diff --git a/Android.mk b/Android.mk index 4d567dfd17c49..61a17f1dd112f 100644 --- a/Android.mk +++ b/Android.mk @@ -38,7 +38,6 @@ LOCAL_SRC_FILES += \ core/java/android/content/EventLogTags.logtags \ core/java/android/speech/tts/EventLogTags.logtags \ core/java/android/webkit/EventLogTags.logtags \ - telephony/java/com/android/internal/telephony/EventLogTags.logtags \ # The following filters out code we are temporarily not including at all. # TODO: Move AWT and beans (and associated harmony code) back into libcore. @@ -71,14 +70,17 @@ LOCAL_SRC_FILES += \ core/java/android/app/IBackupAgent.aidl \ core/java/android/app/IInstrumentationWatcher.aidl \ core/java/android/app/INotificationManager.aidl \ + core/java/android/app/IProfileManager.aidl \ core/java/android/app/IProcessObserver.aidl \ core/java/android/app/ISearchManager.aidl \ core/java/android/app/ISearchManagerCallback.aidl \ core/java/android/app/IServiceConnection.aidl \ + core/java/android/app/IStopUserCallback.aidl \ core/java/android/app/IThumbnailReceiver.aidl \ core/java/android/app/IThumbnailRetriever.aidl \ core/java/android/app/ITransientNotification.aidl \ core/java/android/app/IUiModeManager.aidl \ + core/java/android/app/IUserSwitchObserver.aidl \ core/java/android/app/IWallpaperManager.aidl \ core/java/android/app/IWallpaperManagerCallback.aidl \ core/java/android/app/admin/IDevicePolicyManager.aidl \ @@ -90,7 +92,13 @@ LOCAL_SRC_FILES += \ core/java/android/bluetooth/IBluetoothA2dp.aidl \ core/java/android/bluetooth/IBluetoothCallback.aidl \ core/java/android/bluetooth/IBluetoothHeadset.aidl \ + core/java/android/bluetooth/IBluetoothHeadsetPhone.aidl \ + core/java/android/bluetooth/IBluetoothHealth.aidl \ core/java/android/bluetooth/IBluetoothHealthCallback.aidl \ + core/java/android/bluetooth/IBluetoothInputDevice.aidl \ + core/java/android/bluetooth/IBluetoothPan.aidl \ + core/java/android/bluetooth/IBluetoothManager.aidl \ + core/java/android/bluetooth/IBluetoothManagerCallback.aidl \ core/java/android/bluetooth/IBluetoothPbap.aidl \ core/java/android/bluetooth/IBluetoothStateChangeCallback.aidl \ core/java/android/content/IClipboard.aidl \ @@ -109,6 +117,8 @@ 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/display/IDisplayManagerCallback.aidl \ core/java/android/hardware/input/IInputManager.aidl \ core/java/android/hardware/input/IInputDevicesChangedListener.aidl \ core/java/android/hardware/usb/IUsbManager.aidl \ @@ -133,6 +143,7 @@ LOCAL_SRC_FILES += \ core/java/android/os/IRemoteCallback.aidl \ core/java/android/os/ISchedulingPolicyService.aidl \ core/java/android/os/IUpdateLock.aidl \ + core/java/android/os/IUserManager.aidl \ core/java/android/os/IVibratorService.aidl \ core/java/android/service/dreams/IDreamManager.aidl \ core/java/android/service/dreams/IDreamService.aidl \ @@ -144,6 +155,9 @@ LOCAL_SRC_FILES += \ core/java/android/view/accessibility/IAccessibilityManager.aidl \ core/java/android/view/accessibility/IAccessibilityManagerClient.aidl \ core/java/android/view/IApplicationToken.aidl \ + core/java/android/view/IDisplayContentChangeListener.aidl \ + core/java/android/view/IInputFilter.aidl \ + core/java/android/view/IInputFilterHost.aidl \ core/java/android/view/IOnKeyguardExitResult.aidl \ core/java/android/view/IRotationWatcher.aidl \ core/java/android/view/IWindow.aidl \ @@ -156,6 +170,7 @@ LOCAL_SRC_FILES += \ core/java/com/android/internal/app/IBatteryStats.aidl \ core/java/com/android/internal/app/IUsageStats.aidl \ core/java/com/android/internal/app/IMediaContainerService.aidl \ + core/java/com/android/internal/app/IAssetRedirectionManager.aidl \ core/java/com/android/internal/appwidget/IAppWidgetService.aidl \ core/java/com/android/internal/appwidget/IAppWidgetHost.aidl \ core/java/com/android/internal/backup/IBackupTransport.aidl \ @@ -189,8 +204,8 @@ LOCAL_SRC_FILES += \ location/java/android/location/IGpsStatusProvider.aidl \ location/java/android/location/ILocationListener.aidl \ location/java/android/location/ILocationManager.aidl \ - location/java/android/location/ILocationProvider.aidl \ location/java/android/location/INetInitiatedListener.aidl \ + location/java/com/android/internal/location/ILocationProvider.aidl \ media/java/android/media/IAudioService.aidl \ media/java/android/media/IAudioFocusDispatcher.aidl \ media/java/android/media/IAudioRoutesObserver.aidl \ @@ -204,12 +219,10 @@ LOCAL_SRC_FILES += \ telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl \ telephony/java/com/android/internal/telephony/ITelephony.aidl \ telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl \ - telephony/java/com/android/internal/telephony/IIccPhoneBook.aidl \ - telephony/java/com/android/internal/telephony/ISms.aidl \ telephony/java/com/android/internal/telephony/IWapPushManager.aidl \ + telephony/java/com/android/internal/telephony/IExtendedNetworkService.aidl \ wifi/java/android/net/wifi/IWifiManager.aidl \ wifi/java/android/net/wifi/p2p/IWifiP2pManager.aidl \ - telephony/java/com/android/internal/telephony/IExtendedNetworkService.aidl \ voip/java/android/net/sip/ISipSession.aidl \ voip/java/android/net/sip/ISipSessionListener.aidl \ voip/java/android/net/sip/ISipService.aidl @@ -230,9 +243,6 @@ LOCAL_JAVA_LIBRARIES := bouncycastle core core-junit ext LOCAL_MODULE := framework LOCAL_MODULE_CLASS := JAVA_LIBRARIES -LOCAL_NO_EMMA_INSTRUMENT := true -LOCAL_NO_EMMA_COMPILE := true - # List of classes and interfaces which should be loaded by the Zygote. LOCAL_JAVA_RESOURCE_FILES += $(LOCAL_PATH)/preloaded-classes @@ -262,6 +272,8 @@ aidl_files := \ frameworks/base/core/java/android/accounts/IAccountAuthenticator.aidl \ frameworks/base/core/java/android/accounts/IAccountAuthenticatorResponse.aidl \ frameworks/base/core/java/android/app/Notification.aidl \ + frameworks/base/core/java/android/app/NotificationGroup.aidl \ + frameworks/base/core/java/android/app/Profile.aidl \ frameworks/base/core/java/android/app/PendingIntent.aidl \ frameworks/base/core/java/android/bluetooth/BluetoothDevice.aidl \ frameworks/base/core/java/android/bluetooth/BluetoothHealthAppConfiguration.aidl \ @@ -300,7 +312,11 @@ aidl_files := \ frameworks/base/graphics/java/android/graphics/Rect.aidl \ frameworks/base/graphics/java/android/graphics/Region.aidl \ frameworks/base/location/java/android/location/Criteria.aidl \ + frameworks/base/location/java/android/location/Geofence.aidl \ frameworks/base/location/java/android/location/Location.aidl \ + frameworks/base/location/java/android/location/LocationRequest.aidl \ + frameworks/base/location/java/com/android/internal/location/ProviderProperties.aidl \ + frameworks/base/location/java/com/android/internal/location/ProviderRequest.aidl \ frameworks/base/telephony/java/android/telephony/ServiceState.aidl \ frameworks/base/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl \ frameworks/base/telephony/java/com/android/internal/telephony/ITelephony.aidl \ @@ -339,7 +355,9 @@ include libcore/Docs.mk include external/junit/Common.mk non_base_dirs := \ - ../../external/apache-http/src/org/apache/http + ../../external/apache-http/src/org/apache/http \ + ../opt/telephony/src/java/android/telephony \ + ../opt/telephony/src/java/android/telephony/gsm \ # These are relative to frameworks/base dirs_to_check_apis := \ @@ -390,6 +408,8 @@ framework_docs_LOCAL_JAVA_LIBRARIES := \ core \ ext \ framework \ + mms-common \ + telephony-common \ framework_docs_LOCAL_MODULE_CLASS := JAVA_LIBRARIES framework_docs_LOCAL_DROIDDOC_HTML_DIR := docs/html @@ -413,6 +433,7 @@ framework_docs_LOCAL_DROIDDOC_OPTIONS := \ -since ./frameworks/base/api/14.txt 14 \ -since ./frameworks/base/api/15.txt 15 \ -since ./frameworks/base/api/16.txt 16 \ + -since ./frameworks/base/api/17.txt 17 \ -werror -hide 113 \ -overview $(LOCAL_PATH)/core/java/overview.html @@ -523,7 +544,7 @@ web_docs_sample_code_flags := \ ## SDK version identifiers used in the published docs # major[.minor] version for current SDK. (full releases only) -framework_docs_SDK_VERSION:=4.1 +framework_docs_SDK_VERSION:=4.2 # release version (ie "Release x") (full releases only) framework_docs_SDK_REL_ID:=1 @@ -710,9 +731,6 @@ LOCAL_JAVA_RESOURCE_DIRS := $(ext_res_dirs) LOCAL_MODULE_TAGS := optional LOCAL_MODULE := ext -LOCAL_NO_EMMA_INSTRUMENT := true -LOCAL_NO_EMMA_COMPILE := true - LOCAL_DX_FLAGS := --core-library include $(BUILD_JAVA_LIBRARY) diff --git a/CleanSpec.mk b/CleanSpec.mk index 0d8a7cdace04f..14b36819b6745 100644 --- a/CleanSpec.mk +++ b/CleanSpec.mk @@ -133,6 +133,10 @@ $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framew $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/accessibilityservice/IAccessibilityServiceClientCallback.P) $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/accessibilityservice/IAccessibilityServiceClient.P) $(call add-clean-step, rm -f $(PRODUCT_OUT)/system/media/video/Disco*) +$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates) +$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/ImageProcessing_intermediates) +$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/ImageProcessing2_intermediates) +$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/ImageProcessing_intermediates) # ************************************************ # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST # ************************************************ diff --git a/api/16.txt b/api/16.txt index bc97e814752bf..984b844c1e6d5 100644 --- a/api/16.txt +++ b/api/16.txt @@ -7324,7 +7324,6 @@ package android.database { method public void prepareForInsert(); method public void prepareForReplace(); method public long replace(android.content.ContentValues); - field public static final int TABLE_INFO_PRAGMA_DEFAULT_INDEX = 4; // 0x4 } public final class DefaultDatabaseErrorHandler implements android.database.DatabaseErrorHandler { @@ -15991,7 +15990,7 @@ package android.os { field public static final int PATTERN_SIMPLE_GLOB = 2; // 0x2 } - public class PowerManager { + public final class PowerManager { method public void goToSleep(long); method public boolean isScreenOn(); method public android.os.PowerManager.WakeLock newWakeLock(int, java.lang.String); @@ -16005,7 +16004,7 @@ package android.os { field public static final int SCREEN_DIM_WAKE_LOCK = 6; // 0x6 } - public class PowerManager.WakeLock { + public final class PowerManager.WakeLock { method public void acquire(); method public void acquire(long); method public boolean isHeld(); @@ -22893,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/17.txt b/api/17.txt new file mode 100644 index 0000000000000..6b893d52372ef --- /dev/null +++ b/api/17.txt @@ -0,0 +1,48901 @@ +package android { + + public final class Manifest { + ctor public Manifest(); + } + + public static final class Manifest.permission { + ctor public Manifest.permission(); + field public static final java.lang.String ACCESS_CHECKIN_PROPERTIES = "android.permission.ACCESS_CHECKIN_PROPERTIES"; + field public static final java.lang.String ACCESS_COARSE_LOCATION = "android.permission.ACCESS_COARSE_LOCATION"; + field public static final java.lang.String ACCESS_FINE_LOCATION = "android.permission.ACCESS_FINE_LOCATION"; + field public static final java.lang.String ACCESS_LOCATION_EXTRA_COMMANDS = "android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"; + field public static final java.lang.String ACCESS_MOCK_LOCATION = "android.permission.ACCESS_MOCK_LOCATION"; + field public static final java.lang.String ACCESS_NETWORK_STATE = "android.permission.ACCESS_NETWORK_STATE"; + field public static final java.lang.String ACCESS_SURFACE_FLINGER = "android.permission.ACCESS_SURFACE_FLINGER"; + field public static final java.lang.String ACCESS_WIFI_STATE = "android.permission.ACCESS_WIFI_STATE"; + field public static final java.lang.String ACCOUNT_MANAGER = "android.permission.ACCOUNT_MANAGER"; + field public static final java.lang.String ADD_VOICEMAIL = "com.android.voicemail.permission.ADD_VOICEMAIL"; + field public static final java.lang.String AUTHENTICATE_ACCOUNTS = "android.permission.AUTHENTICATE_ACCOUNTS"; + field public static final java.lang.String BATTERY_STATS = "android.permission.BATTERY_STATS"; + field public static final java.lang.String BIND_ACCESSIBILITY_SERVICE = "android.permission.BIND_ACCESSIBILITY_SERVICE"; + field public static final java.lang.String BIND_APPWIDGET = "android.permission.BIND_APPWIDGET"; + field public static final java.lang.String BIND_DEVICE_ADMIN = "android.permission.BIND_DEVICE_ADMIN"; + field public static final java.lang.String BIND_INPUT_METHOD = "android.permission.BIND_INPUT_METHOD"; + field public static final java.lang.String BIND_REMOTEVIEWS = "android.permission.BIND_REMOTEVIEWS"; + field public static final java.lang.String BIND_TEXT_SERVICE = "android.permission.BIND_TEXT_SERVICE"; + field public static final java.lang.String BIND_VPN_SERVICE = "android.permission.BIND_VPN_SERVICE"; + field public static final java.lang.String BIND_WALLPAPER = "android.permission.BIND_WALLPAPER"; + field public static final java.lang.String BLUETOOTH = "android.permission.BLUETOOTH"; + field public static final java.lang.String BLUETOOTH_ADMIN = "android.permission.BLUETOOTH_ADMIN"; + field public static final java.lang.String BRICK = "android.permission.BRICK"; + field public static final java.lang.String BROADCAST_PACKAGE_REMOVED = "android.permission.BROADCAST_PACKAGE_REMOVED"; + field public static final java.lang.String BROADCAST_SMS = "android.permission.BROADCAST_SMS"; + field public static final java.lang.String BROADCAST_STICKY = "android.permission.BROADCAST_STICKY"; + field public static final java.lang.String BROADCAST_WAP_PUSH = "android.permission.BROADCAST_WAP_PUSH"; + field public static final java.lang.String CALL_PHONE = "android.permission.CALL_PHONE"; + field public static final java.lang.String CALL_PRIVILEGED = "android.permission.CALL_PRIVILEGED"; + field public static final java.lang.String CAMERA = "android.permission.CAMERA"; + field public static final java.lang.String CHANGE_COMPONENT_ENABLED_STATE = "android.permission.CHANGE_COMPONENT_ENABLED_STATE"; + field public static final java.lang.String CHANGE_CONFIGURATION = "android.permission.CHANGE_CONFIGURATION"; + field public static final java.lang.String CHANGE_NETWORK_STATE = "android.permission.CHANGE_NETWORK_STATE"; + field public static final java.lang.String CHANGE_WIFI_MULTICAST_STATE = "android.permission.CHANGE_WIFI_MULTICAST_STATE"; + field public static final java.lang.String CHANGE_WIFI_STATE = "android.permission.CHANGE_WIFI_STATE"; + field public static final java.lang.String CLEAR_APP_CACHE = "android.permission.CLEAR_APP_CACHE"; + field public static final java.lang.String CLEAR_APP_USER_DATA = "android.permission.CLEAR_APP_USER_DATA"; + field public static final java.lang.String CONTROL_LOCATION_UPDATES = "android.permission.CONTROL_LOCATION_UPDATES"; + field public static final java.lang.String DELETE_CACHE_FILES = "android.permission.DELETE_CACHE_FILES"; + field public static final java.lang.String DELETE_PACKAGES = "android.permission.DELETE_PACKAGES"; + field public static final java.lang.String DEVICE_POWER = "android.permission.DEVICE_POWER"; + field public static final java.lang.String DIAGNOSTIC = "android.permission.DIAGNOSTIC"; + field public static final java.lang.String DISABLE_KEYGUARD = "android.permission.DISABLE_KEYGUARD"; + field public static final java.lang.String DUMP = "android.permission.DUMP"; + field public static final java.lang.String EXPAND_STATUS_BAR = "android.permission.EXPAND_STATUS_BAR"; + field public static final java.lang.String FACTORY_TEST = "android.permission.FACTORY_TEST"; + field public static final java.lang.String FLASHLIGHT = "android.permission.FLASHLIGHT"; + field public static final java.lang.String FORCE_BACK = "android.permission.FORCE_BACK"; + field public static final java.lang.String GET_ACCOUNTS = "android.permission.GET_ACCOUNTS"; + field public static final java.lang.String GET_PACKAGE_SIZE = "android.permission.GET_PACKAGE_SIZE"; + field public static final java.lang.String GET_TASKS = "android.permission.GET_TASKS"; + field public static final java.lang.String GLOBAL_SEARCH = "android.permission.GLOBAL_SEARCH"; + field public static final java.lang.String HARDWARE_TEST = "android.permission.HARDWARE_TEST"; + field public static final java.lang.String INJECT_EVENTS = "android.permission.INJECT_EVENTS"; + field public static final java.lang.String INSTALL_LOCATION_PROVIDER = "android.permission.INSTALL_LOCATION_PROVIDER"; + field public static final java.lang.String INSTALL_PACKAGES = "android.permission.INSTALL_PACKAGES"; + field public static final java.lang.String INTERNAL_SYSTEM_WINDOW = "android.permission.INTERNAL_SYSTEM_WINDOW"; + field public static final java.lang.String INTERNET = "android.permission.INTERNET"; + field public static final java.lang.String KILL_BACKGROUND_PROCESSES = "android.permission.KILL_BACKGROUND_PROCESSES"; + field public static final java.lang.String MANAGE_ACCOUNTS = "android.permission.MANAGE_ACCOUNTS"; + field public static final java.lang.String MANAGE_APP_TOKENS = "android.permission.MANAGE_APP_TOKENS"; + field public static final java.lang.String MASTER_CLEAR = "android.permission.MASTER_CLEAR"; + field public static final java.lang.String MODIFY_AUDIO_SETTINGS = "android.permission.MODIFY_AUDIO_SETTINGS"; + field public static final java.lang.String MODIFY_PHONE_STATE = "android.permission.MODIFY_PHONE_STATE"; + field public static final java.lang.String MOUNT_FORMAT_FILESYSTEMS = "android.permission.MOUNT_FORMAT_FILESYSTEMS"; + field public static final java.lang.String MOUNT_UNMOUNT_FILESYSTEMS = "android.permission.MOUNT_UNMOUNT_FILESYSTEMS"; + field public static final java.lang.String NFC = "android.permission.NFC"; + field public static final deprecated java.lang.String PERSISTENT_ACTIVITY = "android.permission.PERSISTENT_ACTIVITY"; + field public static final java.lang.String PROCESS_OUTGOING_CALLS = "android.permission.PROCESS_OUTGOING_CALLS"; + field public static final java.lang.String READ_CALENDAR = "android.permission.READ_CALENDAR"; + field public static final java.lang.String READ_CALL_LOG = "android.permission.READ_CALL_LOG"; + field public static final java.lang.String READ_CONTACTS = "android.permission.READ_CONTACTS"; + field public static final java.lang.String READ_EXTERNAL_STORAGE = "android.permission.READ_EXTERNAL_STORAGE"; + field public static final java.lang.String READ_FRAME_BUFFER = "android.permission.READ_FRAME_BUFFER"; + field public static final java.lang.String READ_HISTORY_BOOKMARKS = "com.android.browser.permission.READ_HISTORY_BOOKMARKS"; + field public static final deprecated java.lang.String READ_INPUT_STATE = "android.permission.READ_INPUT_STATE"; + field public static final java.lang.String READ_LOGS = "android.permission.READ_LOGS"; + field public static final java.lang.String READ_PHONE_STATE = "android.permission.READ_PHONE_STATE"; + field public static final java.lang.String READ_PROFILE = "android.permission.READ_PROFILE"; + field public static final java.lang.String READ_SMS = "android.permission.READ_SMS"; + field public static final java.lang.String READ_SOCIAL_STREAM = "android.permission.READ_SOCIAL_STREAM"; + field public static final java.lang.String READ_SYNC_SETTINGS = "android.permission.READ_SYNC_SETTINGS"; + field public static final java.lang.String READ_SYNC_STATS = "android.permission.READ_SYNC_STATS"; + field public static final java.lang.String READ_USER_DICTIONARY = "android.permission.READ_USER_DICTIONARY"; + field public static final java.lang.String REBOOT = "android.permission.REBOOT"; + field public static final java.lang.String RECEIVE_BOOT_COMPLETED = "android.permission.RECEIVE_BOOT_COMPLETED"; + field public static final java.lang.String RECEIVE_MMS = "android.permission.RECEIVE_MMS"; + field public static final java.lang.String RECEIVE_SMS = "android.permission.RECEIVE_SMS"; + field public static final java.lang.String RECEIVE_WAP_PUSH = "android.permission.RECEIVE_WAP_PUSH"; + field public static final java.lang.String RECORD_AUDIO = "android.permission.RECORD_AUDIO"; + field public static final java.lang.String REORDER_TASKS = "android.permission.REORDER_TASKS"; + field public static final deprecated java.lang.String RESTART_PACKAGES = "android.permission.RESTART_PACKAGES"; + field public static final java.lang.String SEND_SMS = "android.permission.SEND_SMS"; + field public static final java.lang.String SET_ACTIVITY_WATCHER = "android.permission.SET_ACTIVITY_WATCHER"; + field public static final java.lang.String SET_ALARM = "com.android.alarm.permission.SET_ALARM"; + field public static final java.lang.String SET_ALWAYS_FINISH = "android.permission.SET_ALWAYS_FINISH"; + field public static final java.lang.String SET_ANIMATION_SCALE = "android.permission.SET_ANIMATION_SCALE"; + field public static final java.lang.String SET_DEBUG_APP = "android.permission.SET_DEBUG_APP"; + field public static final java.lang.String SET_ORIENTATION = "android.permission.SET_ORIENTATION"; + field public static final java.lang.String SET_POINTER_SPEED = "android.permission.SET_POINTER_SPEED"; + field public static final deprecated java.lang.String SET_PREFERRED_APPLICATIONS = "android.permission.SET_PREFERRED_APPLICATIONS"; + field public static final java.lang.String SET_PROCESS_LIMIT = "android.permission.SET_PROCESS_LIMIT"; + field public static final java.lang.String SET_TIME = "android.permission.SET_TIME"; + field public static final java.lang.String SET_TIME_ZONE = "android.permission.SET_TIME_ZONE"; + field public static final java.lang.String SET_WALLPAPER = "android.permission.SET_WALLPAPER"; + field public static final java.lang.String SET_WALLPAPER_HINTS = "android.permission.SET_WALLPAPER_HINTS"; + field public static final java.lang.String SIGNAL_PERSISTENT_PROCESSES = "android.permission.SIGNAL_PERSISTENT_PROCESSES"; + field public static final java.lang.String STATUS_BAR = "android.permission.STATUS_BAR"; + field public static final java.lang.String SUBSCRIBED_FEEDS_READ = "android.permission.SUBSCRIBED_FEEDS_READ"; + field public static final java.lang.String SUBSCRIBED_FEEDS_WRITE = "android.permission.SUBSCRIBED_FEEDS_WRITE"; + field public static final java.lang.String SYSTEM_ALERT_WINDOW = "android.permission.SYSTEM_ALERT_WINDOW"; + field public static final java.lang.String UPDATE_DEVICE_STATS = "android.permission.UPDATE_DEVICE_STATS"; + field public static final java.lang.String USE_CREDENTIALS = "android.permission.USE_CREDENTIALS"; + field public static final java.lang.String USE_SIP = "android.permission.USE_SIP"; + field public static final java.lang.String VIBRATE = "android.permission.VIBRATE"; + field public static final java.lang.String WAKE_LOCK = "android.permission.WAKE_LOCK"; + field public static final java.lang.String WRITE_APN_SETTINGS = "android.permission.WRITE_APN_SETTINGS"; + field public static final java.lang.String WRITE_CALENDAR = "android.permission.WRITE_CALENDAR"; + field public static final java.lang.String WRITE_CALL_LOG = "android.permission.WRITE_CALL_LOG"; + field public static final java.lang.String WRITE_CONTACTS = "android.permission.WRITE_CONTACTS"; + field public static final java.lang.String WRITE_EXTERNAL_STORAGE = "android.permission.WRITE_EXTERNAL_STORAGE"; + field public static final java.lang.String WRITE_GSERVICES = "android.permission.WRITE_GSERVICES"; + field public static final java.lang.String WRITE_HISTORY_BOOKMARKS = "com.android.browser.permission.WRITE_HISTORY_BOOKMARKS"; + field public static final java.lang.String WRITE_PROFILE = "android.permission.WRITE_PROFILE"; + field public static final java.lang.String WRITE_SECURE_SETTINGS = "android.permission.WRITE_SECURE_SETTINGS"; + field public static final java.lang.String WRITE_SETTINGS = "android.permission.WRITE_SETTINGS"; + field public static final java.lang.String WRITE_SMS = "android.permission.WRITE_SMS"; + field public static final java.lang.String WRITE_SOCIAL_STREAM = "android.permission.WRITE_SOCIAL_STREAM"; + field public static final java.lang.String WRITE_SYNC_SETTINGS = "android.permission.WRITE_SYNC_SETTINGS"; + field public static final java.lang.String WRITE_USER_DICTIONARY = "android.permission.WRITE_USER_DICTIONARY"; + } + + public static final class Manifest.permission_group { + ctor public Manifest.permission_group(); + field public static final java.lang.String ACCOUNTS = "android.permission-group.ACCOUNTS"; + field public static final java.lang.String AFFECTS_BATTERY = "android.permission-group.AFFECTS_BATTERY"; + field public static final java.lang.String APP_INFO = "android.permission-group.APP_INFO"; + field public static final java.lang.String AUDIO_SETTINGS = "android.permission-group.AUDIO_SETTINGS"; + field public static final java.lang.String BLUETOOTH_NETWORK = "android.permission-group.BLUETOOTH_NETWORK"; + field public static final java.lang.String BOOKMARKS = "android.permission-group.BOOKMARKS"; + field public static final java.lang.String CALENDAR = "android.permission-group.CALENDAR"; + field public static final java.lang.String CAMERA = "android.permission-group.CAMERA"; + field public static final java.lang.String COST_MONEY = "android.permission-group.COST_MONEY"; + field public static final java.lang.String DEVELOPMENT_TOOLS = "android.permission-group.DEVELOPMENT_TOOLS"; + field public static final java.lang.String DEVICE_ALARMS = "android.permission-group.DEVICE_ALARMS"; + field public static final java.lang.String DISPLAY = "android.permission-group.DISPLAY"; + field public static final java.lang.String HARDWARE_CONTROLS = "android.permission-group.HARDWARE_CONTROLS"; + field public static final java.lang.String LOCATION = "android.permission-group.LOCATION"; + field public static final java.lang.String MESSAGES = "android.permission-group.MESSAGES"; + field public static final java.lang.String MICROPHONE = "android.permission-group.MICROPHONE"; + field public static final java.lang.String NETWORK = "android.permission-group.NETWORK"; + field public static final java.lang.String PERSONAL_INFO = "android.permission-group.PERSONAL_INFO"; + field public static final java.lang.String PHONE_CALLS = "android.permission-group.PHONE_CALLS"; + field public static final java.lang.String SCREENLOCK = "android.permission-group.SCREENLOCK"; + field public static final java.lang.String SOCIAL_INFO = "android.permission-group.SOCIAL_INFO"; + field public static final java.lang.String STATUS_BAR = "android.permission-group.STATUS_BAR"; + field public static final java.lang.String STORAGE = "android.permission-group.STORAGE"; + field public static final java.lang.String SYNC_SETTINGS = "android.permission-group.SYNC_SETTINGS"; + field public static final java.lang.String SYSTEM_CLOCK = "android.permission-group.SYSTEM_CLOCK"; + field public static final java.lang.String SYSTEM_TOOLS = "android.permission-group.SYSTEM_TOOLS"; + field public static final java.lang.String USER_DICTIONARY = "android.permission-group.USER_DICTIONARY"; + field public static final java.lang.String VOICEMAIL = "android.permission-group.VOICEMAIL"; + field public static final java.lang.String WALLPAPER = "android.permission-group.WALLPAPER"; + field public static final java.lang.String WRITE_USER_DICTIONARY = "android.permission-group.WRITE_USER_DICTIONARY"; + } + + public final class R { + ctor public R(); + } + + public static final class R.anim { + ctor public R.anim(); + field public static final int accelerate_decelerate_interpolator = 17432580; // 0x10a0004 + field public static final int accelerate_interpolator = 17432581; // 0x10a0005 + field public static final int anticipate_interpolator = 17432583; // 0x10a0007 + field public static final int anticipate_overshoot_interpolator = 17432585; // 0x10a0009 + field public static final int bounce_interpolator = 17432586; // 0x10a000a + field public static final int cycle_interpolator = 17432588; // 0x10a000c + field public static final int decelerate_interpolator = 17432582; // 0x10a0006 + field public static final int fade_in = 17432576; // 0x10a0000 + field public static final int fade_out = 17432577; // 0x10a0001 + field public static final int linear_interpolator = 17432587; // 0x10a000b + field public static final int overshoot_interpolator = 17432584; // 0x10a0008 + field public static final int slide_in_left = 17432578; // 0x10a0002 + field public static final int slide_out_right = 17432579; // 0x10a0003 + } + + public static final class R.animator { + ctor public R.animator(); + field public static final int fade_in = 17498112; // 0x10b0000 + field public static final int fade_out = 17498113; // 0x10b0001 + } + + public static final class R.array { + ctor public R.array(); + field public static final int emailAddressTypes = 17235968; // 0x1070000 + field public static final int imProtocols = 17235969; // 0x1070001 + field public static final int organizationTypes = 17235970; // 0x1070002 + field public static final int phoneTypes = 17235971; // 0x1070003 + field public static final int postalAddressTypes = 17235972; // 0x1070004 + } + + public static final class R.attr { + ctor public R.attr(); + field public static final int absListViewStyle = 16842858; // 0x101006a + field public static final int accessibilityEventTypes = 16843648; // 0x1010380 + field public static final int accessibilityFeedbackType = 16843650; // 0x1010382 + field public static final int accessibilityFlags = 16843652; // 0x1010384 + field public static final int accountPreferences = 16843423; // 0x101029f + field public static final int accountType = 16843407; // 0x101028f + field public static final int action = 16842797; // 0x101002d + field public static final int actionBarDivider = 16843675; // 0x101039b + field public static final int actionBarItemBackground = 16843676; // 0x101039c + field public static final int actionBarSize = 16843499; // 0x10102eb + field public static final int actionBarSplitStyle = 16843656; // 0x1010388 + field public static final int actionBarStyle = 16843470; // 0x10102ce + field public static final int actionBarTabBarStyle = 16843508; // 0x10102f4 + field public static final int actionBarTabStyle = 16843507; // 0x10102f3 + field public static final int actionBarTabTextStyle = 16843509; // 0x10102f5 + field public static final int actionBarWidgetTheme = 16843671; // 0x1010397 + field public static final int actionButtonStyle = 16843480; // 0x10102d8 + field public static final int actionDropDownStyle = 16843479; // 0x10102d7 + field public static final int actionLayout = 16843515; // 0x10102fb + field public static final int actionMenuTextAppearance = 16843616; // 0x1010360 + field public static final int actionMenuTextColor = 16843617; // 0x1010361 + field public static final int actionModeBackground = 16843483; // 0x10102db + field public static final int actionModeCloseButtonStyle = 16843511; // 0x10102f7 + field public static final int actionModeCloseDrawable = 16843484; // 0x10102dc + field public static final int actionModeCopyDrawable = 16843538; // 0x1010312 + field public static final int actionModeCutDrawable = 16843537; // 0x1010311 + field public static final int actionModePasteDrawable = 16843539; // 0x1010313 + field public static final int actionModeSelectAllDrawable = 16843646; // 0x101037e + field public static final int actionModeSplitBackground = 16843677; // 0x101039d + field public static final int actionModeStyle = 16843668; // 0x1010394 + field public static final int actionOverflowButtonStyle = 16843510; // 0x10102f6 + field public static final int actionProviderClass = 16843657; // 0x1010389 + field public static final int actionViewClass = 16843516; // 0x10102fc + field public static final int activatedBackgroundIndicator = 16843517; // 0x10102fd + field public static final int activityCloseEnterAnimation = 16842938; // 0x10100ba + field public static final int activityCloseExitAnimation = 16842939; // 0x10100bb + field public static final int activityOpenEnterAnimation = 16842936; // 0x10100b8 + field public static final int activityOpenExitAnimation = 16842937; // 0x10100b9 + field public static final int addStatesFromChildren = 16842992; // 0x10100f0 + field public static final int adjustViewBounds = 16843038; // 0x101011e + field public static final int alertDialogIcon = 16843605; // 0x1010355 + field public static final int alertDialogStyle = 16842845; // 0x101005d + field public static final int alertDialogTheme = 16843529; // 0x1010309 + field public static final int alignmentMode = 16843642; // 0x101037a + field public static final int allContactsName = 16843468; // 0x10102cc + field public static final int allowBackup = 16843392; // 0x1010280 + field public static final int allowClearUserData = 16842757; // 0x1010005 + field public static final int allowParallelSyncs = 16843570; // 0x1010332 + field public static final int allowSingleTap = 16843353; // 0x1010259 + field public static final int allowTaskReparenting = 16843268; // 0x1010204 + field public static final int alpha = 16843551; // 0x101031f + field public static final int alphabeticShortcut = 16843235; // 0x10101e3 + field public static final int alwaysDrawnWithCache = 16842991; // 0x10100ef + field public static final int alwaysRetainTaskState = 16843267; // 0x1010203 + field public static final int angle = 16843168; // 0x10101a0 + field public static final int animateFirstView = 16843477; // 0x10102d5 + field public static final int animateLayoutChanges = 16843506; // 0x10102f2 + field public static final int animateOnClick = 16843356; // 0x101025c + field public static final int animation = 16843213; // 0x10101cd + field public static final int animationCache = 16842989; // 0x10100ed + field public static final int animationDuration = 16843026; // 0x1010112 + field public static final int animationOrder = 16843214; // 0x10101ce + field public static final deprecated int animationResolution = 16843546; // 0x101031a + field public static final int antialias = 16843034; // 0x101011a + field public static final int anyDensity = 16843372; // 0x101026c + field public static final int apiKey = 16843281; // 0x1010211 + field public static final int author = 16843444; // 0x10102b4 + field public static final int authorities = 16842776; // 0x1010018 + field public static final int autoAdvanceViewId = 16843535; // 0x101030f + field public static final int autoCompleteTextViewStyle = 16842859; // 0x101006b + field public static final int autoLink = 16842928; // 0x10100b0 + field public static final int autoStart = 16843445; // 0x10102b5 + field public static final deprecated int autoText = 16843114; // 0x101016a + field public static final int autoUrlDetect = 16843404; // 0x101028c + field public static final int background = 16842964; // 0x10100d4 + field public static final int backgroundDimAmount = 16842802; // 0x1010032 + field public static final int backgroundDimEnabled = 16843295; // 0x101021f + field public static final int backgroundSplit = 16843659; // 0x101038b + field public static final int backgroundStacked = 16843658; // 0x101038a + field public static final int backupAgent = 16843391; // 0x101027f + field public static final int baseline = 16843548; // 0x101031c + field public static final int baselineAlignBottom = 16843042; // 0x1010122 + field public static final int baselineAligned = 16843046; // 0x1010126 + field public static final int baselineAlignedChildIndex = 16843047; // 0x1010127 + field public static final int borderlessButtonStyle = 16843563; // 0x101032b + field public static final int bottom = 16843184; // 0x10101b0 + field public static final int bottomBright = 16842957; // 0x10100cd + field public static final int bottomDark = 16842953; // 0x10100c9 + field public static final int bottomLeftRadius = 16843179; // 0x10101ab + field public static final int bottomMedium = 16842958; // 0x10100ce + field public static final int bottomOffset = 16843351; // 0x1010257 + field public static final int bottomRightRadius = 16843180; // 0x10101ac + field public static final int breadCrumbShortTitle = 16843524; // 0x1010304 + field public static final int breadCrumbTitle = 16843523; // 0x1010303 + field public static final int bufferType = 16843086; // 0x101014e + field public static final int button = 16843015; // 0x1010107 + field public static final int buttonBarButtonStyle = 16843567; // 0x101032f + field public static final int buttonBarStyle = 16843566; // 0x101032e + field public static final int buttonStyle = 16842824; // 0x1010048 + field public static final int buttonStyleInset = 16842826; // 0x101004a + field public static final int buttonStyleSmall = 16842825; // 0x1010049 + field public static final int buttonStyleToggle = 16842827; // 0x101004b + field public static final int cacheColorHint = 16843009; // 0x1010101 + field public static final int calendarViewShown = 16843596; // 0x101034c + field public static final int calendarViewStyle = 16843613; // 0x101035d + field public static final int canRetrieveWindowContent = 16843653; // 0x1010385 + field public static final int candidatesTextStyleSpans = 16843312; // 0x1010230 + field public static final deprecated int capitalize = 16843113; // 0x1010169 + field public static final int centerBright = 16842956; // 0x10100cc + field public static final int centerColor = 16843275; // 0x101020b + field public static final int centerDark = 16842952; // 0x10100c8 + field public static final int centerMedium = 16842959; // 0x10100cf + field public static final int centerX = 16843170; // 0x10101a2 + field public static final int centerY = 16843171; // 0x10101a3 + field public static final int checkBoxPreferenceStyle = 16842895; // 0x101008f + field public static final int checkMark = 16843016; // 0x1010108 + field public static final int checkable = 16843237; // 0x10101e5 + field public static final int checkableBehavior = 16843232; // 0x10101e0 + field public static final int checkboxStyle = 16842860; // 0x101006c + field public static final int checked = 16843014; // 0x1010106 + field public static final int checkedButton = 16843080; // 0x1010148 + field public static final int checkedTextViewStyle = 16843720; // 0x10103c8 + field public static final int childDivider = 16843025; // 0x1010111 + field public static final int childIndicator = 16843020; // 0x101010c + field public static final int childIndicatorLeft = 16843023; // 0x101010f + field public static final int childIndicatorRight = 16843024; // 0x1010110 + field public static final int choiceMode = 16843051; // 0x101012b + field public static final int clearTaskOnLaunch = 16842773; // 0x1010015 + field public static final int clickable = 16842981; // 0x10100e5 + field public static final int clipChildren = 16842986; // 0x10100ea + field public static final int clipOrientation = 16843274; // 0x101020a + field public static final int clipToPadding = 16842987; // 0x10100eb + field public static final int codes = 16843330; // 0x1010242 + field public static final int collapseColumns = 16843083; // 0x101014b + field public static final int color = 16843173; // 0x10101a5 + field public static final int colorActivatedHighlight = 16843664; // 0x1010390 + field public static final int colorBackground = 16842801; // 0x1010031 + field public static final int colorBackgroundCacheHint = 16843435; // 0x10102ab + field public static final int colorFocusedHighlight = 16843663; // 0x101038f + field public static final int colorForeground = 16842800; // 0x1010030 + field public static final int colorForegroundInverse = 16843270; // 0x1010206 + field public static final int colorLongPressedHighlight = 16843662; // 0x101038e + field public static final int colorMultiSelectHighlight = 16843665; // 0x1010391 + field public static final int colorPressedHighlight = 16843661; // 0x101038d + field public static final int columnCount = 16843639; // 0x1010377 + field public static final int columnDelay = 16843215; // 0x10101cf + field public static final int columnOrderPreserved = 16843640; // 0x1010378 + field public static final int columnWidth = 16843031; // 0x1010117 + field public static final int compatibleWidthLimitDp = 16843621; // 0x1010365 + field public static final int completionHint = 16843122; // 0x1010172 + field public static final int completionHintView = 16843123; // 0x1010173 + field public static final int completionThreshold = 16843124; // 0x1010174 + field public static final int configChanges = 16842783; // 0x101001f + field public static final int configure = 16843357; // 0x101025d + field public static final int constantSize = 16843158; // 0x1010196 + field public static final int content = 16843355; // 0x101025b + field public static final int contentAuthority = 16843408; // 0x1010290 + field public static final int contentDescription = 16843379; // 0x1010273 + field public static final int cropToPadding = 16843043; // 0x1010123 + field public static final int cursorVisible = 16843090; // 0x1010152 + field public static final int customNavigationLayout = 16843474; // 0x10102d2 + field public static final int customTokens = 16843579; // 0x101033b + field public static final int cycles = 16843220; // 0x10101d4 + field public static final int dashGap = 16843175; // 0x10101a7 + field public static final int dashWidth = 16843174; // 0x10101a6 + field public static final int data = 16842798; // 0x101002e + field public static final int datePickerStyle = 16843612; // 0x101035c + field public static final int dateTextAppearance = 16843593; // 0x1010349 + field public static final int debuggable = 16842767; // 0x101000f + field public static final int defaultValue = 16843245; // 0x10101ed + field public static final int delay = 16843212; // 0x10101cc + field public static final int dependency = 16843244; // 0x10101ec + field public static final int descendantFocusability = 16842993; // 0x10100f1 + field public static final int description = 16842784; // 0x1010020 + field public static final int detachWallpaper = 16843430; // 0x10102a6 + field public static final int detailColumn = 16843427; // 0x10102a3 + field public static final int detailSocialSummary = 16843428; // 0x10102a4 + field public static final int detailsElementBackground = 16843598; // 0x101034e + field public static final int dial = 16843010; // 0x1010102 + field public static final int dialogIcon = 16843252; // 0x10101f4 + field public static final int dialogLayout = 16843255; // 0x10101f7 + field public static final int dialogMessage = 16843251; // 0x10101f3 + field public static final int dialogPreferenceStyle = 16842897; // 0x1010091 + field public static final int dialogTheme = 16843528; // 0x1010308 + field public static final int dialogTitle = 16843250; // 0x10101f2 + field public static final int digits = 16843110; // 0x1010166 + field public static final int direction = 16843217; // 0x10101d1 + field public static final int directionDescriptions = 16843681; // 0x10103a1 + field public static final int directionPriority = 16843218; // 0x10101d2 + field public static final int disableDependentsState = 16843249; // 0x10101f1 + field public static final int disabledAlpha = 16842803; // 0x1010033 + field public static final int displayOptions = 16843472; // 0x10102d0 + field public static final int dither = 16843036; // 0x101011c + field public static final int divider = 16843049; // 0x1010129 + field public static final int dividerHeight = 16843050; // 0x101012a + field public static final int dividerHorizontal = 16843564; // 0x101032c + field public static final int dividerPadding = 16843562; // 0x101032a + field public static final int dividerVertical = 16843530; // 0x101030a + field public static final int drawSelectorOnTop = 16843004; // 0x10100fc + field public static final int drawable = 16843161; // 0x1010199 + field public static final int drawableBottom = 16843118; // 0x101016e + field public static final int drawableEnd = 16843667; // 0x1010393 + field public static final int drawableLeft = 16843119; // 0x101016f + field public static final int drawablePadding = 16843121; // 0x1010171 + field public static final int drawableRight = 16843120; // 0x1010170 + field public static final int drawableStart = 16843666; // 0x1010392 + field public static final int drawableTop = 16843117; // 0x101016d + field public static final int drawingCacheQuality = 16842984; // 0x10100e8 + field public static final int dropDownAnchor = 16843363; // 0x1010263 + field public static final int dropDownHeight = 16843395; // 0x1010283 + field public static final int dropDownHintAppearance = 16842888; // 0x1010088 + field public static final int dropDownHorizontalOffset = 16843436; // 0x10102ac + field public static final int dropDownItemStyle = 16842886; // 0x1010086 + field public static final int dropDownListViewStyle = 16842861; // 0x101006d + field public static final int dropDownSelector = 16843125; // 0x1010175 + field public static final int dropDownSpinnerStyle = 16843478; // 0x10102d6 + field public static final int dropDownVerticalOffset = 16843437; // 0x10102ad + field public static final int dropDownWidth = 16843362; // 0x1010262 + field public static final int duplicateParentState = 16842985; // 0x10100e9 + field public static final int duration = 16843160; // 0x1010198 + field public static final int editTextBackground = 16843602; // 0x1010352 + field public static final int editTextColor = 16843601; // 0x1010351 + field public static final int editTextPreferenceStyle = 16842898; // 0x1010092 + field public static final int editTextStyle = 16842862; // 0x101006e + field public static final deprecated int editable = 16843115; // 0x101016b + field public static final int editorExtras = 16843300; // 0x1010224 + field public static final int ellipsize = 16842923; // 0x10100ab + field public static final int ems = 16843096; // 0x1010158 + field public static final int enabled = 16842766; // 0x101000e + field public static final int endColor = 16843166; // 0x101019e + field public static final deprecated int endYear = 16843133; // 0x101017d + field public static final int enterFadeDuration = 16843532; // 0x101030c + field public static final int entries = 16842930; // 0x10100b2 + field public static final int entryValues = 16843256; // 0x10101f8 + field public static final int eventsInterceptionEnabled = 16843389; // 0x101027d + field public static final int excludeFromRecents = 16842775; // 0x1010017 + field public static final int exitFadeDuration = 16843533; // 0x101030d + field public static final int expandableListPreferredChildIndicatorLeft = 16842834; // 0x1010052 + field public static final int expandableListPreferredChildIndicatorRight = 16842835; // 0x1010053 + field public static final int expandableListPreferredChildPaddingLeft = 16842831; // 0x101004f + field public static final int expandableListPreferredItemIndicatorLeft = 16842832; // 0x1010050 + field public static final int expandableListPreferredItemIndicatorRight = 16842833; // 0x1010051 + field public static final int expandableListPreferredItemPaddingLeft = 16842830; // 0x101004e + field public static final int expandableListViewStyle = 16842863; // 0x101006f + field public static final int expandableListViewWhiteStyle = 16843446; // 0x10102b6 + field public static final int exported = 16842768; // 0x1010010 + field public static final int extraTension = 16843371; // 0x101026b + field public static final int factor = 16843219; // 0x10101d3 + field public static final int fadeDuration = 16843384; // 0x1010278 + field public static final int fadeEnabled = 16843390; // 0x101027e + field public static final int fadeOffset = 16843383; // 0x1010277 + field public static final int fadeScrollbars = 16843434; // 0x10102aa + field public static final int fadingEdge = 16842975; // 0x10100df + field public static final int fadingEdgeLength = 16842976; // 0x10100e0 + field public static final int fastScrollAlwaysVisible = 16843573; // 0x1010335 + field public static final int fastScrollEnabled = 16843302; // 0x1010226 + field public static final int fastScrollOverlayPosition = 16843578; // 0x101033a + field public static final int fastScrollPreviewBackgroundLeft = 16843575; // 0x1010337 + field public static final int fastScrollPreviewBackgroundRight = 16843576; // 0x1010338 + field public static final int fastScrollTextColor = 16843609; // 0x1010359 + field public static final int fastScrollThumbDrawable = 16843574; // 0x1010336 + field public static final int fastScrollTrackDrawable = 16843577; // 0x1010339 + field public static final int fillAfter = 16843197; // 0x10101bd + field public static final int fillBefore = 16843196; // 0x10101bc + field public static final int fillEnabled = 16843343; // 0x101024f + field public static final int fillViewport = 16843130; // 0x101017a + field public static final int filter = 16843035; // 0x101011b + field public static final int filterTouchesWhenObscured = 16843460; // 0x10102c4 + field public static final int finishOnCloseSystemDialogs = 16843431; // 0x10102a7 + field public static final int finishOnTaskLaunch = 16842772; // 0x1010014 + field public static final int firstDayOfWeek = 16843581; // 0x101033d + field public static final int fitsSystemWindows = 16842973; // 0x10100dd + field public static final int flipInterval = 16843129; // 0x1010179 + field public static final int focusable = 16842970; // 0x10100da + field public static final int focusableInTouchMode = 16842971; // 0x10100db + field public static final int focusedMonthDateColor = 16843587; // 0x1010343 + field public static final int fontFamily = 16843692; // 0x10103ac + field public static final int footerDividersEnabled = 16843311; // 0x101022f + field public static final int foreground = 16843017; // 0x1010109 + field public static final int foregroundGravity = 16843264; // 0x1010200 + field public static final int format = 16843013; // 0x1010105 + field public static final int format12Hour = 16843722; // 0x10103ca + field public static final int format24Hour = 16843723; // 0x10103cb + field public static final int fragment = 16843491; // 0x10102e3 + field public static final int fragmentCloseEnterAnimation = 16843495; // 0x10102e7 + field public static final int fragmentCloseExitAnimation = 16843496; // 0x10102e8 + field public static final int fragmentFadeEnterAnimation = 16843497; // 0x10102e9 + field public static final int fragmentFadeExitAnimation = 16843498; // 0x10102ea + field public static final int fragmentOpenEnterAnimation = 16843493; // 0x10102e5 + field public static final int fragmentOpenExitAnimation = 16843494; // 0x10102e6 + field public static final int freezesText = 16843116; // 0x101016c + field public static final int fromAlpha = 16843210; // 0x10101ca + field public static final int fromDegrees = 16843187; // 0x10101b3 + field public static final int fromXDelta = 16843206; // 0x10101c6 + field public static final int fromXScale = 16843202; // 0x10101c2 + field public static final int fromYDelta = 16843208; // 0x10101c8 + field public static final int fromYScale = 16843204; // 0x10101c4 + field public static final int fullBright = 16842954; // 0x10100ca + field public static final int fullDark = 16842950; // 0x10100c6 + field public static final int functionalTest = 16842787; // 0x1010023 + field public static final int galleryItemBackground = 16842828; // 0x101004c + field public static final int galleryStyle = 16842864; // 0x1010070 + field public static final int gestureColor = 16843381; // 0x1010275 + field public static final int gestureStrokeAngleThreshold = 16843388; // 0x101027c + field public static final int gestureStrokeLengthThreshold = 16843386; // 0x101027a + field public static final int gestureStrokeSquarenessThreshold = 16843387; // 0x101027b + field public static final int gestureStrokeType = 16843385; // 0x1010279 + field public static final int gestureStrokeWidth = 16843380; // 0x1010274 + field public static final int glEsVersion = 16843393; // 0x1010281 + field public static final int gradientRadius = 16843172; // 0x10101a4 + field public static final int grantUriPermissions = 16842779; // 0x101001b + field public static final int gravity = 16842927; // 0x10100af + field public static final int gridViewStyle = 16842865; // 0x1010071 + field public static final int groupIndicator = 16843019; // 0x101010b + field public static final int hand_hour = 16843011; // 0x1010103 + field public static final int hand_minute = 16843012; // 0x1010104 + field public static final int handle = 16843354; // 0x101025a + field public static final int handleProfiling = 16842786; // 0x1010022 + field public static final int hapticFeedbackEnabled = 16843358; // 0x101025e + field public static final int hardwareAccelerated = 16843475; // 0x10102d3 + field public static final int hasCode = 16842764; // 0x101000c + field public static final int headerBackground = 16843055; // 0x101012f + field public static final int headerDividersEnabled = 16843310; // 0x101022e + field public static final int height = 16843093; // 0x1010155 + field public static final int hint = 16843088; // 0x1010150 + field public static final int homeAsUpIndicator = 16843531; // 0x101030b + field public static final int homeLayout = 16843549; // 0x101031d + field public static final int horizontalDivider = 16843053; // 0x101012d + field public static final int horizontalGap = 16843327; // 0x101023f + field public static final int horizontalScrollViewStyle = 16843603; // 0x1010353 + field public static final int horizontalSpacing = 16843028; // 0x1010114 + field public static final int host = 16842792; // 0x1010028 + field public static final int icon = 16842754; // 0x1010002 + field public static final int iconPreview = 16843337; // 0x1010249 + field public static final int iconifiedByDefault = 16843514; // 0x10102fa + field public static final int id = 16842960; // 0x10100d0 + field public static final int ignoreGravity = 16843263; // 0x10101ff + field public static final int imageButtonStyle = 16842866; // 0x1010072 + field public static final int imageWellStyle = 16842867; // 0x1010073 + field public static final int imeActionId = 16843366; // 0x1010266 + field public static final int imeActionLabel = 16843365; // 0x1010265 + field public static final int imeExtractEnterAnimation = 16843368; // 0x1010268 + field public static final int imeExtractExitAnimation = 16843369; // 0x1010269 + field public static final int imeFullscreenBackground = 16843308; // 0x101022c + field public static final int imeOptions = 16843364; // 0x1010264 + field public static final int imeSubtypeExtraValue = 16843502; // 0x10102ee + field public static final int imeSubtypeLocale = 16843500; // 0x10102ec + field public static final int imeSubtypeMode = 16843501; // 0x10102ed + field public static final int immersive = 16843456; // 0x10102c0 + field public static final int importantForAccessibility = 16843690; // 0x10103aa + field public static final int inAnimation = 16843127; // 0x1010177 + field public static final int includeFontPadding = 16843103; // 0x101015f + field public static final int includeInGlobalSearch = 16843374; // 0x101026e + field public static final int indeterminate = 16843065; // 0x1010139 + field public static final int indeterminateBehavior = 16843070; // 0x101013e + field public static final int indeterminateDrawable = 16843067; // 0x101013b + field public static final int indeterminateDuration = 16843069; // 0x101013d + field public static final int indeterminateOnly = 16843066; // 0x101013a + field public static final int indeterminateProgressStyle = 16843544; // 0x1010318 + field public static final int indicatorLeft = 16843021; // 0x101010d + field public static final int indicatorRight = 16843022; // 0x101010e + field public static final int inflatedId = 16842995; // 0x10100f3 + field public static final int initOrder = 16842778; // 0x101001a + field public static final int initialKeyguardLayout = 16843714; // 0x10103c2 + field public static final int initialLayout = 16843345; // 0x1010251 + field public static final int innerRadius = 16843359; // 0x101025f + field public static final int innerRadiusRatio = 16843163; // 0x101019b + field public static final deprecated int inputMethod = 16843112; // 0x1010168 + field public static final int inputType = 16843296; // 0x1010220 + field public static final int insetBottom = 16843194; // 0x10101ba + field public static final int insetLeft = 16843191; // 0x10101b7 + field public static final int insetRight = 16843192; // 0x10101b8 + field public static final int insetTop = 16843193; // 0x10101b9 + field public static final int installLocation = 16843447; // 0x10102b7 + field public static final int interpolator = 16843073; // 0x1010141 + field public static final int isAlwaysSyncable = 16843571; // 0x1010333 + field public static final int isAuxiliary = 16843647; // 0x101037f + field public static final int isDefault = 16843297; // 0x1010221 + field public static final int isIndicator = 16843079; // 0x1010147 + field public static final int isModifier = 16843334; // 0x1010246 + field public static final int isRepeatable = 16843336; // 0x1010248 + field public static final int isScrollContainer = 16843342; // 0x101024e + field public static final int isSticky = 16843335; // 0x1010247 + field public static final int isolatedProcess = 16843689; // 0x10103a9 + field public static final int itemBackground = 16843056; // 0x1010130 + field public static final int itemIconDisabledAlpha = 16843057; // 0x1010131 + field public static final int itemPadding = 16843565; // 0x101032d + field public static final int itemTextAppearance = 16843052; // 0x101012c + field public static final int keepScreenOn = 16843286; // 0x1010216 + field public static final int key = 16843240; // 0x10101e8 + field public static final int keyBackground = 16843315; // 0x1010233 + field public static final int keyEdgeFlags = 16843333; // 0x1010245 + field public static final int keyHeight = 16843326; // 0x101023e + field public static final int keyIcon = 16843340; // 0x101024c + field public static final int keyLabel = 16843339; // 0x101024b + field public static final int keyOutputText = 16843338; // 0x101024a + field public static final int keyPreviewHeight = 16843321; // 0x1010239 + field public static final int keyPreviewLayout = 16843319; // 0x1010237 + field public static final int keyPreviewOffset = 16843320; // 0x1010238 + field public static final int keyTextColor = 16843318; // 0x1010236 + field public static final int keyTextSize = 16843316; // 0x1010234 + field public static final int keyWidth = 16843325; // 0x101023d + field public static final int keyboardLayout = 16843691; // 0x10103ab + field public static final int keyboardMode = 16843341; // 0x101024d + field public static final int keycode = 16842949; // 0x10100c5 + field public static final int killAfterRestore = 16843420; // 0x101029c + field public static final int label = 16842753; // 0x1010001 + field public static final int labelFor = 16843718; // 0x10103c6 + field public static final int labelTextSize = 16843317; // 0x1010235 + field public static final int largeHeap = 16843610; // 0x101035a + field public static final int largeScreens = 16843398; // 0x1010286 + field public static final int largestWidthLimitDp = 16843622; // 0x1010366 + field public static final int launchMode = 16842781; // 0x101001d + field public static final int layerType = 16843604; // 0x1010354 + field public static final int layout = 16842994; // 0x10100f2 + field public static final int layoutAnimation = 16842988; // 0x10100ec + field public static final int layoutDirection = 16843698; // 0x10103b2 + field public static final int layout_above = 16843140; // 0x1010184 + field public static final int layout_alignBaseline = 16843142; // 0x1010186 + field public static final int layout_alignBottom = 16843146; // 0x101018a + field public static final int layout_alignEnd = 16843706; // 0x10103ba + field public static final int layout_alignLeft = 16843143; // 0x1010187 + field public static final int layout_alignParentBottom = 16843150; // 0x101018e + field public static final int layout_alignParentEnd = 16843708; // 0x10103bc + field public static final int layout_alignParentLeft = 16843147; // 0x101018b + field public static final int layout_alignParentRight = 16843149; // 0x101018d + field public static final int layout_alignParentStart = 16843707; // 0x10103bb + field public static final int layout_alignParentTop = 16843148; // 0x101018c + field public static final int layout_alignRight = 16843145; // 0x1010189 + field public static final int layout_alignStart = 16843705; // 0x10103b9 + field public static final int layout_alignTop = 16843144; // 0x1010188 + field public static final int layout_alignWithParentIfMissing = 16843154; // 0x1010192 + field public static final int layout_below = 16843141; // 0x1010185 + field public static final int layout_centerHorizontal = 16843152; // 0x1010190 + field public static final int layout_centerInParent = 16843151; // 0x101018f + field public static final int layout_centerVertical = 16843153; // 0x1010191 + field public static final int layout_column = 16843084; // 0x101014c + field public static final int layout_columnSpan = 16843645; // 0x101037d + field public static final int layout_gravity = 16842931; // 0x10100b3 + field public static final int layout_height = 16842997; // 0x10100f5 + field public static final int layout_margin = 16842998; // 0x10100f6 + field public static final int layout_marginBottom = 16843002; // 0x10100fa + field public static final int layout_marginEnd = 16843702; // 0x10103b6 + field public static final int layout_marginLeft = 16842999; // 0x10100f7 + field public static final int layout_marginRight = 16843001; // 0x10100f9 + field public static final int layout_marginStart = 16843701; // 0x10103b5 + field public static final int layout_marginTop = 16843000; // 0x10100f8 + field public static final int layout_row = 16843643; // 0x101037b + field public static final int layout_rowSpan = 16843644; // 0x101037c + field public static final int layout_scale = 16843155; // 0x1010193 + field public static final int layout_span = 16843085; // 0x101014d + field public static final int layout_toEndOf = 16843704; // 0x10103b8 + field public static final int layout_toLeftOf = 16843138; // 0x1010182 + field public static final int layout_toRightOf = 16843139; // 0x1010183 + field public static final int layout_toStartOf = 16843703; // 0x10103b7 + field public static final int layout_weight = 16843137; // 0x1010181 + field public static final int layout_width = 16842996; // 0x10100f4 + field public static final int layout_x = 16843135; // 0x101017f + field public static final int layout_y = 16843136; // 0x1010180 + field public static final int left = 16843181; // 0x10101ad + field public static final int lineSpacingExtra = 16843287; // 0x1010217 + field public static final int lineSpacingMultiplier = 16843288; // 0x1010218 + field public static final int lines = 16843092; // 0x1010154 + field public static final int linksClickable = 16842929; // 0x10100b1 + field public static final int listChoiceBackgroundIndicator = 16843504; // 0x10102f0 + field public static final int listChoiceIndicatorMultiple = 16843290; // 0x101021a + field public static final int listChoiceIndicatorSingle = 16843289; // 0x1010219 + field public static final int listDivider = 16843284; // 0x1010214 + field public static final int listDividerAlertDialog = 16843525; // 0x1010305 + field public static final int listPopupWindowStyle = 16843519; // 0x10102ff + field public static final int listPreferredItemHeight = 16842829; // 0x101004d + field public static final int listPreferredItemHeightLarge = 16843654; // 0x1010386 + field public static final int listPreferredItemHeightSmall = 16843655; // 0x1010387 + field public static final int listPreferredItemPaddingEnd = 16843710; // 0x10103be + field public static final int listPreferredItemPaddingLeft = 16843683; // 0x10103a3 + field public static final int listPreferredItemPaddingRight = 16843684; // 0x10103a4 + field public static final int listPreferredItemPaddingStart = 16843709; // 0x10103bd + field public static final int listSelector = 16843003; // 0x10100fb + field public static final int listSeparatorTextViewStyle = 16843272; // 0x1010208 + field public static final int listViewStyle = 16842868; // 0x1010074 + field public static final int listViewWhiteStyle = 16842869; // 0x1010075 + field public static final int logo = 16843454; // 0x10102be + field public static final int longClickable = 16842982; // 0x10100e6 + field public static final int loopViews = 16843527; // 0x1010307 + field public static final int manageSpaceActivity = 16842756; // 0x1010004 + field public static final int mapViewStyle = 16842890; // 0x101008a + field public static final int marqueeRepeatLimit = 16843293; // 0x101021d + field public static final int max = 16843062; // 0x1010136 + field public static final int maxDate = 16843584; // 0x1010340 + field public static final int maxEms = 16843095; // 0x1010157 + field public static final int maxHeight = 16843040; // 0x1010120 + field public static final int maxItemsPerRow = 16843060; // 0x1010134 + field public static final int maxLength = 16843104; // 0x1010160 + field public static final int maxLevel = 16843186; // 0x10101b2 + field public static final int maxLines = 16843091; // 0x1010153 + field public static final int maxRows = 16843059; // 0x1010133 + field public static final int maxSdkVersion = 16843377; // 0x1010271 + field public static final int maxWidth = 16843039; // 0x101011f + field public static final int measureAllChildren = 16843018; // 0x101010a + field public static final int measureWithLargestChild = 16843476; // 0x10102d4 + field public static final int mediaRouteButtonStyle = 16843693; // 0x10103ad + field public static final int mediaRouteTypes = 16843694; // 0x10103ae + field public static final int menuCategory = 16843230; // 0x10101de + field public static final int mimeType = 16842790; // 0x1010026 + field public static final int minDate = 16843583; // 0x101033f + field public static final int minEms = 16843098; // 0x101015a + field public static final int minHeight = 16843072; // 0x1010140 + field public static final int minLevel = 16843185; // 0x10101b1 + field public static final int minLines = 16843094; // 0x1010156 + field public static final int minResizeHeight = 16843670; // 0x1010396 + field public static final int minResizeWidth = 16843669; // 0x1010395 + field public static final int minSdkVersion = 16843276; // 0x101020c + field public static final int minWidth = 16843071; // 0x101013f + field public static final int mode = 16843134; // 0x101017e + field public static final int moreIcon = 16843061; // 0x1010135 + field public static final int multiprocess = 16842771; // 0x1010013 + field public static final int name = 16842755; // 0x1010003 + field public static final int navigationMode = 16843471; // 0x10102cf + field public static final int negativeButtonText = 16843254; // 0x10101f6 + field public static final int nextFocusDown = 16842980; // 0x10100e4 + field public static final int nextFocusForward = 16843580; // 0x101033c + field public static final int nextFocusLeft = 16842977; // 0x10100e1 + field public static final int nextFocusRight = 16842978; // 0x10100e2 + field public static final int nextFocusUp = 16842979; // 0x10100e3 + field public static final int noHistory = 16843309; // 0x101022d + field public static final int normalScreens = 16843397; // 0x1010285 + field public static final int notificationTimeout = 16843651; // 0x1010383 + field public static final int numColumns = 16843032; // 0x1010118 + field public static final int numStars = 16843076; // 0x1010144 + field public static final deprecated int numeric = 16843109; // 0x1010165 + field public static final int numericShortcut = 16843236; // 0x10101e4 + field public static final int onClick = 16843375; // 0x101026f + field public static final int oneshot = 16843159; // 0x1010197 + field public static final int opacity = 16843550; // 0x101031e + field public static final int order = 16843242; // 0x10101ea + field public static final int orderInCategory = 16843231; // 0x10101df + field public static final int ordering = 16843490; // 0x10102e2 + field public static final int orderingFromXml = 16843239; // 0x10101e7 + field public static final int orientation = 16842948; // 0x10100c4 + field public static final int outAnimation = 16843128; // 0x1010178 + field public static final int overScrollFooter = 16843459; // 0x10102c3 + field public static final int overScrollHeader = 16843458; // 0x10102c2 + field public static final int overScrollMode = 16843457; // 0x10102c1 + field public static final int overridesImplicitlyEnabledSubtype = 16843682; // 0x10103a2 + field public static final int packageNames = 16843649; // 0x1010381 + field public static final int padding = 16842965; // 0x10100d5 + field public static final int paddingBottom = 16842969; // 0x10100d9 + field public static final int paddingEnd = 16843700; // 0x10103b4 + field public static final int paddingLeft = 16842966; // 0x10100d6 + field public static final int paddingRight = 16842968; // 0x10100d8 + field public static final int paddingStart = 16843699; // 0x10103b3 + field public static final int paddingTop = 16842967; // 0x10100d7 + field public static final int panelBackground = 16842846; // 0x101005e + field public static final int panelColorBackground = 16842849; // 0x1010061 + field public static final int panelColorForeground = 16842848; // 0x1010060 + field public static final int panelFullBackground = 16842847; // 0x101005f + field public static final int panelTextAppearance = 16842850; // 0x1010062 + field public static final int parentActivityName = 16843687; // 0x10103a7 + field public static final deprecated int password = 16843100; // 0x101015c + field public static final int path = 16842794; // 0x101002a + field public static final int pathPattern = 16842796; // 0x101002c + field public static final int pathPrefix = 16842795; // 0x101002b + field public static final int permission = 16842758; // 0x1010006 + field public static final int permissionFlags = 16843719; // 0x10103c7 + field public static final int permissionGroup = 16842762; // 0x101000a + field public static final int permissionGroupFlags = 16843717; // 0x10103c5 + field public static final int persistent = 16842765; // 0x101000d + field public static final int persistentDrawingCache = 16842990; // 0x10100ee + field public static final deprecated int phoneNumber = 16843111; // 0x1010167 + field public static final int pivotX = 16843189; // 0x10101b5 + field public static final int pivotY = 16843190; // 0x10101b6 + field public static final int popupAnimationStyle = 16843465; // 0x10102c9 + field public static final int popupBackground = 16843126; // 0x1010176 + field public static final int popupCharacters = 16843332; // 0x1010244 + field public static final int popupKeyboard = 16843331; // 0x1010243 + field public static final int popupLayout = 16843323; // 0x101023b + field public static final int popupMenuStyle = 16843520; // 0x1010300 + field public static final int popupWindowStyle = 16842870; // 0x1010076 + field public static final int port = 16842793; // 0x1010029 + field public static final int positiveButtonText = 16843253; // 0x10101f5 + field public static final int preferenceCategoryStyle = 16842892; // 0x101008c + field public static final int preferenceInformationStyle = 16842893; // 0x101008d + field public static final int preferenceLayoutChild = 16842900; // 0x1010094 + field public static final int preferenceScreenStyle = 16842891; // 0x101008b + field public static final int preferenceStyle = 16842894; // 0x101008e + field public static final int presentationTheme = 16843712; // 0x10103c0 + field public static final int previewImage = 16843482; // 0x10102da + field public static final int priority = 16842780; // 0x101001c + field public static final int privateImeOptions = 16843299; // 0x1010223 + field public static final int process = 16842769; // 0x1010011 + field public static final int progress = 16843063; // 0x1010137 + field public static final int progressBarPadding = 16843545; // 0x1010319 + field public static final int progressBarStyle = 16842871; // 0x1010077 + field public static final int progressBarStyleHorizontal = 16842872; // 0x1010078 + field public static final int progressBarStyleInverse = 16843399; // 0x1010287 + field public static final int progressBarStyleLarge = 16842874; // 0x101007a + field public static final int progressBarStyleLargeInverse = 16843401; // 0x1010289 + field public static final int progressBarStyleSmall = 16842873; // 0x1010079 + field public static final int progressBarStyleSmallInverse = 16843400; // 0x1010288 + field public static final int progressBarStyleSmallTitle = 16843279; // 0x101020f + field public static final int progressDrawable = 16843068; // 0x101013c + field public static final int prompt = 16843131; // 0x101017b + field public static final int propertyName = 16843489; // 0x10102e1 + field public static final int protectionLevel = 16842761; // 0x1010009 + field public static final int publicKey = 16843686; // 0x10103a6 + field public static final int queryActionMsg = 16843227; // 0x10101db + field public static final int queryAfterZeroResults = 16843394; // 0x1010282 + field public static final int queryHint = 16843608; // 0x1010358 + field public static final int quickContactBadgeStyleSmallWindowLarge = 16843443; // 0x10102b3 + field public static final int quickContactBadgeStyleSmallWindowMedium = 16843442; // 0x10102b2 + field public static final int quickContactBadgeStyleSmallWindowSmall = 16843441; // 0x10102b1 + field public static final int quickContactBadgeStyleWindowLarge = 16843440; // 0x10102b0 + field public static final int quickContactBadgeStyleWindowMedium = 16843439; // 0x10102af + field public static final int quickContactBadgeStyleWindowSmall = 16843438; // 0x10102ae + field public static final int radioButtonStyle = 16842878; // 0x101007e + field public static final int radius = 16843176; // 0x10101a8 + field public static final int rating = 16843077; // 0x1010145 + field public static final int ratingBarStyle = 16842876; // 0x101007c + field public static final int ratingBarStyleIndicator = 16843280; // 0x1010210 + field public static final int ratingBarStyleSmall = 16842877; // 0x101007d + field public static final int readPermission = 16842759; // 0x1010007 + field public static final int repeatCount = 16843199; // 0x10101bf + field public static final int repeatMode = 16843200; // 0x10101c0 + field public static final int reqFiveWayNav = 16843314; // 0x1010232 + field public static final int reqHardKeyboard = 16843305; // 0x1010229 + field public static final int reqKeyboardType = 16843304; // 0x1010228 + field public static final int reqNavigation = 16843306; // 0x101022a + field public static final int reqTouchScreen = 16843303; // 0x1010227 + field public static final int required = 16843406; // 0x101028e + field public static final int requiresFadingEdge = 16843685; // 0x10103a5 + field public static final int requiresSmallestWidthDp = 16843620; // 0x1010364 + field public static final int resizeMode = 16843619; // 0x1010363 + field public static final int resizeable = 16843405; // 0x101028d + field public static final int resource = 16842789; // 0x1010025 + field public static final int restoreAnyVersion = 16843450; // 0x10102ba + field public static final deprecated int restoreNeedsApplication = 16843421; // 0x101029d + field public static final int right = 16843183; // 0x10101af + field public static final int ringtonePreferenceStyle = 16842899; // 0x1010093 + field public static final int ringtoneType = 16843257; // 0x10101f9 + field public static final int rotation = 16843558; // 0x1010326 + field public static final int rotationX = 16843559; // 0x1010327 + field public static final int rotationY = 16843560; // 0x1010328 + field public static final int rowCount = 16843637; // 0x1010375 + field public static final int rowDelay = 16843216; // 0x10101d0 + field public static final int rowEdgeFlags = 16843329; // 0x1010241 + field public static final int rowHeight = 16843058; // 0x1010132 + field public static final int rowOrderPreserved = 16843638; // 0x1010376 + field public static final int saveEnabled = 16842983; // 0x10100e7 + field public static final int scaleGravity = 16843262; // 0x10101fe + field public static final int scaleHeight = 16843261; // 0x10101fd + field public static final int scaleType = 16843037; // 0x101011d + field public static final int scaleWidth = 16843260; // 0x10101fc + field public static final int scaleX = 16843556; // 0x1010324 + field public static final int scaleY = 16843557; // 0x1010325 + field public static final int scheme = 16842791; // 0x1010027 + field public static final int screenDensity = 16843467; // 0x10102cb + field public static final int screenOrientation = 16842782; // 0x101001e + field public static final int screenSize = 16843466; // 0x10102ca + field public static final int scrollHorizontally = 16843099; // 0x101015b + field public static final int scrollViewStyle = 16842880; // 0x1010080 + field public static final int scrollX = 16842962; // 0x10100d2 + field public static final int scrollY = 16842963; // 0x10100d3 + field public static final int scrollbarAlwaysDrawHorizontalTrack = 16842856; // 0x1010068 + field public static final int scrollbarAlwaysDrawVerticalTrack = 16842857; // 0x1010069 + field public static final int scrollbarDefaultDelayBeforeFade = 16843433; // 0x10102a9 + field public static final int scrollbarFadeDuration = 16843432; // 0x10102a8 + field public static final int scrollbarSize = 16842851; // 0x1010063 + field public static final int scrollbarStyle = 16842879; // 0x101007f + field public static final int scrollbarThumbHorizontal = 16842852; // 0x1010064 + field public static final int scrollbarThumbVertical = 16842853; // 0x1010065 + field public static final int scrollbarTrackHorizontal = 16842854; // 0x1010066 + field public static final int scrollbarTrackVertical = 16842855; // 0x1010067 + field public static final int scrollbars = 16842974; // 0x10100de + field public static final int scrollingCache = 16843006; // 0x10100fe + field public static final deprecated int searchButtonText = 16843269; // 0x1010205 + field public static final int searchMode = 16843221; // 0x10101d5 + field public static final int searchSettingsDescription = 16843402; // 0x101028a + field public static final int searchSuggestAuthority = 16843222; // 0x10101d6 + field public static final int searchSuggestIntentAction = 16843225; // 0x10101d9 + field public static final int searchSuggestIntentData = 16843226; // 0x10101da + field public static final int searchSuggestPath = 16843223; // 0x10101d7 + field public static final int searchSuggestSelection = 16843224; // 0x10101d8 + field public static final int searchSuggestThreshold = 16843373; // 0x101026d + field public static final int secondaryProgress = 16843064; // 0x1010138 + field public static final int seekBarStyle = 16842875; // 0x101007b + field public static final int segmentedButtonStyle = 16843568; // 0x1010330 + field public static final int selectAllOnFocus = 16843102; // 0x101015e + field public static final int selectable = 16843238; // 0x10101e6 + field public static final int selectableItemBackground = 16843534; // 0x101030e + field public static final int selectedDateVerticalBar = 16843591; // 0x1010347 + field public static final int selectedWeekBackgroundColor = 16843586; // 0x1010342 + field public static final int settingsActivity = 16843301; // 0x1010225 + field public static final int shadowColor = 16843105; // 0x1010161 + field public static final int shadowDx = 16843106; // 0x1010162 + field public static final int shadowDy = 16843107; // 0x1010163 + field public static final int shadowRadius = 16843108; // 0x1010164 + field public static final int shape = 16843162; // 0x101019a + field public static final int shareInterpolator = 16843195; // 0x10101bb + field public static final int sharedUserId = 16842763; // 0x101000b + field public static final int sharedUserLabel = 16843361; // 0x1010261 + field public static final int shouldDisableView = 16843246; // 0x10101ee + field public static final int showAsAction = 16843481; // 0x10102d9 + field public static final int showDefault = 16843258; // 0x10101fa + field public static final int showDividers = 16843561; // 0x1010329 + field public static final int showOnLockScreen = 16843721; // 0x10103c9 + field public static final int showSilent = 16843259; // 0x10101fb + field public static final int showWeekNumber = 16843582; // 0x101033e + field public static final int shownWeekCount = 16843585; // 0x1010341 + field public static final int shrinkColumns = 16843082; // 0x101014a + field public static final deprecated int singleLine = 16843101; // 0x101015d + field public static final int singleUser = 16843711; // 0x10103bf + field public static final int smallIcon = 16843422; // 0x101029e + field public static final int smallScreens = 16843396; // 0x1010284 + field public static final int smoothScrollbar = 16843313; // 0x1010231 + field public static final int soundEffectsEnabled = 16843285; // 0x1010215 + field public static final int spacing = 16843027; // 0x1010113 + field public static final int spinnerDropDownItemStyle = 16842887; // 0x1010087 + field public static final int spinnerItemStyle = 16842889; // 0x1010089 + field public static final int spinnerMode = 16843505; // 0x10102f1 + field public static final int spinnerStyle = 16842881; // 0x1010081 + field public static final int spinnersShown = 16843595; // 0x101034b + field public static final int splitMotionEvents = 16843503; // 0x10102ef + field public static final int src = 16843033; // 0x1010119 + field public static final int stackFromBottom = 16843005; // 0x10100fd + field public static final int starStyle = 16842882; // 0x1010082 + field public static final int startColor = 16843165; // 0x101019d + field public static final int startOffset = 16843198; // 0x10101be + field public static final deprecated int startYear = 16843132; // 0x101017c + field public static final int stateNotNeeded = 16842774; // 0x1010016 + field public static final int state_above_anchor = 16842922; // 0x10100aa + field public static final int state_accelerated = 16843547; // 0x101031b + field public static final int state_activated = 16843518; // 0x10102fe + field public static final int state_active = 16842914; // 0x10100a2 + field public static final int state_checkable = 16842911; // 0x101009f + field public static final int state_checked = 16842912; // 0x10100a0 + field public static final int state_drag_can_accept = 16843624; // 0x1010368 + field public static final int state_drag_hovered = 16843625; // 0x1010369 + field public static final int state_empty = 16842921; // 0x10100a9 + field public static final int state_enabled = 16842910; // 0x101009e + field public static final int state_expanded = 16842920; // 0x10100a8 + field public static final int state_first = 16842916; // 0x10100a4 + field public static final int state_focused = 16842908; // 0x101009c + field public static final int state_hovered = 16843623; // 0x1010367 + field public static final int state_last = 16842918; // 0x10100a6 + field public static final int state_long_pressable = 16843324; // 0x101023c + field public static final int state_middle = 16842917; // 0x10100a5 + field public static final int state_multiline = 16843597; // 0x101034d + field public static final int state_pressed = 16842919; // 0x10100a7 + field public static final int state_selected = 16842913; // 0x10100a1 + field public static final int state_single = 16842915; // 0x10100a3 + field public static final int state_window_focused = 16842909; // 0x101009d + field public static final int staticWallpaperPreview = 16843569; // 0x1010331 + field public static final int stepSize = 16843078; // 0x1010146 + field public static final int stopWithTask = 16843626; // 0x101036a + field public static final int streamType = 16843273; // 0x1010209 + field public static final int stretchColumns = 16843081; // 0x1010149 + field public static final int stretchMode = 16843030; // 0x1010116 + field public static final int subtitle = 16843473; // 0x10102d1 + field public static final int subtitleTextStyle = 16843513; // 0x10102f9 + field public static final int subtypeExtraValue = 16843674; // 0x101039a + field public static final int subtypeId = 16843713; // 0x10103c1 + field public static final int subtypeLocale = 16843673; // 0x1010399 + field public static final int suggestActionMsg = 16843228; // 0x10101dc + field public static final int suggestActionMsgColumn = 16843229; // 0x10101dd + field public static final int summary = 16843241; // 0x10101e9 + field public static final int summaryColumn = 16843426; // 0x10102a2 + field public static final int summaryOff = 16843248; // 0x10101f0 + field public static final int summaryOn = 16843247; // 0x10101ef + field public static final int supportsRtl = 16843695; // 0x10103af + field public static final int supportsUploading = 16843419; // 0x101029b + field public static final int switchMinWidth = 16843632; // 0x1010370 + field public static final int switchPadding = 16843633; // 0x1010371 + field public static final int switchPreferenceStyle = 16843629; // 0x101036d + field public static final int switchTextAppearance = 16843630; // 0x101036e + field public static final int switchTextOff = 16843628; // 0x101036c + field public static final int switchTextOn = 16843627; // 0x101036b + field public static final int syncable = 16842777; // 0x1010019 + field public static final int tabStripEnabled = 16843453; // 0x10102bd + field public static final int tabStripLeft = 16843451; // 0x10102bb + field public static final int tabStripRight = 16843452; // 0x10102bc + field public static final int tabWidgetStyle = 16842883; // 0x1010083 + field public static final int tag = 16842961; // 0x10100d1 + field public static final int targetActivity = 16843266; // 0x1010202 + field public static final int targetClass = 16842799; // 0x101002f + field public static final int targetDescriptions = 16843680; // 0x10103a0 + field public static final int targetPackage = 16842785; // 0x1010021 + field public static final int targetSdkVersion = 16843376; // 0x1010270 + field public static final int taskAffinity = 16842770; // 0x1010012 + field public static final int taskCloseEnterAnimation = 16842942; // 0x10100be + field public static final int taskCloseExitAnimation = 16842943; // 0x10100bf + field public static final int taskOpenEnterAnimation = 16842940; // 0x10100bc + field public static final int taskOpenExitAnimation = 16842941; // 0x10100bd + field public static final int taskToBackEnterAnimation = 16842946; // 0x10100c2 + field public static final int taskToBackExitAnimation = 16842947; // 0x10100c3 + field public static final int taskToFrontEnterAnimation = 16842944; // 0x10100c0 + field public static final int taskToFrontExitAnimation = 16842945; // 0x10100c1 + field public static final int tension = 16843370; // 0x101026a + field public static final int testOnly = 16843378; // 0x1010272 + field public static final int text = 16843087; // 0x101014f + field public static final int textAlignment = 16843697; // 0x10103b1 + field public static final int textAllCaps = 16843660; // 0x101038c + field public static final int textAppearance = 16842804; // 0x1010034 + field public static final int textAppearanceButton = 16843271; // 0x1010207 + field public static final int textAppearanceInverse = 16842805; // 0x1010035 + field public static final int textAppearanceLarge = 16842816; // 0x1010040 + field public static final int textAppearanceLargeInverse = 16842819; // 0x1010043 + field public static final int textAppearanceLargePopupMenu = 16843521; // 0x1010301 + field public static final int textAppearanceListItem = 16843678; // 0x101039e + field public static final int textAppearanceListItemSmall = 16843679; // 0x101039f + field public static final int textAppearanceMedium = 16842817; // 0x1010041 + field public static final int textAppearanceMediumInverse = 16842820; // 0x1010044 + field public static final int textAppearanceSearchResultSubtitle = 16843424; // 0x10102a0 + field public static final int textAppearanceSearchResultTitle = 16843425; // 0x10102a1 + field public static final int textAppearanceSmall = 16842818; // 0x1010042 + field public static final int textAppearanceSmallInverse = 16842821; // 0x1010045 + field public static final int textAppearanceSmallPopupMenu = 16843522; // 0x1010302 + field public static final int textCheckMark = 16842822; // 0x1010046 + field public static final int textCheckMarkInverse = 16842823; // 0x1010047 + field public static final int textColor = 16842904; // 0x1010098 + field public static final int textColorAlertDialogListItem = 16843526; // 0x1010306 + field public static final int textColorHighlight = 16842905; // 0x1010099 + field public static final int textColorHighlightInverse = 16843599; // 0x101034f + field public static final int textColorHint = 16842906; // 0x101009a + field public static final int textColorHintInverse = 16842815; // 0x101003f + field public static final int textColorLink = 16842907; // 0x101009b + field public static final int textColorLinkInverse = 16843600; // 0x1010350 + field public static final int textColorPrimary = 16842806; // 0x1010036 + field public static final int textColorPrimaryDisableOnly = 16842807; // 0x1010037 + field public static final int textColorPrimaryInverse = 16842809; // 0x1010039 + field public static final int textColorPrimaryInverseDisableOnly = 16843403; // 0x101028b + field public static final int textColorPrimaryInverseNoDisable = 16842813; // 0x101003d + field public static final int textColorPrimaryNoDisable = 16842811; // 0x101003b + field public static final int textColorSecondary = 16842808; // 0x1010038 + field public static final int textColorSecondaryInverse = 16842810; // 0x101003a + field public static final int textColorSecondaryInverseNoDisable = 16842814; // 0x101003e + field public static final int textColorSecondaryNoDisable = 16842812; // 0x101003c + field public static final int textColorTertiary = 16843282; // 0x1010212 + field public static final int textColorTertiaryInverse = 16843283; // 0x1010213 + field public static final int textCursorDrawable = 16843618; // 0x1010362 + field public static final int textDirection = 16843696; // 0x10103b0 + field public static final int textEditNoPasteWindowLayout = 16843541; // 0x1010315 + field public static final int textEditPasteWindowLayout = 16843540; // 0x1010314 + field public static final int textEditSideNoPasteWindowLayout = 16843615; // 0x101035f + field public static final int textEditSidePasteWindowLayout = 16843614; // 0x101035e + field public static final int textEditSuggestionItemLayout = 16843636; // 0x1010374 + field public static final int textFilterEnabled = 16843007; // 0x10100ff + field public static final int textIsSelectable = 16843542; // 0x1010316 + field public static final int textOff = 16843045; // 0x1010125 + field public static final int textOn = 16843044; // 0x1010124 + field public static final int textScaleX = 16843089; // 0x1010151 + field public static final int textSelectHandle = 16843463; // 0x10102c7 + field public static final int textSelectHandleLeft = 16843461; // 0x10102c5 + field public static final int textSelectHandleRight = 16843462; // 0x10102c6 + field public static final int textSelectHandleWindowStyle = 16843464; // 0x10102c8 + field public static final int textSize = 16842901; // 0x1010095 + field public static final int textStyle = 16842903; // 0x1010097 + field public static final int textSuggestionsWindowStyle = 16843635; // 0x1010373 + field public static final int textViewStyle = 16842884; // 0x1010084 + field public static final int theme = 16842752; // 0x1010000 + field public static final int thickness = 16843360; // 0x1010260 + field public static final int thicknessRatio = 16843164; // 0x101019c + field public static final int thumb = 16843074; // 0x1010142 + field public static final int thumbOffset = 16843075; // 0x1010143 + field public static final int thumbTextPadding = 16843634; // 0x1010372 + field public static final int thumbnail = 16843429; // 0x10102a5 + field public static final int tileMode = 16843265; // 0x1010201 + field public static final int timeZone = 16843724; // 0x10103cc + field public static final int tint = 16843041; // 0x1010121 + field public static final int title = 16843233; // 0x10101e1 + field public static final int titleCondensed = 16843234; // 0x10101e2 + field public static final int titleTextStyle = 16843512; // 0x10102f8 + field public static final int toAlpha = 16843211; // 0x10101cb + field public static final int toDegrees = 16843188; // 0x10101b4 + field public static final int toXDelta = 16843207; // 0x10101c7 + field public static final int toXScale = 16843203; // 0x10101c3 + field public static final int toYDelta = 16843209; // 0x10101c9 + field public static final int toYScale = 16843205; // 0x10101c5 + field public static final int top = 16843182; // 0x10101ae + field public static final int topBright = 16842955; // 0x10100cb + field public static final int topDark = 16842951; // 0x10100c7 + field public static final int topLeftRadius = 16843177; // 0x10101a9 + field public static final int topOffset = 16843352; // 0x1010258 + field public static final int topRightRadius = 16843178; // 0x10101aa + field public static final int track = 16843631; // 0x101036f + field public static final int transcriptMode = 16843008; // 0x1010100 + field public static final int transformPivotX = 16843552; // 0x1010320 + field public static final int transformPivotY = 16843553; // 0x1010321 + field public static final int translationX = 16843554; // 0x1010322 + field public static final int translationY = 16843555; // 0x1010323 + field public static final int type = 16843169; // 0x10101a1 + field public static final int typeface = 16842902; // 0x1010096 + field public static final int uiOptions = 16843672; // 0x1010398 + field public static final int uncertainGestureColor = 16843382; // 0x1010276 + field public static final int unfocusedMonthDateColor = 16843588; // 0x1010344 + field public static final int unselectedAlpha = 16843278; // 0x101020e + field public static final int updatePeriodMillis = 16843344; // 0x1010250 + field public static final int useDefaultMargins = 16843641; // 0x1010379 + field public static final int useIntrinsicSizeAsMinimum = 16843536; // 0x1010310 + field public static final int useLevel = 16843167; // 0x101019f + field public static final int userVisible = 16843409; // 0x1010291 + field public static final int value = 16842788; // 0x1010024 + field public static final int valueFrom = 16843486; // 0x10102de + field public static final int valueTo = 16843487; // 0x10102df + field public static final int valueType = 16843488; // 0x10102e0 + field public static final int variablePadding = 16843157; // 0x1010195 + field public static final int versionCode = 16843291; // 0x101021b + field public static final int versionName = 16843292; // 0x101021c + field public static final int verticalCorrection = 16843322; // 0x101023a + field public static final int verticalDivider = 16843054; // 0x101012e + field public static final int verticalGap = 16843328; // 0x1010240 + field public static final int verticalScrollbarPosition = 16843572; // 0x1010334 + field public static final int verticalSpacing = 16843029; // 0x1010115 + field public static final int visibility = 16842972; // 0x10100dc + field public static final int visible = 16843156; // 0x1010194 + field public static final int vmSafeMode = 16843448; // 0x10102b8 + field public static final int voiceLanguage = 16843349; // 0x1010255 + field public static final int voiceLanguageModel = 16843347; // 0x1010253 + field public static final int voiceMaxResults = 16843350; // 0x1010256 + field public static final int voicePromptText = 16843348; // 0x1010254 + field public static final int voiceSearchMode = 16843346; // 0x1010252 + field public static final int wallpaperCloseEnterAnimation = 16843413; // 0x1010295 + field public static final int wallpaperCloseExitAnimation = 16843414; // 0x1010296 + field public static final int wallpaperIntraCloseEnterAnimation = 16843417; // 0x1010299 + field public static final int wallpaperIntraCloseExitAnimation = 16843418; // 0x101029a + field public static final int wallpaperIntraOpenEnterAnimation = 16843415; // 0x1010297 + field public static final int wallpaperIntraOpenExitAnimation = 16843416; // 0x1010298 + field public static final int wallpaperOpenEnterAnimation = 16843411; // 0x1010293 + field public static final int wallpaperOpenExitAnimation = 16843412; // 0x1010294 + field public static final int webTextViewStyle = 16843449; // 0x10102b9 + field public static final int webViewStyle = 16842885; // 0x1010085 + field public static final int weekDayTextAppearance = 16843592; // 0x1010348 + field public static final int weekNumberColor = 16843589; // 0x1010345 + field public static final int weekSeparatorLineColor = 16843590; // 0x1010346 + field public static final int weightSum = 16843048; // 0x1010128 + field public static final int widgetCategory = 16843716; // 0x10103c4 + field public static final int widgetLayout = 16843243; // 0x10101eb + field public static final int width = 16843097; // 0x1010159 + field public static final int windowActionBar = 16843469; // 0x10102cd + field public static final int windowActionBarOverlay = 16843492; // 0x10102e4 + field public static final int windowActionModeOverlay = 16843485; // 0x10102dd + field public static final int windowAnimationStyle = 16842926; // 0x10100ae + field public static final int windowBackground = 16842836; // 0x1010054 + field public static final int windowCloseOnTouchOutside = 16843611; // 0x101035b + field public static final int windowContentOverlay = 16842841; // 0x1010059 + field public static final int windowDisablePreview = 16843298; // 0x1010222 + field public static final int windowEnableSplitTouch = 16843543; // 0x1010317 + field public static final int windowEnterAnimation = 16842932; // 0x10100b4 + field public static final int windowExitAnimation = 16842933; // 0x10100b5 + field public static final int windowFrame = 16842837; // 0x1010055 + field public static final int windowFullscreen = 16843277; // 0x101020d + field public static final int windowHideAnimation = 16842935; // 0x10100b7 + field public static final int windowIsFloating = 16842839; // 0x1010057 + field public static final int windowIsTranslucent = 16842840; // 0x1010058 + field public static final int windowMinWidthMajor = 16843606; // 0x1010356 + field public static final int windowMinWidthMinor = 16843607; // 0x1010357 + field public static final int windowNoDisplay = 16843294; // 0x101021e + field public static final int windowNoTitle = 16842838; // 0x1010056 + field public static final int windowShowAnimation = 16842934; // 0x10100b6 + field public static final int windowShowWallpaper = 16843410; // 0x1010292 + field public static final int windowSoftInputMode = 16843307; // 0x101022b + field public static final int windowTitleBackgroundStyle = 16842844; // 0x101005c + field public static final int windowTitleSize = 16842842; // 0x101005a + field public static final int windowTitleStyle = 16842843; // 0x101005b + field public static final int writePermission = 16842760; // 0x1010008 + field public static final int x = 16842924; // 0x10100ac + field public static final int xlargeScreens = 16843455; // 0x10102bf + field public static final int y = 16842925; // 0x10100ad + field public static final int yesNoPreferenceStyle = 16842896; // 0x1010090 + field public static final int zAdjustment = 16843201; // 0x10101c1 + } + + public static final class R.bool { + ctor public R.bool(); + } + + public static final class R.color { + ctor public R.color(); + field public static final int background_dark = 17170446; // 0x106000e + field public static final int background_light = 17170447; // 0x106000f + field public static final int black = 17170444; // 0x106000c + field public static final int darker_gray = 17170432; // 0x1060000 + field public static final int holo_blue_bright = 17170459; // 0x106001b + field public static final int holo_blue_dark = 17170451; // 0x1060013 + field public static final int holo_blue_light = 17170450; // 0x1060012 + field public static final int holo_green_dark = 17170453; // 0x1060015 + field public static final int holo_green_light = 17170452; // 0x1060014 + field public static final int holo_orange_dark = 17170457; // 0x1060019 + field public static final int holo_orange_light = 17170456; // 0x1060018 + field public static final int holo_purple = 17170458; // 0x106001a + field public static final int holo_red_dark = 17170455; // 0x1060017 + field public static final int holo_red_light = 17170454; // 0x1060016 + field public static final int primary_text_dark = 17170433; // 0x1060001 + field public static final int primary_text_dark_nodisable = 17170434; // 0x1060002 + field public static final int primary_text_light = 17170435; // 0x1060003 + field public static final int primary_text_light_nodisable = 17170436; // 0x1060004 + field public static final int secondary_text_dark = 17170437; // 0x1060005 + field public static final int secondary_text_dark_nodisable = 17170438; // 0x1060006 + field public static final int secondary_text_light = 17170439; // 0x1060007 + field public static final int secondary_text_light_nodisable = 17170440; // 0x1060008 + field public static final int tab_indicator_text = 17170441; // 0x1060009 + field public static final int tertiary_text_dark = 17170448; // 0x1060010 + field public static final int tertiary_text_light = 17170449; // 0x1060011 + field public static final int transparent = 17170445; // 0x106000d + field public static final int white = 17170443; // 0x106000b + field public static final int widget_edittext_dark = 17170442; // 0x106000a + } + + public static final class R.dimen { + ctor public R.dimen(); + field public static final int app_icon_size = 17104896; // 0x1050000 + field public static final int dialog_min_width_major = 17104899; // 0x1050003 + field public static final int dialog_min_width_minor = 17104900; // 0x1050004 + field public static final int notification_large_icon_height = 17104902; // 0x1050006 + field public static final int notification_large_icon_width = 17104901; // 0x1050005 + field public static final int thumbnail_height = 17104897; // 0x1050001 + field public static final int thumbnail_width = 17104898; // 0x1050002 + } + + public static final class R.drawable { + ctor public R.drawable(); + field public static final int alert_dark_frame = 17301504; // 0x1080000 + field public static final int alert_light_frame = 17301505; // 0x1080001 + field public static final int arrow_down_float = 17301506; // 0x1080002 + field public static final int arrow_up_float = 17301507; // 0x1080003 + field public static final int bottom_bar = 17301658; // 0x108009a + field public static final int btn_default = 17301508; // 0x1080004 + field public static final int btn_default_small = 17301509; // 0x1080005 + field public static final int btn_dialog = 17301527; // 0x1080017 + field public static final int btn_dropdown = 17301510; // 0x1080006 + field public static final int btn_minus = 17301511; // 0x1080007 + field public static final int btn_plus = 17301512; // 0x1080008 + field public static final int btn_radio = 17301513; // 0x1080009 + field public static final int btn_star = 17301514; // 0x108000a + field public static final int btn_star_big_off = 17301515; // 0x108000b + field public static final int btn_star_big_on = 17301516; // 0x108000c + field public static final int button_onoff_indicator_off = 17301518; // 0x108000e + field public static final int button_onoff_indicator_on = 17301517; // 0x108000d + field public static final int checkbox_off_background = 17301519; // 0x108000f + field public static final int checkbox_on_background = 17301520; // 0x1080010 + field public static final int dark_header = 17301669; // 0x10800a5 + field public static final int dialog_frame = 17301521; // 0x1080011 + field public static final int dialog_holo_dark_frame = 17301682; // 0x10800b2 + field public static final int dialog_holo_light_frame = 17301683; // 0x10800b3 + field public static final int divider_horizontal_bright = 17301522; // 0x1080012 + field public static final int divider_horizontal_dark = 17301524; // 0x1080014 + field public static final int divider_horizontal_dim_dark = 17301525; // 0x1080015 + field public static final int divider_horizontal_textfield = 17301523; // 0x1080013 + field public static final int edit_text = 17301526; // 0x1080016 + field public static final int editbox_background = 17301528; // 0x1080018 + field public static final int editbox_background_normal = 17301529; // 0x1080019 + field public static final int editbox_dropdown_dark_frame = 17301530; // 0x108001a + field public static final int editbox_dropdown_light_frame = 17301531; // 0x108001b + field public static final int gallery_thumb = 17301532; // 0x108001c + field public static final int ic_btn_speak_now = 17301668; // 0x10800a4 + field public static final int ic_delete = 17301533; // 0x108001d + field public static final int ic_dialog_alert = 17301543; // 0x1080027 + field public static final int ic_dialog_dialer = 17301544; // 0x1080028 + field public static final int ic_dialog_email = 17301545; // 0x1080029 + field public static final int ic_dialog_info = 17301659; // 0x108009b + field public static final int ic_dialog_map = 17301546; // 0x108002a + field public static final int ic_input_add = 17301547; // 0x108002b + field public static final int ic_input_delete = 17301548; // 0x108002c + field public static final int ic_input_get = 17301549; // 0x108002d + field public static final int ic_lock_idle_alarm = 17301550; // 0x108002e + field public static final int ic_lock_idle_charging = 17301534; // 0x108001e + field public static final int ic_lock_idle_lock = 17301535; // 0x108001f + field public static final int ic_lock_idle_low_battery = 17301536; // 0x1080020 + field public static final int ic_lock_lock = 17301551; // 0x108002f + field public static final int ic_lock_power_off = 17301552; // 0x1080030 + field public static final int ic_lock_silent_mode = 17301553; // 0x1080031 + field public static final int ic_lock_silent_mode_off = 17301554; // 0x1080032 + field public static final int ic_media_ff = 17301537; // 0x1080021 + field public static final int ic_media_next = 17301538; // 0x1080022 + field public static final int ic_media_pause = 17301539; // 0x1080023 + field public static final int ic_media_play = 17301540; // 0x1080024 + field public static final int ic_media_previous = 17301541; // 0x1080025 + field public static final int ic_media_rew = 17301542; // 0x1080026 + field public static final int ic_menu_add = 17301555; // 0x1080033 + field public static final int ic_menu_agenda = 17301556; // 0x1080034 + field public static final int ic_menu_always_landscape_portrait = 17301557; // 0x1080035 + field public static final int ic_menu_call = 17301558; // 0x1080036 + field public static final int ic_menu_camera = 17301559; // 0x1080037 + field public static final int ic_menu_close_clear_cancel = 17301560; // 0x1080038 + field public static final int ic_menu_compass = 17301561; // 0x1080039 + field public static final int ic_menu_crop = 17301562; // 0x108003a + field public static final int ic_menu_day = 17301563; // 0x108003b + field public static final int ic_menu_delete = 17301564; // 0x108003c + field public static final int ic_menu_directions = 17301565; // 0x108003d + field public static final int ic_menu_edit = 17301566; // 0x108003e + field public static final int ic_menu_gallery = 17301567; // 0x108003f + field public static final int ic_menu_help = 17301568; // 0x1080040 + field public static final int ic_menu_info_details = 17301569; // 0x1080041 + field public static final int ic_menu_manage = 17301570; // 0x1080042 + field public static final int ic_menu_mapmode = 17301571; // 0x1080043 + field public static final int ic_menu_month = 17301572; // 0x1080044 + field public static final int ic_menu_more = 17301573; // 0x1080045 + field public static final int ic_menu_my_calendar = 17301574; // 0x1080046 + field public static final int ic_menu_mylocation = 17301575; // 0x1080047 + field public static final int ic_menu_myplaces = 17301576; // 0x1080048 + field public static final int ic_menu_preferences = 17301577; // 0x1080049 + field public static final int ic_menu_recent_history = 17301578; // 0x108004a + field public static final int ic_menu_report_image = 17301579; // 0x108004b + field public static final int ic_menu_revert = 17301580; // 0x108004c + field public static final int ic_menu_rotate = 17301581; // 0x108004d + field public static final int ic_menu_save = 17301582; // 0x108004e + field public static final int ic_menu_search = 17301583; // 0x108004f + field public static final int ic_menu_send = 17301584; // 0x1080050 + field public static final int ic_menu_set_as = 17301585; // 0x1080051 + field public static final int ic_menu_share = 17301586; // 0x1080052 + field public static final int ic_menu_slideshow = 17301587; // 0x1080053 + field public static final int ic_menu_sort_alphabetically = 17301660; // 0x108009c + field public static final int ic_menu_sort_by_size = 17301661; // 0x108009d + field public static final int ic_menu_today = 17301588; // 0x1080054 + field public static final int ic_menu_upload = 17301589; // 0x1080055 + field public static final int ic_menu_upload_you_tube = 17301590; // 0x1080056 + field public static final int ic_menu_view = 17301591; // 0x1080057 + field public static final int ic_menu_week = 17301592; // 0x1080058 + field public static final int ic_menu_zoom = 17301593; // 0x1080059 + field public static final int ic_notification_clear_all = 17301594; // 0x108005a + field public static final int ic_notification_overlay = 17301595; // 0x108005b + field public static final int ic_partial_secure = 17301596; // 0x108005c + field public static final int ic_popup_disk_full = 17301597; // 0x108005d + field public static final int ic_popup_reminder = 17301598; // 0x108005e + field public static final int ic_popup_sync = 17301599; // 0x108005f + field public static final int ic_search_category_default = 17301600; // 0x1080060 + field public static final int ic_secure = 17301601; // 0x1080061 + field public static final int list_selector_background = 17301602; // 0x1080062 + field public static final int menu_frame = 17301603; // 0x1080063 + field public static final int menu_full_frame = 17301604; // 0x1080064 + field public static final int menuitem_background = 17301605; // 0x1080065 + field public static final int picture_frame = 17301606; // 0x1080066 + field public static final int presence_audio_away = 17301679; // 0x10800af + field public static final int presence_audio_busy = 17301680; // 0x10800b0 + field public static final int presence_audio_online = 17301681; // 0x10800b1 + field public static final int presence_away = 17301607; // 0x1080067 + field public static final int presence_busy = 17301608; // 0x1080068 + field public static final int presence_invisible = 17301609; // 0x1080069 + field public static final int presence_offline = 17301610; // 0x108006a + field public static final int presence_online = 17301611; // 0x108006b + field public static final int presence_video_away = 17301676; // 0x10800ac + field public static final int presence_video_busy = 17301677; // 0x10800ad + field public static final int presence_video_online = 17301678; // 0x10800ae + field public static final int progress_horizontal = 17301612; // 0x108006c + field public static final int progress_indeterminate_horizontal = 17301613; // 0x108006d + field public static final int radiobutton_off_background = 17301614; // 0x108006e + field public static final int radiobutton_on_background = 17301615; // 0x108006f + field public static final int screen_background_dark = 17301656; // 0x1080098 + field public static final int screen_background_dark_transparent = 17301673; // 0x10800a9 + field public static final int screen_background_light = 17301657; // 0x1080099 + field public static final int screen_background_light_transparent = 17301674; // 0x10800aa + field public static final int spinner_background = 17301616; // 0x1080070 + field public static final int spinner_dropdown_background = 17301617; // 0x1080071 + field public static final int star_big_off = 17301619; // 0x1080073 + field public static final int star_big_on = 17301618; // 0x1080072 + field public static final int star_off = 17301621; // 0x1080075 + field public static final int star_on = 17301620; // 0x1080074 + field public static final int stat_notify_call_mute = 17301622; // 0x1080076 + field public static final int stat_notify_chat = 17301623; // 0x1080077 + field public static final int stat_notify_error = 17301624; // 0x1080078 + field public static final int stat_notify_missed_call = 17301631; // 0x108007f + field public static final int stat_notify_more = 17301625; // 0x1080079 + field public static final int stat_notify_sdcard = 17301626; // 0x108007a + field public static final int stat_notify_sdcard_prepare = 17301675; // 0x10800ab + field public static final int stat_notify_sdcard_usb = 17301627; // 0x108007b + field public static final int stat_notify_sync = 17301628; // 0x108007c + field public static final int stat_notify_sync_noanim = 17301629; // 0x108007d + field public static final int stat_notify_voicemail = 17301630; // 0x108007e + field public static final int stat_sys_data_bluetooth = 17301632; // 0x1080080 + field public static final int stat_sys_download = 17301633; // 0x1080081 + field public static final int stat_sys_download_done = 17301634; // 0x1080082 + field public static final int stat_sys_headset = 17301635; // 0x1080083 + field public static final deprecated int stat_sys_phone_call = 17301636; // 0x1080084 + field public static final deprecated int stat_sys_phone_call_forward = 17301637; // 0x1080085 + field public static final deprecated int stat_sys_phone_call_on_hold = 17301638; // 0x1080086 + field public static final int stat_sys_speakerphone = 17301639; // 0x1080087 + field public static final int stat_sys_upload = 17301640; // 0x1080088 + field public static final int stat_sys_upload_done = 17301641; // 0x1080089 + field public static final deprecated int stat_sys_vp_phone_call = 17301671; // 0x10800a7 + field public static final deprecated int stat_sys_vp_phone_call_on_hold = 17301672; // 0x10800a8 + field public static final int stat_sys_warning = 17301642; // 0x108008a + field public static final int status_bar_item_app_background = 17301643; // 0x108008b + field public static final int status_bar_item_background = 17301644; // 0x108008c + field public static final int sym_action_call = 17301645; // 0x108008d + field public static final int sym_action_chat = 17301646; // 0x108008e + field public static final int sym_action_email = 17301647; // 0x108008f + field public static final int sym_call_incoming = 17301648; // 0x1080090 + field public static final int sym_call_missed = 17301649; // 0x1080091 + field public static final int sym_call_outgoing = 17301650; // 0x1080092 + field public static final int sym_contact_card = 17301652; // 0x1080094 + field public static final int sym_def_app_icon = 17301651; // 0x1080093 + field public static final int title_bar = 17301653; // 0x1080095 + field public static final int title_bar_tall = 17301670; // 0x10800a6 + field public static final int toast_frame = 17301654; // 0x1080096 + field public static final int zoom_plate = 17301655; // 0x1080097 + } + + public static final class R.fraction { + ctor public R.fraction(); + } + + public static final class R.id { + ctor public R.id(); + field public static final int addToDictionary = 16908330; // 0x102002a + field public static final int background = 16908288; // 0x1020000 + field public static final int button1 = 16908313; // 0x1020019 + field public static final int button2 = 16908314; // 0x102001a + field public static final int button3 = 16908315; // 0x102001b + field public static final int candidatesArea = 16908317; // 0x102001d + field public static final int checkbox = 16908289; // 0x1020001 + field public static final int closeButton = 16908327; // 0x1020027 + field public static final int content = 16908290; // 0x1020002 + field public static final int copy = 16908321; // 0x1020021 + field public static final int copyUrl = 16908323; // 0x1020023 + field public static final int custom = 16908331; // 0x102002b + field public static final int cut = 16908320; // 0x1020020 + field public static final int edit = 16908291; // 0x1020003 + field public static final int empty = 16908292; // 0x1020004 + field public static final int extractArea = 16908316; // 0x102001c + field public static final int hint = 16908293; // 0x1020005 + field public static final int home = 16908332; // 0x102002c + field public static final int icon = 16908294; // 0x1020006 + field public static final int icon1 = 16908295; // 0x1020007 + field public static final int icon2 = 16908296; // 0x1020008 + field public static final int input = 16908297; // 0x1020009 + field public static final int inputArea = 16908318; // 0x102001e + field public static final int inputExtractEditText = 16908325; // 0x1020025 + field public static final int keyboardView = 16908326; // 0x1020026 + field public static final int list = 16908298; // 0x102000a + field public static final int message = 16908299; // 0x102000b + field public static final int paste = 16908322; // 0x1020022 + field public static final int primary = 16908300; // 0x102000c + field public static final int progress = 16908301; // 0x102000d + field public static final int secondaryProgress = 16908303; // 0x102000f + field public static final int selectAll = 16908319; // 0x102001f + field public static final int selectTextMode = 16908333; // 0x102002d + field public static final int selectedIcon = 16908302; // 0x102000e + field public static final int startSelectingText = 16908328; // 0x1020028 + field public static final int stopSelectingText = 16908329; // 0x1020029 + field public static final int summary = 16908304; // 0x1020010 + field public static final int switchInputMethod = 16908324; // 0x1020024 + field public static final int tabcontent = 16908305; // 0x1020011 + field public static final int tabhost = 16908306; // 0x1020012 + field public static final int tabs = 16908307; // 0x1020013 + field public static final int text1 = 16908308; // 0x1020014 + field public static final int text2 = 16908309; // 0x1020015 + field public static final int title = 16908310; // 0x1020016 + field public static final int toggle = 16908311; // 0x1020017 + field public static final int widget_frame = 16908312; // 0x1020018 + } + + public static final class R.integer { + ctor public R.integer(); + field public static final int config_longAnimTime = 17694722; // 0x10e0002 + field public static final int config_mediumAnimTime = 17694721; // 0x10e0001 + field public static final int config_shortAnimTime = 17694720; // 0x10e0000 + field public static final int status_bar_notification_info_maxnum = 17694723; // 0x10e0003 + } + + public static final class R.interpolator { + ctor public R.interpolator(); + field public static final int accelerate_cubic = 17563650; // 0x10c0002 + field public static final int accelerate_decelerate = 17563654; // 0x10c0006 + field public static final int accelerate_quad = 17563648; // 0x10c0000 + field public static final int accelerate_quint = 17563652; // 0x10c0004 + field public static final int anticipate = 17563655; // 0x10c0007 + field public static final int anticipate_overshoot = 17563657; // 0x10c0009 + field public static final int bounce = 17563658; // 0x10c000a + field public static final int cycle = 17563660; // 0x10c000c + field public static final int decelerate_cubic = 17563651; // 0x10c0003 + field public static final int decelerate_quad = 17563649; // 0x10c0001 + field public static final int decelerate_quint = 17563653; // 0x10c0005 + field public static final int linear = 17563659; // 0x10c000b + field public static final int overshoot = 17563656; // 0x10c0008 + } + + public static final class R.layout { + ctor public R.layout(); + field public static final int activity_list_item = 17367040; // 0x1090000 + field public static final int browser_link_context_header = 17367054; // 0x109000e + field public static final int expandable_list_content = 17367041; // 0x1090001 + field public static final int list_content = 17367060; // 0x1090014 + field public static final int preference_category = 17367042; // 0x1090002 + field public static final int select_dialog_item = 17367057; // 0x1090011 + field public static final int select_dialog_multichoice = 17367059; // 0x1090013 + field public static final int select_dialog_singlechoice = 17367058; // 0x1090012 + field public static final int simple_dropdown_item_1line = 17367050; // 0x109000a + field public static final int simple_expandable_list_item_1 = 17367046; // 0x1090006 + field public static final int simple_expandable_list_item_2 = 17367047; // 0x1090007 + field public static final int simple_gallery_item = 17367051; // 0x109000b + field public static final int simple_list_item_1 = 17367043; // 0x1090003 + field public static final int simple_list_item_2 = 17367044; // 0x1090004 + field public static final int simple_list_item_activated_1 = 17367062; // 0x1090016 + field public static final int simple_list_item_activated_2 = 17367063; // 0x1090017 + field public static final int simple_list_item_checked = 17367045; // 0x1090005 + field public static final int simple_list_item_multiple_choice = 17367056; // 0x1090010 + field public static final int simple_list_item_single_choice = 17367055; // 0x109000f + field public static final int simple_selectable_list_item = 17367061; // 0x1090015 + field public static final int simple_spinner_dropdown_item = 17367049; // 0x1090009 + field public static final int simple_spinner_item = 17367048; // 0x1090008 + field public static final int test_list_item = 17367052; // 0x109000c + field public static final int two_line_list_item = 17367053; // 0x109000d + } + + public static final class R.menu { + ctor public R.menu(); + } + + public static final class R.mipmap { + ctor public R.mipmap(); + field public static final int sym_def_app_icon = 17629184; // 0x10d0000 + } + + public static final class R.plurals { + ctor public R.plurals(); + } + + public static final class R.raw { + ctor public R.raw(); + } + + public static final class R.string { + ctor public R.string(); + field public static final int VideoView_error_button = 17039376; // 0x1040010 + field public static final int VideoView_error_text_invalid_progressive_playback = 17039381; // 0x1040015 + field public static final int VideoView_error_text_unknown = 17039377; // 0x1040011 + field public static final int VideoView_error_title = 17039378; // 0x1040012 + field public static final int cancel = 17039360; // 0x1040000 + field public static final int copy = 17039361; // 0x1040001 + field public static final int copyUrl = 17039362; // 0x1040002 + field public static final int cut = 17039363; // 0x1040003 + field public static final int defaultMsisdnAlphaTag = 17039365; // 0x1040005 + field public static final int defaultVoiceMailAlphaTag = 17039364; // 0x1040004 + field public static final int dialog_alert_title = 17039380; // 0x1040014 + field public static final int emptyPhoneNumber = 17039366; // 0x1040006 + field public static final int httpErrorBadUrl = 17039367; // 0x1040007 + field public static final int httpErrorUnsupportedScheme = 17039368; // 0x1040008 + field public static final int no = 17039369; // 0x1040009 + field public static final int ok = 17039370; // 0x104000a + field public static final int paste = 17039371; // 0x104000b + field public static final int search_go = 17039372; // 0x104000c + field public static final int selectAll = 17039373; // 0x104000d + field public static final int selectTextMode = 17039382; // 0x1040016 + field public static final int status_bar_notification_info_overflow = 17039383; // 0x1040017 + field public static final int unknownName = 17039374; // 0x104000e + field public static final int untitled = 17039375; // 0x104000f + field public static final int yes = 17039379; // 0x1040013 + } + + public static final class R.style { + ctor public R.style(); + field public static final int Animation = 16973824; // 0x1030000 + field public static final int Animation_Activity = 16973825; // 0x1030001 + field public static final int Animation_Dialog = 16973826; // 0x1030002 + field public static final int Animation_InputMethod = 16973910; // 0x1030056 + field public static final int Animation_Toast = 16973828; // 0x1030004 + field public static final int Animation_Translucent = 16973827; // 0x1030003 + field public static final int DeviceDefault_ButtonBar = 16974287; // 0x10301cf + field public static final int DeviceDefault_ButtonBar_AlertDialog = 16974288; // 0x10301d0 + field public static final int DeviceDefault_Light_ButtonBar = 16974290; // 0x10301d2 + field public static final int DeviceDefault_Light_ButtonBar_AlertDialog = 16974291; // 0x10301d3 + field public static final int DeviceDefault_Light_SegmentedButton = 16974292; // 0x10301d4 + field public static final int DeviceDefault_SegmentedButton = 16974289; // 0x10301d1 + field public static final int Holo_ButtonBar = 16974053; // 0x10300e5 + field public static final int Holo_ButtonBar_AlertDialog = 16974055; // 0x10300e7 + field public static final int Holo_Light_ButtonBar = 16974054; // 0x10300e6 + field public static final int Holo_Light_ButtonBar_AlertDialog = 16974056; // 0x10300e8 + field public static final int Holo_Light_SegmentedButton = 16974058; // 0x10300ea + field public static final int Holo_SegmentedButton = 16974057; // 0x10300e9 + field public static final int MediaButton = 16973879; // 0x1030037 + field public static final int MediaButton_Ffwd = 16973883; // 0x103003b + field public static final int MediaButton_Next = 16973881; // 0x1030039 + field public static final int MediaButton_Pause = 16973885; // 0x103003d + field public static final int MediaButton_Play = 16973882; // 0x103003a + field public static final int MediaButton_Previous = 16973880; // 0x1030038 + field public static final int MediaButton_Rew = 16973884; // 0x103003c + field public static final int TextAppearance = 16973886; // 0x103003e + field public static final int TextAppearance_DeviceDefault = 16974253; // 0x10301ad + field public static final int TextAppearance_DeviceDefault_DialogWindowTitle = 16974264; // 0x10301b8 + field public static final int TextAppearance_DeviceDefault_Inverse = 16974254; // 0x10301ae + field public static final int TextAppearance_DeviceDefault_Large = 16974255; // 0x10301af + field public static final int TextAppearance_DeviceDefault_Large_Inverse = 16974256; // 0x10301b0 + field public static final int TextAppearance_DeviceDefault_Medium = 16974257; // 0x10301b1 + field public static final int TextAppearance_DeviceDefault_Medium_Inverse = 16974258; // 0x10301b2 + field public static final int TextAppearance_DeviceDefault_SearchResult_Subtitle = 16974262; // 0x10301b6 + field public static final int TextAppearance_DeviceDefault_SearchResult_Title = 16974261; // 0x10301b5 + field public static final int TextAppearance_DeviceDefault_Small = 16974259; // 0x10301b3 + field public static final int TextAppearance_DeviceDefault_Small_Inverse = 16974260; // 0x10301b4 + field public static final int TextAppearance_DeviceDefault_Widget = 16974265; // 0x10301b9 + field public static final int TextAppearance_DeviceDefault_Widget_ActionBar_Menu = 16974286; // 0x10301ce + field public static final int TextAppearance_DeviceDefault_Widget_ActionBar_Subtitle = 16974279; // 0x10301c7 + field public static final int TextAppearance_DeviceDefault_Widget_ActionBar_Subtitle_Inverse = 16974283; // 0x10301cb + field public static final int TextAppearance_DeviceDefault_Widget_ActionBar_Title = 16974278; // 0x10301c6 + field public static final int TextAppearance_DeviceDefault_Widget_ActionBar_Title_Inverse = 16974282; // 0x10301ca + field public static final int TextAppearance_DeviceDefault_Widget_ActionMode_Subtitle = 16974281; // 0x10301c9 + field public static final int TextAppearance_DeviceDefault_Widget_ActionMode_Subtitle_Inverse = 16974285; // 0x10301cd + field public static final int TextAppearance_DeviceDefault_Widget_ActionMode_Title = 16974280; // 0x10301c8 + field public static final int TextAppearance_DeviceDefault_Widget_ActionMode_Title_Inverse = 16974284; // 0x10301cc + field public static final int TextAppearance_DeviceDefault_Widget_Button = 16974266; // 0x10301ba + field public static final int TextAppearance_DeviceDefault_Widget_DropDownHint = 16974271; // 0x10301bf + field public static final int TextAppearance_DeviceDefault_Widget_DropDownItem = 16974272; // 0x10301c0 + field public static final int TextAppearance_DeviceDefault_Widget_EditText = 16974274; // 0x10301c2 + field public static final int TextAppearance_DeviceDefault_Widget_IconMenu_Item = 16974267; // 0x10301bb + field public static final int TextAppearance_DeviceDefault_Widget_PopupMenu = 16974275; // 0x10301c3 + field public static final int TextAppearance_DeviceDefault_Widget_PopupMenu_Large = 16974276; // 0x10301c4 + field public static final int TextAppearance_DeviceDefault_Widget_PopupMenu_Small = 16974277; // 0x10301c5 + field public static final int TextAppearance_DeviceDefault_Widget_TabWidget = 16974268; // 0x10301bc + field public static final int TextAppearance_DeviceDefault_Widget_TextView = 16974269; // 0x10301bd + field public static final int TextAppearance_DeviceDefault_Widget_TextView_PopupMenu = 16974270; // 0x10301be + field public static final int TextAppearance_DeviceDefault_Widget_TextView_SpinnerItem = 16974273; // 0x10301c1 + field public static final int TextAppearance_DeviceDefault_WindowTitle = 16974263; // 0x10301b7 + field public static final int TextAppearance_DialogWindowTitle = 16973889; // 0x1030041 + field public static final int TextAppearance_Holo = 16974075; // 0x10300fb + field public static final int TextAppearance_Holo_DialogWindowTitle = 16974103; // 0x1030117 + field public static final int TextAppearance_Holo_Inverse = 16974076; // 0x10300fc + field public static final int TextAppearance_Holo_Large = 16974077; // 0x10300fd + field public static final int TextAppearance_Holo_Large_Inverse = 16974078; // 0x10300fe + field public static final int TextAppearance_Holo_Medium = 16974079; // 0x10300ff + field public static final int TextAppearance_Holo_Medium_Inverse = 16974080; // 0x1030100 + field public static final int TextAppearance_Holo_SearchResult_Subtitle = 16974084; // 0x1030104 + field public static final int TextAppearance_Holo_SearchResult_Title = 16974083; // 0x1030103 + field public static final int TextAppearance_Holo_Small = 16974081; // 0x1030101 + field public static final int TextAppearance_Holo_Small_Inverse = 16974082; // 0x1030102 + field public static final int TextAppearance_Holo_Widget = 16974085; // 0x1030105 + field public static final int TextAppearance_Holo_Widget_ActionBar_Menu = 16974112; // 0x1030120 + field public static final int TextAppearance_Holo_Widget_ActionBar_Subtitle = 16974099; // 0x1030113 + field public static final int TextAppearance_Holo_Widget_ActionBar_Subtitle_Inverse = 16974109; // 0x103011d + field public static final int TextAppearance_Holo_Widget_ActionBar_Title = 16974098; // 0x1030112 + field public static final int TextAppearance_Holo_Widget_ActionBar_Title_Inverse = 16974108; // 0x103011c + field public static final int TextAppearance_Holo_Widget_ActionMode_Subtitle = 16974101; // 0x1030115 + field public static final int TextAppearance_Holo_Widget_ActionMode_Subtitle_Inverse = 16974111; // 0x103011f + field public static final int TextAppearance_Holo_Widget_ActionMode_Title = 16974100; // 0x1030114 + field public static final int TextAppearance_Holo_Widget_ActionMode_Title_Inverse = 16974110; // 0x103011e + field public static final int TextAppearance_Holo_Widget_Button = 16974086; // 0x1030106 + field public static final int TextAppearance_Holo_Widget_DropDownHint = 16974091; // 0x103010b + field public static final int TextAppearance_Holo_Widget_DropDownItem = 16974092; // 0x103010c + field public static final int TextAppearance_Holo_Widget_EditText = 16974094; // 0x103010e + field public static final int TextAppearance_Holo_Widget_IconMenu_Item = 16974087; // 0x1030107 + field public static final int TextAppearance_Holo_Widget_PopupMenu = 16974095; // 0x103010f + field public static final int TextAppearance_Holo_Widget_PopupMenu_Large = 16974096; // 0x1030110 + field public static final int TextAppearance_Holo_Widget_PopupMenu_Small = 16974097; // 0x1030111 + field public static final int TextAppearance_Holo_Widget_TabWidget = 16974088; // 0x1030108 + field public static final int TextAppearance_Holo_Widget_TextView = 16974089; // 0x1030109 + field public static final int TextAppearance_Holo_Widget_TextView_PopupMenu = 16974090; // 0x103010a + field public static final int TextAppearance_Holo_Widget_TextView_SpinnerItem = 16974093; // 0x103010d + field public static final int TextAppearance_Holo_WindowTitle = 16974102; // 0x1030116 + field public static final int TextAppearance_Inverse = 16973887; // 0x103003f + field public static final int TextAppearance_Large = 16973890; // 0x1030042 + field public static final int TextAppearance_Large_Inverse = 16973891; // 0x1030043 + field public static final int TextAppearance_Medium = 16973892; // 0x1030044 + field public static final int TextAppearance_Medium_Inverse = 16973893; // 0x1030045 + field public static final int TextAppearance_Small = 16973894; // 0x1030046 + field public static final int TextAppearance_Small_Inverse = 16973895; // 0x1030047 + field public static final int TextAppearance_StatusBar_EventContent = 16973927; // 0x1030067 + field public static final int TextAppearance_StatusBar_EventContent_Title = 16973928; // 0x1030068 + field public static final int TextAppearance_StatusBar_Icon = 16973926; // 0x1030066 + field public static final int TextAppearance_StatusBar_Title = 16973925; // 0x1030065 + field public static final int TextAppearance_SuggestionHighlight = 16974104; // 0x1030118 + field public static final int TextAppearance_Theme = 16973888; // 0x1030040 + field public static final int TextAppearance_Theme_Dialog = 16973896; // 0x1030048 + field public static final int TextAppearance_Widget = 16973897; // 0x1030049 + field public static final int TextAppearance_Widget_Button = 16973898; // 0x103004a + field public static final int TextAppearance_Widget_DropDownHint = 16973904; // 0x1030050 + field public static final int TextAppearance_Widget_DropDownItem = 16973905; // 0x1030051 + field public static final int TextAppearance_Widget_EditText = 16973900; // 0x103004c + field public static final int TextAppearance_Widget_IconMenu_Item = 16973899; // 0x103004b + field public static final int TextAppearance_Widget_PopupMenu_Large = 16973952; // 0x1030080 + field public static final int TextAppearance_Widget_PopupMenu_Small = 16973953; // 0x1030081 + field public static final int TextAppearance_Widget_TabWidget = 16973901; // 0x103004d + field public static final int TextAppearance_Widget_TextView = 16973902; // 0x103004e + field public static final int TextAppearance_Widget_TextView_PopupMenu = 16973903; // 0x103004f + field public static final int TextAppearance_Widget_TextView_SpinnerItem = 16973906; // 0x1030052 + field public static final int TextAppearance_WindowTitle = 16973907; // 0x1030053 + field public static final int Theme = 16973829; // 0x1030005 + field public static final int Theme_Black = 16973832; // 0x1030008 + field public static final int Theme_Black_NoTitleBar = 16973833; // 0x1030009 + field public static final int Theme_Black_NoTitleBar_Fullscreen = 16973834; // 0x103000a + field public static final int Theme_DeviceDefault = 16974120; // 0x1030128 + field public static final int Theme_DeviceDefault_Dialog = 16974126; // 0x103012e + field public static final int Theme_DeviceDefault_DialogWhenLarge = 16974134; // 0x1030136 + field public static final int Theme_DeviceDefault_DialogWhenLarge_NoActionBar = 16974135; // 0x1030137 + field public static final int Theme_DeviceDefault_Dialog_MinWidth = 16974127; // 0x103012f + field public static final int Theme_DeviceDefault_Dialog_NoActionBar = 16974128; // 0x1030130 + field public static final int Theme_DeviceDefault_Dialog_NoActionBar_MinWidth = 16974129; // 0x1030131 + field public static final int Theme_DeviceDefault_InputMethod = 16974142; // 0x103013e + field public static final int Theme_DeviceDefault_Light = 16974123; // 0x103012b + field public static final int Theme_DeviceDefault_Light_DarkActionBar = 16974143; // 0x103013f + field public static final int Theme_DeviceDefault_Light_Dialog = 16974130; // 0x1030132 + field public static final int Theme_DeviceDefault_Light_DialogWhenLarge = 16974136; // 0x1030138 + field public static final int Theme_DeviceDefault_Light_DialogWhenLarge_NoActionBar = 16974137; // 0x1030139 + field public static final int Theme_DeviceDefault_Light_Dialog_MinWidth = 16974131; // 0x1030133 + field public static final int Theme_DeviceDefault_Light_Dialog_NoActionBar = 16974132; // 0x1030134 + field public static final int Theme_DeviceDefault_Light_Dialog_NoActionBar_MinWidth = 16974133; // 0x1030135 + field public static final int Theme_DeviceDefault_Light_NoActionBar = 16974124; // 0x103012c + field public static final int Theme_DeviceDefault_Light_NoActionBar_Fullscreen = 16974125; // 0x103012d + field public static final int Theme_DeviceDefault_Light_Panel = 16974139; // 0x103013b + field public static final int Theme_DeviceDefault_NoActionBar = 16974121; // 0x1030129 + field public static final int Theme_DeviceDefault_NoActionBar_Fullscreen = 16974122; // 0x103012a + field public static final int Theme_DeviceDefault_Panel = 16974138; // 0x103013a + field public static final int Theme_DeviceDefault_Wallpaper = 16974140; // 0x103013c + field public static final int Theme_DeviceDefault_Wallpaper_NoTitleBar = 16974141; // 0x103013d + field public static final int Theme_Dialog = 16973835; // 0x103000b + field public static final int Theme_Holo = 16973931; // 0x103006b + field public static final int Theme_Holo_Dialog = 16973935; // 0x103006f + field public static final int Theme_Holo_DialogWhenLarge = 16973943; // 0x1030077 + field public static final int Theme_Holo_DialogWhenLarge_NoActionBar = 16973944; // 0x1030078 + field public static final int Theme_Holo_Dialog_MinWidth = 16973936; // 0x1030070 + field public static final int Theme_Holo_Dialog_NoActionBar = 16973937; // 0x1030071 + field public static final int Theme_Holo_Dialog_NoActionBar_MinWidth = 16973938; // 0x1030072 + field public static final int Theme_Holo_InputMethod = 16973951; // 0x103007f + field public static final int Theme_Holo_Light = 16973934; // 0x103006e + field public static final int Theme_Holo_Light_DarkActionBar = 16974105; // 0x1030119 + field public static final int Theme_Holo_Light_Dialog = 16973939; // 0x1030073 + field public static final int Theme_Holo_Light_DialogWhenLarge = 16973945; // 0x1030079 + field public static final int Theme_Holo_Light_DialogWhenLarge_NoActionBar = 16973946; // 0x103007a + field public static final int Theme_Holo_Light_Dialog_MinWidth = 16973940; // 0x1030074 + field public static final int Theme_Holo_Light_Dialog_NoActionBar = 16973941; // 0x1030075 + field public static final int Theme_Holo_Light_Dialog_NoActionBar_MinWidth = 16973942; // 0x1030076 + field public static final int Theme_Holo_Light_NoActionBar = 16974064; // 0x10300f0 + field public static final int Theme_Holo_Light_NoActionBar_Fullscreen = 16974065; // 0x10300f1 + field public static final int Theme_Holo_Light_Panel = 16973948; // 0x103007c + field public static final int Theme_Holo_NoActionBar = 16973932; // 0x103006c + field public static final int Theme_Holo_NoActionBar_Fullscreen = 16973933; // 0x103006d + field public static final int Theme_Holo_Panel = 16973947; // 0x103007b + field public static final int Theme_Holo_Wallpaper = 16973949; // 0x103007d + field public static final int Theme_Holo_Wallpaper_NoTitleBar = 16973950; // 0x103007e + field public static final int Theme_InputMethod = 16973908; // 0x1030054 + field public static final int Theme_Light = 16973836; // 0x103000c + field public static final int Theme_Light_NoTitleBar = 16973837; // 0x103000d + field public static final int Theme_Light_NoTitleBar_Fullscreen = 16973838; // 0x103000e + field public static final int Theme_Light_Panel = 16973914; // 0x103005a + field public static final int Theme_Light_WallpaperSettings = 16973922; // 0x1030062 + field public static final int Theme_NoDisplay = 16973909; // 0x1030055 + field public static final int Theme_NoTitleBar = 16973830; // 0x1030006 + field public static final int Theme_NoTitleBar_Fullscreen = 16973831; // 0x1030007 + field public static final int Theme_NoTitleBar_OverlayActionModes = 16973930; // 0x103006a + field public static final int Theme_Panel = 16973913; // 0x1030059 + field public static final int Theme_Translucent = 16973839; // 0x103000f + field public static final int Theme_Translucent_NoTitleBar = 16973840; // 0x1030010 + field public static final int Theme_Translucent_NoTitleBar_Fullscreen = 16973841; // 0x1030011 + field public static final int Theme_Wallpaper = 16973918; // 0x103005e + field public static final int Theme_WallpaperSettings = 16973921; // 0x1030061 + field public static final int Theme_Wallpaper_NoTitleBar = 16973919; // 0x103005f + field public static final int Theme_Wallpaper_NoTitleBar_Fullscreen = 16973920; // 0x1030060 + field public static final int Theme_WithActionBar = 16973929; // 0x1030069 + field public static final int Widget = 16973842; // 0x1030012 + field public static final int Widget_AbsListView = 16973843; // 0x1030013 + field public static final int Widget_ActionBar = 16973954; // 0x1030082 + field public static final int Widget_ActionBar_TabBar = 16974068; // 0x10300f4 + field public static final int Widget_ActionBar_TabText = 16974067; // 0x10300f3 + field public static final int Widget_ActionBar_TabView = 16974066; // 0x10300f2 + field public static final int Widget_ActionButton = 16973956; // 0x1030084 + field public static final int Widget_ActionButton_CloseMode = 16973960; // 0x1030088 + field public static final int Widget_ActionButton_Overflow = 16973959; // 0x1030087 + field public static final int Widget_AutoCompleteTextView = 16973863; // 0x1030027 + field public static final int Widget_Button = 16973844; // 0x1030014 + field public static final int Widget_Button_Inset = 16973845; // 0x1030015 + field public static final int Widget_Button_Small = 16973846; // 0x1030016 + field public static final int Widget_Button_Toggle = 16973847; // 0x1030017 + field public static final int Widget_CalendarView = 16974059; // 0x10300eb + field public static final int Widget_CompoundButton = 16973848; // 0x1030018 + field public static final int Widget_CompoundButton_CheckBox = 16973849; // 0x1030019 + field public static final int Widget_CompoundButton_RadioButton = 16973850; // 0x103001a + field public static final int Widget_CompoundButton_Star = 16973851; // 0x103001b + field public static final int Widget_DatePicker = 16974062; // 0x10300ee + field public static final int Widget_DeviceDefault = 16974144; // 0x1030140 + field public static final int Widget_DeviceDefault_ActionBar = 16974187; // 0x103016b + field public static final int Widget_DeviceDefault_ActionBar_Solid = 16974195; // 0x1030173 + field public static final int Widget_DeviceDefault_ActionBar_TabBar = 16974194; // 0x1030172 + field public static final int Widget_DeviceDefault_ActionBar_TabText = 16974193; // 0x1030171 + field public static final int Widget_DeviceDefault_ActionBar_TabView = 16974192; // 0x1030170 + field public static final int Widget_DeviceDefault_ActionButton = 16974182; // 0x1030166 + field public static final int Widget_DeviceDefault_ActionButton_CloseMode = 16974186; // 0x103016a + field public static final int Widget_DeviceDefault_ActionButton_Overflow = 16974183; // 0x1030167 + field public static final int Widget_DeviceDefault_ActionButton_TextButton = 16974184; // 0x1030168 + field public static final int Widget_DeviceDefault_ActionMode = 16974185; // 0x1030169 + field public static final int Widget_DeviceDefault_AutoCompleteTextView = 16974151; // 0x1030147 + field public static final int Widget_DeviceDefault_Button = 16974145; // 0x1030141 + field public static final int Widget_DeviceDefault_Button_Borderless = 16974188; // 0x103016c + field public static final int Widget_DeviceDefault_Button_Borderless_Small = 16974149; // 0x1030145 + field public static final int Widget_DeviceDefault_Button_Inset = 16974147; // 0x1030143 + field public static final int Widget_DeviceDefault_Button_Small = 16974146; // 0x1030142 + field public static final int Widget_DeviceDefault_Button_Toggle = 16974148; // 0x1030144 + field public static final int Widget_DeviceDefault_CalendarView = 16974190; // 0x103016e + field public static final int Widget_DeviceDefault_CheckedTextView = 16974299; // 0x10301db + field public static final int Widget_DeviceDefault_CompoundButton_CheckBox = 16974152; // 0x1030148 + field public static final int Widget_DeviceDefault_CompoundButton_RadioButton = 16974169; // 0x1030159 + field public static final int Widget_DeviceDefault_CompoundButton_Star = 16974173; // 0x103015d + field public static final int Widget_DeviceDefault_DatePicker = 16974191; // 0x103016f + field public static final int Widget_DeviceDefault_DropDownItem = 16974177; // 0x1030161 + field public static final int Widget_DeviceDefault_DropDownItem_Spinner = 16974178; // 0x1030162 + field public static final int Widget_DeviceDefault_EditText = 16974154; // 0x103014a + field public static final int Widget_DeviceDefault_ExpandableListView = 16974155; // 0x103014b + field public static final int Widget_DeviceDefault_GridView = 16974156; // 0x103014c + field public static final int Widget_DeviceDefault_HorizontalScrollView = 16974171; // 0x103015b + field public static final int Widget_DeviceDefault_ImageButton = 16974157; // 0x103014d + field public static final int Widget_DeviceDefault_Light = 16974196; // 0x1030174 + field public static final int Widget_DeviceDefault_Light_ActionBar = 16974243; // 0x10301a3 + field public static final int Widget_DeviceDefault_Light_ActionBar_Solid = 16974247; // 0x10301a7 + field public static final int Widget_DeviceDefault_Light_ActionBar_Solid_Inverse = 16974248; // 0x10301a8 + field public static final int Widget_DeviceDefault_Light_ActionBar_TabBar = 16974246; // 0x10301a6 + field public static final int Widget_DeviceDefault_Light_ActionBar_TabBar_Inverse = 16974249; // 0x10301a9 + field public static final int Widget_DeviceDefault_Light_ActionBar_TabText = 16974245; // 0x10301a5 + field public static final int Widget_DeviceDefault_Light_ActionBar_TabText_Inverse = 16974251; // 0x10301ab + field public static final int Widget_DeviceDefault_Light_ActionBar_TabView = 16974244; // 0x10301a4 + field public static final int Widget_DeviceDefault_Light_ActionBar_TabView_Inverse = 16974250; // 0x10301aa + field public static final int Widget_DeviceDefault_Light_ActionButton = 16974239; // 0x103019f + field public static final int Widget_DeviceDefault_Light_ActionButton_CloseMode = 16974242; // 0x10301a2 + field public static final int Widget_DeviceDefault_Light_ActionButton_Overflow = 16974240; // 0x10301a0 + field public static final int Widget_DeviceDefault_Light_ActionMode = 16974241; // 0x10301a1 + field public static final int Widget_DeviceDefault_Light_ActionMode_Inverse = 16974252; // 0x10301ac + field public static final int Widget_DeviceDefault_Light_AutoCompleteTextView = 16974203; // 0x103017b + field public static final int Widget_DeviceDefault_Light_Button = 16974197; // 0x1030175 + field public static final int Widget_DeviceDefault_Light_Button_Borderless_Small = 16974201; // 0x1030179 + field public static final int Widget_DeviceDefault_Light_Button_Inset = 16974199; // 0x1030177 + field public static final int Widget_DeviceDefault_Light_Button_Small = 16974198; // 0x1030176 + field public static final int Widget_DeviceDefault_Light_Button_Toggle = 16974200; // 0x1030178 + field public static final int Widget_DeviceDefault_Light_CalendarView = 16974238; // 0x103019e + field public static final int Widget_DeviceDefault_Light_CheckedTextView = 16974300; // 0x10301dc + field public static final int Widget_DeviceDefault_Light_CompoundButton_CheckBox = 16974204; // 0x103017c + field public static final int Widget_DeviceDefault_Light_CompoundButton_RadioButton = 16974224; // 0x1030190 + field public static final int Widget_DeviceDefault_Light_CompoundButton_Star = 16974228; // 0x1030194 + field public static final int Widget_DeviceDefault_Light_DropDownItem = 16974232; // 0x1030198 + field public static final int Widget_DeviceDefault_Light_DropDownItem_Spinner = 16974233; // 0x1030199 + field public static final int Widget_DeviceDefault_Light_EditText = 16974206; // 0x103017e + field public static final int Widget_DeviceDefault_Light_ExpandableListView = 16974207; // 0x103017f + field public static final int Widget_DeviceDefault_Light_GridView = 16974208; // 0x1030180 + field public static final int Widget_DeviceDefault_Light_HorizontalScrollView = 16974226; // 0x1030192 + field public static final int Widget_DeviceDefault_Light_ImageButton = 16974209; // 0x1030181 + field public static final int Widget_DeviceDefault_Light_ListPopupWindow = 16974235; // 0x103019b + field public static final int Widget_DeviceDefault_Light_ListView = 16974210; // 0x1030182 + field public static final int Widget_DeviceDefault_Light_ListView_DropDown = 16974205; // 0x103017d + field public static final int Widget_DeviceDefault_Light_MediaRouteButton = 16974296; // 0x10301d8 + field public static final int Widget_DeviceDefault_Light_PopupMenu = 16974236; // 0x103019c + field public static final int Widget_DeviceDefault_Light_PopupWindow = 16974211; // 0x1030183 + field public static final int Widget_DeviceDefault_Light_ProgressBar = 16974212; // 0x1030184 + field public static final int Widget_DeviceDefault_Light_ProgressBar_Horizontal = 16974213; // 0x1030185 + field public static final int Widget_DeviceDefault_Light_ProgressBar_Inverse = 16974217; // 0x1030189 + field public static final int Widget_DeviceDefault_Light_ProgressBar_Large = 16974216; // 0x1030188 + field public static final int Widget_DeviceDefault_Light_ProgressBar_Large_Inverse = 16974219; // 0x103018b + field public static final int Widget_DeviceDefault_Light_ProgressBar_Small = 16974214; // 0x1030186 + field public static final int Widget_DeviceDefault_Light_ProgressBar_Small_Inverse = 16974218; // 0x103018a + field public static final int Widget_DeviceDefault_Light_ProgressBar_Small_Title = 16974215; // 0x1030187 + field public static final int Widget_DeviceDefault_Light_RatingBar = 16974221; // 0x103018d + field public static final int Widget_DeviceDefault_Light_RatingBar_Indicator = 16974222; // 0x103018e + field public static final int Widget_DeviceDefault_Light_RatingBar_Small = 16974223; // 0x103018f + field public static final int Widget_DeviceDefault_Light_ScrollView = 16974225; // 0x1030191 + field public static final int Widget_DeviceDefault_Light_SeekBar = 16974220; // 0x103018c + field public static final int Widget_DeviceDefault_Light_Spinner = 16974227; // 0x1030193 + field public static final int Widget_DeviceDefault_Light_Tab = 16974237; // 0x103019d + field public static final int Widget_DeviceDefault_Light_TabWidget = 16974229; // 0x1030195 + field public static final int Widget_DeviceDefault_Light_TextView = 16974202; // 0x103017a + field public static final int Widget_DeviceDefault_Light_TextView_SpinnerItem = 16974234; // 0x103019a + field public static final int Widget_DeviceDefault_Light_WebTextView = 16974230; // 0x1030196 + field public static final int Widget_DeviceDefault_Light_WebView = 16974231; // 0x1030197 + field public static final int Widget_DeviceDefault_ListPopupWindow = 16974180; // 0x1030164 + field public static final int Widget_DeviceDefault_ListView = 16974158; // 0x103014e + field public static final int Widget_DeviceDefault_ListView_DropDown = 16974153; // 0x1030149 + field public static final int Widget_DeviceDefault_MediaRouteButton = 16974295; // 0x10301d7 + field public static final int Widget_DeviceDefault_PopupMenu = 16974181; // 0x1030165 + field public static final int Widget_DeviceDefault_PopupWindow = 16974159; // 0x103014f + field public static final int Widget_DeviceDefault_ProgressBar = 16974160; // 0x1030150 + field public static final int Widget_DeviceDefault_ProgressBar_Horizontal = 16974161; // 0x1030151 + field public static final int Widget_DeviceDefault_ProgressBar_Large = 16974164; // 0x1030154 + field public static final int Widget_DeviceDefault_ProgressBar_Small = 16974162; // 0x1030152 + field public static final int Widget_DeviceDefault_ProgressBar_Small_Title = 16974163; // 0x1030153 + field public static final int Widget_DeviceDefault_RatingBar = 16974166; // 0x1030156 + field public static final int Widget_DeviceDefault_RatingBar_Indicator = 16974167; // 0x1030157 + field public static final int Widget_DeviceDefault_RatingBar_Small = 16974168; // 0x1030158 + field public static final int Widget_DeviceDefault_ScrollView = 16974170; // 0x103015a + field public static final int Widget_DeviceDefault_SeekBar = 16974165; // 0x1030155 + field public static final int Widget_DeviceDefault_Spinner = 16974172; // 0x103015c + field public static final int Widget_DeviceDefault_Tab = 16974189; // 0x103016d + field public static final int Widget_DeviceDefault_TabWidget = 16974174; // 0x103015e + field public static final int Widget_DeviceDefault_TextView = 16974150; // 0x1030146 + field public static final int Widget_DeviceDefault_TextView_SpinnerItem = 16974179; // 0x1030163 + field public static final int Widget_DeviceDefault_WebTextView = 16974175; // 0x103015f + field public static final int Widget_DeviceDefault_WebView = 16974176; // 0x1030160 + field public static final int Widget_DropDownItem = 16973867; // 0x103002b + field public static final int Widget_DropDownItem_Spinner = 16973868; // 0x103002c + field public static final int Widget_EditText = 16973859; // 0x1030023 + field public static final int Widget_ExpandableListView = 16973860; // 0x1030024 + field public static final int Widget_FragmentBreadCrumbs = 16973961; // 0x1030089 + field public static final int Widget_Gallery = 16973877; // 0x1030035 + field public static final int Widget_GridView = 16973874; // 0x1030032 + field public static final int Widget_Holo = 16973962; // 0x103008a + field public static final int Widget_Holo_ActionBar = 16974004; // 0x10300b4 + field public static final int Widget_Holo_ActionBar_Solid = 16974113; // 0x1030121 + field public static final int Widget_Holo_ActionBar_TabBar = 16974071; // 0x10300f7 + field public static final int Widget_Holo_ActionBar_TabText = 16974070; // 0x10300f6 + field public static final int Widget_Holo_ActionBar_TabView = 16974069; // 0x10300f5 + field public static final int Widget_Holo_ActionButton = 16973999; // 0x10300af + field public static final int Widget_Holo_ActionButton_CloseMode = 16974003; // 0x10300b3 + field public static final int Widget_Holo_ActionButton_Overflow = 16974000; // 0x10300b0 + field public static final int Widget_Holo_ActionButton_TextButton = 16974001; // 0x10300b1 + field public static final int Widget_Holo_ActionMode = 16974002; // 0x10300b2 + field public static final int Widget_Holo_AutoCompleteTextView = 16973968; // 0x1030090 + field public static final int Widget_Holo_Button = 16973963; // 0x103008b + field public static final int Widget_Holo_Button_Borderless = 16974050; // 0x10300e2 + field public static final int Widget_Holo_Button_Borderless_Small = 16974106; // 0x103011a + field public static final int Widget_Holo_Button_Inset = 16973965; // 0x103008d + field public static final int Widget_Holo_Button_Small = 16973964; // 0x103008c + field public static final int Widget_Holo_Button_Toggle = 16973966; // 0x103008e + field public static final int Widget_Holo_CalendarView = 16974060; // 0x10300ec + field public static final int Widget_Holo_CheckedTextView = 16974297; // 0x10301d9 + field public static final int Widget_Holo_CompoundButton_CheckBox = 16973969; // 0x1030091 + field public static final int Widget_Holo_CompoundButton_RadioButton = 16973986; // 0x10300a2 + field public static final int Widget_Holo_CompoundButton_Star = 16973990; // 0x10300a6 + field public static final int Widget_Holo_DatePicker = 16974063; // 0x10300ef + field public static final int Widget_Holo_DropDownItem = 16973994; // 0x10300aa + field public static final int Widget_Holo_DropDownItem_Spinner = 16973995; // 0x10300ab + field public static final int Widget_Holo_EditText = 16973971; // 0x1030093 + field public static final int Widget_Holo_ExpandableListView = 16973972; // 0x1030094 + field public static final int Widget_Holo_GridView = 16973973; // 0x1030095 + field public static final int Widget_Holo_HorizontalScrollView = 16973988; // 0x10300a4 + field public static final int Widget_Holo_ImageButton = 16973974; // 0x1030096 + field public static final int Widget_Holo_Light = 16974005; // 0x10300b5 + field public static final int Widget_Holo_Light_ActionBar = 16974049; // 0x10300e1 + field public static final int Widget_Holo_Light_ActionBar_Solid = 16974114; // 0x1030122 + field public static final int Widget_Holo_Light_ActionBar_Solid_Inverse = 16974115; // 0x1030123 + field public static final int Widget_Holo_Light_ActionBar_TabBar = 16974074; // 0x10300fa + field public static final int Widget_Holo_Light_ActionBar_TabBar_Inverse = 16974116; // 0x1030124 + field public static final int Widget_Holo_Light_ActionBar_TabText = 16974073; // 0x10300f9 + field public static final int Widget_Holo_Light_ActionBar_TabText_Inverse = 16974118; // 0x1030126 + field public static final int Widget_Holo_Light_ActionBar_TabView = 16974072; // 0x10300f8 + field public static final int Widget_Holo_Light_ActionBar_TabView_Inverse = 16974117; // 0x1030125 + field public static final int Widget_Holo_Light_ActionButton = 16974045; // 0x10300dd + field public static final int Widget_Holo_Light_ActionButton_CloseMode = 16974048; // 0x10300e0 + field public static final int Widget_Holo_Light_ActionButton_Overflow = 16974046; // 0x10300de + field public static final int Widget_Holo_Light_ActionMode = 16974047; // 0x10300df + field public static final int Widget_Holo_Light_ActionMode_Inverse = 16974119; // 0x1030127 + field public static final int Widget_Holo_Light_AutoCompleteTextView = 16974011; // 0x10300bb + field public static final int Widget_Holo_Light_Button = 16974006; // 0x10300b6 + field public static final int Widget_Holo_Light_Button_Borderless_Small = 16974107; // 0x103011b + field public static final int Widget_Holo_Light_Button_Inset = 16974008; // 0x10300b8 + field public static final int Widget_Holo_Light_Button_Small = 16974007; // 0x10300b7 + field public static final int Widget_Holo_Light_Button_Toggle = 16974009; // 0x10300b9 + field public static final int Widget_Holo_Light_CalendarView = 16974061; // 0x10300ed + field public static final int Widget_Holo_Light_CheckedTextView = 16974298; // 0x10301da + field public static final int Widget_Holo_Light_CompoundButton_CheckBox = 16974012; // 0x10300bc + field public static final int Widget_Holo_Light_CompoundButton_RadioButton = 16974032; // 0x10300d0 + field public static final int Widget_Holo_Light_CompoundButton_Star = 16974036; // 0x10300d4 + field public static final int Widget_Holo_Light_DropDownItem = 16974040; // 0x10300d8 + field public static final int Widget_Holo_Light_DropDownItem_Spinner = 16974041; // 0x10300d9 + field public static final int Widget_Holo_Light_EditText = 16974014; // 0x10300be + field public static final int Widget_Holo_Light_ExpandableListView = 16974015; // 0x10300bf + field public static final int Widget_Holo_Light_GridView = 16974016; // 0x10300c0 + field public static final int Widget_Holo_Light_HorizontalScrollView = 16974034; // 0x10300d2 + field public static final int Widget_Holo_Light_ImageButton = 16974017; // 0x10300c1 + field public static final int Widget_Holo_Light_ListPopupWindow = 16974043; // 0x10300db + field public static final int Widget_Holo_Light_ListView = 16974018; // 0x10300c2 + field public static final int Widget_Holo_Light_ListView_DropDown = 16974013; // 0x10300bd + field public static final int Widget_Holo_Light_MediaRouteButton = 16974294; // 0x10301d6 + field public static final int Widget_Holo_Light_PopupMenu = 16974044; // 0x10300dc + field public static final int Widget_Holo_Light_PopupWindow = 16974019; // 0x10300c3 + field public static final int Widget_Holo_Light_ProgressBar = 16974020; // 0x10300c4 + field public static final int Widget_Holo_Light_ProgressBar_Horizontal = 16974021; // 0x10300c5 + field public static final int Widget_Holo_Light_ProgressBar_Inverse = 16974025; // 0x10300c9 + field public static final int Widget_Holo_Light_ProgressBar_Large = 16974024; // 0x10300c8 + field public static final int Widget_Holo_Light_ProgressBar_Large_Inverse = 16974027; // 0x10300cb + field public static final int Widget_Holo_Light_ProgressBar_Small = 16974022; // 0x10300c6 + field public static final int Widget_Holo_Light_ProgressBar_Small_Inverse = 16974026; // 0x10300ca + field public static final int Widget_Holo_Light_ProgressBar_Small_Title = 16974023; // 0x10300c7 + field public static final int Widget_Holo_Light_RatingBar = 16974029; // 0x10300cd + field public static final int Widget_Holo_Light_RatingBar_Indicator = 16974030; // 0x10300ce + field public static final int Widget_Holo_Light_RatingBar_Small = 16974031; // 0x10300cf + field public static final int Widget_Holo_Light_ScrollView = 16974033; // 0x10300d1 + field public static final int Widget_Holo_Light_SeekBar = 16974028; // 0x10300cc + field public static final int Widget_Holo_Light_Spinner = 16974035; // 0x10300d3 + field public static final int Widget_Holo_Light_Tab = 16974052; // 0x10300e4 + field public static final int Widget_Holo_Light_TabWidget = 16974037; // 0x10300d5 + field public static final int Widget_Holo_Light_TextView = 16974010; // 0x10300ba + field public static final int Widget_Holo_Light_TextView_SpinnerItem = 16974042; // 0x10300da + field public static final int Widget_Holo_Light_WebTextView = 16974038; // 0x10300d6 + field public static final int Widget_Holo_Light_WebView = 16974039; // 0x10300d7 + field public static final int Widget_Holo_ListPopupWindow = 16973997; // 0x10300ad + field public static final int Widget_Holo_ListView = 16973975; // 0x1030097 + field public static final int Widget_Holo_ListView_DropDown = 16973970; // 0x1030092 + field public static final int Widget_Holo_MediaRouteButton = 16974293; // 0x10301d5 + field public static final int Widget_Holo_PopupMenu = 16973998; // 0x10300ae + field public static final int Widget_Holo_PopupWindow = 16973976; // 0x1030098 + field public static final int Widget_Holo_ProgressBar = 16973977; // 0x1030099 + field public static final int Widget_Holo_ProgressBar_Horizontal = 16973978; // 0x103009a + field public static final int Widget_Holo_ProgressBar_Large = 16973981; // 0x103009d + field public static final int Widget_Holo_ProgressBar_Small = 16973979; // 0x103009b + field public static final int Widget_Holo_ProgressBar_Small_Title = 16973980; // 0x103009c + field public static final int Widget_Holo_RatingBar = 16973983; // 0x103009f + field public static final int Widget_Holo_RatingBar_Indicator = 16973984; // 0x10300a0 + field public static final int Widget_Holo_RatingBar_Small = 16973985; // 0x10300a1 + field public static final int Widget_Holo_ScrollView = 16973987; // 0x10300a3 + field public static final int Widget_Holo_SeekBar = 16973982; // 0x103009e + field public static final int Widget_Holo_Spinner = 16973989; // 0x10300a5 + field public static final int Widget_Holo_Tab = 16974051; // 0x10300e3 + field public static final int Widget_Holo_TabWidget = 16973991; // 0x10300a7 + field public static final int Widget_Holo_TextView = 16973967; // 0x103008f + field public static final int Widget_Holo_TextView_SpinnerItem = 16973996; // 0x10300ac + field public static final int Widget_Holo_WebTextView = 16973992; // 0x10300a8 + field public static final int Widget_Holo_WebView = 16973993; // 0x10300a9 + field public static final int Widget_ImageButton = 16973862; // 0x1030026 + field public static final int Widget_ImageWell = 16973861; // 0x1030025 + field public static final int Widget_KeyboardView = 16973911; // 0x1030057 + field public static final int Widget_ListPopupWindow = 16973957; // 0x1030085 + field public static final int Widget_ListView = 16973870; // 0x103002e + field public static final int Widget_ListView_DropDown = 16973872; // 0x1030030 + field public static final int Widget_ListView_Menu = 16973873; // 0x1030031 + field public static final int Widget_ListView_White = 16973871; // 0x103002f + field public static final int Widget_PopupMenu = 16973958; // 0x1030086 + field public static final int Widget_PopupWindow = 16973878; // 0x1030036 + field public static final int Widget_ProgressBar = 16973852; // 0x103001c + field public static final int Widget_ProgressBar_Horizontal = 16973855; // 0x103001f + field public static final int Widget_ProgressBar_Inverse = 16973915; // 0x103005b + field public static final int Widget_ProgressBar_Large = 16973853; // 0x103001d + field public static final int Widget_ProgressBar_Large_Inverse = 16973916; // 0x103005c + field public static final int Widget_ProgressBar_Small = 16973854; // 0x103001e + field public static final int Widget_ProgressBar_Small_Inverse = 16973917; // 0x103005d + field public static final int Widget_RatingBar = 16973857; // 0x1030021 + field public static final int Widget_ScrollView = 16973869; // 0x103002d + field public static final int Widget_SeekBar = 16973856; // 0x1030020 + field public static final int Widget_Spinner = 16973864; // 0x1030028 + field public static final int Widget_Spinner_DropDown = 16973955; // 0x1030083 + field public static final int Widget_TabWidget = 16973876; // 0x1030034 + field public static final int Widget_TextView = 16973858; // 0x1030022 + field public static final int Widget_TextView_PopupMenu = 16973865; // 0x1030029 + field public static final int Widget_TextView_SpinnerItem = 16973866; // 0x103002a + field public static final int Widget_WebView = 16973875; // 0x1030033 + } + + public static final class R.xml { + ctor public R.xml(); + } + +} + +package android.accessibilityservice { + + public abstract class AccessibilityService extends android.app.Service { + ctor public AccessibilityService(); + method public android.view.accessibility.AccessibilityNodeInfo getRootInActiveWindow(); + method public final android.accessibilityservice.AccessibilityServiceInfo getServiceInfo(); + method public abstract void onAccessibilityEvent(android.view.accessibility.AccessibilityEvent); + method public final android.os.IBinder onBind(android.content.Intent); + method protected boolean onGesture(int); + method public abstract void onInterrupt(); + method protected void onServiceConnected(); + method public final boolean performGlobalAction(int); + method public final void setServiceInfo(android.accessibilityservice.AccessibilityServiceInfo); + field public static final int GESTURE_SWIPE_DOWN = 2; // 0x2 + field public static final int GESTURE_SWIPE_DOWN_AND_LEFT = 15; // 0xf + field public static final int GESTURE_SWIPE_DOWN_AND_RIGHT = 16; // 0x10 + field public static final int GESTURE_SWIPE_DOWN_AND_UP = 8; // 0x8 + field public static final int GESTURE_SWIPE_LEFT = 3; // 0x3 + field public static final int GESTURE_SWIPE_LEFT_AND_DOWN = 10; // 0xa + field public static final int GESTURE_SWIPE_LEFT_AND_RIGHT = 5; // 0x5 + field public static final int GESTURE_SWIPE_LEFT_AND_UP = 9; // 0x9 + field public static final int GESTURE_SWIPE_RIGHT = 4; // 0x4 + field public static final int GESTURE_SWIPE_RIGHT_AND_DOWN = 12; // 0xc + field public static final int GESTURE_SWIPE_RIGHT_AND_LEFT = 6; // 0x6 + field public static final int GESTURE_SWIPE_RIGHT_AND_UP = 11; // 0xb + field public static final int GESTURE_SWIPE_UP = 1; // 0x1 + field public static final int GESTURE_SWIPE_UP_AND_DOWN = 7; // 0x7 + field public static final int GESTURE_SWIPE_UP_AND_LEFT = 13; // 0xd + field public static final int GESTURE_SWIPE_UP_AND_RIGHT = 14; // 0xe + field public static final int GLOBAL_ACTION_BACK = 1; // 0x1 + field public static final int GLOBAL_ACTION_HOME = 2; // 0x2 + field public static final int GLOBAL_ACTION_NOTIFICATIONS = 4; // 0x4 + field public static final int GLOBAL_ACTION_QUICK_SETTINGS = 5; // 0x5 + field public static final int GLOBAL_ACTION_RECENTS = 3; // 0x3 + field public static final java.lang.String SERVICE_INTERFACE = "android.accessibilityservice.AccessibilityService"; + field public static final java.lang.String SERVICE_META_DATA = "android.accessibilityservice"; + } + + public class AccessibilityServiceInfo implements android.os.Parcelable { + ctor public AccessibilityServiceInfo(); + method public int describeContents(); + method public static java.lang.String feedbackTypeToString(int); + method public static java.lang.String flagToString(int); + method public boolean getCanRetrieveWindowContent(); + method public deprecated java.lang.String getDescription(); + method public java.lang.String getId(); + method public android.content.pm.ResolveInfo getResolveInfo(); + method public java.lang.String getSettingsActivityName(); + method public java.lang.String loadDescription(android.content.pm.PackageManager); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + field public static final int DEFAULT = 1; // 0x1 + field public static final int FEEDBACK_ALL_MASK = -1; // 0xffffffff + field public static final int FEEDBACK_AUDIBLE = 4; // 0x4 + field public static final int FEEDBACK_BRAILLE = 32; // 0x20 + field public static final int FEEDBACK_GENERIC = 16; // 0x10 + field public static final int FEEDBACK_HAPTIC = 2; // 0x2 + field public static final int FEEDBACK_SPOKEN = 1; // 0x1 + field public static final int FEEDBACK_VISUAL = 8; // 0x8 + field public static final int FLAG_INCLUDE_NOT_IMPORTANT_VIEWS = 2; // 0x2 + field public static final int FLAG_REQUEST_TOUCH_EXPLORATION_MODE = 4; // 0x4 + field public int eventTypes; + field public int feedbackType; + field public int flags; + field public long notificationTimeout; + field public java.lang.String[] packageNames; + } + +} + +package android.accounts { + + public abstract class AbstractAccountAuthenticator { + ctor public AbstractAccountAuthenticator(android.content.Context); + method public abstract android.os.Bundle addAccount(android.accounts.AccountAuthenticatorResponse, java.lang.String, java.lang.String, java.lang.String[], android.os.Bundle) throws android.accounts.NetworkErrorException; + method public abstract android.os.Bundle confirmCredentials(android.accounts.AccountAuthenticatorResponse, android.accounts.Account, android.os.Bundle) throws android.accounts.NetworkErrorException; + method public abstract android.os.Bundle editProperties(android.accounts.AccountAuthenticatorResponse, java.lang.String); + method public android.os.Bundle getAccountRemovalAllowed(android.accounts.AccountAuthenticatorResponse, android.accounts.Account) throws android.accounts.NetworkErrorException; + method public abstract android.os.Bundle getAuthToken(android.accounts.AccountAuthenticatorResponse, android.accounts.Account, java.lang.String, android.os.Bundle) throws android.accounts.NetworkErrorException; + method public abstract java.lang.String getAuthTokenLabel(java.lang.String); + method public final android.os.IBinder getIBinder(); + method public abstract android.os.Bundle hasFeatures(android.accounts.AccountAuthenticatorResponse, android.accounts.Account, java.lang.String[]) throws android.accounts.NetworkErrorException; + method public abstract android.os.Bundle updateCredentials(android.accounts.AccountAuthenticatorResponse, android.accounts.Account, java.lang.String, android.os.Bundle) throws android.accounts.NetworkErrorException; + } + + public class Account implements android.os.Parcelable { + ctor public Account(java.lang.String, java.lang.String); + ctor public Account(android.os.Parcel); + method public int describeContents(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + field public final java.lang.String name; + field public final java.lang.String type; + } + + public class AccountAuthenticatorActivity extends android.app.Activity { + ctor public AccountAuthenticatorActivity(); + method public final void setAccountAuthenticatorResult(android.os.Bundle); + } + + public class AccountAuthenticatorResponse implements android.os.Parcelable { + ctor public AccountAuthenticatorResponse(android.os.Parcel); + method public int describeContents(); + method public void onError(int, java.lang.String); + method public void onRequestContinued(); + method public void onResult(android.os.Bundle); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + } + + public class AccountManager { + method public android.accounts.AccountManagerFuture addAccount(java.lang.String, java.lang.String, java.lang.String[], android.os.Bundle, android.app.Activity, android.accounts.AccountManagerCallback, android.os.Handler); + method public boolean addAccountExplicitly(android.accounts.Account, java.lang.String, android.os.Bundle); + method public void addOnAccountsUpdatedListener(android.accounts.OnAccountsUpdateListener, android.os.Handler, boolean); + method public java.lang.String blockingGetAuthToken(android.accounts.Account, java.lang.String, boolean) throws android.accounts.AuthenticatorException, java.io.IOException, android.accounts.OperationCanceledException; + method public void clearPassword(android.accounts.Account); + method public android.accounts.AccountManagerFuture confirmCredentials(android.accounts.Account, android.os.Bundle, android.app.Activity, android.accounts.AccountManagerCallback, android.os.Handler); + method public android.accounts.AccountManagerFuture editProperties(java.lang.String, android.app.Activity, android.accounts.AccountManagerCallback, android.os.Handler); + method public static android.accounts.AccountManager get(android.content.Context); + method public android.accounts.Account[] getAccounts(); + method public android.accounts.Account[] getAccountsByType(java.lang.String); + method public android.accounts.AccountManagerFuture getAccountsByTypeAndFeatures(java.lang.String, java.lang.String[], android.accounts.AccountManagerCallback, android.os.Handler); + method public android.accounts.AccountManagerFuture getAuthToken(android.accounts.Account, java.lang.String, android.os.Bundle, android.app.Activity, android.accounts.AccountManagerCallback, android.os.Handler); + method public deprecated android.accounts.AccountManagerFuture getAuthToken(android.accounts.Account, java.lang.String, boolean, android.accounts.AccountManagerCallback, android.os.Handler); + method public android.accounts.AccountManagerFuture getAuthToken(android.accounts.Account, java.lang.String, android.os.Bundle, boolean, android.accounts.AccountManagerCallback, android.os.Handler); + method public android.accounts.AccountManagerFuture getAuthTokenByFeatures(java.lang.String, java.lang.String, java.lang.String[], android.app.Activity, android.os.Bundle, android.os.Bundle, android.accounts.AccountManagerCallback, android.os.Handler); + method public android.accounts.AuthenticatorDescription[] getAuthenticatorTypes(); + method public java.lang.String getPassword(android.accounts.Account); + method public java.lang.String getUserData(android.accounts.Account, java.lang.String); + method public android.accounts.AccountManagerFuture hasFeatures(android.accounts.Account, java.lang.String[], android.accounts.AccountManagerCallback, android.os.Handler); + method public void invalidateAuthToken(java.lang.String, java.lang.String); + method public static android.content.Intent newChooseAccountIntent(android.accounts.Account, java.util.ArrayList, java.lang.String[], boolean, java.lang.String, java.lang.String, java.lang.String[], android.os.Bundle); + method public java.lang.String peekAuthToken(android.accounts.Account, java.lang.String); + method public android.accounts.AccountManagerFuture removeAccount(android.accounts.Account, android.accounts.AccountManagerCallback, android.os.Handler); + method public void removeOnAccountsUpdatedListener(android.accounts.OnAccountsUpdateListener); + method public void setAuthToken(android.accounts.Account, java.lang.String, java.lang.String); + method public void setPassword(android.accounts.Account, java.lang.String); + method public void setUserData(android.accounts.Account, java.lang.String, java.lang.String); + method public android.accounts.AccountManagerFuture updateCredentials(android.accounts.Account, java.lang.String, android.os.Bundle, android.app.Activity, android.accounts.AccountManagerCallback, android.os.Handler); + field public static final java.lang.String ACTION_AUTHENTICATOR_INTENT = "android.accounts.AccountAuthenticator"; + field public static final java.lang.String AUTHENTICATOR_ATTRIBUTES_NAME = "account-authenticator"; + field public static final java.lang.String AUTHENTICATOR_META_DATA_NAME = "android.accounts.AccountAuthenticator"; + field public static final int ERROR_CODE_BAD_ARGUMENTS = 7; // 0x7 + field public static final int ERROR_CODE_BAD_REQUEST = 8; // 0x8 + field public static final int ERROR_CODE_CANCELED = 4; // 0x4 + field public static final int ERROR_CODE_INVALID_RESPONSE = 5; // 0x5 + field public static final int ERROR_CODE_NETWORK_ERROR = 3; // 0x3 + field public static final int ERROR_CODE_REMOTE_EXCEPTION = 1; // 0x1 + field public static final int ERROR_CODE_UNSUPPORTED_OPERATION = 6; // 0x6 + field public static final java.lang.String KEY_ACCOUNTS = "accounts"; + field public static final java.lang.String KEY_ACCOUNT_AUTHENTICATOR_RESPONSE = "accountAuthenticatorResponse"; + field public static final java.lang.String KEY_ACCOUNT_MANAGER_RESPONSE = "accountManagerResponse"; + field public static final java.lang.String KEY_ACCOUNT_NAME = "authAccount"; + field public static final java.lang.String KEY_ACCOUNT_TYPE = "accountType"; + field public static final java.lang.String KEY_ANDROID_PACKAGE_NAME = "androidPackageName"; + field public static final java.lang.String KEY_AUTHENTICATOR_TYPES = "authenticator_types"; + field public static final java.lang.String KEY_AUTHTOKEN = "authtoken"; + field public static final java.lang.String KEY_AUTH_FAILED_MESSAGE = "authFailedMessage"; + field public static final java.lang.String KEY_AUTH_TOKEN_LABEL = "authTokenLabelKey"; + field public static final java.lang.String KEY_BOOLEAN_RESULT = "booleanResult"; + field public static final java.lang.String KEY_CALLER_PID = "callerPid"; + field public static final java.lang.String KEY_CALLER_UID = "callerUid"; + field public static final java.lang.String KEY_ERROR_CODE = "errorCode"; + field public static final java.lang.String KEY_ERROR_MESSAGE = "errorMessage"; + field public static final java.lang.String KEY_INTENT = "intent"; + field public static final java.lang.String KEY_PASSWORD = "password"; + field public static final java.lang.String KEY_USERDATA = "userdata"; + field public static final java.lang.String LOGIN_ACCOUNTS_CHANGED_ACTION = "android.accounts.LOGIN_ACCOUNTS_CHANGED"; + } + + public abstract interface AccountManagerCallback { + method public abstract void run(android.accounts.AccountManagerFuture); + } + + public abstract interface AccountManagerFuture { + method public abstract boolean cancel(boolean); + method public abstract V getResult() throws android.accounts.AuthenticatorException, java.io.IOException, android.accounts.OperationCanceledException; + method public abstract V getResult(long, java.util.concurrent.TimeUnit) throws android.accounts.AuthenticatorException, java.io.IOException, android.accounts.OperationCanceledException; + method public abstract boolean isCancelled(); + method public abstract boolean isDone(); + } + + public class AccountsException extends java.lang.Exception { + ctor public AccountsException(); + ctor public AccountsException(java.lang.String); + ctor public AccountsException(java.lang.String, java.lang.Throwable); + ctor public AccountsException(java.lang.Throwable); + } + + public class AuthenticatorDescription implements android.os.Parcelable { + ctor public AuthenticatorDescription(java.lang.String, java.lang.String, int, int, int, int, boolean); + ctor public AuthenticatorDescription(java.lang.String, java.lang.String, int, int, int, int); + method public int describeContents(); + method public static android.accounts.AuthenticatorDescription newKey(java.lang.String); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + field public final int accountPreferencesId; + field public final boolean customTokens; + field public final int iconId; + field public final int labelId; + field public final java.lang.String packageName; + field public final int smallIconId; + field public final java.lang.String type; + } + + public class AuthenticatorException extends android.accounts.AccountsException { + ctor public AuthenticatorException(); + ctor public AuthenticatorException(java.lang.String); + ctor public AuthenticatorException(java.lang.String, java.lang.Throwable); + ctor public AuthenticatorException(java.lang.Throwable); + } + + public class NetworkErrorException extends android.accounts.AccountsException { + ctor public NetworkErrorException(); + ctor public NetworkErrorException(java.lang.String); + ctor public NetworkErrorException(java.lang.String, java.lang.Throwable); + ctor public NetworkErrorException(java.lang.Throwable); + } + + public abstract interface OnAccountsUpdateListener { + method public abstract void onAccountsUpdated(android.accounts.Account[]); + } + + public class OperationCanceledException extends android.accounts.AccountsException { + ctor public OperationCanceledException(); + ctor public OperationCanceledException(java.lang.String); + ctor public OperationCanceledException(java.lang.String, java.lang.Throwable); + ctor public OperationCanceledException(java.lang.Throwable); + } + +} + +package android.animation { + + public abstract class Animator implements java.lang.Cloneable { + ctor public Animator(); + method public void addListener(android.animation.Animator.AnimatorListener); + method public void cancel(); + method public android.animation.Animator clone(); + method public void end(); + method public abstract long getDuration(); + method public java.util.ArrayList getListeners(); + method public abstract long getStartDelay(); + method public abstract boolean isRunning(); + method public boolean isStarted(); + method public void removeAllListeners(); + method public void removeListener(android.animation.Animator.AnimatorListener); + method public abstract android.animation.Animator setDuration(long); + method public abstract void setInterpolator(android.animation.TimeInterpolator); + method public abstract void setStartDelay(long); + method public void setTarget(java.lang.Object); + method public void setupEndValues(); + method public void setupStartValues(); + method public void start(); + } + + public static abstract interface Animator.AnimatorListener { + method public abstract void onAnimationCancel(android.animation.Animator); + method public abstract void onAnimationEnd(android.animation.Animator); + method public abstract void onAnimationRepeat(android.animation.Animator); + method public abstract void onAnimationStart(android.animation.Animator); + } + + public class AnimatorInflater { + ctor public AnimatorInflater(); + method public static android.animation.Animator loadAnimator(android.content.Context, int) throws android.content.res.Resources.NotFoundException; + } + + public abstract class AnimatorListenerAdapter implements android.animation.Animator.AnimatorListener { + ctor public AnimatorListenerAdapter(); + method public void onAnimationCancel(android.animation.Animator); + method public void onAnimationEnd(android.animation.Animator); + method public void onAnimationRepeat(android.animation.Animator); + method public void onAnimationStart(android.animation.Animator); + } + + public final class AnimatorSet extends android.animation.Animator { + ctor public AnimatorSet(); + method public java.util.ArrayList getChildAnimations(); + method public long getDuration(); + method public long getStartDelay(); + method public boolean isRunning(); + method public android.animation.AnimatorSet.Builder play(android.animation.Animator); + method public void playSequentially(android.animation.Animator...); + method public void playSequentially(java.util.List); + method public void playTogether(android.animation.Animator...); + method public void playTogether(java.util.Collection); + method public android.animation.AnimatorSet setDuration(long); + method public void setInterpolator(android.animation.TimeInterpolator); + method public void setStartDelay(long); + } + + public class AnimatorSet.Builder { + method public android.animation.AnimatorSet.Builder after(android.animation.Animator); + method public android.animation.AnimatorSet.Builder after(long); + method public android.animation.AnimatorSet.Builder before(android.animation.Animator); + method public android.animation.AnimatorSet.Builder with(android.animation.Animator); + } + + public class ArgbEvaluator implements android.animation.TypeEvaluator { + ctor public ArgbEvaluator(); + method public java.lang.Object evaluate(float, java.lang.Object, java.lang.Object); + } + + public class FloatEvaluator implements android.animation.TypeEvaluator { + ctor public FloatEvaluator(); + method public java.lang.Float evaluate(float, java.lang.Number, java.lang.Number); + } + + public class IntEvaluator implements android.animation.TypeEvaluator { + ctor public IntEvaluator(); + method public java.lang.Integer evaluate(float, java.lang.Integer, java.lang.Integer); + } + + public abstract class Keyframe implements java.lang.Cloneable { + ctor public Keyframe(); + method public abstract android.animation.Keyframe clone(); + method public float getFraction(); + method public android.animation.TimeInterpolator getInterpolator(); + method public java.lang.Class getType(); + method public abstract java.lang.Object getValue(); + method public boolean hasValue(); + method public static android.animation.Keyframe ofFloat(float, float); + method public static android.animation.Keyframe ofFloat(float); + method public static android.animation.Keyframe ofInt(float, int); + method public static android.animation.Keyframe ofInt(float); + method public static android.animation.Keyframe ofObject(float, java.lang.Object); + method public static android.animation.Keyframe ofObject(float); + method public void setFraction(float); + method public void setInterpolator(android.animation.TimeInterpolator); + method public abstract void setValue(java.lang.Object); + } + + public class LayoutTransition { + ctor public LayoutTransition(); + method public void addChild(android.view.ViewGroup, android.view.View); + method public void addTransitionListener(android.animation.LayoutTransition.TransitionListener); + method public void disableTransitionType(int); + method public void enableTransitionType(int); + method public android.animation.Animator getAnimator(int); + method public long getDuration(int); + method public android.animation.TimeInterpolator getInterpolator(int); + method public long getStagger(int); + method public long getStartDelay(int); + method public java.util.List getTransitionListeners(); + method public deprecated void hideChild(android.view.ViewGroup, android.view.View); + method public void hideChild(android.view.ViewGroup, android.view.View, int); + method public boolean isChangingLayout(); + method public boolean isRunning(); + method public boolean isTransitionTypeEnabled(int); + method public void removeChild(android.view.ViewGroup, android.view.View); + method public void removeTransitionListener(android.animation.LayoutTransition.TransitionListener); + method public void setAnimateParentHierarchy(boolean); + method public void setAnimator(int, android.animation.Animator); + method public void setDuration(long); + method public void setDuration(int, long); + method public void setInterpolator(int, android.animation.TimeInterpolator); + method public void setStagger(int, long); + method public void setStartDelay(int, long); + method public deprecated void showChild(android.view.ViewGroup, android.view.View); + method public void showChild(android.view.ViewGroup, android.view.View, int); + field public static final int APPEARING = 2; // 0x2 + field public static final int CHANGE_APPEARING = 0; // 0x0 + field public static final int CHANGE_DISAPPEARING = 1; // 0x1 + field public static final int CHANGING = 4; // 0x4 + field public static final int DISAPPEARING = 3; // 0x3 + } + + public static abstract interface LayoutTransition.TransitionListener { + method public abstract void endTransition(android.animation.LayoutTransition, android.view.ViewGroup, android.view.View, int); + method public abstract void startTransition(android.animation.LayoutTransition, android.view.ViewGroup, android.view.View, int); + } + + public final class ObjectAnimator extends android.animation.ValueAnimator { + ctor public ObjectAnimator(); + method public java.lang.String getPropertyName(); + method public java.lang.Object getTarget(); + method public static android.animation.ObjectAnimator ofFloat(java.lang.Object, java.lang.String, float...); + method public static android.animation.ObjectAnimator ofFloat(T, android.util.Property, float...); + method public static android.animation.ObjectAnimator ofInt(java.lang.Object, java.lang.String, int...); + method public static android.animation.ObjectAnimator ofInt(T, android.util.Property, int...); + method public static android.animation.ObjectAnimator ofObject(java.lang.Object, java.lang.String, android.animation.TypeEvaluator, java.lang.Object...); + method public static android.animation.ObjectAnimator ofObject(T, android.util.Property, android.animation.TypeEvaluator, V...); + method public static android.animation.ObjectAnimator ofPropertyValuesHolder(java.lang.Object, android.animation.PropertyValuesHolder...); + method public void setProperty(android.util.Property); + method public void setPropertyName(java.lang.String); + } + + public class PropertyValuesHolder implements java.lang.Cloneable { + method public android.animation.PropertyValuesHolder clone(); + method public java.lang.String getPropertyName(); + method public static android.animation.PropertyValuesHolder ofFloat(java.lang.String, float...); + method public static android.animation.PropertyValuesHolder ofFloat(android.util.Property, float...); + method public static android.animation.PropertyValuesHolder ofInt(java.lang.String, int...); + method public static android.animation.PropertyValuesHolder ofInt(android.util.Property, int...); + method public static android.animation.PropertyValuesHolder ofKeyframe(java.lang.String, android.animation.Keyframe...); + method public static android.animation.PropertyValuesHolder ofKeyframe(android.util.Property, android.animation.Keyframe...); + method public static android.animation.PropertyValuesHolder ofObject(java.lang.String, android.animation.TypeEvaluator, java.lang.Object...); + method public static android.animation.PropertyValuesHolder ofObject(android.util.Property, android.animation.TypeEvaluator, V...); + method public void setEvaluator(android.animation.TypeEvaluator); + method public void setFloatValues(float...); + method public void setIntValues(int...); + method public void setKeyframes(android.animation.Keyframe...); + method public void setObjectValues(java.lang.Object...); + method public void setProperty(android.util.Property); + method public void setPropertyName(java.lang.String); + } + + public class TimeAnimator extends android.animation.ValueAnimator { + ctor public TimeAnimator(); + method public void setTimeListener(android.animation.TimeAnimator.TimeListener); + } + + public static abstract interface TimeAnimator.TimeListener { + method public abstract void onTimeUpdate(android.animation.TimeAnimator, long, long); + } + + public abstract interface TimeInterpolator { + method public abstract float getInterpolation(float); + } + + public abstract interface TypeEvaluator { + method public abstract T evaluate(float, T, T); + } + + public class ValueAnimator extends android.animation.Animator { + ctor public ValueAnimator(); + method public void addUpdateListener(android.animation.ValueAnimator.AnimatorUpdateListener); + method public float getAnimatedFraction(); + method public java.lang.Object getAnimatedValue(); + method public java.lang.Object getAnimatedValue(java.lang.String); + method public long getCurrentPlayTime(); + method public long getDuration(); + method public static long getFrameDelay(); + method public android.animation.TimeInterpolator getInterpolator(); + method public int getRepeatCount(); + method public int getRepeatMode(); + method public long getStartDelay(); + method public android.animation.PropertyValuesHolder[] getValues(); + method public boolean isRunning(); + method public static android.animation.ValueAnimator ofFloat(float...); + method public static android.animation.ValueAnimator ofInt(int...); + method public static android.animation.ValueAnimator ofObject(android.animation.TypeEvaluator, java.lang.Object...); + method public static android.animation.ValueAnimator ofPropertyValuesHolder(android.animation.PropertyValuesHolder...); + method public void removeAllUpdateListeners(); + method public void removeUpdateListener(android.animation.ValueAnimator.AnimatorUpdateListener); + method public void reverse(); + method public void setCurrentPlayTime(long); + method public android.animation.ValueAnimator setDuration(long); + method public void setEvaluator(android.animation.TypeEvaluator); + method public void setFloatValues(float...); + method public static void setFrameDelay(long); + method public void setIntValues(int...); + method public void setInterpolator(android.animation.TimeInterpolator); + method public void setObjectValues(java.lang.Object...); + method public void setRepeatCount(int); + method public void setRepeatMode(int); + method public void setStartDelay(long); + method public void setValues(android.animation.PropertyValuesHolder...); + field public static final int INFINITE = -1; // 0xffffffff + field public static final int RESTART = 1; // 0x1 + field public static final int REVERSE = 2; // 0x2 + } + + public static abstract interface ValueAnimator.AnimatorUpdateListener { + method public abstract void onAnimationUpdate(android.animation.ValueAnimator); + } + +} + +package android.annotation { + + public abstract class SuppressLint implements java.lang.annotation.Annotation { + } + + public abstract class TargetApi implements java.lang.annotation.Annotation { + } + +} + +package android.app { + + public abstract class ActionBar { + ctor public ActionBar(); + method public abstract void addOnMenuVisibilityListener(android.app.ActionBar.OnMenuVisibilityListener); + method public abstract void addTab(android.app.ActionBar.Tab); + method public abstract void addTab(android.app.ActionBar.Tab, boolean); + method public abstract void addTab(android.app.ActionBar.Tab, int); + method public abstract void addTab(android.app.ActionBar.Tab, int, boolean); + method public abstract android.view.View getCustomView(); + method public abstract int getDisplayOptions(); + method public abstract int getHeight(); + method public abstract int getNavigationItemCount(); + method public abstract int getNavigationMode(); + method public abstract int getSelectedNavigationIndex(); + method public abstract android.app.ActionBar.Tab getSelectedTab(); + method public abstract java.lang.CharSequence getSubtitle(); + method public abstract android.app.ActionBar.Tab getTabAt(int); + method public abstract int getTabCount(); + method public android.content.Context getThemedContext(); + method public abstract java.lang.CharSequence getTitle(); + method public abstract void hide(); + method public abstract boolean isShowing(); + method public abstract android.app.ActionBar.Tab newTab(); + method public abstract void removeAllTabs(); + method public abstract void removeOnMenuVisibilityListener(android.app.ActionBar.OnMenuVisibilityListener); + method public abstract void removeTab(android.app.ActionBar.Tab); + method public abstract void removeTabAt(int); + method public abstract void selectTab(android.app.ActionBar.Tab); + method public abstract void setBackgroundDrawable(android.graphics.drawable.Drawable); + method public abstract void setCustomView(android.view.View); + method public abstract void setCustomView(android.view.View, android.app.ActionBar.LayoutParams); + method public abstract void setCustomView(int); + method public abstract void setDisplayHomeAsUpEnabled(boolean); + method public abstract void setDisplayOptions(int); + method public abstract void setDisplayOptions(int, int); + method public abstract void setDisplayShowCustomEnabled(boolean); + method public abstract void setDisplayShowHomeEnabled(boolean); + method public abstract void setDisplayShowTitleEnabled(boolean); + method public abstract void setDisplayUseLogoEnabled(boolean); + method public void setHomeButtonEnabled(boolean); + method public abstract void setIcon(int); + method public abstract void setIcon(android.graphics.drawable.Drawable); + method public abstract void setListNavigationCallbacks(android.widget.SpinnerAdapter, android.app.ActionBar.OnNavigationListener); + method public abstract void setLogo(int); + method public abstract void setLogo(android.graphics.drawable.Drawable); + method public abstract void setNavigationMode(int); + method public abstract void setSelectedNavigationItem(int); + method public void setSplitBackgroundDrawable(android.graphics.drawable.Drawable); + method public void setStackedBackgroundDrawable(android.graphics.drawable.Drawable); + method public abstract void setSubtitle(java.lang.CharSequence); + method public abstract void setSubtitle(int); + method public abstract void setTitle(java.lang.CharSequence); + method public abstract void setTitle(int); + method public abstract void show(); + field public static final int DISPLAY_HOME_AS_UP = 4; // 0x4 + field public static final int DISPLAY_SHOW_CUSTOM = 16; // 0x10 + field public static final int DISPLAY_SHOW_HOME = 2; // 0x2 + field public static final int DISPLAY_SHOW_TITLE = 8; // 0x8 + field public static final int DISPLAY_USE_LOGO = 1; // 0x1 + field public static final int NAVIGATION_MODE_LIST = 1; // 0x1 + field public static final int NAVIGATION_MODE_STANDARD = 0; // 0x0 + field public static final int NAVIGATION_MODE_TABS = 2; // 0x2 + } + + public static class ActionBar.LayoutParams extends android.view.ViewGroup.MarginLayoutParams { + ctor public ActionBar.LayoutParams(android.content.Context, android.util.AttributeSet); + ctor public ActionBar.LayoutParams(int, int); + ctor public ActionBar.LayoutParams(int, int, int); + ctor public ActionBar.LayoutParams(int); + ctor public ActionBar.LayoutParams(android.app.ActionBar.LayoutParams); + ctor public ActionBar.LayoutParams(android.view.ViewGroup.LayoutParams); + field public int gravity; + } + + public static abstract interface ActionBar.OnMenuVisibilityListener { + method public abstract void onMenuVisibilityChanged(boolean); + } + + public static abstract interface ActionBar.OnNavigationListener { + method public abstract boolean onNavigationItemSelected(int, long); + } + + public static abstract class ActionBar.Tab { + ctor public ActionBar.Tab(); + method public abstract java.lang.CharSequence getContentDescription(); + method public abstract android.view.View getCustomView(); + method public abstract android.graphics.drawable.Drawable getIcon(); + method public abstract int getPosition(); + method public abstract java.lang.Object getTag(); + method public abstract java.lang.CharSequence getText(); + method public abstract void select(); + method public abstract android.app.ActionBar.Tab setContentDescription(int); + method public abstract android.app.ActionBar.Tab setContentDescription(java.lang.CharSequence); + method public abstract android.app.ActionBar.Tab setCustomView(android.view.View); + method public abstract android.app.ActionBar.Tab setCustomView(int); + method public abstract android.app.ActionBar.Tab setIcon(android.graphics.drawable.Drawable); + method public abstract android.app.ActionBar.Tab setIcon(int); + method public abstract android.app.ActionBar.Tab setTabListener(android.app.ActionBar.TabListener); + method public abstract android.app.ActionBar.Tab setTag(java.lang.Object); + method public abstract android.app.ActionBar.Tab setText(java.lang.CharSequence); + method public abstract android.app.ActionBar.Tab setText(int); + field public static final int INVALID_POSITION = -1; // 0xffffffff + } + + public static abstract interface ActionBar.TabListener { + method public abstract void onTabReselected(android.app.ActionBar.Tab, android.app.FragmentTransaction); + method public abstract void onTabSelected(android.app.ActionBar.Tab, android.app.FragmentTransaction); + method public abstract void onTabUnselected(android.app.ActionBar.Tab, android.app.FragmentTransaction); + } + + public class Activity extends android.view.ContextThemeWrapper implements android.content.ComponentCallbacks2 android.view.KeyEvent.Callback android.view.LayoutInflater.Factory2 android.view.View.OnCreateContextMenuListener android.view.Window.Callback { + ctor public Activity(); + method public void addContentView(android.view.View, android.view.ViewGroup.LayoutParams); + method public void closeContextMenu(); + method public void closeOptionsMenu(); + method public android.app.PendingIntent createPendingResult(int, android.content.Intent, int); + method public final deprecated void dismissDialog(int); + method public boolean dispatchGenericMotionEvent(android.view.MotionEvent); + method public boolean dispatchKeyEvent(android.view.KeyEvent); + method public boolean dispatchKeyShortcutEvent(android.view.KeyEvent); + method public boolean dispatchPopulateAccessibilityEvent(android.view.accessibility.AccessibilityEvent); + method public boolean dispatchTouchEvent(android.view.MotionEvent); + method public boolean dispatchTrackballEvent(android.view.MotionEvent); + method public void dump(java.lang.String, java.io.FileDescriptor, java.io.PrintWriter, java.lang.String[]); + method public android.view.View findViewById(int); + method public void finish(); + method public void finishActivity(int); + method public void finishActivityFromChild(android.app.Activity, int); + method public void finishAffinity(); + method public void finishFromChild(android.app.Activity); + method public android.app.ActionBar getActionBar(); + method public final android.app.Application getApplication(); + method public android.content.ComponentName getCallingActivity(); + method public java.lang.String getCallingPackage(); + method public int getChangingConfigurations(); + method public android.content.ComponentName getComponentName(); + method public android.view.View getCurrentFocus(); + method public android.app.FragmentManager getFragmentManager(); + method public android.content.Intent getIntent(); + method public deprecated java.lang.Object getLastNonConfigurationInstance(); + method public android.view.LayoutInflater getLayoutInflater(); + method public android.app.LoaderManager getLoaderManager(); + method public java.lang.String getLocalClassName(); + method public android.view.MenuInflater getMenuInflater(); + method public final android.app.Activity getParent(); + method public android.content.Intent getParentActivityIntent(); + method public android.content.SharedPreferences getPreferences(int); + method public int getRequestedOrientation(); + method public int getTaskId(); + method public final java.lang.CharSequence getTitle(); + method public final int getTitleColor(); + method public final int getVolumeControlStream(); + method public android.view.Window getWindow(); + method public android.view.WindowManager getWindowManager(); + method public boolean hasWindowFocus(); + method public void invalidateOptionsMenu(); + method public boolean isChangingConfigurations(); + method public final boolean isChild(); + method public boolean isDestroyed(); + method public boolean isFinishing(); + method public boolean isTaskRoot(); + method public final deprecated android.database.Cursor managedQuery(android.net.Uri, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String); + method public boolean moveTaskToBack(boolean); + method public boolean navigateUpTo(android.content.Intent); + method public boolean navigateUpToFromChild(android.app.Activity, android.content.Intent); + method public void onActionModeFinished(android.view.ActionMode); + method public void onActionModeStarted(android.view.ActionMode); + method protected void onActivityResult(int, int, android.content.Intent); + method public void onAttachFragment(android.app.Fragment); + method public void onAttachedToWindow(); + method public void onBackPressed(); + method protected void onChildTitleChanged(android.app.Activity, java.lang.CharSequence); + method public void onConfigurationChanged(android.content.res.Configuration); + method public void onContentChanged(); + method public boolean onContextItemSelected(android.view.MenuItem); + method public void onContextMenuClosed(android.view.Menu); + method protected void onCreate(android.os.Bundle); + method public void onCreateContextMenu(android.view.ContextMenu, android.view.View, android.view.ContextMenu.ContextMenuInfo); + method public java.lang.CharSequence onCreateDescription(); + method protected deprecated android.app.Dialog onCreateDialog(int); + method protected deprecated android.app.Dialog onCreateDialog(int, android.os.Bundle); + method public void onCreateNavigateUpTaskStack(android.app.TaskStackBuilder); + method public boolean onCreateOptionsMenu(android.view.Menu); + method public boolean onCreatePanelMenu(int, android.view.Menu); + method public android.view.View onCreatePanelView(int); + method public boolean onCreateThumbnail(android.graphics.Bitmap, android.graphics.Canvas); + method public android.view.View onCreateView(java.lang.String, android.content.Context, android.util.AttributeSet); + method public android.view.View onCreateView(android.view.View, java.lang.String, android.content.Context, android.util.AttributeSet); + method protected void onDestroy(); + method public void onDetachedFromWindow(); + method public boolean onGenericMotionEvent(android.view.MotionEvent); + method public boolean onKeyDown(int, android.view.KeyEvent); + method public boolean onKeyLongPress(int, android.view.KeyEvent); + method public boolean onKeyMultiple(int, int, android.view.KeyEvent); + method public boolean onKeyShortcut(int, android.view.KeyEvent); + method public boolean onKeyUp(int, android.view.KeyEvent); + method public void onLowMemory(); + method public boolean onMenuItemSelected(int, android.view.MenuItem); + method public boolean onMenuOpened(int, android.view.Menu); + method public boolean onNavigateUp(); + method public boolean onNavigateUpFromChild(android.app.Activity); + method protected void onNewIntent(android.content.Intent); + method public boolean onOptionsItemSelected(android.view.MenuItem); + method public void onOptionsMenuClosed(android.view.Menu); + method public void onPanelClosed(int, android.view.Menu); + method protected void onPause(); + method protected void onPostCreate(android.os.Bundle); + method protected void onPostResume(); + method protected deprecated void onPrepareDialog(int, android.app.Dialog); + method protected deprecated void onPrepareDialog(int, android.app.Dialog, android.os.Bundle); + method public void onPrepareNavigateUpTaskStack(android.app.TaskStackBuilder); + method public boolean onPrepareOptionsMenu(android.view.Menu); + method public boolean onPreparePanel(int, android.view.View, android.view.Menu); + method protected void onRestart(); + method protected void onRestoreInstanceState(android.os.Bundle); + method protected void onResume(); + method public deprecated java.lang.Object onRetainNonConfigurationInstance(); + method protected void onSaveInstanceState(android.os.Bundle); + method public boolean onSearchRequested(); + method protected void onStart(); + method protected void onStop(); + method protected void onTitleChanged(java.lang.CharSequence, int); + method public boolean onTouchEvent(android.view.MotionEvent); + method public boolean onTrackballEvent(android.view.MotionEvent); + method public void onTrimMemory(int); + method public void onUserInteraction(); + method protected void onUserLeaveHint(); + method public void onWindowAttributesChanged(android.view.WindowManager.LayoutParams); + method public void onWindowFocusChanged(boolean); + method public android.view.ActionMode onWindowStartingActionMode(android.view.ActionMode.Callback); + method public void openContextMenu(android.view.View); + method public void openOptionsMenu(); + method public void overridePendingTransition(int, int); + method public void recreate(); + method public void registerForContextMenu(android.view.View); + method public final deprecated void removeDialog(int); + method public final boolean requestWindowFeature(int); + method public final void runOnUiThread(java.lang.Runnable); + method public void setContentView(int); + method public void setContentView(android.view.View); + method public void setContentView(android.view.View, android.view.ViewGroup.LayoutParams); + method public final void setDefaultKeyMode(int); + method public final void setFeatureDrawable(int, android.graphics.drawable.Drawable); + method public final void setFeatureDrawableAlpha(int, int); + method public final void setFeatureDrawableResource(int, int); + method public final void setFeatureDrawableUri(int, android.net.Uri); + method public void setFinishOnTouchOutside(boolean); + method public void setIntent(android.content.Intent); + method public final void setProgress(int); + method public final void setProgressBarIndeterminate(boolean); + method public final void setProgressBarIndeterminateVisibility(boolean); + method public final void setProgressBarVisibility(boolean); + method public void setRequestedOrientation(int); + method public final void setResult(int); + method public final void setResult(int, android.content.Intent); + method public final void setSecondaryProgress(int); + method public void setTitle(java.lang.CharSequence); + method public void setTitle(int); + method public void setTitleColor(int); + method public void setVisible(boolean); + method public final void setVolumeControlStream(int); + method public boolean shouldUpRecreateTask(android.content.Intent); + method public final deprecated void showDialog(int); + method public final deprecated boolean showDialog(int, android.os.Bundle); + method public android.view.ActionMode startActionMode(android.view.ActionMode.Callback); + method public void startActivityForResult(android.content.Intent, int); + method public void startActivityForResult(android.content.Intent, int, android.os.Bundle); + method public void startActivityFromChild(android.app.Activity, android.content.Intent, int); + method public void startActivityFromChild(android.app.Activity, android.content.Intent, int, android.os.Bundle); + method public void startActivityFromFragment(android.app.Fragment, android.content.Intent, int); + method public void startActivityFromFragment(android.app.Fragment, android.content.Intent, int, android.os.Bundle); + method public boolean startActivityIfNeeded(android.content.Intent, int); + method public boolean startActivityIfNeeded(android.content.Intent, int, android.os.Bundle); + method public void startIntentSenderForResult(android.content.IntentSender, int, android.content.Intent, int, int, int) throws android.content.IntentSender.SendIntentException; + method public void startIntentSenderForResult(android.content.IntentSender, int, android.content.Intent, int, int, int, android.os.Bundle) throws android.content.IntentSender.SendIntentException; + method public void startIntentSenderFromChild(android.app.Activity, android.content.IntentSender, int, android.content.Intent, int, int, int) throws android.content.IntentSender.SendIntentException; + method public void startIntentSenderFromChild(android.app.Activity, android.content.IntentSender, int, android.content.Intent, int, int, int, android.os.Bundle) throws android.content.IntentSender.SendIntentException; + method public deprecated void startManagingCursor(android.database.Cursor); + method public boolean startNextMatchingActivity(android.content.Intent); + method public boolean startNextMatchingActivity(android.content.Intent, android.os.Bundle); + method public void startSearch(java.lang.String, boolean, android.os.Bundle, boolean); + method public deprecated void stopManagingCursor(android.database.Cursor); + method public void takeKeyEvents(boolean); + method public void triggerSearch(java.lang.String, android.os.Bundle); + method public void unregisterForContextMenu(android.view.View); + field public static final int DEFAULT_KEYS_DIALER = 1; // 0x1 + field public static final int DEFAULT_KEYS_DISABLE = 0; // 0x0 + field public static final int DEFAULT_KEYS_SEARCH_GLOBAL = 4; // 0x4 + field public static final int DEFAULT_KEYS_SEARCH_LOCAL = 3; // 0x3 + field public static final int DEFAULT_KEYS_SHORTCUT = 2; // 0x2 + field protected static final int[] FOCUSED_STATE_SET; + field public static final int RESULT_CANCELED = 0; // 0x0 + field public static final int RESULT_FIRST_USER = 1; // 0x1 + field public static final int RESULT_OK = -1; // 0xffffffff + } + + public deprecated class ActivityGroup extends android.app.Activity { + ctor public ActivityGroup(); + ctor public ActivityGroup(boolean); + method public android.app.Activity getCurrentActivity(); + method public final android.app.LocalActivityManager getLocalActivityManager(); + } + + public class ActivityManager { + method public android.content.pm.ConfigurationInfo getDeviceConfigurationInfo(); + method public int getLargeMemoryClass(); + method public int getLauncherLargeIconDensity(); + method public int getLauncherLargeIconSize(); + method public int getMemoryClass(); + method public void getMemoryInfo(android.app.ActivityManager.MemoryInfo); + method public static void getMyMemoryState(android.app.ActivityManager.RunningAppProcessInfo); + method public android.os.Debug.MemoryInfo[] getProcessMemoryInfo(int[]); + method public java.util.List getProcessesInErrorState(); + method public java.util.List getRecentTasks(int, int) throws java.lang.SecurityException; + method public java.util.List getRunningAppProcesses(); + method public android.app.PendingIntent getRunningServiceControlPanel(android.content.ComponentName) throws java.lang.SecurityException; + method public java.util.List getRunningServices(int) throws java.lang.SecurityException; + method public java.util.List getRunningTasks(int) throws java.lang.SecurityException; + method public static boolean isRunningInTestHarness(); + method public static boolean isUserAMonkey(); + method public void killBackgroundProcesses(java.lang.String); + method public void moveTaskToFront(int, int); + method public void moveTaskToFront(int, int, android.os.Bundle); + method public deprecated void restartPackage(java.lang.String); + field public static final int MOVE_TASK_NO_USER_ACTION = 2; // 0x2 + field public static final int MOVE_TASK_WITH_HOME = 1; // 0x1 + field public static final int RECENT_IGNORE_UNAVAILABLE = 2; // 0x2 + field public static final int RECENT_WITH_EXCLUDED = 1; // 0x1 + } + + public static class ActivityManager.MemoryInfo implements android.os.Parcelable { + ctor public ActivityManager.MemoryInfo(); + method public int describeContents(); + method public void readFromParcel(android.os.Parcel); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + field public long availMem; + field public boolean lowMemory; + field public long threshold; + field public long totalMem; + } + + public static class ActivityManager.ProcessErrorStateInfo implements android.os.Parcelable { + ctor public ActivityManager.ProcessErrorStateInfo(); + method public int describeContents(); + method public void readFromParcel(android.os.Parcel); + method public void writeToParcel(android.os.Parcel, int); + field public static final int CRASHED = 1; // 0x1 + field public static final android.os.Parcelable.Creator CREATOR; + field public static final int NOT_RESPONDING = 2; // 0x2 + field public static final int NO_ERROR = 0; // 0x0 + field public int condition; + field public byte[] crashData; + field public java.lang.String longMsg; + field public int pid; + field public java.lang.String processName; + field public java.lang.String shortMsg; + field public java.lang.String stackTrace; + field public java.lang.String tag; + field public int uid; + } + + public static class ActivityManager.RecentTaskInfo implements android.os.Parcelable { + ctor public ActivityManager.RecentTaskInfo(); + method public int describeContents(); + method public void readFromParcel(android.os.Parcel); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + field public android.content.Intent baseIntent; + field public java.lang.CharSequence description; + field public int id; + field public android.content.ComponentName origActivity; + field public int persistentId; + } + + public static class ActivityManager.RunningAppProcessInfo implements android.os.Parcelable { + ctor public ActivityManager.RunningAppProcessInfo(); + ctor public ActivityManager.RunningAppProcessInfo(java.lang.String, int, java.lang.String[]); + method public int describeContents(); + method public void readFromParcel(android.os.Parcel); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + field public static final int IMPORTANCE_BACKGROUND = 400; // 0x190 + field public static final int IMPORTANCE_EMPTY = 500; // 0x1f4 + field public static final int IMPORTANCE_FOREGROUND = 100; // 0x64 + field public static final int IMPORTANCE_PERCEPTIBLE = 130; // 0x82 + field public static final int IMPORTANCE_SERVICE = 300; // 0x12c + field public static final int IMPORTANCE_VISIBLE = 200; // 0xc8 + field public static final int REASON_PROVIDER_IN_USE = 1; // 0x1 + field public static final int REASON_SERVICE_IN_USE = 2; // 0x2 + field public static final int REASON_UNKNOWN = 0; // 0x0 + field public int importance; + field public int importanceReasonCode; + field public android.content.ComponentName importanceReasonComponent; + field public int importanceReasonPid; + field public int lastTrimLevel; + field public int lru; + field public int pid; + field public java.lang.String[] pkgList; + field public java.lang.String processName; + field public int uid; + } + + public static class ActivityManager.RunningServiceInfo implements android.os.Parcelable { + ctor public ActivityManager.RunningServiceInfo(); + method public int describeContents(); + method public void readFromParcel(android.os.Parcel); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + field public static final int FLAG_FOREGROUND = 2; // 0x2 + field public static final int FLAG_PERSISTENT_PROCESS = 8; // 0x8 + field public static final int FLAG_STARTED = 1; // 0x1 + field public static final int FLAG_SYSTEM_PROCESS = 4; // 0x4 + field public long activeSince; + field public int clientCount; + field public int clientLabel; + field public java.lang.String clientPackage; + field public int crashCount; + field public int flags; + field public boolean foreground; + field public long lastActivityTime; + field public int pid; + field public java.lang.String process; + field public long restarting; + field public android.content.ComponentName service; + field public boolean started; + field public int uid; + } + + public static class ActivityManager.RunningTaskInfo implements android.os.Parcelable { + ctor public ActivityManager.RunningTaskInfo(); + method public int describeContents(); + method public void readFromParcel(android.os.Parcel); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + field public android.content.ComponentName baseActivity; + field public java.lang.CharSequence description; + field public int id; + field public int numActivities; + field public int numRunning; + field public android.graphics.Bitmap thumbnail; + field public android.content.ComponentName topActivity; + } + + public class ActivityOptions { + method public static android.app.ActivityOptions makeCustomAnimation(android.content.Context, int, int); + method public static android.app.ActivityOptions makeScaleUpAnimation(android.view.View, int, int, int, int); + method public static android.app.ActivityOptions makeThumbnailScaleUpAnimation(android.view.View, android.graphics.Bitmap, int, int); + method public android.os.Bundle toBundle(); + method public void update(android.app.ActivityOptions); + } + + public class AlarmManager { + method public void cancel(android.app.PendingIntent); + method public void set(int, long, android.app.PendingIntent); + method public void setInexactRepeating(int, long, long, android.app.PendingIntent); + method public void setRepeating(int, long, long, android.app.PendingIntent); + method public void setTime(long); + method public void setTimeZone(java.lang.String); + field public static final int ELAPSED_REALTIME = 3; // 0x3 + field public static final int ELAPSED_REALTIME_WAKEUP = 2; // 0x2 + field public static final long INTERVAL_DAY = 86400000L; // 0x5265c00L + field public static final long INTERVAL_FIFTEEN_MINUTES = 900000L; // 0xdbba0L + field public static final long INTERVAL_HALF_DAY = 43200000L; // 0x2932e00L + field public static final long INTERVAL_HALF_HOUR = 1800000L; // 0x1b7740L + field public static final long INTERVAL_HOUR = 3600000L; // 0x36ee80L + field public static final int RTC = 1; // 0x1 + field public static final int RTC_WAKEUP = 0; // 0x0 + } + + public class AlertDialog extends android.app.Dialog implements android.content.DialogInterface { + ctor protected AlertDialog(android.content.Context); + ctor protected AlertDialog(android.content.Context, int); + ctor protected AlertDialog(android.content.Context, boolean, android.content.DialogInterface.OnCancelListener); + method public android.widget.Button getButton(int); + method public android.widget.ListView getListView(); + method public void setButton(int, java.lang.CharSequence, android.os.Message); + method public void setButton(int, java.lang.CharSequence, android.content.DialogInterface.OnClickListener); + method public deprecated void setButton(java.lang.CharSequence, android.os.Message); + method public deprecated void setButton(java.lang.CharSequence, android.content.DialogInterface.OnClickListener); + method public deprecated void setButton2(java.lang.CharSequence, android.os.Message); + method public deprecated void setButton2(java.lang.CharSequence, android.content.DialogInterface.OnClickListener); + method public deprecated void setButton3(java.lang.CharSequence, android.os.Message); + method public deprecated void setButton3(java.lang.CharSequence, android.content.DialogInterface.OnClickListener); + method public void setCustomTitle(android.view.View); + method public void setIcon(int); + method public void setIcon(android.graphics.drawable.Drawable); + method public void setIconAttribute(int); + method public void setInverseBackgroundForced(boolean); + method public void setMessage(java.lang.CharSequence); + method public void setView(android.view.View); + method public void setView(android.view.View, int, int, int, int); + field public static final int THEME_DEVICE_DEFAULT_DARK = 4; // 0x4 + field public static final int THEME_DEVICE_DEFAULT_LIGHT = 5; // 0x5 + field public static final int THEME_HOLO_DARK = 2; // 0x2 + field public static final int THEME_HOLO_LIGHT = 3; // 0x3 + field public static final int THEME_TRADITIONAL = 1; // 0x1 + } + + public static class AlertDialog.Builder { + ctor public AlertDialog.Builder(android.content.Context); + ctor public AlertDialog.Builder(android.content.Context, int); + method public android.app.AlertDialog create(); + method public android.content.Context getContext(); + method public android.app.AlertDialog.Builder setAdapter(android.widget.ListAdapter, android.content.DialogInterface.OnClickListener); + method public android.app.AlertDialog.Builder setCancelable(boolean); + method public android.app.AlertDialog.Builder setCursor(android.database.Cursor, android.content.DialogInterface.OnClickListener, java.lang.String); + method public android.app.AlertDialog.Builder setCustomTitle(android.view.View); + method public android.app.AlertDialog.Builder setIcon(int); + method public android.app.AlertDialog.Builder setIcon(android.graphics.drawable.Drawable); + method public android.app.AlertDialog.Builder setIconAttribute(int); + method public android.app.AlertDialog.Builder setInverseBackgroundForced(boolean); + method public android.app.AlertDialog.Builder setItems(int, android.content.DialogInterface.OnClickListener); + method public android.app.AlertDialog.Builder setItems(java.lang.CharSequence[], android.content.DialogInterface.OnClickListener); + method public android.app.AlertDialog.Builder setMessage(int); + method public android.app.AlertDialog.Builder setMessage(java.lang.CharSequence); + method public android.app.AlertDialog.Builder setMultiChoiceItems(int, boolean[], android.content.DialogInterface.OnMultiChoiceClickListener); + method public android.app.AlertDialog.Builder setMultiChoiceItems(java.lang.CharSequence[], boolean[], android.content.DialogInterface.OnMultiChoiceClickListener); + method public android.app.AlertDialog.Builder setMultiChoiceItems(android.database.Cursor, java.lang.String, java.lang.String, android.content.DialogInterface.OnMultiChoiceClickListener); + method public android.app.AlertDialog.Builder setNegativeButton(int, android.content.DialogInterface.OnClickListener); + method public android.app.AlertDialog.Builder setNegativeButton(java.lang.CharSequence, android.content.DialogInterface.OnClickListener); + method public android.app.AlertDialog.Builder setNeutralButton(int, android.content.DialogInterface.OnClickListener); + method public android.app.AlertDialog.Builder setNeutralButton(java.lang.CharSequence, android.content.DialogInterface.OnClickListener); + method public android.app.AlertDialog.Builder setOnCancelListener(android.content.DialogInterface.OnCancelListener); + method public android.app.AlertDialog.Builder setOnDismissListener(android.content.DialogInterface.OnDismissListener); + method public android.app.AlertDialog.Builder setOnItemSelectedListener(android.widget.AdapterView.OnItemSelectedListener); + method public android.app.AlertDialog.Builder setOnKeyListener(android.content.DialogInterface.OnKeyListener); + method public android.app.AlertDialog.Builder setPositiveButton(int, android.content.DialogInterface.OnClickListener); + method public android.app.AlertDialog.Builder setPositiveButton(java.lang.CharSequence, android.content.DialogInterface.OnClickListener); + method public android.app.AlertDialog.Builder setSingleChoiceItems(int, int, android.content.DialogInterface.OnClickListener); + method public android.app.AlertDialog.Builder setSingleChoiceItems(android.database.Cursor, int, java.lang.String, android.content.DialogInterface.OnClickListener); + method public android.app.AlertDialog.Builder setSingleChoiceItems(java.lang.CharSequence[], int, android.content.DialogInterface.OnClickListener); + method public android.app.AlertDialog.Builder setSingleChoiceItems(android.widget.ListAdapter, int, android.content.DialogInterface.OnClickListener); + method public android.app.AlertDialog.Builder setTitle(int); + method public android.app.AlertDialog.Builder setTitle(java.lang.CharSequence); + method public android.app.AlertDialog.Builder setView(android.view.View); + method public android.app.AlertDialog show(); + } + + public class AliasActivity extends android.app.Activity { + ctor public AliasActivity(); + } + + public class Application extends android.content.ContextWrapper implements android.content.ComponentCallbacks2 { + ctor public Application(); + method public void onConfigurationChanged(android.content.res.Configuration); + method public void onCreate(); + method public void onLowMemory(); + method public void onTerminate(); + method public void onTrimMemory(int); + method public void registerActivityLifecycleCallbacks(android.app.Application.ActivityLifecycleCallbacks); + method public void unregisterActivityLifecycleCallbacks(android.app.Application.ActivityLifecycleCallbacks); + } + + public static abstract interface Application.ActivityLifecycleCallbacks { + method public abstract void onActivityCreated(android.app.Activity, android.os.Bundle); + method public abstract void onActivityDestroyed(android.app.Activity); + method public abstract void onActivityPaused(android.app.Activity); + method public abstract void onActivityResumed(android.app.Activity); + method public abstract void onActivitySaveInstanceState(android.app.Activity, android.os.Bundle); + method public abstract void onActivityStarted(android.app.Activity); + method public abstract void onActivityStopped(android.app.Activity); + } + + public class ApplicationErrorReport implements android.os.Parcelable { + ctor public ApplicationErrorReport(); + method public int describeContents(); + method public void dump(android.util.Printer, java.lang.String); + method public static android.content.ComponentName getErrorReportReceiver(android.content.Context, java.lang.String, int); + method public void readFromParcel(android.os.Parcel); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + field public static final int TYPE_ANR = 2; // 0x2 + field public static final int TYPE_BATTERY = 3; // 0x3 + field public static final int TYPE_CRASH = 1; // 0x1 + field public static final int TYPE_NONE = 0; // 0x0 + field public static final int TYPE_RUNNING_SERVICE = 5; // 0x5 + field public android.app.ApplicationErrorReport.AnrInfo anrInfo; + field public android.app.ApplicationErrorReport.BatteryInfo batteryInfo; + field public android.app.ApplicationErrorReport.CrashInfo crashInfo; + field public java.lang.String installerPackageName; + field public java.lang.String packageName; + field public java.lang.String processName; + field public android.app.ApplicationErrorReport.RunningServiceInfo runningServiceInfo; + field public boolean systemApp; + field public long time; + field public int type; + } + + public static class ApplicationErrorReport.AnrInfo { + ctor public ApplicationErrorReport.AnrInfo(); + ctor public ApplicationErrorReport.AnrInfo(android.os.Parcel); + method public void dump(android.util.Printer, java.lang.String); + method public void writeToParcel(android.os.Parcel, int); + field public java.lang.String activity; + field public java.lang.String cause; + field public java.lang.String info; + } + + public static class ApplicationErrorReport.BatteryInfo { + ctor public ApplicationErrorReport.BatteryInfo(); + ctor public ApplicationErrorReport.BatteryInfo(android.os.Parcel); + method public void dump(android.util.Printer, java.lang.String); + method public void writeToParcel(android.os.Parcel, int); + field public java.lang.String checkinDetails; + field public long durationMicros; + field public java.lang.String usageDetails; + field public int usagePercent; + } + + public static class ApplicationErrorReport.CrashInfo { + ctor public ApplicationErrorReport.CrashInfo(); + ctor public ApplicationErrorReport.CrashInfo(java.lang.Throwable); + ctor public ApplicationErrorReport.CrashInfo(android.os.Parcel); + method public void dump(android.util.Printer, java.lang.String); + method public void writeToParcel(android.os.Parcel, int); + field public java.lang.String exceptionClassName; + field public java.lang.String exceptionMessage; + field public java.lang.String stackTrace; + field public java.lang.String throwClassName; + field public java.lang.String throwFileName; + field public int throwLineNumber; + field public java.lang.String throwMethodName; + } + + public static class ApplicationErrorReport.RunningServiceInfo { + ctor public ApplicationErrorReport.RunningServiceInfo(); + ctor public ApplicationErrorReport.RunningServiceInfo(android.os.Parcel); + method public void dump(android.util.Printer, java.lang.String); + method public void writeToParcel(android.os.Parcel, int); + field public long durationMillis; + field public java.lang.String serviceDetails; + } + + public class DatePickerDialog extends android.app.AlertDialog implements android.widget.DatePicker.OnDateChangedListener android.content.DialogInterface.OnClickListener { + ctor public DatePickerDialog(android.content.Context, android.app.DatePickerDialog.OnDateSetListener, int, int, int); + ctor public DatePickerDialog(android.content.Context, int, android.app.DatePickerDialog.OnDateSetListener, int, int, int); + method public android.widget.DatePicker getDatePicker(); + method public void onClick(android.content.DialogInterface, int); + method public void onDateChanged(android.widget.DatePicker, int, int, int); + method public void updateDate(int, int, int); + } + + public static abstract interface DatePickerDialog.OnDateSetListener { + method public abstract void onDateSet(android.widget.DatePicker, int, int, int); + } + + public class Dialog implements android.content.DialogInterface android.view.KeyEvent.Callback android.view.View.OnCreateContextMenuListener android.view.Window.Callback { + ctor public Dialog(android.content.Context); + ctor public Dialog(android.content.Context, int); + ctor protected Dialog(android.content.Context, boolean, android.content.DialogInterface.OnCancelListener); + method public void addContentView(android.view.View, android.view.ViewGroup.LayoutParams); + method public void cancel(); + method public void closeOptionsMenu(); + method public void dismiss(); + method public boolean dispatchGenericMotionEvent(android.view.MotionEvent); + method public boolean dispatchKeyEvent(android.view.KeyEvent); + method public boolean dispatchKeyShortcutEvent(android.view.KeyEvent); + method public boolean dispatchPopulateAccessibilityEvent(android.view.accessibility.AccessibilityEvent); + method public boolean dispatchTouchEvent(android.view.MotionEvent); + method public boolean dispatchTrackballEvent(android.view.MotionEvent); + method public android.view.View findViewById(int); + method public android.app.ActionBar getActionBar(); + method public final android.content.Context getContext(); + method public android.view.View getCurrentFocus(); + method public android.view.LayoutInflater getLayoutInflater(); + method public final android.app.Activity getOwnerActivity(); + method public final int getVolumeControlStream(); + method public android.view.Window getWindow(); + method public void hide(); + method public void invalidateOptionsMenu(); + method public boolean isShowing(); + method public void onActionModeFinished(android.view.ActionMode); + method public void onActionModeStarted(android.view.ActionMode); + method public void onAttachedToWindow(); + method public void onBackPressed(); + method public void onContentChanged(); + method public boolean onContextItemSelected(android.view.MenuItem); + method public void onContextMenuClosed(android.view.Menu); + method protected void onCreate(android.os.Bundle); + method public void onCreateContextMenu(android.view.ContextMenu, android.view.View, android.view.ContextMenu.ContextMenuInfo); + method public boolean onCreateOptionsMenu(android.view.Menu); + method public boolean onCreatePanelMenu(int, android.view.Menu); + method public android.view.View onCreatePanelView(int); + method public void onDetachedFromWindow(); + method public boolean onGenericMotionEvent(android.view.MotionEvent); + method public boolean onKeyDown(int, android.view.KeyEvent); + method public boolean onKeyLongPress(int, android.view.KeyEvent); + method public boolean onKeyMultiple(int, int, android.view.KeyEvent); + method public boolean onKeyShortcut(int, android.view.KeyEvent); + method public boolean onKeyUp(int, android.view.KeyEvent); + method public boolean onMenuItemSelected(int, android.view.MenuItem); + method public boolean onMenuOpened(int, android.view.Menu); + method public boolean onOptionsItemSelected(android.view.MenuItem); + method public void onOptionsMenuClosed(android.view.Menu); + method public void onPanelClosed(int, android.view.Menu); + method public boolean onPrepareOptionsMenu(android.view.Menu); + method public boolean onPreparePanel(int, android.view.View, android.view.Menu); + method public void onRestoreInstanceState(android.os.Bundle); + method public android.os.Bundle onSaveInstanceState(); + method public boolean onSearchRequested(); + method protected void onStart(); + method protected void onStop(); + method public boolean onTouchEvent(android.view.MotionEvent); + method public boolean onTrackballEvent(android.view.MotionEvent); + method public void onWindowAttributesChanged(android.view.WindowManager.LayoutParams); + method public void onWindowFocusChanged(boolean); + method public android.view.ActionMode onWindowStartingActionMode(android.view.ActionMode.Callback); + method public void openContextMenu(android.view.View); + method public void openOptionsMenu(); + method public void registerForContextMenu(android.view.View); + method public final boolean requestWindowFeature(int); + method public void setCancelMessage(android.os.Message); + method public void setCancelable(boolean); + method public void setCanceledOnTouchOutside(boolean); + method public void setContentView(int); + method public void setContentView(android.view.View); + method public void setContentView(android.view.View, android.view.ViewGroup.LayoutParams); + method public void setDismissMessage(android.os.Message); + method public final void setFeatureDrawable(int, android.graphics.drawable.Drawable); + method public final void setFeatureDrawableAlpha(int, int); + method public final void setFeatureDrawableResource(int, int); + method public final void setFeatureDrawableUri(int, android.net.Uri); + method public void setOnCancelListener(android.content.DialogInterface.OnCancelListener); + method public void setOnDismissListener(android.content.DialogInterface.OnDismissListener); + method public void setOnKeyListener(android.content.DialogInterface.OnKeyListener); + method public void setOnShowListener(android.content.DialogInterface.OnShowListener); + method public final void setOwnerActivity(android.app.Activity); + method public void setTitle(java.lang.CharSequence); + method public void setTitle(int); + method public final void setVolumeControlStream(int); + method public void show(); + method public void takeKeyEvents(boolean); + method public void unregisterForContextMenu(android.view.View); + } + + public class DialogFragment extends android.app.Fragment implements android.content.DialogInterface.OnCancelListener android.content.DialogInterface.OnDismissListener { + ctor public DialogFragment(); + method public void dismiss(); + method public void dismissAllowingStateLoss(); + method public android.app.Dialog getDialog(); + method public boolean getShowsDialog(); + method public int getTheme(); + method public boolean isCancelable(); + method public void onCancel(android.content.DialogInterface); + method public android.app.Dialog onCreateDialog(android.os.Bundle); + method public void onDismiss(android.content.DialogInterface); + method public void setCancelable(boolean); + method public void setShowsDialog(boolean); + method public void setStyle(int, int); + method public void show(android.app.FragmentManager, java.lang.String); + method public int show(android.app.FragmentTransaction, java.lang.String); + field public static final int STYLE_NORMAL = 0; // 0x0 + field public static final int STYLE_NO_FRAME = 2; // 0x2 + field public static final int STYLE_NO_INPUT = 3; // 0x3 + field public static final int STYLE_NO_TITLE = 1; // 0x1 + } + + public class DownloadManager { + method public long addCompletedDownload(java.lang.String, java.lang.String, boolean, java.lang.String, java.lang.String, long, boolean); + method public long enqueue(android.app.DownloadManager.Request); + method public static java.lang.Long getMaxBytesOverMobile(android.content.Context); + method public java.lang.String getMimeTypeForDownloadedFile(long); + method public static java.lang.Long getRecommendedMaxBytesOverMobile(android.content.Context); + method public android.net.Uri getUriForDownloadedFile(long); + method public android.os.ParcelFileDescriptor openDownloadedFile(long) throws java.io.FileNotFoundException; + method public android.database.Cursor query(android.app.DownloadManager.Query); + method public int remove(long...); + field public static final java.lang.String ACTION_DOWNLOAD_COMPLETE = "android.intent.action.DOWNLOAD_COMPLETE"; + field public static final java.lang.String ACTION_NOTIFICATION_CLICKED = "android.intent.action.DOWNLOAD_NOTIFICATION_CLICKED"; + field public static final java.lang.String ACTION_VIEW_DOWNLOADS = "android.intent.action.VIEW_DOWNLOADS"; + field public static final java.lang.String COLUMN_BYTES_DOWNLOADED_SO_FAR = "bytes_so_far"; + field public static final java.lang.String COLUMN_DESCRIPTION = "description"; + field public static final java.lang.String COLUMN_ID = "_id"; + field public static final java.lang.String COLUMN_LAST_MODIFIED_TIMESTAMP = "last_modified_timestamp"; + field public static final java.lang.String COLUMN_LOCAL_FILENAME = "local_filename"; + field public static final java.lang.String COLUMN_LOCAL_URI = "local_uri"; + field public static final java.lang.String COLUMN_MEDIAPROVIDER_URI = "mediaprovider_uri"; + field public static final java.lang.String COLUMN_MEDIA_TYPE = "media_type"; + field public static final java.lang.String COLUMN_REASON = "reason"; + field public static final java.lang.String COLUMN_STATUS = "status"; + field public static final java.lang.String COLUMN_TITLE = "title"; + field public static final java.lang.String COLUMN_TOTAL_SIZE_BYTES = "total_size"; + field public static final java.lang.String COLUMN_URI = "uri"; + field public static final int ERROR_CANNOT_RESUME = 1008; // 0x3f0 + field public static final int ERROR_DEVICE_NOT_FOUND = 1007; // 0x3ef + field public static final int ERROR_FILE_ALREADY_EXISTS = 1009; // 0x3f1 + field public static final int ERROR_FILE_ERROR = 1001; // 0x3e9 + field public static final int ERROR_HTTP_DATA_ERROR = 1004; // 0x3ec + field public static final int ERROR_INSUFFICIENT_SPACE = 1006; // 0x3ee + field public static final int ERROR_TOO_MANY_REDIRECTS = 1005; // 0x3ed + field public static final int ERROR_UNHANDLED_HTTP_CODE = 1002; // 0x3ea + field public static final int ERROR_UNKNOWN = 1000; // 0x3e8 + field public static final java.lang.String EXTRA_DOWNLOAD_ID = "extra_download_id"; + field public static final java.lang.String EXTRA_NOTIFICATION_CLICK_DOWNLOAD_IDS = "extra_click_download_ids"; + field public static final java.lang.String INTENT_EXTRAS_SORT_BY_SIZE = "android.app.DownloadManager.extra_sortBySize"; + field public static final int PAUSED_QUEUED_FOR_WIFI = 3; // 0x3 + field public static final int PAUSED_UNKNOWN = 4; // 0x4 + field public static final int PAUSED_WAITING_FOR_NETWORK = 2; // 0x2 + field public static final int PAUSED_WAITING_TO_RETRY = 1; // 0x1 + field public static final int STATUS_FAILED = 16; // 0x10 + field public static final int STATUS_PAUSED = 4; // 0x4 + field public static final int STATUS_PENDING = 1; // 0x1 + field public static final int STATUS_RUNNING = 2; // 0x2 + field public static final int STATUS_SUCCESSFUL = 8; // 0x8 + } + + public static class DownloadManager.Query { + ctor public DownloadManager.Query(); + method public android.app.DownloadManager.Query setFilterById(long...); + method public android.app.DownloadManager.Query setFilterByStatus(int); + } + + public static class DownloadManager.Request { + ctor public DownloadManager.Request(android.net.Uri); + method public android.app.DownloadManager.Request addRequestHeader(java.lang.String, java.lang.String); + method public void allowScanningByMediaScanner(); + method public android.app.DownloadManager.Request setAllowedNetworkTypes(int); + method public android.app.DownloadManager.Request setAllowedOverMetered(boolean); + method public android.app.DownloadManager.Request setAllowedOverRoaming(boolean); + method public android.app.DownloadManager.Request setDescription(java.lang.CharSequence); + method public android.app.DownloadManager.Request setDestinationInExternalFilesDir(android.content.Context, java.lang.String, java.lang.String); + method public android.app.DownloadManager.Request setDestinationInExternalPublicDir(java.lang.String, java.lang.String); + method public android.app.DownloadManager.Request setDestinationUri(android.net.Uri); + method public android.app.DownloadManager.Request setMimeType(java.lang.String); + method public android.app.DownloadManager.Request setNotificationVisibility(int); + method public deprecated android.app.DownloadManager.Request setShowRunningNotification(boolean); + method public android.app.DownloadManager.Request setTitle(java.lang.CharSequence); + method public android.app.DownloadManager.Request setVisibleInDownloadsUi(boolean); + field public static final int NETWORK_MOBILE = 1; // 0x1 + field public static final int NETWORK_WIFI = 2; // 0x2 + field public static final int VISIBILITY_HIDDEN = 2; // 0x2 + field public static final int VISIBILITY_VISIBLE = 0; // 0x0 + field public static final int VISIBILITY_VISIBLE_NOTIFY_COMPLETED = 1; // 0x1 + field public static final int VISIBILITY_VISIBLE_NOTIFY_ONLY_COMPLETION = 3; // 0x3 + } + + public class ExpandableListActivity extends android.app.Activity implements android.widget.ExpandableListView.OnChildClickListener android.widget.ExpandableListView.OnGroupCollapseListener android.widget.ExpandableListView.OnGroupExpandListener android.view.View.OnCreateContextMenuListener { + ctor public ExpandableListActivity(); + method public android.widget.ExpandableListAdapter getExpandableListAdapter(); + method public android.widget.ExpandableListView getExpandableListView(); + method public long getSelectedId(); + method public long getSelectedPosition(); + method public boolean onChildClick(android.widget.ExpandableListView, android.view.View, int, int, long); + method public void onGroupCollapse(int); + method public void onGroupExpand(int); + method public void setListAdapter(android.widget.ExpandableListAdapter); + method public boolean setSelectedChild(int, int, boolean); + method public void setSelectedGroup(int); + } + + public class Fragment implements android.content.ComponentCallbacks2 android.view.View.OnCreateContextMenuListener { + ctor public Fragment(); + method public void dump(java.lang.String, java.io.FileDescriptor, java.io.PrintWriter, java.lang.String[]); + method public final boolean equals(java.lang.Object); + method public final android.app.Activity getActivity(); + method public final android.os.Bundle getArguments(); + method public final android.app.FragmentManager getChildFragmentManager(); + method public final android.app.FragmentManager getFragmentManager(); + method public final int getId(); + method public android.app.LoaderManager getLoaderManager(); + method public final android.app.Fragment getParentFragment(); + method public final android.content.res.Resources getResources(); + method public final boolean getRetainInstance(); + method public final java.lang.String getString(int); + method public final java.lang.String getString(int, java.lang.Object...); + method public final java.lang.String getTag(); + method public final android.app.Fragment getTargetFragment(); + method public final int getTargetRequestCode(); + method public final java.lang.CharSequence getText(int); + method public boolean getUserVisibleHint(); + method public android.view.View getView(); + method public final int hashCode(); + method public static android.app.Fragment instantiate(android.content.Context, java.lang.String); + method public static android.app.Fragment instantiate(android.content.Context, java.lang.String, android.os.Bundle); + method public final boolean isAdded(); + method public final boolean isDetached(); + method public final boolean isHidden(); + method public final boolean isInLayout(); + method public final boolean isRemoving(); + method public final boolean isResumed(); + method public final boolean isVisible(); + method public void onActivityCreated(android.os.Bundle); + method public void onActivityResult(int, int, android.content.Intent); + method public void onAttach(android.app.Activity); + method public void onConfigurationChanged(android.content.res.Configuration); + method public boolean onContextItemSelected(android.view.MenuItem); + method public void onCreate(android.os.Bundle); + method public android.animation.Animator onCreateAnimator(int, boolean, int); + method public void onCreateContextMenu(android.view.ContextMenu, android.view.View, android.view.ContextMenu.ContextMenuInfo); + method public void onCreateOptionsMenu(android.view.Menu, android.view.MenuInflater); + method public android.view.View onCreateView(android.view.LayoutInflater, android.view.ViewGroup, android.os.Bundle); + method public void onDestroy(); + method public void onDestroyOptionsMenu(); + method public void onDestroyView(); + method public void onDetach(); + method public void onHiddenChanged(boolean); + method public deprecated void onInflate(android.util.AttributeSet, android.os.Bundle); + method public void onInflate(android.app.Activity, android.util.AttributeSet, android.os.Bundle); + method public void onLowMemory(); + method public boolean onOptionsItemSelected(android.view.MenuItem); + method public void onOptionsMenuClosed(android.view.Menu); + method public void onPause(); + method public void onPrepareOptionsMenu(android.view.Menu); + method public void onResume(); + method public void onSaveInstanceState(android.os.Bundle); + method public void onStart(); + method public void onStop(); + method public void onTrimMemory(int); + method public void onViewCreated(android.view.View, android.os.Bundle); + method public void onViewStateRestored(android.os.Bundle); + method public void registerForContextMenu(android.view.View); + method public void setArguments(android.os.Bundle); + method public void setHasOptionsMenu(boolean); + method public void setInitialSavedState(android.app.Fragment.SavedState); + method public void setMenuVisibility(boolean); + method public void setRetainInstance(boolean); + method public void setTargetFragment(android.app.Fragment, int); + method public void setUserVisibleHint(boolean); + method public void startActivity(android.content.Intent); + method public void startActivity(android.content.Intent, android.os.Bundle); + method public void startActivityForResult(android.content.Intent, int); + method public void startActivityForResult(android.content.Intent, int, android.os.Bundle); + method public void unregisterForContextMenu(android.view.View); + } + + public static class Fragment.InstantiationException extends android.util.AndroidRuntimeException { + ctor public Fragment.InstantiationException(java.lang.String, java.lang.Exception); + } + + public static class Fragment.SavedState implements android.os.Parcelable { + method public int describeContents(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.ClassLoaderCreator CREATOR; + } + + public class FragmentBreadCrumbs extends android.view.ViewGroup implements android.app.FragmentManager.OnBackStackChangedListener { + ctor public FragmentBreadCrumbs(android.content.Context); + ctor public FragmentBreadCrumbs(android.content.Context, android.util.AttributeSet); + ctor public FragmentBreadCrumbs(android.content.Context, android.util.AttributeSet, int); + method public void onBackStackChanged(); + method protected void onLayout(boolean, int, int, int, int); + method public void setActivity(android.app.Activity); + method public void setMaxVisible(int); + method public void setOnBreadCrumbClickListener(android.app.FragmentBreadCrumbs.OnBreadCrumbClickListener); + method public void setParentTitle(java.lang.CharSequence, java.lang.CharSequence, android.view.View.OnClickListener); + method public void setTitle(java.lang.CharSequence, java.lang.CharSequence); + } + + public static abstract interface FragmentBreadCrumbs.OnBreadCrumbClickListener { + method public abstract boolean onBreadCrumbClick(android.app.FragmentManager.BackStackEntry, int); + } + + public abstract class FragmentManager { + ctor public FragmentManager(); + method public abstract void addOnBackStackChangedListener(android.app.FragmentManager.OnBackStackChangedListener); + method public abstract android.app.FragmentTransaction beginTransaction(); + method public abstract void dump(java.lang.String, java.io.FileDescriptor, java.io.PrintWriter, java.lang.String[]); + method public static void enableDebugLogging(boolean); + method public abstract boolean executePendingTransactions(); + method public abstract android.app.Fragment findFragmentById(int); + method public abstract android.app.Fragment findFragmentByTag(java.lang.String); + method public abstract android.app.FragmentManager.BackStackEntry getBackStackEntryAt(int); + method public abstract int getBackStackEntryCount(); + method public abstract android.app.Fragment getFragment(android.os.Bundle, java.lang.String); + method public void invalidateOptionsMenu(); + method public abstract boolean isDestroyed(); + method public abstract void popBackStack(); + method public abstract void popBackStack(java.lang.String, int); + method public abstract void popBackStack(int, int); + method public abstract boolean popBackStackImmediate(); + method public abstract boolean popBackStackImmediate(java.lang.String, int); + method public abstract boolean popBackStackImmediate(int, int); + method public abstract void putFragment(android.os.Bundle, java.lang.String, android.app.Fragment); + method public abstract void removeOnBackStackChangedListener(android.app.FragmentManager.OnBackStackChangedListener); + method public abstract android.app.Fragment.SavedState saveFragmentInstanceState(android.app.Fragment); + field public static final int POP_BACK_STACK_INCLUSIVE = 1; // 0x1 + } + + public static abstract interface FragmentManager.BackStackEntry { + method public abstract java.lang.CharSequence getBreadCrumbShortTitle(); + method public abstract int getBreadCrumbShortTitleRes(); + method public abstract java.lang.CharSequence getBreadCrumbTitle(); + method public abstract int getBreadCrumbTitleRes(); + method public abstract int getId(); + method public abstract java.lang.String getName(); + } + + public static abstract interface FragmentManager.OnBackStackChangedListener { + method public abstract void onBackStackChanged(); + } + + public abstract class FragmentTransaction { + ctor public FragmentTransaction(); + method public abstract android.app.FragmentTransaction add(android.app.Fragment, java.lang.String); + method public abstract android.app.FragmentTransaction add(int, android.app.Fragment); + method public abstract android.app.FragmentTransaction add(int, android.app.Fragment, java.lang.String); + method public abstract android.app.FragmentTransaction addToBackStack(java.lang.String); + method public abstract android.app.FragmentTransaction attach(android.app.Fragment); + method public abstract int commit(); + method public abstract int commitAllowingStateLoss(); + method public abstract android.app.FragmentTransaction detach(android.app.Fragment); + method public abstract android.app.FragmentTransaction disallowAddToBackStack(); + method public abstract android.app.FragmentTransaction hide(android.app.Fragment); + method public abstract boolean isAddToBackStackAllowed(); + method public abstract boolean isEmpty(); + method public abstract android.app.FragmentTransaction remove(android.app.Fragment); + method public abstract android.app.FragmentTransaction replace(int, android.app.Fragment); + method public abstract android.app.FragmentTransaction replace(int, android.app.Fragment, java.lang.String); + method public abstract android.app.FragmentTransaction setBreadCrumbShortTitle(int); + method public abstract android.app.FragmentTransaction setBreadCrumbShortTitle(java.lang.CharSequence); + method public abstract android.app.FragmentTransaction setBreadCrumbTitle(int); + method public abstract android.app.FragmentTransaction setBreadCrumbTitle(java.lang.CharSequence); + method public abstract android.app.FragmentTransaction setCustomAnimations(int, int); + method public abstract android.app.FragmentTransaction setCustomAnimations(int, int, int, int); + method public abstract android.app.FragmentTransaction setTransition(int); + method public abstract android.app.FragmentTransaction setTransitionStyle(int); + method public abstract android.app.FragmentTransaction show(android.app.Fragment); + field public static final int TRANSIT_ENTER_MASK = 4096; // 0x1000 + field public static final int TRANSIT_EXIT_MASK = 8192; // 0x2000 + field public static final int TRANSIT_FRAGMENT_CLOSE = 8194; // 0x2002 + field public static final int TRANSIT_FRAGMENT_FADE = 4099; // 0x1003 + field public static final int TRANSIT_FRAGMENT_OPEN = 4097; // 0x1001 + field public static final int TRANSIT_NONE = 0; // 0x0 + field public static final int TRANSIT_UNSET = -1; // 0xffffffff + } + + public class Instrumentation { + ctor public Instrumentation(); + method public void addMonitor(android.app.Instrumentation.ActivityMonitor); + method public android.app.Instrumentation.ActivityMonitor addMonitor(android.content.IntentFilter, android.app.Instrumentation.ActivityResult, boolean); + method public android.app.Instrumentation.ActivityMonitor addMonitor(java.lang.String, android.app.Instrumentation.ActivityResult, boolean); + method public void callActivityOnCreate(android.app.Activity, android.os.Bundle); + method public void callActivityOnDestroy(android.app.Activity); + method public void callActivityOnNewIntent(android.app.Activity, android.content.Intent); + method public void callActivityOnPause(android.app.Activity); + method public void callActivityOnPostCreate(android.app.Activity, android.os.Bundle); + method public void callActivityOnRestart(android.app.Activity); + method public void callActivityOnRestoreInstanceState(android.app.Activity, android.os.Bundle); + method public void callActivityOnResume(android.app.Activity); + method public void callActivityOnSaveInstanceState(android.app.Activity, android.os.Bundle); + method public void callActivityOnStart(android.app.Activity); + method public void callActivityOnStop(android.app.Activity); + method public void callActivityOnUserLeaving(android.app.Activity); + method public void callApplicationOnCreate(android.app.Application); + method public boolean checkMonitorHit(android.app.Instrumentation.ActivityMonitor, int); + method public void endPerformanceSnapshot(); + method public void finish(int, android.os.Bundle); + method public android.os.Bundle getAllocCounts(); + method public android.os.Bundle getBinderCounts(); + method public android.content.ComponentName getComponentName(); + method public android.content.Context getContext(); + method public android.content.Context getTargetContext(); + method public boolean invokeContextMenuAction(android.app.Activity, int, int); + method public boolean invokeMenuActionSync(android.app.Activity, int, int); + method public boolean isProfiling(); + method public android.app.Activity newActivity(java.lang.Class, android.content.Context, android.os.IBinder, android.app.Application, android.content.Intent, android.content.pm.ActivityInfo, java.lang.CharSequence, android.app.Activity, java.lang.String, java.lang.Object) throws java.lang.IllegalAccessException, java.lang.InstantiationException; + method public android.app.Activity newActivity(java.lang.ClassLoader, java.lang.String, android.content.Intent) throws java.lang.ClassNotFoundException, java.lang.IllegalAccessException, java.lang.InstantiationException; + method public android.app.Application newApplication(java.lang.ClassLoader, java.lang.String, android.content.Context) throws java.lang.ClassNotFoundException, java.lang.IllegalAccessException, java.lang.InstantiationException; + method public static android.app.Application newApplication(java.lang.Class, android.content.Context) throws java.lang.ClassNotFoundException, java.lang.IllegalAccessException, java.lang.InstantiationException; + method public void onCreate(android.os.Bundle); + method public void onDestroy(); + method public boolean onException(java.lang.Object, java.lang.Throwable); + method public void onStart(); + method public void removeMonitor(android.app.Instrumentation.ActivityMonitor); + method public void runOnMainSync(java.lang.Runnable); + method public void sendCharacterSync(int); + method public void sendKeyDownUpSync(int); + method public void sendKeySync(android.view.KeyEvent); + method public void sendPointerSync(android.view.MotionEvent); + method public void sendStatus(int, android.os.Bundle); + method public void sendStringSync(java.lang.String); + method public void sendTrackballEventSync(android.view.MotionEvent); + method public void setAutomaticPerformanceSnapshots(); + method public void setInTouchMode(boolean); + method public void start(); + method public android.app.Activity startActivitySync(android.content.Intent); + method public void startAllocCounting(); + method public void startPerformanceSnapshot(); + method public void startProfiling(); + method public void stopAllocCounting(); + method public void stopProfiling(); + method public void waitForIdle(java.lang.Runnable); + method public void waitForIdleSync(); + method public android.app.Activity waitForMonitor(android.app.Instrumentation.ActivityMonitor); + method public android.app.Activity waitForMonitorWithTimeout(android.app.Instrumentation.ActivityMonitor, long); + field public static final java.lang.String REPORT_KEY_IDENTIFIER = "id"; + field public static final java.lang.String REPORT_KEY_STREAMRESULT = "stream"; + } + + public static class Instrumentation.ActivityMonitor { + ctor public Instrumentation.ActivityMonitor(android.content.IntentFilter, android.app.Instrumentation.ActivityResult, boolean); + ctor public Instrumentation.ActivityMonitor(java.lang.String, android.app.Instrumentation.ActivityResult, boolean); + method public final android.content.IntentFilter getFilter(); + method public final int getHits(); + method public final android.app.Activity getLastActivity(); + method public final android.app.Instrumentation.ActivityResult getResult(); + method public final boolean isBlocking(); + method public final android.app.Activity waitForActivity(); + method public final android.app.Activity waitForActivityWithTimeout(long); + } + + public static final class Instrumentation.ActivityResult { + ctor public Instrumentation.ActivityResult(int, android.content.Intent); + method public int getResultCode(); + method public android.content.Intent getResultData(); + } + + public abstract class IntentService extends android.app.Service { + ctor public IntentService(java.lang.String); + method public android.os.IBinder onBind(android.content.Intent); + method protected abstract void onHandleIntent(android.content.Intent); + method public void setIntentRedelivery(boolean); + } + + public class KeyguardManager { + method public deprecated void exitKeyguardSecurely(android.app.KeyguardManager.OnKeyguardExitResult); + method public boolean inKeyguardRestrictedInputMode(); + method public boolean isKeyguardLocked(); + method public boolean isKeyguardSecure(); + method public deprecated android.app.KeyguardManager.KeyguardLock newKeyguardLock(java.lang.String); + } + + public deprecated class KeyguardManager.KeyguardLock { + method public void disableKeyguard(); + method public void reenableKeyguard(); + } + + public static abstract interface KeyguardManager.OnKeyguardExitResult { + method public abstract void onKeyguardExitResult(boolean); + } + + public abstract class LauncherActivity extends android.app.ListActivity { + ctor public LauncherActivity(); + method protected android.content.Intent getTargetIntent(); + method protected android.content.Intent intentForPosition(int); + method protected android.app.LauncherActivity.ListItem itemForPosition(int); + method public java.util.List makeListItems(); + method protected java.util.List onQueryPackageManager(android.content.Intent); + method protected void onSetContentView(); + } + + public class LauncherActivity.IconResizer { + ctor public LauncherActivity.IconResizer(); + method public android.graphics.drawable.Drawable createIconThumbnail(android.graphics.drawable.Drawable); + } + + public static class LauncherActivity.ListItem { + ctor public LauncherActivity.ListItem(); + field public java.lang.String className; + field public android.os.Bundle extras; + field public android.graphics.drawable.Drawable icon; + field public java.lang.CharSequence label; + field public java.lang.String packageName; + field public android.content.pm.ResolveInfo resolveInfo; + } + + public class ListActivity extends android.app.Activity { + ctor public ListActivity(); + method public android.widget.ListAdapter getListAdapter(); + method public android.widget.ListView getListView(); + method public long getSelectedItemId(); + method public int getSelectedItemPosition(); + method protected void onListItemClick(android.widget.ListView, android.view.View, int, long); + method public void setListAdapter(android.widget.ListAdapter); + method public void setSelection(int); + } + + public class ListFragment extends android.app.Fragment { + ctor public ListFragment(); + method public android.widget.ListAdapter getListAdapter(); + method public android.widget.ListView getListView(); + method public long getSelectedItemId(); + method public int getSelectedItemPosition(); + method public void onListItemClick(android.widget.ListView, android.view.View, int, long); + method public void setEmptyText(java.lang.CharSequence); + method public void setListAdapter(android.widget.ListAdapter); + method public void setListShown(boolean); + method public void setListShownNoAnimation(boolean); + method public void setSelection(int); + } + + public abstract class LoaderManager { + ctor public LoaderManager(); + method public abstract void destroyLoader(int); + method public abstract void dump(java.lang.String, java.io.FileDescriptor, java.io.PrintWriter, java.lang.String[]); + method public static void enableDebugLogging(boolean); + method public abstract android.content.Loader getLoader(int); + method public abstract android.content.Loader initLoader(int, android.os.Bundle, android.app.LoaderManager.LoaderCallbacks); + method public abstract android.content.Loader restartLoader(int, android.os.Bundle, android.app.LoaderManager.LoaderCallbacks); + } + + public static abstract interface LoaderManager.LoaderCallbacks { + method public abstract android.content.Loader onCreateLoader(int, android.os.Bundle); + method public abstract void onLoadFinished(android.content.Loader, D); + method public abstract void onLoaderReset(android.content.Loader); + } + + public deprecated class LocalActivityManager { + ctor public LocalActivityManager(android.app.Activity, boolean); + method public android.view.Window destroyActivity(java.lang.String, boolean); + method public void dispatchCreate(android.os.Bundle); + method public void dispatchDestroy(boolean); + method public void dispatchPause(boolean); + method public void dispatchResume(); + method public void dispatchStop(); + method public android.app.Activity getActivity(java.lang.String); + method public android.app.Activity getCurrentActivity(); + method public java.lang.String getCurrentId(); + method public void removeAllActivities(); + method public android.os.Bundle saveInstanceState(); + method public android.view.Window startActivity(java.lang.String, android.content.Intent); + } + + public class MediaRouteActionProvider extends android.view.ActionProvider { + ctor public MediaRouteActionProvider(android.content.Context); + method public android.view.View onCreateActionView(); + method public void setExtendedSettingsClickListener(android.view.View.OnClickListener); + method public void setRouteTypes(int); + } + + public class MediaRouteButton extends android.view.View { + ctor public MediaRouteButton(android.content.Context); + ctor public MediaRouteButton(android.content.Context, android.util.AttributeSet); + ctor public MediaRouteButton(android.content.Context, android.util.AttributeSet, int); + method public int getRouteTypes(); + method public void onAttachedToWindow(); + method public void onDetachedFromWindow(); + method public void setExtendedSettingsClickListener(android.view.View.OnClickListener); + method public void setRouteTypes(int); + method public void showDialog(); + } + + public class NativeActivity extends android.app.Activity implements android.view.InputQueue.Callback android.view.SurfaceHolder.Callback2 android.view.ViewTreeObserver.OnGlobalLayoutListener { + ctor public NativeActivity(); + method public void onGlobalLayout(); + method public void onInputQueueCreated(android.view.InputQueue); + method public void onInputQueueDestroyed(android.view.InputQueue); + method public void surfaceChanged(android.view.SurfaceHolder, int, int, int); + method public void surfaceCreated(android.view.SurfaceHolder); + method public void surfaceDestroyed(android.view.SurfaceHolder); + method public void surfaceRedrawNeeded(android.view.SurfaceHolder); + field public static final java.lang.String META_DATA_FUNC_NAME = "android.app.func_name"; + field public static final java.lang.String META_DATA_LIB_NAME = "android.app.lib_name"; + } + + public class Notification implements android.os.Parcelable { + ctor public Notification(); + ctor public deprecated Notification(int, java.lang.CharSequence, long); + ctor public Notification(android.os.Parcel); + method public android.app.Notification clone(); + method public int describeContents(); + method public deprecated void setLatestEventInfo(android.content.Context, java.lang.CharSequence, java.lang.CharSequence, android.app.PendingIntent); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + field public static final int DEFAULT_ALL = -1; // 0xffffffff + field public static final int DEFAULT_LIGHTS = 4; // 0x4 + field public static final int DEFAULT_SOUND = 1; // 0x1 + field public static final int DEFAULT_VIBRATE = 2; // 0x2 + field public static final int FLAG_AUTO_CANCEL = 16; // 0x10 + field public static final int FLAG_FOREGROUND_SERVICE = 64; // 0x40 + field public static final deprecated int FLAG_HIGH_PRIORITY = 128; // 0x80 + field public static final int FLAG_INSISTENT = 4; // 0x4 + field public static final int FLAG_NO_CLEAR = 32; // 0x20 + field public static final int FLAG_ONGOING_EVENT = 2; // 0x2 + field public static final int FLAG_ONLY_ALERT_ONCE = 8; // 0x8 + field public static final int FLAG_SHOW_LIGHTS = 1; // 0x1 + field public static final int PRIORITY_DEFAULT = 0; // 0x0 + field public static final int PRIORITY_HIGH = 1; // 0x1 + field public static final int PRIORITY_LOW = -1; // 0xffffffff + field public static final int PRIORITY_MAX = 2; // 0x2 + field public static final int PRIORITY_MIN = -2; // 0xfffffffe + field public static final int STREAM_DEFAULT = -1; // 0xffffffff + field public int audioStreamType; + field public android.widget.RemoteViews bigContentView; + field public android.app.PendingIntent contentIntent; + field public android.widget.RemoteViews contentView; + field public int defaults; + field public android.app.PendingIntent deleteIntent; + field public int flags; + field public android.app.PendingIntent fullScreenIntent; + field public int icon; + field public int iconLevel; + field public android.graphics.Bitmap largeIcon; + field public int ledARGB; + field public int ledOffMS; + field public int ledOnMS; + field public int number; + field public int priority; + field public android.net.Uri sound; + field public java.lang.CharSequence tickerText; + field public android.widget.RemoteViews tickerView; + field public long[] vibrate; + field public long when; + } + + public static class Notification.BigPictureStyle extends android.app.Notification.Style { + ctor public Notification.BigPictureStyle(); + ctor public Notification.BigPictureStyle(android.app.Notification.Builder); + method public android.app.Notification.BigPictureStyle bigLargeIcon(android.graphics.Bitmap); + method public android.app.Notification.BigPictureStyle bigPicture(android.graphics.Bitmap); + method public android.app.Notification build(); + method public android.app.Notification.BigPictureStyle setBigContentTitle(java.lang.CharSequence); + method public android.app.Notification.BigPictureStyle setSummaryText(java.lang.CharSequence); + } + + public static class Notification.BigTextStyle extends android.app.Notification.Style { + ctor public Notification.BigTextStyle(); + ctor public Notification.BigTextStyle(android.app.Notification.Builder); + method public android.app.Notification.BigTextStyle bigText(java.lang.CharSequence); + method public android.app.Notification build(); + method public android.app.Notification.BigTextStyle setBigContentTitle(java.lang.CharSequence); + method public android.app.Notification.BigTextStyle setSummaryText(java.lang.CharSequence); + } + + public static class Notification.Builder { + ctor public Notification.Builder(android.content.Context); + method public android.app.Notification.Builder addAction(int, java.lang.CharSequence, android.app.PendingIntent); + method public android.app.Notification build(); + method public deprecated android.app.Notification getNotification(); + method public android.app.Notification.Builder setAutoCancel(boolean); + method public android.app.Notification.Builder setContent(android.widget.RemoteViews); + method public android.app.Notification.Builder setContentInfo(java.lang.CharSequence); + method public android.app.Notification.Builder setContentIntent(android.app.PendingIntent); + method public android.app.Notification.Builder setContentText(java.lang.CharSequence); + method public android.app.Notification.Builder setContentTitle(java.lang.CharSequence); + method public android.app.Notification.Builder setDefaults(int); + method public android.app.Notification.Builder setDeleteIntent(android.app.PendingIntent); + method public android.app.Notification.Builder setFullScreenIntent(android.app.PendingIntent, boolean); + method public android.app.Notification.Builder setLargeIcon(android.graphics.Bitmap); + method public android.app.Notification.Builder setLights(int, int, int); + method public android.app.Notification.Builder setNumber(int); + method public android.app.Notification.Builder setOngoing(boolean); + method public android.app.Notification.Builder setOnlyAlertOnce(boolean); + method public android.app.Notification.Builder setPriority(int); + method public android.app.Notification.Builder setProgress(int, int, boolean); + method public android.app.Notification.Builder setShowWhen(boolean); + method public android.app.Notification.Builder setSmallIcon(int); + method public android.app.Notification.Builder setSmallIcon(int, int); + method public android.app.Notification.Builder setSound(android.net.Uri); + method public android.app.Notification.Builder setSound(android.net.Uri, int); + method public android.app.Notification.Builder setStyle(android.app.Notification.Style); + method public android.app.Notification.Builder setSubText(java.lang.CharSequence); + method public android.app.Notification.Builder setTicker(java.lang.CharSequence); + method public android.app.Notification.Builder setTicker(java.lang.CharSequence, android.widget.RemoteViews); + method public android.app.Notification.Builder setUsesChronometer(boolean); + method public android.app.Notification.Builder setVibrate(long[]); + method public android.app.Notification.Builder setWhen(long); + } + + public static class Notification.InboxStyle extends android.app.Notification.Style { + ctor public Notification.InboxStyle(); + ctor public Notification.InboxStyle(android.app.Notification.Builder); + method public android.app.Notification.InboxStyle addLine(java.lang.CharSequence); + method public android.app.Notification build(); + method public android.app.Notification.InboxStyle setBigContentTitle(java.lang.CharSequence); + method public android.app.Notification.InboxStyle setSummaryText(java.lang.CharSequence); + } + + public static abstract class Notification.Style { + ctor public Notification.Style(); + method public abstract android.app.Notification build(); + method protected void checkBuilder(); + method protected android.widget.RemoteViews getStandardView(int); + method protected void internalSetBigContentTitle(java.lang.CharSequence); + method protected void internalSetSummaryText(java.lang.CharSequence); + method public void setBuilder(android.app.Notification.Builder); + field protected android.app.Notification.Builder mBuilder; + } + + public class NotificationManager { + method public void cancel(int); + method public void cancel(java.lang.String, int); + method public void cancelAll(); + method public void notify(int, android.app.Notification); + method public void notify(java.lang.String, int, android.app.Notification); + } + + public final class PendingIntent implements android.os.Parcelable { + method public void cancel(); + method public int describeContents(); + method public static android.app.PendingIntent getActivities(android.content.Context, int, android.content.Intent[], int); + method public static android.app.PendingIntent getActivities(android.content.Context, int, android.content.Intent[], int, android.os.Bundle); + method public static android.app.PendingIntent getActivity(android.content.Context, int, android.content.Intent, int); + method public static android.app.PendingIntent getActivity(android.content.Context, int, android.content.Intent, int, android.os.Bundle); + method public static android.app.PendingIntent getBroadcast(android.content.Context, int, android.content.Intent, int); + method public java.lang.String getCreatorPackage(); + method public int getCreatorUid(); + method public android.os.UserHandle getCreatorUserHandle(); + method public android.content.IntentSender getIntentSender(); + method public static android.app.PendingIntent getService(android.content.Context, int, android.content.Intent, int); + method public deprecated java.lang.String getTargetPackage(); + method public static android.app.PendingIntent readPendingIntentOrNullFromParcel(android.os.Parcel); + method public void send() throws android.app.PendingIntent.CanceledException; + method public void send(int) throws android.app.PendingIntent.CanceledException; + method public void send(android.content.Context, int, android.content.Intent) throws android.app.PendingIntent.CanceledException; + method public void send(int, android.app.PendingIntent.OnFinished, android.os.Handler) throws android.app.PendingIntent.CanceledException; + method public void send(android.content.Context, int, android.content.Intent, android.app.PendingIntent.OnFinished, android.os.Handler) throws android.app.PendingIntent.CanceledException; + method public void send(android.content.Context, int, android.content.Intent, android.app.PendingIntent.OnFinished, android.os.Handler, java.lang.String) throws android.app.PendingIntent.CanceledException; + method public static void writePendingIntentOrNullToParcel(android.app.PendingIntent, android.os.Parcel); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + field public static final int FLAG_CANCEL_CURRENT = 268435456; // 0x10000000 + field public static final int FLAG_NO_CREATE = 536870912; // 0x20000000 + field public static final int FLAG_ONE_SHOT = 1073741824; // 0x40000000 + field public static final int FLAG_UPDATE_CURRENT = 134217728; // 0x8000000 + } + + public static class PendingIntent.CanceledException extends android.util.AndroidException { + ctor public PendingIntent.CanceledException(); + ctor public PendingIntent.CanceledException(java.lang.String); + ctor public PendingIntent.CanceledException(java.lang.Exception); + } + + public static abstract interface PendingIntent.OnFinished { + method public abstract void onSendFinished(android.app.PendingIntent, android.content.Intent, int, java.lang.String, android.os.Bundle); + } + + public class Presentation extends android.app.Dialog { + ctor public Presentation(android.content.Context, android.view.Display); + ctor public Presentation(android.content.Context, android.view.Display, int); + method public android.view.Display getDisplay(); + method public android.content.res.Resources getResources(); + method public void onDisplayChanged(); + method public void onDisplayRemoved(); + } + + public class ProgressDialog extends android.app.AlertDialog { + ctor public ProgressDialog(android.content.Context); + ctor public ProgressDialog(android.content.Context, int); + method public int getMax(); + method public int getProgress(); + method public int getSecondaryProgress(); + method public void incrementProgressBy(int); + method public void incrementSecondaryProgressBy(int); + method public boolean isIndeterminate(); + method public void onStart(); + method public void setIndeterminate(boolean); + method public void setIndeterminateDrawable(android.graphics.drawable.Drawable); + method public void setMax(int); + method public void setProgress(int); + method public void setProgressDrawable(android.graphics.drawable.Drawable); + method public void setProgressNumberFormat(java.lang.String); + method public void setProgressPercentFormat(java.text.NumberFormat); + method public void setProgressStyle(int); + method public void setSecondaryProgress(int); + method public static android.app.ProgressDialog show(android.content.Context, java.lang.CharSequence, java.lang.CharSequence); + method public static android.app.ProgressDialog show(android.content.Context, java.lang.CharSequence, java.lang.CharSequence, boolean); + method public static android.app.ProgressDialog show(android.content.Context, java.lang.CharSequence, java.lang.CharSequence, boolean, boolean); + method public static android.app.ProgressDialog show(android.content.Context, java.lang.CharSequence, java.lang.CharSequence, boolean, boolean, android.content.DialogInterface.OnCancelListener); + field public static final int STYLE_HORIZONTAL = 1; // 0x1 + field public static final int STYLE_SPINNER = 0; // 0x0 + } + + public class SearchManager implements android.content.DialogInterface.OnCancelListener android.content.DialogInterface.OnDismissListener { + method public android.content.ComponentName getGlobalSearchActivity(); + method public android.app.SearchableInfo getSearchableInfo(android.content.ComponentName); + method public java.util.List getSearchablesInGlobalSearch(); + method public deprecated void onCancel(android.content.DialogInterface); + method public deprecated void onDismiss(android.content.DialogInterface); + method public void setOnCancelListener(android.app.SearchManager.OnCancelListener); + method public void setOnDismissListener(android.app.SearchManager.OnDismissListener); + method public void startSearch(java.lang.String, boolean, android.content.ComponentName, android.os.Bundle, boolean); + method public void stopSearch(); + method public void triggerSearch(java.lang.String, android.content.ComponentName, android.os.Bundle); + field public static final java.lang.String ACTION_KEY = "action_key"; + field public static final java.lang.String ACTION_MSG = "action_msg"; + field public static final java.lang.String APP_DATA = "app_data"; + field public static final java.lang.String CURSOR_EXTRA_KEY_IN_PROGRESS = "in_progress"; + field public static final java.lang.String EXTRA_DATA_KEY = "intent_extra_data_key"; + field public static final java.lang.String EXTRA_NEW_SEARCH = "new_search"; + field public static final java.lang.String EXTRA_SELECT_QUERY = "select_query"; + field public static final java.lang.String EXTRA_WEB_SEARCH_PENDINGINTENT = "web_search_pendingintent"; + field public static final int FLAG_QUERY_REFINEMENT = 1; // 0x1 + field public static final java.lang.String INTENT_ACTION_GLOBAL_SEARCH = "android.search.action.GLOBAL_SEARCH"; + field public static final java.lang.String INTENT_ACTION_SEARCHABLES_CHANGED = "android.search.action.SEARCHABLES_CHANGED"; + field public static final java.lang.String INTENT_ACTION_SEARCH_SETTINGS = "android.search.action.SEARCH_SETTINGS"; + field public static final java.lang.String INTENT_ACTION_SEARCH_SETTINGS_CHANGED = "android.search.action.SETTINGS_CHANGED"; + field public static final java.lang.String INTENT_ACTION_WEB_SEARCH_SETTINGS = "android.search.action.WEB_SEARCH_SETTINGS"; + field public static final java.lang.String INTENT_GLOBAL_SEARCH_ACTIVITY_CHANGED = "android.search.action.GLOBAL_SEARCH_ACTIVITY_CHANGED"; + field public static final char MENU_KEY = 115; // 0x0073 's' + field public static final int MENU_KEYCODE = 47; // 0x2f + field public static final java.lang.String QUERY = "query"; + field public static final java.lang.String SHORTCUT_MIME_TYPE = "vnd.android.cursor.item/vnd.android.search.suggest"; + field public static final java.lang.String SUGGEST_COLUMN_FLAGS = "suggest_flags"; + field public static final java.lang.String SUGGEST_COLUMN_FORMAT = "suggest_format"; + field public static final java.lang.String SUGGEST_COLUMN_ICON_1 = "suggest_icon_1"; + field public static final java.lang.String SUGGEST_COLUMN_ICON_2 = "suggest_icon_2"; + field public static final java.lang.String SUGGEST_COLUMN_INTENT_ACTION = "suggest_intent_action"; + field public static final java.lang.String SUGGEST_COLUMN_INTENT_DATA = "suggest_intent_data"; + field public static final java.lang.String SUGGEST_COLUMN_INTENT_DATA_ID = "suggest_intent_data_id"; + field public static final java.lang.String SUGGEST_COLUMN_INTENT_EXTRA_DATA = "suggest_intent_extra_data"; + field public static final java.lang.String SUGGEST_COLUMN_LAST_ACCESS_HINT = "suggest_last_access_hint"; + field public static final java.lang.String SUGGEST_COLUMN_QUERY = "suggest_intent_query"; + field public static final java.lang.String SUGGEST_COLUMN_SHORTCUT_ID = "suggest_shortcut_id"; + field public static final java.lang.String SUGGEST_COLUMN_SPINNER_WHILE_REFRESHING = "suggest_spinner_while_refreshing"; + field public static final java.lang.String SUGGEST_COLUMN_TEXT_1 = "suggest_text_1"; + field public static final java.lang.String SUGGEST_COLUMN_TEXT_2 = "suggest_text_2"; + field public static final java.lang.String SUGGEST_COLUMN_TEXT_2_URL = "suggest_text_2_url"; + field public static final java.lang.String SUGGEST_MIME_TYPE = "vnd.android.cursor.dir/vnd.android.search.suggest"; + field public static final java.lang.String SUGGEST_NEVER_MAKE_SHORTCUT = "_-1"; + field public static final java.lang.String SUGGEST_PARAMETER_LIMIT = "limit"; + field public static final java.lang.String SUGGEST_URI_PATH_QUERY = "search_suggest_query"; + field public static final java.lang.String SUGGEST_URI_PATH_SHORTCUT = "search_suggest_shortcut"; + field public static final java.lang.String USER_QUERY = "user_query"; + } + + public static abstract interface SearchManager.OnCancelListener { + method public abstract void onCancel(); + } + + public static abstract interface SearchManager.OnDismissListener { + method public abstract void onDismiss(); + } + + public final class SearchableInfo implements android.os.Parcelable { + method public boolean autoUrlDetect(); + method public int describeContents(); + method public int getHintId(); + method public int getImeOptions(); + method public int getInputType(); + method public android.content.ComponentName getSearchActivity(); + method public int getSettingsDescriptionId(); + method public java.lang.String getSuggestAuthority(); + method public java.lang.String getSuggestIntentAction(); + method public java.lang.String getSuggestIntentData(); + method public java.lang.String getSuggestPackage(); + method public java.lang.String getSuggestPath(); + method public java.lang.String getSuggestSelection(); + method public int getSuggestThreshold(); + method public int getVoiceLanguageId(); + method public int getVoiceLanguageModeId(); + method public int getVoiceMaxResults(); + method public int getVoicePromptTextId(); + method public boolean getVoiceSearchEnabled(); + method public boolean getVoiceSearchLaunchRecognizer(); + method public boolean getVoiceSearchLaunchWebSearch(); + method public boolean queryAfterZeroResults(); + method public boolean shouldIncludeInGlobalSearch(); + method public boolean shouldRewriteQueryFromData(); + method public boolean shouldRewriteQueryFromText(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + } + + public abstract class Service extends android.content.ContextWrapper implements android.content.ComponentCallbacks2 { + ctor public Service(); + method protected void dump(java.io.FileDescriptor, java.io.PrintWriter, java.lang.String[]); + method public final android.app.Application getApplication(); + method public abstract android.os.IBinder onBind(android.content.Intent); + method public void onConfigurationChanged(android.content.res.Configuration); + method public void onCreate(); + method public void onDestroy(); + method public void onLowMemory(); + method public void onRebind(android.content.Intent); + method public deprecated void onStart(android.content.Intent, int); + method public int onStartCommand(android.content.Intent, int, int); + method public void onTaskRemoved(android.content.Intent); + method public void onTrimMemory(int); + method public boolean onUnbind(android.content.Intent); + method public final void startForeground(int, android.app.Notification); + method public final void stopForeground(boolean); + method public final void stopSelf(); + method public final void stopSelf(int); + method public final boolean stopSelfResult(int); + field public static final int START_CONTINUATION_MASK = 15; // 0xf + field public static final int START_FLAG_REDELIVERY = 1; // 0x1 + field public static final int START_FLAG_RETRY = 2; // 0x2 + field public static final int START_NOT_STICKY = 2; // 0x2 + field public static final int START_REDELIVER_INTENT = 3; // 0x3 + field public static final int START_STICKY = 1; // 0x1 + field public static final int START_STICKY_COMPATIBILITY = 0; // 0x0 + } + + public deprecated class TabActivity extends android.app.ActivityGroup { + ctor public TabActivity(); + method public android.widget.TabHost getTabHost(); + method public android.widget.TabWidget getTabWidget(); + method public void setDefaultTab(java.lang.String); + method public void setDefaultTab(int); + } + + public class TaskStackBuilder { + method public android.app.TaskStackBuilder addNextIntent(android.content.Intent); + method public android.app.TaskStackBuilder addNextIntentWithParentStack(android.content.Intent); + method public android.app.TaskStackBuilder addParentStack(android.app.Activity); + method public android.app.TaskStackBuilder addParentStack(java.lang.Class); + method public android.app.TaskStackBuilder addParentStack(android.content.ComponentName); + method public static android.app.TaskStackBuilder create(android.content.Context); + method public android.content.Intent editIntentAt(int); + method public int getIntentCount(); + method public android.content.Intent[] getIntents(); + method public android.app.PendingIntent getPendingIntent(int, int); + method public android.app.PendingIntent getPendingIntent(int, int, android.os.Bundle); + method public void startActivities(); + method public void startActivities(android.os.Bundle); + } + + public class TimePickerDialog extends android.app.AlertDialog implements android.content.DialogInterface.OnClickListener android.widget.TimePicker.OnTimeChangedListener { + ctor public TimePickerDialog(android.content.Context, android.app.TimePickerDialog.OnTimeSetListener, int, int, boolean); + ctor public TimePickerDialog(android.content.Context, int, android.app.TimePickerDialog.OnTimeSetListener, int, int, boolean); + method public void onClick(android.content.DialogInterface, int); + method public void onTimeChanged(android.widget.TimePicker, int, int); + method public void updateTime(int, int); + } + + public static abstract interface TimePickerDialog.OnTimeSetListener { + method public abstract void onTimeSet(android.widget.TimePicker, int, int); + } + + public class UiModeManager { + method public void disableCarMode(int); + method public void enableCarMode(int); + method public int getCurrentModeType(); + method public int getNightMode(); + method public void setNightMode(int); + field public static java.lang.String ACTION_ENTER_CAR_MODE; + field public static java.lang.String ACTION_ENTER_DESK_MODE; + field public static java.lang.String ACTION_EXIT_CAR_MODE; + field public static java.lang.String ACTION_EXIT_DESK_MODE; + field public static final int DISABLE_CAR_MODE_GO_HOME = 1; // 0x1 + field public static final int ENABLE_CAR_MODE_GO_CAR_HOME = 1; // 0x1 + field public static final int MODE_NIGHT_AUTO = 0; // 0x0 + field public static final int MODE_NIGHT_NO = 1; // 0x1 + field public static final int MODE_NIGHT_YES = 2; // 0x2 + } + + public final class WallpaperInfo implements android.os.Parcelable { + ctor public WallpaperInfo(android.content.Context, android.content.pm.ResolveInfo) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException; + method public int describeContents(); + method public void dump(android.util.Printer, java.lang.String); + method public android.content.ComponentName getComponent(); + method public java.lang.String getPackageName(); + method public android.content.pm.ServiceInfo getServiceInfo(); + method public java.lang.String getServiceName(); + method public java.lang.String getSettingsActivity(); + method public java.lang.CharSequence loadAuthor(android.content.pm.PackageManager) throws android.content.res.Resources.NotFoundException; + method public java.lang.CharSequence loadDescription(android.content.pm.PackageManager) throws android.content.res.Resources.NotFoundException; + method public android.graphics.drawable.Drawable loadIcon(android.content.pm.PackageManager); + method public java.lang.CharSequence loadLabel(android.content.pm.PackageManager); + method public android.graphics.drawable.Drawable loadThumbnail(android.content.pm.PackageManager); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + } + + public class WallpaperManager { + method public void clear() throws java.io.IOException; + method public void clearWallpaperOffsets(android.os.IBinder); + method public void forgetLoadedWallpaper(); + method public int getDesiredMinimumHeight(); + method public int getDesiredMinimumWidth(); + method public android.graphics.drawable.Drawable getDrawable(); + method public android.graphics.drawable.Drawable getFastDrawable(); + method public static android.app.WallpaperManager getInstance(android.content.Context); + method public android.app.WallpaperInfo getWallpaperInfo(); + method public boolean hasResourceWallpaper(int); + method public android.graphics.drawable.Drawable peekDrawable(); + method public android.graphics.drawable.Drawable peekFastDrawable(); + method public void sendWallpaperCommand(android.os.IBinder, java.lang.String, int, int, int, android.os.Bundle); + method public void setBitmap(android.graphics.Bitmap) throws java.io.IOException; + method public void setResource(int) throws java.io.IOException; + method public void setStream(java.io.InputStream) throws java.io.IOException; + method public void setWallpaperOffsetSteps(float, float); + method public void setWallpaperOffsets(android.os.IBinder, float, float); + method public void suggestDesiredDimensions(int, int); + field public static final java.lang.String ACTION_CHANGE_LIVE_WALLPAPER = "android.service.wallpaper.CHANGE_LIVE_WALLPAPER"; + field public static final java.lang.String ACTION_LIVE_WALLPAPER_CHOOSER = "android.service.wallpaper.LIVE_WALLPAPER_CHOOSER"; + field public static final java.lang.String COMMAND_DROP = "android.home.drop"; + field public static final java.lang.String COMMAND_SECONDARY_TAP = "android.wallpaper.secondaryTap"; + field public static final java.lang.String COMMAND_TAP = "android.wallpaper.tap"; + field public static final java.lang.String EXTRA_LIVE_WALLPAPER_COMPONENT = "android.service.wallpaper.extra.LIVE_WALLPAPER_COMPONENT"; + field public static final java.lang.String WALLPAPER_PREVIEW_META_DATA = "android.wallpaper.preview"; + } + +} + +package android.app.admin { + + public final class DeviceAdminInfo implements android.os.Parcelable { + ctor public DeviceAdminInfo(android.content.Context, android.content.pm.ResolveInfo) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException; + method public int describeContents(); + method public void dump(android.util.Printer, java.lang.String); + method public android.content.pm.ActivityInfo getActivityInfo(); + method public android.content.ComponentName getComponent(); + method public java.lang.String getPackageName(); + method public java.lang.String getReceiverName(); + method public java.lang.String getTagForPolicy(int); + method public boolean isVisible(); + method public java.lang.CharSequence loadDescription(android.content.pm.PackageManager) throws android.content.res.Resources.NotFoundException; + method public android.graphics.drawable.Drawable loadIcon(android.content.pm.PackageManager); + method public java.lang.CharSequence loadLabel(android.content.pm.PackageManager); + method public boolean usesPolicy(int); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + field public static final int USES_ENCRYPTED_STORAGE = 7; // 0x7 + field public static final int USES_POLICY_DISABLE_CAMERA = 8; // 0x8 + field public static final int USES_POLICY_DISABLE_KEYGUARD_FEATURES = 9; // 0x9 + field public static final int USES_POLICY_EXPIRE_PASSWORD = 6; // 0x6 + field public static final int USES_POLICY_FORCE_LOCK = 3; // 0x3 + field public static final int USES_POLICY_LIMIT_PASSWORD = 0; // 0x0 + field public static final int USES_POLICY_RESET_PASSWORD = 2; // 0x2 + field public static final int USES_POLICY_WATCH_LOGIN = 1; // 0x1 + field public static final int USES_POLICY_WIPE_DATA = 4; // 0x4 + } + + public class DeviceAdminReceiver extends android.content.BroadcastReceiver { + ctor public DeviceAdminReceiver(); + method public android.app.admin.DevicePolicyManager getManager(android.content.Context); + method public android.content.ComponentName getWho(android.content.Context); + method public java.lang.CharSequence onDisableRequested(android.content.Context, android.content.Intent); + method public void onDisabled(android.content.Context, android.content.Intent); + method public void onEnabled(android.content.Context, android.content.Intent); + method public void onPasswordChanged(android.content.Context, android.content.Intent); + method public void onPasswordExpiring(android.content.Context, android.content.Intent); + method public void onPasswordFailed(android.content.Context, android.content.Intent); + method public void onPasswordSucceeded(android.content.Context, android.content.Intent); + method public void onReceive(android.content.Context, android.content.Intent); + field public static final java.lang.String ACTION_DEVICE_ADMIN_DISABLED = "android.app.action.DEVICE_ADMIN_DISABLED"; + field public static final java.lang.String ACTION_DEVICE_ADMIN_DISABLE_REQUESTED = "android.app.action.DEVICE_ADMIN_DISABLE_REQUESTED"; + field public static final java.lang.String ACTION_DEVICE_ADMIN_ENABLED = "android.app.action.DEVICE_ADMIN_ENABLED"; + field public static final java.lang.String ACTION_PASSWORD_CHANGED = "android.app.action.ACTION_PASSWORD_CHANGED"; + field public static final java.lang.String ACTION_PASSWORD_EXPIRING = "android.app.action.ACTION_PASSWORD_EXPIRING"; + field public static final java.lang.String ACTION_PASSWORD_FAILED = "android.app.action.ACTION_PASSWORD_FAILED"; + field public static final java.lang.String ACTION_PASSWORD_SUCCEEDED = "android.app.action.ACTION_PASSWORD_SUCCEEDED"; + field public static final java.lang.String DEVICE_ADMIN_META_DATA = "android.app.device_admin"; + field public static final java.lang.String EXTRA_DISABLE_WARNING = "android.app.extra.DISABLE_WARNING"; + } + + public class DevicePolicyManager { + method public java.util.List getActiveAdmins(); + method public boolean getCameraDisabled(android.content.ComponentName); + method public int getCurrentFailedPasswordAttempts(); + method public int getKeyguardDisabledFeatures(android.content.ComponentName); + method public int getMaximumFailedPasswordsForWipe(android.content.ComponentName); + method public long getMaximumTimeToLock(android.content.ComponentName); + method public long getPasswordExpiration(android.content.ComponentName); + method public long getPasswordExpirationTimeout(android.content.ComponentName); + method public int getPasswordHistoryLength(android.content.ComponentName); + method public int getPasswordMaximumLength(int); + method public int getPasswordMinimumLength(android.content.ComponentName); + method public int getPasswordMinimumLetters(android.content.ComponentName); + method public int getPasswordMinimumLowerCase(android.content.ComponentName); + method public int getPasswordMinimumNonLetter(android.content.ComponentName); + method public int getPasswordMinimumNumeric(android.content.ComponentName); + method public int getPasswordMinimumSymbols(android.content.ComponentName); + method public int getPasswordMinimumUpperCase(android.content.ComponentName); + method public int getPasswordQuality(android.content.ComponentName); + method public boolean getStorageEncryption(android.content.ComponentName); + method public int getStorageEncryptionStatus(); + method public boolean hasGrantedPolicy(android.content.ComponentName, int); + method public boolean isActivePasswordSufficient(); + method public boolean isAdminActive(android.content.ComponentName); + method public void lockNow(); + method public void removeActiveAdmin(android.content.ComponentName); + method public boolean resetPassword(java.lang.String, int); + method public void setCameraDisabled(android.content.ComponentName, boolean); + method public void setKeyguardDisabledFeatures(android.content.ComponentName, int); + method public void setMaximumFailedPasswordsForWipe(android.content.ComponentName, int); + method public void setMaximumTimeToLock(android.content.ComponentName, long); + method public void setPasswordExpirationTimeout(android.content.ComponentName, long); + method public void setPasswordHistoryLength(android.content.ComponentName, int); + method public void setPasswordMinimumLength(android.content.ComponentName, int); + method public void setPasswordMinimumLetters(android.content.ComponentName, int); + method public void setPasswordMinimumLowerCase(android.content.ComponentName, int); + method public void setPasswordMinimumNonLetter(android.content.ComponentName, int); + method public void setPasswordMinimumNumeric(android.content.ComponentName, int); + method public void setPasswordMinimumSymbols(android.content.ComponentName, int); + method public void setPasswordMinimumUpperCase(android.content.ComponentName, int); + method public void setPasswordQuality(android.content.ComponentName, int); + method public int setStorageEncryption(android.content.ComponentName, boolean); + method public void wipeData(int); + field public static final java.lang.String ACTION_ADD_DEVICE_ADMIN = "android.app.action.ADD_DEVICE_ADMIN"; + field public static final java.lang.String ACTION_SET_NEW_PASSWORD = "android.app.action.SET_NEW_PASSWORD"; + field public static final java.lang.String ACTION_START_ENCRYPTION = "android.app.action.START_ENCRYPTION"; + field public static final int ENCRYPTION_STATUS_ACTIVATING = 2; // 0x2 + field public static final int ENCRYPTION_STATUS_ACTIVE = 3; // 0x3 + field public static final int ENCRYPTION_STATUS_INACTIVE = 1; // 0x1 + field public static final int ENCRYPTION_STATUS_UNSUPPORTED = 0; // 0x0 + field public static final java.lang.String EXTRA_ADD_EXPLANATION = "android.app.extra.ADD_EXPLANATION"; + field public static final java.lang.String EXTRA_DEVICE_ADMIN = "android.app.extra.DEVICE_ADMIN"; + field public static final int KEYGUARD_DISABLE_FEATURES_ALL = 2147483647; // 0x7fffffff + field public static final int KEYGUARD_DISABLE_FEATURES_NONE = 0; // 0x0 + field public static final int KEYGUARD_DISABLE_SECURE_CAMERA = 2; // 0x2 + field public static final int KEYGUARD_DISABLE_WIDGETS_ALL = 1; // 0x1 + field public static final int PASSWORD_QUALITY_ALPHABETIC = 262144; // 0x40000 + field public static final int PASSWORD_QUALITY_ALPHANUMERIC = 327680; // 0x50000 + field public static final int PASSWORD_QUALITY_BIOMETRIC_WEAK = 32768; // 0x8000 + field public static final int PASSWORD_QUALITY_COMPLEX = 393216; // 0x60000 + field public static final int PASSWORD_QUALITY_NUMERIC = 131072; // 0x20000 + field public static final int PASSWORD_QUALITY_SOMETHING = 65536; // 0x10000 + field public static final int PASSWORD_QUALITY_UNSPECIFIED = 0; // 0x0 + field public static final int RESET_PASSWORD_REQUIRE_ENTRY = 1; // 0x1 + field public static final int WIPE_EXTERNAL_STORAGE = 1; // 0x1 + } + +} + +package android.app.backup { + + public abstract class BackupAgent extends android.content.ContextWrapper { + ctor public BackupAgent(); + method public final void fullBackupFile(java.io.File, android.app.backup.FullBackupDataOutput); + method public abstract void onBackup(android.os.ParcelFileDescriptor, android.app.backup.BackupDataOutput, android.os.ParcelFileDescriptor) throws java.io.IOException; + method public void onCreate(); + method public void onDestroy(); + method public void onFullBackup(android.app.backup.FullBackupDataOutput) throws java.io.IOException; + method public abstract void onRestore(android.app.backup.BackupDataInput, int, android.os.ParcelFileDescriptor) throws java.io.IOException; + method public void onRestoreFile(android.os.ParcelFileDescriptor, long, java.io.File, int, long, long) throws java.io.IOException; + field public static final int TYPE_DIRECTORY = 2; // 0x2 + field public static final int TYPE_FILE = 1; // 0x1 + } + + public class BackupAgentHelper extends android.app.backup.BackupAgent { + ctor public BackupAgentHelper(); + method public void addHelper(java.lang.String, android.app.backup.BackupHelper); + method public void onBackup(android.os.ParcelFileDescriptor, android.app.backup.BackupDataOutput, android.os.ParcelFileDescriptor) throws java.io.IOException; + method public void onRestore(android.app.backup.BackupDataInput, int, android.os.ParcelFileDescriptor) throws java.io.IOException; + } + + public class BackupDataInput { + method public int getDataSize(); + method public java.lang.String getKey(); + method public int readEntityData(byte[], int, int) throws java.io.IOException; + method public boolean readNextHeader() throws java.io.IOException; + method public void skipEntityData() throws java.io.IOException; + } + + public class BackupDataInputStream extends java.io.InputStream { + method public java.lang.String getKey(); + method public int read() throws java.io.IOException; + method public int size(); + } + + public class BackupDataOutput { + method public int writeEntityData(byte[], int) throws java.io.IOException; + method public int writeEntityHeader(java.lang.String, int) throws java.io.IOException; + } + + public abstract interface BackupHelper { + method public abstract void performBackup(android.os.ParcelFileDescriptor, android.app.backup.BackupDataOutput, android.os.ParcelFileDescriptor); + method public abstract void restoreEntity(android.app.backup.BackupDataInputStream); + method public abstract void writeNewStateDescription(android.os.ParcelFileDescriptor); + } + + public class BackupManager { + ctor public BackupManager(android.content.Context); + method public void dataChanged(); + method public static void dataChanged(java.lang.String); + method public int requestRestore(android.app.backup.RestoreObserver); + } + + public class FileBackupHelper extends android.app.backup.FileBackupHelperBase implements android.app.backup.BackupHelper { + ctor public FileBackupHelper(android.content.Context, java.lang.String...); + method public void performBackup(android.os.ParcelFileDescriptor, android.app.backup.BackupDataOutput, android.os.ParcelFileDescriptor); + method public void restoreEntity(android.app.backup.BackupDataInputStream); + } + + class FileBackupHelperBase { + method public void writeNewStateDescription(android.os.ParcelFileDescriptor); + } + + public class FullBackupDataOutput { + } + + public abstract class RestoreObserver { + ctor public RestoreObserver(); + method public void onUpdate(int, java.lang.String); + method public void restoreFinished(int); + method public void restoreStarting(int); + } + + public class SharedPreferencesBackupHelper extends android.app.backup.FileBackupHelperBase implements android.app.backup.BackupHelper { + ctor public SharedPreferencesBackupHelper(android.content.Context, java.lang.String...); + method public void performBackup(android.os.ParcelFileDescriptor, android.app.backup.BackupDataOutput, android.os.ParcelFileDescriptor); + method public void restoreEntity(android.app.backup.BackupDataInputStream); + } + +} + +package android.appwidget { + + public class AppWidgetHost { + ctor public AppWidgetHost(android.content.Context, int); + method public int allocateAppWidgetId(); + method protected void clearViews(); + method public final android.appwidget.AppWidgetHostView createView(android.content.Context, int, android.appwidget.AppWidgetProviderInfo); + method public static void deleteAllHosts(); + method public void deleteAppWidgetId(int); + method public void deleteHost(); + method protected android.appwidget.AppWidgetHostView onCreateView(android.content.Context, int, android.appwidget.AppWidgetProviderInfo); + method protected void onProviderChanged(int, android.appwidget.AppWidgetProviderInfo); + method protected void onProvidersChanged(); + method public void startListening(); + method public void stopListening(); + } + + public class AppWidgetHostView extends android.widget.FrameLayout { + ctor public AppWidgetHostView(android.content.Context); + ctor public AppWidgetHostView(android.content.Context, int, int); + method public int getAppWidgetId(); + method public android.appwidget.AppWidgetProviderInfo getAppWidgetInfo(); + method public static android.graphics.Rect getDefaultPaddingForWidget(android.content.Context, android.content.ComponentName, android.graphics.Rect); + method protected android.view.View getDefaultView(); + method protected android.view.View getErrorView(); + method protected void prepareView(android.view.View); + method public void setAppWidget(int, android.appwidget.AppWidgetProviderInfo); + method public void updateAppWidget(android.widget.RemoteViews); + method public void updateAppWidgetOptions(android.os.Bundle); + method public void updateAppWidgetSize(android.os.Bundle, int, int, int, int); + } + + public class AppWidgetManager { + method public boolean bindAppWidgetIdIfAllowed(int, android.content.ComponentName); + method public boolean bindAppWidgetIdIfAllowed(int, android.content.ComponentName, android.os.Bundle); + method public int[] getAppWidgetIds(android.content.ComponentName); + method public android.appwidget.AppWidgetProviderInfo getAppWidgetInfo(int); + method public android.os.Bundle getAppWidgetOptions(int); + method public java.util.List getInstalledProviders(); + method public static android.appwidget.AppWidgetManager getInstance(android.content.Context); + method public void notifyAppWidgetViewDataChanged(int[], int); + method public void notifyAppWidgetViewDataChanged(int, int); + method public void partiallyUpdateAppWidget(int[], android.widget.RemoteViews); + method public void partiallyUpdateAppWidget(int, android.widget.RemoteViews); + method public void updateAppWidget(int[], android.widget.RemoteViews); + method public void updateAppWidget(int, android.widget.RemoteViews); + method public void updateAppWidget(android.content.ComponentName, android.widget.RemoteViews); + method public void updateAppWidgetOptions(int, android.os.Bundle); + field public static final java.lang.String ACTION_APPWIDGET_BIND = "android.appwidget.action.APPWIDGET_BIND"; + field public static final java.lang.String ACTION_APPWIDGET_CONFIGURE = "android.appwidget.action.APPWIDGET_CONFIGURE"; + field public static final java.lang.String ACTION_APPWIDGET_DELETED = "android.appwidget.action.APPWIDGET_DELETED"; + field public static final java.lang.String ACTION_APPWIDGET_DISABLED = "android.appwidget.action.APPWIDGET_DISABLED"; + field public static final java.lang.String ACTION_APPWIDGET_ENABLED = "android.appwidget.action.APPWIDGET_ENABLED"; + field public static final java.lang.String ACTION_APPWIDGET_OPTIONS_CHANGED = "android.appwidget.action.APPWIDGET_UPDATE_OPTIONS"; + field public static final java.lang.String ACTION_APPWIDGET_PICK = "android.appwidget.action.APPWIDGET_PICK"; + field public static final java.lang.String ACTION_APPWIDGET_UPDATE = "android.appwidget.action.APPWIDGET_UPDATE"; + field public static final java.lang.String EXTRA_APPWIDGET_ID = "appWidgetId"; + field public static final java.lang.String EXTRA_APPWIDGET_IDS = "appWidgetIds"; + field public static final java.lang.String EXTRA_APPWIDGET_OPTIONS = "appWidgetOptions"; + field public static final java.lang.String EXTRA_APPWIDGET_PROVIDER = "appWidgetProvider"; + field public static final java.lang.String EXTRA_CUSTOM_EXTRAS = "customExtras"; + field public static final java.lang.String EXTRA_CUSTOM_INFO = "customInfo"; + field public static final int INVALID_APPWIDGET_ID = 0; // 0x0 + field public static final java.lang.String META_DATA_APPWIDGET_PROVIDER = "android.appwidget.provider"; + field public static final java.lang.String OPTION_APPWIDGET_HOST_CATEGORY = "appWidgetCategory"; + field public static final java.lang.String OPTION_APPWIDGET_MAX_HEIGHT = "appWidgetMaxHeight"; + field public static final java.lang.String OPTION_APPWIDGET_MAX_WIDTH = "appWidgetMaxWidth"; + field public static final java.lang.String OPTION_APPWIDGET_MIN_HEIGHT = "appWidgetMinHeight"; + field public static final java.lang.String OPTION_APPWIDGET_MIN_WIDTH = "appWidgetMinWidth"; + } + + public class AppWidgetProvider extends android.content.BroadcastReceiver { + ctor public AppWidgetProvider(); + method public void onAppWidgetOptionsChanged(android.content.Context, android.appwidget.AppWidgetManager, int, android.os.Bundle); + method public void onDeleted(android.content.Context, int[]); + method public void onDisabled(android.content.Context); + method public void onEnabled(android.content.Context); + method public void onReceive(android.content.Context, android.content.Intent); + method public void onUpdate(android.content.Context, android.appwidget.AppWidgetManager, int[]); + } + + public class AppWidgetProviderInfo implements android.os.Parcelable { + ctor public AppWidgetProviderInfo(); + ctor public AppWidgetProviderInfo(android.os.Parcel); + method public android.appwidget.AppWidgetProviderInfo clone(); + method public int describeContents(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + field public static final int RESIZE_BOTH = 3; // 0x3 + field public static final int RESIZE_HORIZONTAL = 1; // 0x1 + field public static final int RESIZE_NONE = 0; // 0x0 + field public static final int RESIZE_VERTICAL = 2; // 0x2 + field public static final int WIDGET_CATEGORY_HOME_SCREEN = 1; // 0x1 + field public static final int WIDGET_CATEGORY_KEYGUARD = 2; // 0x2 + field public int autoAdvanceViewId; + field public android.content.ComponentName configure; + field public int icon; + field public int initialKeyguardLayout; + field public int initialLayout; + field public java.lang.String label; + field public int minHeight; + field public int minResizeHeight; + field public int minResizeWidth; + field public int minWidth; + field public int previewImage; + field public android.content.ComponentName provider; + field public int resizeMode; + field public int updatePeriodMillis; + field public int widgetCategory; + } + +} + +package android.bluetooth { + + public final class BluetoothA2dp implements android.bluetooth.BluetoothProfile { + method public void finalize(); + method public java.util.List getConnectedDevices(); + method public int getConnectionState(android.bluetooth.BluetoothDevice); + method public java.util.List getDevicesMatchingConnectionStates(int[]); + method public boolean isA2dpPlaying(android.bluetooth.BluetoothDevice); + field public static final java.lang.String ACTION_CONNECTION_STATE_CHANGED = "android.bluetooth.a2dp.profile.action.CONNECTION_STATE_CHANGED"; + field public static final java.lang.String ACTION_PLAYING_STATE_CHANGED = "android.bluetooth.a2dp.profile.action.PLAYING_STATE_CHANGED"; + field public static final int STATE_NOT_PLAYING = 11; // 0xb + field public static final int STATE_PLAYING = 10; // 0xa + } + + public final class BluetoothAdapter { + method public boolean cancelDiscovery(); + method public static boolean checkBluetoothAddress(java.lang.String); + method public void closeProfileProxy(int, android.bluetooth.BluetoothProfile); + method public boolean disable(); + method public boolean enable(); + method public java.lang.String getAddress(); + method public java.util.Set getBondedDevices(); + method public static synchronized android.bluetooth.BluetoothAdapter getDefaultAdapter(); + method public java.lang.String getName(); + method public int getProfileConnectionState(int); + method public boolean getProfileProxy(android.content.Context, android.bluetooth.BluetoothProfile.ServiceListener, int); + method public android.bluetooth.BluetoothDevice getRemoteDevice(java.lang.String); + method public android.bluetooth.BluetoothDevice getRemoteDevice(byte[]); + method public int getScanMode(); + method public int getState(); + method public boolean isDiscovering(); + method public boolean isEnabled(); + method public android.bluetooth.BluetoothServerSocket listenUsingInsecureRfcommWithServiceRecord(java.lang.String, java.util.UUID) throws java.io.IOException; + method public android.bluetooth.BluetoothServerSocket listenUsingRfcommWithServiceRecord(java.lang.String, java.util.UUID) throws java.io.IOException; + method public boolean setName(java.lang.String); + method public boolean startDiscovery(); + field public static final java.lang.String ACTION_CONNECTION_STATE_CHANGED = "android.bluetooth.adapter.action.CONNECTION_STATE_CHANGED"; + field public static final java.lang.String ACTION_DISCOVERY_FINISHED = "android.bluetooth.adapter.action.DISCOVERY_FINISHED"; + field public static final java.lang.String ACTION_DISCOVERY_STARTED = "android.bluetooth.adapter.action.DISCOVERY_STARTED"; + field public static final java.lang.String ACTION_LOCAL_NAME_CHANGED = "android.bluetooth.adapter.action.LOCAL_NAME_CHANGED"; + field public static final java.lang.String ACTION_REQUEST_DISCOVERABLE = "android.bluetooth.adapter.action.REQUEST_DISCOVERABLE"; + field public static final java.lang.String ACTION_REQUEST_ENABLE = "android.bluetooth.adapter.action.REQUEST_ENABLE"; + field public static final java.lang.String ACTION_SCAN_MODE_CHANGED = "android.bluetooth.adapter.action.SCAN_MODE_CHANGED"; + field public static final java.lang.String ACTION_STATE_CHANGED = "android.bluetooth.adapter.action.STATE_CHANGED"; + field public static final int ERROR = -2147483648; // 0x80000000 + field public static final java.lang.String EXTRA_CONNECTION_STATE = "android.bluetooth.adapter.extra.CONNECTION_STATE"; + field public static final java.lang.String EXTRA_DISCOVERABLE_DURATION = "android.bluetooth.adapter.extra.DISCOVERABLE_DURATION"; + field public static final java.lang.String EXTRA_LOCAL_NAME = "android.bluetooth.adapter.extra.LOCAL_NAME"; + field public static final java.lang.String EXTRA_PREVIOUS_CONNECTION_STATE = "android.bluetooth.adapter.extra.PREVIOUS_CONNECTION_STATE"; + field public static final java.lang.String EXTRA_PREVIOUS_SCAN_MODE = "android.bluetooth.adapter.extra.PREVIOUS_SCAN_MODE"; + field public static final java.lang.String EXTRA_PREVIOUS_STATE = "android.bluetooth.adapter.extra.PREVIOUS_STATE"; + field public static final java.lang.String EXTRA_SCAN_MODE = "android.bluetooth.adapter.extra.SCAN_MODE"; + field public static final java.lang.String EXTRA_STATE = "android.bluetooth.adapter.extra.STATE"; + field public static final int SCAN_MODE_CONNECTABLE = 21; // 0x15 + field public static final int SCAN_MODE_CONNECTABLE_DISCOVERABLE = 23; // 0x17 + field public static final int SCAN_MODE_NONE = 20; // 0x14 + field public static final int STATE_CONNECTED = 2; // 0x2 + field public static final int STATE_CONNECTING = 1; // 0x1 + field public static final int STATE_DISCONNECTED = 0; // 0x0 + field public static final int STATE_DISCONNECTING = 3; // 0x3 + field public static final int STATE_OFF = 10; // 0xa + field public static final int STATE_ON = 12; // 0xc + field public static final int STATE_TURNING_OFF = 13; // 0xd + field public static final int STATE_TURNING_ON = 11; // 0xb + } + + public class BluetoothAssignedNumbers { + field public static final int ACCEL_SEMICONDUCTOR = 74; // 0x4a + field public static final int ALCATEL = 36; // 0x24 + field public static final int APPLE = 76; // 0x4c + field public static final int APT_LICENSING = 79; // 0x4f + field public static final int ATHEROS_COMMUNICATIONS = 69; // 0x45 + field public static final int ATMEL = 19; // 0x13 + field public static final int AVAGO = 78; // 0x4e + field public static final int AVM_BERLIN = 31; // 0x1f + field public static final int BANDSPEED = 32; // 0x20 + field public static final int BELKIN_INTERNATIONAL = 92; // 0x5c + field public static final int BLUEGIGA = 71; // 0x47 + field public static final int BLUETOOTH_SIG = 63; // 0x3f + field public static final int BROADCOM = 15; // 0xf + field public static final int CAMBRIDGE_SILICON_RADIO = 10; // 0xa + field public static final int CATC = 52; // 0x34 + field public static final int COMMIL = 51; // 0x33 + field public static final int CONEXANT_SYSTEMS = 28; // 0x1c + field public static final int CONTINENTAL_AUTOMOTIVE = 75; // 0x4b + field public static final int CONWISE_TECHNOLOGY = 66; // 0x42 + field public static final int C_TECHNOLOGIES = 38; // 0x26 + field public static final int DIGIANSWER = 12; // 0xc + field public static final int ECLIPSE = 53; // 0x35 + field public static final int EM_MICROELECTRONIC_MARIN = 90; // 0x5a + field public static final int ERICSSON_TECHNOLOGY = 0; // 0x0 + field public static final int FREE2MOVE = 83; // 0x53 + field public static final int GCT_SEMICONDUCTOR = 45; // 0x2d + field public static final int GENNUM = 59; // 0x3b + field public static final int HARMAN_INTERNATIONAL = 87; // 0x57 + field public static final int HITACHI = 41; // 0x29 + field public static final int IBM = 3; // 0x3 + field public static final int INFINEON_TECHNOLOGIES = 9; // 0x9 + field public static final int INTEGRATED_SILICON_SOLUTION = 65; // 0x41 + field public static final int INTEGRATED_SYSTEM_SOLUTION = 57; // 0x39 + field public static final int INTEL = 2; // 0x2 + field public static final int INVENTEL = 30; // 0x1e + field public static final int IPEXTREME = 61; // 0x3d + field public static final int J_AND_M = 82; // 0x52 + field public static final int KC_TECHNOLOGY = 22; // 0x16 + field public static final int LUCENT = 7; // 0x7 + field public static final int MACRONIX = 44; // 0x2c + field public static final int MANSELLA = 33; // 0x21 + field public static final int MARVELL = 72; // 0x48 + field public static final int MATSUSHITA_ELECTRIC = 58; // 0x3a + field public static final int MEDIATEK = 70; // 0x46 + field public static final int MEWTEL_TECHNOLOGY = 47; // 0x2f + field public static final int MICROSOFT = 6; // 0x6 + field public static final int MITEL_SEMICONDUCTOR = 16; // 0x10 + field public static final int MITSUBISHI_ELECTRIC = 20; // 0x14 + field public static final int MOBILIAN_CORPORATION = 55; // 0x37 + field public static final int MOTOROLA = 8; // 0x8 + field public static final int NEC = 34; // 0x22 + field public static final int NEWLOGIC = 23; // 0x17 + field public static final int NOKIA_MOBILE_PHONES = 1; // 0x1 + field public static final int NORDIC_SEMICONDUCTOR = 89; // 0x59 + field public static final int NORWOOD_SYSTEMS = 46; // 0x2e + field public static final int OPEN_INTERFACE = 39; // 0x27 + field public static final int PARROT = 67; // 0x43 + field public static final int PARTHUS_TECHNOLOGIES = 14; // 0xe + field public static final int PHILIPS_SEMICONDUCTORS = 37; // 0x25 + field public static final int PLANTRONICS = 85; // 0x55 + field public static final int QUALCOMM = 29; // 0x1d + field public static final int RALINK_TECHNOLOGY = 91; // 0x5b + field public static final int REALTEK_SEMICONDUCTOR = 93; // 0x5d + field public static final int RED_M = 50; // 0x32 + field public static final int RENESAS_TECHNOLOGY = 54; // 0x36 + field public static final int RESEARCH_IN_MOTION = 60; // 0x3c + field public static final int RF_MICRO_DEVICES = 40; // 0x28 + field public static final int RIVIERAWAVES = 96; // 0x60 + field public static final int ROHDE_AND_SCHWARZ = 25; // 0x19 + field public static final int RTX_TELECOM = 21; // 0x15 + field public static final int SEIKO_EPSON = 64; // 0x40 + field public static final int SIGNIA_TECHNOLOGIES = 27; // 0x1b + field public static final int SILICON_WAVE = 11; // 0xb + field public static final int SIRF_TECHNOLOGY = 80; // 0x50 + field public static final int SOCKET_MOBILE = 68; // 0x44 + field public static final int SONY_ERICSSON = 86; // 0x56 + field public static final int STACCATO_COMMUNICATIONS = 77; // 0x4d + field public static final int STONESTREET_ONE = 94; // 0x5e + field public static final int ST_MICROELECTRONICS = 48; // 0x30 + field public static final int SYMBOL_TECHNOLOGIES = 42; // 0x2a + field public static final int SYNOPSYS = 49; // 0x31 + field public static final int SYSTEMS_AND_CHIPS = 62; // 0x3e + field public static final int TENOVIS = 43; // 0x2b + field public static final int TERAX = 56; // 0x38 + field public static final int TEXAS_INSTRUMENTS = 13; // 0xd + field public static final int THREECOM = 5; // 0x5 + field public static final int THREE_DIJOY = 84; // 0x54 + field public static final int THREE_DSP = 73; // 0x49 + field public static final int TOSHIBA = 4; // 0x4 + field public static final int TRANSILICA = 24; // 0x18 + field public static final int TTPCOM = 26; // 0x1a + field public static final int TZERO_TECHNOLOGIES = 81; // 0x51 + field public static final int VIZIO = 88; // 0x58 + field public static final int WAVEPLUS_TECHNOLOGY = 35; // 0x23 + field public static final int WICENTRIC = 95; // 0x5f + field public static final int WIDCOMM = 17; // 0x11 + field public static final int ZEEVO = 18; // 0x12 + } + + public final class BluetoothClass implements android.os.Parcelable { + method public int describeContents(); + method public int getDeviceClass(); + method public int getMajorDeviceClass(); + method public boolean hasService(int); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + } + + public static class BluetoothClass.Device { + ctor public BluetoothClass.Device(); + field public static final int AUDIO_VIDEO_CAMCORDER = 1076; // 0x434 + field public static final int AUDIO_VIDEO_CAR_AUDIO = 1056; // 0x420 + field public static final int AUDIO_VIDEO_HANDSFREE = 1032; // 0x408 + field public static final int AUDIO_VIDEO_HEADPHONES = 1048; // 0x418 + field public static final int AUDIO_VIDEO_HIFI_AUDIO = 1064; // 0x428 + field public static final int AUDIO_VIDEO_LOUDSPEAKER = 1044; // 0x414 + field public static final int AUDIO_VIDEO_MICROPHONE = 1040; // 0x410 + field public static final int AUDIO_VIDEO_PORTABLE_AUDIO = 1052; // 0x41c + field public static final int AUDIO_VIDEO_SET_TOP_BOX = 1060; // 0x424 + field public static final int AUDIO_VIDEO_UNCATEGORIZED = 1024; // 0x400 + field public static final int AUDIO_VIDEO_VCR = 1068; // 0x42c + field public static final int AUDIO_VIDEO_VIDEO_CAMERA = 1072; // 0x430 + field public static final int AUDIO_VIDEO_VIDEO_CONFERENCING = 1088; // 0x440 + field public static final int AUDIO_VIDEO_VIDEO_DISPLAY_AND_LOUDSPEAKER = 1084; // 0x43c + field public static final int AUDIO_VIDEO_VIDEO_GAMING_TOY = 1096; // 0x448 + field public static final int AUDIO_VIDEO_VIDEO_MONITOR = 1080; // 0x438 + field public static final int AUDIO_VIDEO_WEARABLE_HEADSET = 1028; // 0x404 + field public static final int COMPUTER_DESKTOP = 260; // 0x104 + field public static final int COMPUTER_HANDHELD_PC_PDA = 272; // 0x110 + field public static final int COMPUTER_LAPTOP = 268; // 0x10c + field public static final int COMPUTER_PALM_SIZE_PC_PDA = 276; // 0x114 + field public static final int COMPUTER_SERVER = 264; // 0x108 + field public static final int COMPUTER_UNCATEGORIZED = 256; // 0x100 + field public static final int COMPUTER_WEARABLE = 280; // 0x118 + field public static final int HEALTH_BLOOD_PRESSURE = 2308; // 0x904 + field public static final int HEALTH_DATA_DISPLAY = 2332; // 0x91c + field public static final int HEALTH_GLUCOSE = 2320; // 0x910 + field public static final int HEALTH_PULSE_OXIMETER = 2324; // 0x914 + field public static final int HEALTH_PULSE_RATE = 2328; // 0x918 + field public static final int HEALTH_THERMOMETER = 2312; // 0x908 + field public static final int HEALTH_UNCATEGORIZED = 2304; // 0x900 + field public static final int HEALTH_WEIGHING = 2316; // 0x90c + field public static final int PHONE_CELLULAR = 516; // 0x204 + field public static final int PHONE_CORDLESS = 520; // 0x208 + field public static final int PHONE_ISDN = 532; // 0x214 + field public static final int PHONE_MODEM_OR_GATEWAY = 528; // 0x210 + field public static final int PHONE_SMART = 524; // 0x20c + field public static final int PHONE_UNCATEGORIZED = 512; // 0x200 + field public static final int TOY_CONTROLLER = 2064; // 0x810 + field public static final int TOY_DOLL_ACTION_FIGURE = 2060; // 0x80c + field public static final int TOY_GAME = 2068; // 0x814 + field public static final int TOY_ROBOT = 2052; // 0x804 + field public static final int TOY_UNCATEGORIZED = 2048; // 0x800 + field public static final int TOY_VEHICLE = 2056; // 0x808 + field public static final int WEARABLE_GLASSES = 1812; // 0x714 + field public static final int WEARABLE_HELMET = 1808; // 0x710 + field public static final int WEARABLE_JACKET = 1804; // 0x70c + field public static final int WEARABLE_PAGER = 1800; // 0x708 + field public static final int WEARABLE_UNCATEGORIZED = 1792; // 0x700 + field public static final int WEARABLE_WRIST_WATCH = 1796; // 0x704 + } + + public static class BluetoothClass.Device.Major { + ctor public BluetoothClass.Device.Major(); + field public static final int AUDIO_VIDEO = 1024; // 0x400 + field public static final int COMPUTER = 256; // 0x100 + field public static final int HEALTH = 2304; // 0x900 + field public static final int IMAGING = 1536; // 0x600 + field public static final int MISC = 0; // 0x0 + field public static final int NETWORKING = 768; // 0x300 + field public static final int PERIPHERAL = 1280; // 0x500 + field public static final int PHONE = 512; // 0x200 + field public static final int TOY = 2048; // 0x800 + field public static final int UNCATEGORIZED = 7936; // 0x1f00 + field public static final int WEARABLE = 1792; // 0x700 + } + + public static final class BluetoothClass.Service { + ctor public BluetoothClass.Service(); + field public static final int AUDIO = 2097152; // 0x200000 + field public static final int CAPTURE = 524288; // 0x80000 + field public static final int INFORMATION = 8388608; // 0x800000 + field public static final int LIMITED_DISCOVERABILITY = 8192; // 0x2000 + field public static final int NETWORKING = 131072; // 0x20000 + field public static final int OBJECT_TRANSFER = 1048576; // 0x100000 + field public static final int POSITIONING = 65536; // 0x10000 + field public static final int RENDER = 262144; // 0x40000 + field public static final int TELEPHONY = 4194304; // 0x400000 + } + + public final class BluetoothDevice implements android.os.Parcelable { + method public android.bluetooth.BluetoothSocket createInsecureRfcommSocketToServiceRecord(java.util.UUID) throws java.io.IOException; + method public android.bluetooth.BluetoothSocket createRfcommSocketToServiceRecord(java.util.UUID) throws java.io.IOException; + method public int describeContents(); + method public boolean fetchUuidsWithSdp(); + method public java.lang.String getAddress(); + method public android.bluetooth.BluetoothClass getBluetoothClass(); + method public int getBondState(); + method public java.lang.String getName(); + method public android.os.ParcelUuid[] getUuids(); + method public void writeToParcel(android.os.Parcel, int); + field public static final java.lang.String ACTION_ACL_CONNECTED = "android.bluetooth.device.action.ACL_CONNECTED"; + field public static final java.lang.String ACTION_ACL_DISCONNECTED = "android.bluetooth.device.action.ACL_DISCONNECTED"; + field public static final java.lang.String ACTION_ACL_DISCONNECT_REQUESTED = "android.bluetooth.device.action.ACL_DISCONNECT_REQUESTED"; + field public static final java.lang.String ACTION_BOND_STATE_CHANGED = "android.bluetooth.device.action.BOND_STATE_CHANGED"; + field public static final java.lang.String ACTION_CLASS_CHANGED = "android.bluetooth.device.action.CLASS_CHANGED"; + field public static final java.lang.String ACTION_FOUND = "android.bluetooth.device.action.FOUND"; + field public static final java.lang.String ACTION_NAME_CHANGED = "android.bluetooth.device.action.NAME_CHANGED"; + field public static final java.lang.String ACTION_UUID = "android.bluetooth.device.action.UUID"; + field public static final int BOND_BONDED = 12; // 0xc + field public static final int BOND_BONDING = 11; // 0xb + field public static final int BOND_NONE = 10; // 0xa + field public static final android.os.Parcelable.Creator CREATOR; + field public static final int ERROR = -2147483648; // 0x80000000 + field public static final java.lang.String EXTRA_BOND_STATE = "android.bluetooth.device.extra.BOND_STATE"; + field public static final java.lang.String EXTRA_CLASS = "android.bluetooth.device.extra.CLASS"; + field public static final java.lang.String EXTRA_DEVICE = "android.bluetooth.device.extra.DEVICE"; + field public static final java.lang.String EXTRA_NAME = "android.bluetooth.device.extra.NAME"; + field public static final java.lang.String EXTRA_PREVIOUS_BOND_STATE = "android.bluetooth.device.extra.PREVIOUS_BOND_STATE"; + field public static final java.lang.String EXTRA_RSSI = "android.bluetooth.device.extra.RSSI"; + field public static final java.lang.String EXTRA_UUID = "android.bluetooth.device.extra.UUID"; + } + + public final class BluetoothHeadset implements android.bluetooth.BluetoothProfile { + method public java.util.List getConnectedDevices(); + method public int getConnectionState(android.bluetooth.BluetoothDevice); + method public java.util.List getDevicesMatchingConnectionStates(int[]); + method public boolean isAudioConnected(android.bluetooth.BluetoothDevice); + method public boolean startVoiceRecognition(android.bluetooth.BluetoothDevice); + method public boolean stopVoiceRecognition(android.bluetooth.BluetoothDevice); + field public static final java.lang.String ACTION_AUDIO_STATE_CHANGED = "android.bluetooth.headset.profile.action.AUDIO_STATE_CHANGED"; + field public static final java.lang.String ACTION_CONNECTION_STATE_CHANGED = "android.bluetooth.headset.profile.action.CONNECTION_STATE_CHANGED"; + field public static final java.lang.String ACTION_VENDOR_SPECIFIC_HEADSET_EVENT = "android.bluetooth.headset.action.VENDOR_SPECIFIC_HEADSET_EVENT"; + field public static final int AT_CMD_TYPE_ACTION = 4; // 0x4 + field public static final int AT_CMD_TYPE_BASIC = 3; // 0x3 + field public static final int AT_CMD_TYPE_READ = 0; // 0x0 + field public static final int AT_CMD_TYPE_SET = 2; // 0x2 + field public static final int AT_CMD_TYPE_TEST = 1; // 0x1 + field public static final java.lang.String EXTRA_VENDOR_SPECIFIC_HEADSET_EVENT_ARGS = "android.bluetooth.headset.extra.VENDOR_SPECIFIC_HEADSET_EVENT_ARGS"; + field public static final java.lang.String EXTRA_VENDOR_SPECIFIC_HEADSET_EVENT_CMD = "android.bluetooth.headset.extra.VENDOR_SPECIFIC_HEADSET_EVENT_CMD"; + field public static final java.lang.String EXTRA_VENDOR_SPECIFIC_HEADSET_EVENT_CMD_TYPE = "android.bluetooth.headset.extra.VENDOR_SPECIFIC_HEADSET_EVENT_CMD_TYPE"; + field public static final int STATE_AUDIO_CONNECTED = 12; // 0xc + field public static final int STATE_AUDIO_CONNECTING = 11; // 0xb + field public static final int STATE_AUDIO_DISCONNECTED = 10; // 0xa + field public static final java.lang.String VENDOR_SPECIFIC_HEADSET_EVENT_COMPANY_ID_CATEGORY = "android.bluetooth.headset.intent.category.companyid"; + } + + public final class BluetoothHealth implements android.bluetooth.BluetoothProfile { + method public boolean connectChannelToSource(android.bluetooth.BluetoothDevice, android.bluetooth.BluetoothHealthAppConfiguration); + method public boolean disconnectChannel(android.bluetooth.BluetoothDevice, android.bluetooth.BluetoothHealthAppConfiguration, int); + method public java.util.List getConnectedDevices(); + method public int getConnectionState(android.bluetooth.BluetoothDevice); + method public java.util.List getDevicesMatchingConnectionStates(int[]); + method public android.os.ParcelFileDescriptor getMainChannelFd(android.bluetooth.BluetoothDevice, android.bluetooth.BluetoothHealthAppConfiguration); + method public boolean registerSinkAppConfiguration(java.lang.String, int, android.bluetooth.BluetoothHealthCallback); + method public boolean unregisterAppConfiguration(android.bluetooth.BluetoothHealthAppConfiguration); + field public static final int APP_CONFIG_REGISTRATION_FAILURE = 1; // 0x1 + field public static final int APP_CONFIG_REGISTRATION_SUCCESS = 0; // 0x0 + field public static final int APP_CONFIG_UNREGISTRATION_FAILURE = 3; // 0x3 + field public static final int APP_CONFIG_UNREGISTRATION_SUCCESS = 2; // 0x2 + field public static final int CHANNEL_TYPE_RELIABLE = 10; // 0xa + field public static final int CHANNEL_TYPE_STREAMING = 11; // 0xb + field public static final int SINK_ROLE = 2; // 0x2 + field public static final int SOURCE_ROLE = 1; // 0x1 + field public static final int STATE_CHANNEL_CONNECTED = 2; // 0x2 + field public static final int STATE_CHANNEL_CONNECTING = 1; // 0x1 + field public static final int STATE_CHANNEL_DISCONNECTED = 0; // 0x0 + field public static final int STATE_CHANNEL_DISCONNECTING = 3; // 0x3 + } + + public final class BluetoothHealthAppConfiguration implements android.os.Parcelable { + method public int describeContents(); + method public int getDataType(); + method public java.lang.String getName(); + method public int getRole(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + } + + public abstract class BluetoothHealthCallback { + ctor public BluetoothHealthCallback(); + method public void onHealthAppConfigurationStatusChange(android.bluetooth.BluetoothHealthAppConfiguration, int); + method public void onHealthChannelStateChange(android.bluetooth.BluetoothHealthAppConfiguration, android.bluetooth.BluetoothDevice, int, int, android.os.ParcelFileDescriptor, int); + } + + public abstract interface BluetoothProfile { + method public abstract java.util.List getConnectedDevices(); + method public abstract int getConnectionState(android.bluetooth.BluetoothDevice); + method public abstract java.util.List getDevicesMatchingConnectionStates(int[]); + field public static final int A2DP = 2; // 0x2 + field public static final java.lang.String EXTRA_PREVIOUS_STATE = "android.bluetooth.profile.extra.PREVIOUS_STATE"; + field public static final java.lang.String EXTRA_STATE = "android.bluetooth.profile.extra.STATE"; + field public static final int HEADSET = 1; // 0x1 + field public static final int HEALTH = 3; // 0x3 + field public static final int STATE_CONNECTED = 2; // 0x2 + field public static final int STATE_CONNECTING = 1; // 0x1 + field public static final int STATE_DISCONNECTED = 0; // 0x0 + field public static final int STATE_DISCONNECTING = 3; // 0x3 + } + + public static abstract interface BluetoothProfile.ServiceListener { + method public abstract void onServiceConnected(int, android.bluetooth.BluetoothProfile); + method public abstract void onServiceDisconnected(int); + } + + public final class BluetoothServerSocket implements java.io.Closeable { + method public android.bluetooth.BluetoothSocket accept() throws java.io.IOException; + method public android.bluetooth.BluetoothSocket accept(int) throws java.io.IOException; + method public void close() throws java.io.IOException; + } + + public final class BluetoothSocket implements java.io.Closeable { + method public void close() throws java.io.IOException; + method public void connect() throws java.io.IOException; + method public java.io.InputStream getInputStream() throws java.io.IOException; + method public java.io.OutputStream getOutputStream() throws java.io.IOException; + method public android.bluetooth.BluetoothDevice getRemoteDevice(); + method public boolean isConnected(); + } + +} + +package android.content { + + public abstract class AbstractThreadedSyncAdapter { + ctor public AbstractThreadedSyncAdapter(android.content.Context, boolean); + ctor public AbstractThreadedSyncAdapter(android.content.Context, boolean, boolean); + method public android.content.Context getContext(); + method public final android.os.IBinder getSyncAdapterBinder(); + method public abstract void onPerformSync(android.accounts.Account, android.os.Bundle, java.lang.String, android.content.ContentProviderClient, android.content.SyncResult); + method public void onSyncCanceled(); + method public void onSyncCanceled(java.lang.Thread); + field public static final deprecated int LOG_SYNC_DETAILS = 2743; // 0xab7 + } + + public class ActivityNotFoundException extends java.lang.RuntimeException { + ctor public ActivityNotFoundException(); + ctor public ActivityNotFoundException(java.lang.String); + } + + public abstract class AsyncQueryHandler extends android.os.Handler { + ctor public AsyncQueryHandler(android.content.ContentResolver); + method public final void cancelOperation(int); + method protected android.os.Handler createHandler(android.os.Looper); + method protected void onDeleteComplete(int, java.lang.Object, int); + method protected void onInsertComplete(int, java.lang.Object, android.net.Uri); + method protected void onQueryComplete(int, java.lang.Object, android.database.Cursor); + method protected void onUpdateComplete(int, java.lang.Object, int); + method public final void startDelete(int, java.lang.Object, android.net.Uri, java.lang.String, java.lang.String[]); + method public final void startInsert(int, java.lang.Object, android.net.Uri, android.content.ContentValues); + method public void startQuery(int, java.lang.Object, android.net.Uri, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String); + method public final void startUpdate(int, java.lang.Object, android.net.Uri, android.content.ContentValues, java.lang.String, java.lang.String[]); + } + + protected static final class AsyncQueryHandler.WorkerArgs { + ctor protected AsyncQueryHandler.WorkerArgs(); + field public java.lang.Object cookie; + field public android.os.Handler handler; + field public java.lang.String orderBy; + field public java.lang.String[] projection; + field public java.lang.Object result; + field public java.lang.String selection; + field public java.lang.String[] selectionArgs; + field public android.net.Uri uri; + field public android.content.ContentValues values; + } + + protected class AsyncQueryHandler.WorkerHandler extends android.os.Handler { + ctor public AsyncQueryHandler.WorkerHandler(android.os.Looper); + } + + public abstract class AsyncTaskLoader extends android.content.Loader { + ctor public AsyncTaskLoader(android.content.Context); + method public void cancelLoadInBackground(); + method public boolean isLoadInBackgroundCanceled(); + method public abstract D loadInBackground(); + method public void onCanceled(D); + method protected D onLoadInBackground(); + method public void setUpdateThrottle(long); + } + + public abstract class BroadcastReceiver { + ctor public BroadcastReceiver(); + method public final void abortBroadcast(); + method public final void clearAbortBroadcast(); + method public final boolean getAbortBroadcast(); + method public final boolean getDebugUnregister(); + method public final int getResultCode(); + method public final java.lang.String getResultData(); + method public final android.os.Bundle getResultExtras(boolean); + method public final android.content.BroadcastReceiver.PendingResult goAsync(); + method public final boolean isInitialStickyBroadcast(); + method public final boolean isOrderedBroadcast(); + method public abstract void onReceive(android.content.Context, android.content.Intent); + method public android.os.IBinder peekService(android.content.Context, android.content.Intent); + method public final void setDebugUnregister(boolean); + method public final void setOrderedHint(boolean); + method public final void setResult(int, java.lang.String, android.os.Bundle); + method public final void setResultCode(int); + method public final void setResultData(java.lang.String); + method public final void setResultExtras(android.os.Bundle); + } + + public static class BroadcastReceiver.PendingResult { + method public final void abortBroadcast(); + method public final void clearAbortBroadcast(); + method public final void finish(); + method public final boolean getAbortBroadcast(); + method public final int getResultCode(); + method public final java.lang.String getResultData(); + method public final android.os.Bundle getResultExtras(boolean); + method public final void setResult(int, java.lang.String, android.os.Bundle); + method public final void setResultCode(int); + method public final void setResultData(java.lang.String); + method public final void setResultExtras(android.os.Bundle); + } + + public class ClipData implements android.os.Parcelable { + ctor public ClipData(java.lang.CharSequence, java.lang.String[], android.content.ClipData.Item); + ctor public ClipData(android.content.ClipDescription, android.content.ClipData.Item); + ctor public ClipData(android.content.ClipData); + method public void addItem(android.content.ClipData.Item); + method public int describeContents(); + method public android.content.ClipDescription getDescription(); + method public android.content.ClipData.Item getItemAt(int); + method public int getItemCount(); + method public static android.content.ClipData newHtmlText(java.lang.CharSequence, java.lang.CharSequence, java.lang.String); + method public static android.content.ClipData newIntent(java.lang.CharSequence, android.content.Intent); + method public static android.content.ClipData newPlainText(java.lang.CharSequence, java.lang.CharSequence); + method public static android.content.ClipData newRawUri(java.lang.CharSequence, android.net.Uri); + method public static android.content.ClipData newUri(android.content.ContentResolver, java.lang.CharSequence, android.net.Uri); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + } + + public static class ClipData.Item { + ctor public ClipData.Item(java.lang.CharSequence); + ctor public ClipData.Item(java.lang.CharSequence, java.lang.String); + ctor public ClipData.Item(android.content.Intent); + ctor public ClipData.Item(android.net.Uri); + ctor public ClipData.Item(java.lang.CharSequence, android.content.Intent, android.net.Uri); + ctor public ClipData.Item(java.lang.CharSequence, java.lang.String, android.content.Intent, android.net.Uri); + method public java.lang.String coerceToHtmlText(android.content.Context); + method public java.lang.CharSequence coerceToStyledText(android.content.Context); + method public java.lang.CharSequence coerceToText(android.content.Context); + method public java.lang.String getHtmlText(); + method public android.content.Intent getIntent(); + method public java.lang.CharSequence getText(); + method public android.net.Uri getUri(); + } + + public class ClipDescription implements android.os.Parcelable { + ctor public ClipDescription(java.lang.CharSequence, java.lang.String[]); + ctor public ClipDescription(android.content.ClipDescription); + method public static boolean compareMimeTypes(java.lang.String, java.lang.String); + method public int describeContents(); + method public java.lang.String[] filterMimeTypes(java.lang.String); + method public java.lang.CharSequence getLabel(); + method public java.lang.String getMimeType(int); + method public int getMimeTypeCount(); + method public boolean hasMimeType(java.lang.String); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + field public static final java.lang.String MIMETYPE_TEXT_HTML = "text/html"; + field public static final java.lang.String MIMETYPE_TEXT_INTENT = "text/vnd.android.intent"; + field public static final java.lang.String MIMETYPE_TEXT_PLAIN = "text/plain"; + field public static final java.lang.String MIMETYPE_TEXT_URILIST = "text/uri-list"; + } + + public class ClipboardManager extends android.text.ClipboardManager { + method public void addPrimaryClipChangedListener(android.content.ClipboardManager.OnPrimaryClipChangedListener); + method public android.content.ClipData getPrimaryClip(); + method public android.content.ClipDescription getPrimaryClipDescription(); + method public deprecated java.lang.CharSequence getText(); + method public boolean hasPrimaryClip(); + method public deprecated boolean hasText(); + method public void removePrimaryClipChangedListener(android.content.ClipboardManager.OnPrimaryClipChangedListener); + method public void setPrimaryClip(android.content.ClipData); + method public deprecated void setText(java.lang.CharSequence); + } + + public static abstract interface ClipboardManager.OnPrimaryClipChangedListener { + method public abstract void onPrimaryClipChanged(); + } + + public abstract interface ComponentCallbacks { + method public abstract void onConfigurationChanged(android.content.res.Configuration); + method public abstract void onLowMemory(); + } + + public abstract interface ComponentCallbacks2 implements android.content.ComponentCallbacks { + method public abstract void onTrimMemory(int); + field public static final int TRIM_MEMORY_BACKGROUND = 40; // 0x28 + field public static final int TRIM_MEMORY_COMPLETE = 80; // 0x50 + field public static final int TRIM_MEMORY_MODERATE = 60; // 0x3c + field public static final int TRIM_MEMORY_RUNNING_CRITICAL = 15; // 0xf + field public static final int TRIM_MEMORY_RUNNING_LOW = 10; // 0xa + field public static final int TRIM_MEMORY_RUNNING_MODERATE = 5; // 0x5 + field public static final int TRIM_MEMORY_UI_HIDDEN = 20; // 0x14 + } + + public final class ComponentName implements java.lang.Cloneable java.lang.Comparable android.os.Parcelable { + ctor public ComponentName(java.lang.String, java.lang.String); + ctor public ComponentName(android.content.Context, java.lang.String); + ctor public ComponentName(android.content.Context, java.lang.Class); + ctor public ComponentName(android.os.Parcel); + method public android.content.ComponentName clone(); + method public int compareTo(android.content.ComponentName); + method public int describeContents(); + method public java.lang.String flattenToShortString(); + method public java.lang.String flattenToString(); + method public java.lang.String getClassName(); + method public java.lang.String getPackageName(); + method public java.lang.String getShortClassName(); + method public static android.content.ComponentName readFromParcel(android.os.Parcel); + method public java.lang.String toShortString(); + method public static android.content.ComponentName unflattenFromString(java.lang.String); + method public void writeToParcel(android.os.Parcel, int); + method public static void writeToParcel(android.content.ComponentName, android.os.Parcel); + field public static final android.os.Parcelable.Creator CREATOR; + } + + public abstract class ContentProvider implements android.content.ComponentCallbacks2 { + ctor public ContentProvider(); + method public android.content.ContentProviderResult[] applyBatch(java.util.ArrayList) throws android.content.OperationApplicationException; + method public void attachInfo(android.content.Context, android.content.pm.ProviderInfo); + method public int bulkInsert(android.net.Uri, android.content.ContentValues[]); + method public android.os.Bundle call(java.lang.String, java.lang.String, android.os.Bundle); + method public abstract int delete(android.net.Uri, java.lang.String, java.lang.String[]); + method public final android.content.Context getContext(); + method public final android.content.pm.PathPermission[] getPathPermissions(); + method public final java.lang.String getReadPermission(); + method public java.lang.String[] getStreamTypes(android.net.Uri, java.lang.String); + method public abstract java.lang.String getType(android.net.Uri); + method public final java.lang.String getWritePermission(); + method public abstract android.net.Uri insert(android.net.Uri, android.content.ContentValues); + method protected boolean isTemporary(); + method public void onConfigurationChanged(android.content.res.Configuration); + method public abstract boolean onCreate(); + method public void onLowMemory(); + method public void onTrimMemory(int); + method public android.content.res.AssetFileDescriptor openAssetFile(android.net.Uri, java.lang.String) throws java.io.FileNotFoundException; + method public android.os.ParcelFileDescriptor openFile(android.net.Uri, java.lang.String) throws java.io.FileNotFoundException; + method protected final android.os.ParcelFileDescriptor openFileHelper(android.net.Uri, java.lang.String) throws java.io.FileNotFoundException; + method public android.os.ParcelFileDescriptor openPipeHelper(android.net.Uri, java.lang.String, android.os.Bundle, T, android.content.ContentProvider.PipeDataWriter) throws java.io.FileNotFoundException; + method public android.content.res.AssetFileDescriptor openTypedAssetFile(android.net.Uri, java.lang.String, android.os.Bundle) throws java.io.FileNotFoundException; + method public abstract android.database.Cursor query(android.net.Uri, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String); + method public android.database.Cursor query(android.net.Uri, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String, android.os.CancellationSignal); + method protected final void setPathPermissions(android.content.pm.PathPermission[]); + method protected final void setReadPermission(java.lang.String); + method protected final void setWritePermission(java.lang.String); + method public void shutdown(); + method public abstract int update(android.net.Uri, android.content.ContentValues, java.lang.String, java.lang.String[]); + } + + public static abstract interface ContentProvider.PipeDataWriter { + method public abstract void writeDataToPipe(android.os.ParcelFileDescriptor, android.net.Uri, java.lang.String, android.os.Bundle, T); + } + + public class ContentProviderClient { + method public android.content.ContentProviderResult[] applyBatch(java.util.ArrayList) throws android.content.OperationApplicationException, android.os.RemoteException; + method public int bulkInsert(android.net.Uri, android.content.ContentValues[]) throws android.os.RemoteException; + method public android.os.Bundle call(java.lang.String, java.lang.String, android.os.Bundle) throws android.os.RemoteException; + method public int delete(android.net.Uri, java.lang.String, java.lang.String[]) throws android.os.RemoteException; + method public android.content.ContentProvider getLocalContentProvider(); + method public java.lang.String[] getStreamTypes(android.net.Uri, java.lang.String) throws android.os.RemoteException; + method public java.lang.String getType(android.net.Uri) throws android.os.RemoteException; + method public android.net.Uri insert(android.net.Uri, android.content.ContentValues) throws android.os.RemoteException; + method public android.content.res.AssetFileDescriptor openAssetFile(android.net.Uri, java.lang.String) throws java.io.FileNotFoundException, android.os.RemoteException; + method public android.os.ParcelFileDescriptor openFile(android.net.Uri, java.lang.String) throws java.io.FileNotFoundException, android.os.RemoteException; + method public final android.content.res.AssetFileDescriptor openTypedAssetFileDescriptor(android.net.Uri, java.lang.String, android.os.Bundle) throws java.io.FileNotFoundException, android.os.RemoteException; + method public android.database.Cursor query(android.net.Uri, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String) throws android.os.RemoteException; + method public android.database.Cursor query(android.net.Uri, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String, android.os.CancellationSignal) throws android.os.RemoteException; + method public boolean release(); + method public int update(android.net.Uri, android.content.ContentValues, java.lang.String, java.lang.String[]) throws android.os.RemoteException; + } + + public class ContentProviderOperation implements android.os.Parcelable { + method public android.content.ContentProviderResult apply(android.content.ContentProvider, android.content.ContentProviderResult[], int) throws android.content.OperationApplicationException; + method public int describeContents(); + method public android.net.Uri getUri(); + method public boolean isReadOperation(); + method public boolean isWriteOperation(); + method public boolean isYieldAllowed(); + method public static android.content.ContentProviderOperation.Builder newAssertQuery(android.net.Uri); + method public static android.content.ContentProviderOperation.Builder newDelete(android.net.Uri); + method public static android.content.ContentProviderOperation.Builder newInsert(android.net.Uri); + method public static android.content.ContentProviderOperation.Builder newUpdate(android.net.Uri); + method public java.lang.String[] resolveSelectionArgsBackReferences(android.content.ContentProviderResult[], int); + method public android.content.ContentValues resolveValueBackReferences(android.content.ContentProviderResult[], int); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + } + + public static class ContentProviderOperation.Builder { + method public android.content.ContentProviderOperation build(); + method public android.content.ContentProviderOperation.Builder withExpectedCount(int); + method public android.content.ContentProviderOperation.Builder withSelection(java.lang.String, java.lang.String[]); + method public android.content.ContentProviderOperation.Builder withSelectionBackReference(int, int); + method public android.content.ContentProviderOperation.Builder withValue(java.lang.String, java.lang.Object); + method public android.content.ContentProviderOperation.Builder withValueBackReference(java.lang.String, int); + method public android.content.ContentProviderOperation.Builder withValueBackReferences(android.content.ContentValues); + method public android.content.ContentProviderOperation.Builder withValues(android.content.ContentValues); + method public android.content.ContentProviderOperation.Builder withYieldAllowed(boolean); + } + + public class ContentProviderResult implements android.os.Parcelable { + ctor public ContentProviderResult(android.net.Uri); + ctor public ContentProviderResult(int); + ctor public ContentProviderResult(android.os.Parcel); + method public int describeContents(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + field public final java.lang.Integer count; + field public final android.net.Uri uri; + } + + public class ContentQueryMap extends java.util.Observable { + ctor public ContentQueryMap(android.database.Cursor, java.lang.String, boolean, android.os.Handler); + method public synchronized void close(); + method public synchronized java.util.Map getRows(); + method public synchronized android.content.ContentValues getValues(java.lang.String); + method public void requery(); + method public void setKeepUpdated(boolean); + } + + public abstract class ContentResolver { + ctor public ContentResolver(android.content.Context); + method public final android.content.ContentProviderClient acquireContentProviderClient(android.net.Uri); + method public final android.content.ContentProviderClient acquireContentProviderClient(java.lang.String); + method public final android.content.ContentProviderClient acquireUnstableContentProviderClient(android.net.Uri); + method public final android.content.ContentProviderClient acquireUnstableContentProviderClient(java.lang.String); + method public static void addPeriodicSync(android.accounts.Account, java.lang.String, android.os.Bundle, long); + method public static java.lang.Object addStatusChangeListener(int, android.content.SyncStatusObserver); + method public android.content.ContentProviderResult[] applyBatch(java.lang.String, java.util.ArrayList) throws android.content.OperationApplicationException, android.os.RemoteException; + method public final int bulkInsert(android.net.Uri, android.content.ContentValues[]); + method public final android.os.Bundle call(android.net.Uri, java.lang.String, java.lang.String, android.os.Bundle); + method public deprecated void cancelSync(android.net.Uri); + method public static void cancelSync(android.accounts.Account, java.lang.String); + method public final int delete(android.net.Uri, java.lang.String, java.lang.String[]); + method public static deprecated android.content.SyncInfo getCurrentSync(); + method public static java.util.List getCurrentSyncs(); + method public static int getIsSyncable(android.accounts.Account, java.lang.String); + method public static boolean getMasterSyncAutomatically(); + method public static java.util.List getPeriodicSyncs(android.accounts.Account, java.lang.String); + method public java.lang.String[] getStreamTypes(android.net.Uri, java.lang.String); + method public static android.content.SyncAdapterType[] getSyncAdapterTypes(); + method public static boolean getSyncAutomatically(android.accounts.Account, java.lang.String); + method public final java.lang.String getType(android.net.Uri); + method public final android.net.Uri insert(android.net.Uri, android.content.ContentValues); + method public static boolean isSyncActive(android.accounts.Account, java.lang.String); + method public static boolean isSyncPending(android.accounts.Account, java.lang.String); + method public void notifyChange(android.net.Uri, android.database.ContentObserver); + method public void notifyChange(android.net.Uri, android.database.ContentObserver, boolean); + method public final android.content.res.AssetFileDescriptor openAssetFileDescriptor(android.net.Uri, java.lang.String) throws java.io.FileNotFoundException; + method public final android.os.ParcelFileDescriptor openFileDescriptor(android.net.Uri, java.lang.String) throws java.io.FileNotFoundException; + method public final java.io.InputStream openInputStream(android.net.Uri) throws java.io.FileNotFoundException; + method public final java.io.OutputStream openOutputStream(android.net.Uri) throws java.io.FileNotFoundException; + method public final java.io.OutputStream openOutputStream(android.net.Uri, java.lang.String) throws java.io.FileNotFoundException; + method public final android.content.res.AssetFileDescriptor openTypedAssetFileDescriptor(android.net.Uri, java.lang.String, android.os.Bundle) throws java.io.FileNotFoundException; + method public final android.database.Cursor query(android.net.Uri, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String); + method public final android.database.Cursor query(android.net.Uri, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String, android.os.CancellationSignal); + method public final void registerContentObserver(android.net.Uri, boolean, android.database.ContentObserver); + method public static void removePeriodicSync(android.accounts.Account, java.lang.String, android.os.Bundle); + method public static void removeStatusChangeListener(java.lang.Object); + method public static void requestSync(android.accounts.Account, java.lang.String, android.os.Bundle); + method public static void setIsSyncable(android.accounts.Account, java.lang.String, int); + method public static void setMasterSyncAutomatically(boolean); + method public static void setSyncAutomatically(android.accounts.Account, java.lang.String, boolean); + method public deprecated void startSync(android.net.Uri, android.os.Bundle); + method public final void unregisterContentObserver(android.database.ContentObserver); + method public final int update(android.net.Uri, android.content.ContentValues, java.lang.String, java.lang.String[]); + method public static void validateSyncExtrasBundle(android.os.Bundle); + field public static final java.lang.String CURSOR_DIR_BASE_TYPE = "vnd.android.cursor.dir"; + field public static final java.lang.String CURSOR_ITEM_BASE_TYPE = "vnd.android.cursor.item"; + field public static final java.lang.String SCHEME_ANDROID_RESOURCE = "android.resource"; + field public static final java.lang.String SCHEME_CONTENT = "content"; + field public static final java.lang.String SCHEME_FILE = "file"; + field public static final deprecated java.lang.String SYNC_EXTRAS_ACCOUNT = "account"; + field public static final java.lang.String SYNC_EXTRAS_DISCARD_LOCAL_DELETIONS = "discard_deletions"; + field public static final java.lang.String SYNC_EXTRAS_DO_NOT_RETRY = "do_not_retry"; + field public static final java.lang.String SYNC_EXTRAS_EXPEDITED = "expedited"; + field public static final deprecated java.lang.String SYNC_EXTRAS_FORCE = "force"; + field public static final java.lang.String SYNC_EXTRAS_IGNORE_BACKOFF = "ignore_backoff"; + field public static final java.lang.String SYNC_EXTRAS_IGNORE_SETTINGS = "ignore_settings"; + field public static final java.lang.String SYNC_EXTRAS_INITIALIZE = "initialize"; + field public static final java.lang.String SYNC_EXTRAS_MANUAL = "force"; + field public static final java.lang.String SYNC_EXTRAS_OVERRIDE_TOO_MANY_DELETIONS = "deletions_override"; + field public static final java.lang.String SYNC_EXTRAS_UPLOAD = "upload"; + field public static final int SYNC_OBSERVER_TYPE_ACTIVE = 4; // 0x4 + field public static final int SYNC_OBSERVER_TYPE_PENDING = 2; // 0x2 + field public static final int SYNC_OBSERVER_TYPE_SETTINGS = 1; // 0x1 + } + + public class ContentUris { + ctor public ContentUris(); + method public static android.net.Uri.Builder appendId(android.net.Uri.Builder, long); + method public static long parseId(android.net.Uri); + method public static android.net.Uri withAppendedId(android.net.Uri, long); + } + + public final class ContentValues implements android.os.Parcelable { + ctor public ContentValues(); + ctor public ContentValues(int); + ctor public ContentValues(android.content.ContentValues); + method public void clear(); + method public boolean containsKey(java.lang.String); + method public int describeContents(); + method public java.lang.Object get(java.lang.String); + method public java.lang.Boolean getAsBoolean(java.lang.String); + method public java.lang.Byte getAsByte(java.lang.String); + method public byte[] getAsByteArray(java.lang.String); + method public java.lang.Double getAsDouble(java.lang.String); + method public java.lang.Float getAsFloat(java.lang.String); + method public java.lang.Integer getAsInteger(java.lang.String); + method public java.lang.Long getAsLong(java.lang.String); + method public java.lang.Short getAsShort(java.lang.String); + method public java.lang.String getAsString(java.lang.String); + method public java.util.Set keySet(); + method public void put(java.lang.String, java.lang.String); + method public void put(java.lang.String, java.lang.Byte); + method public void put(java.lang.String, java.lang.Short); + method public void put(java.lang.String, java.lang.Integer); + method public void put(java.lang.String, java.lang.Long); + method public void put(java.lang.String, java.lang.Float); + method public void put(java.lang.String, java.lang.Double); + method public void put(java.lang.String, java.lang.Boolean); + method public void put(java.lang.String, byte[]); + method public void putAll(android.content.ContentValues); + method public void putNull(java.lang.String); + method public void remove(java.lang.String); + method public int size(); + method public java.util.Set> valueSet(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + field public static final java.lang.String TAG = "ContentValues"; + } + + public abstract class Context { + ctor public Context(); + method public abstract boolean bindService(android.content.Intent, android.content.ServiceConnection, int); + method public abstract int checkCallingOrSelfPermission(java.lang.String); + method public abstract int checkCallingOrSelfUriPermission(android.net.Uri, int); + method public abstract int checkCallingPermission(java.lang.String); + method public abstract int checkCallingUriPermission(android.net.Uri, int); + method public abstract int checkPermission(java.lang.String, int, int); + method public abstract int checkUriPermission(android.net.Uri, int, int, int); + method public abstract int checkUriPermission(android.net.Uri, java.lang.String, java.lang.String, int, int, int); + method public abstract deprecated void clearWallpaper() throws java.io.IOException; + method public abstract android.content.Context createConfigurationContext(android.content.res.Configuration); + method public abstract android.content.Context createDisplayContext(android.view.Display); + method public abstract android.content.Context createPackageContext(java.lang.String, int) throws android.content.pm.PackageManager.NameNotFoundException; + method public abstract java.lang.String[] databaseList(); + method public abstract boolean deleteDatabase(java.lang.String); + method public abstract boolean deleteFile(java.lang.String); + method public abstract void enforceCallingOrSelfPermission(java.lang.String, java.lang.String); + method public abstract void enforceCallingOrSelfUriPermission(android.net.Uri, int, java.lang.String); + method public abstract void enforceCallingPermission(java.lang.String, java.lang.String); + method public abstract void enforceCallingUriPermission(android.net.Uri, int, java.lang.String); + method public abstract void enforcePermission(java.lang.String, int, int, java.lang.String); + method public abstract void enforceUriPermission(android.net.Uri, int, int, int, java.lang.String); + method public abstract void enforceUriPermission(android.net.Uri, java.lang.String, java.lang.String, int, int, int, java.lang.String); + method public abstract java.lang.String[] fileList(); + method public abstract android.content.Context getApplicationContext(); + method public abstract android.content.pm.ApplicationInfo getApplicationInfo(); + method public abstract android.content.res.AssetManager getAssets(); + method public abstract java.io.File getCacheDir(); + method public abstract java.lang.ClassLoader getClassLoader(); + method public abstract android.content.ContentResolver getContentResolver(); + method public abstract java.io.File getDatabasePath(java.lang.String); + method public abstract java.io.File getDir(java.lang.String, int); + method public abstract java.io.File getExternalCacheDir(); + method public abstract java.io.File getExternalFilesDir(java.lang.String); + method public abstract java.io.File getFileStreamPath(java.lang.String); + method public abstract java.io.File getFilesDir(); + method public abstract android.os.Looper getMainLooper(); + method public abstract java.io.File getObbDir(); + method public abstract java.lang.String getPackageCodePath(); + method public abstract android.content.pm.PackageManager getPackageManager(); + method public abstract java.lang.String getPackageName(); + method public abstract java.lang.String getPackageResourcePath(); + method public abstract android.content.res.Resources getResources(); + method public abstract android.content.SharedPreferences getSharedPreferences(java.lang.String, int); + method public final java.lang.String getString(int); + method public final java.lang.String getString(int, java.lang.Object...); + method public abstract java.lang.Object getSystemService(java.lang.String); + method public final java.lang.CharSequence getText(int); + method public abstract android.content.res.Resources.Theme getTheme(); + method public abstract deprecated android.graphics.drawable.Drawable getWallpaper(); + method public abstract deprecated int getWallpaperDesiredMinimumHeight(); + method public abstract deprecated int getWallpaperDesiredMinimumWidth(); + method public abstract void grantUriPermission(java.lang.String, android.net.Uri, int); + method public boolean isRestricted(); + method public final android.content.res.TypedArray obtainStyledAttributes(int[]); + method public final android.content.res.TypedArray obtainStyledAttributes(int, int[]) throws android.content.res.Resources.NotFoundException; + method public final android.content.res.TypedArray obtainStyledAttributes(android.util.AttributeSet, int[]); + method public final android.content.res.TypedArray obtainStyledAttributes(android.util.AttributeSet, int[], int, int); + method public abstract java.io.FileInputStream openFileInput(java.lang.String) throws java.io.FileNotFoundException; + method public abstract java.io.FileOutputStream openFileOutput(java.lang.String, int) throws java.io.FileNotFoundException; + method public abstract android.database.sqlite.SQLiteDatabase openOrCreateDatabase(java.lang.String, int, android.database.sqlite.SQLiteDatabase.CursorFactory); + method public abstract android.database.sqlite.SQLiteDatabase openOrCreateDatabase(java.lang.String, int, android.database.sqlite.SQLiteDatabase.CursorFactory, android.database.DatabaseErrorHandler); + method public abstract deprecated android.graphics.drawable.Drawable peekWallpaper(); + method public void registerComponentCallbacks(android.content.ComponentCallbacks); + method public abstract android.content.Intent registerReceiver(android.content.BroadcastReceiver, android.content.IntentFilter); + method public abstract android.content.Intent registerReceiver(android.content.BroadcastReceiver, android.content.IntentFilter, java.lang.String, android.os.Handler); + method public abstract void removeStickyBroadcast(android.content.Intent); + method public abstract void removeStickyBroadcastAsUser(android.content.Intent, android.os.UserHandle); + method public abstract void revokeUriPermission(android.net.Uri, int); + method public abstract void sendBroadcast(android.content.Intent); + method public abstract void sendBroadcast(android.content.Intent, java.lang.String); + method public abstract void sendBroadcastAsUser(android.content.Intent, android.os.UserHandle); + method public abstract void sendBroadcastAsUser(android.content.Intent, android.os.UserHandle, java.lang.String); + method public abstract void sendOrderedBroadcast(android.content.Intent, java.lang.String); + method public abstract void sendOrderedBroadcast(android.content.Intent, java.lang.String, android.content.BroadcastReceiver, android.os.Handler, int, java.lang.String, android.os.Bundle); + method public abstract void sendOrderedBroadcastAsUser(android.content.Intent, android.os.UserHandle, java.lang.String, android.content.BroadcastReceiver, android.os.Handler, int, java.lang.String, android.os.Bundle); + method public abstract void sendStickyBroadcast(android.content.Intent); + method public abstract void sendStickyBroadcastAsUser(android.content.Intent, android.os.UserHandle); + method public abstract void sendStickyOrderedBroadcast(android.content.Intent, android.content.BroadcastReceiver, android.os.Handler, int, java.lang.String, android.os.Bundle); + method public abstract void sendStickyOrderedBroadcastAsUser(android.content.Intent, android.os.UserHandle, android.content.BroadcastReceiver, android.os.Handler, int, java.lang.String, android.os.Bundle); + method public abstract void setTheme(int); + method public abstract deprecated void setWallpaper(android.graphics.Bitmap) throws java.io.IOException; + method public abstract deprecated void setWallpaper(java.io.InputStream) throws java.io.IOException; + method public abstract void startActivities(android.content.Intent[]); + method public abstract void startActivities(android.content.Intent[], android.os.Bundle); + method public abstract void startActivity(android.content.Intent); + method public abstract void startActivity(android.content.Intent, android.os.Bundle); + method public abstract boolean startInstrumentation(android.content.ComponentName, java.lang.String, android.os.Bundle); + method public abstract void startIntentSender(android.content.IntentSender, android.content.Intent, int, int, int) throws android.content.IntentSender.SendIntentException; + method public abstract void startIntentSender(android.content.IntentSender, android.content.Intent, int, int, int, android.os.Bundle) throws android.content.IntentSender.SendIntentException; + method public abstract android.content.ComponentName startService(android.content.Intent); + method public abstract boolean stopService(android.content.Intent); + method public abstract void unbindService(android.content.ServiceConnection); + method public void unregisterComponentCallbacks(android.content.ComponentCallbacks); + method public abstract void unregisterReceiver(android.content.BroadcastReceiver); + field public static final java.lang.String ACCESSIBILITY_SERVICE = "accessibility"; + field public static final java.lang.String ACCOUNT_SERVICE = "account"; + field public static final java.lang.String ACTIVITY_SERVICE = "activity"; + field public static final java.lang.String ALARM_SERVICE = "alarm"; + field public static final java.lang.String AUDIO_SERVICE = "audio"; + field public static final int BIND_ABOVE_CLIENT = 8; // 0x8 + field public static final int BIND_ADJUST_WITH_ACTIVITY = 128; // 0x80 + field public static final int BIND_ALLOW_OOM_MANAGEMENT = 16; // 0x10 + field public static final int BIND_AUTO_CREATE = 1; // 0x1 + field public static final int BIND_DEBUG_UNBIND = 2; // 0x2 + field public static final int BIND_IMPORTANT = 64; // 0x40 + field public static final int BIND_NOT_FOREGROUND = 4; // 0x4 + field public static final int BIND_WAIVE_PRIORITY = 32; // 0x20 + field public static final java.lang.String CLIPBOARD_SERVICE = "clipboard"; + field public static final java.lang.String CONNECTIVITY_SERVICE = "connectivity"; + field public static final int CONTEXT_IGNORE_SECURITY = 2; // 0x2 + 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"; + field public static final java.lang.String INPUT_SERVICE = "input"; + field public static final java.lang.String KEYGUARD_SERVICE = "keyguard"; + field public static final java.lang.String LAYOUT_INFLATER_SERVICE = "layout_inflater"; + field public static final java.lang.String LOCATION_SERVICE = "location"; + field public static final java.lang.String MEDIA_ROUTER_SERVICE = "media_router"; + field public static final int MODE_APPEND = 32768; // 0x8000 + field public static final int MODE_ENABLE_WRITE_AHEAD_LOGGING = 8; // 0x8 + field public static final int MODE_MULTI_PROCESS = 4; // 0x4 + field public static final int MODE_PRIVATE = 0; // 0x0 + field public static final deprecated int MODE_WORLD_READABLE = 1; // 0x1 + field public static final deprecated int MODE_WORLD_WRITEABLE = 2; // 0x2 + field public static final java.lang.String NFC_SERVICE = "nfc"; + field public static final java.lang.String NOTIFICATION_SERVICE = "notification"; + field public static final java.lang.String NSD_SERVICE = "servicediscovery"; + field public static final java.lang.String POWER_SERVICE = "power"; + field public static final java.lang.String SEARCH_SERVICE = "search"; + field public static final java.lang.String SENSOR_SERVICE = "sensor"; + field public static final java.lang.String STORAGE_SERVICE = "storage"; + field public static final java.lang.String TELEPHONY_SERVICE = "phone"; + field public static final java.lang.String TEXT_SERVICES_MANAGER_SERVICE = "textservices"; + field public static final java.lang.String UI_MODE_SERVICE = "uimode"; + field public static final java.lang.String USB_SERVICE = "usb"; + field public static final java.lang.String USER_SERVICE = "user"; + field public static final java.lang.String VIBRATOR_SERVICE = "vibrator"; + field public static final java.lang.String WALLPAPER_SERVICE = "wallpaper"; + field public static final java.lang.String WIFI_P2P_SERVICE = "wifip2p"; + field public static final java.lang.String WIFI_SERVICE = "wifi"; + field public static final java.lang.String WINDOW_SERVICE = "window"; + } + + public class ContextWrapper extends android.content.Context { + ctor public ContextWrapper(android.content.Context); + method protected void attachBaseContext(android.content.Context); + method public boolean bindService(android.content.Intent, android.content.ServiceConnection, int); + method public int checkCallingOrSelfPermission(java.lang.String); + method public int checkCallingOrSelfUriPermission(android.net.Uri, int); + method public int checkCallingPermission(java.lang.String); + method public int checkCallingUriPermission(android.net.Uri, int); + method public int checkPermission(java.lang.String, int, int); + method public int checkUriPermission(android.net.Uri, int, int, int); + method public int checkUriPermission(android.net.Uri, java.lang.String, java.lang.String, int, int, int); + method public void clearWallpaper() throws java.io.IOException; + method public android.content.Context createConfigurationContext(android.content.res.Configuration); + method public android.content.Context createDisplayContext(android.view.Display); + method public android.content.Context createPackageContext(java.lang.String, int) throws android.content.pm.PackageManager.NameNotFoundException; + method public java.lang.String[] databaseList(); + method public boolean deleteDatabase(java.lang.String); + method public boolean deleteFile(java.lang.String); + method public void enforceCallingOrSelfPermission(java.lang.String, java.lang.String); + method public void enforceCallingOrSelfUriPermission(android.net.Uri, int, java.lang.String); + method public void enforceCallingPermission(java.lang.String, java.lang.String); + method public void enforceCallingUriPermission(android.net.Uri, int, java.lang.String); + method public void enforcePermission(java.lang.String, int, int, java.lang.String); + method public void enforceUriPermission(android.net.Uri, int, int, int, java.lang.String); + method public void enforceUriPermission(android.net.Uri, java.lang.String, java.lang.String, int, int, int, java.lang.String); + method public java.lang.String[] fileList(); + method public android.content.Context getApplicationContext(); + method public android.content.pm.ApplicationInfo getApplicationInfo(); + method public android.content.res.AssetManager getAssets(); + method public android.content.Context getBaseContext(); + method public java.io.File getCacheDir(); + method public java.lang.ClassLoader getClassLoader(); + method public android.content.ContentResolver getContentResolver(); + method public java.io.File getDatabasePath(java.lang.String); + method public java.io.File getDir(java.lang.String, int); + method public java.io.File getExternalCacheDir(); + method public java.io.File getExternalFilesDir(java.lang.String); + method public java.io.File getFileStreamPath(java.lang.String); + method public java.io.File getFilesDir(); + method public android.os.Looper getMainLooper(); + method public java.io.File getObbDir(); + method public java.lang.String getPackageCodePath(); + method public android.content.pm.PackageManager getPackageManager(); + method public java.lang.String getPackageName(); + method public java.lang.String getPackageResourcePath(); + method public android.content.res.Resources getResources(); + method public android.content.SharedPreferences getSharedPreferences(java.lang.String, int); + method public java.lang.Object getSystemService(java.lang.String); + method public android.content.res.Resources.Theme getTheme(); + method public android.graphics.drawable.Drawable getWallpaper(); + method public int getWallpaperDesiredMinimumHeight(); + method public int getWallpaperDesiredMinimumWidth(); + method public void grantUriPermission(java.lang.String, android.net.Uri, int); + method public java.io.FileInputStream openFileInput(java.lang.String) throws java.io.FileNotFoundException; + method public java.io.FileOutputStream openFileOutput(java.lang.String, int) throws java.io.FileNotFoundException; + method public android.database.sqlite.SQLiteDatabase openOrCreateDatabase(java.lang.String, int, android.database.sqlite.SQLiteDatabase.CursorFactory); + method public android.database.sqlite.SQLiteDatabase openOrCreateDatabase(java.lang.String, int, android.database.sqlite.SQLiteDatabase.CursorFactory, android.database.DatabaseErrorHandler); + method public android.graphics.drawable.Drawable peekWallpaper(); + method public android.content.Intent registerReceiver(android.content.BroadcastReceiver, android.content.IntentFilter); + method public android.content.Intent registerReceiver(android.content.BroadcastReceiver, android.content.IntentFilter, java.lang.String, android.os.Handler); + method public void removeStickyBroadcast(android.content.Intent); + method public void removeStickyBroadcastAsUser(android.content.Intent, android.os.UserHandle); + method public void revokeUriPermission(android.net.Uri, int); + method public void sendBroadcast(android.content.Intent); + method public void sendBroadcast(android.content.Intent, java.lang.String); + method public void sendBroadcastAsUser(android.content.Intent, android.os.UserHandle); + method public void sendBroadcastAsUser(android.content.Intent, android.os.UserHandle, java.lang.String); + method public void sendOrderedBroadcast(android.content.Intent, java.lang.String); + method public void sendOrderedBroadcast(android.content.Intent, java.lang.String, android.content.BroadcastReceiver, android.os.Handler, int, java.lang.String, android.os.Bundle); + method public void sendOrderedBroadcastAsUser(android.content.Intent, android.os.UserHandle, java.lang.String, android.content.BroadcastReceiver, android.os.Handler, int, java.lang.String, android.os.Bundle); + method public void sendStickyBroadcast(android.content.Intent); + method public void sendStickyBroadcastAsUser(android.content.Intent, android.os.UserHandle); + method public void sendStickyOrderedBroadcast(android.content.Intent, android.content.BroadcastReceiver, android.os.Handler, int, java.lang.String, android.os.Bundle); + method public void sendStickyOrderedBroadcastAsUser(android.content.Intent, android.os.UserHandle, android.content.BroadcastReceiver, android.os.Handler, int, java.lang.String, android.os.Bundle); + method public void setTheme(int); + method public void setWallpaper(android.graphics.Bitmap) throws java.io.IOException; + method public void setWallpaper(java.io.InputStream) throws java.io.IOException; + method public void startActivities(android.content.Intent[]); + method public void startActivities(android.content.Intent[], android.os.Bundle); + method public void startActivity(android.content.Intent); + method public void startActivity(android.content.Intent, android.os.Bundle); + method public boolean startInstrumentation(android.content.ComponentName, java.lang.String, android.os.Bundle); + method public void startIntentSender(android.content.IntentSender, android.content.Intent, int, int, int) throws android.content.IntentSender.SendIntentException; + method public void startIntentSender(android.content.IntentSender, android.content.Intent, int, int, int, android.os.Bundle) throws android.content.IntentSender.SendIntentException; + method public android.content.ComponentName startService(android.content.Intent); + method public boolean stopService(android.content.Intent); + method public void unbindService(android.content.ServiceConnection); + method public void unregisterReceiver(android.content.BroadcastReceiver); + } + + public class CursorLoader extends android.content.AsyncTaskLoader { + ctor public CursorLoader(android.content.Context); + ctor public CursorLoader(android.content.Context, android.net.Uri, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String); + method public void deliverResult(android.database.Cursor); + method public java.lang.String[] getProjection(); + method public java.lang.String getSelection(); + method public java.lang.String[] getSelectionArgs(); + method public java.lang.String getSortOrder(); + method public android.net.Uri getUri(); + method public android.database.Cursor loadInBackground(); + method public void onCanceled(android.database.Cursor); + method public void setProjection(java.lang.String[]); + method public void setSelection(java.lang.String); + method public void setSelectionArgs(java.lang.String[]); + method public void setSortOrder(java.lang.String); + method public void setUri(android.net.Uri); + } + + public abstract interface DialogInterface { + method public abstract void cancel(); + method public abstract void dismiss(); + field public static final deprecated int BUTTON1 = -1; // 0xffffffff + field public static final deprecated int BUTTON2 = -2; // 0xfffffffe + field public static final deprecated int BUTTON3 = -3; // 0xfffffffd + field public static final int BUTTON_NEGATIVE = -2; // 0xfffffffe + field public static final int BUTTON_NEUTRAL = -3; // 0xfffffffd + field public static final int BUTTON_POSITIVE = -1; // 0xffffffff + } + + public static abstract interface DialogInterface.OnCancelListener { + method public abstract void onCancel(android.content.DialogInterface); + } + + public static abstract interface DialogInterface.OnClickListener { + method public abstract void onClick(android.content.DialogInterface, int); + } + + public static abstract interface DialogInterface.OnDismissListener { + method public abstract void onDismiss(android.content.DialogInterface); + } + + public static abstract interface DialogInterface.OnKeyListener { + method public abstract boolean onKey(android.content.DialogInterface, int, android.view.KeyEvent); + } + + public static abstract interface DialogInterface.OnMultiChoiceClickListener { + method public abstract void onClick(android.content.DialogInterface, int, boolean); + } + + public static abstract interface DialogInterface.OnShowListener { + method public abstract void onShow(android.content.DialogInterface); + } + + public final class Entity { + ctor public Entity(android.content.ContentValues); + method public void addSubValue(android.net.Uri, android.content.ContentValues); + method public android.content.ContentValues getEntityValues(); + method public java.util.ArrayList getSubValues(); + } + + public static class Entity.NamedContentValues { + ctor public Entity.NamedContentValues(android.net.Uri, android.content.ContentValues); + field public final android.net.Uri uri; + field public final android.content.ContentValues values; + } + + public abstract interface EntityIterator implements java.util.Iterator { + method public abstract void close(); + method public abstract void reset(); + } + + public class Intent implements java.lang.Cloneable android.os.Parcelable { + ctor public Intent(); + ctor public Intent(android.content.Intent); + ctor public Intent(java.lang.String); + ctor public Intent(java.lang.String, android.net.Uri); + ctor public Intent(android.content.Context, java.lang.Class); + ctor public Intent(java.lang.String, android.net.Uri, android.content.Context, java.lang.Class); + method public android.content.Intent addCategory(java.lang.String); + method public android.content.Intent addFlags(int); + method public java.lang.Object clone(); + method public android.content.Intent cloneFilter(); + method public static android.content.Intent createChooser(android.content.Intent, java.lang.CharSequence); + method public int describeContents(); + method public int fillIn(android.content.Intent, int); + method public boolean filterEquals(android.content.Intent); + method public int filterHashCode(); + method public java.lang.String getAction(); + method public boolean[] getBooleanArrayExtra(java.lang.String); + method public boolean getBooleanExtra(java.lang.String, boolean); + method public android.os.Bundle getBundleExtra(java.lang.String); + method public byte[] getByteArrayExtra(java.lang.String); + method public byte getByteExtra(java.lang.String, byte); + method public java.util.Set getCategories(); + method public char[] getCharArrayExtra(java.lang.String); + method public char getCharExtra(java.lang.String, char); + method public java.lang.CharSequence[] getCharSequenceArrayExtra(java.lang.String); + method public java.util.ArrayList getCharSequenceArrayListExtra(java.lang.String); + method public java.lang.CharSequence getCharSequenceExtra(java.lang.String); + method public android.content.ClipData getClipData(); + method public android.content.ComponentName getComponent(); + method public android.net.Uri getData(); + method public java.lang.String getDataString(); + method public double[] getDoubleArrayExtra(java.lang.String); + method public double getDoubleExtra(java.lang.String, double); + method public android.os.Bundle getExtras(); + method public int getFlags(); + method public float[] getFloatArrayExtra(java.lang.String); + method public float getFloatExtra(java.lang.String, float); + method public int[] getIntArrayExtra(java.lang.String); + method public int getIntExtra(java.lang.String, int); + method public java.util.ArrayList getIntegerArrayListExtra(java.lang.String); + method public static deprecated android.content.Intent getIntent(java.lang.String) throws java.net.URISyntaxException; + method public static android.content.Intent getIntentOld(java.lang.String) throws java.net.URISyntaxException; + method public long[] getLongArrayExtra(java.lang.String); + method public long getLongExtra(java.lang.String, long); + method public java.lang.String getPackage(); + method public android.os.Parcelable[] getParcelableArrayExtra(java.lang.String); + method public java.util.ArrayList getParcelableArrayListExtra(java.lang.String); + method public T getParcelableExtra(java.lang.String); + method public java.lang.String getScheme(); + method public android.content.Intent getSelector(); + method public java.io.Serializable getSerializableExtra(java.lang.String); + method public short[] getShortArrayExtra(java.lang.String); + method public short getShortExtra(java.lang.String, short); + method public android.graphics.Rect getSourceBounds(); + method public java.lang.String[] getStringArrayExtra(java.lang.String); + method public java.util.ArrayList getStringArrayListExtra(java.lang.String); + method public java.lang.String getStringExtra(java.lang.String); + method public java.lang.String getType(); + method public boolean hasCategory(java.lang.String); + method public boolean hasExtra(java.lang.String); + method public boolean hasFileDescriptors(); + method public static android.content.Intent makeMainActivity(android.content.ComponentName); + method public static android.content.Intent makeMainSelectorActivity(java.lang.String, java.lang.String); + method public static android.content.Intent makeRestartActivityTask(android.content.ComponentName); + method public static java.lang.String normalizeMimeType(java.lang.String); + method public static android.content.Intent parseIntent(android.content.res.Resources, org.xmlpull.v1.XmlPullParser, android.util.AttributeSet) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException; + method public static android.content.Intent parseUri(java.lang.String, int) throws java.net.URISyntaxException; + method public android.content.Intent putCharSequenceArrayListExtra(java.lang.String, java.util.ArrayList); + method public android.content.Intent putExtra(java.lang.String, boolean); + method public android.content.Intent putExtra(java.lang.String, byte); + method public android.content.Intent putExtra(java.lang.String, char); + method public android.content.Intent putExtra(java.lang.String, short); + method public android.content.Intent putExtra(java.lang.String, int); + method public android.content.Intent putExtra(java.lang.String, long); + method public android.content.Intent putExtra(java.lang.String, float); + method public android.content.Intent putExtra(java.lang.String, double); + method public android.content.Intent putExtra(java.lang.String, java.lang.String); + method public android.content.Intent putExtra(java.lang.String, java.lang.CharSequence); + method public android.content.Intent putExtra(java.lang.String, android.os.Parcelable); + method public android.content.Intent putExtra(java.lang.String, android.os.Parcelable[]); + method public android.content.Intent putExtra(java.lang.String, java.io.Serializable); + method public android.content.Intent putExtra(java.lang.String, boolean[]); + method public android.content.Intent putExtra(java.lang.String, byte[]); + method public android.content.Intent putExtra(java.lang.String, short[]); + method public android.content.Intent putExtra(java.lang.String, char[]); + method public android.content.Intent putExtra(java.lang.String, int[]); + method public android.content.Intent putExtra(java.lang.String, long[]); + method public android.content.Intent putExtra(java.lang.String, float[]); + method public android.content.Intent putExtra(java.lang.String, double[]); + method public android.content.Intent putExtra(java.lang.String, java.lang.String[]); + method public android.content.Intent putExtra(java.lang.String, java.lang.CharSequence[]); + method public android.content.Intent putExtra(java.lang.String, android.os.Bundle); + method public android.content.Intent putExtras(android.content.Intent); + method public android.content.Intent putExtras(android.os.Bundle); + method public android.content.Intent putIntegerArrayListExtra(java.lang.String, java.util.ArrayList); + method public android.content.Intent putParcelableArrayListExtra(java.lang.String, java.util.ArrayList); + method public android.content.Intent putStringArrayListExtra(java.lang.String, java.util.ArrayList); + method public void readFromParcel(android.os.Parcel); + method public void removeCategory(java.lang.String); + method public void removeExtra(java.lang.String); + method public android.content.Intent replaceExtras(android.content.Intent); + method public android.content.Intent replaceExtras(android.os.Bundle); + method public android.content.ComponentName resolveActivity(android.content.pm.PackageManager); + method public android.content.pm.ActivityInfo resolveActivityInfo(android.content.pm.PackageManager, int); + method public java.lang.String resolveType(android.content.Context); + method public java.lang.String resolveType(android.content.ContentResolver); + method public java.lang.String resolveTypeIfNeeded(android.content.ContentResolver); + method public android.content.Intent setAction(java.lang.String); + method public android.content.Intent setClass(android.content.Context, java.lang.Class); + method public android.content.Intent setClassName(android.content.Context, java.lang.String); + method public android.content.Intent setClassName(java.lang.String, java.lang.String); + method public void setClipData(android.content.ClipData); + method public android.content.Intent setComponent(android.content.ComponentName); + method public android.content.Intent setData(android.net.Uri); + method public android.content.Intent setDataAndNormalize(android.net.Uri); + method public android.content.Intent setDataAndType(android.net.Uri, java.lang.String); + method public android.content.Intent setDataAndTypeAndNormalize(android.net.Uri, java.lang.String); + method public void setExtrasClassLoader(java.lang.ClassLoader); + method public android.content.Intent setFlags(int); + method public android.content.Intent setPackage(java.lang.String); + method public void setSelector(android.content.Intent); + method public void setSourceBounds(android.graphics.Rect); + method public android.content.Intent setType(java.lang.String); + method public android.content.Intent setTypeAndNormalize(java.lang.String); + method public deprecated java.lang.String toURI(); + method public java.lang.String toUri(int); + method public void writeToParcel(android.os.Parcel, int); + field public static final java.lang.String ACTION_AIRPLANE_MODE_CHANGED = "android.intent.action.AIRPLANE_MODE"; + field public static final java.lang.String ACTION_ALL_APPS = "android.intent.action.ALL_APPS"; + field public static final java.lang.String ACTION_ANSWER = "android.intent.action.ANSWER"; + field public static final java.lang.String ACTION_APP_ERROR = "android.intent.action.APP_ERROR"; + field public static final java.lang.String ACTION_ASSIST = "android.intent.action.ASSIST"; + field public static final java.lang.String ACTION_ATTACH_DATA = "android.intent.action.ATTACH_DATA"; + field public static final java.lang.String ACTION_BATTERY_CHANGED = "android.intent.action.BATTERY_CHANGED"; + field public static final java.lang.String ACTION_BATTERY_LOW = "android.intent.action.BATTERY_LOW"; + field public static final java.lang.String ACTION_BATTERY_OKAY = "android.intent.action.BATTERY_OKAY"; + field public static final java.lang.String ACTION_BOOT_COMPLETED = "android.intent.action.BOOT_COMPLETED"; + field public static final java.lang.String ACTION_BUG_REPORT = "android.intent.action.BUG_REPORT"; + field public static final java.lang.String ACTION_CALL = "android.intent.action.CALL"; + field public static final java.lang.String ACTION_CALL_BUTTON = "android.intent.action.CALL_BUTTON"; + field public static final java.lang.String ACTION_CAMERA_BUTTON = "android.intent.action.CAMERA_BUTTON"; + field public static final java.lang.String ACTION_CHOOSER = "android.intent.action.CHOOSER"; + field public static final java.lang.String ACTION_CLOSE_SYSTEM_DIALOGS = "android.intent.action.CLOSE_SYSTEM_DIALOGS"; + field public static final java.lang.String ACTION_CONFIGURATION_CHANGED = "android.intent.action.CONFIGURATION_CHANGED"; + field public static final java.lang.String ACTION_CREATE_SHORTCUT = "android.intent.action.CREATE_SHORTCUT"; + field public static final java.lang.String ACTION_DATE_CHANGED = "android.intent.action.DATE_CHANGED"; + field public static final java.lang.String ACTION_DEFAULT = "android.intent.action.VIEW"; + field public static final java.lang.String ACTION_DELETE = "android.intent.action.DELETE"; + field public static final java.lang.String ACTION_DEVICE_STORAGE_LOW = "android.intent.action.DEVICE_STORAGE_LOW"; + field public static final java.lang.String ACTION_DEVICE_STORAGE_OK = "android.intent.action.DEVICE_STORAGE_OK"; + field public static final java.lang.String ACTION_DIAL = "android.intent.action.DIAL"; + field public static final java.lang.String ACTION_DOCK_EVENT = "android.intent.action.DOCK_EVENT"; + field public static final java.lang.String ACTION_DREAMING_STARTED = "android.intent.action.DREAMING_STARTED"; + field public static final java.lang.String ACTION_DREAMING_STOPPED = "android.intent.action.DREAMING_STOPPED"; + field public static final java.lang.String ACTION_EDIT = "android.intent.action.EDIT"; + field public static final java.lang.String ACTION_EXTERNAL_APPLICATIONS_AVAILABLE = "android.intent.action.EXTERNAL_APPLICATIONS_AVAILABLE"; + field public static final java.lang.String ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE = "android.intent.action.EXTERNAL_APPLICATIONS_UNAVAILABLE"; + field public static final java.lang.String ACTION_FACTORY_TEST = "android.intent.action.FACTORY_TEST"; + field public static final java.lang.String ACTION_GET_CONTENT = "android.intent.action.GET_CONTENT"; + field public static final java.lang.String ACTION_GTALK_SERVICE_CONNECTED = "android.intent.action.GTALK_CONNECTED"; + field public static final java.lang.String ACTION_GTALK_SERVICE_DISCONNECTED = "android.intent.action.GTALK_DISCONNECTED"; + field public static final java.lang.String ACTION_HEADSET_PLUG = "android.intent.action.HEADSET_PLUG"; + field public static final java.lang.String ACTION_INPUT_METHOD_CHANGED = "android.intent.action.INPUT_METHOD_CHANGED"; + field public static final java.lang.String ACTION_INSERT = "android.intent.action.INSERT"; + field public static final java.lang.String ACTION_INSERT_OR_EDIT = "android.intent.action.INSERT_OR_EDIT"; + field public static final java.lang.String ACTION_INSTALL_PACKAGE = "android.intent.action.INSTALL_PACKAGE"; + field public static final java.lang.String ACTION_LOCALE_CHANGED = "android.intent.action.LOCALE_CHANGED"; + field public static final java.lang.String ACTION_MAIN = "android.intent.action.MAIN"; + field public static final java.lang.String ACTION_MANAGE_NETWORK_USAGE = "android.intent.action.MANAGE_NETWORK_USAGE"; + field public static final java.lang.String ACTION_MANAGE_PACKAGE_STORAGE = "android.intent.action.MANAGE_PACKAGE_STORAGE"; + field public static final java.lang.String ACTION_MEDIA_BAD_REMOVAL = "android.intent.action.MEDIA_BAD_REMOVAL"; + field public static final java.lang.String ACTION_MEDIA_BUTTON = "android.intent.action.MEDIA_BUTTON"; + field public static final java.lang.String ACTION_MEDIA_CHECKING = "android.intent.action.MEDIA_CHECKING"; + field public static final java.lang.String ACTION_MEDIA_EJECT = "android.intent.action.MEDIA_EJECT"; + field public static final java.lang.String ACTION_MEDIA_MOUNTED = "android.intent.action.MEDIA_MOUNTED"; + field public static final java.lang.String ACTION_MEDIA_NOFS = "android.intent.action.MEDIA_NOFS"; + field public static final java.lang.String ACTION_MEDIA_REMOVED = "android.intent.action.MEDIA_REMOVED"; + field public static final java.lang.String ACTION_MEDIA_SCANNER_FINISHED = "android.intent.action.MEDIA_SCANNER_FINISHED"; + field public static final java.lang.String ACTION_MEDIA_SCANNER_SCAN_FILE = "android.intent.action.MEDIA_SCANNER_SCAN_FILE"; + field public static final java.lang.String ACTION_MEDIA_SCANNER_STARTED = "android.intent.action.MEDIA_SCANNER_STARTED"; + field public static final java.lang.String ACTION_MEDIA_SHARED = "android.intent.action.MEDIA_SHARED"; + field public static final java.lang.String ACTION_MEDIA_UNMOUNTABLE = "android.intent.action.MEDIA_UNMOUNTABLE"; + field public static final java.lang.String ACTION_MEDIA_UNMOUNTED = "android.intent.action.MEDIA_UNMOUNTED"; + field public static final java.lang.String ACTION_MY_PACKAGE_REPLACED = "android.intent.action.MY_PACKAGE_REPLACED"; + field public static final java.lang.String ACTION_NEW_OUTGOING_CALL = "android.intent.action.NEW_OUTGOING_CALL"; + field public static final java.lang.String ACTION_PACKAGE_ADDED = "android.intent.action.PACKAGE_ADDED"; + field public static final java.lang.String ACTION_PACKAGE_CHANGED = "android.intent.action.PACKAGE_CHANGED"; + field public static final java.lang.String ACTION_PACKAGE_DATA_CLEARED = "android.intent.action.PACKAGE_DATA_CLEARED"; + field public static final java.lang.String ACTION_PACKAGE_FIRST_LAUNCH = "android.intent.action.PACKAGE_FIRST_LAUNCH"; + field public static final java.lang.String ACTION_PACKAGE_FULLY_REMOVED = "android.intent.action.PACKAGE_FULLY_REMOVED"; + field public static final deprecated java.lang.String ACTION_PACKAGE_INSTALL = "android.intent.action.PACKAGE_INSTALL"; + field public static final java.lang.String ACTION_PACKAGE_NEEDS_VERIFICATION = "android.intent.action.PACKAGE_NEEDS_VERIFICATION"; + field public static final java.lang.String ACTION_PACKAGE_REMOVED = "android.intent.action.PACKAGE_REMOVED"; + field public static final java.lang.String ACTION_PACKAGE_REPLACED = "android.intent.action.PACKAGE_REPLACED"; + field public static final java.lang.String ACTION_PACKAGE_RESTARTED = "android.intent.action.PACKAGE_RESTARTED"; + field public static final java.lang.String ACTION_PACKAGE_VERIFIED = "android.intent.action.PACKAGE_VERIFIED"; + field public static final java.lang.String ACTION_PASTE = "android.intent.action.PASTE"; + field public static final java.lang.String ACTION_PICK = "android.intent.action.PICK"; + field public static final java.lang.String ACTION_PICK_ACTIVITY = "android.intent.action.PICK_ACTIVITY"; + field public static final java.lang.String ACTION_POWER_CONNECTED = "android.intent.action.ACTION_POWER_CONNECTED"; + field public static final java.lang.String ACTION_POWER_DISCONNECTED = "android.intent.action.ACTION_POWER_DISCONNECTED"; + field public static final java.lang.String ACTION_POWER_USAGE_SUMMARY = "android.intent.action.POWER_USAGE_SUMMARY"; + field public static final java.lang.String ACTION_PROVIDER_CHANGED = "android.intent.action.PROVIDER_CHANGED"; + field public static final java.lang.String ACTION_QUICK_CLOCK = "android.intent.action.QUICK_CLOCK"; + field public static final java.lang.String ACTION_REBOOT = "android.intent.action.REBOOT"; + field public static final java.lang.String ACTION_RUN = "android.intent.action.RUN"; + field public static final java.lang.String ACTION_SCREEN_OFF = "android.intent.action.SCREEN_OFF"; + field public static final java.lang.String ACTION_SCREEN_ON = "android.intent.action.SCREEN_ON"; + field public static final java.lang.String ACTION_SEARCH = "android.intent.action.SEARCH"; + field public static final java.lang.String ACTION_SEARCH_LONG_PRESS = "android.intent.action.SEARCH_LONG_PRESS"; + field public static final java.lang.String ACTION_SEND = "android.intent.action.SEND"; + field public static final java.lang.String ACTION_SENDTO = "android.intent.action.SENDTO"; + field public static final java.lang.String ACTION_SEND_MULTIPLE = "android.intent.action.SEND_MULTIPLE"; + field public static final java.lang.String ACTION_SET_WALLPAPER = "android.intent.action.SET_WALLPAPER"; + field public static final java.lang.String ACTION_SHUTDOWN = "android.intent.action.ACTION_SHUTDOWN"; + field public static final java.lang.String ACTION_SYNC = "android.intent.action.SYNC"; + field public static final java.lang.String ACTION_SYSTEM_TUTORIAL = "android.intent.action.SYSTEM_TUTORIAL"; + field public static final java.lang.String ACTION_TIMEZONE_CHANGED = "android.intent.action.TIMEZONE_CHANGED"; + field public static final java.lang.String ACTION_TIME_CHANGED = "android.intent.action.TIME_SET"; + field public static final java.lang.String ACTION_TIME_TICK = "android.intent.action.TIME_TICK"; + field public static final java.lang.String ACTION_UID_REMOVED = "android.intent.action.UID_REMOVED"; + field public static final deprecated java.lang.String ACTION_UMS_CONNECTED = "android.intent.action.UMS_CONNECTED"; + field public static final deprecated java.lang.String ACTION_UMS_DISCONNECTED = "android.intent.action.UMS_DISCONNECTED"; + field public static final java.lang.String ACTION_UNINSTALL_PACKAGE = "android.intent.action.UNINSTALL_PACKAGE"; + field public static final java.lang.String ACTION_USER_BACKGROUND = "android.intent.action.USER_BACKGROUND"; + field public static final java.lang.String ACTION_USER_FOREGROUND = "android.intent.action.USER_FOREGROUND"; + field public static final java.lang.String ACTION_USER_INITIALIZE = "android.intent.action.USER_INITIALIZE"; + field public static final java.lang.String ACTION_USER_PRESENT = "android.intent.action.USER_PRESENT"; + field public static final java.lang.String ACTION_VIEW = "android.intent.action.VIEW"; + field public static final java.lang.String ACTION_VOICE_COMMAND = "android.intent.action.VOICE_COMMAND"; + field public static final deprecated java.lang.String ACTION_WALLPAPER_CHANGED = "android.intent.action.WALLPAPER_CHANGED"; + field public static final java.lang.String ACTION_WEB_SEARCH = "android.intent.action.WEB_SEARCH"; + field public static final java.lang.String CATEGORY_ALTERNATIVE = "android.intent.category.ALTERNATIVE"; + field public static final java.lang.String CATEGORY_APP_BROWSER = "android.intent.category.APP_BROWSER"; + field public static final java.lang.String CATEGORY_APP_CALCULATOR = "android.intent.category.APP_CALCULATOR"; + field public static final java.lang.String CATEGORY_APP_CALENDAR = "android.intent.category.APP_CALENDAR"; + field public static final java.lang.String CATEGORY_APP_CONTACTS = "android.intent.category.APP_CONTACTS"; + field public static final java.lang.String CATEGORY_APP_EMAIL = "android.intent.category.APP_EMAIL"; + field public static final java.lang.String CATEGORY_APP_GALLERY = "android.intent.category.APP_GALLERY"; + field public static final java.lang.String CATEGORY_APP_MAPS = "android.intent.category.APP_MAPS"; + field public static final java.lang.String CATEGORY_APP_MARKET = "android.intent.category.APP_MARKET"; + field public static final java.lang.String CATEGORY_APP_MESSAGING = "android.intent.category.APP_MESSAGING"; + field public static final java.lang.String CATEGORY_APP_MUSIC = "android.intent.category.APP_MUSIC"; + field public static final java.lang.String CATEGORY_BROWSABLE = "android.intent.category.BROWSABLE"; + field public static final java.lang.String CATEGORY_CAR_DOCK = "android.intent.category.CAR_DOCK"; + field public static final java.lang.String CATEGORY_CAR_MODE = "android.intent.category.CAR_MODE"; + field public static final java.lang.String CATEGORY_DEFAULT = "android.intent.category.DEFAULT"; + field public static final java.lang.String CATEGORY_DESK_DOCK = "android.intent.category.DESK_DOCK"; + field public static final java.lang.String CATEGORY_DEVELOPMENT_PREFERENCE = "android.intent.category.DEVELOPMENT_PREFERENCE"; + field public static final java.lang.String CATEGORY_EMBED = "android.intent.category.EMBED"; + field public static final java.lang.String CATEGORY_FRAMEWORK_INSTRUMENTATION_TEST = "android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST"; + field public static final java.lang.String CATEGORY_HE_DESK_DOCK = "android.intent.category.HE_DESK_DOCK"; + field public static final java.lang.String CATEGORY_HOME = "android.intent.category.HOME"; + field public static final java.lang.String CATEGORY_INFO = "android.intent.category.INFO"; + field public static final java.lang.String CATEGORY_LAUNCHER = "android.intent.category.LAUNCHER"; + field public static final java.lang.String CATEGORY_LE_DESK_DOCK = "android.intent.category.LE_DESK_DOCK"; + field public static final java.lang.String CATEGORY_MONKEY = "android.intent.category.MONKEY"; + field public static final java.lang.String CATEGORY_OPENABLE = "android.intent.category.OPENABLE"; + field public static final java.lang.String CATEGORY_PREFERENCE = "android.intent.category.PREFERENCE"; + field public static final java.lang.String CATEGORY_SAMPLE_CODE = "android.intent.category.SAMPLE_CODE"; + field public static final java.lang.String CATEGORY_SELECTED_ALTERNATIVE = "android.intent.category.SELECTED_ALTERNATIVE"; + field public static final java.lang.String CATEGORY_TAB = "android.intent.category.TAB"; + field public static final java.lang.String CATEGORY_TEST = "android.intent.category.TEST"; + field public static final java.lang.String CATEGORY_UNIT_TEST = "android.intent.category.UNIT_TEST"; + field public static final android.os.Parcelable.Creator CREATOR; + field public static final java.lang.String EXTRA_ALARM_COUNT = "android.intent.extra.ALARM_COUNT"; + field public static final deprecated java.lang.String EXTRA_ALLOW_REPLACE = "android.intent.extra.ALLOW_REPLACE"; + field public static final java.lang.String EXTRA_BCC = "android.intent.extra.BCC"; + field public static final java.lang.String EXTRA_BUG_REPORT = "android.intent.extra.BUG_REPORT"; + field public static final java.lang.String EXTRA_CC = "android.intent.extra.CC"; + field public static final deprecated java.lang.String EXTRA_CHANGED_COMPONENT_NAME = "android.intent.extra.changed_component_name"; + field public static final java.lang.String EXTRA_CHANGED_COMPONENT_NAME_LIST = "android.intent.extra.changed_component_name_list"; + field public static final java.lang.String EXTRA_CHANGED_PACKAGE_LIST = "android.intent.extra.changed_package_list"; + field public static final java.lang.String EXTRA_CHANGED_UID_LIST = "android.intent.extra.changed_uid_list"; + field public static final java.lang.String EXTRA_DATA_REMOVED = "android.intent.extra.DATA_REMOVED"; + field public static final java.lang.String EXTRA_DOCK_STATE = "android.intent.extra.DOCK_STATE"; + field public static final int EXTRA_DOCK_STATE_CAR = 2; // 0x2 + field public static final int EXTRA_DOCK_STATE_DESK = 1; // 0x1 + field public static final int EXTRA_DOCK_STATE_HE_DESK = 4; // 0x4 + field public static final int EXTRA_DOCK_STATE_LE_DESK = 3; // 0x3 + field public static final int EXTRA_DOCK_STATE_UNDOCKED = 0; // 0x0 + field public static final java.lang.String EXTRA_DONT_KILL_APP = "android.intent.extra.DONT_KILL_APP"; + field public static final java.lang.String EXTRA_EMAIL = "android.intent.extra.EMAIL"; + field public static final java.lang.String EXTRA_HTML_TEXT = "android.intent.extra.HTML_TEXT"; + field public static final java.lang.String EXTRA_INITIAL_INTENTS = "android.intent.extra.INITIAL_INTENTS"; + field public static final java.lang.String EXTRA_INSTALLER_PACKAGE_NAME = "android.intent.extra.INSTALLER_PACKAGE_NAME"; + field public static final java.lang.String EXTRA_INTENT = "android.intent.extra.INTENT"; + field public static final java.lang.String EXTRA_KEY_EVENT = "android.intent.extra.KEY_EVENT"; + field public static final java.lang.String EXTRA_LOCAL_ONLY = "android.intent.extra.LOCAL_ONLY"; + field public static final java.lang.String EXTRA_NOT_UNKNOWN_SOURCE = "android.intent.extra.NOT_UNKNOWN_SOURCE"; + field public static final java.lang.String EXTRA_ORIGINATING_URI = "android.intent.extra.ORIGINATING_URI"; + field public static final java.lang.String EXTRA_PHONE_NUMBER = "android.intent.extra.PHONE_NUMBER"; + field public static final java.lang.String EXTRA_REFERRER = "android.intent.extra.REFERRER"; + field public static final java.lang.String EXTRA_REMOTE_INTENT_TOKEN = "android.intent.extra.remote_intent_token"; + field public static final java.lang.String EXTRA_REPLACING = "android.intent.extra.REPLACING"; + field public static final java.lang.String EXTRA_RETURN_RESULT = "android.intent.extra.RETURN_RESULT"; + field public static final java.lang.String EXTRA_SHORTCUT_ICON = "android.intent.extra.shortcut.ICON"; + field public static final java.lang.String EXTRA_SHORTCUT_ICON_RESOURCE = "android.intent.extra.shortcut.ICON_RESOURCE"; + field public static final java.lang.String EXTRA_SHORTCUT_INTENT = "android.intent.extra.shortcut.INTENT"; + field public static final java.lang.String EXTRA_SHORTCUT_NAME = "android.intent.extra.shortcut.NAME"; + field public static final java.lang.String EXTRA_STREAM = "android.intent.extra.STREAM"; + field public static final java.lang.String EXTRA_SUBJECT = "android.intent.extra.SUBJECT"; + field public static final java.lang.String EXTRA_TEMPLATE = "android.intent.extra.TEMPLATE"; + field public static final java.lang.String EXTRA_TEXT = "android.intent.extra.TEXT"; + field public static final java.lang.String EXTRA_TITLE = "android.intent.extra.TITLE"; + field public static final java.lang.String EXTRA_UID = "android.intent.extra.UID"; + field public static final int FILL_IN_ACTION = 1; // 0x1 + field public static final int FILL_IN_CATEGORIES = 4; // 0x4 + field public static final int FILL_IN_CLIP_DATA = 128; // 0x80 + field public static final int FILL_IN_COMPONENT = 8; // 0x8 + field public static final int FILL_IN_DATA = 2; // 0x2 + field public static final int FILL_IN_PACKAGE = 16; // 0x10 + field public static final int FILL_IN_SELECTOR = 64; // 0x40 + field public static final int FILL_IN_SOURCE_BOUNDS = 32; // 0x20 + field public static final int FLAG_ACTIVITY_BROUGHT_TO_FRONT = 4194304; // 0x400000 + field public static final int FLAG_ACTIVITY_CLEAR_TASK = 32768; // 0x8000 + field public static final int FLAG_ACTIVITY_CLEAR_TOP = 67108864; // 0x4000000 + field public static final int FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET = 524288; // 0x80000 + field public static final int FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS = 8388608; // 0x800000 + field public static final int FLAG_ACTIVITY_FORWARD_RESULT = 33554432; // 0x2000000 + field public static final int FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY = 1048576; // 0x100000 + field public static final int FLAG_ACTIVITY_MULTIPLE_TASK = 134217728; // 0x8000000 + field public static final int FLAG_ACTIVITY_NEW_TASK = 268435456; // 0x10000000 + field public static final int FLAG_ACTIVITY_NO_ANIMATION = 65536; // 0x10000 + field public static final int FLAG_ACTIVITY_NO_HISTORY = 1073741824; // 0x40000000 + field public static final int FLAG_ACTIVITY_NO_USER_ACTION = 262144; // 0x40000 + field public static final int FLAG_ACTIVITY_PREVIOUS_IS_TOP = 16777216; // 0x1000000 + field public static final int FLAG_ACTIVITY_REORDER_TO_FRONT = 131072; // 0x20000 + field public static final int FLAG_ACTIVITY_RESET_TASK_IF_NEEDED = 2097152; // 0x200000 + field public static final int FLAG_ACTIVITY_SINGLE_TOP = 536870912; // 0x20000000 + field public static final int FLAG_ACTIVITY_TASK_ON_HOME = 16384; // 0x4000 + field public static final int FLAG_DEBUG_LOG_RESOLUTION = 8; // 0x8 + field public static final int FLAG_EXCLUDE_STOPPED_PACKAGES = 16; // 0x10 + field public static final int FLAG_FROM_BACKGROUND = 4; // 0x4 + field public static final int FLAG_GRANT_READ_URI_PERMISSION = 1; // 0x1 + field public static final int FLAG_GRANT_WRITE_URI_PERMISSION = 2; // 0x2 + field public static final int FLAG_INCLUDE_STOPPED_PACKAGES = 32; // 0x20 + field public static final int FLAG_RECEIVER_FOREGROUND = 268435456; // 0x10000000 + field public static final int FLAG_RECEIVER_REGISTERED_ONLY = 1073741824; // 0x40000000 + field public static final int FLAG_RECEIVER_REPLACE_PENDING = 536870912; // 0x20000000 + field public static final java.lang.String METADATA_DOCK_HOME = "android.dock_home"; + field public static final int URI_INTENT_SCHEME = 1; // 0x1 + } + + public static final class Intent.FilterComparison { + ctor public Intent.FilterComparison(android.content.Intent); + method public android.content.Intent getIntent(); + } + + public static class Intent.ShortcutIconResource implements android.os.Parcelable { + ctor public Intent.ShortcutIconResource(); + method public int describeContents(); + method public static android.content.Intent.ShortcutIconResource fromContext(android.content.Context, int); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + field public java.lang.String packageName; + field public java.lang.String resourceName; + } + + public class IntentFilter implements android.os.Parcelable { + ctor public IntentFilter(); + ctor public IntentFilter(java.lang.String); + ctor public IntentFilter(java.lang.String, java.lang.String) throws android.content.IntentFilter.MalformedMimeTypeException; + ctor public IntentFilter(android.content.IntentFilter); + method public final java.util.Iterator actionsIterator(); + method public final void addAction(java.lang.String); + method public final void addCategory(java.lang.String); + method public final void addDataAuthority(java.lang.String, java.lang.String); + method public final void addDataPath(java.lang.String, int); + method public final void addDataScheme(java.lang.String); + method public final void addDataType(java.lang.String) throws android.content.IntentFilter.MalformedMimeTypeException; + method public final java.util.Iterator authoritiesIterator(); + method public final java.util.Iterator categoriesIterator(); + method public final int countActions(); + method public final int countCategories(); + method public final int countDataAuthorities(); + method public final int countDataPaths(); + method public final int countDataSchemes(); + method public final int countDataTypes(); + method public static android.content.IntentFilter create(java.lang.String, java.lang.String); + method public final int describeContents(); + method public void dump(android.util.Printer, java.lang.String); + method public final java.lang.String getAction(int); + method public final java.lang.String getCategory(int); + method public final android.content.IntentFilter.AuthorityEntry getDataAuthority(int); + method public final android.os.PatternMatcher getDataPath(int); + method public final java.lang.String getDataScheme(int); + method public final java.lang.String getDataType(int); + method public final int getPriority(); + method public final boolean hasAction(java.lang.String); + method public final boolean hasCategory(java.lang.String); + method public final boolean hasDataAuthority(android.net.Uri); + method public final boolean hasDataPath(java.lang.String); + method public final boolean hasDataScheme(java.lang.String); + method public final boolean hasDataType(java.lang.String); + method public final int match(android.content.ContentResolver, android.content.Intent, boolean, java.lang.String); + method public final int match(java.lang.String, java.lang.String, java.lang.String, android.net.Uri, java.util.Set, java.lang.String); + method public final boolean matchAction(java.lang.String); + method public final java.lang.String matchCategories(java.util.Set); + method public final int matchData(java.lang.String, java.lang.String, android.net.Uri); + method public final int matchDataAuthority(android.net.Uri); + method public final java.util.Iterator pathsIterator(); + method public void readFromXml(org.xmlpull.v1.XmlPullParser) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException; + method public final java.util.Iterator schemesIterator(); + method public final void setPriority(int); + method public final java.util.Iterator typesIterator(); + method public final void writeToParcel(android.os.Parcel, int); + method public void writeToXml(org.xmlpull.v1.XmlSerializer) throws java.io.IOException; + field public static final android.os.Parcelable.Creator CREATOR; + field public static final int MATCH_ADJUSTMENT_MASK = 65535; // 0xffff + field public static final int MATCH_ADJUSTMENT_NORMAL = 32768; // 0x8000 + field public static final int MATCH_CATEGORY_EMPTY = 1048576; // 0x100000 + field public static final int MATCH_CATEGORY_HOST = 3145728; // 0x300000 + field public static final int MATCH_CATEGORY_MASK = 268369920; // 0xfff0000 + field public static final int MATCH_CATEGORY_PATH = 5242880; // 0x500000 + field public static final int MATCH_CATEGORY_PORT = 4194304; // 0x400000 + field public static final int MATCH_CATEGORY_SCHEME = 2097152; // 0x200000 + field public static final int MATCH_CATEGORY_TYPE = 6291456; // 0x600000 + field public static final int NO_MATCH_ACTION = -3; // 0xfffffffd + field public static final int NO_MATCH_CATEGORY = -4; // 0xfffffffc + field public static final int NO_MATCH_DATA = -2; // 0xfffffffe + field public static final int NO_MATCH_TYPE = -1; // 0xffffffff + field public static final int SYSTEM_HIGH_PRIORITY = 1000; // 0x3e8 + field public static final int SYSTEM_LOW_PRIORITY = -1000; // 0xfffffc18 + } + + public static final class IntentFilter.AuthorityEntry { + ctor public IntentFilter.AuthorityEntry(java.lang.String, java.lang.String); + method public java.lang.String getHost(); + method public int getPort(); + method public int match(android.net.Uri); + } + + public static class IntentFilter.MalformedMimeTypeException extends android.util.AndroidException { + ctor public IntentFilter.MalformedMimeTypeException(); + ctor public IntentFilter.MalformedMimeTypeException(java.lang.String); + } + + public class IntentSender implements android.os.Parcelable { + method public int describeContents(); + method public java.lang.String getCreatorPackage(); + method public int getCreatorUid(); + method public android.os.UserHandle getCreatorUserHandle(); + method public deprecated java.lang.String getTargetPackage(); + method public static android.content.IntentSender readIntentSenderOrNullFromParcel(android.os.Parcel); + method public void sendIntent(android.content.Context, int, android.content.Intent, android.content.IntentSender.OnFinished, android.os.Handler) throws android.content.IntentSender.SendIntentException; + method public void sendIntent(android.content.Context, int, android.content.Intent, android.content.IntentSender.OnFinished, android.os.Handler, java.lang.String) throws android.content.IntentSender.SendIntentException; + method public static void writeIntentSenderOrNullToParcel(android.content.IntentSender, android.os.Parcel); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + } + + public static abstract interface IntentSender.OnFinished { + method public abstract void onSendFinished(android.content.IntentSender, android.content.Intent, int, java.lang.String, android.os.Bundle); + } + + public static class IntentSender.SendIntentException extends android.util.AndroidException { + ctor public IntentSender.SendIntentException(); + ctor public IntentSender.SendIntentException(java.lang.String); + ctor public IntentSender.SendIntentException(java.lang.Exception); + } + + public class Loader { + ctor public Loader(android.content.Context); + method public void abandon(); + method public boolean cancelLoad(); + method public java.lang.String dataToString(D); + method public void deliverCancellation(); + method public void deliverResult(D); + method public void dump(java.lang.String, java.io.FileDescriptor, java.io.PrintWriter, java.lang.String[]); + method public void forceLoad(); + method public android.content.Context getContext(); + method public int getId(); + method public boolean isAbandoned(); + method public boolean isReset(); + method public boolean isStarted(); + method protected void onAbandon(); + method protected boolean onCancelLoad(); + method public void onContentChanged(); + method protected void onForceLoad(); + method protected void onReset(); + method protected void onStartLoading(); + method protected void onStopLoading(); + method public void registerListener(int, android.content.Loader.OnLoadCompleteListener); + method public void registerOnLoadCanceledListener(android.content.Loader.OnLoadCanceledListener); + method public void reset(); + method public final void startLoading(); + method public void stopLoading(); + method public boolean takeContentChanged(); + method public void unregisterListener(android.content.Loader.OnLoadCompleteListener); + method public void unregisterOnLoadCanceledListener(android.content.Loader.OnLoadCanceledListener); + } + + public final class Loader.ForceLoadContentObserver extends android.database.ContentObserver { + ctor public Loader.ForceLoadContentObserver(); + } + + public static abstract interface Loader.OnLoadCanceledListener { + method public abstract void onLoadCanceled(android.content.Loader); + } + + public static abstract interface Loader.OnLoadCompleteListener { + method public abstract void onLoadComplete(android.content.Loader, D); + } + + public class MutableContextWrapper extends android.content.ContextWrapper { + ctor public MutableContextWrapper(android.content.Context); + method public void setBaseContext(android.content.Context); + } + + public class OperationApplicationException extends java.lang.Exception { + ctor public OperationApplicationException(); + ctor public OperationApplicationException(java.lang.String); + ctor public OperationApplicationException(java.lang.String, java.lang.Throwable); + ctor public OperationApplicationException(java.lang.Throwable); + ctor public OperationApplicationException(int); + ctor public OperationApplicationException(java.lang.String, int); + method public int getNumSuccessfulYieldPoints(); + } + + public class PeriodicSync implements android.os.Parcelable { + ctor public PeriodicSync(android.accounts.Account, java.lang.String, android.os.Bundle, long); + method public int describeContents(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + field public final android.accounts.Account account; + field public final java.lang.String authority; + field public final android.os.Bundle extras; + field public final long period; + } + + public class ReceiverCallNotAllowedException extends android.util.AndroidRuntimeException { + ctor public ReceiverCallNotAllowedException(java.lang.String); + } + + public class SearchRecentSuggestionsProvider extends android.content.ContentProvider { + ctor public SearchRecentSuggestionsProvider(); + method public int delete(android.net.Uri, java.lang.String, java.lang.String[]); + method public java.lang.String getType(android.net.Uri); + method public android.net.Uri insert(android.net.Uri, android.content.ContentValues); + method public boolean onCreate(); + method public android.database.Cursor query(android.net.Uri, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String); + method protected void setupSuggestions(java.lang.String, int); + method public int update(android.net.Uri, android.content.ContentValues, java.lang.String, java.lang.String[]); + field public static final int DATABASE_MODE_2LINES = 2; // 0x2 + field public static final int DATABASE_MODE_QUERIES = 1; // 0x1 + } + + public abstract interface ServiceConnection { + method public abstract void onServiceConnected(android.content.ComponentName, android.os.IBinder); + method public abstract void onServiceDisconnected(android.content.ComponentName); + } + + public abstract interface SharedPreferences { + method public abstract boolean contains(java.lang.String); + method public abstract android.content.SharedPreferences.Editor edit(); + method public abstract java.util.Map getAll(); + method public abstract boolean getBoolean(java.lang.String, boolean); + method public abstract float getFloat(java.lang.String, float); + method public abstract int getInt(java.lang.String, int); + method public abstract long getLong(java.lang.String, long); + method public abstract java.lang.String getString(java.lang.String, java.lang.String); + method public abstract java.util.Set getStringSet(java.lang.String, java.util.Set); + method public abstract void registerOnSharedPreferenceChangeListener(android.content.SharedPreferences.OnSharedPreferenceChangeListener); + method public abstract void unregisterOnSharedPreferenceChangeListener(android.content.SharedPreferences.OnSharedPreferenceChangeListener); + } + + public static abstract interface SharedPreferences.Editor { + method public abstract void apply(); + method public abstract android.content.SharedPreferences.Editor clear(); + method public abstract boolean commit(); + method public abstract android.content.SharedPreferences.Editor putBoolean(java.lang.String, boolean); + method public abstract android.content.SharedPreferences.Editor putFloat(java.lang.String, float); + method public abstract android.content.SharedPreferences.Editor putInt(java.lang.String, int); + method public abstract android.content.SharedPreferences.Editor putLong(java.lang.String, long); + method public abstract android.content.SharedPreferences.Editor putString(java.lang.String, java.lang.String); + method public abstract android.content.SharedPreferences.Editor putStringSet(java.lang.String, java.util.Set); + method public abstract android.content.SharedPreferences.Editor remove(java.lang.String); + } + + public static abstract interface SharedPreferences.OnSharedPreferenceChangeListener { + method public abstract void onSharedPreferenceChanged(android.content.SharedPreferences, java.lang.String); + } + + public class SyncAdapterType implements android.os.Parcelable { + ctor public SyncAdapterType(java.lang.String, java.lang.String, boolean, boolean); + ctor public SyncAdapterType(android.os.Parcel); + method public boolean allowParallelSyncs(); + method public int describeContents(); + method public java.lang.String getSettingsActivity(); + method public boolean isAlwaysSyncable(); + method public boolean isUserVisible(); + method public static android.content.SyncAdapterType newKey(java.lang.String, java.lang.String); + method public boolean supportsUploading(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + field public final java.lang.String accountType; + field public final java.lang.String authority; + field public final boolean isKey; + } + + public class SyncContext { + method public android.os.IBinder getSyncContextBinder(); + method public void onFinished(android.content.SyncResult); + } + + public class SyncInfo implements android.os.Parcelable { + method public int describeContents(); + method public void writeToParcel(android.os.Parcel, int); + field public final android.accounts.Account account; + field public final java.lang.String authority; + field public final long startTime; + } + + public final class SyncResult implements android.os.Parcelable { + ctor public SyncResult(); + method public void clear(); + method public int describeContents(); + method public boolean hasError(); + method public boolean hasHardError(); + method public boolean hasSoftError(); + method public boolean madeSomeProgress(); + method public java.lang.String toDebugString(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.content.SyncResult ALREADY_IN_PROGRESS; + field public static final android.os.Parcelable.Creator CREATOR; + field public boolean databaseError; + field public long delayUntil; + field public boolean fullSyncRequested; + field public boolean moreRecordsToGet; + field public boolean partialSyncUnavailable; + field public final android.content.SyncStats stats; + field public final boolean syncAlreadyInProgress; + field public boolean tooManyDeletions; + field public boolean tooManyRetries; + } + + public class SyncStats implements android.os.Parcelable { + ctor public SyncStats(); + ctor public SyncStats(android.os.Parcel); + method public void clear(); + method public int describeContents(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + field public long numAuthExceptions; + field public long numConflictDetectedExceptions; + field public long numDeletes; + field public long numEntries; + field public long numInserts; + field public long numIoExceptions; + field public long numParseExceptions; + field public long numSkippedEntries; + field public long numUpdates; + } + + public abstract interface SyncStatusObserver { + method public abstract void onStatusChanged(int); + } + + public class UriMatcher { + ctor public UriMatcher(int); + method public void addURI(java.lang.String, java.lang.String, int); + method public int match(android.net.Uri); + field public static final int NO_MATCH = -1; // 0xffffffff + } + +} + +package android.content.pm { + + public class ActivityInfo extends android.content.pm.ComponentInfo implements android.os.Parcelable { + ctor public ActivityInfo(); + ctor public ActivityInfo(android.content.pm.ActivityInfo); + method public int describeContents(); + method public void dump(android.util.Printer, java.lang.String); + method public final int getThemeResource(); + field public static final int CONFIG_DENSITY = 4096; // 0x1000 + field public static final int CONFIG_FONT_SCALE = 1073741824; // 0x40000000 + field public static final int CONFIG_KEYBOARD = 16; // 0x10 + field public static final int CONFIG_KEYBOARD_HIDDEN = 32; // 0x20 + field public static final int CONFIG_LAYOUT_DIRECTION = 8192; // 0x2000 + field public static final int CONFIG_LOCALE = 4; // 0x4 + field public static final int CONFIG_MCC = 1; // 0x1 + field public static final int CONFIG_MNC = 2; // 0x2 + field public static final int CONFIG_NAVIGATION = 64; // 0x40 + field public static final int CONFIG_ORIENTATION = 128; // 0x80 + field public static final int CONFIG_SCREEN_LAYOUT = 256; // 0x100 + field public static final int CONFIG_SCREEN_SIZE = 1024; // 0x400 + field public static final int CONFIG_SMALLEST_SCREEN_SIZE = 2048; // 0x800 + field public static final int CONFIG_TOUCHSCREEN = 8; // 0x8 + field public static final int CONFIG_UI_MODE = 512; // 0x200 + field public static final android.os.Parcelable.Creator CREATOR; + field public static final int FLAG_ALLOW_TASK_REPARENTING = 64; // 0x40 + field public static final int FLAG_ALWAYS_RETAIN_TASK_STATE = 8; // 0x8 + field public static final int FLAG_CLEAR_TASK_ON_LAUNCH = 4; // 0x4 + field public static final int FLAG_EXCLUDE_FROM_RECENTS = 32; // 0x20 + field public static final int FLAG_FINISH_ON_CLOSE_SYSTEM_DIALOGS = 256; // 0x100 + field public static final int FLAG_FINISH_ON_TASK_LAUNCH = 2; // 0x2 + field public static final int FLAG_HARDWARE_ACCELERATED = 512; // 0x200 + field public static final int FLAG_MULTIPROCESS = 1; // 0x1 + field public static final int FLAG_NO_HISTORY = 128; // 0x80 + field public static final int FLAG_SINGLE_USER = 1073741824; // 0x40000000 + field public static final int FLAG_STATE_NOT_NEEDED = 16; // 0x10 + field public static final int LAUNCH_MULTIPLE = 0; // 0x0 + field public static final int LAUNCH_SINGLE_INSTANCE = 3; // 0x3 + field public static final int LAUNCH_SINGLE_TASK = 2; // 0x2 + field public static final int LAUNCH_SINGLE_TOP = 1; // 0x1 + field public static final int SCREEN_ORIENTATION_BEHIND = 3; // 0x3 + field public static final int SCREEN_ORIENTATION_FULL_SENSOR = 10; // 0xa + field public static final int SCREEN_ORIENTATION_LANDSCAPE = 0; // 0x0 + field public static final int SCREEN_ORIENTATION_NOSENSOR = 5; // 0x5 + field public static final int SCREEN_ORIENTATION_PORTRAIT = 1; // 0x1 + field public static final int SCREEN_ORIENTATION_REVERSE_LANDSCAPE = 8; // 0x8 + field public static final int SCREEN_ORIENTATION_REVERSE_PORTRAIT = 9; // 0x9 + field public static final int SCREEN_ORIENTATION_SENSOR = 4; // 0x4 + field public static final int SCREEN_ORIENTATION_SENSOR_LANDSCAPE = 6; // 0x6 + field public static final int SCREEN_ORIENTATION_SENSOR_PORTRAIT = 7; // 0x7 + field public static final int SCREEN_ORIENTATION_UNSPECIFIED = -1; // 0xffffffff + field public static final int SCREEN_ORIENTATION_USER = 2; // 0x2 + field public static final int UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW = 1; // 0x1 + field public int configChanges; + field public int flags; + field public int launchMode; + field public java.lang.String parentActivityName; + field public java.lang.String permission; + field public int screenOrientation; + field public int softInputMode; + field public java.lang.String targetActivity; + field public java.lang.String taskAffinity; + field public int theme; + field public int uiOptions; + } + + public class ApplicationInfo extends android.content.pm.PackageItemInfo implements android.os.Parcelable { + ctor public ApplicationInfo(); + ctor public ApplicationInfo(android.content.pm.ApplicationInfo); + method public int describeContents(); + method public void dump(android.util.Printer, java.lang.String); + method public java.lang.CharSequence loadDescription(android.content.pm.PackageManager); + field public static final android.os.Parcelable.Creator CREATOR; + field public static final int FLAG_ALLOW_BACKUP = 32768; // 0x8000 + field public static final int FLAG_ALLOW_CLEAR_USER_DATA = 64; // 0x40 + field public static final int FLAG_ALLOW_TASK_REPARENTING = 32; // 0x20 + field public static final int FLAG_DEBUGGABLE = 2; // 0x2 + field public static final int FLAG_EXTERNAL_STORAGE = 262144; // 0x40000 + field public static final int FLAG_FACTORY_TEST = 16; // 0x10 + field public static final int FLAG_HAS_CODE = 4; // 0x4 + field public static final int FLAG_INSTALLED = 8388608; // 0x800000 + field public static final int FLAG_IS_DATA_ONLY = 16777216; // 0x1000000 + field public static final int FLAG_KILL_AFTER_RESTORE = 65536; // 0x10000 + field public static final int FLAG_LARGE_HEAP = 1048576; // 0x100000 + field public static final int FLAG_PERSISTENT = 8; // 0x8 + field public static final int FLAG_RESIZEABLE_FOR_SCREENS = 4096; // 0x1000 + field public static final int FLAG_RESTORE_ANY_VERSION = 131072; // 0x20000 + field public static final int FLAG_STOPPED = 2097152; // 0x200000 + field public static final int FLAG_SUPPORTS_LARGE_SCREENS = 2048; // 0x800 + field public static final int FLAG_SUPPORTS_NORMAL_SCREENS = 1024; // 0x400 + field public static final int FLAG_SUPPORTS_RTL = 4194304; // 0x400000 + field public static final int FLAG_SUPPORTS_SCREEN_DENSITIES = 8192; // 0x2000 + field public static final int FLAG_SUPPORTS_SMALL_SCREENS = 512; // 0x200 + field public static final int FLAG_SUPPORTS_XLARGE_SCREENS = 524288; // 0x80000 + field public static final int FLAG_SYSTEM = 1; // 0x1 + field public static final int FLAG_TEST_ONLY = 256; // 0x100 + field public static final int FLAG_UPDATED_SYSTEM_APP = 128; // 0x80 + field public static final int FLAG_VM_SAFE_MODE = 16384; // 0x4000 + field public java.lang.String backupAgentName; + field public java.lang.String className; + field public int compatibleWidthLimitDp; + field public java.lang.String dataDir; + field public int descriptionRes; + field public boolean enabled; + field public int flags; + field public int largestWidthLimitDp; + field public java.lang.String manageSpaceActivityName; + field public java.lang.String nativeLibraryDir; + field public java.lang.String permission; + field public java.lang.String processName; + field public java.lang.String publicSourceDir; + field public int requiresSmallestWidthDp; + field public java.lang.String[] sharedLibraryFiles; + field public java.lang.String sourceDir; + field public int targetSdkVersion; + field public java.lang.String taskAffinity; + field public int theme; + field public int uiOptions; + field public int uid; + } + + public static class ApplicationInfo.DisplayNameComparator implements java.util.Comparator { + ctor public ApplicationInfo.DisplayNameComparator(android.content.pm.PackageManager); + method public final int compare(android.content.pm.ApplicationInfo, android.content.pm.ApplicationInfo); + } + + public class ComponentInfo extends android.content.pm.PackageItemInfo { + ctor public ComponentInfo(); + ctor public ComponentInfo(android.content.pm.ComponentInfo); + ctor protected ComponentInfo(android.os.Parcel); + method public final int getIconResource(); + method public boolean isEnabled(); + field public android.content.pm.ApplicationInfo applicationInfo; + field public int descriptionRes; + field public boolean enabled; + field public boolean exported; + field public java.lang.String processName; + } + + public class ConfigurationInfo implements android.os.Parcelable { + ctor public ConfigurationInfo(); + ctor public ConfigurationInfo(android.content.pm.ConfigurationInfo); + method public int describeContents(); + method public java.lang.String getGlEsVersion(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + field public static final int GL_ES_VERSION_UNDEFINED = 0; // 0x0 + field public static final int INPUT_FEATURE_FIVE_WAY_NAV = 2; // 0x2 + field public static final int INPUT_FEATURE_HARD_KEYBOARD = 1; // 0x1 + field public int reqGlEsVersion; + field public int reqInputFeatures; + field public int reqKeyboardType; + field public int reqNavigation; + field public int reqTouchScreen; + } + + public class FeatureInfo implements android.os.Parcelable { + ctor public FeatureInfo(); + ctor public FeatureInfo(android.content.pm.FeatureInfo); + method public int describeContents(); + method public java.lang.String getGlEsVersion(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + field public static final int FLAG_REQUIRED = 1; // 0x1 + field public static final int GL_ES_VERSION_UNDEFINED = 0; // 0x0 + field public int flags; + field public java.lang.String name; + field public int reqGlEsVersion; + } + + public class InstrumentationInfo extends android.content.pm.PackageItemInfo implements android.os.Parcelable { + ctor public InstrumentationInfo(); + ctor public InstrumentationInfo(android.content.pm.InstrumentationInfo); + method public int describeContents(); + field public static final android.os.Parcelable.Creator CREATOR; + field public java.lang.String dataDir; + field public boolean functionalTest; + field public boolean handleProfiling; + field public java.lang.String publicSourceDir; + field public java.lang.String sourceDir; + field public java.lang.String targetPackage; + } + + public class LabeledIntent extends android.content.Intent { + ctor public LabeledIntent(android.content.Intent, java.lang.String, int, int); + ctor public LabeledIntent(android.content.Intent, java.lang.String, java.lang.CharSequence, int); + ctor public LabeledIntent(java.lang.String, int, int); + ctor public LabeledIntent(java.lang.String, java.lang.CharSequence, int); + method public int getIconResource(); + method public int getLabelResource(); + method public java.lang.CharSequence getNonLocalizedLabel(); + method public java.lang.String getSourcePackage(); + method public android.graphics.drawable.Drawable loadIcon(android.content.pm.PackageManager); + method public java.lang.CharSequence loadLabel(android.content.pm.PackageManager); + field public static final android.os.Parcelable.Creator CREATOR; + } + + public class PackageInfo implements android.os.Parcelable { + ctor public PackageInfo(); + method public int describeContents(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + field public static final int REQUESTED_PERMISSION_GRANTED = 2; // 0x2 + field public static final int REQUESTED_PERMISSION_REQUIRED = 1; // 0x1 + field public android.content.pm.ActivityInfo[] activities; + field public android.content.pm.ApplicationInfo applicationInfo; + field public android.content.pm.ConfigurationInfo[] configPreferences; + field public long firstInstallTime; + field public int[] gids; + field public android.content.pm.InstrumentationInfo[] instrumentation; + field public long lastUpdateTime; + field public java.lang.String packageName; + field public android.content.pm.PermissionInfo[] permissions; + field public android.content.pm.ProviderInfo[] providers; + field public android.content.pm.ActivityInfo[] receivers; + field public android.content.pm.FeatureInfo[] reqFeatures; + field public java.lang.String[] requestedPermissions; + field public int[] requestedPermissionsFlags; + field public android.content.pm.ServiceInfo[] services; + field public java.lang.String sharedUserId; + field public int sharedUserLabel; + field public android.content.pm.Signature[] signatures; + field public int versionCode; + field public java.lang.String versionName; + } + + public class PackageItemInfo { + ctor public PackageItemInfo(); + ctor public PackageItemInfo(android.content.pm.PackageItemInfo); + ctor protected PackageItemInfo(android.os.Parcel); + method protected void dumpBack(android.util.Printer, java.lang.String); + method protected void dumpFront(android.util.Printer, java.lang.String); + method public android.graphics.drawable.Drawable loadIcon(android.content.pm.PackageManager); + method public java.lang.CharSequence loadLabel(android.content.pm.PackageManager); + method public android.graphics.drawable.Drawable loadLogo(android.content.pm.PackageManager); + method public android.content.res.XmlResourceParser loadXmlMetaData(android.content.pm.PackageManager, java.lang.String); + method public void writeToParcel(android.os.Parcel, int); + field public int icon; + field public int labelRes; + field public int logo; + field public android.os.Bundle metaData; + field public java.lang.String name; + field public java.lang.CharSequence nonLocalizedLabel; + field public java.lang.String packageName; + } + + public static class PackageItemInfo.DisplayNameComparator implements java.util.Comparator { + ctor public PackageItemInfo.DisplayNameComparator(android.content.pm.PackageManager); + method public final int compare(android.content.pm.PackageItemInfo, android.content.pm.PackageItemInfo); + } + + public abstract class PackageManager { + ctor public PackageManager(); + method public abstract deprecated void addPackageToPreferred(java.lang.String); + method public abstract boolean addPermission(android.content.pm.PermissionInfo); + method public abstract boolean addPermissionAsync(android.content.pm.PermissionInfo); + method public abstract deprecated void addPreferredActivity(android.content.IntentFilter, int, android.content.ComponentName[], android.content.ComponentName); + method public abstract java.lang.String[] canonicalToCurrentPackageNames(java.lang.String[]); + method public abstract int checkPermission(java.lang.String, java.lang.String); + method public abstract int checkSignatures(java.lang.String, java.lang.String); + method public abstract int checkSignatures(int, int); + method public abstract void clearPackagePreferredActivities(java.lang.String); + method public abstract java.lang.String[] currentToCanonicalPackageNames(java.lang.String[]); + method public abstract void extendVerificationTimeout(int, int, long); + method public abstract android.graphics.drawable.Drawable getActivityIcon(android.content.ComponentName) throws android.content.pm.PackageManager.NameNotFoundException; + method public abstract android.graphics.drawable.Drawable getActivityIcon(android.content.Intent) throws android.content.pm.PackageManager.NameNotFoundException; + method public abstract android.content.pm.ActivityInfo getActivityInfo(android.content.ComponentName, int) throws android.content.pm.PackageManager.NameNotFoundException; + method public abstract android.graphics.drawable.Drawable getActivityLogo(android.content.ComponentName) throws android.content.pm.PackageManager.NameNotFoundException; + method public abstract android.graphics.drawable.Drawable getActivityLogo(android.content.Intent) throws android.content.pm.PackageManager.NameNotFoundException; + method public abstract java.util.List getAllPermissionGroups(int); + method public abstract int getApplicationEnabledSetting(java.lang.String); + method public abstract android.graphics.drawable.Drawable getApplicationIcon(android.content.pm.ApplicationInfo); + method public abstract android.graphics.drawable.Drawable getApplicationIcon(java.lang.String) throws android.content.pm.PackageManager.NameNotFoundException; + method public abstract android.content.pm.ApplicationInfo getApplicationInfo(java.lang.String, int) throws android.content.pm.PackageManager.NameNotFoundException; + method public abstract java.lang.CharSequence getApplicationLabel(android.content.pm.ApplicationInfo); + method public abstract android.graphics.drawable.Drawable getApplicationLogo(android.content.pm.ApplicationInfo); + method public abstract android.graphics.drawable.Drawable getApplicationLogo(java.lang.String) throws android.content.pm.PackageManager.NameNotFoundException; + method public abstract int getComponentEnabledSetting(android.content.ComponentName); + method public abstract android.graphics.drawable.Drawable getDefaultActivityIcon(); + method public abstract android.graphics.drawable.Drawable getDrawable(java.lang.String, int, android.content.pm.ApplicationInfo); + method public abstract java.util.List getInstalledApplications(int); + method public abstract java.util.List getInstalledPackages(int); + method public abstract java.lang.String getInstallerPackageName(java.lang.String); + method public abstract android.content.pm.InstrumentationInfo getInstrumentationInfo(android.content.ComponentName, int) throws android.content.pm.PackageManager.NameNotFoundException; + method public abstract android.content.Intent getLaunchIntentForPackage(java.lang.String); + method public abstract java.lang.String getNameForUid(int); + method public android.content.pm.PackageInfo getPackageArchiveInfo(java.lang.String, int); + method public abstract int[] getPackageGids(java.lang.String) throws android.content.pm.PackageManager.NameNotFoundException; + method public abstract android.content.pm.PackageInfo getPackageInfo(java.lang.String, int) throws android.content.pm.PackageManager.NameNotFoundException; + method public abstract java.lang.String[] getPackagesForUid(int); + method public abstract android.content.pm.PermissionGroupInfo getPermissionGroupInfo(java.lang.String, int) throws android.content.pm.PackageManager.NameNotFoundException; + method public abstract android.content.pm.PermissionInfo getPermissionInfo(java.lang.String, int) throws android.content.pm.PackageManager.NameNotFoundException; + method public abstract int getPreferredActivities(java.util.List, java.util.List, java.lang.String); + method public abstract java.util.List getPreferredPackages(int); + method public abstract android.content.pm.ProviderInfo getProviderInfo(android.content.ComponentName, int) throws android.content.pm.PackageManager.NameNotFoundException; + method public abstract android.content.pm.ActivityInfo getReceiverInfo(android.content.ComponentName, int) throws android.content.pm.PackageManager.NameNotFoundException; + method public abstract android.content.res.Resources getResourcesForActivity(android.content.ComponentName) throws android.content.pm.PackageManager.NameNotFoundException; + method public abstract android.content.res.Resources getResourcesForApplication(android.content.pm.ApplicationInfo) throws android.content.pm.PackageManager.NameNotFoundException; + method public abstract android.content.res.Resources getResourcesForApplication(java.lang.String) throws android.content.pm.PackageManager.NameNotFoundException; + method public abstract android.content.pm.ServiceInfo getServiceInfo(android.content.ComponentName, int) throws android.content.pm.PackageManager.NameNotFoundException; + method public abstract android.content.pm.FeatureInfo[] getSystemAvailableFeatures(); + method public abstract java.lang.String[] getSystemSharedLibraryNames(); + method public abstract java.lang.CharSequence getText(java.lang.String, int, android.content.pm.ApplicationInfo); + method public abstract android.content.res.XmlResourceParser getXml(java.lang.String, int, android.content.pm.ApplicationInfo); + method public abstract boolean hasSystemFeature(java.lang.String); + method public abstract boolean isSafeMode(); + method public abstract java.util.List queryBroadcastReceivers(android.content.Intent, int); + method public abstract java.util.List queryContentProviders(java.lang.String, int, int); + method public abstract java.util.List queryInstrumentation(java.lang.String, int); + method public abstract java.util.List queryIntentActivities(android.content.Intent, int); + method public abstract java.util.List queryIntentActivityOptions(android.content.ComponentName, android.content.Intent[], android.content.Intent, int); + method public abstract java.util.List queryIntentServices(android.content.Intent, int); + method public abstract java.util.List queryPermissionsByGroup(java.lang.String, int) throws android.content.pm.PackageManager.NameNotFoundException; + method public abstract deprecated void removePackageFromPreferred(java.lang.String); + method public abstract void removePermission(java.lang.String); + method public abstract android.content.pm.ResolveInfo resolveActivity(android.content.Intent, int); + method public abstract android.content.pm.ProviderInfo resolveContentProvider(java.lang.String, int); + method public abstract android.content.pm.ResolveInfo resolveService(android.content.Intent, int); + method public abstract void setApplicationEnabledSetting(java.lang.String, int, int); + method public abstract void setComponentEnabledSetting(android.content.ComponentName, int, int); + method public abstract void setInstallerPackageName(java.lang.String, java.lang.String); + method public abstract void verifyPendingInstall(int, int); + field public static final int COMPONENT_ENABLED_STATE_DEFAULT = 0; // 0x0 + field public static final int COMPONENT_ENABLED_STATE_DISABLED = 2; // 0x2 + field public static final int COMPONENT_ENABLED_STATE_DISABLED_USER = 3; // 0x3 + field public static final int COMPONENT_ENABLED_STATE_ENABLED = 1; // 0x1 + field public static final int DONT_KILL_APP = 1; // 0x1 + field public static final java.lang.String EXTRA_VERIFICATION_ID = "android.content.pm.extra.VERIFICATION_ID"; + field public static final java.lang.String EXTRA_VERIFICATION_RESULT = "android.content.pm.extra.VERIFICATION_RESULT"; + field public static final java.lang.String FEATURE_AUDIO_LOW_LATENCY = "android.hardware.audio.low_latency"; + field public static final java.lang.String FEATURE_BLUETOOTH = "android.hardware.bluetooth"; + field public static final java.lang.String FEATURE_CAMERA = "android.hardware.camera"; + field public static final java.lang.String FEATURE_CAMERA_ANY = "android.hardware.camera.any"; + field public static final java.lang.String FEATURE_CAMERA_AUTOFOCUS = "android.hardware.camera.autofocus"; + field public static final java.lang.String FEATURE_CAMERA_FLASH = "android.hardware.camera.flash"; + field public static final java.lang.String FEATURE_CAMERA_FRONT = "android.hardware.camera.front"; + field public static final java.lang.String FEATURE_FAKETOUCH = "android.hardware.faketouch"; + field public static final java.lang.String FEATURE_FAKETOUCH_MULTITOUCH_DISTINCT = "android.hardware.faketouch.multitouch.distinct"; + field public static final java.lang.String FEATURE_FAKETOUCH_MULTITOUCH_JAZZHAND = "android.hardware.faketouch.multitouch.jazzhand"; + field public static final java.lang.String FEATURE_LIVE_WALLPAPER = "android.software.live_wallpaper"; + field public static final java.lang.String FEATURE_LOCATION = "android.hardware.location"; + field public static final java.lang.String FEATURE_LOCATION_GPS = "android.hardware.location.gps"; + field public static final java.lang.String FEATURE_LOCATION_NETWORK = "android.hardware.location.network"; + field public static final java.lang.String FEATURE_MICROPHONE = "android.hardware.microphone"; + field public static final java.lang.String FEATURE_NFC = "android.hardware.nfc"; + field public static final java.lang.String FEATURE_SCREEN_LANDSCAPE = "android.hardware.screen.landscape"; + field public static final java.lang.String FEATURE_SCREEN_PORTRAIT = "android.hardware.screen.portrait"; + field public static final java.lang.String FEATURE_SENSOR_ACCELEROMETER = "android.hardware.sensor.accelerometer"; + field public static final java.lang.String FEATURE_SENSOR_BAROMETER = "android.hardware.sensor.barometer"; + field public static final java.lang.String FEATURE_SENSOR_COMPASS = "android.hardware.sensor.compass"; + field public static final java.lang.String FEATURE_SENSOR_GYROSCOPE = "android.hardware.sensor.gyroscope"; + field public static final java.lang.String FEATURE_SENSOR_LIGHT = "android.hardware.sensor.light"; + field public static final java.lang.String FEATURE_SENSOR_PROXIMITY = "android.hardware.sensor.proximity"; + field public static final java.lang.String FEATURE_SIP = "android.software.sip"; + field public static final java.lang.String FEATURE_SIP_VOIP = "android.software.sip.voip"; + field public static final java.lang.String FEATURE_TELEPHONY = "android.hardware.telephony"; + field public static final java.lang.String FEATURE_TELEPHONY_CDMA = "android.hardware.telephony.cdma"; + field public static final java.lang.String FEATURE_TELEPHONY_GSM = "android.hardware.telephony.gsm"; + field public static final java.lang.String FEATURE_TELEVISION = "android.hardware.type.television"; + field public static final java.lang.String FEATURE_TOUCHSCREEN = "android.hardware.touchscreen"; + field public static final java.lang.String FEATURE_TOUCHSCREEN_MULTITOUCH = "android.hardware.touchscreen.multitouch"; + field public static final java.lang.String FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT = "android.hardware.touchscreen.multitouch.distinct"; + field public static final java.lang.String FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND = "android.hardware.touchscreen.multitouch.jazzhand"; + field public static final java.lang.String FEATURE_USB_ACCESSORY = "android.hardware.usb.accessory"; + field public static final java.lang.String FEATURE_USB_HOST = "android.hardware.usb.host"; + field public static final java.lang.String FEATURE_WIFI = "android.hardware.wifi"; + field public static final java.lang.String FEATURE_WIFI_DIRECT = "android.hardware.wifi.direct"; + field public static final int GET_ACTIVITIES = 1; // 0x1 + field public static final int GET_CONFIGURATIONS = 16384; // 0x4000 + field public static final int GET_DISABLED_COMPONENTS = 512; // 0x200 + field public static final int GET_GIDS = 256; // 0x100 + field public static final int GET_INSTRUMENTATION = 16; // 0x10 + field public static final int GET_INTENT_FILTERS = 32; // 0x20 + field public static final int GET_META_DATA = 128; // 0x80 + field public static final int GET_PERMISSIONS = 4096; // 0x1000 + field public static final int GET_PROVIDERS = 8; // 0x8 + field public static final int GET_RECEIVERS = 2; // 0x2 + field public static final int GET_RESOLVED_FILTER = 64; // 0x40 + field public static final int GET_SERVICES = 4; // 0x4 + field public static final int GET_SHARED_LIBRARY_FILES = 1024; // 0x400 + field public static final int GET_SIGNATURES = 64; // 0x40 + field public static final int GET_UNINSTALLED_PACKAGES = 8192; // 0x2000 + field public static final int GET_URI_PERMISSION_PATTERNS = 2048; // 0x800 + field public static final int MATCH_DEFAULT_ONLY = 65536; // 0x10000 + field public static final long MAXIMUM_VERIFICATION_TIMEOUT = 3600000L; // 0x36ee80L + field public static final int PERMISSION_DENIED = -1; // 0xffffffff + field public static final int PERMISSION_GRANTED = 0; // 0x0 + field public static final int SIGNATURE_FIRST_NOT_SIGNED = -1; // 0xffffffff + field public static final int SIGNATURE_MATCH = 0; // 0x0 + field public static final int SIGNATURE_NEITHER_SIGNED = 1; // 0x1 + field public static final int SIGNATURE_NO_MATCH = -3; // 0xfffffffd + field public static final int SIGNATURE_SECOND_NOT_SIGNED = -2; // 0xfffffffe + field public static final int SIGNATURE_UNKNOWN_PACKAGE = -4; // 0xfffffffc + field public static final int VERIFICATION_ALLOW = 1; // 0x1 + field public static final int VERIFICATION_REJECT = -1; // 0xffffffff + } + + public static class PackageManager.NameNotFoundException extends android.util.AndroidException { + ctor public PackageManager.NameNotFoundException(); + ctor public PackageManager.NameNotFoundException(java.lang.String); + } + + public class PackageStats implements android.os.Parcelable { + ctor public PackageStats(java.lang.String); + ctor public PackageStats(android.os.Parcel); + ctor public PackageStats(android.content.pm.PackageStats); + method public int describeContents(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + field public long cacheSize; + field public long codeSize; + field public long dataSize; + field public long externalCacheSize; + field public long externalCodeSize; + field public long externalDataSize; + field public long externalMediaSize; + field public long externalObbSize; + field public java.lang.String packageName; + } + + public class PathPermission extends android.os.PatternMatcher { + ctor public PathPermission(java.lang.String, int, java.lang.String, java.lang.String); + ctor public PathPermission(android.os.Parcel); + method public java.lang.String getReadPermission(); + method public java.lang.String getWritePermission(); + field public static final android.os.Parcelable.Creator CREATOR; + } + + public class PermissionGroupInfo extends android.content.pm.PackageItemInfo implements android.os.Parcelable { + ctor public PermissionGroupInfo(); + ctor public PermissionGroupInfo(android.content.pm.PermissionGroupInfo); + method public int describeContents(); + method public java.lang.CharSequence loadDescription(android.content.pm.PackageManager); + field public static final android.os.Parcelable.Creator CREATOR; + field public static final int FLAG_PERSONAL_INFO = 1; // 0x1 + field public int descriptionRes; + field public int flags; + field public java.lang.CharSequence nonLocalizedDescription; + field public int priority; + } + + public class PermissionInfo extends android.content.pm.PackageItemInfo implements android.os.Parcelable { + ctor public PermissionInfo(); + ctor public PermissionInfo(android.content.pm.PermissionInfo); + method public int describeContents(); + method public java.lang.CharSequence loadDescription(android.content.pm.PackageManager); + field public static final android.os.Parcelable.Creator CREATOR; + field public static final int FLAG_COSTS_MONEY = 1; // 0x1 + field public static final int PROTECTION_DANGEROUS = 1; // 0x1 + field public static final int PROTECTION_FLAG_DEVELOPMENT = 32; // 0x20 + field public static final int PROTECTION_FLAG_SYSTEM = 16; // 0x10 + field public static final int PROTECTION_MASK_BASE = 15; // 0xf + field public static final int PROTECTION_MASK_FLAGS = 240; // 0xf0 + field public static final int PROTECTION_NORMAL = 0; // 0x0 + field public static final int PROTECTION_SIGNATURE = 2; // 0x2 + field public static final int PROTECTION_SIGNATURE_OR_SYSTEM = 3; // 0x3 + field public int descriptionRes; + field public int flags; + field public java.lang.String group; + field public java.lang.CharSequence nonLocalizedDescription; + field public int protectionLevel; + } + + public final class ProviderInfo extends android.content.pm.ComponentInfo implements android.os.Parcelable { + ctor public ProviderInfo(); + ctor public ProviderInfo(android.content.pm.ProviderInfo); + method public int describeContents(); + field public static final android.os.Parcelable.Creator CREATOR; + field public static final int FLAG_SINGLE_USER = 1073741824; // 0x40000000 + field public java.lang.String authority; + field public int flags; + field public boolean grantUriPermissions; + field public int initOrder; + field public deprecated boolean isSyncable; + field public boolean multiprocess; + field public android.content.pm.PathPermission[] pathPermissions; + field public java.lang.String readPermission; + field public android.os.PatternMatcher[] uriPermissionPatterns; + field public java.lang.String writePermission; + } + + public class ResolveInfo implements android.os.Parcelable { + ctor public ResolveInfo(); + ctor public ResolveInfo(android.content.pm.ResolveInfo); + method public int describeContents(); + method public void dump(android.util.Printer, java.lang.String); + method public final int getIconResource(); + method public android.graphics.drawable.Drawable loadIcon(android.content.pm.PackageManager); + method public java.lang.CharSequence loadLabel(android.content.pm.PackageManager); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + field public android.content.pm.ActivityInfo activityInfo; + field public android.content.IntentFilter filter; + field public int icon; + field public boolean isDefault; + field public int labelRes; + field public int match; + field public java.lang.CharSequence nonLocalizedLabel; + field public int preferredOrder; + field public int priority; + field public java.lang.String resolvePackageName; + field public android.content.pm.ServiceInfo serviceInfo; + field public int specificIndex; + } + + public static class ResolveInfo.DisplayNameComparator implements java.util.Comparator { + ctor public ResolveInfo.DisplayNameComparator(android.content.pm.PackageManager); + method public final int compare(android.content.pm.ResolveInfo, android.content.pm.ResolveInfo); + } + + public class ServiceInfo extends android.content.pm.ComponentInfo implements android.os.Parcelable { + ctor public ServiceInfo(); + ctor public ServiceInfo(android.content.pm.ServiceInfo); + method public int describeContents(); + method public void dump(android.util.Printer, java.lang.String); + field public static final android.os.Parcelable.Creator CREATOR; + field public static final int FLAG_ISOLATED_PROCESS = 2; // 0x2 + field public static final int FLAG_SINGLE_USER = 1073741824; // 0x40000000 + field public static final int FLAG_STOP_WITH_TASK = 1; // 0x1 + field public int flags; + field public java.lang.String permission; + } + + public class Signature implements android.os.Parcelable { + ctor public Signature(byte[]); + ctor public Signature(java.lang.String); + method public int describeContents(); + method public byte[] toByteArray(); + method public char[] toChars(); + method public char[] toChars(char[], int[]); + method public java.lang.String toCharsString(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + } + +} + +package android.content.res { + + public class AssetFileDescriptor implements android.os.Parcelable { + ctor public AssetFileDescriptor(android.os.ParcelFileDescriptor, long, long); + method public void close() throws java.io.IOException; + method public java.io.FileInputStream createInputStream() throws java.io.IOException; + method public java.io.FileOutputStream createOutputStream() throws java.io.IOException; + method public int describeContents(); + method public long getDeclaredLength(); + method public java.io.FileDescriptor getFileDescriptor(); + method public long getLength(); + method public android.os.ParcelFileDescriptor getParcelFileDescriptor(); + method public long getStartOffset(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + field public static final long UNKNOWN_LENGTH = -1L; // 0xffffffffffffffffL + } + + public static class AssetFileDescriptor.AutoCloseInputStream extends android.os.ParcelFileDescriptor.AutoCloseInputStream { + ctor public AssetFileDescriptor.AutoCloseInputStream(android.content.res.AssetFileDescriptor) throws java.io.IOException; + } + + public static class AssetFileDescriptor.AutoCloseOutputStream extends android.os.ParcelFileDescriptor.AutoCloseOutputStream { + ctor public AssetFileDescriptor.AutoCloseOutputStream(android.content.res.AssetFileDescriptor) throws java.io.IOException; + } + + public final class AssetManager { + method public void close(); + method public final java.lang.String[] getLocales(); + method public final java.lang.String[] list(java.lang.String) throws java.io.IOException; + method public final java.io.InputStream open(java.lang.String) throws java.io.IOException; + method public final java.io.InputStream open(java.lang.String, int) throws java.io.IOException; + method public final android.content.res.AssetFileDescriptor openFd(java.lang.String) throws java.io.IOException; + method public final android.content.res.AssetFileDescriptor openNonAssetFd(java.lang.String) throws java.io.IOException; + method public final android.content.res.AssetFileDescriptor openNonAssetFd(int, java.lang.String) throws java.io.IOException; + method public final android.content.res.XmlResourceParser openXmlResourceParser(java.lang.String) throws java.io.IOException; + method public final android.content.res.XmlResourceParser openXmlResourceParser(int, java.lang.String) throws java.io.IOException; + field public static final int ACCESS_BUFFER = 3; // 0x3 + field public static final int ACCESS_RANDOM = 1; // 0x1 + field public static final int ACCESS_STREAMING = 2; // 0x2 + field public static final int ACCESS_UNKNOWN = 0; // 0x0 + } + + public final class AssetManager.AssetInputStream extends java.io.InputStream { + method public final int available() throws java.io.IOException; + method public final void close() throws java.io.IOException; + method public final int getAssetInt(); + method public final void mark(int); + method public final boolean markSupported(); + method public final int read() throws java.io.IOException; + method public final int read(byte[]) throws java.io.IOException; + method public final int read(byte[], int, int) throws java.io.IOException; + method public final void reset() throws java.io.IOException; + method public final long skip(long) throws java.io.IOException; + } + + public class ColorStateList implements android.os.Parcelable { + ctor public ColorStateList(int[][], int[]); + method public static android.content.res.ColorStateList createFromXml(android.content.res.Resources, org.xmlpull.v1.XmlPullParser) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException; + method public int describeContents(); + method public int getColorForState(int[], int); + method public int getDefaultColor(); + method public boolean isStateful(); + method public static android.content.res.ColorStateList valueOf(int); + method public android.content.res.ColorStateList withAlpha(int); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + } + + public final class Configuration implements java.lang.Comparable android.os.Parcelable { + ctor public Configuration(); + ctor public Configuration(android.content.res.Configuration); + method public int compareTo(android.content.res.Configuration); + method public int describeContents(); + method public int diff(android.content.res.Configuration); + method public boolean equals(android.content.res.Configuration); + method public int getLayoutDirection(); + method public boolean isLayoutSizeAtLeast(int); + method public static boolean needNewResources(int, int); + method public void readFromParcel(android.os.Parcel); + method public void setLayoutDirection(java.util.Locale); + method public void setLocale(java.util.Locale); + method public void setTo(android.content.res.Configuration); + method public void setToDefaults(); + method public int updateFrom(android.content.res.Configuration); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + field public static final int DENSITY_DPI_UNDEFINED = 0; // 0x0 + field public static final int HARDKEYBOARDHIDDEN_NO = 1; // 0x1 + field public static final int HARDKEYBOARDHIDDEN_UNDEFINED = 0; // 0x0 + field public static final int HARDKEYBOARDHIDDEN_YES = 2; // 0x2 + field public static final int KEYBOARDHIDDEN_NO = 1; // 0x1 + field public static final int KEYBOARDHIDDEN_UNDEFINED = 0; // 0x0 + field public static final int KEYBOARDHIDDEN_YES = 2; // 0x2 + field public static final int KEYBOARD_12KEY = 3; // 0x3 + field public static final int KEYBOARD_NOKEYS = 1; // 0x1 + field public static final int KEYBOARD_QWERTY = 2; // 0x2 + field public static final int KEYBOARD_UNDEFINED = 0; // 0x0 + field public static final int NAVIGATIONHIDDEN_NO = 1; // 0x1 + field public static final int NAVIGATIONHIDDEN_UNDEFINED = 0; // 0x0 + field public static final int NAVIGATIONHIDDEN_YES = 2; // 0x2 + field public static final int NAVIGATION_DPAD = 2; // 0x2 + field public static final int NAVIGATION_NONAV = 1; // 0x1 + field public static final int NAVIGATION_TRACKBALL = 3; // 0x3 + field public static final int NAVIGATION_UNDEFINED = 0; // 0x0 + field public static final int NAVIGATION_WHEEL = 4; // 0x4 + field public static final int ORIENTATION_LANDSCAPE = 2; // 0x2 + field public static final int ORIENTATION_PORTRAIT = 1; // 0x1 + field public static final deprecated int ORIENTATION_SQUARE = 3; // 0x3 + field public static final int ORIENTATION_UNDEFINED = 0; // 0x0 + field public static final int SCREENLAYOUT_LAYOUTDIR_LTR = 64; // 0x40 + field public static final int SCREENLAYOUT_LAYOUTDIR_MASK = 192; // 0xc0 + field public static final int SCREENLAYOUT_LAYOUTDIR_RTL = 128; // 0x80 + field public static final int SCREENLAYOUT_LAYOUTDIR_SHIFT = 6; // 0x6 + field public static final int SCREENLAYOUT_LAYOUTDIR_UNDEFINED = 0; // 0x0 + field public static final int SCREENLAYOUT_LONG_MASK = 48; // 0x30 + field public static final int SCREENLAYOUT_LONG_NO = 16; // 0x10 + field public static final int SCREENLAYOUT_LONG_UNDEFINED = 0; // 0x0 + field public static final int SCREENLAYOUT_LONG_YES = 32; // 0x20 + field public static final int SCREENLAYOUT_SIZE_LARGE = 3; // 0x3 + field public static final int SCREENLAYOUT_SIZE_MASK = 15; // 0xf + field public static final int SCREENLAYOUT_SIZE_NORMAL = 2; // 0x2 + field public static final int SCREENLAYOUT_SIZE_SMALL = 1; // 0x1 + field public static final int SCREENLAYOUT_SIZE_UNDEFINED = 0; // 0x0 + field public static final int SCREENLAYOUT_SIZE_XLARGE = 4; // 0x4 + field public static final int SCREENLAYOUT_UNDEFINED = 0; // 0x0 + field public static final int SCREEN_HEIGHT_DP_UNDEFINED = 0; // 0x0 + field public static final int SCREEN_WIDTH_DP_UNDEFINED = 0; // 0x0 + field public static final int SMALLEST_SCREEN_WIDTH_DP_UNDEFINED = 0; // 0x0 + field public static final int TOUCHSCREEN_FINGER = 3; // 0x3 + field public static final int TOUCHSCREEN_NOTOUCH = 1; // 0x1 + field public static final deprecated int TOUCHSCREEN_STYLUS = 2; // 0x2 + field public static final int TOUCHSCREEN_UNDEFINED = 0; // 0x0 + field public static final int UI_MODE_NIGHT_MASK = 48; // 0x30 + field public static final int UI_MODE_NIGHT_NO = 16; // 0x10 + field public static final int UI_MODE_NIGHT_UNDEFINED = 0; // 0x0 + field public static final int UI_MODE_NIGHT_YES = 32; // 0x20 + field public static final int UI_MODE_TYPE_APPLIANCE = 5; // 0x5 + field public static final int UI_MODE_TYPE_CAR = 3; // 0x3 + field public static final int UI_MODE_TYPE_DESK = 2; // 0x2 + field public static final int UI_MODE_TYPE_MASK = 15; // 0xf + field public static final int UI_MODE_TYPE_NORMAL = 1; // 0x1 + field public static final int UI_MODE_TYPE_TELEVISION = 4; // 0x4 + field public static final int UI_MODE_TYPE_UNDEFINED = 0; // 0x0 + field public int densityDpi; + field public float fontScale; + field public int hardKeyboardHidden; + field public int keyboard; + field public int keyboardHidden; + field public java.util.Locale locale; + field public int mcc; + field public int mnc; + field public int navigation; + field public int navigationHidden; + field public int orientation; + field public int screenHeightDp; + field public int screenLayout; + field public int screenWidthDp; + field public int smallestScreenWidthDp; + field public int touchscreen; + field public int uiMode; + } + + public class ObbInfo implements android.os.Parcelable { + method public int describeContents(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + field public static final int OBB_OVERLAY = 1; // 0x1 + field public java.lang.String filename; + field public int flags; + field public java.lang.String packageName; + field public int version; + } + + public class ObbScanner { + method public static android.content.res.ObbInfo getObbInfo(java.lang.String) throws java.io.IOException; + } + + public class Resources { + ctor public Resources(android.content.res.AssetManager, android.util.DisplayMetrics, android.content.res.Configuration); + method public final void finishPreloading(); + method public final void flushLayoutCache(); + method public android.content.res.XmlResourceParser getAnimation(int) throws android.content.res.Resources.NotFoundException; + method public final android.content.res.AssetManager getAssets(); + method public boolean getBoolean(int) throws android.content.res.Resources.NotFoundException; + method public int getColor(int) throws android.content.res.Resources.NotFoundException; + method public android.content.res.ColorStateList getColorStateList(int) throws android.content.res.Resources.NotFoundException; + method public android.content.res.Configuration getConfiguration(); + method public float getDimension(int) throws android.content.res.Resources.NotFoundException; + method public int getDimensionPixelOffset(int) throws android.content.res.Resources.NotFoundException; + method public int getDimensionPixelSize(int) throws android.content.res.Resources.NotFoundException; + method public android.util.DisplayMetrics getDisplayMetrics(); + method public android.graphics.drawable.Drawable getDrawable(int) throws android.content.res.Resources.NotFoundException; + method public android.graphics.drawable.Drawable getDrawableForDensity(int, int) throws android.content.res.Resources.NotFoundException; + method public float getFraction(int, int, int); + method public int getIdentifier(java.lang.String, java.lang.String, java.lang.String); + method public int[] getIntArray(int) throws android.content.res.Resources.NotFoundException; + method public int getInteger(int) throws android.content.res.Resources.NotFoundException; + method public android.content.res.XmlResourceParser getLayout(int) throws android.content.res.Resources.NotFoundException; + method public android.graphics.Movie getMovie(int) throws android.content.res.Resources.NotFoundException; + method public java.lang.String getQuantityString(int, int, java.lang.Object...) throws android.content.res.Resources.NotFoundException; + method public java.lang.String getQuantityString(int, int) throws android.content.res.Resources.NotFoundException; + method public java.lang.CharSequence getQuantityText(int, int) throws android.content.res.Resources.NotFoundException; + method public java.lang.String getResourceEntryName(int) throws android.content.res.Resources.NotFoundException; + method public java.lang.String getResourceName(int) throws android.content.res.Resources.NotFoundException; + method public java.lang.String getResourcePackageName(int) throws android.content.res.Resources.NotFoundException; + method public java.lang.String getResourceTypeName(int) throws android.content.res.Resources.NotFoundException; + method public java.lang.String getString(int) throws android.content.res.Resources.NotFoundException; + method public java.lang.String getString(int, java.lang.Object...) throws android.content.res.Resources.NotFoundException; + method public java.lang.String[] getStringArray(int) throws android.content.res.Resources.NotFoundException; + method public static android.content.res.Resources getSystem(); + method public java.lang.CharSequence getText(int) throws android.content.res.Resources.NotFoundException; + method public java.lang.CharSequence getText(int, java.lang.CharSequence); + method public java.lang.CharSequence[] getTextArray(int) throws android.content.res.Resources.NotFoundException; + method public void getValue(int, android.util.TypedValue, boolean) throws android.content.res.Resources.NotFoundException; + method public void getValue(java.lang.String, android.util.TypedValue, boolean) throws android.content.res.Resources.NotFoundException; + method public void getValueForDensity(int, int, android.util.TypedValue, boolean) throws android.content.res.Resources.NotFoundException; + method public android.content.res.XmlResourceParser getXml(int) throws android.content.res.Resources.NotFoundException; + method public final android.content.res.Resources.Theme newTheme(); + method public android.content.res.TypedArray obtainAttributes(android.util.AttributeSet, int[]); + method public android.content.res.TypedArray obtainTypedArray(int) throws android.content.res.Resources.NotFoundException; + method public java.io.InputStream openRawResource(int) throws android.content.res.Resources.NotFoundException; + method public java.io.InputStream openRawResource(int, android.util.TypedValue) throws android.content.res.Resources.NotFoundException; + method public android.content.res.AssetFileDescriptor openRawResourceFd(int) throws android.content.res.Resources.NotFoundException; + method public void parseBundleExtra(java.lang.String, android.util.AttributeSet, android.os.Bundle) throws org.xmlpull.v1.XmlPullParserException; + method public void parseBundleExtras(android.content.res.XmlResourceParser, android.os.Bundle) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException; + method public void updateConfiguration(android.content.res.Configuration, android.util.DisplayMetrics); + } + + public static class Resources.NotFoundException extends java.lang.RuntimeException { + ctor public Resources.NotFoundException(); + ctor public Resources.NotFoundException(java.lang.String); + } + + public final class Resources.Theme { + method public void applyStyle(int, boolean); + method public void dump(int, java.lang.String, java.lang.String); + method public android.content.res.TypedArray obtainStyledAttributes(int[]); + method public android.content.res.TypedArray obtainStyledAttributes(int, int[]) throws android.content.res.Resources.NotFoundException; + method public android.content.res.TypedArray obtainStyledAttributes(android.util.AttributeSet, int[], int, int); + method public boolean resolveAttribute(int, android.util.TypedValue, boolean); + method public void setTo(android.content.res.Resources.Theme); + } + + public class TypedArray { + method public boolean getBoolean(int, boolean); + method public int getColor(int, int); + method public android.content.res.ColorStateList getColorStateList(int); + method public float getDimension(int, float); + method public int getDimensionPixelOffset(int, int); + method public int getDimensionPixelSize(int, int); + method public android.graphics.drawable.Drawable getDrawable(int); + method public float getFloat(int, float); + method public float getFraction(int, int, int, float); + method public int getIndex(int); + method public int getIndexCount(); + method public int getInt(int, int); + method public int getInteger(int, int); + method public int getLayoutDimension(int, java.lang.String); + method public int getLayoutDimension(int, int); + method public java.lang.String getNonResourceString(int); + method public java.lang.String getPositionDescription(); + method public int getResourceId(int, int); + method public android.content.res.Resources getResources(); + method public java.lang.String getString(int); + method public java.lang.CharSequence getText(int); + method public java.lang.CharSequence[] getTextArray(int); + method public boolean getValue(int, android.util.TypedValue); + method public boolean hasValue(int); + method public int length(); + method public android.util.TypedValue peekValue(int); + method public void recycle(); + } + + public abstract interface XmlResourceParser implements android.util.AttributeSet org.xmlpull.v1.XmlPullParser { + method public abstract void close(); + } + +} + +package android.database { + + public abstract class AbstractCursor implements android.database.CrossProcessCursor { + ctor public AbstractCursor(); + method protected void checkPosition(); + method public void close(); + method public void copyStringToBuffer(int, android.database.CharArrayBuffer); + method public void deactivate(); + method public void fillWindow(int, android.database.CursorWindow); + method public byte[] getBlob(int); + method public int getColumnCount(); + method public int getColumnIndex(java.lang.String); + method public int getColumnIndexOrThrow(java.lang.String); + method public java.lang.String getColumnName(int); + method public abstract java.lang.String[] getColumnNames(); + method public abstract int getCount(); + method public abstract double getDouble(int); + method public android.os.Bundle getExtras(); + method public abstract float getFloat(int); + method public abstract int getInt(int); + method public abstract long getLong(int); + method public android.net.Uri getNotificationUri(); + method public final int getPosition(); + method public abstract short getShort(int); + method public abstract java.lang.String getString(int); + method public int getType(int); + method protected deprecated java.lang.Object getUpdatedField(int); + method public boolean getWantsAllOnMoveCalls(); + method public android.database.CursorWindow getWindow(); + method public final boolean isAfterLast(); + method public final boolean isBeforeFirst(); + method public boolean isClosed(); + method protected deprecated boolean isFieldUpdated(int); + method public final boolean isFirst(); + method public final boolean isLast(); + method public abstract boolean isNull(int); + method public final boolean move(int); + method public final boolean moveToFirst(); + method public final boolean moveToLast(); + method public final boolean moveToNext(); + method public final boolean moveToPosition(int); + method public final boolean moveToPrevious(); + method protected void onChange(boolean); + method public boolean onMove(int, int); + method public void registerContentObserver(android.database.ContentObserver); + method public void registerDataSetObserver(android.database.DataSetObserver); + method public boolean requery(); + method public android.os.Bundle respond(android.os.Bundle); + method public void setNotificationUri(android.content.ContentResolver, android.net.Uri); + method public void unregisterContentObserver(android.database.ContentObserver); + method public void unregisterDataSetObserver(android.database.DataSetObserver); + field protected boolean mClosed; + field protected android.content.ContentResolver mContentResolver; + field protected deprecated java.lang.Long mCurrentRowID; + field protected int mPos; + field protected deprecated int mRowIdColumnIndex; + field protected deprecated java.util.HashMap mUpdatedRows; + } + + protected static class AbstractCursor.SelfContentObserver extends android.database.ContentObserver { + ctor public AbstractCursor.SelfContentObserver(android.database.AbstractCursor); + } + + public abstract class AbstractWindowedCursor extends android.database.AbstractCursor { + ctor public AbstractWindowedCursor(); + method public double getDouble(int); + method public float getFloat(int); + method public int getInt(int); + method public long getLong(int); + method public short getShort(int); + method public java.lang.String getString(int); + method public boolean hasWindow(); + method public deprecated boolean isBlob(int); + method public deprecated boolean isFloat(int); + method public deprecated boolean isLong(int); + method public boolean isNull(int); + method public deprecated boolean isString(int); + method public void setWindow(android.database.CursorWindow); + field protected android.database.CursorWindow mWindow; + } + + public final class CharArrayBuffer { + ctor public CharArrayBuffer(int); + ctor public CharArrayBuffer(char[]); + field public char[] data; + field public int sizeCopied; + } + + public class ContentObservable extends android.database.Observable { + ctor public ContentObservable(); + method public deprecated void dispatchChange(boolean); + method public void dispatchChange(boolean, android.net.Uri); + method public deprecated void notifyChange(boolean); + method public void registerObserver(android.database.ContentObserver); + } + + public abstract class ContentObserver { + ctor public ContentObserver(android.os.Handler); + method public boolean deliverSelfNotifications(); + method public final deprecated void dispatchChange(boolean); + method public final void dispatchChange(boolean, android.net.Uri); + method public void onChange(boolean); + method public void onChange(boolean, android.net.Uri); + } + + public abstract interface CrossProcessCursor implements android.database.Cursor { + method public abstract void fillWindow(int, android.database.CursorWindow); + method public abstract android.database.CursorWindow getWindow(); + method public abstract boolean onMove(int, int); + } + + public class CrossProcessCursorWrapper extends android.database.CursorWrapper implements android.database.CrossProcessCursor { + ctor public CrossProcessCursorWrapper(android.database.Cursor); + method public void fillWindow(int, android.database.CursorWindow); + method public android.database.CursorWindow getWindow(); + method public boolean onMove(int, int); + } + + public abstract interface Cursor implements java.io.Closeable { + method public abstract void close(); + method public abstract void copyStringToBuffer(int, android.database.CharArrayBuffer); + method public abstract deprecated void deactivate(); + method public abstract byte[] getBlob(int); + method public abstract int getColumnCount(); + method public abstract int getColumnIndex(java.lang.String); + method public abstract int getColumnIndexOrThrow(java.lang.String) throws java.lang.IllegalArgumentException; + method public abstract java.lang.String getColumnName(int); + method public abstract java.lang.String[] getColumnNames(); + method public abstract int getCount(); + method public abstract double getDouble(int); + method public abstract android.os.Bundle getExtras(); + method public abstract float getFloat(int); + method public abstract int getInt(int); + method public abstract long getLong(int); + method public abstract int getPosition(); + method public abstract short getShort(int); + method public abstract java.lang.String getString(int); + method public abstract int getType(int); + method public abstract boolean getWantsAllOnMoveCalls(); + method public abstract boolean isAfterLast(); + method public abstract boolean isBeforeFirst(); + method public abstract boolean isClosed(); + method public abstract boolean isFirst(); + method public abstract boolean isLast(); + method public abstract boolean isNull(int); + method public abstract boolean move(int); + method public abstract boolean moveToFirst(); + method public abstract boolean moveToLast(); + method public abstract boolean moveToNext(); + method public abstract boolean moveToPosition(int); + method public abstract boolean moveToPrevious(); + method public abstract void registerContentObserver(android.database.ContentObserver); + method public abstract void registerDataSetObserver(android.database.DataSetObserver); + method public abstract deprecated boolean requery(); + method public abstract android.os.Bundle respond(android.os.Bundle); + method public abstract void setNotificationUri(android.content.ContentResolver, android.net.Uri); + method public abstract void unregisterContentObserver(android.database.ContentObserver); + method public abstract void unregisterDataSetObserver(android.database.DataSetObserver); + field public static final int FIELD_TYPE_BLOB = 4; // 0x4 + field public static final int FIELD_TYPE_FLOAT = 2; // 0x2 + field public static final int FIELD_TYPE_INTEGER = 1; // 0x1 + field public static final int FIELD_TYPE_NULL = 0; // 0x0 + field public static final int FIELD_TYPE_STRING = 3; // 0x3 + } + + public class CursorIndexOutOfBoundsException extends java.lang.IndexOutOfBoundsException { + ctor public CursorIndexOutOfBoundsException(int, int); + ctor public CursorIndexOutOfBoundsException(java.lang.String); + } + + public final class CursorJoiner implements java.lang.Iterable java.util.Iterator { + ctor public CursorJoiner(android.database.Cursor, java.lang.String[], android.database.Cursor, java.lang.String[]); + method public boolean hasNext(); + method public java.util.Iterator iterator(); + method public android.database.CursorJoiner.Result next(); + method public void remove(); + } + + public static final class CursorJoiner.Result extends java.lang.Enum { + method public static android.database.CursorJoiner.Result valueOf(java.lang.String); + method public static final android.database.CursorJoiner.Result[] values(); + enum_constant public static final android.database.CursorJoiner.Result BOTH; + enum_constant public static final android.database.CursorJoiner.Result LEFT; + enum_constant public static final android.database.CursorJoiner.Result RIGHT; + } + + public class CursorWindow extends android.database.sqlite.SQLiteClosable implements android.os.Parcelable { + ctor public CursorWindow(java.lang.String); + ctor public deprecated CursorWindow(boolean); + method public boolean allocRow(); + method public void clear(); + method public void copyStringToBuffer(int, int, android.database.CharArrayBuffer); + method public int describeContents(); + method public void freeLastRow(); + method public byte[] getBlob(int, int); + method public double getDouble(int, int); + method public float getFloat(int, int); + method public int getInt(int, int); + method public long getLong(int, int); + method public int getNumRows(); + method public short getShort(int, int); + method public int getStartPosition(); + method public java.lang.String getString(int, int); + method public int getType(int, int); + method public deprecated boolean isBlob(int, int); + method public deprecated boolean isFloat(int, int); + method public deprecated boolean isLong(int, int); + method public deprecated boolean isNull(int, int); + method public deprecated boolean isString(int, int); + method public static android.database.CursorWindow newFromParcel(android.os.Parcel); + method protected void onAllReferencesReleased(); + method public boolean putBlob(byte[], int, int); + method public boolean putDouble(double, int, int); + method public boolean putLong(long, int, int); + method public boolean putNull(int, int); + method public boolean putString(java.lang.String, int, int); + method public boolean setNumColumns(int); + method public void setStartPosition(int); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + } + + public class CursorWrapper implements android.database.Cursor { + ctor public CursorWrapper(android.database.Cursor); + method public void close(); + method public void copyStringToBuffer(int, android.database.CharArrayBuffer); + method public void deactivate(); + method public byte[] getBlob(int); + method public int getColumnCount(); + method public int getColumnIndex(java.lang.String); + method public int getColumnIndexOrThrow(java.lang.String) throws java.lang.IllegalArgumentException; + method public java.lang.String getColumnName(int); + method public java.lang.String[] getColumnNames(); + method public int getCount(); + method public double getDouble(int); + method public android.os.Bundle getExtras(); + method public float getFloat(int); + method public int getInt(int); + method public long getLong(int); + method public int getPosition(); + method public short getShort(int); + method public java.lang.String getString(int); + method public int getType(int); + method public boolean getWantsAllOnMoveCalls(); + method public android.database.Cursor getWrappedCursor(); + method public boolean isAfterLast(); + method public boolean isBeforeFirst(); + method public boolean isClosed(); + method public boolean isFirst(); + method public boolean isLast(); + method public boolean isNull(int); + method public boolean move(int); + method public boolean moveToFirst(); + method public boolean moveToLast(); + method public boolean moveToNext(); + method public boolean moveToPosition(int); + method public boolean moveToPrevious(); + method public void registerContentObserver(android.database.ContentObserver); + method public void registerDataSetObserver(android.database.DataSetObserver); + method public boolean requery(); + method public android.os.Bundle respond(android.os.Bundle); + method public void setNotificationUri(android.content.ContentResolver, android.net.Uri); + method public void unregisterContentObserver(android.database.ContentObserver); + method public void unregisterDataSetObserver(android.database.DataSetObserver); + } + + public class DataSetObservable extends android.database.Observable { + ctor public DataSetObservable(); + method public void notifyChanged(); + method public void notifyInvalidated(); + } + + public abstract class DataSetObserver { + ctor public DataSetObserver(); + method public void onChanged(); + method public void onInvalidated(); + } + + public abstract interface DatabaseErrorHandler { + method public abstract void onCorruption(android.database.sqlite.SQLiteDatabase); + } + + public class DatabaseUtils { + ctor public DatabaseUtils(); + method public static void appendEscapedSQLString(java.lang.StringBuilder, java.lang.String); + method public static java.lang.String[] appendSelectionArgs(java.lang.String[], java.lang.String[]); + method public static final void appendValueToSql(java.lang.StringBuilder, java.lang.Object); + method public static void bindObjectToProgram(android.database.sqlite.SQLiteProgram, int, java.lang.Object); + method public static android.os.ParcelFileDescriptor blobFileDescriptorForQuery(android.database.sqlite.SQLiteDatabase, java.lang.String, java.lang.String[]); + method public static android.os.ParcelFileDescriptor blobFileDescriptorForQuery(android.database.sqlite.SQLiteStatement, java.lang.String[]); + method public static java.lang.String concatenateWhere(java.lang.String, java.lang.String); + method public static void createDbFromSqlStatements(android.content.Context, java.lang.String, int, java.lang.String); + method public static void cursorDoubleToContentValues(android.database.Cursor, java.lang.String, android.content.ContentValues, java.lang.String); + method public static void cursorDoubleToContentValuesIfPresent(android.database.Cursor, android.content.ContentValues, java.lang.String); + method public static void cursorDoubleToCursorValues(android.database.Cursor, java.lang.String, android.content.ContentValues); + method public static void cursorFloatToContentValuesIfPresent(android.database.Cursor, android.content.ContentValues, java.lang.String); + method public static void cursorIntToContentValues(android.database.Cursor, java.lang.String, android.content.ContentValues); + method public static void cursorIntToContentValues(android.database.Cursor, java.lang.String, android.content.ContentValues, java.lang.String); + method public static void cursorIntToContentValuesIfPresent(android.database.Cursor, android.content.ContentValues, java.lang.String); + method public static void cursorLongToContentValues(android.database.Cursor, java.lang.String, android.content.ContentValues); + method public static void cursorLongToContentValues(android.database.Cursor, java.lang.String, android.content.ContentValues, java.lang.String); + method public static void cursorLongToContentValuesIfPresent(android.database.Cursor, android.content.ContentValues, java.lang.String); + method public static void cursorRowToContentValues(android.database.Cursor, android.content.ContentValues); + method public static void cursorShortToContentValuesIfPresent(android.database.Cursor, android.content.ContentValues, java.lang.String); + method public static void cursorStringToContentValues(android.database.Cursor, java.lang.String, android.content.ContentValues); + method public static void cursorStringToContentValues(android.database.Cursor, java.lang.String, android.content.ContentValues, java.lang.String); + method public static void cursorStringToContentValuesIfPresent(android.database.Cursor, android.content.ContentValues, java.lang.String); + method public static void cursorStringToInsertHelper(android.database.Cursor, java.lang.String, android.database.DatabaseUtils.InsertHelper, int); + method public static void dumpCurrentRow(android.database.Cursor); + method public static void dumpCurrentRow(android.database.Cursor, java.io.PrintStream); + method public static void dumpCurrentRow(android.database.Cursor, java.lang.StringBuilder); + method public static java.lang.String dumpCurrentRowToString(android.database.Cursor); + method public static void dumpCursor(android.database.Cursor); + method public static void dumpCursor(android.database.Cursor, java.io.PrintStream); + method public static void dumpCursor(android.database.Cursor, java.lang.StringBuilder); + method public static java.lang.String dumpCursorToString(android.database.Cursor); + method public static java.lang.String getCollationKey(java.lang.String); + method public static java.lang.String getHexCollationKey(java.lang.String); + method public static int getSqlStatementType(java.lang.String); + method public static long longForQuery(android.database.sqlite.SQLiteDatabase, java.lang.String, java.lang.String[]); + method public static long longForQuery(android.database.sqlite.SQLiteStatement, java.lang.String[]); + method public static long queryNumEntries(android.database.sqlite.SQLiteDatabase, java.lang.String); + method public static long queryNumEntries(android.database.sqlite.SQLiteDatabase, java.lang.String, java.lang.String); + method public static long queryNumEntries(android.database.sqlite.SQLiteDatabase, java.lang.String, java.lang.String, java.lang.String[]); + method public static final void readExceptionFromParcel(android.os.Parcel); + method public static void readExceptionWithFileNotFoundExceptionFromParcel(android.os.Parcel) throws java.io.FileNotFoundException; + method public static void readExceptionWithOperationApplicationExceptionFromParcel(android.os.Parcel) throws android.content.OperationApplicationException; + method public static java.lang.String sqlEscapeString(java.lang.String); + method public static java.lang.String stringForQuery(android.database.sqlite.SQLiteDatabase, java.lang.String, java.lang.String[]); + method public static java.lang.String stringForQuery(android.database.sqlite.SQLiteStatement, java.lang.String[]); + method public static final void writeExceptionToParcel(android.os.Parcel, java.lang.Exception); + field public static final int STATEMENT_ABORT = 6; // 0x6 + field public static final int STATEMENT_ATTACH = 3; // 0x3 + field public static final int STATEMENT_BEGIN = 4; // 0x4 + field public static final int STATEMENT_COMMIT = 5; // 0x5 + field public static final int STATEMENT_DDL = 8; // 0x8 + field public static final int STATEMENT_OTHER = 99; // 0x63 + field public static final int STATEMENT_PRAGMA = 7; // 0x7 + field public static final int STATEMENT_SELECT = 1; // 0x1 + field public static final int STATEMENT_UNPREPARED = 9; // 0x9 + field public static final int STATEMENT_UPDATE = 2; // 0x2 + } + + public static deprecated class DatabaseUtils.InsertHelper { + ctor public DatabaseUtils.InsertHelper(android.database.sqlite.SQLiteDatabase, java.lang.String); + method public void bind(int, double); + method public void bind(int, float); + method public void bind(int, long); + method public void bind(int, int); + method public void bind(int, boolean); + method public void bind(int, byte[]); + method public void bind(int, java.lang.String); + method public void bindNull(int); + method public void close(); + method public long execute(); + method public int getColumnIndex(java.lang.String); + method public long insert(android.content.ContentValues); + method public void prepareForInsert(); + method public void prepareForReplace(); + method public long replace(android.content.ContentValues); + } + + public final class DefaultDatabaseErrorHandler implements android.database.DatabaseErrorHandler { + ctor public DefaultDatabaseErrorHandler(); + method public void onCorruption(android.database.sqlite.SQLiteDatabase); + } + + public class MatrixCursor extends android.database.AbstractCursor { + ctor public MatrixCursor(java.lang.String[], int); + ctor public MatrixCursor(java.lang.String[]); + method public void addRow(java.lang.Object[]); + method public void addRow(java.lang.Iterable); + method public java.lang.String[] getColumnNames(); + method public int getCount(); + method public double getDouble(int); + method public float getFloat(int); + method public int getInt(int); + method public long getLong(int); + method public short getShort(int); + method public java.lang.String getString(int); + method public boolean isNull(int); + method public android.database.MatrixCursor.RowBuilder newRow(); + } + + public class MatrixCursor.RowBuilder { + method public android.database.MatrixCursor.RowBuilder add(java.lang.Object); + } + + public class MergeCursor extends android.database.AbstractCursor { + ctor public MergeCursor(android.database.Cursor[]); + method public java.lang.String[] getColumnNames(); + method public int getCount(); + method public double getDouble(int); + method public float getFloat(int); + method public int getInt(int); + method public long getLong(int); + method public short getShort(int); + method public java.lang.String getString(int); + method public boolean isNull(int); + } + + public abstract class Observable { + ctor public Observable(); + method public void registerObserver(T); + method public void unregisterAll(); + method public void unregisterObserver(T); + field protected final java.util.ArrayList mObservers; + } + + public class SQLException extends java.lang.RuntimeException { + ctor public SQLException(); + ctor public SQLException(java.lang.String); + ctor public SQLException(java.lang.String, java.lang.Throwable); + } + + public class StaleDataException extends java.lang.RuntimeException { + ctor public StaleDataException(); + ctor public StaleDataException(java.lang.String); + } + +} + +package android.database.sqlite { + + public class SQLiteAbortException extends android.database.sqlite.SQLiteException { + ctor public SQLiteAbortException(); + ctor public SQLiteAbortException(java.lang.String); + } + + public class SQLiteAccessPermException extends android.database.sqlite.SQLiteException { + ctor public SQLiteAccessPermException(); + ctor public SQLiteAccessPermException(java.lang.String); + } + + public class SQLiteBindOrColumnIndexOutOfRangeException extends android.database.sqlite.SQLiteException { + ctor public SQLiteBindOrColumnIndexOutOfRangeException(); + ctor public SQLiteBindOrColumnIndexOutOfRangeException(java.lang.String); + } + + public class SQLiteBlobTooBigException extends android.database.sqlite.SQLiteException { + ctor public SQLiteBlobTooBigException(); + ctor public SQLiteBlobTooBigException(java.lang.String); + } + + public class SQLiteCantOpenDatabaseException extends android.database.sqlite.SQLiteException { + ctor public SQLiteCantOpenDatabaseException(); + ctor public SQLiteCantOpenDatabaseException(java.lang.String); + } + + public abstract class SQLiteClosable implements java.io.Closeable { + ctor public SQLiteClosable(); + method public void acquireReference(); + method public void close(); + method protected abstract void onAllReferencesReleased(); + method protected deprecated void onAllReferencesReleasedFromContainer(); + method public void releaseReference(); + method public deprecated void releaseReferenceFromContainer(); + } + + public class SQLiteConstraintException extends android.database.sqlite.SQLiteException { + ctor public SQLiteConstraintException(); + ctor public SQLiteConstraintException(java.lang.String); + } + + public class SQLiteCursor extends android.database.AbstractWindowedCursor { + ctor public deprecated SQLiteCursor(android.database.sqlite.SQLiteDatabase, android.database.sqlite.SQLiteCursorDriver, java.lang.String, android.database.sqlite.SQLiteQuery); + ctor public SQLiteCursor(android.database.sqlite.SQLiteCursorDriver, java.lang.String, android.database.sqlite.SQLiteQuery); + method public java.lang.String[] getColumnNames(); + method public int getCount(); + method public android.database.sqlite.SQLiteDatabase getDatabase(); + method public void setSelectionArguments(java.lang.String[]); + } + + public abstract interface SQLiteCursorDriver { + method public abstract void cursorClosed(); + method public abstract void cursorDeactivated(); + method public abstract void cursorRequeried(android.database.Cursor); + method public abstract android.database.Cursor query(android.database.sqlite.SQLiteDatabase.CursorFactory, java.lang.String[]); + method public abstract void setBindArguments(java.lang.String[]); + } + + public final class SQLiteDatabase extends android.database.sqlite.SQLiteClosable { + method public void beginTransaction(); + method public void beginTransactionNonExclusive(); + method public void beginTransactionWithListener(android.database.sqlite.SQLiteTransactionListener); + method public void beginTransactionWithListenerNonExclusive(android.database.sqlite.SQLiteTransactionListener); + method public android.database.sqlite.SQLiteStatement compileStatement(java.lang.String) throws android.database.SQLException; + method public static android.database.sqlite.SQLiteDatabase create(android.database.sqlite.SQLiteDatabase.CursorFactory); + method public int delete(java.lang.String, java.lang.String, java.lang.String[]); + method public static boolean deleteDatabase(java.io.File); + method public void disableWriteAheadLogging(); + method public boolean enableWriteAheadLogging(); + method public void endTransaction(); + method public void execSQL(java.lang.String) throws android.database.SQLException; + method public void execSQL(java.lang.String, java.lang.Object[]) throws android.database.SQLException; + method public static java.lang.String findEditTable(java.lang.String); + method public java.util.List> getAttachedDbs(); + method public long getMaximumSize(); + method public long getPageSize(); + method public final java.lang.String getPath(); + method public deprecated java.util.Map getSyncedTables(); + method public int getVersion(); + method public boolean inTransaction(); + method public long insert(java.lang.String, java.lang.String, android.content.ContentValues); + method public long insertOrThrow(java.lang.String, java.lang.String, android.content.ContentValues) throws android.database.SQLException; + method public long insertWithOnConflict(java.lang.String, java.lang.String, android.content.ContentValues, int); + method public boolean isDatabaseIntegrityOk(); + method public boolean isDbLockedByCurrentThread(); + method public deprecated boolean isDbLockedByOtherThreads(); + method public boolean isOpen(); + method public boolean isReadOnly(); + method public boolean isWriteAheadLoggingEnabled(); + method public deprecated void markTableSyncable(java.lang.String, java.lang.String); + method public deprecated void markTableSyncable(java.lang.String, java.lang.String, java.lang.String); + method public boolean needUpgrade(int); + method protected void onAllReferencesReleased(); + method public static android.database.sqlite.SQLiteDatabase openDatabase(java.lang.String, android.database.sqlite.SQLiteDatabase.CursorFactory, int); + method public static android.database.sqlite.SQLiteDatabase openDatabase(java.lang.String, android.database.sqlite.SQLiteDatabase.CursorFactory, int, android.database.DatabaseErrorHandler); + method public static android.database.sqlite.SQLiteDatabase openOrCreateDatabase(java.io.File, android.database.sqlite.SQLiteDatabase.CursorFactory); + method public static android.database.sqlite.SQLiteDatabase openOrCreateDatabase(java.lang.String, android.database.sqlite.SQLiteDatabase.CursorFactory); + method public static android.database.sqlite.SQLiteDatabase openOrCreateDatabase(java.lang.String, android.database.sqlite.SQLiteDatabase.CursorFactory, android.database.DatabaseErrorHandler); + method public android.database.Cursor query(boolean, java.lang.String, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String, java.lang.String, java.lang.String, java.lang.String); + method public android.database.Cursor query(boolean, java.lang.String, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String, java.lang.String, java.lang.String, java.lang.String, android.os.CancellationSignal); + method public android.database.Cursor query(java.lang.String, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String, java.lang.String, java.lang.String); + method public android.database.Cursor query(java.lang.String, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String, java.lang.String, java.lang.String, java.lang.String); + method public android.database.Cursor queryWithFactory(android.database.sqlite.SQLiteDatabase.CursorFactory, boolean, java.lang.String, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String, java.lang.String, java.lang.String, java.lang.String); + method public android.database.Cursor queryWithFactory(android.database.sqlite.SQLiteDatabase.CursorFactory, boolean, java.lang.String, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String, java.lang.String, java.lang.String, java.lang.String, android.os.CancellationSignal); + method public android.database.Cursor rawQuery(java.lang.String, java.lang.String[]); + method public android.database.Cursor rawQuery(java.lang.String, java.lang.String[], android.os.CancellationSignal); + method public android.database.Cursor rawQueryWithFactory(android.database.sqlite.SQLiteDatabase.CursorFactory, java.lang.String, java.lang.String[], java.lang.String); + method public android.database.Cursor rawQueryWithFactory(android.database.sqlite.SQLiteDatabase.CursorFactory, java.lang.String, java.lang.String[], java.lang.String, android.os.CancellationSignal); + method public static int releaseMemory(); + method public long replace(java.lang.String, java.lang.String, android.content.ContentValues); + method public long replaceOrThrow(java.lang.String, java.lang.String, android.content.ContentValues) throws android.database.SQLException; + method public void setForeignKeyConstraintsEnabled(boolean); + method public void setLocale(java.util.Locale); + method public deprecated void setLockingEnabled(boolean); + method public void setMaxSqlCacheSize(int); + method public long setMaximumSize(long); + method public void setPageSize(long); + method public void setTransactionSuccessful(); + method public void setVersion(int); + method public int update(java.lang.String, android.content.ContentValues, java.lang.String, java.lang.String[]); + method public int updateWithOnConflict(java.lang.String, android.content.ContentValues, java.lang.String, java.lang.String[], int); + method public deprecated boolean yieldIfContended(); + method public boolean yieldIfContendedSafely(); + method public boolean yieldIfContendedSafely(long); + field public static final int CONFLICT_ABORT = 2; // 0x2 + field public static final int CONFLICT_FAIL = 3; // 0x3 + field public static final int CONFLICT_IGNORE = 4; // 0x4 + field public static final int CONFLICT_NONE = 0; // 0x0 + field public static final int CONFLICT_REPLACE = 5; // 0x5 + field public static final int CONFLICT_ROLLBACK = 1; // 0x1 + field public static final int CREATE_IF_NECESSARY = 268435456; // 0x10000000 + field public static final int ENABLE_WRITE_AHEAD_LOGGING = 536870912; // 0x20000000 + field public static final int MAX_SQL_CACHE_SIZE = 100; // 0x64 + field public static final int NO_LOCALIZED_COLLATORS = 16; // 0x10 + field public static final int OPEN_READONLY = 1; // 0x1 + field public static final int OPEN_READWRITE = 0; // 0x0 + field public static final int SQLITE_MAX_LIKE_PATTERN_LENGTH = 50000; // 0xc350 + } + + public static abstract interface SQLiteDatabase.CursorFactory { + method public abstract android.database.Cursor newCursor(android.database.sqlite.SQLiteDatabase, android.database.sqlite.SQLiteCursorDriver, java.lang.String, android.database.sqlite.SQLiteQuery); + } + + public class SQLiteDatabaseCorruptException extends android.database.sqlite.SQLiteException { + ctor public SQLiteDatabaseCorruptException(); + ctor public SQLiteDatabaseCorruptException(java.lang.String); + } + + public class SQLiteDatabaseLockedException extends android.database.sqlite.SQLiteException { + ctor public SQLiteDatabaseLockedException(); + ctor public SQLiteDatabaseLockedException(java.lang.String); + } + + public class SQLiteDatatypeMismatchException extends android.database.sqlite.SQLiteException { + ctor public SQLiteDatatypeMismatchException(); + ctor public SQLiteDatatypeMismatchException(java.lang.String); + } + + public class SQLiteDiskIOException extends android.database.sqlite.SQLiteException { + ctor public SQLiteDiskIOException(); + ctor public SQLiteDiskIOException(java.lang.String); + } + + public class SQLiteDoneException extends android.database.sqlite.SQLiteException { + ctor public SQLiteDoneException(); + ctor public SQLiteDoneException(java.lang.String); + } + + public class SQLiteException extends android.database.SQLException { + ctor public SQLiteException(); + ctor public SQLiteException(java.lang.String); + ctor public SQLiteException(java.lang.String, java.lang.Throwable); + } + + public class SQLiteFullException extends android.database.sqlite.SQLiteException { + ctor public SQLiteFullException(); + ctor public SQLiteFullException(java.lang.String); + } + + public class SQLiteMisuseException extends android.database.sqlite.SQLiteException { + ctor public SQLiteMisuseException(); + ctor public SQLiteMisuseException(java.lang.String); + } + + public abstract class SQLiteOpenHelper { + ctor public SQLiteOpenHelper(android.content.Context, java.lang.String, android.database.sqlite.SQLiteDatabase.CursorFactory, int); + ctor public SQLiteOpenHelper(android.content.Context, java.lang.String, android.database.sqlite.SQLiteDatabase.CursorFactory, int, android.database.DatabaseErrorHandler); + method public synchronized void close(); + method public java.lang.String getDatabaseName(); + method public android.database.sqlite.SQLiteDatabase getReadableDatabase(); + method public android.database.sqlite.SQLiteDatabase getWritableDatabase(); + method public void onConfigure(android.database.sqlite.SQLiteDatabase); + method public abstract void onCreate(android.database.sqlite.SQLiteDatabase); + method public void onDowngrade(android.database.sqlite.SQLiteDatabase, int, int); + method public void onOpen(android.database.sqlite.SQLiteDatabase); + method public abstract void onUpgrade(android.database.sqlite.SQLiteDatabase, int, int); + method public void setWriteAheadLoggingEnabled(boolean); + } + + public class SQLiteOutOfMemoryException extends android.database.sqlite.SQLiteException { + ctor public SQLiteOutOfMemoryException(); + ctor public SQLiteOutOfMemoryException(java.lang.String); + } + + public abstract class SQLiteProgram extends android.database.sqlite.SQLiteClosable { + method public void bindAllArgsAsStrings(java.lang.String[]); + method public void bindBlob(int, byte[]); + method public void bindDouble(int, double); + method public void bindLong(int, long); + method public void bindNull(int); + method public void bindString(int, java.lang.String); + method public void clearBindings(); + method public final deprecated int getUniqueId(); + method protected void onAllReferencesReleased(); + } + + public final class SQLiteQuery extends android.database.sqlite.SQLiteProgram { + } + + public class SQLiteQueryBuilder { + ctor public SQLiteQueryBuilder(); + method public static void appendColumns(java.lang.StringBuilder, java.lang.String[]); + method public void appendWhere(java.lang.CharSequence); + method public void appendWhereEscapeString(java.lang.String); + method public java.lang.String buildQuery(java.lang.String[], java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String); + method public deprecated java.lang.String buildQuery(java.lang.String[], java.lang.String, java.lang.String[], java.lang.String, java.lang.String, java.lang.String, java.lang.String); + method public static java.lang.String buildQueryString(boolean, java.lang.String, java.lang.String[], java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String); + method public java.lang.String buildUnionQuery(java.lang.String[], java.lang.String, java.lang.String); + method public java.lang.String buildUnionSubQuery(java.lang.String, java.lang.String[], java.util.Set, int, java.lang.String, java.lang.String, java.lang.String, java.lang.String); + method public deprecated java.lang.String buildUnionSubQuery(java.lang.String, java.lang.String[], java.util.Set, int, java.lang.String, java.lang.String, java.lang.String[], java.lang.String, java.lang.String); + method public java.lang.String getTables(); + method public android.database.Cursor query(android.database.sqlite.SQLiteDatabase, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String, java.lang.String, java.lang.String); + method public android.database.Cursor query(android.database.sqlite.SQLiteDatabase, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String, java.lang.String, java.lang.String, java.lang.String); + method public android.database.Cursor query(android.database.sqlite.SQLiteDatabase, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String, java.lang.String, java.lang.String, java.lang.String, android.os.CancellationSignal); + method public void setCursorFactory(android.database.sqlite.SQLiteDatabase.CursorFactory); + method public void setDistinct(boolean); + method public void setProjectionMap(java.util.Map); + method public void setStrict(boolean); + method public void setTables(java.lang.String); + } + + public class SQLiteReadOnlyDatabaseException extends android.database.sqlite.SQLiteException { + ctor public SQLiteReadOnlyDatabaseException(); + ctor public SQLiteReadOnlyDatabaseException(java.lang.String); + } + + public final class SQLiteStatement extends android.database.sqlite.SQLiteProgram { + method public void execute(); + method public long executeInsert(); + method public int executeUpdateDelete(); + method public android.os.ParcelFileDescriptor simpleQueryForBlobFileDescriptor(); + method public long simpleQueryForLong(); + method public java.lang.String simpleQueryForString(); + } + + public class SQLiteTableLockedException extends android.database.sqlite.SQLiteException { + ctor public SQLiteTableLockedException(); + ctor public SQLiteTableLockedException(java.lang.String); + } + + public abstract interface SQLiteTransactionListener { + method public abstract void onBegin(); + method public abstract void onCommit(); + method public abstract void onRollback(); + } + +} + +package android.drm { + + public class DrmConvertedStatus { + ctor public DrmConvertedStatus(int, byte[], int); + field public static final int STATUS_ERROR = 3; // 0x3 + field public static final int STATUS_INPUTDATA_ERROR = 2; // 0x2 + field public static final int STATUS_OK = 1; // 0x1 + field public final byte[] convertedData; + field public final int offset; + field public final int statusCode; + } + + public class DrmErrorEvent extends android.drm.DrmEvent { + ctor public DrmErrorEvent(int, int, java.lang.String); + ctor public DrmErrorEvent(int, int, java.lang.String, java.util.HashMap); + field public static final int TYPE_ACQUIRE_DRM_INFO_FAILED = 2008; // 0x7d8 + field public static final int TYPE_NOT_SUPPORTED = 2003; // 0x7d3 + field public static final int TYPE_NO_INTERNET_CONNECTION = 2005; // 0x7d5 + field public static final int TYPE_OUT_OF_MEMORY = 2004; // 0x7d4 + field public static final int TYPE_PROCESS_DRM_INFO_FAILED = 2006; // 0x7d6 + field public static final int TYPE_REMOVE_ALL_RIGHTS_FAILED = 2007; // 0x7d7 + field public static final int TYPE_RIGHTS_NOT_INSTALLED = 2001; // 0x7d1 + field public static final int TYPE_RIGHTS_RENEWAL_NOT_ALLOWED = 2002; // 0x7d2 + } + + public class DrmEvent { + ctor protected DrmEvent(int, int, java.lang.String, java.util.HashMap); + ctor protected DrmEvent(int, int, java.lang.String); + method public java.lang.Object getAttribute(java.lang.String); + method public java.lang.String getMessage(); + method public int getType(); + method public int getUniqueId(); + field public static final java.lang.String DRM_INFO_OBJECT = "drm_info_object"; + field public static final java.lang.String DRM_INFO_STATUS_OBJECT = "drm_info_status_object"; + field public static final int TYPE_ALL_RIGHTS_REMOVED = 1001; // 0x3e9 + field public static final int TYPE_DRM_INFO_PROCESSED = 1002; // 0x3ea + } + + public class DrmInfo { + ctor public DrmInfo(int, byte[], java.lang.String); + ctor public DrmInfo(int, java.lang.String, java.lang.String); + method public java.lang.Object get(java.lang.String); + method public byte[] getData(); + method public int getInfoType(); + method public java.lang.String getMimeType(); + method public java.util.Iterator iterator(); + method public java.util.Iterator keyIterator(); + method public void put(java.lang.String, java.lang.Object); + } + + public class DrmInfoEvent extends android.drm.DrmEvent { + ctor public DrmInfoEvent(int, int, java.lang.String); + ctor public DrmInfoEvent(int, int, java.lang.String, java.util.HashMap); + field public static final int TYPE_ACCOUNT_ALREADY_REGISTERED = 5; // 0x5 + field public static final int TYPE_ALREADY_REGISTERED_BY_ANOTHER_ACCOUNT = 1; // 0x1 + field public static final int TYPE_REMOVE_RIGHTS = 2; // 0x2 + field public static final int TYPE_RIGHTS_INSTALLED = 3; // 0x3 + field public static final int TYPE_RIGHTS_REMOVED = 6; // 0x6 + field public static final int TYPE_WAIT_FOR_RIGHTS = 4; // 0x4 + } + + public class DrmInfoRequest { + ctor public DrmInfoRequest(int, java.lang.String); + method public java.lang.Object get(java.lang.String); + method public int getInfoType(); + method public java.lang.String getMimeType(); + method public java.util.Iterator iterator(); + method public java.util.Iterator keyIterator(); + method public void put(java.lang.String, java.lang.Object); + field public static final java.lang.String ACCOUNT_ID = "account_id"; + field public static final java.lang.String SUBSCRIPTION_ID = "subscription_id"; + field public static final int TYPE_REGISTRATION_INFO = 1; // 0x1 + field public static final int TYPE_RIGHTS_ACQUISITION_INFO = 3; // 0x3 + field public static final int TYPE_RIGHTS_ACQUISITION_PROGRESS_INFO = 4; // 0x4 + field public static final int TYPE_UNREGISTRATION_INFO = 2; // 0x2 + } + + public class DrmInfoStatus { + ctor public DrmInfoStatus(int, int, android.drm.ProcessedData, java.lang.String); + field public static final int STATUS_ERROR = 2; // 0x2 + field public static final int STATUS_OK = 1; // 0x1 + field public final android.drm.ProcessedData data; + field public final int infoType; + field public final java.lang.String mimeType; + field public final int statusCode; + } + + public class DrmManagerClient { + ctor public DrmManagerClient(android.content.Context); + method public android.drm.DrmInfo acquireDrmInfo(android.drm.DrmInfoRequest); + method public int acquireRights(android.drm.DrmInfoRequest); + method public boolean canHandle(java.lang.String, java.lang.String); + method public boolean canHandle(android.net.Uri, java.lang.String); + method public int checkRightsStatus(java.lang.String); + method public int checkRightsStatus(android.net.Uri); + method public int checkRightsStatus(java.lang.String, int); + method public int checkRightsStatus(android.net.Uri, int); + method public android.drm.DrmConvertedStatus closeConvertSession(int); + method public android.drm.DrmConvertedStatus convertData(int, byte[]); + method public java.lang.String[] getAvailableDrmEngines(); + method public android.content.ContentValues getConstraints(java.lang.String, int); + method public android.content.ContentValues getConstraints(android.net.Uri, int); + method public int getDrmObjectType(java.lang.String, java.lang.String); + method public int getDrmObjectType(android.net.Uri, java.lang.String); + method public android.content.ContentValues getMetadata(java.lang.String); + method public android.content.ContentValues getMetadata(android.net.Uri); + method public java.lang.String getOriginalMimeType(java.lang.String); + method public java.lang.String getOriginalMimeType(android.net.Uri); + method public int openConvertSession(java.lang.String); + method public int processDrmInfo(android.drm.DrmInfo); + method public void release(); + method public int removeAllRights(); + method public int removeRights(java.lang.String); + method public int removeRights(android.net.Uri); + method public int saveRights(android.drm.DrmRights, java.lang.String, java.lang.String) throws java.io.IOException; + method public synchronized void setOnErrorListener(android.drm.DrmManagerClient.OnErrorListener); + method public synchronized void setOnEventListener(android.drm.DrmManagerClient.OnEventListener); + method public synchronized void setOnInfoListener(android.drm.DrmManagerClient.OnInfoListener); + field public static final int ERROR_NONE = 0; // 0x0 + field public static final int ERROR_UNKNOWN = -2000; // 0xfffff830 + } + + public static abstract interface DrmManagerClient.OnErrorListener { + method public abstract void onError(android.drm.DrmManagerClient, android.drm.DrmErrorEvent); + } + + public static abstract interface DrmManagerClient.OnEventListener { + method public abstract void onEvent(android.drm.DrmManagerClient, android.drm.DrmEvent); + } + + public static abstract interface DrmManagerClient.OnInfoListener { + method public abstract void onInfo(android.drm.DrmManagerClient, android.drm.DrmInfoEvent); + } + + public class DrmRights { + ctor public DrmRights(java.lang.String, java.lang.String); + ctor public DrmRights(java.lang.String, java.lang.String, java.lang.String); + ctor public DrmRights(java.lang.String, java.lang.String, java.lang.String, java.lang.String); + ctor public DrmRights(java.io.File, java.lang.String); + ctor public DrmRights(android.drm.ProcessedData, java.lang.String); + method public java.lang.String getAccountId(); + method public byte[] getData(); + method public java.lang.String getMimeType(); + method public java.lang.String getSubscriptionId(); + } + + public class DrmStore { + ctor public deprecated DrmStore(); + } + + public static class DrmStore.Action { + ctor public deprecated DrmStore.Action(); + field public static final int DEFAULT = 0; // 0x0 + field public static final int DISPLAY = 7; // 0x7 + field public static final int EXECUTE = 6; // 0x6 + field public static final int OUTPUT = 4; // 0x4 + field public static final int PLAY = 1; // 0x1 + field public static final int PREVIEW = 5; // 0x5 + field public static final int RINGTONE = 2; // 0x2 + field public static final int TRANSFER = 3; // 0x3 + } + + public static abstract interface DrmStore.ConstraintsColumns { + field public static final java.lang.String EXTENDED_METADATA = "extended_metadata"; + field public static final java.lang.String LICENSE_AVAILABLE_TIME = "license_available_time"; + field public static final java.lang.String LICENSE_EXPIRY_TIME = "license_expiry_time"; + field public static final java.lang.String LICENSE_START_TIME = "license_start_time"; + field public static final java.lang.String MAX_REPEAT_COUNT = "max_repeat_count"; + field public static final java.lang.String REMAINING_REPEAT_COUNT = "remaining_repeat_count"; + } + + public static class DrmStore.DrmObjectType { + ctor public deprecated DrmStore.DrmObjectType(); + field public static final int CONTENT = 1; // 0x1 + field public static final int RIGHTS_OBJECT = 2; // 0x2 + field public static final int TRIGGER_OBJECT = 3; // 0x3 + field public static final int UNKNOWN = 0; // 0x0 + } + + public static class DrmStore.Playback { + ctor public deprecated DrmStore.Playback(); + field public static final int PAUSE = 2; // 0x2 + field public static final int RESUME = 3; // 0x3 + field public static final int START = 0; // 0x0 + field public static final int STOP = 1; // 0x1 + } + + public static class DrmStore.RightsStatus { + ctor public deprecated DrmStore.RightsStatus(); + field public static final int RIGHTS_EXPIRED = 2; // 0x2 + field public static final int RIGHTS_INVALID = 1; // 0x1 + field public static final int RIGHTS_NOT_ACQUIRED = 3; // 0x3 + field public static final int RIGHTS_VALID = 0; // 0x0 + } + + public class DrmSupportInfo { + ctor public DrmSupportInfo(); + method public void addFileSuffix(java.lang.String); + method public void addMimeType(java.lang.String); + method public deprecated java.lang.String getDescriprition(); + method public java.lang.String getDescription(); + method public java.util.Iterator getFileSuffixIterator(); + method public java.util.Iterator getMimeTypeIterator(); + method public void setDescription(java.lang.String); + } + + public class DrmUtils { + ctor public DrmUtils(); + method public static android.drm.DrmUtils.ExtendedMetadataParser getExtendedMetadataParser(byte[]); + } + + public static class DrmUtils.ExtendedMetadataParser { + method public java.lang.String get(java.lang.String); + method public java.util.Iterator iterator(); + method public java.util.Iterator keyIterator(); + } + + public class ProcessedData { + method public java.lang.String getAccountId(); + method public byte[] getData(); + method public java.lang.String getSubscriptionId(); + } + +} + +package android.gesture { + + public class Gesture implements android.os.Parcelable { + ctor public Gesture(); + method public void addStroke(android.gesture.GestureStroke); + method public java.lang.Object clone(); + method public int describeContents(); + method public android.graphics.RectF getBoundingBox(); + method public long getID(); + method public float getLength(); + method public java.util.ArrayList getStrokes(); + method public int getStrokesCount(); + method public android.graphics.Bitmap toBitmap(int, int, int, int, int); + method public android.graphics.Bitmap toBitmap(int, int, int, int); + method public android.graphics.Path toPath(); + method public android.graphics.Path toPath(android.graphics.Path); + method public android.graphics.Path toPath(int, int, int, int); + method public android.graphics.Path toPath(android.graphics.Path, int, int, int, int); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + } + + public final class GestureLibraries { + method public static android.gesture.GestureLibrary fromFile(java.lang.String); + method public static android.gesture.GestureLibrary fromFile(java.io.File); + method public static android.gesture.GestureLibrary fromPrivateFile(android.content.Context, java.lang.String); + method public static android.gesture.GestureLibrary fromRawResource(android.content.Context, int); + } + + public abstract class GestureLibrary { + ctor protected GestureLibrary(); + method public void addGesture(java.lang.String, android.gesture.Gesture); + method public java.util.Set getGestureEntries(); + method public java.util.ArrayList getGestures(java.lang.String); + method public int getOrientationStyle(); + method public int getSequenceType(); + method public boolean isReadOnly(); + method public abstract boolean load(); + method public java.util.ArrayList recognize(android.gesture.Gesture); + method public void removeEntry(java.lang.String); + method public void removeGesture(java.lang.String, android.gesture.Gesture); + method public abstract boolean save(); + method public void setOrientationStyle(int); + method public void setSequenceType(int); + field protected final android.gesture.GestureStore mStore; + } + + public class GestureOverlayView extends android.widget.FrameLayout { + ctor public GestureOverlayView(android.content.Context); + ctor public GestureOverlayView(android.content.Context, android.util.AttributeSet); + ctor public GestureOverlayView(android.content.Context, android.util.AttributeSet, int); + method public void addOnGestureListener(android.gesture.GestureOverlayView.OnGestureListener); + method public void addOnGesturePerformedListener(android.gesture.GestureOverlayView.OnGesturePerformedListener); + method public void addOnGesturingListener(android.gesture.GestureOverlayView.OnGesturingListener); + method public void cancelClearAnimation(); + method public void cancelGesture(); + method public void clear(boolean); + method public java.util.ArrayList getCurrentStroke(); + method public long getFadeOffset(); + method public android.gesture.Gesture getGesture(); + method public int getGestureColor(); + method public android.graphics.Path getGesturePath(); + method public android.graphics.Path getGesturePath(android.graphics.Path); + method public float getGestureStrokeAngleThreshold(); + method public float getGestureStrokeLengthThreshold(); + method public float getGestureStrokeSquarenessTreshold(); + method public int getGestureStrokeType(); + method public float getGestureStrokeWidth(); + method public int getOrientation(); + method public int getUncertainGestureColor(); + method public boolean isEventsInterceptionEnabled(); + method public boolean isFadeEnabled(); + method public boolean isGestureVisible(); + method public boolean isGesturing(); + method public void removeAllOnGestureListeners(); + method public void removeAllOnGesturePerformedListeners(); + method public void removeAllOnGesturingListeners(); + method public void removeOnGestureListener(android.gesture.GestureOverlayView.OnGestureListener); + method public void removeOnGesturePerformedListener(android.gesture.GestureOverlayView.OnGesturePerformedListener); + method public void removeOnGesturingListener(android.gesture.GestureOverlayView.OnGesturingListener); + method public void setEventsInterceptionEnabled(boolean); + method public void setFadeEnabled(boolean); + method public void setFadeOffset(long); + method public void setGesture(android.gesture.Gesture); + method public void setGestureColor(int); + method public void setGestureStrokeAngleThreshold(float); + method public void setGestureStrokeLengthThreshold(float); + method public void setGestureStrokeSquarenessTreshold(float); + method public void setGestureStrokeType(int); + method public void setGestureStrokeWidth(float); + method public void setGestureVisible(boolean); + method public void setOrientation(int); + method public void setUncertainGestureColor(int); + field public static final int GESTURE_STROKE_TYPE_MULTIPLE = 1; // 0x1 + field public static final int GESTURE_STROKE_TYPE_SINGLE = 0; // 0x0 + field public static final int ORIENTATION_HORIZONTAL = 0; // 0x0 + field public static final int ORIENTATION_VERTICAL = 1; // 0x1 + } + + public static abstract interface GestureOverlayView.OnGestureListener { + method public abstract void onGesture(android.gesture.GestureOverlayView, android.view.MotionEvent); + method public abstract void onGestureCancelled(android.gesture.GestureOverlayView, android.view.MotionEvent); + method public abstract void onGestureEnded(android.gesture.GestureOverlayView, android.view.MotionEvent); + method public abstract void onGestureStarted(android.gesture.GestureOverlayView, android.view.MotionEvent); + } + + public static abstract interface GestureOverlayView.OnGesturePerformedListener { + method public abstract void onGesturePerformed(android.gesture.GestureOverlayView, android.gesture.Gesture); + } + + public static abstract interface GestureOverlayView.OnGesturingListener { + method public abstract void onGesturingEnded(android.gesture.GestureOverlayView); + method public abstract void onGesturingStarted(android.gesture.GestureOverlayView); + } + + public class GesturePoint { + ctor public GesturePoint(float, float, long); + method public java.lang.Object clone(); + field public final long timestamp; + field public final float x; + field public final float y; + } + + public class GestureStore { + ctor public GestureStore(); + method public void addGesture(java.lang.String, android.gesture.Gesture); + method public java.util.Set getGestureEntries(); + method public java.util.ArrayList getGestures(java.lang.String); + method public int getOrientationStyle(); + method public int getSequenceType(); + method public boolean hasChanged(); + method public void load(java.io.InputStream) throws java.io.IOException; + method public void load(java.io.InputStream, boolean) throws java.io.IOException; + method public java.util.ArrayList recognize(android.gesture.Gesture); + method public void removeEntry(java.lang.String); + method public void removeGesture(java.lang.String, android.gesture.Gesture); + method public void save(java.io.OutputStream) throws java.io.IOException; + method public void save(java.io.OutputStream, boolean) throws java.io.IOException; + method public void setOrientationStyle(int); + method public void setSequenceType(int); + field public static final int ORIENTATION_INVARIANT = 1; // 0x1 + field public static final int ORIENTATION_SENSITIVE = 2; // 0x2 + field public static final int SEQUENCE_INVARIANT = 1; // 0x1 + field public static final int SEQUENCE_SENSITIVE = 2; // 0x2 + } + + public class GestureStroke { + ctor public GestureStroke(java.util.ArrayList); + method public void clearPath(); + method public java.lang.Object clone(); + method public android.gesture.OrientedBoundingBox computeOrientedBoundingBox(); + method public android.graphics.Path getPath(); + method public android.graphics.Path toPath(float, float, int); + field public final android.graphics.RectF boundingBox; + field public final float length; + field public final float[] points; + } + + public final class GestureUtils { + method public static android.gesture.OrientedBoundingBox computeOrientedBoundingBox(java.util.ArrayList); + method public static android.gesture.OrientedBoundingBox computeOrientedBoundingBox(float[]); + method public static float[] spatialSampling(android.gesture.Gesture, int); + method public static float[] spatialSampling(android.gesture.Gesture, int, boolean); + method public static float[] temporalSampling(android.gesture.GestureStroke, int); + } + + public class OrientedBoundingBox { + field public final float centerX; + field public final float centerY; + field public final float height; + field public final float orientation; + field public final float squareness; + field public final float width; + } + + public class Prediction { + field public final java.lang.String name; + field public double score; + } + +} + +package android.graphics { + + public deprecated class AvoidXfermode extends android.graphics.Xfermode { + ctor public AvoidXfermode(int, int, android.graphics.AvoidXfermode.Mode); + } + + public static final class AvoidXfermode.Mode extends java.lang.Enum { + method public static android.graphics.AvoidXfermode.Mode valueOf(java.lang.String); + method public static final android.graphics.AvoidXfermode.Mode[] values(); + enum_constant public static final android.graphics.AvoidXfermode.Mode AVOID; + enum_constant public static final android.graphics.AvoidXfermode.Mode TARGET; + } + + public final class Bitmap implements android.os.Parcelable { + method public boolean compress(android.graphics.Bitmap.CompressFormat, int, java.io.OutputStream); + method public android.graphics.Bitmap copy(android.graphics.Bitmap.Config, boolean); + method public void copyPixelsFromBuffer(java.nio.Buffer); + method public void copyPixelsToBuffer(java.nio.Buffer); + method public static android.graphics.Bitmap createBitmap(android.graphics.Bitmap); + method public static android.graphics.Bitmap createBitmap(android.graphics.Bitmap, int, int, int, int); + method public static android.graphics.Bitmap createBitmap(android.graphics.Bitmap, int, int, int, int, android.graphics.Matrix, boolean); + method public static android.graphics.Bitmap createBitmap(int, int, android.graphics.Bitmap.Config); + method public static android.graphics.Bitmap createBitmap(android.util.DisplayMetrics, int, int, android.graphics.Bitmap.Config); + method public static android.graphics.Bitmap createBitmap(int[], int, int, int, int, android.graphics.Bitmap.Config); + method public static android.graphics.Bitmap createBitmap(android.util.DisplayMetrics, int[], int, int, int, int, android.graphics.Bitmap.Config); + method public static android.graphics.Bitmap createBitmap(int[], int, int, android.graphics.Bitmap.Config); + method public static android.graphics.Bitmap createBitmap(android.util.DisplayMetrics, int[], int, int, android.graphics.Bitmap.Config); + method public static android.graphics.Bitmap createScaledBitmap(android.graphics.Bitmap, int, int, boolean); + method public int describeContents(); + method public void eraseColor(int); + method public android.graphics.Bitmap extractAlpha(); + method public android.graphics.Bitmap extractAlpha(android.graphics.Paint, int[]); + method public final int getByteCount(); + method public final android.graphics.Bitmap.Config getConfig(); + method public int getDensity(); + method public int getGenerationId(); + method public final int getHeight(); + method public byte[] getNinePatchChunk(); + method public int getPixel(int, int); + method public void getPixels(int[], int, int, int, int, int, int); + method public final int getRowBytes(); + method public int getScaledHeight(android.graphics.Canvas); + method public int getScaledHeight(android.util.DisplayMetrics); + method public int getScaledHeight(int); + method public int getScaledWidth(android.graphics.Canvas); + method public int getScaledWidth(android.util.DisplayMetrics); + method public int getScaledWidth(int); + method public final int getWidth(); + method public final boolean hasAlpha(); + method public final boolean hasMipMap(); + method public final boolean isMutable(); + method public final boolean isPremultiplied(); + method public final boolean isRecycled(); + method public void prepareToDraw(); + method public void recycle(); + method public boolean sameAs(android.graphics.Bitmap); + method public void setDensity(int); + method public void setHasAlpha(boolean); + method public final void setHasMipMap(boolean); + method public void setPixel(int, int, int); + method public void setPixels(int[], int, int, int, int, int, int); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + field public static final int DENSITY_NONE = 0; // 0x0 + } + + public static final class Bitmap.CompressFormat extends java.lang.Enum { + method public static android.graphics.Bitmap.CompressFormat valueOf(java.lang.String); + method public static final android.graphics.Bitmap.CompressFormat[] values(); + enum_constant public static final android.graphics.Bitmap.CompressFormat JPEG; + enum_constant public static final android.graphics.Bitmap.CompressFormat PNG; + enum_constant public static final android.graphics.Bitmap.CompressFormat WEBP; + } + + public static final class Bitmap.Config extends java.lang.Enum { + method public static android.graphics.Bitmap.Config valueOf(java.lang.String); + method public static final android.graphics.Bitmap.Config[] values(); + enum_constant public static final android.graphics.Bitmap.Config ALPHA_8; + enum_constant public static final deprecated android.graphics.Bitmap.Config ARGB_4444; + enum_constant public static final android.graphics.Bitmap.Config ARGB_8888; + enum_constant public static final android.graphics.Bitmap.Config RGB_565; + } + + public class BitmapFactory { + ctor public BitmapFactory(); + method public static android.graphics.Bitmap decodeByteArray(byte[], int, int, android.graphics.BitmapFactory.Options); + method public static android.graphics.Bitmap decodeByteArray(byte[], int, int); + method public static android.graphics.Bitmap decodeFile(java.lang.String, android.graphics.BitmapFactory.Options); + method public static android.graphics.Bitmap decodeFile(java.lang.String); + method public static android.graphics.Bitmap decodeFileDescriptor(java.io.FileDescriptor, android.graphics.Rect, android.graphics.BitmapFactory.Options); + method public static android.graphics.Bitmap decodeFileDescriptor(java.io.FileDescriptor); + method public static android.graphics.Bitmap decodeResource(android.content.res.Resources, int, android.graphics.BitmapFactory.Options); + method public static android.graphics.Bitmap decodeResource(android.content.res.Resources, int); + method public static android.graphics.Bitmap decodeResourceStream(android.content.res.Resources, android.util.TypedValue, java.io.InputStream, android.graphics.Rect, android.graphics.BitmapFactory.Options); + method public static android.graphics.Bitmap decodeStream(java.io.InputStream, android.graphics.Rect, android.graphics.BitmapFactory.Options); + method public static android.graphics.Bitmap decodeStream(java.io.InputStream); + } + + public static class BitmapFactory.Options { + ctor public BitmapFactory.Options(); + method public void requestCancelDecode(); + field public android.graphics.Bitmap inBitmap; + field public int inDensity; + field public boolean inDither; + field public boolean inInputShareable; + field public boolean inJustDecodeBounds; + field public boolean inMutable; + field public boolean inPreferQualityOverSpeed; + field public android.graphics.Bitmap.Config inPreferredConfig; + field public boolean inPurgeable; + field public int inSampleSize; + field public boolean inScaled; + field public int inScreenDensity; + field public int inTargetDensity; + field public byte[] inTempStorage; + field public boolean mCancel; + field public int outHeight; + field public java.lang.String outMimeType; + field public int outWidth; + } + + public final class BitmapRegionDecoder { + method public android.graphics.Bitmap decodeRegion(android.graphics.Rect, android.graphics.BitmapFactory.Options); + method public int getHeight(); + method public int getWidth(); + method public final boolean isRecycled(); + method public static android.graphics.BitmapRegionDecoder newInstance(byte[], int, int, boolean) throws java.io.IOException; + method public static android.graphics.BitmapRegionDecoder newInstance(java.io.FileDescriptor, boolean) throws java.io.IOException; + method public static android.graphics.BitmapRegionDecoder newInstance(java.io.InputStream, boolean) throws java.io.IOException; + method public static android.graphics.BitmapRegionDecoder newInstance(java.lang.String, boolean) throws java.io.IOException; + method public void recycle(); + } + + public class BitmapShader extends android.graphics.Shader { + ctor public BitmapShader(android.graphics.Bitmap, android.graphics.Shader.TileMode, android.graphics.Shader.TileMode); + } + + public class BlurMaskFilter extends android.graphics.MaskFilter { + ctor public BlurMaskFilter(float, android.graphics.BlurMaskFilter.Blur); + } + + public static final class BlurMaskFilter.Blur extends java.lang.Enum { + method public static android.graphics.BlurMaskFilter.Blur valueOf(java.lang.String); + method public static final android.graphics.BlurMaskFilter.Blur[] values(); + enum_constant public static final android.graphics.BlurMaskFilter.Blur INNER; + enum_constant public static final android.graphics.BlurMaskFilter.Blur NORMAL; + enum_constant public static final android.graphics.BlurMaskFilter.Blur OUTER; + enum_constant public static final android.graphics.BlurMaskFilter.Blur SOLID; + } + + public class Camera { + ctor public Camera(); + method public void applyToCanvas(android.graphics.Canvas); + method public float dotWithNormal(float, float, float); + method public float getLocationX(); + method public float getLocationY(); + method public float getLocationZ(); + method public void getMatrix(android.graphics.Matrix); + method public void restore(); + method public void rotate(float, float, float); + method public void rotateX(float); + method public void rotateY(float); + method public void rotateZ(float); + method public void save(); + method public void setLocation(float, float, float); + method public void translate(float, float, float); + } + + public class Canvas { + ctor public Canvas(); + ctor public Canvas(android.graphics.Bitmap); + method public boolean clipPath(android.graphics.Path, android.graphics.Region.Op); + method public boolean clipPath(android.graphics.Path); + method public boolean clipRect(android.graphics.RectF, android.graphics.Region.Op); + method public boolean clipRect(android.graphics.Rect, android.graphics.Region.Op); + method public boolean clipRect(android.graphics.RectF); + method public boolean clipRect(android.graphics.Rect); + method public boolean clipRect(float, float, float, float, android.graphics.Region.Op); + method public boolean clipRect(float, float, float, float); + method public boolean clipRect(int, int, int, int); + method public boolean clipRegion(android.graphics.Region, android.graphics.Region.Op); + method public boolean clipRegion(android.graphics.Region); + method public void concat(android.graphics.Matrix); + method public void drawARGB(int, int, int, int); + method public void drawArc(android.graphics.RectF, float, float, boolean, android.graphics.Paint); + method public void drawBitmap(android.graphics.Bitmap, float, float, android.graphics.Paint); + method public void drawBitmap(android.graphics.Bitmap, android.graphics.Rect, android.graphics.RectF, android.graphics.Paint); + method public void drawBitmap(android.graphics.Bitmap, android.graphics.Rect, android.graphics.Rect, android.graphics.Paint); + method public void drawBitmap(int[], int, int, float, float, int, int, boolean, android.graphics.Paint); + method public void drawBitmap(int[], int, int, int, int, int, int, boolean, android.graphics.Paint); + method public void drawBitmap(android.graphics.Bitmap, android.graphics.Matrix, android.graphics.Paint); + method public void drawBitmapMesh(android.graphics.Bitmap, int, int, float[], int, int[], int, android.graphics.Paint); + method public void drawCircle(float, float, float, android.graphics.Paint); + method public void drawColor(int); + method public void drawColor(int, android.graphics.PorterDuff.Mode); + method public void drawLine(float, float, float, float, android.graphics.Paint); + method public void drawLines(float[], int, int, android.graphics.Paint); + method public void drawLines(float[], android.graphics.Paint); + method public void drawOval(android.graphics.RectF, android.graphics.Paint); + method public void drawPaint(android.graphics.Paint); + method public void drawPath(android.graphics.Path, android.graphics.Paint); + method public void drawPicture(android.graphics.Picture); + method public void drawPicture(android.graphics.Picture, android.graphics.RectF); + method public void drawPicture(android.graphics.Picture, android.graphics.Rect); + method public void drawPoint(float, float, android.graphics.Paint); + method public void drawPoints(float[], int, int, android.graphics.Paint); + method public void drawPoints(float[], android.graphics.Paint); + method public deprecated void drawPosText(char[], int, int, float[], android.graphics.Paint); + method public deprecated void drawPosText(java.lang.String, float[], android.graphics.Paint); + method public void drawRGB(int, int, int); + method public void drawRect(android.graphics.RectF, android.graphics.Paint); + method public void drawRect(android.graphics.Rect, android.graphics.Paint); + method public void drawRect(float, float, float, float, android.graphics.Paint); + method public void drawRoundRect(android.graphics.RectF, float, float, android.graphics.Paint); + method public void drawText(char[], int, int, float, float, android.graphics.Paint); + method public void drawText(java.lang.String, float, float, android.graphics.Paint); + method public void drawText(java.lang.String, int, int, float, float, android.graphics.Paint); + method public void drawText(java.lang.CharSequence, int, int, float, float, android.graphics.Paint); + method public void drawTextOnPath(char[], int, int, android.graphics.Path, float, float, android.graphics.Paint); + method public void drawTextOnPath(java.lang.String, android.graphics.Path, float, float, android.graphics.Paint); + method public void drawVertices(android.graphics.Canvas.VertexMode, int, float[], int, float[], int, int[], int, short[], int, int, android.graphics.Paint); + method public boolean getClipBounds(android.graphics.Rect); + method public final android.graphics.Rect getClipBounds(); + method public int getDensity(); + method public android.graphics.DrawFilter getDrawFilter(); + method public int getHeight(); + method public deprecated void getMatrix(android.graphics.Matrix); + method public final deprecated android.graphics.Matrix getMatrix(); + method public int getMaximumBitmapHeight(); + method public int getMaximumBitmapWidth(); + method public int getSaveCount(); + method public int getWidth(); + method public boolean isHardwareAccelerated(); + method public boolean isOpaque(); + method public boolean quickReject(android.graphics.RectF, android.graphics.Canvas.EdgeType); + method public boolean quickReject(android.graphics.Path, android.graphics.Canvas.EdgeType); + method public boolean quickReject(float, float, float, float, android.graphics.Canvas.EdgeType); + method public void restore(); + method public void restoreToCount(int); + method public void rotate(float); + method public final void rotate(float, float, float); + method public int save(); + method public int save(int); + method public int saveLayer(android.graphics.RectF, android.graphics.Paint, int); + method public int saveLayer(float, float, float, float, android.graphics.Paint, int); + method public int saveLayerAlpha(android.graphics.RectF, int, int); + method public int saveLayerAlpha(float, float, float, float, int, int); + method public void scale(float, float); + method public final void scale(float, float, float, float); + method public void setBitmap(android.graphics.Bitmap); + method public void setDensity(int); + method public void setDrawFilter(android.graphics.DrawFilter); + method public void setMatrix(android.graphics.Matrix); + method public void skew(float, float); + method public void translate(float, float); + field public static final int ALL_SAVE_FLAG = 31; // 0x1f + field public static final int CLIP_SAVE_FLAG = 2; // 0x2 + field public static final int CLIP_TO_LAYER_SAVE_FLAG = 16; // 0x10 + field public static final int FULL_COLOR_LAYER_SAVE_FLAG = 8; // 0x8 + field public static final int HAS_ALPHA_LAYER_SAVE_FLAG = 4; // 0x4 + field public static final int MATRIX_SAVE_FLAG = 1; // 0x1 + } + + public static final class Canvas.EdgeType extends java.lang.Enum { + method public static android.graphics.Canvas.EdgeType valueOf(java.lang.String); + method public static final android.graphics.Canvas.EdgeType[] values(); + enum_constant public static final android.graphics.Canvas.EdgeType AA; + enum_constant public static final android.graphics.Canvas.EdgeType BW; + } + + public static final class Canvas.VertexMode extends java.lang.Enum { + method public static android.graphics.Canvas.VertexMode valueOf(java.lang.String); + method public static final android.graphics.Canvas.VertexMode[] values(); + enum_constant public static final android.graphics.Canvas.VertexMode TRIANGLES; + enum_constant public static final android.graphics.Canvas.VertexMode TRIANGLE_FAN; + enum_constant public static final android.graphics.Canvas.VertexMode TRIANGLE_STRIP; + } + + public class Color { + ctor public Color(); + method public static int HSVToColor(float[]); + method public static int HSVToColor(int, float[]); + method public static void RGBToHSV(int, int, int, float[]); + method public static int alpha(int); + method public static int argb(int, int, int, int); + method public static int blue(int); + method public static void colorToHSV(int, float[]); + method public static int green(int); + method public static int parseColor(java.lang.String); + method public static int red(int); + method public static int rgb(int, int, int); + field public static final int BLACK = -16777216; // 0xff000000 + field public static final int BLUE = -16776961; // 0xff0000ff + field public static final int CYAN = -16711681; // 0xff00ffff + field public static final int DKGRAY = -12303292; // 0xff444444 + field public static final int GRAY = -7829368; // 0xff888888 + field public static final int GREEN = -16711936; // 0xff00ff00 + field public static final int LTGRAY = -3355444; // 0xffcccccc + field public static final int MAGENTA = -65281; // 0xffff00ff + field public static final int RED = -65536; // 0xffff0000 + field public static final int TRANSPARENT = 0; // 0x0 + field public static final int WHITE = -1; // 0xffffffff + field public static final int YELLOW = -256; // 0xffffff00 + } + + public class ColorFilter { + ctor public ColorFilter(); + } + + public class ColorMatrix { + ctor public ColorMatrix(); + ctor public ColorMatrix(float[]); + ctor public ColorMatrix(android.graphics.ColorMatrix); + method public final float[] getArray(); + method public void postConcat(android.graphics.ColorMatrix); + method public void preConcat(android.graphics.ColorMatrix); + method public void reset(); + method public void set(android.graphics.ColorMatrix); + method public void set(float[]); + method public void setConcat(android.graphics.ColorMatrix, android.graphics.ColorMatrix); + method public void setRGB2YUV(); + method public void setRotate(int, float); + method public void setSaturation(float); + method public void setScale(float, float, float, float); + method public void setYUV2RGB(); + } + + public class ColorMatrixColorFilter extends android.graphics.ColorFilter { + ctor public ColorMatrixColorFilter(android.graphics.ColorMatrix); + ctor public ColorMatrixColorFilter(float[]); + } + + public class ComposePathEffect extends android.graphics.PathEffect { + ctor public ComposePathEffect(android.graphics.PathEffect, android.graphics.PathEffect); + } + + public class ComposeShader extends android.graphics.Shader { + ctor public ComposeShader(android.graphics.Shader, android.graphics.Shader, android.graphics.Xfermode); + ctor public ComposeShader(android.graphics.Shader, android.graphics.Shader, android.graphics.PorterDuff.Mode); + } + + public class CornerPathEffect extends android.graphics.PathEffect { + ctor public CornerPathEffect(float); + } + + public class DashPathEffect extends android.graphics.PathEffect { + ctor public DashPathEffect(float[], float); + } + + public class DiscretePathEffect extends android.graphics.PathEffect { + ctor public DiscretePathEffect(float, float); + } + + public class DrawFilter { + ctor public DrawFilter(); + } + + public class EmbossMaskFilter extends android.graphics.MaskFilter { + ctor public EmbossMaskFilter(float[], float, float, float); + } + + public class ImageFormat { + ctor public ImageFormat(); + method public static int getBitsPerPixel(int); + field public static final int JPEG = 256; // 0x100 + field public static final int NV16 = 16; // 0x10 + field public static final int NV21 = 17; // 0x11 + field public static final int RGB_565 = 4; // 0x4 + field public static final int UNKNOWN = 0; // 0x0 + field public static final int YUY2 = 20; // 0x14 + field public static final int YV12 = 842094169; // 0x32315659 + } + + public class Interpolator { + ctor public Interpolator(int); + ctor public Interpolator(int, int); + method public final int getKeyFrameCount(); + method public final int getValueCount(); + method public void reset(int); + method public void reset(int, int); + method public void setKeyFrame(int, int, float[]); + method public void setKeyFrame(int, int, float[], float[]); + method public void setRepeatMirror(float, boolean); + method public android.graphics.Interpolator.Result timeToValues(float[]); + method public android.graphics.Interpolator.Result timeToValues(int, float[]); + } + + public static final class Interpolator.Result extends java.lang.Enum { + method public static android.graphics.Interpolator.Result valueOf(java.lang.String); + method public static final android.graphics.Interpolator.Result[] values(); + enum_constant public static final android.graphics.Interpolator.Result FREEZE_END; + enum_constant public static final android.graphics.Interpolator.Result FREEZE_START; + enum_constant public static final android.graphics.Interpolator.Result NORMAL; + } + + public class LayerRasterizer extends android.graphics.Rasterizer { + ctor public LayerRasterizer(); + method public void addLayer(android.graphics.Paint, float, float); + method public void addLayer(android.graphics.Paint); + } + + public class LightingColorFilter extends android.graphics.ColorFilter { + ctor public LightingColorFilter(int, int); + } + + public class LinearGradient extends android.graphics.Shader { + ctor public LinearGradient(float, float, float, float, int[], float[], android.graphics.Shader.TileMode); + ctor public LinearGradient(float, float, float, float, int, int, android.graphics.Shader.TileMode); + } + + public class MaskFilter { + ctor public MaskFilter(); + } + + public class Matrix { + ctor public Matrix(); + ctor public Matrix(android.graphics.Matrix); + method public void getValues(float[]); + method public boolean invert(android.graphics.Matrix); + method public boolean isIdentity(); + method public void mapPoints(float[], int, float[], int, int); + method public void mapPoints(float[], float[]); + method public void mapPoints(float[]); + method public float mapRadius(float); + method public boolean mapRect(android.graphics.RectF, android.graphics.RectF); + method public boolean mapRect(android.graphics.RectF); + method public void mapVectors(float[], int, float[], int, int); + method public void mapVectors(float[], float[]); + method public void mapVectors(float[]); + method public boolean postConcat(android.graphics.Matrix); + method public boolean postRotate(float, float, float); + method public boolean postRotate(float); + method public boolean postScale(float, float, float, float); + method public boolean postScale(float, float); + method public boolean postSkew(float, float, float, float); + method public boolean postSkew(float, float); + method public boolean postTranslate(float, float); + method public boolean preConcat(android.graphics.Matrix); + method public boolean preRotate(float, float, float); + method public boolean preRotate(float); + method public boolean preScale(float, float, float, float); + method public boolean preScale(float, float); + method public boolean preSkew(float, float, float, float); + method public boolean preSkew(float, float); + method public boolean preTranslate(float, float); + method public boolean rectStaysRect(); + method public void reset(); + method public void set(android.graphics.Matrix); + method public boolean setConcat(android.graphics.Matrix, android.graphics.Matrix); + method public boolean setPolyToPoly(float[], int, float[], int, int); + method public boolean setRectToRect(android.graphics.RectF, android.graphics.RectF, android.graphics.Matrix.ScaleToFit); + method public void setRotate(float, float, float); + method public void setRotate(float); + method public void setScale(float, float, float, float); + method public void setScale(float, float); + method public void setSinCos(float, float, float, float); + method public void setSinCos(float, float); + method public void setSkew(float, float, float, float); + method public void setSkew(float, float); + method public void setTranslate(float, float); + method public void setValues(float[]); + method public java.lang.String toShortString(); + field public static final int MPERSP_0 = 6; // 0x6 + field public static final int MPERSP_1 = 7; // 0x7 + field public static final int MPERSP_2 = 8; // 0x8 + field public static final int MSCALE_X = 0; // 0x0 + field public static final int MSCALE_Y = 4; // 0x4 + field public static final int MSKEW_X = 1; // 0x1 + field public static final int MSKEW_Y = 3; // 0x3 + field public static final int MTRANS_X = 2; // 0x2 + field public static final int MTRANS_Y = 5; // 0x5 + } + + public static final class Matrix.ScaleToFit extends java.lang.Enum { + method public static android.graphics.Matrix.ScaleToFit valueOf(java.lang.String); + method public static final android.graphics.Matrix.ScaleToFit[] values(); + enum_constant public static final android.graphics.Matrix.ScaleToFit CENTER; + enum_constant public static final android.graphics.Matrix.ScaleToFit END; + enum_constant public static final android.graphics.Matrix.ScaleToFit FILL; + enum_constant public static final android.graphics.Matrix.ScaleToFit START; + } + + public class Movie { + method public static android.graphics.Movie decodeByteArray(byte[], int, int); + method public static android.graphics.Movie decodeFile(java.lang.String); + method public static android.graphics.Movie decodeStream(java.io.InputStream); + method public void draw(android.graphics.Canvas, float, float, android.graphics.Paint); + method public void draw(android.graphics.Canvas, float, float); + method public int duration(); + method public int height(); + method public boolean isOpaque(); + method public boolean setTime(int); + method public int width(); + } + + public class NinePatch { + ctor public NinePatch(android.graphics.Bitmap, byte[], java.lang.String); + method public void draw(android.graphics.Canvas, android.graphics.RectF); + method public void draw(android.graphics.Canvas, android.graphics.Rect); + method public void draw(android.graphics.Canvas, android.graphics.Rect, android.graphics.Paint); + method public int getDensity(); + method public int getHeight(); + method public final android.graphics.Region getTransparentRegion(android.graphics.Rect); + method public int getWidth(); + method public final boolean hasAlpha(); + method public static boolean isNinePatchChunk(byte[]); + method public void setPaint(android.graphics.Paint); + } + + public class Paint { + ctor public Paint(); + ctor public Paint(int); + ctor public Paint(android.graphics.Paint); + method public float ascent(); + method public int breakText(char[], int, int, float, float[]); + method public int breakText(java.lang.CharSequence, int, int, boolean, float, float[]); + method public int breakText(java.lang.String, boolean, float, float[]); + method public void clearShadowLayer(); + method public float descent(); + method public int getAlpha(); + method public int getColor(); + method public android.graphics.ColorFilter getColorFilter(); + method public boolean getFillPath(android.graphics.Path, android.graphics.Path); + method public int getFlags(); + method public float getFontMetrics(android.graphics.Paint.FontMetrics); + method public android.graphics.Paint.FontMetrics getFontMetrics(); + method public int getFontMetricsInt(android.graphics.Paint.FontMetricsInt); + method public android.graphics.Paint.FontMetricsInt getFontMetricsInt(); + method public float getFontSpacing(); + method public int getHinting(); + method public android.graphics.MaskFilter getMaskFilter(); + method public android.graphics.PathEffect getPathEffect(); + method public android.graphics.Rasterizer getRasterizer(); + method public android.graphics.Shader getShader(); + method public android.graphics.Paint.Cap getStrokeCap(); + method public android.graphics.Paint.Join getStrokeJoin(); + method public float getStrokeMiter(); + method public float getStrokeWidth(); + method public android.graphics.Paint.Style getStyle(); + method public android.graphics.Paint.Align getTextAlign(); + method public void getTextBounds(java.lang.String, int, int, android.graphics.Rect); + method public void getTextBounds(char[], int, int, android.graphics.Rect); + method public java.util.Locale getTextLocale(); + method public void getTextPath(char[], int, int, float, float, android.graphics.Path); + method public void getTextPath(java.lang.String, int, int, float, float, android.graphics.Path); + method public float getTextScaleX(); + method public float getTextSize(); + method public float getTextSkewX(); + method public int getTextWidths(char[], int, int, float[]); + method public int getTextWidths(java.lang.CharSequence, int, int, float[]); + method public int getTextWidths(java.lang.String, int, int, float[]); + method public int getTextWidths(java.lang.String, float[]); + method public android.graphics.Typeface getTypeface(); + method public android.graphics.Xfermode getXfermode(); + method public final boolean isAntiAlias(); + method public final boolean isDither(); + method public final boolean isFakeBoldText(); + method public final boolean isFilterBitmap(); + method public final deprecated boolean isLinearText(); + method public final boolean isStrikeThruText(); + method public final boolean isSubpixelText(); + method public final boolean isUnderlineText(); + method public float measureText(char[], int, int); + method public float measureText(java.lang.String, int, int); + method public float measureText(java.lang.String); + method public float measureText(java.lang.CharSequence, int, int); + method public void reset(); + method public void set(android.graphics.Paint); + method public void setARGB(int, int, int, int); + method public void setAlpha(int); + method public void setAntiAlias(boolean); + method public void setColor(int); + method public android.graphics.ColorFilter setColorFilter(android.graphics.ColorFilter); + method public void setDither(boolean); + method public void setFakeBoldText(boolean); + method public void setFilterBitmap(boolean); + method public void setFlags(int); + method public void setHinting(int); + method public deprecated void setLinearText(boolean); + method public android.graphics.MaskFilter setMaskFilter(android.graphics.MaskFilter); + method public android.graphics.PathEffect setPathEffect(android.graphics.PathEffect); + method public android.graphics.Rasterizer setRasterizer(android.graphics.Rasterizer); + method public android.graphics.Shader setShader(android.graphics.Shader); + method public void setShadowLayer(float, float, float, int); + method public void setStrikeThruText(boolean); + method public void setStrokeCap(android.graphics.Paint.Cap); + method public void setStrokeJoin(android.graphics.Paint.Join); + method public void setStrokeMiter(float); + method public void setStrokeWidth(float); + method public void setStyle(android.graphics.Paint.Style); + method public void setSubpixelText(boolean); + method public void setTextAlign(android.graphics.Paint.Align); + method public void setTextLocale(java.util.Locale); + method public void setTextScaleX(float); + method public void setTextSize(float); + method public void setTextSkewX(float); + method public android.graphics.Typeface setTypeface(android.graphics.Typeface); + method public void setUnderlineText(boolean); + method public android.graphics.Xfermode setXfermode(android.graphics.Xfermode); + field public static final int ANTI_ALIAS_FLAG = 1; // 0x1 + field public static final int DEV_KERN_TEXT_FLAG = 256; // 0x100 + field public static final int DITHER_FLAG = 4; // 0x4 + field public static final int FAKE_BOLD_TEXT_FLAG = 32; // 0x20 + field public static final int FILTER_BITMAP_FLAG = 2; // 0x2 + field public static final int HINTING_OFF = 0; // 0x0 + field public static final int HINTING_ON = 1; // 0x1 + field public static final int LINEAR_TEXT_FLAG = 64; // 0x40 + field public static final int STRIKE_THRU_TEXT_FLAG = 16; // 0x10 + field public static final int SUBPIXEL_TEXT_FLAG = 128; // 0x80 + field public static final int UNDERLINE_TEXT_FLAG = 8; // 0x8 + } + + public static final class Paint.Align extends java.lang.Enum { + method public static android.graphics.Paint.Align valueOf(java.lang.String); + method public static final android.graphics.Paint.Align[] values(); + enum_constant public static final android.graphics.Paint.Align CENTER; + enum_constant public static final android.graphics.Paint.Align LEFT; + enum_constant public static final android.graphics.Paint.Align RIGHT; + } + + public static final class Paint.Cap extends java.lang.Enum { + method public static android.graphics.Paint.Cap valueOf(java.lang.String); + method public static final android.graphics.Paint.Cap[] values(); + enum_constant public static final android.graphics.Paint.Cap BUTT; + enum_constant public static final android.graphics.Paint.Cap ROUND; + enum_constant public static final android.graphics.Paint.Cap SQUARE; + } + + public static class Paint.FontMetrics { + ctor public Paint.FontMetrics(); + field public float ascent; + field public float bottom; + field public float descent; + field public float leading; + field public float top; + } + + public static class Paint.FontMetricsInt { + ctor public Paint.FontMetricsInt(); + field public int ascent; + field public int bottom; + field public int descent; + field public int leading; + field public int top; + } + + public static final class Paint.Join extends java.lang.Enum { + method public static android.graphics.Paint.Join valueOf(java.lang.String); + method public static final android.graphics.Paint.Join[] values(); + enum_constant public static final android.graphics.Paint.Join BEVEL; + enum_constant public static final android.graphics.Paint.Join MITER; + enum_constant public static final android.graphics.Paint.Join ROUND; + } + + public static final class Paint.Style extends java.lang.Enum { + method public static android.graphics.Paint.Style valueOf(java.lang.String); + method public static final android.graphics.Paint.Style[] values(); + enum_constant public static final android.graphics.Paint.Style FILL; + enum_constant public static final android.graphics.Paint.Style FILL_AND_STROKE; + enum_constant public static final android.graphics.Paint.Style STROKE; + } + + public class PaintFlagsDrawFilter extends android.graphics.DrawFilter { + ctor public PaintFlagsDrawFilter(int, int); + } + + public class Path { + ctor public Path(); + ctor public Path(android.graphics.Path); + method public void addArc(android.graphics.RectF, float, float); + method public void addCircle(float, float, float, android.graphics.Path.Direction); + method public void addOval(android.graphics.RectF, android.graphics.Path.Direction); + method public void addPath(android.graphics.Path, float, float); + method public void addPath(android.graphics.Path); + method public void addPath(android.graphics.Path, android.graphics.Matrix); + method public void addRect(android.graphics.RectF, android.graphics.Path.Direction); + method public void addRect(float, float, float, float, android.graphics.Path.Direction); + method public void addRoundRect(android.graphics.RectF, float, float, android.graphics.Path.Direction); + method public void addRoundRect(android.graphics.RectF, float[], android.graphics.Path.Direction); + method public void arcTo(android.graphics.RectF, float, float, boolean); + method public void arcTo(android.graphics.RectF, float, float); + method public void close(); + method public void computeBounds(android.graphics.RectF, boolean); + method public void cubicTo(float, float, float, float, float, float); + method public android.graphics.Path.FillType getFillType(); + method public void incReserve(int); + method public boolean isEmpty(); + method public boolean isInverseFillType(); + method public boolean isRect(android.graphics.RectF); + method public void lineTo(float, float); + method public void moveTo(float, float); + method public void offset(float, float, android.graphics.Path); + method public void offset(float, float); + method public void quadTo(float, float, float, float); + method public void rCubicTo(float, float, float, float, float, float); + method public void rLineTo(float, float); + method public void rMoveTo(float, float); + method public void rQuadTo(float, float, float, float); + method public void reset(); + method public void rewind(); + method public void set(android.graphics.Path); + method public void setFillType(android.graphics.Path.FillType); + method public void setLastPoint(float, float); + method public void toggleInverseFillType(); + method public void transform(android.graphics.Matrix, android.graphics.Path); + method public void transform(android.graphics.Matrix); + } + + public static final class Path.Direction extends java.lang.Enum { + method public static android.graphics.Path.Direction valueOf(java.lang.String); + method public static final android.graphics.Path.Direction[] values(); + enum_constant public static final android.graphics.Path.Direction CCW; + enum_constant public static final android.graphics.Path.Direction CW; + } + + public static final class Path.FillType extends java.lang.Enum { + method public static android.graphics.Path.FillType valueOf(java.lang.String); + method public static final android.graphics.Path.FillType[] values(); + enum_constant public static final android.graphics.Path.FillType EVEN_ODD; + enum_constant public static final android.graphics.Path.FillType INVERSE_EVEN_ODD; + enum_constant public static final android.graphics.Path.FillType INVERSE_WINDING; + enum_constant public static final android.graphics.Path.FillType WINDING; + } + + public class PathDashPathEffect extends android.graphics.PathEffect { + ctor public PathDashPathEffect(android.graphics.Path, float, float, android.graphics.PathDashPathEffect.Style); + } + + public static final class PathDashPathEffect.Style extends java.lang.Enum { + method public static android.graphics.PathDashPathEffect.Style valueOf(java.lang.String); + method public static final android.graphics.PathDashPathEffect.Style[] values(); + enum_constant public static final android.graphics.PathDashPathEffect.Style MORPH; + enum_constant public static final android.graphics.PathDashPathEffect.Style ROTATE; + enum_constant public static final android.graphics.PathDashPathEffect.Style TRANSLATE; + } + + public class PathEffect { + ctor public PathEffect(); + } + + public class PathMeasure { + ctor public PathMeasure(); + ctor public PathMeasure(android.graphics.Path, boolean); + method public float getLength(); + method public boolean getMatrix(float, android.graphics.Matrix, int); + method public boolean getPosTan(float, float[], float[]); + method public boolean getSegment(float, float, android.graphics.Path, boolean); + method public boolean isClosed(); + method public boolean nextContour(); + method public void setPath(android.graphics.Path, boolean); + field public static final int POSITION_MATRIX_FLAG = 1; // 0x1 + field public static final int TANGENT_MATRIX_FLAG = 2; // 0x2 + } + + public class Picture { + ctor public Picture(); + ctor public Picture(android.graphics.Picture); + method public android.graphics.Canvas beginRecording(int, int); + method public static android.graphics.Picture createFromStream(java.io.InputStream); + method public void draw(android.graphics.Canvas); + method public void endRecording(); + method public int getHeight(); + method public int getWidth(); + method public void writeToStream(java.io.OutputStream); + } + + public class PixelFormat { + ctor public PixelFormat(); + method public static boolean formatHasAlpha(int); + method public static void getPixelFormatInfo(int, android.graphics.PixelFormat); + field public static final int A_8 = 8; // 0x8 + field public static final deprecated int JPEG = 256; // 0x100 + field public static final deprecated int LA_88 = 10; // 0xa + field public static final int L_8 = 9; // 0x9 + field public static final int OPAQUE = -1; // 0xffffffff + field public static final deprecated int RGBA_4444 = 7; // 0x7 + field public static final deprecated int RGBA_5551 = 6; // 0x6 + field public static final int RGBA_8888 = 1; // 0x1 + field public static final int RGBX_8888 = 2; // 0x2 + field public static final deprecated int RGB_332 = 11; // 0xb + field public static final int RGB_565 = 4; // 0x4 + field public static final int RGB_888 = 3; // 0x3 + field public static final int TRANSLUCENT = -3; // 0xfffffffd + field public static final int TRANSPARENT = -2; // 0xfffffffe + field public static final int UNKNOWN = 0; // 0x0 + field public static final deprecated int YCbCr_420_SP = 17; // 0x11 + field public static final deprecated int YCbCr_422_I = 20; // 0x14 + field public static final deprecated int YCbCr_422_SP = 16; // 0x10 + field public int bitsPerPixel; + field public int bytesPerPixel; + } + + public deprecated class PixelXorXfermode extends android.graphics.Xfermode { + ctor public PixelXorXfermode(int); + } + + public class Point implements android.os.Parcelable { + ctor public Point(); + ctor public Point(int, int); + ctor public Point(android.graphics.Point); + method public int describeContents(); + method public final boolean equals(int, int); + method public final void negate(); + method public final void offset(int, int); + method public void readFromParcel(android.os.Parcel); + method public void set(int, int); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + field public int x; + field public int y; + } + + public class PointF implements android.os.Parcelable { + ctor public PointF(); + ctor public PointF(float, float); + ctor public PointF(android.graphics.Point); + method public int describeContents(); + method public final boolean equals(float, float); + method public final float length(); + method public static float length(float, float); + method public final void negate(); + method public final void offset(float, float); + method public void readFromParcel(android.os.Parcel); + method public final void set(float, float); + method public final void set(android.graphics.PointF); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + field public float x; + field public float y; + } + + public class PorterDuff { + ctor public PorterDuff(); + } + + public static final class PorterDuff.Mode extends java.lang.Enum { + method public static android.graphics.PorterDuff.Mode valueOf(java.lang.String); + method public static final android.graphics.PorterDuff.Mode[] values(); + enum_constant public static final android.graphics.PorterDuff.Mode ADD; + enum_constant public static final android.graphics.PorterDuff.Mode CLEAR; + enum_constant public static final android.graphics.PorterDuff.Mode DARKEN; + enum_constant public static final android.graphics.PorterDuff.Mode DST; + enum_constant public static final android.graphics.PorterDuff.Mode DST_ATOP; + enum_constant public static final android.graphics.PorterDuff.Mode DST_IN; + enum_constant public static final android.graphics.PorterDuff.Mode DST_OUT; + enum_constant public static final android.graphics.PorterDuff.Mode DST_OVER; + enum_constant public static final android.graphics.PorterDuff.Mode LIGHTEN; + enum_constant public static final android.graphics.PorterDuff.Mode MULTIPLY; + enum_constant public static final android.graphics.PorterDuff.Mode OVERLAY; + enum_constant public static final android.graphics.PorterDuff.Mode SCREEN; + enum_constant public static final android.graphics.PorterDuff.Mode SRC; + enum_constant public static final android.graphics.PorterDuff.Mode SRC_ATOP; + enum_constant public static final android.graphics.PorterDuff.Mode SRC_IN; + enum_constant public static final android.graphics.PorterDuff.Mode SRC_OUT; + enum_constant public static final android.graphics.PorterDuff.Mode SRC_OVER; + enum_constant public static final android.graphics.PorterDuff.Mode XOR; + } + + public class PorterDuffColorFilter extends android.graphics.ColorFilter { + ctor public PorterDuffColorFilter(int, android.graphics.PorterDuff.Mode); + } + + public class PorterDuffXfermode extends android.graphics.Xfermode { + ctor public PorterDuffXfermode(android.graphics.PorterDuff.Mode); + } + + public class RadialGradient extends android.graphics.Shader { + ctor public RadialGradient(float, float, float, int[], float[], android.graphics.Shader.TileMode); + ctor public RadialGradient(float, float, float, int, int, android.graphics.Shader.TileMode); + } + + public class Rasterizer { + ctor public Rasterizer(); + } + + public final class Rect implements android.os.Parcelable { + ctor public Rect(); + ctor public Rect(int, int, int, int); + ctor public Rect(android.graphics.Rect); + method public final int centerX(); + method public final int centerY(); + method public boolean contains(int, int); + method public boolean contains(int, int, int, int); + method public boolean contains(android.graphics.Rect); + method public int describeContents(); + method public final float exactCenterX(); + method public final float exactCenterY(); + method public java.lang.String flattenToString(); + method public final int height(); + method public void inset(int, int); + method public boolean intersect(int, int, int, int); + method public boolean intersect(android.graphics.Rect); + method public boolean intersects(int, int, int, int); + method public static boolean intersects(android.graphics.Rect, android.graphics.Rect); + method public final boolean isEmpty(); + method public void offset(int, int); + method public void offsetTo(int, int); + method public void readFromParcel(android.os.Parcel); + method public void set(int, int, int, int); + method public void set(android.graphics.Rect); + method public void setEmpty(); + method public boolean setIntersect(android.graphics.Rect, android.graphics.Rect); + method public void sort(); + method public java.lang.String toShortString(); + method public static android.graphics.Rect unflattenFromString(java.lang.String); + method public void union(int, int, int, int); + method public void union(android.graphics.Rect); + method public void union(int, int); + method public final int width(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + field public int bottom; + field public int left; + field public int right; + field public int top; + } + + public class RectF implements android.os.Parcelable { + ctor public RectF(); + ctor public RectF(float, float, float, float); + ctor public RectF(android.graphics.RectF); + ctor public RectF(android.graphics.Rect); + method public final float centerX(); + method public final float centerY(); + method public boolean contains(float, float); + method public boolean contains(float, float, float, float); + method public boolean contains(android.graphics.RectF); + method public int describeContents(); + method public final float height(); + method public void inset(float, float); + method public boolean intersect(float, float, float, float); + method public boolean intersect(android.graphics.RectF); + method public boolean intersects(float, float, float, float); + method public static boolean intersects(android.graphics.RectF, android.graphics.RectF); + method public final boolean isEmpty(); + method public void offset(float, float); + method public void offsetTo(float, float); + method public void readFromParcel(android.os.Parcel); + method public void round(android.graphics.Rect); + method public void roundOut(android.graphics.Rect); + method public void set(float, float, float, float); + method public void set(android.graphics.RectF); + method public void set(android.graphics.Rect); + method public void setEmpty(); + method public boolean setIntersect(android.graphics.RectF, android.graphics.RectF); + method public void sort(); + method public java.lang.String toShortString(); + method public void union(float, float, float, float); + method public void union(android.graphics.RectF); + method public void union(float, float); + method public final float width(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + field public float bottom; + field public float left; + field public float right; + field public float top; + } + + public class Region implements android.os.Parcelable { + ctor public Region(); + ctor public Region(android.graphics.Region); + ctor public Region(android.graphics.Rect); + ctor public Region(int, int, int, int); + method public boolean contains(int, int); + method public int describeContents(); + method public android.graphics.Path getBoundaryPath(); + method public boolean getBoundaryPath(android.graphics.Path); + method public android.graphics.Rect getBounds(); + method public boolean getBounds(android.graphics.Rect); + method public boolean isComplex(); + method public boolean isEmpty(); + method public boolean isRect(); + method public boolean op(android.graphics.Rect, android.graphics.Region.Op); + method public boolean op(int, int, int, int, android.graphics.Region.Op); + method public boolean op(android.graphics.Region, android.graphics.Region.Op); + method public boolean op(android.graphics.Rect, android.graphics.Region, android.graphics.Region.Op); + method public boolean op(android.graphics.Region, android.graphics.Region, android.graphics.Region.Op); + method public boolean quickContains(android.graphics.Rect); + method public boolean quickContains(int, int, int, int); + method public boolean quickReject(android.graphics.Rect); + method public boolean quickReject(int, int, int, int); + method public boolean quickReject(android.graphics.Region); + method public boolean set(android.graphics.Region); + method public boolean set(android.graphics.Rect); + method public boolean set(int, int, int, int); + method public void setEmpty(); + method public boolean setPath(android.graphics.Path, android.graphics.Region); + method public void translate(int, int); + method public void translate(int, int, android.graphics.Region); + method public final boolean union(android.graphics.Rect); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + } + + public static final class Region.Op extends java.lang.Enum { + method public static android.graphics.Region.Op valueOf(java.lang.String); + method public static final android.graphics.Region.Op[] values(); + enum_constant public static final android.graphics.Region.Op DIFFERENCE; + enum_constant public static final android.graphics.Region.Op INTERSECT; + enum_constant public static final android.graphics.Region.Op REPLACE; + enum_constant public static final android.graphics.Region.Op REVERSE_DIFFERENCE; + enum_constant public static final android.graphics.Region.Op UNION; + enum_constant public static final android.graphics.Region.Op XOR; + } + + public class RegionIterator { + ctor public RegionIterator(android.graphics.Region); + method public final boolean next(android.graphics.Rect); + } + + public class Shader { + ctor public Shader(); + method public boolean getLocalMatrix(android.graphics.Matrix); + method public void setLocalMatrix(android.graphics.Matrix); + } + + public static final class Shader.TileMode extends java.lang.Enum { + method public static android.graphics.Shader.TileMode valueOf(java.lang.String); + method public static final android.graphics.Shader.TileMode[] values(); + enum_constant public static final android.graphics.Shader.TileMode CLAMP; + enum_constant public static final android.graphics.Shader.TileMode MIRROR; + enum_constant public static final android.graphics.Shader.TileMode REPEAT; + } + + public class SumPathEffect extends android.graphics.PathEffect { + ctor public SumPathEffect(android.graphics.PathEffect, android.graphics.PathEffect); + } + + public class SurfaceTexture { + ctor public SurfaceTexture(int); + method public void attachToGLContext(int); + method public void detachFromGLContext(); + method public long getTimestamp(); + method public void getTransformMatrix(float[]); + method public void release(); + method public void setDefaultBufferSize(int, int); + method public void setOnFrameAvailableListener(android.graphics.SurfaceTexture.OnFrameAvailableListener); + method public void updateTexImage(); + } + + public static abstract interface SurfaceTexture.OnFrameAvailableListener { + method public abstract void onFrameAvailable(android.graphics.SurfaceTexture); + } + + public static class SurfaceTexture.OutOfResourcesException extends java.lang.Exception { + ctor public SurfaceTexture.OutOfResourcesException(); + ctor public SurfaceTexture.OutOfResourcesException(java.lang.String); + } + + public class SweepGradient extends android.graphics.Shader { + ctor public SweepGradient(float, float, int[], float[]); + ctor public SweepGradient(float, float, int, int); + } + + public class Typeface { + method public static android.graphics.Typeface create(java.lang.String, int); + method public static android.graphics.Typeface create(android.graphics.Typeface, int); + method public static android.graphics.Typeface createFromAsset(android.content.res.AssetManager, java.lang.String); + method public static android.graphics.Typeface createFromFile(java.io.File); + method public static android.graphics.Typeface createFromFile(java.lang.String); + method public static android.graphics.Typeface defaultFromStyle(int); + method public int getStyle(); + method public final boolean isBold(); + method public final boolean isItalic(); + field public static final int BOLD = 1; // 0x1 + field public static final int BOLD_ITALIC = 3; // 0x3 + field public static final android.graphics.Typeface DEFAULT; + field public static final android.graphics.Typeface DEFAULT_BOLD; + field public static final int ITALIC = 2; // 0x2 + field public static final android.graphics.Typeface MONOSPACE; + field public static final int NORMAL = 0; // 0x0 + field public static final android.graphics.Typeface SANS_SERIF; + field public static final android.graphics.Typeface SERIF; + } + + public class Xfermode { + ctor public Xfermode(); + } + + public class YuvImage { + ctor public YuvImage(byte[], int, int, int, int[]); + method public boolean compressToJpeg(android.graphics.Rect, int, java.io.OutputStream); + method public int getHeight(); + method public int[] getStrides(); + method public int getWidth(); + method public byte[] getYuvData(); + method public int getYuvFormat(); + } + +} + +package android.graphics.drawable { + + public abstract interface Animatable { + method public abstract boolean isRunning(); + method public abstract void start(); + method public abstract void stop(); + } + + public class AnimationDrawable extends android.graphics.drawable.DrawableContainer implements android.graphics.drawable.Animatable java.lang.Runnable { + ctor public AnimationDrawable(); + method public void addFrame(android.graphics.drawable.Drawable, int); + method public int getDuration(int); + method public android.graphics.drawable.Drawable getFrame(int); + method public int getNumberOfFrames(); + method public boolean isOneShot(); + method public boolean isRunning(); + method public void run(); + method public void setOneShot(boolean); + method public void start(); + method public void stop(); + } + + public class BitmapDrawable extends android.graphics.drawable.Drawable { + ctor public deprecated BitmapDrawable(); + ctor public BitmapDrawable(android.content.res.Resources); + ctor public deprecated BitmapDrawable(android.graphics.Bitmap); + ctor public BitmapDrawable(android.content.res.Resources, android.graphics.Bitmap); + ctor public deprecated BitmapDrawable(java.lang.String); + ctor public BitmapDrawable(android.content.res.Resources, java.lang.String); + ctor public deprecated BitmapDrawable(java.io.InputStream); + ctor public BitmapDrawable(android.content.res.Resources, java.io.InputStream); + method public void draw(android.graphics.Canvas); + method public final android.graphics.Bitmap getBitmap(); + method public final android.graphics.drawable.Drawable.ConstantState getConstantState(); + method public int getGravity(); + method public int getOpacity(); + method public final android.graphics.Paint getPaint(); + method public android.graphics.Shader.TileMode getTileModeX(); + method public android.graphics.Shader.TileMode getTileModeY(); + method public void setAlpha(int); + method public void setAntiAlias(boolean); + method public void setColorFilter(android.graphics.ColorFilter); + method public void setGravity(int); + method public void setTargetDensity(android.graphics.Canvas); + method public void setTargetDensity(android.util.DisplayMetrics); + method public void setTargetDensity(int); + method public void setTileModeX(android.graphics.Shader.TileMode); + method public void setTileModeXY(android.graphics.Shader.TileMode, android.graphics.Shader.TileMode); + method public final void setTileModeY(android.graphics.Shader.TileMode); + } + + public class ClipDrawable extends android.graphics.drawable.Drawable implements android.graphics.drawable.Drawable.Callback { + ctor public ClipDrawable(android.graphics.drawable.Drawable, int, int); + method public void draw(android.graphics.Canvas); + method public int getOpacity(); + method public void invalidateDrawable(android.graphics.drawable.Drawable); + method public void scheduleDrawable(android.graphics.drawable.Drawable, java.lang.Runnable, long); + method public void setAlpha(int); + method public void setColorFilter(android.graphics.ColorFilter); + method public void unscheduleDrawable(android.graphics.drawable.Drawable, java.lang.Runnable); + field public static final int HORIZONTAL = 1; // 0x1 + field public static final int VERTICAL = 2; // 0x2 + } + + public class ColorDrawable extends android.graphics.drawable.Drawable { + ctor public ColorDrawable(); + ctor public ColorDrawable(int); + method public void draw(android.graphics.Canvas); + method public int getAlpha(); + method public int getColor(); + method public int getOpacity(); + method public void setAlpha(int); + method public void setColor(int); + method public void setColorFilter(android.graphics.ColorFilter); + } + + public abstract class Drawable { + ctor public Drawable(); + method public void clearColorFilter(); + method public final void copyBounds(android.graphics.Rect); + method public final android.graphics.Rect copyBounds(); + method public static android.graphics.drawable.Drawable createFromPath(java.lang.String); + method public static android.graphics.drawable.Drawable createFromResourceStream(android.content.res.Resources, android.util.TypedValue, java.io.InputStream, java.lang.String); + method public static android.graphics.drawable.Drawable createFromResourceStream(android.content.res.Resources, android.util.TypedValue, java.io.InputStream, java.lang.String, android.graphics.BitmapFactory.Options); + method public static android.graphics.drawable.Drawable createFromStream(java.io.InputStream, java.lang.String); + method public static android.graphics.drawable.Drawable createFromXml(android.content.res.Resources, org.xmlpull.v1.XmlPullParser) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException; + method public static android.graphics.drawable.Drawable createFromXmlInner(android.content.res.Resources, org.xmlpull.v1.XmlPullParser, android.util.AttributeSet) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException; + method public abstract void draw(android.graphics.Canvas); + method public final android.graphics.Rect getBounds(); + method public android.graphics.drawable.Drawable.Callback getCallback(); + method public int getChangingConfigurations(); + method public android.graphics.drawable.Drawable.ConstantState getConstantState(); + method public android.graphics.drawable.Drawable getCurrent(); + method public int getIntrinsicHeight(); + method public int getIntrinsicWidth(); + method public final int getLevel(); + method public int getMinimumHeight(); + method public int getMinimumWidth(); + method public abstract int getOpacity(); + method public boolean getPadding(android.graphics.Rect); + method public int[] getState(); + method public android.graphics.Region getTransparentRegion(); + method public void inflate(android.content.res.Resources, org.xmlpull.v1.XmlPullParser, android.util.AttributeSet) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException; + method public void invalidateSelf(); + method public boolean isStateful(); + method public final boolean isVisible(); + method public void jumpToCurrentState(); + method public android.graphics.drawable.Drawable mutate(); + method protected void onBoundsChange(android.graphics.Rect); + method protected boolean onLevelChange(int); + method protected boolean onStateChange(int[]); + method public static int resolveOpacity(int, int); + method public void scheduleSelf(java.lang.Runnable, long); + method public abstract void setAlpha(int); + method public void setBounds(int, int, int, int); + method public void setBounds(android.graphics.Rect); + method public final void setCallback(android.graphics.drawable.Drawable.Callback); + method public void setChangingConfigurations(int); + method public abstract void setColorFilter(android.graphics.ColorFilter); + method public void setColorFilter(int, android.graphics.PorterDuff.Mode); + method public void setDither(boolean); + method public void setFilterBitmap(boolean); + method public final boolean setLevel(int); + method public boolean setState(int[]); + method public boolean setVisible(boolean, boolean); + method public void unscheduleSelf(java.lang.Runnable); + } + + public static abstract interface Drawable.Callback { + method public abstract void invalidateDrawable(android.graphics.drawable.Drawable); + method public abstract void scheduleDrawable(android.graphics.drawable.Drawable, java.lang.Runnable, long); + method public abstract void unscheduleDrawable(android.graphics.drawable.Drawable, java.lang.Runnable); + } + + public static abstract class Drawable.ConstantState { + ctor public Drawable.ConstantState(); + method public abstract int getChangingConfigurations(); + method public abstract android.graphics.drawable.Drawable newDrawable(); + method public android.graphics.drawable.Drawable newDrawable(android.content.res.Resources); + } + + public class DrawableContainer extends android.graphics.drawable.Drawable implements android.graphics.drawable.Drawable.Callback { + ctor public DrawableContainer(); + method public void draw(android.graphics.Canvas); + method public int getOpacity(); + method public void invalidateDrawable(android.graphics.drawable.Drawable); + method public void scheduleDrawable(android.graphics.drawable.Drawable, java.lang.Runnable, long); + method public boolean selectDrawable(int); + method public void setAlpha(int); + method public void setColorFilter(android.graphics.ColorFilter); + method protected void setConstantState(android.graphics.drawable.DrawableContainer.DrawableContainerState); + method public void setEnterFadeDuration(int); + method public void setExitFadeDuration(int); + method public void unscheduleDrawable(android.graphics.drawable.Drawable, java.lang.Runnable); + } + + public static abstract class DrawableContainer.DrawableContainerState extends android.graphics.drawable.Drawable.ConstantState { + method public final int addChild(android.graphics.drawable.Drawable); + method public synchronized boolean canConstantState(); + method protected void computeConstantSize(); + method public int getChangingConfigurations(); + method public final int getChildCount(); + method public final android.graphics.drawable.Drawable[] getChildren(); + method public final int getConstantHeight(); + method public final int getConstantMinimumHeight(); + method public final int getConstantMinimumWidth(); + method public final android.graphics.Rect getConstantPadding(); + method public final int getConstantWidth(); + method public final int getEnterFadeDuration(); + method public final int getExitFadeDuration(); + method public final int getOpacity(); + method public void growArray(int, int); + method public final boolean isConstantSize(); + method public final boolean isStateful(); + method public final void setConstantSize(boolean); + method public final void setEnterFadeDuration(int); + method public final void setExitFadeDuration(int); + method public final void setVariablePadding(boolean); + } + + public class GradientDrawable extends android.graphics.drawable.Drawable { + ctor public GradientDrawable(); + ctor public GradientDrawable(android.graphics.drawable.GradientDrawable.Orientation, int[]); + method public void draw(android.graphics.Canvas); + method public int getOpacity(); + method public android.graphics.drawable.GradientDrawable.Orientation getOrientation(); + method public void setAlpha(int); + method public void setColor(int); + method public void setColorFilter(android.graphics.ColorFilter); + method public void setColors(int[]); + method public void setCornerRadii(float[]); + method public void setCornerRadius(float); + method public void setGradientCenter(float, float); + method public void setGradientRadius(float); + method public void setGradientType(int); + method public void setOrientation(android.graphics.drawable.GradientDrawable.Orientation); + method public void setShape(int); + method public void setSize(int, int); + method public void setStroke(int, int); + method public void setStroke(int, int, float, float); + method public void setUseLevel(boolean); + field public static final int LINE = 2; // 0x2 + field public static final int LINEAR_GRADIENT = 0; // 0x0 + field public static final int OVAL = 1; // 0x1 + field public static final int RADIAL_GRADIENT = 1; // 0x1 + field public static final int RECTANGLE = 0; // 0x0 + field public static final int RING = 3; // 0x3 + field public static final int SWEEP_GRADIENT = 2; // 0x2 + } + + public static final class GradientDrawable.Orientation extends java.lang.Enum { + method public static android.graphics.drawable.GradientDrawable.Orientation valueOf(java.lang.String); + method public static final android.graphics.drawable.GradientDrawable.Orientation[] values(); + enum_constant public static final android.graphics.drawable.GradientDrawable.Orientation BL_TR; + enum_constant public static final android.graphics.drawable.GradientDrawable.Orientation BOTTOM_TOP; + enum_constant public static final android.graphics.drawable.GradientDrawable.Orientation BR_TL; + enum_constant public static final android.graphics.drawable.GradientDrawable.Orientation LEFT_RIGHT; + enum_constant public static final android.graphics.drawable.GradientDrawable.Orientation RIGHT_LEFT; + enum_constant public static final android.graphics.drawable.GradientDrawable.Orientation TL_BR; + enum_constant public static final android.graphics.drawable.GradientDrawable.Orientation TOP_BOTTOM; + enum_constant public static final android.graphics.drawable.GradientDrawable.Orientation TR_BL; + } + + public class InsetDrawable extends android.graphics.drawable.Drawable implements android.graphics.drawable.Drawable.Callback { + ctor public InsetDrawable(android.graphics.drawable.Drawable, int); + ctor public InsetDrawable(android.graphics.drawable.Drawable, int, int, int, int); + method public void draw(android.graphics.Canvas); + method public int getOpacity(); + method public void invalidateDrawable(android.graphics.drawable.Drawable); + method public void scheduleDrawable(android.graphics.drawable.Drawable, java.lang.Runnable, long); + method public void setAlpha(int); + method public void setColorFilter(android.graphics.ColorFilter); + method public void unscheduleDrawable(android.graphics.drawable.Drawable, java.lang.Runnable); + } + + public class LayerDrawable extends android.graphics.drawable.Drawable implements android.graphics.drawable.Drawable.Callback { + ctor public LayerDrawable(android.graphics.drawable.Drawable[]); + method public void draw(android.graphics.Canvas); + method public android.graphics.drawable.Drawable findDrawableByLayerId(int); + method public android.graphics.drawable.Drawable getDrawable(int); + method public int getId(int); + method public int getNumberOfLayers(); + method public int getOpacity(); + method public void invalidateDrawable(android.graphics.drawable.Drawable); + method public void scheduleDrawable(android.graphics.drawable.Drawable, java.lang.Runnable, long); + method public void setAlpha(int); + method public void setColorFilter(android.graphics.ColorFilter); + method public boolean setDrawableByLayerId(int, android.graphics.drawable.Drawable); + method public void setId(int, int); + method public void setLayerInset(int, int, int, int, int); + method public void setOpacity(int); + method public void unscheduleDrawable(android.graphics.drawable.Drawable, java.lang.Runnable); + } + + public class LevelListDrawable extends android.graphics.drawable.DrawableContainer { + ctor public LevelListDrawable(); + method public void addLevel(int, int, android.graphics.drawable.Drawable); + } + + public class NinePatchDrawable extends android.graphics.drawable.Drawable { + ctor public deprecated NinePatchDrawable(android.graphics.Bitmap, byte[], android.graphics.Rect, java.lang.String); + ctor public NinePatchDrawable(android.content.res.Resources, android.graphics.Bitmap, byte[], android.graphics.Rect, java.lang.String); + ctor public deprecated NinePatchDrawable(android.graphics.NinePatch); + ctor public NinePatchDrawable(android.content.res.Resources, android.graphics.NinePatch); + method public void draw(android.graphics.Canvas); + method public int getOpacity(); + method public android.graphics.Paint getPaint(); + method public void setAlpha(int); + method public void setColorFilter(android.graphics.ColorFilter); + method public void setTargetDensity(android.graphics.Canvas); + method public void setTargetDensity(android.util.DisplayMetrics); + method public void setTargetDensity(int); + } + + public class PaintDrawable extends android.graphics.drawable.ShapeDrawable { + ctor public PaintDrawable(); + ctor public PaintDrawable(int); + method public void setCornerRadii(float[]); + method public void setCornerRadius(float); + } + + public class PictureDrawable extends android.graphics.drawable.Drawable { + ctor public PictureDrawable(android.graphics.Picture); + method public void draw(android.graphics.Canvas); + method public int getOpacity(); + method public android.graphics.Picture getPicture(); + method public void setAlpha(int); + method public void setColorFilter(android.graphics.ColorFilter); + method public void setPicture(android.graphics.Picture); + } + + public class RotateDrawable extends android.graphics.drawable.Drawable implements android.graphics.drawable.Drawable.Callback { + ctor public RotateDrawable(); + method public void draw(android.graphics.Canvas); + method public android.graphics.drawable.Drawable getDrawable(); + method public int getOpacity(); + method public void invalidateDrawable(android.graphics.drawable.Drawable); + method public void scheduleDrawable(android.graphics.drawable.Drawable, java.lang.Runnable, long); + method public void setAlpha(int); + method public void setColorFilter(android.graphics.ColorFilter); + method public void unscheduleDrawable(android.graphics.drawable.Drawable, java.lang.Runnable); + } + + public class ScaleDrawable extends android.graphics.drawable.Drawable implements android.graphics.drawable.Drawable.Callback { + ctor public ScaleDrawable(android.graphics.drawable.Drawable, int, float, float); + method public void draw(android.graphics.Canvas); + method public android.graphics.drawable.Drawable getDrawable(); + method public int getOpacity(); + method public void invalidateDrawable(android.graphics.drawable.Drawable); + method public void scheduleDrawable(android.graphics.drawable.Drawable, java.lang.Runnable, long); + method public void setAlpha(int); + method public void setColorFilter(android.graphics.ColorFilter); + method public void unscheduleDrawable(android.graphics.drawable.Drawable, java.lang.Runnable); + } + + public class ShapeDrawable extends android.graphics.drawable.Drawable { + ctor public ShapeDrawable(); + ctor public ShapeDrawable(android.graphics.drawable.shapes.Shape); + method public void draw(android.graphics.Canvas); + method public int getOpacity(); + method public android.graphics.Paint getPaint(); + method public android.graphics.drawable.ShapeDrawable.ShaderFactory getShaderFactory(); + method public android.graphics.drawable.shapes.Shape getShape(); + method protected boolean inflateTag(java.lang.String, android.content.res.Resources, org.xmlpull.v1.XmlPullParser, android.util.AttributeSet); + method protected void onDraw(android.graphics.drawable.shapes.Shape, android.graphics.Canvas, android.graphics.Paint); + method public void setAlpha(int); + method public void setColorFilter(android.graphics.ColorFilter); + method public void setIntrinsicHeight(int); + method public void setIntrinsicWidth(int); + method public void setPadding(int, int, int, int); + method public void setPadding(android.graphics.Rect); + method public void setShaderFactory(android.graphics.drawable.ShapeDrawable.ShaderFactory); + method public void setShape(android.graphics.drawable.shapes.Shape); + } + + public static abstract class ShapeDrawable.ShaderFactory { + ctor public ShapeDrawable.ShaderFactory(); + method public abstract android.graphics.Shader resize(int, int); + } + + public class StateListDrawable extends android.graphics.drawable.DrawableContainer { + ctor public StateListDrawable(); + method public void addState(int[], android.graphics.drawable.Drawable); + } + + public class TransitionDrawable extends android.graphics.drawable.LayerDrawable implements android.graphics.drawable.Drawable.Callback { + ctor public TransitionDrawable(android.graphics.drawable.Drawable[]); + method public boolean isCrossFadeEnabled(); + method public void resetTransition(); + method public void reverseTransition(int); + method public void setCrossFadeEnabled(boolean); + method public void startTransition(int); + } + +} + +package android.graphics.drawable.shapes { + + public class ArcShape extends android.graphics.drawable.shapes.RectShape { + ctor public ArcShape(float, float); + } + + public class OvalShape extends android.graphics.drawable.shapes.RectShape { + ctor public OvalShape(); + } + + public class PathShape extends android.graphics.drawable.shapes.Shape { + ctor public PathShape(android.graphics.Path, float, float); + method public void draw(android.graphics.Canvas, android.graphics.Paint); + } + + public class RectShape extends android.graphics.drawable.shapes.Shape { + ctor public RectShape(); + method public void draw(android.graphics.Canvas, android.graphics.Paint); + method protected final android.graphics.RectF rect(); + } + + public class RoundRectShape extends android.graphics.drawable.shapes.RectShape { + ctor public RoundRectShape(float[], android.graphics.RectF, float[]); + } + + public abstract class Shape implements java.lang.Cloneable { + ctor public Shape(); + method public android.graphics.drawable.shapes.Shape clone() throws java.lang.CloneNotSupportedException; + method public abstract void draw(android.graphics.Canvas, android.graphics.Paint); + method public final float getHeight(); + method public final float getWidth(); + method public boolean hasAlpha(); + method protected void onResize(float, float); + method public final void resize(float, float); + } + +} + +package android.hardware { + + public class Camera { + method public final void addCallbackBuffer(byte[]); + method public final void autoFocus(android.hardware.Camera.AutoFocusCallback); + method public final void cancelAutoFocus(); + method public final boolean enableShutterSound(boolean); + method public static void getCameraInfo(int, android.hardware.Camera.CameraInfo); + method public static int getNumberOfCameras(); + method public android.hardware.Camera.Parameters getParameters(); + method public final void lock(); + method public static android.hardware.Camera open(int); + method public static android.hardware.Camera open(); + method public final void reconnect() throws java.io.IOException; + method public final void release(); + method public void setAutoFocusMoveCallback(android.hardware.Camera.AutoFocusMoveCallback); + method public final void setDisplayOrientation(int); + method public final void setErrorCallback(android.hardware.Camera.ErrorCallback); + method public final void setFaceDetectionListener(android.hardware.Camera.FaceDetectionListener); + method public final void setOneShotPreviewCallback(android.hardware.Camera.PreviewCallback); + method public void setParameters(android.hardware.Camera.Parameters); + method public final void setPreviewCallback(android.hardware.Camera.PreviewCallback); + method public final void setPreviewCallbackWithBuffer(android.hardware.Camera.PreviewCallback); + method public final void setPreviewDisplay(android.view.SurfaceHolder) throws java.io.IOException; + method public final void setPreviewTexture(android.graphics.SurfaceTexture) throws java.io.IOException; + method public final void setZoomChangeListener(android.hardware.Camera.OnZoomChangeListener); + method public final void startFaceDetection(); + method public final void startPreview(); + method public final void startSmoothZoom(int); + method public final void stopFaceDetection(); + method public final void stopPreview(); + method public final void stopSmoothZoom(); + method public final void takePicture(android.hardware.Camera.ShutterCallback, android.hardware.Camera.PictureCallback, android.hardware.Camera.PictureCallback); + method public final void takePicture(android.hardware.Camera.ShutterCallback, android.hardware.Camera.PictureCallback, android.hardware.Camera.PictureCallback, android.hardware.Camera.PictureCallback); + method public final void unlock(); + field public static final java.lang.String ACTION_NEW_PICTURE = "android.hardware.action.NEW_PICTURE"; + field public static final java.lang.String ACTION_NEW_VIDEO = "android.hardware.action.NEW_VIDEO"; + field public static final int CAMERA_ERROR_SERVER_DIED = 100; // 0x64 + field public static final int CAMERA_ERROR_UNKNOWN = 1; // 0x1 + } + + public static class Camera.Area { + ctor public Camera.Area(android.graphics.Rect, int); + field public android.graphics.Rect rect; + field public int weight; + } + + public static abstract interface Camera.AutoFocusCallback { + method public abstract void onAutoFocus(boolean, android.hardware.Camera); + } + + public static abstract interface Camera.AutoFocusMoveCallback { + method public abstract void onAutoFocusMoving(boolean, android.hardware.Camera); + } + + public static class Camera.CameraInfo { + ctor public Camera.CameraInfo(); + field public static final int CAMERA_FACING_BACK = 0; // 0x0 + field public static final int CAMERA_FACING_FRONT = 1; // 0x1 + field public boolean canDisableShutterSound; + field public int facing; + field public int orientation; + } + + public static abstract interface Camera.ErrorCallback { + method public abstract void onError(int, android.hardware.Camera); + } + + public static class Camera.Face { + ctor public Camera.Face(); + field public int id; + field public android.graphics.Point leftEye; + field public android.graphics.Point mouth; + field public android.graphics.Rect rect; + field public android.graphics.Point rightEye; + field public int score; + } + + public static abstract interface Camera.FaceDetectionListener { + method public abstract void onFaceDetection(android.hardware.Camera.Face[], android.hardware.Camera); + } + + public static abstract interface Camera.OnZoomChangeListener { + method public abstract void onZoomChange(int, boolean, android.hardware.Camera); + } + + public class Camera.Parameters { + method public java.lang.String flatten(); + method public java.lang.String get(java.lang.String); + method public java.lang.String getAntibanding(); + method public boolean getAutoExposureLock(); + method public boolean getAutoWhiteBalanceLock(); + method public java.lang.String getColorEffect(); + method public int getExposureCompensation(); + method public float getExposureCompensationStep(); + method public java.lang.String getFlashMode(); + method public float getFocalLength(); + method public java.util.List getFocusAreas(); + method public void getFocusDistances(float[]); + method public java.lang.String getFocusMode(); + method public float getHorizontalViewAngle(); + method public int getInt(java.lang.String); + method public int getJpegQuality(); + method public int getJpegThumbnailQuality(); + method public android.hardware.Camera.Size getJpegThumbnailSize(); + method public int getMaxExposureCompensation(); + method public int getMaxNumDetectedFaces(); + method public int getMaxNumFocusAreas(); + method public int getMaxNumMeteringAreas(); + method public int getMaxZoom(); + method public java.util.List getMeteringAreas(); + method public int getMinExposureCompensation(); + method public int getPictureFormat(); + method public android.hardware.Camera.Size getPictureSize(); + method public android.hardware.Camera.Size getPreferredPreviewSizeForVideo(); + method public int getPreviewFormat(); + method public void getPreviewFpsRange(int[]); + method public deprecated int getPreviewFrameRate(); + method public android.hardware.Camera.Size getPreviewSize(); + method public java.lang.String getSceneMode(); + method public java.util.List getSupportedAntibanding(); + method public java.util.List getSupportedColorEffects(); + method public java.util.List getSupportedFlashModes(); + method public java.util.List getSupportedFocusModes(); + method public java.util.List getSupportedJpegThumbnailSizes(); + method public java.util.List getSupportedPictureFormats(); + method public java.util.List getSupportedPictureSizes(); + method public java.util.List getSupportedPreviewFormats(); + method public java.util.List getSupportedPreviewFpsRange(); + method public deprecated java.util.List getSupportedPreviewFrameRates(); + method public java.util.List getSupportedPreviewSizes(); + method public java.util.List getSupportedSceneModes(); + method public java.util.List getSupportedVideoSizes(); + method public java.util.List getSupportedWhiteBalance(); + method public float getVerticalViewAngle(); + method public boolean getVideoStabilization(); + method public java.lang.String getWhiteBalance(); + method public int getZoom(); + method public java.util.List getZoomRatios(); + method public boolean isAutoExposureLockSupported(); + method public boolean isAutoWhiteBalanceLockSupported(); + method public boolean isSmoothZoomSupported(); + method public boolean isVideoSnapshotSupported(); + method public boolean isVideoStabilizationSupported(); + method public boolean isZoomSupported(); + method public void remove(java.lang.String); + method public void removeGpsData(); + method public void set(java.lang.String, java.lang.String); + method public void set(java.lang.String, int); + method public void setAntibanding(java.lang.String); + method public void setAutoExposureLock(boolean); + method public void setAutoWhiteBalanceLock(boolean); + method public void setColorEffect(java.lang.String); + method public void setExposureCompensation(int); + method public void setFlashMode(java.lang.String); + method public void setFocusAreas(java.util.List); + method public void setFocusMode(java.lang.String); + method public void setGpsAltitude(double); + method public void setGpsLatitude(double); + method public void setGpsLongitude(double); + method public void setGpsProcessingMethod(java.lang.String); + method public void setGpsTimestamp(long); + method public void setJpegQuality(int); + method public void setJpegThumbnailQuality(int); + method public void setJpegThumbnailSize(int, int); + method public void setMeteringAreas(java.util.List); + method public void setPictureFormat(int); + method public void setPictureSize(int, int); + method public void setPreviewFormat(int); + method public void setPreviewFpsRange(int, int); + method public deprecated void setPreviewFrameRate(int); + method public void setPreviewSize(int, int); + method public void setRecordingHint(boolean); + method public void setRotation(int); + method public void setSceneMode(java.lang.String); + method public void setVideoStabilization(boolean); + method public void setWhiteBalance(java.lang.String); + method public void setZoom(int); + method public void unflatten(java.lang.String); + field public static final java.lang.String ANTIBANDING_50HZ = "50hz"; + field public static final java.lang.String ANTIBANDING_60HZ = "60hz"; + field public static final java.lang.String ANTIBANDING_AUTO = "auto"; + field public static final java.lang.String ANTIBANDING_OFF = "off"; + field public static final java.lang.String EFFECT_AQUA = "aqua"; + field public static final java.lang.String EFFECT_BLACKBOARD = "blackboard"; + field public static final java.lang.String EFFECT_MONO = "mono"; + field public static final java.lang.String EFFECT_NEGATIVE = "negative"; + field public static final java.lang.String EFFECT_NONE = "none"; + field public static final java.lang.String EFFECT_POSTERIZE = "posterize"; + field public static final java.lang.String EFFECT_SEPIA = "sepia"; + field public static final java.lang.String EFFECT_SOLARIZE = "solarize"; + field public static final java.lang.String EFFECT_WHITEBOARD = "whiteboard"; + field public static final java.lang.String FLASH_MODE_AUTO = "auto"; + field public static final java.lang.String FLASH_MODE_OFF = "off"; + field public static final java.lang.String FLASH_MODE_ON = "on"; + field public static final java.lang.String FLASH_MODE_RED_EYE = "red-eye"; + field public static final java.lang.String FLASH_MODE_TORCH = "torch"; + field public static final int FOCUS_DISTANCE_FAR_INDEX = 2; // 0x2 + field public static final int FOCUS_DISTANCE_NEAR_INDEX = 0; // 0x0 + field public static final int FOCUS_DISTANCE_OPTIMAL_INDEX = 1; // 0x1 + field public static final java.lang.String FOCUS_MODE_AUTO = "auto"; + field public static final java.lang.String FOCUS_MODE_CONTINUOUS_PICTURE = "continuous-picture"; + field public static final java.lang.String FOCUS_MODE_CONTINUOUS_VIDEO = "continuous-video"; + field public static final java.lang.String FOCUS_MODE_EDOF = "edof"; + field public static final java.lang.String FOCUS_MODE_FIXED = "fixed"; + field public static final java.lang.String FOCUS_MODE_INFINITY = "infinity"; + field public static final java.lang.String FOCUS_MODE_MACRO = "macro"; + field public static final int PREVIEW_FPS_MAX_INDEX = 1; // 0x1 + field public static final int PREVIEW_FPS_MIN_INDEX = 0; // 0x0 + field public static final java.lang.String SCENE_MODE_ACTION = "action"; + field public static final java.lang.String SCENE_MODE_AUTO = "auto"; + field public static final java.lang.String SCENE_MODE_BARCODE = "barcode"; + field public static final java.lang.String SCENE_MODE_BEACH = "beach"; + field public static final java.lang.String SCENE_MODE_CANDLELIGHT = "candlelight"; + field public static final java.lang.String SCENE_MODE_FIREWORKS = "fireworks"; + field public static final java.lang.String SCENE_MODE_HDR = "hdr"; + field public static final java.lang.String SCENE_MODE_LANDSCAPE = "landscape"; + field public static final java.lang.String SCENE_MODE_NIGHT = "night"; + field public static final java.lang.String SCENE_MODE_NIGHT_PORTRAIT = "night-portrait"; + field public static final java.lang.String SCENE_MODE_PARTY = "party"; + field public static final java.lang.String SCENE_MODE_PORTRAIT = "portrait"; + field public static final java.lang.String SCENE_MODE_SNOW = "snow"; + field public static final java.lang.String SCENE_MODE_SPORTS = "sports"; + field public static final java.lang.String SCENE_MODE_STEADYPHOTO = "steadyphoto"; + field public static final java.lang.String SCENE_MODE_SUNSET = "sunset"; + field public static final java.lang.String SCENE_MODE_THEATRE = "theatre"; + field public static final java.lang.String WHITE_BALANCE_AUTO = "auto"; + field public static final java.lang.String WHITE_BALANCE_CLOUDY_DAYLIGHT = "cloudy-daylight"; + field public static final java.lang.String WHITE_BALANCE_DAYLIGHT = "daylight"; + field public static final java.lang.String WHITE_BALANCE_FLUORESCENT = "fluorescent"; + field public static final java.lang.String WHITE_BALANCE_INCANDESCENT = "incandescent"; + field public static final java.lang.String WHITE_BALANCE_SHADE = "shade"; + field public static final java.lang.String WHITE_BALANCE_TWILIGHT = "twilight"; + field public static final java.lang.String WHITE_BALANCE_WARM_FLUORESCENT = "warm-fluorescent"; + } + + public static abstract interface Camera.PictureCallback { + method public abstract void onPictureTaken(byte[], android.hardware.Camera); + } + + public static abstract interface Camera.PreviewCallback { + method public abstract void onPreviewFrame(byte[], android.hardware.Camera); + } + + public static abstract interface Camera.ShutterCallback { + method public abstract void onShutter(); + } + + public class Camera.Size { + ctor public Camera.Size(int, int); + field public int height; + field public int width; + } + + public class GeomagneticField { + ctor public GeomagneticField(float, float, float, long); + method public float getDeclination(); + method public float getFieldStrength(); + method public float getHorizontalStrength(); + method public float getInclination(); + method public float getX(); + method public float getY(); + method public float getZ(); + } + + public final class Sensor { + method public float getMaximumRange(); + method public int getMinDelay(); + method public java.lang.String getName(); + method public float getPower(); + method public float getResolution(); + method public int getType(); + method public java.lang.String getVendor(); + method public int getVersion(); + field public static final int TYPE_ACCELEROMETER = 1; // 0x1 + field public static final int TYPE_ALL = -1; // 0xffffffff + field public static final int TYPE_AMBIENT_TEMPERATURE = 13; // 0xd + field public static final int TYPE_GRAVITY = 9; // 0x9 + field public static final int TYPE_GYROSCOPE = 4; // 0x4 + field public static final int TYPE_LIGHT = 5; // 0x5 + field public static final int TYPE_LINEAR_ACCELERATION = 10; // 0xa + field public static final int TYPE_MAGNETIC_FIELD = 2; // 0x2 + field public static final deprecated int TYPE_ORIENTATION = 3; // 0x3 + field public static final int TYPE_PRESSURE = 6; // 0x6 + field public static final int TYPE_PROXIMITY = 8; // 0x8 + field public static final int TYPE_RELATIVE_HUMIDITY = 12; // 0xc + field public static final int TYPE_ROTATION_VECTOR = 11; // 0xb + field public static final deprecated int TYPE_TEMPERATURE = 7; // 0x7 + } + + public class SensorEvent { + field public int accuracy; + field public android.hardware.Sensor sensor; + field public long timestamp; + field public final float[] values; + } + + public abstract interface SensorEventListener { + method public abstract void onAccuracyChanged(android.hardware.Sensor, int); + method public abstract void onSensorChanged(android.hardware.SensorEvent); + } + + public abstract deprecated interface SensorListener { + method public abstract void onAccuracyChanged(int, int); + method public abstract void onSensorChanged(int, float[]); + } + + public abstract class SensorManager { + method public static float getAltitude(float, float); + method public static void getAngleChange(float[], float[], float[]); + method public android.hardware.Sensor getDefaultSensor(int); + method public static float getInclination(float[]); + method public static float[] getOrientation(float[], float[]); + method public static void getQuaternionFromVector(float[], float[]); + method public static boolean getRotationMatrix(float[], float[], float[], float[]); + method public static void getRotationMatrixFromVector(float[], float[]); + method public java.util.List getSensorList(int); + method public deprecated int getSensors(); + method public deprecated boolean registerListener(android.hardware.SensorListener, int); + method public deprecated boolean registerListener(android.hardware.SensorListener, int, int); + method public boolean registerListener(android.hardware.SensorEventListener, android.hardware.Sensor, int); + method public boolean registerListener(android.hardware.SensorEventListener, android.hardware.Sensor, int, android.os.Handler); + method public static boolean remapCoordinateSystem(float[], int, int, float[]); + method public deprecated void unregisterListener(android.hardware.SensorListener); + method public deprecated void unregisterListener(android.hardware.SensorListener, int); + method public void unregisterListener(android.hardware.SensorEventListener, android.hardware.Sensor); + method public void unregisterListener(android.hardware.SensorEventListener); + field public static final int AXIS_MINUS_X = 129; // 0x81 + field public static final int AXIS_MINUS_Y = 130; // 0x82 + field public static final int AXIS_MINUS_Z = 131; // 0x83 + field public static final int AXIS_X = 1; // 0x1 + field public static final int AXIS_Y = 2; // 0x2 + field public static final int AXIS_Z = 3; // 0x3 + field public static final deprecated int DATA_X = 0; // 0x0 + field public static final deprecated int DATA_Y = 1; // 0x1 + field public static final deprecated int DATA_Z = 2; // 0x2 + field public static final float GRAVITY_DEATH_STAR_I = 3.5303614E-7f; + field public static final float GRAVITY_EARTH = 9.80665f; + field public static final float GRAVITY_JUPITER = 23.12f; + field public static final float GRAVITY_MARS = 3.71f; + field public static final float GRAVITY_MERCURY = 3.7f; + field public static final float GRAVITY_MOON = 1.6f; + field public static final float GRAVITY_NEPTUNE = 11.0f; + field public static final float GRAVITY_PLUTO = 0.6f; + field public static final float GRAVITY_SATURN = 8.96f; + field public static final float GRAVITY_SUN = 275.0f; + field public static final float GRAVITY_THE_ISLAND = 4.815162f; + field public static final float GRAVITY_URANUS = 8.69f; + field public static final float GRAVITY_VENUS = 8.87f; + field public static final float LIGHT_CLOUDY = 100.0f; + field public static final float LIGHT_FULLMOON = 0.25f; + field public static final float LIGHT_NO_MOON = 0.001f; + field public static final float LIGHT_OVERCAST = 10000.0f; + field public static final float LIGHT_SHADE = 20000.0f; + field public static final float LIGHT_SUNLIGHT = 110000.0f; + field public static final float LIGHT_SUNLIGHT_MAX = 120000.0f; + field public static final float LIGHT_SUNRISE = 400.0f; + field public static final float MAGNETIC_FIELD_EARTH_MAX = 60.0f; + field public static final float MAGNETIC_FIELD_EARTH_MIN = 30.0f; + field public static final float PRESSURE_STANDARD_ATMOSPHERE = 1013.25f; + field public static final deprecated int RAW_DATA_INDEX = 3; // 0x3 + field public static final deprecated int RAW_DATA_X = 3; // 0x3 + field public static final deprecated int RAW_DATA_Y = 4; // 0x4 + field public static final deprecated int RAW_DATA_Z = 5; // 0x5 + field public static final deprecated int SENSOR_ACCELEROMETER = 2; // 0x2 + field public static final deprecated int SENSOR_ALL = 127; // 0x7f + field public static final int SENSOR_DELAY_FASTEST = 0; // 0x0 + field public static final int SENSOR_DELAY_GAME = 1; // 0x1 + field public static final int SENSOR_DELAY_NORMAL = 3; // 0x3 + field public static final int SENSOR_DELAY_UI = 2; // 0x2 + field public static final deprecated int SENSOR_LIGHT = 16; // 0x10 + field public static final deprecated int SENSOR_MAGNETIC_FIELD = 8; // 0x8 + field public static final deprecated int SENSOR_MAX = 64; // 0x40 + field public static final deprecated int SENSOR_MIN = 1; // 0x1 + field public static final deprecated int SENSOR_ORIENTATION = 1; // 0x1 + field public static final deprecated int SENSOR_ORIENTATION_RAW = 128; // 0x80 + field public static final deprecated int SENSOR_PROXIMITY = 32; // 0x20 + field public static final int SENSOR_STATUS_ACCURACY_HIGH = 3; // 0x3 + field public static final int SENSOR_STATUS_ACCURACY_LOW = 1; // 0x1 + field public static final int SENSOR_STATUS_ACCURACY_MEDIUM = 2; // 0x2 + field public static final int SENSOR_STATUS_UNRELIABLE = 0; // 0x0 + field public static final deprecated int SENSOR_TEMPERATURE = 4; // 0x4 + field public static final deprecated int SENSOR_TRICORDER = 64; // 0x40 + field public static final float STANDARD_GRAVITY = 9.80665f; + } + +} + +package android.hardware.display { + + public final class DisplayManager { + method public android.view.Display getDisplay(int); + method public android.view.Display[] getDisplays(); + method public android.view.Display[] getDisplays(java.lang.String); + method public void registerDisplayListener(android.hardware.display.DisplayManager.DisplayListener, android.os.Handler); + method public void unregisterDisplayListener(android.hardware.display.DisplayManager.DisplayListener); + field public static final java.lang.String DISPLAY_CATEGORY_PRESENTATION = "android.hardware.display.category.PRESENTATION"; + } + + public static abstract interface DisplayManager.DisplayListener { + method public abstract void onDisplayAdded(int); + method public abstract void onDisplayChanged(int); + method public abstract void onDisplayRemoved(int); + } + +} + +package android.hardware.input { + + public final class InputManager { + method public android.view.InputDevice getInputDevice(int); + method public int[] getInputDeviceIds(); + method public void registerInputDeviceListener(android.hardware.input.InputManager.InputDeviceListener, android.os.Handler); + method public void unregisterInputDeviceListener(android.hardware.input.InputManager.InputDeviceListener); + field public static final java.lang.String ACTION_QUERY_KEYBOARD_LAYOUTS = "android.hardware.input.action.QUERY_KEYBOARD_LAYOUTS"; + field public static final java.lang.String META_DATA_KEYBOARD_LAYOUTS = "android.hardware.input.metadata.KEYBOARD_LAYOUTS"; + } + + public static abstract interface InputManager.InputDeviceListener { + method public abstract void onInputDeviceAdded(int); + method public abstract void onInputDeviceChanged(int); + method public abstract void onInputDeviceRemoved(int); + } + +} + +package android.hardware.usb { + + public class UsbAccessory implements android.os.Parcelable { + method public int describeContents(); + method public java.lang.String getDescription(); + method public java.lang.String getManufacturer(); + method public java.lang.String getModel(); + method public java.lang.String getSerial(); + method public java.lang.String getUri(); + method public java.lang.String getVersion(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + } + + public final class UsbConstants { + ctor public UsbConstants(); + field public static final int USB_CLASS_APP_SPEC = 254; // 0xfe + field public static final int USB_CLASS_AUDIO = 1; // 0x1 + field public static final int USB_CLASS_CDC_DATA = 10; // 0xa + field public static final int USB_CLASS_COMM = 2; // 0x2 + field public static final int USB_CLASS_CONTENT_SEC = 13; // 0xd + field public static final int USB_CLASS_CSCID = 11; // 0xb + field public static final int USB_CLASS_HID = 3; // 0x3 + field public static final int USB_CLASS_HUB = 9; // 0x9 + field public static final int USB_CLASS_MASS_STORAGE = 8; // 0x8 + field public static final int USB_CLASS_MISC = 239; // 0xef + field public static final int USB_CLASS_PER_INTERFACE = 0; // 0x0 + field public static final int USB_CLASS_PHYSICA = 5; // 0x5 + field public static final int USB_CLASS_PRINTER = 7; // 0x7 + field public static final int USB_CLASS_STILL_IMAGE = 6; // 0x6 + field public static final int USB_CLASS_VENDOR_SPEC = 255; // 0xff + field public static final int USB_CLASS_VIDEO = 14; // 0xe + field public static final int USB_CLASS_WIRELESS_CONTROLLER = 224; // 0xe0 + field public static final int USB_DIR_IN = 128; // 0x80 + field public static final int USB_DIR_OUT = 0; // 0x0 + field public static final int USB_ENDPOINT_DIR_MASK = 128; // 0x80 + field public static final int USB_ENDPOINT_NUMBER_MASK = 15; // 0xf + field public static final int USB_ENDPOINT_XFERTYPE_MASK = 3; // 0x3 + field public static final int USB_ENDPOINT_XFER_BULK = 2; // 0x2 + field public static final int USB_ENDPOINT_XFER_CONTROL = 0; // 0x0 + field public static final int USB_ENDPOINT_XFER_INT = 3; // 0x3 + field public static final int USB_ENDPOINT_XFER_ISOC = 1; // 0x1 + field public static final int USB_INTERFACE_SUBCLASS_BOOT = 1; // 0x1 + field public static final int USB_SUBCLASS_VENDOR_SPEC = 255; // 0xff + field public static final int USB_TYPE_CLASS = 32; // 0x20 + field public static final int USB_TYPE_MASK = 96; // 0x60 + field public static final int USB_TYPE_RESERVED = 96; // 0x60 + field public static final int USB_TYPE_STANDARD = 0; // 0x0 + field public static final int USB_TYPE_VENDOR = 64; // 0x40 + } + + public class UsbDevice implements android.os.Parcelable { + method public int describeContents(); + method public int getDeviceClass(); + method public int getDeviceId(); + method public static int getDeviceId(java.lang.String); + method public java.lang.String getDeviceName(); + method public static java.lang.String getDeviceName(int); + method public int getDeviceProtocol(); + method public int getDeviceSubclass(); + method public android.hardware.usb.UsbInterface getInterface(int); + method public int getInterfaceCount(); + method public int getProductId(); + method public int getVendorId(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + } + + public class UsbDeviceConnection { + method public int bulkTransfer(android.hardware.usb.UsbEndpoint, byte[], int, int); + method public boolean claimInterface(android.hardware.usb.UsbInterface, boolean); + method public void close(); + method public int controlTransfer(int, int, int, int, byte[], int, int); + method public int getFileDescriptor(); + method public byte[] getRawDescriptors(); + method public java.lang.String getSerial(); + method public boolean releaseInterface(android.hardware.usb.UsbInterface); + method public android.hardware.usb.UsbRequest requestWait(); + } + + public class UsbEndpoint implements android.os.Parcelable { + method public int describeContents(); + method public int getAddress(); + method public int getAttributes(); + method public int getDirection(); + method public int getEndpointNumber(); + method public int getInterval(); + method public int getMaxPacketSize(); + method public int getType(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + } + + public class UsbInterface implements android.os.Parcelable { + method public int describeContents(); + method public android.hardware.usb.UsbEndpoint getEndpoint(int); + method public int getEndpointCount(); + method public int getId(); + method public int getInterfaceClass(); + method public int getInterfaceProtocol(); + method public int getInterfaceSubclass(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + } + + public class UsbManager { + method public android.hardware.usb.UsbAccessory[] getAccessoryList(); + method public java.util.HashMap getDeviceList(); + method public boolean hasPermission(android.hardware.usb.UsbDevice); + method public boolean hasPermission(android.hardware.usb.UsbAccessory); + method public android.os.ParcelFileDescriptor openAccessory(android.hardware.usb.UsbAccessory); + method public android.hardware.usb.UsbDeviceConnection openDevice(android.hardware.usb.UsbDevice); + method public void requestPermission(android.hardware.usb.UsbDevice, android.app.PendingIntent); + method public void requestPermission(android.hardware.usb.UsbAccessory, android.app.PendingIntent); + field public static final java.lang.String ACTION_USB_ACCESSORY_ATTACHED = "android.hardware.usb.action.USB_ACCESSORY_ATTACHED"; + field public static final java.lang.String ACTION_USB_ACCESSORY_DETACHED = "android.hardware.usb.action.USB_ACCESSORY_DETACHED"; + field public static final java.lang.String ACTION_USB_DEVICE_ATTACHED = "android.hardware.usb.action.USB_DEVICE_ATTACHED"; + field public static final java.lang.String ACTION_USB_DEVICE_DETACHED = "android.hardware.usb.action.USB_DEVICE_DETACHED"; + field public static final java.lang.String EXTRA_ACCESSORY = "accessory"; + field public static final java.lang.String EXTRA_DEVICE = "device"; + field public static final java.lang.String EXTRA_PERMISSION_GRANTED = "permission"; + } + + public class UsbRequest { + ctor public UsbRequest(); + method public boolean cancel(); + method public void close(); + method public java.lang.Object getClientData(); + method public android.hardware.usb.UsbEndpoint getEndpoint(); + method public boolean initialize(android.hardware.usb.UsbDeviceConnection, android.hardware.usb.UsbEndpoint); + method public boolean queue(java.nio.ByteBuffer, int); + method public void setClientData(java.lang.Object); + } + +} + +package android.inputmethodservice { + + public abstract class AbstractInputMethodService extends android.app.Service implements android.view.KeyEvent.Callback { + ctor public AbstractInputMethodService(); + method public android.view.KeyEvent.DispatcherState getKeyDispatcherState(); + method public final android.os.IBinder onBind(android.content.Intent); + method public abstract android.inputmethodservice.AbstractInputMethodService.AbstractInputMethodImpl onCreateInputMethodInterface(); + method public abstract android.inputmethodservice.AbstractInputMethodService.AbstractInputMethodSessionImpl onCreateInputMethodSessionInterface(); + method public boolean onGenericMotionEvent(android.view.MotionEvent); + method public boolean onTrackballEvent(android.view.MotionEvent); + } + + public abstract class AbstractInputMethodService.AbstractInputMethodImpl implements android.view.inputmethod.InputMethod { + ctor public AbstractInputMethodService.AbstractInputMethodImpl(); + method public void createSession(android.view.inputmethod.InputMethod.SessionCallback); + method public void revokeSession(android.view.inputmethod.InputMethodSession); + method public void setSessionEnabled(android.view.inputmethod.InputMethodSession, boolean); + } + + public abstract class AbstractInputMethodService.AbstractInputMethodSessionImpl implements android.view.inputmethod.InputMethodSession { + ctor public AbstractInputMethodService.AbstractInputMethodSessionImpl(); + method public void dispatchGenericMotionEvent(int, android.view.MotionEvent, android.view.inputmethod.InputMethodSession.EventCallback); + method public void dispatchKeyEvent(int, android.view.KeyEvent, android.view.inputmethod.InputMethodSession.EventCallback); + method public void dispatchTrackballEvent(int, android.view.MotionEvent, android.view.inputmethod.InputMethodSession.EventCallback); + method public boolean isEnabled(); + method public boolean isRevoked(); + method public void revokeSelf(); + method public void setEnabled(boolean); + } + + public class ExtractEditText extends android.widget.EditText { + ctor public ExtractEditText(android.content.Context); + ctor public ExtractEditText(android.content.Context, android.util.AttributeSet); + ctor public ExtractEditText(android.content.Context, android.util.AttributeSet, int); + method public void finishInternalChanges(); + method public boolean hasVerticalScrollBar(); + method public void startInternalChanges(); + } + + public class InputMethodService extends android.inputmethodservice.AbstractInputMethodService { + ctor public InputMethodService(); + method public boolean enableHardwareAcceleration(); + method public int getBackDisposition(); + method public int getCandidatesHiddenVisibility(); + method public android.view.inputmethod.InputBinding getCurrentInputBinding(); + method public android.view.inputmethod.InputConnection getCurrentInputConnection(); + method public android.view.inputmethod.EditorInfo getCurrentInputEditorInfo(); + method public boolean getCurrentInputStarted(); + method public android.view.LayoutInflater getLayoutInflater(); + method public int getMaxWidth(); + method public java.lang.CharSequence getTextForImeAction(int); + method public android.app.Dialog getWindow(); + method public void hideStatusIcon(); + method public void hideWindow(); + method public boolean isExtractViewShown(); + method public boolean isFullscreenMode(); + method public boolean isInputViewShown(); + method public boolean isShowInputRequested(); + method public void onAppPrivateCommand(java.lang.String, android.os.Bundle); + method public void onBindInput(); + method public void onComputeInsets(android.inputmethodservice.InputMethodService.Insets); + method public void onConfigureWindow(android.view.Window, boolean, boolean); + method public android.view.View onCreateCandidatesView(); + method public android.view.View onCreateExtractTextView(); + method public android.inputmethodservice.AbstractInputMethodService.AbstractInputMethodImpl onCreateInputMethodInterface(); + method public android.inputmethodservice.AbstractInputMethodService.AbstractInputMethodSessionImpl onCreateInputMethodSessionInterface(); + method public android.view.View onCreateInputView(); + method protected void onCurrentInputMethodSubtypeChanged(android.view.inputmethod.InputMethodSubtype); + method public void onDisplayCompletions(android.view.inputmethod.CompletionInfo[]); + method public boolean onEvaluateFullscreenMode(); + method public boolean onEvaluateInputViewShown(); + method public boolean onExtractTextContextMenuItem(int); + method public void onExtractedCursorMovement(int, int); + method public void onExtractedSelectionChanged(int, int); + method public void onExtractedTextClicked(); + method public void onExtractingInputChanged(android.view.inputmethod.EditorInfo); + method public void onFinishCandidatesView(boolean); + method public void onFinishInput(); + method public void onFinishInputView(boolean); + method public void onInitializeInterface(); + method public boolean onKeyDown(int, android.view.KeyEvent); + method public boolean onKeyLongPress(int, android.view.KeyEvent); + method public boolean onKeyMultiple(int, int, android.view.KeyEvent); + method public boolean onKeyUp(int, android.view.KeyEvent); + method public boolean onShowInputRequested(int, boolean); + method public void onStartCandidatesView(android.view.inputmethod.EditorInfo, boolean); + method public void onStartInput(android.view.inputmethod.EditorInfo, boolean); + method public void onStartInputView(android.view.inputmethod.EditorInfo, boolean); + method public void onUnbindInput(); + method public void onUpdateCursor(android.graphics.Rect); + method public void onUpdateExtractedText(int, android.view.inputmethod.ExtractedText); + method public void onUpdateExtractingViews(android.view.inputmethod.EditorInfo); + method public void onUpdateExtractingVisibility(android.view.inputmethod.EditorInfo); + method public void onUpdateSelection(int, int, int, int, int, int); + method public void onViewClicked(boolean); + method public void onWindowHidden(); + method public void onWindowShown(); + method public void requestHideSelf(int); + method public boolean sendDefaultEditorAction(boolean); + method public void sendDownUpKeyEvents(int); + method public void sendKeyChar(char); + method public void setBackDisposition(int); + method public void setCandidatesView(android.view.View); + method public void setCandidatesViewShown(boolean); + method public void setExtractView(android.view.View); + method public void setExtractViewShown(boolean); + method public void setInputView(android.view.View); + method public void showStatusIcon(int); + method public void showWindow(boolean); + method public void switchInputMethod(java.lang.String); + method public void updateFullscreenMode(); + method public void updateInputViewShown(); + field public static final int BACK_DISPOSITION_DEFAULT = 0; // 0x0 + field public static final int BACK_DISPOSITION_WILL_DISMISS = 2; // 0x2 + field public static final int BACK_DISPOSITION_WILL_NOT_DISMISS = 1; // 0x1 + } + + public class InputMethodService.InputMethodImpl extends android.inputmethodservice.AbstractInputMethodService.AbstractInputMethodImpl { + ctor public InputMethodService.InputMethodImpl(); + method public void attachToken(android.os.IBinder); + method public void bindInput(android.view.inputmethod.InputBinding); + method public void changeInputMethodSubtype(android.view.inputmethod.InputMethodSubtype); + method public void hideSoftInput(int, android.os.ResultReceiver); + method public void restartInput(android.view.inputmethod.InputConnection, android.view.inputmethod.EditorInfo); + method public void showSoftInput(int, android.os.ResultReceiver); + method public void startInput(android.view.inputmethod.InputConnection, android.view.inputmethod.EditorInfo); + method public void unbindInput(); + } + + public class InputMethodService.InputMethodSessionImpl extends android.inputmethodservice.AbstractInputMethodService.AbstractInputMethodSessionImpl { + ctor public InputMethodService.InputMethodSessionImpl(); + method public void appPrivateCommand(java.lang.String, android.os.Bundle); + method public void displayCompletions(android.view.inputmethod.CompletionInfo[]); + method public void finishInput(); + method public void toggleSoftInput(int, int); + method public void updateCursor(android.graphics.Rect); + method public void updateExtractedText(int, android.view.inputmethod.ExtractedText); + method public void updateSelection(int, int, int, int, int, int); + method public void viewClicked(boolean); + } + + public static final class InputMethodService.Insets { + ctor public InputMethodService.Insets(); + field public static final int TOUCHABLE_INSETS_CONTENT = 1; // 0x1 + field public static final int TOUCHABLE_INSETS_FRAME = 0; // 0x0 + field public static final int TOUCHABLE_INSETS_REGION = 3; // 0x3 + field public static final int TOUCHABLE_INSETS_VISIBLE = 2; // 0x2 + field public int contentTopInsets; + field public int touchableInsets; + field public final android.graphics.Region touchableRegion; + field public int visibleTopInsets; + } + + public class Keyboard { + ctor public Keyboard(android.content.Context, int); + ctor public Keyboard(android.content.Context, int, int, int, int); + ctor public Keyboard(android.content.Context, int, int); + ctor public Keyboard(android.content.Context, int, java.lang.CharSequence, int, int); + method protected android.inputmethodservice.Keyboard.Key createKeyFromXml(android.content.res.Resources, android.inputmethodservice.Keyboard.Row, int, int, android.content.res.XmlResourceParser); + method protected android.inputmethodservice.Keyboard.Row createRowFromXml(android.content.res.Resources, android.content.res.XmlResourceParser); + method public int getHeight(); + method protected int getHorizontalGap(); + method protected int getKeyHeight(); + method protected int getKeyWidth(); + method public java.util.List getKeys(); + method public int getMinWidth(); + method public java.util.List getModifierKeys(); + method public int[] getNearestKeys(int, int); + method public int getShiftKeyIndex(); + method protected int getVerticalGap(); + method public boolean isShifted(); + method protected void setHorizontalGap(int); + method protected void setKeyHeight(int); + method protected void setKeyWidth(int); + method public boolean setShifted(boolean); + method protected void setVerticalGap(int); + field public static final int EDGE_BOTTOM = 8; // 0x8 + field public static final int EDGE_LEFT = 1; // 0x1 + field public static final int EDGE_RIGHT = 2; // 0x2 + field public static final int EDGE_TOP = 4; // 0x4 + field public static final int KEYCODE_ALT = -6; // 0xfffffffa + field public static final int KEYCODE_CANCEL = -3; // 0xfffffffd + field public static final int KEYCODE_DELETE = -5; // 0xfffffffb + field public static final int KEYCODE_DONE = -4; // 0xfffffffc + field public static final int KEYCODE_MODE_CHANGE = -2; // 0xfffffffe + field public static final int KEYCODE_SHIFT = -1; // 0xffffffff + } + + public static class Keyboard.Key { + ctor public Keyboard.Key(android.inputmethodservice.Keyboard.Row); + ctor public Keyboard.Key(android.content.res.Resources, android.inputmethodservice.Keyboard.Row, int, int, android.content.res.XmlResourceParser); + method public int[] getCurrentDrawableState(); + method public boolean isInside(int, int); + method public void onPressed(); + method public void onReleased(boolean); + method public int squaredDistanceFrom(int, int); + field public int[] codes; + field public int edgeFlags; + field public int gap; + field public int height; + field public android.graphics.drawable.Drawable icon; + field public android.graphics.drawable.Drawable iconPreview; + field public java.lang.CharSequence label; + field public boolean modifier; + field public boolean on; + field public java.lang.CharSequence popupCharacters; + field public int popupResId; + field public boolean pressed; + field public boolean repeatable; + field public boolean sticky; + field public java.lang.CharSequence text; + field public int width; + field public int x; + field public int y; + } + + public static class Keyboard.Row { + ctor public Keyboard.Row(android.inputmethodservice.Keyboard); + ctor public Keyboard.Row(android.content.res.Resources, android.inputmethodservice.Keyboard, android.content.res.XmlResourceParser); + field public int defaultHeight; + field public int defaultHorizontalGap; + field public int defaultWidth; + field public int mode; + field public int rowEdgeFlags; + field public int verticalGap; + } + + public class KeyboardView extends android.view.View implements android.view.View.OnClickListener { + ctor public KeyboardView(android.content.Context, android.util.AttributeSet); + ctor public KeyboardView(android.content.Context, android.util.AttributeSet, int); + method public void closing(); + method public android.inputmethodservice.Keyboard getKeyboard(); + method protected android.inputmethodservice.KeyboardView.OnKeyboardActionListener getOnKeyboardActionListener(); + method public boolean handleBack(); + method public void invalidateAllKeys(); + method public void invalidateKey(int); + method public boolean isPreviewEnabled(); + method public boolean isProximityCorrectionEnabled(); + method public boolean isShifted(); + method public void onClick(android.view.View); + method public void onDetachedFromWindow(); + method public void onDraw(android.graphics.Canvas); + method protected boolean onLongPress(android.inputmethodservice.Keyboard.Key); + method public void onMeasure(int, int); + method public void onSizeChanged(int, int, int, int); + method public void setKeyboard(android.inputmethodservice.Keyboard); + method public void setOnKeyboardActionListener(android.inputmethodservice.KeyboardView.OnKeyboardActionListener); + method public void setPopupOffset(int, int); + method public void setPopupParent(android.view.View); + method public void setPreviewEnabled(boolean); + method public void setProximityCorrectionEnabled(boolean); + method public boolean setShifted(boolean); + method public void setVerticalCorrection(int); + method protected void swipeDown(); + method protected void swipeLeft(); + method protected void swipeRight(); + method protected void swipeUp(); + } + + public static abstract interface KeyboardView.OnKeyboardActionListener { + method public abstract void onKey(int, int[]); + method public abstract void onPress(int); + method public abstract void onRelease(int); + method public abstract void onText(java.lang.CharSequence); + method public abstract void swipeDown(); + method public abstract void swipeLeft(); + method public abstract void swipeRight(); + method public abstract void swipeUp(); + } + +} + +package android.location { + + public class Address implements android.os.Parcelable { + ctor public Address(java.util.Locale); + method public void clearLatitude(); + method public void clearLongitude(); + method public int describeContents(); + method public java.lang.String getAddressLine(int); + method public java.lang.String getAdminArea(); + method public java.lang.String getCountryCode(); + method public java.lang.String getCountryName(); + method public android.os.Bundle getExtras(); + method public java.lang.String getFeatureName(); + method public double getLatitude(); + method public java.util.Locale getLocale(); + method public java.lang.String getLocality(); + method public double getLongitude(); + method public int getMaxAddressLineIndex(); + method public java.lang.String getPhone(); + method public java.lang.String getPostalCode(); + method public java.lang.String getPremises(); + method public java.lang.String getSubAdminArea(); + method public java.lang.String getSubLocality(); + method public java.lang.String getSubThoroughfare(); + method public java.lang.String getThoroughfare(); + method public java.lang.String getUrl(); + method public boolean hasLatitude(); + method public boolean hasLongitude(); + method public void setAddressLine(int, java.lang.String); + method public void setAdminArea(java.lang.String); + method public void setCountryCode(java.lang.String); + method public void setCountryName(java.lang.String); + method public void setExtras(android.os.Bundle); + method public void setFeatureName(java.lang.String); + method public void setLatitude(double); + method public void setLocality(java.lang.String); + method public void setLongitude(double); + method public void setPhone(java.lang.String); + method public void setPostalCode(java.lang.String); + method public void setPremises(java.lang.String); + method public void setSubAdminArea(java.lang.String); + method public void setSubLocality(java.lang.String); + method public void setSubThoroughfare(java.lang.String); + method public void setThoroughfare(java.lang.String); + method public void setUrl(java.lang.String); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + } + + public class Criteria implements android.os.Parcelable { + ctor public Criteria(); + ctor public Criteria(android.location.Criteria); + method public int describeContents(); + method public int getAccuracy(); + method public int getBearingAccuracy(); + method public int getHorizontalAccuracy(); + method public int getPowerRequirement(); + method public int getSpeedAccuracy(); + method public int getVerticalAccuracy(); + method public boolean isAltitudeRequired(); + method public boolean isBearingRequired(); + method public boolean isCostAllowed(); + method public boolean isSpeedRequired(); + method public void setAccuracy(int); + method public void setAltitudeRequired(boolean); + method public void setBearingAccuracy(int); + method public void setBearingRequired(boolean); + method public void setCostAllowed(boolean); + method public void setHorizontalAccuracy(int); + method public void setPowerRequirement(int); + method public void setSpeedAccuracy(int); + method public void setSpeedRequired(boolean); + method public void setVerticalAccuracy(int); + method public void writeToParcel(android.os.Parcel, int); + field public static final int ACCURACY_COARSE = 2; // 0x2 + field public static final int ACCURACY_FINE = 1; // 0x1 + field public static final int ACCURACY_HIGH = 3; // 0x3 + field public static final int ACCURACY_LOW = 1; // 0x1 + field public static final int ACCURACY_MEDIUM = 2; // 0x2 + field public static final android.os.Parcelable.Creator CREATOR; + field public static final int NO_REQUIREMENT = 0; // 0x0 + field public static final int POWER_HIGH = 3; // 0x3 + field public static final int POWER_LOW = 1; // 0x1 + field public static final int POWER_MEDIUM = 2; // 0x2 + } + + public final class Geocoder { + ctor public Geocoder(android.content.Context, java.util.Locale); + ctor public Geocoder(android.content.Context); + method public java.util.List getFromLocation(double, double, int) throws java.io.IOException; + method public java.util.List getFromLocationName(java.lang.String, int) throws java.io.IOException; + method public java.util.List getFromLocationName(java.lang.String, int, double, double, double, double) throws java.io.IOException; + method public static boolean isPresent(); + } + + public final class GpsSatellite { + method public float getAzimuth(); + method public float getElevation(); + method public int getPrn(); + method public float getSnr(); + method public boolean hasAlmanac(); + method public boolean hasEphemeris(); + method public boolean usedInFix(); + } + + public final class GpsStatus { + method public int getMaxSatellites(); + method public java.lang.Iterable getSatellites(); + method public int getTimeToFirstFix(); + field public static final int GPS_EVENT_FIRST_FIX = 3; // 0x3 + field public static final int GPS_EVENT_SATELLITE_STATUS = 4; // 0x4 + field public static final int GPS_EVENT_STARTED = 1; // 0x1 + field public static final int GPS_EVENT_STOPPED = 2; // 0x2 + } + + public static abstract interface GpsStatus.Listener { + method public abstract void onGpsStatusChanged(int); + } + + public static abstract interface GpsStatus.NmeaListener { + method public abstract void onNmeaReceived(long, java.lang.String); + } + + public class Location implements android.os.Parcelable { + ctor public Location(java.lang.String); + ctor public Location(android.location.Location); + method public float bearingTo(android.location.Location); + method public static java.lang.String convert(double, int); + method public static double convert(java.lang.String); + method public int describeContents(); + method public static void distanceBetween(double, double, double, double, float[]); + method public float distanceTo(android.location.Location); + method public void dump(android.util.Printer, java.lang.String); + method public float getAccuracy(); + method public double getAltitude(); + method public float getBearing(); + method public long getElapsedRealtimeNanos(); + method public android.os.Bundle getExtras(); + method public double getLatitude(); + method public double getLongitude(); + method public java.lang.String getProvider(); + method public float getSpeed(); + method public long getTime(); + method public boolean hasAccuracy(); + method public boolean hasAltitude(); + method public boolean hasBearing(); + method public boolean hasSpeed(); + method public void removeAccuracy(); + method public void removeAltitude(); + method public void removeBearing(); + method public void removeSpeed(); + method public void reset(); + method public void set(android.location.Location); + method public void setAccuracy(float); + method public void setAltitude(double); + method public void setBearing(float); + method public void setElapsedRealtimeNanos(long); + method public void setExtras(android.os.Bundle); + method public void setLatitude(double); + method public void setLongitude(double); + method public void setProvider(java.lang.String); + method public void setSpeed(float); + method public void setTime(long); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + field public static final int FORMAT_DEGREES = 0; // 0x0 + field public static final int FORMAT_MINUTES = 1; // 0x1 + field public static final int FORMAT_SECONDS = 2; // 0x2 + } + + public abstract interface LocationListener { + method public abstract void onLocationChanged(android.location.Location); + method public abstract void onProviderDisabled(java.lang.String); + method public abstract void onProviderEnabled(java.lang.String); + method public abstract void onStatusChanged(java.lang.String, int, android.os.Bundle); + } + + public class LocationManager { + method public boolean addGpsStatusListener(android.location.GpsStatus.Listener); + method public boolean addNmeaListener(android.location.GpsStatus.NmeaListener); + method public void addProximityAlert(double, double, float, long, android.app.PendingIntent); + method public void addTestProvider(java.lang.String, boolean, boolean, boolean, boolean, boolean, boolean, boolean, int, int); + method public void clearTestProviderEnabled(java.lang.String); + method public void clearTestProviderLocation(java.lang.String); + method public void clearTestProviderStatus(java.lang.String); + method public java.util.List getAllProviders(); + method public java.lang.String getBestProvider(android.location.Criteria, boolean); + method public android.location.GpsStatus getGpsStatus(android.location.GpsStatus); + method public android.location.Location getLastKnownLocation(java.lang.String); + method public android.location.LocationProvider getProvider(java.lang.String); + method public java.util.List getProviders(boolean); + method public java.util.List getProviders(android.location.Criteria, boolean); + method public boolean isProviderEnabled(java.lang.String); + method public void removeGpsStatusListener(android.location.GpsStatus.Listener); + method public void removeNmeaListener(android.location.GpsStatus.NmeaListener); + method public void removeProximityAlert(android.app.PendingIntent); + method public void removeTestProvider(java.lang.String); + method public void removeUpdates(android.location.LocationListener); + method public void removeUpdates(android.app.PendingIntent); + method public void requestLocationUpdates(java.lang.String, long, float, android.location.LocationListener); + method public void requestLocationUpdates(java.lang.String, long, float, android.location.LocationListener, android.os.Looper); + method public void requestLocationUpdates(long, float, android.location.Criteria, android.location.LocationListener, android.os.Looper); + method public void requestLocationUpdates(java.lang.String, long, float, android.app.PendingIntent); + method public void requestLocationUpdates(long, float, android.location.Criteria, android.app.PendingIntent); + method public void requestSingleUpdate(java.lang.String, android.location.LocationListener, android.os.Looper); + method public void requestSingleUpdate(android.location.Criteria, android.location.LocationListener, android.os.Looper); + method public void requestSingleUpdate(java.lang.String, android.app.PendingIntent); + method public void requestSingleUpdate(android.location.Criteria, android.app.PendingIntent); + method public boolean sendExtraCommand(java.lang.String, java.lang.String, android.os.Bundle); + method public void setTestProviderEnabled(java.lang.String, boolean); + method public void setTestProviderLocation(java.lang.String, android.location.Location); + method public void setTestProviderStatus(java.lang.String, int, android.os.Bundle, long); + field public static final java.lang.String GPS_PROVIDER = "gps"; + field public static final java.lang.String KEY_LOCATION_CHANGED = "location"; + field public static final java.lang.String KEY_PROVIDER_ENABLED = "providerEnabled"; + field public static final java.lang.String KEY_PROXIMITY_ENTERING = "entering"; + field public static final java.lang.String KEY_STATUS_CHANGED = "status"; + field public static final java.lang.String NETWORK_PROVIDER = "network"; + field public static final java.lang.String PASSIVE_PROVIDER = "passive"; + field public static final java.lang.String PROVIDERS_CHANGED_ACTION = "android.location.PROVIDERS_CHANGED"; + } + + public class LocationProvider { + method public int getAccuracy(); + method public java.lang.String getName(); + method public int getPowerRequirement(); + method public boolean hasMonetaryCost(); + method public boolean meetsCriteria(android.location.Criteria); + method public boolean requiresCell(); + method public boolean requiresNetwork(); + method public boolean requiresSatellite(); + method public boolean supportsAltitude(); + method public boolean supportsBearing(); + method public boolean supportsSpeed(); + field public static final int AVAILABLE = 2; // 0x2 + field public static final int OUT_OF_SERVICE = 0; // 0x0 + field public static final int TEMPORARILY_UNAVAILABLE = 1; // 0x1 + } + +} + +package android.media { + + public class AsyncPlayer { + ctor public AsyncPlayer(java.lang.String); + method public void play(android.content.Context, android.net.Uri, boolean, int); + method public void stop(); + } + + public class AudioFormat { + ctor public AudioFormat(); + field public static final deprecated int CHANNEL_CONFIGURATION_DEFAULT = 1; // 0x1 + field public static final deprecated int CHANNEL_CONFIGURATION_INVALID = 0; // 0x0 + field public static final deprecated int CHANNEL_CONFIGURATION_MONO = 2; // 0x2 + field public static final deprecated int CHANNEL_CONFIGURATION_STEREO = 3; // 0x3 + field public static final int CHANNEL_INVALID = 0; // 0x0 + field public static final int CHANNEL_IN_BACK = 32; // 0x20 + field public static final int CHANNEL_IN_BACK_PROCESSED = 512; // 0x200 + field public static final int CHANNEL_IN_DEFAULT = 1; // 0x1 + field public static final int CHANNEL_IN_FRONT = 16; // 0x10 + field public static final int CHANNEL_IN_FRONT_PROCESSED = 256; // 0x100 + field public static final int CHANNEL_IN_LEFT = 4; // 0x4 + field public static final int CHANNEL_IN_LEFT_PROCESSED = 64; // 0x40 + field public static final int CHANNEL_IN_MONO = 16; // 0x10 + field public static final int CHANNEL_IN_PRESSURE = 1024; // 0x400 + field public static final int CHANNEL_IN_RIGHT = 8; // 0x8 + field public static final int CHANNEL_IN_RIGHT_PROCESSED = 128; // 0x80 + field public static final int CHANNEL_IN_STEREO = 12; // 0xc + field public static final int CHANNEL_IN_VOICE_DNLINK = 32768; // 0x8000 + field public static final int CHANNEL_IN_VOICE_UPLINK = 16384; // 0x4000 + field public static final int CHANNEL_IN_X_AXIS = 2048; // 0x800 + field public static final int CHANNEL_IN_Y_AXIS = 4096; // 0x1000 + field public static final int CHANNEL_IN_Z_AXIS = 8192; // 0x2000 + field public static final int CHANNEL_OUT_5POINT1 = 252; // 0xfc + field public static final int CHANNEL_OUT_7POINT1 = 1020; // 0x3fc + field public static final int CHANNEL_OUT_BACK_CENTER = 1024; // 0x400 + field public static final int CHANNEL_OUT_BACK_LEFT = 64; // 0x40 + field public static final int CHANNEL_OUT_BACK_RIGHT = 128; // 0x80 + field public static final int CHANNEL_OUT_DEFAULT = 1; // 0x1 + field public static final int CHANNEL_OUT_FRONT_CENTER = 16; // 0x10 + field public static final int CHANNEL_OUT_FRONT_LEFT = 4; // 0x4 + field public static final int CHANNEL_OUT_FRONT_LEFT_OF_CENTER = 256; // 0x100 + field public static final int CHANNEL_OUT_FRONT_RIGHT = 8; // 0x8 + field public static final int CHANNEL_OUT_FRONT_RIGHT_OF_CENTER = 512; // 0x200 + field public static final int CHANNEL_OUT_LOW_FREQUENCY = 32; // 0x20 + field public static final int CHANNEL_OUT_MONO = 4; // 0x4 + field public static final int CHANNEL_OUT_QUAD = 204; // 0xcc + field public static final int CHANNEL_OUT_STEREO = 12; // 0xc + field public static final int CHANNEL_OUT_SURROUND = 1052; // 0x41c + field public static final int ENCODING_DEFAULT = 1; // 0x1 + field public static final int ENCODING_INVALID = 0; // 0x0 + field public static final int ENCODING_PCM_16BIT = 2; // 0x2 + field public static final int ENCODING_PCM_8BIT = 3; // 0x3 + } + + public class AudioManager { + method public int abandonAudioFocus(android.media.AudioManager.OnAudioFocusChangeListener); + method public void adjustStreamVolume(int, int, int); + method public void adjustSuggestedStreamVolume(int, int, int); + method public void adjustVolume(int, int); + method public int getMode(); + method public java.lang.String getParameters(java.lang.String); + method public java.lang.String getProperty(java.lang.String); + method public int getRingerMode(); + method public deprecated int getRouting(int); + method public int getStreamMaxVolume(int); + method public int getStreamVolume(int); + method public deprecated int getVibrateSetting(int); + method public boolean isBluetoothA2dpOn(); + method public boolean isBluetoothScoAvailableOffCall(); + method public boolean isBluetoothScoOn(); + method public boolean isMicrophoneMute(); + method public boolean isMusicActive(); + method public boolean isSpeakerphoneOn(); + method public deprecated boolean isWiredHeadsetOn(); + method public void loadSoundEffects(); + method public void playSoundEffect(int); + method public void playSoundEffect(int, float); + method public void registerMediaButtonEventReceiver(android.content.ComponentName); + method public void registerRemoteControlClient(android.media.RemoteControlClient); + method public int requestAudioFocus(android.media.AudioManager.OnAudioFocusChangeListener, int, int); + method public deprecated void setBluetoothA2dpOn(boolean); + method public void setBluetoothScoOn(boolean); + method public void setMicrophoneMute(boolean); + method public void setMode(int); + method public void setParameters(java.lang.String); + method public void setRingerMode(int); + method public deprecated void setRouting(int, int, int); + method public void setSpeakerphoneOn(boolean); + method public void setStreamMute(int, boolean); + method public void setStreamSolo(int, boolean); + method public void setStreamVolume(int, int, int); + method public deprecated void setVibrateSetting(int, int); + method public deprecated void setWiredHeadsetOn(boolean); + method public deprecated boolean shouldVibrate(int); + method public void startBluetoothSco(); + method public void stopBluetoothSco(); + method public void unloadSoundEffects(); + method public void unregisterMediaButtonEventReceiver(android.content.ComponentName); + method public void unregisterRemoteControlClient(android.media.RemoteControlClient); + field public static final java.lang.String ACTION_AUDIO_BECOMING_NOISY = "android.media.AUDIO_BECOMING_NOISY"; + field public static final deprecated java.lang.String ACTION_SCO_AUDIO_STATE_CHANGED = "android.media.SCO_AUDIO_STATE_CHANGED"; + field public static final java.lang.String ACTION_SCO_AUDIO_STATE_UPDATED = "android.media.ACTION_SCO_AUDIO_STATE_UPDATED"; + field public static final int ADJUST_LOWER = -1; // 0xffffffff + field public static final int ADJUST_RAISE = 1; // 0x1 + field public static final int ADJUST_SAME = 0; // 0x0 + field public static final int AUDIOFOCUS_GAIN = 1; // 0x1 + field public static final int AUDIOFOCUS_GAIN_TRANSIENT = 2; // 0x2 + field public static final int AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK = 3; // 0x3 + field public static final int AUDIOFOCUS_LOSS = -1; // 0xffffffff + field public static final int AUDIOFOCUS_LOSS_TRANSIENT = -2; // 0xfffffffe + field public static final int AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK = -3; // 0xfffffffd + field public static final int AUDIOFOCUS_REQUEST_FAILED = 0; // 0x0 + field public static final int AUDIOFOCUS_REQUEST_GRANTED = 1; // 0x1 + field public static final java.lang.String EXTRA_RINGER_MODE = "android.media.EXTRA_RINGER_MODE"; + field public static final java.lang.String EXTRA_SCO_AUDIO_PREVIOUS_STATE = "android.media.extra.SCO_AUDIO_PREVIOUS_STATE"; + field public static final java.lang.String EXTRA_SCO_AUDIO_STATE = "android.media.extra.SCO_AUDIO_STATE"; + field public static final deprecated java.lang.String EXTRA_VIBRATE_SETTING = "android.media.EXTRA_VIBRATE_SETTING"; + field public static final deprecated java.lang.String EXTRA_VIBRATE_TYPE = "android.media.EXTRA_VIBRATE_TYPE"; + field public static final int FLAG_ALLOW_RINGER_MODES = 2; // 0x2 + field public static final int FLAG_PLAY_SOUND = 4; // 0x4 + field public static final int FLAG_REMOVE_SOUND_AND_VIBRATE = 8; // 0x8 + field public static final int FLAG_SHOW_UI = 1; // 0x1 + field public static final int FLAG_VIBRATE = 16; // 0x10 + field public static final int FX_FOCUS_NAVIGATION_DOWN = 2; // 0x2 + field public static final int FX_FOCUS_NAVIGATION_LEFT = 3; // 0x3 + field public static final int FX_FOCUS_NAVIGATION_RIGHT = 4; // 0x4 + field public static final int FX_FOCUS_NAVIGATION_UP = 1; // 0x1 + field public static final int FX_KEYPRESS_DELETE = 7; // 0x7 + field public static final int FX_KEYPRESS_RETURN = 8; // 0x8 + field public static final int FX_KEYPRESS_SPACEBAR = 6; // 0x6 + field public static final int FX_KEYPRESS_STANDARD = 5; // 0x5 + field public static final int FX_KEY_CLICK = 0; // 0x0 + field public static final int MODE_CURRENT = -1; // 0xffffffff + field public static final int MODE_INVALID = -2; // 0xfffffffe + field public static final int MODE_IN_CALL = 2; // 0x2 + field public static final int MODE_IN_COMMUNICATION = 3; // 0x3 + field public static final int MODE_NORMAL = 0; // 0x0 + field public static final int MODE_RINGTONE = 1; // 0x1 + field public static final deprecated int NUM_STREAMS = 5; // 0x5 + field public static final java.lang.String PROPERTY_OUTPUT_FRAMES_PER_BUFFER = "android.media.property.OUTPUT_FRAMES_PER_BUFFER"; + field public static final java.lang.String PROPERTY_OUTPUT_SAMPLE_RATE = "android.media.property.OUTPUT_SAMPLE_RATE"; + field public static final java.lang.String RINGER_MODE_CHANGED_ACTION = "android.media.RINGER_MODE_CHANGED"; + field public static final int RINGER_MODE_NORMAL = 2; // 0x2 + field public static final int RINGER_MODE_SILENT = 0; // 0x0 + field public static final int RINGER_MODE_VIBRATE = 1; // 0x1 + field public static final deprecated int ROUTE_ALL = -1; // 0xffffffff + field public static final deprecated int ROUTE_BLUETOOTH = 4; // 0x4 + field public static final deprecated int ROUTE_BLUETOOTH_A2DP = 16; // 0x10 + field public static final deprecated int ROUTE_BLUETOOTH_SCO = 4; // 0x4 + field public static final deprecated int ROUTE_EARPIECE = 1; // 0x1 + field public static final deprecated int ROUTE_HEADSET = 8; // 0x8 + field public static final deprecated int ROUTE_SPEAKER = 2; // 0x2 + field public static final int SCO_AUDIO_STATE_CONNECTED = 1; // 0x1 + field public static final int SCO_AUDIO_STATE_CONNECTING = 2; // 0x2 + field public static final int SCO_AUDIO_STATE_DISCONNECTED = 0; // 0x0 + field public static final int SCO_AUDIO_STATE_ERROR = -1; // 0xffffffff + field public static final int STREAM_ALARM = 4; // 0x4 + field public static final int STREAM_DTMF = 8; // 0x8 + field public static final int STREAM_MUSIC = 3; // 0x3 + field public static final int STREAM_NOTIFICATION = 5; // 0x5 + field public static final int STREAM_RING = 2; // 0x2 + field public static final int STREAM_SYSTEM = 1; // 0x1 + field public static final int STREAM_VOICE_CALL = 0; // 0x0 + field public static final int USE_DEFAULT_STREAM_TYPE = -2147483648; // 0x80000000 + field public static final deprecated java.lang.String VIBRATE_SETTING_CHANGED_ACTION = "android.media.VIBRATE_SETTING_CHANGED"; + field public static final deprecated int VIBRATE_SETTING_OFF = 0; // 0x0 + field public static final deprecated int VIBRATE_SETTING_ON = 1; // 0x1 + field public static final deprecated int VIBRATE_SETTING_ONLY_SILENT = 2; // 0x2 + field public static final deprecated int VIBRATE_TYPE_NOTIFICATION = 1; // 0x1 + field public static final deprecated int VIBRATE_TYPE_RINGER = 0; // 0x0 + } + + public static abstract interface AudioManager.OnAudioFocusChangeListener { + method public abstract void onAudioFocusChange(int); + } + + public class AudioRecord { + ctor public AudioRecord(int, int, int, int, int) throws java.lang.IllegalArgumentException; + method public int getAudioFormat(); + method public int getAudioSessionId(); + method public int getAudioSource(); + method public int getChannelConfiguration(); + method public int getChannelCount(); + method public static int getMinBufferSize(int, int, int); + method public int getNotificationMarkerPosition(); + method public int getPositionNotificationPeriod(); + method public int getRecordingState(); + method public int getSampleRate(); + method public int getState(); + method public int read(byte[], int, int); + method public int read(short[], int, int); + method public int read(java.nio.ByteBuffer, int); + method public void release(); + method public int setNotificationMarkerPosition(int); + method public int setPositionNotificationPeriod(int); + method public void setRecordPositionUpdateListener(android.media.AudioRecord.OnRecordPositionUpdateListener); + method public void setRecordPositionUpdateListener(android.media.AudioRecord.OnRecordPositionUpdateListener, android.os.Handler); + method public void startRecording() throws java.lang.IllegalStateException; + method public void startRecording(android.media.MediaSyncEvent) throws java.lang.IllegalStateException; + method public void stop() throws java.lang.IllegalStateException; + field public static final int ERROR = -1; // 0xffffffff + field public static final int ERROR_BAD_VALUE = -2; // 0xfffffffe + field public static final int ERROR_INVALID_OPERATION = -3; // 0xfffffffd + field public static final int RECORDSTATE_RECORDING = 3; // 0x3 + field public static final int RECORDSTATE_STOPPED = 1; // 0x1 + field public static final int STATE_INITIALIZED = 1; // 0x1 + field public static final int STATE_UNINITIALIZED = 0; // 0x0 + field public static final int SUCCESS = 0; // 0x0 + } + + public static abstract interface AudioRecord.OnRecordPositionUpdateListener { + method public abstract void onMarkerReached(android.media.AudioRecord); + method public abstract void onPeriodicNotification(android.media.AudioRecord); + } + + public class AudioTrack { + ctor public AudioTrack(int, int, int, int, int, int) throws java.lang.IllegalArgumentException; + ctor public AudioTrack(int, int, int, int, int, int, int) throws java.lang.IllegalArgumentException; + method public int attachAuxEffect(int); + method public void flush(); + method public int getAudioFormat(); + method public int getAudioSessionId(); + method public int getChannelConfiguration(); + method public int getChannelCount(); + method public static float getMaxVolume(); + method public static int getMinBufferSize(int, int, int); + method public static float getMinVolume(); + method protected int getNativeFrameCount(); + method public static int getNativeOutputSampleRate(int); + method public int getNotificationMarkerPosition(); + method public int getPlayState(); + method public int getPlaybackHeadPosition(); + method public int getPlaybackRate(); + method public int getPositionNotificationPeriod(); + method public int getSampleRate(); + method public int getState(); + method public int getStreamType(); + method public void pause() throws java.lang.IllegalStateException; + method public void play() throws java.lang.IllegalStateException; + method public void release(); + method public int reloadStaticData(); + method public int setAuxEffectSendLevel(float); + method public int setLoopPoints(int, int, int); + method public int setNotificationMarkerPosition(int); + method public int setPlaybackHeadPosition(int); + method public void setPlaybackPositionUpdateListener(android.media.AudioTrack.OnPlaybackPositionUpdateListener); + method public void setPlaybackPositionUpdateListener(android.media.AudioTrack.OnPlaybackPositionUpdateListener, android.os.Handler); + method public int setPlaybackRate(int); + method public int setPositionNotificationPeriod(int); + method protected void setState(int); + method public int setStereoVolume(float, float); + method public void stop() throws java.lang.IllegalStateException; + method public int write(byte[], int, int); + method public int write(short[], int, int); + field public static final int ERROR = -1; // 0xffffffff + field public static final int ERROR_BAD_VALUE = -2; // 0xfffffffe + field public static final int ERROR_INVALID_OPERATION = -3; // 0xfffffffd + field public static final int MODE_STATIC = 0; // 0x0 + field public static final int MODE_STREAM = 1; // 0x1 + field public static final int PLAYSTATE_PAUSED = 2; // 0x2 + field public static final int PLAYSTATE_PLAYING = 3; // 0x3 + field public static final int PLAYSTATE_STOPPED = 1; // 0x1 + field public static final int STATE_INITIALIZED = 1; // 0x1 + field public static final int STATE_NO_STATIC_DATA = 2; // 0x2 + field public static final int STATE_UNINITIALIZED = 0; // 0x0 + field public static final int SUCCESS = 0; // 0x0 + } + + public static abstract interface AudioTrack.OnPlaybackPositionUpdateListener { + method public abstract void onMarkerReached(android.media.AudioTrack); + method public abstract void onPeriodicNotification(android.media.AudioTrack); + } + + public class CamcorderProfile { + method public static android.media.CamcorderProfile get(int); + method public static android.media.CamcorderProfile get(int, int); + method public static boolean hasProfile(int); + method public static boolean hasProfile(int, int); + field public static final int QUALITY_1080P = 6; // 0x6 + field public static final int QUALITY_480P = 4; // 0x4 + field public static final int QUALITY_720P = 5; // 0x5 + field public static final int QUALITY_CIF = 3; // 0x3 + field public static final int QUALITY_HIGH = 1; // 0x1 + field public static final int QUALITY_LOW = 0; // 0x0 + field public static final int QUALITY_QCIF = 2; // 0x2 + field public static final int QUALITY_QVGA = 7; // 0x7 + field public static final int QUALITY_TIME_LAPSE_1080P = 1006; // 0x3ee + field public static final int QUALITY_TIME_LAPSE_480P = 1004; // 0x3ec + field public static final int QUALITY_TIME_LAPSE_720P = 1005; // 0x3ed + field public static final int QUALITY_TIME_LAPSE_CIF = 1003; // 0x3eb + field public static final int QUALITY_TIME_LAPSE_HIGH = 1001; // 0x3e9 + field public static final int QUALITY_TIME_LAPSE_LOW = 1000; // 0x3e8 + field public static final int QUALITY_TIME_LAPSE_QCIF = 1002; // 0x3ea + field public static final int QUALITY_TIME_LAPSE_QVGA = 1007; // 0x3ef + field public int audioBitRate; + field public int audioChannels; + field public int audioCodec; + field public int audioSampleRate; + field public int duration; + field public int fileFormat; + field public int quality; + field public int videoBitRate; + field public int videoCodec; + field public int videoFrameHeight; + field public int videoFrameRate; + field public int videoFrameWidth; + } + + public class CameraProfile { + ctor public CameraProfile(); + method public static int getJpegEncodingQualityParameter(int); + method public static int getJpegEncodingQualityParameter(int, int); + field public static final int QUALITY_HIGH = 2; // 0x2 + field public static final int QUALITY_LOW = 0; // 0x0 + field public static final int QUALITY_MEDIUM = 1; // 0x1 + } + + public class ExifInterface { + ctor public ExifInterface(java.lang.String) throws java.io.IOException; + method public double getAltitude(double); + method public java.lang.String getAttribute(java.lang.String); + method public double getAttributeDouble(java.lang.String, double); + method public int getAttributeInt(java.lang.String, int); + method public boolean getLatLong(float[]); + method public byte[] getThumbnail(); + method public boolean hasThumbnail(); + method public void saveAttributes() throws java.io.IOException; + method public void setAttribute(java.lang.String, java.lang.String); + field public static final int ORIENTATION_FLIP_HORIZONTAL = 2; // 0x2 + field public static final int ORIENTATION_FLIP_VERTICAL = 4; // 0x4 + field public static final int ORIENTATION_NORMAL = 1; // 0x1 + field public static final int ORIENTATION_ROTATE_180 = 3; // 0x3 + field public static final int ORIENTATION_ROTATE_270 = 8; // 0x8 + field public static final int ORIENTATION_ROTATE_90 = 6; // 0x6 + field public static final int ORIENTATION_TRANSPOSE = 5; // 0x5 + field public static final int ORIENTATION_TRANSVERSE = 7; // 0x7 + field public static final int ORIENTATION_UNDEFINED = 0; // 0x0 + field public static final java.lang.String TAG_APERTURE = "FNumber"; + field public static final java.lang.String TAG_DATETIME = "DateTime"; + field public static final java.lang.String TAG_EXPOSURE_TIME = "ExposureTime"; + field public static final java.lang.String TAG_FLASH = "Flash"; + field public static final java.lang.String TAG_FOCAL_LENGTH = "FocalLength"; + field public static final java.lang.String TAG_GPS_ALTITUDE = "GPSAltitude"; + field public static final java.lang.String TAG_GPS_ALTITUDE_REF = "GPSAltitudeRef"; + field public static final java.lang.String TAG_GPS_DATESTAMP = "GPSDateStamp"; + field public static final java.lang.String TAG_GPS_LATITUDE = "GPSLatitude"; + field public static final java.lang.String TAG_GPS_LATITUDE_REF = "GPSLatitudeRef"; + field public static final java.lang.String TAG_GPS_LONGITUDE = "GPSLongitude"; + field public static final java.lang.String TAG_GPS_LONGITUDE_REF = "GPSLongitudeRef"; + field public static final java.lang.String TAG_GPS_PROCESSING_METHOD = "GPSProcessingMethod"; + field public static final java.lang.String TAG_GPS_TIMESTAMP = "GPSTimeStamp"; + field public static final java.lang.String TAG_IMAGE_LENGTH = "ImageLength"; + field public static final java.lang.String TAG_IMAGE_WIDTH = "ImageWidth"; + field public static final java.lang.String TAG_ISO = "ISOSpeedRatings"; + field public static final java.lang.String TAG_MAKE = "Make"; + field public static final java.lang.String TAG_MODEL = "Model"; + field public static final java.lang.String TAG_ORIENTATION = "Orientation"; + field public static final java.lang.String TAG_WHITE_BALANCE = "WhiteBalance"; + field public static final int WHITEBALANCE_AUTO = 0; // 0x0 + field public static final int WHITEBALANCE_MANUAL = 1; // 0x1 + } + + public class FaceDetector { + ctor public FaceDetector(int, int, int); + method public int findFaces(android.graphics.Bitmap, android.media.FaceDetector.Face[]); + } + + public class FaceDetector.Face { + method public float confidence(); + method public float eyesDistance(); + method public void getMidPoint(android.graphics.PointF); + method public float pose(int); + field public static final float CONFIDENCE_THRESHOLD = 0.4f; + field public static final int EULER_X = 0; // 0x0 + field public static final int EULER_Y = 1; // 0x1 + field public static final int EULER_Z = 2; // 0x2 + } + + public class JetPlayer { + method public boolean clearQueue(); + method public java.lang.Object clone() throws java.lang.CloneNotSupportedException; + method public boolean closeJetFile(); + method public static android.media.JetPlayer getJetPlayer(); + method public static int getMaxTracks(); + method public boolean loadJetFile(java.lang.String); + method public boolean loadJetFile(android.content.res.AssetFileDescriptor); + method public boolean pause(); + method public boolean play(); + method public boolean queueJetSegment(int, int, int, int, int, byte); + method public boolean queueJetSegmentMuteArray(int, int, int, int, boolean[], byte); + method public void release(); + method public void setEventListener(android.media.JetPlayer.OnJetEventListener); + method public void setEventListener(android.media.JetPlayer.OnJetEventListener, android.os.Handler); + method public boolean setMuteArray(boolean[], boolean); + method public boolean setMuteFlag(int, boolean, boolean); + method public boolean setMuteFlags(int, boolean); + method public boolean triggerClip(int); + } + + public static abstract interface JetPlayer.OnJetEventListener { + method public abstract void onJetEvent(android.media.JetPlayer, short, byte, byte, byte, byte); + method public abstract void onJetNumQueuedSegmentUpdate(android.media.JetPlayer, int); + method public abstract void onJetPauseUpdate(android.media.JetPlayer, int); + method public abstract void onJetUserIdUpdate(android.media.JetPlayer, int, int); + } + + public class MediaActionSound { + ctor public MediaActionSound(); + method public synchronized void load(int); + method public synchronized void play(int); + method public void release(); + field public static final int FOCUS_COMPLETE = 1; // 0x1 + field public static final int SHUTTER_CLICK = 0; // 0x0 + field public static final int START_VIDEO_RECORDING = 2; // 0x2 + field public static final int STOP_VIDEO_RECORDING = 3; // 0x3 + } + + public final class MediaCodec { + method public void configure(android.media.MediaFormat, android.view.Surface, android.media.MediaCrypto, int); + method public static android.media.MediaCodec createByCodecName(java.lang.String); + method public static android.media.MediaCodec createDecoderByType(java.lang.String); + method public static android.media.MediaCodec createEncoderByType(java.lang.String); + method public final int dequeueInputBuffer(long); + method public final int dequeueOutputBuffer(android.media.MediaCodec.BufferInfo, long); + method public final void flush(); + method public java.nio.ByteBuffer[] getInputBuffers(); + method public java.nio.ByteBuffer[] getOutputBuffers(); + method public final android.media.MediaFormat getOutputFormat(); + method public final void queueInputBuffer(int, int, int, long, int) throws android.media.MediaCodec.CryptoException; + method public final void queueSecureInputBuffer(int, int, android.media.MediaCodec.CryptoInfo, long, int) throws android.media.MediaCodec.CryptoException; + method public final void release(); + method public final void releaseOutputBuffer(int, boolean); + method public final void setVideoScalingMode(int); + method public final void start(); + method public final void stop(); + field public static final int BUFFER_FLAG_CODEC_CONFIG = 2; // 0x2 + field public static final int BUFFER_FLAG_END_OF_STREAM = 4; // 0x4 + field public static final int BUFFER_FLAG_SYNC_FRAME = 1; // 0x1 + field public static final int CONFIGURE_FLAG_ENCODE = 1; // 0x1 + field public static final int CRYPTO_MODE_AES_CTR = 1; // 0x1 + field public static final int CRYPTO_MODE_UNENCRYPTED = 0; // 0x0 + field public static final int INFO_OUTPUT_BUFFERS_CHANGED = -3; // 0xfffffffd + field public static final int INFO_OUTPUT_FORMAT_CHANGED = -2; // 0xfffffffe + field public static final int INFO_TRY_AGAIN_LATER = -1; // 0xffffffff + field public static final int VIDEO_SCALING_MODE_SCALE_TO_FIT = 1; // 0x1 + field public static final int VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING = 2; // 0x2 + } + + public static final class MediaCodec.BufferInfo { + ctor public MediaCodec.BufferInfo(); + method public void set(int, int, long, int); + field public int flags; + field public int offset; + field public long presentationTimeUs; + field public int size; + } + + public static final class MediaCodec.CryptoException extends java.lang.RuntimeException { + ctor public MediaCodec.CryptoException(int, java.lang.String); + method public int getErrorCode(); + } + + public static final class MediaCodec.CryptoInfo { + ctor public MediaCodec.CryptoInfo(); + method public void set(int, int[], int[], byte[], byte[], int); + field public byte[] iv; + field public byte[] key; + field public int mode; + field public int[] numBytesOfClearData; + field public int[] numBytesOfEncryptedData; + field public int numSubSamples; + } + + public final class MediaCodecInfo { + method public final android.media.MediaCodecInfo.CodecCapabilities getCapabilitiesForType(java.lang.String); + method public final java.lang.String getName(); + method public final java.lang.String[] getSupportedTypes(); + method public final boolean isEncoder(); + } + + public static final class MediaCodecInfo.CodecCapabilities { + ctor public MediaCodecInfo.CodecCapabilities(); + field public static final int COLOR_Format12bitRGB444 = 3; // 0x3 + field public static final int COLOR_Format16bitARGB1555 = 5; // 0x5 + field public static final int COLOR_Format16bitARGB4444 = 4; // 0x4 + field public static final int COLOR_Format16bitBGR565 = 7; // 0x7 + field public static final int COLOR_Format16bitRGB565 = 6; // 0x6 + field public static final int COLOR_Format18BitBGR666 = 41; // 0x29 + field public static final int COLOR_Format18bitARGB1665 = 9; // 0x9 + field public static final int COLOR_Format18bitRGB666 = 8; // 0x8 + field public static final int COLOR_Format19bitARGB1666 = 10; // 0xa + field public static final int COLOR_Format24BitABGR6666 = 43; // 0x2b + field public static final int COLOR_Format24BitARGB6666 = 42; // 0x2a + field public static final int COLOR_Format24bitARGB1887 = 13; // 0xd + field public static final int COLOR_Format24bitBGR888 = 12; // 0xc + field public static final int COLOR_Format24bitRGB888 = 11; // 0xb + field public static final int COLOR_Format25bitARGB1888 = 14; // 0xe + field public static final int COLOR_Format32bitARGB8888 = 16; // 0x10 + field public static final int COLOR_Format32bitBGRA8888 = 15; // 0xf + field public static final int COLOR_Format8bitRGB332 = 2; // 0x2 + field public static final int COLOR_FormatCbYCrY = 27; // 0x1b + field public static final int COLOR_FormatCrYCbY = 28; // 0x1c + field public static final int COLOR_FormatL16 = 36; // 0x24 + field public static final int COLOR_FormatL2 = 33; // 0x21 + field public static final int COLOR_FormatL24 = 37; // 0x25 + field public static final int COLOR_FormatL32 = 38; // 0x26 + field public static final int COLOR_FormatL4 = 34; // 0x22 + field public static final int COLOR_FormatL8 = 35; // 0x23 + field public static final int COLOR_FormatMonochrome = 1; // 0x1 + field public static final int COLOR_FormatRawBayer10bit = 31; // 0x1f + field public static final int COLOR_FormatRawBayer8bit = 30; // 0x1e + field public static final int COLOR_FormatRawBayer8bitcompressed = 32; // 0x20 + field public static final int COLOR_FormatYCbYCr = 25; // 0x19 + field public static final int COLOR_FormatYCrYCb = 26; // 0x1a + field public static final int COLOR_FormatYUV411PackedPlanar = 18; // 0x12 + field public static final int COLOR_FormatYUV411Planar = 17; // 0x11 + field public static final int COLOR_FormatYUV420PackedPlanar = 20; // 0x14 + field public static final int COLOR_FormatYUV420PackedSemiPlanar = 39; // 0x27 + field public static final int COLOR_FormatYUV420Planar = 19; // 0x13 + field public static final int COLOR_FormatYUV420SemiPlanar = 21; // 0x15 + field public static final int COLOR_FormatYUV422PackedPlanar = 23; // 0x17 + field public static final int COLOR_FormatYUV422PackedSemiPlanar = 40; // 0x28 + field public static final int COLOR_FormatYUV422Planar = 22; // 0x16 + field public static final int COLOR_FormatYUV422SemiPlanar = 24; // 0x18 + field public static final int COLOR_FormatYUV444Interleaved = 29; // 0x1d + field public static final int COLOR_QCOM_FormatYUV420SemiPlanar = 2141391872; // 0x7fa30c00 + field public static final int COLOR_TI_FormatYUV420PackedSemiPlanar = 2130706688; // 0x7f000100 + field public int[] colorFormats; + field public android.media.MediaCodecInfo.CodecProfileLevel[] profileLevels; + } + + public static final class MediaCodecInfo.CodecProfileLevel { + ctor public MediaCodecInfo.CodecProfileLevel(); + field public static final int AACObjectELD = 39; // 0x27 + field public static final int AACObjectERLC = 17; // 0x11 + field public static final int AACObjectHE = 5; // 0x5 + field public static final int AACObjectHE_PS = 29; // 0x1d + field public static final int AACObjectLC = 2; // 0x2 + field public static final int AACObjectLD = 23; // 0x17 + field public static final int AACObjectLTP = 4; // 0x4 + field public static final int AACObjectMain = 1; // 0x1 + field public static final int AACObjectSSR = 3; // 0x3 + field public static final int AACObjectScalable = 6; // 0x6 + field public static final int AVCLevel1 = 1; // 0x1 + field public static final int AVCLevel11 = 4; // 0x4 + field public static final int AVCLevel12 = 8; // 0x8 + field public static final int AVCLevel13 = 16; // 0x10 + field public static final int AVCLevel1b = 2; // 0x2 + field public static final int AVCLevel2 = 32; // 0x20 + field public static final int AVCLevel21 = 64; // 0x40 + field public static final int AVCLevel22 = 128; // 0x80 + field public static final int AVCLevel3 = 256; // 0x100 + field public static final int AVCLevel31 = 512; // 0x200 + field public static final int AVCLevel32 = 1024; // 0x400 + field public static final int AVCLevel4 = 2048; // 0x800 + field public static final int AVCLevel41 = 4096; // 0x1000 + field public static final int AVCLevel42 = 8192; // 0x2000 + field public static final int AVCLevel5 = 16384; // 0x4000 + field public static final int AVCLevel51 = 32768; // 0x8000 + field public static final int AVCProfileBaseline = 1; // 0x1 + field public static final int AVCProfileExtended = 4; // 0x4 + field public static final int AVCProfileHigh = 8; // 0x8 + field public static final int AVCProfileHigh10 = 16; // 0x10 + field public static final int AVCProfileHigh422 = 32; // 0x20 + field public static final int AVCProfileHigh444 = 64; // 0x40 + field public static final int AVCProfileMain = 2; // 0x2 + field public static final int H263Level10 = 1; // 0x1 + field public static final int H263Level20 = 2; // 0x2 + field public static final int H263Level30 = 4; // 0x4 + field public static final int H263Level40 = 8; // 0x8 + field public static final int H263Level45 = 16; // 0x10 + field public static final int H263Level50 = 32; // 0x20 + field public static final int H263Level60 = 64; // 0x40 + field public static final int H263Level70 = 128; // 0x80 + field public static final int H263ProfileBackwardCompatible = 4; // 0x4 + field public static final int H263ProfileBaseline = 1; // 0x1 + field public static final int H263ProfileH320Coding = 2; // 0x2 + field public static final int H263ProfileHighCompression = 32; // 0x20 + field public static final int H263ProfileHighLatency = 256; // 0x100 + field public static final int H263ProfileISWV2 = 8; // 0x8 + field public static final int H263ProfileISWV3 = 16; // 0x10 + field public static final int H263ProfileInterlace = 128; // 0x80 + field public static final int H263ProfileInternet = 64; // 0x40 + field public static final int MPEG4Level0 = 1; // 0x1 + field public static final int MPEG4Level0b = 2; // 0x2 + field public static final int MPEG4Level1 = 4; // 0x4 + field public static final int MPEG4Level2 = 8; // 0x8 + field public static final int MPEG4Level3 = 16; // 0x10 + field public static final int MPEG4Level4 = 32; // 0x20 + field public static final int MPEG4Level4a = 64; // 0x40 + field public static final int MPEG4Level5 = 128; // 0x80 + field public static final int MPEG4ProfileAdvancedCoding = 4096; // 0x1000 + field public static final int MPEG4ProfileAdvancedCore = 8192; // 0x2000 + field public static final int MPEG4ProfileAdvancedRealTime = 1024; // 0x400 + field public static final int MPEG4ProfileAdvancedScalable = 16384; // 0x4000 + field public static final int MPEG4ProfileAdvancedSimple = 32768; // 0x8000 + field public static final int MPEG4ProfileBasicAnimated = 256; // 0x100 + field public static final int MPEG4ProfileCore = 4; // 0x4 + field public static final int MPEG4ProfileCoreScalable = 2048; // 0x800 + field public static final int MPEG4ProfileHybrid = 512; // 0x200 + field public static final int MPEG4ProfileMain = 8; // 0x8 + field public static final int MPEG4ProfileNbit = 16; // 0x10 + field public static final int MPEG4ProfileScalableTexture = 32; // 0x20 + field public static final int MPEG4ProfileSimple = 1; // 0x1 + field public static final int MPEG4ProfileSimpleFBA = 128; // 0x80 + field public static final int MPEG4ProfileSimpleFace = 64; // 0x40 + field public static final int MPEG4ProfileSimpleScalable = 2; // 0x2 + field public int level; + field public int profile; + } + + public final class MediaCodecList { + method public static final int getCodecCount(); + method public static final android.media.MediaCodecInfo getCodecInfoAt(int); + } + + public final class MediaCrypto { + ctor public MediaCrypto(java.util.UUID, byte[]) throws android.media.MediaCryptoException; + method public static final boolean isCryptoSchemeSupported(java.util.UUID); + method public final void release(); + method public final boolean requiresSecureDecoderComponent(java.lang.String); + } + + public final class MediaCryptoException extends java.lang.Exception { + ctor public MediaCryptoException(java.lang.String); + } + + public final class MediaExtractor { + ctor public MediaExtractor(); + method public boolean advance(); + method public long getCachedDuration(); + method public boolean getSampleCryptoInfo(android.media.MediaCodec.CryptoInfo); + method public int getSampleFlags(); + method public long getSampleTime(); + method public int getSampleTrackIndex(); + method public final int getTrackCount(); + method public android.media.MediaFormat getTrackFormat(int); + method public boolean hasCacheReachedEndOfStream(); + method public int readSampleData(java.nio.ByteBuffer, int); + method public final void release(); + method public void seekTo(long, int); + method public void selectTrack(int); + method public final void setDataSource(android.content.Context, android.net.Uri, java.util.Map) throws java.io.IOException; + method public final void setDataSource(java.lang.String, java.util.Map); + method public final void setDataSource(java.lang.String); + method public final void setDataSource(java.io.FileDescriptor); + method public final void setDataSource(java.io.FileDescriptor, long, long); + method public void unselectTrack(int); + field public static final int SAMPLE_FLAG_ENCRYPTED = 2; // 0x2 + field public static final int SAMPLE_FLAG_SYNC = 1; // 0x1 + field public static final int SEEK_TO_CLOSEST_SYNC = 2; // 0x2 + field public static final int SEEK_TO_NEXT_SYNC = 1; // 0x1 + field public static final int SEEK_TO_PREVIOUS_SYNC = 0; // 0x0 + } + + public final class MediaFormat { + ctor public MediaFormat(); + method public final boolean containsKey(java.lang.String); + method public static final android.media.MediaFormat createAudioFormat(java.lang.String, int, int); + method public static final android.media.MediaFormat createVideoFormat(java.lang.String, int, int); + method public final java.nio.ByteBuffer getByteBuffer(java.lang.String); + method public final float getFloat(java.lang.String); + method public final int getInteger(java.lang.String); + method public final long getLong(java.lang.String); + method public final java.lang.String getString(java.lang.String); + method public final void setByteBuffer(java.lang.String, java.nio.ByteBuffer); + method public final void setFloat(java.lang.String, float); + method public final void setInteger(java.lang.String, int); + method public final void setLong(java.lang.String, long); + method public final void setString(java.lang.String, java.lang.String); + field public static final java.lang.String KEY_AAC_PROFILE = "aac-profile"; + field public static final java.lang.String KEY_BIT_RATE = "bitrate"; + field public static final java.lang.String KEY_CHANNEL_COUNT = "channel-count"; + field public static final java.lang.String KEY_CHANNEL_MASK = "channel-mask"; + field public static final java.lang.String KEY_COLOR_FORMAT = "color-format"; + field public static final java.lang.String KEY_DURATION = "durationUs"; + field public static final java.lang.String KEY_FLAC_COMPRESSION_LEVEL = "flac-compression-level"; + field public static final java.lang.String KEY_FRAME_RATE = "frame-rate"; + field public static final java.lang.String KEY_HEIGHT = "height"; + field public static final java.lang.String KEY_IS_ADTS = "is-adts"; + field public static final java.lang.String KEY_I_FRAME_INTERVAL = "i-frame-interval"; + field public static final java.lang.String KEY_MAX_INPUT_SIZE = "max-input-size"; + field public static final java.lang.String KEY_MIME = "mime"; + field public static final java.lang.String KEY_SAMPLE_RATE = "sample-rate"; + field public static final java.lang.String KEY_WIDTH = "width"; + } + + public class MediaMetadataRetriever { + ctor public MediaMetadataRetriever(); + method public java.lang.String extractMetadata(int); + method public byte[] getEmbeddedPicture(); + method public android.graphics.Bitmap getFrameAtTime(long, int); + method public android.graphics.Bitmap getFrameAtTime(long); + method public android.graphics.Bitmap getFrameAtTime(); + method public void release(); + method public void setDataSource(java.lang.String) throws java.lang.IllegalArgumentException; + method public void setDataSource(java.lang.String, java.util.Map) throws java.lang.IllegalArgumentException; + method public void setDataSource(java.io.FileDescriptor, long, long) throws java.lang.IllegalArgumentException; + method public void setDataSource(java.io.FileDescriptor) throws java.lang.IllegalArgumentException; + method public void setDataSource(android.content.Context, android.net.Uri) throws java.lang.IllegalArgumentException, java.lang.SecurityException; + field public static final int METADATA_KEY_ALBUM = 1; // 0x1 + field public static final int METADATA_KEY_ALBUMARTIST = 13; // 0xd + field public static final int METADATA_KEY_ARTIST = 2; // 0x2 + field public static final int METADATA_KEY_AUTHOR = 3; // 0x3 + field public static final int METADATA_KEY_BITRATE = 20; // 0x14 + field public static final int METADATA_KEY_CD_TRACK_NUMBER = 0; // 0x0 + field public static final int METADATA_KEY_COMPILATION = 15; // 0xf + field public static final int METADATA_KEY_COMPOSER = 4; // 0x4 + field public static final int METADATA_KEY_DATE = 5; // 0x5 + field public static final int METADATA_KEY_DISC_NUMBER = 14; // 0xe + field public static final int METADATA_KEY_DURATION = 9; // 0x9 + field public static final int METADATA_KEY_GENRE = 6; // 0x6 + field public static final int METADATA_KEY_HAS_AUDIO = 16; // 0x10 + field public static final int METADATA_KEY_HAS_VIDEO = 17; // 0x11 + field public static final int METADATA_KEY_LOCATION = 23; // 0x17 + field public static final int METADATA_KEY_MIMETYPE = 12; // 0xc + field public static final int METADATA_KEY_NUM_TRACKS = 10; // 0xa + field public static final int METADATA_KEY_TITLE = 7; // 0x7 + field public static final int METADATA_KEY_VIDEO_HEIGHT = 19; // 0x13 + field public static final int METADATA_KEY_VIDEO_ROTATION = 24; // 0x18 + field public static final int METADATA_KEY_VIDEO_WIDTH = 18; // 0x12 + field public static final int METADATA_KEY_WRITER = 11; // 0xb + field public static final int METADATA_KEY_YEAR = 8; // 0x8 + field public static final int OPTION_CLOSEST = 3; // 0x3 + field public static final int OPTION_CLOSEST_SYNC = 2; // 0x2 + field public static final int OPTION_NEXT_SYNC = 1; // 0x1 + field public static final int OPTION_PREVIOUS_SYNC = 0; // 0x0 + } + + public class MediaPlayer { + ctor public MediaPlayer(); + method public void addTimedTextSource(java.lang.String, java.lang.String) throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.IllegalStateException; + method public void addTimedTextSource(android.content.Context, android.net.Uri, java.lang.String) throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.IllegalStateException; + method public void addTimedTextSource(java.io.FileDescriptor, java.lang.String) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException; + method public void addTimedTextSource(java.io.FileDescriptor, long, long, java.lang.String) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException; + method public void attachAuxEffect(int); + method public static android.media.MediaPlayer create(android.content.Context, android.net.Uri); + method public static android.media.MediaPlayer create(android.content.Context, android.net.Uri, android.view.SurfaceHolder); + method public static android.media.MediaPlayer create(android.content.Context, int); + method public void deselectTrack(int) throws java.lang.IllegalStateException; + method public int getAudioSessionId(); + method public int getCurrentPosition(); + method public int getDuration(); + method public android.media.MediaPlayer.TrackInfo[] getTrackInfo() throws java.lang.IllegalStateException; + method public int getVideoHeight(); + method public int getVideoWidth(); + method public boolean isLooping(); + method public boolean isPlaying(); + method public void pause() throws java.lang.IllegalStateException; + method public void prepare() throws java.io.IOException, java.lang.IllegalStateException; + method public void prepareAsync() throws java.lang.IllegalStateException; + method public void release(); + method public void reset(); + method public void seekTo(int) throws java.lang.IllegalStateException; + method public void selectTrack(int) throws java.lang.IllegalStateException; + method public void setAudioSessionId(int) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException; + method public void setAudioStreamType(int); + method public void setAuxEffectSendLevel(float); + method public void setDataSource(android.content.Context, android.net.Uri) throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.SecurityException; + method public void setDataSource(android.content.Context, android.net.Uri, java.util.Map) throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.SecurityException; + method public void setDataSource(java.lang.String) throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.SecurityException; + method public void setDataSource(java.io.FileDescriptor) throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.IllegalStateException; + method public void setDataSource(java.io.FileDescriptor, long, long) throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.IllegalStateException; + method public void setDisplay(android.view.SurfaceHolder); + method public void setLooping(boolean); + method public void setNextMediaPlayer(android.media.MediaPlayer); + method public void setOnBufferingUpdateListener(android.media.MediaPlayer.OnBufferingUpdateListener); + method public void setOnCompletionListener(android.media.MediaPlayer.OnCompletionListener); + method public void setOnErrorListener(android.media.MediaPlayer.OnErrorListener); + method public void setOnInfoListener(android.media.MediaPlayer.OnInfoListener); + method public void setOnPreparedListener(android.media.MediaPlayer.OnPreparedListener); + method public void setOnSeekCompleteListener(android.media.MediaPlayer.OnSeekCompleteListener); + method public void setOnTimedTextListener(android.media.MediaPlayer.OnTimedTextListener); + method public void setOnVideoSizeChangedListener(android.media.MediaPlayer.OnVideoSizeChangedListener); + method public void setScreenOnWhilePlaying(boolean); + method public void setSurface(android.view.Surface); + method public void setVideoScalingMode(int); + method public void setVolume(float, float); + method public void setWakeMode(android.content.Context, int); + method public void start() throws java.lang.IllegalStateException; + method public void stop() throws java.lang.IllegalStateException; + field public static final int MEDIA_ERROR_IO = -1004; // 0xfffffc14 + field public static final int MEDIA_ERROR_MALFORMED = -1007; // 0xfffffc11 + field public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK = 200; // 0xc8 + field public static final int MEDIA_ERROR_SERVER_DIED = 100; // 0x64 + field public static final int MEDIA_ERROR_TIMED_OUT = -110; // 0xffffff92 + field public static final int MEDIA_ERROR_UNKNOWN = 1; // 0x1 + field public static final int MEDIA_ERROR_UNSUPPORTED = -1010; // 0xfffffc0e + field public static final int MEDIA_INFO_BAD_INTERLEAVING = 800; // 0x320 + field public static final int MEDIA_INFO_BUFFERING_END = 702; // 0x2be + field public static final int MEDIA_INFO_BUFFERING_START = 701; // 0x2bd + field public static final int MEDIA_INFO_METADATA_UPDATE = 802; // 0x322 + field public static final int MEDIA_INFO_NOT_SEEKABLE = 801; // 0x321 + field public static final int MEDIA_INFO_UNKNOWN = 1; // 0x1 + field public static final int MEDIA_INFO_VIDEO_RENDERING_START = 3; // 0x3 + field public static final int MEDIA_INFO_VIDEO_TRACK_LAGGING = 700; // 0x2bc + field public static final java.lang.String MEDIA_MIMETYPE_TEXT_SUBRIP = "application/x-subrip"; + field public static final int VIDEO_SCALING_MODE_SCALE_TO_FIT = 1; // 0x1 + field public static final int VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING = 2; // 0x2 + } + + public static abstract interface MediaPlayer.OnBufferingUpdateListener { + method public abstract void onBufferingUpdate(android.media.MediaPlayer, int); + } + + public static abstract interface MediaPlayer.OnCompletionListener { + method public abstract void onCompletion(android.media.MediaPlayer); + } + + public static abstract interface MediaPlayer.OnErrorListener { + method public abstract boolean onError(android.media.MediaPlayer, int, int); + } + + public static abstract interface MediaPlayer.OnInfoListener { + method public abstract boolean onInfo(android.media.MediaPlayer, int, int); + } + + public static abstract interface MediaPlayer.OnPreparedListener { + method public abstract void onPrepared(android.media.MediaPlayer); + } + + public static abstract interface MediaPlayer.OnSeekCompleteListener { + method public abstract void onSeekComplete(android.media.MediaPlayer); + } + + public static abstract interface MediaPlayer.OnTimedTextListener { + method public abstract void onTimedText(android.media.MediaPlayer, android.media.TimedText); + } + + public static abstract interface MediaPlayer.OnVideoSizeChangedListener { + method public abstract void onVideoSizeChanged(android.media.MediaPlayer, int, int); + } + + public static class MediaPlayer.TrackInfo implements android.os.Parcelable { + method public int describeContents(); + method public java.lang.String getLanguage(); + method public int getTrackType(); + method public void writeToParcel(android.os.Parcel, int); + field public static final int MEDIA_TRACK_TYPE_AUDIO = 2; // 0x2 + field public static final int MEDIA_TRACK_TYPE_TIMEDTEXT = 3; // 0x3 + field public static final int MEDIA_TRACK_TYPE_UNKNOWN = 0; // 0x0 + field public static final int MEDIA_TRACK_TYPE_VIDEO = 1; // 0x1 + } + + public class MediaRecorder { + ctor public MediaRecorder(); + method public static final int getAudioSourceMax(); + method public int getMaxAmplitude() throws java.lang.IllegalStateException; + method public void prepare() throws java.io.IOException, java.lang.IllegalStateException; + method public void release(); + method public void reset(); + method public void setAudioChannels(int); + method public void setAudioEncoder(int) throws java.lang.IllegalStateException; + method public void setAudioEncodingBitRate(int); + method public void setAudioSamplingRate(int); + method public void setAudioSource(int) throws java.lang.IllegalStateException; + method public void setCamera(android.hardware.Camera); + method public void setCaptureRate(double); + method public void setLocation(float, float); + method public void setMaxDuration(int) throws java.lang.IllegalArgumentException; + method public void setMaxFileSize(long) throws java.lang.IllegalArgumentException; + method public void setOnErrorListener(android.media.MediaRecorder.OnErrorListener); + method public void setOnInfoListener(android.media.MediaRecorder.OnInfoListener); + method public void setOrientationHint(int); + method public void setOutputFile(java.io.FileDescriptor) throws java.lang.IllegalStateException; + method public void setOutputFile(java.lang.String) throws java.lang.IllegalStateException; + method public void setOutputFormat(int) throws java.lang.IllegalStateException; + method public void setPreviewDisplay(android.view.Surface); + method public void setProfile(android.media.CamcorderProfile); + method public void setVideoEncoder(int) throws java.lang.IllegalStateException; + method public void setVideoEncodingBitRate(int); + method public void setVideoFrameRate(int) throws java.lang.IllegalStateException; + method public void setVideoSize(int, int) throws java.lang.IllegalStateException; + method public void setVideoSource(int) throws java.lang.IllegalStateException; + method public void start() throws java.lang.IllegalStateException; + method public void stop() throws java.lang.IllegalStateException; + field public static final int MEDIA_ERROR_SERVER_DIED = 100; // 0x64 + field public static final int MEDIA_RECORDER_ERROR_UNKNOWN = 1; // 0x1 + field public static final int MEDIA_RECORDER_INFO_MAX_DURATION_REACHED = 800; // 0x320 + field public static final int MEDIA_RECORDER_INFO_MAX_FILESIZE_REACHED = 801; // 0x321 + field public static final int MEDIA_RECORDER_INFO_UNKNOWN = 1; // 0x1 + } + + public final class MediaRecorder.AudioEncoder { + field public static final int AAC = 3; // 0x3 + field public static final int AAC_ELD = 5; // 0x5 + field public static final int AMR_NB = 1; // 0x1 + field public static final int AMR_WB = 2; // 0x2 + field public static final int DEFAULT = 0; // 0x0 + field public static final int HE_AAC = 4; // 0x4 + } + + public final class MediaRecorder.AudioSource { + field public static final int CAMCORDER = 5; // 0x5 + field public static final int DEFAULT = 0; // 0x0 + field public static final int MIC = 1; // 0x1 + field public static final int VOICE_CALL = 4; // 0x4 + field public static final int VOICE_COMMUNICATION = 7; // 0x7 + field public static final int VOICE_DOWNLINK = 3; // 0x3 + field public static final int VOICE_RECOGNITION = 6; // 0x6 + field public static final int VOICE_UPLINK = 2; // 0x2 + } + + public static abstract interface MediaRecorder.OnErrorListener { + method public abstract void onError(android.media.MediaRecorder, int, int); + } + + public static abstract interface MediaRecorder.OnInfoListener { + method public abstract void onInfo(android.media.MediaRecorder, int, int); + } + + public final class MediaRecorder.OutputFormat { + field public static final int AAC_ADTS = 6; // 0x6 + field public static final int AMR_NB = 3; // 0x3 + field public static final int AMR_WB = 4; // 0x4 + field public static final int DEFAULT = 0; // 0x0 + field public static final int MPEG_4 = 2; // 0x2 + field public static final deprecated int RAW_AMR = 3; // 0x3 + field public static final int THREE_GPP = 1; // 0x1 + } + + public final class MediaRecorder.VideoEncoder { + field public static final int DEFAULT = 0; // 0x0 + field public static final int H263 = 1; // 0x1 + field public static final int H264 = 2; // 0x2 + field public static final int MPEG_4_SP = 3; // 0x3 + } + + public final class MediaRecorder.VideoSource { + field public static final int CAMERA = 1; // 0x1 + field public static final int DEFAULT = 0; // 0x0 + } + + public class MediaRouter { + method public void addCallback(int, android.media.MediaRouter.Callback); + method public void addUserRoute(android.media.MediaRouter.UserRouteInfo); + method public void clearUserRoutes(); + method public android.media.MediaRouter.RouteCategory createRouteCategory(java.lang.CharSequence, boolean); + method public android.media.MediaRouter.RouteCategory createRouteCategory(int, boolean); + method public android.media.MediaRouter.UserRouteInfo createUserRoute(android.media.MediaRouter.RouteCategory); + method public android.media.MediaRouter.RouteCategory getCategoryAt(int); + method public int getCategoryCount(); + method public android.media.MediaRouter.RouteInfo getRouteAt(int); + method public int getRouteCount(); + method public android.media.MediaRouter.RouteInfo getSelectedRoute(int); + method public void removeCallback(android.media.MediaRouter.Callback); + method public void removeUserRoute(android.media.MediaRouter.UserRouteInfo); + method public void selectRoute(int, android.media.MediaRouter.RouteInfo); + field public static final int ROUTE_TYPE_LIVE_AUDIO = 1; // 0x1 + field public static final int ROUTE_TYPE_LIVE_VIDEO = 2; // 0x2 + field public static final int ROUTE_TYPE_USER = 8388608; // 0x800000 + } + + public static abstract class MediaRouter.Callback { + ctor public MediaRouter.Callback(); + method public abstract void onRouteAdded(android.media.MediaRouter, android.media.MediaRouter.RouteInfo); + method public abstract void onRouteChanged(android.media.MediaRouter, android.media.MediaRouter.RouteInfo); + method public abstract void onRouteGrouped(android.media.MediaRouter, android.media.MediaRouter.RouteInfo, android.media.MediaRouter.RouteGroup, int); + method public void onRoutePresentationDisplayChanged(android.media.MediaRouter, android.media.MediaRouter.RouteInfo); + method public abstract void onRouteRemoved(android.media.MediaRouter, android.media.MediaRouter.RouteInfo); + method public abstract void onRouteSelected(android.media.MediaRouter, int, android.media.MediaRouter.RouteInfo); + method public abstract void onRouteUngrouped(android.media.MediaRouter, android.media.MediaRouter.RouteInfo, android.media.MediaRouter.RouteGroup); + method public abstract void onRouteUnselected(android.media.MediaRouter, int, android.media.MediaRouter.RouteInfo); + method public abstract void onRouteVolumeChanged(android.media.MediaRouter, android.media.MediaRouter.RouteInfo); + } + + public static class MediaRouter.RouteCategory { + method public java.lang.CharSequence getName(); + method public java.lang.CharSequence getName(android.content.Context); + method public java.util.List getRoutes(java.util.List); + method public int getSupportedTypes(); + method public boolean isGroupable(); + } + + public static class MediaRouter.RouteGroup extends android.media.MediaRouter.RouteInfo { + method public void addRoute(android.media.MediaRouter.RouteInfo); + method public void addRoute(android.media.MediaRouter.RouteInfo, int); + method public android.media.MediaRouter.RouteInfo getRouteAt(int); + method public int getRouteCount(); + method public void removeRoute(android.media.MediaRouter.RouteInfo); + method public void removeRoute(int); + method public void setIconDrawable(android.graphics.drawable.Drawable); + method public void setIconResource(int); + } + + public static class MediaRouter.RouteInfo { + method public android.media.MediaRouter.RouteCategory getCategory(); + method public android.media.MediaRouter.RouteGroup getGroup(); + method public android.graphics.drawable.Drawable getIconDrawable(); + method public java.lang.CharSequence getName(); + method public java.lang.CharSequence getName(android.content.Context); + method public int getPlaybackStream(); + method public int getPlaybackType(); + method public android.view.Display getPresentationDisplay(); + method public java.lang.CharSequence getStatus(); + method public int getSupportedTypes(); + method public java.lang.Object getTag(); + method public int getVolume(); + method public int getVolumeHandling(); + method public int getVolumeMax(); + method public boolean isEnabled(); + method public void requestSetVolume(int); + method public void requestUpdateVolume(int); + method public void setTag(java.lang.Object); + field public static final int PLAYBACK_TYPE_LOCAL = 0; // 0x0 + field public static final int PLAYBACK_TYPE_REMOTE = 1; // 0x1 + field public static final int PLAYBACK_VOLUME_FIXED = 0; // 0x0 + field public static final int PLAYBACK_VOLUME_VARIABLE = 1; // 0x1 + } + + public static class MediaRouter.SimpleCallback extends android.media.MediaRouter.Callback { + ctor public MediaRouter.SimpleCallback(); + method public void onRouteAdded(android.media.MediaRouter, android.media.MediaRouter.RouteInfo); + method public void onRouteChanged(android.media.MediaRouter, android.media.MediaRouter.RouteInfo); + method public void onRouteGrouped(android.media.MediaRouter, android.media.MediaRouter.RouteInfo, android.media.MediaRouter.RouteGroup, int); + method public void onRouteRemoved(android.media.MediaRouter, android.media.MediaRouter.RouteInfo); + method public void onRouteSelected(android.media.MediaRouter, int, android.media.MediaRouter.RouteInfo); + method public void onRouteUngrouped(android.media.MediaRouter, android.media.MediaRouter.RouteInfo, android.media.MediaRouter.RouteGroup); + method public void onRouteUnselected(android.media.MediaRouter, int, android.media.MediaRouter.RouteInfo); + method public void onRouteVolumeChanged(android.media.MediaRouter, android.media.MediaRouter.RouteInfo); + } + + public static class MediaRouter.UserRouteInfo extends android.media.MediaRouter.RouteInfo { + method public android.media.RemoteControlClient getRemoteControlClient(); + method public void setIconDrawable(android.graphics.drawable.Drawable); + method public void setIconResource(int); + method public void setName(java.lang.CharSequence); + method public void setName(int); + method public void setPlaybackStream(int); + method public void setPlaybackType(int); + method public void setRemoteControlClient(android.media.RemoteControlClient); + method public void setStatus(java.lang.CharSequence); + method public void setVolume(int); + method public void setVolumeCallback(android.media.MediaRouter.VolumeCallback); + method public void setVolumeHandling(int); + method public void setVolumeMax(int); + } + + public static abstract class MediaRouter.VolumeCallback { + ctor public MediaRouter.VolumeCallback(); + method public abstract void onVolumeSetRequest(android.media.MediaRouter.RouteInfo, int); + method public abstract void onVolumeUpdateRequest(android.media.MediaRouter.RouteInfo, int); + } + + public class MediaScannerConnection implements android.content.ServiceConnection { + ctor public MediaScannerConnection(android.content.Context, android.media.MediaScannerConnection.MediaScannerConnectionClient); + method public void connect(); + method public void disconnect(); + method public synchronized boolean isConnected(); + method public void onServiceConnected(android.content.ComponentName, android.os.IBinder); + method public void onServiceDisconnected(android.content.ComponentName); + method public void scanFile(java.lang.String, java.lang.String); + method public static void scanFile(android.content.Context, java.lang.String[], java.lang.String[], android.media.MediaScannerConnection.OnScanCompletedListener); + } + + public static abstract interface MediaScannerConnection.MediaScannerConnectionClient implements android.media.MediaScannerConnection.OnScanCompletedListener { + method public abstract void onMediaScannerConnected(); + method public abstract void onScanCompleted(java.lang.String, android.net.Uri); + } + + public static abstract interface MediaScannerConnection.OnScanCompletedListener { + method public abstract void onScanCompleted(java.lang.String, android.net.Uri); + } + + public class MediaSyncEvent { + method public static android.media.MediaSyncEvent createEvent(int) throws java.lang.IllegalArgumentException; + method public int getAudioSessionId(); + method public int getType(); + method public android.media.MediaSyncEvent setAudioSessionId(int) throws java.lang.IllegalArgumentException; + field public static final int SYNC_EVENT_NONE = 0; // 0x0 + field public static final int SYNC_EVENT_PRESENTATION_COMPLETE = 1; // 0x1 + } + + public class RemoteControlClient { + ctor public RemoteControlClient(android.app.PendingIntent); + ctor public RemoteControlClient(android.app.PendingIntent, android.os.Looper); + method public android.media.RemoteControlClient.MetadataEditor editMetadata(boolean); + method public void setPlaybackState(int); + method public void setTransportControlFlags(int); + field public static final int FLAG_KEY_MEDIA_FAST_FORWARD = 64; // 0x40 + field public static final int FLAG_KEY_MEDIA_NEXT = 128; // 0x80 + field public static final int FLAG_KEY_MEDIA_PAUSE = 16; // 0x10 + field public static final int FLAG_KEY_MEDIA_PLAY = 4; // 0x4 + field public static final int FLAG_KEY_MEDIA_PLAY_PAUSE = 8; // 0x8 + field public static final int FLAG_KEY_MEDIA_PREVIOUS = 1; // 0x1 + field public static final int FLAG_KEY_MEDIA_REWIND = 2; // 0x2 + field public static final int FLAG_KEY_MEDIA_STOP = 32; // 0x20 + field public static final int PLAYSTATE_BUFFERING = 8; // 0x8 + field public static final int PLAYSTATE_ERROR = 9; // 0x9 + field public static final int PLAYSTATE_FAST_FORWARDING = 4; // 0x4 + field public static final int PLAYSTATE_PAUSED = 2; // 0x2 + field public static final int PLAYSTATE_PLAYING = 3; // 0x3 + field public static final int PLAYSTATE_REWINDING = 5; // 0x5 + field public static final int PLAYSTATE_SKIPPING_BACKWARDS = 7; // 0x7 + field public static final int PLAYSTATE_SKIPPING_FORWARDS = 6; // 0x6 + field public static final int PLAYSTATE_STOPPED = 1; // 0x1 + } + + public class RemoteControlClient.MetadataEditor { + method public synchronized void apply(); + method public synchronized void clear(); + method public synchronized android.media.RemoteControlClient.MetadataEditor putBitmap(int, android.graphics.Bitmap) throws java.lang.IllegalArgumentException; + method public synchronized android.media.RemoteControlClient.MetadataEditor putLong(int, long) throws java.lang.IllegalArgumentException; + method public synchronized android.media.RemoteControlClient.MetadataEditor putString(int, java.lang.String) throws java.lang.IllegalArgumentException; + field public static final int BITMAP_KEY_ARTWORK = 100; // 0x64 + } + + public class Ringtone { + method public int getStreamType(); + method public java.lang.String getTitle(android.content.Context); + method public boolean isPlaying(); + method public void play(); + method public void setStreamType(int); + method public void stop(); + } + + public class RingtoneManager { + ctor public RingtoneManager(android.app.Activity); + ctor public RingtoneManager(android.content.Context); + method public static android.net.Uri getActualDefaultRingtoneUri(android.content.Context, int); + method public android.database.Cursor getCursor(); + method public static int getDefaultType(android.net.Uri); + method public static android.net.Uri getDefaultUri(int); + method public boolean getIncludeDrm(); + method public android.media.Ringtone getRingtone(int); + method public static android.media.Ringtone getRingtone(android.content.Context, android.net.Uri); + method public int getRingtonePosition(android.net.Uri); + method public android.net.Uri getRingtoneUri(int); + method public boolean getStopPreviousRingtone(); + method public static android.net.Uri getValidRingtoneUri(android.content.Context); + method public int inferStreamType(); + method public static boolean isDefault(android.net.Uri); + method public static void setActualDefaultRingtoneUri(android.content.Context, int, android.net.Uri); + method public void setIncludeDrm(boolean); + method public void setStopPreviousRingtone(boolean); + method public void setType(int); + method public void stopPreviousRingtone(); + field public static final java.lang.String ACTION_RINGTONE_PICKER = "android.intent.action.RINGTONE_PICKER"; + field public static final java.lang.String EXTRA_RINGTONE_DEFAULT_URI = "android.intent.extra.ringtone.DEFAULT_URI"; + field public static final java.lang.String EXTRA_RINGTONE_EXISTING_URI = "android.intent.extra.ringtone.EXISTING_URI"; + field public static final java.lang.String EXTRA_RINGTONE_INCLUDE_DRM = "android.intent.extra.ringtone.INCLUDE_DRM"; + field public static final java.lang.String EXTRA_RINGTONE_PICKED_URI = "android.intent.extra.ringtone.PICKED_URI"; + field public static final java.lang.String EXTRA_RINGTONE_SHOW_DEFAULT = "android.intent.extra.ringtone.SHOW_DEFAULT"; + field public static final java.lang.String EXTRA_RINGTONE_SHOW_SILENT = "android.intent.extra.ringtone.SHOW_SILENT"; + field public static final java.lang.String EXTRA_RINGTONE_TITLE = "android.intent.extra.ringtone.TITLE"; + field public static final java.lang.String EXTRA_RINGTONE_TYPE = "android.intent.extra.ringtone.TYPE"; + field public static final int ID_COLUMN_INDEX = 0; // 0x0 + field public static final int TITLE_COLUMN_INDEX = 1; // 0x1 + field public static final int TYPE_ALARM = 4; // 0x4 + field public static final int TYPE_ALL = 7; // 0x7 + field public static final int TYPE_NOTIFICATION = 2; // 0x2 + field public static final int TYPE_RINGTONE = 1; // 0x1 + field public static final int URI_COLUMN_INDEX = 2; // 0x2 + } + + public class SoundPool { + ctor public SoundPool(int, int, int); + method public final void autoPause(); + method public final void autoResume(); + method public int load(java.lang.String, int); + method public int load(android.content.Context, int, int); + method public int load(android.content.res.AssetFileDescriptor, int); + method public int load(java.io.FileDescriptor, long, long, int); + method public final void pause(int); + method public final int play(int, float, float, int, int, float); + method public final void release(); + method public final void resume(int); + method public final void setLoop(int, int); + method public void setOnLoadCompleteListener(android.media.SoundPool.OnLoadCompleteListener); + method public final void setPriority(int, int); + method public final void setRate(int, float); + method public final void setVolume(int, float, float); + method public final void stop(int); + method public final boolean unload(int); + } + + public static abstract interface SoundPool.OnLoadCompleteListener { + method public abstract void onLoadComplete(android.media.SoundPool, int, int); + } + + public class ThumbnailUtils { + ctor public ThumbnailUtils(); + method public static android.graphics.Bitmap createVideoThumbnail(java.lang.String, int); + method public static android.graphics.Bitmap extractThumbnail(android.graphics.Bitmap, int, int); + method public static android.graphics.Bitmap extractThumbnail(android.graphics.Bitmap, int, int, int); + field public static final int OPTIONS_RECYCLE_INPUT = 2; // 0x2 + } + + public final class TimedText { + method public android.graphics.Rect getBounds(); + method public java.lang.String getText(); + } + + public class ToneGenerator { + ctor public ToneGenerator(int, int); + method public final int getAudioSessionId(); + method public void release(); + method public boolean startTone(int); + method public boolean startTone(int, int); + method public void stopTone(); + field public static final int MAX_VOLUME = 100; // 0x64 + field public static final int MIN_VOLUME = 0; // 0x0 + field public static final int TONE_CDMA_ABBR_ALERT = 97; // 0x61 + field public static final int TONE_CDMA_ABBR_INTERCEPT = 37; // 0x25 + field public static final int TONE_CDMA_ABBR_REORDER = 39; // 0x27 + field public static final int TONE_CDMA_ALERT_AUTOREDIAL_LITE = 87; // 0x57 + field public static final int TONE_CDMA_ALERT_CALL_GUARD = 93; // 0x5d + field public static final int TONE_CDMA_ALERT_INCALL_LITE = 91; // 0x5b + field public static final int TONE_CDMA_ALERT_NETWORK_LITE = 86; // 0x56 + field public static final int TONE_CDMA_ANSWER = 42; // 0x2a + field public static final int TONE_CDMA_CALLDROP_LITE = 95; // 0x5f + field public static final int TONE_CDMA_CALL_SIGNAL_ISDN_INTERGROUP = 46; // 0x2e + field public static final int TONE_CDMA_CALL_SIGNAL_ISDN_NORMAL = 45; // 0x2d + field public static final int TONE_CDMA_CALL_SIGNAL_ISDN_PAT3 = 48; // 0x30 + field public static final int TONE_CDMA_CALL_SIGNAL_ISDN_PAT5 = 50; // 0x32 + field public static final int TONE_CDMA_CALL_SIGNAL_ISDN_PAT6 = 51; // 0x33 + field public static final int TONE_CDMA_CALL_SIGNAL_ISDN_PAT7 = 52; // 0x34 + field public static final int TONE_CDMA_CALL_SIGNAL_ISDN_PING_RING = 49; // 0x31 + field public static final int TONE_CDMA_CALL_SIGNAL_ISDN_SP_PRI = 47; // 0x2f + field public static final int TONE_CDMA_CONFIRM = 41; // 0x29 + field public static final int TONE_CDMA_DIAL_TONE_LITE = 34; // 0x22 + field public static final int TONE_CDMA_EMERGENCY_RINGBACK = 92; // 0x5c + field public static final int TONE_CDMA_HIGH_L = 53; // 0x35 + field public static final int TONE_CDMA_HIGH_PBX_L = 71; // 0x47 + field public static final int TONE_CDMA_HIGH_PBX_SLS = 80; // 0x50 + field public static final int TONE_CDMA_HIGH_PBX_SS = 74; // 0x4a + field public static final int TONE_CDMA_HIGH_PBX_SSL = 77; // 0x4d + field public static final int TONE_CDMA_HIGH_PBX_S_X4 = 83; // 0x53 + field public static final int TONE_CDMA_HIGH_SLS = 65; // 0x41 + field public static final int TONE_CDMA_HIGH_SS = 56; // 0x38 + field public static final int TONE_CDMA_HIGH_SSL = 59; // 0x3b + field public static final int TONE_CDMA_HIGH_SS_2 = 62; // 0x3e + field public static final int TONE_CDMA_HIGH_S_X4 = 68; // 0x44 + field public static final int TONE_CDMA_INTERCEPT = 36; // 0x24 + field public static final int TONE_CDMA_KEYPAD_VOLUME_KEY_LITE = 89; // 0x59 + field public static final int TONE_CDMA_LOW_L = 55; // 0x37 + field public static final int TONE_CDMA_LOW_PBX_L = 73; // 0x49 + field public static final int TONE_CDMA_LOW_PBX_SLS = 82; // 0x52 + field public static final int TONE_CDMA_LOW_PBX_SS = 76; // 0x4c + field public static final int TONE_CDMA_LOW_PBX_SSL = 79; // 0x4f + field public static final int TONE_CDMA_LOW_PBX_S_X4 = 85; // 0x55 + field public static final int TONE_CDMA_LOW_SLS = 67; // 0x43 + field public static final int TONE_CDMA_LOW_SS = 58; // 0x3a + field public static final int TONE_CDMA_LOW_SSL = 61; // 0x3d + field public static final int TONE_CDMA_LOW_SS_2 = 64; // 0x40 + field public static final int TONE_CDMA_LOW_S_X4 = 70; // 0x46 + field public static final int TONE_CDMA_MED_L = 54; // 0x36 + field public static final int TONE_CDMA_MED_PBX_L = 72; // 0x48 + field public static final int TONE_CDMA_MED_PBX_SLS = 81; // 0x51 + field public static final int TONE_CDMA_MED_PBX_SS = 75; // 0x4b + field public static final int TONE_CDMA_MED_PBX_SSL = 78; // 0x4e + field public static final int TONE_CDMA_MED_PBX_S_X4 = 84; // 0x54 + field public static final int TONE_CDMA_MED_SLS = 66; // 0x42 + field public static final int TONE_CDMA_MED_SS = 57; // 0x39 + field public static final int TONE_CDMA_MED_SSL = 60; // 0x3c + field public static final int TONE_CDMA_MED_SS_2 = 63; // 0x3f + field public static final int TONE_CDMA_MED_S_X4 = 69; // 0x45 + field public static final int TONE_CDMA_NETWORK_BUSY = 40; // 0x28 + field public static final int TONE_CDMA_NETWORK_BUSY_ONE_SHOT = 96; // 0x60 + field public static final int TONE_CDMA_NETWORK_CALLWAITING = 43; // 0x2b + field public static final int TONE_CDMA_NETWORK_USA_RINGBACK = 35; // 0x23 + field public static final int TONE_CDMA_ONE_MIN_BEEP = 88; // 0x58 + field public static final int TONE_CDMA_PIP = 44; // 0x2c + field public static final int TONE_CDMA_PRESSHOLDKEY_LITE = 90; // 0x5a + field public static final int TONE_CDMA_REORDER = 38; // 0x26 + field public static final int TONE_CDMA_SIGNAL_OFF = 98; // 0x62 + field public static final int TONE_CDMA_SOFT_ERROR_LITE = 94; // 0x5e + field public static final int TONE_DTMF_0 = 0; // 0x0 + field public static final int TONE_DTMF_1 = 1; // 0x1 + field public static final int TONE_DTMF_2 = 2; // 0x2 + field public static final int TONE_DTMF_3 = 3; // 0x3 + field public static final int TONE_DTMF_4 = 4; // 0x4 + field public static final int TONE_DTMF_5 = 5; // 0x5 + field public static final int TONE_DTMF_6 = 6; // 0x6 + field public static final int TONE_DTMF_7 = 7; // 0x7 + field public static final int TONE_DTMF_8 = 8; // 0x8 + field public static final int TONE_DTMF_9 = 9; // 0x9 + field public static final int TONE_DTMF_A = 12; // 0xc + field public static final int TONE_DTMF_B = 13; // 0xd + field public static final int TONE_DTMF_C = 14; // 0xe + field public static final int TONE_DTMF_D = 15; // 0xf + field public static final int TONE_DTMF_P = 11; // 0xb + field public static final int TONE_DTMF_S = 10; // 0xa + field public static final int TONE_PROP_ACK = 25; // 0x19 + field public static final int TONE_PROP_BEEP = 24; // 0x18 + field public static final int TONE_PROP_BEEP2 = 28; // 0x1c + field public static final int TONE_PROP_NACK = 26; // 0x1a + field public static final int TONE_PROP_PROMPT = 27; // 0x1b + field public static final int TONE_SUP_BUSY = 17; // 0x11 + field public static final int TONE_SUP_CALL_WAITING = 22; // 0x16 + field public static final int TONE_SUP_CONFIRM = 32; // 0x20 + field public static final int TONE_SUP_CONGESTION = 18; // 0x12 + field public static final int TONE_SUP_CONGESTION_ABBREV = 31; // 0x1f + field public static final int TONE_SUP_DIAL = 16; // 0x10 + field public static final int TONE_SUP_ERROR = 21; // 0x15 + field public static final int TONE_SUP_INTERCEPT = 29; // 0x1d + field public static final int TONE_SUP_INTERCEPT_ABBREV = 30; // 0x1e + field public static final int TONE_SUP_PIP = 33; // 0x21 + field public static final int TONE_SUP_RADIO_ACK = 19; // 0x13 + field public static final int TONE_SUP_RADIO_NOTAVAIL = 20; // 0x14 + field public static final int TONE_SUP_RINGTONE = 23; // 0x17 + } + +} + +package android.media.audiofx { + + public class AcousticEchoCanceler extends android.media.audiofx.AudioEffect { + method public static android.media.audiofx.AcousticEchoCanceler create(int); + method public static boolean isAvailable(); + } + + public class AudioEffect { + method public android.media.audiofx.AudioEffect.Descriptor getDescriptor() throws java.lang.IllegalStateException; + method public boolean getEnabled() throws java.lang.IllegalStateException; + method public int getId() throws java.lang.IllegalStateException; + method public boolean hasControl() throws java.lang.IllegalStateException; + method public static android.media.audiofx.AudioEffect.Descriptor[] queryEffects(); + method public void release(); + method public void setControlStatusListener(android.media.audiofx.AudioEffect.OnControlStatusChangeListener); + method public void setEnableStatusListener(android.media.audiofx.AudioEffect.OnEnableStatusChangeListener); + method public int setEnabled(boolean) throws java.lang.IllegalStateException; + field public static final java.lang.String ACTION_CLOSE_AUDIO_EFFECT_CONTROL_SESSION = "android.media.action.CLOSE_AUDIO_EFFECT_CONTROL_SESSION"; + field public static final java.lang.String ACTION_DISPLAY_AUDIO_EFFECT_CONTROL_PANEL = "android.media.action.DISPLAY_AUDIO_EFFECT_CONTROL_PANEL"; + field public static final java.lang.String ACTION_OPEN_AUDIO_EFFECT_CONTROL_SESSION = "android.media.action.OPEN_AUDIO_EFFECT_CONTROL_SESSION"; + field public static final int ALREADY_EXISTS = -2; // 0xfffffffe + field public static final int CONTENT_TYPE_GAME = 2; // 0x2 + field public static final int CONTENT_TYPE_MOVIE = 1; // 0x1 + field public static final int CONTENT_TYPE_MUSIC = 0; // 0x0 + field public static final int CONTENT_TYPE_VOICE = 3; // 0x3 + field public static final java.lang.String EFFECT_AUXILIARY = "Auxiliary"; + field public static final java.lang.String EFFECT_INSERT = "Insert"; + field public static final int ERROR = -1; // 0xffffffff + field public static final int ERROR_BAD_VALUE = -4; // 0xfffffffc + field public static final int ERROR_DEAD_OBJECT = -7; // 0xfffffff9 + field public static final int ERROR_INVALID_OPERATION = -5; // 0xfffffffb + field public static final int ERROR_NO_INIT = -3; // 0xfffffffd + field public static final int ERROR_NO_MEMORY = -6; // 0xfffffffa + field public static final java.lang.String EXTRA_AUDIO_SESSION = "android.media.extra.AUDIO_SESSION"; + field public static final java.lang.String EXTRA_CONTENT_TYPE = "android.media.extra.CONTENT_TYPE"; + field public static final java.lang.String EXTRA_PACKAGE_NAME = "android.media.extra.PACKAGE_NAME"; + field public static final int SUCCESS = 0; // 0x0 + } + + public static class AudioEffect.Descriptor { + ctor public AudioEffect.Descriptor(); + ctor public AudioEffect.Descriptor(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String); + field public java.lang.String connectMode; + field public java.lang.String implementor; + field public java.lang.String name; + field public java.util.UUID type; + field public java.util.UUID uuid; + } + + public static abstract interface AudioEffect.OnControlStatusChangeListener { + method public abstract void onControlStatusChange(android.media.audiofx.AudioEffect, boolean); + } + + public static abstract interface AudioEffect.OnEnableStatusChangeListener { + method public abstract void onEnableStatusChange(android.media.audiofx.AudioEffect, boolean); + } + + public class AutomaticGainControl extends android.media.audiofx.AudioEffect { + method public static android.media.audiofx.AutomaticGainControl create(int); + method public static boolean isAvailable(); + } + + public class BassBoost extends android.media.audiofx.AudioEffect { + ctor public BassBoost(int, int) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.RuntimeException, java.lang.UnsupportedOperationException; + method public android.media.audiofx.BassBoost.Settings getProperties() throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException; + method public short getRoundedStrength() throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException; + method public boolean getStrengthSupported(); + method public void setParameterListener(android.media.audiofx.BassBoost.OnParameterChangeListener); + method public void setProperties(android.media.audiofx.BassBoost.Settings) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException; + method public void setStrength(short) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException; + field public static final int PARAM_STRENGTH = 1; // 0x1 + field public static final int PARAM_STRENGTH_SUPPORTED = 0; // 0x0 + } + + public static abstract interface BassBoost.OnParameterChangeListener { + method public abstract void onParameterChange(android.media.audiofx.BassBoost, int, int, short); + } + + public static class BassBoost.Settings { + ctor public BassBoost.Settings(); + ctor public BassBoost.Settings(java.lang.String); + field public short strength; + } + + public class EnvironmentalReverb extends android.media.audiofx.AudioEffect { + ctor public EnvironmentalReverb(int, int) throws java.lang.IllegalArgumentException, java.lang.RuntimeException, java.lang.UnsupportedOperationException; + method public short getDecayHFRatio() throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException; + method public int getDecayTime() throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException; + method public short getDensity() throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException; + method public short getDiffusion() throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException; + method public android.media.audiofx.EnvironmentalReverb.Settings getProperties() throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException; + method public int getReflectionsDelay() throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException; + method public short getReflectionsLevel() throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException; + method public int getReverbDelay() throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException; + method public short getReverbLevel() throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException; + method public short getRoomHFLevel() throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException; + method public short getRoomLevel() throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException; + method public void setDecayHFRatio(short) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException; + method public void setDecayTime(int) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException; + method public void setDensity(short) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException; + method public void setDiffusion(short) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException; + method public void setParameterListener(android.media.audiofx.EnvironmentalReverb.OnParameterChangeListener); + method public void setProperties(android.media.audiofx.EnvironmentalReverb.Settings) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException; + method public void setReflectionsDelay(int) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException; + method public void setReflectionsLevel(short) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException; + method public void setReverbDelay(int) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException; + method public void setReverbLevel(short) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException; + method public void setRoomHFLevel(short) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException; + method public void setRoomLevel(short) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException; + field public static final int PARAM_DECAY_HF_RATIO = 3; // 0x3 + field public static final int PARAM_DECAY_TIME = 2; // 0x2 + field public static final int PARAM_DENSITY = 9; // 0x9 + field public static final int PARAM_DIFFUSION = 8; // 0x8 + field public static final int PARAM_REFLECTIONS_DELAY = 5; // 0x5 + field public static final int PARAM_REFLECTIONS_LEVEL = 4; // 0x4 + field public static final int PARAM_REVERB_DELAY = 7; // 0x7 + field public static final int PARAM_REVERB_LEVEL = 6; // 0x6 + field public static final int PARAM_ROOM_HF_LEVEL = 1; // 0x1 + field public static final int PARAM_ROOM_LEVEL = 0; // 0x0 + } + + public static abstract interface EnvironmentalReverb.OnParameterChangeListener { + method public abstract void onParameterChange(android.media.audiofx.EnvironmentalReverb, int, int, int); + } + + public static class EnvironmentalReverb.Settings { + ctor public EnvironmentalReverb.Settings(); + ctor public EnvironmentalReverb.Settings(java.lang.String); + field public short decayHFRatio; + field public int decayTime; + field public short density; + field public short diffusion; + field public int reflectionsDelay; + field public short reflectionsLevel; + field public int reverbDelay; + field public short reverbLevel; + field public short roomHFLevel; + field public short roomLevel; + } + + public class Equalizer extends android.media.audiofx.AudioEffect { + ctor public Equalizer(int, int) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.RuntimeException, java.lang.UnsupportedOperationException; + method public short getBand(int) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException; + method public int[] getBandFreqRange(short) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException; + method public short getBandLevel(short) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException; + method public short[] getBandLevelRange() throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException; + method public int getCenterFreq(short) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException; + method public short getCurrentPreset() throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException; + method public short getNumberOfBands() throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException; + method public short getNumberOfPresets() throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException; + method public java.lang.String getPresetName(short); + method public android.media.audiofx.Equalizer.Settings getProperties() throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException; + method public void setBandLevel(short, short) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException; + method public void setParameterListener(android.media.audiofx.Equalizer.OnParameterChangeListener); + method public void setProperties(android.media.audiofx.Equalizer.Settings) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException; + method public void usePreset(short) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException; + field public static final int PARAM_BAND_FREQ_RANGE = 4; // 0x4 + field public static final int PARAM_BAND_LEVEL = 2; // 0x2 + field public static final int PARAM_CENTER_FREQ = 3; // 0x3 + field public static final int PARAM_CURRENT_PRESET = 6; // 0x6 + field public static final int PARAM_GET_BAND = 5; // 0x5 + field public static final int PARAM_GET_NUM_OF_PRESETS = 7; // 0x7 + field public static final int PARAM_GET_PRESET_NAME = 8; // 0x8 + field public static final int PARAM_LEVEL_RANGE = 1; // 0x1 + field public static final int PARAM_NUM_BANDS = 0; // 0x0 + field public static final int PARAM_STRING_SIZE_MAX = 32; // 0x20 + } + + public static abstract interface Equalizer.OnParameterChangeListener { + method public abstract void onParameterChange(android.media.audiofx.Equalizer, int, int, int, int); + } + + public static class Equalizer.Settings { + ctor public Equalizer.Settings(); + ctor public Equalizer.Settings(java.lang.String); + field public short[] bandLevels; + field public short curPreset; + field public short numBands; + } + + public class NoiseSuppressor extends android.media.audiofx.AudioEffect { + method public static android.media.audiofx.NoiseSuppressor create(int); + method public static boolean isAvailable(); + } + + public class PresetReverb extends android.media.audiofx.AudioEffect { + ctor public PresetReverb(int, int) throws java.lang.IllegalArgumentException, java.lang.RuntimeException, java.lang.UnsupportedOperationException; + method public short getPreset() throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException; + method public android.media.audiofx.PresetReverb.Settings getProperties() throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException; + method public void setParameterListener(android.media.audiofx.PresetReverb.OnParameterChangeListener); + method public void setPreset(short) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException; + method public void setProperties(android.media.audiofx.PresetReverb.Settings) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException; + field public static final int PARAM_PRESET = 0; // 0x0 + field public static final short PRESET_LARGEHALL = 5; // 0x5 + field public static final short PRESET_LARGEROOM = 3; // 0x3 + field public static final short PRESET_MEDIUMHALL = 4; // 0x4 + field public static final short PRESET_MEDIUMROOM = 2; // 0x2 + field public static final short PRESET_NONE = 0; // 0x0 + field public static final short PRESET_PLATE = 6; // 0x6 + field public static final short PRESET_SMALLROOM = 1; // 0x1 + } + + public static abstract interface PresetReverb.OnParameterChangeListener { + method public abstract void onParameterChange(android.media.audiofx.PresetReverb, int, int, short); + } + + public static class PresetReverb.Settings { + ctor public PresetReverb.Settings(); + ctor public PresetReverb.Settings(java.lang.String); + field public short preset; + } + + public class Virtualizer extends android.media.audiofx.AudioEffect { + ctor public Virtualizer(int, int) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.RuntimeException, java.lang.UnsupportedOperationException; + method public android.media.audiofx.Virtualizer.Settings getProperties() throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException; + method public short getRoundedStrength() throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException; + method public boolean getStrengthSupported(); + method public void setParameterListener(android.media.audiofx.Virtualizer.OnParameterChangeListener); + method public void setProperties(android.media.audiofx.Virtualizer.Settings) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException; + method public void setStrength(short) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException; + field public static final int PARAM_STRENGTH = 1; // 0x1 + field public static final int PARAM_STRENGTH_SUPPORTED = 0; // 0x0 + } + + public static abstract interface Virtualizer.OnParameterChangeListener { + method public abstract void onParameterChange(android.media.audiofx.Virtualizer, int, int, short); + } + + public static class Virtualizer.Settings { + ctor public Virtualizer.Settings(); + ctor public Virtualizer.Settings(java.lang.String); + field public short strength; + } + + public class Visualizer { + ctor public Visualizer(int) throws java.lang.RuntimeException, java.lang.UnsupportedOperationException; + method public int getCaptureSize() throws java.lang.IllegalStateException; + method public static int[] getCaptureSizeRange(); + method public boolean getEnabled(); + method public int getFft(byte[]) throws java.lang.IllegalStateException; + method public static int getMaxCaptureRate(); + method public int getSamplingRate() throws java.lang.IllegalStateException; + method public int getScalingMode() throws java.lang.IllegalStateException; + method public int getWaveForm(byte[]) throws java.lang.IllegalStateException; + method public void release(); + method public int setCaptureSize(int) throws java.lang.IllegalStateException; + method public int setDataCaptureListener(android.media.audiofx.Visualizer.OnDataCaptureListener, int, boolean, boolean); + method public int setEnabled(boolean) throws java.lang.IllegalStateException; + method public int setScalingMode(int) throws java.lang.IllegalStateException; + field public static final int ALREADY_EXISTS = -2; // 0xfffffffe + field public static final int ERROR = -1; // 0xffffffff + field public static final int ERROR_BAD_VALUE = -4; // 0xfffffffc + field public static final int ERROR_DEAD_OBJECT = -7; // 0xfffffff9 + field public static final int ERROR_INVALID_OPERATION = -5; // 0xfffffffb + field public static final int ERROR_NO_INIT = -3; // 0xfffffffd + field public static final int ERROR_NO_MEMORY = -6; // 0xfffffffa + field public static final int SCALING_MODE_AS_PLAYED = 1; // 0x1 + field public static final int SCALING_MODE_NORMALIZED = 0; // 0x0 + field public static final int STATE_ENABLED = 2; // 0x2 + field public static final int STATE_INITIALIZED = 1; // 0x1 + field public static final int STATE_UNINITIALIZED = 0; // 0x0 + field public static final int SUCCESS = 0; // 0x0 + } + + public static abstract interface Visualizer.OnDataCaptureListener { + method public abstract void onFftDataCapture(android.media.audiofx.Visualizer, byte[], int); + method public abstract void onWaveFormDataCapture(android.media.audiofx.Visualizer, byte[], int); + } + +} + +package android.media.effect { + + public abstract class Effect { + ctor public Effect(); + method public abstract void apply(int, int, int, int); + method public abstract java.lang.String getName(); + method public abstract void release(); + method public abstract void setParameter(java.lang.String, java.lang.Object); + method public void setUpdateListener(android.media.effect.EffectUpdateListener); + } + + public class EffectContext { + method public static android.media.effect.EffectContext createWithCurrentGlContext(); + method public android.media.effect.EffectFactory getFactory(); + method public void release(); + } + + public class EffectFactory { + method public android.media.effect.Effect createEffect(java.lang.String); + method public static boolean isEffectSupported(java.lang.String); + field public static final java.lang.String EFFECT_AUTOFIX = "android.media.effect.effects.AutoFixEffect"; + field public static final java.lang.String EFFECT_BACKDROPPER = "android.media.effect.effects.BackDropperEffect"; + field public static final java.lang.String EFFECT_BITMAPOVERLAY = "android.media.effect.effects.BitmapOverlayEffect"; + field public static final java.lang.String EFFECT_BLACKWHITE = "android.media.effect.effects.BlackWhiteEffect"; + field public static final java.lang.String EFFECT_BRIGHTNESS = "android.media.effect.effects.BrightnessEffect"; + field public static final java.lang.String EFFECT_CONTRAST = "android.media.effect.effects.ContrastEffect"; + field public static final java.lang.String EFFECT_CROP = "android.media.effect.effects.CropEffect"; + field public static final java.lang.String EFFECT_CROSSPROCESS = "android.media.effect.effects.CrossProcessEffect"; + field public static final java.lang.String EFFECT_DOCUMENTARY = "android.media.effect.effects.DocumentaryEffect"; + field public static final java.lang.String EFFECT_DUOTONE = "android.media.effect.effects.DuotoneEffect"; + field public static final java.lang.String EFFECT_FILLLIGHT = "android.media.effect.effects.FillLightEffect"; + field public static final java.lang.String EFFECT_FISHEYE = "android.media.effect.effects.FisheyeEffect"; + field public static final java.lang.String EFFECT_FLIP = "android.media.effect.effects.FlipEffect"; + field public static final java.lang.String EFFECT_GRAIN = "android.media.effect.effects.GrainEffect"; + field public static final java.lang.String EFFECT_GRAYSCALE = "android.media.effect.effects.GrayscaleEffect"; + field public static final java.lang.String EFFECT_LOMOISH = "android.media.effect.effects.LomoishEffect"; + field public static final java.lang.String EFFECT_NEGATIVE = "android.media.effect.effects.NegativeEffect"; + field public static final java.lang.String EFFECT_POSTERIZE = "android.media.effect.effects.PosterizeEffect"; + field public static final java.lang.String EFFECT_REDEYE = "android.media.effect.effects.RedEyeEffect"; + field public static final java.lang.String EFFECT_ROTATE = "android.media.effect.effects.RotateEffect"; + field public static final java.lang.String EFFECT_SATURATE = "android.media.effect.effects.SaturateEffect"; + field public static final java.lang.String EFFECT_SEPIA = "android.media.effect.effects.SepiaEffect"; + field public static final java.lang.String EFFECT_SHARPEN = "android.media.effect.effects.SharpenEffect"; + field public static final java.lang.String EFFECT_STRAIGHTEN = "android.media.effect.effects.StraightenEffect"; + field public static final java.lang.String EFFECT_TEMPERATURE = "android.media.effect.effects.ColorTemperatureEffect"; + field public static final java.lang.String EFFECT_TINT = "android.media.effect.effects.TintEffect"; + field public static final java.lang.String EFFECT_VIGNETTE = "android.media.effect.effects.VignetteEffect"; + } + + public abstract interface EffectUpdateListener { + method public abstract void onEffectUpdated(android.media.effect.Effect, java.lang.Object); + } + +} + +package android.mtp { + + public final class MtpConstants { + ctor public MtpConstants(); + method public static boolean isAbstractObject(int); + field public static final int ASSOCIATION_TYPE_GENERIC_FOLDER = 1; // 0x1 + field public static final int FORMAT_3GP_CONTAINER = 47492; // 0xb984 + field public static final int FORMAT_AAC = 47363; // 0xb903 + field public static final int FORMAT_ABSTRACT_AUDIO_ALBUM = 47619; // 0xba03 + field public static final int FORMAT_ABSTRACT_AUDIO_PLAYLIST = 47625; // 0xba09 + field public static final int FORMAT_ABSTRACT_AV_PLAYLIST = 47621; // 0xba05 + field public static final int FORMAT_ABSTRACT_DOCUMENT = 47745; // 0xba81 + field public static final int FORMAT_ABSTRACT_IMAGE_ALBUM = 47618; // 0xba02 + field public static final int FORMAT_ABSTRACT_MEDIACAST = 47627; // 0xba0b + field public static final int FORMAT_ABSTRACT_MULTIMEDIA_ALBUM = 47617; // 0xba01 + field public static final int FORMAT_ABSTRACT_VIDEO_ALBUM = 47620; // 0xba04 + field public static final int FORMAT_ABSTRACT_VIDEO_PLAYLIST = 47626; // 0xba0a + field public static final int FORMAT_AIFF = 12295; // 0x3007 + field public static final int FORMAT_ASF = 12300; // 0x300c + field public static final int FORMAT_ASSOCIATION = 12289; // 0x3001 + field public static final int FORMAT_ASX_PLAYLIST = 47635; // 0xba13 + field public static final int FORMAT_AUDIBLE = 47364; // 0xb904 + field public static final int FORMAT_AVI = 12298; // 0x300a + field public static final int FORMAT_BMP = 14340; // 0x3804 + field public static final int FORMAT_DPOF = 12294; // 0x3006 + field public static final int FORMAT_EXECUTABLE = 12291; // 0x3003 + field public static final int FORMAT_EXIF_JPEG = 14337; // 0x3801 + field public static final int FORMAT_FLAC = 47366; // 0xb906 + field public static final int FORMAT_GIF = 14343; // 0x3807 + field public static final int FORMAT_HTML = 12293; // 0x3005 + field public static final int FORMAT_JFIF = 14344; // 0x3808 + field public static final int FORMAT_JP2 = 14351; // 0x380f + field public static final int FORMAT_JPX = 14352; // 0x3810 + field public static final int FORMAT_M3U_PLAYLIST = 47633; // 0xba11 + field public static final int FORMAT_MP2 = 47491; // 0xb983 + field public static final int FORMAT_MP3 = 12297; // 0x3009 + field public static final int FORMAT_MP4_CONTAINER = 47490; // 0xb982 + field public static final int FORMAT_MPEG = 12299; // 0x300b + field public static final int FORMAT_MPL_PLAYLIST = 47634; // 0xba12 + field public static final int FORMAT_MS_EXCEL_SPREADSHEET = 47749; // 0xba85 + field public static final int FORMAT_MS_POWERPOINT_PRESENTATION = 47750; // 0xba86 + field public static final int FORMAT_MS_WORD_DOCUMENT = 47747; // 0xba83 + field public static final int FORMAT_OGG = 47362; // 0xb902 + field public static final int FORMAT_PICT = 14346; // 0x380a + field public static final int FORMAT_PLS_PLAYLIST = 47636; // 0xba14 + field public static final int FORMAT_PNG = 14347; // 0x380b + field public static final int FORMAT_SCRIPT = 12290; // 0x3002 + field public static final int FORMAT_TEXT = 12292; // 0x3004 + field public static final int FORMAT_TIFF = 14349; // 0x380d + field public static final int FORMAT_TIFF_EP = 14338; // 0x3802 + field public static final int FORMAT_UNDEFINED = 12288; // 0x3000 + field public static final int FORMAT_UNDEFINED_AUDIO = 47360; // 0xb900 + field public static final int FORMAT_UNDEFINED_COLLECTION = 47616; // 0xba00 + field public static final int FORMAT_UNDEFINED_DOCUMENT = 47744; // 0xba80 + field public static final int FORMAT_UNDEFINED_FIRMWARE = 47106; // 0xb802 + field public static final int FORMAT_UNDEFINED_VIDEO = 47488; // 0xb980 + field public static final int FORMAT_WAV = 12296; // 0x3008 + field public static final int FORMAT_WINDOWS_IMAGE_FORMAT = 47233; // 0xb881 + field public static final int FORMAT_WMA = 47361; // 0xb901 + field public static final int FORMAT_WMV = 47489; // 0xb981 + field public static final int FORMAT_WPL_PLAYLIST = 47632; // 0xba10 + field public static final int FORMAT_XML_DOCUMENT = 47746; // 0xba82 + field public static final int PROTECTION_STATUS_NONE = 0; // 0x0 + field public static final int PROTECTION_STATUS_NON_TRANSFERABLE_DATA = 32771; // 0x8003 + field public static final int PROTECTION_STATUS_READ_ONLY = 32769; // 0x8001 + field public static final int PROTECTION_STATUS_READ_ONLY_DATA = 32770; // 0x8002 + } + + public final class MtpDevice { + ctor public MtpDevice(android.hardware.usb.UsbDevice); + method public void close(); + method public boolean deleteObject(int); + method public int getDeviceId(); + method public android.mtp.MtpDeviceInfo getDeviceInfo(); + method public java.lang.String getDeviceName(); + method public byte[] getObject(int, int); + method public int[] getObjectHandles(int, int, int); + method public android.mtp.MtpObjectInfo getObjectInfo(int); + method public long getParent(int); + method public long getStorageId(int); + method public int[] getStorageIds(); + method public android.mtp.MtpStorageInfo getStorageInfo(int); + method public byte[] getThumbnail(int); + method public boolean importFile(int, java.lang.String); + method public boolean open(android.hardware.usb.UsbDeviceConnection); + } + + public class MtpDeviceInfo { + method public final java.lang.String getManufacturer(); + method public final java.lang.String getModel(); + method public final java.lang.String getSerialNumber(); + method public final java.lang.String getVersion(); + } + + public final class MtpObjectInfo { + method public final int getAssociationDesc(); + method public final int getAssociationType(); + method public final int getCompressedSize(); + method public final long getDateCreated(); + method public final long getDateModified(); + method public final int getFormat(); + method public final int getImagePixDepth(); + method public final int getImagePixHeight(); + method public final int getImagePixWidth(); + method public final java.lang.String getKeywords(); + method public final java.lang.String getName(); + method public final int getObjectHandle(); + method public final int getParent(); + method public final int getProtectionStatus(); + method public final int getSequenceNumber(); + method public final int getStorageId(); + method public final int getThumbCompressedSize(); + method public final int getThumbFormat(); + method public final int getThumbPixHeight(); + method public final int getThumbPixWidth(); + } + + public final class MtpStorageInfo { + method public final java.lang.String getDescription(); + method public final long getFreeSpace(); + method public final long getMaxCapacity(); + method public final int getStorageId(); + method public final java.lang.String getVolumeIdentifier(); + } + +} + +package android.net { + + public class ConnectivityManager { + method public android.net.NetworkInfo getActiveNetworkInfo(); + method public android.net.NetworkInfo[] getAllNetworkInfo(); + method public deprecated boolean getBackgroundDataSetting(); + method public android.net.NetworkInfo getNetworkInfo(int); + method public int getNetworkPreference(); + method public boolean isActiveNetworkMetered(); + method public static boolean isNetworkTypeValid(int); + method public boolean requestRouteToHost(int, int); + method public void setNetworkPreference(int); + method public int startUsingNetworkFeature(int, java.lang.String); + method public int stopUsingNetworkFeature(int, java.lang.String); + field public static final deprecated java.lang.String ACTION_BACKGROUND_DATA_SETTING_CHANGED = "android.net.conn.BACKGROUND_DATA_SETTING_CHANGED"; + field public static final java.lang.String CONNECTIVITY_ACTION = "android.net.conn.CONNECTIVITY_CHANGE"; + field public static final int DEFAULT_NETWORK_PREFERENCE = 1; // 0x1 + field public static final java.lang.String EXTRA_EXTRA_INFO = "extraInfo"; + field public static final java.lang.String EXTRA_IS_FAILOVER = "isFailover"; + field public static final deprecated java.lang.String EXTRA_NETWORK_INFO = "networkInfo"; + field public static final java.lang.String EXTRA_NETWORK_TYPE = "networkType"; + field public static final java.lang.String EXTRA_NO_CONNECTIVITY = "noConnectivity"; + field public static final java.lang.String EXTRA_OTHER_NETWORK_INFO = "otherNetwork"; + field public static final java.lang.String EXTRA_REASON = "reason"; + field public static final int TYPE_BLUETOOTH = 7; // 0x7 + field public static final int TYPE_DUMMY = 8; // 0x8 + field public static final int TYPE_ETHERNET = 9; // 0x9 + field public static final int TYPE_MOBILE = 0; // 0x0 + field public static final int TYPE_MOBILE_DUN = 4; // 0x4 + field public static final int TYPE_MOBILE_HIPRI = 5; // 0x5 + field public static final int TYPE_MOBILE_MMS = 2; // 0x2 + field public static final int TYPE_MOBILE_SUPL = 3; // 0x3 + field public static final int TYPE_WIFI = 1; // 0x1 + field public static final int TYPE_WIMAX = 6; // 0x6 + } + + public class Credentials { + ctor public Credentials(int, int, int); + method public int getGid(); + method public int getPid(); + method public int getUid(); + } + + public class DhcpInfo implements android.os.Parcelable { + ctor public DhcpInfo(); + method public int describeContents(); + method public void writeToParcel(android.os.Parcel, int); + field public int dns1; + field public int dns2; + field public int gateway; + field public int ipAddress; + field public int leaseDuration; + field public int netmask; + field public int serverAddress; + } + + public class LocalServerSocket { + ctor public LocalServerSocket(java.lang.String) throws java.io.IOException; + ctor public LocalServerSocket(java.io.FileDescriptor) throws java.io.IOException; + method public android.net.LocalSocket accept() throws java.io.IOException; + method public void close() throws java.io.IOException; + method public java.io.FileDescriptor getFileDescriptor(); + method public android.net.LocalSocketAddress getLocalSocketAddress(); + } + + public class LocalSocket implements java.io.Closeable { + ctor public LocalSocket(); + method public void bind(android.net.LocalSocketAddress) throws java.io.IOException; + method public void close() throws java.io.IOException; + method public void connect(android.net.LocalSocketAddress) throws java.io.IOException; + method public void connect(android.net.LocalSocketAddress, int) throws java.io.IOException; + method public java.io.FileDescriptor[] getAncillaryFileDescriptors() throws java.io.IOException; + method public java.io.FileDescriptor getFileDescriptor(); + method public java.io.InputStream getInputStream() throws java.io.IOException; + method public android.net.LocalSocketAddress getLocalSocketAddress(); + method public java.io.OutputStream getOutputStream() throws java.io.IOException; + method public android.net.Credentials getPeerCredentials() throws java.io.IOException; + method public int getReceiveBufferSize() throws java.io.IOException; + method public android.net.LocalSocketAddress getRemoteSocketAddress(); + method public int getSendBufferSize() throws java.io.IOException; + method public int getSoTimeout() throws java.io.IOException; + method public synchronized boolean isBound(); + method public boolean isClosed(); + method public synchronized boolean isConnected(); + method public boolean isInputShutdown(); + method public boolean isOutputShutdown(); + method public void setFileDescriptorsForSend(java.io.FileDescriptor[]); + method public void setReceiveBufferSize(int) throws java.io.IOException; + method public void setSendBufferSize(int) throws java.io.IOException; + method public void setSoTimeout(int) throws java.io.IOException; + method public void shutdownInput() throws java.io.IOException; + method public void shutdownOutput() throws java.io.IOException; + } + + public class LocalSocketAddress { + ctor public LocalSocketAddress(java.lang.String, android.net.LocalSocketAddress.Namespace); + ctor public LocalSocketAddress(java.lang.String); + method public java.lang.String getName(); + method public android.net.LocalSocketAddress.Namespace getNamespace(); + } + + public static final class LocalSocketAddress.Namespace extends java.lang.Enum { + method public static android.net.LocalSocketAddress.Namespace valueOf(java.lang.String); + method public static final android.net.LocalSocketAddress.Namespace[] values(); + enum_constant public static final android.net.LocalSocketAddress.Namespace ABSTRACT; + enum_constant public static final android.net.LocalSocketAddress.Namespace FILESYSTEM; + enum_constant public static final android.net.LocalSocketAddress.Namespace RESERVED; + } + + public class MailTo { + method public java.lang.String getBody(); + method public java.lang.String getCc(); + method public java.util.Map getHeaders(); + method public java.lang.String getSubject(); + method public java.lang.String getTo(); + method public static boolean isMailTo(java.lang.String); + method public static android.net.MailTo parse(java.lang.String) throws android.net.ParseException; + field public static final java.lang.String MAILTO_SCHEME = "mailto:"; + } + + public class NetworkInfo implements android.os.Parcelable { + method public int describeContents(); + method public android.net.NetworkInfo.DetailedState getDetailedState(); + method public java.lang.String getExtraInfo(); + method public java.lang.String getReason(); + method public android.net.NetworkInfo.State getState(); + method public int getSubtype(); + method public java.lang.String getSubtypeName(); + method public int getType(); + method public java.lang.String getTypeName(); + method public boolean isAvailable(); + method public boolean isConnected(); + method public boolean isConnectedOrConnecting(); + method public boolean isFailover(); + method public boolean isRoaming(); + method public void writeToParcel(android.os.Parcel, int); + } + + public static final class NetworkInfo.DetailedState extends java.lang.Enum { + method public static android.net.NetworkInfo.DetailedState valueOf(java.lang.String); + method public static final android.net.NetworkInfo.DetailedState[] values(); + enum_constant public static final android.net.NetworkInfo.DetailedState AUTHENTICATING; + enum_constant public static final android.net.NetworkInfo.DetailedState BLOCKED; + enum_constant public static final android.net.NetworkInfo.DetailedState CAPTIVE_PORTAL_CHECK; + enum_constant public static final android.net.NetworkInfo.DetailedState CONNECTED; + enum_constant public static final android.net.NetworkInfo.DetailedState CONNECTING; + enum_constant public static final android.net.NetworkInfo.DetailedState DISCONNECTED; + enum_constant public static final android.net.NetworkInfo.DetailedState DISCONNECTING; + enum_constant public static final android.net.NetworkInfo.DetailedState FAILED; + enum_constant public static final android.net.NetworkInfo.DetailedState IDLE; + enum_constant public static final android.net.NetworkInfo.DetailedState OBTAINING_IPADDR; + enum_constant public static final android.net.NetworkInfo.DetailedState SCANNING; + enum_constant public static final android.net.NetworkInfo.DetailedState SUSPENDED; + enum_constant public static final android.net.NetworkInfo.DetailedState VERIFYING_POOR_LINK; + } + + public static final class NetworkInfo.State extends java.lang.Enum { + method public static android.net.NetworkInfo.State valueOf(java.lang.String); + method public static final android.net.NetworkInfo.State[] values(); + enum_constant public static final android.net.NetworkInfo.State CONNECTED; + enum_constant public static final android.net.NetworkInfo.State CONNECTING; + enum_constant public static final android.net.NetworkInfo.State DISCONNECTED; + enum_constant public static final android.net.NetworkInfo.State DISCONNECTING; + enum_constant public static final android.net.NetworkInfo.State SUSPENDED; + enum_constant public static final android.net.NetworkInfo.State UNKNOWN; + } + + public class ParseException extends java.lang.RuntimeException { + field public java.lang.String response; + } + + public final class Proxy { + ctor public Proxy(); + method public static final deprecated java.lang.String getDefaultHost(); + method public static final deprecated int getDefaultPort(); + method public static final deprecated java.lang.String getHost(android.content.Context); + method public static final deprecated int getPort(android.content.Context); + field public static final java.lang.String PROXY_CHANGE_ACTION = "android.intent.action.PROXY_CHANGE"; + } + + public class SSLCertificateSocketFactory extends javax.net.ssl.SSLSocketFactory { + ctor public deprecated SSLCertificateSocketFactory(int); + method public java.net.Socket createSocket(java.net.Socket, java.lang.String, int, boolean) throws java.io.IOException; + method public java.net.Socket createSocket(java.net.InetAddress, int, java.net.InetAddress, int) throws java.io.IOException; + method public java.net.Socket createSocket(java.net.InetAddress, int) throws java.io.IOException; + method public java.net.Socket createSocket(java.lang.String, int, java.net.InetAddress, int) throws java.io.IOException; + method public java.net.Socket createSocket(java.lang.String, int) throws java.io.IOException; + method public static javax.net.SocketFactory getDefault(int); + method public static javax.net.ssl.SSLSocketFactory getDefault(int, android.net.SSLSessionCache); + method public java.lang.String[] getDefaultCipherSuites(); + method public static org.apache.http.conn.ssl.SSLSocketFactory getHttpSocketFactory(int, android.net.SSLSessionCache); + method public static javax.net.ssl.SSLSocketFactory getInsecure(int, android.net.SSLSessionCache); + method public byte[] getNpnSelectedProtocol(java.net.Socket); + method public java.lang.String[] getSupportedCipherSuites(); + method public void setHostname(java.net.Socket, java.lang.String); + method public void setKeyManagers(javax.net.ssl.KeyManager[]); + method public void setNpnProtocols(byte[][]); + method public void setTrustManagers(javax.net.ssl.TrustManager[]); + method public void setUseSessionTickets(java.net.Socket, boolean); + } + + public final class SSLSessionCache { + ctor public SSLSessionCache(java.io.File) throws java.io.IOException; + ctor public SSLSessionCache(android.content.Context); + } + + public class TrafficStats { + ctor public TrafficStats(); + method public static void clearThreadStatsTag(); + method public static long getMobileRxBytes(); + method public static long getMobileRxPackets(); + method public static long getMobileTxBytes(); + method public static long getMobileTxPackets(); + method public static int getThreadStatsTag(); + method public static long getTotalRxBytes(); + method public static long getTotalRxPackets(); + method public static long getTotalTxBytes(); + method public static long getTotalTxPackets(); + method public static long getUidRxBytes(int); + method public static long getUidRxPackets(int); + method public static long getUidTcpRxBytes(int); + method public static long getUidTcpRxSegments(int); + method public static long getUidTcpTxBytes(int); + method public static long getUidTcpTxSegments(int); + method public static long getUidTxBytes(int); + method public static long getUidTxPackets(int); + method public static long getUidUdpRxBytes(int); + method public static long getUidUdpRxPackets(int); + method public static long getUidUdpTxBytes(int); + method public static long getUidUdpTxPackets(int); + method public static void incrementOperationCount(int); + method public static void incrementOperationCount(int, int); + method public static void setThreadStatsTag(int); + method public static void tagSocket(java.net.Socket) throws java.net.SocketException; + method public static void untagSocket(java.net.Socket) throws java.net.SocketException; + field public static final int UNSUPPORTED = -1; // 0xffffffff + } + + public abstract class Uri implements java.lang.Comparable android.os.Parcelable { + method public abstract android.net.Uri.Builder buildUpon(); + method public int compareTo(android.net.Uri); + method public static java.lang.String decode(java.lang.String); + method public static java.lang.String encode(java.lang.String); + method public static java.lang.String encode(java.lang.String, java.lang.String); + method public static android.net.Uri fromFile(java.io.File); + method public static android.net.Uri fromParts(java.lang.String, java.lang.String, java.lang.String); + method public abstract java.lang.String getAuthority(); + method public boolean getBooleanQueryParameter(java.lang.String, boolean); + method public abstract java.lang.String getEncodedAuthority(); + method public abstract java.lang.String getEncodedFragment(); + method public abstract java.lang.String getEncodedPath(); + method public abstract java.lang.String getEncodedQuery(); + method public abstract java.lang.String getEncodedSchemeSpecificPart(); + method public abstract java.lang.String getEncodedUserInfo(); + method public abstract java.lang.String getFragment(); + method public abstract java.lang.String getHost(); + method public abstract java.lang.String getLastPathSegment(); + method public abstract java.lang.String getPath(); + method public abstract java.util.List getPathSegments(); + method public abstract int getPort(); + method public abstract java.lang.String getQuery(); + method public java.lang.String getQueryParameter(java.lang.String); + method public java.util.Set getQueryParameterNames(); + method public java.util.List getQueryParameters(java.lang.String); + method public abstract java.lang.String getScheme(); + method public abstract java.lang.String getSchemeSpecificPart(); + method public abstract java.lang.String getUserInfo(); + method public boolean isAbsolute(); + method public abstract boolean isHierarchical(); + method public boolean isOpaque(); + method public abstract boolean isRelative(); + method public android.net.Uri normalizeScheme(); + method public static android.net.Uri parse(java.lang.String); + method public abstract java.lang.String toString(); + method public static android.net.Uri withAppendedPath(android.net.Uri, java.lang.String); + method public static void writeToParcel(android.os.Parcel, android.net.Uri); + field public static final android.os.Parcelable.Creator CREATOR; + field public static final android.net.Uri EMPTY; + } + + public static final class Uri.Builder { + ctor public Uri.Builder(); + method public android.net.Uri.Builder appendEncodedPath(java.lang.String); + method public android.net.Uri.Builder appendPath(java.lang.String); + method public android.net.Uri.Builder appendQueryParameter(java.lang.String, java.lang.String); + method public android.net.Uri.Builder authority(java.lang.String); + method public android.net.Uri build(); + method public android.net.Uri.Builder clearQuery(); + method public android.net.Uri.Builder encodedAuthority(java.lang.String); + method public android.net.Uri.Builder encodedFragment(java.lang.String); + method public android.net.Uri.Builder encodedOpaquePart(java.lang.String); + method public android.net.Uri.Builder encodedPath(java.lang.String); + method public android.net.Uri.Builder encodedQuery(java.lang.String); + method public android.net.Uri.Builder fragment(java.lang.String); + method public android.net.Uri.Builder opaquePart(java.lang.String); + method public android.net.Uri.Builder path(java.lang.String); + method public android.net.Uri.Builder query(java.lang.String); + method public android.net.Uri.Builder scheme(java.lang.String); + } + + public class UrlQuerySanitizer { + ctor public UrlQuerySanitizer(); + ctor public UrlQuerySanitizer(java.lang.String); + method protected void addSanitizedEntry(java.lang.String, java.lang.String); + method protected void clear(); + method protected int decodeHexDigit(char); + method public static final android.net.UrlQuerySanitizer.ValueSanitizer getAllButNulAndAngleBracketsLegal(); + method public static final android.net.UrlQuerySanitizer.ValueSanitizer getAllButNulLegal(); + method public static final android.net.UrlQuerySanitizer.ValueSanitizer getAllButWhitespaceLegal(); + method public static final android.net.UrlQuerySanitizer.ValueSanitizer getAllIllegal(); + method public boolean getAllowUnregisteredParamaters(); + method public static final android.net.UrlQuerySanitizer.ValueSanitizer getAmpAndSpaceLegal(); + method public static final android.net.UrlQuerySanitizer.ValueSanitizer getAmpLegal(); + method public android.net.UrlQuerySanitizer.ValueSanitizer getEffectiveValueSanitizer(java.lang.String); + method public java.util.List getParameterList(); + method public java.util.Set getParameterSet(); + method public boolean getPreferFirstRepeatedParameter(); + method public static final android.net.UrlQuerySanitizer.ValueSanitizer getSpaceLegal(); + method public android.net.UrlQuerySanitizer.ValueSanitizer getUnregisteredParameterValueSanitizer(); + method public static final android.net.UrlQuerySanitizer.ValueSanitizer getUrlAndSpaceLegal(); + method public static final android.net.UrlQuerySanitizer.ValueSanitizer getUrlLegal(); + method public java.lang.String getValue(java.lang.String); + method public android.net.UrlQuerySanitizer.ValueSanitizer getValueSanitizer(java.lang.String); + method public boolean hasParameter(java.lang.String); + method protected boolean isHexDigit(char); + method protected void parseEntry(java.lang.String, java.lang.String); + method public void parseQuery(java.lang.String); + method public void parseUrl(java.lang.String); + method public void registerParameter(java.lang.String, android.net.UrlQuerySanitizer.ValueSanitizer); + method public void registerParameters(java.lang.String[], android.net.UrlQuerySanitizer.ValueSanitizer); + method public void setAllowUnregisteredParamaters(boolean); + method public void setPreferFirstRepeatedParameter(boolean); + method public void setUnregisteredParameterValueSanitizer(android.net.UrlQuerySanitizer.ValueSanitizer); + method public java.lang.String unescape(java.lang.String); + } + + public static class UrlQuerySanitizer.IllegalCharacterValueSanitizer implements android.net.UrlQuerySanitizer.ValueSanitizer { + ctor public UrlQuerySanitizer.IllegalCharacterValueSanitizer(int); + method public java.lang.String sanitize(java.lang.String); + field public static final int ALL_BUT_NUL_AND_ANGLE_BRACKETS_LEGAL = 1439; // 0x59f + field public static final int ALL_BUT_NUL_LEGAL = 1535; // 0x5ff + field public static final int ALL_BUT_WHITESPACE_LEGAL = 1532; // 0x5fc + field public static final int ALL_ILLEGAL = 0; // 0x0 + field public static final int ALL_OK = 2047; // 0x7ff + field public static final int ALL_WHITESPACE_OK = 3; // 0x3 + field public static final int AMP_AND_SPACE_LEGAL = 129; // 0x81 + field public static final int AMP_LEGAL = 128; // 0x80 + field public static final int AMP_OK = 128; // 0x80 + field public static final int DQUOTE_OK = 8; // 0x8 + field public static final int GT_OK = 64; // 0x40 + field public static final int LT_OK = 32; // 0x20 + field public static final int NON_7_BIT_ASCII_OK = 4; // 0x4 + field public static final int NUL_OK = 512; // 0x200 + field public static final int OTHER_WHITESPACE_OK = 2; // 0x2 + field public static final int PCT_OK = 256; // 0x100 + field public static final int SCRIPT_URL_OK = 1024; // 0x400 + field public static final int SPACE_LEGAL = 1; // 0x1 + field public static final int SPACE_OK = 1; // 0x1 + field public static final int SQUOTE_OK = 16; // 0x10 + field public static final int URL_AND_SPACE_LEGAL = 405; // 0x195 + field public static final int URL_LEGAL = 404; // 0x194 + } + + public class UrlQuerySanitizer.ParameterValuePair { + ctor public UrlQuerySanitizer.ParameterValuePair(java.lang.String, java.lang.String); + field public java.lang.String mParameter; + field public java.lang.String mValue; + } + + public static abstract interface UrlQuerySanitizer.ValueSanitizer { + method public abstract java.lang.String sanitize(java.lang.String); + } + + public class VpnService extends android.app.Service { + ctor public VpnService(); + method public android.os.IBinder onBind(android.content.Intent); + method public void onRevoke(); + method public static android.content.Intent prepare(android.content.Context); + method public boolean protect(int); + method public boolean protect(java.net.Socket); + method public boolean protect(java.net.DatagramSocket); + field public static final java.lang.String SERVICE_INTERFACE = "android.net.VpnService"; + } + + public class VpnService.Builder { + ctor public VpnService.Builder(); + method public android.net.VpnService.Builder addAddress(java.net.InetAddress, int); + method public android.net.VpnService.Builder addAddress(java.lang.String, int); + method public android.net.VpnService.Builder addDnsServer(java.net.InetAddress); + method public android.net.VpnService.Builder addDnsServer(java.lang.String); + method public android.net.VpnService.Builder addRoute(java.net.InetAddress, int); + method public android.net.VpnService.Builder addRoute(java.lang.String, int); + method public android.net.VpnService.Builder addSearchDomain(java.lang.String); + method public android.os.ParcelFileDescriptor establish(); + method public android.net.VpnService.Builder setConfigureIntent(android.app.PendingIntent); + method public android.net.VpnService.Builder setMtu(int); + method public android.net.VpnService.Builder setSession(java.lang.String); + } + +} + +package android.net.http { + + public final class AndroidHttpClient implements org.apache.http.client.HttpClient { + method public void close(); + method public void disableCurlLogging(); + method public void enableCurlLogging(java.lang.String, int); + method public org.apache.http.HttpResponse execute(org.apache.http.client.methods.HttpUriRequest) throws java.io.IOException; + method public org.apache.http.HttpResponse execute(org.apache.http.client.methods.HttpUriRequest, org.apache.http.protocol.HttpContext) throws java.io.IOException; + method public org.apache.http.HttpResponse execute(org.apache.http.HttpHost, org.apache.http.HttpRequest) throws java.io.IOException; + method public org.apache.http.HttpResponse execute(org.apache.http.HttpHost, org.apache.http.HttpRequest, org.apache.http.protocol.HttpContext) throws java.io.IOException; + method public T execute(org.apache.http.client.methods.HttpUriRequest, org.apache.http.client.ResponseHandler) throws org.apache.http.client.ClientProtocolException, java.io.IOException; + method public T execute(org.apache.http.client.methods.HttpUriRequest, org.apache.http.client.ResponseHandler, org.apache.http.protocol.HttpContext) throws org.apache.http.client.ClientProtocolException, java.io.IOException; + method public T execute(org.apache.http.HttpHost, org.apache.http.HttpRequest, org.apache.http.client.ResponseHandler) throws org.apache.http.client.ClientProtocolException, java.io.IOException; + method public T execute(org.apache.http.HttpHost, org.apache.http.HttpRequest, org.apache.http.client.ResponseHandler, org.apache.http.protocol.HttpContext) throws org.apache.http.client.ClientProtocolException, java.io.IOException; + method public static org.apache.http.entity.AbstractHttpEntity getCompressedEntity(byte[], android.content.ContentResolver) throws java.io.IOException; + method public org.apache.http.conn.ClientConnectionManager getConnectionManager(); + method public static long getMinGzipSize(android.content.ContentResolver); + method public org.apache.http.params.HttpParams getParams(); + method public static java.io.InputStream getUngzippedContent(org.apache.http.HttpEntity) throws java.io.IOException; + method public static void modifyRequestToAcceptGzipResponse(org.apache.http.HttpRequest); + method public static android.net.http.AndroidHttpClient newInstance(java.lang.String, android.content.Context); + method public static android.net.http.AndroidHttpClient newInstance(java.lang.String); + method public static long parseDate(java.lang.String); + field public static long DEFAULT_SYNC_MIN_GZIP_BYTES; + } + + public final class HttpResponseCache extends java.net.ResponseCache implements java.io.Closeable { + method public void close() throws java.io.IOException; + method public void delete() throws java.io.IOException; + method public void flush(); + method public java.net.CacheResponse get(java.net.URI, java.lang.String, java.util.Map>) throws java.io.IOException; + method public int getHitCount(); + method public static android.net.http.HttpResponseCache getInstalled(); + method public int getNetworkCount(); + method public int getRequestCount(); + method public static android.net.http.HttpResponseCache install(java.io.File, long) throws java.io.IOException; + method public long maxSize(); + method public java.net.CacheRequest put(java.net.URI, java.net.URLConnection) throws java.io.IOException; + method public long size(); + } + + public class SslCertificate { + ctor public deprecated SslCertificate(java.lang.String, java.lang.String, java.lang.String, java.lang.String); + ctor public deprecated SslCertificate(java.lang.String, java.lang.String, java.util.Date, java.util.Date); + ctor public SslCertificate(java.security.cert.X509Certificate); + method public android.net.http.SslCertificate.DName getIssuedBy(); + method public android.net.http.SslCertificate.DName getIssuedTo(); + method public deprecated java.lang.String getValidNotAfter(); + method public java.util.Date getValidNotAfterDate(); + method public deprecated java.lang.String getValidNotBefore(); + method public java.util.Date getValidNotBeforeDate(); + method public static android.net.http.SslCertificate restoreState(android.os.Bundle); + method public static android.os.Bundle saveState(android.net.http.SslCertificate); + } + + public class SslCertificate.DName { + ctor public SslCertificate.DName(java.lang.String); + method public java.lang.String getCName(); + method public java.lang.String getDName(); + method public java.lang.String getOName(); + method public java.lang.String getUName(); + } + + public class SslError { + ctor public deprecated SslError(int, android.net.http.SslCertificate); + ctor public deprecated SslError(int, java.security.cert.X509Certificate); + ctor public SslError(int, android.net.http.SslCertificate, java.lang.String); + ctor public SslError(int, java.security.cert.X509Certificate, java.lang.String); + method public boolean addError(int); + method public android.net.http.SslCertificate getCertificate(); + method public int getPrimaryError(); + method public java.lang.String getUrl(); + method public boolean hasError(int); + field public static final int SSL_DATE_INVALID = 4; // 0x4 + field public static final int SSL_EXPIRED = 1; // 0x1 + field public static final int SSL_IDMISMATCH = 2; // 0x2 + field public static final int SSL_INVALID = 5; // 0x5 + field public static final deprecated int SSL_MAX_ERROR = 6; // 0x6 + field public static final int SSL_NOTYETVALID = 0; // 0x0 + field public static final int SSL_UNTRUSTED = 3; // 0x3 + } + + public class X509TrustManagerExtensions { + ctor public X509TrustManagerExtensions(javax.net.ssl.X509TrustManager) throws java.lang.IllegalArgumentException; + method public java.util.List checkServerTrusted(java.security.cert.X509Certificate[], java.lang.String, java.lang.String) throws java.security.cert.CertificateException; + } + +} + +package android.net.nsd { + + public final class NsdManager { + method public void discoverServices(java.lang.String, int, android.net.nsd.NsdManager.DiscoveryListener); + method public void registerService(android.net.nsd.NsdServiceInfo, int, android.net.nsd.NsdManager.RegistrationListener); + method public void resolveService(android.net.nsd.NsdServiceInfo, android.net.nsd.NsdManager.ResolveListener); + method public void stopServiceDiscovery(android.net.nsd.NsdManager.DiscoveryListener); + method public void unregisterService(android.net.nsd.NsdManager.RegistrationListener); + field public static final java.lang.String ACTION_NSD_STATE_CHANGED = "android.net.nsd.STATE_CHANGED"; + field public static final java.lang.String EXTRA_NSD_STATE = "nsd_state"; + field public static final int FAILURE_ALREADY_ACTIVE = 3; // 0x3 + field public static final int FAILURE_INTERNAL_ERROR = 0; // 0x0 + field public static final int FAILURE_MAX_LIMIT = 4; // 0x4 + field public static final int NSD_STATE_DISABLED = 1; // 0x1 + field public static final int NSD_STATE_ENABLED = 2; // 0x2 + field public static final int PROTOCOL_DNS_SD = 1; // 0x1 + } + + public static abstract interface NsdManager.DiscoveryListener { + method public abstract void onDiscoveryStarted(java.lang.String); + method public abstract void onDiscoveryStopped(java.lang.String); + method public abstract void onServiceFound(android.net.nsd.NsdServiceInfo); + method public abstract void onServiceLost(android.net.nsd.NsdServiceInfo); + method public abstract void onStartDiscoveryFailed(java.lang.String, int); + method public abstract void onStopDiscoveryFailed(java.lang.String, int); + } + + public static abstract interface NsdManager.RegistrationListener { + method public abstract void onRegistrationFailed(android.net.nsd.NsdServiceInfo, int); + method public abstract void onServiceRegistered(android.net.nsd.NsdServiceInfo); + method public abstract void onServiceUnregistered(android.net.nsd.NsdServiceInfo); + method public abstract void onUnregistrationFailed(android.net.nsd.NsdServiceInfo, int); + } + + public static abstract interface NsdManager.ResolveListener { + method public abstract void onResolveFailed(android.net.nsd.NsdServiceInfo, int); + method public abstract void onServiceResolved(android.net.nsd.NsdServiceInfo); + } + + public final class NsdServiceInfo implements android.os.Parcelable { + ctor public NsdServiceInfo(); + method public int describeContents(); + method public java.net.InetAddress getHost(); + method public int getPort(); + method public java.lang.String getServiceName(); + method public java.lang.String getServiceType(); + method public void setHost(java.net.InetAddress); + method public void setPort(int); + method public void setServiceName(java.lang.String); + method public void setServiceType(java.lang.String); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + } + +} + +package android.net.rtp { + + public class AudioCodec { + method public static android.net.rtp.AudioCodec getCodec(int, java.lang.String, java.lang.String); + method public static android.net.rtp.AudioCodec[] getCodecs(); + field public static final android.net.rtp.AudioCodec AMR; + field public static final android.net.rtp.AudioCodec GSM; + field public static final android.net.rtp.AudioCodec GSM_EFR; + field public static final android.net.rtp.AudioCodec PCMA; + field public static final android.net.rtp.AudioCodec PCMU; + field public final java.lang.String fmtp; + field public final java.lang.String rtpmap; + field public final int type; + } + + public class AudioGroup { + ctor public AudioGroup(); + method public void clear(); + method public int getMode(); + method public android.net.rtp.AudioStream[] getStreams(); + method public void sendDtmf(int); + method public void setMode(int); + field public static final int MODE_ECHO_SUPPRESSION = 3; // 0x3 + field public static final int MODE_MUTED = 1; // 0x1 + field public static final int MODE_NORMAL = 2; // 0x2 + field public static final int MODE_ON_HOLD = 0; // 0x0 + } + + public class AudioStream extends android.net.rtp.RtpStream { + ctor public AudioStream(java.net.InetAddress) throws java.net.SocketException; + method public android.net.rtp.AudioCodec getCodec(); + method public int getDtmfType(); + method public android.net.rtp.AudioGroup getGroup(); + method public final boolean isBusy(); + method public void join(android.net.rtp.AudioGroup); + method public void setCodec(android.net.rtp.AudioCodec); + method public void setDtmfType(int); + } + + public class RtpStream { + method public void associate(java.net.InetAddress, int); + method public java.net.InetAddress getLocalAddress(); + method public int getLocalPort(); + method public int getMode(); + method public java.net.InetAddress getRemoteAddress(); + method public int getRemotePort(); + method public boolean isBusy(); + method public void release(); + method public void setMode(int); + field public static final int MODE_NORMAL = 0; // 0x0 + field public static final int MODE_RECEIVE_ONLY = 2; // 0x2 + field public static final int MODE_SEND_ONLY = 1; // 0x1 + } + +} + +package android.net.sip { + + public class SipAudioCall { + ctor public SipAudioCall(android.content.Context, android.net.sip.SipProfile); + method public void answerCall(int) throws android.net.sip.SipException; + method public void attachCall(android.net.sip.SipSession, java.lang.String) throws android.net.sip.SipException; + method public void close(); + method public void continueCall(int) throws android.net.sip.SipException; + method public void endCall() throws android.net.sip.SipException; + method public android.net.sip.SipProfile getLocalProfile(); + method public android.net.sip.SipProfile getPeerProfile(); + method public int getState(); + method public void holdCall(int) throws android.net.sip.SipException; + method public boolean isInCall(); + method public boolean isMuted(); + method public boolean isOnHold(); + method public void makeCall(android.net.sip.SipProfile, android.net.sip.SipSession, int) throws android.net.sip.SipException; + method public void sendDtmf(int); + method public void sendDtmf(int, android.os.Message); + method public void setListener(android.net.sip.SipAudioCall.Listener); + method public void setListener(android.net.sip.SipAudioCall.Listener, boolean); + method public void setSpeakerMode(boolean); + method public void startAudio(); + method public void toggleMute(); + } + + public static class SipAudioCall.Listener { + ctor public SipAudioCall.Listener(); + method public void onCallBusy(android.net.sip.SipAudioCall); + method public void onCallEnded(android.net.sip.SipAudioCall); + method public void onCallEstablished(android.net.sip.SipAudioCall); + method public void onCallHeld(android.net.sip.SipAudioCall); + method public void onCalling(android.net.sip.SipAudioCall); + method public void onChanged(android.net.sip.SipAudioCall); + method public void onError(android.net.sip.SipAudioCall, int, java.lang.String); + method public void onReadyToCall(android.net.sip.SipAudioCall); + method public void onRinging(android.net.sip.SipAudioCall, android.net.sip.SipProfile); + method public void onRingingBack(android.net.sip.SipAudioCall); + } + + public class SipErrorCode { + method public static java.lang.String toString(int); + field public static final int CLIENT_ERROR = -4; // 0xfffffffc + field public static final int CROSS_DOMAIN_AUTHENTICATION = -11; // 0xfffffff5 + field public static final int DATA_CONNECTION_LOST = -10; // 0xfffffff6 + field public static final int INVALID_CREDENTIALS = -8; // 0xfffffff8 + field public static final int INVALID_REMOTE_URI = -6; // 0xfffffffa + field public static final int IN_PROGRESS = -9; // 0xfffffff7 + field public static final int NO_ERROR = 0; // 0x0 + field public static final int PEER_NOT_REACHABLE = -7; // 0xfffffff9 + field public static final int SERVER_ERROR = -2; // 0xfffffffe + field public static final int SERVER_UNREACHABLE = -12; // 0xfffffff4 + field public static final int SOCKET_ERROR = -1; // 0xffffffff + field public static final int TIME_OUT = -5; // 0xfffffffb + field public static final int TRANSACTION_TERMINTED = -3; // 0xfffffffd + } + + public class SipException extends java.lang.Exception { + ctor public SipException(); + ctor public SipException(java.lang.String); + ctor public SipException(java.lang.String, java.lang.Throwable); + } + + public class SipManager { + method public void close(java.lang.String) throws android.net.sip.SipException; + method public android.net.sip.SipSession createSipSession(android.net.sip.SipProfile, android.net.sip.SipSession.Listener) throws android.net.sip.SipException; + method public static java.lang.String getCallId(android.content.Intent); + method public static java.lang.String getOfferSessionDescription(android.content.Intent); + method public android.net.sip.SipSession getSessionFor(android.content.Intent) throws android.net.sip.SipException; + method public static boolean isApiSupported(android.content.Context); + method public static boolean isIncomingCallIntent(android.content.Intent); + method public boolean isOpened(java.lang.String) throws android.net.sip.SipException; + method public boolean isRegistered(java.lang.String) throws android.net.sip.SipException; + method public static boolean isSipWifiOnly(android.content.Context); + method public static boolean isVoipSupported(android.content.Context); + method public android.net.sip.SipAudioCall makeAudioCall(android.net.sip.SipProfile, android.net.sip.SipProfile, android.net.sip.SipAudioCall.Listener, int) throws android.net.sip.SipException; + method public android.net.sip.SipAudioCall makeAudioCall(java.lang.String, java.lang.String, android.net.sip.SipAudioCall.Listener, int) throws android.net.sip.SipException; + method public static android.net.sip.SipManager newInstance(android.content.Context); + method public void open(android.net.sip.SipProfile) throws android.net.sip.SipException; + method public void open(android.net.sip.SipProfile, android.app.PendingIntent, android.net.sip.SipRegistrationListener) throws android.net.sip.SipException; + method public void register(android.net.sip.SipProfile, int, android.net.sip.SipRegistrationListener) throws android.net.sip.SipException; + method public void setRegistrationListener(java.lang.String, android.net.sip.SipRegistrationListener) throws android.net.sip.SipException; + method public android.net.sip.SipAudioCall takeAudioCall(android.content.Intent, android.net.sip.SipAudioCall.Listener) throws android.net.sip.SipException; + method public void unregister(android.net.sip.SipProfile, android.net.sip.SipRegistrationListener) throws android.net.sip.SipException; + field public static final java.lang.String EXTRA_CALL_ID = "android:sipCallID"; + field public static final java.lang.String EXTRA_OFFER_SD = "android:sipOfferSD"; + field public static final int INCOMING_CALL_RESULT_CODE = 101; // 0x65 + } + + public class SipProfile implements java.lang.Cloneable android.os.Parcelable java.io.Serializable { + method public int describeContents(); + method public java.lang.String getAuthUserName(); + method public boolean getAutoRegistration(); + method public java.lang.String getDisplayName(); + method public java.lang.String getPassword(); + method public int getPort(); + method public java.lang.String getProfileName(); + method public java.lang.String getProtocol(); + method public java.lang.String getProxyAddress(); + method public boolean getSendKeepAlive(); + method public java.lang.String getSipDomain(); + method public java.lang.String getUriString(); + method public java.lang.String getUserName(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + } + + public static class SipProfile.Builder { + ctor public SipProfile.Builder(android.net.sip.SipProfile); + ctor public SipProfile.Builder(java.lang.String) throws java.text.ParseException; + ctor public SipProfile.Builder(java.lang.String, java.lang.String) throws java.text.ParseException; + method public android.net.sip.SipProfile build(); + method public android.net.sip.SipProfile.Builder setAuthUserName(java.lang.String); + method public android.net.sip.SipProfile.Builder setAutoRegistration(boolean); + method public android.net.sip.SipProfile.Builder setDisplayName(java.lang.String); + method public android.net.sip.SipProfile.Builder setOutboundProxy(java.lang.String); + method public android.net.sip.SipProfile.Builder setPassword(java.lang.String); + method public android.net.sip.SipProfile.Builder setPort(int) throws java.lang.IllegalArgumentException; + method public android.net.sip.SipProfile.Builder setProfileName(java.lang.String); + method public android.net.sip.SipProfile.Builder setProtocol(java.lang.String) throws java.lang.IllegalArgumentException; + method public android.net.sip.SipProfile.Builder setSendKeepAlive(boolean); + } + + public abstract interface SipRegistrationListener { + method public abstract void onRegistering(java.lang.String); + method public abstract void onRegistrationDone(java.lang.String, long); + method public abstract void onRegistrationFailed(java.lang.String, int, java.lang.String); + } + + public final class SipSession { + method public void answerCall(java.lang.String, int); + method public void changeCall(java.lang.String, int); + method public void endCall(); + method public java.lang.String getCallId(); + method public java.lang.String getLocalIp(); + method public android.net.sip.SipProfile getLocalProfile(); + method public android.net.sip.SipProfile getPeerProfile(); + method public int getState(); + method public boolean isInCall(); + method public void makeCall(android.net.sip.SipProfile, java.lang.String, int); + method public void register(int); + method public void setListener(android.net.sip.SipSession.Listener); + method public void unregister(); + } + + public static class SipSession.Listener { + ctor public SipSession.Listener(); + method public void onCallBusy(android.net.sip.SipSession); + method public void onCallChangeFailed(android.net.sip.SipSession, int, java.lang.String); + method public void onCallEnded(android.net.sip.SipSession); + method public void onCallEstablished(android.net.sip.SipSession, java.lang.String); + method public void onCalling(android.net.sip.SipSession); + method public void onError(android.net.sip.SipSession, int, java.lang.String); + method public void onRegistering(android.net.sip.SipSession); + method public void onRegistrationDone(android.net.sip.SipSession, int); + method public void onRegistrationFailed(android.net.sip.SipSession, int, java.lang.String); + method public void onRegistrationTimeout(android.net.sip.SipSession); + method public void onRinging(android.net.sip.SipSession, android.net.sip.SipProfile, java.lang.String); + method public void onRingingBack(android.net.sip.SipSession); + } + + public static class SipSession.State { + method public static java.lang.String toString(int); + field public static final int DEREGISTERING = 2; // 0x2 + field public static final int INCOMING_CALL = 3; // 0x3 + field public static final int INCOMING_CALL_ANSWERING = 4; // 0x4 + field public static final int IN_CALL = 8; // 0x8 + field public static final int NOT_DEFINED = 101; // 0x65 + field public static final int OUTGOING_CALL = 5; // 0x5 + field public static final int OUTGOING_CALL_CANCELING = 7; // 0x7 + field public static final int OUTGOING_CALL_RING_BACK = 6; // 0x6 + field public static final int PINGING = 9; // 0x9 + field public static final int READY_TO_CALL = 0; // 0x0 + field public static final int REGISTERING = 1; // 0x1 + } + +} + +package android.net.wifi { + + public class ScanResult implements android.os.Parcelable { + method public int describeContents(); + method public void writeToParcel(android.os.Parcel, int); + field public java.lang.String BSSID; + field public java.lang.String SSID; + field public java.lang.String capabilities; + field public int frequency; + field public int level; + field public long timestamp; + } + + public final class SupplicantState extends java.lang.Enum implements android.os.Parcelable { + method public int describeContents(); + method public static boolean isValidState(android.net.wifi.SupplicantState); + method public static android.net.wifi.SupplicantState valueOf(java.lang.String); + method public static final android.net.wifi.SupplicantState[] values(); + method public void writeToParcel(android.os.Parcel, int); + enum_constant public static final android.net.wifi.SupplicantState ASSOCIATED; + enum_constant public static final android.net.wifi.SupplicantState ASSOCIATING; + enum_constant public static final android.net.wifi.SupplicantState AUTHENTICATING; + enum_constant public static final android.net.wifi.SupplicantState COMPLETED; + enum_constant public static final android.net.wifi.SupplicantState DISCONNECTED; + enum_constant public static final android.net.wifi.SupplicantState DORMANT; + enum_constant public static final android.net.wifi.SupplicantState FOUR_WAY_HANDSHAKE; + enum_constant public static final android.net.wifi.SupplicantState GROUP_HANDSHAKE; + enum_constant public static final android.net.wifi.SupplicantState INACTIVE; + enum_constant public static final android.net.wifi.SupplicantState INTERFACE_DISABLED; + enum_constant public static final android.net.wifi.SupplicantState INVALID; + enum_constant public static final android.net.wifi.SupplicantState SCANNING; + enum_constant public static final android.net.wifi.SupplicantState UNINITIALIZED; + } + + public class WifiConfiguration implements android.os.Parcelable { + ctor public WifiConfiguration(); + method public int describeContents(); + method public void writeToParcel(android.os.Parcel, int); + field public java.lang.String BSSID; + field public java.lang.String SSID; + field public java.util.BitSet allowedAuthAlgorithms; + field public java.util.BitSet allowedGroupCiphers; + field public java.util.BitSet allowedKeyManagement; + field public java.util.BitSet allowedPairwiseCiphers; + field public java.util.BitSet allowedProtocols; + field public boolean hiddenSSID; + field public int networkId; + field public java.lang.String preSharedKey; + field public int priority; + field public int status; + field public java.lang.String[] wepKeys; + field public int wepTxKeyIndex; + } + + public static class WifiConfiguration.AuthAlgorithm { + field public static final int LEAP = 2; // 0x2 + field public static final int OPEN = 0; // 0x0 + field public static final int SHARED = 1; // 0x1 + field public static final java.lang.String[] strings; + field public static final java.lang.String varName = "auth_alg"; + } + + public static class WifiConfiguration.GroupCipher { + field public static final int CCMP = 3; // 0x3 + field public static final int TKIP = 2; // 0x2 + field public static final int WEP104 = 1; // 0x1 + field public static final int WEP40 = 0; // 0x0 + field public static final java.lang.String[] strings; + field public static final java.lang.String varName = "group"; + } + + public static class WifiConfiguration.KeyMgmt { + field public static final int IEEE8021X = 3; // 0x3 + field public static final int NONE = 0; // 0x0 + field public static final int WPA_EAP = 2; // 0x2 + field public static final int WPA_PSK = 1; // 0x1 + field public static final java.lang.String[] strings; + field public static final java.lang.String varName = "key_mgmt"; + } + + public static class WifiConfiguration.PairwiseCipher { + field public static final int CCMP = 2; // 0x2 + field public static final int NONE = 0; // 0x0 + field public static final int TKIP = 1; // 0x1 + field public static final java.lang.String[] strings; + field public static final java.lang.String varName = "pairwise"; + } + + public static class WifiConfiguration.Protocol { + field public static final int RSN = 1; // 0x1 + field public static final int WPA = 0; // 0x0 + field public static final java.lang.String[] strings; + field public static final java.lang.String varName = "proto"; + } + + public static class WifiConfiguration.Status { + field public static final int CURRENT = 0; // 0x0 + field public static final int DISABLED = 1; // 0x1 + field public static final int ENABLED = 2; // 0x2 + field public static final java.lang.String[] strings; + } + + public class WifiInfo implements android.os.Parcelable { + method public int describeContents(); + method public java.lang.String getBSSID(); + method public static android.net.NetworkInfo.DetailedState getDetailedStateOf(android.net.wifi.SupplicantState); + method public boolean getHiddenSSID(); + method public int getIpAddress(); + method public int getLinkSpeed(); + method public java.lang.String getMacAddress(); + method public int getNetworkId(); + method public int getRssi(); + method public java.lang.String getSSID(); + method public android.net.wifi.SupplicantState getSupplicantState(); + method public void writeToParcel(android.os.Parcel, int); + field public static final java.lang.String LINK_SPEED_UNITS = "Mbps"; + } + + public class WifiManager { + method public int addNetwork(android.net.wifi.WifiConfiguration); + method public static int calculateSignalLevel(int, int); + method public static int compareSignalLevel(int, int); + method public android.net.wifi.WifiManager.MulticastLock createMulticastLock(java.lang.String); + method public android.net.wifi.WifiManager.WifiLock createWifiLock(int, java.lang.String); + method public android.net.wifi.WifiManager.WifiLock createWifiLock(java.lang.String); + method public boolean disableNetwork(int); + method public boolean disconnect(); + method public boolean enableNetwork(int, boolean); + method public java.util.List getConfiguredNetworks(); + method public android.net.wifi.WifiInfo getConnectionInfo(); + method public android.net.DhcpInfo getDhcpInfo(); + method public java.util.List getScanResults(); + method public int getWifiState(); + method public boolean isWifiEnabled(); + method public boolean pingSupplicant(); + method public boolean reassociate(); + method public boolean reconnect(); + method public boolean removeNetwork(int); + method public boolean saveConfiguration(); + method public boolean setWifiEnabled(boolean); + method public boolean startScan(); + method public int updateNetwork(android.net.wifi.WifiConfiguration); + field public static final java.lang.String ACTION_PICK_WIFI_NETWORK = "android.net.wifi.PICK_WIFI_NETWORK"; + field public static final int ERROR_AUTHENTICATING = 1; // 0x1 + field public static final java.lang.String EXTRA_BSSID = "bssid"; + field public static final java.lang.String EXTRA_NETWORK_INFO = "networkInfo"; + field public static final java.lang.String EXTRA_NEW_RSSI = "newRssi"; + field public static final java.lang.String EXTRA_NEW_STATE = "newState"; + field public static final java.lang.String EXTRA_PREVIOUS_WIFI_STATE = "previous_wifi_state"; + field public static final java.lang.String EXTRA_SUPPLICANT_CONNECTED = "connected"; + field public static final java.lang.String EXTRA_SUPPLICANT_ERROR = "supplicantError"; + field public static final java.lang.String EXTRA_WIFI_INFO = "wifiInfo"; + field public static final java.lang.String EXTRA_WIFI_STATE = "wifi_state"; + field public static final java.lang.String NETWORK_IDS_CHANGED_ACTION = "android.net.wifi.NETWORK_IDS_CHANGED"; + field public static final java.lang.String NETWORK_STATE_CHANGED_ACTION = "android.net.wifi.STATE_CHANGE"; + field public static final java.lang.String RSSI_CHANGED_ACTION = "android.net.wifi.RSSI_CHANGED"; + field public static final java.lang.String SCAN_RESULTS_AVAILABLE_ACTION = "android.net.wifi.SCAN_RESULTS"; + field public static final java.lang.String SUPPLICANT_CONNECTION_CHANGE_ACTION = "android.net.wifi.supplicant.CONNECTION_CHANGE"; + field public static final java.lang.String SUPPLICANT_STATE_CHANGED_ACTION = "android.net.wifi.supplicant.STATE_CHANGE"; + field public static final int WIFI_MODE_FULL = 1; // 0x1 + field public static final int WIFI_MODE_FULL_HIGH_PERF = 3; // 0x3 + field public static final int WIFI_MODE_SCAN_ONLY = 2; // 0x2 + field public static final java.lang.String WIFI_STATE_CHANGED_ACTION = "android.net.wifi.WIFI_STATE_CHANGED"; + field public static final int WIFI_STATE_DISABLED = 1; // 0x1 + field public static final int WIFI_STATE_DISABLING = 0; // 0x0 + field public static final int WIFI_STATE_ENABLED = 3; // 0x3 + field public static final int WIFI_STATE_ENABLING = 2; // 0x2 + field public static final int WIFI_STATE_UNKNOWN = 4; // 0x4 + } + + public class WifiManager.MulticastLock { + method public void acquire(); + method public boolean isHeld(); + method public void release(); + method public void setReferenceCounted(boolean); + } + + public class WifiManager.WifiLock { + method public void acquire(); + method public boolean isHeld(); + method public void release(); + method public void setReferenceCounted(boolean); + method public void setWorkSource(android.os.WorkSource); + } + + public class WpsInfo implements android.os.Parcelable { + ctor public WpsInfo(); + ctor public WpsInfo(android.net.wifi.WpsInfo); + method public int describeContents(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + field public static final int DISPLAY = 1; // 0x1 + field public static final int INVALID = 4; // 0x4 + field public static final int KEYPAD = 2; // 0x2 + field public static final int LABEL = 3; // 0x3 + field public static final int PBC = 0; // 0x0 + field public java.lang.String pin; + field public int setup; + } + +} + +package android.net.wifi.p2p { + + public class WifiP2pConfig implements android.os.Parcelable { + ctor public WifiP2pConfig(); + ctor public WifiP2pConfig(android.net.wifi.p2p.WifiP2pConfig); + method public int describeContents(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + field public java.lang.String deviceAddress; + field public int groupOwnerIntent; + field public android.net.wifi.WpsInfo wps; + } + + public class WifiP2pDevice implements android.os.Parcelable { + ctor public WifiP2pDevice(); + ctor public WifiP2pDevice(android.net.wifi.p2p.WifiP2pDevice); + method public int describeContents(); + method public boolean isGroupOwner(); + method public boolean isServiceDiscoveryCapable(); + method public boolean wpsDisplaySupported(); + method public boolean wpsKeypadSupported(); + method public boolean wpsPbcSupported(); + method public void writeToParcel(android.os.Parcel, int); + field public static final int AVAILABLE = 3; // 0x3 + field public static final int CONNECTED = 0; // 0x0 + field public static final android.os.Parcelable.Creator CREATOR; + field public static final int FAILED = 2; // 0x2 + field public static final int INVITED = 1; // 0x1 + field public static final int UNAVAILABLE = 4; // 0x4 + field public java.lang.String deviceAddress; + field public java.lang.String deviceName; + field public java.lang.String primaryDeviceType; + field public java.lang.String secondaryDeviceType; + field public int status; + } + + public class WifiP2pDeviceList implements android.os.Parcelable { + ctor public WifiP2pDeviceList(); + ctor public WifiP2pDeviceList(android.net.wifi.p2p.WifiP2pDeviceList); + method public int describeContents(); + method public java.util.Collection getDeviceList(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + } + + public class WifiP2pGroup implements android.os.Parcelable { + ctor public WifiP2pGroup(); + ctor public WifiP2pGroup(android.net.wifi.p2p.WifiP2pGroup); + method public int describeContents(); + method public java.util.Collection getClientList(); + method public java.lang.String getInterface(); + method public java.lang.String getNetworkName(); + method public android.net.wifi.p2p.WifiP2pDevice getOwner(); + method public java.lang.String getPassphrase(); + method public boolean isGroupOwner(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + } + + public class WifiP2pInfo implements android.os.Parcelable { + ctor public WifiP2pInfo(); + ctor public WifiP2pInfo(android.net.wifi.p2p.WifiP2pInfo); + method public int describeContents(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + field public boolean groupFormed; + field public java.net.InetAddress groupOwnerAddress; + field public boolean isGroupOwner; + } + + public class WifiP2pManager { + method public void addLocalService(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.nsd.WifiP2pServiceInfo, android.net.wifi.p2p.WifiP2pManager.ActionListener); + method public void addServiceRequest(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.nsd.WifiP2pServiceRequest, android.net.wifi.p2p.WifiP2pManager.ActionListener); + method public void cancelConnect(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.WifiP2pManager.ActionListener); + method public void clearLocalServices(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.WifiP2pManager.ActionListener); + method public void clearServiceRequests(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.WifiP2pManager.ActionListener); + method public void connect(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.WifiP2pConfig, android.net.wifi.p2p.WifiP2pManager.ActionListener); + method public void createGroup(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.WifiP2pManager.ActionListener); + method public void discoverPeers(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.WifiP2pManager.ActionListener); + method public void discoverServices(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.WifiP2pManager.ActionListener); + method public android.net.wifi.p2p.WifiP2pManager.Channel initialize(android.content.Context, android.os.Looper, android.net.wifi.p2p.WifiP2pManager.ChannelListener); + method public void removeGroup(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.WifiP2pManager.ActionListener); + method public void removeLocalService(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.nsd.WifiP2pServiceInfo, android.net.wifi.p2p.WifiP2pManager.ActionListener); + method public void removeServiceRequest(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.nsd.WifiP2pServiceRequest, android.net.wifi.p2p.WifiP2pManager.ActionListener); + method public void requestConnectionInfo(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.WifiP2pManager.ConnectionInfoListener); + method public void requestGroupInfo(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.WifiP2pManager.GroupInfoListener); + method public void requestPeers(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.WifiP2pManager.PeerListListener); + method public void setDnsSdResponseListeners(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.WifiP2pManager.DnsSdServiceResponseListener, android.net.wifi.p2p.WifiP2pManager.DnsSdTxtRecordListener); + method public void setServiceResponseListener(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.WifiP2pManager.ServiceResponseListener); + method public void setUpnpServiceResponseListener(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.WifiP2pManager.UpnpServiceResponseListener); + method public void stopPeerDiscovery(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.WifiP2pManager.ActionListener); + field public static final int BUSY = 2; // 0x2 + field public static final int ERROR = 0; // 0x0 + field public static final java.lang.String EXTRA_DISCOVERY_STATE = "discoveryState"; + field public static final java.lang.String EXTRA_NETWORK_INFO = "networkInfo"; + field public static final java.lang.String EXTRA_WIFI_P2P_DEVICE = "wifiP2pDevice"; + field public static final java.lang.String EXTRA_WIFI_P2P_INFO = "wifiP2pInfo"; + field public static final java.lang.String EXTRA_WIFI_STATE = "wifi_p2p_state"; + field public static final int NO_SERVICE_REQUESTS = 3; // 0x3 + field public static final int P2P_UNSUPPORTED = 1; // 0x1 + field public static final java.lang.String WIFI_P2P_CONNECTION_CHANGED_ACTION = "android.net.wifi.p2p.CONNECTION_STATE_CHANGE"; + field public static final java.lang.String WIFI_P2P_DISCOVERY_CHANGED_ACTION = "android.net.wifi.p2p.DISCOVERY_STATE_CHANGE"; + field public static final int WIFI_P2P_DISCOVERY_STARTED = 2; // 0x2 + field public static final int WIFI_P2P_DISCOVERY_STOPPED = 1; // 0x1 + field public static final java.lang.String WIFI_P2P_PEERS_CHANGED_ACTION = "android.net.wifi.p2p.PEERS_CHANGED"; + field public static final java.lang.String WIFI_P2P_STATE_CHANGED_ACTION = "android.net.wifi.p2p.STATE_CHANGED"; + field public static final int WIFI_P2P_STATE_DISABLED = 1; // 0x1 + field public static final int WIFI_P2P_STATE_ENABLED = 2; // 0x2 + field public static final java.lang.String WIFI_P2P_THIS_DEVICE_CHANGED_ACTION = "android.net.wifi.p2p.THIS_DEVICE_CHANGED"; + } + + public static abstract interface WifiP2pManager.ActionListener { + method public abstract void onFailure(int); + method public abstract void onSuccess(); + } + + public static class WifiP2pManager.Channel { + } + + public static abstract interface WifiP2pManager.ChannelListener { + method public abstract void onChannelDisconnected(); + } + + public static abstract interface WifiP2pManager.ConnectionInfoListener { + method public abstract void onConnectionInfoAvailable(android.net.wifi.p2p.WifiP2pInfo); + } + + public static abstract interface WifiP2pManager.DnsSdServiceResponseListener { + method public abstract void onDnsSdServiceAvailable(java.lang.String, java.lang.String, android.net.wifi.p2p.WifiP2pDevice); + } + + public static abstract interface WifiP2pManager.DnsSdTxtRecordListener { + method public abstract void onDnsSdTxtRecordAvailable(java.lang.String, java.util.Map, android.net.wifi.p2p.WifiP2pDevice); + } + + public static abstract interface WifiP2pManager.GroupInfoListener { + method public abstract void onGroupInfoAvailable(android.net.wifi.p2p.WifiP2pGroup); + } + + public static abstract interface WifiP2pManager.PeerListListener { + method public abstract void onPeersAvailable(android.net.wifi.p2p.WifiP2pDeviceList); + } + + public static abstract interface WifiP2pManager.ServiceResponseListener { + method public abstract void onServiceAvailable(int, byte[], android.net.wifi.p2p.WifiP2pDevice); + } + + public static abstract interface WifiP2pManager.UpnpServiceResponseListener { + method public abstract void onUpnpServiceAvailable(java.util.List, android.net.wifi.p2p.WifiP2pDevice); + } + +} + +package android.net.wifi.p2p.nsd { + + public class WifiP2pDnsSdServiceInfo extends android.net.wifi.p2p.nsd.WifiP2pServiceInfo { + method public static android.net.wifi.p2p.nsd.WifiP2pDnsSdServiceInfo newInstance(java.lang.String, java.lang.String, java.util.Map); + } + + public class WifiP2pDnsSdServiceRequest extends android.net.wifi.p2p.nsd.WifiP2pServiceRequest { + method public static android.net.wifi.p2p.nsd.WifiP2pDnsSdServiceRequest newInstance(); + method public static android.net.wifi.p2p.nsd.WifiP2pDnsSdServiceRequest newInstance(java.lang.String); + method public static android.net.wifi.p2p.nsd.WifiP2pDnsSdServiceRequest newInstance(java.lang.String, java.lang.String); + } + + public class WifiP2pServiceInfo implements android.os.Parcelable { + method public int describeContents(); + method public void writeToParcel(android.os.Parcel, int); + field public static final int SERVICE_TYPE_ALL = 0; // 0x0 + field public static final int SERVICE_TYPE_BONJOUR = 1; // 0x1 + field public static final int SERVICE_TYPE_UPNP = 2; // 0x2 + field public static final int SERVICE_TYPE_VENDOR_SPECIFIC = 255; // 0xff + } + + public class WifiP2pServiceRequest implements android.os.Parcelable { + method public int describeContents(); + method public static android.net.wifi.p2p.nsd.WifiP2pServiceRequest newInstance(int, java.lang.String); + method public static android.net.wifi.p2p.nsd.WifiP2pServiceRequest newInstance(int); + method public void writeToParcel(android.os.Parcel, int); + } + + public class WifiP2pUpnpServiceInfo extends android.net.wifi.p2p.nsd.WifiP2pServiceInfo { + method public static android.net.wifi.p2p.nsd.WifiP2pUpnpServiceInfo newInstance(java.lang.String, java.lang.String, java.util.List); + } + + public class WifiP2pUpnpServiceRequest extends android.net.wifi.p2p.nsd.WifiP2pServiceRequest { + method public static android.net.wifi.p2p.nsd.WifiP2pUpnpServiceRequest newInstance(); + method public static android.net.wifi.p2p.nsd.WifiP2pUpnpServiceRequest newInstance(java.lang.String); + } + +} + +package android.nfc { + + public class FormatException extends java.lang.Exception { + ctor public FormatException(); + ctor public FormatException(java.lang.String); + ctor public FormatException(java.lang.String, java.lang.Throwable); + } + + public final class NdefMessage implements android.os.Parcelable { + ctor public NdefMessage(byte[]) throws android.nfc.FormatException; + ctor public NdefMessage(android.nfc.NdefRecord, android.nfc.NdefRecord...); + ctor public NdefMessage(android.nfc.NdefRecord[]); + method public int describeContents(); + method public int getByteArrayLength(); + method public android.nfc.NdefRecord[] getRecords(); + method public byte[] toByteArray(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + } + + public final class NdefRecord implements android.os.Parcelable { + ctor public NdefRecord(short, byte[], byte[], byte[]); + ctor public deprecated NdefRecord(byte[]) throws android.nfc.FormatException; + method public static android.nfc.NdefRecord createApplicationRecord(java.lang.String); + method public static android.nfc.NdefRecord createExternal(java.lang.String, java.lang.String, byte[]); + method public static android.nfc.NdefRecord createMime(java.lang.String, byte[]); + method public static android.nfc.NdefRecord createUri(android.net.Uri); + method public static android.nfc.NdefRecord createUri(java.lang.String); + method public int describeContents(); + method public byte[] getId(); + method public byte[] getPayload(); + method public short getTnf(); + method public byte[] getType(); + method public deprecated byte[] toByteArray(); + method public java.lang.String toMimeType(); + method public android.net.Uri toUri(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + field public static final byte[] RTD_ALTERNATIVE_CARRIER; + field public static final byte[] RTD_HANDOVER_CARRIER; + field public static final byte[] RTD_HANDOVER_REQUEST; + field public static final byte[] RTD_HANDOVER_SELECT; + field public static final byte[] RTD_SMART_POSTER; + field public static final byte[] RTD_TEXT; + field public static final byte[] RTD_URI; + field public static final short TNF_ABSOLUTE_URI = 3; // 0x3 + field public static final short TNF_EMPTY = 0; // 0x0 + field public static final short TNF_EXTERNAL_TYPE = 4; // 0x4 + field public static final short TNF_MIME_MEDIA = 2; // 0x2 + field public static final short TNF_UNCHANGED = 6; // 0x6 + field public static final short TNF_UNKNOWN = 5; // 0x5 + field public static final short TNF_WELL_KNOWN = 1; // 0x1 + } + + public final class NfcAdapter { + method public void disableForegroundDispatch(android.app.Activity); + method public deprecated void disableForegroundNdefPush(android.app.Activity); + method public void enableForegroundDispatch(android.app.Activity, android.app.PendingIntent, android.content.IntentFilter[], java.lang.String[][]); + method public deprecated void enableForegroundNdefPush(android.app.Activity, android.nfc.NdefMessage); + method public static android.nfc.NfcAdapter getDefaultAdapter(android.content.Context); + method public boolean isEnabled(); + method public boolean isNdefPushEnabled(); + method public void setBeamPushUris(android.net.Uri[], android.app.Activity); + method public void setBeamPushUrisCallback(android.nfc.NfcAdapter.CreateBeamUrisCallback, android.app.Activity); + method public void setNdefPushMessage(android.nfc.NdefMessage, android.app.Activity, android.app.Activity...); + method public void setNdefPushMessageCallback(android.nfc.NfcAdapter.CreateNdefMessageCallback, android.app.Activity, android.app.Activity...); + method public void setOnNdefPushCompleteCallback(android.nfc.NfcAdapter.OnNdefPushCompleteCallback, android.app.Activity, android.app.Activity...); + field public static final java.lang.String ACTION_NDEF_DISCOVERED = "android.nfc.action.NDEF_DISCOVERED"; + field public static final java.lang.String ACTION_TAG_DISCOVERED = "android.nfc.action.TAG_DISCOVERED"; + field public static final java.lang.String ACTION_TECH_DISCOVERED = "android.nfc.action.TECH_DISCOVERED"; + field public static final java.lang.String EXTRA_ID = "android.nfc.extra.ID"; + field public static final java.lang.String EXTRA_NDEF_MESSAGES = "android.nfc.extra.NDEF_MESSAGES"; + field public static final java.lang.String EXTRA_TAG = "android.nfc.extra.TAG"; + } + + public static abstract interface NfcAdapter.CreateBeamUrisCallback { + method public abstract android.net.Uri[] createBeamUris(android.nfc.NfcEvent); + } + + public static abstract interface NfcAdapter.CreateNdefMessageCallback { + method public abstract android.nfc.NdefMessage createNdefMessage(android.nfc.NfcEvent); + } + + public static abstract interface NfcAdapter.OnNdefPushCompleteCallback { + method public abstract void onNdefPushComplete(android.nfc.NfcEvent); + } + + public final class NfcEvent { + field public final android.nfc.NfcAdapter nfcAdapter; + } + + public final class NfcManager { + method public android.nfc.NfcAdapter getDefaultAdapter(); + } + + public final class Tag implements android.os.Parcelable { + method public int describeContents(); + method public byte[] getId(); + method public java.lang.String[] getTechList(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + } + + public class TagLostException extends java.io.IOException { + ctor public TagLostException(); + ctor public TagLostException(java.lang.String); + } + +} + +package android.nfc.tech { + + abstract class BasicTagTechnology implements android.nfc.tech.TagTechnology { + method public void close() throws java.io.IOException; + method public void connect() throws java.io.IOException; + method public android.nfc.Tag getTag(); + method public boolean isConnected(); + } + + public final class IsoDep extends android.nfc.tech.BasicTagTechnology { + method public static android.nfc.tech.IsoDep get(android.nfc.Tag); + method public byte[] getHiLayerResponse(); + method public byte[] getHistoricalBytes(); + method public int getMaxTransceiveLength(); + method public int getTimeout(); + method public boolean isExtendedLengthApduSupported(); + method public void setTimeout(int); + method public byte[] transceive(byte[]) throws java.io.IOException; + } + + public final class MifareClassic extends android.nfc.tech.BasicTagTechnology { + method public boolean authenticateSectorWithKeyA(int, byte[]) throws java.io.IOException; + method public boolean authenticateSectorWithKeyB(int, byte[]) throws java.io.IOException; + method public int blockToSector(int); + method public void decrement(int, int) throws java.io.IOException; + method public static android.nfc.tech.MifareClassic get(android.nfc.Tag); + method public int getBlockCount(); + method public int getBlockCountInSector(int); + method public int getMaxTransceiveLength(); + method public int getSectorCount(); + method public int getSize(); + method public int getTimeout(); + method public int getType(); + method public void increment(int, int) throws java.io.IOException; + method public byte[] readBlock(int) throws java.io.IOException; + method public void restore(int) throws java.io.IOException; + method public int sectorToBlock(int); + method public void setTimeout(int); + method public byte[] transceive(byte[]) throws java.io.IOException; + method public void transfer(int) throws java.io.IOException; + method public void writeBlock(int, byte[]) throws java.io.IOException; + field public static final int BLOCK_SIZE = 16; // 0x10 + field public static final byte[] KEY_DEFAULT; + field public static final byte[] KEY_MIFARE_APPLICATION_DIRECTORY; + field public static final byte[] KEY_NFC_FORUM; + field public static final int SIZE_1K = 1024; // 0x400 + field public static final int SIZE_2K = 2048; // 0x800 + field public static final int SIZE_4K = 4096; // 0x1000 + field public static final int SIZE_MINI = 320; // 0x140 + field public static final int TYPE_CLASSIC = 0; // 0x0 + field public static final int TYPE_PLUS = 1; // 0x1 + field public static final int TYPE_PRO = 2; // 0x2 + field public static final int TYPE_UNKNOWN = -1; // 0xffffffff + } + + public final class MifareUltralight extends android.nfc.tech.BasicTagTechnology { + method public static android.nfc.tech.MifareUltralight get(android.nfc.Tag); + method public int getMaxTransceiveLength(); + method public int getTimeout(); + method public int getType(); + method public byte[] readPages(int) throws java.io.IOException; + method public void setTimeout(int); + method public byte[] transceive(byte[]) throws java.io.IOException; + method public void writePage(int, byte[]) throws java.io.IOException; + field public static final int PAGE_SIZE = 4; // 0x4 + field public static final int TYPE_ULTRALIGHT = 1; // 0x1 + field public static final int TYPE_ULTRALIGHT_C = 2; // 0x2 + field public static final int TYPE_UNKNOWN = -1; // 0xffffffff + } + + public final class Ndef extends android.nfc.tech.BasicTagTechnology { + method public boolean canMakeReadOnly(); + method public static android.nfc.tech.Ndef get(android.nfc.Tag); + method public android.nfc.NdefMessage getCachedNdefMessage(); + method public int getMaxSize(); + method public android.nfc.NdefMessage getNdefMessage() throws android.nfc.FormatException, java.io.IOException; + method public java.lang.String getType(); + method public boolean isWritable(); + method public boolean makeReadOnly() throws java.io.IOException; + method public void writeNdefMessage(android.nfc.NdefMessage) throws android.nfc.FormatException, java.io.IOException; + field public static final java.lang.String MIFARE_CLASSIC = "com.nxp.ndef.mifareclassic"; + field public static final java.lang.String NFC_FORUM_TYPE_1 = "org.nfcforum.ndef.type1"; + field public static final java.lang.String NFC_FORUM_TYPE_2 = "org.nfcforum.ndef.type2"; + field public static final java.lang.String NFC_FORUM_TYPE_3 = "org.nfcforum.ndef.type3"; + field public static final java.lang.String NFC_FORUM_TYPE_4 = "org.nfcforum.ndef.type4"; + } + + public final class NdefFormatable extends android.nfc.tech.BasicTagTechnology { + method public void format(android.nfc.NdefMessage) throws android.nfc.FormatException, java.io.IOException; + method public void formatReadOnly(android.nfc.NdefMessage) throws android.nfc.FormatException, java.io.IOException; + method public static android.nfc.tech.NdefFormatable get(android.nfc.Tag); + } + + public final class NfcA extends android.nfc.tech.BasicTagTechnology { + method public static android.nfc.tech.NfcA get(android.nfc.Tag); + method public byte[] getAtqa(); + method public int getMaxTransceiveLength(); + method public short getSak(); + method public int getTimeout(); + method public void setTimeout(int); + method public byte[] transceive(byte[]) throws java.io.IOException; + } + + public final class NfcB extends android.nfc.tech.BasicTagTechnology { + method public static android.nfc.tech.NfcB get(android.nfc.Tag); + method public byte[] getApplicationData(); + method public int getMaxTransceiveLength(); + method public byte[] getProtocolInfo(); + method public byte[] transceive(byte[]) throws java.io.IOException; + } + + public final class NfcBarcode extends android.nfc.tech.BasicTagTechnology { + method public static android.nfc.tech.NfcBarcode get(android.nfc.Tag); + method public byte[] getBarcode(); + method public int getType(); + field public static final int TYPE_KOVIO = 1; // 0x1 + field public static final int TYPE_UNKNOWN = -1; // 0xffffffff + } + + public final class NfcF extends android.nfc.tech.BasicTagTechnology { + method public static android.nfc.tech.NfcF get(android.nfc.Tag); + method public byte[] getManufacturer(); + method public int getMaxTransceiveLength(); + method public byte[] getSystemCode(); + method public int getTimeout(); + method public void setTimeout(int); + method public byte[] transceive(byte[]) throws java.io.IOException; + } + + public final class NfcV extends android.nfc.tech.BasicTagTechnology { + method public static android.nfc.tech.NfcV get(android.nfc.Tag); + method public byte getDsfId(); + method public int getMaxTransceiveLength(); + method public byte getResponseFlags(); + method public byte[] transceive(byte[]) throws java.io.IOException; + } + + public abstract interface TagTechnology implements java.io.Closeable { + method public abstract void close() throws java.io.IOException; + method public abstract void connect() throws java.io.IOException; + method public abstract android.nfc.Tag getTag(); + method public abstract boolean isConnected(); + } + +} + +package android.opengl { + + public class EGL14 { + ctor public EGL14(); + method public static boolean eglBindAPI(int); + method public static boolean eglBindTexImage(android.opengl.EGLDisplay, android.opengl.EGLSurface, int); + method public static boolean eglChooseConfig(android.opengl.EGLDisplay, int[], int, android.opengl.EGLConfig[], int, int, int[], int); + method public static boolean eglCopyBuffers(android.opengl.EGLDisplay, android.opengl.EGLSurface, int); + method public static android.opengl.EGLContext eglCreateContext(android.opengl.EGLDisplay, android.opengl.EGLConfig, android.opengl.EGLContext, int[], int); + method public static android.opengl.EGLSurface eglCreatePbufferFromClientBuffer(android.opengl.EGLDisplay, int, int, android.opengl.EGLConfig, int[], int); + method public static android.opengl.EGLSurface eglCreatePbufferSurface(android.opengl.EGLDisplay, android.opengl.EGLConfig, int[], int); + method public static android.opengl.EGLSurface eglCreatePixmapSurface(android.opengl.EGLDisplay, android.opengl.EGLConfig, int, int[], int); + method public static android.opengl.EGLSurface eglCreateWindowSurface(android.opengl.EGLDisplay, android.opengl.EGLConfig, java.lang.Object, int[], int); + method public static boolean eglDestroyContext(android.opengl.EGLDisplay, android.opengl.EGLContext); + method public static boolean eglDestroySurface(android.opengl.EGLDisplay, android.opengl.EGLSurface); + method public static boolean eglGetConfigAttrib(android.opengl.EGLDisplay, android.opengl.EGLConfig, int, int[], int); + method public static boolean eglGetConfigs(android.opengl.EGLDisplay, android.opengl.EGLConfig[], int, int, int[], int); + method public static android.opengl.EGLContext eglGetCurrentContext(); + method public static android.opengl.EGLDisplay eglGetCurrentDisplay(); + method public static android.opengl.EGLSurface eglGetCurrentSurface(int); + method public static android.opengl.EGLDisplay eglGetDisplay(int); + method public static int eglGetError(); + method public static boolean eglInitialize(android.opengl.EGLDisplay, int[], int, int[], int); + method public static boolean eglMakeCurrent(android.opengl.EGLDisplay, android.opengl.EGLSurface, android.opengl.EGLSurface, android.opengl.EGLContext); + method public static int eglQueryAPI(); + method public static boolean eglQueryContext(android.opengl.EGLDisplay, android.opengl.EGLContext, int, int[], int); + method public static java.lang.String eglQueryString(android.opengl.EGLDisplay, int); + method public static boolean eglQuerySurface(android.opengl.EGLDisplay, android.opengl.EGLSurface, int, int[], int); + method public static boolean eglReleaseTexImage(android.opengl.EGLDisplay, android.opengl.EGLSurface, int); + method public static boolean eglReleaseThread(); + method public static boolean eglSurfaceAttrib(android.opengl.EGLDisplay, android.opengl.EGLSurface, int, int); + method public static boolean eglSwapBuffers(android.opengl.EGLDisplay, android.opengl.EGLSurface); + method public static boolean eglSwapInterval(android.opengl.EGLDisplay, int); + method public static boolean eglTerminate(android.opengl.EGLDisplay); + method public static boolean eglWaitClient(); + method public static boolean eglWaitGL(); + method public static boolean eglWaitNative(int); + field public static final int EGL_ALPHA_MASK_SIZE = 12350; // 0x303e + field public static final int EGL_ALPHA_SIZE = 12321; // 0x3021 + field public static final int EGL_BACK_BUFFER = 12420; // 0x3084 + field public static final int EGL_BAD_ACCESS = 12290; // 0x3002 + field public static final int EGL_BAD_ALLOC = 12291; // 0x3003 + field public static final int EGL_BAD_ATTRIBUTE = 12292; // 0x3004 + field public static final int EGL_BAD_CONFIG = 12293; // 0x3005 + field public static final int EGL_BAD_CONTEXT = 12294; // 0x3006 + field public static final int EGL_BAD_CURRENT_SURFACE = 12295; // 0x3007 + field public static final int EGL_BAD_DISPLAY = 12296; // 0x3008 + field public static final int EGL_BAD_MATCH = 12297; // 0x3009 + field public static final int EGL_BAD_NATIVE_PIXMAP = 12298; // 0x300a + field public static final int EGL_BAD_NATIVE_WINDOW = 12299; // 0x300b + field public static final int EGL_BAD_PARAMETER = 12300; // 0x300c + field public static final int EGL_BAD_SURFACE = 12301; // 0x300d + field public static final int EGL_BIND_TO_TEXTURE_RGB = 12345; // 0x3039 + field public static final int EGL_BIND_TO_TEXTURE_RGBA = 12346; // 0x303a + field public static final int EGL_BLUE_SIZE = 12322; // 0x3022 + field public static final int EGL_BUFFER_DESTROYED = 12437; // 0x3095 + field public static final int EGL_BUFFER_PRESERVED = 12436; // 0x3094 + field public static final int EGL_BUFFER_SIZE = 12320; // 0x3020 + field public static final int EGL_CLIENT_APIS = 12429; // 0x308d + field public static final int EGL_COLOR_BUFFER_TYPE = 12351; // 0x303f + field public static final int EGL_CONFIG_CAVEAT = 12327; // 0x3027 + field public static final int EGL_CONFIG_ID = 12328; // 0x3028 + field public static final int EGL_CONFORMANT = 12354; // 0x3042 + field public static final int EGL_CONTEXT_CLIENT_TYPE = 12439; // 0x3097 + field public static final int EGL_CONTEXT_CLIENT_VERSION = 12440; // 0x3098 + field public static final int EGL_CONTEXT_LOST = 12302; // 0x300e + field public static final int EGL_CORE_NATIVE_ENGINE = 12379; // 0x305b + field public static final int EGL_DEFAULT_DISPLAY = 0; // 0x0 + field public static final int EGL_DEPTH_SIZE = 12325; // 0x3025 + field public static final int EGL_DISPLAY_SCALING = 10000; // 0x2710 + field public static final int EGL_DRAW = 12377; // 0x3059 + field public static final int EGL_EXTENSIONS = 12373; // 0x3055 + field public static final int EGL_FALSE = 0; // 0x0 + field public static final int EGL_GREEN_SIZE = 12323; // 0x3023 + field public static final int EGL_HEIGHT = 12374; // 0x3056 + field public static final int EGL_HORIZONTAL_RESOLUTION = 12432; // 0x3090 + field public static final int EGL_LARGEST_PBUFFER = 12376; // 0x3058 + field public static final int EGL_LEVEL = 12329; // 0x3029 + field public static final int EGL_LUMINANCE_BUFFER = 12431; // 0x308f + field public static final int EGL_LUMINANCE_SIZE = 12349; // 0x303d + field public static final int EGL_MATCH_NATIVE_PIXMAP = 12353; // 0x3041 + field public static final int EGL_MAX_PBUFFER_HEIGHT = 12330; // 0x302a + field public static final int EGL_MAX_PBUFFER_PIXELS = 12331; // 0x302b + field public static final int EGL_MAX_PBUFFER_WIDTH = 12332; // 0x302c + field public static final int EGL_MAX_SWAP_INTERVAL = 12348; // 0x303c + field public static final int EGL_MIN_SWAP_INTERVAL = 12347; // 0x303b + field public static final int EGL_MIPMAP_LEVEL = 12419; // 0x3083 + field public static final int EGL_MIPMAP_TEXTURE = 12418; // 0x3082 + field public static final int EGL_MULTISAMPLE_RESOLVE = 12441; // 0x3099 + field public static final int EGL_MULTISAMPLE_RESOLVE_BOX = 12443; // 0x309b + field public static final int EGL_MULTISAMPLE_RESOLVE_BOX_BIT = 512; // 0x200 + field public static final int EGL_MULTISAMPLE_RESOLVE_DEFAULT = 12442; // 0x309a + field public static final int EGL_NATIVE_RENDERABLE = 12333; // 0x302d + field public static final int EGL_NATIVE_VISUAL_ID = 12334; // 0x302e + field public static final int EGL_NATIVE_VISUAL_TYPE = 12335; // 0x302f + field public static final int EGL_NONE = 12344; // 0x3038 + field public static final int EGL_NON_CONFORMANT_CONFIG = 12369; // 0x3051 + field public static final int EGL_NOT_INITIALIZED = 12289; // 0x3001 + field public static android.opengl.EGLContext EGL_NO_CONTEXT; + field public static android.opengl.EGLDisplay EGL_NO_DISPLAY; + field public static android.opengl.EGLSurface EGL_NO_SURFACE; + field public static final int EGL_NO_TEXTURE = 12380; // 0x305c + field public static final int EGL_OPENGL_API = 12450; // 0x30a2 + field public static final int EGL_OPENGL_BIT = 8; // 0x8 + field public static final int EGL_OPENGL_ES2_BIT = 4; // 0x4 + field public static final int EGL_OPENGL_ES_API = 12448; // 0x30a0 + field public static final int EGL_OPENGL_ES_BIT = 1; // 0x1 + field public static final int EGL_OPENVG_API = 12449; // 0x30a1 + field public static final int EGL_OPENVG_BIT = 2; // 0x2 + field public static final int EGL_OPENVG_IMAGE = 12438; // 0x3096 + field public static final int EGL_PBUFFER_BIT = 1; // 0x1 + field public static final int EGL_PIXEL_ASPECT_RATIO = 12434; // 0x3092 + field public static final int EGL_PIXMAP_BIT = 2; // 0x2 + field public static final int EGL_READ = 12378; // 0x305a + field public static final int EGL_RED_SIZE = 12324; // 0x3024 + field public static final int EGL_RENDERABLE_TYPE = 12352; // 0x3040 + field public static final int EGL_RENDER_BUFFER = 12422; // 0x3086 + field public static final int EGL_RGB_BUFFER = 12430; // 0x308e + field public static final int EGL_SAMPLES = 12337; // 0x3031 + field public static final int EGL_SAMPLE_BUFFERS = 12338; // 0x3032 + field public static final int EGL_SINGLE_BUFFER = 12421; // 0x3085 + field public static final int EGL_SLOW_CONFIG = 12368; // 0x3050 + field public static final int EGL_STENCIL_SIZE = 12326; // 0x3026 + field public static final int EGL_SUCCESS = 12288; // 0x3000 + field public static final int EGL_SURFACE_TYPE = 12339; // 0x3033 + field public static final int EGL_SWAP_BEHAVIOR = 12435; // 0x3093 + field public static final int EGL_SWAP_BEHAVIOR_PRESERVED_BIT = 1024; // 0x400 + field public static final int EGL_TEXTURE_2D = 12383; // 0x305f + field public static final int EGL_TEXTURE_FORMAT = 12416; // 0x3080 + field public static final int EGL_TEXTURE_RGB = 12381; // 0x305d + field public static final int EGL_TEXTURE_RGBA = 12382; // 0x305e + field public static final int EGL_TEXTURE_TARGET = 12417; // 0x3081 + field public static final int EGL_TRANSPARENT_BLUE_VALUE = 12341; // 0x3035 + field public static final int EGL_TRANSPARENT_GREEN_VALUE = 12342; // 0x3036 + field public static final int EGL_TRANSPARENT_RED_VALUE = 12343; // 0x3037 + field public static final int EGL_TRANSPARENT_RGB = 12370; // 0x3052 + field public static final int EGL_TRANSPARENT_TYPE = 12340; // 0x3034 + field public static final int EGL_TRUE = 1; // 0x1 + field public static final int EGL_VENDOR = 12371; // 0x3053 + field public static final int EGL_VERSION = 12372; // 0x3054 + field public static final int EGL_VERTICAL_RESOLUTION = 12433; // 0x3091 + field public static final int EGL_VG_ALPHA_FORMAT = 12424; // 0x3088 + field public static final int EGL_VG_ALPHA_FORMAT_NONPRE = 12427; // 0x308b + field public static final int EGL_VG_ALPHA_FORMAT_PRE = 12428; // 0x308c + field public static final int EGL_VG_ALPHA_FORMAT_PRE_BIT = 64; // 0x40 + field public static final int EGL_VG_COLORSPACE = 12423; // 0x3087 + field public static final int EGL_VG_COLORSPACE_LINEAR = 12426; // 0x308a + field public static final int EGL_VG_COLORSPACE_LINEAR_BIT = 32; // 0x20 + field public static final int EGL_VG_COLORSPACE_sRGB = 12425; // 0x3089 + field public static final int EGL_WIDTH = 12375; // 0x3057 + field public static final int EGL_WINDOW_BIT = 4; // 0x4 + } + + public class EGLConfig extends android.opengl.EGLObjectHandle { + } + + public class EGLContext extends android.opengl.EGLObjectHandle { + } + + public class EGLDisplay extends android.opengl.EGLObjectHandle { + } + + public abstract class EGLObjectHandle { + ctor protected EGLObjectHandle(int); + method public int getHandle(); + } + + public class EGLSurface extends android.opengl.EGLObjectHandle { + } + + public class ETC1 { + ctor public ETC1(); + method public static void decodeBlock(java.nio.Buffer, java.nio.Buffer); + method public static void decodeImage(java.nio.Buffer, java.nio.Buffer, int, int, int, int); + method public static void encodeBlock(java.nio.Buffer, int, java.nio.Buffer); + method public static void encodeImage(java.nio.Buffer, int, int, int, int, java.nio.Buffer); + method public static void formatHeader(java.nio.Buffer, int, int); + method public static int getEncodedDataSize(int, int); + method public static int getHeight(java.nio.Buffer); + method public static int getWidth(java.nio.Buffer); + method public static boolean isValid(java.nio.Buffer); + field public static final int DECODED_BLOCK_SIZE = 48; // 0x30 + field public static final int ENCODED_BLOCK_SIZE = 8; // 0x8 + field public static final int ETC1_RGB8_OES = 36196; // 0x8d64 + field public static final int ETC_PKM_HEADER_SIZE = 16; // 0x10 + } + + public class ETC1Util { + ctor public ETC1Util(); + method public static android.opengl.ETC1Util.ETC1Texture compressTexture(java.nio.Buffer, int, int, int, int); + method public static android.opengl.ETC1Util.ETC1Texture createTexture(java.io.InputStream) throws java.io.IOException; + method public static boolean isETC1Supported(); + method public static void loadTexture(int, int, int, int, int, java.io.InputStream) throws java.io.IOException; + method public static void loadTexture(int, int, int, int, int, android.opengl.ETC1Util.ETC1Texture); + method public static void writeTexture(android.opengl.ETC1Util.ETC1Texture, java.io.OutputStream) throws java.io.IOException; + } + + public static class ETC1Util.ETC1Texture { + ctor public ETC1Util.ETC1Texture(int, int, java.nio.ByteBuffer); + method public java.nio.ByteBuffer getData(); + method public int getHeight(); + method public int getWidth(); + } + + public class GLDebugHelper { + ctor public GLDebugHelper(); + method public static javax.microedition.khronos.opengles.GL wrap(javax.microedition.khronos.opengles.GL, int, java.io.Writer); + method public static javax.microedition.khronos.egl.EGL wrap(javax.microedition.khronos.egl.EGL, int, java.io.Writer); + field public static final int CONFIG_CHECK_GL_ERROR = 1; // 0x1 + field public static final int CONFIG_CHECK_THREAD = 2; // 0x2 + field public static final int CONFIG_LOG_ARGUMENT_NAMES = 4; // 0x4 + field public static final int ERROR_WRONG_THREAD = 28672; // 0x7000 + } + + public class GLES10 { + ctor public GLES10(); + method public static void glActiveTexture(int); + method public static void glAlphaFunc(int, float); + method public static void glAlphaFuncx(int, int); + method public static void glBindTexture(int, int); + method public static void glBlendFunc(int, int); + method public static void glClear(int); + method public static void glClearColor(float, float, float, float); + method public static void glClearColorx(int, int, int, int); + method public static void glClearDepthf(float); + method public static void glClearDepthx(int); + method public static void glClearStencil(int); + method public static void glClientActiveTexture(int); + method public static void glColor4f(float, float, float, float); + method public static void glColor4x(int, int, int, int); + method public static void glColorMask(boolean, boolean, boolean, boolean); + method public static void glColorPointer(int, int, int, java.nio.Buffer); + method public static void glCompressedTexImage2D(int, int, int, int, int, int, int, java.nio.Buffer); + method public static void glCompressedTexSubImage2D(int, int, int, int, int, int, int, int, java.nio.Buffer); + method public static void glCopyTexImage2D(int, int, int, int, int, int, int, int); + method public static void glCopyTexSubImage2D(int, int, int, int, int, int, int, int); + method public static void glCullFace(int); + method public static void glDeleteTextures(int, int[], int); + method public static void glDeleteTextures(int, java.nio.IntBuffer); + method public static void glDepthFunc(int); + method public static void glDepthMask(boolean); + method public static void glDepthRangef(float, float); + method public static void glDepthRangex(int, int); + method public static void glDisable(int); + method public static void glDisableClientState(int); + method public static void glDrawArrays(int, int, int); + method public static void glDrawElements(int, int, int, java.nio.Buffer); + method public static void glEnable(int); + method public static void glEnableClientState(int); + method public static void glFinish(); + method public static void glFlush(); + method public static void glFogf(int, float); + method public static void glFogfv(int, float[], int); + method public static void glFogfv(int, java.nio.FloatBuffer); + method public static void glFogx(int, int); + method public static void glFogxv(int, int[], int); + method public static void glFogxv(int, java.nio.IntBuffer); + method public static void glFrontFace(int); + method public static void glFrustumf(float, float, float, float, float, float); + method public static void glFrustumx(int, int, int, int, int, int); + method public static void glGenTextures(int, int[], int); + method public static void glGenTextures(int, java.nio.IntBuffer); + method public static int glGetError(); + method public static void glGetIntegerv(int, int[], int); + method public static void glGetIntegerv(int, java.nio.IntBuffer); + method public static java.lang.String glGetString(int); + method public static void glHint(int, int); + method public static void glLightModelf(int, float); + method public static void glLightModelfv(int, float[], int); + method public static void glLightModelfv(int, java.nio.FloatBuffer); + method public static void glLightModelx(int, int); + method public static void glLightModelxv(int, int[], int); + method public static void glLightModelxv(int, java.nio.IntBuffer); + method public static void glLightf(int, int, float); + method public static void glLightfv(int, int, float[], int); + method public static void glLightfv(int, int, java.nio.FloatBuffer); + method public static void glLightx(int, int, int); + method public static void glLightxv(int, int, int[], int); + method public static void glLightxv(int, int, java.nio.IntBuffer); + method public static void glLineWidth(float); + method public static void glLineWidthx(int); + method public static void glLoadIdentity(); + method public static void glLoadMatrixf(float[], int); + method public static void glLoadMatrixf(java.nio.FloatBuffer); + method public static void glLoadMatrixx(int[], int); + method public static void glLoadMatrixx(java.nio.IntBuffer); + method public static void glLogicOp(int); + method public static void glMaterialf(int, int, float); + method public static void glMaterialfv(int, int, float[], int); + method public static void glMaterialfv(int, int, java.nio.FloatBuffer); + method public static void glMaterialx(int, int, int); + method public static void glMaterialxv(int, int, int[], int); + method public static void glMaterialxv(int, int, java.nio.IntBuffer); + method public static void glMatrixMode(int); + method public static void glMultMatrixf(float[], int); + method public static void glMultMatrixf(java.nio.FloatBuffer); + method public static void glMultMatrixx(int[], int); + method public static void glMultMatrixx(java.nio.IntBuffer); + method public static void glMultiTexCoord4f(int, float, float, float, float); + method public static void glMultiTexCoord4x(int, int, int, int, int); + method public static void glNormal3f(float, float, float); + method public static void glNormal3x(int, int, int); + method public static void glNormalPointer(int, int, java.nio.Buffer); + method public static void glOrthof(float, float, float, float, float, float); + method public static void glOrthox(int, int, int, int, int, int); + method public static void glPixelStorei(int, int); + method public static void glPointSize(float); + method public static void glPointSizex(int); + method public static void glPolygonOffset(float, float); + method public static void glPolygonOffsetx(int, int); + method public static void glPopMatrix(); + method public static void glPushMatrix(); + method public static void glReadPixels(int, int, int, int, int, int, java.nio.Buffer); + method public static void glRotatef(float, float, float, float); + method public static void glRotatex(int, int, int, int); + method public static void glSampleCoverage(float, boolean); + method public static void glSampleCoveragex(int, boolean); + method public static void glScalef(float, float, float); + method public static void glScalex(int, int, int); + method public static void glScissor(int, int, int, int); + method public static void glShadeModel(int); + method public static void glStencilFunc(int, int, int); + method public static void glStencilMask(int); + method public static void glStencilOp(int, int, int); + method public static void glTexCoordPointer(int, int, int, java.nio.Buffer); + method public static void glTexEnvf(int, int, float); + method public static void glTexEnvfv(int, int, float[], int); + method public static void glTexEnvfv(int, int, java.nio.FloatBuffer); + method public static void glTexEnvx(int, int, int); + method public static void glTexEnvxv(int, int, int[], int); + method public static void glTexEnvxv(int, int, java.nio.IntBuffer); + method public static void glTexImage2D(int, int, int, int, int, int, int, int, java.nio.Buffer); + method public static void glTexParameterf(int, int, float); + method public static void glTexParameterx(int, int, int); + method public static void glTexSubImage2D(int, int, int, int, int, int, int, int, java.nio.Buffer); + method public static void glTranslatef(float, float, float); + method public static void glTranslatex(int, int, int); + method public static void glVertexPointer(int, int, int, java.nio.Buffer); + method public static void glViewport(int, int, int, int); + field public static final int GL_ADD = 260; // 0x104 + field public static final int GL_ALIASED_LINE_WIDTH_RANGE = 33902; // 0x846e + field public static final int GL_ALIASED_POINT_SIZE_RANGE = 33901; // 0x846d + field public static final int GL_ALPHA = 6406; // 0x1906 + field public static final int GL_ALPHA_BITS = 3413; // 0xd55 + field public static final int GL_ALPHA_TEST = 3008; // 0xbc0 + field public static final int GL_ALWAYS = 519; // 0x207 + field public static final int GL_AMBIENT = 4608; // 0x1200 + field public static final int GL_AMBIENT_AND_DIFFUSE = 5634; // 0x1602 + field public static final int GL_AND = 5377; // 0x1501 + field public static final int GL_AND_INVERTED = 5380; // 0x1504 + field public static final int GL_AND_REVERSE = 5378; // 0x1502 + field public static final int GL_BACK = 1029; // 0x405 + field public static final int GL_BLEND = 3042; // 0xbe2 + field public static final int GL_BLUE_BITS = 3412; // 0xd54 + field public static final int GL_BYTE = 5120; // 0x1400 + field public static final int GL_CCW = 2305; // 0x901 + field public static final int GL_CLAMP_TO_EDGE = 33071; // 0x812f + field public static final int GL_CLEAR = 5376; // 0x1500 + field public static final int GL_COLOR_ARRAY = 32886; // 0x8076 + field public static final int GL_COLOR_BUFFER_BIT = 16384; // 0x4000 + field public static final int GL_COLOR_LOGIC_OP = 3058; // 0xbf2 + field public static final int GL_COLOR_MATERIAL = 2903; // 0xb57 + field public static final int GL_COMPRESSED_TEXTURE_FORMATS = 34467; // 0x86a3 + field public static final int GL_CONSTANT_ATTENUATION = 4615; // 0x1207 + field public static final int GL_COPY = 5379; // 0x1503 + field public static final int GL_COPY_INVERTED = 5388; // 0x150c + field public static final int GL_CULL_FACE = 2884; // 0xb44 + field public static final int GL_CW = 2304; // 0x900 + field public static final int GL_DECAL = 8449; // 0x2101 + field public static final int GL_DECR = 7683; // 0x1e03 + field public static final int GL_DEPTH_BITS = 3414; // 0xd56 + field public static final int GL_DEPTH_BUFFER_BIT = 256; // 0x100 + field public static final int GL_DEPTH_TEST = 2929; // 0xb71 + field public static final int GL_DIFFUSE = 4609; // 0x1201 + field public static final int GL_DITHER = 3024; // 0xbd0 + field public static final int GL_DONT_CARE = 4352; // 0x1100 + field public static final int GL_DST_ALPHA = 772; // 0x304 + field public static final int GL_DST_COLOR = 774; // 0x306 + field public static final int GL_EMISSION = 5632; // 0x1600 + field public static final int GL_EQUAL = 514; // 0x202 + field public static final int GL_EQUIV = 5385; // 0x1509 + field public static final int GL_EXP = 2048; // 0x800 + field public static final int GL_EXP2 = 2049; // 0x801 + field public static final int GL_EXTENSIONS = 7939; // 0x1f03 + field public static final int GL_FALSE = 0; // 0x0 + field public static final int GL_FASTEST = 4353; // 0x1101 + field public static final int GL_FIXED = 5132; // 0x140c + field public static final int GL_FLAT = 7424; // 0x1d00 + field public static final int GL_FLOAT = 5126; // 0x1406 + field public static final int GL_FOG = 2912; // 0xb60 + field public static final int GL_FOG_COLOR = 2918; // 0xb66 + field public static final int GL_FOG_DENSITY = 2914; // 0xb62 + field public static final int GL_FOG_END = 2916; // 0xb64 + field public static final int GL_FOG_HINT = 3156; // 0xc54 + field public static final int GL_FOG_MODE = 2917; // 0xb65 + field public static final int GL_FOG_START = 2915; // 0xb63 + field public static final int GL_FRONT = 1028; // 0x404 + field public static final int GL_FRONT_AND_BACK = 1032; // 0x408 + field public static final int GL_GEQUAL = 518; // 0x206 + field public static final int GL_GREATER = 516; // 0x204 + field public static final int GL_GREEN_BITS = 3411; // 0xd53 + field public static final int GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES = 35739; // 0x8b9b + field public static final int GL_IMPLEMENTATION_COLOR_READ_TYPE_OES = 35738; // 0x8b9a + field public static final int GL_INCR = 7682; // 0x1e02 + field public static final int GL_INVALID_ENUM = 1280; // 0x500 + field public static final int GL_INVALID_OPERATION = 1282; // 0x502 + field public static final int GL_INVALID_VALUE = 1281; // 0x501 + field public static final int GL_INVERT = 5386; // 0x150a + field public static final int GL_KEEP = 7680; // 0x1e00 + field public static final int GL_LEQUAL = 515; // 0x203 + field public static final int GL_LESS = 513; // 0x201 + field public static final int GL_LIGHT0 = 16384; // 0x4000 + field public static final int GL_LIGHT1 = 16385; // 0x4001 + field public static final int GL_LIGHT2 = 16386; // 0x4002 + field public static final int GL_LIGHT3 = 16387; // 0x4003 + field public static final int GL_LIGHT4 = 16388; // 0x4004 + field public static final int GL_LIGHT5 = 16389; // 0x4005 + field public static final int GL_LIGHT6 = 16390; // 0x4006 + field public static final int GL_LIGHT7 = 16391; // 0x4007 + field public static final int GL_LIGHTING = 2896; // 0xb50 + field public static final int GL_LIGHT_MODEL_AMBIENT = 2899; // 0xb53 + field public static final int GL_LIGHT_MODEL_TWO_SIDE = 2898; // 0xb52 + field public static final int GL_LINEAR = 9729; // 0x2601 + field public static final int GL_LINEAR_ATTENUATION = 4616; // 0x1208 + field public static final int GL_LINEAR_MIPMAP_LINEAR = 9987; // 0x2703 + field public static final int GL_LINEAR_MIPMAP_NEAREST = 9985; // 0x2701 + field public static final int GL_LINES = 1; // 0x1 + field public static final int GL_LINE_LOOP = 2; // 0x2 + field public static final int GL_LINE_SMOOTH = 2848; // 0xb20 + field public static final int GL_LINE_SMOOTH_HINT = 3154; // 0xc52 + field public static final int GL_LINE_STRIP = 3; // 0x3 + field public static final int GL_LUMINANCE = 6409; // 0x1909 + field public static final int GL_LUMINANCE_ALPHA = 6410; // 0x190a + field public static final int GL_MAX_ELEMENTS_INDICES = 33001; // 0x80e9 + field public static final int GL_MAX_ELEMENTS_VERTICES = 33000; // 0x80e8 + field public static final int GL_MAX_LIGHTS = 3377; // 0xd31 + field public static final int GL_MAX_MODELVIEW_STACK_DEPTH = 3382; // 0xd36 + field public static final int GL_MAX_PROJECTION_STACK_DEPTH = 3384; // 0xd38 + field public static final int GL_MAX_TEXTURE_SIZE = 3379; // 0xd33 + field public static final int GL_MAX_TEXTURE_STACK_DEPTH = 3385; // 0xd39 + field public static final int GL_MAX_TEXTURE_UNITS = 34018; // 0x84e2 + field public static final int GL_MAX_VIEWPORT_DIMS = 3386; // 0xd3a + field public static final int GL_MODELVIEW = 5888; // 0x1700 + field public static final int GL_MODULATE = 8448; // 0x2100 + field public static final int GL_MULTISAMPLE = 32925; // 0x809d + field public static final int GL_NAND = 5390; // 0x150e + field public static final int GL_NEAREST = 9728; // 0x2600 + field public static final int GL_NEAREST_MIPMAP_LINEAR = 9986; // 0x2702 + field public static final int GL_NEAREST_MIPMAP_NEAREST = 9984; // 0x2700 + field public static final int GL_NEVER = 512; // 0x200 + field public static final int GL_NICEST = 4354; // 0x1102 + field public static final int GL_NOOP = 5381; // 0x1505 + field public static final int GL_NOR = 5384; // 0x1508 + field public static final int GL_NORMALIZE = 2977; // 0xba1 + field public static final int GL_NORMAL_ARRAY = 32885; // 0x8075 + field public static final int GL_NOTEQUAL = 517; // 0x205 + field public static final int GL_NO_ERROR = 0; // 0x0 + field public static final int GL_NUM_COMPRESSED_TEXTURE_FORMATS = 34466; // 0x86a2 + field public static final int GL_ONE = 1; // 0x1 + field public static final int GL_ONE_MINUS_DST_ALPHA = 773; // 0x305 + field public static final int GL_ONE_MINUS_DST_COLOR = 775; // 0x307 + field public static final int GL_ONE_MINUS_SRC_ALPHA = 771; // 0x303 + field public static final int GL_ONE_MINUS_SRC_COLOR = 769; // 0x301 + field public static final int GL_OR = 5383; // 0x1507 + field public static final int GL_OR_INVERTED = 5389; // 0x150d + field public static final int GL_OR_REVERSE = 5387; // 0x150b + field public static final int GL_OUT_OF_MEMORY = 1285; // 0x505 + field public static final int GL_PACK_ALIGNMENT = 3333; // 0xd05 + field public static final int GL_PALETTE4_R5_G6_B5_OES = 35730; // 0x8b92 + field public static final int GL_PALETTE4_RGB5_A1_OES = 35732; // 0x8b94 + field public static final int GL_PALETTE4_RGB8_OES = 35728; // 0x8b90 + field public static final int GL_PALETTE4_RGBA4_OES = 35731; // 0x8b93 + field public static final int GL_PALETTE4_RGBA8_OES = 35729; // 0x8b91 + field public static final int GL_PALETTE8_R5_G6_B5_OES = 35735; // 0x8b97 + field public static final int GL_PALETTE8_RGB5_A1_OES = 35737; // 0x8b99 + field public static final int GL_PALETTE8_RGB8_OES = 35733; // 0x8b95 + field public static final int GL_PALETTE8_RGBA4_OES = 35736; // 0x8b98 + field public static final int GL_PALETTE8_RGBA8_OES = 35734; // 0x8b96 + field public static final int GL_PERSPECTIVE_CORRECTION_HINT = 3152; // 0xc50 + field public static final int GL_POINTS = 0; // 0x0 + field public static final int GL_POINT_FADE_THRESHOLD_SIZE = 33064; // 0x8128 + field public static final int GL_POINT_SIZE = 2833; // 0xb11 + field public static final int GL_POINT_SMOOTH = 2832; // 0xb10 + field public static final int GL_POINT_SMOOTH_HINT = 3153; // 0xc51 + field public static final int GL_POLYGON_OFFSET_FILL = 32823; // 0x8037 + field public static final int GL_POLYGON_SMOOTH_HINT = 3155; // 0xc53 + field public static final int GL_POSITION = 4611; // 0x1203 + field public static final int GL_PROJECTION = 5889; // 0x1701 + field public static final int GL_QUADRATIC_ATTENUATION = 4617; // 0x1209 + field public static final int GL_RED_BITS = 3410; // 0xd52 + field public static final int GL_RENDERER = 7937; // 0x1f01 + field public static final int GL_REPEAT = 10497; // 0x2901 + field public static final int GL_REPLACE = 7681; // 0x1e01 + field public static final int GL_RESCALE_NORMAL = 32826; // 0x803a + field public static final int GL_RGB = 6407; // 0x1907 + field public static final int GL_RGBA = 6408; // 0x1908 + field public static final int GL_SAMPLE_ALPHA_TO_COVERAGE = 32926; // 0x809e + field public static final int GL_SAMPLE_ALPHA_TO_ONE = 32927; // 0x809f + field public static final int GL_SAMPLE_COVERAGE = 32928; // 0x80a0 + field public static final int GL_SCISSOR_TEST = 3089; // 0xc11 + field public static final int GL_SET = 5391; // 0x150f + field public static final int GL_SHININESS = 5633; // 0x1601 + field public static final int GL_SHORT = 5122; // 0x1402 + field public static final int GL_SMOOTH = 7425; // 0x1d01 + field public static final int GL_SMOOTH_LINE_WIDTH_RANGE = 2850; // 0xb22 + field public static final int GL_SMOOTH_POINT_SIZE_RANGE = 2834; // 0xb12 + field public static final int GL_SPECULAR = 4610; // 0x1202 + field public static final int GL_SPOT_CUTOFF = 4614; // 0x1206 + field public static final int GL_SPOT_DIRECTION = 4612; // 0x1204 + field public static final int GL_SPOT_EXPONENT = 4613; // 0x1205 + field public static final int GL_SRC_ALPHA = 770; // 0x302 + field public static final int GL_SRC_ALPHA_SATURATE = 776; // 0x308 + field public static final int GL_SRC_COLOR = 768; // 0x300 + field public static final int GL_STACK_OVERFLOW = 1283; // 0x503 + field public static final int GL_STACK_UNDERFLOW = 1284; // 0x504 + field public static final int GL_STENCIL_BITS = 3415; // 0xd57 + field public static final int GL_STENCIL_BUFFER_BIT = 1024; // 0x400 + field public static final int GL_STENCIL_TEST = 2960; // 0xb90 + field public static final int GL_SUBPIXEL_BITS = 3408; // 0xd50 + field public static final int GL_TEXTURE = 5890; // 0x1702 + field public static final int GL_TEXTURE0 = 33984; // 0x84c0 + field public static final int GL_TEXTURE1 = 33985; // 0x84c1 + field public static final int GL_TEXTURE10 = 33994; // 0x84ca + field public static final int GL_TEXTURE11 = 33995; // 0x84cb + field public static final int GL_TEXTURE12 = 33996; // 0x84cc + field public static final int GL_TEXTURE13 = 33997; // 0x84cd + field public static final int GL_TEXTURE14 = 33998; // 0x84ce + field public static final int GL_TEXTURE15 = 33999; // 0x84cf + field public static final int GL_TEXTURE16 = 34000; // 0x84d0 + field public static final int GL_TEXTURE17 = 34001; // 0x84d1 + field public static final int GL_TEXTURE18 = 34002; // 0x84d2 + field public static final int GL_TEXTURE19 = 34003; // 0x84d3 + field public static final int GL_TEXTURE2 = 33986; // 0x84c2 + field public static final int GL_TEXTURE20 = 34004; // 0x84d4 + field public static final int GL_TEXTURE21 = 34005; // 0x84d5 + field public static final int GL_TEXTURE22 = 34006; // 0x84d6 + field public static final int GL_TEXTURE23 = 34007; // 0x84d7 + field public static final int GL_TEXTURE24 = 34008; // 0x84d8 + field public static final int GL_TEXTURE25 = 34009; // 0x84d9 + field public static final int GL_TEXTURE26 = 34010; // 0x84da + field public static final int GL_TEXTURE27 = 34011; // 0x84db + field public static final int GL_TEXTURE28 = 34012; // 0x84dc + field public static final int GL_TEXTURE29 = 34013; // 0x84dd + field public static final int GL_TEXTURE3 = 33987; // 0x84c3 + field public static final int GL_TEXTURE30 = 34014; // 0x84de + field public static final int GL_TEXTURE31 = 34015; // 0x84df + field public static final int GL_TEXTURE4 = 33988; // 0x84c4 + field public static final int GL_TEXTURE5 = 33989; // 0x84c5 + field public static final int GL_TEXTURE6 = 33990; // 0x84c6 + field public static final int GL_TEXTURE7 = 33991; // 0x84c7 + field public static final int GL_TEXTURE8 = 33992; // 0x84c8 + field public static final int GL_TEXTURE9 = 33993; // 0x84c9 + field public static final int GL_TEXTURE_2D = 3553; // 0xde1 + field public static final int GL_TEXTURE_COORD_ARRAY = 32888; // 0x8078 + field public static final int GL_TEXTURE_ENV = 8960; // 0x2300 + field public static final int GL_TEXTURE_ENV_COLOR = 8705; // 0x2201 + field public static final int GL_TEXTURE_ENV_MODE = 8704; // 0x2200 + field public static final int GL_TEXTURE_MAG_FILTER = 10240; // 0x2800 + field public static final int GL_TEXTURE_MIN_FILTER = 10241; // 0x2801 + field public static final int GL_TEXTURE_WRAP_S = 10242; // 0x2802 + field public static final int GL_TEXTURE_WRAP_T = 10243; // 0x2803 + field public static final int GL_TRIANGLES = 4; // 0x4 + field public static final int GL_TRIANGLE_FAN = 6; // 0x6 + field public static final int GL_TRIANGLE_STRIP = 5; // 0x5 + field public static final int GL_TRUE = 1; // 0x1 + field public static final int GL_UNPACK_ALIGNMENT = 3317; // 0xcf5 + field public static final int GL_UNSIGNED_BYTE = 5121; // 0x1401 + field public static final int GL_UNSIGNED_SHORT = 5123; // 0x1403 + field public static final int GL_UNSIGNED_SHORT_4_4_4_4 = 32819; // 0x8033 + field public static final int GL_UNSIGNED_SHORT_5_5_5_1 = 32820; // 0x8034 + field public static final int GL_UNSIGNED_SHORT_5_6_5 = 33635; // 0x8363 + field public static final int GL_VENDOR = 7936; // 0x1f00 + field public static final int GL_VERSION = 7938; // 0x1f02 + field public static final int GL_VERTEX_ARRAY = 32884; // 0x8074 + field public static final int GL_XOR = 5382; // 0x1506 + field public static final int GL_ZERO = 0; // 0x0 + } + + public class GLES10Ext { + ctor public GLES10Ext(); + method public static int glQueryMatrixxOES(int[], int, int[], int); + method public static int glQueryMatrixxOES(java.nio.IntBuffer, java.nio.IntBuffer); + } + + public class GLES11 extends android.opengl.GLES10 { + ctor public GLES11(); + method public static void glBindBuffer(int, int); + method public static void glBufferData(int, int, java.nio.Buffer, int); + method public static void glBufferSubData(int, int, int, java.nio.Buffer); + method public static void glClipPlanef(int, float[], int); + method public static void glClipPlanef(int, java.nio.FloatBuffer); + method public static void glClipPlanex(int, int[], int); + method public static void glClipPlanex(int, java.nio.IntBuffer); + method public static void glColor4ub(byte, byte, byte, byte); + method public static void glColorPointer(int, int, int, int); + method public static void glDeleteBuffers(int, int[], int); + method public static void glDeleteBuffers(int, java.nio.IntBuffer); + method public static void glDrawElements(int, int, int, int); + method public static void glGenBuffers(int, int[], int); + method public static void glGenBuffers(int, java.nio.IntBuffer); + method public static void glGetBooleanv(int, boolean[], int); + method public static void glGetBooleanv(int, java.nio.IntBuffer); + method public static void glGetBufferParameteriv(int, int, int[], int); + method public static void glGetBufferParameteriv(int, int, java.nio.IntBuffer); + method public static void glGetClipPlanef(int, float[], int); + method public static void glGetClipPlanef(int, java.nio.FloatBuffer); + method public static void glGetClipPlanex(int, int[], int); + method public static void glGetClipPlanex(int, java.nio.IntBuffer); + method public static void glGetFixedv(int, int[], int); + method public static void glGetFixedv(int, java.nio.IntBuffer); + method public static void glGetFloatv(int, float[], int); + method public static void glGetFloatv(int, java.nio.FloatBuffer); + method public static void glGetLightfv(int, int, float[], int); + method public static void glGetLightfv(int, int, java.nio.FloatBuffer); + method public static void glGetLightxv(int, int, int[], int); + method public static void glGetLightxv(int, int, java.nio.IntBuffer); + method public static void glGetMaterialfv(int, int, float[], int); + method public static void glGetMaterialfv(int, int, java.nio.FloatBuffer); + method public static void glGetMaterialxv(int, int, int[], int); + method public static void glGetMaterialxv(int, int, java.nio.IntBuffer); + method public static void glGetTexEnvfv(int, int, float[], int); + method public static void glGetTexEnvfv(int, int, java.nio.FloatBuffer); + method public static void glGetTexEnviv(int, int, int[], int); + method public static void glGetTexEnviv(int, int, java.nio.IntBuffer); + method public static void glGetTexEnvxv(int, int, int[], int); + method public static void glGetTexEnvxv(int, int, java.nio.IntBuffer); + method public static void glGetTexParameterfv(int, int, float[], int); + method public static void glGetTexParameterfv(int, int, java.nio.FloatBuffer); + method public static void glGetTexParameteriv(int, int, int[], int); + method public static void glGetTexParameteriv(int, int, java.nio.IntBuffer); + method public static void glGetTexParameterxv(int, int, int[], int); + method public static void glGetTexParameterxv(int, int, java.nio.IntBuffer); + method public static boolean glIsBuffer(int); + method public static boolean glIsEnabled(int); + method public static boolean glIsTexture(int); + method public static void glNormalPointer(int, int, int); + method public static void glPointParameterf(int, float); + method public static void glPointParameterfv(int, float[], int); + method public static void glPointParameterfv(int, java.nio.FloatBuffer); + method public static void glPointParameterx(int, int); + method public static void glPointParameterxv(int, int[], int); + method public static void glPointParameterxv(int, java.nio.IntBuffer); + method public static void glPointSizePointerOES(int, int, java.nio.Buffer); + method public static void glTexCoordPointer(int, int, int, int); + method public static void glTexEnvi(int, int, int); + method public static void glTexEnviv(int, int, int[], int); + method public static void glTexEnviv(int, int, java.nio.IntBuffer); + method public static void glTexParameterfv(int, int, float[], int); + method public static void glTexParameterfv(int, int, java.nio.FloatBuffer); + method public static void glTexParameteri(int, int, int); + method public static void glTexParameteriv(int, int, int[], int); + method public static void glTexParameteriv(int, int, java.nio.IntBuffer); + method public static void glTexParameterxv(int, int, int[], int); + method public static void glTexParameterxv(int, int, java.nio.IntBuffer); + method public static void glVertexPointer(int, int, int, int); + field public static final int GL_ACTIVE_TEXTURE = 34016; // 0x84e0 + field public static final int GL_ADD_SIGNED = 34164; // 0x8574 + field public static final int GL_ALPHA_SCALE = 3356; // 0xd1c + field public static final int GL_ALPHA_TEST_FUNC = 3009; // 0xbc1 + field public static final int GL_ALPHA_TEST_REF = 3010; // 0xbc2 + field public static final int GL_ARRAY_BUFFER = 34962; // 0x8892 + field public static final int GL_ARRAY_BUFFER_BINDING = 34964; // 0x8894 + field public static final int GL_BLEND_DST = 3040; // 0xbe0 + field public static final int GL_BLEND_SRC = 3041; // 0xbe1 + field public static final int GL_BUFFER_ACCESS = 35003; // 0x88bb + field public static final int GL_BUFFER_SIZE = 34660; // 0x8764 + field public static final int GL_BUFFER_USAGE = 34661; // 0x8765 + field public static final int GL_CLIENT_ACTIVE_TEXTURE = 34017; // 0x84e1 + field public static final int GL_CLIP_PLANE0 = 12288; // 0x3000 + field public static final int GL_CLIP_PLANE1 = 12289; // 0x3001 + field public static final int GL_CLIP_PLANE2 = 12290; // 0x3002 + field public static final int GL_CLIP_PLANE3 = 12291; // 0x3003 + field public static final int GL_CLIP_PLANE4 = 12292; // 0x3004 + field public static final int GL_CLIP_PLANE5 = 12293; // 0x3005 + field public static final int GL_COLOR_ARRAY_BUFFER_BINDING = 34968; // 0x8898 + field public static final int GL_COLOR_ARRAY_POINTER = 32912; // 0x8090 + field public static final int GL_COLOR_ARRAY_SIZE = 32897; // 0x8081 + field public static final int GL_COLOR_ARRAY_STRIDE = 32899; // 0x8083 + field public static final int GL_COLOR_ARRAY_TYPE = 32898; // 0x8082 + field public static final int GL_COLOR_CLEAR_VALUE = 3106; // 0xc22 + field public static final int GL_COLOR_WRITEMASK = 3107; // 0xc23 + field public static final int GL_COMBINE = 34160; // 0x8570 + field public static final int GL_COMBINE_ALPHA = 34162; // 0x8572 + field public static final int GL_COMBINE_RGB = 34161; // 0x8571 + field public static final int GL_CONSTANT = 34166; // 0x8576 + field public static final int GL_COORD_REPLACE_OES = 34914; // 0x8862 + field public static final int GL_CULL_FACE_MODE = 2885; // 0xb45 + field public static final int GL_CURRENT_COLOR = 2816; // 0xb00 + field public static final int GL_CURRENT_NORMAL = 2818; // 0xb02 + field public static final int GL_CURRENT_TEXTURE_COORDS = 2819; // 0xb03 + field public static final int GL_DEPTH_CLEAR_VALUE = 2931; // 0xb73 + field public static final int GL_DEPTH_FUNC = 2932; // 0xb74 + field public static final int GL_DEPTH_RANGE = 2928; // 0xb70 + field public static final int GL_DEPTH_WRITEMASK = 2930; // 0xb72 + field public static final int GL_DOT3_RGB = 34478; // 0x86ae + field public static final int GL_DOT3_RGBA = 34479; // 0x86af + field public static final int GL_DYNAMIC_DRAW = 35048; // 0x88e8 + field public static final int GL_ELEMENT_ARRAY_BUFFER = 34963; // 0x8893 + field public static final int GL_ELEMENT_ARRAY_BUFFER_BINDING = 34965; // 0x8895 + field public static final int GL_FRONT_FACE = 2886; // 0xb46 + field public static final int GL_GENERATE_MIPMAP = 33169; // 0x8191 + field public static final int GL_GENERATE_MIPMAP_HINT = 33170; // 0x8192 + field public static final int GL_INTERPOLATE = 34165; // 0x8575 + field public static final int GL_LINE_WIDTH = 2849; // 0xb21 + field public static final int GL_LOGIC_OP_MODE = 3056; // 0xbf0 + field public static final int GL_MATRIX_MODE = 2976; // 0xba0 + field public static final int GL_MAX_CLIP_PLANES = 3378; // 0xd32 + field public static final int GL_MODELVIEW_MATRIX = 2982; // 0xba6 + field public static final int GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES = 35213; // 0x898d + field public static final int GL_MODELVIEW_STACK_DEPTH = 2979; // 0xba3 + field public static final int GL_NORMAL_ARRAY_BUFFER_BINDING = 34967; // 0x8897 + field public static final int GL_NORMAL_ARRAY_POINTER = 32911; // 0x808f + field public static final int GL_NORMAL_ARRAY_STRIDE = 32895; // 0x807f + field public static final int GL_NORMAL_ARRAY_TYPE = 32894; // 0x807e + field public static final int GL_OPERAND0_ALPHA = 34200; // 0x8598 + field public static final int GL_OPERAND0_RGB = 34192; // 0x8590 + field public static final int GL_OPERAND1_ALPHA = 34201; // 0x8599 + field public static final int GL_OPERAND1_RGB = 34193; // 0x8591 + field public static final int GL_OPERAND2_ALPHA = 34202; // 0x859a + field public static final int GL_OPERAND2_RGB = 34194; // 0x8592 + field public static final int GL_POINT_DISTANCE_ATTENUATION = 33065; // 0x8129 + field public static final int GL_POINT_FADE_THRESHOLD_SIZE = 33064; // 0x8128 + field public static final int GL_POINT_SIZE = 2833; // 0xb11 + field public static final int GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES = 35743; // 0x8b9f + field public static final int GL_POINT_SIZE_ARRAY_OES = 35740; // 0x8b9c + field public static final int GL_POINT_SIZE_ARRAY_POINTER_OES = 35212; // 0x898c + field public static final int GL_POINT_SIZE_ARRAY_STRIDE_OES = 35211; // 0x898b + field public static final int GL_POINT_SIZE_ARRAY_TYPE_OES = 35210; // 0x898a + field public static final int GL_POINT_SIZE_MAX = 33063; // 0x8127 + field public static final int GL_POINT_SIZE_MIN = 33062; // 0x8126 + field public static final int GL_POINT_SPRITE_OES = 34913; // 0x8861 + field public static final int GL_POLYGON_OFFSET_FACTOR = 32824; // 0x8038 + field public static final int GL_POLYGON_OFFSET_UNITS = 10752; // 0x2a00 + field public static final int GL_PREVIOUS = 34168; // 0x8578 + field public static final int GL_PRIMARY_COLOR = 34167; // 0x8577 + field public static final int GL_PROJECTION_MATRIX = 2983; // 0xba7 + field public static final int GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES = 35214; // 0x898e + field public static final int GL_PROJECTION_STACK_DEPTH = 2980; // 0xba4 + field public static final int GL_RGB_SCALE = 34163; // 0x8573 + field public static final int GL_SAMPLES = 32937; // 0x80a9 + field public static final int GL_SAMPLE_BUFFERS = 32936; // 0x80a8 + field public static final int GL_SAMPLE_COVERAGE_INVERT = 32939; // 0x80ab + field public static final int GL_SAMPLE_COVERAGE_VALUE = 32938; // 0x80aa + field public static final int GL_SCISSOR_BOX = 3088; // 0xc10 + field public static final int GL_SHADE_MODEL = 2900; // 0xb54 + field public static final int GL_SRC0_ALPHA = 34184; // 0x8588 + field public static final int GL_SRC0_RGB = 34176; // 0x8580 + field public static final int GL_SRC1_ALPHA = 34185; // 0x8589 + field public static final int GL_SRC1_RGB = 34177; // 0x8581 + field public static final int GL_SRC2_ALPHA = 34186; // 0x858a + field public static final int GL_SRC2_RGB = 34178; // 0x8582 + field public static final int GL_STATIC_DRAW = 35044; // 0x88e4 + field public static final int GL_STENCIL_CLEAR_VALUE = 2961; // 0xb91 + field public static final int GL_STENCIL_FAIL = 2964; // 0xb94 + field public static final int GL_STENCIL_FUNC = 2962; // 0xb92 + field public static final int GL_STENCIL_PASS_DEPTH_FAIL = 2965; // 0xb95 + field public static final int GL_STENCIL_PASS_DEPTH_PASS = 2966; // 0xb96 + field public static final int GL_STENCIL_REF = 2967; // 0xb97 + field public static final int GL_STENCIL_VALUE_MASK = 2963; // 0xb93 + field public static final int GL_STENCIL_WRITEMASK = 2968; // 0xb98 + field public static final int GL_SUBTRACT = 34023; // 0x84e7 + field public static final int GL_TEXTURE_BINDING_2D = 32873; // 0x8069 + field public static final int GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING = 34970; // 0x889a + field public static final int GL_TEXTURE_COORD_ARRAY_POINTER = 32914; // 0x8092 + field public static final int GL_TEXTURE_COORD_ARRAY_SIZE = 32904; // 0x8088 + field public static final int GL_TEXTURE_COORD_ARRAY_STRIDE = 32906; // 0x808a + field public static final int GL_TEXTURE_COORD_ARRAY_TYPE = 32905; // 0x8089 + field public static final int GL_TEXTURE_MATRIX = 2984; // 0xba8 + field public static final int GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES = 35215; // 0x898f + field public static final int GL_TEXTURE_STACK_DEPTH = 2981; // 0xba5 + field public static final int GL_VERTEX_ARRAY_BUFFER_BINDING = 34966; // 0x8896 + field public static final int GL_VERTEX_ARRAY_POINTER = 32910; // 0x808e + field public static final int GL_VERTEX_ARRAY_SIZE = 32890; // 0x807a + field public static final int GL_VERTEX_ARRAY_STRIDE = 32892; // 0x807c + field public static final int GL_VERTEX_ARRAY_TYPE = 32891; // 0x807b + field public static final int GL_VIEWPORT = 2978; // 0xba2 + field public static final int GL_WRITE_ONLY = 35001; // 0x88b9 + } + + public class GLES11Ext { + ctor public GLES11Ext(); + method public static void glAlphaFuncxOES(int, int); + method public static void glBindFramebufferOES(int, int); + method public static void glBindRenderbufferOES(int, int); + method public static void glBlendEquationOES(int); + method public static void glBlendEquationSeparateOES(int, int); + method public static void glBlendFuncSeparateOES(int, int, int, int); + method public static int glCheckFramebufferStatusOES(int); + method public static void glClearColorxOES(int, int, int, int); + method public static void glClearDepthfOES(float); + method public static void glClearDepthxOES(int); + method public static void glClipPlanefOES(int, float[], int); + method public static void glClipPlanefOES(int, java.nio.FloatBuffer); + method public static void glClipPlanexOES(int, int[], int); + method public static void glClipPlanexOES(int, java.nio.IntBuffer); + method public static void glColor4xOES(int, int, int, int); + method public static void glCurrentPaletteMatrixOES(int); + method public static void glDeleteFramebuffersOES(int, int[], int); + method public static void glDeleteFramebuffersOES(int, java.nio.IntBuffer); + method public static void glDeleteRenderbuffersOES(int, int[], int); + method public static void glDeleteRenderbuffersOES(int, java.nio.IntBuffer); + method public static void glDepthRangefOES(float, float); + method public static void glDepthRangexOES(int, int); + method public static void glDrawTexfOES(float, float, float, float, float); + method public static void glDrawTexfvOES(float[], int); + method public static void glDrawTexfvOES(java.nio.FloatBuffer); + method public static void glDrawTexiOES(int, int, int, int, int); + method public static void glDrawTexivOES(int[], int); + method public static void glDrawTexivOES(java.nio.IntBuffer); + method public static void glDrawTexsOES(short, short, short, short, short); + method public static void glDrawTexsvOES(short[], int); + method public static void glDrawTexsvOES(java.nio.ShortBuffer); + method public static void glDrawTexxOES(int, int, int, int, int); + method public static void glDrawTexxvOES(int[], int); + method public static void glDrawTexxvOES(java.nio.IntBuffer); + method public static void glEGLImageTargetRenderbufferStorageOES(int, java.nio.Buffer); + method public static void glEGLImageTargetTexture2DOES(int, java.nio.Buffer); + method public static void glFogxOES(int, int); + method public static void glFogxvOES(int, int[], int); + method public static void glFogxvOES(int, java.nio.IntBuffer); + method public static void glFramebufferRenderbufferOES(int, int, int, int); + method public static void glFramebufferTexture2DOES(int, int, int, int, int); + method public static void glFrustumfOES(float, float, float, float, float, float); + method public static void glFrustumxOES(int, int, int, int, int, int); + method public static void glGenFramebuffersOES(int, int[], int); + method public static void glGenFramebuffersOES(int, java.nio.IntBuffer); + method public static void glGenRenderbuffersOES(int, int[], int); + method public static void glGenRenderbuffersOES(int, java.nio.IntBuffer); + method public static void glGenerateMipmapOES(int); + method public static void glGetClipPlanefOES(int, float[], int); + method public static void glGetClipPlanefOES(int, java.nio.FloatBuffer); + method public static void glGetClipPlanexOES(int, int[], int); + method public static void glGetClipPlanexOES(int, java.nio.IntBuffer); + method public static void glGetFixedvOES(int, int[], int); + method public static void glGetFixedvOES(int, java.nio.IntBuffer); + method public static void glGetFramebufferAttachmentParameterivOES(int, int, int, int[], int); + method public static void glGetFramebufferAttachmentParameterivOES(int, int, int, java.nio.IntBuffer); + method public static void glGetLightxvOES(int, int, int[], int); + method public static void glGetLightxvOES(int, int, java.nio.IntBuffer); + method public static void glGetMaterialxvOES(int, int, int[], int); + method public static void glGetMaterialxvOES(int, int, java.nio.IntBuffer); + method public static void glGetRenderbufferParameterivOES(int, int, int[], int); + method public static void glGetRenderbufferParameterivOES(int, int, java.nio.IntBuffer); + method public static void glGetTexEnvxvOES(int, int, int[], int); + method public static void glGetTexEnvxvOES(int, int, java.nio.IntBuffer); + method public static void glGetTexGenfvOES(int, int, float[], int); + method public static void glGetTexGenfvOES(int, int, java.nio.FloatBuffer); + method public static void glGetTexGenivOES(int, int, int[], int); + method public static void glGetTexGenivOES(int, int, java.nio.IntBuffer); + method public static void glGetTexGenxvOES(int, int, int[], int); + method public static void glGetTexGenxvOES(int, int, java.nio.IntBuffer); + method public static void glGetTexParameterxvOES(int, int, int[], int); + method public static void glGetTexParameterxvOES(int, int, java.nio.IntBuffer); + method public static boolean glIsFramebufferOES(int); + method public static boolean glIsRenderbufferOES(int); + method public static void glLightModelxOES(int, int); + method public static void glLightModelxvOES(int, int[], int); + method public static void glLightModelxvOES(int, java.nio.IntBuffer); + method public static void glLightxOES(int, int, int); + method public static void glLightxvOES(int, int, int[], int); + method public static void glLightxvOES(int, int, java.nio.IntBuffer); + method public static void glLineWidthxOES(int); + method public static void glLoadMatrixxOES(int[], int); + method public static void glLoadMatrixxOES(java.nio.IntBuffer); + method public static void glLoadPaletteFromModelViewMatrixOES(); + method public static void glMaterialxOES(int, int, int); + method public static void glMaterialxvOES(int, int, int[], int); + method public static void glMaterialxvOES(int, int, java.nio.IntBuffer); + method public static void glMatrixIndexPointerOES(int, int, int, java.nio.Buffer); + method public static void glMultMatrixxOES(int[], int); + method public static void glMultMatrixxOES(java.nio.IntBuffer); + method public static void glMultiTexCoord4xOES(int, int, int, int, int); + method public static void glNormal3xOES(int, int, int); + method public static void glOrthofOES(float, float, float, float, float, float); + method public static void glOrthoxOES(int, int, int, int, int, int); + method public static void glPointParameterxOES(int, int); + method public static void glPointParameterxvOES(int, int[], int); + method public static void glPointParameterxvOES(int, java.nio.IntBuffer); + method public static void glPointSizexOES(int); + method public static void glPolygonOffsetxOES(int, int); + method public static void glRenderbufferStorageOES(int, int, int, int); + method public static void glRotatexOES(int, int, int, int); + method public static void glSampleCoveragexOES(int, boolean); + method public static void glScalexOES(int, int, int); + method public static void glTexEnvxOES(int, int, int); + method public static void glTexEnvxvOES(int, int, int[], int); + method public static void glTexEnvxvOES(int, int, java.nio.IntBuffer); + method public static void glTexGenfOES(int, int, float); + method public static void glTexGenfvOES(int, int, float[], int); + method public static void glTexGenfvOES(int, int, java.nio.FloatBuffer); + method public static void glTexGeniOES(int, int, int); + method public static void glTexGenivOES(int, int, int[], int); + method public static void glTexGenivOES(int, int, java.nio.IntBuffer); + method public static void glTexGenxOES(int, int, int); + method public static void glTexGenxvOES(int, int, int[], int); + method public static void glTexGenxvOES(int, int, java.nio.IntBuffer); + method public static void glTexParameterxOES(int, int, int); + method public static void glTexParameterxvOES(int, int, int[], int); + method public static void glTexParameterxvOES(int, int, java.nio.IntBuffer); + method public static void glTranslatexOES(int, int, int); + method public static void glWeightPointerOES(int, int, int, java.nio.Buffer); + field public static final int GL_3DC_XY_AMD = 34810; // 0x87fa + field public static final int GL_3DC_X_AMD = 34809; // 0x87f9 + field public static final int GL_ATC_RGBA_EXPLICIT_ALPHA_AMD = 35987; // 0x8c93 + field public static final int GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD = 34798; // 0x87ee + field public static final int GL_ATC_RGB_AMD = 35986; // 0x8c92 + field public static final int GL_BGRA = 32993; // 0x80e1 + field public static final int GL_BLEND_DST_ALPHA_OES = 32970; // 0x80ca + field public static final int GL_BLEND_DST_RGB_OES = 32968; // 0x80c8 + field public static final int GL_BLEND_EQUATION_ALPHA_OES = 34877; // 0x883d + field public static final int GL_BLEND_EQUATION_OES = 32777; // 0x8009 + field public static final int GL_BLEND_EQUATION_RGB_OES = 32777; // 0x8009 + field public static final int GL_BLEND_SRC_ALPHA_OES = 32971; // 0x80cb + field public static final int GL_BLEND_SRC_RGB_OES = 32969; // 0x80c9 + field public static final int GL_BUFFER_ACCESS_OES = 35003; // 0x88bb + field public static final int GL_BUFFER_MAPPED_OES = 35004; // 0x88bc + field public static final int GL_BUFFER_MAP_POINTER_OES = 35005; // 0x88bd + field public static final int GL_COLOR_ATTACHMENT0_OES = 36064; // 0x8ce0 + field public static final int GL_CURRENT_PALETTE_MATRIX_OES = 34883; // 0x8843 + field public static final int GL_DECR_WRAP_OES = 34056; // 0x8508 + field public static final int GL_DEPTH24_STENCIL8_OES = 35056; // 0x88f0 + field public static final int GL_DEPTH_ATTACHMENT_OES = 36096; // 0x8d00 + field public static final int GL_DEPTH_COMPONENT16_OES = 33189; // 0x81a5 + field public static final int GL_DEPTH_COMPONENT24_OES = 33190; // 0x81a6 + field public static final int GL_DEPTH_COMPONENT32_OES = 33191; // 0x81a7 + field public static final int GL_DEPTH_STENCIL_OES = 34041; // 0x84f9 + field public static final int GL_ETC1_RGB8_OES = 36196; // 0x8d64 + field public static final int GL_FIXED_OES = 5132; // 0x140c + field public static final int GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_OES = 36049; // 0x8cd1 + field public static final int GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_OES = 36048; // 0x8cd0 + field public static final int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_OES = 36051; // 0x8cd3 + field public static final int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_OES = 36050; // 0x8cd2 + field public static final int GL_FRAMEBUFFER_BINDING_OES = 36006; // 0x8ca6 + field public static final int GL_FRAMEBUFFER_COMPLETE_OES = 36053; // 0x8cd5 + field public static final int GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES = 36054; // 0x8cd6 + field public static final int GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES = 36057; // 0x8cd9 + field public static final int GL_FRAMEBUFFER_INCOMPLETE_FORMATS_OES = 36058; // 0x8cda + field public static final int GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES = 36055; // 0x8cd7 + field public static final int GL_FRAMEBUFFER_OES = 36160; // 0x8d40 + field public static final int GL_FRAMEBUFFER_UNSUPPORTED_OES = 36061; // 0x8cdd + field public static final int GL_FUNC_ADD_OES = 32774; // 0x8006 + field public static final int GL_FUNC_REVERSE_SUBTRACT_OES = 32779; // 0x800b + field public static final int GL_FUNC_SUBTRACT_OES = 32778; // 0x800a + field public static final int GL_INCR_WRAP_OES = 34055; // 0x8507 + field public static final int GL_INVALID_FRAMEBUFFER_OPERATION_OES = 1286; // 0x506 + field public static final int GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES = 35742; // 0x8b9e + field public static final int GL_MATRIX_INDEX_ARRAY_OES = 34884; // 0x8844 + field public static final int GL_MATRIX_INDEX_ARRAY_POINTER_OES = 34889; // 0x8849 + field public static final int GL_MATRIX_INDEX_ARRAY_SIZE_OES = 34886; // 0x8846 + field public static final int GL_MATRIX_INDEX_ARRAY_STRIDE_OES = 34888; // 0x8848 + field public static final int GL_MATRIX_INDEX_ARRAY_TYPE_OES = 34887; // 0x8847 + field public static final int GL_MATRIX_PALETTE_OES = 34880; // 0x8840 + field public static final int GL_MAX_CUBE_MAP_TEXTURE_SIZE_OES = 34076; // 0x851c + field public static final int GL_MAX_PALETTE_MATRICES_OES = 34882; // 0x8842 + field public static final int GL_MAX_RENDERBUFFER_SIZE_OES = 34024; // 0x84e8 + field public static final int GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT = 34047; // 0x84ff + field public static final int GL_MAX_VERTEX_UNITS_OES = 34468; // 0x86a4 + field public static final int GL_MIRRORED_REPEAT_OES = 33648; // 0x8370 + field public static final int GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES = 35213; // 0x898d + field public static final int GL_NONE_OES = 0; // 0x0 + field public static final int GL_NORMAL_MAP_OES = 34065; // 0x8511 + field public static final int GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES = 35214; // 0x898e + field public static final int GL_REFLECTION_MAP_OES = 34066; // 0x8512 + field public static final int GL_RENDERBUFFER_ALPHA_SIZE_OES = 36179; // 0x8d53 + field public static final int GL_RENDERBUFFER_BINDING_OES = 36007; // 0x8ca7 + field public static final int GL_RENDERBUFFER_BLUE_SIZE_OES = 36178; // 0x8d52 + field public static final int GL_RENDERBUFFER_DEPTH_SIZE_OES = 36180; // 0x8d54 + field public static final int GL_RENDERBUFFER_GREEN_SIZE_OES = 36177; // 0x8d51 + field public static final int GL_RENDERBUFFER_HEIGHT_OES = 36163; // 0x8d43 + field public static final int GL_RENDERBUFFER_INTERNAL_FORMAT_OES = 36164; // 0x8d44 + field public static final int GL_RENDERBUFFER_OES = 36161; // 0x8d41 + field public static final int GL_RENDERBUFFER_RED_SIZE_OES = 36176; // 0x8d50 + field public static final int GL_RENDERBUFFER_STENCIL_SIZE_OES = 36181; // 0x8d55 + field public static final int GL_RENDERBUFFER_WIDTH_OES = 36162; // 0x8d42 + field public static final int GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES = 36200; // 0x8d68 + field public static final int GL_RGB565_OES = 36194; // 0x8d62 + field public static final int GL_RGB5_A1_OES = 32855; // 0x8057 + field public static final int GL_RGB8_OES = 32849; // 0x8051 + field public static final int GL_RGBA4_OES = 32854; // 0x8056 + field public static final int GL_RGBA8_OES = 32856; // 0x8058 + field public static final int GL_SAMPLER_EXTERNAL_OES = 36198; // 0x8d66 + field public static final int GL_STENCIL_ATTACHMENT_OES = 36128; // 0x8d20 + field public static final int GL_STENCIL_INDEX1_OES = 36166; // 0x8d46 + field public static final int GL_STENCIL_INDEX4_OES = 36167; // 0x8d47 + field public static final int GL_STENCIL_INDEX8_OES = 36168; // 0x8d48 + field public static final int GL_TEXTURE_BINDING_CUBE_MAP_OES = 34068; // 0x8514 + field public static final int GL_TEXTURE_BINDING_EXTERNAL_OES = 36199; // 0x8d67 + field public static final int GL_TEXTURE_CROP_RECT_OES = 35741; // 0x8b9d + field public static final int GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES = 34070; // 0x8516 + field public static final int GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES = 34072; // 0x8518 + field public static final int GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES = 34074; // 0x851a + field public static final int GL_TEXTURE_CUBE_MAP_OES = 34067; // 0x8513 + field public static final int GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES = 34069; // 0x8515 + field public static final int GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES = 34071; // 0x8517 + field public static final int GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES = 34073; // 0x8519 + field public static final int GL_TEXTURE_EXTERNAL_OES = 36197; // 0x8d65 + field public static final int GL_TEXTURE_GEN_MODE_OES = 9472; // 0x2500 + field public static final int GL_TEXTURE_GEN_STR_OES = 36192; // 0x8d60 + field public static final int GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES = 35215; // 0x898f + field public static final int GL_TEXTURE_MAX_ANISOTROPY_EXT = 34046; // 0x84fe + field public static final int GL_UNSIGNED_INT_24_8_OES = 34042; // 0x84fa + field public static final int GL_WEIGHT_ARRAY_BUFFER_BINDING_OES = 34974; // 0x889e + field public static final int GL_WEIGHT_ARRAY_OES = 34477; // 0x86ad + field public static final int GL_WEIGHT_ARRAY_POINTER_OES = 34476; // 0x86ac + field public static final int GL_WEIGHT_ARRAY_SIZE_OES = 34475; // 0x86ab + field public static final int GL_WEIGHT_ARRAY_STRIDE_OES = 34474; // 0x86aa + field public static final int GL_WEIGHT_ARRAY_TYPE_OES = 34473; // 0x86a9 + field public static final int GL_WRITE_ONLY_OES = 35001; // 0x88b9 + } + + public class GLES20 { + ctor public GLES20(); + method public static void glActiveTexture(int); + method public static void glAttachShader(int, int); + method public static void glBindAttribLocation(int, int, java.lang.String); + method public static void glBindBuffer(int, int); + method public static void glBindFramebuffer(int, int); + method public static void glBindRenderbuffer(int, int); + method public static void glBindTexture(int, int); + method public static void glBlendColor(float, float, float, float); + method public static void glBlendEquation(int); + method public static void glBlendEquationSeparate(int, int); + method public static void glBlendFunc(int, int); + method public static void glBlendFuncSeparate(int, int, int, int); + method public static void glBufferData(int, int, java.nio.Buffer, int); + method public static void glBufferSubData(int, int, int, java.nio.Buffer); + method public static int glCheckFramebufferStatus(int); + method public static void glClear(int); + method public static void glClearColor(float, float, float, float); + method public static void glClearDepthf(float); + method public static void glClearStencil(int); + method public static void glColorMask(boolean, boolean, boolean, boolean); + method public static void glCompileShader(int); + method public static void glCompressedTexImage2D(int, int, int, int, int, int, int, java.nio.Buffer); + method public static void glCompressedTexSubImage2D(int, int, int, int, int, int, int, int, java.nio.Buffer); + method public static void glCopyTexImage2D(int, int, int, int, int, int, int, int); + method public static void glCopyTexSubImage2D(int, int, int, int, int, int, int, int); + method public static int glCreateProgram(); + method public static int glCreateShader(int); + method public static void glCullFace(int); + method public static void glDeleteBuffers(int, int[], int); + method public static void glDeleteBuffers(int, java.nio.IntBuffer); + method public static void glDeleteFramebuffers(int, int[], int); + method public static void glDeleteFramebuffers(int, java.nio.IntBuffer); + method public static void glDeleteProgram(int); + method public static void glDeleteRenderbuffers(int, int[], int); + method public static void glDeleteRenderbuffers(int, java.nio.IntBuffer); + method public static void glDeleteShader(int); + method public static void glDeleteTextures(int, int[], int); + method public static void glDeleteTextures(int, java.nio.IntBuffer); + method public static void glDepthFunc(int); + method public static void glDepthMask(boolean); + method public static void glDepthRangef(float, float); + method public static void glDetachShader(int, int); + method public static void glDisable(int); + method public static void glDisableVertexAttribArray(int); + method public static void glDrawArrays(int, int, int); + method public static void glDrawElements(int, int, int, int); + method public static void glDrawElements(int, int, int, java.nio.Buffer); + method public static void glEnable(int); + method public static void glEnableVertexAttribArray(int); + method public static void glFinish(); + method public static void glFlush(); + method public static void glFramebufferRenderbuffer(int, int, int, int); + method public static void glFramebufferTexture2D(int, int, int, int, int); + method public static void glFrontFace(int); + method public static void glGenBuffers(int, int[], int); + method public static void glGenBuffers(int, java.nio.IntBuffer); + method public static void glGenFramebuffers(int, int[], int); + method public static void glGenFramebuffers(int, java.nio.IntBuffer); + method public static void glGenRenderbuffers(int, int[], int); + method public static void glGenRenderbuffers(int, java.nio.IntBuffer); + method public static void glGenTextures(int, int[], int); + method public static void glGenTextures(int, java.nio.IntBuffer); + method public static void glGenerateMipmap(int); + method public static void glGetActiveAttrib(int, int, int, int[], int, int[], int, int[], int, byte[], int); + method public static void glGetActiveAttrib(int, int, int, java.nio.IntBuffer, java.nio.IntBuffer, java.nio.IntBuffer, byte); + method public static java.lang.String glGetActiveAttrib(int, int, int[], int, int[], int); + method public static java.lang.String glGetActiveAttrib(int, int, java.nio.IntBuffer, java.nio.IntBuffer); + method public static void glGetActiveUniform(int, int, int, int[], int, int[], int, int[], int, byte[], int); + method public static void glGetActiveUniform(int, int, int, java.nio.IntBuffer, java.nio.IntBuffer, java.nio.IntBuffer, byte); + method public static java.lang.String glGetActiveUniform(int, int, int[], int, int[], int); + method public static java.lang.String glGetActiveUniform(int, int, java.nio.IntBuffer, java.nio.IntBuffer); + method public static void glGetAttachedShaders(int, int, int[], int, int[], int); + method public static void glGetAttachedShaders(int, int, java.nio.IntBuffer, java.nio.IntBuffer); + method public static int glGetAttribLocation(int, java.lang.String); + method public static void glGetBooleanv(int, boolean[], int); + method public static void glGetBooleanv(int, java.nio.IntBuffer); + method public static void glGetBufferParameteriv(int, int, int[], int); + method public static void glGetBufferParameteriv(int, int, java.nio.IntBuffer); + method public static int glGetError(); + method public static void glGetFloatv(int, float[], int); + method public static void glGetFloatv(int, java.nio.FloatBuffer); + method public static void glGetFramebufferAttachmentParameteriv(int, int, int, int[], int); + method public static void glGetFramebufferAttachmentParameteriv(int, int, int, java.nio.IntBuffer); + method public static void glGetIntegerv(int, int[], int); + method public static void glGetIntegerv(int, java.nio.IntBuffer); + method public static java.lang.String glGetProgramInfoLog(int); + method public static void glGetProgramiv(int, int, int[], int); + method public static void glGetProgramiv(int, int, java.nio.IntBuffer); + method public static void glGetRenderbufferParameteriv(int, int, int[], int); + method public static void glGetRenderbufferParameteriv(int, int, java.nio.IntBuffer); + method public static java.lang.String glGetShaderInfoLog(int); + method public static void glGetShaderPrecisionFormat(int, int, int[], int, int[], int); + method public static void glGetShaderPrecisionFormat(int, int, java.nio.IntBuffer, java.nio.IntBuffer); + method public static void glGetShaderSource(int, int, int[], int, byte[], int); + method public static void glGetShaderSource(int, int, java.nio.IntBuffer, byte); + method public static java.lang.String glGetShaderSource(int); + method public static void glGetShaderiv(int, int, int[], int); + method public static void glGetShaderiv(int, int, java.nio.IntBuffer); + method public static java.lang.String glGetString(int); + method public static void glGetTexParameterfv(int, int, float[], int); + method public static void glGetTexParameterfv(int, int, java.nio.FloatBuffer); + method public static void glGetTexParameteriv(int, int, int[], int); + method public static void glGetTexParameteriv(int, int, java.nio.IntBuffer); + method public static int glGetUniformLocation(int, java.lang.String); + method public static void glGetUniformfv(int, int, float[], int); + method public static void glGetUniformfv(int, int, java.nio.FloatBuffer); + method public static void glGetUniformiv(int, int, int[], int); + method public static void glGetUniformiv(int, int, java.nio.IntBuffer); + method public static void glGetVertexAttribfv(int, int, float[], int); + method public static void glGetVertexAttribfv(int, int, java.nio.FloatBuffer); + method public static void glGetVertexAttribiv(int, int, int[], int); + method public static void glGetVertexAttribiv(int, int, java.nio.IntBuffer); + method public static void glHint(int, int); + method public static boolean glIsBuffer(int); + method public static boolean glIsEnabled(int); + method public static boolean glIsFramebuffer(int); + method public static boolean glIsProgram(int); + method public static boolean glIsRenderbuffer(int); + method public static boolean glIsShader(int); + method public static boolean glIsTexture(int); + method public static void glLineWidth(float); + method public static void glLinkProgram(int); + method public static void glPixelStorei(int, int); + method public static void glPolygonOffset(float, float); + method public static void glReadPixels(int, int, int, int, int, int, java.nio.Buffer); + method public static void glReleaseShaderCompiler(); + method public static void glRenderbufferStorage(int, int, int, int); + method public static void glSampleCoverage(float, boolean); + method public static void glScissor(int, int, int, int); + method public static void glShaderBinary(int, int[], int, int, java.nio.Buffer, int); + method public static void glShaderBinary(int, java.nio.IntBuffer, int, java.nio.Buffer, int); + method public static void glShaderSource(int, java.lang.String); + method public static void glStencilFunc(int, int, int); + method public static void glStencilFuncSeparate(int, int, int, int); + method public static void glStencilMask(int); + method public static void glStencilMaskSeparate(int, int); + method public static void glStencilOp(int, int, int); + method public static void glStencilOpSeparate(int, int, int, int); + method public static void glTexImage2D(int, int, int, int, int, int, int, int, java.nio.Buffer); + method public static void glTexParameterf(int, int, float); + method public static void glTexParameterfv(int, int, float[], int); + method public static void glTexParameterfv(int, int, java.nio.FloatBuffer); + method public static void glTexParameteri(int, int, int); + method public static void glTexParameteriv(int, int, int[], int); + method public static void glTexParameteriv(int, int, java.nio.IntBuffer); + method public static void glTexSubImage2D(int, int, int, int, int, int, int, int, java.nio.Buffer); + method public static void glUniform1f(int, float); + method public static void glUniform1fv(int, int, float[], int); + method public static void glUniform1fv(int, int, java.nio.FloatBuffer); + method public static void glUniform1i(int, int); + method public static void glUniform1iv(int, int, int[], int); + method public static void glUniform1iv(int, int, java.nio.IntBuffer); + method public static void glUniform2f(int, float, float); + method public static void glUniform2fv(int, int, float[], int); + method public static void glUniform2fv(int, int, java.nio.FloatBuffer); + method public static void glUniform2i(int, int, int); + method public static void glUniform2iv(int, int, int[], int); + method public static void glUniform2iv(int, int, java.nio.IntBuffer); + method public static void glUniform3f(int, float, float, float); + method public static void glUniform3fv(int, int, float[], int); + method public static void glUniform3fv(int, int, java.nio.FloatBuffer); + method public static void glUniform3i(int, int, int, int); + method public static void glUniform3iv(int, int, int[], int); + method public static void glUniform3iv(int, int, java.nio.IntBuffer); + method public static void glUniform4f(int, float, float, float, float); + method public static void glUniform4fv(int, int, float[], int); + method public static void glUniform4fv(int, int, java.nio.FloatBuffer); + method public static void glUniform4i(int, int, int, int, int); + method public static void glUniform4iv(int, int, int[], int); + method public static void glUniform4iv(int, int, java.nio.IntBuffer); + method public static void glUniformMatrix2fv(int, int, boolean, float[], int); + method public static void glUniformMatrix2fv(int, int, boolean, java.nio.FloatBuffer); + method public static void glUniformMatrix3fv(int, int, boolean, float[], int); + method public static void glUniformMatrix3fv(int, int, boolean, java.nio.FloatBuffer); + method public static void glUniformMatrix4fv(int, int, boolean, float[], int); + method public static void glUniformMatrix4fv(int, int, boolean, java.nio.FloatBuffer); + method public static void glUseProgram(int); + method public static void glValidateProgram(int); + method public static void glVertexAttrib1f(int, float); + method public static void glVertexAttrib1fv(int, float[], int); + method public static void glVertexAttrib1fv(int, java.nio.FloatBuffer); + method public static void glVertexAttrib2f(int, float, float); + method public static void glVertexAttrib2fv(int, float[], int); + method public static void glVertexAttrib2fv(int, java.nio.FloatBuffer); + method public static void glVertexAttrib3f(int, float, float, float); + method public static void glVertexAttrib3fv(int, float[], int); + method public static void glVertexAttrib3fv(int, java.nio.FloatBuffer); + method public static void glVertexAttrib4f(int, float, float, float, float); + method public static void glVertexAttrib4fv(int, float[], int); + method public static void glVertexAttrib4fv(int, java.nio.FloatBuffer); + method public static void glVertexAttribPointer(int, int, int, boolean, int, int); + method public static void glVertexAttribPointer(int, int, int, boolean, int, java.nio.Buffer); + method public static void glViewport(int, int, int, int); + field public static final int GL_ACTIVE_ATTRIBUTES = 35721; // 0x8b89 + field public static final int GL_ACTIVE_ATTRIBUTE_MAX_LENGTH = 35722; // 0x8b8a + field public static final int GL_ACTIVE_TEXTURE = 34016; // 0x84e0 + field public static final int GL_ACTIVE_UNIFORMS = 35718; // 0x8b86 + field public static final int GL_ACTIVE_UNIFORM_MAX_LENGTH = 35719; // 0x8b87 + field public static final int GL_ALIASED_LINE_WIDTH_RANGE = 33902; // 0x846e + field public static final int GL_ALIASED_POINT_SIZE_RANGE = 33901; // 0x846d + field public static final int GL_ALPHA = 6406; // 0x1906 + field public static final int GL_ALPHA_BITS = 3413; // 0xd55 + field public static final int GL_ALWAYS = 519; // 0x207 + field public static final int GL_ARRAY_BUFFER = 34962; // 0x8892 + field public static final int GL_ARRAY_BUFFER_BINDING = 34964; // 0x8894 + field public static final int GL_ATTACHED_SHADERS = 35717; // 0x8b85 + field public static final int GL_BACK = 1029; // 0x405 + field public static final int GL_BLEND = 3042; // 0xbe2 + field public static final int GL_BLEND_COLOR = 32773; // 0x8005 + field public static final int GL_BLEND_DST_ALPHA = 32970; // 0x80ca + field public static final int GL_BLEND_DST_RGB = 32968; // 0x80c8 + field public static final int GL_BLEND_EQUATION = 32777; // 0x8009 + field public static final int GL_BLEND_EQUATION_ALPHA = 34877; // 0x883d + field public static final int GL_BLEND_EQUATION_RGB = 32777; // 0x8009 + field public static final int GL_BLEND_SRC_ALPHA = 32971; // 0x80cb + field public static final int GL_BLEND_SRC_RGB = 32969; // 0x80c9 + field public static final int GL_BLUE_BITS = 3412; // 0xd54 + field public static final int GL_BOOL = 35670; // 0x8b56 + field public static final int GL_BOOL_VEC2 = 35671; // 0x8b57 + field public static final int GL_BOOL_VEC3 = 35672; // 0x8b58 + field public static final int GL_BOOL_VEC4 = 35673; // 0x8b59 + field public static final int GL_BUFFER_SIZE = 34660; // 0x8764 + field public static final int GL_BUFFER_USAGE = 34661; // 0x8765 + field public static final int GL_BYTE = 5120; // 0x1400 + field public static final int GL_CCW = 2305; // 0x901 + field public static final int GL_CLAMP_TO_EDGE = 33071; // 0x812f + field public static final int GL_COLOR_ATTACHMENT0 = 36064; // 0x8ce0 + field public static final int GL_COLOR_BUFFER_BIT = 16384; // 0x4000 + field public static final int GL_COLOR_CLEAR_VALUE = 3106; // 0xc22 + field public static final int GL_COLOR_WRITEMASK = 3107; // 0xc23 + field public static final int GL_COMPILE_STATUS = 35713; // 0x8b81 + field public static final int GL_COMPRESSED_TEXTURE_FORMATS = 34467; // 0x86a3 + field public static final int GL_CONSTANT_ALPHA = 32771; // 0x8003 + field public static final int GL_CONSTANT_COLOR = 32769; // 0x8001 + field public static final int GL_CULL_FACE = 2884; // 0xb44 + field public static final int GL_CULL_FACE_MODE = 2885; // 0xb45 + field public static final int GL_CURRENT_PROGRAM = 35725; // 0x8b8d + field public static final int GL_CURRENT_VERTEX_ATTRIB = 34342; // 0x8626 + field public static final int GL_CW = 2304; // 0x900 + field public static final int GL_DECR = 7683; // 0x1e03 + field public static final int GL_DECR_WRAP = 34056; // 0x8508 + field public static final int GL_DELETE_STATUS = 35712; // 0x8b80 + field public static final int GL_DEPTH_ATTACHMENT = 36096; // 0x8d00 + field public static final int GL_DEPTH_BITS = 3414; // 0xd56 + field public static final int GL_DEPTH_BUFFER_BIT = 256; // 0x100 + field public static final int GL_DEPTH_CLEAR_VALUE = 2931; // 0xb73 + field public static final int GL_DEPTH_COMPONENT = 6402; // 0x1902 + field public static final int GL_DEPTH_COMPONENT16 = 33189; // 0x81a5 + field public static final int GL_DEPTH_FUNC = 2932; // 0xb74 + field public static final int GL_DEPTH_RANGE = 2928; // 0xb70 + field public static final int GL_DEPTH_TEST = 2929; // 0xb71 + field public static final int GL_DEPTH_WRITEMASK = 2930; // 0xb72 + field public static final int GL_DITHER = 3024; // 0xbd0 + field public static final int GL_DONT_CARE = 4352; // 0x1100 + field public static final int GL_DST_ALPHA = 772; // 0x304 + field public static final int GL_DST_COLOR = 774; // 0x306 + field public static final int GL_DYNAMIC_DRAW = 35048; // 0x88e8 + field public static final int GL_ELEMENT_ARRAY_BUFFER = 34963; // 0x8893 + field public static final int GL_ELEMENT_ARRAY_BUFFER_BINDING = 34965; // 0x8895 + field public static final int GL_EQUAL = 514; // 0x202 + field public static final int GL_EXTENSIONS = 7939; // 0x1f03 + field public static final int GL_FALSE = 0; // 0x0 + field public static final int GL_FASTEST = 4353; // 0x1101 + field public static final int GL_FIXED = 5132; // 0x140c + field public static final int GL_FLOAT = 5126; // 0x1406 + field public static final int GL_FLOAT_MAT2 = 35674; // 0x8b5a + field public static final int GL_FLOAT_MAT3 = 35675; // 0x8b5b + field public static final int GL_FLOAT_MAT4 = 35676; // 0x8b5c + field public static final int GL_FLOAT_VEC2 = 35664; // 0x8b50 + field public static final int GL_FLOAT_VEC3 = 35665; // 0x8b51 + field public static final int GL_FLOAT_VEC4 = 35666; // 0x8b52 + field public static final int GL_FRAGMENT_SHADER = 35632; // 0x8b30 + field public static final int GL_FRAMEBUFFER = 36160; // 0x8d40 + field public static final int GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = 36049; // 0x8cd1 + field public static final int GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = 36048; // 0x8cd0 + field public static final int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = 36051; // 0x8cd3 + field public static final int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = 36050; // 0x8cd2 + field public static final int GL_FRAMEBUFFER_BINDING = 36006; // 0x8ca6 + field public static final int GL_FRAMEBUFFER_COMPLETE = 36053; // 0x8cd5 + field public static final int GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT = 36054; // 0x8cd6 + field public static final int GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS = 36057; // 0x8cd9 + field public static final int GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 36055; // 0x8cd7 + field public static final int GL_FRAMEBUFFER_UNSUPPORTED = 36061; // 0x8cdd + field public static final int GL_FRONT = 1028; // 0x404 + field public static final int GL_FRONT_AND_BACK = 1032; // 0x408 + field public static final int GL_FRONT_FACE = 2886; // 0xb46 + field public static final int GL_FUNC_ADD = 32774; // 0x8006 + field public static final int GL_FUNC_REVERSE_SUBTRACT = 32779; // 0x800b + field public static final int GL_FUNC_SUBTRACT = 32778; // 0x800a + field public static final int GL_GENERATE_MIPMAP_HINT = 33170; // 0x8192 + field public static final int GL_GEQUAL = 518; // 0x206 + field public static final int GL_GREATER = 516; // 0x204 + field public static final int GL_GREEN_BITS = 3411; // 0xd53 + field public static final int GL_HIGH_FLOAT = 36338; // 0x8df2 + field public static final int GL_HIGH_INT = 36341; // 0x8df5 + field public static final int GL_IMPLEMENTATION_COLOR_READ_FORMAT = 35739; // 0x8b9b + field public static final int GL_IMPLEMENTATION_COLOR_READ_TYPE = 35738; // 0x8b9a + field public static final int GL_INCR = 7682; // 0x1e02 + field public static final int GL_INCR_WRAP = 34055; // 0x8507 + field public static final int GL_INFO_LOG_LENGTH = 35716; // 0x8b84 + field public static final int GL_INT = 5124; // 0x1404 + field public static final int GL_INT_VEC2 = 35667; // 0x8b53 + field public static final int GL_INT_VEC3 = 35668; // 0x8b54 + field public static final int GL_INT_VEC4 = 35669; // 0x8b55 + field public static final int GL_INVALID_ENUM = 1280; // 0x500 + field public static final int GL_INVALID_FRAMEBUFFER_OPERATION = 1286; // 0x506 + field public static final int GL_INVALID_OPERATION = 1282; // 0x502 + field public static final int GL_INVALID_VALUE = 1281; // 0x501 + field public static final int GL_INVERT = 5386; // 0x150a + field public static final int GL_KEEP = 7680; // 0x1e00 + field public static final int GL_LEQUAL = 515; // 0x203 + field public static final int GL_LESS = 513; // 0x201 + field public static final int GL_LINEAR = 9729; // 0x2601 + field public static final int GL_LINEAR_MIPMAP_LINEAR = 9987; // 0x2703 + field public static final int GL_LINEAR_MIPMAP_NEAREST = 9985; // 0x2701 + field public static final int GL_LINES = 1; // 0x1 + field public static final int GL_LINE_LOOP = 2; // 0x2 + field public static final int GL_LINE_STRIP = 3; // 0x3 + field public static final int GL_LINE_WIDTH = 2849; // 0xb21 + field public static final int GL_LINK_STATUS = 35714; // 0x8b82 + field public static final int GL_LOW_FLOAT = 36336; // 0x8df0 + field public static final int GL_LOW_INT = 36339; // 0x8df3 + field public static final int GL_LUMINANCE = 6409; // 0x1909 + field public static final int GL_LUMINANCE_ALPHA = 6410; // 0x190a + field public static final int GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS = 35661; // 0x8b4d + field public static final int GL_MAX_CUBE_MAP_TEXTURE_SIZE = 34076; // 0x851c + field public static final int GL_MAX_FRAGMENT_UNIFORM_VECTORS = 36349; // 0x8dfd + field public static final int GL_MAX_RENDERBUFFER_SIZE = 34024; // 0x84e8 + field public static final int GL_MAX_TEXTURE_IMAGE_UNITS = 34930; // 0x8872 + field public static final int GL_MAX_TEXTURE_SIZE = 3379; // 0xd33 + field public static final int GL_MAX_VARYING_VECTORS = 36348; // 0x8dfc + field public static final int GL_MAX_VERTEX_ATTRIBS = 34921; // 0x8869 + field public static final int GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS = 35660; // 0x8b4c + field public static final int GL_MAX_VERTEX_UNIFORM_VECTORS = 36347; // 0x8dfb + field public static final int GL_MAX_VIEWPORT_DIMS = 3386; // 0xd3a + field public static final int GL_MEDIUM_FLOAT = 36337; // 0x8df1 + field public static final int GL_MEDIUM_INT = 36340; // 0x8df4 + field public static final int GL_MIRRORED_REPEAT = 33648; // 0x8370 + field public static final int GL_NEAREST = 9728; // 0x2600 + field public static final int GL_NEAREST_MIPMAP_LINEAR = 9986; // 0x2702 + field public static final int GL_NEAREST_MIPMAP_NEAREST = 9984; // 0x2700 + field public static final int GL_NEVER = 512; // 0x200 + field public static final int GL_NICEST = 4354; // 0x1102 + field public static final int GL_NONE = 0; // 0x0 + field public static final int GL_NOTEQUAL = 517; // 0x205 + field public static final int GL_NO_ERROR = 0; // 0x0 + field public static final int GL_NUM_COMPRESSED_TEXTURE_FORMATS = 34466; // 0x86a2 + field public static final int GL_NUM_SHADER_BINARY_FORMATS = 36345; // 0x8df9 + field public static final int GL_ONE = 1; // 0x1 + field public static final int GL_ONE_MINUS_CONSTANT_ALPHA = 32772; // 0x8004 + field public static final int GL_ONE_MINUS_CONSTANT_COLOR = 32770; // 0x8002 + field public static final int GL_ONE_MINUS_DST_ALPHA = 773; // 0x305 + field public static final int GL_ONE_MINUS_DST_COLOR = 775; // 0x307 + field public static final int GL_ONE_MINUS_SRC_ALPHA = 771; // 0x303 + field public static final int GL_ONE_MINUS_SRC_COLOR = 769; // 0x301 + field public static final int GL_OUT_OF_MEMORY = 1285; // 0x505 + field public static final int GL_PACK_ALIGNMENT = 3333; // 0xd05 + field public static final int GL_POINTS = 0; // 0x0 + field public static final int GL_POLYGON_OFFSET_FACTOR = 32824; // 0x8038 + field public static final int GL_POLYGON_OFFSET_FILL = 32823; // 0x8037 + field public static final int GL_POLYGON_OFFSET_UNITS = 10752; // 0x2a00 + field public static final int GL_RED_BITS = 3410; // 0xd52 + field public static final int GL_RENDERBUFFER = 36161; // 0x8d41 + field public static final int GL_RENDERBUFFER_ALPHA_SIZE = 36179; // 0x8d53 + field public static final int GL_RENDERBUFFER_BINDING = 36007; // 0x8ca7 + field public static final int GL_RENDERBUFFER_BLUE_SIZE = 36178; // 0x8d52 + field public static final int GL_RENDERBUFFER_DEPTH_SIZE = 36180; // 0x8d54 + field public static final int GL_RENDERBUFFER_GREEN_SIZE = 36177; // 0x8d51 + field public static final int GL_RENDERBUFFER_HEIGHT = 36163; // 0x8d43 + field public static final int GL_RENDERBUFFER_INTERNAL_FORMAT = 36164; // 0x8d44 + field public static final int GL_RENDERBUFFER_RED_SIZE = 36176; // 0x8d50 + field public static final int GL_RENDERBUFFER_STENCIL_SIZE = 36181; // 0x8d55 + field public static final int GL_RENDERBUFFER_WIDTH = 36162; // 0x8d42 + field public static final int GL_RENDERER = 7937; // 0x1f01 + field public static final int GL_REPEAT = 10497; // 0x2901 + field public static final int GL_REPLACE = 7681; // 0x1e01 + field public static final int GL_RGB = 6407; // 0x1907 + field public static final int GL_RGB565 = 36194; // 0x8d62 + field public static final int GL_RGB5_A1 = 32855; // 0x8057 + field public static final int GL_RGBA = 6408; // 0x1908 + field public static final int GL_RGBA4 = 32854; // 0x8056 + field public static final int GL_SAMPLER_2D = 35678; // 0x8b5e + field public static final int GL_SAMPLER_CUBE = 35680; // 0x8b60 + field public static final int GL_SAMPLES = 32937; // 0x80a9 + field public static final int GL_SAMPLE_ALPHA_TO_COVERAGE = 32926; // 0x809e + field public static final int GL_SAMPLE_BUFFERS = 32936; // 0x80a8 + field public static final int GL_SAMPLE_COVERAGE = 32928; // 0x80a0 + field public static final int GL_SAMPLE_COVERAGE_INVERT = 32939; // 0x80ab + field public static final int GL_SAMPLE_COVERAGE_VALUE = 32938; // 0x80aa + field public static final int GL_SCISSOR_BOX = 3088; // 0xc10 + field public static final int GL_SCISSOR_TEST = 3089; // 0xc11 + field public static final int GL_SHADER_BINARY_FORMATS = 36344; // 0x8df8 + field public static final int GL_SHADER_COMPILER = 36346; // 0x8dfa + field public static final int GL_SHADER_SOURCE_LENGTH = 35720; // 0x8b88 + field public static final int GL_SHADER_TYPE = 35663; // 0x8b4f + field public static final int GL_SHADING_LANGUAGE_VERSION = 35724; // 0x8b8c + field public static final int GL_SHORT = 5122; // 0x1402 + field public static final int GL_SRC_ALPHA = 770; // 0x302 + field public static final int GL_SRC_ALPHA_SATURATE = 776; // 0x308 + field public static final int GL_SRC_COLOR = 768; // 0x300 + field public static final int GL_STATIC_DRAW = 35044; // 0x88e4 + field public static final int GL_STENCIL_ATTACHMENT = 36128; // 0x8d20 + field public static final int GL_STENCIL_BACK_FAIL = 34817; // 0x8801 + field public static final int GL_STENCIL_BACK_FUNC = 34816; // 0x8800 + field public static final int GL_STENCIL_BACK_PASS_DEPTH_FAIL = 34818; // 0x8802 + field public static final int GL_STENCIL_BACK_PASS_DEPTH_PASS = 34819; // 0x8803 + field public static final int GL_STENCIL_BACK_REF = 36003; // 0x8ca3 + field public static final int GL_STENCIL_BACK_VALUE_MASK = 36004; // 0x8ca4 + field public static final int GL_STENCIL_BACK_WRITEMASK = 36005; // 0x8ca5 + field public static final int GL_STENCIL_BITS = 3415; // 0xd57 + field public static final int GL_STENCIL_BUFFER_BIT = 1024; // 0x400 + field public static final int GL_STENCIL_CLEAR_VALUE = 2961; // 0xb91 + field public static final int GL_STENCIL_FAIL = 2964; // 0xb94 + field public static final int GL_STENCIL_FUNC = 2962; // 0xb92 + field public static final int GL_STENCIL_INDEX = 6401; // 0x1901 + field public static final int GL_STENCIL_INDEX8 = 36168; // 0x8d48 + field public static final int GL_STENCIL_PASS_DEPTH_FAIL = 2965; // 0xb95 + field public static final int GL_STENCIL_PASS_DEPTH_PASS = 2966; // 0xb96 + field public static final int GL_STENCIL_REF = 2967; // 0xb97 + field public static final int GL_STENCIL_TEST = 2960; // 0xb90 + field public static final int GL_STENCIL_VALUE_MASK = 2963; // 0xb93 + field public static final int GL_STENCIL_WRITEMASK = 2968; // 0xb98 + field public static final int GL_STREAM_DRAW = 35040; // 0x88e0 + field public static final int GL_SUBPIXEL_BITS = 3408; // 0xd50 + field public static final int GL_TEXTURE = 5890; // 0x1702 + field public static final int GL_TEXTURE0 = 33984; // 0x84c0 + field public static final int GL_TEXTURE1 = 33985; // 0x84c1 + field public static final int GL_TEXTURE10 = 33994; // 0x84ca + field public static final int GL_TEXTURE11 = 33995; // 0x84cb + field public static final int GL_TEXTURE12 = 33996; // 0x84cc + field public static final int GL_TEXTURE13 = 33997; // 0x84cd + field public static final int GL_TEXTURE14 = 33998; // 0x84ce + field public static final int GL_TEXTURE15 = 33999; // 0x84cf + field public static final int GL_TEXTURE16 = 34000; // 0x84d0 + field public static final int GL_TEXTURE17 = 34001; // 0x84d1 + field public static final int GL_TEXTURE18 = 34002; // 0x84d2 + field public static final int GL_TEXTURE19 = 34003; // 0x84d3 + field public static final int GL_TEXTURE2 = 33986; // 0x84c2 + field public static final int GL_TEXTURE20 = 34004; // 0x84d4 + field public static final int GL_TEXTURE21 = 34005; // 0x84d5 + field public static final int GL_TEXTURE22 = 34006; // 0x84d6 + field public static final int GL_TEXTURE23 = 34007; // 0x84d7 + field public static final int GL_TEXTURE24 = 34008; // 0x84d8 + field public static final int GL_TEXTURE25 = 34009; // 0x84d9 + field public static final int GL_TEXTURE26 = 34010; // 0x84da + field public static final int GL_TEXTURE27 = 34011; // 0x84db + field public static final int GL_TEXTURE28 = 34012; // 0x84dc + field public static final int GL_TEXTURE29 = 34013; // 0x84dd + field public static final int GL_TEXTURE3 = 33987; // 0x84c3 + field public static final int GL_TEXTURE30 = 34014; // 0x84de + field public static final int GL_TEXTURE31 = 34015; // 0x84df + field public static final int GL_TEXTURE4 = 33988; // 0x84c4 + field public static final int GL_TEXTURE5 = 33989; // 0x84c5 + field public static final int GL_TEXTURE6 = 33990; // 0x84c6 + field public static final int GL_TEXTURE7 = 33991; // 0x84c7 + field public static final int GL_TEXTURE8 = 33992; // 0x84c8 + field public static final int GL_TEXTURE9 = 33993; // 0x84c9 + field public static final int GL_TEXTURE_2D = 3553; // 0xde1 + field public static final int GL_TEXTURE_BINDING_2D = 32873; // 0x8069 + field public static final int GL_TEXTURE_BINDING_CUBE_MAP = 34068; // 0x8514 + field public static final int GL_TEXTURE_CUBE_MAP = 34067; // 0x8513 + field public static final int GL_TEXTURE_CUBE_MAP_NEGATIVE_X = 34070; // 0x8516 + field public static final int GL_TEXTURE_CUBE_MAP_NEGATIVE_Y = 34072; // 0x8518 + field public static final int GL_TEXTURE_CUBE_MAP_NEGATIVE_Z = 34074; // 0x851a + field public static final int GL_TEXTURE_CUBE_MAP_POSITIVE_X = 34069; // 0x8515 + field public static final int GL_TEXTURE_CUBE_MAP_POSITIVE_Y = 34071; // 0x8517 + field public static final int GL_TEXTURE_CUBE_MAP_POSITIVE_Z = 34073; // 0x8519 + field public static final int GL_TEXTURE_MAG_FILTER = 10240; // 0x2800 + field public static final int GL_TEXTURE_MIN_FILTER = 10241; // 0x2801 + field public static final int GL_TEXTURE_WRAP_S = 10242; // 0x2802 + field public static final int GL_TEXTURE_WRAP_T = 10243; // 0x2803 + field public static final int GL_TRIANGLES = 4; // 0x4 + field public static final int GL_TRIANGLE_FAN = 6; // 0x6 + field public static final int GL_TRIANGLE_STRIP = 5; // 0x5 + field public static final int GL_TRUE = 1; // 0x1 + field public static final int GL_UNPACK_ALIGNMENT = 3317; // 0xcf5 + field public static final int GL_UNSIGNED_BYTE = 5121; // 0x1401 + field public static final int GL_UNSIGNED_INT = 5125; // 0x1405 + field public static final int GL_UNSIGNED_SHORT = 5123; // 0x1403 + field public static final int GL_UNSIGNED_SHORT_4_4_4_4 = 32819; // 0x8033 + field public static final int GL_UNSIGNED_SHORT_5_5_5_1 = 32820; // 0x8034 + field public static final int GL_UNSIGNED_SHORT_5_6_5 = 33635; // 0x8363 + field public static final int GL_VALIDATE_STATUS = 35715; // 0x8b83 + field public static final int GL_VENDOR = 7936; // 0x1f00 + field public static final int GL_VERSION = 7938; // 0x1f02 + field public static final int GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = 34975; // 0x889f + field public static final int GL_VERTEX_ATTRIB_ARRAY_ENABLED = 34338; // 0x8622 + field public static final int GL_VERTEX_ATTRIB_ARRAY_NORMALIZED = 34922; // 0x886a + field public static final int GL_VERTEX_ATTRIB_ARRAY_POINTER = 34373; // 0x8645 + field public static final int GL_VERTEX_ATTRIB_ARRAY_SIZE = 34339; // 0x8623 + field public static final int GL_VERTEX_ATTRIB_ARRAY_STRIDE = 34340; // 0x8624 + field public static final int GL_VERTEX_ATTRIB_ARRAY_TYPE = 34341; // 0x8625 + field public static final int GL_VERTEX_SHADER = 35633; // 0x8b31 + field public static final int GL_VIEWPORT = 2978; // 0xba2 + field public static final int GL_ZERO = 0; // 0x0 + } + + public class GLException extends java.lang.RuntimeException { + ctor public GLException(int); + ctor public GLException(int, java.lang.String); + } + + public class GLSurfaceView extends android.view.SurfaceView implements android.view.SurfaceHolder.Callback { + ctor public GLSurfaceView(android.content.Context); + ctor public GLSurfaceView(android.content.Context, android.util.AttributeSet); + method public int getDebugFlags(); + method public boolean getPreserveEGLContextOnPause(); + method public int getRenderMode(); + method public void onPause(); + method public void onResume(); + method public void queueEvent(java.lang.Runnable); + method public void requestRender(); + method public void setDebugFlags(int); + method public void setEGLConfigChooser(android.opengl.GLSurfaceView.EGLConfigChooser); + method public void setEGLConfigChooser(boolean); + method public void setEGLConfigChooser(int, int, int, int, int, int); + method public void setEGLContextClientVersion(int); + method public void setEGLContextFactory(android.opengl.GLSurfaceView.EGLContextFactory); + method public void setEGLWindowSurfaceFactory(android.opengl.GLSurfaceView.EGLWindowSurfaceFactory); + method public void setGLWrapper(android.opengl.GLSurfaceView.GLWrapper); + method public void setPreserveEGLContextOnPause(boolean); + method public void setRenderMode(int); + method public void setRenderer(android.opengl.GLSurfaceView.Renderer); + method public void surfaceChanged(android.view.SurfaceHolder, int, int, int); + method public void surfaceCreated(android.view.SurfaceHolder); + method public void surfaceDestroyed(android.view.SurfaceHolder); + field public static final int DEBUG_CHECK_GL_ERROR = 1; // 0x1 + field public static final int DEBUG_LOG_GL_CALLS = 2; // 0x2 + field public static final int RENDERMODE_CONTINUOUSLY = 1; // 0x1 + field public static final int RENDERMODE_WHEN_DIRTY = 0; // 0x0 + } + + public static abstract interface GLSurfaceView.EGLConfigChooser { + method public abstract javax.microedition.khronos.egl.EGLConfig chooseConfig(javax.microedition.khronos.egl.EGL10, javax.microedition.khronos.egl.EGLDisplay); + } + + public static abstract interface GLSurfaceView.EGLContextFactory { + method public abstract javax.microedition.khronos.egl.EGLContext createContext(javax.microedition.khronos.egl.EGL10, javax.microedition.khronos.egl.EGLDisplay, javax.microedition.khronos.egl.EGLConfig); + method public abstract void destroyContext(javax.microedition.khronos.egl.EGL10, javax.microedition.khronos.egl.EGLDisplay, javax.microedition.khronos.egl.EGLContext); + } + + public static abstract interface GLSurfaceView.EGLWindowSurfaceFactory { + method public abstract javax.microedition.khronos.egl.EGLSurface createWindowSurface(javax.microedition.khronos.egl.EGL10, javax.microedition.khronos.egl.EGLDisplay, javax.microedition.khronos.egl.EGLConfig, java.lang.Object); + method public abstract void destroySurface(javax.microedition.khronos.egl.EGL10, javax.microedition.khronos.egl.EGLDisplay, javax.microedition.khronos.egl.EGLSurface); + } + + public static abstract interface GLSurfaceView.GLWrapper { + method public abstract javax.microedition.khronos.opengles.GL wrap(javax.microedition.khronos.opengles.GL); + } + + public static abstract interface GLSurfaceView.Renderer { + method public abstract void onDrawFrame(javax.microedition.khronos.opengles.GL10); + method public abstract void onSurfaceChanged(javax.microedition.khronos.opengles.GL10, int, int); + method public abstract void onSurfaceCreated(javax.microedition.khronos.opengles.GL10, javax.microedition.khronos.egl.EGLConfig); + } + + public class GLU { + ctor public GLU(); + method public static java.lang.String gluErrorString(int); + method public static void gluLookAt(javax.microedition.khronos.opengles.GL10, float, float, float, float, float, float, float, float, float); + method public static void gluOrtho2D(javax.microedition.khronos.opengles.GL10, float, float, float, float); + method public static void gluPerspective(javax.microedition.khronos.opengles.GL10, float, float, float, float); + method public static int gluProject(float, float, float, float[], int, float[], int, int[], int, float[], int); + method public static int gluUnProject(float, float, float, float[], int, float[], int, int[], int, float[], int); + } + + public final class GLUtils { + method public static java.lang.String getEGLErrorString(int); + method public static int getInternalFormat(android.graphics.Bitmap); + method public static int getType(android.graphics.Bitmap); + method public static void texImage2D(int, int, int, android.graphics.Bitmap, int); + method public static void texImage2D(int, int, int, android.graphics.Bitmap, int, int); + method public static void texImage2D(int, int, android.graphics.Bitmap, int); + method public static void texSubImage2D(int, int, int, int, android.graphics.Bitmap); + method public static void texSubImage2D(int, int, int, int, android.graphics.Bitmap, int, int); + } + + public class Matrix { + ctor public Matrix(); + method public static void frustumM(float[], int, float, float, float, float, float, float); + method public static boolean invertM(float[], int, float[], int); + method public static float length(float, float, float); + method public static void multiplyMM(float[], int, float[], int, float[], int); + method public static void multiplyMV(float[], int, float[], int, float[], int); + method public static void orthoM(float[], int, float, float, float, float, float, float); + method public static void perspectiveM(float[], int, float, float, float, float); + method public static void rotateM(float[], int, float[], int, float, float, float, float); + method public static void rotateM(float[], int, float, float, float, float); + method public static void scaleM(float[], int, float[], int, float, float, float); + method public static void scaleM(float[], int, float, float, float); + method public static void setIdentityM(float[], int); + method public static void setLookAtM(float[], int, float, float, float, float, float, float, float, float, float); + method public static void setRotateEulerM(float[], int, float, float, float); + method public static void setRotateM(float[], int, float, float, float, float); + method public static void translateM(float[], int, float[], int, float, float, float); + method public static void translateM(float[], int, float, float, float); + method public static void transposeM(float[], int, float[], int); + } + + public class Visibility { + ctor public Visibility(); + method public static void computeBoundingSphere(float[], int, int, float[], int); + method public static int frustumCullSpheres(float[], int, float[], int, int, int[], int, int); + method public static int visibilityTest(float[], int, float[], int, char[], int, int); + } + +} + +package android.os { + + public abstract class AsyncTask { + ctor public AsyncTask(); + method public final boolean cancel(boolean); + method protected abstract Result doInBackground(Params...); + method public final android.os.AsyncTask execute(Params...); + method public static void execute(java.lang.Runnable); + method public final android.os.AsyncTask executeOnExecutor(java.util.concurrent.Executor, Params...); + method public final Result get() throws java.util.concurrent.ExecutionException, java.lang.InterruptedException; + method public final Result get(long, java.util.concurrent.TimeUnit) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException, java.util.concurrent.TimeoutException; + method public final android.os.AsyncTask.Status getStatus(); + method public final boolean isCancelled(); + method protected void onCancelled(Result); + method protected void onCancelled(); + method protected void onPostExecute(Result); + method protected void onPreExecute(); + method protected void onProgressUpdate(Progress...); + method protected final void publishProgress(Progress...); + field public static final java.util.concurrent.Executor SERIAL_EXECUTOR; + field public static final java.util.concurrent.Executor THREAD_POOL_EXECUTOR; + } + + public static final class AsyncTask.Status extends java.lang.Enum { + method public static android.os.AsyncTask.Status valueOf(java.lang.String); + method public static final android.os.AsyncTask.Status[] values(); + enum_constant public static final android.os.AsyncTask.Status FINISHED; + enum_constant public static final android.os.AsyncTask.Status PENDING; + enum_constant public static final android.os.AsyncTask.Status RUNNING; + } + + public class BadParcelableException extends android.util.AndroidRuntimeException { + ctor public BadParcelableException(java.lang.String); + ctor public BadParcelableException(java.lang.Exception); + } + + public class BatteryManager { + ctor public BatteryManager(); + field public static final int BATTERY_HEALTH_COLD = 7; // 0x7 + field public static final int BATTERY_HEALTH_DEAD = 4; // 0x4 + field public static final int BATTERY_HEALTH_GOOD = 2; // 0x2 + field public static final int BATTERY_HEALTH_OVERHEAT = 3; // 0x3 + field public static final int BATTERY_HEALTH_OVER_VOLTAGE = 5; // 0x5 + field public static final int BATTERY_HEALTH_UNKNOWN = 1; // 0x1 + field public static final int BATTERY_HEALTH_UNSPECIFIED_FAILURE = 6; // 0x6 + field public static final int BATTERY_PLUGGED_AC = 1; // 0x1 + field public static final int BATTERY_PLUGGED_USB = 2; // 0x2 + field public static final int BATTERY_PLUGGED_WIRELESS = 4; // 0x4 + field public static final int BATTERY_STATUS_CHARGING = 2; // 0x2 + field public static final int BATTERY_STATUS_DISCHARGING = 3; // 0x3 + field public static final int BATTERY_STATUS_FULL = 5; // 0x5 + field public static final int BATTERY_STATUS_NOT_CHARGING = 4; // 0x4 + field public static final int BATTERY_STATUS_UNKNOWN = 1; // 0x1 + field public static final java.lang.String EXTRA_HEALTH = "health"; + field public static final java.lang.String EXTRA_ICON_SMALL = "icon-small"; + field public static final java.lang.String EXTRA_LEVEL = "level"; + field public static final java.lang.String EXTRA_PLUGGED = "plugged"; + field public static final java.lang.String EXTRA_PRESENT = "present"; + field public static final java.lang.String EXTRA_SCALE = "scale"; + field public static final java.lang.String EXTRA_STATUS = "status"; + field public static final java.lang.String EXTRA_TECHNOLOGY = "technology"; + field public static final java.lang.String EXTRA_TEMPERATURE = "temperature"; + field public static final java.lang.String EXTRA_VOLTAGE = "voltage"; + } + + public class Binder implements android.os.IBinder { + ctor public Binder(); + method public void attachInterface(android.os.IInterface, java.lang.String); + method public static final long clearCallingIdentity(); + method public void dump(java.io.FileDescriptor, java.lang.String[]); + method protected void dump(java.io.FileDescriptor, java.io.PrintWriter, java.lang.String[]); + method public void dumpAsync(java.io.FileDescriptor, java.lang.String[]); + method public static final void flushPendingCommands(); + method public static final int getCallingPid(); + method public static final int getCallingUid(); + method public static final android.os.UserHandle getCallingUserHandle(); + method public java.lang.String getInterfaceDescriptor(); + method public boolean isBinderAlive(); + method public static final void joinThreadPool(); + method public void linkToDeath(android.os.IBinder.DeathRecipient, int); + method protected boolean onTransact(int, android.os.Parcel, android.os.Parcel, int) throws android.os.RemoteException; + method public boolean pingBinder(); + method public android.os.IInterface queryLocalInterface(java.lang.String); + method public static final void restoreCallingIdentity(long); + method public final boolean transact(int, android.os.Parcel, android.os.Parcel, int) throws android.os.RemoteException; + method public boolean unlinkToDeath(android.os.IBinder.DeathRecipient, int); + } + + public class Build { + ctor public Build(); + method public static java.lang.String getRadioVersion(); + field public static final java.lang.String BOARD; + field public static final java.lang.String BOOTLOADER; + field public static final java.lang.String BRAND; + field public static final java.lang.String CPU_ABI; + field public static final java.lang.String CPU_ABI2; + field public static final java.lang.String DEVICE; + field public static final java.lang.String DISPLAY; + field public static final java.lang.String FINGERPRINT; + field public static final java.lang.String HARDWARE; + field public static final java.lang.String HOST; + field public static final java.lang.String ID; + field public static final java.lang.String MANUFACTURER; + field public static final java.lang.String MODEL; + field public static final java.lang.String PRODUCT; + field public static final deprecated java.lang.String RADIO; + field public static final java.lang.String SERIAL; + field public static final java.lang.String TAGS; + field public static final long TIME; + field public static final java.lang.String TYPE; + field public static final java.lang.String UNKNOWN = "unknown"; + field public static final java.lang.String USER; + } + + public static class Build.VERSION { + ctor public Build.VERSION(); + field public static final java.lang.String CODENAME; + field public static final java.lang.String INCREMENTAL; + field public static final java.lang.String RELEASE; + field public static final deprecated java.lang.String SDK; + field public static final int SDK_INT; + } + + public static class Build.VERSION_CODES { + ctor public Build.VERSION_CODES(); + field public static final int BASE = 1; // 0x1 + field public static final int BASE_1_1 = 2; // 0x2 + field public static final int CUPCAKE = 3; // 0x3 + field public static final int CUR_DEVELOPMENT = 10000; // 0x2710 + field public static final int DONUT = 4; // 0x4 + field public static final int ECLAIR = 5; // 0x5 + field public static final int ECLAIR_0_1 = 6; // 0x6 + field public static final int ECLAIR_MR1 = 7; // 0x7 + field public static final int FROYO = 8; // 0x8 + field public static final int GINGERBREAD = 9; // 0x9 + field public static final int GINGERBREAD_MR1 = 10; // 0xa + field public static final int HONEYCOMB = 11; // 0xb + field public static final int HONEYCOMB_MR1 = 12; // 0xc + field public static final int HONEYCOMB_MR2 = 13; // 0xd + field public static final int ICE_CREAM_SANDWICH = 14; // 0xe + field public static final int ICE_CREAM_SANDWICH_MR1 = 15; // 0xf + field public static final int JELLY_BEAN = 16; // 0x10 + field public static final int JELLY_BEAN_MR1 = 17; // 0x11 + } + + public final class Bundle implements java.lang.Cloneable android.os.Parcelable { + ctor public Bundle(); + ctor public Bundle(java.lang.ClassLoader); + ctor public Bundle(int); + ctor public Bundle(android.os.Bundle); + method public void clear(); + method public java.lang.Object clone(); + method public boolean containsKey(java.lang.String); + method public int describeContents(); + method public java.lang.Object get(java.lang.String); + method public boolean getBoolean(java.lang.String); + method public boolean getBoolean(java.lang.String, boolean); + method public boolean[] getBooleanArray(java.lang.String); + method public android.os.Bundle getBundle(java.lang.String); + method public byte getByte(java.lang.String); + method public java.lang.Byte getByte(java.lang.String, byte); + method public byte[] getByteArray(java.lang.String); + method public char getChar(java.lang.String); + method public char getChar(java.lang.String, char); + method public char[] getCharArray(java.lang.String); + method public java.lang.CharSequence getCharSequence(java.lang.String); + method public java.lang.CharSequence getCharSequence(java.lang.String, java.lang.CharSequence); + method public java.lang.CharSequence[] getCharSequenceArray(java.lang.String); + method public java.util.ArrayList getCharSequenceArrayList(java.lang.String); + method public java.lang.ClassLoader getClassLoader(); + method public double getDouble(java.lang.String); + method public double getDouble(java.lang.String, double); + method public double[] getDoubleArray(java.lang.String); + method public float getFloat(java.lang.String); + method public float getFloat(java.lang.String, float); + method public float[] getFloatArray(java.lang.String); + method public int getInt(java.lang.String); + method public int getInt(java.lang.String, int); + method public int[] getIntArray(java.lang.String); + method public java.util.ArrayList getIntegerArrayList(java.lang.String); + method public long getLong(java.lang.String); + method public long getLong(java.lang.String, long); + method public long[] getLongArray(java.lang.String); + method public T getParcelable(java.lang.String); + method public android.os.Parcelable[] getParcelableArray(java.lang.String); + method public java.util.ArrayList getParcelableArrayList(java.lang.String); + method public java.io.Serializable getSerializable(java.lang.String); + method public short getShort(java.lang.String); + method public short getShort(java.lang.String, short); + method public short[] getShortArray(java.lang.String); + method public android.util.SparseArray getSparseParcelableArray(java.lang.String); + method public java.lang.String getString(java.lang.String); + method public java.lang.String getString(java.lang.String, java.lang.String); + method public java.lang.String[] getStringArray(java.lang.String); + method public java.util.ArrayList getStringArrayList(java.lang.String); + method public boolean hasFileDescriptors(); + method public boolean isEmpty(); + method public java.util.Set keySet(); + method public void putAll(android.os.Bundle); + method public void putBoolean(java.lang.String, boolean); + method public void putBooleanArray(java.lang.String, boolean[]); + method public void putBundle(java.lang.String, android.os.Bundle); + method public void putByte(java.lang.String, byte); + method public void putByteArray(java.lang.String, byte[]); + method public void putChar(java.lang.String, char); + method public void putCharArray(java.lang.String, char[]); + method public void putCharSequence(java.lang.String, java.lang.CharSequence); + method public void putCharSequenceArray(java.lang.String, java.lang.CharSequence[]); + method public void putCharSequenceArrayList(java.lang.String, java.util.ArrayList); + method public void putDouble(java.lang.String, double); + method public void putDoubleArray(java.lang.String, double[]); + method public void putFloat(java.lang.String, float); + method public void putFloatArray(java.lang.String, float[]); + method public void putInt(java.lang.String, int); + method public void putIntArray(java.lang.String, int[]); + method public void putIntegerArrayList(java.lang.String, java.util.ArrayList); + method public void putLong(java.lang.String, long); + method public void putLongArray(java.lang.String, long[]); + method public void putParcelable(java.lang.String, android.os.Parcelable); + method public void putParcelableArray(java.lang.String, android.os.Parcelable[]); + method public void putParcelableArrayList(java.lang.String, java.util.ArrayList); + method public void putSerializable(java.lang.String, java.io.Serializable); + method public void putShort(java.lang.String, short); + method public void putShortArray(java.lang.String, short[]); + method public void putSparseParcelableArray(java.lang.String, android.util.SparseArray); + method public void putString(java.lang.String, java.lang.String); + method public void putStringArray(java.lang.String, java.lang.String[]); + method public void putStringArrayList(java.lang.String, java.util.ArrayList); + method public void readFromParcel(android.os.Parcel); + method public void remove(java.lang.String); + method public void setClassLoader(java.lang.ClassLoader); + method public int size(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + field public static final android.os.Bundle EMPTY; + } + + public final class CancellationSignal { + ctor public CancellationSignal(); + method public void cancel(); + method public boolean isCanceled(); + method public void setOnCancelListener(android.os.CancellationSignal.OnCancelListener); + method public void throwIfCanceled(); + } + + public static abstract interface CancellationSignal.OnCancelListener { + method public abstract void onCancel(); + } + + public class ConditionVariable { + ctor public ConditionVariable(); + ctor public ConditionVariable(boolean); + method public void block(); + method public boolean block(long); + method public void close(); + method public void open(); + } + + public abstract class CountDownTimer { + ctor public CountDownTimer(long, long); + method public final void cancel(); + method public abstract void onFinish(); + method public abstract void onTick(long); + method public final synchronized android.os.CountDownTimer start(); + } + + public class DeadObjectException extends android.os.RemoteException { + ctor public DeadObjectException(); + } + + public final class Debug { + method public static deprecated void changeDebugPort(int); + method public static void dumpHprofData(java.lang.String) throws java.io.IOException; + method public static boolean dumpService(java.lang.String, java.io.FileDescriptor, java.lang.String[]); + method public static void enableEmulatorTraceOutput(); + method public static final int getBinderDeathObjectCount(); + method public static final int getBinderLocalObjectCount(); + method public static final int getBinderProxyObjectCount(); + method public static int getBinderReceivedTransactions(); + method public static int getBinderSentTransactions(); + method public static int getGlobalAllocCount(); + method public static int getGlobalAllocSize(); + method public static int getGlobalClassInitCount(); + method public static int getGlobalClassInitTime(); + method public static deprecated int getGlobalExternalAllocCount(); + method public static deprecated int getGlobalExternalAllocSize(); + method public static deprecated int getGlobalExternalFreedCount(); + method public static deprecated int getGlobalExternalFreedSize(); + method public static int getGlobalFreedCount(); + method public static int getGlobalFreedSize(); + method public static int getGlobalGcInvocationCount(); + method public static int getLoadedClassCount(); + method public static void getMemoryInfo(android.os.Debug.MemoryInfo); + method public static long getNativeHeapAllocatedSize(); + method public static long getNativeHeapFreeSize(); + method public static long getNativeHeapSize(); + method public static long getPss(); + method public static int getThreadAllocCount(); + method public static int getThreadAllocSize(); + method public static deprecated int getThreadExternalAllocCount(); + method public static deprecated int getThreadExternalAllocSize(); + method public static int getThreadGcInvocationCount(); + method public static boolean isDebuggerConnected(); + method public static void printLoadedClasses(int); + method public static void resetAllCounts(); + method public static void resetGlobalAllocCount(); + method public static void resetGlobalAllocSize(); + method public static void resetGlobalClassInitCount(); + method public static void resetGlobalClassInitTime(); + method public static deprecated void resetGlobalExternalAllocCount(); + method public static deprecated void resetGlobalExternalAllocSize(); + method public static deprecated void resetGlobalExternalFreedCount(); + method public static deprecated void resetGlobalExternalFreedSize(); + method public static void resetGlobalFreedCount(); + method public static void resetGlobalFreedSize(); + method public static void resetGlobalGcInvocationCount(); + method public static void resetThreadAllocCount(); + method public static void resetThreadAllocSize(); + method public static deprecated void resetThreadExternalAllocCount(); + method public static deprecated void resetThreadExternalAllocSize(); + method public static void resetThreadGcInvocationCount(); + method public static deprecated int setAllocationLimit(int); + method public static deprecated int setGlobalAllocationLimit(int); + method public static void startAllocCounting(); + method public static void startMethodTracing(); + method public static void startMethodTracing(java.lang.String); + method public static void startMethodTracing(java.lang.String, int); + method public static void startMethodTracing(java.lang.String, int, int); + method public static void startNativeTracing(); + method public static void stopAllocCounting(); + method public static void stopMethodTracing(); + method public static void stopNativeTracing(); + method public static long threadCpuTimeNanos(); + method public static void waitForDebugger(); + method public static boolean waitingForDebugger(); + field public static final int SHOW_CLASSLOADER = 2; // 0x2 + field public static final int SHOW_FULL_DETAIL = 1; // 0x1 + field public static final int SHOW_INITIALIZED = 4; // 0x4 + field public static final int TRACE_COUNT_ALLOCS = 1; // 0x1 + } + + public static class Debug.InstructionCount { + ctor public Debug.InstructionCount(); + method public boolean collect(); + method public int globalMethodInvocations(); + method public int globalTotal(); + method public boolean resetAndStart(); + } + + public static class Debug.MemoryInfo implements android.os.Parcelable { + ctor public Debug.MemoryInfo(); + method public int describeContents(); + method public static java.lang.String getOtherLabel(int); + method public int getOtherPrivateDirty(int); + method public int getOtherPss(int); + method public int getOtherSharedDirty(int); + method public int getTotalPrivateDirty(); + method public int getTotalPss(); + method public int getTotalSharedDirty(); + method public void readFromParcel(android.os.Parcel); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + field public int dalvikPrivateDirty; + field public int dalvikPss; + field public int dalvikSharedDirty; + field public int nativePrivateDirty; + field public int nativePss; + field public int nativeSharedDirty; + field public int otherPrivateDirty; + field public int otherPss; + field public int otherSharedDirty; + } + + public class DropBoxManager { + ctor protected DropBoxManager(); + method public void addData(java.lang.String, byte[], int); + method public void addFile(java.lang.String, java.io.File, int) throws java.io.IOException; + method public void addText(java.lang.String, java.lang.String); + method public android.os.DropBoxManager.Entry getNextEntry(java.lang.String, long); + method public boolean isTagEnabled(java.lang.String); + field public static final java.lang.String ACTION_DROPBOX_ENTRY_ADDED = "android.intent.action.DROPBOX_ENTRY_ADDED"; + field public static final java.lang.String EXTRA_TAG = "tag"; + field public static final java.lang.String EXTRA_TIME = "time"; + field public static final int IS_EMPTY = 1; // 0x1 + field public static final int IS_GZIPPED = 4; // 0x4 + field public static final int IS_TEXT = 2; // 0x2 + } + + public static class DropBoxManager.Entry implements java.io.Closeable android.os.Parcelable { + ctor public DropBoxManager.Entry(java.lang.String, long); + ctor public DropBoxManager.Entry(java.lang.String, long, java.lang.String); + ctor public DropBoxManager.Entry(java.lang.String, long, byte[], int); + ctor public DropBoxManager.Entry(java.lang.String, long, android.os.ParcelFileDescriptor, int); + ctor public DropBoxManager.Entry(java.lang.String, long, java.io.File, int) throws java.io.IOException; + method public void close(); + method public int describeContents(); + method public int getFlags(); + method public java.io.InputStream getInputStream() throws java.io.IOException; + method public java.lang.String getTag(); + method public java.lang.String getText(int); + method public long getTimeMillis(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + } + + public class Environment { + ctor public Environment(); + method public static java.io.File getDataDirectory(); + method public static java.io.File getDownloadCacheDirectory(); + method public static java.io.File getExternalStorageDirectory(); + method public static java.io.File getExternalStoragePublicDirectory(java.lang.String); + method public static java.lang.String getExternalStorageState(); + method public static java.io.File getRootDirectory(); + method public static boolean isExternalStorageEmulated(); + method public static boolean isExternalStorageRemovable(); + field public static java.lang.String DIRECTORY_ALARMS; + field public static java.lang.String DIRECTORY_DCIM; + field public static java.lang.String DIRECTORY_DOWNLOADS; + field public static java.lang.String DIRECTORY_MOVIES; + field public static java.lang.String DIRECTORY_MUSIC; + field public static java.lang.String DIRECTORY_NOTIFICATIONS; + field public static java.lang.String DIRECTORY_PICTURES; + field public static java.lang.String DIRECTORY_PODCASTS; + field public static java.lang.String DIRECTORY_RINGTONES; + field public static final java.lang.String MEDIA_BAD_REMOVAL = "bad_removal"; + field public static final java.lang.String MEDIA_CHECKING = "checking"; + field public static final java.lang.String MEDIA_MOUNTED = "mounted"; + field public static final java.lang.String MEDIA_MOUNTED_READ_ONLY = "mounted_ro"; + field public static final java.lang.String MEDIA_NOFS = "nofs"; + field public static final java.lang.String MEDIA_REMOVED = "removed"; + field public static final java.lang.String MEDIA_SHARED = "shared"; + field public static final java.lang.String MEDIA_UNMOUNTABLE = "unmountable"; + field public static final java.lang.String MEDIA_UNMOUNTED = "unmounted"; + } + + public abstract class FileObserver { + ctor public FileObserver(java.lang.String); + ctor public FileObserver(java.lang.String, int); + method public abstract void onEvent(int, java.lang.String); + method public void startWatching(); + method public void stopWatching(); + field public static final int ACCESS = 1; // 0x1 + field public static final int ALL_EVENTS = 4095; // 0xfff + field public static final int ATTRIB = 4; // 0x4 + field public static final int CLOSE_NOWRITE = 16; // 0x10 + field public static final int CLOSE_WRITE = 8; // 0x8 + field public static final int CREATE = 256; // 0x100 + field public static final int DELETE = 512; // 0x200 + field public static final int DELETE_SELF = 1024; // 0x400 + field public static final int MODIFY = 2; // 0x2 + field public static final int MOVED_FROM = 64; // 0x40 + field public static final int MOVED_TO = 128; // 0x80 + field public static final int MOVE_SELF = 2048; // 0x800 + field public static final int OPEN = 32; // 0x20 + } + + public class Handler { + ctor public Handler(); + ctor public Handler(android.os.Handler.Callback); + ctor public Handler(android.os.Looper); + ctor public Handler(android.os.Looper, android.os.Handler.Callback); + method public void dispatchMessage(android.os.Message); + method public final void dump(android.util.Printer, java.lang.String); + method public final android.os.Looper getLooper(); + method public java.lang.String getMessageName(android.os.Message); + method public void handleMessage(android.os.Message); + method public final boolean hasMessages(int); + method public final boolean hasMessages(int, java.lang.Object); + method public final android.os.Message obtainMessage(); + method public final android.os.Message obtainMessage(int); + method public final android.os.Message obtainMessage(int, java.lang.Object); + method public final android.os.Message obtainMessage(int, int, int); + method public final android.os.Message obtainMessage(int, int, int, java.lang.Object); + method public final boolean post(java.lang.Runnable); + method public final boolean postAtFrontOfQueue(java.lang.Runnable); + method public final boolean postAtTime(java.lang.Runnable, long); + method public final boolean postAtTime(java.lang.Runnable, java.lang.Object, long); + method public final boolean postDelayed(java.lang.Runnable, long); + method public final void removeCallbacks(java.lang.Runnable); + method public final void removeCallbacks(java.lang.Runnable, java.lang.Object); + method public final void removeCallbacksAndMessages(java.lang.Object); + method public final void removeMessages(int); + method public final void removeMessages(int, java.lang.Object); + method public final boolean sendEmptyMessage(int); + method public final boolean sendEmptyMessageAtTime(int, long); + method public final boolean sendEmptyMessageDelayed(int, long); + method public final boolean sendMessage(android.os.Message); + method public final boolean sendMessageAtFrontOfQueue(android.os.Message); + method public boolean sendMessageAtTime(android.os.Message, long); + method public final boolean sendMessageDelayed(android.os.Message, long); + } + + public static abstract interface Handler.Callback { + method public abstract boolean handleMessage(android.os.Message); + } + + public class HandlerThread extends java.lang.Thread { + ctor public HandlerThread(java.lang.String); + ctor public HandlerThread(java.lang.String, int); + method public android.os.Looper getLooper(); + method public int getThreadId(); + method protected void onLooperPrepared(); + method public boolean quit(); + } + + public abstract interface IBinder { + method public abstract void dump(java.io.FileDescriptor, java.lang.String[]) throws android.os.RemoteException; + method public abstract void dumpAsync(java.io.FileDescriptor, java.lang.String[]) throws android.os.RemoteException; + method public abstract java.lang.String getInterfaceDescriptor() throws android.os.RemoteException; + method public abstract boolean isBinderAlive(); + method public abstract void linkToDeath(android.os.IBinder.DeathRecipient, int) throws android.os.RemoteException; + method public abstract boolean pingBinder(); + method public abstract android.os.IInterface queryLocalInterface(java.lang.String); + method public abstract boolean transact(int, android.os.Parcel, android.os.Parcel, int) throws android.os.RemoteException; + method public abstract boolean unlinkToDeath(android.os.IBinder.DeathRecipient, int); + field public static final int DUMP_TRANSACTION = 1598311760; // 0x5f444d50 + field public static final int FIRST_CALL_TRANSACTION = 1; // 0x1 + field public static final int FLAG_ONEWAY = 1; // 0x1 + field public static final int INTERFACE_TRANSACTION = 1598968902; // 0x5f4e5446 + field public static final int LAST_CALL_TRANSACTION = 16777215; // 0xffffff + field public static final int LIKE_TRANSACTION = 1598835019; // 0x5f4c494b + field public static final int PING_TRANSACTION = 1599098439; // 0x5f504e47 + field public static final int TWEET_TRANSACTION = 1599362900; // 0x5f545754 + } + + public static abstract interface IBinder.DeathRecipient { + method public abstract void binderDied(); + } + + public abstract interface IInterface { + method public abstract android.os.IBinder asBinder(); + } + + public class Looper { + method public void dump(android.util.Printer, java.lang.String); + method public static android.os.Looper getMainLooper(); + method public java.lang.Thread getThread(); + method public static void loop(); + method public static android.os.Looper myLooper(); + method public static android.os.MessageQueue myQueue(); + method public static void prepare(); + method public static void prepareMainLooper(); + method public void quit(); + method public void setMessageLogging(android.util.Printer); + } + + public class MemoryFile { + ctor public MemoryFile(java.lang.String, int) throws java.io.IOException; + method public synchronized boolean allowPurging(boolean) throws java.io.IOException; + method public void close(); + method public java.io.InputStream getInputStream(); + method public java.io.OutputStream getOutputStream(); + method public boolean isPurgingAllowed(); + method public int length(); + method public int readBytes(byte[], int, int, int) throws java.io.IOException; + method public void writeBytes(byte[], int, int, int) throws java.io.IOException; + } + + public final class Message implements android.os.Parcelable { + ctor public Message(); + method public void copyFrom(android.os.Message); + method public int describeContents(); + method public java.lang.Runnable getCallback(); + method public android.os.Bundle getData(); + method public android.os.Handler getTarget(); + method public long getWhen(); + method public static android.os.Message obtain(); + method public static android.os.Message obtain(android.os.Message); + method public static android.os.Message obtain(android.os.Handler); + method public static android.os.Message obtain(android.os.Handler, java.lang.Runnable); + method public static android.os.Message obtain(android.os.Handler, int); + method public static android.os.Message obtain(android.os.Handler, int, java.lang.Object); + method public static android.os.Message obtain(android.os.Handler, int, int, int); + method public static android.os.Message obtain(android.os.Handler, int, int, int, java.lang.Object); + method public android.os.Bundle peekData(); + method public void recycle(); + method public void sendToTarget(); + method public void setData(android.os.Bundle); + method public void setTarget(android.os.Handler); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + field public int arg1; + field public int arg2; + field public java.lang.Object obj; + field public android.os.Messenger replyTo; + field public int what; + } + + public class MessageQueue { + method public final void addIdleHandler(android.os.MessageQueue.IdleHandler); + method public final void removeIdleHandler(android.os.MessageQueue.IdleHandler); + } + + public static abstract interface MessageQueue.IdleHandler { + method public abstract boolean queueIdle(); + } + + public final class Messenger implements android.os.Parcelable { + ctor public Messenger(android.os.Handler); + ctor public Messenger(android.os.IBinder); + method public int describeContents(); + method public android.os.IBinder getBinder(); + method public static android.os.Messenger readMessengerOrNullFromParcel(android.os.Parcel); + method public void send(android.os.Message) throws android.os.RemoteException; + method public static void writeMessengerOrNullToParcel(android.os.Messenger, android.os.Parcel); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + } + + public class NetworkOnMainThreadException extends java.lang.RuntimeException { + ctor public NetworkOnMainThreadException(); + } + + public class OperationCanceledException extends java.lang.RuntimeException { + ctor public OperationCanceledException(); + ctor public OperationCanceledException(java.lang.String); + } + + public final class Parcel { + method public final void appendFrom(android.os.Parcel, int, int); + method public final android.os.IBinder[] createBinderArray(); + method public final java.util.ArrayList createBinderArrayList(); + method public final boolean[] createBooleanArray(); + method public final byte[] createByteArray(); + method public final char[] createCharArray(); + method public final double[] createDoubleArray(); + method public final float[] createFloatArray(); + method public final int[] createIntArray(); + method public final long[] createLongArray(); + method public final java.lang.String[] createStringArray(); + method public final java.util.ArrayList createStringArrayList(); + method public final T[] createTypedArray(android.os.Parcelable.Creator); + method public final java.util.ArrayList createTypedArrayList(android.os.Parcelable.Creator); + method public final int dataAvail(); + method public final int dataCapacity(); + method public final int dataPosition(); + method public final int dataSize(); + method public final void enforceInterface(java.lang.String); + method public final boolean hasFileDescriptors(); + method public final byte[] marshall(); + method public static android.os.Parcel obtain(); + method protected static final android.os.Parcel obtain(int); + method public final java.lang.Object[] readArray(java.lang.ClassLoader); + method public final java.util.ArrayList readArrayList(java.lang.ClassLoader); + method public final void readBinderArray(android.os.IBinder[]); + method public final void readBinderList(java.util.List); + method public final void readBooleanArray(boolean[]); + method public final android.os.Bundle readBundle(); + method public final android.os.Bundle readBundle(java.lang.ClassLoader); + method public final byte readByte(); + method public final void readByteArray(byte[]); + method public final void readCharArray(char[]); + method public final double readDouble(); + method public final void readDoubleArray(double[]); + method public final void readException(); + method public final void readException(int, java.lang.String); + method public final android.os.ParcelFileDescriptor readFileDescriptor(); + method public final float readFloat(); + method public final void readFloatArray(float[]); + method public final java.util.HashMap readHashMap(java.lang.ClassLoader); + method public final int readInt(); + method public final void readIntArray(int[]); + method public final void readList(java.util.List, java.lang.ClassLoader); + method public final long readLong(); + method public final void readLongArray(long[]); + method public final void readMap(java.util.Map, java.lang.ClassLoader); + method public final T readParcelable(java.lang.ClassLoader); + method public final android.os.Parcelable[] readParcelableArray(java.lang.ClassLoader); + method public final java.io.Serializable readSerializable(); + method public final android.util.SparseArray readSparseArray(java.lang.ClassLoader); + method public final android.util.SparseBooleanArray readSparseBooleanArray(); + method public final java.lang.String readString(); + method public final void readStringArray(java.lang.String[]); + method public final void readStringList(java.util.List); + method public final android.os.IBinder readStrongBinder(); + method public final void readTypedArray(T[], android.os.Parcelable.Creator); + method public final void readTypedList(java.util.List, android.os.Parcelable.Creator); + method public final java.lang.Object readValue(java.lang.ClassLoader); + method public final void recycle(); + method public final void setDataCapacity(int); + method public final void setDataPosition(int); + method public final void setDataSize(int); + method public final void unmarshall(byte[], int, int); + method public final void writeArray(java.lang.Object[]); + method public final void writeBinderArray(android.os.IBinder[]); + method public final void writeBinderList(java.util.List); + method public final void writeBooleanArray(boolean[]); + method public final void writeBundle(android.os.Bundle); + method public final void writeByte(byte); + method public final void writeByteArray(byte[]); + method public final void writeByteArray(byte[], int, int); + method public final void writeCharArray(char[]); + method public final void writeDouble(double); + method public final void writeDoubleArray(double[]); + method public final void writeException(java.lang.Exception); + method public final void writeFileDescriptor(java.io.FileDescriptor); + method public final void writeFloat(float); + method public final void writeFloatArray(float[]); + method public final void writeInt(int); + method public final void writeIntArray(int[]); + method public final void writeInterfaceToken(java.lang.String); + method public final void writeList(java.util.List); + method public final void writeLong(long); + method public final void writeLongArray(long[]); + method public final void writeMap(java.util.Map); + method public final void writeNoException(); + method public final void writeParcelable(android.os.Parcelable, int); + method public final void writeParcelableArray(T[], int); + method public final void writeSerializable(java.io.Serializable); + method public final void writeSparseArray(android.util.SparseArray); + method public final void writeSparseBooleanArray(android.util.SparseBooleanArray); + method public final void writeString(java.lang.String); + method public final void writeStringArray(java.lang.String[]); + method public final void writeStringList(java.util.List); + method public final void writeStrongBinder(android.os.IBinder); + method public final void writeStrongInterface(android.os.IInterface); + method public final void writeTypedArray(T[], int); + method public final void writeTypedList(java.util.List); + method public final void writeValue(java.lang.Object); + field public static final android.os.Parcelable.Creator STRING_CREATOR; + } + + public class ParcelFileDescriptor implements java.io.Closeable android.os.Parcelable { + ctor public ParcelFileDescriptor(android.os.ParcelFileDescriptor); + method public static android.os.ParcelFileDescriptor adoptFd(int); + method public void close() throws java.io.IOException; + method public static android.os.ParcelFileDescriptor[] createPipe() throws java.io.IOException; + method public int describeContents(); + method public int detachFd(); + method public static android.os.ParcelFileDescriptor dup(java.io.FileDescriptor) throws java.io.IOException; + method public android.os.ParcelFileDescriptor dup() throws java.io.IOException; + method public static android.os.ParcelFileDescriptor fromDatagramSocket(java.net.DatagramSocket); + method public static android.os.ParcelFileDescriptor fromFd(int) throws java.io.IOException; + method public static android.os.ParcelFileDescriptor fromSocket(java.net.Socket); + method public int getFd(); + method public java.io.FileDescriptor getFileDescriptor(); + method public long getStatSize(); + method public static android.os.ParcelFileDescriptor open(java.io.File, int) throws java.io.FileNotFoundException; + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + field public static final int MODE_APPEND = 33554432; // 0x2000000 + field public static final int MODE_CREATE = 134217728; // 0x8000000 + field public static final int MODE_READ_ONLY = 268435456; // 0x10000000 + field public static final int MODE_READ_WRITE = 805306368; // 0x30000000 + field public static final int MODE_TRUNCATE = 67108864; // 0x4000000 + field public static final int MODE_WORLD_READABLE = 1; // 0x1 + field public static final int MODE_WORLD_WRITEABLE = 2; // 0x2 + field public static final int MODE_WRITE_ONLY = 536870912; // 0x20000000 + } + + public static class ParcelFileDescriptor.AutoCloseInputStream extends java.io.FileInputStream { + ctor public ParcelFileDescriptor.AutoCloseInputStream(android.os.ParcelFileDescriptor); + } + + public static class ParcelFileDescriptor.AutoCloseOutputStream extends java.io.FileOutputStream { + ctor public ParcelFileDescriptor.AutoCloseOutputStream(android.os.ParcelFileDescriptor); + } + + public class ParcelFormatException extends java.lang.RuntimeException { + ctor public ParcelFormatException(); + ctor public ParcelFormatException(java.lang.String); + } + + public final class ParcelUuid implements android.os.Parcelable { + ctor public ParcelUuid(java.util.UUID); + method public int describeContents(); + method public static android.os.ParcelUuid fromString(java.lang.String); + method public java.util.UUID getUuid(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + } + + public abstract interface Parcelable { + method public abstract int describeContents(); + method public abstract void writeToParcel(android.os.Parcel, int); + field public static final int CONTENTS_FILE_DESCRIPTOR = 1; // 0x1 + field public static final int PARCELABLE_WRITE_RETURN_VALUE = 1; // 0x1 + } + + public static abstract interface Parcelable.ClassLoaderCreator implements android.os.Parcelable.Creator { + method public abstract T createFromParcel(android.os.Parcel, java.lang.ClassLoader); + } + + public static abstract interface Parcelable.Creator { + method public abstract T createFromParcel(android.os.Parcel); + method public abstract T[] newArray(int); + } + + public class PatternMatcher implements android.os.Parcelable { + ctor public PatternMatcher(java.lang.String, int); + ctor public PatternMatcher(android.os.Parcel); + method public int describeContents(); + method public final java.lang.String getPath(); + method public final int getType(); + method public boolean match(java.lang.String); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + field public static final int PATTERN_LITERAL = 0; // 0x0 + field public static final int PATTERN_PREFIX = 1; // 0x1 + field public static final int PATTERN_SIMPLE_GLOB = 2; // 0x2 + } + + public final class PowerManager { + method public void goToSleep(long); + method public boolean isScreenOn(); + method public android.os.PowerManager.WakeLock newWakeLock(int, java.lang.String); + method public void reboot(java.lang.String); + method public void userActivity(long, boolean); + method public void wakeUp(long); + field public static final int ACQUIRE_CAUSES_WAKEUP = 268435456; // 0x10000000 + 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 deprecated int SCREEN_DIM_WAKE_LOCK = 6; // 0x6 + } + + public final class PowerManager.WakeLock { + method public void acquire(); + method public void acquire(long); + method public boolean isHeld(); + method public void release(); + method public void setReferenceCounted(boolean); + method public void setWorkSource(android.os.WorkSource); + } + + public class Process { + ctor public Process(); + method public static final long getElapsedCpuTime(); + method public static final int getGidForName(java.lang.String); + method public static final int getThreadPriority(int) throws java.lang.IllegalArgumentException; + method public static final int getUidForName(java.lang.String); + method public static final void killProcess(int); + method public static final int myPid(); + method public static final int myTid(); + method public static final int myUid(); + method public static final android.os.UserHandle myUserHandle(); + method public static final void sendSignal(int, int); + method public static final void setThreadPriority(int, int) throws java.lang.IllegalArgumentException, java.lang.SecurityException; + method public static final void setThreadPriority(int) throws java.lang.IllegalArgumentException, java.lang.SecurityException; + method public static final deprecated boolean supportsProcesses(); + field public static final int BLUETOOTH_GID = 2000; // 0x7d0 + field public static final int FIRST_APPLICATION_UID = 10000; // 0x2710 + field public static final int LAST_APPLICATION_UID = 19999; // 0x4e1f + field public static final int PHONE_UID = 1001; // 0x3e9 + field public static final int SIGNAL_KILL = 9; // 0x9 + field public static final int SIGNAL_QUIT = 3; // 0x3 + field public static final int SIGNAL_USR1 = 10; // 0xa + field public static final int SYSTEM_UID = 1000; // 0x3e8 + field public static final int THREAD_PRIORITY_AUDIO = -16; // 0xfffffff0 + field public static final int THREAD_PRIORITY_BACKGROUND = 10; // 0xa + field public static final int THREAD_PRIORITY_DEFAULT = 0; // 0x0 + field public static final int THREAD_PRIORITY_DISPLAY = -4; // 0xfffffffc + field public static final int THREAD_PRIORITY_FOREGROUND = -2; // 0xfffffffe + field public static final int THREAD_PRIORITY_LESS_FAVORABLE = 1; // 0x1 + field public static final int THREAD_PRIORITY_LOWEST = 19; // 0x13 + field public static final int THREAD_PRIORITY_MORE_FAVORABLE = -1; // 0xffffffff + field public static final int THREAD_PRIORITY_URGENT_AUDIO = -19; // 0xffffffed + field public static final int THREAD_PRIORITY_URGENT_DISPLAY = -8; // 0xfffffff8 + } + + public class RecoverySystem { + ctor public RecoverySystem(); + method public static void installPackage(android.content.Context, java.io.File) throws java.io.IOException; + method public static void rebootWipeCache(android.content.Context) throws java.io.IOException; + method public static void rebootWipeUserData(android.content.Context) throws java.io.IOException; + method public static void verifyPackage(java.io.File, android.os.RecoverySystem.ProgressListener, java.io.File) throws java.security.GeneralSecurityException, java.io.IOException; + } + + public static abstract interface RecoverySystem.ProgressListener { + method public abstract void onProgress(int); + } + + public class RemoteCallbackList { + ctor public RemoteCallbackList(); + method public int beginBroadcast(); + method public void finishBroadcast(); + method public java.lang.Object getBroadcastCookie(int); + method public E getBroadcastItem(int); + method public int getRegisteredCallbackCount(); + method public void kill(); + method public void onCallbackDied(E); + method public void onCallbackDied(E, java.lang.Object); + method public boolean register(E); + method public boolean register(E, java.lang.Object); + method public boolean unregister(E); + } + + public class RemoteException extends android.util.AndroidException { + ctor public RemoteException(); + ctor public RemoteException(java.lang.String); + } + + public class ResultReceiver implements android.os.Parcelable { + ctor public ResultReceiver(android.os.Handler); + method public int describeContents(); + method protected void onReceiveResult(int, android.os.Bundle); + method public void send(int, android.os.Bundle); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + } + + public class StatFs { + ctor public StatFs(java.lang.String); + method public int getAvailableBlocks(); + method public int getBlockCount(); + method public int getBlockSize(); + method public int getFreeBlocks(); + method public void restat(java.lang.String); + } + + public final class StrictMode { + method public static android.os.StrictMode.ThreadPolicy allowThreadDiskReads(); + method public static android.os.StrictMode.ThreadPolicy allowThreadDiskWrites(); + method public static void enableDefaults(); + method public static android.os.StrictMode.ThreadPolicy getThreadPolicy(); + method public static android.os.StrictMode.VmPolicy getVmPolicy(); + method public static void noteSlowCall(java.lang.String); + method public static void setThreadPolicy(android.os.StrictMode.ThreadPolicy); + method public static void setVmPolicy(android.os.StrictMode.VmPolicy); + } + + public static final class StrictMode.ThreadPolicy { + field public static final android.os.StrictMode.ThreadPolicy LAX; + } + + public static final class StrictMode.ThreadPolicy.Builder { + ctor public StrictMode.ThreadPolicy.Builder(); + ctor public StrictMode.ThreadPolicy.Builder(android.os.StrictMode.ThreadPolicy); + method public android.os.StrictMode.ThreadPolicy build(); + method public android.os.StrictMode.ThreadPolicy.Builder detectAll(); + method public android.os.StrictMode.ThreadPolicy.Builder detectCustomSlowCalls(); + method public android.os.StrictMode.ThreadPolicy.Builder detectDiskReads(); + method public android.os.StrictMode.ThreadPolicy.Builder detectDiskWrites(); + method public android.os.StrictMode.ThreadPolicy.Builder detectNetwork(); + method public android.os.StrictMode.ThreadPolicy.Builder penaltyDeath(); + method public android.os.StrictMode.ThreadPolicy.Builder penaltyDeathOnNetwork(); + method public android.os.StrictMode.ThreadPolicy.Builder penaltyDialog(); + method public android.os.StrictMode.ThreadPolicy.Builder penaltyDropBox(); + method public android.os.StrictMode.ThreadPolicy.Builder penaltyFlashScreen(); + method public android.os.StrictMode.ThreadPolicy.Builder penaltyLog(); + method public android.os.StrictMode.ThreadPolicy.Builder permitAll(); + method public android.os.StrictMode.ThreadPolicy.Builder permitCustomSlowCalls(); + method public android.os.StrictMode.ThreadPolicy.Builder permitDiskReads(); + method public android.os.StrictMode.ThreadPolicy.Builder permitDiskWrites(); + method public android.os.StrictMode.ThreadPolicy.Builder permitNetwork(); + } + + public static final class StrictMode.VmPolicy { + field public static final android.os.StrictMode.VmPolicy LAX; + } + + public static final class StrictMode.VmPolicy.Builder { + ctor public StrictMode.VmPolicy.Builder(); + ctor public StrictMode.VmPolicy.Builder(android.os.StrictMode.VmPolicy); + method public android.os.StrictMode.VmPolicy build(); + method public android.os.StrictMode.VmPolicy.Builder detectActivityLeaks(); + method public android.os.StrictMode.VmPolicy.Builder detectAll(); + method public android.os.StrictMode.VmPolicy.Builder detectLeakedClosableObjects(); + method public android.os.StrictMode.VmPolicy.Builder detectLeakedRegistrationObjects(); + method public android.os.StrictMode.VmPolicy.Builder detectLeakedSqlLiteObjects(); + method public android.os.StrictMode.VmPolicy.Builder penaltyDeath(); + method public android.os.StrictMode.VmPolicy.Builder penaltyDropBox(); + method public android.os.StrictMode.VmPolicy.Builder penaltyLog(); + method public android.os.StrictMode.VmPolicy.Builder setClassInstanceLimit(java.lang.Class, int); + } + + public final class SystemClock { + method public static long currentThreadTimeMillis(); + method public static long elapsedRealtime(); + method public static long elapsedRealtimeNanos(); + method public static boolean setCurrentTimeMillis(long); + method public static void sleep(long); + method public static long uptimeMillis(); + } + + public abstract class TokenWatcher { + ctor public TokenWatcher(android.os.Handler, java.lang.String); + method public void acquire(android.os.IBinder, java.lang.String); + method public abstract void acquired(); + method public void cleanup(android.os.IBinder, boolean); + method public void dump(); + method public void dump(java.io.PrintWriter); + method public boolean isAcquired(); + method public void release(android.os.IBinder); + method public abstract void released(); + } + + public class TransactionTooLargeException extends android.os.RemoteException { + ctor public TransactionTooLargeException(); + } + + public final class UserHandle implements android.os.Parcelable { + ctor public UserHandle(android.os.Parcel); + method public int describeContents(); + method public static android.os.UserHandle readFromParcel(android.os.Parcel); + method public void writeToParcel(android.os.Parcel, int); + method public static void writeToParcel(android.os.UserHandle, android.os.Parcel); + field public static final android.os.Parcelable.Creator CREATOR; + } + + public class UserManager { + method public long getSerialNumberForUser(android.os.UserHandle); + method public int getUserCount(); + method public android.os.UserHandle getUserForSerialNumber(long); + method public java.lang.String getUserName(); + method public boolean isUserAGoat(); + method public boolean isUserRunning(android.os.UserHandle); + method public boolean isUserRunningOrStopping(android.os.UserHandle); + } + + public abstract class Vibrator { + method public abstract void cancel(); + method public abstract boolean hasVibrator(); + method public abstract void vibrate(long); + method public abstract void vibrate(long[], int); + } + + public class WorkSource implements android.os.Parcelable { + ctor public WorkSource(); + ctor public WorkSource(android.os.WorkSource); + method public boolean add(android.os.WorkSource); + method public void clear(); + method public int describeContents(); + method public boolean diff(android.os.WorkSource); + method public boolean remove(android.os.WorkSource); + method public void set(android.os.WorkSource); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + } + +} + +package android.os.storage { + + public abstract class OnObbStateChangeListener { + ctor public OnObbStateChangeListener(); + method public void onObbStateChange(java.lang.String, int); + field public static final int ERROR_ALREADY_MOUNTED = 24; // 0x18 + field public static final int ERROR_COULD_NOT_MOUNT = 21; // 0x15 + field public static final int ERROR_COULD_NOT_UNMOUNT = 22; // 0x16 + field public static final int ERROR_INTERNAL = 20; // 0x14 + field public static final int ERROR_NOT_MOUNTED = 23; // 0x17 + field public static final int ERROR_PERMISSION_DENIED = 25; // 0x19 + field public static final int MOUNTED = 1; // 0x1 + field public static final int UNMOUNTED = 2; // 0x2 + } + + public class StorageManager { + method public java.lang.String getMountedObbPath(java.lang.String); + method public boolean isObbMounted(java.lang.String); + method public boolean mountObb(java.lang.String, java.lang.String, android.os.storage.OnObbStateChangeListener); + method public boolean unmountObb(java.lang.String, boolean, android.os.storage.OnObbStateChangeListener); + } + +} + +package android.preference { + + public class CheckBoxPreference extends android.preference.TwoStatePreference { + ctor public CheckBoxPreference(android.content.Context, android.util.AttributeSet, int); + ctor public CheckBoxPreference(android.content.Context, android.util.AttributeSet); + ctor public CheckBoxPreference(android.content.Context); + } + + public abstract class DialogPreference extends android.preference.Preference implements android.content.DialogInterface.OnClickListener android.content.DialogInterface.OnDismissListener android.preference.PreferenceManager.OnActivityDestroyListener { + ctor public DialogPreference(android.content.Context, android.util.AttributeSet, int); + ctor public DialogPreference(android.content.Context, android.util.AttributeSet); + method public android.app.Dialog getDialog(); + method public android.graphics.drawable.Drawable getDialogIcon(); + method public int getDialogLayoutResource(); + method public java.lang.CharSequence getDialogMessage(); + method public java.lang.CharSequence getDialogTitle(); + method public java.lang.CharSequence getNegativeButtonText(); + method public java.lang.CharSequence getPositiveButtonText(); + method public void onActivityDestroy(); + method protected void onBindDialogView(android.view.View); + method public void onClick(android.content.DialogInterface, int); + method protected android.view.View onCreateDialogView(); + method protected void onDialogClosed(boolean); + method public void onDismiss(android.content.DialogInterface); + method protected void onPrepareDialogBuilder(android.app.AlertDialog.Builder); + method public void setDialogIcon(android.graphics.drawable.Drawable); + method public void setDialogIcon(int); + method public void setDialogLayoutResource(int); + method public void setDialogMessage(java.lang.CharSequence); + method public void setDialogMessage(int); + method public void setDialogTitle(java.lang.CharSequence); + method public void setDialogTitle(int); + method public void setNegativeButtonText(java.lang.CharSequence); + method public void setNegativeButtonText(int); + method public void setPositiveButtonText(java.lang.CharSequence); + method public void setPositiveButtonText(int); + method protected void showDialog(android.os.Bundle); + } + + public class EditTextPreference extends android.preference.DialogPreference { + ctor public EditTextPreference(android.content.Context, android.util.AttributeSet, int); + ctor public EditTextPreference(android.content.Context, android.util.AttributeSet); + ctor public EditTextPreference(android.content.Context); + method public android.widget.EditText getEditText(); + method public java.lang.String getText(); + method protected void onAddEditTextToDialogView(android.view.View, android.widget.EditText); + method public void setText(java.lang.String); + } + + public class ListPreference extends android.preference.DialogPreference { + ctor public ListPreference(android.content.Context, android.util.AttributeSet); + ctor public ListPreference(android.content.Context); + method public int findIndexOfValue(java.lang.String); + method public java.lang.CharSequence[] getEntries(); + method public java.lang.CharSequence getEntry(); + method public java.lang.CharSequence[] getEntryValues(); + method public java.lang.String getValue(); + method public void setEntries(java.lang.CharSequence[]); + method public void setEntries(int); + method public void setEntryValues(java.lang.CharSequence[]); + method public void setEntryValues(int); + method public void setValue(java.lang.String); + method public void setValueIndex(int); + } + + public class MultiSelectListPreference extends android.preference.DialogPreference { + ctor public MultiSelectListPreference(android.content.Context, android.util.AttributeSet); + ctor public MultiSelectListPreference(android.content.Context); + method public int findIndexOfValue(java.lang.String); + method public java.lang.CharSequence[] getEntries(); + method public java.lang.CharSequence[] getEntryValues(); + method public java.util.Set getValues(); + method public void setEntries(java.lang.CharSequence[]); + method public void setEntries(int); + method public void setEntryValues(java.lang.CharSequence[]); + method public void setEntryValues(int); + method public void setValues(java.util.Set); + } + + public class Preference implements java.lang.Comparable { + ctor public Preference(android.content.Context, android.util.AttributeSet, int); + ctor public Preference(android.content.Context, android.util.AttributeSet); + ctor public Preference(android.content.Context); + method protected boolean callChangeListener(java.lang.Object); + method public int compareTo(android.preference.Preference); + method protected android.preference.Preference findPreferenceInHierarchy(java.lang.String); + method public android.content.Context getContext(); + method public java.lang.String getDependency(); + method public android.content.SharedPreferences.Editor getEditor(); + method public android.os.Bundle getExtras(); + method public java.lang.String getFragment(); + method public android.graphics.drawable.Drawable getIcon(); + method public android.content.Intent getIntent(); + method public java.lang.String getKey(); + method public int getLayoutResource(); + method public android.preference.Preference.OnPreferenceChangeListener getOnPreferenceChangeListener(); + method public android.preference.Preference.OnPreferenceClickListener getOnPreferenceClickListener(); + method public int getOrder(); + method protected boolean getPersistedBoolean(boolean); + method protected float getPersistedFloat(float); + method protected int getPersistedInt(int); + method protected long getPersistedLong(long); + method protected java.lang.String getPersistedString(java.lang.String); + method public android.preference.PreferenceManager getPreferenceManager(); + method public android.content.SharedPreferences getSharedPreferences(); + method public boolean getShouldDisableView(); + method public java.lang.CharSequence getSummary(); + method public java.lang.CharSequence getTitle(); + method public int getTitleRes(); + method public android.view.View getView(android.view.View, android.view.ViewGroup); + method public int getWidgetLayoutResource(); + method public boolean hasKey(); + method public boolean isEnabled(); + method public boolean isPersistent(); + method public boolean isSelectable(); + method protected void notifyChanged(); + method public void notifyDependencyChange(boolean); + method protected void notifyHierarchyChanged(); + method protected void onAttachedToActivity(); + method protected void onAttachedToHierarchy(android.preference.PreferenceManager); + method protected void onBindView(android.view.View); + method protected void onClick(); + method protected android.view.View onCreateView(android.view.ViewGroup); + method public void onDependencyChanged(android.preference.Preference, boolean); + method protected java.lang.Object onGetDefaultValue(android.content.res.TypedArray, int); + method protected void onPrepareForRemoval(); + method protected void onRestoreInstanceState(android.os.Parcelable); + method protected android.os.Parcelable onSaveInstanceState(); + method protected void onSetInitialValue(boolean, java.lang.Object); + method public android.os.Bundle peekExtras(); + method protected boolean persistBoolean(boolean); + method protected boolean persistFloat(float); + method protected boolean persistInt(int); + method protected boolean persistLong(long); + method protected boolean persistString(java.lang.String); + method public void restoreHierarchyState(android.os.Bundle); + method public void saveHierarchyState(android.os.Bundle); + method public void setDefaultValue(java.lang.Object); + method public void setDependency(java.lang.String); + method public void setEnabled(boolean); + method public void setFragment(java.lang.String); + method public void setIcon(android.graphics.drawable.Drawable); + method public void setIcon(int); + method public void setIntent(android.content.Intent); + method public void setKey(java.lang.String); + method public void setLayoutResource(int); + method public void setOnPreferenceChangeListener(android.preference.Preference.OnPreferenceChangeListener); + method public void setOnPreferenceClickListener(android.preference.Preference.OnPreferenceClickListener); + method public void setOrder(int); + method public void setPersistent(boolean); + method public void setSelectable(boolean); + method public void setShouldDisableView(boolean); + method public void setSummary(java.lang.CharSequence); + method public void setSummary(int); + method public void setTitle(java.lang.CharSequence); + method public void setTitle(int); + method public void setWidgetLayoutResource(int); + method public boolean shouldCommit(); + method public boolean shouldDisableDependents(); + method protected boolean shouldPersist(); + field public static final int DEFAULT_ORDER = 2147483647; // 0x7fffffff + } + + public static class Preference.BaseSavedState extends android.view.AbsSavedState { + ctor public Preference.BaseSavedState(android.os.Parcel); + ctor public Preference.BaseSavedState(android.os.Parcelable); + field public static final android.os.Parcelable.Creator CREATOR; + } + + public static abstract interface Preference.OnPreferenceChangeListener { + method public abstract boolean onPreferenceChange(android.preference.Preference, java.lang.Object); + } + + public static abstract interface Preference.OnPreferenceClickListener { + method public abstract boolean onPreferenceClick(android.preference.Preference); + } + + public abstract class PreferenceActivity extends android.app.ListActivity implements android.preference.PreferenceFragment.OnPreferenceStartFragmentCallback { + ctor public PreferenceActivity(); + method public deprecated void addPreferencesFromIntent(android.content.Intent); + method public deprecated void addPreferencesFromResource(int); + method public deprecated android.preference.Preference findPreference(java.lang.CharSequence); + method public void finishPreferencePanel(android.app.Fragment, int, android.content.Intent); + method public deprecated android.preference.PreferenceManager getPreferenceManager(); + method public deprecated android.preference.PreferenceScreen getPreferenceScreen(); + method public boolean hasHeaders(); + method public void invalidateHeaders(); + method public boolean isMultiPane(); + method public void loadHeadersFromResource(int, java.util.List); + method public void onBuildHeaders(java.util.List); + method public android.content.Intent onBuildStartFragmentIntent(java.lang.String, android.os.Bundle, int, int); + method public android.preference.PreferenceActivity.Header onGetInitialHeader(); + method public android.preference.PreferenceActivity.Header onGetNewHeader(); + method public void onHeaderClick(android.preference.PreferenceActivity.Header, int); + method public boolean onIsHidingHeaders(); + method public boolean onIsMultiPane(); + method public boolean onPreferenceStartFragment(android.preference.PreferenceFragment, android.preference.Preference); + method public deprecated boolean onPreferenceTreeClick(android.preference.PreferenceScreen, android.preference.Preference); + method public void setListFooter(android.view.View); + method public void setParentTitle(java.lang.CharSequence, java.lang.CharSequence, android.view.View.OnClickListener); + method public deprecated void setPreferenceScreen(android.preference.PreferenceScreen); + method public void showBreadCrumbs(java.lang.CharSequence, java.lang.CharSequence); + method public void startPreferenceFragment(android.app.Fragment, boolean); + method public void startPreferencePanel(java.lang.String, android.os.Bundle, int, java.lang.CharSequence, android.app.Fragment, int); + method public void startWithFragment(java.lang.String, android.os.Bundle, android.app.Fragment, int); + method public void startWithFragment(java.lang.String, android.os.Bundle, android.app.Fragment, int, int, int); + method public void switchToHeader(java.lang.String, android.os.Bundle); + method public void switchToHeader(android.preference.PreferenceActivity.Header); + field public static final java.lang.String EXTRA_NO_HEADERS = ":android:no_headers"; + field public static final java.lang.String EXTRA_SHOW_FRAGMENT = ":android:show_fragment"; + field public static final java.lang.String EXTRA_SHOW_FRAGMENT_ARGUMENTS = ":android:show_fragment_args"; + field public static final java.lang.String EXTRA_SHOW_FRAGMENT_SHORT_TITLE = ":android:show_fragment_short_title"; + field public static final java.lang.String EXTRA_SHOW_FRAGMENT_TITLE = ":android:show_fragment_title"; + field public static final long HEADER_ID_UNDEFINED = -1L; // 0xffffffffffffffffL + } + + public static final class PreferenceActivity.Header implements android.os.Parcelable { + ctor public PreferenceActivity.Header(); + method public int describeContents(); + method public java.lang.CharSequence getBreadCrumbShortTitle(android.content.res.Resources); + method public java.lang.CharSequence getBreadCrumbTitle(android.content.res.Resources); + method public java.lang.CharSequence getSummary(android.content.res.Resources); + method public java.lang.CharSequence getTitle(android.content.res.Resources); + method public void readFromParcel(android.os.Parcel); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + field public java.lang.CharSequence breadCrumbShortTitle; + field public int breadCrumbShortTitleRes; + field public java.lang.CharSequence breadCrumbTitle; + field public int breadCrumbTitleRes; + field public android.os.Bundle extras; + field public java.lang.String fragment; + field public android.os.Bundle fragmentArguments; + field public int iconRes; + field public long id; + field public android.content.Intent intent; + field public java.lang.CharSequence summary; + field public int summaryRes; + field public java.lang.CharSequence title; + field public int titleRes; + } + + public class PreferenceCategory extends android.preference.PreferenceGroup { + ctor public PreferenceCategory(android.content.Context, android.util.AttributeSet, int); + ctor public PreferenceCategory(android.content.Context, android.util.AttributeSet); + ctor public PreferenceCategory(android.content.Context); + } + + public abstract class PreferenceFragment extends android.app.Fragment { + ctor public PreferenceFragment(); + method public void addPreferencesFromIntent(android.content.Intent); + method public void addPreferencesFromResource(int); + method public android.preference.Preference findPreference(java.lang.CharSequence); + method public android.preference.PreferenceManager getPreferenceManager(); + method public android.preference.PreferenceScreen getPreferenceScreen(); + method public boolean onPreferenceTreeClick(android.preference.PreferenceScreen, android.preference.Preference); + method public void setPreferenceScreen(android.preference.PreferenceScreen); + } + + public static abstract interface PreferenceFragment.OnPreferenceStartFragmentCallback { + method public abstract boolean onPreferenceStartFragment(android.preference.PreferenceFragment, android.preference.Preference); + } + + public abstract class PreferenceGroup extends android.preference.Preference { + ctor public PreferenceGroup(android.content.Context, android.util.AttributeSet, int); + ctor public PreferenceGroup(android.content.Context, android.util.AttributeSet); + method public void addItemFromInflater(android.preference.Preference); + method public boolean addPreference(android.preference.Preference); + method protected void dispatchRestoreInstanceState(android.os.Bundle); + method protected void dispatchSaveInstanceState(android.os.Bundle); + method public android.preference.Preference findPreference(java.lang.CharSequence); + method public android.preference.Preference getPreference(int); + method public int getPreferenceCount(); + method protected boolean isOnSameScreenAsChildren(); + method public boolean isOrderingAsAdded(); + method protected boolean onPrepareAddPreference(android.preference.Preference); + method public void removeAll(); + method public boolean removePreference(android.preference.Preference); + method public void setOrderingAsAdded(boolean); + } + + public class PreferenceManager { + method public android.preference.PreferenceScreen createPreferenceScreen(android.content.Context); + method public android.preference.Preference findPreference(java.lang.CharSequence); + method public static android.content.SharedPreferences getDefaultSharedPreferences(android.content.Context); + method public android.content.SharedPreferences getSharedPreferences(); + method public int getSharedPreferencesMode(); + method public java.lang.String getSharedPreferencesName(); + method public static void setDefaultValues(android.content.Context, int, boolean); + method public static void setDefaultValues(android.content.Context, java.lang.String, int, int, boolean); + method public void setSharedPreferencesMode(int); + method public void setSharedPreferencesName(java.lang.String); + field public static final java.lang.String KEY_HAS_SET_DEFAULT_VALUES = "_has_set_default_values"; + field public static final java.lang.String METADATA_KEY_PREFERENCES = "android.preference"; + } + + public static abstract interface PreferenceManager.OnActivityDestroyListener { + method public abstract void onActivityDestroy(); + } + + public static abstract interface PreferenceManager.OnActivityResultListener { + method public abstract boolean onActivityResult(int, int, android.content.Intent); + } + + public static abstract interface PreferenceManager.OnActivityStopListener { + method public abstract void onActivityStop(); + } + + public final class PreferenceScreen extends android.preference.PreferenceGroup implements android.widget.AdapterView.OnItemClickListener android.content.DialogInterface.OnDismissListener { + method public void bind(android.widget.ListView); + method public android.app.Dialog getDialog(); + method public android.widget.ListAdapter getRootAdapter(); + method protected android.widget.ListAdapter onCreateRootAdapter(); + method public void onDismiss(android.content.DialogInterface); + method public void onItemClick(android.widget.AdapterView, android.view.View, int, long); + } + + public class RingtonePreference extends android.preference.Preference implements android.preference.PreferenceManager.OnActivityResultListener { + ctor public RingtonePreference(android.content.Context, android.util.AttributeSet, int); + ctor public RingtonePreference(android.content.Context, android.util.AttributeSet); + ctor public RingtonePreference(android.content.Context); + method public int getRingtoneType(); + method public boolean getShowDefault(); + method public boolean getShowSilent(); + method public boolean onActivityResult(int, int, android.content.Intent); + method protected void onPrepareRingtonePickerIntent(android.content.Intent); + method protected android.net.Uri onRestoreRingtone(); + method protected void onSaveRingtone(android.net.Uri); + method public void setRingtoneType(int); + method public void setShowDefault(boolean); + method public void setShowSilent(boolean); + } + + public class SwitchPreference extends android.preference.TwoStatePreference { + ctor public SwitchPreference(android.content.Context, android.util.AttributeSet, int); + ctor public SwitchPreference(android.content.Context, android.util.AttributeSet); + ctor public SwitchPreference(android.content.Context); + method public java.lang.CharSequence getSwitchTextOff(); + method public java.lang.CharSequence getSwitchTextOn(); + method public void setSwitchTextOff(java.lang.CharSequence); + method public void setSwitchTextOff(int); + method public void setSwitchTextOn(java.lang.CharSequence); + method public void setSwitchTextOn(int); + } + + public abstract class TwoStatePreference extends android.preference.Preference { + ctor public TwoStatePreference(android.content.Context, android.util.AttributeSet, int); + ctor public TwoStatePreference(android.content.Context, android.util.AttributeSet); + ctor public TwoStatePreference(android.content.Context); + method public boolean getDisableDependentsState(); + method public java.lang.CharSequence getSummaryOff(); + method public java.lang.CharSequence getSummaryOn(); + method public boolean isChecked(); + method public void setChecked(boolean); + method public void setDisableDependentsState(boolean); + method public void setSummaryOff(java.lang.CharSequence); + method public void setSummaryOff(int); + method public void setSummaryOn(java.lang.CharSequence); + method public void setSummaryOn(int); + } + +} + +package android.provider { + + public final class AlarmClock { + ctor public AlarmClock(); + field public static final java.lang.String ACTION_SET_ALARM = "android.intent.action.SET_ALARM"; + field public static final java.lang.String EXTRA_HOUR = "android.intent.extra.alarm.HOUR"; + field public static final java.lang.String EXTRA_MESSAGE = "android.intent.extra.alarm.MESSAGE"; + field public static final java.lang.String EXTRA_MINUTES = "android.intent.extra.alarm.MINUTES"; + field public static final java.lang.String EXTRA_SKIP_UI = "android.intent.extra.alarm.SKIP_UI"; + } + + public abstract interface BaseColumns { + field public static final java.lang.String _COUNT = "_count"; + field public static final java.lang.String _ID = "_id"; + } + + public class Browser { + ctor public Browser(); + method public static final void addSearchUrl(android.content.ContentResolver, java.lang.String); + method public static final boolean canClearHistory(android.content.ContentResolver); + method public static final void clearHistory(android.content.ContentResolver); + method public static final void clearSearches(android.content.ContentResolver); + method public static final void deleteFromHistory(android.content.ContentResolver, java.lang.String); + method public static final void deleteHistoryTimeFrame(android.content.ContentResolver, long, long); + method public static final android.database.Cursor getAllBookmarks(android.content.ContentResolver) throws java.lang.IllegalStateException; + method public static final android.database.Cursor getAllVisitedUrls(android.content.ContentResolver) throws java.lang.IllegalStateException; + method public static final void requestAllIcons(android.content.ContentResolver, java.lang.String, android.webkit.WebIconDatabase.IconListener); + method public static final void saveBookmark(android.content.Context, java.lang.String, java.lang.String); + method public static final void sendString(android.content.Context, java.lang.String); + method public static final void truncateHistory(android.content.ContentResolver); + method public static final void updateVisitedHistory(android.content.ContentResolver, java.lang.String, boolean); + field public static final android.net.Uri BOOKMARKS_URI; + field public static final java.lang.String EXTRA_APPLICATION_ID = "com.android.browser.application_id"; + field public static final java.lang.String EXTRA_CREATE_NEW_TAB = "create_new_tab"; + field public static final java.lang.String EXTRA_HEADERS = "com.android.browser.headers"; + field public static final java.lang.String[] HISTORY_PROJECTION; + field public static final int HISTORY_PROJECTION_BOOKMARK_INDEX = 4; // 0x4 + field public static final int HISTORY_PROJECTION_DATE_INDEX = 3; // 0x3 + field public static final int HISTORY_PROJECTION_FAVICON_INDEX = 6; // 0x6 + field public static final int HISTORY_PROJECTION_ID_INDEX = 0; // 0x0 + field public static final int HISTORY_PROJECTION_TITLE_INDEX = 5; // 0x5 + field public static final int HISTORY_PROJECTION_URL_INDEX = 1; // 0x1 + field public static final int HISTORY_PROJECTION_VISITS_INDEX = 2; // 0x2 + field public static final java.lang.String INITIAL_ZOOM_LEVEL = "browser.initialZoomLevel"; + field public static final java.lang.String[] SEARCHES_PROJECTION; + field public static final int SEARCHES_PROJECTION_DATE_INDEX = 2; // 0x2 + field public static final int SEARCHES_PROJECTION_SEARCH_INDEX = 1; // 0x1 + field public static final android.net.Uri SEARCHES_URI; + field public static final java.lang.String[] TRUNCATE_HISTORY_PROJECTION; + field public static final int TRUNCATE_HISTORY_PROJECTION_ID_INDEX = 0; // 0x0 + field public static final int TRUNCATE_N_OLDEST = 5; // 0x5 + } + + public static class Browser.BookmarkColumns implements android.provider.BaseColumns { + ctor public Browser.BookmarkColumns(); + field public static final java.lang.String BOOKMARK = "bookmark"; + field public static final java.lang.String CREATED = "created"; + field public static final java.lang.String DATE = "date"; + field public static final java.lang.String FAVICON = "favicon"; + field public static final java.lang.String TITLE = "title"; + field public static final java.lang.String URL = "url"; + field public static final java.lang.String VISITS = "visits"; + } + + public static class Browser.SearchColumns implements android.provider.BaseColumns { + ctor public Browser.SearchColumns(); + field public static final java.lang.String DATE = "date"; + field public static final java.lang.String SEARCH = "search"; + field public static final deprecated java.lang.String URL = "url"; + } + + public final class CalendarContract { + field public static final java.lang.String ACCOUNT_TYPE_LOCAL = "LOCAL"; + field public static final java.lang.String ACTION_EVENT_REMINDER = "android.intent.action.EVENT_REMINDER"; + field public static final java.lang.String ACTION_HANDLE_CUSTOM_EVENT = "android.provider.calendar.action.HANDLE_CUSTOM_EVENT"; + field public static final java.lang.String AUTHORITY = "com.android.calendar"; + field public static final java.lang.String CALLER_IS_SYNCADAPTER = "caller_is_syncadapter"; + field public static final android.net.Uri CONTENT_URI; + field public static final java.lang.String EXTRA_CUSTOM_APP_URI = "customAppUri"; + field public static final java.lang.String EXTRA_EVENT_ALL_DAY = "allDay"; + field public static final java.lang.String EXTRA_EVENT_BEGIN_TIME = "beginTime"; + field public static final java.lang.String EXTRA_EVENT_END_TIME = "endTime"; + } + + public static final class CalendarContract.Attendees implements android.provider.BaseColumns android.provider.CalendarContract.AttendeesColumns android.provider.CalendarContract.EventsColumns { + method public static final android.database.Cursor query(android.content.ContentResolver, long, java.lang.String[]); + field public static final android.net.Uri CONTENT_URI; + } + + protected static abstract interface CalendarContract.AttendeesColumns { + field public static final java.lang.String ATTENDEE_EMAIL = "attendeeEmail"; + field public static final java.lang.String ATTENDEE_IDENTITY = "attendeeIdentity"; + field public static final java.lang.String ATTENDEE_ID_NAMESPACE = "attendeeIdNamespace"; + field public static final java.lang.String ATTENDEE_NAME = "attendeeName"; + field public static final java.lang.String ATTENDEE_RELATIONSHIP = "attendeeRelationship"; + field public static final java.lang.String ATTENDEE_STATUS = "attendeeStatus"; + field public static final int ATTENDEE_STATUS_ACCEPTED = 1; // 0x1 + field public static final int ATTENDEE_STATUS_DECLINED = 2; // 0x2 + field public static final int ATTENDEE_STATUS_INVITED = 3; // 0x3 + field public static final int ATTENDEE_STATUS_NONE = 0; // 0x0 + field public static final int ATTENDEE_STATUS_TENTATIVE = 4; // 0x4 + field public static final java.lang.String ATTENDEE_TYPE = "attendeeType"; + field public static final java.lang.String EVENT_ID = "event_id"; + field public static final int RELATIONSHIP_ATTENDEE = 1; // 0x1 + field public static final int RELATIONSHIP_NONE = 0; // 0x0 + field public static final int RELATIONSHIP_ORGANIZER = 2; // 0x2 + field public static final int RELATIONSHIP_PERFORMER = 3; // 0x3 + field public static final int RELATIONSHIP_SPEAKER = 4; // 0x4 + field public static final int TYPE_NONE = 0; // 0x0 + field public static final int TYPE_OPTIONAL = 2; // 0x2 + field public static final int TYPE_REQUIRED = 1; // 0x1 + field public static final int TYPE_RESOURCE = 3; // 0x3 + } + + public static final class CalendarContract.CalendarAlerts implements android.provider.BaseColumns android.provider.CalendarContract.CalendarAlertsColumns android.provider.CalendarContract.CalendarColumns android.provider.CalendarContract.EventsColumns { + field public static final android.net.Uri CONTENT_URI; + field public static final android.net.Uri CONTENT_URI_BY_INSTANCE; + } + + protected static abstract interface CalendarContract.CalendarAlertsColumns { + field public static final java.lang.String ALARM_TIME = "alarmTime"; + field public static final java.lang.String BEGIN = "begin"; + field public static final java.lang.String CREATION_TIME = "creationTime"; + field public static final java.lang.String DEFAULT_SORT_ORDER = "begin ASC,title ASC"; + field public static final java.lang.String END = "end"; + field public static final java.lang.String EVENT_ID = "event_id"; + field public static final java.lang.String MINUTES = "minutes"; + field public static final java.lang.String NOTIFY_TIME = "notifyTime"; + field public static final java.lang.String RECEIVED_TIME = "receivedTime"; + field public static final java.lang.String STATE = "state"; + field public static final int STATE_DISMISSED = 2; // 0x2 + field public static final int STATE_FIRED = 1; // 0x1 + field public static final int STATE_SCHEDULED = 0; // 0x0 + } + + public static final class CalendarContract.CalendarCache implements android.provider.CalendarContract.CalendarCacheColumns { + field public static final java.lang.String KEY_TIMEZONE_INSTANCES = "timezoneInstances"; + field public static final java.lang.String KEY_TIMEZONE_INSTANCES_PREVIOUS = "timezoneInstancesPrevious"; + field public static final java.lang.String KEY_TIMEZONE_TYPE = "timezoneType"; + field public static final java.lang.String TIMEZONE_TYPE_AUTO = "auto"; + field public static final java.lang.String TIMEZONE_TYPE_HOME = "home"; + field public static final android.net.Uri URI; + } + + protected static abstract interface CalendarContract.CalendarCacheColumns { + field public static final java.lang.String KEY = "key"; + field public static final java.lang.String VALUE = "value"; + } + + protected static abstract interface CalendarContract.CalendarColumns { + field public static final java.lang.String ALLOWED_ATTENDEE_TYPES = "allowedAttendeeTypes"; + field public static final java.lang.String ALLOWED_AVAILABILITY = "allowedAvailability"; + field public static final java.lang.String ALLOWED_REMINDERS = "allowedReminders"; + field public static final java.lang.String CALENDAR_ACCESS_LEVEL = "calendar_access_level"; + field public static final java.lang.String CALENDAR_COLOR = "calendar_color"; + field public static final java.lang.String CALENDAR_COLOR_KEY = "calendar_color_index"; + field public static final java.lang.String CALENDAR_DISPLAY_NAME = "calendar_displayName"; + field public static final java.lang.String CALENDAR_TIME_ZONE = "calendar_timezone"; + field public static final int CAL_ACCESS_CONTRIBUTOR = 500; // 0x1f4 + field public static final int CAL_ACCESS_EDITOR = 600; // 0x258 + field public static final int CAL_ACCESS_FREEBUSY = 100; // 0x64 + field public static final int CAL_ACCESS_NONE = 0; // 0x0 + field public static final int CAL_ACCESS_OVERRIDE = 400; // 0x190 + field public static final int CAL_ACCESS_OWNER = 700; // 0x2bc + field public static final int CAL_ACCESS_READ = 200; // 0xc8 + field public static final int CAL_ACCESS_RESPOND = 300; // 0x12c + field public static final int CAL_ACCESS_ROOT = 800; // 0x320 + field public static final java.lang.String CAN_MODIFY_TIME_ZONE = "canModifyTimeZone"; + field public static final java.lang.String CAN_ORGANIZER_RESPOND = "canOrganizerRespond"; + field public static final java.lang.String IS_PRIMARY = "isPrimary"; + field public static final java.lang.String MAX_REMINDERS = "maxReminders"; + field public static final java.lang.String OWNER_ACCOUNT = "ownerAccount"; + field public static final java.lang.String SYNC_EVENTS = "sync_events"; + field public static final java.lang.String VISIBLE = "visible"; + } + + public static final class CalendarContract.CalendarEntity implements android.provider.BaseColumns android.provider.CalendarContract.CalendarColumns android.provider.CalendarContract.SyncColumns { + method public static android.content.EntityIterator newEntityIterator(android.database.Cursor); + field public static final android.net.Uri CONTENT_URI; + } + + protected static abstract interface CalendarContract.CalendarSyncColumns { + field public static final java.lang.String CAL_SYNC1 = "cal_sync1"; + field public static final java.lang.String CAL_SYNC10 = "cal_sync10"; + field public static final java.lang.String CAL_SYNC2 = "cal_sync2"; + field public static final java.lang.String CAL_SYNC3 = "cal_sync3"; + field public static final java.lang.String CAL_SYNC4 = "cal_sync4"; + field public static final java.lang.String CAL_SYNC5 = "cal_sync5"; + field public static final java.lang.String CAL_SYNC6 = "cal_sync6"; + field public static final java.lang.String CAL_SYNC7 = "cal_sync7"; + field public static final java.lang.String CAL_SYNC8 = "cal_sync8"; + field public static final java.lang.String CAL_SYNC9 = "cal_sync9"; + } + + public static final class CalendarContract.Calendars implements android.provider.BaseColumns android.provider.CalendarContract.CalendarColumns android.provider.CalendarContract.SyncColumns { + field public static final java.lang.String CALENDAR_LOCATION = "calendar_location"; + field public static final android.net.Uri CONTENT_URI; + field public static final java.lang.String DEFAULT_SORT_ORDER = "calendar_displayName"; + field public static final java.lang.String NAME = "name"; + } + + public static final class CalendarContract.Colors implements android.provider.CalendarContract.ColorsColumns { + field public static final android.net.Uri CONTENT_URI; + } + + protected static abstract interface CalendarContract.ColorsColumns implements android.provider.SyncStateContract.Columns { + field public static final java.lang.String COLOR = "color"; + field public static final java.lang.String COLOR_KEY = "color_index"; + field public static final java.lang.String COLOR_TYPE = "color_type"; + field public static final int TYPE_CALENDAR = 0; // 0x0 + field public static final int TYPE_EVENT = 1; // 0x1 + } + + public static final class CalendarContract.EventDays implements android.provider.CalendarContract.EventDaysColumns { + method public static final android.database.Cursor query(android.content.ContentResolver, int, int, java.lang.String[]); + field public static final android.net.Uri CONTENT_URI; + } + + protected static abstract interface CalendarContract.EventDaysColumns { + field public static final java.lang.String ENDDAY = "endDay"; + field public static final java.lang.String STARTDAY = "startDay"; + } + + public static final class CalendarContract.Events implements android.provider.BaseColumns android.provider.CalendarContract.CalendarColumns android.provider.CalendarContract.EventsColumns android.provider.CalendarContract.SyncColumns { + field public static final android.net.Uri CONTENT_EXCEPTION_URI; + field public static final android.net.Uri CONTENT_URI; + } + + protected static abstract interface CalendarContract.EventsColumns { + field public static final int ACCESS_CONFIDENTIAL = 1; // 0x1 + field public static final int ACCESS_DEFAULT = 0; // 0x0 + field public static final java.lang.String ACCESS_LEVEL = "accessLevel"; + field public static final int ACCESS_PRIVATE = 2; // 0x2 + field public static final int ACCESS_PUBLIC = 3; // 0x3 + field public static final java.lang.String ALL_DAY = "allDay"; + field public static final java.lang.String AVAILABILITY = "availability"; + field public static final int AVAILABILITY_BUSY = 0; // 0x0 + field public static final int AVAILABILITY_FREE = 1; // 0x1 + field public static final int AVAILABILITY_TENTATIVE = 2; // 0x2 + field public static final java.lang.String CALENDAR_ID = "calendar_id"; + field public static final java.lang.String CAN_INVITE_OTHERS = "canInviteOthers"; + field public static final java.lang.String CUSTOM_APP_PACKAGE = "customAppPackage"; + field public static final java.lang.String CUSTOM_APP_URI = "customAppUri"; + field public static final java.lang.String DESCRIPTION = "description"; + field public static final java.lang.String DISPLAY_COLOR = "displayColor"; + field public static final java.lang.String DTEND = "dtend"; + field public static final java.lang.String DTSTART = "dtstart"; + field public static final java.lang.String DURATION = "duration"; + field public static final java.lang.String EVENT_COLOR = "eventColor"; + field public static final java.lang.String EVENT_COLOR_KEY = "eventColor_index"; + field public static final java.lang.String EVENT_END_TIMEZONE = "eventEndTimezone"; + field public static final java.lang.String EVENT_LOCATION = "eventLocation"; + field public static final java.lang.String EVENT_TIMEZONE = "eventTimezone"; + field public static final java.lang.String EXDATE = "exdate"; + field public static final java.lang.String EXRULE = "exrule"; + field public static final java.lang.String GUESTS_CAN_INVITE_OTHERS = "guestsCanInviteOthers"; + field public static final java.lang.String GUESTS_CAN_MODIFY = "guestsCanModify"; + field public static final java.lang.String GUESTS_CAN_SEE_GUESTS = "guestsCanSeeGuests"; + field public static final java.lang.String HAS_ALARM = "hasAlarm"; + field public static final java.lang.String HAS_ATTENDEE_DATA = "hasAttendeeData"; + field public static final java.lang.String HAS_EXTENDED_PROPERTIES = "hasExtendedProperties"; + field public static final java.lang.String IS_ORGANIZER = "isOrganizer"; + field public static final java.lang.String LAST_DATE = "lastDate"; + field public static final java.lang.String LAST_SYNCED = "lastSynced"; + field public static final java.lang.String ORGANIZER = "organizer"; + field public static final java.lang.String ORIGINAL_ALL_DAY = "originalAllDay"; + field public static final java.lang.String ORIGINAL_ID = "original_id"; + field public static final java.lang.String ORIGINAL_INSTANCE_TIME = "originalInstanceTime"; + field public static final java.lang.String ORIGINAL_SYNC_ID = "original_sync_id"; + field public static final java.lang.String RDATE = "rdate"; + field public static final java.lang.String RRULE = "rrule"; + field public static final java.lang.String SELF_ATTENDEE_STATUS = "selfAttendeeStatus"; + field public static final java.lang.String STATUS = "eventStatus"; + field public static final int STATUS_CANCELED = 2; // 0x2 + field public static final int STATUS_CONFIRMED = 1; // 0x1 + field public static final int STATUS_TENTATIVE = 0; // 0x0 + field public static final java.lang.String SYNC_DATA1 = "sync_data1"; + field public static final java.lang.String SYNC_DATA10 = "sync_data10"; + field public static final java.lang.String SYNC_DATA2 = "sync_data2"; + field public static final java.lang.String SYNC_DATA3 = "sync_data3"; + field public static final java.lang.String SYNC_DATA4 = "sync_data4"; + field public static final java.lang.String SYNC_DATA5 = "sync_data5"; + field public static final java.lang.String SYNC_DATA6 = "sync_data6"; + field public static final java.lang.String SYNC_DATA7 = "sync_data7"; + field public static final java.lang.String SYNC_DATA8 = "sync_data8"; + field public static final java.lang.String SYNC_DATA9 = "sync_data9"; + field public static final java.lang.String TITLE = "title"; + field public static final java.lang.String UID_2445 = "uid2445"; + } + + public static final class CalendarContract.EventsEntity implements android.provider.BaseColumns android.provider.CalendarContract.EventsColumns android.provider.CalendarContract.SyncColumns { + method public static android.content.EntityIterator newEntityIterator(android.database.Cursor, android.content.ContentResolver); + method public static android.content.EntityIterator newEntityIterator(android.database.Cursor, android.content.ContentProviderClient); + field public static final android.net.Uri CONTENT_URI; + } + + public static final class CalendarContract.ExtendedProperties implements android.provider.BaseColumns android.provider.CalendarContract.EventsColumns android.provider.CalendarContract.ExtendedPropertiesColumns { + field public static final android.net.Uri CONTENT_URI; + } + + protected static abstract interface CalendarContract.ExtendedPropertiesColumns { + field public static final java.lang.String EVENT_ID = "event_id"; + field public static final java.lang.String NAME = "name"; + field public static final java.lang.String VALUE = "value"; + } + + public static final class CalendarContract.Instances implements android.provider.BaseColumns android.provider.CalendarContract.CalendarColumns android.provider.CalendarContract.EventsColumns { + method public static final android.database.Cursor query(android.content.ContentResolver, java.lang.String[], long, long); + method public static final android.database.Cursor query(android.content.ContentResolver, java.lang.String[], long, long, java.lang.String); + field public static final java.lang.String BEGIN = "begin"; + field public static final android.net.Uri CONTENT_BY_DAY_URI; + field public static final android.net.Uri CONTENT_SEARCH_BY_DAY_URI; + field public static final android.net.Uri CONTENT_SEARCH_URI; + field public static final android.net.Uri CONTENT_URI; + field public static final java.lang.String END = "end"; + field public static final java.lang.String END_DAY = "endDay"; + field public static final java.lang.String END_MINUTE = "endMinute"; + field public static final java.lang.String EVENT_ID = "event_id"; + field public static final java.lang.String START_DAY = "startDay"; + field public static final java.lang.String START_MINUTE = "startMinute"; + } + + public static final class CalendarContract.Reminders implements android.provider.BaseColumns android.provider.CalendarContract.EventsColumns android.provider.CalendarContract.RemindersColumns { + method public static final android.database.Cursor query(android.content.ContentResolver, long, java.lang.String[]); + field public static final android.net.Uri CONTENT_URI; + } + + protected static abstract interface CalendarContract.RemindersColumns { + field public static final java.lang.String EVENT_ID = "event_id"; + field public static final java.lang.String METHOD = "method"; + field public static final int METHOD_ALARM = 4; // 0x4 + field public static final int METHOD_ALERT = 1; // 0x1 + field public static final int METHOD_DEFAULT = 0; // 0x0 + field public static final int METHOD_EMAIL = 2; // 0x2 + field public static final int METHOD_SMS = 3; // 0x3 + field public static final java.lang.String MINUTES = "minutes"; + field public static final int MINUTES_DEFAULT = -1; // 0xffffffff + } + + protected static abstract interface CalendarContract.SyncColumns implements android.provider.CalendarContract.CalendarSyncColumns { + field public static final java.lang.String ACCOUNT_NAME = "account_name"; + field public static final java.lang.String ACCOUNT_TYPE = "account_type"; + field public static final java.lang.String CAN_PARTIALLY_UPDATE = "canPartiallyUpdate"; + field public static final java.lang.String DELETED = "deleted"; + field public static final java.lang.String DIRTY = "dirty"; + field public static final java.lang.String _SYNC_ID = "_sync_id"; + } + + public static final class CalendarContract.SyncState implements android.provider.SyncStateContract.Columns { + field public static final android.net.Uri CONTENT_URI; + } + + public class CallLog { + ctor public CallLog(); + field public static final java.lang.String AUTHORITY = "call_log"; + field public static final android.net.Uri CONTENT_URI; + } + + public static class CallLog.Calls implements android.provider.BaseColumns { + ctor public CallLog.Calls(); + method public static java.lang.String getLastOutgoingCall(android.content.Context); + field public static final java.lang.String CACHED_NAME = "name"; + field public static final java.lang.String CACHED_NUMBER_LABEL = "numberlabel"; + field public static final java.lang.String CACHED_NUMBER_TYPE = "numbertype"; + field public static final android.net.Uri CONTENT_FILTER_URI; + field public static final java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/calls"; + field public static final java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/calls"; + field public static final android.net.Uri CONTENT_URI; + field public static final java.lang.String DATE = "date"; + field public static final java.lang.String DEFAULT_SORT_ORDER = "date DESC"; + field public static final java.lang.String DURATION = "duration"; + field public static final int INCOMING_TYPE = 1; // 0x1 + field public static final java.lang.String IS_READ = "is_read"; + field public static final java.lang.String LIMIT_PARAM_KEY = "limit"; + field public static final int MISSED_TYPE = 3; // 0x3 + field public static final java.lang.String NEW = "new"; + field public static final java.lang.String NUMBER = "number"; + field public static final java.lang.String OFFSET_PARAM_KEY = "offset"; + field public static final int OUTGOING_TYPE = 2; // 0x2 + field public static final java.lang.String TYPE = "type"; + } + + public deprecated class Contacts { + field public static final deprecated java.lang.String AUTHORITY = "contacts"; + field public static final deprecated android.net.Uri CONTENT_URI; + field public static final deprecated int KIND_EMAIL = 1; // 0x1 + field public static final deprecated int KIND_IM = 3; // 0x3 + field public static final deprecated int KIND_ORGANIZATION = 4; // 0x4 + field public static final deprecated int KIND_PHONE = 5; // 0x5 + field public static final deprecated int KIND_POSTAL = 2; // 0x2 + } + + public static final deprecated class Contacts.ContactMethods implements android.provider.BaseColumns android.provider.Contacts.ContactMethodsColumns android.provider.Contacts.PeopleColumns { + method public deprecated void addPostalLocation(android.content.Context, long, double, double); + method public static deprecated java.lang.Object decodeImProtocol(java.lang.String); + method public static deprecated java.lang.String encodeCustomImProtocol(java.lang.String); + method public static deprecated java.lang.String encodePredefinedImProtocol(int); + method public static final deprecated java.lang.CharSequence getDisplayLabel(android.content.Context, int, int, java.lang.CharSequence); + field public static final deprecated java.lang.String CONTENT_EMAIL_ITEM_TYPE = "vnd.android.cursor.item/email"; + field public static final deprecated java.lang.String CONTENT_EMAIL_TYPE = "vnd.android.cursor.dir/email"; + field public static final deprecated android.net.Uri CONTENT_EMAIL_URI; + field public static final deprecated java.lang.String CONTENT_IM_ITEM_TYPE = "vnd.android.cursor.item/jabber-im"; + field public static final deprecated java.lang.String CONTENT_POSTAL_ITEM_TYPE = "vnd.android.cursor.item/postal-address"; + field public static final deprecated java.lang.String CONTENT_POSTAL_TYPE = "vnd.android.cursor.dir/postal-address"; + field public static final deprecated java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/contact-methods"; + field public static final deprecated android.net.Uri CONTENT_URI; + field public static final deprecated java.lang.String DEFAULT_SORT_ORDER = "name ASC"; + field public static final deprecated java.lang.String PERSON_ID = "person"; + field public static final deprecated java.lang.String POSTAL_LOCATION_LATITUDE = "data"; + field public static final deprecated java.lang.String POSTAL_LOCATION_LONGITUDE = "aux_data"; + field public static final deprecated int PROTOCOL_AIM = 0; // 0x0 + field public static final deprecated int PROTOCOL_GOOGLE_TALK = 5; // 0x5 + field public static final deprecated int PROTOCOL_ICQ = 6; // 0x6 + field public static final deprecated int PROTOCOL_JABBER = 7; // 0x7 + field public static final deprecated int PROTOCOL_MSN = 1; // 0x1 + field public static final deprecated int PROTOCOL_QQ = 4; // 0x4 + field public static final deprecated int PROTOCOL_SKYPE = 3; // 0x3 + field public static final deprecated int PROTOCOL_YAHOO = 2; // 0x2 + } + + public static abstract deprecated interface Contacts.ContactMethodsColumns { + field public static final deprecated java.lang.String AUX_DATA = "aux_data"; + field public static final deprecated java.lang.String DATA = "data"; + field public static final deprecated java.lang.String ISPRIMARY = "isprimary"; + field public static final deprecated java.lang.String KIND = "kind"; + field public static final deprecated java.lang.String LABEL = "label"; + field public static final deprecated java.lang.String TYPE = "type"; + field public static final deprecated int TYPE_CUSTOM = 0; // 0x0 + field public static final deprecated int TYPE_HOME = 1; // 0x1 + field public static final deprecated int TYPE_OTHER = 3; // 0x3 + field public static final deprecated int TYPE_WORK = 2; // 0x2 + } + + public static final deprecated class Contacts.Extensions implements android.provider.BaseColumns android.provider.Contacts.ExtensionsColumns { + field public static final deprecated java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/contact_extensions"; + field public static final deprecated java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/contact_extensions"; + field public static final deprecated android.net.Uri CONTENT_URI; + field public static final deprecated java.lang.String DEFAULT_SORT_ORDER = "person, name ASC"; + field public static final deprecated java.lang.String PERSON_ID = "person"; + } + + public static abstract deprecated interface Contacts.ExtensionsColumns { + field public static final deprecated java.lang.String NAME = "name"; + field public static final deprecated java.lang.String VALUE = "value"; + } + + public static final deprecated class Contacts.GroupMembership implements android.provider.BaseColumns android.provider.Contacts.GroupsColumns { + field public static final deprecated java.lang.String CONTENT_DIRECTORY = "groupmembership"; + field public static final deprecated java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/contactsgroupmembership"; + field public static final deprecated java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/contactsgroupmembership"; + field public static final deprecated android.net.Uri CONTENT_URI; + field public static final deprecated java.lang.String DEFAULT_SORT_ORDER = "group_id ASC"; + field public static final deprecated java.lang.String GROUP_ID = "group_id"; + field public static final deprecated java.lang.String GROUP_SYNC_ACCOUNT = "group_sync_account"; + field public static final deprecated java.lang.String GROUP_SYNC_ACCOUNT_TYPE = "group_sync_account_type"; + field public static final deprecated java.lang.String GROUP_SYNC_ID = "group_sync_id"; + field public static final deprecated java.lang.String PERSON_ID = "person"; + field public static final deprecated android.net.Uri RAW_CONTENT_URI; + } + + public static final deprecated class Contacts.Groups implements android.provider.BaseColumns android.provider.Contacts.GroupsColumns { + field public static final deprecated java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/contactsgroup"; + field public static final deprecated java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/contactsgroup"; + field public static final deprecated android.net.Uri CONTENT_URI; + field public static final deprecated java.lang.String DEFAULT_SORT_ORDER = "name ASC"; + field public static final deprecated android.net.Uri DELETED_CONTENT_URI; + field public static final deprecated java.lang.String GROUP_ANDROID_STARRED = "Starred in Android"; + field public static final deprecated java.lang.String GROUP_MY_CONTACTS = "Contacts"; + } + + public static abstract deprecated interface Contacts.GroupsColumns { + field public static final deprecated java.lang.String NAME = "name"; + field public static final deprecated java.lang.String NOTES = "notes"; + field public static final deprecated java.lang.String SHOULD_SYNC = "should_sync"; + field public static final deprecated java.lang.String SYSTEM_ID = "system_id"; + } + + public static final deprecated class Contacts.Intents { + ctor public deprecated Contacts.Intents(); + field public static final deprecated java.lang.String ATTACH_IMAGE = "com.android.contacts.action.ATTACH_IMAGE"; + field public static final deprecated java.lang.String EXTRA_CREATE_DESCRIPTION = "com.android.contacts.action.CREATE_DESCRIPTION"; + field public static final deprecated java.lang.String EXTRA_FORCE_CREATE = "com.android.contacts.action.FORCE_CREATE"; + field public static final deprecated java.lang.String SEARCH_SUGGESTION_CLICKED = "android.provider.Contacts.SEARCH_SUGGESTION_CLICKED"; + field public static final deprecated java.lang.String SEARCH_SUGGESTION_CREATE_CONTACT_CLICKED = "android.provider.Contacts.SEARCH_SUGGESTION_CREATE_CONTACT_CLICKED"; + field public static final deprecated java.lang.String SEARCH_SUGGESTION_DIAL_NUMBER_CLICKED = "android.provider.Contacts.SEARCH_SUGGESTION_DIAL_NUMBER_CLICKED"; + field public static final deprecated java.lang.String SHOW_OR_CREATE_CONTACT = "com.android.contacts.action.SHOW_OR_CREATE_CONTACT"; + } + + public static final deprecated class Contacts.Intents.Insert { + ctor public deprecated Contacts.Intents.Insert(); + field public static final deprecated java.lang.String ACTION = "android.intent.action.INSERT"; + field public static final deprecated java.lang.String COMPANY = "company"; + field public static final deprecated java.lang.String EMAIL = "email"; + field public static final deprecated java.lang.String EMAIL_ISPRIMARY = "email_isprimary"; + field public static final deprecated java.lang.String EMAIL_TYPE = "email_type"; + field public static final deprecated java.lang.String FULL_MODE = "full_mode"; + field public static final deprecated java.lang.String IM_HANDLE = "im_handle"; + field public static final deprecated java.lang.String IM_ISPRIMARY = "im_isprimary"; + field public static final deprecated java.lang.String IM_PROTOCOL = "im_protocol"; + field public static final deprecated java.lang.String JOB_TITLE = "job_title"; + field public static final deprecated java.lang.String NAME = "name"; + field public static final deprecated java.lang.String NOTES = "notes"; + field public static final deprecated java.lang.String PHONE = "phone"; + field public static final deprecated java.lang.String PHONETIC_NAME = "phonetic_name"; + field public static final deprecated java.lang.String PHONE_ISPRIMARY = "phone_isprimary"; + field public static final deprecated java.lang.String PHONE_TYPE = "phone_type"; + field public static final deprecated java.lang.String POSTAL = "postal"; + field public static final deprecated java.lang.String POSTAL_ISPRIMARY = "postal_isprimary"; + field public static final deprecated java.lang.String POSTAL_TYPE = "postal_type"; + field public static final deprecated java.lang.String SECONDARY_EMAIL = "secondary_email"; + field public static final deprecated java.lang.String SECONDARY_EMAIL_TYPE = "secondary_email_type"; + field public static final deprecated java.lang.String SECONDARY_PHONE = "secondary_phone"; + field public static final deprecated java.lang.String SECONDARY_PHONE_TYPE = "secondary_phone_type"; + field public static final deprecated java.lang.String TERTIARY_EMAIL = "tertiary_email"; + field public static final deprecated java.lang.String TERTIARY_EMAIL_TYPE = "tertiary_email_type"; + field public static final deprecated java.lang.String TERTIARY_PHONE = "tertiary_phone"; + field public static final deprecated java.lang.String TERTIARY_PHONE_TYPE = "tertiary_phone_type"; + } + + public static final deprecated class Contacts.Intents.UI { + ctor public deprecated Contacts.Intents.UI(); + field public static final deprecated java.lang.String FILTER_CONTACTS_ACTION = "com.android.contacts.action.FILTER_CONTACTS"; + field public static final deprecated java.lang.String FILTER_TEXT_EXTRA_KEY = "com.android.contacts.extra.FILTER_TEXT"; + field public static final deprecated java.lang.String GROUP_NAME_EXTRA_KEY = "com.android.contacts.extra.GROUP"; + field public static final deprecated java.lang.String LIST_ALL_CONTACTS_ACTION = "com.android.contacts.action.LIST_ALL_CONTACTS"; + field public static final deprecated java.lang.String LIST_CONTACTS_WITH_PHONES_ACTION = "com.android.contacts.action.LIST_CONTACTS_WITH_PHONES"; + field public static final deprecated java.lang.String LIST_DEFAULT = "com.android.contacts.action.LIST_DEFAULT"; + field public static final deprecated java.lang.String LIST_FREQUENT_ACTION = "com.android.contacts.action.LIST_FREQUENT"; + field public static final deprecated java.lang.String LIST_GROUP_ACTION = "com.android.contacts.action.LIST_GROUP"; + field public static final deprecated java.lang.String LIST_STARRED_ACTION = "com.android.contacts.action.LIST_STARRED"; + field public static final deprecated java.lang.String LIST_STREQUENT_ACTION = "com.android.contacts.action.LIST_STREQUENT"; + field public static final deprecated java.lang.String TITLE_EXTRA_KEY = "com.android.contacts.extra.TITLE_EXTRA"; + } + + public static abstract deprecated interface Contacts.OrganizationColumns { + field public static final deprecated java.lang.String COMPANY = "company"; + field public static final deprecated java.lang.String ISPRIMARY = "isprimary"; + field public static final deprecated java.lang.String LABEL = "label"; + field public static final deprecated java.lang.String PERSON_ID = "person"; + field public static final deprecated java.lang.String TITLE = "title"; + field public static final deprecated java.lang.String TYPE = "type"; + field public static final deprecated int TYPE_CUSTOM = 0; // 0x0 + field public static final deprecated int TYPE_OTHER = 2; // 0x2 + field public static final deprecated int TYPE_WORK = 1; // 0x1 + } + + public static final deprecated class Contacts.Organizations implements android.provider.BaseColumns android.provider.Contacts.OrganizationColumns { + method public static final deprecated java.lang.CharSequence getDisplayLabel(android.content.Context, int, java.lang.CharSequence); + field public static final deprecated java.lang.String CONTENT_DIRECTORY = "organizations"; + field public static final deprecated android.net.Uri CONTENT_URI; + field public static final deprecated java.lang.String DEFAULT_SORT_ORDER = "company, title, isprimary ASC"; + } + + public static final deprecated class Contacts.People implements android.provider.BaseColumns android.provider.Contacts.PeopleColumns android.provider.Contacts.PhonesColumns android.provider.Contacts.PresenceColumns { + method public static deprecated android.net.Uri addToGroup(android.content.ContentResolver, long, java.lang.String); + method public static deprecated android.net.Uri addToGroup(android.content.ContentResolver, long, long); + method public static deprecated android.net.Uri addToMyContactsGroup(android.content.ContentResolver, long); + method public static deprecated android.net.Uri createPersonInMyContactsGroup(android.content.ContentResolver, android.content.ContentValues); + method public static deprecated android.graphics.Bitmap loadContactPhoto(android.content.Context, android.net.Uri, int, android.graphics.BitmapFactory.Options); + method public static deprecated void markAsContacted(android.content.ContentResolver, long); + method public static deprecated java.io.InputStream openContactPhotoInputStream(android.content.ContentResolver, android.net.Uri); + method public static deprecated android.database.Cursor queryGroups(android.content.ContentResolver, long); + method public static deprecated void setPhotoData(android.content.ContentResolver, android.net.Uri, byte[]); + field public static final deprecated android.net.Uri CONTENT_FILTER_URI; + field public static final deprecated java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/person"; + field public static final deprecated java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/person"; + field public static final deprecated android.net.Uri CONTENT_URI; + field public static final deprecated java.lang.String DEFAULT_SORT_ORDER = "name ASC"; + field public static final deprecated android.net.Uri DELETED_CONTENT_URI; + field public static final deprecated java.lang.String PRIMARY_EMAIL_ID = "primary_email"; + field public static final deprecated java.lang.String PRIMARY_ORGANIZATION_ID = "primary_organization"; + field public static final deprecated java.lang.String PRIMARY_PHONE_ID = "primary_phone"; + } + + public static final deprecated class Contacts.People.ContactMethods implements android.provider.BaseColumns android.provider.Contacts.ContactMethodsColumns android.provider.Contacts.PeopleColumns { + field public static final deprecated java.lang.String CONTENT_DIRECTORY = "contact_methods"; + field public static final deprecated java.lang.String DEFAULT_SORT_ORDER = "data ASC"; + } + + public static deprecated class Contacts.People.Extensions implements android.provider.BaseColumns android.provider.Contacts.ExtensionsColumns { + field public static final deprecated java.lang.String CONTENT_DIRECTORY = "extensions"; + field public static final deprecated java.lang.String DEFAULT_SORT_ORDER = "name ASC"; + field public static final deprecated java.lang.String PERSON_ID = "person"; + } + + public static final deprecated class Contacts.People.Phones implements android.provider.BaseColumns android.provider.Contacts.PeopleColumns android.provider.Contacts.PhonesColumns { + field public static final deprecated java.lang.String CONTENT_DIRECTORY = "phones"; + field public static final deprecated java.lang.String DEFAULT_SORT_ORDER = "number ASC"; + } + + public static abstract deprecated interface Contacts.PeopleColumns { + field public static final deprecated java.lang.String CUSTOM_RINGTONE = "custom_ringtone"; + field public static final deprecated java.lang.String DISPLAY_NAME = "display_name"; + field public static final deprecated java.lang.String LAST_TIME_CONTACTED = "last_time_contacted"; + field public static final deprecated java.lang.String NAME = "name"; + field public static final deprecated java.lang.String NOTES = "notes"; + field public static final deprecated java.lang.String PHONETIC_NAME = "phonetic_name"; + field public static final deprecated java.lang.String PHOTO_VERSION = "photo_version"; + field public static final deprecated java.lang.String SEND_TO_VOICEMAIL = "send_to_voicemail"; + field public static final deprecated java.lang.String STARRED = "starred"; + field public static final deprecated java.lang.String TIMES_CONTACTED = "times_contacted"; + } + + public static final deprecated class Contacts.Phones implements android.provider.BaseColumns android.provider.Contacts.PeopleColumns android.provider.Contacts.PhonesColumns { + method public static final deprecated java.lang.CharSequence getDisplayLabel(android.content.Context, int, java.lang.CharSequence, java.lang.CharSequence[]); + method public static final deprecated java.lang.CharSequence getDisplayLabel(android.content.Context, int, java.lang.CharSequence); + field public static final deprecated android.net.Uri CONTENT_FILTER_URL; + field public static final deprecated java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/phone"; + field public static final deprecated java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/phone"; + field public static final deprecated android.net.Uri CONTENT_URI; + field public static final deprecated java.lang.String DEFAULT_SORT_ORDER = "name ASC"; + field public static final deprecated java.lang.String PERSON_ID = "person"; + } + + public static abstract deprecated interface Contacts.PhonesColumns { + field public static final deprecated java.lang.String ISPRIMARY = "isprimary"; + field public static final deprecated java.lang.String LABEL = "label"; + field public static final deprecated java.lang.String NUMBER = "number"; + field public static final deprecated java.lang.String NUMBER_KEY = "number_key"; + field public static final deprecated java.lang.String TYPE = "type"; + field public static final deprecated int TYPE_CUSTOM = 0; // 0x0 + field public static final deprecated int TYPE_FAX_HOME = 5; // 0x5 + field public static final deprecated int TYPE_FAX_WORK = 4; // 0x4 + field public static final deprecated int TYPE_HOME = 1; // 0x1 + field public static final deprecated int TYPE_MOBILE = 2; // 0x2 + field public static final deprecated int TYPE_OTHER = 7; // 0x7 + field public static final deprecated int TYPE_PAGER = 6; // 0x6 + field public static final deprecated int TYPE_WORK = 3; // 0x3 + } + + public static final deprecated class Contacts.Photos implements android.provider.BaseColumns android.provider.Contacts.PhotosColumns { + field public static final deprecated java.lang.String CONTENT_DIRECTORY = "photo"; + field public static final deprecated android.net.Uri CONTENT_URI; + field public static final deprecated java.lang.String DEFAULT_SORT_ORDER = "person ASC"; + } + + public static abstract deprecated interface Contacts.PhotosColumns { + field public static final deprecated java.lang.String DATA = "data"; + field public static final deprecated java.lang.String DOWNLOAD_REQUIRED = "download_required"; + field public static final deprecated java.lang.String EXISTS_ON_SERVER = "exists_on_server"; + field public static final deprecated java.lang.String LOCAL_VERSION = "local_version"; + field public static final deprecated java.lang.String PERSON_ID = "person"; + field public static final deprecated java.lang.String SYNC_ERROR = "sync_error"; + } + + public static abstract deprecated interface Contacts.PresenceColumns { + field public static final int AVAILABLE = 5; // 0x5 + field public static final int AWAY = 2; // 0x2 + field public static final int DO_NOT_DISTURB = 4; // 0x4 + field public static final int IDLE = 3; // 0x3 + field public static final deprecated java.lang.String IM_ACCOUNT = "im_account"; + field public static final deprecated java.lang.String IM_HANDLE = "im_handle"; + field public static final deprecated java.lang.String IM_PROTOCOL = "im_protocol"; + field public static final int INVISIBLE = 1; // 0x1 + field public static final int OFFLINE = 0; // 0x0 + field public static final java.lang.String PRESENCE_CUSTOM_STATUS = "status"; + field public static final java.lang.String PRESENCE_STATUS = "mode"; + field public static final java.lang.String PRIORITY = "priority"; + } + + public static final deprecated class Contacts.Settings implements android.provider.BaseColumns android.provider.Contacts.SettingsColumns { + method public static deprecated java.lang.String getSetting(android.content.ContentResolver, java.lang.String, java.lang.String); + method public static deprecated void setSetting(android.content.ContentResolver, java.lang.String, java.lang.String, java.lang.String); + field public static final deprecated java.lang.String CONTENT_DIRECTORY = "settings"; + field public static final deprecated android.net.Uri CONTENT_URI; + field public static final deprecated java.lang.String DEFAULT_SORT_ORDER = "key ASC"; + field public static final deprecated java.lang.String SYNC_EVERYTHING = "syncEverything"; + } + + public static abstract deprecated interface Contacts.SettingsColumns { + field public static final deprecated java.lang.String KEY = "key"; + field public static final deprecated java.lang.String VALUE = "value"; + field public static final deprecated java.lang.String _SYNC_ACCOUNT = "_sync_account"; + field public static final deprecated java.lang.String _SYNC_ACCOUNT_TYPE = "_sync_account_type"; + } + + public final class ContactsContract { + ctor public ContactsContract(); + method public static boolean isProfileId(long); + field public static final java.lang.String AUTHORITY = "com.android.contacts"; + field public static final android.net.Uri AUTHORITY_URI; + field public static final java.lang.String CALLER_IS_SYNCADAPTER = "caller_is_syncadapter"; + field public static final java.lang.String DIRECTORY_PARAM_KEY = "directory"; + field public static final java.lang.String LIMIT_PARAM_KEY = "limit"; + field public static final java.lang.String PRIMARY_ACCOUNT_NAME = "name_for_primary_account"; + field public static final java.lang.String PRIMARY_ACCOUNT_TYPE = "type_for_primary_account"; + } + + public static final class ContactsContract.AggregationExceptions implements android.provider.BaseColumns { + field public static final java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/aggregation_exception"; + field public static final java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/aggregation_exception"; + field public static final android.net.Uri CONTENT_URI; + field public static final java.lang.String RAW_CONTACT_ID1 = "raw_contact_id1"; + field public static final java.lang.String RAW_CONTACT_ID2 = "raw_contact_id2"; + field public static final java.lang.String TYPE = "type"; + field public static final int TYPE_AUTOMATIC = 0; // 0x0 + field public static final int TYPE_KEEP_SEPARATE = 2; // 0x2 + field public static final int TYPE_KEEP_TOGETHER = 1; // 0x1 + } + + protected static abstract interface ContactsContract.BaseSyncColumns { + field public static final java.lang.String SYNC1 = "sync1"; + field public static final java.lang.String SYNC2 = "sync2"; + field public static final java.lang.String SYNC3 = "sync3"; + field public static final java.lang.String SYNC4 = "sync4"; + } + + public static final class ContactsContract.CommonDataKinds { + } + + public static abstract interface ContactsContract.CommonDataKinds.BaseTypes { + field public static final int TYPE_CUSTOM = 0; // 0x0 + } + + protected static abstract interface ContactsContract.CommonDataKinds.CommonColumns implements android.provider.ContactsContract.CommonDataKinds.BaseTypes { + field public static final java.lang.String DATA = "data1"; + field public static final java.lang.String LABEL = "data3"; + field public static final java.lang.String TYPE = "data2"; + } + + public static final class ContactsContract.CommonDataKinds.Email implements android.provider.ContactsContract.CommonDataKinds.CommonColumns android.provider.ContactsContract.DataColumnsWithJoins { + method public static final java.lang.CharSequence getTypeLabel(android.content.res.Resources, int, java.lang.CharSequence); + method public static final int getTypeLabelResource(int); + field public static final java.lang.String ADDRESS = "data1"; + field public static final android.net.Uri CONTENT_FILTER_URI; + field public static final java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/email_v2"; + field public static final android.net.Uri CONTENT_LOOKUP_URI; + field public static final java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/email_v2"; + field public static final android.net.Uri CONTENT_URI; + field public static final java.lang.String DISPLAY_NAME = "data4"; + field public static final int TYPE_HOME = 1; // 0x1 + field public static final int TYPE_MOBILE = 4; // 0x4 + field public static final int TYPE_OTHER = 3; // 0x3 + field public static final int TYPE_WORK = 2; // 0x2 + } + + public static final class ContactsContract.CommonDataKinds.Event implements android.provider.ContactsContract.CommonDataKinds.CommonColumns android.provider.ContactsContract.DataColumnsWithJoins { + method public static int getTypeResource(java.lang.Integer); + field public static final java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/contact_event"; + field public static final java.lang.String START_DATE = "data1"; + field public static final int TYPE_ANNIVERSARY = 1; // 0x1 + field public static final int TYPE_BIRTHDAY = 3; // 0x3 + field public static final int TYPE_OTHER = 2; // 0x2 + } + + public static final class ContactsContract.CommonDataKinds.GroupMembership implements android.provider.ContactsContract.DataColumnsWithJoins { + field public static final java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/group_membership"; + field public static final java.lang.String GROUP_ROW_ID = "data1"; + field public static final java.lang.String GROUP_SOURCE_ID = "group_sourceid"; + } + + public static final class ContactsContract.CommonDataKinds.Identity implements android.provider.ContactsContract.DataColumnsWithJoins { + field public static final java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/identity"; + field public static final java.lang.String IDENTITY = "data1"; + field public static final java.lang.String NAMESPACE = "data2"; + } + + public static final class ContactsContract.CommonDataKinds.Im implements android.provider.ContactsContract.CommonDataKinds.CommonColumns android.provider.ContactsContract.DataColumnsWithJoins { + method public static final java.lang.CharSequence getProtocolLabel(android.content.res.Resources, int, java.lang.CharSequence); + method public static final int getProtocolLabelResource(int); + method public static final java.lang.CharSequence getTypeLabel(android.content.res.Resources, int, java.lang.CharSequence); + method public static final int getTypeLabelResource(int); + field public static final java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/im"; + field public static final java.lang.String CUSTOM_PROTOCOL = "data6"; + field public static final java.lang.String PROTOCOL = "data5"; + field public static final int PROTOCOL_AIM = 0; // 0x0 + field public static final int PROTOCOL_CUSTOM = -1; // 0xffffffff + field public static final int PROTOCOL_GOOGLE_TALK = 5; // 0x5 + field public static final int PROTOCOL_ICQ = 6; // 0x6 + field public static final int PROTOCOL_JABBER = 7; // 0x7 + field public static final int PROTOCOL_MSN = 1; // 0x1 + field public static final int PROTOCOL_NETMEETING = 8; // 0x8 + field public static final int PROTOCOL_QQ = 4; // 0x4 + field public static final int PROTOCOL_SKYPE = 3; // 0x3 + field public static final int PROTOCOL_YAHOO = 2; // 0x2 + field public static final int TYPE_HOME = 1; // 0x1 + field public static final int TYPE_OTHER = 3; // 0x3 + field public static final int TYPE_WORK = 2; // 0x2 + } + + public static final class ContactsContract.CommonDataKinds.Nickname implements android.provider.ContactsContract.CommonDataKinds.CommonColumns android.provider.ContactsContract.DataColumnsWithJoins { + field public static final java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/nickname"; + field public static final java.lang.String NAME = "data1"; + field public static final int TYPE_DEFAULT = 1; // 0x1 + field public static final int TYPE_INITIALS = 5; // 0x5 + field public static final int TYPE_MAIDEN_NAME = 3; // 0x3 + field public static final deprecated int TYPE_MAINDEN_NAME = 3; // 0x3 + field public static final int TYPE_OTHER_NAME = 2; // 0x2 + field public static final int TYPE_SHORT_NAME = 4; // 0x4 + } + + public static final class ContactsContract.CommonDataKinds.Note implements android.provider.ContactsContract.DataColumnsWithJoins { + field public static final java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/note"; + field public static final java.lang.String NOTE = "data1"; + } + + public static final class ContactsContract.CommonDataKinds.Organization implements android.provider.ContactsContract.CommonDataKinds.CommonColumns android.provider.ContactsContract.DataColumnsWithJoins { + method public static final java.lang.CharSequence getTypeLabel(android.content.res.Resources, int, java.lang.CharSequence); + method public static final int getTypeLabelResource(int); + field public static final java.lang.String COMPANY = "data1"; + field public static final java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/organization"; + field public static final java.lang.String DEPARTMENT = "data5"; + field public static final java.lang.String JOB_DESCRIPTION = "data6"; + field public static final java.lang.String OFFICE_LOCATION = "data9"; + field public static final java.lang.String PHONETIC_NAME = "data8"; + field public static final java.lang.String SYMBOL = "data7"; + field public static final java.lang.String TITLE = "data4"; + field public static final int TYPE_OTHER = 2; // 0x2 + field public static final int TYPE_WORK = 1; // 0x1 + } + + public static final class ContactsContract.CommonDataKinds.Phone implements android.provider.ContactsContract.CommonDataKinds.CommonColumns android.provider.ContactsContract.DataColumnsWithJoins { + method public static final java.lang.CharSequence getTypeLabel(android.content.res.Resources, int, java.lang.CharSequence); + method public static final int getTypeLabelResource(int); + field public static final android.net.Uri CONTENT_FILTER_URI; + field public static final java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/phone_v2"; + field public static final java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/phone_v2"; + field public static final android.net.Uri CONTENT_URI; + field public static final java.lang.String NORMALIZED_NUMBER = "data4"; + field public static final java.lang.String NUMBER = "data1"; + field public static final java.lang.String SEARCH_DISPLAY_NAME_KEY = "search_display_name"; + field public static final java.lang.String SEARCH_PHONE_NUMBER_KEY = "search_phone_number"; + field public static final int TYPE_ASSISTANT = 19; // 0x13 + field public static final int TYPE_CALLBACK = 8; // 0x8 + field public static final int TYPE_CAR = 9; // 0x9 + field public static final int TYPE_COMPANY_MAIN = 10; // 0xa + field public static final int TYPE_FAX_HOME = 5; // 0x5 + field public static final int TYPE_FAX_WORK = 4; // 0x4 + field public static final int TYPE_HOME = 1; // 0x1 + field public static final int TYPE_ISDN = 11; // 0xb + field public static final int TYPE_MAIN = 12; // 0xc + field public static final int TYPE_MMS = 20; // 0x14 + field public static final int TYPE_MOBILE = 2; // 0x2 + field public static final int TYPE_OTHER = 7; // 0x7 + field public static final int TYPE_OTHER_FAX = 13; // 0xd + field public static final int TYPE_PAGER = 6; // 0x6 + field public static final int TYPE_RADIO = 14; // 0xe + field public static final int TYPE_TELEX = 15; // 0xf + field public static final int TYPE_TTY_TDD = 16; // 0x10 + field public static final int TYPE_WORK = 3; // 0x3 + field public static final int TYPE_WORK_MOBILE = 17; // 0x11 + field public static final int TYPE_WORK_PAGER = 18; // 0x12 + } + + public static final class ContactsContract.CommonDataKinds.Photo implements android.provider.ContactsContract.DataColumnsWithJoins { + field public static final java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/photo"; + field public static final java.lang.String PHOTO = "data15"; + field public static final java.lang.String PHOTO_FILE_ID = "data14"; + } + + public static final class ContactsContract.CommonDataKinds.Relation implements android.provider.ContactsContract.CommonDataKinds.CommonColumns android.provider.ContactsContract.DataColumnsWithJoins { + method public static final java.lang.CharSequence getTypeLabel(android.content.res.Resources, int, java.lang.CharSequence); + method public static final int getTypeLabelResource(int); + field public static final java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/relation"; + field public static final java.lang.String NAME = "data1"; + field public static final int TYPE_ASSISTANT = 1; // 0x1 + field public static final int TYPE_BROTHER = 2; // 0x2 + field public static final int TYPE_CHILD = 3; // 0x3 + field public static final int TYPE_DOMESTIC_PARTNER = 4; // 0x4 + field public static final int TYPE_FATHER = 5; // 0x5 + field public static final int TYPE_FRIEND = 6; // 0x6 + field public static final int TYPE_MANAGER = 7; // 0x7 + field public static final int TYPE_MOTHER = 8; // 0x8 + field public static final int TYPE_PARENT = 9; // 0x9 + field public static final int TYPE_PARTNER = 10; // 0xa + field public static final int TYPE_REFERRED_BY = 11; // 0xb + field public static final int TYPE_RELATIVE = 12; // 0xc + field public static final int TYPE_SISTER = 13; // 0xd + field public static final int TYPE_SPOUSE = 14; // 0xe + } + + public static final class ContactsContract.CommonDataKinds.SipAddress implements android.provider.ContactsContract.CommonDataKinds.CommonColumns android.provider.ContactsContract.DataColumnsWithJoins { + method public static final java.lang.CharSequence getTypeLabel(android.content.res.Resources, int, java.lang.CharSequence); + method public static final int getTypeLabelResource(int); + field public static final java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/sip_address"; + field public static final java.lang.String SIP_ADDRESS = "data1"; + field public static final int TYPE_HOME = 1; // 0x1 + field public static final int TYPE_OTHER = 3; // 0x3 + field public static final int TYPE_WORK = 2; // 0x2 + } + + public static final class ContactsContract.CommonDataKinds.StructuredName implements android.provider.ContactsContract.DataColumnsWithJoins { + field public static final java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/name"; + field public static final java.lang.String DISPLAY_NAME = "data1"; + field public static final java.lang.String FAMILY_NAME = "data3"; + field public static final java.lang.String GIVEN_NAME = "data2"; + field public static final java.lang.String MIDDLE_NAME = "data5"; + field public static final java.lang.String PHONETIC_FAMILY_NAME = "data9"; + field public static final java.lang.String PHONETIC_GIVEN_NAME = "data7"; + field public static final java.lang.String PHONETIC_MIDDLE_NAME = "data8"; + field public static final java.lang.String PREFIX = "data4"; + field public static final java.lang.String SUFFIX = "data6"; + } + + public static final class ContactsContract.CommonDataKinds.StructuredPostal implements android.provider.ContactsContract.CommonDataKinds.CommonColumns android.provider.ContactsContract.DataColumnsWithJoins { + method public static final java.lang.CharSequence getTypeLabel(android.content.res.Resources, int, java.lang.CharSequence); + method public static final int getTypeLabelResource(int); + field public static final java.lang.String CITY = "data7"; + field public static final java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/postal-address_v2"; + field public static final java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/postal-address_v2"; + field public static final android.net.Uri CONTENT_URI; + field public static final java.lang.String COUNTRY = "data10"; + field public static final java.lang.String FORMATTED_ADDRESS = "data1"; + field public static final java.lang.String NEIGHBORHOOD = "data6"; + field public static final java.lang.String POBOX = "data5"; + field public static final java.lang.String POSTCODE = "data9"; + field public static final java.lang.String REGION = "data8"; + field public static final java.lang.String STREET = "data4"; + field public static final int TYPE_HOME = 1; // 0x1 + field public static final int TYPE_OTHER = 3; // 0x3 + field public static final int TYPE_WORK = 2; // 0x2 + } + + public static final class ContactsContract.CommonDataKinds.Website implements android.provider.ContactsContract.CommonDataKinds.CommonColumns android.provider.ContactsContract.DataColumnsWithJoins { + field public static final java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/website"; + field public static final int TYPE_BLOG = 2; // 0x2 + field public static final int TYPE_FTP = 6; // 0x6 + field public static final int TYPE_HOME = 4; // 0x4 + field public static final int TYPE_HOMEPAGE = 1; // 0x1 + field public static final int TYPE_OTHER = 7; // 0x7 + field public static final int TYPE_PROFILE = 3; // 0x3 + field public static final int TYPE_WORK = 5; // 0x5 + field public static final java.lang.String URL = "data1"; + } + + protected static abstract interface ContactsContract.ContactNameColumns { + field public static final java.lang.String DISPLAY_NAME_ALTERNATIVE = "display_name_alt"; + field public static final java.lang.String DISPLAY_NAME_PRIMARY = "display_name"; + field public static final java.lang.String DISPLAY_NAME_SOURCE = "display_name_source"; + field public static final java.lang.String PHONETIC_NAME = "phonetic_name"; + field public static final java.lang.String PHONETIC_NAME_STYLE = "phonetic_name_style"; + field public static final java.lang.String SORT_KEY_ALTERNATIVE = "sort_key_alt"; + field public static final java.lang.String SORT_KEY_PRIMARY = "sort_key"; + } + + protected static abstract interface ContactsContract.ContactOptionsColumns { + field public static final java.lang.String CUSTOM_RINGTONE = "custom_ringtone"; + field public static final java.lang.String LAST_TIME_CONTACTED = "last_time_contacted"; + field public static final java.lang.String SEND_TO_VOICEMAIL = "send_to_voicemail"; + field public static final java.lang.String STARRED = "starred"; + field public static final java.lang.String TIMES_CONTACTED = "times_contacted"; + } + + protected static abstract interface ContactsContract.ContactStatusColumns { + field public static final java.lang.String CONTACT_CHAT_CAPABILITY = "contact_chat_capability"; + field public static final java.lang.String CONTACT_PRESENCE = "contact_presence"; + field public static final java.lang.String CONTACT_STATUS = "contact_status"; + field public static final java.lang.String CONTACT_STATUS_ICON = "contact_status_icon"; + field public static final java.lang.String CONTACT_STATUS_LABEL = "contact_status_label"; + field public static final java.lang.String CONTACT_STATUS_RES_PACKAGE = "contact_status_res_package"; + field public static final java.lang.String CONTACT_STATUS_TIMESTAMP = "contact_status_ts"; + } + + public static class ContactsContract.Contacts implements android.provider.BaseColumns android.provider.ContactsContract.ContactNameColumns android.provider.ContactsContract.ContactOptionsColumns android.provider.ContactsContract.ContactStatusColumns android.provider.ContactsContract.ContactsColumns { + method public static android.net.Uri getLookupUri(android.content.ContentResolver, android.net.Uri); + method public static android.net.Uri getLookupUri(long, java.lang.String); + method public static android.net.Uri lookupContact(android.content.ContentResolver, android.net.Uri); + method public static deprecated void markAsContacted(android.content.ContentResolver, long); + method public static java.io.InputStream openContactPhotoInputStream(android.content.ContentResolver, android.net.Uri, boolean); + method public static java.io.InputStream openContactPhotoInputStream(android.content.ContentResolver, android.net.Uri); + field public static final android.net.Uri CONTENT_FILTER_URI; + field public static final android.net.Uri CONTENT_GROUP_URI; + field public static final java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/contact"; + field public static final android.net.Uri CONTENT_LOOKUP_URI; + field public static final android.net.Uri CONTENT_STREQUENT_FILTER_URI; + field public static final android.net.Uri CONTENT_STREQUENT_URI; + field public static final java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/contact"; + field public static final android.net.Uri CONTENT_URI; + field public static final java.lang.String CONTENT_VCARD_TYPE = "text/x-vcard"; + field public static final android.net.Uri CONTENT_VCARD_URI; + } + + public static final class ContactsContract.Contacts.AggregationSuggestions implements android.provider.BaseColumns android.provider.ContactsContract.ContactOptionsColumns android.provider.ContactsContract.ContactStatusColumns android.provider.ContactsContract.ContactsColumns { + field public static final java.lang.String CONTENT_DIRECTORY = "suggestions"; + } + + public static final class ContactsContract.Contacts.Data implements android.provider.BaseColumns android.provider.ContactsContract.DataColumns { + field public static final java.lang.String CONTENT_DIRECTORY = "data"; + } + + public static final class ContactsContract.Contacts.Entity implements android.provider.BaseColumns android.provider.ContactsContract.BaseSyncColumns android.provider.ContactsContract.ContactNameColumns android.provider.ContactsContract.ContactOptionsColumns android.provider.ContactsContract.ContactStatusColumns android.provider.ContactsContract.ContactsColumns android.provider.ContactsContract.DataColumns android.provider.ContactsContract.RawContactsColumns android.provider.ContactsContract.StatusColumns android.provider.ContactsContract.SyncColumns { + field public static final java.lang.String CONTENT_DIRECTORY = "entities"; + field public static final java.lang.String DATA_ID = "data_id"; + field public static final java.lang.String RAW_CONTACT_ID = "raw_contact_id"; + } + + public static final class ContactsContract.Contacts.Photo implements android.provider.BaseColumns android.provider.ContactsContract.DataColumnsWithJoins { + field public static final java.lang.String CONTENT_DIRECTORY = "photo"; + field public static final java.lang.String DISPLAY_PHOTO = "display_photo"; + field public static final java.lang.String PHOTO = "data15"; + field public static final java.lang.String PHOTO_FILE_ID = "data14"; + } + + public static final class ContactsContract.Contacts.StreamItems implements android.provider.ContactsContract.StreamItemsColumns { + field public static final java.lang.String CONTENT_DIRECTORY = "stream_items"; + } + + protected static abstract interface ContactsContract.ContactsColumns { + field public static final java.lang.String DISPLAY_NAME = "display_name"; + field public static final java.lang.String HAS_PHONE_NUMBER = "has_phone_number"; + field public static final java.lang.String IN_VISIBLE_GROUP = "in_visible_group"; + field public static final java.lang.String IS_USER_PROFILE = "is_user_profile"; + field public static final java.lang.String LOOKUP_KEY = "lookup"; + field public static final java.lang.String PHOTO_FILE_ID = "photo_file_id"; + field public static final java.lang.String PHOTO_ID = "photo_id"; + field public static final java.lang.String PHOTO_THUMBNAIL_URI = "photo_thumb_uri"; + field public static final java.lang.String PHOTO_URI = "photo_uri"; + } + + public static final class ContactsContract.Data implements android.provider.ContactsContract.DataColumnsWithJoins { + method public static android.net.Uri getContactLookupUri(android.content.ContentResolver, android.net.Uri); + field public static final java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/data"; + field public static final android.net.Uri CONTENT_URI; + } + + protected static abstract interface ContactsContract.DataColumns { + field public static final java.lang.String DATA1 = "data1"; + field public static final java.lang.String DATA10 = "data10"; + field public static final java.lang.String DATA11 = "data11"; + field public static final java.lang.String DATA12 = "data12"; + field public static final java.lang.String DATA13 = "data13"; + field public static final java.lang.String DATA14 = "data14"; + field public static final java.lang.String DATA15 = "data15"; + field public static final java.lang.String DATA2 = "data2"; + field public static final java.lang.String DATA3 = "data3"; + field public static final java.lang.String DATA4 = "data4"; + field public static final java.lang.String DATA5 = "data5"; + field public static final java.lang.String DATA6 = "data6"; + field public static final java.lang.String DATA7 = "data7"; + field public static final java.lang.String DATA8 = "data8"; + field public static final java.lang.String DATA9 = "data9"; + field public static final java.lang.String DATA_VERSION = "data_version"; + field public static final java.lang.String IS_PRIMARY = "is_primary"; + field public static final java.lang.String IS_READ_ONLY = "is_read_only"; + field public static final java.lang.String IS_SUPER_PRIMARY = "is_super_primary"; + field public static final java.lang.String MIMETYPE = "mimetype"; + field public static final java.lang.String RAW_CONTACT_ID = "raw_contact_id"; + field public static final java.lang.String SYNC1 = "data_sync1"; + field public static final java.lang.String SYNC2 = "data_sync2"; + field public static final java.lang.String SYNC3 = "data_sync3"; + field public static final java.lang.String SYNC4 = "data_sync4"; + } + + protected static abstract interface ContactsContract.DataColumnsWithJoins implements android.provider.BaseColumns android.provider.ContactsContract.ContactNameColumns android.provider.ContactsContract.ContactOptionsColumns android.provider.ContactsContract.ContactStatusColumns android.provider.ContactsContract.ContactsColumns android.provider.ContactsContract.DataColumns android.provider.ContactsContract.RawContactsColumns android.provider.ContactsContract.StatusColumns { + } + + public static final class ContactsContract.DataUsageFeedback { + ctor public ContactsContract.DataUsageFeedback(); + field public static final android.net.Uri DELETE_USAGE_URI; + field public static final android.net.Uri FEEDBACK_URI; + field public static final java.lang.String USAGE_TYPE = "type"; + field public static final java.lang.String USAGE_TYPE_CALL = "call"; + field public static final java.lang.String USAGE_TYPE_LONG_TEXT = "long_text"; + field public static final java.lang.String USAGE_TYPE_SHORT_TEXT = "short_text"; + } + + public static final class ContactsContract.Directory implements android.provider.BaseColumns { + method public static void notifyDirectoryChange(android.content.ContentResolver); + field public static final java.lang.String ACCOUNT_NAME = "accountName"; + field public static final java.lang.String ACCOUNT_TYPE = "accountType"; + field public static final java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/contact_directory"; + field public static final java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/contact_directories"; + field public static final android.net.Uri CONTENT_URI; + field public static final long DEFAULT = 0L; // 0x0L + field public static final java.lang.String DIRECTORY_AUTHORITY = "authority"; + field public static final java.lang.String DISPLAY_NAME = "displayName"; + field public static final java.lang.String EXPORT_SUPPORT = "exportSupport"; + field public static final int EXPORT_SUPPORT_ANY_ACCOUNT = 2; // 0x2 + field public static final int EXPORT_SUPPORT_NONE = 0; // 0x0 + field public static final int EXPORT_SUPPORT_SAME_ACCOUNT_ONLY = 1; // 0x1 + field public static final long LOCAL_INVISIBLE = 1L; // 0x1L + field public static final java.lang.String PACKAGE_NAME = "packageName"; + field public static final java.lang.String PHOTO_SUPPORT = "photoSupport"; + field public static final int PHOTO_SUPPORT_FULL = 3; // 0x3 + field public static final int PHOTO_SUPPORT_FULL_SIZE_ONLY = 2; // 0x2 + field public static final int PHOTO_SUPPORT_NONE = 0; // 0x0 + field public static final int PHOTO_SUPPORT_THUMBNAIL_ONLY = 1; // 0x1 + field public static final java.lang.String SHORTCUT_SUPPORT = "shortcutSupport"; + field public static final int SHORTCUT_SUPPORT_DATA_ITEMS_ONLY = 1; // 0x1 + field public static final int SHORTCUT_SUPPORT_FULL = 2; // 0x2 + field public static final int SHORTCUT_SUPPORT_NONE = 0; // 0x0 + field public static final java.lang.String TYPE_RESOURCE_ID = "typeResourceId"; + } + + public static abstract interface ContactsContract.DisplayNameSources { + field public static final int EMAIL = 10; // 0xa + field public static final int NICKNAME = 35; // 0x23 + field public static final int ORGANIZATION = 30; // 0x1e + field public static final int PHONE = 20; // 0x14 + field public static final int STRUCTURED_NAME = 40; // 0x28 + field public static final int UNDEFINED = 0; // 0x0 + } + + public static final class ContactsContract.DisplayPhoto { + field public static final android.net.Uri CONTENT_MAX_DIMENSIONS_URI; + field public static final android.net.Uri CONTENT_URI; + field public static final java.lang.String DISPLAY_MAX_DIM = "display_max_dim"; + field public static final java.lang.String THUMBNAIL_MAX_DIM = "thumbnail_max_dim"; + } + + public static abstract interface ContactsContract.FullNameStyle { + field public static final int CHINESE = 3; // 0x3 + field public static final int CJK = 2; // 0x2 + field public static final int JAPANESE = 4; // 0x4 + field public static final int KOREAN = 5; // 0x5 + field public static final int UNDEFINED = 0; // 0x0 + field public static final int WESTERN = 1; // 0x1 + } + + public static final class ContactsContract.Groups implements android.provider.BaseColumns android.provider.ContactsContract.GroupsColumns android.provider.ContactsContract.SyncColumns { + method public static android.content.EntityIterator newEntityIterator(android.database.Cursor); + field public static final java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/group"; + field public static final android.net.Uri CONTENT_SUMMARY_URI; + field public static final java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/group"; + field public static final android.net.Uri CONTENT_URI; + } + + protected static abstract interface ContactsContract.GroupsColumns { + field public static final java.lang.String AUTO_ADD = "auto_add"; + field public static final java.lang.String DATA_SET = "data_set"; + field public static final java.lang.String DELETED = "deleted"; + field public static final java.lang.String FAVORITES = "favorites"; + field public static final java.lang.String GROUP_IS_READ_ONLY = "group_is_read_only"; + field public static final java.lang.String GROUP_VISIBLE = "group_visible"; + field public static final java.lang.String NOTES = "notes"; + field public static final java.lang.String SHOULD_SYNC = "should_sync"; + field public static final java.lang.String SUMMARY_COUNT = "summ_count"; + field public static final java.lang.String SUMMARY_WITH_PHONES = "summ_phones"; + field public static final java.lang.String SYSTEM_ID = "system_id"; + field public static final java.lang.String TITLE = "title"; + } + + public static final class ContactsContract.Intents { + ctor public ContactsContract.Intents(); + field public static final java.lang.String ATTACH_IMAGE = "com.android.contacts.action.ATTACH_IMAGE"; + field public static final java.lang.String EXTRA_CREATE_DESCRIPTION = "com.android.contacts.action.CREATE_DESCRIPTION"; + field public static final java.lang.String EXTRA_FORCE_CREATE = "com.android.contacts.action.FORCE_CREATE"; + field public static final java.lang.String INVITE_CONTACT = "com.android.contacts.action.INVITE_CONTACT"; + field public static final java.lang.String SEARCH_SUGGESTION_CLICKED = "android.provider.Contacts.SEARCH_SUGGESTION_CLICKED"; + field public static final java.lang.String SEARCH_SUGGESTION_CREATE_CONTACT_CLICKED = "android.provider.Contacts.SEARCH_SUGGESTION_CREATE_CONTACT_CLICKED"; + field public static final java.lang.String SEARCH_SUGGESTION_DIAL_NUMBER_CLICKED = "android.provider.Contacts.SEARCH_SUGGESTION_DIAL_NUMBER_CLICKED"; + field public static final java.lang.String SHOW_OR_CREATE_CONTACT = "com.android.contacts.action.SHOW_OR_CREATE_CONTACT"; + } + + public static final class ContactsContract.Intents.Insert { + ctor public ContactsContract.Intents.Insert(); + field public static final java.lang.String ACTION = "android.intent.action.INSERT"; + field public static final java.lang.String COMPANY = "company"; + field public static final java.lang.String DATA = "data"; + field public static final java.lang.String EMAIL = "email"; + field public static final java.lang.String EMAIL_ISPRIMARY = "email_isprimary"; + field public static final java.lang.String EMAIL_TYPE = "email_type"; + field public static final java.lang.String FULL_MODE = "full_mode"; + field public static final java.lang.String IM_HANDLE = "im_handle"; + field public static final java.lang.String IM_ISPRIMARY = "im_isprimary"; + field public static final java.lang.String IM_PROTOCOL = "im_protocol"; + field public static final java.lang.String JOB_TITLE = "job_title"; + field public static final java.lang.String NAME = "name"; + field public static final java.lang.String NOTES = "notes"; + field public static final java.lang.String PHONE = "phone"; + field public static final java.lang.String PHONETIC_NAME = "phonetic_name"; + field public static final java.lang.String PHONE_ISPRIMARY = "phone_isprimary"; + field public static final java.lang.String PHONE_TYPE = "phone_type"; + field public static final java.lang.String POSTAL = "postal"; + field public static final java.lang.String POSTAL_ISPRIMARY = "postal_isprimary"; + field public static final java.lang.String POSTAL_TYPE = "postal_type"; + field public static final java.lang.String SECONDARY_EMAIL = "secondary_email"; + field public static final java.lang.String SECONDARY_EMAIL_TYPE = "secondary_email_type"; + field public static final java.lang.String SECONDARY_PHONE = "secondary_phone"; + field public static final java.lang.String SECONDARY_PHONE_TYPE = "secondary_phone_type"; + field public static final java.lang.String TERTIARY_EMAIL = "tertiary_email"; + field public static final java.lang.String TERTIARY_EMAIL_TYPE = "tertiary_email_type"; + field public static final java.lang.String TERTIARY_PHONE = "tertiary_phone"; + field public static final java.lang.String TERTIARY_PHONE_TYPE = "tertiary_phone_type"; + } + + public static final class ContactsContract.PhoneLookup implements android.provider.BaseColumns android.provider.ContactsContract.ContactOptionsColumns android.provider.ContactsContract.ContactsColumns android.provider.ContactsContract.PhoneLookupColumns { + field public static final android.net.Uri CONTENT_FILTER_URI; + } + + protected static abstract interface ContactsContract.PhoneLookupColumns { + field public static final java.lang.String LABEL = "label"; + field public static final java.lang.String NORMALIZED_NUMBER = "normalized_number"; + field public static final java.lang.String NUMBER = "number"; + field public static final java.lang.String TYPE = "type"; + } + + public static abstract interface ContactsContract.PhoneticNameStyle { + field public static final int JAPANESE = 4; // 0x4 + field public static final int KOREAN = 5; // 0x5 + field public static final int PINYIN = 3; // 0x3 + field public static final int UNDEFINED = 0; // 0x0 + } + + public static final deprecated class ContactsContract.Presence extends android.provider.ContactsContract.StatusUpdates { + ctor public ContactsContract.Presence(); + } + + protected static abstract interface ContactsContract.PresenceColumns { + field public static final java.lang.String CUSTOM_PROTOCOL = "custom_protocol"; + field public static final java.lang.String DATA_ID = "presence_data_id"; + field public static final java.lang.String IM_ACCOUNT = "im_account"; + field public static final java.lang.String IM_HANDLE = "im_handle"; + field public static final java.lang.String PROTOCOL = "protocol"; + } + + public static final class ContactsContract.Profile implements android.provider.BaseColumns android.provider.ContactsContract.ContactNameColumns android.provider.ContactsContract.ContactOptionsColumns android.provider.ContactsContract.ContactStatusColumns android.provider.ContactsContract.ContactsColumns { + field public static final android.net.Uri CONTENT_RAW_CONTACTS_URI; + field public static final android.net.Uri CONTENT_URI; + field public static final android.net.Uri CONTENT_VCARD_URI; + field public static final long MIN_ID = 9223372034707292160L; // 0x7fffffff80000000L + } + + public static final class ContactsContract.ProfileSyncState implements android.provider.SyncStateContract.Columns { + method public static byte[] get(android.content.ContentProviderClient, android.accounts.Account) throws android.os.RemoteException; + method public static android.util.Pair getWithUri(android.content.ContentProviderClient, android.accounts.Account) throws android.os.RemoteException; + method public static android.content.ContentProviderOperation newSetOperation(android.accounts.Account, byte[]); + method public static void set(android.content.ContentProviderClient, android.accounts.Account, byte[]) throws android.os.RemoteException; + field public static final java.lang.String CONTENT_DIRECTORY = "syncstate"; + field public static final android.net.Uri CONTENT_URI; + } + + public static final class ContactsContract.QuickContact { + ctor public ContactsContract.QuickContact(); + method public static void showQuickContact(android.content.Context, android.view.View, android.net.Uri, int, java.lang.String[]); + method public static void showQuickContact(android.content.Context, android.graphics.Rect, android.net.Uri, int, java.lang.String[]); + field public static final int MODE_LARGE = 3; // 0x3 + field public static final int MODE_MEDIUM = 2; // 0x2 + field public static final int MODE_SMALL = 1; // 0x1 + } + + public static final class ContactsContract.RawContacts implements android.provider.BaseColumns android.provider.ContactsContract.ContactNameColumns android.provider.ContactsContract.ContactOptionsColumns android.provider.ContactsContract.RawContactsColumns android.provider.ContactsContract.SyncColumns { + method public static android.net.Uri getContactLookupUri(android.content.ContentResolver, android.net.Uri); + method public static android.content.EntityIterator newEntityIterator(android.database.Cursor); + field public static final int AGGREGATION_MODE_DEFAULT = 0; // 0x0 + field public static final int AGGREGATION_MODE_DISABLED = 3; // 0x3 + field public static final deprecated int AGGREGATION_MODE_IMMEDIATE = 1; // 0x1 + field public static final int AGGREGATION_MODE_SUSPENDED = 2; // 0x2 + field public static final java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/raw_contact"; + field public static final java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/raw_contact"; + field public static final android.net.Uri CONTENT_URI; + } + + public static final class ContactsContract.RawContacts.Data implements android.provider.BaseColumns android.provider.ContactsContract.DataColumns { + field public static final java.lang.String CONTENT_DIRECTORY = "data"; + } + + public static final class ContactsContract.RawContacts.DisplayPhoto { + field public static final java.lang.String CONTENT_DIRECTORY = "display_photo"; + } + + public static final class ContactsContract.RawContacts.Entity implements android.provider.BaseColumns android.provider.ContactsContract.DataColumns { + field public static final java.lang.String CONTENT_DIRECTORY = "entity"; + field public static final java.lang.String DATA_ID = "data_id"; + } + + public static final class ContactsContract.RawContacts.StreamItems implements android.provider.BaseColumns android.provider.ContactsContract.StreamItemsColumns { + field public static final java.lang.String CONTENT_DIRECTORY = "stream_items"; + } + + protected static abstract interface ContactsContract.RawContactsColumns { + field public static final java.lang.String AGGREGATION_MODE = "aggregation_mode"; + field public static final java.lang.String CONTACT_ID = "contact_id"; + field public static final java.lang.String DATA_SET = "data_set"; + field public static final java.lang.String DELETED = "deleted"; + field public static final java.lang.String RAW_CONTACT_IS_READ_ONLY = "raw_contact_is_read_only"; + field public static final java.lang.String RAW_CONTACT_IS_USER_PROFILE = "raw_contact_is_user_profile"; + } + + public static final class ContactsContract.RawContactsEntity implements android.provider.BaseColumns android.provider.ContactsContract.DataColumns android.provider.ContactsContract.RawContactsColumns { + field public static final java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/raw_contact_entity"; + field public static final android.net.Uri CONTENT_URI; + field public static final java.lang.String DATA_ID = "data_id"; + field public static final android.net.Uri PROFILE_CONTENT_URI; + } + + public static final class ContactsContract.Settings implements android.provider.ContactsContract.SettingsColumns { + field public static final java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/setting"; + field public static final java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/setting"; + field public static final android.net.Uri CONTENT_URI; + } + + protected static abstract interface ContactsContract.SettingsColumns { + field public static final java.lang.String ACCOUNT_NAME = "account_name"; + field public static final java.lang.String ACCOUNT_TYPE = "account_type"; + field public static final java.lang.String ANY_UNSYNCED = "any_unsynced"; + field public static final java.lang.String DATA_SET = "data_set"; + field public static final java.lang.String SHOULD_SYNC = "should_sync"; + field public static final java.lang.String UNGROUPED_COUNT = "summ_count"; + field public static final java.lang.String UNGROUPED_VISIBLE = "ungrouped_visible"; + field public static final java.lang.String UNGROUPED_WITH_PHONES = "summ_phones"; + } + + protected static abstract interface ContactsContract.StatusColumns { + field public static final int AVAILABLE = 5; // 0x5 + field public static final int AWAY = 2; // 0x2 + field public static final int CAPABILITY_HAS_CAMERA = 4; // 0x4 + field public static final int CAPABILITY_HAS_VIDEO = 2; // 0x2 + field public static final int CAPABILITY_HAS_VOICE = 1; // 0x1 + field public static final java.lang.String CHAT_CAPABILITY = "chat_capability"; + field public static final int DO_NOT_DISTURB = 4; // 0x4 + field public static final int IDLE = 3; // 0x3 + field public static final int INVISIBLE = 1; // 0x1 + field public static final int OFFLINE = 0; // 0x0 + field public static final java.lang.String PRESENCE = "mode"; + field public static final deprecated java.lang.String PRESENCE_CUSTOM_STATUS = "status"; + field public static final deprecated java.lang.String PRESENCE_STATUS = "mode"; + field public static final java.lang.String STATUS = "status"; + field public static final java.lang.String STATUS_ICON = "status_icon"; + field public static final java.lang.String STATUS_LABEL = "status_label"; + field public static final java.lang.String STATUS_RES_PACKAGE = "status_res_package"; + field public static final java.lang.String STATUS_TIMESTAMP = "status_ts"; + } + + public static class ContactsContract.StatusUpdates implements android.provider.ContactsContract.PresenceColumns android.provider.ContactsContract.StatusColumns { + method public static final int getPresenceIconResourceId(int); + method public static final int getPresencePrecedence(int); + field public static final java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/status-update"; + field public static final java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/status-update"; + field public static final android.net.Uri CONTENT_URI; + field public static final android.net.Uri PROFILE_CONTENT_URI; + } + + public static final class ContactsContract.StreamItemPhotos implements android.provider.BaseColumns android.provider.ContactsContract.StreamItemPhotosColumns { + field public static final java.lang.String PHOTO = "photo"; + } + + protected static abstract interface ContactsContract.StreamItemPhotosColumns { + field public static final java.lang.String PHOTO_FILE_ID = "photo_file_id"; + field public static final java.lang.String PHOTO_URI = "photo_uri"; + field public static final java.lang.String SORT_INDEX = "sort_index"; + field public static final java.lang.String STREAM_ITEM_ID = "stream_item_id"; + field public static final java.lang.String SYNC1 = "stream_item_photo_sync1"; + field public static final java.lang.String SYNC2 = "stream_item_photo_sync2"; + field public static final java.lang.String SYNC3 = "stream_item_photo_sync3"; + field public static final java.lang.String SYNC4 = "stream_item_photo_sync4"; + } + + public static final class ContactsContract.StreamItems implements android.provider.BaseColumns android.provider.ContactsContract.StreamItemsColumns { + field public static final java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/stream_item"; + field public static final android.net.Uri CONTENT_LIMIT_URI; + field public static final android.net.Uri CONTENT_PHOTO_URI; + field public static final java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/stream_item"; + field public static final android.net.Uri CONTENT_URI; + field public static final java.lang.String MAX_ITEMS = "max_items"; + } + + public static final class ContactsContract.StreamItems.StreamItemPhotos implements android.provider.BaseColumns android.provider.ContactsContract.StreamItemPhotosColumns { + field public static final java.lang.String CONTENT_DIRECTORY = "photo"; + field public static final java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/stream_item_photo"; + field public static final java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/stream_item_photo"; + } + + protected static abstract interface ContactsContract.StreamItemsColumns { + field public static final java.lang.String ACCOUNT_NAME = "account_name"; + field public static final java.lang.String ACCOUNT_TYPE = "account_type"; + field public static final java.lang.String COMMENTS = "comments"; + field public static final java.lang.String CONTACT_ID = "contact_id"; + field public static final java.lang.String CONTACT_LOOKUP_KEY = "contact_lookup"; + field public static final java.lang.String DATA_SET = "data_set"; + field public static final java.lang.String RAW_CONTACT_ID = "raw_contact_id"; + field public static final java.lang.String RAW_CONTACT_SOURCE_ID = "raw_contact_source_id"; + field public static final java.lang.String RES_ICON = "icon"; + field public static final java.lang.String RES_LABEL = "label"; + field public static final java.lang.String RES_PACKAGE = "res_package"; + field public static final java.lang.String SYNC1 = "stream_item_sync1"; + field public static final java.lang.String SYNC2 = "stream_item_sync2"; + field public static final java.lang.String SYNC3 = "stream_item_sync3"; + field public static final java.lang.String SYNC4 = "stream_item_sync4"; + field public static final java.lang.String TEXT = "text"; + field public static final java.lang.String TIMESTAMP = "timestamp"; + } + + protected static abstract interface ContactsContract.SyncColumns implements android.provider.ContactsContract.BaseSyncColumns { + field public static final java.lang.String ACCOUNT_NAME = "account_name"; + field public static final java.lang.String ACCOUNT_TYPE = "account_type"; + field public static final java.lang.String DIRTY = "dirty"; + field public static final java.lang.String SOURCE_ID = "sourceid"; + field public static final java.lang.String VERSION = "version"; + } + + public static final class ContactsContract.SyncState implements android.provider.SyncStateContract.Columns { + method public static byte[] get(android.content.ContentProviderClient, android.accounts.Account) throws android.os.RemoteException; + method public static android.util.Pair getWithUri(android.content.ContentProviderClient, android.accounts.Account) throws android.os.RemoteException; + method public static android.content.ContentProviderOperation newSetOperation(android.accounts.Account, byte[]); + method public static void set(android.content.ContentProviderClient, android.accounts.Account, byte[]) throws android.os.RemoteException; + field public static final java.lang.String CONTENT_DIRECTORY = "syncstate"; + field public static final android.net.Uri CONTENT_URI; + } + + public final deprecated class LiveFolders implements android.provider.BaseColumns { + field public static final java.lang.String ACTION_CREATE_LIVE_FOLDER = "android.intent.action.CREATE_LIVE_FOLDER"; + field public static final java.lang.String DESCRIPTION = "description"; + field public static final int DISPLAY_MODE_GRID = 1; // 0x1 + field public static final int DISPLAY_MODE_LIST = 2; // 0x2 + field public static final java.lang.String EXTRA_LIVE_FOLDER_BASE_INTENT = "android.intent.extra.livefolder.BASE_INTENT"; + field public static final java.lang.String EXTRA_LIVE_FOLDER_DISPLAY_MODE = "android.intent.extra.livefolder.DISPLAY_MODE"; + field public static final java.lang.String EXTRA_LIVE_FOLDER_ICON = "android.intent.extra.livefolder.ICON"; + field public static final java.lang.String EXTRA_LIVE_FOLDER_NAME = "android.intent.extra.livefolder.NAME"; + field public static final java.lang.String ICON_BITMAP = "icon_bitmap"; + field public static final java.lang.String ICON_PACKAGE = "icon_package"; + field public static final java.lang.String ICON_RESOURCE = "icon_resource"; + field public static final java.lang.String INTENT = "intent"; + field public static final java.lang.String NAME = "name"; + } + + public final class MediaStore { + ctor public MediaStore(); + method public static android.net.Uri getMediaScannerUri(); + method public static java.lang.String getVersion(android.content.Context); + field public static final java.lang.String ACTION_IMAGE_CAPTURE = "android.media.action.IMAGE_CAPTURE"; + field public static final java.lang.String ACTION_IMAGE_CAPTURE_SECURE = "android.media.action.IMAGE_CAPTURE_SECURE"; + field public static final java.lang.String ACTION_VIDEO_CAPTURE = "android.media.action.VIDEO_CAPTURE"; + field public static final java.lang.String AUTHORITY = "media"; + field public static final java.lang.String EXTRA_DURATION_LIMIT = "android.intent.extra.durationLimit"; + field public static final java.lang.String EXTRA_FINISH_ON_COMPLETION = "android.intent.extra.finishOnCompletion"; + field public static final java.lang.String EXTRA_FULL_SCREEN = "android.intent.extra.fullScreen"; + field public static final java.lang.String EXTRA_MEDIA_ALBUM = "android.intent.extra.album"; + field public static final java.lang.String EXTRA_MEDIA_ARTIST = "android.intent.extra.artist"; + field public static final java.lang.String EXTRA_MEDIA_FOCUS = "android.intent.extra.focus"; + field public static final java.lang.String EXTRA_MEDIA_TITLE = "android.intent.extra.title"; + field public static final java.lang.String EXTRA_OUTPUT = "output"; + field public static final java.lang.String EXTRA_SCREEN_ORIENTATION = "android.intent.extra.screenOrientation"; + field public static final java.lang.String EXTRA_SHOW_ACTION_ICONS = "android.intent.extra.showActionIcons"; + field public static final java.lang.String EXTRA_SIZE_LIMIT = "android.intent.extra.sizeLimit"; + field public static final java.lang.String EXTRA_VIDEO_QUALITY = "android.intent.extra.videoQuality"; + field public static final java.lang.String INTENT_ACTION_MEDIA_PLAY_FROM_SEARCH = "android.media.action.MEDIA_PLAY_FROM_SEARCH"; + field public static final java.lang.String INTENT_ACTION_MEDIA_SEARCH = "android.intent.action.MEDIA_SEARCH"; + field public static final deprecated java.lang.String INTENT_ACTION_MUSIC_PLAYER = "android.intent.action.MUSIC_PLAYER"; + field public static final java.lang.String INTENT_ACTION_STILL_IMAGE_CAMERA = "android.media.action.STILL_IMAGE_CAMERA"; + field public static final java.lang.String INTENT_ACTION_STILL_IMAGE_CAMERA_SECURE = "android.media.action.STILL_IMAGE_CAMERA_SECURE"; + field public static final java.lang.String INTENT_ACTION_TEXT_OPEN_FROM_SEARCH = "android.media.action.TEXT_OPEN_FROM_SEARCH"; + field public static final java.lang.String INTENT_ACTION_VIDEO_CAMERA = "android.media.action.VIDEO_CAMERA"; + field public static final java.lang.String INTENT_ACTION_VIDEO_PLAY_FROM_SEARCH = "android.media.action.VIDEO_PLAY_FROM_SEARCH"; + field public static final java.lang.String MEDIA_IGNORE_FILENAME = ".nomedia"; + field public static final java.lang.String MEDIA_SCANNER_VOLUME = "volume"; + field public static final java.lang.String UNKNOWN_STRING = ""; + } + + public static final class MediaStore.Audio { + ctor public MediaStore.Audio(); + method public static java.lang.String keyFor(java.lang.String); + } + + public static abstract interface MediaStore.Audio.AlbumColumns { + field public static final java.lang.String ALBUM = "album"; + field public static final java.lang.String ALBUM_ART = "album_art"; + field public static final java.lang.String ALBUM_ID = "album_id"; + field public static final java.lang.String ALBUM_KEY = "album_key"; + field public static final java.lang.String ARTIST = "artist"; + field public static final java.lang.String FIRST_YEAR = "minyear"; + field public static final java.lang.String LAST_YEAR = "maxyear"; + field public static final java.lang.String NUMBER_OF_SONGS = "numsongs"; + field public static final java.lang.String NUMBER_OF_SONGS_FOR_ARTIST = "numsongs_by_artist"; + } + + public static final class MediaStore.Audio.Albums implements android.provider.BaseColumns android.provider.MediaStore.Audio.AlbumColumns { + ctor public MediaStore.Audio.Albums(); + method public static android.net.Uri getContentUri(java.lang.String); + field public static final java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/albums"; + field public static final java.lang.String DEFAULT_SORT_ORDER = "album_key"; + field public static final java.lang.String ENTRY_CONTENT_TYPE = "vnd.android.cursor.item/album"; + field public static final android.net.Uri EXTERNAL_CONTENT_URI; + field public static final android.net.Uri INTERNAL_CONTENT_URI; + } + + public static abstract interface MediaStore.Audio.ArtistColumns { + field public static final java.lang.String ARTIST = "artist"; + field public static final java.lang.String ARTIST_KEY = "artist_key"; + field public static final java.lang.String NUMBER_OF_ALBUMS = "number_of_albums"; + field public static final java.lang.String NUMBER_OF_TRACKS = "number_of_tracks"; + } + + public static final class MediaStore.Audio.Artists implements android.provider.BaseColumns android.provider.MediaStore.Audio.ArtistColumns { + ctor public MediaStore.Audio.Artists(); + method public static android.net.Uri getContentUri(java.lang.String); + field public static final java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/artists"; + field public static final java.lang.String DEFAULT_SORT_ORDER = "artist_key"; + field public static final java.lang.String ENTRY_CONTENT_TYPE = "vnd.android.cursor.item/artist"; + field public static final android.net.Uri EXTERNAL_CONTENT_URI; + field public static final android.net.Uri INTERNAL_CONTENT_URI; + } + + public static final class MediaStore.Audio.Artists.Albums implements android.provider.MediaStore.Audio.AlbumColumns { + ctor public MediaStore.Audio.Artists.Albums(); + method public static final android.net.Uri getContentUri(java.lang.String, long); + } + + public static abstract interface MediaStore.Audio.AudioColumns implements android.provider.MediaStore.MediaColumns { + field public static final java.lang.String ALBUM = "album"; + field public static final java.lang.String ALBUM_ID = "album_id"; + field public static final java.lang.String ALBUM_KEY = "album_key"; + field public static final java.lang.String ARTIST = "artist"; + field public static final java.lang.String ARTIST_ID = "artist_id"; + field public static final java.lang.String ARTIST_KEY = "artist_key"; + field public static final java.lang.String BOOKMARK = "bookmark"; + field public static final java.lang.String COMPOSER = "composer"; + field public static final java.lang.String DURATION = "duration"; + field public static final java.lang.String IS_ALARM = "is_alarm"; + field public static final java.lang.String IS_MUSIC = "is_music"; + field public static final java.lang.String IS_NOTIFICATION = "is_notification"; + field public static final java.lang.String IS_PODCAST = "is_podcast"; + field public static final java.lang.String IS_RINGTONE = "is_ringtone"; + field public static final java.lang.String TITLE_KEY = "title_key"; + field public static final java.lang.String TRACK = "track"; + field public static final java.lang.String YEAR = "year"; + } + + public static final class MediaStore.Audio.Genres implements android.provider.BaseColumns android.provider.MediaStore.Audio.GenresColumns { + ctor public MediaStore.Audio.Genres(); + method public static android.net.Uri getContentUri(java.lang.String); + method public static android.net.Uri getContentUriForAudioId(java.lang.String, int); + field public static final java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/genre"; + field public static final java.lang.String DEFAULT_SORT_ORDER = "name"; + field public static final java.lang.String ENTRY_CONTENT_TYPE = "vnd.android.cursor.item/genre"; + field public static final android.net.Uri EXTERNAL_CONTENT_URI; + field public static final android.net.Uri INTERNAL_CONTENT_URI; + } + + public static final class MediaStore.Audio.Genres.Members implements android.provider.MediaStore.Audio.AudioColumns { + ctor public MediaStore.Audio.Genres.Members(); + method public static final android.net.Uri getContentUri(java.lang.String, long); + field public static final java.lang.String AUDIO_ID = "audio_id"; + field public static final java.lang.String CONTENT_DIRECTORY = "members"; + field public static final java.lang.String DEFAULT_SORT_ORDER = "title_key"; + field public static final java.lang.String GENRE_ID = "genre_id"; + } + + public static abstract interface MediaStore.Audio.GenresColumns { + field public static final java.lang.String NAME = "name"; + } + + public static final class MediaStore.Audio.Media implements android.provider.MediaStore.Audio.AudioColumns { + ctor public MediaStore.Audio.Media(); + method public static android.net.Uri getContentUri(java.lang.String); + method public static android.net.Uri getContentUriForPath(java.lang.String); + field public static final java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/audio"; + field public static final java.lang.String DEFAULT_SORT_ORDER = "title_key"; + field public static final android.net.Uri EXTERNAL_CONTENT_URI; + field public static final java.lang.String EXTRA_MAX_BYTES = "android.provider.MediaStore.extra.MAX_BYTES"; + field public static final android.net.Uri INTERNAL_CONTENT_URI; + field public static final java.lang.String RECORD_SOUND_ACTION = "android.provider.MediaStore.RECORD_SOUND"; + } + + public static final class MediaStore.Audio.Playlists implements android.provider.BaseColumns android.provider.MediaStore.Audio.PlaylistsColumns { + ctor public MediaStore.Audio.Playlists(); + method public static android.net.Uri getContentUri(java.lang.String); + field public static final java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/playlist"; + field public static final java.lang.String DEFAULT_SORT_ORDER = "name"; + field public static final java.lang.String ENTRY_CONTENT_TYPE = "vnd.android.cursor.item/playlist"; + field public static final android.net.Uri EXTERNAL_CONTENT_URI; + field public static final android.net.Uri INTERNAL_CONTENT_URI; + } + + public static final class MediaStore.Audio.Playlists.Members implements android.provider.MediaStore.Audio.AudioColumns { + ctor public MediaStore.Audio.Playlists.Members(); + method public static final android.net.Uri getContentUri(java.lang.String, long); + method public static final boolean moveItem(android.content.ContentResolver, long, int, int); + field public static final java.lang.String AUDIO_ID = "audio_id"; + field public static final java.lang.String CONTENT_DIRECTORY = "members"; + field public static final java.lang.String DEFAULT_SORT_ORDER = "play_order"; + field public static final java.lang.String PLAYLIST_ID = "playlist_id"; + field public static final java.lang.String PLAY_ORDER = "play_order"; + field public static final java.lang.String _ID = "_id"; + } + + public static abstract interface MediaStore.Audio.PlaylistsColumns { + field public static final java.lang.String DATA = "_data"; + field public static final java.lang.String DATE_ADDED = "date_added"; + field public static final java.lang.String DATE_MODIFIED = "date_modified"; + field public static final java.lang.String NAME = "name"; + } + + public static final class MediaStore.Files { + ctor public MediaStore.Files(); + method public static android.net.Uri getContentUri(java.lang.String); + method public static final android.net.Uri getContentUri(java.lang.String, long); + } + + public static abstract interface MediaStore.Files.FileColumns implements android.provider.MediaStore.MediaColumns { + field public static final java.lang.String MEDIA_TYPE = "media_type"; + field public static final int MEDIA_TYPE_AUDIO = 2; // 0x2 + field public static final int MEDIA_TYPE_IMAGE = 1; // 0x1 + field public static final int MEDIA_TYPE_NONE = 0; // 0x0 + field public static final int MEDIA_TYPE_PLAYLIST = 4; // 0x4 + field public static final int MEDIA_TYPE_VIDEO = 3; // 0x3 + field public static final java.lang.String MIME_TYPE = "mime_type"; + field public static final java.lang.String PARENT = "parent"; + field public static final java.lang.String TITLE = "title"; + } + + public static final class MediaStore.Images { + ctor public MediaStore.Images(); + } + + public static abstract interface MediaStore.Images.ImageColumns implements android.provider.MediaStore.MediaColumns { + field public static final java.lang.String BUCKET_DISPLAY_NAME = "bucket_display_name"; + field public static final java.lang.String BUCKET_ID = "bucket_id"; + field public static final java.lang.String DATE_TAKEN = "datetaken"; + field public static final java.lang.String DESCRIPTION = "description"; + field public static final java.lang.String IS_PRIVATE = "isprivate"; + field public static final java.lang.String LATITUDE = "latitude"; + field public static final java.lang.String LONGITUDE = "longitude"; + field public static final java.lang.String MINI_THUMB_MAGIC = "mini_thumb_magic"; + field public static final java.lang.String ORIENTATION = "orientation"; + field public static final java.lang.String PICASA_ID = "picasa_id"; + } + + public static final class MediaStore.Images.Media implements android.provider.MediaStore.Images.ImageColumns { + ctor public MediaStore.Images.Media(); + method public static final android.graphics.Bitmap getBitmap(android.content.ContentResolver, android.net.Uri) throws java.io.FileNotFoundException, java.io.IOException; + method public static android.net.Uri getContentUri(java.lang.String); + method public static final java.lang.String insertImage(android.content.ContentResolver, java.lang.String, java.lang.String, java.lang.String) throws java.io.FileNotFoundException; + method public static final java.lang.String insertImage(android.content.ContentResolver, android.graphics.Bitmap, java.lang.String, java.lang.String); + method public static final android.database.Cursor query(android.content.ContentResolver, android.net.Uri, java.lang.String[]); + method public static final android.database.Cursor query(android.content.ContentResolver, android.net.Uri, java.lang.String[], java.lang.String, java.lang.String); + method public static final android.database.Cursor query(android.content.ContentResolver, android.net.Uri, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String); + field public static final java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/image"; + field public static final java.lang.String DEFAULT_SORT_ORDER = "bucket_display_name"; + field public static final android.net.Uri EXTERNAL_CONTENT_URI; + field public static final android.net.Uri INTERNAL_CONTENT_URI; + } + + public static class MediaStore.Images.Thumbnails implements android.provider.BaseColumns { + ctor public MediaStore.Images.Thumbnails(); + method public static void cancelThumbnailRequest(android.content.ContentResolver, long); + method public static void cancelThumbnailRequest(android.content.ContentResolver, long, long); + method public static android.net.Uri getContentUri(java.lang.String); + method public static android.graphics.Bitmap getThumbnail(android.content.ContentResolver, long, int, android.graphics.BitmapFactory.Options); + method public static android.graphics.Bitmap getThumbnail(android.content.ContentResolver, long, long, int, android.graphics.BitmapFactory.Options); + method public static final android.database.Cursor query(android.content.ContentResolver, android.net.Uri, java.lang.String[]); + method public static final android.database.Cursor queryMiniThumbnail(android.content.ContentResolver, long, int, java.lang.String[]); + method public static final android.database.Cursor queryMiniThumbnails(android.content.ContentResolver, android.net.Uri, int, java.lang.String[]); + field public static final java.lang.String DATA = "_data"; + field public static final java.lang.String DEFAULT_SORT_ORDER = "image_id ASC"; + field public static final android.net.Uri EXTERNAL_CONTENT_URI; + field public static final int FULL_SCREEN_KIND = 2; // 0x2 + field public static final java.lang.String HEIGHT = "height"; + field public static final java.lang.String IMAGE_ID = "image_id"; + field public static final android.net.Uri INTERNAL_CONTENT_URI; + field public static final java.lang.String KIND = "kind"; + field public static final int MICRO_KIND = 3; // 0x3 + field public static final int MINI_KIND = 1; // 0x1 + field public static final java.lang.String THUMB_DATA = "thumb_data"; + field public static final java.lang.String WIDTH = "width"; + } + + public static abstract interface MediaStore.MediaColumns implements android.provider.BaseColumns { + field public static final java.lang.String DATA = "_data"; + field public static final java.lang.String DATE_ADDED = "date_added"; + field public static final java.lang.String DATE_MODIFIED = "date_modified"; + field public static final java.lang.String DISPLAY_NAME = "_display_name"; + field public static final java.lang.String HEIGHT = "height"; + field public static final java.lang.String MIME_TYPE = "mime_type"; + field public static final java.lang.String SIZE = "_size"; + field public static final java.lang.String TITLE = "title"; + field public static final java.lang.String WIDTH = "width"; + } + + public static final class MediaStore.Video { + ctor public MediaStore.Video(); + method public static final android.database.Cursor query(android.content.ContentResolver, android.net.Uri, java.lang.String[]); + field public static final java.lang.String DEFAULT_SORT_ORDER = "_display_name"; + } + + public static final class MediaStore.Video.Media implements android.provider.MediaStore.Video.VideoColumns { + ctor public MediaStore.Video.Media(); + method public static android.net.Uri getContentUri(java.lang.String); + field public static final java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/video"; + field public static final java.lang.String DEFAULT_SORT_ORDER = "title"; + field public static final android.net.Uri EXTERNAL_CONTENT_URI; + field public static final android.net.Uri INTERNAL_CONTENT_URI; + } + + public static class MediaStore.Video.Thumbnails implements android.provider.BaseColumns { + ctor public MediaStore.Video.Thumbnails(); + method public static void cancelThumbnailRequest(android.content.ContentResolver, long); + method public static void cancelThumbnailRequest(android.content.ContentResolver, long, long); + method public static android.net.Uri getContentUri(java.lang.String); + method public static android.graphics.Bitmap getThumbnail(android.content.ContentResolver, long, int, android.graphics.BitmapFactory.Options); + method public static android.graphics.Bitmap getThumbnail(android.content.ContentResolver, long, long, int, android.graphics.BitmapFactory.Options); + field public static final java.lang.String DATA = "_data"; + field public static final java.lang.String DEFAULT_SORT_ORDER = "video_id ASC"; + field public static final android.net.Uri EXTERNAL_CONTENT_URI; + field public static final int FULL_SCREEN_KIND = 2; // 0x2 + field public static final java.lang.String HEIGHT = "height"; + field public static final android.net.Uri INTERNAL_CONTENT_URI; + field public static final java.lang.String KIND = "kind"; + field public static final int MICRO_KIND = 3; // 0x3 + field public static final int MINI_KIND = 1; // 0x1 + field public static final java.lang.String VIDEO_ID = "video_id"; + field public static final java.lang.String WIDTH = "width"; + } + + public static abstract interface MediaStore.Video.VideoColumns implements android.provider.MediaStore.MediaColumns { + field public static final java.lang.String ALBUM = "album"; + field public static final java.lang.String ARTIST = "artist"; + field public static final java.lang.String BOOKMARK = "bookmark"; + field public static final java.lang.String BUCKET_DISPLAY_NAME = "bucket_display_name"; + field public static final java.lang.String BUCKET_ID = "bucket_id"; + field public static final java.lang.String CATEGORY = "category"; + field public static final java.lang.String DATE_TAKEN = "datetaken"; + field public static final java.lang.String DESCRIPTION = "description"; + field public static final java.lang.String DURATION = "duration"; + field public static final java.lang.String IS_PRIVATE = "isprivate"; + field public static final java.lang.String LANGUAGE = "language"; + field public static final java.lang.String LATITUDE = "latitude"; + field public static final java.lang.String LONGITUDE = "longitude"; + field public static final java.lang.String MINI_THUMB_MAGIC = "mini_thumb_magic"; + field public static final java.lang.String RESOLUTION = "resolution"; + field public static final java.lang.String TAGS = "tags"; + } + + public abstract interface OpenableColumns { + field public static final java.lang.String DISPLAY_NAME = "_display_name"; + field public static final java.lang.String SIZE = "_size"; + } + + public class SearchRecentSuggestions { + ctor public SearchRecentSuggestions(android.content.Context, java.lang.String, int); + method public void clearHistory(); + method public void saveRecentQuery(java.lang.String, java.lang.String); + method protected void truncateHistory(android.content.ContentResolver, int); + field public static final java.lang.String[] QUERIES_PROJECTION_1LINE; + field public static final java.lang.String[] QUERIES_PROJECTION_2LINE; + field public static final int QUERIES_PROJECTION_DATE_INDEX = 1; // 0x1 + field public static final int QUERIES_PROJECTION_DISPLAY1_INDEX = 3; // 0x3 + field public static final int QUERIES_PROJECTION_DISPLAY2_INDEX = 4; // 0x4 + field public static final int QUERIES_PROJECTION_QUERY_INDEX = 2; // 0x2 + } + + public final class Settings { + ctor public Settings(); + field public static final java.lang.String ACTION_ACCESSIBILITY_SETTINGS = "android.settings.ACCESSIBILITY_SETTINGS"; + field public static final java.lang.String ACTION_ADD_ACCOUNT = "android.settings.ADD_ACCOUNT_SETTINGS"; + field public static final java.lang.String ACTION_AIRPLANE_MODE_SETTINGS = "android.settings.AIRPLANE_MODE_SETTINGS"; + field public static final java.lang.String ACTION_APN_SETTINGS = "android.settings.APN_SETTINGS"; + field public static final java.lang.String ACTION_APPLICATION_DETAILS_SETTINGS = "android.settings.APPLICATION_DETAILS_SETTINGS"; + field public static final java.lang.String ACTION_APPLICATION_DEVELOPMENT_SETTINGS = "android.settings.APPLICATION_DEVELOPMENT_SETTINGS"; + field public static final java.lang.String ACTION_APPLICATION_SETTINGS = "android.settings.APPLICATION_SETTINGS"; + field public static final java.lang.String ACTION_BLUETOOTH_SETTINGS = "android.settings.BLUETOOTH_SETTINGS"; + field public static final java.lang.String ACTION_DATA_ROAMING_SETTINGS = "android.settings.DATA_ROAMING_SETTINGS"; + field public static final java.lang.String ACTION_DATE_SETTINGS = "android.settings.DATE_SETTINGS"; + field public static final java.lang.String ACTION_DEVICE_INFO_SETTINGS = "android.settings.DEVICE_INFO_SETTINGS"; + field public static final java.lang.String ACTION_DISPLAY_SETTINGS = "android.settings.DISPLAY_SETTINGS"; + field public static final java.lang.String ACTION_INPUT_METHOD_SETTINGS = "android.settings.INPUT_METHOD_SETTINGS"; + field public static final java.lang.String ACTION_INPUT_METHOD_SUBTYPE_SETTINGS = "android.settings.INPUT_METHOD_SUBTYPE_SETTINGS"; + field public static final java.lang.String ACTION_INTERNAL_STORAGE_SETTINGS = "android.settings.INTERNAL_STORAGE_SETTINGS"; + field public static final java.lang.String ACTION_LOCALE_SETTINGS = "android.settings.LOCALE_SETTINGS"; + field public static final java.lang.String ACTION_LOCATION_SOURCE_SETTINGS = "android.settings.LOCATION_SOURCE_SETTINGS"; + field public static final java.lang.String ACTION_MANAGE_ALL_APPLICATIONS_SETTINGS = "android.settings.MANAGE_ALL_APPLICATIONS_SETTINGS"; + field public static final java.lang.String ACTION_MANAGE_APPLICATIONS_SETTINGS = "android.settings.MANAGE_APPLICATIONS_SETTINGS"; + field public static final java.lang.String ACTION_MEMORY_CARD_SETTINGS = "android.settings.MEMORY_CARD_SETTINGS"; + field public static final java.lang.String ACTION_NETWORK_OPERATOR_SETTINGS = "android.settings.NETWORK_OPERATOR_SETTINGS"; + field public static final java.lang.String ACTION_NFCSHARING_SETTINGS = "android.settings.NFCSHARING_SETTINGS"; + field public static final java.lang.String ACTION_NFC_SETTINGS = "android.settings.NFC_SETTINGS"; + field public static final java.lang.String ACTION_PRIVACY_SETTINGS = "android.settings.PRIVACY_SETTINGS"; + field public static final java.lang.String ACTION_QUICK_LAUNCH_SETTINGS = "android.settings.QUICK_LAUNCH_SETTINGS"; + field public static final java.lang.String ACTION_SEARCH_SETTINGS = "android.search.action.SEARCH_SETTINGS"; + field public static final java.lang.String ACTION_SECURITY_SETTINGS = "android.settings.SECURITY_SETTINGS"; + field public static final java.lang.String ACTION_SETTINGS = "android.settings.SETTINGS"; + field public static final java.lang.String ACTION_SOUND_SETTINGS = "android.settings.SOUND_SETTINGS"; + field public static final java.lang.String ACTION_SYNC_SETTINGS = "android.settings.SYNC_SETTINGS"; + field public static final java.lang.String ACTION_USER_DICTIONARY_SETTINGS = "android.settings.USER_DICTIONARY_SETTINGS"; + field public static final java.lang.String ACTION_WIFI_IP_SETTINGS = "android.settings.WIFI_IP_SETTINGS"; + field public static final java.lang.String ACTION_WIFI_SETTINGS = "android.settings.WIFI_SETTINGS"; + field public static final java.lang.String ACTION_WIRELESS_SETTINGS = "android.settings.WIRELESS_SETTINGS"; + field public static final java.lang.String AUTHORITY = "settings"; + field public static final java.lang.String EXTRA_AUTHORITIES = "authorities"; + field public static final java.lang.String EXTRA_INPUT_METHOD_ID = "input_method_id"; + } + + public static final class Settings.Global extends android.provider.Settings.NameValueTable { + ctor public Settings.Global(); + method public static float getFloat(android.content.ContentResolver, java.lang.String, float); + method public static float getFloat(android.content.ContentResolver, java.lang.String) throws android.provider.Settings.SettingNotFoundException; + method public static int getInt(android.content.ContentResolver, java.lang.String, int); + method public static int getInt(android.content.ContentResolver, java.lang.String) throws android.provider.Settings.SettingNotFoundException; + method public static long getLong(android.content.ContentResolver, java.lang.String, long); + method public static long getLong(android.content.ContentResolver, java.lang.String) throws android.provider.Settings.SettingNotFoundException; + method public static java.lang.String getString(android.content.ContentResolver, java.lang.String); + method public static android.net.Uri getUriFor(java.lang.String); + method public static boolean putFloat(android.content.ContentResolver, java.lang.String, float); + method public static boolean putInt(android.content.ContentResolver, java.lang.String, int); + method public static boolean putLong(android.content.ContentResolver, java.lang.String, long); + method public static boolean putString(android.content.ContentResolver, java.lang.String, java.lang.String); + field public static final java.lang.String ADB_ENABLED = "adb_enabled"; + field public static final java.lang.String AIRPLANE_MODE_ON = "airplane_mode_on"; + field public static final java.lang.String AIRPLANE_MODE_RADIOS = "airplane_mode_radios"; + field public static final java.lang.String ALWAYS_FINISH_ACTIVITIES = "always_finish_activities"; + field public static final java.lang.String ANIMATOR_DURATION_SCALE = "animator_duration_scale"; + field public static final java.lang.String AUTO_TIME = "auto_time"; + field public static final java.lang.String AUTO_TIME_ZONE = "auto_time_zone"; + field public static final java.lang.String BLUETOOTH_ON = "bluetooth_on"; + field public static final android.net.Uri CONTENT_URI; + field public static final java.lang.String DATA_ROAMING = "data_roaming"; + field public static final java.lang.String DEBUG_APP = "debug_app"; + field public static final java.lang.String DEVELOPMENT_SETTINGS_ENABLED = "development_settings_enabled"; + field public static final java.lang.String DEVICE_PROVISIONED = "device_provisioned"; + field public static final java.lang.String HTTP_PROXY = "http_proxy"; + field public static final java.lang.String INSTALL_NON_MARKET_APPS = "install_non_market_apps"; + field public static final java.lang.String MODE_RINGER = "mode_ringer"; + field public static final java.lang.String NETWORK_PREFERENCE = "network_preference"; + field public static final java.lang.String RADIO_BLUETOOTH = "bluetooth"; + field public static final java.lang.String RADIO_CELL = "cell"; + field public static final java.lang.String RADIO_NFC = "nfc"; + field public static final java.lang.String RADIO_WIFI = "wifi"; + field public static final java.lang.String SHOW_PROCESSES = "show_processes"; + field public static final java.lang.String STAY_ON_WHILE_PLUGGED_IN = "stay_on_while_plugged_in"; + field public static final java.lang.String SYS_PROP_SETTING_VERSION = "sys.settings_global_version"; + field public static final java.lang.String TRANSITION_ANIMATION_SCALE = "transition_animation_scale"; + field public static final java.lang.String USB_MASS_STORAGE_ENABLED = "usb_mass_storage_enabled"; + field public static final java.lang.String USE_GOOGLE_MAIL = "use_google_mail"; + field public static final java.lang.String WAIT_FOR_DEBUGGER = "wait_for_debugger"; + field public static final java.lang.String WIFI_MAX_DHCP_RETRY_COUNT = "wifi_max_dhcp_retry_count"; + field public static final java.lang.String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS = "wifi_mobile_data_transition_wakelock_timeout_ms"; + field public static final java.lang.String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON = "wifi_networks_available_notification_on"; + field public static final java.lang.String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY = "wifi_networks_available_repeat_delay"; + field public static final java.lang.String WIFI_NUM_OPEN_NETWORKS_KEPT = "wifi_num_open_networks_kept"; + field public static final java.lang.String WIFI_ON = "wifi_on"; + field public static final java.lang.String WIFI_SLEEP_POLICY = "wifi_sleep_policy"; + field public static final int WIFI_SLEEP_POLICY_DEFAULT = 0; // 0x0 + field public static final int WIFI_SLEEP_POLICY_NEVER = 2; // 0x2 + field public static final int WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED = 1; // 0x1 + field public static final java.lang.String WIFI_WATCHDOG_ON = "wifi_watchdog_on"; + field public static final java.lang.String WINDOW_ANIMATION_SCALE = "window_animation_scale"; + } + + public static class Settings.NameValueTable implements android.provider.BaseColumns { + ctor public Settings.NameValueTable(); + method public static android.net.Uri getUriFor(android.net.Uri, java.lang.String); + method protected static boolean putString(android.content.ContentResolver, android.net.Uri, java.lang.String, java.lang.String); + field public static final java.lang.String NAME = "name"; + field public static final java.lang.String VALUE = "value"; + } + + public static final class Settings.Secure extends android.provider.Settings.NameValueTable { + ctor public Settings.Secure(); + method public static float getFloat(android.content.ContentResolver, java.lang.String, float); + method public static float getFloat(android.content.ContentResolver, java.lang.String) throws android.provider.Settings.SettingNotFoundException; + method public static int getInt(android.content.ContentResolver, java.lang.String, int); + method public static int getInt(android.content.ContentResolver, java.lang.String) throws android.provider.Settings.SettingNotFoundException; + method public static long getLong(android.content.ContentResolver, java.lang.String, long); + method public static long getLong(android.content.ContentResolver, java.lang.String) throws android.provider.Settings.SettingNotFoundException; + method public static java.lang.String getString(android.content.ContentResolver, java.lang.String); + method public static android.net.Uri getUriFor(java.lang.String); + method public static final boolean isLocationProviderEnabled(android.content.ContentResolver, java.lang.String); + method public static boolean putFloat(android.content.ContentResolver, java.lang.String, float); + method public static boolean putInt(android.content.ContentResolver, java.lang.String, int); + method public static boolean putLong(android.content.ContentResolver, java.lang.String, long); + method public static boolean putString(android.content.ContentResolver, java.lang.String, java.lang.String); + method public static final void setLocationProviderEnabled(android.content.ContentResolver, java.lang.String, boolean); + field public static final java.lang.String ACCESSIBILITY_ENABLED = "accessibility_enabled"; + field public static final java.lang.String ACCESSIBILITY_SPEAK_PASSWORD = "speak_password"; + field public static final deprecated java.lang.String ADB_ENABLED = "adb_enabled"; + field public static final java.lang.String ALLOWED_GEOLOCATION_ORIGINS = "allowed_geolocation_origins"; + field public static final java.lang.String ALLOW_MOCK_LOCATION = "mock_location"; + field public static final java.lang.String ANDROID_ID = "android_id"; + field public static final deprecated java.lang.String BACKGROUND_DATA = "background_data"; + field public static final deprecated java.lang.String BLUETOOTH_ON = "bluetooth_on"; + field public static final android.net.Uri CONTENT_URI; + field public static final deprecated java.lang.String DATA_ROAMING = "data_roaming"; + field public static final java.lang.String DEFAULT_INPUT_METHOD = "default_input_method"; + field public static final deprecated java.lang.String DEVELOPMENT_SETTINGS_ENABLED = "development_settings_enabled"; + field public static final deprecated java.lang.String DEVICE_PROVISIONED = "device_provisioned"; + field public static final java.lang.String ENABLED_ACCESSIBILITY_SERVICES = "enabled_accessibility_services"; + field public static final java.lang.String ENABLED_INPUT_METHODS = "enabled_input_methods"; + field public static final deprecated java.lang.String HTTP_PROXY = "http_proxy"; + field public static final java.lang.String INPUT_METHOD_SELECTOR_VISIBILITY = "input_method_selector_visibility"; + field public static final deprecated java.lang.String INSTALL_NON_MARKET_APPS = "install_non_market_apps"; + field public static final java.lang.String LOCATION_PROVIDERS_ALLOWED = "location_providers_allowed"; + field public static final java.lang.String LOCK_PATTERN_ENABLED = "lock_pattern_autolock"; + field public static final deprecated java.lang.String LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED = "lock_pattern_tactile_feedback_enabled"; + field public static final java.lang.String LOCK_PATTERN_VISIBLE = "lock_pattern_visible_pattern"; + field public static final deprecated java.lang.String LOGGING_ID = "logging_id"; + field public static final deprecated java.lang.String NETWORK_PREFERENCE = "network_preference"; + field public static final java.lang.String PARENTAL_CONTROL_ENABLED = "parental_control_enabled"; + field public static final java.lang.String PARENTAL_CONTROL_LAST_UPDATE = "parental_control_last_update"; + field public static final java.lang.String PARENTAL_CONTROL_REDIRECT_URL = "parental_control_redirect_url"; + field public static final java.lang.String SELECTED_INPUT_METHOD_SUBTYPE = "selected_input_method_subtype"; + field public static final java.lang.String SETTINGS_CLASSNAME = "settings_classname"; + field public static final java.lang.String SYS_PROP_SETTING_VERSION = "sys.settings_secure_version"; + field public static final java.lang.String TOUCH_EXPLORATION_ENABLED = "touch_exploration_enabled"; + field public static final deprecated java.lang.String TTS_DEFAULT_COUNTRY = "tts_default_country"; + field public static final deprecated java.lang.String TTS_DEFAULT_LANG = "tts_default_lang"; + field public static final java.lang.String TTS_DEFAULT_PITCH = "tts_default_pitch"; + field public static final java.lang.String TTS_DEFAULT_RATE = "tts_default_rate"; + field public static final java.lang.String TTS_DEFAULT_SYNTH = "tts_default_synth"; + field public static final deprecated java.lang.String TTS_DEFAULT_VARIANT = "tts_default_variant"; + field public static final java.lang.String TTS_ENABLED_PLUGINS = "tts_enabled_plugins"; + field public static final deprecated java.lang.String TTS_USE_DEFAULTS = "tts_use_defaults"; + field public static final deprecated java.lang.String USB_MASS_STORAGE_ENABLED = "usb_mass_storage_enabled"; + field public static final deprecated java.lang.String USE_GOOGLE_MAIL = "use_google_mail"; + field public static final deprecated java.lang.String WIFI_MAX_DHCP_RETRY_COUNT = "wifi_max_dhcp_retry_count"; + field public static final deprecated java.lang.String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS = "wifi_mobile_data_transition_wakelock_timeout_ms"; + field public static final deprecated java.lang.String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON = "wifi_networks_available_notification_on"; + field public static final deprecated java.lang.String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY = "wifi_networks_available_repeat_delay"; + field public static final deprecated java.lang.String WIFI_NUM_OPEN_NETWORKS_KEPT = "wifi_num_open_networks_kept"; + field public static final deprecated java.lang.String WIFI_ON = "wifi_on"; + field public static final deprecated java.lang.String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE = "wifi_watchdog_acceptable_packet_loss_percentage"; + field public static final deprecated java.lang.String WIFI_WATCHDOG_AP_COUNT = "wifi_watchdog_ap_count"; + field public static final deprecated java.lang.String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS = "wifi_watchdog_background_check_delay_ms"; + field public static final deprecated java.lang.String WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED = "wifi_watchdog_background_check_enabled"; + field public static final deprecated java.lang.String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS = "wifi_watchdog_background_check_timeout_ms"; + field public static final deprecated java.lang.String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT = "wifi_watchdog_initial_ignored_ping_count"; + field public static final deprecated java.lang.String WIFI_WATCHDOG_MAX_AP_CHECKS = "wifi_watchdog_max_ap_checks"; + field public static final deprecated java.lang.String WIFI_WATCHDOG_ON = "wifi_watchdog_on"; + field public static final deprecated java.lang.String WIFI_WATCHDOG_PING_COUNT = "wifi_watchdog_ping_count"; + field public static final deprecated java.lang.String WIFI_WATCHDOG_PING_DELAY_MS = "wifi_watchdog_ping_delay_ms"; + field public static final deprecated java.lang.String WIFI_WATCHDOG_PING_TIMEOUT_MS = "wifi_watchdog_ping_timeout_ms"; + field public static final deprecated java.lang.String WIFI_WATCHDOG_WATCH_LIST = "wifi_watchdog_watch_list"; + } + + public static class Settings.SettingNotFoundException extends android.util.AndroidException { + ctor public Settings.SettingNotFoundException(java.lang.String); + } + + public static final class Settings.System extends android.provider.Settings.NameValueTable { + ctor public Settings.System(); + method public static void getConfiguration(android.content.ContentResolver, android.content.res.Configuration); + method public static float getFloat(android.content.ContentResolver, java.lang.String, float); + method public static float getFloat(android.content.ContentResolver, java.lang.String) throws android.provider.Settings.SettingNotFoundException; + method public static int getInt(android.content.ContentResolver, java.lang.String, int); + method public static int getInt(android.content.ContentResolver, java.lang.String) throws android.provider.Settings.SettingNotFoundException; + method public static long getLong(android.content.ContentResolver, java.lang.String, long); + method public static long getLong(android.content.ContentResolver, java.lang.String) throws android.provider.Settings.SettingNotFoundException; + method public static deprecated boolean getShowGTalkServiceStatus(android.content.ContentResolver); + method public static java.lang.String getString(android.content.ContentResolver, java.lang.String); + method public static android.net.Uri getUriFor(java.lang.String); + method public static boolean putConfiguration(android.content.ContentResolver, android.content.res.Configuration); + method public static boolean putFloat(android.content.ContentResolver, java.lang.String, float); + method public static boolean putInt(android.content.ContentResolver, java.lang.String, int); + method public static boolean putLong(android.content.ContentResolver, java.lang.String, long); + method public static boolean putString(android.content.ContentResolver, java.lang.String, java.lang.String); + method public static deprecated void setShowGTalkServiceStatus(android.content.ContentResolver, boolean); + field public static final java.lang.String ACCELEROMETER_ROTATION = "accelerometer_rotation"; + field public static final deprecated java.lang.String ADB_ENABLED = "adb_enabled"; + field public static final deprecated java.lang.String AIRPLANE_MODE_ON = "airplane_mode_on"; + field public static final deprecated java.lang.String AIRPLANE_MODE_RADIOS = "airplane_mode_radios"; + field public static final java.lang.String ALARM_ALERT = "alarm_alert"; + field public static final deprecated java.lang.String ALWAYS_FINISH_ACTIVITIES = "always_finish_activities"; + field public static final deprecated java.lang.String ANDROID_ID = "android_id"; + field public static final deprecated java.lang.String ANIMATOR_DURATION_SCALE = "animator_duration_scale"; + field public static final java.lang.String APPEND_FOR_LAST_AUDIBLE = "_last_audible"; + field public static final deprecated java.lang.String AUTO_TIME = "auto_time"; + field public static final deprecated java.lang.String AUTO_TIME_ZONE = "auto_time_zone"; + field public static final java.lang.String BLUETOOTH_DISCOVERABILITY = "bluetooth_discoverability"; + field public static final java.lang.String BLUETOOTH_DISCOVERABILITY_TIMEOUT = "bluetooth_discoverability_timeout"; + field public static final deprecated java.lang.String BLUETOOTH_ON = "bluetooth_on"; + field public static final android.net.Uri CONTENT_URI; + field public static final deprecated java.lang.String DATA_ROAMING = "data_roaming"; + field public static final java.lang.String DATE_FORMAT = "date_format"; + field public static final deprecated java.lang.String DEBUG_APP = "debug_app"; + field public static final android.net.Uri DEFAULT_ALARM_ALERT_URI; + field public static final android.net.Uri DEFAULT_NOTIFICATION_URI; + field public static final android.net.Uri DEFAULT_RINGTONE_URI; + field public static final deprecated java.lang.String DEVICE_PROVISIONED = "device_provisioned"; + field public static final deprecated java.lang.String DIM_SCREEN = "dim_screen"; + field public static final java.lang.String DTMF_TONE_WHEN_DIALING = "dtmf_tone"; + field public static final java.lang.String END_BUTTON_BEHAVIOR = "end_button_behavior"; + field public static final java.lang.String FONT_SCALE = "font_scale"; + field public static final java.lang.String HAPTIC_FEEDBACK_ENABLED = "haptic_feedback_enabled"; + field public static final deprecated java.lang.String HTTP_PROXY = "http_proxy"; + field public static final deprecated java.lang.String INSTALL_NON_MARKET_APPS = "install_non_market_apps"; + field public static final deprecated java.lang.String LOCATION_PROVIDERS_ALLOWED = "location_providers_allowed"; + field public static final deprecated java.lang.String LOCK_PATTERN_ENABLED = "lock_pattern_autolock"; + field public static final deprecated java.lang.String LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED = "lock_pattern_tactile_feedback_enabled"; + field public static final deprecated java.lang.String LOCK_PATTERN_VISIBLE = "lock_pattern_visible_pattern"; + field public static final deprecated java.lang.String LOGGING_ID = "logging_id"; + field public static final deprecated java.lang.String MODE_RINGER = "mode_ringer"; + field public static final java.lang.String MODE_RINGER_STREAMS_AFFECTED = "mode_ringer_streams_affected"; + field public static final java.lang.String MUTE_STREAMS_AFFECTED = "mute_streams_affected"; + field public static final deprecated java.lang.String NETWORK_PREFERENCE = "network_preference"; + field public static final java.lang.String NEXT_ALARM_FORMATTED = "next_alarm_formatted"; + field public static final java.lang.String NOTIFICATION_SOUND = "notification_sound"; + field public static final deprecated java.lang.String PARENTAL_CONTROL_ENABLED = "parental_control_enabled"; + field public static final deprecated java.lang.String PARENTAL_CONTROL_LAST_UPDATE = "parental_control_last_update"; + field public static final deprecated java.lang.String PARENTAL_CONTROL_REDIRECT_URL = "parental_control_redirect_url"; + field public static final deprecated java.lang.String RADIO_BLUETOOTH = "bluetooth"; + field public static final deprecated java.lang.String RADIO_CELL = "cell"; + field public static final deprecated java.lang.String RADIO_NFC = "nfc"; + field public static final deprecated java.lang.String RADIO_WIFI = "wifi"; + field public static final java.lang.String RINGTONE = "ringtone"; + field public static final java.lang.String SCREEN_BRIGHTNESS = "screen_brightness"; + field public static final java.lang.String SCREEN_BRIGHTNESS_MODE = "screen_brightness_mode"; + field public static final int SCREEN_BRIGHTNESS_MODE_AUTOMATIC = 1; // 0x1 + field public static final int SCREEN_BRIGHTNESS_MODE_MANUAL = 0; // 0x0 + field public static final java.lang.String SCREEN_OFF_TIMEOUT = "screen_off_timeout"; + field public static final deprecated java.lang.String SETTINGS_CLASSNAME = "settings_classname"; + field public static final java.lang.String SETUP_WIZARD_HAS_RUN = "setup_wizard_has_run"; + field public static final java.lang.String SHOW_GTALK_SERVICE_STATUS = "SHOW_GTALK_SERVICE_STATUS"; + field public static final deprecated java.lang.String SHOW_PROCESSES = "show_processes"; + field public static final deprecated java.lang.String SHOW_WEB_SUGGESTIONS = "show_web_suggestions"; + field public static final java.lang.String SOUND_EFFECTS_ENABLED = "sound_effects_enabled"; + field public static final deprecated java.lang.String STAY_ON_WHILE_PLUGGED_IN = "stay_on_while_plugged_in"; + field public static final java.lang.String SYS_PROP_SETTING_VERSION = "sys.settings_system_version"; + field public static final java.lang.String TEXT_AUTO_CAPS = "auto_caps"; + field public static final java.lang.String TEXT_AUTO_PUNCTUATE = "auto_punctuate"; + field public static final java.lang.String TEXT_AUTO_REPLACE = "auto_replace"; + field public static final java.lang.String TEXT_SHOW_PASSWORD = "show_password"; + field public static final java.lang.String TIME_12_24 = "time_12_24"; + field public static final deprecated java.lang.String TRANSITION_ANIMATION_SCALE = "transition_animation_scale"; + field public static final deprecated java.lang.String USB_MASS_STORAGE_ENABLED = "usb_mass_storage_enabled"; + field public static final java.lang.String USER_ROTATION = "user_rotation"; + field public static final deprecated java.lang.String USE_GOOGLE_MAIL = "use_google_mail"; + field public static final java.lang.String VIBRATE_ON = "vibrate_on"; + field public static final java.lang.String VOLUME_ALARM = "volume_alarm"; + field public static final java.lang.String VOLUME_BLUETOOTH_SCO = "volume_bluetooth_sco"; + field public static final java.lang.String VOLUME_MUSIC = "volume_music"; + field public static final java.lang.String VOLUME_NOTIFICATION = "volume_notification"; + field public static final java.lang.String VOLUME_RING = "volume_ring"; + field public static final java.lang.String[] VOLUME_SETTINGS; + field public static final java.lang.String VOLUME_SYSTEM = "volume_system"; + field public static final java.lang.String VOLUME_VOICE = "volume_voice"; + field public static final deprecated java.lang.String WAIT_FOR_DEBUGGER = "wait_for_debugger"; + field public static final deprecated java.lang.String WALLPAPER_ACTIVITY = "wallpaper_activity"; + field public static final deprecated java.lang.String WIFI_MAX_DHCP_RETRY_COUNT = "wifi_max_dhcp_retry_count"; + field public static final deprecated java.lang.String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS = "wifi_mobile_data_transition_wakelock_timeout_ms"; + field public static final deprecated java.lang.String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON = "wifi_networks_available_notification_on"; + field public static final deprecated java.lang.String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY = "wifi_networks_available_repeat_delay"; + field public static final deprecated java.lang.String WIFI_NUM_OPEN_NETWORKS_KEPT = "wifi_num_open_networks_kept"; + field public static final deprecated java.lang.String WIFI_ON = "wifi_on"; + field public static final deprecated java.lang.String WIFI_SLEEP_POLICY = "wifi_sleep_policy"; + field public static final deprecated int WIFI_SLEEP_POLICY_DEFAULT = 0; // 0x0 + field public static final deprecated int WIFI_SLEEP_POLICY_NEVER = 2; // 0x2 + field public static final deprecated int WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED = 1; // 0x1 + field public static final deprecated java.lang.String WIFI_STATIC_DNS1 = "wifi_static_dns1"; + field public static final deprecated java.lang.String WIFI_STATIC_DNS2 = "wifi_static_dns2"; + field public static final deprecated java.lang.String WIFI_STATIC_GATEWAY = "wifi_static_gateway"; + field public static final deprecated java.lang.String WIFI_STATIC_IP = "wifi_static_ip"; + field public static final deprecated java.lang.String WIFI_STATIC_NETMASK = "wifi_static_netmask"; + field public static final deprecated java.lang.String WIFI_USE_STATIC_IP = "wifi_use_static_ip"; + field public static final deprecated java.lang.String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE = "wifi_watchdog_acceptable_packet_loss_percentage"; + field public static final deprecated java.lang.String WIFI_WATCHDOG_AP_COUNT = "wifi_watchdog_ap_count"; + field public static final deprecated java.lang.String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS = "wifi_watchdog_background_check_delay_ms"; + field public static final deprecated java.lang.String WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED = "wifi_watchdog_background_check_enabled"; + field public static final deprecated java.lang.String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS = "wifi_watchdog_background_check_timeout_ms"; + field public static final deprecated java.lang.String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT = "wifi_watchdog_initial_ignored_ping_count"; + field public static final deprecated java.lang.String WIFI_WATCHDOG_MAX_AP_CHECKS = "wifi_watchdog_max_ap_checks"; + field public static final deprecated java.lang.String WIFI_WATCHDOG_ON = "wifi_watchdog_on"; + field public static final deprecated java.lang.String WIFI_WATCHDOG_PING_COUNT = "wifi_watchdog_ping_count"; + field public static final deprecated java.lang.String WIFI_WATCHDOG_PING_DELAY_MS = "wifi_watchdog_ping_delay_ms"; + field public static final deprecated java.lang.String WIFI_WATCHDOG_PING_TIMEOUT_MS = "wifi_watchdog_ping_timeout_ms"; + field public static final deprecated java.lang.String WINDOW_ANIMATION_SCALE = "window_animation_scale"; + } + + public class SyncStateContract { + ctor public SyncStateContract(); + } + + public static abstract interface SyncStateContract.Columns implements android.provider.BaseColumns { + field public static final java.lang.String ACCOUNT_NAME = "account_name"; + field public static final java.lang.String ACCOUNT_TYPE = "account_type"; + field public static final java.lang.String DATA = "data"; + } + + public static class SyncStateContract.Constants implements android.provider.SyncStateContract.Columns { + ctor public SyncStateContract.Constants(); + field public static final java.lang.String CONTENT_DIRECTORY = "syncstate"; + } + + public static final class SyncStateContract.Helpers { + ctor public SyncStateContract.Helpers(); + method public static byte[] get(android.content.ContentProviderClient, android.net.Uri, android.accounts.Account) throws android.os.RemoteException; + method public static android.util.Pair getWithUri(android.content.ContentProviderClient, android.net.Uri, android.accounts.Account) throws android.os.RemoteException; + method public static android.net.Uri insert(android.content.ContentProviderClient, android.net.Uri, android.accounts.Account, byte[]) throws android.os.RemoteException; + method public static android.content.ContentProviderOperation newSetOperation(android.net.Uri, android.accounts.Account, byte[]); + method public static android.content.ContentProviderOperation newUpdateOperation(android.net.Uri, byte[]); + method public static void set(android.content.ContentProviderClient, android.net.Uri, android.accounts.Account, byte[]) throws android.os.RemoteException; + method public static void update(android.content.ContentProviderClient, android.net.Uri, byte[]) throws android.os.RemoteException; + } + + public class UserDictionary { + ctor public UserDictionary(); + field public static final java.lang.String AUTHORITY = "user_dictionary"; + field public static final android.net.Uri CONTENT_URI; + } + + public static class UserDictionary.Words implements android.provider.BaseColumns { + ctor public UserDictionary.Words(); + method public static deprecated void addWord(android.content.Context, java.lang.String, int, int); + method public static void addWord(android.content.Context, java.lang.String, int, java.lang.String, java.util.Locale); + field public static final java.lang.String APP_ID = "appid"; + field public static final java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.google.userword"; + field public static final java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.google.userword"; + field public static final android.net.Uri CONTENT_URI; + field public static final java.lang.String DEFAULT_SORT_ORDER = "frequency DESC"; + field public static final java.lang.String FREQUENCY = "frequency"; + field public static final java.lang.String LOCALE = "locale"; + field public static final deprecated int LOCALE_TYPE_ALL = 0; // 0x0 + field public static final deprecated int LOCALE_TYPE_CURRENT = 1; // 0x1 + field public static final java.lang.String SHORTCUT = "shortcut"; + field public static final java.lang.String WORD = "word"; + field public static final java.lang.String _ID = "_id"; + } + + public class VoicemailContract { + field public static final java.lang.String ACTION_FETCH_VOICEMAIL = "android.intent.action.FETCH_VOICEMAIL"; + field public static final java.lang.String ACTION_NEW_VOICEMAIL = "android.intent.action.NEW_VOICEMAIL"; + field public static final java.lang.String AUTHORITY = "com.android.voicemail"; + field public static final java.lang.String EXTRA_SELF_CHANGE = "com.android.voicemail.extra.SELF_CHANGE"; + field public static final java.lang.String PARAM_KEY_SOURCE_PACKAGE = "source_package"; + } + + public static final class VoicemailContract.Status implements android.provider.BaseColumns { + method public static android.net.Uri buildSourceUri(java.lang.String); + field public static final java.lang.String CONFIGURATION_STATE = "configuration_state"; + field public static final int CONFIGURATION_STATE_CAN_BE_CONFIGURED = 2; // 0x2 + field public static final int CONFIGURATION_STATE_NOT_CONFIGURED = 1; // 0x1 + field public static final int CONFIGURATION_STATE_OK = 0; // 0x0 + field public static final android.net.Uri CONTENT_URI; + field public static final java.lang.String DATA_CHANNEL_STATE = "data_channel_state"; + field public static final int DATA_CHANNEL_STATE_NO_CONNECTION = 1; // 0x1 + field public static final int DATA_CHANNEL_STATE_OK = 0; // 0x0 + field public static final java.lang.String DIR_TYPE = "vnd.android.cursor.dir/voicemail.source.status"; + field public static final java.lang.String ITEM_TYPE = "vnd.android.cursor.item/voicemail.source.status"; + field public static final java.lang.String NOTIFICATION_CHANNEL_STATE = "notification_channel_state"; + field public static final int NOTIFICATION_CHANNEL_STATE_MESSAGE_WAITING = 2; // 0x2 + field public static final int NOTIFICATION_CHANNEL_STATE_NO_CONNECTION = 1; // 0x1 + field public static final int NOTIFICATION_CHANNEL_STATE_OK = 0; // 0x0 + field public static final java.lang.String SETTINGS_URI = "settings_uri"; + field public static final java.lang.String SOURCE_PACKAGE = "source_package"; + field public static final java.lang.String VOICEMAIL_ACCESS_URI = "voicemail_access_uri"; + } + + public static final class VoicemailContract.Voicemails implements android.provider.BaseColumns android.provider.OpenableColumns { + method public static android.net.Uri buildSourceUri(java.lang.String); + field public static final android.net.Uri CONTENT_URI; + field public static final java.lang.String DATE = "date"; + field public static final java.lang.String DIR_TYPE = "vnd.android.cursor.dir/voicemails"; + field public static final java.lang.String DURATION = "duration"; + field public static final java.lang.String HAS_CONTENT = "has_content"; + field public static final java.lang.String IS_READ = "is_read"; + field public static final java.lang.String ITEM_TYPE = "vnd.android.cursor.item/voicemail"; + field public static final java.lang.String MIME_TYPE = "mime_type"; + field public static final java.lang.String NUMBER = "number"; + field public static final java.lang.String SOURCE_DATA = "source_data"; + field public static final java.lang.String SOURCE_PACKAGE = "source_package"; + } + +} + +package android.renderscript { + + public class Allocation extends android.renderscript.BaseObj { + method public void copy1DRangeFrom(int, int, int[]); + method public void copy1DRangeFrom(int, int, short[]); + method public void copy1DRangeFrom(int, int, byte[]); + method public void copy1DRangeFrom(int, int, float[]); + method public void copy1DRangeFrom(int, int, android.renderscript.Allocation, int); + method public void copy1DRangeFromUnchecked(int, int, int[]); + method public void copy1DRangeFromUnchecked(int, int, short[]); + method public void copy1DRangeFromUnchecked(int, int, byte[]); + method public void copy1DRangeFromUnchecked(int, int, float[]); + method public void copy2DRangeFrom(int, int, int, int, byte[]); + method public void copy2DRangeFrom(int, int, int, int, short[]); + method public void copy2DRangeFrom(int, int, int, int, int[]); + method public void copy2DRangeFrom(int, int, int, int, float[]); + method public void copy2DRangeFrom(int, int, int, int, android.renderscript.Allocation, int, int); + method public void copy2DRangeFrom(int, int, android.graphics.Bitmap); + method public void copyFrom(android.renderscript.BaseObj[]); + method public void copyFrom(int[]); + method public void copyFrom(short[]); + method public void copyFrom(byte[]); + method public void copyFrom(float[]); + method public void copyFrom(android.graphics.Bitmap); + method public void copyFromUnchecked(int[]); + method public void copyFromUnchecked(short[]); + method public void copyFromUnchecked(byte[]); + method public void copyFromUnchecked(float[]); + method public void copyTo(android.graphics.Bitmap); + method public void copyTo(byte[]); + method public void copyTo(short[]); + method public void copyTo(int[]); + method public void copyTo(float[]); + method public static android.renderscript.Allocation createCubemapFromBitmap(android.renderscript.RenderScript, android.graphics.Bitmap, android.renderscript.Allocation.MipmapControl, int); + method public static android.renderscript.Allocation createCubemapFromBitmap(android.renderscript.RenderScript, android.graphics.Bitmap); + method public static android.renderscript.Allocation createCubemapFromCubeFaces(android.renderscript.RenderScript, android.graphics.Bitmap, android.graphics.Bitmap, android.graphics.Bitmap, android.graphics.Bitmap, android.graphics.Bitmap, android.graphics.Bitmap, android.renderscript.Allocation.MipmapControl, int); + method public static android.renderscript.Allocation createCubemapFromCubeFaces(android.renderscript.RenderScript, android.graphics.Bitmap, android.graphics.Bitmap, android.graphics.Bitmap, android.graphics.Bitmap, android.graphics.Bitmap, android.graphics.Bitmap); + method public static android.renderscript.Allocation createFromBitmap(android.renderscript.RenderScript, android.graphics.Bitmap, android.renderscript.Allocation.MipmapControl, int); + method public static android.renderscript.Allocation createFromBitmap(android.renderscript.RenderScript, android.graphics.Bitmap); + method public static android.renderscript.Allocation createFromBitmapResource(android.renderscript.RenderScript, android.content.res.Resources, int, android.renderscript.Allocation.MipmapControl, int); + method public static android.renderscript.Allocation createFromBitmapResource(android.renderscript.RenderScript, android.content.res.Resources, int); + method public static android.renderscript.Allocation createFromString(android.renderscript.RenderScript, java.lang.String, int); + method public static android.renderscript.Allocation createSized(android.renderscript.RenderScript, android.renderscript.Element, int, int); + method public static android.renderscript.Allocation createSized(android.renderscript.RenderScript, android.renderscript.Element, int); + method public static android.renderscript.Allocation createTyped(android.renderscript.RenderScript, android.renderscript.Type, android.renderscript.Allocation.MipmapControl, int); + method public static android.renderscript.Allocation createTyped(android.renderscript.RenderScript, android.renderscript.Type, int); + method public static android.renderscript.Allocation createTyped(android.renderscript.RenderScript, android.renderscript.Type); + method public void generateMipmaps(); + method public int getBytesSize(); + method public android.renderscript.Element getElement(); + method public android.view.Surface getSurface(); + method public android.renderscript.Type getType(); + method public int getUsage(); + method public void ioReceive(); + method public void ioSend(); + method public synchronized void resize(int); + method public void setFromFieldPacker(int, android.renderscript.FieldPacker); + method public void setFromFieldPacker(int, int, android.renderscript.FieldPacker); + method public void setSurface(android.view.Surface); + method public void syncAll(int); + field public static final int USAGE_GRAPHICS_CONSTANTS = 8; // 0x8 + field public static final int USAGE_GRAPHICS_RENDER_TARGET = 16; // 0x10 + field public static final int USAGE_GRAPHICS_TEXTURE = 2; // 0x2 + field public static final int USAGE_GRAPHICS_VERTEX = 4; // 0x4 + field public static final int USAGE_IO_INPUT = 32; // 0x20 + field public static final int USAGE_IO_OUTPUT = 64; // 0x40 + field public static final int USAGE_SCRIPT = 1; // 0x1 + } + + public static final class Allocation.MipmapControl extends java.lang.Enum { + method public static android.renderscript.Allocation.MipmapControl valueOf(java.lang.String); + method public static final android.renderscript.Allocation.MipmapControl[] values(); + enum_constant public static final android.renderscript.Allocation.MipmapControl MIPMAP_FULL; + enum_constant public static final android.renderscript.Allocation.MipmapControl MIPMAP_NONE; + enum_constant public static final android.renderscript.Allocation.MipmapControl MIPMAP_ON_SYNC_TO_TEXTURE; + } + + public class AllocationAdapter extends android.renderscript.Allocation { + method public static android.renderscript.AllocationAdapter create1D(android.renderscript.RenderScript, android.renderscript.Allocation); + method public static android.renderscript.AllocationAdapter create2D(android.renderscript.RenderScript, android.renderscript.Allocation); + method public void setFace(android.renderscript.Type.CubemapFace); + method public void setLOD(int); + method public void setY(int); + method public void setZ(int); + } + + public class BaseObj { + method public synchronized void destroy(); + method public java.lang.String getName(); + method public void setName(java.lang.String); + } + + public class Byte2 { + ctor public Byte2(); + ctor public Byte2(byte, byte); + field public byte x; + field public byte y; + } + + public class Byte3 { + ctor public Byte3(); + ctor public Byte3(byte, byte, byte); + field public byte x; + field public byte y; + field public byte z; + } + + public class Byte4 { + ctor public Byte4(); + ctor public Byte4(byte, byte, byte, byte); + field public byte w; + field public byte x; + field public byte y; + field public byte z; + } + + public class Double2 { + ctor public Double2(); + ctor public Double2(double, double); + field public double x; + field public double y; + } + + public class Double3 { + ctor public Double3(); + ctor public Double3(double, double, double); + field public double x; + field public double y; + field public double z; + } + + public class Double4 { + ctor public Double4(); + ctor public Double4(double, double, double, double); + field public double w; + field public double x; + field public double y; + field public double z; + } + + public class Element extends android.renderscript.BaseObj { + method public static android.renderscript.Element ALLOCATION(android.renderscript.RenderScript); + method public static android.renderscript.Element A_8(android.renderscript.RenderScript); + method public static android.renderscript.Element BOOLEAN(android.renderscript.RenderScript); + method public static android.renderscript.Element ELEMENT(android.renderscript.RenderScript); + method public static android.renderscript.Element F32(android.renderscript.RenderScript); + method public static android.renderscript.Element F32_2(android.renderscript.RenderScript); + method public static android.renderscript.Element F32_3(android.renderscript.RenderScript); + method public static android.renderscript.Element F32_4(android.renderscript.RenderScript); + method public static android.renderscript.Element F64(android.renderscript.RenderScript); + method public static android.renderscript.Element F64_2(android.renderscript.RenderScript); + method public static android.renderscript.Element F64_3(android.renderscript.RenderScript); + method public static android.renderscript.Element F64_4(android.renderscript.RenderScript); + method public static android.renderscript.Element FONT(android.renderscript.RenderScript); + method public static android.renderscript.Element I16(android.renderscript.RenderScript); + method public static android.renderscript.Element I16_2(android.renderscript.RenderScript); + method public static android.renderscript.Element I16_3(android.renderscript.RenderScript); + method public static android.renderscript.Element I16_4(android.renderscript.RenderScript); + method public static android.renderscript.Element I32(android.renderscript.RenderScript); + method public static android.renderscript.Element I32_2(android.renderscript.RenderScript); + method public static android.renderscript.Element I32_3(android.renderscript.RenderScript); + method public static android.renderscript.Element I32_4(android.renderscript.RenderScript); + method public static android.renderscript.Element I64(android.renderscript.RenderScript); + method public static android.renderscript.Element I64_2(android.renderscript.RenderScript); + method public static android.renderscript.Element I64_3(android.renderscript.RenderScript); + method public static android.renderscript.Element I64_4(android.renderscript.RenderScript); + method public static android.renderscript.Element I8(android.renderscript.RenderScript); + method public static android.renderscript.Element I8_2(android.renderscript.RenderScript); + method public static android.renderscript.Element I8_3(android.renderscript.RenderScript); + method public static android.renderscript.Element I8_4(android.renderscript.RenderScript); + method public static deprecated android.renderscript.Element MATRIX4X4(android.renderscript.RenderScript); + method public static android.renderscript.Element MATRIX_2X2(android.renderscript.RenderScript); + method public static android.renderscript.Element MATRIX_3X3(android.renderscript.RenderScript); + method public static android.renderscript.Element MATRIX_4X4(android.renderscript.RenderScript); + method public static android.renderscript.Element MESH(android.renderscript.RenderScript); + method public static android.renderscript.Element PROGRAM_FRAGMENT(android.renderscript.RenderScript); + method public static android.renderscript.Element PROGRAM_RASTER(android.renderscript.RenderScript); + method public static android.renderscript.Element PROGRAM_STORE(android.renderscript.RenderScript); + method public static android.renderscript.Element PROGRAM_VERTEX(android.renderscript.RenderScript); + method public static android.renderscript.Element RGBA_4444(android.renderscript.RenderScript); + method public static android.renderscript.Element RGBA_5551(android.renderscript.RenderScript); + method public static android.renderscript.Element RGBA_8888(android.renderscript.RenderScript); + method public static android.renderscript.Element RGB_565(android.renderscript.RenderScript); + method public static android.renderscript.Element RGB_888(android.renderscript.RenderScript); + method public static android.renderscript.Element SAMPLER(android.renderscript.RenderScript); + method public static android.renderscript.Element SCRIPT(android.renderscript.RenderScript); + method public static android.renderscript.Element TYPE(android.renderscript.RenderScript); + method public static android.renderscript.Element U16(android.renderscript.RenderScript); + method public static android.renderscript.Element U16_2(android.renderscript.RenderScript); + method public static android.renderscript.Element U16_3(android.renderscript.RenderScript); + method public static android.renderscript.Element U16_4(android.renderscript.RenderScript); + method public static android.renderscript.Element U32(android.renderscript.RenderScript); + method public static android.renderscript.Element U32_2(android.renderscript.RenderScript); + method public static android.renderscript.Element U32_3(android.renderscript.RenderScript); + method public static android.renderscript.Element U32_4(android.renderscript.RenderScript); + method public static android.renderscript.Element U64(android.renderscript.RenderScript); + method public static android.renderscript.Element U64_2(android.renderscript.RenderScript); + method public static android.renderscript.Element U64_3(android.renderscript.RenderScript); + method public static android.renderscript.Element U64_4(android.renderscript.RenderScript); + method public static android.renderscript.Element U8(android.renderscript.RenderScript); + method public static android.renderscript.Element U8_2(android.renderscript.RenderScript); + method public static android.renderscript.Element U8_3(android.renderscript.RenderScript); + method public static android.renderscript.Element U8_4(android.renderscript.RenderScript); + method public static android.renderscript.Element createPixel(android.renderscript.RenderScript, android.renderscript.Element.DataType, android.renderscript.Element.DataKind); + method public static android.renderscript.Element createVector(android.renderscript.RenderScript, android.renderscript.Element.DataType, int); + method public int getBytesSize(); + method public android.renderscript.Element.DataKind getDataKind(); + method public android.renderscript.Element.DataType getDataType(); + method public android.renderscript.Element getSubElement(int); + method public int getSubElementArraySize(int); + method public int getSubElementCount(); + method public java.lang.String getSubElementName(int); + method public int getSubElementOffsetBytes(int); + method public int getVectorSize(); + method public boolean isCompatible(android.renderscript.Element); + method public boolean isComplex(); + } + + public static class Element.Builder { + ctor public Element.Builder(android.renderscript.RenderScript); + method public android.renderscript.Element.Builder add(android.renderscript.Element, java.lang.String, int); + method public android.renderscript.Element.Builder add(android.renderscript.Element, java.lang.String); + method public android.renderscript.Element create(); + } + + public static final class Element.DataKind extends java.lang.Enum { + method public static android.renderscript.Element.DataKind valueOf(java.lang.String); + method public static final android.renderscript.Element.DataKind[] values(); + enum_constant public static final android.renderscript.Element.DataKind PIXEL_A; + enum_constant public static final android.renderscript.Element.DataKind PIXEL_DEPTH; + enum_constant public static final android.renderscript.Element.DataKind PIXEL_L; + enum_constant public static final android.renderscript.Element.DataKind PIXEL_LA; + enum_constant public static final android.renderscript.Element.DataKind PIXEL_RGB; + enum_constant public static final android.renderscript.Element.DataKind PIXEL_RGBA; + enum_constant public static final android.renderscript.Element.DataKind USER; + } + + public static final class Element.DataType extends java.lang.Enum { + method public static android.renderscript.Element.DataType valueOf(java.lang.String); + method public static final android.renderscript.Element.DataType[] values(); + enum_constant public static final android.renderscript.Element.DataType BOOLEAN; + enum_constant public static final android.renderscript.Element.DataType FLOAT_32; + enum_constant public static final android.renderscript.Element.DataType FLOAT_64; + enum_constant public static final android.renderscript.Element.DataType MATRIX_2X2; + enum_constant public static final android.renderscript.Element.DataType MATRIX_3X3; + enum_constant public static final android.renderscript.Element.DataType MATRIX_4X4; + enum_constant public static final android.renderscript.Element.DataType NONE; + enum_constant public static final android.renderscript.Element.DataType RS_ALLOCATION; + enum_constant public static final android.renderscript.Element.DataType RS_ELEMENT; + enum_constant public static final android.renderscript.Element.DataType RS_FONT; + enum_constant public static final android.renderscript.Element.DataType RS_MESH; + enum_constant public static final android.renderscript.Element.DataType RS_PROGRAM_FRAGMENT; + enum_constant public static final android.renderscript.Element.DataType RS_PROGRAM_RASTER; + enum_constant public static final android.renderscript.Element.DataType RS_PROGRAM_STORE; + enum_constant public static final android.renderscript.Element.DataType RS_PROGRAM_VERTEX; + enum_constant public static final android.renderscript.Element.DataType RS_SAMPLER; + enum_constant public static final android.renderscript.Element.DataType RS_SCRIPT; + enum_constant public static final android.renderscript.Element.DataType RS_TYPE; + enum_constant public static final android.renderscript.Element.DataType SIGNED_16; + enum_constant public static final android.renderscript.Element.DataType SIGNED_32; + enum_constant public static final android.renderscript.Element.DataType SIGNED_64; + enum_constant public static final android.renderscript.Element.DataType SIGNED_8; + enum_constant public static final android.renderscript.Element.DataType UNSIGNED_16; + enum_constant public static final android.renderscript.Element.DataType UNSIGNED_32; + enum_constant public static final android.renderscript.Element.DataType UNSIGNED_4_4_4_4; + enum_constant public static final android.renderscript.Element.DataType UNSIGNED_5_5_5_1; + enum_constant public static final android.renderscript.Element.DataType UNSIGNED_5_6_5; + enum_constant public static final android.renderscript.Element.DataType UNSIGNED_64; + enum_constant public static final android.renderscript.Element.DataType UNSIGNED_8; + } + + public class FieldPacker { + ctor public FieldPacker(int); + method public void addBoolean(boolean); + method public void addF32(float); + method public void addF32(android.renderscript.Float2); + method public void addF32(android.renderscript.Float3); + method public void addF32(android.renderscript.Float4); + method public void addF64(double); + method public void addF64(android.renderscript.Double2); + method public void addF64(android.renderscript.Double3); + method public void addF64(android.renderscript.Double4); + method public void addI16(short); + method public void addI16(android.renderscript.Short2); + method public void addI16(android.renderscript.Short3); + method public void addI16(android.renderscript.Short4); + method public void addI32(int); + method public void addI32(android.renderscript.Int2); + method public void addI32(android.renderscript.Int3); + method public void addI32(android.renderscript.Int4); + method public void addI64(long); + method public void addI64(android.renderscript.Long2); + method public void addI64(android.renderscript.Long3); + method public void addI64(android.renderscript.Long4); + method public void addI8(byte); + method public void addI8(android.renderscript.Byte2); + method public void addI8(android.renderscript.Byte3); + method public void addI8(android.renderscript.Byte4); + method public void addMatrix(android.renderscript.Matrix4f); + method public void addMatrix(android.renderscript.Matrix3f); + method public void addMatrix(android.renderscript.Matrix2f); + method public void addObj(android.renderscript.BaseObj); + method public void addU16(int); + method public void addU16(android.renderscript.Int2); + method public void addU16(android.renderscript.Int3); + method public void addU16(android.renderscript.Int4); + method public void addU32(long); + method public void addU32(android.renderscript.Long2); + method public void addU32(android.renderscript.Long3); + method public void addU32(android.renderscript.Long4); + method public void addU64(long); + method public void addU64(android.renderscript.Long2); + method public void addU64(android.renderscript.Long3); + method public void addU64(android.renderscript.Long4); + method public void addU8(short); + method public void addU8(android.renderscript.Short2); + method public void addU8(android.renderscript.Short3); + method public void addU8(android.renderscript.Short4); + method public void align(int); + method public final byte[] getData(); + method public void reset(); + method public void reset(int); + method public void skip(int); + } + + public deprecated class FileA3D extends android.renderscript.BaseObj { + method public static deprecated android.renderscript.FileA3D createFromAsset(android.renderscript.RenderScript, android.content.res.AssetManager, java.lang.String); + method public static deprecated android.renderscript.FileA3D createFromFile(android.renderscript.RenderScript, java.lang.String); + method public static deprecated android.renderscript.FileA3D createFromFile(android.renderscript.RenderScript, java.io.File); + method public static deprecated android.renderscript.FileA3D createFromResource(android.renderscript.RenderScript, android.content.res.Resources, int); + method public deprecated android.renderscript.FileA3D.IndexEntry getIndexEntry(int); + method public deprecated int getIndexEntryCount(); + } + + public static final deprecated class FileA3D.EntryType extends java.lang.Enum { + method public static android.renderscript.FileA3D.EntryType valueOf(java.lang.String); + method public static final android.renderscript.FileA3D.EntryType[] values(); + enum_constant public static final deprecated android.renderscript.FileA3D.EntryType MESH; + enum_constant public static final deprecated android.renderscript.FileA3D.EntryType UNKNOWN; + } + + public static deprecated class FileA3D.IndexEntry { + method public deprecated android.renderscript.FileA3D.EntryType getEntryType(); + method public deprecated android.renderscript.Mesh getMesh(); + method public deprecated java.lang.String getName(); + method public deprecated android.renderscript.BaseObj getObject(); + } + + public class Float2 { + ctor public Float2(); + ctor public Float2(float, float); + field public float x; + field public float y; + } + + public class Float3 { + ctor public Float3(); + ctor public Float3(float, float, float); + field public float x; + field public float y; + field public float z; + } + + public class Float4 { + ctor public Float4(); + ctor public Float4(float, float, float, float); + field public float w; + field public float x; + field public float y; + field public float z; + } + + public deprecated class Font extends android.renderscript.BaseObj { + method public static deprecated android.renderscript.Font create(android.renderscript.RenderScript, android.content.res.Resources, java.lang.String, android.renderscript.Font.Style, float); + method public static deprecated android.renderscript.Font createFromAsset(android.renderscript.RenderScript, android.content.res.Resources, java.lang.String, float); + method public static deprecated android.renderscript.Font createFromFile(android.renderscript.RenderScript, android.content.res.Resources, java.lang.String, float); + method public static deprecated android.renderscript.Font createFromFile(android.renderscript.RenderScript, android.content.res.Resources, java.io.File, float); + method public static deprecated android.renderscript.Font createFromResource(android.renderscript.RenderScript, android.content.res.Resources, int, float); + } + + public static final deprecated class Font.Style extends java.lang.Enum { + method public static android.renderscript.Font.Style valueOf(java.lang.String); + method public static final android.renderscript.Font.Style[] values(); + enum_constant public static final deprecated android.renderscript.Font.Style BOLD; + enum_constant public static final deprecated android.renderscript.Font.Style BOLD_ITALIC; + enum_constant public static final deprecated android.renderscript.Font.Style ITALIC; + enum_constant public static final deprecated android.renderscript.Font.Style NORMAL; + } + + public class Int2 { + ctor public Int2(); + ctor public Int2(int, int); + field public int x; + field public int y; + } + + public class Int3 { + ctor public Int3(); + ctor public Int3(int, int, int); + field public int x; + field public int y; + field public int z; + } + + public class Int4 { + ctor public Int4(); + ctor public Int4(int, int, int, int); + field public int w; + field public int x; + field public int y; + field public int z; + } + + public class Long2 { + ctor public Long2(); + ctor public Long2(long, long); + field public long x; + field public long y; + } + + public class Long3 { + ctor public Long3(); + ctor public Long3(long, long, long); + field public long x; + field public long y; + field public long z; + } + + public class Long4 { + ctor public Long4(); + ctor public Long4(long, long, long, long); + field public long w; + field public long x; + field public long y; + field public long z; + } + + public class Matrix2f { + ctor public Matrix2f(); + ctor public Matrix2f(float[]); + method public float get(int, int); + method public float[] getArray(); + method public void load(android.renderscript.Matrix2f); + method public void loadIdentity(); + method public void loadMultiply(android.renderscript.Matrix2f, android.renderscript.Matrix2f); + method public void loadRotate(float); + method public void loadScale(float, float); + method public void multiply(android.renderscript.Matrix2f); + method public void rotate(float); + method public void scale(float, float); + method public void set(int, int, float); + method public void transpose(); + } + + public class Matrix3f { + ctor public Matrix3f(); + ctor public Matrix3f(float[]); + method public float get(int, int); + method public float[] getArray(); + method public void load(android.renderscript.Matrix3f); + method public void loadIdentity(); + method public void loadMultiply(android.renderscript.Matrix3f, android.renderscript.Matrix3f); + method public void loadRotate(float, float, float, float); + method public void loadRotate(float); + method public void loadScale(float, float); + method public void loadScale(float, float, float); + method public void loadTranslate(float, float); + method public void multiply(android.renderscript.Matrix3f); + method public void rotate(float, float, float, float); + method public void rotate(float); + method public void scale(float, float); + method public void scale(float, float, float); + method public void set(int, int, float); + method public void translate(float, float); + method public void transpose(); + } + + public class Matrix4f { + ctor public Matrix4f(); + ctor public Matrix4f(float[]); + method public float get(int, int); + method public float[] getArray(); + method public boolean inverse(); + method public boolean inverseTranspose(); + method public void load(android.renderscript.Matrix4f); + method public void loadFrustum(float, float, float, float, float, float); + method public void loadIdentity(); + method public void loadMultiply(android.renderscript.Matrix4f, android.renderscript.Matrix4f); + method public void loadOrtho(float, float, float, float, float, float); + method public void loadOrthoWindow(int, int); + method public void loadPerspective(float, float, float, float); + method public void loadProjectionNormalized(int, int); + method public void loadRotate(float, float, float, float); + method public void loadScale(float, float, float); + method public void loadTranslate(float, float, float); + method public void multiply(android.renderscript.Matrix4f); + method public void rotate(float, float, float, float); + method public void scale(float, float, float); + method public void set(int, int, float); + method public void translate(float, float, float); + method public void transpose(); + } + + public deprecated class Mesh extends android.renderscript.BaseObj { + method public deprecated android.renderscript.Allocation getIndexSetAllocation(int); + method public deprecated android.renderscript.Mesh.Primitive getPrimitive(int); + method public deprecated int getPrimitiveCount(); + method public deprecated android.renderscript.Allocation getVertexAllocation(int); + method public deprecated int getVertexAllocationCount(); + } + + public static deprecated class Mesh.AllocationBuilder { + ctor public deprecated Mesh.AllocationBuilder(android.renderscript.RenderScript); + method public deprecated android.renderscript.Mesh.AllocationBuilder addIndexSetAllocation(android.renderscript.Allocation, android.renderscript.Mesh.Primitive); + method public deprecated android.renderscript.Mesh.AllocationBuilder addIndexSetType(android.renderscript.Mesh.Primitive); + method public deprecated android.renderscript.Mesh.AllocationBuilder addVertexAllocation(android.renderscript.Allocation) throws java.lang.IllegalStateException; + method public deprecated android.renderscript.Mesh create(); + method public deprecated int getCurrentIndexSetIndex(); + method public deprecated int getCurrentVertexTypeIndex(); + } + + public static deprecated class Mesh.Builder { + ctor public deprecated Mesh.Builder(android.renderscript.RenderScript, int); + method public deprecated android.renderscript.Mesh.Builder addIndexSetType(android.renderscript.Type, android.renderscript.Mesh.Primitive); + method public deprecated android.renderscript.Mesh.Builder addIndexSetType(android.renderscript.Mesh.Primitive); + method public deprecated android.renderscript.Mesh.Builder addIndexSetType(android.renderscript.Element, int, android.renderscript.Mesh.Primitive); + method public deprecated android.renderscript.Mesh.Builder addVertexType(android.renderscript.Type) throws java.lang.IllegalStateException; + method public deprecated android.renderscript.Mesh.Builder addVertexType(android.renderscript.Element, int) throws java.lang.IllegalStateException; + method public deprecated android.renderscript.Mesh create(); + method public deprecated int getCurrentIndexSetIndex(); + method public deprecated int getCurrentVertexTypeIndex(); + } + + public static final deprecated class Mesh.Primitive extends java.lang.Enum { + method public static android.renderscript.Mesh.Primitive valueOf(java.lang.String); + method public static final android.renderscript.Mesh.Primitive[] values(); + enum_constant public static final deprecated android.renderscript.Mesh.Primitive LINE; + enum_constant public static final deprecated android.renderscript.Mesh.Primitive LINE_STRIP; + enum_constant public static final deprecated android.renderscript.Mesh.Primitive POINT; + enum_constant public static final deprecated android.renderscript.Mesh.Primitive TRIANGLE; + enum_constant public static final deprecated android.renderscript.Mesh.Primitive TRIANGLE_FAN; + enum_constant public static final deprecated android.renderscript.Mesh.Primitive TRIANGLE_STRIP; + } + + public static deprecated class Mesh.TriangleMeshBuilder { + ctor public deprecated Mesh.TriangleMeshBuilder(android.renderscript.RenderScript, int, int); + method public deprecated android.renderscript.Mesh.TriangleMeshBuilder addTriangle(int, int, int); + method public deprecated android.renderscript.Mesh.TriangleMeshBuilder addVertex(float, float); + method public deprecated android.renderscript.Mesh.TriangleMeshBuilder addVertex(float, float, float); + method public deprecated android.renderscript.Mesh create(boolean); + method public deprecated android.renderscript.Mesh.TriangleMeshBuilder setColor(float, float, float, float); + method public deprecated android.renderscript.Mesh.TriangleMeshBuilder setNormal(float, float, float); + method public deprecated android.renderscript.Mesh.TriangleMeshBuilder setTexture(float, float); + field public static final deprecated int COLOR = 1; // 0x1 + field public static final deprecated int NORMAL = 2; // 0x2 + field public static final deprecated int TEXTURE_0 = 256; // 0x100 + } + + public class Program extends android.renderscript.BaseObj { + method public void bindConstants(android.renderscript.Allocation, int); + method public void bindSampler(android.renderscript.Sampler, int) throws java.lang.IllegalArgumentException; + method public void bindTexture(android.renderscript.Allocation, int) throws java.lang.IllegalArgumentException; + method public android.renderscript.Type getConstant(int); + method public int getConstantCount(); + method public int getTextureCount(); + method public java.lang.String getTextureName(int); + method public android.renderscript.Program.TextureType getTextureType(int); + } + + public static class Program.BaseProgramBuilder { + ctor protected Program.BaseProgramBuilder(android.renderscript.RenderScript); + method public android.renderscript.Program.BaseProgramBuilder addConstant(android.renderscript.Type) throws java.lang.IllegalStateException; + method public android.renderscript.Program.BaseProgramBuilder addTexture(android.renderscript.Program.TextureType) throws java.lang.IllegalArgumentException; + method public android.renderscript.Program.BaseProgramBuilder addTexture(android.renderscript.Program.TextureType, java.lang.String) throws java.lang.IllegalArgumentException; + method public int getCurrentConstantIndex(); + method public int getCurrentTextureIndex(); + method protected void initProgram(android.renderscript.Program); + method public android.renderscript.Program.BaseProgramBuilder setShader(java.lang.String); + method public android.renderscript.Program.BaseProgramBuilder setShader(android.content.res.Resources, int); + } + + public static final class Program.TextureType extends java.lang.Enum { + method public static android.renderscript.Program.TextureType valueOf(java.lang.String); + method public static final android.renderscript.Program.TextureType[] values(); + enum_constant public static final android.renderscript.Program.TextureType TEXTURE_2D; + enum_constant public static final android.renderscript.Program.TextureType TEXTURE_CUBE; + } + + public deprecated class ProgramFragment extends android.renderscript.Program { + } + + public static deprecated class ProgramFragment.Builder extends android.renderscript.Program.BaseProgramBuilder { + ctor public deprecated ProgramFragment.Builder(android.renderscript.RenderScript); + method public deprecated android.renderscript.ProgramFragment create(); + } + + public deprecated class ProgramFragmentFixedFunction extends android.renderscript.ProgramFragment { + } + + public static deprecated class ProgramFragmentFixedFunction.Builder { + ctor public deprecated ProgramFragmentFixedFunction.Builder(android.renderscript.RenderScript); + method public deprecated android.renderscript.ProgramFragmentFixedFunction create(); + method public deprecated android.renderscript.ProgramFragmentFixedFunction.Builder setPointSpriteTexCoordinateReplacement(boolean); + method public deprecated android.renderscript.ProgramFragmentFixedFunction.Builder setTexture(android.renderscript.ProgramFragmentFixedFunction.Builder.EnvMode, android.renderscript.ProgramFragmentFixedFunction.Builder.Format, int) throws java.lang.IllegalArgumentException; + method public deprecated android.renderscript.ProgramFragmentFixedFunction.Builder setVaryingColor(boolean); + field public static final deprecated int MAX_TEXTURE = 2; // 0x2 + } + + public static final deprecated class ProgramFragmentFixedFunction.Builder.EnvMode extends java.lang.Enum { + method public static android.renderscript.ProgramFragmentFixedFunction.Builder.EnvMode valueOf(java.lang.String); + method public static final android.renderscript.ProgramFragmentFixedFunction.Builder.EnvMode[] values(); + enum_constant public static final deprecated android.renderscript.ProgramFragmentFixedFunction.Builder.EnvMode DECAL; + enum_constant public static final deprecated android.renderscript.ProgramFragmentFixedFunction.Builder.EnvMode MODULATE; + enum_constant public static final deprecated android.renderscript.ProgramFragmentFixedFunction.Builder.EnvMode REPLACE; + } + + public static final deprecated class ProgramFragmentFixedFunction.Builder.Format extends java.lang.Enum { + method public static android.renderscript.ProgramFragmentFixedFunction.Builder.Format valueOf(java.lang.String); + method public static final android.renderscript.ProgramFragmentFixedFunction.Builder.Format[] values(); + enum_constant public static final deprecated android.renderscript.ProgramFragmentFixedFunction.Builder.Format ALPHA; + enum_constant public static final deprecated android.renderscript.ProgramFragmentFixedFunction.Builder.Format LUMINANCE_ALPHA; + enum_constant public static final deprecated android.renderscript.ProgramFragmentFixedFunction.Builder.Format RGB; + enum_constant public static final deprecated android.renderscript.ProgramFragmentFixedFunction.Builder.Format RGBA; + } + + public deprecated class ProgramRaster extends android.renderscript.BaseObj { + method public static deprecated android.renderscript.ProgramRaster CULL_BACK(android.renderscript.RenderScript); + method public static deprecated android.renderscript.ProgramRaster CULL_FRONT(android.renderscript.RenderScript); + method public static deprecated android.renderscript.ProgramRaster CULL_NONE(android.renderscript.RenderScript); + method public deprecated android.renderscript.ProgramRaster.CullMode getCullMode(); + method public deprecated boolean isPointSpriteEnabled(); + } + + public static deprecated class ProgramRaster.Builder { + ctor public deprecated ProgramRaster.Builder(android.renderscript.RenderScript); + method public deprecated android.renderscript.ProgramRaster create(); + method public deprecated android.renderscript.ProgramRaster.Builder setCullMode(android.renderscript.ProgramRaster.CullMode); + method public deprecated android.renderscript.ProgramRaster.Builder setPointSpriteEnabled(boolean); + } + + public static final deprecated class ProgramRaster.CullMode extends java.lang.Enum { + method public static android.renderscript.ProgramRaster.CullMode valueOf(java.lang.String); + method public static final android.renderscript.ProgramRaster.CullMode[] values(); + enum_constant public static final deprecated android.renderscript.ProgramRaster.CullMode BACK; + enum_constant public static final deprecated android.renderscript.ProgramRaster.CullMode FRONT; + enum_constant public static final deprecated android.renderscript.ProgramRaster.CullMode NONE; + } + + public class ProgramStore extends android.renderscript.BaseObj { + method public static android.renderscript.ProgramStore BLEND_ALPHA_DEPTH_NONE(android.renderscript.RenderScript); + method public static android.renderscript.ProgramStore BLEND_ALPHA_DEPTH_TEST(android.renderscript.RenderScript); + method public static android.renderscript.ProgramStore BLEND_NONE_DEPTH_NONE(android.renderscript.RenderScript); + method public static android.renderscript.ProgramStore BLEND_NONE_DEPTH_TEST(android.renderscript.RenderScript); + method public android.renderscript.ProgramStore.BlendDstFunc getBlendDstFunc(); + method public android.renderscript.ProgramStore.BlendSrcFunc getBlendSrcFunc(); + method public android.renderscript.ProgramStore.DepthFunc getDepthFunc(); + method public boolean isColorMaskAlphaEnabled(); + method public boolean isColorMaskBlueEnabled(); + method public boolean isColorMaskGreenEnabled(); + method public boolean isColorMaskRedEnabled(); + method public boolean isDepthMaskEnabled(); + method public boolean isDitherEnabled(); + } + + public static final class ProgramStore.BlendDstFunc extends java.lang.Enum { + method public static android.renderscript.ProgramStore.BlendDstFunc valueOf(java.lang.String); + method public static final android.renderscript.ProgramStore.BlendDstFunc[] values(); + enum_constant public static final android.renderscript.ProgramStore.BlendDstFunc DST_ALPHA; + enum_constant public static final android.renderscript.ProgramStore.BlendDstFunc ONE; + enum_constant public static final android.renderscript.ProgramStore.BlendDstFunc ONE_MINUS_DST_ALPHA; + enum_constant public static final android.renderscript.ProgramStore.BlendDstFunc ONE_MINUS_SRC_ALPHA; + enum_constant public static final android.renderscript.ProgramStore.BlendDstFunc ONE_MINUS_SRC_COLOR; + enum_constant public static final android.renderscript.ProgramStore.BlendDstFunc SRC_ALPHA; + enum_constant public static final android.renderscript.ProgramStore.BlendDstFunc SRC_COLOR; + enum_constant public static final android.renderscript.ProgramStore.BlendDstFunc ZERO; + } + + public static final class ProgramStore.BlendSrcFunc extends java.lang.Enum { + method public static android.renderscript.ProgramStore.BlendSrcFunc valueOf(java.lang.String); + method public static final android.renderscript.ProgramStore.BlendSrcFunc[] values(); + enum_constant public static final android.renderscript.ProgramStore.BlendSrcFunc DST_ALPHA; + enum_constant public static final android.renderscript.ProgramStore.BlendSrcFunc DST_COLOR; + enum_constant public static final android.renderscript.ProgramStore.BlendSrcFunc ONE; + enum_constant public static final android.renderscript.ProgramStore.BlendSrcFunc ONE_MINUS_DST_ALPHA; + enum_constant public static final android.renderscript.ProgramStore.BlendSrcFunc ONE_MINUS_DST_COLOR; + enum_constant public static final android.renderscript.ProgramStore.BlendSrcFunc ONE_MINUS_SRC_ALPHA; + enum_constant public static final android.renderscript.ProgramStore.BlendSrcFunc SRC_ALPHA; + enum_constant public static final android.renderscript.ProgramStore.BlendSrcFunc SRC_ALPHA_SATURATE; + enum_constant public static final android.renderscript.ProgramStore.BlendSrcFunc ZERO; + } + + public static class ProgramStore.Builder { + ctor public ProgramStore.Builder(android.renderscript.RenderScript); + method public android.renderscript.ProgramStore create(); + method public android.renderscript.ProgramStore.Builder setBlendFunc(android.renderscript.ProgramStore.BlendSrcFunc, android.renderscript.ProgramStore.BlendDstFunc); + method public android.renderscript.ProgramStore.Builder setColorMaskEnabled(boolean, boolean, boolean, boolean); + method public android.renderscript.ProgramStore.Builder setDepthFunc(android.renderscript.ProgramStore.DepthFunc); + method public android.renderscript.ProgramStore.Builder setDepthMaskEnabled(boolean); + method public android.renderscript.ProgramStore.Builder setDitherEnabled(boolean); + } + + public static final class ProgramStore.DepthFunc extends java.lang.Enum { + method public static android.renderscript.ProgramStore.DepthFunc valueOf(java.lang.String); + method public static final android.renderscript.ProgramStore.DepthFunc[] values(); + enum_constant public static final android.renderscript.ProgramStore.DepthFunc ALWAYS; + enum_constant public static final android.renderscript.ProgramStore.DepthFunc EQUAL; + enum_constant public static final android.renderscript.ProgramStore.DepthFunc GREATER; + enum_constant public static final android.renderscript.ProgramStore.DepthFunc GREATER_OR_EQUAL; + enum_constant public static final android.renderscript.ProgramStore.DepthFunc LESS; + enum_constant public static final android.renderscript.ProgramStore.DepthFunc LESS_OR_EQUAL; + enum_constant public static final android.renderscript.ProgramStore.DepthFunc NOT_EQUAL; + } + + public deprecated class ProgramVertex extends android.renderscript.Program { + method public deprecated android.renderscript.Element getInput(int); + method public deprecated int getInputCount(); + } + + public static deprecated class ProgramVertex.Builder extends android.renderscript.Program.BaseProgramBuilder { + ctor public deprecated ProgramVertex.Builder(android.renderscript.RenderScript); + method public deprecated android.renderscript.ProgramVertex.Builder addInput(android.renderscript.Element) throws java.lang.IllegalStateException; + method public deprecated android.renderscript.ProgramVertex create(); + } + + public deprecated class ProgramVertexFixedFunction extends android.renderscript.ProgramVertex { + method public deprecated void bindConstants(android.renderscript.ProgramVertexFixedFunction.Constants); + } + + public static deprecated class ProgramVertexFixedFunction.Builder { + ctor public deprecated ProgramVertexFixedFunction.Builder(android.renderscript.RenderScript); + method public deprecated android.renderscript.ProgramVertexFixedFunction create(); + method public deprecated android.renderscript.ProgramVertexFixedFunction.Builder setTextureMatrixEnable(boolean); + } + + public static deprecated class ProgramVertexFixedFunction.Constants { + ctor public deprecated ProgramVertexFixedFunction.Constants(android.renderscript.RenderScript); + method public deprecated void destroy(); + method public deprecated void setModelview(android.renderscript.Matrix4f); + method public deprecated void setProjection(android.renderscript.Matrix4f); + method public deprecated void setTexture(android.renderscript.Matrix4f); + } + + public class RSDriverException extends android.renderscript.RSRuntimeException { + ctor public RSDriverException(java.lang.String); + } + + public class RSIllegalArgumentException extends android.renderscript.RSRuntimeException { + ctor public RSIllegalArgumentException(java.lang.String); + } + + public class RSInvalidStateException extends android.renderscript.RSRuntimeException { + ctor public RSInvalidStateException(java.lang.String); + } + + public class RSRuntimeException extends java.lang.RuntimeException { + ctor public RSRuntimeException(java.lang.String); + } + + public deprecated class RSSurfaceView extends android.view.SurfaceView implements android.view.SurfaceHolder.Callback { + ctor public deprecated RSSurfaceView(android.content.Context); + ctor public deprecated RSSurfaceView(android.content.Context, android.util.AttributeSet); + method public deprecated android.renderscript.RenderScriptGL createRenderScriptGL(android.renderscript.RenderScriptGL.SurfaceConfig); + method public deprecated void destroyRenderScriptGL(); + method public deprecated android.renderscript.RenderScriptGL getRenderScriptGL(); + method public deprecated void pause(); + method public deprecated void resume(); + method public deprecated void setRenderScriptGL(android.renderscript.RenderScriptGL); + method public deprecated void surfaceChanged(android.view.SurfaceHolder, int, int, int); + method public deprecated void surfaceCreated(android.view.SurfaceHolder); + method public deprecated void surfaceDestroyed(android.view.SurfaceHolder); + } + + public deprecated class RSTextureView extends android.view.TextureView implements android.view.TextureView.SurfaceTextureListener { + ctor public deprecated RSTextureView(android.content.Context); + ctor public deprecated RSTextureView(android.content.Context, android.util.AttributeSet); + method public deprecated android.renderscript.RenderScriptGL createRenderScriptGL(android.renderscript.RenderScriptGL.SurfaceConfig); + method public deprecated void destroyRenderScriptGL(); + method public deprecated android.renderscript.RenderScriptGL getRenderScriptGL(); + method public deprecated void onSurfaceTextureAvailable(android.graphics.SurfaceTexture, int, int); + method public deprecated boolean onSurfaceTextureDestroyed(android.graphics.SurfaceTexture); + method public deprecated void onSurfaceTextureSizeChanged(android.graphics.SurfaceTexture, int, int); + method public deprecated void onSurfaceTextureUpdated(android.graphics.SurfaceTexture); + method public deprecated void pause(); + method public deprecated void resume(); + method public deprecated void setRenderScriptGL(android.renderscript.RenderScriptGL); + } + + public class RenderScript { + method public void contextDump(); + method public static android.renderscript.RenderScript create(android.content.Context); + method public void destroy(); + method public void finish(); + method public final android.content.Context getApplicationContext(); + method public android.renderscript.RenderScript.RSErrorHandler getErrorHandler(); + method public android.renderscript.RenderScript.RSMessageHandler getMessageHandler(); + method public void setErrorHandler(android.renderscript.RenderScript.RSErrorHandler); + method public void setMessageHandler(android.renderscript.RenderScript.RSMessageHandler); + method public void setPriority(android.renderscript.RenderScript.Priority); + } + + public static final class RenderScript.Priority extends java.lang.Enum { + method public static android.renderscript.RenderScript.Priority valueOf(java.lang.String); + method public static final android.renderscript.RenderScript.Priority[] values(); + enum_constant public static final android.renderscript.RenderScript.Priority LOW; + enum_constant public static final android.renderscript.RenderScript.Priority NORMAL; + } + + public static class RenderScript.RSErrorHandler implements java.lang.Runnable { + ctor public RenderScript.RSErrorHandler(); + method public void run(); + field protected java.lang.String mErrorMessage; + field protected int mErrorNum; + } + + public static class RenderScript.RSMessageHandler implements java.lang.Runnable { + ctor public RenderScript.RSMessageHandler(); + method public void run(); + field protected int[] mData; + field protected int mID; + field protected int mLength; + } + + public deprecated class RenderScriptGL extends android.renderscript.RenderScript { + ctor public deprecated RenderScriptGL(android.content.Context, android.renderscript.RenderScriptGL.SurfaceConfig); + method public deprecated void bindProgramFragment(android.renderscript.ProgramFragment); + method public deprecated void bindProgramRaster(android.renderscript.ProgramRaster); + method public deprecated void bindProgramStore(android.renderscript.ProgramStore); + method public deprecated void bindProgramVertex(android.renderscript.ProgramVertex); + method public deprecated void bindRootScript(android.renderscript.Script); + method public deprecated int getHeight(); + method public deprecated int getWidth(); + method public deprecated void pause(); + method public deprecated void resume(); + method public deprecated void setSurface(android.view.SurfaceHolder, int, int); + method public deprecated void setSurfaceTexture(android.graphics.SurfaceTexture, int, int); + } + + public static deprecated class RenderScriptGL.SurfaceConfig { + ctor public deprecated RenderScriptGL.SurfaceConfig(); + ctor public deprecated RenderScriptGL.SurfaceConfig(android.renderscript.RenderScriptGL.SurfaceConfig); + method public deprecated void setAlpha(int, int); + method public deprecated void setColor(int, int); + method public deprecated void setDepth(int, int); + method public deprecated void setSamples(int, int, float); + } + + public class Sampler extends android.renderscript.BaseObj { + method public static android.renderscript.Sampler CLAMP_LINEAR(android.renderscript.RenderScript); + method public static android.renderscript.Sampler CLAMP_LINEAR_MIP_LINEAR(android.renderscript.RenderScript); + method public static android.renderscript.Sampler CLAMP_NEAREST(android.renderscript.RenderScript); + method public static android.renderscript.Sampler WRAP_LINEAR(android.renderscript.RenderScript); + method public static android.renderscript.Sampler WRAP_LINEAR_MIP_LINEAR(android.renderscript.RenderScript); + method public static android.renderscript.Sampler WRAP_NEAREST(android.renderscript.RenderScript); + method public float getAnisotropy(); + method public android.renderscript.Sampler.Value getMagnification(); + method public android.renderscript.Sampler.Value getMinification(); + method public android.renderscript.Sampler.Value getWrapS(); + method public android.renderscript.Sampler.Value getWrapT(); + } + + public static class Sampler.Builder { + ctor public Sampler.Builder(android.renderscript.RenderScript); + method public android.renderscript.Sampler create(); + method public void setAnisotropy(float); + method public void setMagnification(android.renderscript.Sampler.Value); + method public void setMinification(android.renderscript.Sampler.Value); + method public void setWrapS(android.renderscript.Sampler.Value); + method public void setWrapT(android.renderscript.Sampler.Value); + } + + public static final class Sampler.Value extends java.lang.Enum { + method public static android.renderscript.Sampler.Value valueOf(java.lang.String); + method public static final android.renderscript.Sampler.Value[] values(); + enum_constant public static final android.renderscript.Sampler.Value CLAMP; + enum_constant public static final android.renderscript.Sampler.Value LINEAR; + enum_constant public static final android.renderscript.Sampler.Value LINEAR_MIP_LINEAR; + enum_constant public static final android.renderscript.Sampler.Value LINEAR_MIP_NEAREST; + enum_constant public static final android.renderscript.Sampler.Value NEAREST; + enum_constant public static final android.renderscript.Sampler.Value WRAP; + } + + public class Script extends android.renderscript.BaseObj { + method public void bindAllocation(android.renderscript.Allocation, int); + method protected android.renderscript.Script.FieldID createFieldID(int, android.renderscript.Element); + method protected android.renderscript.Script.KernelID createKernelID(int, int, android.renderscript.Element, android.renderscript.Element); + method protected void forEach(int, android.renderscript.Allocation, android.renderscript.Allocation, android.renderscript.FieldPacker); + method protected void invoke(int); + method protected void invoke(int, android.renderscript.FieldPacker); + method public void setTimeZone(java.lang.String); + method public void setVar(int, float); + method public void setVar(int, double); + method public void setVar(int, int); + method public void setVar(int, long); + method public void setVar(int, boolean); + method public void setVar(int, android.renderscript.BaseObj); + method public void setVar(int, android.renderscript.FieldPacker); + method public void setVar(int, android.renderscript.FieldPacker, android.renderscript.Element, int[]); + } + + public static class Script.Builder { + } + + public static class Script.FieldBase { + ctor protected Script.FieldBase(); + method public android.renderscript.Allocation getAllocation(); + method public android.renderscript.Element getElement(); + method public android.renderscript.Type getType(); + method protected void init(android.renderscript.RenderScript, int); + method protected void init(android.renderscript.RenderScript, int, int); + method public void updateAllocation(); + field protected android.renderscript.Allocation mAllocation; + field protected android.renderscript.Element mElement; + } + + public static final class Script.FieldID extends android.renderscript.BaseObj { + } + + public static final class Script.KernelID extends android.renderscript.BaseObj { + } + + public class ScriptC extends android.renderscript.Script { + ctor protected ScriptC(int, android.renderscript.RenderScript); + ctor protected ScriptC(android.renderscript.RenderScript, android.content.res.Resources, int); + } + + public final class ScriptGroup extends android.renderscript.BaseObj { + method public void execute(); + method public void setInput(android.renderscript.Script.KernelID, android.renderscript.Allocation); + method public void setOutput(android.renderscript.Script.KernelID, android.renderscript.Allocation); + } + + public static final class ScriptGroup.Builder { + ctor public ScriptGroup.Builder(android.renderscript.RenderScript); + method public android.renderscript.ScriptGroup.Builder addConnection(android.renderscript.Type, android.renderscript.Script.KernelID, android.renderscript.Script.FieldID); + method public android.renderscript.ScriptGroup.Builder addConnection(android.renderscript.Type, android.renderscript.Script.KernelID, android.renderscript.Script.KernelID); + method public android.renderscript.ScriptGroup.Builder addKernel(android.renderscript.Script.KernelID); + method public android.renderscript.ScriptGroup create(); + } + + public abstract class ScriptIntrinsic extends android.renderscript.Script { + } + + public class ScriptIntrinsicBlend extends android.renderscript.ScriptIntrinsic { + method public static android.renderscript.ScriptIntrinsicBlend create(android.renderscript.RenderScript, android.renderscript.Element); + method public void forEachAdd(android.renderscript.Allocation, android.renderscript.Allocation); + method public void forEachClear(android.renderscript.Allocation, android.renderscript.Allocation); + method public void forEachDst(android.renderscript.Allocation, android.renderscript.Allocation); + method public void forEachDstAtop(android.renderscript.Allocation, android.renderscript.Allocation); + method public void forEachDstIn(android.renderscript.Allocation, android.renderscript.Allocation); + method public void forEachDstOut(android.renderscript.Allocation, android.renderscript.Allocation); + method public void forEachDstOver(android.renderscript.Allocation, android.renderscript.Allocation); + method public void forEachMultiply(android.renderscript.Allocation, android.renderscript.Allocation); + method public void forEachSrc(android.renderscript.Allocation, android.renderscript.Allocation); + method public void forEachSrcAtop(android.renderscript.Allocation, android.renderscript.Allocation); + method public void forEachSrcIn(android.renderscript.Allocation, android.renderscript.Allocation); + method public void forEachSrcOut(android.renderscript.Allocation, android.renderscript.Allocation); + method public void forEachSrcOver(android.renderscript.Allocation, android.renderscript.Allocation); + method public void forEachSubtract(android.renderscript.Allocation, android.renderscript.Allocation); + method public void forEachXor(android.renderscript.Allocation, android.renderscript.Allocation); + method public android.renderscript.Script.KernelID getKernelIDAdd(); + method public android.renderscript.Script.KernelID getKernelIDClear(); + method public android.renderscript.Script.KernelID getKernelIDDst(); + method public android.renderscript.Script.KernelID getKernelIDDstAtop(); + method public android.renderscript.Script.KernelID getKernelIDDstIn(); + method public android.renderscript.Script.KernelID getKernelIDDstOut(); + method public android.renderscript.Script.KernelID getKernelIDDstOver(); + method public android.renderscript.Script.KernelID getKernelIDMultiply(); + method public android.renderscript.Script.KernelID getKernelIDSrc(); + method public android.renderscript.Script.KernelID getKernelIDSrcAtop(); + method public android.renderscript.Script.KernelID getKernelIDSrcIn(); + method public android.renderscript.Script.KernelID getKernelIDSrcOut(); + method public android.renderscript.Script.KernelID getKernelIDSrcOver(); + method public android.renderscript.Script.KernelID getKernelIDSubtract(); + method public android.renderscript.Script.KernelID getKernelIDXor(); + } + + public final class ScriptIntrinsicBlur extends android.renderscript.ScriptIntrinsic { + method public static android.renderscript.ScriptIntrinsicBlur create(android.renderscript.RenderScript, android.renderscript.Element); + method public void forEach(android.renderscript.Allocation); + method public android.renderscript.Script.FieldID getFieldID_Input(); + method public android.renderscript.Script.KernelID getKernelID(); + method public void setInput(android.renderscript.Allocation); + method public void setRadius(float); + } + + public final class ScriptIntrinsicColorMatrix extends android.renderscript.ScriptIntrinsic { + method public static android.renderscript.ScriptIntrinsicColorMatrix create(android.renderscript.RenderScript, android.renderscript.Element); + method public void forEach(android.renderscript.Allocation, android.renderscript.Allocation); + method public android.renderscript.Script.KernelID getKernelID(); + method public void setColorMatrix(android.renderscript.Matrix4f); + method public void setColorMatrix(android.renderscript.Matrix3f); + method public void setGreyscale(); + method public void setRGBtoYUV(); + method public void setYUVtoRGB(); + } + + public final class ScriptIntrinsicConvolve3x3 extends android.renderscript.ScriptIntrinsic { + method public static android.renderscript.ScriptIntrinsicConvolve3x3 create(android.renderscript.RenderScript, android.renderscript.Element); + method public void forEach(android.renderscript.Allocation); + method public android.renderscript.Script.FieldID getFieldID_Input(); + method public android.renderscript.Script.KernelID getKernelID(); + method public void setCoefficients(float[]); + method public void setInput(android.renderscript.Allocation); + } + + public final class ScriptIntrinsicConvolve5x5 extends android.renderscript.ScriptIntrinsic { + method public static android.renderscript.ScriptIntrinsicConvolve5x5 create(android.renderscript.RenderScript, android.renderscript.Element); + method public void forEach(android.renderscript.Allocation); + method public android.renderscript.Script.FieldID getFieldID_Input(); + method public android.renderscript.Script.KernelID getKernelID(); + method public void setCoefficients(float[]); + method public void setInput(android.renderscript.Allocation); + } + + public final class ScriptIntrinsicLUT extends android.renderscript.ScriptIntrinsic { + method public static android.renderscript.ScriptIntrinsicLUT create(android.renderscript.RenderScript, android.renderscript.Element); + method public void forEach(android.renderscript.Allocation, android.renderscript.Allocation); + method public android.renderscript.Script.KernelID getKernelID(); + method public void setAlpha(int, int); + method public void setBlue(int, int); + method public void setGreen(int, int); + method public void setRed(int, int); + } + + public final class ScriptIntrinsicYuvToRGB extends android.renderscript.ScriptIntrinsic { + method public static android.renderscript.ScriptIntrinsicYuvToRGB create(android.renderscript.RenderScript, android.renderscript.Element); + method public void forEach(android.renderscript.Allocation); + method public android.renderscript.Script.FieldID getFieldID_Input(); + method public android.renderscript.Script.KernelID getKernelID(); + method public void setInput(android.renderscript.Allocation); + } + + public class Short2 { + ctor public Short2(); + ctor public Short2(short, short); + field public short x; + field public short y; + } + + public class Short3 { + ctor public Short3(); + ctor public Short3(short, short, short); + field public short x; + field public short y; + field public short z; + } + + public class Short4 { + ctor public Short4(); + ctor public Short4(short, short, short, short); + field public short w; + field public short x; + field public short y; + field public short z; + } + + public class Type extends android.renderscript.BaseObj { + method public int getCount(); + method public android.renderscript.Element getElement(); + method public int getX(); + method public int getY(); + method public int getZ(); + method public boolean hasFaces(); + method public boolean hasMipmaps(); + } + + public static class Type.Builder { + ctor public Type.Builder(android.renderscript.RenderScript, android.renderscript.Element); + method public android.renderscript.Type create(); + method public android.renderscript.Type.Builder setFaces(boolean); + method public android.renderscript.Type.Builder setMipmaps(boolean); + method public android.renderscript.Type.Builder setX(int); + method public android.renderscript.Type.Builder setY(int); + } + + public static final class Type.CubemapFace extends java.lang.Enum { + method public static android.renderscript.Type.CubemapFace valueOf(java.lang.String); + method public static final android.renderscript.Type.CubemapFace[] values(); + enum_constant public static final android.renderscript.Type.CubemapFace NEGATIVE_X; + enum_constant public static final android.renderscript.Type.CubemapFace NEGATIVE_Y; + enum_constant public static final android.renderscript.Type.CubemapFace NEGATIVE_Z; + enum_constant public static final android.renderscript.Type.CubemapFace POSITIVE_X; + enum_constant public static final android.renderscript.Type.CubemapFace POSITIVE_Y; + enum_constant public static final android.renderscript.Type.CubemapFace POSITIVE_Z; + enum_constant public static final deprecated android.renderscript.Type.CubemapFace POSITVE_X; + enum_constant public static final deprecated android.renderscript.Type.CubemapFace POSITVE_Y; + enum_constant public static final deprecated android.renderscript.Type.CubemapFace POSITVE_Z; + } + +} + +package android.sax { + + public class Element { + method public android.sax.Element getChild(java.lang.String); + method public android.sax.Element getChild(java.lang.String, java.lang.String); + method public android.sax.Element requireChild(java.lang.String); + method public android.sax.Element requireChild(java.lang.String, java.lang.String); + method public void setElementListener(android.sax.ElementListener); + method public void setEndElementListener(android.sax.EndElementListener); + method public void setEndTextElementListener(android.sax.EndTextElementListener); + method public void setStartElementListener(android.sax.StartElementListener); + method public void setTextElementListener(android.sax.TextElementListener); + } + + public abstract interface ElementListener implements android.sax.EndElementListener android.sax.StartElementListener { + } + + public abstract interface EndElementListener { + method public abstract void end(); + } + + public abstract interface EndTextElementListener { + method public abstract void end(java.lang.String); + } + + public class RootElement extends android.sax.Element { + ctor public RootElement(java.lang.String, java.lang.String); + ctor public RootElement(java.lang.String); + method public org.xml.sax.ContentHandler getContentHandler(); + } + + public abstract interface StartElementListener { + method public abstract void start(org.xml.sax.Attributes); + } + + public abstract interface TextElementListener implements android.sax.EndTextElementListener android.sax.StartElementListener { + } + +} + +package android.security { + + public final class KeyChain { + ctor public KeyChain(); + method public static void choosePrivateKeyAlias(android.app.Activity, android.security.KeyChainAliasCallback, java.lang.String[], java.security.Principal[], java.lang.String, int, java.lang.String); + method public static android.content.Intent createInstallIntent(); + method public static java.security.cert.X509Certificate[] getCertificateChain(android.content.Context, java.lang.String) throws java.lang.InterruptedException, android.security.KeyChainException; + method public static java.security.PrivateKey getPrivateKey(android.content.Context, java.lang.String) throws java.lang.InterruptedException, android.security.KeyChainException; + field public static final java.lang.String ACTION_STORAGE_CHANGED = "android.security.STORAGE_CHANGED"; + field public static final java.lang.String EXTRA_CERTIFICATE = "CERT"; + field public static final java.lang.String EXTRA_NAME = "name"; + field public static final java.lang.String EXTRA_PKCS12 = "PKCS12"; + } + + public abstract interface KeyChainAliasCallback { + method public abstract void alias(java.lang.String); + } + + public class KeyChainException extends java.lang.Exception { + ctor public KeyChainException(); + ctor public KeyChainException(java.lang.String); + ctor public KeyChainException(java.lang.String, java.lang.Throwable); + ctor public KeyChainException(java.lang.Throwable); + } + +} + +package android.service.dreams { + + public class DreamService extends android.app.Service implements android.view.Window.Callback { + ctor public DreamService(); + method public void addContentView(android.view.View, android.view.ViewGroup.LayoutParams); + method public boolean dispatchGenericMotionEvent(android.view.MotionEvent); + method public boolean dispatchKeyEvent(android.view.KeyEvent); + method public boolean dispatchKeyShortcutEvent(android.view.KeyEvent); + method public boolean dispatchPopulateAccessibilityEvent(android.view.accessibility.AccessibilityEvent); + method public boolean dispatchTouchEvent(android.view.MotionEvent); + method public boolean dispatchTrackballEvent(android.view.MotionEvent); + method public android.view.View findViewById(int); + method public final void finish(); + method public android.view.Window getWindow(); + method public android.view.WindowManager getWindowManager(); + method public boolean isFullscreen(); + method public boolean isInteractive(); + method public boolean isScreenBright(); + method public void onActionModeFinished(android.view.ActionMode); + method public void onActionModeStarted(android.view.ActionMode); + method public void onAttachedToWindow(); + method public final android.os.IBinder onBind(android.content.Intent); + method public void onContentChanged(); + method public boolean onCreatePanelMenu(int, android.view.Menu); + method public android.view.View onCreatePanelView(int); + method public void onDetachedFromWindow(); + method public void onDreamingStarted(); + method public void onDreamingStopped(); + method public boolean onMenuItemSelected(int, android.view.MenuItem); + method public boolean onMenuOpened(int, android.view.Menu); + method public void onPanelClosed(int, android.view.Menu); + method public boolean onPreparePanel(int, android.view.View, android.view.Menu); + method public boolean onSearchRequested(); + method public void onWindowAttributesChanged(android.view.WindowManager.LayoutParams); + method public void onWindowFocusChanged(boolean); + method public android.view.ActionMode onWindowStartingActionMode(android.view.ActionMode.Callback); + method public void setContentView(int); + method public void setContentView(android.view.View); + method public void setContentView(android.view.View, android.view.ViewGroup.LayoutParams); + method public void setFullscreen(boolean); + method public void setInteractive(boolean); + method public void setScreenBright(boolean); + field public static final java.lang.String DREAM_META_DATA = "android.service.dream"; + field public static final java.lang.String SERVICE_INTERFACE = "android.service.dreams.DreamService"; + } + +} + +package android.service.textservice { + + public abstract class SpellCheckerService extends android.app.Service { + ctor public SpellCheckerService(); + method public abstract android.service.textservice.SpellCheckerService.Session createSession(); + method public final android.os.IBinder onBind(android.content.Intent); + field public static final java.lang.String SERVICE_INTERFACE = "android.service.textservice.SpellCheckerService"; + } + + public static abstract class SpellCheckerService.Session { + ctor public SpellCheckerService.Session(); + method public android.os.Bundle getBundle(); + method public java.lang.String getLocale(); + method public void onCancel(); + method public void onClose(); + method public abstract void onCreate(); + method public android.view.textservice.SentenceSuggestionsInfo[] onGetSentenceSuggestionsMultiple(android.view.textservice.TextInfo[], int); + method public abstract android.view.textservice.SuggestionsInfo onGetSuggestions(android.view.textservice.TextInfo, int); + method public android.view.textservice.SuggestionsInfo[] onGetSuggestionsMultiple(android.view.textservice.TextInfo[], int, boolean); + } + +} + +package android.service.wallpaper { + + public abstract class WallpaperService extends android.app.Service { + ctor public WallpaperService(); + method public final android.os.IBinder onBind(android.content.Intent); + method public abstract android.service.wallpaper.WallpaperService.Engine onCreateEngine(); + field public static final java.lang.String SERVICE_INTERFACE = "android.service.wallpaper.WallpaperService"; + field public static final java.lang.String SERVICE_META_DATA = "android.service.wallpaper"; + } + + public class WallpaperService.Engine { + ctor public WallpaperService.Engine(); + method protected void dump(java.lang.String, java.io.FileDescriptor, java.io.PrintWriter, java.lang.String[]); + method public int getDesiredMinimumHeight(); + method public int getDesiredMinimumWidth(); + method public android.view.SurfaceHolder getSurfaceHolder(); + method public boolean isPreview(); + method public boolean isVisible(); + method public android.os.Bundle onCommand(java.lang.String, int, int, int, android.os.Bundle, boolean); + method public void onCreate(android.view.SurfaceHolder); + method public void onDesiredSizeChanged(int, int); + method public void onDestroy(); + method public void onOffsetsChanged(float, float, float, float, int, int); + method public void onSurfaceChanged(android.view.SurfaceHolder, int, int, int); + method public void onSurfaceCreated(android.view.SurfaceHolder); + method public void onSurfaceDestroyed(android.view.SurfaceHolder); + method public void onSurfaceRedrawNeeded(android.view.SurfaceHolder); + method public void onTouchEvent(android.view.MotionEvent); + method public void onVisibilityChanged(boolean); + method public void setOffsetNotificationsEnabled(boolean); + method public void setTouchEventsEnabled(boolean); + } + +} + +package android.speech { + + public abstract interface RecognitionListener { + method public abstract void onBeginningOfSpeech(); + method public abstract void onBufferReceived(byte[]); + method public abstract void onEndOfSpeech(); + method public abstract void onError(int); + method public abstract void onEvent(int, android.os.Bundle); + method public abstract void onPartialResults(android.os.Bundle); + method public abstract void onReadyForSpeech(android.os.Bundle); + method public abstract void onResults(android.os.Bundle); + method public abstract void onRmsChanged(float); + } + + public abstract class RecognitionService extends android.app.Service { + ctor public RecognitionService(); + method public final android.os.IBinder onBind(android.content.Intent); + method protected abstract void onCancel(android.speech.RecognitionService.Callback); + method protected abstract void onStartListening(android.content.Intent, android.speech.RecognitionService.Callback); + method protected abstract void onStopListening(android.speech.RecognitionService.Callback); + field public static final java.lang.String SERVICE_INTERFACE = "android.speech.RecognitionService"; + field public static final java.lang.String SERVICE_META_DATA = "android.speech"; + } + + public class RecognitionService.Callback { + method public void beginningOfSpeech() throws android.os.RemoteException; + method public void bufferReceived(byte[]) throws android.os.RemoteException; + method public void endOfSpeech() throws android.os.RemoteException; + method public void error(int) throws android.os.RemoteException; + method public void partialResults(android.os.Bundle) throws android.os.RemoteException; + method public void readyForSpeech(android.os.Bundle) throws android.os.RemoteException; + method public void results(android.os.Bundle) throws android.os.RemoteException; + method public void rmsChanged(float) throws android.os.RemoteException; + } + + public class RecognizerIntent { + method public static final android.content.Intent getVoiceDetailsIntent(android.content.Context); + field public static final java.lang.String ACTION_GET_LANGUAGE_DETAILS = "android.speech.action.GET_LANGUAGE_DETAILS"; + field public static final java.lang.String ACTION_RECOGNIZE_SPEECH = "android.speech.action.RECOGNIZE_SPEECH"; + field public static final java.lang.String ACTION_VOICE_SEARCH_HANDS_FREE = "android.speech.action.VOICE_SEARCH_HANDS_FREE"; + field public static final java.lang.String ACTION_WEB_SEARCH = "android.speech.action.WEB_SEARCH"; + field public static final java.lang.String DETAILS_META_DATA = "android.speech.DETAILS"; + field public static final java.lang.String EXTRA_CALLING_PACKAGE = "calling_package"; + field public static final java.lang.String EXTRA_CONFIDENCE_SCORES = "android.speech.extra.CONFIDENCE_SCORES"; + field public static final java.lang.String EXTRA_LANGUAGE = "android.speech.extra.LANGUAGE"; + field public static final java.lang.String EXTRA_LANGUAGE_MODEL = "android.speech.extra.LANGUAGE_MODEL"; + field public static final java.lang.String EXTRA_LANGUAGE_PREFERENCE = "android.speech.extra.LANGUAGE_PREFERENCE"; + field public static final java.lang.String EXTRA_MAX_RESULTS = "android.speech.extra.MAX_RESULTS"; + field public static final java.lang.String EXTRA_ONLY_RETURN_LANGUAGE_PREFERENCE = "android.speech.extra.ONLY_RETURN_LANGUAGE_PREFERENCE"; + field public static final java.lang.String EXTRA_ORIGIN = "android.speech.extra.ORIGIN"; + field public static final java.lang.String EXTRA_PARTIAL_RESULTS = "android.speech.extra.PARTIAL_RESULTS"; + field public static final java.lang.String EXTRA_PROMPT = "android.speech.extra.PROMPT"; + field public static final java.lang.String EXTRA_RESULTS = "android.speech.extra.RESULTS"; + field public static final java.lang.String EXTRA_RESULTS_PENDINGINTENT = "android.speech.extra.RESULTS_PENDINGINTENT"; + field public static final java.lang.String EXTRA_RESULTS_PENDINGINTENT_BUNDLE = "android.speech.extra.RESULTS_PENDINGINTENT_BUNDLE"; + field public static final java.lang.String EXTRA_SECURE = "android.speech.extras.EXTRA_SECURE"; + field public static final java.lang.String EXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS = "android.speech.extras.SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS"; + field public static final java.lang.String EXTRA_SPEECH_INPUT_MINIMUM_LENGTH_MILLIS = "android.speech.extras.SPEECH_INPUT_MINIMUM_LENGTH_MILLIS"; + field public static final java.lang.String EXTRA_SPEECH_INPUT_POSSIBLY_COMPLETE_SILENCE_LENGTH_MILLIS = "android.speech.extras.SPEECH_INPUT_POSSIBLY_COMPLETE_SILENCE_LENGTH_MILLIS"; + field public static final java.lang.String EXTRA_SUPPORTED_LANGUAGES = "android.speech.extra.SUPPORTED_LANGUAGES"; + field public static final java.lang.String EXTRA_WEB_SEARCH_ONLY = "android.speech.extra.WEB_SEARCH_ONLY"; + field public static final java.lang.String LANGUAGE_MODEL_FREE_FORM = "free_form"; + field public static final java.lang.String LANGUAGE_MODEL_WEB_SEARCH = "web_search"; + field public static final int RESULT_AUDIO_ERROR = 5; // 0x5 + field public static final int RESULT_CLIENT_ERROR = 2; // 0x2 + field public static final int RESULT_NETWORK_ERROR = 4; // 0x4 + field public static final int RESULT_NO_MATCH = 1; // 0x1 + field public static final int RESULT_SERVER_ERROR = 3; // 0x3 + } + + public class RecognizerResultsIntent { + field public static final java.lang.String ACTION_VOICE_SEARCH_RESULTS = "android.speech.action.VOICE_SEARCH_RESULTS"; + field public static final java.lang.String EXTRA_VOICE_SEARCH_RESULT_HTML = "android.speech.extras.VOICE_SEARCH_RESULT_HTML"; + field public static final java.lang.String EXTRA_VOICE_SEARCH_RESULT_HTML_BASE_URLS = "android.speech.extras.VOICE_SEARCH_RESULT_HTML_BASE_URLS"; + field public static final java.lang.String EXTRA_VOICE_SEARCH_RESULT_HTTP_HEADERS = "android.speech.extras.EXTRA_VOICE_SEARCH_RESULT_HTTP_HEADERS"; + field public static final java.lang.String EXTRA_VOICE_SEARCH_RESULT_STRINGS = "android.speech.extras.VOICE_SEARCH_RESULT_STRINGS"; + field public static final java.lang.String EXTRA_VOICE_SEARCH_RESULT_URLS = "android.speech.extras.VOICE_SEARCH_RESULT_URLS"; + field public static final java.lang.String URI_SCHEME_INLINE = "inline"; + } + + public class SpeechRecognizer { + method public void cancel(); + method public static android.speech.SpeechRecognizer createSpeechRecognizer(android.content.Context); + method public static android.speech.SpeechRecognizer createSpeechRecognizer(android.content.Context, android.content.ComponentName); + method public void destroy(); + method public static boolean isRecognitionAvailable(android.content.Context); + method public void setRecognitionListener(android.speech.RecognitionListener); + method public void startListening(android.content.Intent); + method public void stopListening(); + field public static final java.lang.String CONFIDENCE_SCORES = "confidence_scores"; + field public static final int ERROR_AUDIO = 3; // 0x3 + field public static final int ERROR_CLIENT = 5; // 0x5 + field public static final int ERROR_INSUFFICIENT_PERMISSIONS = 9; // 0x9 + field public static final int ERROR_NETWORK = 2; // 0x2 + field public static final int ERROR_NETWORK_TIMEOUT = 1; // 0x1 + field public static final int ERROR_NO_MATCH = 7; // 0x7 + field public static final int ERROR_RECOGNIZER_BUSY = 8; // 0x8 + field public static final int ERROR_SERVER = 4; // 0x4 + field public static final int ERROR_SPEECH_TIMEOUT = 6; // 0x6 + field public static final java.lang.String RESULTS_RECOGNITION = "results_recognition"; + } + +} + +package android.speech.tts { + + public abstract interface SynthesisCallback { + method public abstract int audioAvailable(byte[], int, int); + method public abstract int done(); + method public abstract void error(); + method public abstract int getMaxBufferSize(); + method public abstract int start(int, int, int); + } + + public final class SynthesisRequest { + ctor public SynthesisRequest(java.lang.String, android.os.Bundle); + method public java.lang.String getCountry(); + method public java.lang.String getLanguage(); + method public android.os.Bundle getParams(); + method public int getPitch(); + method public int getSpeechRate(); + method public java.lang.String getText(); + method public java.lang.String getVariant(); + } + + public class TextToSpeech { + ctor public TextToSpeech(android.content.Context, android.speech.tts.TextToSpeech.OnInitListener); + ctor public TextToSpeech(android.content.Context, android.speech.tts.TextToSpeech.OnInitListener, java.lang.String); + method public int addEarcon(java.lang.String, java.lang.String, int); + method public int addEarcon(java.lang.String, java.lang.String); + method public int addSpeech(java.lang.String, java.lang.String, int); + method public int addSpeech(java.lang.String, java.lang.String); + method public boolean areDefaultsEnforced(); + method public java.lang.String getDefaultEngine(); + method public java.util.List getEngines(); + method public java.util.Set getFeatures(java.util.Locale); + method public java.util.Locale getLanguage(); + method public int isLanguageAvailable(java.util.Locale); + method public boolean isSpeaking(); + method public int playEarcon(java.lang.String, int, java.util.HashMap); + method public int playSilence(long, int, java.util.HashMap); + method public deprecated int setEngineByPackageName(java.lang.String); + method public int setLanguage(java.util.Locale); + method public deprecated int setOnUtteranceCompletedListener(android.speech.tts.TextToSpeech.OnUtteranceCompletedListener); + method public int setOnUtteranceProgressListener(android.speech.tts.UtteranceProgressListener); + method public int setPitch(float); + method public int setSpeechRate(float); + method public void shutdown(); + method public int speak(java.lang.String, int, java.util.HashMap); + method public int stop(); + method public int synthesizeToFile(java.lang.String, java.util.HashMap, java.lang.String); + field public static final java.lang.String ACTION_TTS_QUEUE_PROCESSING_COMPLETED = "android.speech.tts.TTS_QUEUE_PROCESSING_COMPLETED"; + field public static final int ERROR = -1; // 0xffffffff + field public static final int LANG_AVAILABLE = 0; // 0x0 + field public static final int LANG_COUNTRY_AVAILABLE = 1; // 0x1 + field public static final int LANG_COUNTRY_VAR_AVAILABLE = 2; // 0x2 + field public static final int LANG_MISSING_DATA = -1; // 0xffffffff + field public static final int LANG_NOT_SUPPORTED = -2; // 0xfffffffe + field public static final int QUEUE_ADD = 1; // 0x1 + field public static final int QUEUE_FLUSH = 0; // 0x0 + field public static final int SUCCESS = 0; // 0x0 + } + + public class TextToSpeech.Engine { + ctor public TextToSpeech.Engine(); + field public static final java.lang.String ACTION_CHECK_TTS_DATA = "android.speech.tts.engine.CHECK_TTS_DATA"; + field public static final java.lang.String ACTION_INSTALL_TTS_DATA = "android.speech.tts.engine.INSTALL_TTS_DATA"; + field public static final java.lang.String ACTION_TTS_DATA_INSTALLED = "android.speech.tts.engine.TTS_DATA_INSTALLED"; + field public static final int CHECK_VOICE_DATA_BAD_DATA = -1; // 0xffffffff + field public static final int CHECK_VOICE_DATA_FAIL = 0; // 0x0 + field public static final int CHECK_VOICE_DATA_MISSING_DATA = -2; // 0xfffffffe + field public static final int CHECK_VOICE_DATA_MISSING_VOLUME = -3; // 0xfffffffd + field public static final int CHECK_VOICE_DATA_PASS = 1; // 0x1 + field public static final int DEFAULT_STREAM = 3; // 0x3 + field public static final java.lang.String EXTRA_AVAILABLE_VOICES = "availableVoices"; + field public static final java.lang.String EXTRA_CHECK_VOICE_DATA_FOR = "checkVoiceDataFor"; + field public static final java.lang.String EXTRA_TTS_DATA_INSTALLED = "dataInstalled"; + field public static final java.lang.String EXTRA_UNAVAILABLE_VOICES = "unavailableVoices"; + field public static final java.lang.String EXTRA_VOICE_DATA_FILES = "dataFiles"; + field public static final java.lang.String EXTRA_VOICE_DATA_FILES_INFO = "dataFilesInfo"; + field public static final java.lang.String EXTRA_VOICE_DATA_ROOT_DIRECTORY = "dataRoot"; + field public static final java.lang.String INTENT_ACTION_TTS_SERVICE = "android.intent.action.TTS_SERVICE"; + field public static final java.lang.String KEY_FEATURE_EMBEDDED_SYNTHESIS = "embeddedTts"; + field public static final java.lang.String KEY_FEATURE_NETWORK_SYNTHESIS = "networkTts"; + field public static final java.lang.String KEY_PARAM_PAN = "pan"; + field public static final java.lang.String KEY_PARAM_STREAM = "streamType"; + field public static final java.lang.String KEY_PARAM_UTTERANCE_ID = "utteranceId"; + field public static final java.lang.String KEY_PARAM_VOLUME = "volume"; + field public static final java.lang.String SERVICE_META_DATA = "android.speech.tts"; + } + + public static class TextToSpeech.EngineInfo { + ctor public TextToSpeech.EngineInfo(); + field public int icon; + field public java.lang.String label; + field public java.lang.String name; + } + + public static abstract interface TextToSpeech.OnInitListener { + method public abstract void onInit(int); + } + + public static abstract interface TextToSpeech.OnUtteranceCompletedListener { + method public abstract void onUtteranceCompleted(java.lang.String); + } + + public abstract class TextToSpeechService extends android.app.Service { + ctor public TextToSpeechService(); + method public android.os.IBinder onBind(android.content.Intent); + method protected java.util.Set onGetFeaturesForLanguage(java.lang.String, java.lang.String, java.lang.String); + method protected abstract java.lang.String[] onGetLanguage(); + method protected abstract int onIsLanguageAvailable(java.lang.String, java.lang.String, java.lang.String); + method protected abstract int onLoadLanguage(java.lang.String, java.lang.String, java.lang.String); + method protected abstract void onStop(); + method protected abstract void onSynthesizeText(android.speech.tts.SynthesisRequest, android.speech.tts.SynthesisCallback); + } + + public abstract class UtteranceProgressListener { + ctor public UtteranceProgressListener(); + method public abstract void onDone(java.lang.String); + method public abstract void onError(java.lang.String); + method public abstract void onStart(java.lang.String); + } + +} + +package android.telephony { + + public final class CellIdentityCdma implements android.os.Parcelable { + method public int describeContents(); + method public int getBasestationId(); + method public int getLatitude(); + method public int getLongitude(); + method public int getNetworkId(); + method public int getSystemId(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + } + + public final class CellIdentityGsm implements android.os.Parcelable { + method public int describeContents(); + method public int getCid(); + method public int getLac(); + method public int getMcc(); + method public int getMnc(); + method public int getPsc(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + } + + public final class CellIdentityLte implements android.os.Parcelable { + method public int describeContents(); + method public int getCi(); + method public int getMcc(); + method public int getMnc(); + method public int getPci(); + method public int getTac(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + } + + public abstract class CellInfo implements android.os.Parcelable { + method public int describeContents(); + method public long getTimeStamp(); + method public boolean isRegistered(); + method public abstract void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + } + + public final class CellInfoCdma extends android.telephony.CellInfo implements android.os.Parcelable { + method public android.telephony.CellIdentityCdma getCellIdentity(); + method public android.telephony.CellSignalStrengthCdma getCellSignalStrength(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + } + + public final class CellInfoGsm extends android.telephony.CellInfo implements android.os.Parcelable { + method public android.telephony.CellIdentityGsm getCellIdentity(); + method public android.telephony.CellSignalStrengthGsm getCellSignalStrength(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + } + + public final class CellInfoLte extends android.telephony.CellInfo implements android.os.Parcelable { + method public android.telephony.CellIdentityLte getCellIdentity(); + method public android.telephony.CellSignalStrengthLte getCellSignalStrength(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + } + + public abstract class CellLocation { + ctor public CellLocation(); + method public static android.telephony.CellLocation getEmpty(); + method public static void requestLocationUpdate(); + } + + public abstract class CellSignalStrength { + method public abstract boolean equals(java.lang.Object); + method public abstract int getAsuLevel(); + method public abstract int getDbm(); + method public abstract int getLevel(); + method public abstract int hashCode(); + } + + public final class CellSignalStrengthCdma extends android.telephony.CellSignalStrength implements android.os.Parcelable { + method public int describeContents(); + method public boolean equals(java.lang.Object); + method public int getAsuLevel(); + method public int getCdmaDbm(); + method public int getCdmaEcio(); + method public int getCdmaLevel(); + method public int getDbm(); + method public int getEvdoDbm(); + method public int getEvdoEcio(); + method public int getEvdoLevel(); + method public int getEvdoSnr(); + method public int getLevel(); + method public int hashCode(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + } + + public final class CellSignalStrengthGsm extends android.telephony.CellSignalStrength implements android.os.Parcelable { + method public int describeContents(); + method public boolean equals(java.lang.Object); + method public int getAsuLevel(); + method public int getDbm(); + method public int getLevel(); + method public int hashCode(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + } + + public final class CellSignalStrengthLte extends android.telephony.CellSignalStrength implements android.os.Parcelable { + method public int describeContents(); + method public boolean equals(java.lang.Object); + method public int getAsuLevel(); + method public int getDbm(); + method public int getLevel(); + method public int getTimingAdvance(); + method public int hashCode(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + } + + public class NeighboringCellInfo implements android.os.Parcelable { + ctor public deprecated NeighboringCellInfo(); + ctor public deprecated NeighboringCellInfo(int, int); + ctor public NeighboringCellInfo(int, java.lang.String, int); + ctor public NeighboringCellInfo(android.os.Parcel); + method public int describeContents(); + method public int getCid(); + method public int getLac(); + method public int getNetworkType(); + method public int getPsc(); + method public int getRssi(); + method public deprecated void setCid(int); + method public deprecated void setRssi(int); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + field public static final int UNKNOWN_CID = -1; // 0xffffffff + field public static final int UNKNOWN_RSSI = 99; // 0x63 + } + + public class PhoneNumberFormattingTextWatcher implements android.text.TextWatcher { + ctor public PhoneNumberFormattingTextWatcher(); + method public synchronized void afterTextChanged(android.text.Editable); + method public void beforeTextChanged(java.lang.CharSequence, int, int, int); + method public void onTextChanged(java.lang.CharSequence, int, int, int); + } + + public class PhoneNumberUtils { + ctor public PhoneNumberUtils(); + method public static java.lang.String calledPartyBCDFragmentToString(byte[], int, int); + method public static java.lang.String calledPartyBCDToString(byte[], int, int); + method public static boolean compare(java.lang.String, java.lang.String); + method public static boolean compare(android.content.Context, java.lang.String, java.lang.String); + method public static java.lang.String convertKeypadLettersToDigits(java.lang.String); + method public static java.lang.String extractNetworkPortion(java.lang.String); + method public static java.lang.String extractPostDialPortion(java.lang.String); + method public static void formatJapaneseNumber(android.text.Editable); + method public static void formatNanpNumber(android.text.Editable); + method public static java.lang.String formatNumber(java.lang.String); + method public static void formatNumber(android.text.Editable, int); + method public static int getFormatTypeForLocale(java.util.Locale); + method public static java.lang.String getNumberFromIntent(android.content.Intent, android.content.Context); + method public static java.lang.String getStrippedReversed(java.lang.String); + method public static final boolean is12Key(char); + method public static final boolean isDialable(char); + method public static boolean isEmergencyNumber(java.lang.String); + method public static boolean isGlobalPhoneNumber(java.lang.String); + method public static boolean isISODigit(char); + method public static final boolean isNonSeparator(char); + method public static final boolean isReallyDialable(char); + method public static final boolean isStartsPostDial(char); + method public static boolean isWellFormedSmsAddress(java.lang.String); + method public static byte[] networkPortionToCalledPartyBCD(java.lang.String); + method public static byte[] networkPortionToCalledPartyBCDWithLength(java.lang.String); + method public static byte[] numberToCalledPartyBCD(java.lang.String); + method public static java.lang.String stringFromStringAndTOA(java.lang.String, int); + method public static java.lang.String stripSeparators(java.lang.String); + method public static java.lang.String toCallerIDMinMatch(java.lang.String); + method public static int toaFromString(java.lang.String); + field public static final int FORMAT_JAPAN = 2; // 0x2 + field public static final int FORMAT_NANP = 1; // 0x1 + field public static final int FORMAT_UNKNOWN = 0; // 0x0 + field public static final char PAUSE = 44; // 0x002c ',' + field public static final int TOA_International = 145; // 0x91 + field public static final int TOA_Unknown = 129; // 0x81 + field public static final char WAIT = 59; // 0x003b ';' + field public static final char WILD = 78; // 0x004e 'N' + } + + public class PhoneStateListener { + ctor public PhoneStateListener(); + method public void onCallForwardingIndicatorChanged(boolean); + method public void onCallStateChanged(int, java.lang.String); + method public void onCellInfoChanged(java.util.List); + method public void onCellLocationChanged(android.telephony.CellLocation); + method public void onDataActivity(int); + method public void onDataConnectionStateChanged(int); + method public void onDataConnectionStateChanged(int, int); + method public void onMessageWaitingIndicatorChanged(boolean); + method public void onServiceStateChanged(android.telephony.ServiceState); + method public deprecated void onSignalStrengthChanged(int); + method public void onSignalStrengthsChanged(android.telephony.SignalStrength); + field public static final int LISTEN_CALL_FORWARDING_INDICATOR = 8; // 0x8 + field public static final int LISTEN_CALL_STATE = 32; // 0x20 + field public static final int LISTEN_CELL_INFO = 1024; // 0x400 + field public static final int LISTEN_CELL_LOCATION = 16; // 0x10 + field public static final int LISTEN_DATA_ACTIVITY = 128; // 0x80 + field public static final int LISTEN_DATA_CONNECTION_STATE = 64; // 0x40 + field public static final int LISTEN_MESSAGE_WAITING_INDICATOR = 4; // 0x4 + field public static final int LISTEN_NONE = 0; // 0x0 + field public static final int LISTEN_SERVICE_STATE = 1; // 0x1 + field public static final deprecated int LISTEN_SIGNAL_STRENGTH = 2; // 0x2 + field public static final int LISTEN_SIGNAL_STRENGTHS = 256; // 0x100 + } + + public class ServiceState implements android.os.Parcelable { + ctor public ServiceState(); + ctor public ServiceState(android.telephony.ServiceState); + ctor public ServiceState(android.os.Parcel); + method protected void copyFrom(android.telephony.ServiceState); + method public int describeContents(); + method public boolean getIsManualSelection(); + method public java.lang.String getOperatorAlphaLong(); + method public java.lang.String getOperatorAlphaShort(); + method public java.lang.String getOperatorNumeric(); + method public boolean getRoaming(); + method public int getState(); + method public void setIsManualSelection(boolean); + method public void setOperatorName(java.lang.String, java.lang.String, java.lang.String); + method public void setRoaming(boolean); + method public void setState(int); + method public void setStateOff(); + method public void setStateOutOfService(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + field public static final int STATE_EMERGENCY_ONLY = 2; // 0x2 + field public static final int STATE_IN_SERVICE = 0; // 0x0 + field public static final int STATE_OUT_OF_SERVICE = 1; // 0x1 + field public static final int STATE_POWER_OFF = 3; // 0x3 + } + + public class SignalStrength implements android.os.Parcelable { + method public int describeContents(); + method public int getCdmaDbm(); + method public int getCdmaEcio(); + method public int getEvdoDbm(); + method public int getEvdoEcio(); + method public int getEvdoSnr(); + method public int getGsmBitErrorRate(); + method public int getGsmSignalStrength(); + method public boolean isGsm(); + method public void writeToParcel(android.os.Parcel, int); + } + + public final class SmsManager { + method public java.util.ArrayList divideMessage(java.lang.String); + method public static android.telephony.SmsManager getDefault(); + method public void sendDataMessage(java.lang.String, java.lang.String, short, byte[], android.app.PendingIntent, android.app.PendingIntent); + method public void sendMultipartTextMessage(java.lang.String, java.lang.String, java.util.ArrayList, java.util.ArrayList, java.util.ArrayList); + method public void sendTextMessage(java.lang.String, java.lang.String, java.lang.String, android.app.PendingIntent, android.app.PendingIntent); + field public static final int RESULT_ERROR_GENERIC_FAILURE = 1; // 0x1 + field public static final int RESULT_ERROR_NO_SERVICE = 4; // 0x4 + field public static final int RESULT_ERROR_NULL_PDU = 3; // 0x3 + field public static final int RESULT_ERROR_RADIO_OFF = 2; // 0x2 + field public static final int STATUS_ON_ICC_FREE = 0; // 0x0 + field public static final int STATUS_ON_ICC_READ = 1; // 0x1 + field public static final int STATUS_ON_ICC_SENT = 5; // 0x5 + field public static final int STATUS_ON_ICC_UNREAD = 3; // 0x3 + field public static final int STATUS_ON_ICC_UNSENT = 7; // 0x7 + } + + public class SmsMessage { + method public static int[] calculateLength(java.lang.CharSequence, boolean); + method public static int[] calculateLength(java.lang.String, boolean); + method public static android.telephony.SmsMessage createFromPdu(byte[]); + method public java.lang.String getDisplayMessageBody(); + method public java.lang.String getDisplayOriginatingAddress(); + method public java.lang.String getEmailBody(); + method public java.lang.String getEmailFrom(); + method public int getIndexOnIcc(); + method public deprecated int getIndexOnSim(); + method public java.lang.String getMessageBody(); + method public android.telephony.SmsMessage.MessageClass getMessageClass(); + method public java.lang.String getOriginatingAddress(); + method public byte[] getPdu(); + method public int getProtocolIdentifier(); + method public java.lang.String getPseudoSubject(); + method public java.lang.String getServiceCenterAddress(); + method public int getStatus(); + method public int getStatusOnIcc(); + method public deprecated int getStatusOnSim(); + method public static android.telephony.SmsMessage.SubmitPdu getSubmitPdu(java.lang.String, java.lang.String, java.lang.String, boolean); + method public static android.telephony.SmsMessage.SubmitPdu getSubmitPdu(java.lang.String, java.lang.String, short, byte[], boolean); + method public static int getTPLayerLengthForPDU(java.lang.String); + method public long getTimestampMillis(); + method public byte[] getUserData(); + method public boolean isCphsMwiMessage(); + method public boolean isEmail(); + method public boolean isMWIClearMessage(); + method public boolean isMWISetMessage(); + method public boolean isMwiDontStore(); + method public boolean isReplace(); + method public boolean isReplyPathPresent(); + method public boolean isStatusReportMessage(); + field public static final int ENCODING_16BIT = 3; // 0x3 + field public static final int ENCODING_7BIT = 1; // 0x1 + field public static final int ENCODING_8BIT = 2; // 0x2 + field public static final int ENCODING_UNKNOWN = 0; // 0x0 + field public static final int MAX_USER_DATA_BYTES = 140; // 0x8c + field public static final int MAX_USER_DATA_BYTES_WITH_HEADER = 134; // 0x86 + field public static final int MAX_USER_DATA_SEPTETS = 160; // 0xa0 + field public static final int MAX_USER_DATA_SEPTETS_WITH_HEADER = 153; // 0x99 + } + + public static final class SmsMessage.MessageClass extends java.lang.Enum { + method public static android.telephony.SmsMessage.MessageClass valueOf(java.lang.String); + method public static final android.telephony.SmsMessage.MessageClass[] values(); + enum_constant public static final android.telephony.SmsMessage.MessageClass CLASS_0; + enum_constant public static final android.telephony.SmsMessage.MessageClass CLASS_1; + enum_constant public static final android.telephony.SmsMessage.MessageClass CLASS_2; + enum_constant public static final android.telephony.SmsMessage.MessageClass CLASS_3; + enum_constant public static final android.telephony.SmsMessage.MessageClass UNKNOWN; + } + + public static class SmsMessage.SubmitPdu { + field public byte[] encodedMessage; + field public byte[] encodedScAddress; + } + + public class TelephonyManager { + method public java.util.List getAllCellInfo(); + method public int getCallState(); + method public android.telephony.CellLocation getCellLocation(); + method public int getDataActivity(); + method public int getDataState(); + method public java.lang.String getDeviceId(); + method public java.lang.String getDeviceSoftwareVersion(); + method public java.lang.String getLine1Number(); + method public java.util.List getNeighboringCellInfo(); + method public java.lang.String getNetworkCountryIso(); + method public java.lang.String getNetworkOperator(); + method public java.lang.String getNetworkOperatorName(); + method public int getNetworkType(); + method public int getPhoneType(); + method public java.lang.String getSimCountryIso(); + method public java.lang.String getSimOperator(); + method public java.lang.String getSimOperatorName(); + method public java.lang.String getSimSerialNumber(); + method public int getSimState(); + method public java.lang.String getSubscriberId(); + method public java.lang.String getVoiceMailAlphaTag(); + method public java.lang.String getVoiceMailNumber(); + method public boolean hasIccCard(); + method public boolean isNetworkRoaming(); + method public void listen(android.telephony.PhoneStateListener, int); + field public static final java.lang.String ACTION_PHONE_STATE_CHANGED = "android.intent.action.PHONE_STATE"; + field public static final int CALL_STATE_IDLE = 0; // 0x0 + field public static final int CALL_STATE_OFFHOOK = 2; // 0x2 + field public static final int CALL_STATE_RINGING = 1; // 0x1 + field public static final int DATA_ACTIVITY_DORMANT = 4; // 0x4 + field public static final int DATA_ACTIVITY_IN = 1; // 0x1 + field public static final int DATA_ACTIVITY_INOUT = 3; // 0x3 + field public static final int DATA_ACTIVITY_NONE = 0; // 0x0 + field public static final int DATA_ACTIVITY_OUT = 2; // 0x2 + field public static final int DATA_CONNECTED = 2; // 0x2 + field public static final int DATA_CONNECTING = 1; // 0x1 + field public static final int DATA_DISCONNECTED = 0; // 0x0 + field public static final int DATA_SUSPENDED = 3; // 0x3 + field public static final java.lang.String EXTRA_INCOMING_NUMBER = "incoming_number"; + field public static final java.lang.String EXTRA_STATE = "state"; + field public static final java.lang.String EXTRA_STATE_IDLE; + field public static final java.lang.String EXTRA_STATE_OFFHOOK; + field public static final java.lang.String EXTRA_STATE_RINGING; + field public static final int NETWORK_TYPE_1xRTT = 7; // 0x7 + field public static final int NETWORK_TYPE_CDMA = 4; // 0x4 + field public static final int NETWORK_TYPE_EDGE = 2; // 0x2 + field public static final int NETWORK_TYPE_EHRPD = 14; // 0xe + field public static final int NETWORK_TYPE_EVDO_0 = 5; // 0x5 + field public static final int NETWORK_TYPE_EVDO_A = 6; // 0x6 + field public static final int NETWORK_TYPE_EVDO_B = 12; // 0xc + field public static final int NETWORK_TYPE_GPRS = 1; // 0x1 + field public static final int NETWORK_TYPE_HSDPA = 8; // 0x8 + field public static final int NETWORK_TYPE_HSPA = 10; // 0xa + field public static final int NETWORK_TYPE_HSPAP = 15; // 0xf + field public static final int NETWORK_TYPE_HSUPA = 9; // 0x9 + field public static final int NETWORK_TYPE_IDEN = 11; // 0xb + field public static final int NETWORK_TYPE_LTE = 13; // 0xd + field public static final int NETWORK_TYPE_UMTS = 3; // 0x3 + field public static final int NETWORK_TYPE_UNKNOWN = 0; // 0x0 + field public static final int PHONE_TYPE_CDMA = 2; // 0x2 + field public static final int PHONE_TYPE_GSM = 1; // 0x1 + field public static final int PHONE_TYPE_NONE = 0; // 0x0 + field public static final int PHONE_TYPE_SIP = 3; // 0x3 + field public static final int SIM_STATE_ABSENT = 1; // 0x1 + field public static final int SIM_STATE_NETWORK_LOCKED = 4; // 0x4 + field public static final int SIM_STATE_PIN_REQUIRED = 2; // 0x2 + field public static final int SIM_STATE_PUK_REQUIRED = 3; // 0x3 + field public static final int SIM_STATE_READY = 5; // 0x5 + field public static final int SIM_STATE_UNKNOWN = 0; // 0x0 + } + +} + +package android.telephony.cdma { + + public class CdmaCellLocation extends android.telephony.CellLocation { + ctor public CdmaCellLocation(); + ctor public CdmaCellLocation(android.os.Bundle); + method public static double convertQuartSecToDecDegrees(int); + method public void fillInNotifierBundle(android.os.Bundle); + method public int getBaseStationId(); + method public int getBaseStationLatitude(); + method public int getBaseStationLongitude(); + method public int getNetworkId(); + method public int getSystemId(); + method public void setCellLocationData(int, int, int); + method public void setCellLocationData(int, int, int, int, int); + method public void setStateInvalid(); + } + +} + +package android.telephony.gsm { + + public class GsmCellLocation extends android.telephony.CellLocation { + ctor public GsmCellLocation(); + ctor public GsmCellLocation(android.os.Bundle); + method public void fillInNotifierBundle(android.os.Bundle); + method public int getCid(); + method public int getLac(); + method public int getPsc(); + method public void setLacAndCid(int, int); + method public void setStateInvalid(); + } + + public final deprecated class SmsManager { + method public final deprecated java.util.ArrayList divideMessage(java.lang.String); + method public static final deprecated android.telephony.gsm.SmsManager getDefault(); + method public final deprecated void sendDataMessage(java.lang.String, java.lang.String, short, byte[], android.app.PendingIntent, android.app.PendingIntent); + method public final deprecated void sendMultipartTextMessage(java.lang.String, java.lang.String, java.util.ArrayList, java.util.ArrayList, java.util.ArrayList); + method public final deprecated void sendTextMessage(java.lang.String, java.lang.String, java.lang.String, android.app.PendingIntent, android.app.PendingIntent); + field public static final deprecated int RESULT_ERROR_GENERIC_FAILURE = 1; // 0x1 + field public static final deprecated int RESULT_ERROR_NO_SERVICE = 4; // 0x4 + field public static final deprecated int RESULT_ERROR_NULL_PDU = 3; // 0x3 + field public static final deprecated int RESULT_ERROR_RADIO_OFF = 2; // 0x2 + field public static final deprecated int STATUS_ON_SIM_FREE = 0; // 0x0 + field public static final deprecated int STATUS_ON_SIM_READ = 1; // 0x1 + field public static final deprecated int STATUS_ON_SIM_SENT = 5; // 0x5 + field public static final deprecated int STATUS_ON_SIM_UNREAD = 3; // 0x3 + field public static final deprecated int STATUS_ON_SIM_UNSENT = 7; // 0x7 + } + + public deprecated class SmsMessage { + ctor public deprecated SmsMessage(); + method public static deprecated int[] calculateLength(java.lang.CharSequence, boolean); + method public static deprecated int[] calculateLength(java.lang.String, boolean); + method public static deprecated android.telephony.gsm.SmsMessage createFromPdu(byte[]); + method public deprecated java.lang.String getDisplayMessageBody(); + method public deprecated java.lang.String getDisplayOriginatingAddress(); + method public deprecated java.lang.String getEmailBody(); + method public deprecated java.lang.String getEmailFrom(); + method public deprecated int getIndexOnSim(); + method public deprecated java.lang.String getMessageBody(); + method public deprecated android.telephony.gsm.SmsMessage.MessageClass getMessageClass(); + method public deprecated java.lang.String getOriginatingAddress(); + method public deprecated byte[] getPdu(); + method public deprecated int getProtocolIdentifier(); + method public deprecated java.lang.String getPseudoSubject(); + method public deprecated java.lang.String getServiceCenterAddress(); + method public deprecated int getStatus(); + method public deprecated int getStatusOnSim(); + method public static deprecated android.telephony.gsm.SmsMessage.SubmitPdu getSubmitPdu(java.lang.String, java.lang.String, java.lang.String, boolean); + method public static deprecated android.telephony.gsm.SmsMessage.SubmitPdu getSubmitPdu(java.lang.String, java.lang.String, short, byte[], boolean); + method public static deprecated int getTPLayerLengthForPDU(java.lang.String); + method public deprecated long getTimestampMillis(); + method public deprecated byte[] getUserData(); + method public deprecated boolean isCphsMwiMessage(); + method public deprecated boolean isEmail(); + method public deprecated boolean isMWIClearMessage(); + method public deprecated boolean isMWISetMessage(); + method public deprecated boolean isMwiDontStore(); + method public deprecated boolean isReplace(); + method public deprecated boolean isReplyPathPresent(); + method public deprecated boolean isStatusReportMessage(); + field public static final deprecated int ENCODING_16BIT = 3; // 0x3 + field public static final deprecated int ENCODING_7BIT = 1; // 0x1 + field public static final deprecated int ENCODING_8BIT = 2; // 0x2 + field public static final deprecated int ENCODING_UNKNOWN = 0; // 0x0 + field public static final deprecated int MAX_USER_DATA_BYTES = 140; // 0x8c + field public static final deprecated int MAX_USER_DATA_SEPTETS = 160; // 0xa0 + field public static final deprecated int MAX_USER_DATA_SEPTETS_WITH_HEADER = 153; // 0x99 + } + + public static final deprecated class SmsMessage.MessageClass extends java.lang.Enum { + method public static android.telephony.gsm.SmsMessage.MessageClass valueOf(java.lang.String); + method public static final android.telephony.gsm.SmsMessage.MessageClass[] values(); + enum_constant public static final android.telephony.gsm.SmsMessage.MessageClass CLASS_0; + enum_constant public static final android.telephony.gsm.SmsMessage.MessageClass CLASS_1; + enum_constant public static final android.telephony.gsm.SmsMessage.MessageClass CLASS_2; + enum_constant public static final android.telephony.gsm.SmsMessage.MessageClass CLASS_3; + enum_constant public static final android.telephony.gsm.SmsMessage.MessageClass UNKNOWN; + } + + public static deprecated class SmsMessage.SubmitPdu { + ctor public deprecated SmsMessage.SubmitPdu(); + field public deprecated byte[] encodedMessage; + field public deprecated byte[] encodedScAddress; + } + +} + +package android.test { + + public abstract deprecated class ActivityInstrumentationTestCase extends android.test.ActivityTestCase { + ctor public ActivityInstrumentationTestCase(java.lang.String, java.lang.Class); + ctor public ActivityInstrumentationTestCase(java.lang.String, java.lang.Class, boolean); + method public T getActivity(); + method public void testActivityTestCaseSetUpProperly() throws java.lang.Exception; + } + + public abstract class ActivityInstrumentationTestCase2 extends android.test.ActivityTestCase { + ctor public deprecated ActivityInstrumentationTestCase2(java.lang.String, java.lang.Class); + ctor public ActivityInstrumentationTestCase2(java.lang.Class); + method public T getActivity(); + method public void setActivityInitialTouchMode(boolean); + method public void setActivityIntent(android.content.Intent); + } + + public abstract class ActivityTestCase extends android.test.InstrumentationTestCase { + ctor public ActivityTestCase(); + method protected android.app.Activity getActivity(); + method protected void scrubClass(java.lang.Class) throws java.lang.IllegalAccessException; + method protected void setActivity(android.app.Activity); + } + + public abstract class ActivityUnitTestCase extends android.test.ActivityTestCase { + ctor public ActivityUnitTestCase(java.lang.Class); + method public T getActivity(); + method public int getFinishedActivityRequest(); + method public int getRequestedOrientation(); + method public android.content.Intent getStartedActivityIntent(); + method public int getStartedActivityRequest(); + method public boolean isFinishCalled(); + method public void setActivityContext(android.content.Context); + method public void setApplication(android.app.Application); + method protected T startActivity(android.content.Intent, android.os.Bundle, java.lang.Object); + } + + public class AndroidTestCase extends junit.framework.TestCase { + ctor public AndroidTestCase(); + method public void assertActivityRequiresPermission(java.lang.String, java.lang.String, java.lang.String); + method public void assertReadingContentUriRequiresPermission(android.net.Uri, java.lang.String); + method public void assertWritingContentUriRequiresPermission(android.net.Uri, java.lang.String); + method public android.content.Context getContext(); + method protected void scrubClass(java.lang.Class) throws java.lang.IllegalAccessException; + method public void setContext(android.content.Context); + method public void testAndroidTestCaseSetupProperly(); + field protected android.content.Context mContext; + } + + public class AndroidTestRunner extends junit.runner.BaseTestRunner { + ctor public AndroidTestRunner(); + method public void addTestListener(junit.framework.TestListener); + method public void clearTestListeners(); + method protected junit.framework.TestResult createTestResult(); + method public java.util.List getTestCases(); + method public java.lang.String getTestClassName(); + method public junit.framework.TestResult getTestResult(); + method protected void runFailed(java.lang.String); + method public void runTest(); + method public void runTest(junit.framework.TestResult); + method public void setContext(android.content.Context); + method public deprecated void setInstrumentaiton(android.app.Instrumentation); + method public void setInstrumentation(android.app.Instrumentation); + method public void setTest(junit.framework.Test); + method public void setTestClassName(java.lang.String, java.lang.String); + method public void testEnded(java.lang.String); + method public void testFailed(int, junit.framework.Test, java.lang.Throwable); + method public void testStarted(java.lang.String); + } + + public abstract class ApplicationTestCase extends android.test.AndroidTestCase { + ctor public ApplicationTestCase(java.lang.Class); + method protected final void createApplication(); + method public T getApplication(); + method public android.content.Context getSystemContext(); + method protected final void terminateApplication(); + method public final void testApplicationTestCaseSetUpProperly() throws java.lang.Exception; + } + + public deprecated class AssertionFailedError extends java.lang.Error { + ctor public AssertionFailedError(); + ctor public AssertionFailedError(java.lang.String); + } + + public deprecated class ComparisonFailure extends android.test.AssertionFailedError { + ctor public ComparisonFailure(java.lang.String, java.lang.String, java.lang.String); + } + + public abstract class FlakyTest implements java.lang.annotation.Annotation { + } + + public class InstrumentationTestCase extends junit.framework.TestCase { + ctor public InstrumentationTestCase(); + method public android.app.Instrumentation getInstrumentation(); + method public deprecated void injectInsrumentation(android.app.Instrumentation); + method public void injectInstrumentation(android.app.Instrumentation); + method public final T launchActivity(java.lang.String, java.lang.Class, android.os.Bundle); + method public final T launchActivityWithIntent(java.lang.String, java.lang.Class, android.content.Intent); + method public void runTestOnUiThread(java.lang.Runnable) throws java.lang.Throwable; + method public void sendKeys(java.lang.String); + method public void sendKeys(int...); + method public void sendRepeatedKeys(int...); + } + + public class InstrumentationTestRunner extends android.app.Instrumentation implements android.test.TestSuiteProvider { + ctor public InstrumentationTestRunner(); + method public junit.framework.TestSuite getAllTests(); + method protected android.test.AndroidTestRunner getAndroidTestRunner(); + method public java.lang.ClassLoader getLoader(); + method public junit.framework.TestSuite getTestSuite(); + field public static final java.lang.String REPORT_KEY_NAME_CLASS = "class"; + field public static final java.lang.String REPORT_KEY_NAME_TEST = "test"; + field public static final java.lang.String REPORT_KEY_NUM_CURRENT = "current"; + field public static final java.lang.String REPORT_KEY_NUM_TOTAL = "numtests"; + field public static final java.lang.String REPORT_KEY_STACK = "stack"; + field public static final java.lang.String REPORT_VALUE_ID = "InstrumentationTestRunner"; + field public static final int REPORT_VALUE_RESULT_ERROR = -1; // 0xffffffff + field public static final int REPORT_VALUE_RESULT_FAILURE = -2; // 0xfffffffe + field public static final int REPORT_VALUE_RESULT_OK = 0; // 0x0 + field public static final int REPORT_VALUE_RESULT_START = 1; // 0x1 + } + + public class InstrumentationTestSuite extends junit.framework.TestSuite { + ctor public InstrumentationTestSuite(android.app.Instrumentation); + ctor public InstrumentationTestSuite(java.lang.String, android.app.Instrumentation); + ctor public InstrumentationTestSuite(java.lang.Class, android.app.Instrumentation); + method public void addTestSuite(java.lang.Class); + } + + public class IsolatedContext extends android.content.ContextWrapper { + ctor public IsolatedContext(android.content.ContentResolver, android.content.Context); + method public java.util.List getAndClearBroadcastIntents(); + } + + public class LoaderTestCase extends android.test.AndroidTestCase { + ctor public LoaderTestCase(); + method public T getLoaderResultSynchronously(android.content.Loader); + } + + public final class MoreAsserts { + method public static void assertAssignableFrom(java.lang.Class, java.lang.Object); + method public static void assertAssignableFrom(java.lang.Class, java.lang.Class); + method public static java.util.regex.MatchResult assertContainsRegex(java.lang.String, java.lang.String, java.lang.String); + method public static java.util.regex.MatchResult assertContainsRegex(java.lang.String, java.lang.String); + method public static void assertContentsInAnyOrder(java.lang.String, java.lang.Iterable, java.lang.Object...); + method public static void assertContentsInAnyOrder(java.lang.Iterable, java.lang.Object...); + method public static void assertContentsInOrder(java.lang.String, java.lang.Iterable, java.lang.Object...); + method public static void assertContentsInOrder(java.lang.Iterable, java.lang.Object...); + method public static void assertEmpty(java.lang.String, java.lang.Iterable); + method public static void assertEmpty(java.lang.Iterable); + method public static void assertEmpty(java.lang.String, java.util.Map); + method public static void assertEmpty(java.util.Map); + method public static void assertEquals(java.lang.String, byte[], byte[]); + method public static void assertEquals(byte[], byte[]); + method public static void assertEquals(java.lang.String, int[], int[]); + method public static void assertEquals(int[], int[]); + method public static void assertEquals(java.lang.String, double[], double[]); + method public static void assertEquals(double[], double[]); + method public static void assertEquals(java.lang.String, java.lang.Object[], java.lang.Object[]); + method public static void assertEquals(java.lang.Object[], java.lang.Object[]); + method public static void assertEquals(java.lang.String, java.util.Set, java.util.Set); + method public static void assertEquals(java.util.Set, java.util.Set); + method public static java.util.regex.MatchResult assertMatchesRegex(java.lang.String, java.lang.String, java.lang.String); + method public static java.util.regex.MatchResult assertMatchesRegex(java.lang.String, java.lang.String); + method public static void assertNotContainsRegex(java.lang.String, java.lang.String, java.lang.String); + method public static void assertNotContainsRegex(java.lang.String, java.lang.String); + method public static void assertNotEmpty(java.lang.String, java.lang.Iterable); + method public static void assertNotEmpty(java.lang.Iterable); + method public static void assertNotEmpty(java.lang.String, java.util.Map); + method public static void assertNotEmpty(java.util.Map); + method public static void assertNotEqual(java.lang.String, java.lang.Object, java.lang.Object); + method public static void assertNotEqual(java.lang.Object, java.lang.Object); + method public static void assertNotMatchesRegex(java.lang.String, java.lang.String, java.lang.String); + method public static void assertNotMatchesRegex(java.lang.String, java.lang.String); + method public static void checkEqualsAndHashCodeMethods(java.lang.String, java.lang.Object, java.lang.Object, boolean); + method public static void checkEqualsAndHashCodeMethods(java.lang.Object, java.lang.Object, boolean); + } + + public abstract interface PerformanceTestCase { + method public abstract boolean isPerformanceOnly(); + method public abstract int startPerformance(android.test.PerformanceTestCase.Intermediates); + } + + public static abstract interface PerformanceTestCase.Intermediates { + method public abstract void addIntermediate(java.lang.String); + method public abstract void addIntermediate(java.lang.String, long); + method public abstract void finishTiming(boolean); + method public abstract void setInternalIterations(int); + method public abstract void startTiming(boolean); + } + + public abstract deprecated class ProviderTestCase extends android.test.InstrumentationTestCase { + ctor public ProviderTestCase(java.lang.Class, java.lang.String); + method public android.test.mock.MockContentResolver getMockContentResolver(); + method public android.test.IsolatedContext getMockContext(); + method public T getProvider(); + method public static android.content.ContentResolver newResolverWithContentProviderFromSql(android.content.Context, java.lang.Class, java.lang.String, java.lang.String, int, java.lang.String) throws java.lang.IllegalAccessException, java.lang.InstantiationException; + } + + public abstract class ProviderTestCase2 extends android.test.AndroidTestCase { + ctor public ProviderTestCase2(java.lang.Class, java.lang.String); + method public android.test.mock.MockContentResolver getMockContentResolver(); + method public android.test.IsolatedContext getMockContext(); + method public T getProvider(); + method public static android.content.ContentResolver newResolverWithContentProviderFromSql(android.content.Context, java.lang.String, java.lang.Class, java.lang.String, java.lang.String, int, java.lang.String) throws java.lang.IllegalAccessException, java.lang.InstantiationException; + } + + public class RenamingDelegatingContext extends android.content.ContextWrapper { + ctor public RenamingDelegatingContext(android.content.Context, java.lang.String); + ctor public RenamingDelegatingContext(android.content.Context, android.content.Context, java.lang.String); + method public java.lang.String getDatabasePrefix(); + method public void makeExistingFilesAndDbsAccessible(); + method public static T providerWithRenamedContext(java.lang.Class, android.content.Context, java.lang.String) throws java.lang.IllegalAccessException, java.lang.InstantiationException; + method public static T providerWithRenamedContext(java.lang.Class, android.content.Context, java.lang.String, boolean) throws java.lang.IllegalAccessException, java.lang.InstantiationException; + } + + public abstract class ServiceTestCase extends android.test.AndroidTestCase { + ctor public ServiceTestCase(java.lang.Class); + method protected android.os.IBinder bindService(android.content.Intent); + method public android.app.Application getApplication(); + method public T getService(); + method public android.content.Context getSystemContext(); + method public void setApplication(android.app.Application); + method protected void setupService(); + method protected void shutdownService(); + method protected void startService(android.content.Intent); + method public void testServiceTestCaseSetUpProperly() throws java.lang.Exception; + } + + public abstract class SingleLaunchActivityTestCase extends android.test.InstrumentationTestCase { + ctor public SingleLaunchActivityTestCase(java.lang.String, java.lang.Class); + method public T getActivity(); + method public void testActivityTestCaseSetUpProperly() throws java.lang.Exception; + } + + public class SyncBaseInstrumentation extends android.test.InstrumentationTestCase { + ctor public SyncBaseInstrumentation(); + method protected void cancelSyncsandDisableAutoSync(); + method protected void syncProvider(android.net.Uri, java.lang.String, java.lang.String) throws java.lang.Exception; + } + + public abstract interface TestSuiteProvider { + method public abstract junit.framework.TestSuite getTestSuite(); + } + + public class TouchUtils { + ctor public TouchUtils(); + method public static void clickView(android.test.InstrumentationTestCase, android.view.View); + method public static deprecated void drag(android.test.ActivityInstrumentationTestCase, float, float, float, float, int); + method public static void drag(android.test.InstrumentationTestCase, float, float, float, float, int); + method public static deprecated void dragQuarterScreenDown(android.test.ActivityInstrumentationTestCase); + method public static void dragQuarterScreenDown(android.test.InstrumentationTestCase, android.app.Activity); + method public static deprecated void dragQuarterScreenUp(android.test.ActivityInstrumentationTestCase); + method public static void dragQuarterScreenUp(android.test.InstrumentationTestCase, android.app.Activity); + method public static deprecated int dragViewBy(android.test.ActivityInstrumentationTestCase, android.view.View, int, int, int); + method public static deprecated int dragViewBy(android.test.InstrumentationTestCase, android.view.View, int, int, int); + method public static deprecated int dragViewTo(android.test.ActivityInstrumentationTestCase, android.view.View, int, int, int); + method public static int dragViewTo(android.test.InstrumentationTestCase, android.view.View, int, int, int); + method public static deprecated void dragViewToBottom(android.test.ActivityInstrumentationTestCase, android.view.View); + method public static void dragViewToBottom(android.test.InstrumentationTestCase, android.app.Activity, android.view.View); + method public static deprecated void dragViewToBottom(android.test.ActivityInstrumentationTestCase, android.view.View, int); + method public static void dragViewToBottom(android.test.InstrumentationTestCase, android.app.Activity, android.view.View, int); + method public static deprecated void dragViewToTop(android.test.ActivityInstrumentationTestCase, android.view.View); + method public static deprecated void dragViewToTop(android.test.ActivityInstrumentationTestCase, android.view.View, int); + method public static void dragViewToTop(android.test.InstrumentationTestCase, android.view.View); + method public static void dragViewToTop(android.test.InstrumentationTestCase, android.view.View, int); + method public static deprecated int dragViewToX(android.test.ActivityInstrumentationTestCase, android.view.View, int, int); + method public static int dragViewToX(android.test.InstrumentationTestCase, android.view.View, int, int); + method public static deprecated int dragViewToY(android.test.ActivityInstrumentationTestCase, android.view.View, int, int); + method public static int dragViewToY(android.test.InstrumentationTestCase, android.view.View, int, int); + method public static deprecated void longClickView(android.test.ActivityInstrumentationTestCase, android.view.View); + method public static void longClickView(android.test.InstrumentationTestCase, android.view.View); + method public static deprecated void scrollToBottom(android.test.ActivityInstrumentationTestCase, android.view.ViewGroup); + method public static void scrollToBottom(android.test.InstrumentationTestCase, android.app.Activity, android.view.ViewGroup); + method public static deprecated void scrollToTop(android.test.ActivityInstrumentationTestCase, android.view.ViewGroup); + method public static void scrollToTop(android.test.InstrumentationTestCase, android.app.Activity, android.view.ViewGroup); + method public static void tapView(android.test.InstrumentationTestCase, android.view.View); + method public static void touchAndCancelView(android.test.InstrumentationTestCase, android.view.View); + } + + public abstract class UiThreadTest implements java.lang.annotation.Annotation { + } + + public class ViewAsserts { + method public static void assertBaselineAligned(android.view.View, android.view.View); + method public static void assertBottomAligned(android.view.View, android.view.View); + method public static void assertBottomAligned(android.view.View, android.view.View, int); + method public static void assertGroupContains(android.view.ViewGroup, android.view.View); + method public static void assertGroupIntegrity(android.view.ViewGroup); + method public static void assertGroupNotContains(android.view.ViewGroup, android.view.View); + method public static void assertHasScreenCoordinates(android.view.View, android.view.View, int, int); + method public static void assertHorizontalCenterAligned(android.view.View, android.view.View); + method public static void assertLeftAligned(android.view.View, android.view.View); + method public static void assertLeftAligned(android.view.View, android.view.View, int); + method public static void assertOffScreenAbove(android.view.View, android.view.View); + method public static void assertOffScreenBelow(android.view.View, android.view.View); + method public static void assertOnScreen(android.view.View, android.view.View); + method public static void assertRightAligned(android.view.View, android.view.View); + method public static void assertRightAligned(android.view.View, android.view.View, int); + method public static void assertTopAligned(android.view.View, android.view.View); + method public static void assertTopAligned(android.view.View, android.view.View, int); + method public static void assertVerticalCenterAligned(android.view.View, android.view.View); + } + +} + +package android.test.mock { + + public class MockApplication extends android.app.Application { + ctor public MockApplication(); + } + + public class MockContentProvider extends android.content.ContentProvider { + ctor protected MockContentProvider(); + ctor public MockContentProvider(android.content.Context); + ctor public MockContentProvider(android.content.Context, java.lang.String, java.lang.String, android.content.pm.PathPermission[]); + method public int delete(android.net.Uri, java.lang.String, java.lang.String[]); + method public java.lang.String getType(android.net.Uri); + method public android.net.Uri insert(android.net.Uri, android.content.ContentValues); + method public boolean onCreate(); + method public android.database.Cursor query(android.net.Uri, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String); + method public int update(android.net.Uri, android.content.ContentValues, java.lang.String, java.lang.String[]); + } + + public class MockContentResolver extends android.content.ContentResolver { + ctor public MockContentResolver(); + method public void addProvider(java.lang.String, android.content.ContentProvider); + } + + public class MockContext extends android.content.Context { + ctor public MockContext(); + method public boolean bindService(android.content.Intent, android.content.ServiceConnection, int); + method public int checkCallingOrSelfPermission(java.lang.String); + method public int checkCallingOrSelfUriPermission(android.net.Uri, int); + method public int checkCallingPermission(java.lang.String); + method public int checkCallingUriPermission(android.net.Uri, int); + method public int checkPermission(java.lang.String, int, int); + method public int checkUriPermission(android.net.Uri, int, int, int); + method public int checkUriPermission(android.net.Uri, java.lang.String, java.lang.String, int, int, int); + method public void clearWallpaper(); + method public android.content.Context createConfigurationContext(android.content.res.Configuration); + method public android.content.Context createDisplayContext(android.view.Display); + method public android.content.Context createPackageContext(java.lang.String, int) throws android.content.pm.PackageManager.NameNotFoundException; + method public java.lang.String[] databaseList(); + method public boolean deleteDatabase(java.lang.String); + method public boolean deleteFile(java.lang.String); + method public void enforceCallingOrSelfPermission(java.lang.String, java.lang.String); + method public void enforceCallingOrSelfUriPermission(android.net.Uri, int, java.lang.String); + method public void enforceCallingPermission(java.lang.String, java.lang.String); + method public void enforceCallingUriPermission(android.net.Uri, int, java.lang.String); + method public void enforcePermission(java.lang.String, int, int, java.lang.String); + method public void enforceUriPermission(android.net.Uri, int, int, int, java.lang.String); + method public void enforceUriPermission(android.net.Uri, java.lang.String, java.lang.String, int, int, int, java.lang.String); + method public java.lang.String[] fileList(); + method public android.content.Context getApplicationContext(); + method public android.content.pm.ApplicationInfo getApplicationInfo(); + method public android.content.res.AssetManager getAssets(); + method public java.io.File getCacheDir(); + method public java.lang.ClassLoader getClassLoader(); + method public android.content.ContentResolver getContentResolver(); + method public java.io.File getDatabasePath(java.lang.String); + method public java.io.File getDir(java.lang.String, int); + method public java.io.File getExternalCacheDir(); + method public java.io.File getExternalFilesDir(java.lang.String); + method public java.io.File getFileStreamPath(java.lang.String); + method public java.io.File getFilesDir(); + method public android.os.Looper getMainLooper(); + method public java.io.File getObbDir(); + method public java.lang.String getPackageCodePath(); + method public android.content.pm.PackageManager getPackageManager(); + method public java.lang.String getPackageName(); + method public java.lang.String getPackageResourcePath(); + method public android.content.res.Resources getResources(); + method public android.content.SharedPreferences getSharedPreferences(java.lang.String, int); + method public java.lang.Object getSystemService(java.lang.String); + method public android.content.res.Resources.Theme getTheme(); + method public android.graphics.drawable.Drawable getWallpaper(); + method public int getWallpaperDesiredMinimumHeight(); + method public int getWallpaperDesiredMinimumWidth(); + method public void grantUriPermission(java.lang.String, android.net.Uri, int); + method public java.io.FileInputStream openFileInput(java.lang.String) throws java.io.FileNotFoundException; + method public java.io.FileOutputStream openFileOutput(java.lang.String, int) throws java.io.FileNotFoundException; + method public android.database.sqlite.SQLiteDatabase openOrCreateDatabase(java.lang.String, int, android.database.sqlite.SQLiteDatabase.CursorFactory); + method public android.database.sqlite.SQLiteDatabase openOrCreateDatabase(java.lang.String, int, android.database.sqlite.SQLiteDatabase.CursorFactory, android.database.DatabaseErrorHandler); + method public android.graphics.drawable.Drawable peekWallpaper(); + method public android.content.Intent registerReceiver(android.content.BroadcastReceiver, android.content.IntentFilter); + method public android.content.Intent registerReceiver(android.content.BroadcastReceiver, android.content.IntentFilter, java.lang.String, android.os.Handler); + method public void removeStickyBroadcast(android.content.Intent); + method public void removeStickyBroadcastAsUser(android.content.Intent, android.os.UserHandle); + method public void revokeUriPermission(android.net.Uri, int); + method public void sendBroadcast(android.content.Intent); + method public void sendBroadcast(android.content.Intent, java.lang.String); + method public void sendBroadcastAsUser(android.content.Intent, android.os.UserHandle); + method public void sendBroadcastAsUser(android.content.Intent, android.os.UserHandle, java.lang.String); + method public void sendOrderedBroadcast(android.content.Intent, java.lang.String); + method public void sendOrderedBroadcast(android.content.Intent, java.lang.String, android.content.BroadcastReceiver, android.os.Handler, int, java.lang.String, android.os.Bundle); + method public void sendOrderedBroadcastAsUser(android.content.Intent, android.os.UserHandle, java.lang.String, android.content.BroadcastReceiver, android.os.Handler, int, java.lang.String, android.os.Bundle); + method public void sendStickyBroadcast(android.content.Intent); + method public void sendStickyBroadcastAsUser(android.content.Intent, android.os.UserHandle); + method public void sendStickyOrderedBroadcast(android.content.Intent, android.content.BroadcastReceiver, android.os.Handler, int, java.lang.String, android.os.Bundle); + method public void sendStickyOrderedBroadcastAsUser(android.content.Intent, android.os.UserHandle, android.content.BroadcastReceiver, android.os.Handler, int, java.lang.String, android.os.Bundle); + method public void setTheme(int); + method public void setWallpaper(android.graphics.Bitmap) throws java.io.IOException; + method public void setWallpaper(java.io.InputStream) throws java.io.IOException; + method public void startActivities(android.content.Intent[]); + method public void startActivities(android.content.Intent[], android.os.Bundle); + method public void startActivity(android.content.Intent); + method public void startActivity(android.content.Intent, android.os.Bundle); + method public boolean startInstrumentation(android.content.ComponentName, java.lang.String, android.os.Bundle); + method public void startIntentSender(android.content.IntentSender, android.content.Intent, int, int, int) throws android.content.IntentSender.SendIntentException; + method public void startIntentSender(android.content.IntentSender, android.content.Intent, int, int, int, android.os.Bundle) throws android.content.IntentSender.SendIntentException; + method public android.content.ComponentName startService(android.content.Intent); + method public boolean stopService(android.content.Intent); + method public void unbindService(android.content.ServiceConnection); + method public void unregisterReceiver(android.content.BroadcastReceiver); + } + + public class MockCursor implements android.database.Cursor { + ctor public MockCursor(); + method public void close(); + method public void copyStringToBuffer(int, android.database.CharArrayBuffer); + method public void deactivate(); + method public byte[] getBlob(int); + method public int getColumnCount(); + method public int getColumnIndex(java.lang.String); + method public int getColumnIndexOrThrow(java.lang.String); + method public java.lang.String getColumnName(int); + method public java.lang.String[] getColumnNames(); + method public int getCount(); + method public double getDouble(int); + method public android.os.Bundle getExtras(); + method public float getFloat(int); + method public int getInt(int); + method public long getLong(int); + method public int getPosition(); + method public short getShort(int); + method public java.lang.String getString(int); + method public int getType(int); + method public boolean getWantsAllOnMoveCalls(); + method public boolean isAfterLast(); + method public boolean isBeforeFirst(); + method public boolean isClosed(); + method public boolean isFirst(); + method public boolean isLast(); + method public boolean isNull(int); + method public boolean move(int); + method public boolean moveToFirst(); + method public boolean moveToLast(); + method public boolean moveToNext(); + method public boolean moveToPosition(int); + method public boolean moveToPrevious(); + method public void registerContentObserver(android.database.ContentObserver); + method public void registerDataSetObserver(android.database.DataSetObserver); + method public boolean requery(); + method public android.os.Bundle respond(android.os.Bundle); + method public void setNotificationUri(android.content.ContentResolver, android.net.Uri); + method public void unregisterContentObserver(android.database.ContentObserver); + method public void unregisterDataSetObserver(android.database.DataSetObserver); + } + + public class MockDialogInterface implements android.content.DialogInterface { + ctor public MockDialogInterface(); + method public void cancel(); + method public void dismiss(); + } + + public class MockPackageManager extends android.content.pm.PackageManager { + ctor public MockPackageManager(); + method public void addPackageToPreferred(java.lang.String); + method public boolean addPermission(android.content.pm.PermissionInfo); + method public boolean addPermissionAsync(android.content.pm.PermissionInfo); + method public void addPreferredActivity(android.content.IntentFilter, int, android.content.ComponentName[], android.content.ComponentName); + method public java.lang.String[] canonicalToCurrentPackageNames(java.lang.String[]); + method public int checkPermission(java.lang.String, java.lang.String); + method public int checkSignatures(java.lang.String, java.lang.String); + method public int checkSignatures(int, int); + method public void clearPackagePreferredActivities(java.lang.String); + method public java.lang.String[] currentToCanonicalPackageNames(java.lang.String[]); + method public void extendVerificationTimeout(int, int, long); + method public android.graphics.drawable.Drawable getActivityIcon(android.content.ComponentName) throws android.content.pm.PackageManager.NameNotFoundException; + method public android.graphics.drawable.Drawable getActivityIcon(android.content.Intent) throws android.content.pm.PackageManager.NameNotFoundException; + method public android.content.pm.ActivityInfo getActivityInfo(android.content.ComponentName, int) throws android.content.pm.PackageManager.NameNotFoundException; + method public android.graphics.drawable.Drawable getActivityLogo(android.content.ComponentName) throws android.content.pm.PackageManager.NameNotFoundException; + method public android.graphics.drawable.Drawable getActivityLogo(android.content.Intent) throws android.content.pm.PackageManager.NameNotFoundException; + method public java.util.List getAllPermissionGroups(int); + method public int getApplicationEnabledSetting(java.lang.String); + method public android.graphics.drawable.Drawable getApplicationIcon(android.content.pm.ApplicationInfo); + method public android.graphics.drawable.Drawable getApplicationIcon(java.lang.String) throws android.content.pm.PackageManager.NameNotFoundException; + method public android.content.pm.ApplicationInfo getApplicationInfo(java.lang.String, int) throws android.content.pm.PackageManager.NameNotFoundException; + method public java.lang.CharSequence getApplicationLabel(android.content.pm.ApplicationInfo); + method public android.graphics.drawable.Drawable getApplicationLogo(android.content.pm.ApplicationInfo); + method public android.graphics.drawable.Drawable getApplicationLogo(java.lang.String) throws android.content.pm.PackageManager.NameNotFoundException; + method public int getComponentEnabledSetting(android.content.ComponentName); + method public android.graphics.drawable.Drawable getDefaultActivityIcon(); + method public android.graphics.drawable.Drawable getDrawable(java.lang.String, int, android.content.pm.ApplicationInfo); + method public java.util.List getInstalledApplications(int); + method public java.util.List getInstalledPackages(int); + method public java.lang.String getInstallerPackageName(java.lang.String); + method public android.content.pm.InstrumentationInfo getInstrumentationInfo(android.content.ComponentName, int) throws android.content.pm.PackageManager.NameNotFoundException; + method public android.content.Intent getLaunchIntentForPackage(java.lang.String); + method public java.lang.String getNameForUid(int); + method public int[] getPackageGids(java.lang.String) throws android.content.pm.PackageManager.NameNotFoundException; + method public android.content.pm.PackageInfo getPackageInfo(java.lang.String, int) throws android.content.pm.PackageManager.NameNotFoundException; + method public java.lang.String[] getPackagesForUid(int); + method public android.content.pm.PermissionGroupInfo getPermissionGroupInfo(java.lang.String, int) throws android.content.pm.PackageManager.NameNotFoundException; + method public android.content.pm.PermissionInfo getPermissionInfo(java.lang.String, int) throws android.content.pm.PackageManager.NameNotFoundException; + method public int getPreferredActivities(java.util.List, java.util.List, java.lang.String); + method public java.util.List getPreferredPackages(int); + method public android.content.pm.ProviderInfo getProviderInfo(android.content.ComponentName, int) throws android.content.pm.PackageManager.NameNotFoundException; + method public android.content.pm.ActivityInfo getReceiverInfo(android.content.ComponentName, int) throws android.content.pm.PackageManager.NameNotFoundException; + method public android.content.res.Resources getResourcesForActivity(android.content.ComponentName) throws android.content.pm.PackageManager.NameNotFoundException; + method public android.content.res.Resources getResourcesForApplication(android.content.pm.ApplicationInfo); + method public android.content.res.Resources getResourcesForApplication(java.lang.String) throws android.content.pm.PackageManager.NameNotFoundException; + method public android.content.pm.ServiceInfo getServiceInfo(android.content.ComponentName, int) throws android.content.pm.PackageManager.NameNotFoundException; + method public android.content.pm.FeatureInfo[] getSystemAvailableFeatures(); + method public java.lang.String[] getSystemSharedLibraryNames(); + method public java.lang.CharSequence getText(java.lang.String, int, android.content.pm.ApplicationInfo); + method public android.content.res.XmlResourceParser getXml(java.lang.String, int, android.content.pm.ApplicationInfo); + method public boolean hasSystemFeature(java.lang.String); + method public boolean isSafeMode(); + method public java.util.List queryBroadcastReceivers(android.content.Intent, int); + method public java.util.List queryContentProviders(java.lang.String, int, int); + method public java.util.List queryInstrumentation(java.lang.String, int); + method public java.util.List queryIntentActivities(android.content.Intent, int); + method public java.util.List queryIntentActivityOptions(android.content.ComponentName, android.content.Intent[], android.content.Intent, int); + method public java.util.List queryIntentServices(android.content.Intent, int); + method public java.util.List queryPermissionsByGroup(java.lang.String, int) throws android.content.pm.PackageManager.NameNotFoundException; + method public void removePackageFromPreferred(java.lang.String); + method public void removePermission(java.lang.String); + method public android.content.pm.ResolveInfo resolveActivity(android.content.Intent, int); + method public android.content.pm.ProviderInfo resolveContentProvider(java.lang.String, int); + method public android.content.pm.ResolveInfo resolveService(android.content.Intent, int); + method public void setApplicationEnabledSetting(java.lang.String, int, int); + method public void setComponentEnabledSetting(android.content.ComponentName, int, int); + method public void setInstallerPackageName(java.lang.String, java.lang.String); + method public void verifyPendingInstall(int, int); + } + + public class MockResources extends android.content.res.Resources { + ctor public MockResources(); + } + +} + +package android.test.suitebuilder { + + public class TestMethod { + ctor public TestMethod(java.lang.reflect.Method, java.lang.Class); + ctor public TestMethod(java.lang.String, java.lang.Class); + ctor public TestMethod(junit.framework.TestCase); + method public junit.framework.TestCase createTest() throws java.lang.IllegalAccessException, java.lang.InstantiationException, java.lang.reflect.InvocationTargetException; + method public T getAnnotation(java.lang.Class); + method public java.lang.Class getEnclosingClass(); + method public java.lang.String getEnclosingClassname(); + method public java.lang.String getName(); + } + + public class TestSuiteBuilder { + ctor public TestSuiteBuilder(java.lang.Class); + ctor public TestSuiteBuilder(java.lang.String, java.lang.ClassLoader); + method public android.test.suitebuilder.TestSuiteBuilder addRequirements(java.util.List>); + method public final android.test.suitebuilder.TestSuiteBuilder addRequirements(com.android.internal.util.Predicate...); + method public final junit.framework.TestSuite build(); + method public android.test.suitebuilder.TestSuiteBuilder excludePackages(java.lang.String...); + method protected java.lang.String getSuiteName(); + method public final android.test.suitebuilder.TestSuiteBuilder includeAllPackagesUnderHere(); + method public android.test.suitebuilder.TestSuiteBuilder includePackages(java.lang.String...); + method public android.test.suitebuilder.TestSuiteBuilder named(java.lang.String); + } + + public static class TestSuiteBuilder.FailedToCreateTests extends junit.framework.TestCase { + ctor public TestSuiteBuilder.FailedToCreateTests(java.lang.Exception); + method public void testSuiteConstructionFailed(); + } + +} + +package android.test.suitebuilder.annotation { + + public abstract class LargeTest implements java.lang.annotation.Annotation { + } + + public abstract class MediumTest implements java.lang.annotation.Annotation { + } + + public abstract class SmallTest implements java.lang.annotation.Annotation { + } + + public abstract class Smoke implements java.lang.annotation.Annotation { + } + + public abstract class Suppress implements java.lang.annotation.Annotation { + } + +} + +package android.text { + + public class AlteredCharSequence implements java.lang.CharSequence android.text.GetChars { + method public char charAt(int); + method public void getChars(int, int, char[], int); + method public int length(); + method public static android.text.AlteredCharSequence make(java.lang.CharSequence, char[], int, int); + method public java.lang.CharSequence subSequence(int, int); + } + + public class AndroidCharacter { + ctor public AndroidCharacter(); + method public static void getDirectionalities(char[], byte[], int); + method public static int getEastAsianWidth(char); + method public static void getEastAsianWidths(char[], int, int, byte[]); + method public static char getMirror(char); + method public static boolean mirror(char[], int, int); + field public static final int EAST_ASIAN_WIDTH_AMBIGUOUS = 1; // 0x1 + field public static final int EAST_ASIAN_WIDTH_FULL_WIDTH = 3; // 0x3 + field public static final int EAST_ASIAN_WIDTH_HALF_WIDTH = 2; // 0x2 + field public static final int EAST_ASIAN_WIDTH_NARROW = 4; // 0x4 + field public static final int EAST_ASIAN_WIDTH_NEUTRAL = 0; // 0x0 + field public static final int EAST_ASIAN_WIDTH_WIDE = 5; // 0x5 + } + + public class Annotation implements android.text.ParcelableSpan { + ctor public Annotation(java.lang.String, java.lang.String); + ctor public Annotation(android.os.Parcel); + method public int describeContents(); + method public java.lang.String getKey(); + method public int getSpanTypeId(); + method public java.lang.String getValue(); + method public void writeToParcel(android.os.Parcel, int); + } + + public class AutoText { + method public static java.lang.String get(java.lang.CharSequence, int, int, android.view.View); + method public static int getSize(android.view.View); + } + + public class BoringLayout extends android.text.Layout implements android.text.TextUtils.EllipsizeCallback { + ctor public BoringLayout(java.lang.CharSequence, android.text.TextPaint, int, android.text.Layout.Alignment, float, float, android.text.BoringLayout.Metrics, boolean); + ctor public BoringLayout(java.lang.CharSequence, android.text.TextPaint, int, android.text.Layout.Alignment, float, float, android.text.BoringLayout.Metrics, boolean, android.text.TextUtils.TruncateAt, int); + method public void ellipsized(int, int); + method public int getBottomPadding(); + method public int getEllipsisCount(int); + method public int getEllipsisStart(int); + method public boolean getLineContainsTab(int); + method public int getLineCount(); + method public int getLineDescent(int); + method public final android.text.Layout.Directions getLineDirections(int); + method public int getLineStart(int); + method public int getLineTop(int); + method public int getParagraphDirection(int); + method public int getTopPadding(); + method public static android.text.BoringLayout.Metrics isBoring(java.lang.CharSequence, android.text.TextPaint); + method public static android.text.BoringLayout.Metrics isBoring(java.lang.CharSequence, android.text.TextPaint, android.text.BoringLayout.Metrics); + method public static android.text.BoringLayout make(java.lang.CharSequence, android.text.TextPaint, int, android.text.Layout.Alignment, float, float, android.text.BoringLayout.Metrics, boolean); + method public static android.text.BoringLayout make(java.lang.CharSequence, android.text.TextPaint, int, android.text.Layout.Alignment, float, float, android.text.BoringLayout.Metrics, boolean, android.text.TextUtils.TruncateAt, int); + method public android.text.BoringLayout replaceOrMake(java.lang.CharSequence, android.text.TextPaint, int, android.text.Layout.Alignment, float, float, android.text.BoringLayout.Metrics, boolean); + method public android.text.BoringLayout replaceOrMake(java.lang.CharSequence, android.text.TextPaint, int, android.text.Layout.Alignment, float, float, android.text.BoringLayout.Metrics, boolean, android.text.TextUtils.TruncateAt, int); + } + + public static class BoringLayout.Metrics extends android.graphics.Paint.FontMetricsInt { + ctor public BoringLayout.Metrics(); + field public int width; + } + + public abstract deprecated class ClipboardManager { + ctor public ClipboardManager(); + method public abstract java.lang.CharSequence getText(); + method public abstract boolean hasText(); + method public abstract void setText(java.lang.CharSequence); + } + + public class DynamicLayout extends android.text.Layout { + ctor public DynamicLayout(java.lang.CharSequence, android.text.TextPaint, int, android.text.Layout.Alignment, float, float, boolean); + ctor public DynamicLayout(java.lang.CharSequence, java.lang.CharSequence, android.text.TextPaint, int, android.text.Layout.Alignment, float, float, boolean); + ctor public DynamicLayout(java.lang.CharSequence, java.lang.CharSequence, android.text.TextPaint, int, android.text.Layout.Alignment, float, float, boolean, android.text.TextUtils.TruncateAt, int); + method public int getBottomPadding(); + method public int getEllipsisCount(int); + method public int getEllipsisStart(int); + method public boolean getLineContainsTab(int); + method public int getLineCount(); + method public int getLineDescent(int); + method public final android.text.Layout.Directions getLineDirections(int); + method public int getLineStart(int); + method public int getLineTop(int); + method public int getParagraphDirection(int); + method public int getTopPadding(); + } + + public abstract interface Editable implements java.lang.Appendable java.lang.CharSequence android.text.GetChars android.text.Spannable { + method public abstract android.text.Editable append(java.lang.CharSequence); + method public abstract android.text.Editable append(java.lang.CharSequence, int, int); + method public abstract android.text.Editable append(char); + method public abstract void clear(); + method public abstract void clearSpans(); + method public abstract android.text.Editable delete(int, int); + method public abstract android.text.InputFilter[] getFilters(); + method public abstract android.text.Editable insert(int, java.lang.CharSequence, int, int); + method public abstract android.text.Editable insert(int, java.lang.CharSequence); + method public abstract android.text.Editable replace(int, int, java.lang.CharSequence, int, int); + method public abstract android.text.Editable replace(int, int, java.lang.CharSequence); + method public abstract void setFilters(android.text.InputFilter[]); + } + + public static class Editable.Factory { + ctor public Editable.Factory(); + method public static android.text.Editable.Factory getInstance(); + method public android.text.Editable newEditable(java.lang.CharSequence); + } + + public abstract interface GetChars implements java.lang.CharSequence { + method public abstract void getChars(int, int, char[], int); + } + + public class Html { + method public static java.lang.String escapeHtml(java.lang.CharSequence); + method public static android.text.Spanned fromHtml(java.lang.String); + method public static android.text.Spanned fromHtml(java.lang.String, android.text.Html.ImageGetter, android.text.Html.TagHandler); + method public static java.lang.String toHtml(android.text.Spanned); + } + + public static abstract interface Html.ImageGetter { + method public abstract android.graphics.drawable.Drawable getDrawable(java.lang.String); + } + + public static abstract interface Html.TagHandler { + method public abstract void handleTag(boolean, java.lang.String, android.text.Editable, org.xml.sax.XMLReader); + } + + public abstract interface InputFilter { + method public abstract java.lang.CharSequence filter(java.lang.CharSequence, int, int, android.text.Spanned, int, int); + } + + public static class InputFilter.AllCaps implements android.text.InputFilter { + ctor public InputFilter.AllCaps(); + method public java.lang.CharSequence filter(java.lang.CharSequence, int, int, android.text.Spanned, int, int); + } + + public static class InputFilter.LengthFilter implements android.text.InputFilter { + ctor public InputFilter.LengthFilter(int); + method public java.lang.CharSequence filter(java.lang.CharSequence, int, int, android.text.Spanned, int, int); + } + + public abstract interface InputType { + field public static final int TYPE_CLASS_DATETIME = 4; // 0x4 + field public static final int TYPE_CLASS_NUMBER = 2; // 0x2 + field public static final int TYPE_CLASS_PHONE = 3; // 0x3 + field public static final int TYPE_CLASS_TEXT = 1; // 0x1 + field public static final int TYPE_DATETIME_VARIATION_DATE = 16; // 0x10 + field public static final int TYPE_DATETIME_VARIATION_NORMAL = 0; // 0x0 + field public static final int TYPE_DATETIME_VARIATION_TIME = 32; // 0x20 + field public static final int TYPE_MASK_CLASS = 15; // 0xf + field public static final int TYPE_MASK_FLAGS = 16773120; // 0xfff000 + field public static final int TYPE_MASK_VARIATION = 4080; // 0xff0 + field public static final int TYPE_NULL = 0; // 0x0 + field public static final int TYPE_NUMBER_FLAG_DECIMAL = 8192; // 0x2000 + field public static final int TYPE_NUMBER_FLAG_SIGNED = 4096; // 0x1000 + field public static final int TYPE_NUMBER_VARIATION_NORMAL = 0; // 0x0 + field public static final int TYPE_NUMBER_VARIATION_PASSWORD = 16; // 0x10 + field public static final int TYPE_TEXT_FLAG_AUTO_COMPLETE = 65536; // 0x10000 + field public static final int TYPE_TEXT_FLAG_AUTO_CORRECT = 32768; // 0x8000 + field public static final int TYPE_TEXT_FLAG_CAP_CHARACTERS = 4096; // 0x1000 + field public static final int TYPE_TEXT_FLAG_CAP_SENTENCES = 16384; // 0x4000 + field public static final int TYPE_TEXT_FLAG_CAP_WORDS = 8192; // 0x2000 + field public static final int TYPE_TEXT_FLAG_IME_MULTI_LINE = 262144; // 0x40000 + field public static final int TYPE_TEXT_FLAG_MULTI_LINE = 131072; // 0x20000 + field public static final int TYPE_TEXT_FLAG_NO_SUGGESTIONS = 524288; // 0x80000 + field public static final int TYPE_TEXT_VARIATION_EMAIL_ADDRESS = 32; // 0x20 + field public static final int TYPE_TEXT_VARIATION_EMAIL_SUBJECT = 48; // 0x30 + field public static final int TYPE_TEXT_VARIATION_FILTER = 176; // 0xb0 + field public static final int TYPE_TEXT_VARIATION_LONG_MESSAGE = 80; // 0x50 + field public static final int TYPE_TEXT_VARIATION_NORMAL = 0; // 0x0 + field public static final int TYPE_TEXT_VARIATION_PASSWORD = 128; // 0x80 + field public static final int TYPE_TEXT_VARIATION_PERSON_NAME = 96; // 0x60 + field public static final int TYPE_TEXT_VARIATION_PHONETIC = 192; // 0xc0 + field public static final int TYPE_TEXT_VARIATION_POSTAL_ADDRESS = 112; // 0x70 + field public static final int TYPE_TEXT_VARIATION_SHORT_MESSAGE = 64; // 0x40 + field public static final int TYPE_TEXT_VARIATION_URI = 16; // 0x10 + field public static final int TYPE_TEXT_VARIATION_VISIBLE_PASSWORD = 144; // 0x90 + field public static final int TYPE_TEXT_VARIATION_WEB_EDIT_TEXT = 160; // 0xa0 + field public static final int TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS = 208; // 0xd0 + field public static final int TYPE_TEXT_VARIATION_WEB_PASSWORD = 224; // 0xe0 + } + + public abstract class Layout { + ctor protected Layout(java.lang.CharSequence, android.text.TextPaint, int, android.text.Layout.Alignment, float, float); + method public void draw(android.graphics.Canvas); + method public void draw(android.graphics.Canvas, android.graphics.Path, android.graphics.Paint, int); + method public final android.text.Layout.Alignment getAlignment(); + method public abstract int getBottomPadding(); + method public void getCursorPath(int, android.graphics.Path, java.lang.CharSequence); + method public static float getDesiredWidth(java.lang.CharSequence, android.text.TextPaint); + method public static float getDesiredWidth(java.lang.CharSequence, int, int, android.text.TextPaint); + method public abstract int getEllipsisCount(int); + method public abstract int getEllipsisStart(int); + method public int getEllipsizedWidth(); + method public int getHeight(); + method public final int getLineAscent(int); + method public final int getLineBaseline(int); + method public final int getLineBottom(int); + method public int getLineBounds(int, android.graphics.Rect); + method public abstract boolean getLineContainsTab(int); + method public abstract int getLineCount(); + method public abstract int getLineDescent(int); + method public abstract android.text.Layout.Directions getLineDirections(int); + method public final int getLineEnd(int); + method public int getLineForOffset(int); + method public int getLineForVertical(int); + method public float getLineLeft(int); + method public float getLineMax(int); + method public float getLineRight(int); + method public abstract int getLineStart(int); + method public abstract int getLineTop(int); + method public int getLineVisibleEnd(int); + method public float getLineWidth(int); + method public int getOffsetForHorizontal(int, float); + method public int getOffsetToLeftOf(int); + method public int getOffsetToRightOf(int); + method public final android.text.TextPaint getPaint(); + method public final android.text.Layout.Alignment getParagraphAlignment(int); + method public abstract int getParagraphDirection(int); + method public final int getParagraphLeft(int); + method public final int getParagraphRight(int); + method public float getPrimaryHorizontal(int); + method public float getSecondaryHorizontal(int); + method public void getSelectionPath(int, int, android.graphics.Path); + method public final float getSpacingAdd(); + method public final float getSpacingMultiplier(); + method public final java.lang.CharSequence getText(); + method public abstract int getTopPadding(); + method public final int getWidth(); + method public final void increaseWidthTo(int); + method public boolean isRtlCharAt(int); + method protected final boolean isSpanned(); + field public static final int DIR_LEFT_TO_RIGHT = 1; // 0x1 + field public static final int DIR_RIGHT_TO_LEFT = -1; // 0xffffffff + } + + public static final class Layout.Alignment extends java.lang.Enum { + method public static android.text.Layout.Alignment valueOf(java.lang.String); + method public static final android.text.Layout.Alignment[] values(); + enum_constant public static final android.text.Layout.Alignment ALIGN_CENTER; + enum_constant public static final android.text.Layout.Alignment ALIGN_NORMAL; + enum_constant public static final android.text.Layout.Alignment ALIGN_OPPOSITE; + } + + public static class Layout.Directions { + } + + public abstract class LoginFilter implements android.text.InputFilter { + method public java.lang.CharSequence filter(java.lang.CharSequence, int, int, android.text.Spanned, int, int); + method public abstract boolean isAllowed(char); + method public void onInvalidCharacter(char); + method public void onStart(); + method public void onStop(); + } + + public static class LoginFilter.PasswordFilterGMail extends android.text.LoginFilter { + ctor public LoginFilter.PasswordFilterGMail(); + ctor public LoginFilter.PasswordFilterGMail(boolean); + method public boolean isAllowed(char); + } + + public static class LoginFilter.UsernameFilterGMail extends android.text.LoginFilter { + ctor public LoginFilter.UsernameFilterGMail(); + ctor public LoginFilter.UsernameFilterGMail(boolean); + method public boolean isAllowed(char); + } + + public static class LoginFilter.UsernameFilterGeneric extends android.text.LoginFilter { + ctor public LoginFilter.UsernameFilterGeneric(); + ctor public LoginFilter.UsernameFilterGeneric(boolean); + method public boolean isAllowed(char); + } + + public abstract interface NoCopySpan { + } + + public static class NoCopySpan.Concrete implements android.text.NoCopySpan { + ctor public NoCopySpan.Concrete(); + } + + public abstract interface ParcelableSpan implements android.os.Parcelable { + method public abstract int getSpanTypeId(); + } + + public class Selection { + method public static boolean extendDown(android.text.Spannable, android.text.Layout); + method public static boolean extendLeft(android.text.Spannable, android.text.Layout); + method public static boolean extendRight(android.text.Spannable, android.text.Layout); + method public static final void extendSelection(android.text.Spannable, int); + method public static boolean extendToLeftEdge(android.text.Spannable, android.text.Layout); + method public static boolean extendToRightEdge(android.text.Spannable, android.text.Layout); + method public static boolean extendUp(android.text.Spannable, android.text.Layout); + method public static final int getSelectionEnd(java.lang.CharSequence); + method public static final int getSelectionStart(java.lang.CharSequence); + method public static boolean moveDown(android.text.Spannable, android.text.Layout); + method public static boolean moveLeft(android.text.Spannable, android.text.Layout); + method public static boolean moveRight(android.text.Spannable, android.text.Layout); + method public static boolean moveToLeftEdge(android.text.Spannable, android.text.Layout); + method public static boolean moveToRightEdge(android.text.Spannable, android.text.Layout); + method public static boolean moveUp(android.text.Spannable, android.text.Layout); + method public static final void removeSelection(android.text.Spannable); + method public static final void selectAll(android.text.Spannable); + method public static void setSelection(android.text.Spannable, int, int); + method public static final void setSelection(android.text.Spannable, int); + field public static final java.lang.Object SELECTION_END; + field public static final java.lang.Object SELECTION_START; + } + + public abstract interface SpanWatcher implements android.text.NoCopySpan { + method public abstract void onSpanAdded(android.text.Spannable, java.lang.Object, int, int); + method public abstract void onSpanChanged(android.text.Spannable, java.lang.Object, int, int, int, int); + method public abstract void onSpanRemoved(android.text.Spannable, java.lang.Object, int, int); + } + + public abstract interface Spannable implements android.text.Spanned { + method public abstract void removeSpan(java.lang.Object); + method public abstract void setSpan(java.lang.Object, int, int, int); + } + + public static class Spannable.Factory { + ctor public Spannable.Factory(); + method public static android.text.Spannable.Factory getInstance(); + method public android.text.Spannable newSpannable(java.lang.CharSequence); + } + + public class SpannableString extends android.text.SpannableStringInternal implements java.lang.CharSequence android.text.GetChars android.text.Spannable { + ctor public SpannableString(java.lang.CharSequence); + method public void removeSpan(java.lang.Object); + method public void setSpan(java.lang.Object, int, int, int); + method public final java.lang.CharSequence subSequence(int, int); + method public static android.text.SpannableString valueOf(java.lang.CharSequence); + } + + public class SpannableStringBuilder implements java.lang.Appendable java.lang.CharSequence android.text.Editable android.text.GetChars android.text.Spannable { + ctor public SpannableStringBuilder(); + ctor public SpannableStringBuilder(java.lang.CharSequence); + ctor public SpannableStringBuilder(java.lang.CharSequence, int, int); + method public android.text.SpannableStringBuilder append(java.lang.CharSequence); + method public android.text.SpannableStringBuilder append(java.lang.CharSequence, int, int); + method public android.text.SpannableStringBuilder append(char); + method public char charAt(int); + method public void clear(); + method public void clearSpans(); + method public android.text.SpannableStringBuilder delete(int, int); + method public void getChars(int, int, char[], int); + method public android.text.InputFilter[] getFilters(); + method public int getSpanEnd(java.lang.Object); + method public int getSpanFlags(java.lang.Object); + method public int getSpanStart(java.lang.Object); + method public T[] getSpans(int, int, java.lang.Class); + method public deprecated int getTextRunCursor(int, int, int, int, int, android.graphics.Paint); + method public android.text.SpannableStringBuilder insert(int, java.lang.CharSequence, int, int); + method public android.text.SpannableStringBuilder insert(int, java.lang.CharSequence); + method public int length(); + method public int nextSpanTransition(int, int, java.lang.Class); + method public void removeSpan(java.lang.Object); + method public android.text.SpannableStringBuilder replace(int, int, java.lang.CharSequence); + method public android.text.SpannableStringBuilder replace(int, int, java.lang.CharSequence, int, int); + method public void setFilters(android.text.InputFilter[]); + method public void setSpan(java.lang.Object, int, int, int); + method public java.lang.CharSequence subSequence(int, int); + method public static android.text.SpannableStringBuilder valueOf(java.lang.CharSequence); + } + + abstract class SpannableStringInternal { + method public final char charAt(int); + method public final void getChars(int, int, char[], int); + method public int getSpanEnd(java.lang.Object); + method public int getSpanFlags(java.lang.Object); + method public int getSpanStart(java.lang.Object); + method public T[] getSpans(int, int, java.lang.Class); + method public final int length(); + method public int nextSpanTransition(int, int, java.lang.Class); + method public final java.lang.String toString(); + } + + public abstract interface Spanned implements java.lang.CharSequence { + method public abstract int getSpanEnd(java.lang.Object); + method public abstract int getSpanFlags(java.lang.Object); + method public abstract int getSpanStart(java.lang.Object); + method public abstract T[] getSpans(int, int, java.lang.Class); + method public abstract int nextSpanTransition(int, int, java.lang.Class); + field public static final int SPAN_COMPOSING = 256; // 0x100 + field public static final int SPAN_EXCLUSIVE_EXCLUSIVE = 33; // 0x21 + field public static final int SPAN_EXCLUSIVE_INCLUSIVE = 34; // 0x22 + field public static final int SPAN_INCLUSIVE_EXCLUSIVE = 17; // 0x11 + field public static final int SPAN_INCLUSIVE_INCLUSIVE = 18; // 0x12 + field public static final int SPAN_INTERMEDIATE = 512; // 0x200 + field public static final int SPAN_MARK_MARK = 17; // 0x11 + field public static final int SPAN_MARK_POINT = 18; // 0x12 + field public static final int SPAN_PARAGRAPH = 51; // 0x33 + field public static final int SPAN_POINT_MARK = 33; // 0x21 + field public static final int SPAN_POINT_MARK_MASK = 51; // 0x33 + field public static final int SPAN_POINT_POINT = 34; // 0x22 + field public static final int SPAN_PRIORITY = 16711680; // 0xff0000 + field public static final int SPAN_PRIORITY_SHIFT = 16; // 0x10 + field public static final int SPAN_USER = -16777216; // 0xff000000 + field public static final int SPAN_USER_SHIFT = 24; // 0x18 + } + + public final class SpannedString extends android.text.SpannableStringInternal implements java.lang.CharSequence android.text.GetChars android.text.Spanned { + ctor public SpannedString(java.lang.CharSequence); + method public java.lang.CharSequence subSequence(int, int); + method public static android.text.SpannedString valueOf(java.lang.CharSequence); + } + + public class StaticLayout extends android.text.Layout { + ctor public StaticLayout(java.lang.CharSequence, android.text.TextPaint, int, android.text.Layout.Alignment, float, float, boolean); + ctor public StaticLayout(java.lang.CharSequence, int, int, android.text.TextPaint, int, android.text.Layout.Alignment, float, float, boolean); + ctor public StaticLayout(java.lang.CharSequence, int, int, android.text.TextPaint, int, android.text.Layout.Alignment, float, float, boolean, android.text.TextUtils.TruncateAt, int); + method public int getBottomPadding(); + method public int getEllipsisCount(int); + method public int getEllipsisStart(int); + method public boolean getLineContainsTab(int); + method public int getLineCount(); + method public int getLineDescent(int); + method public final android.text.Layout.Directions getLineDirections(int); + method public int getLineStart(int); + method public int getLineTop(int); + method public int getParagraphDirection(int); + method public int getTopPadding(); + } + + public class TextPaint extends android.graphics.Paint { + ctor public TextPaint(); + ctor public TextPaint(int); + ctor public TextPaint(android.graphics.Paint); + method public void set(android.text.TextPaint); + field public int baselineShift; + field public int bgColor; + field public float density; + field public int[] drawableState; + field public int linkColor; + } + + public class TextUtils { + method public static java.lang.CharSequence commaEllipsize(java.lang.CharSequence, android.text.TextPaint, float, java.lang.String, java.lang.String); + method public static java.lang.CharSequence concat(java.lang.CharSequence...); + method public static void copySpansFrom(android.text.Spanned, int, int, java.lang.Class, android.text.Spannable, int); + method public static void dumpSpans(java.lang.CharSequence, android.util.Printer, java.lang.String); + method public static java.lang.CharSequence ellipsize(java.lang.CharSequence, android.text.TextPaint, float, android.text.TextUtils.TruncateAt); + method public static java.lang.CharSequence ellipsize(java.lang.CharSequence, android.text.TextPaint, float, android.text.TextUtils.TruncateAt, boolean, android.text.TextUtils.EllipsizeCallback); + method public static boolean equals(java.lang.CharSequence, java.lang.CharSequence); + method public static java.lang.CharSequence expandTemplate(java.lang.CharSequence, java.lang.CharSequence...); + method public static int getCapsMode(java.lang.CharSequence, int, int); + method public static void getChars(java.lang.CharSequence, int, int, char[], int); + method public static int getLayoutDirectionFromLocale(java.util.Locale); + method public static int getOffsetAfter(java.lang.CharSequence, int); + method public static int getOffsetBefore(java.lang.CharSequence, int); + method public static java.lang.CharSequence getReverse(java.lang.CharSequence, int, int); + method public static int getTrimmedLength(java.lang.CharSequence); + method public static java.lang.String htmlEncode(java.lang.String); + method public static int indexOf(java.lang.CharSequence, char); + method public static int indexOf(java.lang.CharSequence, char, int); + method public static int indexOf(java.lang.CharSequence, char, int, int); + method public static int indexOf(java.lang.CharSequence, java.lang.CharSequence); + method public static int indexOf(java.lang.CharSequence, java.lang.CharSequence, int); + method public static int indexOf(java.lang.CharSequence, java.lang.CharSequence, int, int); + method public static boolean isDigitsOnly(java.lang.CharSequence); + method public static boolean isEmpty(java.lang.CharSequence); + method public static boolean isGraphic(java.lang.CharSequence); + method public static boolean isGraphic(char); + method public static java.lang.String join(java.lang.CharSequence, java.lang.Object[]); + method public static java.lang.String join(java.lang.CharSequence, java.lang.Iterable); + method public static int lastIndexOf(java.lang.CharSequence, char); + method public static int lastIndexOf(java.lang.CharSequence, char, int); + method public static int lastIndexOf(java.lang.CharSequence, char, int, int); + method public static boolean regionMatches(java.lang.CharSequence, int, java.lang.CharSequence, int, int); + method public static java.lang.CharSequence replace(java.lang.CharSequence, java.lang.String[], java.lang.CharSequence[]); + method public static java.lang.String[] split(java.lang.String, java.lang.String); + method public static java.lang.String[] split(java.lang.String, java.util.regex.Pattern); + method public static java.lang.CharSequence stringOrSpannedString(java.lang.CharSequence); + method public static java.lang.String substring(java.lang.CharSequence, int, int); + method public static void writeToParcel(java.lang.CharSequence, android.os.Parcel, int); + field public static final int CAP_MODE_CHARACTERS = 4096; // 0x1000 + field public static final int CAP_MODE_SENTENCES = 16384; // 0x4000 + field public static final int CAP_MODE_WORDS = 8192; // 0x2000 + field public static final android.os.Parcelable.Creator CHAR_SEQUENCE_CREATOR; + } + + public static abstract interface TextUtils.EllipsizeCallback { + method public abstract void ellipsized(int, int); + } + + public static class TextUtils.SimpleStringSplitter implements java.util.Iterator android.text.TextUtils.StringSplitter { + ctor public TextUtils.SimpleStringSplitter(char); + method public boolean hasNext(); + method public java.util.Iterator iterator(); + method public java.lang.String next(); + method public void remove(); + method public void setString(java.lang.String); + } + + public static abstract interface TextUtils.StringSplitter implements java.lang.Iterable { + method public abstract void setString(java.lang.String); + } + + public static final class TextUtils.TruncateAt extends java.lang.Enum { + method public static android.text.TextUtils.TruncateAt valueOf(java.lang.String); + method public static final android.text.TextUtils.TruncateAt[] values(); + enum_constant public static final android.text.TextUtils.TruncateAt END; + enum_constant public static final android.text.TextUtils.TruncateAt MARQUEE; + enum_constant public static final android.text.TextUtils.TruncateAt MIDDLE; + enum_constant public static final android.text.TextUtils.TruncateAt START; + } + + public abstract interface TextWatcher implements android.text.NoCopySpan { + method public abstract void afterTextChanged(android.text.Editable); + method public abstract void beforeTextChanged(java.lang.CharSequence, int, int, int); + method public abstract void onTextChanged(java.lang.CharSequence, int, int, int); + } + +} + +package android.text.format { + + public class DateFormat { + ctor public DateFormat(); + method public static java.lang.CharSequence format(java.lang.CharSequence, long); + method public static java.lang.CharSequence format(java.lang.CharSequence, java.util.Date); + method public static java.lang.CharSequence format(java.lang.CharSequence, java.util.Calendar); + method public static java.text.DateFormat getDateFormat(android.content.Context); + method public static char[] getDateFormatOrder(android.content.Context); + method public static java.text.DateFormat getLongDateFormat(android.content.Context); + method public static java.text.DateFormat getMediumDateFormat(android.content.Context); + method public static java.text.DateFormat getTimeFormat(android.content.Context); + method public static boolean is24HourFormat(android.content.Context); + field public static final char AM_PM = 97; // 0x0061 'a' + field public static final char CAPITAL_AM_PM = 65; // 0x0041 'A' + field public static final char DATE = 100; // 0x0064 'd' + field public static final char DAY = 69; // 0x0045 'E' + field public static final char HOUR = 104; // 0x0068 'h' + field public static final char HOUR_OF_DAY = 107; // 0x006b 'k' + field public static final char MINUTE = 109; // 0x006d 'm' + field public static final char MONTH = 77; // 0x004d 'M' + field public static final char QUOTE = 39; // 0x0027 '\'' + field public static final char SECONDS = 115; // 0x0073 's' + field public static final char STANDALONE_MONTH = 76; // 0x004c 'L' + field public static final char TIME_ZONE = 122; // 0x007a 'z' + field public static final char YEAR = 121; // 0x0079 'y' + } + + public class DateUtils { + ctor public DateUtils(); + method public static java.lang.String formatDateRange(android.content.Context, long, long, int); + method public static java.util.Formatter formatDateRange(android.content.Context, java.util.Formatter, long, long, int); + method public static java.util.Formatter formatDateRange(android.content.Context, java.util.Formatter, long, long, int, java.lang.String); + method public static java.lang.String formatDateTime(android.content.Context, long, int); + method public static java.lang.String formatElapsedTime(long); + method public static java.lang.String formatElapsedTime(java.lang.StringBuilder, long); + method public static final java.lang.CharSequence formatSameDayTime(long, long, int, int); + method public static deprecated java.lang.String getAMPMString(int); + method public static deprecated java.lang.String getDayOfWeekString(int, int); + method public static deprecated java.lang.String getMonthString(int, int); + method public static java.lang.CharSequence getRelativeDateTimeString(android.content.Context, long, long, long, int); + method public static java.lang.CharSequence getRelativeTimeSpanString(long); + method public static java.lang.CharSequence getRelativeTimeSpanString(long, long, long); + method public static java.lang.CharSequence getRelativeTimeSpanString(long, long, long, int); + method public static java.lang.CharSequence getRelativeTimeSpanString(android.content.Context, long, boolean); + method public static java.lang.CharSequence getRelativeTimeSpanString(android.content.Context, long); + method public static boolean isToday(long); + field public static final deprecated java.lang.String ABBREV_MONTH_FORMAT = "%b"; + field public static final java.lang.String ABBREV_WEEKDAY_FORMAT = "%a"; + field public static final long DAY_IN_MILLIS = 86400000L; // 0x5265c00L + field public static final deprecated int FORMAT_12HOUR = 64; // 0x40 + field public static final deprecated int FORMAT_24HOUR = 128; // 0x80 + field public static final int FORMAT_ABBREV_ALL = 524288; // 0x80000 + field public static final int FORMAT_ABBREV_MONTH = 65536; // 0x10000 + field public static final int FORMAT_ABBREV_RELATIVE = 262144; // 0x40000 + field public static final int FORMAT_ABBREV_TIME = 16384; // 0x4000 + field public static final int FORMAT_ABBREV_WEEKDAY = 32768; // 0x8000 + field public static final deprecated int FORMAT_CAP_AMPM = 256; // 0x100 + field public static final deprecated int FORMAT_CAP_MIDNIGHT = 4096; // 0x1000 + field public static final deprecated int FORMAT_CAP_NOON = 1024; // 0x400 + field public static final deprecated int FORMAT_CAP_NOON_MIDNIGHT = 5120; // 0x1400 + field public static final int FORMAT_NO_MIDNIGHT = 2048; // 0x800 + field public static final int FORMAT_NO_MONTH_DAY = 32; // 0x20 + field public static final int FORMAT_NO_NOON = 512; // 0x200 + field public static final deprecated int FORMAT_NO_NOON_MIDNIGHT = 2560; // 0xa00 + field public static final int FORMAT_NO_YEAR = 8; // 0x8 + field public static final int FORMAT_NUMERIC_DATE = 131072; // 0x20000 + field public static final int FORMAT_SHOW_DATE = 16; // 0x10 + field public static final int FORMAT_SHOW_TIME = 1; // 0x1 + field public static final int FORMAT_SHOW_WEEKDAY = 2; // 0x2 + field public static final int FORMAT_SHOW_YEAR = 4; // 0x4 + field public static final deprecated int FORMAT_UTC = 8192; // 0x2000 + field public static final long HOUR_IN_MILLIS = 3600000L; // 0x36ee80L + field public static final deprecated java.lang.String HOUR_MINUTE_24 = "%H:%M"; + field public static final deprecated int LENGTH_LONG = 10; // 0xa + field public static final deprecated int LENGTH_MEDIUM = 20; // 0x14 + field public static final deprecated int LENGTH_SHORT = 30; // 0x1e + field public static final deprecated int LENGTH_SHORTER = 40; // 0x28 + field public static final deprecated int LENGTH_SHORTEST = 50; // 0x32 + field public static final long MINUTE_IN_MILLIS = 60000L; // 0xea60L + field public static final java.lang.String MONTH_DAY_FORMAT = "%-d"; + field public static final java.lang.String MONTH_FORMAT = "%B"; + field public static final java.lang.String NUMERIC_MONTH_FORMAT = "%m"; + field public static final long SECOND_IN_MILLIS = 1000L; // 0x3e8L + field public static final java.lang.String WEEKDAY_FORMAT = "%A"; + field public static final long WEEK_IN_MILLIS = 604800000L; // 0x240c8400L + field public static final java.lang.String YEAR_FORMAT = "%Y"; + field public static final java.lang.String YEAR_FORMAT_TWO_DIGITS = "%g"; + field public static final long YEAR_IN_MILLIS = 31449600000L; // 0x7528ad000L + field public static final deprecated int[] sameMonthTable; + field public static final deprecated int[] sameYearTable; + } + + public final class Formatter { + ctor public Formatter(); + method public static java.lang.String formatFileSize(android.content.Context, long); + method public static deprecated java.lang.String formatIpAddress(int); + method public static java.lang.String formatShortFileSize(android.content.Context, long); + } + + public class Time { + ctor public Time(java.lang.String); + ctor public Time(); + ctor public Time(android.text.format.Time); + method public boolean after(android.text.format.Time); + method public boolean before(android.text.format.Time); + method public void clear(java.lang.String); + method public static int compare(android.text.format.Time, android.text.format.Time); + method public java.lang.String format(java.lang.String); + method public java.lang.String format2445(); + method public java.lang.String format3339(boolean); + method public int getActualMaximum(int); + method public static java.lang.String getCurrentTimezone(); + method public static int getJulianDay(long, long); + method public static int getJulianMondayFromWeeksSinceEpoch(int); + method public int getWeekNumber(); + method public static int getWeeksSinceEpochFromJulianDay(int, int); + method public static boolean isEpoch(android.text.format.Time); + method public long normalize(boolean); + method public boolean parse(java.lang.String); + method public boolean parse3339(java.lang.String); + method public void set(long); + method public void set(android.text.format.Time); + method public void set(int, int, int, int, int, int); + method public void set(int, int, int); + method public long setJulianDay(int); + method public void setToNow(); + method public void switchTimezone(java.lang.String); + method public long toMillis(boolean); + field public static final int EPOCH_JULIAN_DAY = 2440588; // 0x253d8c + field public static final int FRIDAY = 5; // 0x5 + field public static final int HOUR = 3; // 0x3 + field public static final int MINUTE = 2; // 0x2 + field public static final int MONDAY = 1; // 0x1 + field public static final int MONDAY_BEFORE_JULIAN_EPOCH = 2440585; // 0x253d89 + field public static final int MONTH = 5; // 0x5 + field public static final int MONTH_DAY = 4; // 0x4 + field public static final int SATURDAY = 6; // 0x6 + field public static final int SECOND = 1; // 0x1 + field public static final int SUNDAY = 0; // 0x0 + field public static final int THURSDAY = 4; // 0x4 + field public static final java.lang.String TIMEZONE_UTC = "UTC"; + field public static final int TUESDAY = 2; // 0x2 + field public static final int WEDNESDAY = 3; // 0x3 + field public static final int WEEK_DAY = 7; // 0x7 + field public static final int WEEK_NUM = 9; // 0x9 + field public static final int YEAR = 6; // 0x6 + field public static final int YEAR_DAY = 8; // 0x8 + field public boolean allDay; + field public long gmtoff; + field public int hour; + field public int isDst; + field public int minute; + field public int month; + field public int monthDay; + field public int second; + field public java.lang.String timezone; + field public int weekDay; + field public int year; + field public int yearDay; + } + +} + +package android.text.method { + + public class ArrowKeyMovementMethod extends android.text.method.BaseMovementMethod implements android.text.method.MovementMethod { + ctor public ArrowKeyMovementMethod(); + method public static android.text.method.MovementMethod getInstance(); + } + + public abstract class BaseKeyListener extends android.text.method.MetaKeyKeyListener implements android.text.method.KeyListener { + ctor public BaseKeyListener(); + method public boolean backspace(android.view.View, android.text.Editable, int, android.view.KeyEvent); + method public boolean forwardDelete(android.view.View, android.text.Editable, int, android.view.KeyEvent); + method public boolean onKeyOther(android.view.View, android.text.Editable, android.view.KeyEvent); + } + + public class BaseMovementMethod implements android.text.method.MovementMethod { + ctor public BaseMovementMethod(); + method protected boolean bottom(android.widget.TextView, android.text.Spannable); + method public boolean canSelectArbitrarily(); + method protected boolean down(android.widget.TextView, android.text.Spannable); + method protected boolean end(android.widget.TextView, android.text.Spannable); + method protected int getMovementMetaState(android.text.Spannable, android.view.KeyEvent); + method protected boolean handleMovementKey(android.widget.TextView, android.text.Spannable, int, int, android.view.KeyEvent); + method protected boolean home(android.widget.TextView, android.text.Spannable); + method public void initialize(android.widget.TextView, android.text.Spannable); + method protected boolean left(android.widget.TextView, android.text.Spannable); + method protected boolean lineEnd(android.widget.TextView, android.text.Spannable); + method protected boolean lineStart(android.widget.TextView, android.text.Spannable); + method public boolean onGenericMotionEvent(android.widget.TextView, android.text.Spannable, android.view.MotionEvent); + method public boolean onKeyDown(android.widget.TextView, android.text.Spannable, int, android.view.KeyEvent); + method public boolean onKeyOther(android.widget.TextView, android.text.Spannable, android.view.KeyEvent); + method public boolean onKeyUp(android.widget.TextView, android.text.Spannable, int, android.view.KeyEvent); + method public void onTakeFocus(android.widget.TextView, android.text.Spannable, int); + method public boolean onTouchEvent(android.widget.TextView, android.text.Spannable, android.view.MotionEvent); + method public boolean onTrackballEvent(android.widget.TextView, android.text.Spannable, android.view.MotionEvent); + method protected boolean pageDown(android.widget.TextView, android.text.Spannable); + method protected boolean pageUp(android.widget.TextView, android.text.Spannable); + method protected boolean right(android.widget.TextView, android.text.Spannable); + method protected boolean top(android.widget.TextView, android.text.Spannable); + method protected boolean up(android.widget.TextView, android.text.Spannable); + } + + public class CharacterPickerDialog extends android.app.Dialog implements android.widget.AdapterView.OnItemClickListener android.view.View.OnClickListener { + ctor public CharacterPickerDialog(android.content.Context, android.view.View, android.text.Editable, java.lang.String, boolean); + method public void onClick(android.view.View); + method public void onItemClick(android.widget.AdapterView, android.view.View, int, long); + } + + public class DateKeyListener extends android.text.method.NumberKeyListener { + ctor public DateKeyListener(); + method protected char[] getAcceptedChars(); + method public int getInputType(); + method public static android.text.method.DateKeyListener getInstance(); + field public static final char[] CHARACTERS; + } + + public class DateTimeKeyListener extends android.text.method.NumberKeyListener { + ctor public DateTimeKeyListener(); + method protected char[] getAcceptedChars(); + method public int getInputType(); + method public static android.text.method.DateTimeKeyListener getInstance(); + field public static final char[] CHARACTERS; + } + + public class DialerKeyListener extends android.text.method.NumberKeyListener { + ctor public DialerKeyListener(); + method protected char[] getAcceptedChars(); + method public int getInputType(); + method public static android.text.method.DialerKeyListener getInstance(); + field public static final char[] CHARACTERS; + } + + public class DigitsKeyListener extends android.text.method.NumberKeyListener { + ctor public DigitsKeyListener(); + ctor public DigitsKeyListener(boolean, boolean); + method protected char[] getAcceptedChars(); + method public int getInputType(); + method public static android.text.method.DigitsKeyListener getInstance(); + method public static android.text.method.DigitsKeyListener getInstance(boolean, boolean); + method public static android.text.method.DigitsKeyListener getInstance(java.lang.String); + } + + public class HideReturnsTransformationMethod extends android.text.method.ReplacementTransformationMethod { + ctor public HideReturnsTransformationMethod(); + method public static android.text.method.HideReturnsTransformationMethod getInstance(); + method protected char[] getOriginal(); + method protected char[] getReplacement(); + } + + public abstract interface KeyListener { + method public abstract void clearMetaKeyState(android.view.View, android.text.Editable, int); + method public abstract int getInputType(); + method public abstract boolean onKeyDown(android.view.View, android.text.Editable, int, android.view.KeyEvent); + method public abstract boolean onKeyOther(android.view.View, android.text.Editable, android.view.KeyEvent); + method public abstract boolean onKeyUp(android.view.View, android.text.Editable, int, android.view.KeyEvent); + } + + public class LinkMovementMethod extends android.text.method.ScrollingMovementMethod { + ctor public LinkMovementMethod(); + method public static android.text.method.MovementMethod getInstance(); + } + + public abstract class MetaKeyKeyListener { + ctor public MetaKeyKeyListener(); + method public static void adjustMetaAfterKeypress(android.text.Spannable); + method public static long adjustMetaAfterKeypress(long); + method public void clearMetaKeyState(android.view.View, android.text.Editable, int); + method public static void clearMetaKeyState(android.text.Editable, int); + method public long clearMetaKeyState(long, int); + method public static final int getMetaState(java.lang.CharSequence); + method public static final int getMetaState(java.lang.CharSequence, int); + method public static final int getMetaState(long); + method public static final int getMetaState(long, int); + method public static long handleKeyDown(long, int, android.view.KeyEvent); + method public static long handleKeyUp(long, int, android.view.KeyEvent); + method public static boolean isMetaTracker(java.lang.CharSequence, java.lang.Object); + method public static boolean isSelectingMetaTracker(java.lang.CharSequence, java.lang.Object); + method public boolean onKeyDown(android.view.View, android.text.Editable, int, android.view.KeyEvent); + method public boolean onKeyUp(android.view.View, android.text.Editable, int, android.view.KeyEvent); + method protected static void resetLockedMeta(android.text.Spannable); + method public static long resetLockedMeta(long); + method public static void resetMetaState(android.text.Spannable); + field public static final int META_ALT_LOCKED = 512; // 0x200 + field public static final int META_ALT_ON = 2; // 0x2 + field public static final int META_CAP_LOCKED = 256; // 0x100 + field public static final int META_SHIFT_ON = 1; // 0x1 + field public static final int META_SYM_LOCKED = 1024; // 0x400 + field public static final int META_SYM_ON = 4; // 0x4 + } + + public abstract interface MovementMethod { + method public abstract boolean canSelectArbitrarily(); + method public abstract void initialize(android.widget.TextView, android.text.Spannable); + method public abstract boolean onGenericMotionEvent(android.widget.TextView, android.text.Spannable, android.view.MotionEvent); + method public abstract boolean onKeyDown(android.widget.TextView, android.text.Spannable, int, android.view.KeyEvent); + method public abstract boolean onKeyOther(android.widget.TextView, android.text.Spannable, android.view.KeyEvent); + method public abstract boolean onKeyUp(android.widget.TextView, android.text.Spannable, int, android.view.KeyEvent); + method public abstract void onTakeFocus(android.widget.TextView, android.text.Spannable, int); + method public abstract boolean onTouchEvent(android.widget.TextView, android.text.Spannable, android.view.MotionEvent); + method public abstract boolean onTrackballEvent(android.widget.TextView, android.text.Spannable, android.view.MotionEvent); + } + + public class MultiTapKeyListener extends android.text.method.BaseKeyListener implements android.text.SpanWatcher { + ctor public MultiTapKeyListener(android.text.method.TextKeyListener.Capitalize, boolean); + method public int getInputType(); + method public static android.text.method.MultiTapKeyListener getInstance(boolean, android.text.method.TextKeyListener.Capitalize); + method public void onSpanAdded(android.text.Spannable, java.lang.Object, int, int); + method public void onSpanChanged(android.text.Spannable, java.lang.Object, int, int, int, int); + method public void onSpanRemoved(android.text.Spannable, java.lang.Object, int, int); + } + + public abstract class NumberKeyListener extends android.text.method.BaseKeyListener implements android.text.InputFilter { + ctor public NumberKeyListener(); + method public java.lang.CharSequence filter(java.lang.CharSequence, int, int, android.text.Spanned, int, int); + method protected abstract char[] getAcceptedChars(); + method protected int lookup(android.view.KeyEvent, android.text.Spannable); + method protected static boolean ok(char[], char); + } + + public class PasswordTransformationMethod implements android.text.TextWatcher android.text.method.TransformationMethod { + ctor public PasswordTransformationMethod(); + method public void afterTextChanged(android.text.Editable); + method public void beforeTextChanged(java.lang.CharSequence, int, int, int); + method public static android.text.method.PasswordTransformationMethod getInstance(); + method public java.lang.CharSequence getTransformation(java.lang.CharSequence, android.view.View); + method public void onFocusChanged(android.view.View, java.lang.CharSequence, boolean, int, android.graphics.Rect); + method public void onTextChanged(java.lang.CharSequence, int, int, int); + } + + public class QwertyKeyListener extends android.text.method.BaseKeyListener { + ctor public QwertyKeyListener(android.text.method.TextKeyListener.Capitalize, boolean); + method public int getInputType(); + method public static android.text.method.QwertyKeyListener getInstance(boolean, android.text.method.TextKeyListener.Capitalize); + method public static android.text.method.QwertyKeyListener getInstanceForFullKeyboard(); + method public static void markAsReplaced(android.text.Spannable, int, int, java.lang.String); + } + + public abstract class ReplacementTransformationMethod implements android.text.method.TransformationMethod { + ctor public ReplacementTransformationMethod(); + method protected abstract char[] getOriginal(); + method protected abstract char[] getReplacement(); + method public java.lang.CharSequence getTransformation(java.lang.CharSequence, android.view.View); + method public void onFocusChanged(android.view.View, java.lang.CharSequence, boolean, int, android.graphics.Rect); + } + + public class ScrollingMovementMethod extends android.text.method.BaseMovementMethod implements android.text.method.MovementMethod { + ctor public ScrollingMovementMethod(); + method public static android.text.method.MovementMethod getInstance(); + } + + public class SingleLineTransformationMethod extends android.text.method.ReplacementTransformationMethod { + ctor public SingleLineTransformationMethod(); + method public static android.text.method.SingleLineTransformationMethod getInstance(); + method protected char[] getOriginal(); + method protected char[] getReplacement(); + } + + public class TextKeyListener extends android.text.method.BaseKeyListener implements android.text.SpanWatcher { + ctor public TextKeyListener(android.text.method.TextKeyListener.Capitalize, boolean); + method public static void clear(android.text.Editable); + method public int getInputType(); + method public static android.text.method.TextKeyListener getInstance(boolean, android.text.method.TextKeyListener.Capitalize); + method public static android.text.method.TextKeyListener getInstance(); + method public void onSpanAdded(android.text.Spannable, java.lang.Object, int, int); + method public void onSpanChanged(android.text.Spannable, java.lang.Object, int, int, int, int); + method public void onSpanRemoved(android.text.Spannable, java.lang.Object, int, int); + method public void release(); + method public static boolean shouldCap(android.text.method.TextKeyListener.Capitalize, java.lang.CharSequence, int); + } + + public static final class TextKeyListener.Capitalize extends java.lang.Enum { + method public static android.text.method.TextKeyListener.Capitalize valueOf(java.lang.String); + method public static final android.text.method.TextKeyListener.Capitalize[] values(); + enum_constant public static final android.text.method.TextKeyListener.Capitalize CHARACTERS; + enum_constant public static final android.text.method.TextKeyListener.Capitalize NONE; + enum_constant public static final android.text.method.TextKeyListener.Capitalize SENTENCES; + enum_constant public static final android.text.method.TextKeyListener.Capitalize WORDS; + } + + public class TimeKeyListener extends android.text.method.NumberKeyListener { + ctor public TimeKeyListener(); + method protected char[] getAcceptedChars(); + method public int getInputType(); + method public static android.text.method.TimeKeyListener getInstance(); + field public static final char[] CHARACTERS; + } + + public class Touch { + method public static int getInitialScrollX(android.widget.TextView, android.text.Spannable); + method public static int getInitialScrollY(android.widget.TextView, android.text.Spannable); + method public static boolean onTouchEvent(android.widget.TextView, android.text.Spannable, android.view.MotionEvent); + method public static void scrollTo(android.widget.TextView, android.text.Layout, int, int); + } + + public abstract interface TransformationMethod { + method public abstract java.lang.CharSequence getTransformation(java.lang.CharSequence, android.view.View); + method public abstract void onFocusChanged(android.view.View, java.lang.CharSequence, boolean, int, android.graphics.Rect); + } + +} + +package android.text.style { + + public class AbsoluteSizeSpan extends android.text.style.MetricAffectingSpan implements android.text.ParcelableSpan { + ctor public AbsoluteSizeSpan(int); + ctor public AbsoluteSizeSpan(int, boolean); + ctor public AbsoluteSizeSpan(android.os.Parcel); + method public int describeContents(); + method public boolean getDip(); + method public int getSize(); + method public int getSpanTypeId(); + method public void updateDrawState(android.text.TextPaint); + method public void updateMeasureState(android.text.TextPaint); + method public void writeToParcel(android.os.Parcel, int); + } + + public abstract interface AlignmentSpan implements android.text.style.ParagraphStyle { + method public abstract android.text.Layout.Alignment getAlignment(); + } + + public static class AlignmentSpan.Standard implements android.text.style.AlignmentSpan android.text.ParcelableSpan { + ctor public AlignmentSpan.Standard(android.text.Layout.Alignment); + ctor public AlignmentSpan.Standard(android.os.Parcel); + method public int describeContents(); + method public android.text.Layout.Alignment getAlignment(); + method public int getSpanTypeId(); + method public void writeToParcel(android.os.Parcel, int); + } + + public class BackgroundColorSpan extends android.text.style.CharacterStyle implements android.text.ParcelableSpan android.text.style.UpdateAppearance { + ctor public BackgroundColorSpan(int); + ctor public BackgroundColorSpan(android.os.Parcel); + method public int describeContents(); + method public int getBackgroundColor(); + method public int getSpanTypeId(); + method public void updateDrawState(android.text.TextPaint); + method public void writeToParcel(android.os.Parcel, int); + } + + public class BulletSpan implements android.text.style.LeadingMarginSpan android.text.ParcelableSpan { + ctor public BulletSpan(); + ctor public BulletSpan(int); + ctor public BulletSpan(int, int); + ctor public BulletSpan(android.os.Parcel); + method public int describeContents(); + method public void drawLeadingMargin(android.graphics.Canvas, android.graphics.Paint, int, int, int, int, int, java.lang.CharSequence, int, int, boolean, android.text.Layout); + method public int getLeadingMargin(boolean); + method public int getSpanTypeId(); + method public void writeToParcel(android.os.Parcel, int); + field public static final int STANDARD_GAP_WIDTH = 2; // 0x2 + } + + public abstract class CharacterStyle { + ctor public CharacterStyle(); + method public android.text.style.CharacterStyle getUnderlying(); + method public abstract void updateDrawState(android.text.TextPaint); + method public static android.text.style.CharacterStyle wrap(android.text.style.CharacterStyle); + } + + public abstract class ClickableSpan extends android.text.style.CharacterStyle implements android.text.style.UpdateAppearance { + ctor public ClickableSpan(); + method public abstract void onClick(android.view.View); + method public void updateDrawState(android.text.TextPaint); + } + + public class DrawableMarginSpan implements android.text.style.LeadingMarginSpan android.text.style.LineHeightSpan { + ctor public DrawableMarginSpan(android.graphics.drawable.Drawable); + ctor public DrawableMarginSpan(android.graphics.drawable.Drawable, int); + method public void chooseHeight(java.lang.CharSequence, int, int, int, int, android.graphics.Paint.FontMetricsInt); + method public void drawLeadingMargin(android.graphics.Canvas, android.graphics.Paint, int, int, int, int, int, java.lang.CharSequence, int, int, boolean, android.text.Layout); + method public int getLeadingMargin(boolean); + } + + public abstract class DynamicDrawableSpan extends android.text.style.ReplacementSpan { + ctor public DynamicDrawableSpan(); + ctor protected DynamicDrawableSpan(int); + method public void draw(android.graphics.Canvas, java.lang.CharSequence, int, int, float, int, int, int, android.graphics.Paint); + method public abstract android.graphics.drawable.Drawable getDrawable(); + method public int getSize(android.graphics.Paint, java.lang.CharSequence, int, int, android.graphics.Paint.FontMetricsInt); + method public int getVerticalAlignment(); + field public static final int ALIGN_BASELINE = 1; // 0x1 + field public static final int ALIGN_BOTTOM = 0; // 0x0 + field protected final int mVerticalAlignment; + } + + public class EasyEditSpan implements android.text.ParcelableSpan { + ctor public EasyEditSpan(); + method public int describeContents(); + method public int getSpanTypeId(); + method public void writeToParcel(android.os.Parcel, int); + } + + public class ForegroundColorSpan extends android.text.style.CharacterStyle implements android.text.ParcelableSpan android.text.style.UpdateAppearance { + ctor public ForegroundColorSpan(int); + ctor public ForegroundColorSpan(android.os.Parcel); + method public int describeContents(); + method public int getForegroundColor(); + method public int getSpanTypeId(); + method public void updateDrawState(android.text.TextPaint); + method public void writeToParcel(android.os.Parcel, int); + } + + public class IconMarginSpan implements android.text.style.LeadingMarginSpan android.text.style.LineHeightSpan { + ctor public IconMarginSpan(android.graphics.Bitmap); + ctor public IconMarginSpan(android.graphics.Bitmap, int); + method public void chooseHeight(java.lang.CharSequence, int, int, int, int, android.graphics.Paint.FontMetricsInt); + method public void drawLeadingMargin(android.graphics.Canvas, android.graphics.Paint, int, int, int, int, int, java.lang.CharSequence, int, int, boolean, android.text.Layout); + method public int getLeadingMargin(boolean); + } + + public class ImageSpan extends android.text.style.DynamicDrawableSpan { + ctor public deprecated ImageSpan(android.graphics.Bitmap); + ctor public deprecated ImageSpan(android.graphics.Bitmap, int); + ctor public ImageSpan(android.content.Context, android.graphics.Bitmap); + ctor public ImageSpan(android.content.Context, android.graphics.Bitmap, int); + ctor public ImageSpan(android.graphics.drawable.Drawable); + ctor public ImageSpan(android.graphics.drawable.Drawable, int); + ctor public ImageSpan(android.graphics.drawable.Drawable, java.lang.String); + ctor public ImageSpan(android.graphics.drawable.Drawable, java.lang.String, int); + ctor public ImageSpan(android.content.Context, android.net.Uri); + ctor public ImageSpan(android.content.Context, android.net.Uri, int); + ctor public ImageSpan(android.content.Context, int); + ctor public ImageSpan(android.content.Context, int, int); + method public android.graphics.drawable.Drawable getDrawable(); + method public java.lang.String getSource(); + } + + public abstract interface LeadingMarginSpan implements android.text.style.ParagraphStyle { + method public abstract void drawLeadingMargin(android.graphics.Canvas, android.graphics.Paint, int, int, int, int, int, java.lang.CharSequence, int, int, boolean, android.text.Layout); + method public abstract int getLeadingMargin(boolean); + } + + public static abstract interface LeadingMarginSpan.LeadingMarginSpan2 implements android.text.style.LeadingMarginSpan android.text.style.WrapTogetherSpan { + method public abstract int getLeadingMarginLineCount(); + } + + public static class LeadingMarginSpan.Standard implements android.text.style.LeadingMarginSpan android.text.ParcelableSpan { + ctor public LeadingMarginSpan.Standard(int, int); + ctor public LeadingMarginSpan.Standard(int); + ctor public LeadingMarginSpan.Standard(android.os.Parcel); + method public int describeContents(); + method public void drawLeadingMargin(android.graphics.Canvas, android.graphics.Paint, int, int, int, int, int, java.lang.CharSequence, int, int, boolean, android.text.Layout); + method public int getLeadingMargin(boolean); + method public int getSpanTypeId(); + method public void writeToParcel(android.os.Parcel, int); + } + + public abstract interface LineBackgroundSpan implements android.text.style.ParagraphStyle { + method public abstract void drawBackground(android.graphics.Canvas, android.graphics.Paint, int, int, int, int, int, java.lang.CharSequence, int, int, int); + } + + public abstract interface LineHeightSpan implements android.text.style.ParagraphStyle android.text.style.WrapTogetherSpan { + method public abstract void chooseHeight(java.lang.CharSequence, int, int, int, int, android.graphics.Paint.FontMetricsInt); + } + + public static abstract interface LineHeightSpan.WithDensity implements android.text.style.LineHeightSpan { + method public abstract void chooseHeight(java.lang.CharSequence, int, int, int, int, android.graphics.Paint.FontMetricsInt, android.text.TextPaint); + } + + public class LocaleSpan extends android.text.style.MetricAffectingSpan implements android.text.ParcelableSpan { + ctor public LocaleSpan(java.util.Locale); + ctor public LocaleSpan(android.os.Parcel); + method public int describeContents(); + method public java.util.Locale getLocale(); + method public int getSpanTypeId(); + method public void updateDrawState(android.text.TextPaint); + method public void updateMeasureState(android.text.TextPaint); + method public void writeToParcel(android.os.Parcel, int); + } + + public class MaskFilterSpan extends android.text.style.CharacterStyle implements android.text.style.UpdateAppearance { + ctor public MaskFilterSpan(android.graphics.MaskFilter); + method public android.graphics.MaskFilter getMaskFilter(); + method public void updateDrawState(android.text.TextPaint); + } + + public abstract class MetricAffectingSpan extends android.text.style.CharacterStyle implements android.text.style.UpdateLayout { + ctor public MetricAffectingSpan(); + method public abstract void updateMeasureState(android.text.TextPaint); + } + + public abstract interface ParagraphStyle { + } + + public class QuoteSpan implements android.text.style.LeadingMarginSpan android.text.ParcelableSpan { + ctor public QuoteSpan(); + ctor public QuoteSpan(int); + ctor public QuoteSpan(android.os.Parcel); + method public int describeContents(); + method public void drawLeadingMargin(android.graphics.Canvas, android.graphics.Paint, int, int, int, int, int, java.lang.CharSequence, int, int, boolean, android.text.Layout); + method public int getColor(); + method public int getLeadingMargin(boolean); + method public int getSpanTypeId(); + method public void writeToParcel(android.os.Parcel, int); + } + + public class RasterizerSpan extends android.text.style.CharacterStyle implements android.text.style.UpdateAppearance { + ctor public RasterizerSpan(android.graphics.Rasterizer); + method public android.graphics.Rasterizer getRasterizer(); + method public void updateDrawState(android.text.TextPaint); + } + + public class RelativeSizeSpan extends android.text.style.MetricAffectingSpan implements android.text.ParcelableSpan { + ctor public RelativeSizeSpan(float); + ctor public RelativeSizeSpan(android.os.Parcel); + method public int describeContents(); + method public float getSizeChange(); + method public int getSpanTypeId(); + method public void updateDrawState(android.text.TextPaint); + method public void updateMeasureState(android.text.TextPaint); + method public void writeToParcel(android.os.Parcel, int); + } + + public abstract class ReplacementSpan extends android.text.style.MetricAffectingSpan { + ctor public ReplacementSpan(); + method public abstract void draw(android.graphics.Canvas, java.lang.CharSequence, int, int, float, int, int, int, android.graphics.Paint); + method public abstract int getSize(android.graphics.Paint, java.lang.CharSequence, int, int, android.graphics.Paint.FontMetricsInt); + method public void updateDrawState(android.text.TextPaint); + method public void updateMeasureState(android.text.TextPaint); + } + + public class ScaleXSpan extends android.text.style.MetricAffectingSpan implements android.text.ParcelableSpan { + ctor public ScaleXSpan(float); + ctor public ScaleXSpan(android.os.Parcel); + method public int describeContents(); + method public float getScaleX(); + method public int getSpanTypeId(); + method public void updateDrawState(android.text.TextPaint); + method public void updateMeasureState(android.text.TextPaint); + method public void writeToParcel(android.os.Parcel, int); + } + + public class StrikethroughSpan extends android.text.style.CharacterStyle implements android.text.ParcelableSpan android.text.style.UpdateAppearance { + ctor public StrikethroughSpan(); + ctor public StrikethroughSpan(android.os.Parcel); + method public int describeContents(); + method public int getSpanTypeId(); + method public void updateDrawState(android.text.TextPaint); + method public void writeToParcel(android.os.Parcel, int); + } + + public class StyleSpan extends android.text.style.MetricAffectingSpan implements android.text.ParcelableSpan { + ctor public StyleSpan(int); + ctor public StyleSpan(android.os.Parcel); + method public int describeContents(); + method public int getSpanTypeId(); + method public int getStyle(); + method public void updateDrawState(android.text.TextPaint); + method public void updateMeasureState(android.text.TextPaint); + method public void writeToParcel(android.os.Parcel, int); + } + + public class SubscriptSpan extends android.text.style.MetricAffectingSpan implements android.text.ParcelableSpan { + ctor public SubscriptSpan(); + ctor public SubscriptSpan(android.os.Parcel); + method public int describeContents(); + method public int getSpanTypeId(); + method public void updateDrawState(android.text.TextPaint); + method public void updateMeasureState(android.text.TextPaint); + method public void writeToParcel(android.os.Parcel, int); + } + + public class SuggestionSpan extends android.text.style.CharacterStyle implements android.text.ParcelableSpan { + ctor public SuggestionSpan(android.content.Context, java.lang.String[], int); + ctor public SuggestionSpan(java.util.Locale, java.lang.String[], int); + ctor public SuggestionSpan(android.content.Context, java.util.Locale, java.lang.String[], int, java.lang.Class); + ctor public SuggestionSpan(android.os.Parcel); + method public int describeContents(); + method public int getFlags(); + method public java.lang.String getLocale(); + method public int getSpanTypeId(); + method public java.lang.String[] getSuggestions(); + method public void setFlags(int); + method public void updateDrawState(android.text.TextPaint); + method public void writeToParcel(android.os.Parcel, int); + field public static final java.lang.String ACTION_SUGGESTION_PICKED = "android.text.style.SUGGESTION_PICKED"; + field public static final android.os.Parcelable.Creator CREATOR; + field public static final int FLAG_AUTO_CORRECTION = 4; // 0x4 + field public static final int FLAG_EASY_CORRECT = 1; // 0x1 + field public static final int FLAG_MISSPELLED = 2; // 0x2 + field public static final int SUGGESTIONS_MAX_SIZE = 5; // 0x5 + field public static final java.lang.String SUGGESTION_SPAN_PICKED_AFTER = "after"; + field public static final java.lang.String SUGGESTION_SPAN_PICKED_BEFORE = "before"; + field public static final java.lang.String SUGGESTION_SPAN_PICKED_HASHCODE = "hashcode"; + } + + public class SuperscriptSpan extends android.text.style.MetricAffectingSpan implements android.text.ParcelableSpan { + ctor public SuperscriptSpan(); + ctor public SuperscriptSpan(android.os.Parcel); + method public int describeContents(); + method public int getSpanTypeId(); + method public void updateDrawState(android.text.TextPaint); + method public void updateMeasureState(android.text.TextPaint); + method public void writeToParcel(android.os.Parcel, int); + } + + public abstract interface TabStopSpan implements android.text.style.ParagraphStyle { + method public abstract int getTabStop(); + } + + public static class TabStopSpan.Standard implements android.text.style.TabStopSpan { + ctor public TabStopSpan.Standard(int); + method public int getTabStop(); + } + + public class TextAppearanceSpan extends android.text.style.MetricAffectingSpan implements android.text.ParcelableSpan { + ctor public TextAppearanceSpan(android.content.Context, int); + ctor public TextAppearanceSpan(android.content.Context, int, int); + ctor public TextAppearanceSpan(java.lang.String, int, int, android.content.res.ColorStateList, android.content.res.ColorStateList); + ctor public TextAppearanceSpan(android.os.Parcel); + method public int describeContents(); + method public java.lang.String getFamily(); + method public android.content.res.ColorStateList getLinkTextColor(); + method public int getSpanTypeId(); + method public android.content.res.ColorStateList getTextColor(); + method public int getTextSize(); + method public int getTextStyle(); + method public void updateDrawState(android.text.TextPaint); + method public void updateMeasureState(android.text.TextPaint); + method public void writeToParcel(android.os.Parcel, int); + } + + public class TypefaceSpan extends android.text.style.MetricAffectingSpan implements android.text.ParcelableSpan { + ctor public TypefaceSpan(java.lang.String); + ctor public TypefaceSpan(android.os.Parcel); + method public int describeContents(); + method public java.lang.String getFamily(); + method public int getSpanTypeId(); + method public void updateDrawState(android.text.TextPaint); + method public void updateMeasureState(android.text.TextPaint); + method public void writeToParcel(android.os.Parcel, int); + } + + public class URLSpan extends android.text.style.ClickableSpan implements android.text.ParcelableSpan { + ctor public URLSpan(java.lang.String); + ctor public URLSpan(android.os.Parcel); + method public int describeContents(); + method public int getSpanTypeId(); + method public java.lang.String getURL(); + method public void onClick(android.view.View); + method public void writeToParcel(android.os.Parcel, int); + } + + public class UnderlineSpan extends android.text.style.CharacterStyle implements android.text.ParcelableSpan android.text.style.UpdateAppearance { + ctor public UnderlineSpan(); + ctor public UnderlineSpan(android.os.Parcel); + method public int describeContents(); + method public int getSpanTypeId(); + method public void updateDrawState(android.text.TextPaint); + method public void writeToParcel(android.os.Parcel, int); + } + + public abstract interface UpdateAppearance { + } + + public abstract interface UpdateLayout implements android.text.style.UpdateAppearance { + } + + public abstract interface WrapTogetherSpan implements android.text.style.ParagraphStyle { + } + +} + +package android.text.util { + + public class Linkify { + ctor public Linkify(); + method public static final boolean addLinks(android.text.Spannable, int); + method public static final boolean addLinks(android.widget.TextView, int); + method public static final void addLinks(android.widget.TextView, java.util.regex.Pattern, java.lang.String); + method public static final void addLinks(android.widget.TextView, java.util.regex.Pattern, java.lang.String, android.text.util.Linkify.MatchFilter, android.text.util.Linkify.TransformFilter); + method public static final boolean addLinks(android.text.Spannable, java.util.regex.Pattern, java.lang.String); + method public static final boolean addLinks(android.text.Spannable, java.util.regex.Pattern, java.lang.String, android.text.util.Linkify.MatchFilter, android.text.util.Linkify.TransformFilter); + field public static final int ALL = 15; // 0xf + field public static final int EMAIL_ADDRESSES = 2; // 0x2 + field public static final int MAP_ADDRESSES = 8; // 0x8 + field public static final int PHONE_NUMBERS = 4; // 0x4 + field public static final int WEB_URLS = 1; // 0x1 + field public static final android.text.util.Linkify.MatchFilter sPhoneNumberMatchFilter; + field public static final android.text.util.Linkify.TransformFilter sPhoneNumberTransformFilter; + field public static final android.text.util.Linkify.MatchFilter sUrlMatchFilter; + } + + public static abstract interface Linkify.MatchFilter { + method public abstract boolean acceptMatch(java.lang.CharSequence, int, int); + } + + public static abstract interface Linkify.TransformFilter { + method public abstract java.lang.String transformUrl(java.util.regex.Matcher, java.lang.String); + } + + public class Rfc822Token { + ctor public Rfc822Token(java.lang.String, java.lang.String, java.lang.String); + method public java.lang.String getAddress(); + method public java.lang.String getComment(); + method public java.lang.String getName(); + method public static java.lang.String quoteComment(java.lang.String); + method public static java.lang.String quoteName(java.lang.String); + method public static java.lang.String quoteNameIfNecessary(java.lang.String); + method public void setAddress(java.lang.String); + method public void setComment(java.lang.String); + method public void setName(java.lang.String); + } + + public class Rfc822Tokenizer implements android.widget.MultiAutoCompleteTextView.Tokenizer { + ctor public Rfc822Tokenizer(); + method public int findTokenEnd(java.lang.CharSequence, int); + method public int findTokenStart(java.lang.CharSequence, int); + method public java.lang.CharSequence terminateToken(java.lang.CharSequence); + method public static void tokenize(java.lang.CharSequence, java.util.Collection); + method public static android.text.util.Rfc822Token[] tokenize(java.lang.CharSequence); + } + +} + +package android.util { + + public class AndroidException extends java.lang.Exception { + ctor public AndroidException(); + ctor public AndroidException(java.lang.String); + ctor public AndroidException(java.lang.String, java.lang.Throwable); + ctor public AndroidException(java.lang.Exception); + } + + public class AndroidRuntimeException extends java.lang.RuntimeException { + ctor public AndroidRuntimeException(); + ctor public AndroidRuntimeException(java.lang.String); + ctor public AndroidRuntimeException(java.lang.String, java.lang.Throwable); + ctor public AndroidRuntimeException(java.lang.Exception); + } + + public class AtomicFile { + ctor public AtomicFile(java.io.File); + method public void delete(); + method public void failWrite(java.io.FileOutputStream); + method public void finishWrite(java.io.FileOutputStream); + method public java.io.File getBaseFile(); + method public java.io.FileInputStream openRead() throws java.io.FileNotFoundException; + method public byte[] readFully() throws java.io.IOException; + method public java.io.FileOutputStream startWrite() throws java.io.IOException; + } + + public abstract interface AttributeSet { + method public abstract boolean getAttributeBooleanValue(java.lang.String, java.lang.String, boolean); + method public abstract boolean getAttributeBooleanValue(int, boolean); + method public abstract int getAttributeCount(); + method public abstract float getAttributeFloatValue(java.lang.String, java.lang.String, float); + method public abstract float getAttributeFloatValue(int, float); + method public abstract int getAttributeIntValue(java.lang.String, java.lang.String, int); + method public abstract int getAttributeIntValue(int, int); + method public abstract int getAttributeListValue(java.lang.String, java.lang.String, java.lang.String[], int); + method public abstract int getAttributeListValue(int, java.lang.String[], int); + method public abstract java.lang.String getAttributeName(int); + method public abstract int getAttributeNameResource(int); + method public abstract int getAttributeResourceValue(java.lang.String, java.lang.String, int); + method public abstract int getAttributeResourceValue(int, int); + method public abstract int getAttributeUnsignedIntValue(java.lang.String, java.lang.String, int); + method public abstract int getAttributeUnsignedIntValue(int, int); + method public abstract java.lang.String getAttributeValue(int); + method public abstract java.lang.String getAttributeValue(java.lang.String, java.lang.String); + method public abstract java.lang.String getClassAttribute(); + method public abstract java.lang.String getIdAttribute(); + method public abstract int getIdAttributeResourceValue(int); + method public abstract java.lang.String getPositionDescription(); + method public abstract int getStyleAttribute(); + } + + public class Base64 { + method public static byte[] decode(java.lang.String, int); + method public static byte[] decode(byte[], int); + method public static byte[] decode(byte[], int, int, int); + method public static byte[] encode(byte[], int); + method public static byte[] encode(byte[], int, int, int); + method public static java.lang.String encodeToString(byte[], int); + method public static java.lang.String encodeToString(byte[], int, int, int); + field public static final int CRLF = 4; // 0x4 + field public static final int DEFAULT = 0; // 0x0 + field public static final int NO_CLOSE = 16; // 0x10 + field public static final int NO_PADDING = 1; // 0x1 + field public static final int NO_WRAP = 2; // 0x2 + field public static final int URL_SAFE = 8; // 0x8 + } + + public class Base64DataException extends java.io.IOException { + ctor public Base64DataException(java.lang.String); + } + + public class Base64InputStream extends java.io.FilterInputStream { + ctor public Base64InputStream(java.io.InputStream, int); + } + + public class Base64OutputStream extends java.io.FilterOutputStream { + ctor public Base64OutputStream(java.io.OutputStream, int); + } + + public final deprecated class Config { + field public static final deprecated boolean DEBUG = false; + field public static final deprecated boolean LOGD = true; + field public static final deprecated boolean LOGV = false; + field public static final deprecated boolean PROFILE = false; + field public static final deprecated boolean RELEASE = true; + } + + public class DebugUtils { + method public static boolean isObjectSelected(java.lang.Object); + } + + public class DisplayMetrics { + ctor public DisplayMetrics(); + method public boolean equals(android.util.DisplayMetrics); + method public void setTo(android.util.DisplayMetrics); + method public void setToDefaults(); + field public static final int DENSITY_DEFAULT = 160; // 0xa0 + field public static final int DENSITY_HIGH = 240; // 0xf0 + field public static final int DENSITY_LOW = 120; // 0x78 + field public static final int DENSITY_MEDIUM = 160; // 0xa0 + field public static final int DENSITY_TV = 213; // 0xd5 + field public static final int DENSITY_XHIGH = 320; // 0x140 + field public static final int DENSITY_XXHIGH = 480; // 0x1e0 + field public float density; + field public int densityDpi; + field public int heightPixels; + field public float scaledDensity; + field public int widthPixels; + field public float xdpi; + field public float ydpi; + } + + public class EventLog { + method public static int getTagCode(java.lang.String); + method public static java.lang.String getTagName(int); + method public static void readEvents(int[], java.util.Collection) throws java.io.IOException; + method public static int writeEvent(int, int); + method public static int writeEvent(int, long); + method public static int writeEvent(int, java.lang.String); + method public static int writeEvent(int, java.lang.Object...); + } + + public static final class EventLog.Event { + method public synchronized java.lang.Object getData(); + method public int getProcessId(); + method public int getTag(); + method public int getThreadId(); + method public long getTimeNanos(); + } + + public deprecated class EventLogTags { + ctor public EventLogTags() throws java.io.IOException; + ctor public EventLogTags(java.io.BufferedReader) throws java.io.IOException; + method public android.util.EventLogTags.Description get(java.lang.String); + method public android.util.EventLogTags.Description get(int); + } + + public static class EventLogTags.Description { + field public final java.lang.String mName; + field public final int mTag; + } + + public class FloatMath { + method public static float ceil(float); + method public static float cos(float); + method public static float exp(float); + method public static float floor(float); + method public static float hypot(float, float); + method public static float pow(float, float); + method public static float sin(float); + method public static float sqrt(float); + } + + public final class JsonReader implements java.io.Closeable { + ctor public JsonReader(java.io.Reader); + method public void beginArray() throws java.io.IOException; + method public void beginObject() throws java.io.IOException; + method public void close() throws java.io.IOException; + method public void endArray() throws java.io.IOException; + method public void endObject() throws java.io.IOException; + method public boolean hasNext() throws java.io.IOException; + method public boolean isLenient(); + method public boolean nextBoolean() throws java.io.IOException; + method public double nextDouble() throws java.io.IOException; + method public int nextInt() throws java.io.IOException; + method public long nextLong() throws java.io.IOException; + method public java.lang.String nextName() throws java.io.IOException; + method public void nextNull() throws java.io.IOException; + method public java.lang.String nextString() throws java.io.IOException; + method public android.util.JsonToken peek() throws java.io.IOException; + method public void setLenient(boolean); + method public void skipValue() throws java.io.IOException; + } + + public final class JsonToken extends java.lang.Enum { + method public static android.util.JsonToken valueOf(java.lang.String); + method public static final android.util.JsonToken[] values(); + enum_constant public static final android.util.JsonToken BEGIN_ARRAY; + enum_constant public static final android.util.JsonToken BEGIN_OBJECT; + enum_constant public static final android.util.JsonToken BOOLEAN; + enum_constant public static final android.util.JsonToken END_ARRAY; + enum_constant public static final android.util.JsonToken END_DOCUMENT; + enum_constant public static final android.util.JsonToken END_OBJECT; + enum_constant public static final android.util.JsonToken NAME; + enum_constant public static final android.util.JsonToken NULL; + enum_constant public static final android.util.JsonToken NUMBER; + enum_constant public static final android.util.JsonToken STRING; + } + + public final class JsonWriter implements java.io.Closeable { + ctor public JsonWriter(java.io.Writer); + method public android.util.JsonWriter beginArray() throws java.io.IOException; + method public android.util.JsonWriter beginObject() throws java.io.IOException; + method public void close() throws java.io.IOException; + method public android.util.JsonWriter endArray() throws java.io.IOException; + method public android.util.JsonWriter endObject() throws java.io.IOException; + method public void flush() throws java.io.IOException; + method public boolean isLenient(); + method public android.util.JsonWriter name(java.lang.String) throws java.io.IOException; + method public android.util.JsonWriter nullValue() throws java.io.IOException; + method public void setIndent(java.lang.String); + method public void setLenient(boolean); + method public android.util.JsonWriter value(java.lang.String) throws java.io.IOException; + method public android.util.JsonWriter value(boolean) throws java.io.IOException; + method public android.util.JsonWriter value(double) throws java.io.IOException; + method public android.util.JsonWriter value(long) throws java.io.IOException; + method public android.util.JsonWriter value(java.lang.Number) throws java.io.IOException; + } + + public final class Log { + method public static int d(java.lang.String, java.lang.String); + method public static int d(java.lang.String, java.lang.String, java.lang.Throwable); + method public static int e(java.lang.String, java.lang.String); + method public static int e(java.lang.String, java.lang.String, java.lang.Throwable); + method public static java.lang.String getStackTraceString(java.lang.Throwable); + method public static int i(java.lang.String, java.lang.String); + method public static int i(java.lang.String, java.lang.String, java.lang.Throwable); + method public static boolean isLoggable(java.lang.String, int); + method public static int println(int, java.lang.String, java.lang.String); + method public static int v(java.lang.String, java.lang.String); + method public static int v(java.lang.String, java.lang.String, java.lang.Throwable); + method public static int w(java.lang.String, java.lang.String); + method public static int w(java.lang.String, java.lang.String, java.lang.Throwable); + method public static int w(java.lang.String, java.lang.Throwable); + method public static int wtf(java.lang.String, java.lang.String); + method public static int wtf(java.lang.String, java.lang.Throwable); + method public static int wtf(java.lang.String, java.lang.String, java.lang.Throwable); + field public static final int ASSERT = 7; // 0x7 + field public static final int DEBUG = 3; // 0x3 + field public static final int ERROR = 6; // 0x6 + field public static final int INFO = 4; // 0x4 + field public static final int VERBOSE = 2; // 0x2 + field public static final int WARN = 5; // 0x5 + } + + public class LogPrinter implements android.util.Printer { + ctor public LogPrinter(int, java.lang.String); + method public void println(java.lang.String); + } + + public class LongSparseArray implements java.lang.Cloneable { + ctor public LongSparseArray(); + ctor public LongSparseArray(int); + method public void append(long, E); + method public void clear(); + method public android.util.LongSparseArray clone(); + method public void delete(long); + method public E get(long); + method public E get(long, E); + method public int indexOfKey(long); + method public int indexOfValue(E); + method public long keyAt(int); + method public void put(long, E); + method public void remove(long); + method public void removeAt(int); + method public void setValueAt(int, E); + method public int size(); + method public E valueAt(int); + } + + public class LruCache { + ctor public LruCache(int); + method protected V create(K); + method public final synchronized int createCount(); + method protected void entryRemoved(boolean, K, V, V); + method public final void evictAll(); + method public final synchronized int evictionCount(); + method public final V get(K); + method public final synchronized int hitCount(); + method public final synchronized int maxSize(); + method public final synchronized int missCount(); + method public final V put(K, V); + method public final synchronized int putCount(); + method public final V remove(K); + method public final synchronized int size(); + method protected int sizeOf(K, V); + method public final synchronized java.util.Map snapshot(); + method public final synchronized java.lang.String toString(); + method public void trimToSize(int); + } + + public final class MalformedJsonException extends java.io.IOException { + ctor public MalformedJsonException(java.lang.String); + } + + public class MonthDisplayHelper { + ctor public MonthDisplayHelper(int, int, int); + ctor public MonthDisplayHelper(int, int); + method public int getColumnOf(int); + method public int getDayAt(int, int); + method public int[] getDigitsForRow(int); + method public int getFirstDayOfMonth(); + method public int getMonth(); + method public int getNumberOfDaysInMonth(); + method public int getOffset(); + method public int getRowOf(int); + method public int getWeekStartDay(); + method public int getYear(); + method public boolean isWithinCurrentMonth(int, int); + method public void nextMonth(); + method public void previousMonth(); + } + + public class NoSuchPropertyException extends java.lang.RuntimeException { + ctor public NoSuchPropertyException(java.lang.String); + } + + public class Pair { + ctor public Pair(F, S); + method public static android.util.Pair create(A, B); + field public final F first; + field public final S second; + } + + public class Patterns { + method public static final java.lang.String concatGroups(java.util.regex.Matcher); + method public static final java.lang.String digitsAndPlusOnly(java.util.regex.Matcher); + field public static final java.util.regex.Pattern DOMAIN_NAME; + field public static final java.util.regex.Pattern EMAIL_ADDRESS; + field public static final java.lang.String GOOD_IRI_CHAR = "a-zA-Z0-9\u00a0-\ud7ff\uf900-\ufdcf\ufdf0-\uffef"; + field public static final java.util.regex.Pattern IP_ADDRESS; + field public static final java.util.regex.Pattern PHONE; + field public static final java.util.regex.Pattern TOP_LEVEL_DOMAIN; + field public static final java.lang.String TOP_LEVEL_DOMAIN_STR = "((aero|arpa|asia|a[cdefgilmnoqrstuwxz])|(biz|b[abdefghijmnorstvwyz])|(cat|com|coop|c[acdfghiklmnoruvxyz])|d[ejkmoz]|(edu|e[cegrstu])|f[ijkmor]|(gov|g[abdefghilmnpqrstuwy])|h[kmnrtu]|(info|int|i[delmnoqrst])|(jobs|j[emop])|k[eghimnprwyz]|l[abcikrstuvy]|(mil|mobi|museum|m[acdeghklmnopqrstuvwxyz])|(name|net|n[acefgilopruz])|(org|om)|(pro|p[aefghklmnrstwy])|qa|r[eosuw]|s[abcdeghijklmnortuvyz]|(tel|travel|t[cdfghjklmnoprtvwz])|u[agksyz]|v[aceginu]|w[fs]|(\u03b4\u03bf\u03ba\u03b9\u03bc\u03ae|\u0438\u0441\u043f\u044b\u0442\u0430\u043d\u0438\u0435|\u0440\u0444|\u0441\u0440\u0431|\u05d8\u05e2\u05e1\u05d8|\u0622\u0632\u0645\u0627\u06cc\u0634\u06cc|\u0625\u062e\u062a\u0628\u0627\u0631|\u0627\u0644\u0627\u0631\u062f\u0646|\u0627\u0644\u062c\u0632\u0627\u0626\u0631|\u0627\u0644\u0633\u0639\u0648\u062f\u064a\u0629|\u0627\u0644\u0645\u063a\u0631\u0628|\u0627\u0645\u0627\u0631\u0627\u062a|\u0628\u06be\u0627\u0631\u062a|\u062a\u0648\u0646\u0633|\u0633\u0648\u0631\u064a\u0629|\u0641\u0644\u0633\u0637\u064a\u0646|\u0642\u0637\u0631|\u0645\u0635\u0631|\u092a\u0930\u0940\u0915\u094d\u0937\u093e|\u092d\u093e\u0930\u0924|\u09ad\u09be\u09b0\u09a4|\u0a2d\u0a3e\u0a30\u0a24|\u0aad\u0abe\u0ab0\u0aa4|\u0b87\u0ba8\u0bcd\u0ba4\u0bbf\u0baf\u0bbe|\u0b87\u0bb2\u0b99\u0bcd\u0b95\u0bc8|\u0b9a\u0bbf\u0b99\u0bcd\u0b95\u0baa\u0bcd\u0baa\u0bc2\u0bb0\u0bcd|\u0baa\u0bb0\u0bbf\u0b9f\u0bcd\u0b9a\u0bc8|\u0c2d\u0c3e\u0c30\u0c24\u0c4d|\u0dbd\u0d82\u0d9a\u0dcf|\u0e44\u0e17\u0e22|\u30c6\u30b9\u30c8|\u4e2d\u56fd|\u4e2d\u570b|\u53f0\u6e7e|\u53f0\u7063|\u65b0\u52a0\u5761|\u6d4b\u8bd5|\u6e2c\u8a66|\u9999\u6e2f|\ud14c\uc2a4\ud2b8|\ud55c\uad6d|xn\\-\\-0zwm56d|xn\\-\\-11b5bs3a9aj6g|xn\\-\\-3e0b707e|xn\\-\\-45brj9c|xn\\-\\-80akhbyknj4f|xn\\-\\-90a3ac|xn\\-\\-9t4b11yi5a|xn\\-\\-clchc0ea0b2g2a9gcd|xn\\-\\-deba0ad|xn\\-\\-fiqs8s|xn\\-\\-fiqz9s|xn\\-\\-fpcrj9c3d|xn\\-\\-fzc2c9e2c|xn\\-\\-g6w251d|xn\\-\\-gecrj9c|xn\\-\\-h2brj9c|xn\\-\\-hgbk6aj7f53bba|xn\\-\\-hlcj6aya9esc7a|xn\\-\\-j6w193g|xn\\-\\-jxalpdlp|xn\\-\\-kgbechtv|xn\\-\\-kprw13d|xn\\-\\-kpry57d|xn\\-\\-lgbbat1ad8j|xn\\-\\-mgbaam7a8h|xn\\-\\-mgbayh7gpa|xn\\-\\-mgbbh1a71e|xn\\-\\-mgbc0a9azcg|xn\\-\\-mgberp4a5d4ar|xn\\-\\-o3cw4h|xn\\-\\-ogbpf8fl|xn\\-\\-p1ai|xn\\-\\-pgbs0dh|xn\\-\\-s9brj9c|xn\\-\\-wgbh1c|xn\\-\\-wgbl6a|xn\\-\\-xkc2al3hye2a|xn\\-\\-xkc2dl3a5ee0h|xn\\-\\-yfro4i67o|xn\\-\\-ygbi2ammx|xn\\-\\-zckzah|xxx)|y[et]|z[amw])"; + field public static final java.lang.String TOP_LEVEL_DOMAIN_STR_FOR_WEB_URL = "(?:(?:aero|arpa|asia|a[cdefgilmnoqrstuwxz])|(?:biz|b[abdefghijmnorstvwyz])|(?:cat|com|coop|c[acdfghiklmnoruvxyz])|d[ejkmoz]|(?:edu|e[cegrstu])|f[ijkmor]|(?:gov|g[abdefghilmnpqrstuwy])|h[kmnrtu]|(?:info|int|i[delmnoqrst])|(?:jobs|j[emop])|k[eghimnprwyz]|l[abcikrstuvy]|(?:mil|mobi|museum|m[acdeghklmnopqrstuvwxyz])|(?:name|net|n[acefgilopruz])|(?:org|om)|(?:pro|p[aefghklmnrstwy])|qa|r[eosuw]|s[abcdeghijklmnortuvyz]|(?:tel|travel|t[cdfghjklmnoprtvwz])|u[agksyz]|v[aceginu]|w[fs]|(?:\u03b4\u03bf\u03ba\u03b9\u03bc\u03ae|\u0438\u0441\u043f\u044b\u0442\u0430\u043d\u0438\u0435|\u0440\u0444|\u0441\u0440\u0431|\u05d8\u05e2\u05e1\u05d8|\u0622\u0632\u0645\u0627\u06cc\u0634\u06cc|\u0625\u062e\u062a\u0628\u0627\u0631|\u0627\u0644\u0627\u0631\u062f\u0646|\u0627\u0644\u062c\u0632\u0627\u0626\u0631|\u0627\u0644\u0633\u0639\u0648\u062f\u064a\u0629|\u0627\u0644\u0645\u063a\u0631\u0628|\u0627\u0645\u0627\u0631\u0627\u062a|\u0628\u06be\u0627\u0631\u062a|\u062a\u0648\u0646\u0633|\u0633\u0648\u0631\u064a\u0629|\u0641\u0644\u0633\u0637\u064a\u0646|\u0642\u0637\u0631|\u0645\u0635\u0631|\u092a\u0930\u0940\u0915\u094d\u0937\u093e|\u092d\u093e\u0930\u0924|\u09ad\u09be\u09b0\u09a4|\u0a2d\u0a3e\u0a30\u0a24|\u0aad\u0abe\u0ab0\u0aa4|\u0b87\u0ba8\u0bcd\u0ba4\u0bbf\u0baf\u0bbe|\u0b87\u0bb2\u0b99\u0bcd\u0b95\u0bc8|\u0b9a\u0bbf\u0b99\u0bcd\u0b95\u0baa\u0bcd\u0baa\u0bc2\u0bb0\u0bcd|\u0baa\u0bb0\u0bbf\u0b9f\u0bcd\u0b9a\u0bc8|\u0c2d\u0c3e\u0c30\u0c24\u0c4d|\u0dbd\u0d82\u0d9a\u0dcf|\u0e44\u0e17\u0e22|\u30c6\u30b9\u30c8|\u4e2d\u56fd|\u4e2d\u570b|\u53f0\u6e7e|\u53f0\u7063|\u65b0\u52a0\u5761|\u6d4b\u8bd5|\u6e2c\u8a66|\u9999\u6e2f|\ud14c\uc2a4\ud2b8|\ud55c\uad6d|xn\\-\\-0zwm56d|xn\\-\\-11b5bs3a9aj6g|xn\\-\\-3e0b707e|xn\\-\\-45brj9c|xn\\-\\-80akhbyknj4f|xn\\-\\-90a3ac|xn\\-\\-9t4b11yi5a|xn\\-\\-clchc0ea0b2g2a9gcd|xn\\-\\-deba0ad|xn\\-\\-fiqs8s|xn\\-\\-fiqz9s|xn\\-\\-fpcrj9c3d|xn\\-\\-fzc2c9e2c|xn\\-\\-g6w251d|xn\\-\\-gecrj9c|xn\\-\\-h2brj9c|xn\\-\\-hgbk6aj7f53bba|xn\\-\\-hlcj6aya9esc7a|xn\\-\\-j6w193g|xn\\-\\-jxalpdlp|xn\\-\\-kgbechtv|xn\\-\\-kprw13d|xn\\-\\-kpry57d|xn\\-\\-lgbbat1ad8j|xn\\-\\-mgbaam7a8h|xn\\-\\-mgbayh7gpa|xn\\-\\-mgbbh1a71e|xn\\-\\-mgbc0a9azcg|xn\\-\\-mgberp4a5d4ar|xn\\-\\-o3cw4h|xn\\-\\-ogbpf8fl|xn\\-\\-p1ai|xn\\-\\-pgbs0dh|xn\\-\\-s9brj9c|xn\\-\\-wgbh1c|xn\\-\\-wgbl6a|xn\\-\\-xkc2al3hye2a|xn\\-\\-xkc2dl3a5ee0h|xn\\-\\-yfro4i67o|xn\\-\\-ygbi2ammx|xn\\-\\-zckzah|xxx)|y[et]|z[amw]))"; + field public static final java.util.regex.Pattern WEB_URL; + } + + public class PrintStreamPrinter implements android.util.Printer { + ctor public PrintStreamPrinter(java.io.PrintStream); + method public void println(java.lang.String); + } + + public class PrintWriterPrinter implements android.util.Printer { + ctor public PrintWriterPrinter(java.io.PrintWriter); + method public void println(java.lang.String); + } + + public abstract interface Printer { + method public abstract void println(java.lang.String); + } + + public abstract class Property { + ctor public Property(java.lang.Class, java.lang.String); + method public abstract V get(T); + method public java.lang.String getName(); + method public java.lang.Class getType(); + method public boolean isReadOnly(); + method public static android.util.Property of(java.lang.Class, java.lang.Class, java.lang.String); + method public void set(T, V); + } + + public class SparseArray implements java.lang.Cloneable { + ctor public SparseArray(); + ctor public SparseArray(int); + method public void append(int, E); + method public void clear(); + method public android.util.SparseArray clone(); + method public void delete(int); + method public E get(int); + method public E get(int, E); + method public int indexOfKey(int); + method public int indexOfValue(E); + method public int keyAt(int); + method public void put(int, E); + method public void remove(int); + method public void removeAt(int); + method public void setValueAt(int, E); + method public int size(); + method public E valueAt(int); + } + + public class SparseBooleanArray implements java.lang.Cloneable { + ctor public SparseBooleanArray(); + ctor public SparseBooleanArray(int); + method public void append(int, boolean); + method public void clear(); + method public android.util.SparseBooleanArray clone(); + method public void delete(int); + method public boolean get(int); + method public boolean get(int, boolean); + method public int indexOfKey(int); + method public int indexOfValue(boolean); + method public int keyAt(int); + method public void put(int, boolean); + method public int size(); + method public boolean valueAt(int); + } + + public class SparseIntArray implements java.lang.Cloneable { + ctor public SparseIntArray(); + ctor public SparseIntArray(int); + method public void append(int, int); + method public void clear(); + method public android.util.SparseIntArray clone(); + method public void delete(int); + method public int get(int); + method public int get(int, int); + method public int indexOfKey(int); + method public int indexOfValue(int); + method public int keyAt(int); + method public void put(int, int); + method public void removeAt(int); + method public int size(); + method public int valueAt(int); + } + + public class StateSet { + method public static java.lang.String dump(int[]); + method public static boolean isWildCard(int[]); + method public static boolean stateSetMatches(int[], int[]); + method public static boolean stateSetMatches(int[], int); + method public static int[] trimStateSet(int[], int); + field public static final int[] NOTHING; + field public static final int[] WILD_CARD; + } + + public class StringBuilderPrinter implements android.util.Printer { + ctor public StringBuilderPrinter(java.lang.StringBuilder); + method public void println(java.lang.String); + } + + public class TimeFormatException extends java.lang.RuntimeException { + } + + public class TimeUtils { + method public static java.util.TimeZone getTimeZone(int, boolean, long, java.lang.String); + method public static java.lang.String getTimeZoneDatabaseVersion(); + } + + public class TimingLogger { + ctor public TimingLogger(java.lang.String, java.lang.String); + method public void addSplit(java.lang.String); + method public void dumpToLog(); + method public void reset(java.lang.String, java.lang.String); + method public void reset(); + } + + public class TypedValue { + ctor public TypedValue(); + method public static float applyDimension(int, float, android.util.DisplayMetrics); + method public final java.lang.CharSequence coerceToString(); + method public static final java.lang.String coerceToString(int, int); + method public static float complexToDimension(int, android.util.DisplayMetrics); + method public static float complexToDimensionNoisy(int, android.util.DisplayMetrics); + method public static int complexToDimensionPixelOffset(int, android.util.DisplayMetrics); + method public static int complexToDimensionPixelSize(int, android.util.DisplayMetrics); + method public static float complexToFloat(int); + method public static float complexToFraction(int, float, float); + method public float getDimension(android.util.DisplayMetrics); + method public final float getFloat(); + method public float getFraction(float, float); + method public void setTo(android.util.TypedValue); + field public static final int COMPLEX_MANTISSA_MASK = 16777215; // 0xffffff + field public static final int COMPLEX_MANTISSA_SHIFT = 8; // 0x8 + field public static final int COMPLEX_RADIX_0p23 = 3; // 0x3 + field public static final int COMPLEX_RADIX_16p7 = 1; // 0x1 + field public static final int COMPLEX_RADIX_23p0 = 0; // 0x0 + field public static final int COMPLEX_RADIX_8p15 = 2; // 0x2 + field public static final int COMPLEX_RADIX_MASK = 3; // 0x3 + field public static final int COMPLEX_RADIX_SHIFT = 4; // 0x4 + field public static final int COMPLEX_UNIT_DIP = 1; // 0x1 + field public static final int COMPLEX_UNIT_FRACTION = 0; // 0x0 + field public static final int COMPLEX_UNIT_FRACTION_PARENT = 1; // 0x1 + field public static final int COMPLEX_UNIT_IN = 4; // 0x4 + field public static final int COMPLEX_UNIT_MASK = 15; // 0xf + field public static final int COMPLEX_UNIT_MM = 5; // 0x5 + field public static final int COMPLEX_UNIT_PT = 3; // 0x3 + field public static final int COMPLEX_UNIT_PX = 0; // 0x0 + field public static final int COMPLEX_UNIT_SHIFT = 0; // 0x0 + field public static final int COMPLEX_UNIT_SP = 2; // 0x2 + field public static final int DENSITY_DEFAULT = 0; // 0x0 + field public static final int DENSITY_NONE = 65535; // 0xffff + field public static final int TYPE_ATTRIBUTE = 2; // 0x2 + field public static final int TYPE_DIMENSION = 5; // 0x5 + field public static final int TYPE_FIRST_COLOR_INT = 28; // 0x1c + field public static final int TYPE_FIRST_INT = 16; // 0x10 + field public static final int TYPE_FLOAT = 4; // 0x4 + field public static final int TYPE_FRACTION = 6; // 0x6 + field public static final int TYPE_INT_BOOLEAN = 18; // 0x12 + field public static final int TYPE_INT_COLOR_ARGB4 = 30; // 0x1e + field public static final int TYPE_INT_COLOR_ARGB8 = 28; // 0x1c + field public static final int TYPE_INT_COLOR_RGB4 = 31; // 0x1f + field public static final int TYPE_INT_COLOR_RGB8 = 29; // 0x1d + field public static final int TYPE_INT_DEC = 16; // 0x10 + field public static final int TYPE_INT_HEX = 17; // 0x11 + field public static final int TYPE_LAST_COLOR_INT = 31; // 0x1f + field public static final int TYPE_LAST_INT = 31; // 0x1f + field public static final int TYPE_NULL = 0; // 0x0 + field public static final int TYPE_REFERENCE = 1; // 0x1 + field public static final int TYPE_STRING = 3; // 0x3 + field public int assetCookie; + field public int changingConfigurations; + field public int data; + field public int density; + field public int resourceId; + field public java.lang.CharSequence string; + field public int type; + } + + public class Xml { + method public static android.util.AttributeSet asAttributeSet(org.xmlpull.v1.XmlPullParser); + method public static android.util.Xml.Encoding findEncodingByName(java.lang.String) throws java.io.UnsupportedEncodingException; + method public static org.xmlpull.v1.XmlPullParser newPullParser(); + method public static org.xmlpull.v1.XmlSerializer newSerializer(); + method public static void parse(java.lang.String, org.xml.sax.ContentHandler) throws org.xml.sax.SAXException; + method public static void parse(java.io.Reader, org.xml.sax.ContentHandler) throws java.io.IOException, org.xml.sax.SAXException; + method public static void parse(java.io.InputStream, android.util.Xml.Encoding, org.xml.sax.ContentHandler) throws java.io.IOException, org.xml.sax.SAXException; + field public static java.lang.String FEATURE_RELAXED; + } + + public static final class Xml.Encoding extends java.lang.Enum { + method public static android.util.Xml.Encoding valueOf(java.lang.String); + method public static final android.util.Xml.Encoding[] values(); + enum_constant public static final android.util.Xml.Encoding ISO_8859_1; + enum_constant public static final android.util.Xml.Encoding US_ASCII; + enum_constant public static final android.util.Xml.Encoding UTF_16; + enum_constant public static final android.util.Xml.Encoding UTF_8; + } + +} + +package android.view { + + public abstract class AbsSavedState implements android.os.Parcelable { + ctor protected AbsSavedState(android.os.Parcelable); + ctor protected AbsSavedState(android.os.Parcel); + method public int describeContents(); + method public final android.os.Parcelable getSuperState(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + field public static final android.view.AbsSavedState EMPTY_STATE; + } + + public abstract class ActionMode { + ctor public ActionMode(); + method public abstract void finish(); + method public abstract android.view.View getCustomView(); + method public abstract android.view.Menu getMenu(); + method public abstract android.view.MenuInflater getMenuInflater(); + method public abstract java.lang.CharSequence getSubtitle(); + method public java.lang.Object getTag(); + method public abstract java.lang.CharSequence getTitle(); + method public boolean getTitleOptionalHint(); + method public abstract void invalidate(); + method public boolean isTitleOptional(); + method public abstract void setCustomView(android.view.View); + method public abstract void setSubtitle(java.lang.CharSequence); + method public abstract void setSubtitle(int); + method public void setTag(java.lang.Object); + method public abstract void setTitle(java.lang.CharSequence); + method public abstract void setTitle(int); + method public void setTitleOptionalHint(boolean); + } + + public static abstract interface ActionMode.Callback { + method public abstract boolean onActionItemClicked(android.view.ActionMode, android.view.MenuItem); + method public abstract boolean onCreateActionMode(android.view.ActionMode, android.view.Menu); + method public abstract void onDestroyActionMode(android.view.ActionMode); + method public abstract boolean onPrepareActionMode(android.view.ActionMode, android.view.Menu); + } + + public abstract class ActionProvider { + ctor public ActionProvider(android.content.Context); + method public boolean hasSubMenu(); + method public boolean isVisible(); + method public abstract deprecated android.view.View onCreateActionView(); + method public android.view.View onCreateActionView(android.view.MenuItem); + method public boolean onPerformDefaultAction(); + method public void onPrepareSubMenu(android.view.SubMenu); + method public boolean overridesItemVisibility(); + method public void refreshVisibility(); + method public void setVisibilityListener(android.view.ActionProvider.VisibilityListener); + } + + public static abstract interface ActionProvider.VisibilityListener { + method public abstract void onActionProviderVisibilityChanged(boolean); + } + + public final class Choreographer { + method public static android.view.Choreographer getInstance(); + method public void postFrameCallback(android.view.Choreographer.FrameCallback); + method public void postFrameCallbackDelayed(android.view.Choreographer.FrameCallback, long); + method public void removeFrameCallback(android.view.Choreographer.FrameCallback); + } + + public static abstract interface Choreographer.FrameCallback { + method public abstract void doFrame(long); + } + + public abstract interface CollapsibleActionView { + method public abstract void onActionViewCollapsed(); + method public abstract void onActionViewExpanded(); + } + + public abstract interface ContextMenu implements android.view.Menu { + method public abstract void clearHeader(); + method public abstract android.view.ContextMenu setHeaderIcon(int); + method public abstract android.view.ContextMenu setHeaderIcon(android.graphics.drawable.Drawable); + method public abstract android.view.ContextMenu setHeaderTitle(int); + method public abstract android.view.ContextMenu setHeaderTitle(java.lang.CharSequence); + method public abstract android.view.ContextMenu setHeaderView(android.view.View); + } + + public static abstract interface ContextMenu.ContextMenuInfo { + } + + public class ContextThemeWrapper extends android.content.ContextWrapper { + ctor public ContextThemeWrapper(); + ctor public ContextThemeWrapper(android.content.Context, int); + method public void applyOverrideConfiguration(android.content.res.Configuration); + method protected void onApplyThemeResource(android.content.res.Resources.Theme, int, boolean); + } + + public final class Display { + method public void getCurrentSizeRange(android.graphics.Point, android.graphics.Point); + method public int getDisplayId(); + method public int getFlags(); + method public deprecated int getHeight(); + method public void getMetrics(android.util.DisplayMetrics); + method public java.lang.String getName(); + method public deprecated int getOrientation(); + 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(); + method public void getSize(android.graphics.Point); + method public deprecated int getWidth(); + method public boolean isValid(); + field public static final int DEFAULT_DISPLAY = 0; // 0x0 + field public static final int FLAG_SECURE = 2; // 0x2 + field public static final int FLAG_SUPPORTS_PROTECTED_BUFFERS = 1; // 0x1 + } + + public class DragEvent implements android.os.Parcelable { + method public int describeContents(); + method public int getAction(); + method public android.content.ClipData getClipData(); + method public android.content.ClipDescription getClipDescription(); + method public java.lang.Object getLocalState(); + method public boolean getResult(); + method public float getX(); + method public float getY(); + method public void writeToParcel(android.os.Parcel, int); + field public static final int ACTION_DRAG_ENDED = 4; // 0x4 + field public static final int ACTION_DRAG_ENTERED = 5; // 0x5 + field public static final int ACTION_DRAG_EXITED = 6; // 0x6 + field public static final int ACTION_DRAG_LOCATION = 2; // 0x2 + field public static final int ACTION_DRAG_STARTED = 1; // 0x1 + field public static final int ACTION_DROP = 3; // 0x3 + field public static final android.os.Parcelable.Creator CREATOR; + } + + public class FocusFinder { + method public android.view.View findNearestTouchable(android.view.ViewGroup, int, int, int, int[]); + method public final android.view.View findNextFocus(android.view.ViewGroup, android.view.View, int); + method public android.view.View findNextFocusFromRect(android.view.ViewGroup, android.graphics.Rect, int); + method public static android.view.FocusFinder getInstance(); + } + + public class GestureDetector { + ctor public deprecated GestureDetector(android.view.GestureDetector.OnGestureListener, android.os.Handler); + ctor public deprecated GestureDetector(android.view.GestureDetector.OnGestureListener); + ctor public GestureDetector(android.content.Context, android.view.GestureDetector.OnGestureListener); + ctor public GestureDetector(android.content.Context, android.view.GestureDetector.OnGestureListener, android.os.Handler); + ctor public GestureDetector(android.content.Context, android.view.GestureDetector.OnGestureListener, android.os.Handler, boolean); + method public boolean isLongpressEnabled(); + method public boolean onTouchEvent(android.view.MotionEvent); + method public void setIsLongpressEnabled(boolean); + method public void setOnDoubleTapListener(android.view.GestureDetector.OnDoubleTapListener); + } + + public static abstract interface GestureDetector.OnDoubleTapListener { + method public abstract boolean onDoubleTap(android.view.MotionEvent); + method public abstract boolean onDoubleTapEvent(android.view.MotionEvent); + method public abstract boolean onSingleTapConfirmed(android.view.MotionEvent); + } + + public static abstract interface GestureDetector.OnGestureListener { + method public abstract boolean onDown(android.view.MotionEvent); + method public abstract boolean onFling(android.view.MotionEvent, android.view.MotionEvent, float, float); + method public abstract void onLongPress(android.view.MotionEvent); + method public abstract boolean onScroll(android.view.MotionEvent, android.view.MotionEvent, float, float); + method public abstract void onShowPress(android.view.MotionEvent); + method public abstract boolean onSingleTapUp(android.view.MotionEvent); + } + + public static class GestureDetector.SimpleOnGestureListener implements android.view.GestureDetector.OnDoubleTapListener android.view.GestureDetector.OnGestureListener { + ctor public GestureDetector.SimpleOnGestureListener(); + method public boolean onDoubleTap(android.view.MotionEvent); + method public boolean onDoubleTapEvent(android.view.MotionEvent); + method public boolean onDown(android.view.MotionEvent); + method public boolean onFling(android.view.MotionEvent, android.view.MotionEvent, float, float); + method public void onLongPress(android.view.MotionEvent); + method public boolean onScroll(android.view.MotionEvent, android.view.MotionEvent, float, float); + method public void onShowPress(android.view.MotionEvent); + method public boolean onSingleTapConfirmed(android.view.MotionEvent); + method public boolean onSingleTapUp(android.view.MotionEvent); + } + + public class Gravity { + ctor public Gravity(); + method public static void apply(int, int, int, android.graphics.Rect, android.graphics.Rect); + method public static void apply(int, int, int, android.graphics.Rect, android.graphics.Rect, int); + method public static void apply(int, int, int, android.graphics.Rect, int, int, android.graphics.Rect); + method public static void apply(int, int, int, android.graphics.Rect, int, int, android.graphics.Rect, int); + method public static void applyDisplay(int, android.graphics.Rect, android.graphics.Rect); + method public static void applyDisplay(int, android.graphics.Rect, android.graphics.Rect, int); + method public static int getAbsoluteGravity(int, int); + method public static boolean isHorizontal(int); + method public static boolean isVertical(int); + field public static final int AXIS_CLIP = 8; // 0x8 + field public static final int AXIS_PULL_AFTER = 4; // 0x4 + field public static final int AXIS_PULL_BEFORE = 2; // 0x2 + field public static final int AXIS_SPECIFIED = 1; // 0x1 + field public static final int AXIS_X_SHIFT = 0; // 0x0 + field public static final int AXIS_Y_SHIFT = 4; // 0x4 + field public static final int BOTTOM = 80; // 0x50 + field public static final int CENTER = 17; // 0x11 + field public static final int CENTER_HORIZONTAL = 1; // 0x1 + field public static final int CENTER_VERTICAL = 16; // 0x10 + field public static final int CLIP_HORIZONTAL = 8; // 0x8 + field public static final int CLIP_VERTICAL = 128; // 0x80 + field public static final int DISPLAY_CLIP_HORIZONTAL = 16777216; // 0x1000000 + field public static final int DISPLAY_CLIP_VERTICAL = 268435456; // 0x10000000 + field public static final int END = 8388613; // 0x800005 + field public static final int FILL = 119; // 0x77 + field public static final int FILL_HORIZONTAL = 7; // 0x7 + field public static final int FILL_VERTICAL = 112; // 0x70 + field public static final int HORIZONTAL_GRAVITY_MASK = 7; // 0x7 + field public static final int LEFT = 3; // 0x3 + field public static final int NO_GRAVITY = 0; // 0x0 + field public static final int RELATIVE_HORIZONTAL_GRAVITY_MASK = 8388615; // 0x800007 + field public static final int RELATIVE_LAYOUT_DIRECTION = 8388608; // 0x800000 + field public static final int RIGHT = 5; // 0x5 + field public static final int START = 8388611; // 0x800003 + field public static final int TOP = 48; // 0x30 + field public static final int VERTICAL_GRAVITY_MASK = 112; // 0x70 + } + + public class HapticFeedbackConstants { + field public static final int FLAG_IGNORE_GLOBAL_SETTING = 2; // 0x2 + field public static final int FLAG_IGNORE_VIEW_SETTING = 1; // 0x1 + field public static final int KEYBOARD_TAP = 3; // 0x3 + field public static final int LONG_PRESS = 0; // 0x0 + field public static final int VIRTUAL_KEY = 1; // 0x1 + } + + public class InflateException extends java.lang.RuntimeException { + ctor public InflateException(); + ctor public InflateException(java.lang.String, java.lang.Throwable); + ctor public InflateException(java.lang.String); + ctor public InflateException(java.lang.Throwable); + } + + public final class InputDevice implements android.os.Parcelable { + method public int describeContents(); + method public java.lang.String getDescriptor(); + method public static android.view.InputDevice getDevice(int); + method public static int[] getDeviceIds(); + method public int getId(); + method public android.view.KeyCharacterMap getKeyCharacterMap(); + method public int getKeyboardType(); + method public android.view.InputDevice.MotionRange getMotionRange(int); + method public android.view.InputDevice.MotionRange getMotionRange(int, int); + method public java.util.List getMotionRanges(); + method public java.lang.String getName(); + method public int getSources(); + method public android.os.Vibrator getVibrator(); + method public boolean isVirtual(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + field public static final int KEYBOARD_TYPE_ALPHABETIC = 2; // 0x2 + field public static final int KEYBOARD_TYPE_NONE = 0; // 0x0 + field public static final int KEYBOARD_TYPE_NON_ALPHABETIC = 1; // 0x1 + field public static final deprecated int MOTION_RANGE_ORIENTATION = 8; // 0x8 + field public static final deprecated int MOTION_RANGE_PRESSURE = 2; // 0x2 + field public static final deprecated int MOTION_RANGE_SIZE = 3; // 0x3 + field public static final deprecated int MOTION_RANGE_TOOL_MAJOR = 6; // 0x6 + field public static final deprecated int MOTION_RANGE_TOOL_MINOR = 7; // 0x7 + field public static final deprecated int MOTION_RANGE_TOUCH_MAJOR = 4; // 0x4 + field public static final deprecated int MOTION_RANGE_TOUCH_MINOR = 5; // 0x5 + field public static final deprecated int MOTION_RANGE_X = 0; // 0x0 + field public static final deprecated int MOTION_RANGE_Y = 1; // 0x1 + field public static final int SOURCE_ANY = -256; // 0xffffff00 + field public static final int SOURCE_CLASS_BUTTON = 1; // 0x1 + field public static final int SOURCE_CLASS_JOYSTICK = 16; // 0x10 + field public static final int SOURCE_CLASS_MASK = 255; // 0xff + field public static final int SOURCE_CLASS_POINTER = 2; // 0x2 + field public static final int SOURCE_CLASS_POSITION = 8; // 0x8 + field public static final int SOURCE_CLASS_TRACKBALL = 4; // 0x4 + field public static final int SOURCE_DPAD = 513; // 0x201 + field public static final int SOURCE_GAMEPAD = 1025; // 0x401 + field public static final int SOURCE_JOYSTICK = 16777232; // 0x1000010 + field public static final int SOURCE_KEYBOARD = 257; // 0x101 + field public static final int SOURCE_MOUSE = 8194; // 0x2002 + field public static final int SOURCE_STYLUS = 16386; // 0x4002 + field public static final int SOURCE_TOUCHPAD = 1048584; // 0x100008 + field public static final int SOURCE_TOUCHSCREEN = 4098; // 0x1002 + field public static final int SOURCE_TRACKBALL = 65540; // 0x10004 + field public static final int SOURCE_UNKNOWN = 0; // 0x0 + } + + public static final class InputDevice.MotionRange { + method public int getAxis(); + method public float getFlat(); + method public float getFuzz(); + method public float getMax(); + method public float getMin(); + method public float getRange(); + method public int getSource(); + } + + public abstract class InputEvent implements android.os.Parcelable { + method public int describeContents(); + method public final android.view.InputDevice getDevice(); + method public abstract int getDeviceId(); + method public abstract long getEventTime(); + method public abstract int getSource(); + field public static final android.os.Parcelable.Creator CREATOR; + } + + public final class InputQueue { + } + + public static abstract interface InputQueue.Callback { + method public abstract void onInputQueueCreated(android.view.InputQueue); + method public abstract void onInputQueueDestroyed(android.view.InputQueue); + } + + public class KeyCharacterMap implements android.os.Parcelable { + method public int describeContents(); + method public static boolean deviceHasKey(int); + method public static boolean[] deviceHasKeys(int[]); + method public int get(int, int); + method public static int getDeadChar(int, int); + method public char getDisplayLabel(int); + method public android.view.KeyEvent[] getEvents(char[]); + method public deprecated boolean getKeyData(int, android.view.KeyCharacterMap.KeyData); + method public int getKeyboardType(); + method public char getMatch(int, char[]); + method public char getMatch(int, char[], int); + method public int getModifierBehavior(); + method public char getNumber(int); + method public boolean isPrintingKey(int); + method public static android.view.KeyCharacterMap load(int); + method public void writeToParcel(android.os.Parcel, int); + field public static final int ALPHA = 3; // 0x3 + field public static final deprecated int BUILT_IN_KEYBOARD = 0; // 0x0 + field public static final int COMBINING_ACCENT = -2147483648; // 0x80000000 + field public static final int COMBINING_ACCENT_MASK = 2147483647; // 0x7fffffff + field public static final android.os.Parcelable.Creator CREATOR; + field public static final int FULL = 4; // 0x4 + field public static final char HEX_INPUT = 61184; // 0xef00 '\uef00' + field public static final int MODIFIER_BEHAVIOR_CHORDED = 0; // 0x0 + field public static final int MODIFIER_BEHAVIOR_CHORDED_OR_TOGGLED = 1; // 0x1 + field public static final int NUMERIC = 1; // 0x1 + field public static final char PICKER_DIALOG_INPUT = 61185; // 0xef01 '\uef01' + field public static final int PREDICTIVE = 2; // 0x2 + field public static final int SPECIAL_FUNCTION = 5; // 0x5 + field public static final int VIRTUAL_KEYBOARD = -1; // 0xffffffff + } + + public static deprecated class KeyCharacterMap.KeyData { + ctor public KeyCharacterMap.KeyData(); + field public static final int META_LENGTH = 4; // 0x4 + field public char displayLabel; + field public char[] meta; + field public char number; + } + + public static class KeyCharacterMap.UnavailableException extends android.util.AndroidRuntimeException { + ctor public KeyCharacterMap.UnavailableException(java.lang.String); + } + + public class KeyEvent extends android.view.InputEvent implements android.os.Parcelable { + ctor public KeyEvent(int, int); + ctor public KeyEvent(long, long, int, int, int); + ctor public KeyEvent(long, long, int, int, int, int); + ctor public KeyEvent(long, long, int, int, int, int, int, int); + ctor public KeyEvent(long, long, int, int, int, int, int, int, int); + ctor public KeyEvent(long, long, int, int, int, int, int, int, int, int); + ctor public KeyEvent(long, java.lang.String, int, int); + ctor public KeyEvent(android.view.KeyEvent); + ctor public deprecated KeyEvent(android.view.KeyEvent, long, int); + method public static android.view.KeyEvent changeAction(android.view.KeyEvent, int); + method public static android.view.KeyEvent changeFlags(android.view.KeyEvent, int); + method public static android.view.KeyEvent changeTimeRepeat(android.view.KeyEvent, long, int); + method public static android.view.KeyEvent changeTimeRepeat(android.view.KeyEvent, long, int, int); + method public final deprecated boolean dispatch(android.view.KeyEvent.Callback); + method public final boolean dispatch(android.view.KeyEvent.Callback, android.view.KeyEvent.DispatcherState, java.lang.Object); + method public final int getAction(); + method public final java.lang.String getCharacters(); + method public static int getDeadChar(int, int); + method public final int getDeviceId(); + method public char getDisplayLabel(); + method public final long getDownTime(); + method public final long getEventTime(); + method public final int getFlags(); + method public final android.view.KeyCharacterMap getKeyCharacterMap(); + method public final int getKeyCode(); + method public deprecated boolean getKeyData(android.view.KeyCharacterMap.KeyData); + method public char getMatch(char[]); + method public char getMatch(char[], int); + method public static int getMaxKeyCode(); + method public final int getMetaState(); + method public static int getModifierMetaStateMask(); + method public final int getModifiers(); + method public char getNumber(); + method public final int getRepeatCount(); + method public final int getScanCode(); + method public final int getSource(); + method public int getUnicodeChar(); + method public int getUnicodeChar(int); + method public final boolean hasModifiers(int); + method public final boolean hasNoModifiers(); + method public final boolean isAltPressed(); + method public final boolean isCanceled(); + method public final boolean isCapsLockOn(); + method public final boolean isCtrlPressed(); + method public final boolean isFunctionPressed(); + method public static final boolean isGamepadButton(int); + method public final boolean isLongPress(); + method public final boolean isMetaPressed(); + method public static boolean isModifierKey(int); + method public final boolean isNumLockOn(); + method public boolean isPrintingKey(); + method public final boolean isScrollLockOn(); + method public final boolean isShiftPressed(); + method public final boolean isSymPressed(); + method public final boolean isSystem(); + method public final boolean isTracking(); + method public static int keyCodeFromString(java.lang.String); + method public static java.lang.String keyCodeToString(int); + method public static boolean metaStateHasModifiers(int, int); + method public static boolean metaStateHasNoModifiers(int); + method public static int normalizeMetaState(int); + method public final void setSource(int); + method public final void startTracking(); + method public void writeToParcel(android.os.Parcel, int); + field public static final int ACTION_DOWN = 0; // 0x0 + field public static final int ACTION_MULTIPLE = 2; // 0x2 + field public static final int ACTION_UP = 1; // 0x1 + field public static final android.os.Parcelable.Creator CREATOR; + field public static final int FLAG_CANCELED = 32; // 0x20 + field public static final int FLAG_CANCELED_LONG_PRESS = 256; // 0x100 + field public static final int FLAG_EDITOR_ACTION = 16; // 0x10 + field public static final int FLAG_FALLBACK = 1024; // 0x400 + field public static final int FLAG_FROM_SYSTEM = 8; // 0x8 + field public static final int FLAG_KEEP_TOUCH_MODE = 4; // 0x4 + field public static final int FLAG_LONG_PRESS = 128; // 0x80 + field public static final int FLAG_SOFT_KEYBOARD = 2; // 0x2 + field public static final int FLAG_TRACKING = 512; // 0x200 + field public static final int FLAG_VIRTUAL_HARD_KEY = 64; // 0x40 + field public static final int FLAG_WOKE_HERE = 1; // 0x1 + field public static final int KEYCODE_0 = 7; // 0x7 + field public static final int KEYCODE_1 = 8; // 0x8 + field public static final int KEYCODE_2 = 9; // 0x9 + field public static final int KEYCODE_3 = 10; // 0xa + field public static final int KEYCODE_3D_MODE = 206; // 0xce + field public static final int KEYCODE_4 = 11; // 0xb + field public static final int KEYCODE_5 = 12; // 0xc + field public static final int KEYCODE_6 = 13; // 0xd + field public static final int KEYCODE_7 = 14; // 0xe + field public static final int KEYCODE_8 = 15; // 0xf + field public static final int KEYCODE_9 = 16; // 0x10 + field public static final int KEYCODE_A = 29; // 0x1d + field public static final int KEYCODE_ALT_LEFT = 57; // 0x39 + field public static final int KEYCODE_ALT_RIGHT = 58; // 0x3a + field public static final int KEYCODE_APOSTROPHE = 75; // 0x4b + field public static final int KEYCODE_APP_SWITCH = 187; // 0xbb + field public static final int KEYCODE_ASSIST = 219; // 0xdb + field public static final int KEYCODE_AT = 77; // 0x4d + field public static final int KEYCODE_AVR_INPUT = 182; // 0xb6 + field public static final int KEYCODE_AVR_POWER = 181; // 0xb5 + field public static final int KEYCODE_B = 30; // 0x1e + field public static final int KEYCODE_BACK = 4; // 0x4 + field public static final int KEYCODE_BACKSLASH = 73; // 0x49 + field public static final int KEYCODE_BOOKMARK = 174; // 0xae + field public static final int KEYCODE_BREAK = 121; // 0x79 + field public static final int KEYCODE_BUTTON_1 = 188; // 0xbc + field public static final int KEYCODE_BUTTON_10 = 197; // 0xc5 + field public static final int KEYCODE_BUTTON_11 = 198; // 0xc6 + field public static final int KEYCODE_BUTTON_12 = 199; // 0xc7 + field public static final int KEYCODE_BUTTON_13 = 200; // 0xc8 + field public static final int KEYCODE_BUTTON_14 = 201; // 0xc9 + field public static final int KEYCODE_BUTTON_15 = 202; // 0xca + field public static final int KEYCODE_BUTTON_16 = 203; // 0xcb + field public static final int KEYCODE_BUTTON_2 = 189; // 0xbd + field public static final int KEYCODE_BUTTON_3 = 190; // 0xbe + field public static final int KEYCODE_BUTTON_4 = 191; // 0xbf + field public static final int KEYCODE_BUTTON_5 = 192; // 0xc0 + field public static final int KEYCODE_BUTTON_6 = 193; // 0xc1 + field public static final int KEYCODE_BUTTON_7 = 194; // 0xc2 + field public static final int KEYCODE_BUTTON_8 = 195; // 0xc3 + field public static final int KEYCODE_BUTTON_9 = 196; // 0xc4 + field public static final int KEYCODE_BUTTON_A = 96; // 0x60 + field public static final int KEYCODE_BUTTON_B = 97; // 0x61 + field public static final int KEYCODE_BUTTON_C = 98; // 0x62 + field public static final int KEYCODE_BUTTON_L1 = 102; // 0x66 + field public static final int KEYCODE_BUTTON_L2 = 104; // 0x68 + field public static final int KEYCODE_BUTTON_MODE = 110; // 0x6e + field public static final int KEYCODE_BUTTON_R1 = 103; // 0x67 + field public static final int KEYCODE_BUTTON_R2 = 105; // 0x69 + field public static final int KEYCODE_BUTTON_SELECT = 109; // 0x6d + field public static final int KEYCODE_BUTTON_START = 108; // 0x6c + field public static final int KEYCODE_BUTTON_THUMBL = 106; // 0x6a + field public static final int KEYCODE_BUTTON_THUMBR = 107; // 0x6b + field public static final int KEYCODE_BUTTON_X = 99; // 0x63 + field public static final int KEYCODE_BUTTON_Y = 100; // 0x64 + field public static final int KEYCODE_BUTTON_Z = 101; // 0x65 + field public static final int KEYCODE_C = 31; // 0x1f + field public static final int KEYCODE_CALCULATOR = 210; // 0xd2 + field public static final int KEYCODE_CALENDAR = 208; // 0xd0 + field public static final int KEYCODE_CALL = 5; // 0x5 + field public static final int KEYCODE_CAMERA = 27; // 0x1b + field public static final int KEYCODE_CAPS_LOCK = 115; // 0x73 + field public static final int KEYCODE_CAPTIONS = 175; // 0xaf + field public static final int KEYCODE_CHANNEL_DOWN = 167; // 0xa7 + field public static final int KEYCODE_CHANNEL_UP = 166; // 0xa6 + field public static final int KEYCODE_CLEAR = 28; // 0x1c + field public static final int KEYCODE_COMMA = 55; // 0x37 + field public static final int KEYCODE_CONTACTS = 207; // 0xcf + field public static final int KEYCODE_CTRL_LEFT = 113; // 0x71 + field public static final int KEYCODE_CTRL_RIGHT = 114; // 0x72 + field public static final int KEYCODE_D = 32; // 0x20 + field public static final int KEYCODE_DEL = 67; // 0x43 + field public static final int KEYCODE_DPAD_CENTER = 23; // 0x17 + field public static final int KEYCODE_DPAD_DOWN = 20; // 0x14 + field public static final int KEYCODE_DPAD_LEFT = 21; // 0x15 + field public static final int KEYCODE_DPAD_RIGHT = 22; // 0x16 + field public static final int KEYCODE_DPAD_UP = 19; // 0x13 + field public static final int KEYCODE_DVR = 173; // 0xad + field public static final int KEYCODE_E = 33; // 0x21 + field public static final int KEYCODE_EISU = 212; // 0xd4 + field public static final int KEYCODE_ENDCALL = 6; // 0x6 + field public static final int KEYCODE_ENTER = 66; // 0x42 + field public static final int KEYCODE_ENVELOPE = 65; // 0x41 + field public static final int KEYCODE_EQUALS = 70; // 0x46 + field public static final int KEYCODE_ESCAPE = 111; // 0x6f + field public static final int KEYCODE_EXPLORER = 64; // 0x40 + field public static final int KEYCODE_F = 34; // 0x22 + field public static final int KEYCODE_F1 = 131; // 0x83 + field public static final int KEYCODE_F10 = 140; // 0x8c + field public static final int KEYCODE_F11 = 141; // 0x8d + field public static final int KEYCODE_F12 = 142; // 0x8e + field public static final int KEYCODE_F2 = 132; // 0x84 + field public static final int KEYCODE_F3 = 133; // 0x85 + field public static final int KEYCODE_F4 = 134; // 0x86 + field public static final int KEYCODE_F5 = 135; // 0x87 + field public static final int KEYCODE_F6 = 136; // 0x88 + field public static final int KEYCODE_F7 = 137; // 0x89 + field public static final int KEYCODE_F8 = 138; // 0x8a + field public static final int KEYCODE_F9 = 139; // 0x8b + field public static final int KEYCODE_FOCUS = 80; // 0x50 + field public static final int KEYCODE_FORWARD = 125; // 0x7d + field public static final int KEYCODE_FORWARD_DEL = 112; // 0x70 + field public static final int KEYCODE_FUNCTION = 119; // 0x77 + field public static final int KEYCODE_G = 35; // 0x23 + field public static final int KEYCODE_GRAVE = 68; // 0x44 + field public static final int KEYCODE_GUIDE = 172; // 0xac + field public static final int KEYCODE_H = 36; // 0x24 + field public static final int KEYCODE_HEADSETHOOK = 79; // 0x4f + field public static final int KEYCODE_HENKAN = 214; // 0xd6 + field public static final int KEYCODE_HOME = 3; // 0x3 + field public static final int KEYCODE_I = 37; // 0x25 + field public static final int KEYCODE_INFO = 165; // 0xa5 + field public static final int KEYCODE_INSERT = 124; // 0x7c + field public static final int KEYCODE_J = 38; // 0x26 + field public static final int KEYCODE_K = 39; // 0x27 + field public static final int KEYCODE_KANA = 218; // 0xda + field public static final int KEYCODE_KATAKANA_HIRAGANA = 215; // 0xd7 + field public static final int KEYCODE_L = 40; // 0x28 + field public static final int KEYCODE_LANGUAGE_SWITCH = 204; // 0xcc + field public static final int KEYCODE_LEFT_BRACKET = 71; // 0x47 + field public static final int KEYCODE_M = 41; // 0x29 + field public static final int KEYCODE_MANNER_MODE = 205; // 0xcd + field public static final int KEYCODE_MEDIA_CLOSE = 128; // 0x80 + field public static final int KEYCODE_MEDIA_EJECT = 129; // 0x81 + field public static final int KEYCODE_MEDIA_FAST_FORWARD = 90; // 0x5a + field public static final int KEYCODE_MEDIA_NEXT = 87; // 0x57 + field public static final int KEYCODE_MEDIA_PAUSE = 127; // 0x7f + field public static final int KEYCODE_MEDIA_PLAY = 126; // 0x7e + field public static final int KEYCODE_MEDIA_PLAY_PAUSE = 85; // 0x55 + field public static final int KEYCODE_MEDIA_PREVIOUS = 88; // 0x58 + field public static final int KEYCODE_MEDIA_RECORD = 130; // 0x82 + field public static final int KEYCODE_MEDIA_REWIND = 89; // 0x59 + field public static final int KEYCODE_MEDIA_STOP = 86; // 0x56 + field public static final int KEYCODE_MENU = 82; // 0x52 + field public static final int KEYCODE_META_LEFT = 117; // 0x75 + field public static final int KEYCODE_META_RIGHT = 118; // 0x76 + field public static final int KEYCODE_MINUS = 69; // 0x45 + field public static final int KEYCODE_MOVE_END = 123; // 0x7b + field public static final int KEYCODE_MOVE_HOME = 122; // 0x7a + field public static final int KEYCODE_MUHENKAN = 213; // 0xd5 + field public static final int KEYCODE_MUSIC = 209; // 0xd1 + field public static final int KEYCODE_MUTE = 91; // 0x5b + field public static final int KEYCODE_N = 42; // 0x2a + field public static final int KEYCODE_NOTIFICATION = 83; // 0x53 + field public static final int KEYCODE_NUM = 78; // 0x4e + field public static final int KEYCODE_NUMPAD_0 = 144; // 0x90 + field public static final int KEYCODE_NUMPAD_1 = 145; // 0x91 + field public static final int KEYCODE_NUMPAD_2 = 146; // 0x92 + field public static final int KEYCODE_NUMPAD_3 = 147; // 0x93 + field public static final int KEYCODE_NUMPAD_4 = 148; // 0x94 + field public static final int KEYCODE_NUMPAD_5 = 149; // 0x95 + field public static final int KEYCODE_NUMPAD_6 = 150; // 0x96 + field public static final int KEYCODE_NUMPAD_7 = 151; // 0x97 + field public static final int KEYCODE_NUMPAD_8 = 152; // 0x98 + field public static final int KEYCODE_NUMPAD_9 = 153; // 0x99 + field public static final int KEYCODE_NUMPAD_ADD = 157; // 0x9d + field public static final int KEYCODE_NUMPAD_COMMA = 159; // 0x9f + field public static final int KEYCODE_NUMPAD_DIVIDE = 154; // 0x9a + field public static final int KEYCODE_NUMPAD_DOT = 158; // 0x9e + field public static final int KEYCODE_NUMPAD_ENTER = 160; // 0xa0 + field public static final int KEYCODE_NUMPAD_EQUALS = 161; // 0xa1 + field public static final int KEYCODE_NUMPAD_LEFT_PAREN = 162; // 0xa2 + field public static final int KEYCODE_NUMPAD_MULTIPLY = 155; // 0x9b + field public static final int KEYCODE_NUMPAD_RIGHT_PAREN = 163; // 0xa3 + field public static final int KEYCODE_NUMPAD_SUBTRACT = 156; // 0x9c + field public static final int KEYCODE_NUM_LOCK = 143; // 0x8f + field public static final int KEYCODE_O = 43; // 0x2b + field public static final int KEYCODE_P = 44; // 0x2c + field public static final int KEYCODE_PAGE_DOWN = 93; // 0x5d + field public static final int KEYCODE_PAGE_UP = 92; // 0x5c + field public static final int KEYCODE_PERIOD = 56; // 0x38 + field public static final int KEYCODE_PICTSYMBOLS = 94; // 0x5e + field public static final int KEYCODE_PLUS = 81; // 0x51 + field public static final int KEYCODE_POUND = 18; // 0x12 + field public static final int KEYCODE_POWER = 26; // 0x1a + field public static final int KEYCODE_PROG_BLUE = 186; // 0xba + field public static final int KEYCODE_PROG_GREEN = 184; // 0xb8 + field public static final int KEYCODE_PROG_RED = 183; // 0xb7 + field public static final int KEYCODE_PROG_YELLOW = 185; // 0xb9 + field public static final int KEYCODE_Q = 45; // 0x2d + field public static final int KEYCODE_R = 46; // 0x2e + field public static final int KEYCODE_RIGHT_BRACKET = 72; // 0x48 + field public static final int KEYCODE_RO = 217; // 0xd9 + field public static final int KEYCODE_S = 47; // 0x2f + field public static final int KEYCODE_SCROLL_LOCK = 116; // 0x74 + field public static final int KEYCODE_SEARCH = 84; // 0x54 + field public static final int KEYCODE_SEMICOLON = 74; // 0x4a + field public static final int KEYCODE_SETTINGS = 176; // 0xb0 + field public static final int KEYCODE_SHIFT_LEFT = 59; // 0x3b + field public static final int KEYCODE_SHIFT_RIGHT = 60; // 0x3c + field public static final int KEYCODE_SLASH = 76; // 0x4c + field public static final int KEYCODE_SOFT_LEFT = 1; // 0x1 + field public static final int KEYCODE_SOFT_RIGHT = 2; // 0x2 + field public static final int KEYCODE_SPACE = 62; // 0x3e + field public static final int KEYCODE_STAR = 17; // 0x11 + field public static final int KEYCODE_STB_INPUT = 180; // 0xb4 + field public static final int KEYCODE_STB_POWER = 179; // 0xb3 + field public static final int KEYCODE_SWITCH_CHARSET = 95; // 0x5f + field public static final int KEYCODE_SYM = 63; // 0x3f + field public static final int KEYCODE_SYSRQ = 120; // 0x78 + field public static final int KEYCODE_T = 48; // 0x30 + field public static final int KEYCODE_TAB = 61; // 0x3d + field public static final int KEYCODE_TV = 170; // 0xaa + field public static final int KEYCODE_TV_INPUT = 178; // 0xb2 + field public static final int KEYCODE_TV_POWER = 177; // 0xb1 + field public static final int KEYCODE_U = 49; // 0x31 + field public static final int KEYCODE_UNKNOWN = 0; // 0x0 + field public static final int KEYCODE_V = 50; // 0x32 + field public static final int KEYCODE_VOLUME_DOWN = 25; // 0x19 + field public static final int KEYCODE_VOLUME_MUTE = 164; // 0xa4 + field public static final int KEYCODE_VOLUME_UP = 24; // 0x18 + field public static final int KEYCODE_W = 51; // 0x33 + field public static final int KEYCODE_WINDOW = 171; // 0xab + field public static final int KEYCODE_X = 52; // 0x34 + field public static final int KEYCODE_Y = 53; // 0x35 + field public static final int KEYCODE_YEN = 216; // 0xd8 + field public static final int KEYCODE_Z = 54; // 0x36 + field public static final int KEYCODE_ZENKAKU_HANKAKU = 211; // 0xd3 + field public static final int KEYCODE_ZOOM_IN = 168; // 0xa8 + field public static final int KEYCODE_ZOOM_OUT = 169; // 0xa9 + field public static final deprecated int MAX_KEYCODE = 84; // 0x54 + field public static final int META_ALT_LEFT_ON = 16; // 0x10 + field public static final int META_ALT_MASK = 50; // 0x32 + field public static final int META_ALT_ON = 2; // 0x2 + field public static final int META_ALT_RIGHT_ON = 32; // 0x20 + field public static final int META_CAPS_LOCK_ON = 1048576; // 0x100000 + field public static final int META_CTRL_LEFT_ON = 8192; // 0x2000 + field public static final int META_CTRL_MASK = 28672; // 0x7000 + field public static final int META_CTRL_ON = 4096; // 0x1000 + field public static final int META_CTRL_RIGHT_ON = 16384; // 0x4000 + field public static final int META_FUNCTION_ON = 8; // 0x8 + field public static final int META_META_LEFT_ON = 131072; // 0x20000 + field public static final int META_META_MASK = 458752; // 0x70000 + field public static final int META_META_ON = 65536; // 0x10000 + field public static final int META_META_RIGHT_ON = 262144; // 0x40000 + field public static final int META_NUM_LOCK_ON = 2097152; // 0x200000 + field public static final int META_SCROLL_LOCK_ON = 4194304; // 0x400000 + field public static final int META_SHIFT_LEFT_ON = 64; // 0x40 + field public static final int META_SHIFT_MASK = 193; // 0xc1 + field public static final int META_SHIFT_ON = 1; // 0x1 + field public static final int META_SHIFT_RIGHT_ON = 128; // 0x80 + field public static final int META_SYM_ON = 4; // 0x4 + } + + public static abstract interface KeyEvent.Callback { + method public abstract boolean onKeyDown(int, android.view.KeyEvent); + method public abstract boolean onKeyLongPress(int, android.view.KeyEvent); + method public abstract boolean onKeyMultiple(int, int, android.view.KeyEvent); + method public abstract boolean onKeyUp(int, android.view.KeyEvent); + } + + public static class KeyEvent.DispatcherState { + ctor public KeyEvent.DispatcherState(); + method public void handleUpEvent(android.view.KeyEvent); + method public boolean isTracking(android.view.KeyEvent); + method public void performedLongPress(android.view.KeyEvent); + method public void reset(); + method public void reset(java.lang.Object); + method public void startTracking(android.view.KeyEvent, java.lang.Object); + } + + public abstract class LayoutInflater { + ctor protected LayoutInflater(android.content.Context); + ctor protected LayoutInflater(android.view.LayoutInflater, android.content.Context); + method public abstract android.view.LayoutInflater cloneInContext(android.content.Context); + method public final android.view.View createView(java.lang.String, java.lang.String, android.util.AttributeSet) throws java.lang.ClassNotFoundException, android.view.InflateException; + method public static android.view.LayoutInflater from(android.content.Context); + method public android.content.Context getContext(); + method public final android.view.LayoutInflater.Factory getFactory(); + method public final android.view.LayoutInflater.Factory2 getFactory2(); + method public android.view.LayoutInflater.Filter getFilter(); + method public android.view.View inflate(int, android.view.ViewGroup); + method public android.view.View inflate(org.xmlpull.v1.XmlPullParser, android.view.ViewGroup); + method public android.view.View inflate(int, android.view.ViewGroup, boolean); + method public android.view.View inflate(org.xmlpull.v1.XmlPullParser, android.view.ViewGroup, boolean); + method protected android.view.View onCreateView(java.lang.String, android.util.AttributeSet) throws java.lang.ClassNotFoundException; + method protected android.view.View onCreateView(android.view.View, java.lang.String, android.util.AttributeSet) throws java.lang.ClassNotFoundException; + method public void setFactory(android.view.LayoutInflater.Factory); + method public void setFactory2(android.view.LayoutInflater.Factory2); + method public void setFilter(android.view.LayoutInflater.Filter); + } + + public static abstract interface LayoutInflater.Factory { + method public abstract android.view.View onCreateView(java.lang.String, android.content.Context, android.util.AttributeSet); + } + + public static abstract interface LayoutInflater.Factory2 implements android.view.LayoutInflater.Factory { + method public abstract android.view.View onCreateView(android.view.View, java.lang.String, android.content.Context, android.util.AttributeSet); + } + + public static abstract interface LayoutInflater.Filter { + method public abstract boolean onLoadClass(java.lang.Class); + } + + public abstract interface Menu { + method public abstract android.view.MenuItem add(java.lang.CharSequence); + method public abstract android.view.MenuItem add(int); + method public abstract android.view.MenuItem add(int, int, int, java.lang.CharSequence); + method public abstract android.view.MenuItem add(int, int, int, int); + method public abstract int addIntentOptions(int, int, int, android.content.ComponentName, android.content.Intent[], android.content.Intent, int, android.view.MenuItem[]); + method public abstract android.view.SubMenu addSubMenu(java.lang.CharSequence); + method public abstract android.view.SubMenu addSubMenu(int); + method public abstract android.view.SubMenu addSubMenu(int, int, int, java.lang.CharSequence); + method public abstract android.view.SubMenu addSubMenu(int, int, int, int); + method public abstract void clear(); + method public abstract void close(); + method public abstract android.view.MenuItem findItem(int); + method public abstract android.view.MenuItem getItem(int); + method public abstract boolean hasVisibleItems(); + method public abstract boolean isShortcutKey(int, android.view.KeyEvent); + method public abstract boolean performIdentifierAction(int, int); + method public abstract boolean performShortcut(int, android.view.KeyEvent, int); + method public abstract void removeGroup(int); + method public abstract void removeItem(int); + method public abstract void setGroupCheckable(int, boolean, boolean); + method public abstract void setGroupEnabled(int, boolean); + method public abstract void setGroupVisible(int, boolean); + method public abstract void setQwertyMode(boolean); + method public abstract int size(); + field public static final int CATEGORY_ALTERNATIVE = 262144; // 0x40000 + field public static final int CATEGORY_CONTAINER = 65536; // 0x10000 + field public static final int CATEGORY_SECONDARY = 196608; // 0x30000 + field public static final int CATEGORY_SYSTEM = 131072; // 0x20000 + field public static final int FIRST = 1; // 0x1 + field public static final int FLAG_ALWAYS_PERFORM_CLOSE = 2; // 0x2 + field public static final int FLAG_APPEND_TO_GROUP = 1; // 0x1 + field public static final int FLAG_PERFORM_NO_CLOSE = 1; // 0x1 + field public static final int NONE = 0; // 0x0 + } + + public class MenuInflater { + ctor public MenuInflater(android.content.Context); + method public void inflate(int, android.view.Menu); + } + + public abstract interface MenuItem { + method public abstract boolean collapseActionView(); + method public abstract boolean expandActionView(); + method public abstract android.view.ActionProvider getActionProvider(); + method public abstract android.view.View getActionView(); + method public abstract char getAlphabeticShortcut(); + method public abstract int getGroupId(); + method public abstract android.graphics.drawable.Drawable getIcon(); + method public abstract android.content.Intent getIntent(); + method public abstract int getItemId(); + method public abstract android.view.ContextMenu.ContextMenuInfo getMenuInfo(); + method public abstract char getNumericShortcut(); + method public abstract int getOrder(); + method public abstract android.view.SubMenu getSubMenu(); + method public abstract java.lang.CharSequence getTitle(); + method public abstract java.lang.CharSequence getTitleCondensed(); + method public abstract boolean hasSubMenu(); + method public abstract boolean isActionViewExpanded(); + method public abstract boolean isCheckable(); + method public abstract boolean isChecked(); + method public abstract boolean isEnabled(); + method public abstract boolean isVisible(); + method public abstract android.view.MenuItem setActionProvider(android.view.ActionProvider); + method public abstract android.view.MenuItem setActionView(android.view.View); + method public abstract android.view.MenuItem setActionView(int); + method public abstract android.view.MenuItem setAlphabeticShortcut(char); + method public abstract android.view.MenuItem setCheckable(boolean); + method public abstract android.view.MenuItem setChecked(boolean); + method public abstract android.view.MenuItem setEnabled(boolean); + method public abstract android.view.MenuItem setIcon(android.graphics.drawable.Drawable); + method public abstract android.view.MenuItem setIcon(int); + method public abstract android.view.MenuItem setIntent(android.content.Intent); + method public abstract android.view.MenuItem setNumericShortcut(char); + method public abstract android.view.MenuItem setOnActionExpandListener(android.view.MenuItem.OnActionExpandListener); + method public abstract android.view.MenuItem setOnMenuItemClickListener(android.view.MenuItem.OnMenuItemClickListener); + method public abstract android.view.MenuItem setShortcut(char, char); + method public abstract void setShowAsAction(int); + method public abstract android.view.MenuItem setShowAsActionFlags(int); + method public abstract android.view.MenuItem setTitle(java.lang.CharSequence); + method public abstract android.view.MenuItem setTitle(int); + method public abstract android.view.MenuItem setTitleCondensed(java.lang.CharSequence); + method public abstract android.view.MenuItem setVisible(boolean); + field public static final int SHOW_AS_ACTION_ALWAYS = 2; // 0x2 + field public static final int SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW = 8; // 0x8 + field public static final int SHOW_AS_ACTION_IF_ROOM = 1; // 0x1 + field public static final int SHOW_AS_ACTION_NEVER = 0; // 0x0 + field public static final int SHOW_AS_ACTION_WITH_TEXT = 4; // 0x4 + } + + public static abstract interface MenuItem.OnActionExpandListener { + method public abstract boolean onMenuItemActionCollapse(android.view.MenuItem); + method public abstract boolean onMenuItemActionExpand(android.view.MenuItem); + } + + public static abstract interface MenuItem.OnMenuItemClickListener { + method public abstract boolean onMenuItemClick(android.view.MenuItem); + } + + public final class MotionEvent extends android.view.InputEvent implements android.os.Parcelable { + method public final void addBatch(long, float, float, float, float, int); + method public final void addBatch(long, android.view.MotionEvent.PointerCoords[], int); + method public static int axisFromString(java.lang.String); + method public static java.lang.String axisToString(int); + method public final int findPointerIndex(int); + method public final int getAction(); + method public final int getActionIndex(); + method public final int getActionMasked(); + method public final float getAxisValue(int); + method public final float getAxisValue(int, int); + method public final int getButtonState(); + method public final int getDeviceId(); + method public final long getDownTime(); + method public final int getEdgeFlags(); + method public final long getEventTime(); + method public final int getFlags(); + method public final float getHistoricalAxisValue(int, int); + method public final float getHistoricalAxisValue(int, int, int); + method public final long getHistoricalEventTime(int); + method public final float getHistoricalOrientation(int); + method public final float getHistoricalOrientation(int, int); + method public final void getHistoricalPointerCoords(int, int, android.view.MotionEvent.PointerCoords); + method public final float getHistoricalPressure(int); + method public final float getHistoricalPressure(int, int); + method public final float getHistoricalSize(int); + method public final float getHistoricalSize(int, int); + method public final float getHistoricalToolMajor(int); + method public final float getHistoricalToolMajor(int, int); + method public final float getHistoricalToolMinor(int); + method public final float getHistoricalToolMinor(int, int); + method public final float getHistoricalTouchMajor(int); + method public final float getHistoricalTouchMajor(int, int); + method public final float getHistoricalTouchMinor(int); + method public final float getHistoricalTouchMinor(int, int); + method public final float getHistoricalX(int); + method public final float getHistoricalX(int, int); + method public final float getHistoricalY(int); + method public final float getHistoricalY(int, int); + method public final int getHistorySize(); + method public final int getMetaState(); + method public final float getOrientation(); + method public final float getOrientation(int); + method public final void getPointerCoords(int, android.view.MotionEvent.PointerCoords); + method public final int getPointerCount(); + method public final int getPointerId(int); + method public final void getPointerProperties(int, android.view.MotionEvent.PointerProperties); + method public final float getPressure(); + method public final float getPressure(int); + method public final float getRawX(); + method public final float getRawY(); + method public final float getSize(); + method public final float getSize(int); + method public final int getSource(); + method public final float getToolMajor(); + method public final float getToolMajor(int); + method public final float getToolMinor(); + method public final float getToolMinor(int); + method public final int getToolType(int); + method public final float getTouchMajor(); + method public final float getTouchMajor(int); + method public final float getTouchMinor(); + method public final float getTouchMinor(int); + method public final float getX(); + method public final float getX(int); + method public final float getXPrecision(); + method public final float getY(); + method public final float getY(int); + method public final float getYPrecision(); + method public static android.view.MotionEvent obtain(long, long, int, int, android.view.MotionEvent.PointerProperties[], android.view.MotionEvent.PointerCoords[], int, int, float, float, int, int, int, int); + method public static deprecated android.view.MotionEvent obtain(long, long, int, int, int[], android.view.MotionEvent.PointerCoords[], int, float, float, int, int, int, int); + method public static android.view.MotionEvent obtain(long, long, int, float, float, float, float, int, float, float, int, int); + method public static deprecated android.view.MotionEvent obtain(long, long, int, int, float, float, float, float, int, float, float, int, int); + method public static android.view.MotionEvent obtain(long, long, int, float, float, int); + method public static android.view.MotionEvent obtain(android.view.MotionEvent); + method public static android.view.MotionEvent obtainNoHistory(android.view.MotionEvent); + method public final void offsetLocation(float, float); + method public final void recycle(); + method public final void setAction(int); + method public final void setEdgeFlags(int); + method public final void setLocation(float, float); + method public final void setSource(int); + method public final void transform(android.graphics.Matrix); + method public void writeToParcel(android.os.Parcel, int); + field public static final int ACTION_CANCEL = 3; // 0x3 + field public static final int ACTION_DOWN = 0; // 0x0 + field public static final int ACTION_HOVER_ENTER = 9; // 0x9 + field public static final int ACTION_HOVER_EXIT = 10; // 0xa + field public static final int ACTION_HOVER_MOVE = 7; // 0x7 + field public static final int ACTION_MASK = 255; // 0xff + field public static final int ACTION_MOVE = 2; // 0x2 + field public static final int ACTION_OUTSIDE = 4; // 0x4 + field public static final deprecated int ACTION_POINTER_1_DOWN = 5; // 0x5 + field public static final deprecated int ACTION_POINTER_1_UP = 6; // 0x6 + field public static final deprecated int ACTION_POINTER_2_DOWN = 261; // 0x105 + field public static final deprecated int ACTION_POINTER_2_UP = 262; // 0x106 + field public static final deprecated int ACTION_POINTER_3_DOWN = 517; // 0x205 + field public static final deprecated int ACTION_POINTER_3_UP = 518; // 0x206 + field public static final int ACTION_POINTER_DOWN = 5; // 0x5 + field public static final deprecated int ACTION_POINTER_ID_MASK = 65280; // 0xff00 + field public static final deprecated int ACTION_POINTER_ID_SHIFT = 8; // 0x8 + field public static final int ACTION_POINTER_INDEX_MASK = 65280; // 0xff00 + field public static final int ACTION_POINTER_INDEX_SHIFT = 8; // 0x8 + field public static final int ACTION_POINTER_UP = 6; // 0x6 + field public static final int ACTION_SCROLL = 8; // 0x8 + field public static final int ACTION_UP = 1; // 0x1 + field public static final int AXIS_BRAKE = 23; // 0x17 + field public static final int AXIS_DISTANCE = 24; // 0x18 + field public static final int AXIS_GAS = 22; // 0x16 + field public static final int AXIS_GENERIC_1 = 32; // 0x20 + field public static final int AXIS_GENERIC_10 = 41; // 0x29 + field public static final int AXIS_GENERIC_11 = 42; // 0x2a + field public static final int AXIS_GENERIC_12 = 43; // 0x2b + field public static final int AXIS_GENERIC_13 = 44; // 0x2c + field public static final int AXIS_GENERIC_14 = 45; // 0x2d + field public static final int AXIS_GENERIC_15 = 46; // 0x2e + field public static final int AXIS_GENERIC_16 = 47; // 0x2f + field public static final int AXIS_GENERIC_2 = 33; // 0x21 + field public static final int AXIS_GENERIC_3 = 34; // 0x22 + field public static final int AXIS_GENERIC_4 = 35; // 0x23 + field public static final int AXIS_GENERIC_5 = 36; // 0x24 + field public static final int AXIS_GENERIC_6 = 37; // 0x25 + field public static final int AXIS_GENERIC_7 = 38; // 0x26 + field public static final int AXIS_GENERIC_8 = 39; // 0x27 + field public static final int AXIS_GENERIC_9 = 40; // 0x28 + field public static final int AXIS_HAT_X = 15; // 0xf + field public static final int AXIS_HAT_Y = 16; // 0x10 + field public static final int AXIS_HSCROLL = 10; // 0xa + field public static final int AXIS_LTRIGGER = 17; // 0x11 + field public static final int AXIS_ORIENTATION = 8; // 0x8 + field public static final int AXIS_PRESSURE = 2; // 0x2 + field public static final int AXIS_RTRIGGER = 18; // 0x12 + field public static final int AXIS_RUDDER = 20; // 0x14 + field public static final int AXIS_RX = 12; // 0xc + field public static final int AXIS_RY = 13; // 0xd + field public static final int AXIS_RZ = 14; // 0xe + field public static final int AXIS_SIZE = 3; // 0x3 + field public static final int AXIS_THROTTLE = 19; // 0x13 + field public static final int AXIS_TILT = 25; // 0x19 + field public static final int AXIS_TOOL_MAJOR = 6; // 0x6 + field public static final int AXIS_TOOL_MINOR = 7; // 0x7 + field public static final int AXIS_TOUCH_MAJOR = 4; // 0x4 + field public static final int AXIS_TOUCH_MINOR = 5; // 0x5 + field public static final int AXIS_VSCROLL = 9; // 0x9 + field public static final int AXIS_WHEEL = 21; // 0x15 + field public static final int AXIS_X = 0; // 0x0 + field public static final int AXIS_Y = 1; // 0x1 + field public static final int AXIS_Z = 11; // 0xb + field public static final int BUTTON_BACK = 8; // 0x8 + field public static final int BUTTON_FORWARD = 16; // 0x10 + field public static final int BUTTON_PRIMARY = 1; // 0x1 + field public static final int BUTTON_SECONDARY = 2; // 0x2 + field public static final int BUTTON_TERTIARY = 4; // 0x4 + field public static final android.os.Parcelable.Creator CREATOR; + field public static final int EDGE_BOTTOM = 2; // 0x2 + field public static final int EDGE_LEFT = 4; // 0x4 + field public static final int EDGE_RIGHT = 8; // 0x8 + field public static final int EDGE_TOP = 1; // 0x1 + field public static final int FLAG_WINDOW_IS_OBSCURED = 1; // 0x1 + field public static final int INVALID_POINTER_ID = -1; // 0xffffffff + field public static final int TOOL_TYPE_ERASER = 4; // 0x4 + field public static final int TOOL_TYPE_FINGER = 1; // 0x1 + field public static final int TOOL_TYPE_MOUSE = 3; // 0x3 + field public static final int TOOL_TYPE_STYLUS = 2; // 0x2 + field public static final int TOOL_TYPE_UNKNOWN = 0; // 0x0 + } + + public static final class MotionEvent.PointerCoords { + ctor public MotionEvent.PointerCoords(); + ctor public MotionEvent.PointerCoords(android.view.MotionEvent.PointerCoords); + method public void clear(); + method public void copyFrom(android.view.MotionEvent.PointerCoords); + method public float getAxisValue(int); + method public void setAxisValue(int, float); + field public float orientation; + field public float pressure; + field public float size; + field public float toolMajor; + field public float toolMinor; + field public float touchMajor; + field public float touchMinor; + field public float x; + field public float y; + } + + public static final class MotionEvent.PointerProperties { + ctor public MotionEvent.PointerProperties(); + ctor public MotionEvent.PointerProperties(android.view.MotionEvent.PointerProperties); + method public void clear(); + method public void copyFrom(android.view.MotionEvent.PointerProperties); + field public int id; + field public int toolType; + } + + public abstract class OrientationEventListener { + ctor public OrientationEventListener(android.content.Context); + ctor public OrientationEventListener(android.content.Context, int); + method public boolean canDetectOrientation(); + method public void disable(); + method public void enable(); + method public abstract void onOrientationChanged(int); + field public static final int ORIENTATION_UNKNOWN = -1; // 0xffffffff + } + + public abstract deprecated class OrientationListener implements android.hardware.SensorListener { + ctor public OrientationListener(android.content.Context); + ctor public OrientationListener(android.content.Context, int); + method public void disable(); + method public void enable(); + method public void onAccuracyChanged(int, int); + method public abstract void onOrientationChanged(int); + method public void onSensorChanged(int, float[]); + field public static final int ORIENTATION_UNKNOWN = -1; // 0xffffffff + } + + public class ScaleGestureDetector { + ctor public ScaleGestureDetector(android.content.Context, android.view.ScaleGestureDetector.OnScaleGestureListener); + method public float getCurrentSpan(); + method public float getCurrentSpanX(); + method public float getCurrentSpanY(); + method public long getEventTime(); + method public float getFocusX(); + method public float getFocusY(); + method public float getPreviousSpan(); + method public float getPreviousSpanX(); + method public float getPreviousSpanY(); + method public float getScaleFactor(); + method public long getTimeDelta(); + method public boolean isInProgress(); + method public boolean onTouchEvent(android.view.MotionEvent); + } + + public static abstract interface ScaleGestureDetector.OnScaleGestureListener { + method public abstract boolean onScale(android.view.ScaleGestureDetector); + method public abstract boolean onScaleBegin(android.view.ScaleGestureDetector); + method public abstract void onScaleEnd(android.view.ScaleGestureDetector); + } + + public static class ScaleGestureDetector.SimpleOnScaleGestureListener implements android.view.ScaleGestureDetector.OnScaleGestureListener { + ctor public ScaleGestureDetector.SimpleOnScaleGestureListener(); + method public boolean onScale(android.view.ScaleGestureDetector); + method public boolean onScaleBegin(android.view.ScaleGestureDetector); + method public void onScaleEnd(android.view.ScaleGestureDetector); + } + + public class SoundEffectConstants { + method public static int getContantForFocusDirection(int); + field public static final int CLICK = 0; // 0x0 + field public static final int NAVIGATION_DOWN = 4; // 0x4 + field public static final int NAVIGATION_LEFT = 1; // 0x1 + field public static final int NAVIGATION_RIGHT = 3; // 0x3 + field public static final int NAVIGATION_UP = 2; // 0x2 + } + + public abstract interface SubMenu implements android.view.Menu { + method public abstract void clearHeader(); + method public abstract android.view.MenuItem getItem(); + method public abstract android.view.SubMenu setHeaderIcon(int); + method public abstract android.view.SubMenu setHeaderIcon(android.graphics.drawable.Drawable); + method public abstract android.view.SubMenu setHeaderTitle(int); + method public abstract android.view.SubMenu setHeaderTitle(java.lang.CharSequence); + method public abstract android.view.SubMenu setHeaderView(android.view.View); + method public abstract android.view.SubMenu setIcon(int); + method public abstract android.view.SubMenu setIcon(android.graphics.drawable.Drawable); + } + + public class Surface implements android.os.Parcelable { + ctor public Surface(android.graphics.SurfaceTexture); + method public int describeContents(); + method public boolean isValid(); + method public android.graphics.Canvas lockCanvas(android.graphics.Rect) throws java.lang.IllegalArgumentException, android.view.Surface.OutOfResourcesException; + method public void readFromParcel(android.os.Parcel); + method public void release(); + method public deprecated void unlockCanvas(android.graphics.Canvas); + method public void unlockCanvasAndPost(android.graphics.Canvas); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + field public static final int ROTATION_0 = 0; // 0x0 + field public static final int ROTATION_180 = 2; // 0x2 + field public static final int ROTATION_270 = 3; // 0x3 + field public static final int ROTATION_90 = 1; // 0x1 + } + + public static class Surface.OutOfResourcesException extends java.lang.Exception { + ctor public Surface.OutOfResourcesException(); + ctor public Surface.OutOfResourcesException(java.lang.String); + } + + public abstract interface SurfaceHolder { + method public abstract void addCallback(android.view.SurfaceHolder.Callback); + method public abstract android.view.Surface getSurface(); + method public abstract android.graphics.Rect getSurfaceFrame(); + method public abstract boolean isCreating(); + method public abstract android.graphics.Canvas lockCanvas(); + method public abstract android.graphics.Canvas lockCanvas(android.graphics.Rect); + method public abstract void removeCallback(android.view.SurfaceHolder.Callback); + method public abstract void setFixedSize(int, int); + method public abstract void setFormat(int); + method public abstract void setKeepScreenOn(boolean); + method public abstract void setSizeFromLayout(); + method public abstract deprecated void setType(int); + method public abstract void unlockCanvasAndPost(android.graphics.Canvas); + field public static final deprecated int SURFACE_TYPE_GPU = 2; // 0x2 + field public static final deprecated int SURFACE_TYPE_HARDWARE = 1; // 0x1 + field public static final deprecated int SURFACE_TYPE_NORMAL = 0; // 0x0 + field public static final deprecated int SURFACE_TYPE_PUSH_BUFFERS = 3; // 0x3 + } + + public static class SurfaceHolder.BadSurfaceTypeException extends java.lang.RuntimeException { + ctor public SurfaceHolder.BadSurfaceTypeException(); + ctor public SurfaceHolder.BadSurfaceTypeException(java.lang.String); + } + + public static abstract interface SurfaceHolder.Callback { + method public abstract void surfaceChanged(android.view.SurfaceHolder, int, int, int); + method public abstract void surfaceCreated(android.view.SurfaceHolder); + method public abstract void surfaceDestroyed(android.view.SurfaceHolder); + } + + public static abstract interface SurfaceHolder.Callback2 implements android.view.SurfaceHolder.Callback { + method public abstract void surfaceRedrawNeeded(android.view.SurfaceHolder); + } + + public class SurfaceView extends android.view.View { + ctor public SurfaceView(android.content.Context); + ctor public SurfaceView(android.content.Context, android.util.AttributeSet); + ctor public SurfaceView(android.content.Context, android.util.AttributeSet, int); + method public boolean gatherTransparentRegion(android.graphics.Region); + method public android.view.SurfaceHolder getHolder(); + method public void setSecure(boolean); + method public void setZOrderMediaOverlay(boolean); + method public void setZOrderOnTop(boolean); + } + + public class TextureView extends android.view.View { + ctor public TextureView(android.content.Context); + ctor public TextureView(android.content.Context, android.util.AttributeSet); + ctor public TextureView(android.content.Context, android.util.AttributeSet, int); + method public final void draw(android.graphics.Canvas); + method public android.graphics.Bitmap getBitmap(); + method public android.graphics.Bitmap getBitmap(int, int); + method public android.graphics.Bitmap getBitmap(android.graphics.Bitmap); + method public android.graphics.SurfaceTexture getSurfaceTexture(); + method public android.view.TextureView.SurfaceTextureListener getSurfaceTextureListener(); + method public android.graphics.Matrix getTransform(android.graphics.Matrix); + method public boolean isAvailable(); + method public android.graphics.Canvas lockCanvas(); + method public android.graphics.Canvas lockCanvas(android.graphics.Rect); + method protected final void onDraw(android.graphics.Canvas); + method public void setOpaque(boolean); + method public void setSurfaceTexture(android.graphics.SurfaceTexture); + method public void setSurfaceTextureListener(android.view.TextureView.SurfaceTextureListener); + method public void setTransform(android.graphics.Matrix); + method public void unlockCanvasAndPost(android.graphics.Canvas); + } + + public static abstract interface TextureView.SurfaceTextureListener { + method public abstract void onSurfaceTextureAvailable(android.graphics.SurfaceTexture, int, int); + method public abstract boolean onSurfaceTextureDestroyed(android.graphics.SurfaceTexture); + method public abstract void onSurfaceTextureSizeChanged(android.graphics.SurfaceTexture, int, int); + method public abstract void onSurfaceTextureUpdated(android.graphics.SurfaceTexture); + } + + public class TouchDelegate { + ctor public TouchDelegate(android.graphics.Rect, android.view.View); + method public boolean onTouchEvent(android.view.MotionEvent); + field public static final int ABOVE = 1; // 0x1 + field public static final int BELOW = 2; // 0x2 + field public static final int TO_LEFT = 4; // 0x4 + field public static final int TO_RIGHT = 8; // 0x8 + } + + public final class VelocityTracker { + method public void addMovement(android.view.MotionEvent); + method public void clear(); + method public void computeCurrentVelocity(int); + method public void computeCurrentVelocity(int, float); + method public float getXVelocity(); + method public float getXVelocity(int); + method public float getYVelocity(); + method public float getYVelocity(int); + method public static android.view.VelocityTracker obtain(); + method public void recycle(); + } + + public class View implements android.view.accessibility.AccessibilityEventSource android.graphics.drawable.Drawable.Callback android.view.KeyEvent.Callback { + ctor public View(android.content.Context); + ctor public View(android.content.Context, android.util.AttributeSet); + ctor public View(android.content.Context, android.util.AttributeSet, int); + method public void addChildrenForAccessibility(java.util.ArrayList); + method public void addFocusables(java.util.ArrayList, int); + method public void addFocusables(java.util.ArrayList, int, int); + method public void addOnAttachStateChangeListener(android.view.View.OnAttachStateChangeListener); + method public void addOnLayoutChangeListener(android.view.View.OnLayoutChangeListener); + method public void addTouchables(java.util.ArrayList); + method public android.view.ViewPropertyAnimator animate(); + method public void announceForAccessibility(java.lang.CharSequence); + method protected boolean awakenScrollBars(); + method protected boolean awakenScrollBars(int); + method protected boolean awakenScrollBars(int, boolean); + method public void bringToFront(); + method public void buildDrawingCache(); + method public void buildDrawingCache(boolean); + method public void buildLayer(); + method public boolean callOnClick(); + method public boolean canScrollHorizontally(int); + method public boolean canScrollVertically(int); + method public void cancelLongPress(); + method public boolean checkInputConnectionProxy(android.view.View); + method public void clearAnimation(); + method public void clearFocus(); + method public static int combineMeasuredStates(int, int); + method protected int computeHorizontalScrollExtent(); + method protected int computeHorizontalScrollOffset(); + method protected int computeHorizontalScrollRange(); + method public void computeScroll(); + method protected int computeVerticalScrollExtent(); + method protected int computeVerticalScrollOffset(); + method protected int computeVerticalScrollRange(); + method public android.view.accessibility.AccessibilityNodeInfo createAccessibilityNodeInfo(); + method public void createContextMenu(android.view.ContextMenu); + method public void destroyDrawingCache(); + method public void dispatchConfigurationChanged(android.content.res.Configuration); + method public void dispatchDisplayHint(int); + method public boolean dispatchDragEvent(android.view.DragEvent); + method protected void dispatchDraw(android.graphics.Canvas); + method protected boolean dispatchGenericFocusedEvent(android.view.MotionEvent); + method public boolean dispatchGenericMotionEvent(android.view.MotionEvent); + method protected boolean dispatchGenericPointerEvent(android.view.MotionEvent); + method protected boolean dispatchHoverEvent(android.view.MotionEvent); + method public boolean dispatchKeyEvent(android.view.KeyEvent); + method public boolean dispatchKeyEventPreIme(android.view.KeyEvent); + method public boolean dispatchKeyShortcutEvent(android.view.KeyEvent); + method public boolean dispatchPopulateAccessibilityEvent(android.view.accessibility.AccessibilityEvent); + method protected void dispatchRestoreInstanceState(android.util.SparseArray); + method protected void dispatchSaveInstanceState(android.util.SparseArray); + method protected void dispatchSetActivated(boolean); + method protected void dispatchSetPressed(boolean); + method protected void dispatchSetSelected(boolean); + method public void dispatchSystemUiVisibilityChanged(int); + method public boolean dispatchTouchEvent(android.view.MotionEvent); + method public boolean dispatchTrackballEvent(android.view.MotionEvent); + method public boolean dispatchUnhandledMove(android.view.View, int); + method protected void dispatchVisibilityChanged(android.view.View, int); + method public void dispatchWindowFocusChanged(boolean); + method public void dispatchWindowSystemUiVisiblityChanged(int); + method public void dispatchWindowVisibilityChanged(int); + method public void draw(android.graphics.Canvas); + method protected void drawableStateChanged(); + method public android.view.View findFocus(); + method public final android.view.View findViewById(int); + method public final android.view.View findViewWithTag(java.lang.Object); + method public void findViewsWithText(java.util.ArrayList, java.lang.CharSequence, int); + method protected boolean fitSystemWindows(android.graphics.Rect); + method public android.view.View focusSearch(int); + method public void forceLayout(); + method public static int generateViewId(); + method public android.view.accessibility.AccessibilityNodeProvider getAccessibilityNodeProvider(); + method public float getAlpha(); + method public android.view.animation.Animation getAnimation(); + method public android.os.IBinder getApplicationWindowToken(); + method public android.graphics.drawable.Drawable getBackground(); + method public int getBaseline(); + method public final int getBottom(); + method protected float getBottomFadingEdgeStrength(); + method protected int getBottomPaddingOffset(); + method public float getCameraDistance(); + method public java.lang.CharSequence getContentDescription(); + method public final android.content.Context getContext(); + method protected android.view.ContextMenu.ContextMenuInfo getContextMenuInfo(); + method public static int getDefaultSize(int, int); + method public android.view.Display getDisplay(); + method public final int[] getDrawableState(); + method public android.graphics.Bitmap getDrawingCache(); + method public android.graphics.Bitmap getDrawingCache(boolean); + method public int getDrawingCacheBackgroundColor(); + method public int getDrawingCacheQuality(); + method public void getDrawingRect(android.graphics.Rect); + method public long getDrawingTime(); + method public boolean getFilterTouchesWhenObscured(); + method public boolean getFitsSystemWindows(); + method public java.util.ArrayList getFocusables(int); + method public void getFocusedRect(android.graphics.Rect); + method public boolean getGlobalVisibleRect(android.graphics.Rect, android.graphics.Point); + method public final boolean getGlobalVisibleRect(android.graphics.Rect); + method public android.os.Handler getHandler(); + method public final int getHeight(); + method public void getHitRect(android.graphics.Rect); + method public int getHorizontalFadingEdgeLength(); + method protected int getHorizontalScrollbarHeight(); + method public int getId(); + method public int getImportantForAccessibility(); + method public boolean getKeepScreenOn(); + method public android.view.KeyEvent.DispatcherState getKeyDispatcherState(); + method public int getLabelFor(); + method public int getLayerType(); + method public int getLayoutDirection(); + method public android.view.ViewGroup.LayoutParams getLayoutParams(); + method public final int getLeft(); + method protected float getLeftFadingEdgeStrength(); + method protected int getLeftPaddingOffset(); + method public final boolean getLocalVisibleRect(android.graphics.Rect); + method public void getLocationInWindow(int[]); + method public void getLocationOnScreen(int[]); + method public android.graphics.Matrix getMatrix(); + method public final int getMeasuredHeight(); + method public final int getMeasuredHeightAndState(); + method public final int getMeasuredState(); + method public final int getMeasuredWidth(); + method public final int getMeasuredWidthAndState(); + method public int getMinimumHeight(); + method public int getMinimumWidth(); + method public int getNextFocusDownId(); + method public int getNextFocusForwardId(); + method public int getNextFocusLeftId(); + method public int getNextFocusRightId(); + method public int getNextFocusUpId(); + method public android.view.View.OnFocusChangeListener getOnFocusChangeListener(); + method public int getOverScrollMode(); + method public int getPaddingBottom(); + method public int getPaddingEnd(); + method public int getPaddingLeft(); + method public int getPaddingRight(); + method public int getPaddingStart(); + method public int getPaddingTop(); + method public final android.view.ViewParent getParent(); + method public android.view.ViewParent getParentForAccessibility(); + method public float getPivotX(); + method public float getPivotY(); + method public android.content.res.Resources getResources(); + method public final int getRight(); + method protected float getRightFadingEdgeStrength(); + method protected int getRightPaddingOffset(); + method public android.view.View getRootView(); + method public float getRotation(); + method public float getRotationX(); + method public float getRotationY(); + method public float getScaleX(); + method public float getScaleY(); + method public int getScrollBarDefaultDelayBeforeFade(); + method public int getScrollBarFadeDuration(); + method public int getScrollBarSize(); + method public int getScrollBarStyle(); + method public final int getScrollX(); + method public final int getScrollY(); + method public int getSolidColor(); + method protected int getSuggestedMinimumHeight(); + method protected int getSuggestedMinimumWidth(); + method public int getSystemUiVisibility(); + method public java.lang.Object getTag(); + method public java.lang.Object getTag(int); + method public int getTextAlignment(); + method public int getTextDirection(); + method public final int getTop(); + method protected float getTopFadingEdgeStrength(); + method protected int getTopPaddingOffset(); + method public android.view.TouchDelegate getTouchDelegate(); + method public java.util.ArrayList getTouchables(); + method public float getTranslationX(); + method public float getTranslationY(); + method public int getVerticalFadingEdgeLength(); + method public int getVerticalScrollbarPosition(); + method public int getVerticalScrollbarWidth(); + method public android.view.ViewTreeObserver getViewTreeObserver(); + method public int getVisibility(); + method public final int getWidth(); + method protected int getWindowAttachCount(); + method public int getWindowSystemUiVisibility(); + method public android.os.IBinder getWindowToken(); + method public int getWindowVisibility(); + method public void getWindowVisibleDisplayFrame(android.graphics.Rect); + method public float getX(); + method public float getY(); + method public boolean hasFocus(); + method public boolean hasFocusable(); + method public boolean hasOnClickListeners(); + method public boolean hasOverlappingRendering(); + method public boolean hasTransientState(); + method public boolean hasWindowFocus(); + method public static android.view.View inflate(android.content.Context, int, android.view.ViewGroup); + method protected void initializeFadingEdge(android.content.res.TypedArray); + method protected void initializeScrollbars(android.content.res.TypedArray); + method public void invalidate(android.graphics.Rect); + method public void invalidate(int, int, int, int); + method public void invalidate(); + method public void invalidateDrawable(android.graphics.drawable.Drawable); + method public boolean isActivated(); + method public boolean isClickable(); + method public boolean isDirty(); + method public boolean isDrawingCacheEnabled(); + method public boolean isDuplicateParentStateEnabled(); + method public boolean isEnabled(); + method public final boolean isFocusable(); + method public final boolean isFocusableInTouchMode(); + method public boolean isFocused(); + method public boolean isHapticFeedbackEnabled(); + method public boolean isHardwareAccelerated(); + method public boolean isHorizontalFadingEdgeEnabled(); + method public boolean isHorizontalScrollBarEnabled(); + method public boolean isHovered(); + method public boolean isInEditMode(); + method public boolean isInTouchMode(); + method public boolean isLayoutRequested(); + method public boolean isLongClickable(); + method public boolean isOpaque(); + method protected boolean isPaddingOffsetRequired(); + method public boolean isPaddingRelative(); + method public boolean isPressed(); + method public boolean isSaveEnabled(); + method public boolean isSaveFromParentEnabled(); + method public boolean isScrollContainer(); + method public boolean isScrollbarFadingEnabled(); + method public boolean isSelected(); + method public boolean isShown(); + method public boolean isSoundEffectsEnabled(); + method public boolean isVerticalFadingEdgeEnabled(); + method public boolean isVerticalScrollBarEnabled(); + method public void jumpDrawablesToCurrentState(); + method public void layout(int, int, int, int); + method public final void measure(int, int); + method protected static int[] mergeDrawableStates(int[], int[]); + method public void offsetLeftAndRight(int); + method public void offsetTopAndBottom(int); + method protected void onAnimationEnd(); + method protected void onAnimationStart(); + method protected void onAttachedToWindow(); + method public boolean onCheckIsTextEditor(); + method protected void onConfigurationChanged(android.content.res.Configuration); + method protected void onCreateContextMenu(android.view.ContextMenu); + method protected int[] onCreateDrawableState(int); + method public android.view.inputmethod.InputConnection onCreateInputConnection(android.view.inputmethod.EditorInfo); + method protected void onDetachedFromWindow(); + method protected void onDisplayHint(int); + method public boolean onDragEvent(android.view.DragEvent); + method protected void onDraw(android.graphics.Canvas); + method protected final void onDrawScrollBars(android.graphics.Canvas); + method public boolean onFilterTouchEventForSecurity(android.view.MotionEvent); + method protected void onFinishInflate(); + method public void onFinishTemporaryDetach(); + method protected void onFocusChanged(boolean, int, android.graphics.Rect); + method public boolean onGenericMotionEvent(android.view.MotionEvent); + method public void onHoverChanged(boolean); + method public boolean onHoverEvent(android.view.MotionEvent); + method public void onInitializeAccessibilityEvent(android.view.accessibility.AccessibilityEvent); + method public void onInitializeAccessibilityNodeInfo(android.view.accessibility.AccessibilityNodeInfo); + method public boolean onKeyDown(int, android.view.KeyEvent); + method public boolean onKeyLongPress(int, android.view.KeyEvent); + method public boolean onKeyMultiple(int, int, android.view.KeyEvent); + method public boolean onKeyPreIme(int, android.view.KeyEvent); + method public boolean onKeyShortcut(int, android.view.KeyEvent); + method public boolean onKeyUp(int, android.view.KeyEvent); + method protected void onLayout(boolean, int, int, int, int); + method protected void onMeasure(int, int); + method protected void onOverScrolled(int, int, boolean, boolean); + method public void onPopulateAccessibilityEvent(android.view.accessibility.AccessibilityEvent); + method protected void onRestoreInstanceState(android.os.Parcelable); + method public void onRtlPropertiesChanged(int); + method protected android.os.Parcelable onSaveInstanceState(); + method public void onScreenStateChanged(int); + method protected void onScrollChanged(int, int, int, int); + method protected boolean onSetAlpha(int); + method protected void onSizeChanged(int, int, int, int); + method public void onStartTemporaryDetach(); + method public boolean onTouchEvent(android.view.MotionEvent); + method public boolean onTrackballEvent(android.view.MotionEvent); + method protected void onVisibilityChanged(android.view.View, int); + method public void onWindowFocusChanged(boolean); + method public void onWindowSystemUiVisibilityChanged(int); + method protected void onWindowVisibilityChanged(int); + method protected boolean overScrollBy(int, int, int, int, int, int, int, int, boolean); + method public boolean performAccessibilityAction(int, android.os.Bundle); + method public boolean performClick(); + method public boolean performHapticFeedback(int); + method public boolean performHapticFeedback(int, int); + method public boolean performLongClick(); + method public void playSoundEffect(int); + method public boolean post(java.lang.Runnable); + method public boolean postDelayed(java.lang.Runnable, long); + method public void postInvalidate(); + method public void postInvalidate(int, int, int, int); + method public void postInvalidateDelayed(long); + method public void postInvalidateDelayed(long, int, int, int, int); + method public void postInvalidateOnAnimation(); + method public void postInvalidateOnAnimation(int, int, int, int); + method public void postOnAnimation(java.lang.Runnable); + method public void postOnAnimationDelayed(java.lang.Runnable, long); + method public void refreshDrawableState(); + method public boolean removeCallbacks(java.lang.Runnable); + method public void removeOnAttachStateChangeListener(android.view.View.OnAttachStateChangeListener); + method public void removeOnLayoutChangeListener(android.view.View.OnLayoutChangeListener); + method public void requestFitSystemWindows(); + method public final boolean requestFocus(); + method public final boolean requestFocus(int); + method public boolean requestFocus(int, android.graphics.Rect); + method public final boolean requestFocusFromTouch(); + method public void requestLayout(); + method public boolean requestRectangleOnScreen(android.graphics.Rect); + method public boolean requestRectangleOnScreen(android.graphics.Rect, boolean); + method public static int resolveSize(int, int); + method public static int resolveSizeAndState(int, int, int); + method public void restoreHierarchyState(android.util.SparseArray); + method public void saveHierarchyState(android.util.SparseArray); + method public void scheduleDrawable(android.graphics.drawable.Drawable, java.lang.Runnable, long); + method public void scrollBy(int, int); + method public void scrollTo(int, int); + method public void sendAccessibilityEvent(int); + method public void sendAccessibilityEventUnchecked(android.view.accessibility.AccessibilityEvent); + method public void setAccessibilityDelegate(android.view.View.AccessibilityDelegate); + method public void setActivated(boolean); + method public void setAlpha(float); + method public void setAnimation(android.view.animation.Animation); + method public void setBackground(android.graphics.drawable.Drawable); + method public void setBackgroundColor(int); + method public deprecated void setBackgroundDrawable(android.graphics.drawable.Drawable); + method public void setBackgroundResource(int); + method public final void setBottom(int); + method public void setCameraDistance(float); + method public void setClickable(boolean); + method public void setContentDescription(java.lang.CharSequence); + method public void setDrawingCacheBackgroundColor(int); + method public void setDrawingCacheEnabled(boolean); + method public void setDrawingCacheQuality(int); + method public void setDuplicateParentStateEnabled(boolean); + method public void setEnabled(boolean); + method public void setFadingEdgeLength(int); + method public void setFilterTouchesWhenObscured(boolean); + method public void setFitsSystemWindows(boolean); + method public void setFocusable(boolean); + method public void setFocusableInTouchMode(boolean); + method public void setHapticFeedbackEnabled(boolean); + method public void setHasTransientState(boolean); + method public void setHorizontalFadingEdgeEnabled(boolean); + method public void setHorizontalScrollBarEnabled(boolean); + method public void setHovered(boolean); + method public void setId(int); + method public void setImportantForAccessibility(int); + method public void setKeepScreenOn(boolean); + method public void setLabelFor(int); + method public void setLayerPaint(android.graphics.Paint); + method public void setLayerType(int, android.graphics.Paint); + method public void setLayoutDirection(int); + method public void setLayoutParams(android.view.ViewGroup.LayoutParams); + method public final void setLeft(int); + method public void setLongClickable(boolean); + method protected final void setMeasuredDimension(int, int); + method public void setMinimumHeight(int); + method public void setMinimumWidth(int); + method public void setNextFocusDownId(int); + method public void setNextFocusForwardId(int); + method public void setNextFocusLeftId(int); + method public void setNextFocusRightId(int); + method public void setNextFocusUpId(int); + method public void setOnClickListener(android.view.View.OnClickListener); + method public void setOnCreateContextMenuListener(android.view.View.OnCreateContextMenuListener); + method public void setOnDragListener(android.view.View.OnDragListener); + method public void setOnFocusChangeListener(android.view.View.OnFocusChangeListener); + method public void setOnGenericMotionListener(android.view.View.OnGenericMotionListener); + method public void setOnHoverListener(android.view.View.OnHoverListener); + method public void setOnKeyListener(android.view.View.OnKeyListener); + method public void setOnLongClickListener(android.view.View.OnLongClickListener); + method public void setOnSystemUiVisibilityChangeListener(android.view.View.OnSystemUiVisibilityChangeListener); + method public void setOnTouchListener(android.view.View.OnTouchListener); + method public void setOverScrollMode(int); + method public void setPadding(int, int, int, int); + method public void setPaddingRelative(int, int, int, int); + method public void setPivotX(float); + method public void setPivotY(float); + method public void setPressed(boolean); + method public final void setRight(int); + method public void setRotation(float); + method public void setRotationX(float); + method public void setRotationY(float); + method public void setSaveEnabled(boolean); + method public void setSaveFromParentEnabled(boolean); + method public void setScaleX(float); + method public void setScaleY(float); + method public void setScrollBarDefaultDelayBeforeFade(int); + method public void setScrollBarFadeDuration(int); + method public void setScrollBarSize(int); + method public void setScrollBarStyle(int); + method public void setScrollContainer(boolean); + method public void setScrollX(int); + method public void setScrollY(int); + method public void setScrollbarFadingEnabled(boolean); + method public void setSelected(boolean); + method public void setSoundEffectsEnabled(boolean); + method public void setSystemUiVisibility(int); + method public void setTag(java.lang.Object); + method public void setTag(int, java.lang.Object); + method public void setTextAlignment(int); + method public void setTextDirection(int); + method public final void setTop(int); + method public void setTouchDelegate(android.view.TouchDelegate); + method public void setTranslationX(float); + method public void setTranslationY(float); + method public void setVerticalFadingEdgeEnabled(boolean); + method public void setVerticalScrollBarEnabled(boolean); + method public void setVerticalScrollbarPosition(int); + method public void setVisibility(int); + method public void setWillNotCacheDrawing(boolean); + method public void setWillNotDraw(boolean); + method public void setX(float); + method public void setY(float); + method public boolean showContextMenu(); + method public android.view.ActionMode startActionMode(android.view.ActionMode.Callback); + method public void startAnimation(android.view.animation.Animation); + method public final boolean startDrag(android.content.ClipData, android.view.View.DragShadowBuilder, java.lang.Object, int); + method public void unscheduleDrawable(android.graphics.drawable.Drawable, java.lang.Runnable); + method public void unscheduleDrawable(android.graphics.drawable.Drawable); + method protected boolean verifyDrawable(android.graphics.drawable.Drawable); + method public boolean willNotCacheDrawing(); + method public boolean willNotDraw(); + field public static final android.util.Property ALPHA; + field public static final int DRAWING_CACHE_QUALITY_AUTO = 0; // 0x0 + field public static final int DRAWING_CACHE_QUALITY_HIGH = 1048576; // 0x100000 + field public static final int DRAWING_CACHE_QUALITY_LOW = 524288; // 0x80000 + field protected static final int[] EMPTY_STATE_SET; + field protected static final int[] ENABLED_FOCUSED_SELECTED_STATE_SET; + field protected static final int[] ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET; + field protected static final int[] ENABLED_FOCUSED_STATE_SET; + field protected static final int[] ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET; + field protected static final int[] ENABLED_SELECTED_STATE_SET; + field protected static final int[] ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET; + field protected static final int[] ENABLED_STATE_SET; + field protected static final int[] ENABLED_WINDOW_FOCUSED_STATE_SET; + field public static final int FIND_VIEWS_WITH_CONTENT_DESCRIPTION = 2; // 0x2 + field public static final int FIND_VIEWS_WITH_TEXT = 1; // 0x1 + field public static final int FOCUSABLES_ALL = 0; // 0x0 + field public static final int FOCUSABLES_TOUCH_MODE = 1; // 0x1 + field protected static final int[] FOCUSED_SELECTED_STATE_SET; + field protected static final int[] FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET; + field protected static final int[] FOCUSED_STATE_SET; + field protected static final int[] FOCUSED_WINDOW_FOCUSED_STATE_SET; + field public static final int FOCUS_BACKWARD = 1; // 0x1 + field public static final int FOCUS_DOWN = 130; // 0x82 + field public static final int FOCUS_FORWARD = 2; // 0x2 + field public static final int FOCUS_LEFT = 17; // 0x11 + field public static final int FOCUS_RIGHT = 66; // 0x42 + field public static final int FOCUS_UP = 33; // 0x21 + field public static final int GONE = 8; // 0x8 + field public static final int HAPTIC_FEEDBACK_ENABLED = 268435456; // 0x10000000 + field public static final int IMPORTANT_FOR_ACCESSIBILITY_AUTO = 0; // 0x0 + field public static final int IMPORTANT_FOR_ACCESSIBILITY_NO = 2; // 0x2 + field public static final int IMPORTANT_FOR_ACCESSIBILITY_YES = 1; // 0x1 + field public static final int INVISIBLE = 4; // 0x4 + field public static final int KEEP_SCREEN_ON = 67108864; // 0x4000000 + field public static final int LAYER_TYPE_HARDWARE = 2; // 0x2 + field public static final int LAYER_TYPE_NONE = 0; // 0x0 + field public static final int LAYER_TYPE_SOFTWARE = 1; // 0x1 + field public static final int LAYOUT_DIRECTION_INHERIT = 2; // 0x2 + field public static final int LAYOUT_DIRECTION_LOCALE = 3; // 0x3 + field public static final int LAYOUT_DIRECTION_LTR = 0; // 0x0 + field public static final int LAYOUT_DIRECTION_RTL = 1; // 0x1 + field public static final int MEASURED_HEIGHT_STATE_SHIFT = 16; // 0x10 + field public static final int MEASURED_SIZE_MASK = 16777215; // 0xffffff + field public static final int MEASURED_STATE_MASK = -16777216; // 0xff000000 + field public static final int MEASURED_STATE_TOO_SMALL = 16777216; // 0x1000000 + field public static final int NO_ID = -1; // 0xffffffff + field public static final int OVER_SCROLL_ALWAYS = 0; // 0x0 + field public static final int OVER_SCROLL_IF_CONTENT_SCROLLS = 1; // 0x1 + field public static final int OVER_SCROLL_NEVER = 2; // 0x2 + field protected static final int[] PRESSED_ENABLED_FOCUSED_SELECTED_STATE_SET; + field protected static final int[] PRESSED_ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET; + field protected static final int[] PRESSED_ENABLED_FOCUSED_STATE_SET; + field protected static final int[] PRESSED_ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET; + field protected static final int[] PRESSED_ENABLED_SELECTED_STATE_SET; + field protected static final int[] PRESSED_ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET; + field protected static final int[] PRESSED_ENABLED_STATE_SET; + field protected static final int[] PRESSED_ENABLED_WINDOW_FOCUSED_STATE_SET; + field protected static final int[] PRESSED_FOCUSED_SELECTED_STATE_SET; + field protected static final int[] PRESSED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET; + field protected static final int[] PRESSED_FOCUSED_STATE_SET; + field protected static final int[] PRESSED_FOCUSED_WINDOW_FOCUSED_STATE_SET; + field protected static final int[] PRESSED_SELECTED_STATE_SET; + field protected static final int[] PRESSED_SELECTED_WINDOW_FOCUSED_STATE_SET; + field protected static final int[] PRESSED_WINDOW_FOCUSED_STATE_SET; + field public static final android.util.Property ROTATION; + field public static final android.util.Property ROTATION_X; + field public static final android.util.Property ROTATION_Y; + field public static final android.util.Property SCALE_X; + field public static final android.util.Property SCALE_Y; + field public static final int SCREEN_STATE_OFF = 0; // 0x0 + field public static final int SCREEN_STATE_ON = 1; // 0x1 + field public static final int SCROLLBARS_INSIDE_INSET = 16777216; // 0x1000000 + field public static final int SCROLLBARS_INSIDE_OVERLAY = 0; // 0x0 + field public static final int SCROLLBARS_OUTSIDE_INSET = 50331648; // 0x3000000 + field public static final int SCROLLBARS_OUTSIDE_OVERLAY = 33554432; // 0x2000000 + field public static final int SCROLLBAR_POSITION_DEFAULT = 0; // 0x0 + field public static final int SCROLLBAR_POSITION_LEFT = 1; // 0x1 + field public static final int SCROLLBAR_POSITION_RIGHT = 2; // 0x2 + field protected static final int[] SELECTED_STATE_SET; + field protected static final int[] SELECTED_WINDOW_FOCUSED_STATE_SET; + field public static final int SOUND_EFFECTS_ENABLED = 134217728; // 0x8000000 + field public static final deprecated int STATUS_BAR_HIDDEN = 1; // 0x1 + field public static final deprecated int STATUS_BAR_VISIBLE = 0; // 0x0 + field public static final int SYSTEM_UI_FLAG_FULLSCREEN = 4; // 0x4 + field public static final int SYSTEM_UI_FLAG_HIDE_NAVIGATION = 2; // 0x2 + field public static final int SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN = 1024; // 0x400 + field public static final int SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION = 512; // 0x200 + field public static final int SYSTEM_UI_FLAG_LAYOUT_STABLE = 256; // 0x100 + field public static final int SYSTEM_UI_FLAG_LOW_PROFILE = 1; // 0x1 + field public static final int SYSTEM_UI_FLAG_VISIBLE = 0; // 0x0 + field public static final int SYSTEM_UI_LAYOUT_FLAGS = 1536; // 0x600 + field public static final int TEXT_ALIGNMENT_CENTER = 4; // 0x4 + field public static final int TEXT_ALIGNMENT_GRAVITY = 1; // 0x1 + field public static final int TEXT_ALIGNMENT_INHERIT = 0; // 0x0 + field public static final int TEXT_ALIGNMENT_TEXT_END = 3; // 0x3 + field public static final int TEXT_ALIGNMENT_TEXT_START = 2; // 0x2 + field public static final int TEXT_ALIGNMENT_VIEW_END = 6; // 0x6 + field public static final int TEXT_ALIGNMENT_VIEW_START = 5; // 0x5 + field public static final int TEXT_DIRECTION_ANY_RTL = 2; // 0x2 + field public static final int TEXT_DIRECTION_FIRST_STRONG = 1; // 0x1 + field public static final int TEXT_DIRECTION_INHERIT = 0; // 0x0 + field public static final int TEXT_DIRECTION_LOCALE = 5; // 0x5 + field public static final int TEXT_DIRECTION_LTR = 3; // 0x3 + field public static final int TEXT_DIRECTION_RTL = 4; // 0x4 + field public static final android.util.Property TRANSLATION_X; + field public static final android.util.Property TRANSLATION_Y; + field protected static final java.lang.String VIEW_LOG_TAG = "View"; + field public static final int VISIBLE = 0; // 0x0 + field protected static final int[] WINDOW_FOCUSED_STATE_SET; + field public static final android.util.Property X; + field public static final android.util.Property Y; + } + + public static class View.AccessibilityDelegate { + ctor public View.AccessibilityDelegate(); + method public boolean dispatchPopulateAccessibilityEvent(android.view.View, android.view.accessibility.AccessibilityEvent); + method public android.view.accessibility.AccessibilityNodeProvider getAccessibilityNodeProvider(android.view.View); + method public void onInitializeAccessibilityEvent(android.view.View, android.view.accessibility.AccessibilityEvent); + method public void onInitializeAccessibilityNodeInfo(android.view.View, android.view.accessibility.AccessibilityNodeInfo); + method public void onPopulateAccessibilityEvent(android.view.View, android.view.accessibility.AccessibilityEvent); + method public boolean onRequestSendAccessibilityEvent(android.view.ViewGroup, android.view.View, android.view.accessibility.AccessibilityEvent); + method public boolean performAccessibilityAction(android.view.View, int, android.os.Bundle); + method public void sendAccessibilityEvent(android.view.View, int); + method public void sendAccessibilityEventUnchecked(android.view.View, android.view.accessibility.AccessibilityEvent); + } + + public static class View.BaseSavedState extends android.view.AbsSavedState { + ctor public View.BaseSavedState(android.os.Parcel); + ctor public View.BaseSavedState(android.os.Parcelable); + field public static final android.os.Parcelable.Creator CREATOR; + } + + public static class View.DragShadowBuilder { + ctor public View.DragShadowBuilder(android.view.View); + ctor public View.DragShadowBuilder(); + method public final android.view.View getView(); + method public void onDrawShadow(android.graphics.Canvas); + method public void onProvideShadowMetrics(android.graphics.Point, android.graphics.Point); + } + + public static class View.MeasureSpec { + ctor public View.MeasureSpec(); + method public static int getMode(int); + method public static int getSize(int); + method public static int makeMeasureSpec(int, int); + method public static java.lang.String toString(int); + field public static final int AT_MOST = -2147483648; // 0x80000000 + field public static final int EXACTLY = 1073741824; // 0x40000000 + field public static final int UNSPECIFIED = 0; // 0x0 + } + + public static abstract interface View.OnAttachStateChangeListener { + method public abstract void onViewAttachedToWindow(android.view.View); + method public abstract void onViewDetachedFromWindow(android.view.View); + } + + public static abstract interface View.OnClickListener { + method public abstract void onClick(android.view.View); + } + + public static abstract interface View.OnCreateContextMenuListener { + method public abstract void onCreateContextMenu(android.view.ContextMenu, android.view.View, android.view.ContextMenu.ContextMenuInfo); + } + + public static abstract interface View.OnDragListener { + method public abstract boolean onDrag(android.view.View, android.view.DragEvent); + } + + public static abstract interface View.OnFocusChangeListener { + method public abstract void onFocusChange(android.view.View, boolean); + } + + public static abstract interface View.OnGenericMotionListener { + method public abstract boolean onGenericMotion(android.view.View, android.view.MotionEvent); + } + + public static abstract interface View.OnHoverListener { + method public abstract boolean onHover(android.view.View, android.view.MotionEvent); + } + + public static abstract interface View.OnKeyListener { + method public abstract boolean onKey(android.view.View, int, android.view.KeyEvent); + } + + public static abstract interface View.OnLayoutChangeListener { + method public abstract void onLayoutChange(android.view.View, int, int, int, int, int, int, int, int); + } + + public static abstract interface View.OnLongClickListener { + method public abstract boolean onLongClick(android.view.View); + } + + public static abstract interface View.OnSystemUiVisibilityChangeListener { + method public abstract void onSystemUiVisibilityChange(int); + } + + public static abstract interface View.OnTouchListener { + method public abstract boolean onTouch(android.view.View, android.view.MotionEvent); + } + + public class ViewConfiguration { + ctor public deprecated ViewConfiguration(); + method public static android.view.ViewConfiguration get(android.content.Context); + method public static int getDoubleTapTimeout(); + method public static deprecated int getEdgeSlop(); + method public static deprecated int getFadingEdgeLength(); + method public static long getGlobalActionKeyTimeout(); + method public static int getJumpTapTimeout(); + method public static int getKeyRepeatDelay(); + method public static int getKeyRepeatTimeout(); + method public static int getLongPressTimeout(); + method public static deprecated int getMaximumDrawingCacheSize(); + method public static deprecated int getMaximumFlingVelocity(); + method public static deprecated int getMinimumFlingVelocity(); + method public static int getPressedStateDuration(); + method public int getScaledDoubleTapSlop(); + method public int getScaledEdgeSlop(); + method public int getScaledFadingEdgeLength(); + method public int getScaledMaximumDrawingCacheSize(); + method public int getScaledMaximumFlingVelocity(); + method public int getScaledMinimumFlingVelocity(); + method public int getScaledOverflingDistance(); + method public int getScaledOverscrollDistance(); + method public int getScaledPagingTouchSlop(); + method public int getScaledScrollBarSize(); + method public int getScaledTouchSlop(); + method public int getScaledWindowTouchSlop(); + method public static int getScrollBarFadeDuration(); + method public static deprecated int getScrollBarSize(); + method public static int getScrollDefaultDelay(); + method public static float getScrollFriction(); + method public static int getTapTimeout(); + method public static deprecated int getTouchSlop(); + method public static deprecated int getWindowTouchSlop(); + method public static long getZoomControlsTimeout(); + method public boolean hasPermanentMenuKey(); + } + + public class ViewDebug { + ctor public ViewDebug(); + method public static void dumpCapturedView(java.lang.String, java.lang.Object); + method public static deprecated void startHierarchyTracing(java.lang.String, android.view.View); + method public static deprecated void startRecyclerTracing(java.lang.String, android.view.View); + method public static deprecated void stopHierarchyTracing(); + method public static deprecated void stopRecyclerTracing(); + method public static deprecated void trace(android.view.View, android.view.ViewDebug.RecyclerTraceType, int...); + method public static deprecated void trace(android.view.View, android.view.ViewDebug.HierarchyTraceType); + field public static final deprecated boolean TRACE_HIERARCHY = false; + field public static final deprecated boolean TRACE_RECYCLER = false; + } + + public static abstract class ViewDebug.CapturedViewProperty implements java.lang.annotation.Annotation { + } + + public static abstract class ViewDebug.ExportedProperty implements java.lang.annotation.Annotation { + } + + public static abstract class ViewDebug.FlagToString implements java.lang.annotation.Annotation { + } + + public static final deprecated class ViewDebug.HierarchyTraceType extends java.lang.Enum { + method public static android.view.ViewDebug.HierarchyTraceType valueOf(java.lang.String); + method public static final android.view.ViewDebug.HierarchyTraceType[] values(); + enum_constant public static final android.view.ViewDebug.HierarchyTraceType BUILD_CACHE; + enum_constant public static final android.view.ViewDebug.HierarchyTraceType DRAW; + enum_constant public static final android.view.ViewDebug.HierarchyTraceType INVALIDATE; + enum_constant public static final android.view.ViewDebug.HierarchyTraceType INVALIDATE_CHILD; + enum_constant public static final android.view.ViewDebug.HierarchyTraceType INVALIDATE_CHILD_IN_PARENT; + enum_constant public static final android.view.ViewDebug.HierarchyTraceType ON_LAYOUT; + enum_constant public static final android.view.ViewDebug.HierarchyTraceType ON_MEASURE; + enum_constant public static final android.view.ViewDebug.HierarchyTraceType REQUEST_LAYOUT; + } + + public static abstract class ViewDebug.IntToString implements java.lang.annotation.Annotation { + } + + public static final deprecated class ViewDebug.RecyclerTraceType extends java.lang.Enum { + method public static android.view.ViewDebug.RecyclerTraceType valueOf(java.lang.String); + method public static final android.view.ViewDebug.RecyclerTraceType[] values(); + enum_constant public static final android.view.ViewDebug.RecyclerTraceType BIND_VIEW; + enum_constant public static final android.view.ViewDebug.RecyclerTraceType MOVE_FROM_ACTIVE_TO_SCRAP_HEAP; + enum_constant public static final android.view.ViewDebug.RecyclerTraceType MOVE_TO_SCRAP_HEAP; + enum_constant public static final android.view.ViewDebug.RecyclerTraceType NEW_VIEW; + enum_constant public static final android.view.ViewDebug.RecyclerTraceType RECYCLE_FROM_ACTIVE_HEAP; + enum_constant public static final android.view.ViewDebug.RecyclerTraceType RECYCLE_FROM_SCRAP_HEAP; + } + + public abstract class ViewGroup extends android.view.View implements android.view.ViewManager android.view.ViewParent { + ctor public ViewGroup(android.content.Context); + ctor public ViewGroup(android.content.Context, android.util.AttributeSet); + ctor public ViewGroup(android.content.Context, android.util.AttributeSet, int); + method public boolean addStatesFromChildren(); + method public void addView(android.view.View); + method public void addView(android.view.View, int); + method public void addView(android.view.View, int, int); + method public void addView(android.view.View, android.view.ViewGroup.LayoutParams); + method public void addView(android.view.View, int, android.view.ViewGroup.LayoutParams); + method protected boolean addViewInLayout(android.view.View, int, android.view.ViewGroup.LayoutParams); + method protected boolean addViewInLayout(android.view.View, int, android.view.ViewGroup.LayoutParams, boolean); + method protected void attachLayoutAnimationParameters(android.view.View, android.view.ViewGroup.LayoutParams, int, int); + method protected void attachViewToParent(android.view.View, int, android.view.ViewGroup.LayoutParams); + method public void bringChildToFront(android.view.View); + method protected boolean canAnimate(); + method protected boolean checkLayoutParams(android.view.ViewGroup.LayoutParams); + method public void childDrawableStateChanged(android.view.View); + method protected void cleanupLayoutState(android.view.View); + method public void clearChildFocus(android.view.View); + method public void clearDisappearingChildren(); + method protected void debug(int); + method protected void detachAllViewsFromParent(); + method protected void detachViewFromParent(android.view.View); + method protected void detachViewFromParent(int); + method protected void detachViewsFromParent(int, int); + method protected void dispatchFreezeSelfOnly(android.util.SparseArray); + method public void dispatchSetActivated(boolean); + method public void dispatchSetSelected(boolean); + method protected void dispatchThawSelfOnly(android.util.SparseArray); + method protected boolean drawChild(android.graphics.Canvas, android.view.View, long); + method public void endViewTransition(android.view.View); + method public android.view.View focusSearch(android.view.View, int); + method public void focusableViewAvailable(android.view.View); + method public boolean gatherTransparentRegion(android.graphics.Region); + method protected android.view.ViewGroup.LayoutParams generateDefaultLayoutParams(); + method public android.view.ViewGroup.LayoutParams generateLayoutParams(android.util.AttributeSet); + method protected android.view.ViewGroup.LayoutParams generateLayoutParams(android.view.ViewGroup.LayoutParams); + method public android.view.View getChildAt(int); + method public int getChildCount(); + method protected int getChildDrawingOrder(int, int); + method public static int getChildMeasureSpec(int, int, int); + method protected boolean getChildStaticTransformation(android.view.View, android.view.animation.Transformation); + method public boolean getChildVisibleRect(android.view.View, android.graphics.Rect, android.graphics.Point); + method public int getDescendantFocusability(); + method public android.view.View getFocusedChild(); + method public android.view.animation.LayoutAnimationController getLayoutAnimation(); + method public android.view.animation.Animation.AnimationListener getLayoutAnimationListener(); + method public android.animation.LayoutTransition getLayoutTransition(); + method public int getPersistentDrawingCache(); + method public int indexOfChild(android.view.View); + method public final void invalidateChild(android.view.View, android.graphics.Rect); + method public android.view.ViewParent invalidateChildInParent(int[], android.graphics.Rect); + method public boolean isAlwaysDrawnWithCacheEnabled(); + method public boolean isAnimationCacheEnabled(); + method protected boolean isChildrenDrawingOrderEnabled(); + method protected boolean isChildrenDrawnWithCacheEnabled(); + method public boolean isMotionEventSplittingEnabled(); + method public final void layout(int, int, int, int); + method protected void measureChild(android.view.View, int, int); + method protected void measureChildWithMargins(android.view.View, int, int, int, int); + method protected void measureChildren(int, int); + method public final void offsetDescendantRectToMyCoords(android.view.View, android.graphics.Rect); + method public final void offsetRectIntoDescendantCoords(android.view.View, android.graphics.Rect); + method public boolean onInterceptHoverEvent(android.view.MotionEvent); + method public boolean onInterceptTouchEvent(android.view.MotionEvent); + method protected abstract void onLayout(boolean, int, int, int, int); + method protected boolean onRequestFocusInDescendants(int, android.graphics.Rect); + method public boolean onRequestSendAccessibilityEvent(android.view.View, android.view.accessibility.AccessibilityEvent); + method public void recomputeViewAttributes(android.view.View); + method public void removeAllViews(); + method public void removeAllViewsInLayout(); + method protected void removeDetachedView(android.view.View, boolean); + method public void removeView(android.view.View); + method public void removeViewAt(int); + method public void removeViewInLayout(android.view.View); + method public void removeViews(int, int); + method public void removeViewsInLayout(int, int); + method public void requestChildFocus(android.view.View, android.view.View); + method public boolean requestChildRectangleOnScreen(android.view.View, android.graphics.Rect, boolean); + method public void requestDisallowInterceptTouchEvent(boolean); + method public boolean requestSendAccessibilityEvent(android.view.View, android.view.accessibility.AccessibilityEvent); + method public void requestTransparentRegion(android.view.View); + method public void scheduleLayoutAnimation(); + method public void setAddStatesFromChildren(boolean); + method public void setAlwaysDrawnWithCacheEnabled(boolean); + method public void setAnimationCacheEnabled(boolean); + method protected void setChildrenDrawingCacheEnabled(boolean); + method protected void setChildrenDrawingOrderEnabled(boolean); + method protected void setChildrenDrawnWithCacheEnabled(boolean); + method public void setClipChildren(boolean); + method public void setClipToPadding(boolean); + method public void setDescendantFocusability(int); + method public void setLayoutAnimation(android.view.animation.LayoutAnimationController); + method public void setLayoutAnimationListener(android.view.animation.Animation.AnimationListener); + method public void setLayoutTransition(android.animation.LayoutTransition); + method public void setMotionEventSplittingEnabled(boolean); + method public void setOnHierarchyChangeListener(android.view.ViewGroup.OnHierarchyChangeListener); + method public void setPersistentDrawingCache(int); + method protected void setStaticTransformationsEnabled(boolean); + method public boolean shouldDelayChildPressedState(); + method public boolean showContextMenuForChild(android.view.View); + method public android.view.ActionMode startActionModeForChild(android.view.View, android.view.ActionMode.Callback); + method public void startLayoutAnimation(); + method public void startViewTransition(android.view.View); + method public void updateViewLayout(android.view.View, android.view.ViewGroup.LayoutParams); + field protected static final int CLIP_TO_PADDING_MASK = 34; // 0x22 + field public static final int FOCUS_AFTER_DESCENDANTS = 262144; // 0x40000 + field public static final int FOCUS_BEFORE_DESCENDANTS = 131072; // 0x20000 + field public static final int FOCUS_BLOCK_DESCENDANTS = 393216; // 0x60000 + field public static final int PERSISTENT_ALL_CACHES = 3; // 0x3 + field public static final int PERSISTENT_ANIMATION_CACHE = 1; // 0x1 + field public static final int PERSISTENT_NO_CACHE = 0; // 0x0 + field public static final int PERSISTENT_SCROLLING_CACHE = 2; // 0x2 + } + + public static class ViewGroup.LayoutParams { + ctor public ViewGroup.LayoutParams(android.content.Context, android.util.AttributeSet); + ctor public ViewGroup.LayoutParams(int, int); + ctor public ViewGroup.LayoutParams(android.view.ViewGroup.LayoutParams); + method public void resolveLayoutDirection(int); + method protected void setBaseAttributes(android.content.res.TypedArray, int, int); + field public static final deprecated int FILL_PARENT = -1; // 0xffffffff + field public static final int MATCH_PARENT = -1; // 0xffffffff + field public static final int WRAP_CONTENT = -2; // 0xfffffffe + field public int height; + field public android.view.animation.LayoutAnimationController.AnimationParameters layoutAnimationParameters; + field public int width; + } + + public static class ViewGroup.MarginLayoutParams extends android.view.ViewGroup.LayoutParams { + ctor public ViewGroup.MarginLayoutParams(android.content.Context, android.util.AttributeSet); + ctor public ViewGroup.MarginLayoutParams(int, int); + ctor public ViewGroup.MarginLayoutParams(android.view.ViewGroup.MarginLayoutParams); + ctor public ViewGroup.MarginLayoutParams(android.view.ViewGroup.LayoutParams); + method public int getLayoutDirection(); + method public int getMarginEnd(); + method public int getMarginStart(); + method public boolean isMarginRelative(); + method public void setLayoutDirection(int); + method public void setMarginEnd(int); + method public void setMarginStart(int); + method public void setMargins(int, int, int, int); + field public int bottomMargin; + field public int leftMargin; + field public int rightMargin; + field public int topMargin; + } + + public static abstract interface ViewGroup.OnHierarchyChangeListener { + method public abstract void onChildViewAdded(android.view.View, android.view.View); + method public abstract void onChildViewRemoved(android.view.View, android.view.View); + } + + public abstract interface ViewManager { + method public abstract void addView(android.view.View, android.view.ViewGroup.LayoutParams); + method public abstract void removeView(android.view.View); + method public abstract void updateViewLayout(android.view.View, android.view.ViewGroup.LayoutParams); + } + + public abstract interface ViewParent { + method public abstract void bringChildToFront(android.view.View); + method public abstract void childDrawableStateChanged(android.view.View); + method public abstract void clearChildFocus(android.view.View); + method public abstract void createContextMenu(android.view.ContextMenu); + method public abstract android.view.View focusSearch(android.view.View, int); + method public abstract void focusableViewAvailable(android.view.View); + method public abstract boolean getChildVisibleRect(android.view.View, android.graphics.Rect, android.graphics.Point); + method public abstract android.view.ViewParent getParent(); + method public abstract android.view.ViewParent getParentForAccessibility(); + method public abstract void invalidateChild(android.view.View, android.graphics.Rect); + method public abstract android.view.ViewParent invalidateChildInParent(int[], android.graphics.Rect); + method public abstract boolean isLayoutRequested(); + method public abstract void recomputeViewAttributes(android.view.View); + method public abstract void requestChildFocus(android.view.View, android.view.View); + method public abstract boolean requestChildRectangleOnScreen(android.view.View, android.graphics.Rect, boolean); + method public abstract void requestDisallowInterceptTouchEvent(boolean); + method public abstract void requestFitSystemWindows(); + method public abstract void requestLayout(); + method public abstract boolean requestSendAccessibilityEvent(android.view.View, android.view.accessibility.AccessibilityEvent); + method public abstract void requestTransparentRegion(android.view.View); + method public abstract boolean showContextMenuForChild(android.view.View); + method public abstract android.view.ActionMode startActionModeForChild(android.view.View, android.view.ActionMode.Callback); + } + + public class ViewPropertyAnimator { + method public android.view.ViewPropertyAnimator alpha(float); + method public android.view.ViewPropertyAnimator alphaBy(float); + method public void cancel(); + method public long getDuration(); + method public long getStartDelay(); + method public android.view.ViewPropertyAnimator rotation(float); + method public android.view.ViewPropertyAnimator rotationBy(float); + method public android.view.ViewPropertyAnimator rotationX(float); + method public android.view.ViewPropertyAnimator rotationXBy(float); + method public android.view.ViewPropertyAnimator rotationY(float); + method public android.view.ViewPropertyAnimator rotationYBy(float); + method public android.view.ViewPropertyAnimator scaleX(float); + method public android.view.ViewPropertyAnimator scaleXBy(float); + method public android.view.ViewPropertyAnimator scaleY(float); + method public android.view.ViewPropertyAnimator scaleYBy(float); + method public android.view.ViewPropertyAnimator setDuration(long); + method public android.view.ViewPropertyAnimator setInterpolator(android.animation.TimeInterpolator); + method public android.view.ViewPropertyAnimator setListener(android.animation.Animator.AnimatorListener); + method public android.view.ViewPropertyAnimator setStartDelay(long); + method public void start(); + method public android.view.ViewPropertyAnimator translationX(float); + method public android.view.ViewPropertyAnimator translationXBy(float); + method public android.view.ViewPropertyAnimator translationY(float); + method public android.view.ViewPropertyAnimator translationYBy(float); + method public android.view.ViewPropertyAnimator withEndAction(java.lang.Runnable); + method public android.view.ViewPropertyAnimator withLayer(); + method public android.view.ViewPropertyAnimator withStartAction(java.lang.Runnable); + method public android.view.ViewPropertyAnimator x(float); + method public android.view.ViewPropertyAnimator xBy(float); + method public android.view.ViewPropertyAnimator y(float); + method public android.view.ViewPropertyAnimator yBy(float); + } + + public final class ViewStub extends android.view.View { + ctor public ViewStub(android.content.Context); + ctor public ViewStub(android.content.Context, int); + ctor public ViewStub(android.content.Context, android.util.AttributeSet); + ctor public ViewStub(android.content.Context, android.util.AttributeSet, int); + method public int getInflatedId(); + method public android.view.LayoutInflater getLayoutInflater(); + method public int getLayoutResource(); + method public android.view.View inflate(); + method public void setInflatedId(int); + method public void setLayoutInflater(android.view.LayoutInflater); + method public void setLayoutResource(int); + method public void setOnInflateListener(android.view.ViewStub.OnInflateListener); + } + + public static abstract interface ViewStub.OnInflateListener { + method public abstract void onInflate(android.view.ViewStub, android.view.View); + } + + public final class ViewTreeObserver { + method public void addOnDrawListener(android.view.ViewTreeObserver.OnDrawListener); + method public void addOnGlobalFocusChangeListener(android.view.ViewTreeObserver.OnGlobalFocusChangeListener); + method public void addOnGlobalLayoutListener(android.view.ViewTreeObserver.OnGlobalLayoutListener); + method public void addOnPreDrawListener(android.view.ViewTreeObserver.OnPreDrawListener); + method public void addOnScrollChangedListener(android.view.ViewTreeObserver.OnScrollChangedListener); + method public void addOnTouchModeChangeListener(android.view.ViewTreeObserver.OnTouchModeChangeListener); + method public final void dispatchOnDraw(); + method public final void dispatchOnGlobalLayout(); + method public final boolean dispatchOnPreDraw(); + method public boolean isAlive(); + method public deprecated void removeGlobalOnLayoutListener(android.view.ViewTreeObserver.OnGlobalLayoutListener); + method public void removeOnDrawListener(android.view.ViewTreeObserver.OnDrawListener); + method public void removeOnGlobalFocusChangeListener(android.view.ViewTreeObserver.OnGlobalFocusChangeListener); + method public void removeOnGlobalLayoutListener(android.view.ViewTreeObserver.OnGlobalLayoutListener); + method public void removeOnPreDrawListener(android.view.ViewTreeObserver.OnPreDrawListener); + method public void removeOnScrollChangedListener(android.view.ViewTreeObserver.OnScrollChangedListener); + method public void removeOnTouchModeChangeListener(android.view.ViewTreeObserver.OnTouchModeChangeListener); + } + + public static abstract interface ViewTreeObserver.OnDrawListener { + method public abstract void onDraw(); + } + + public static abstract interface ViewTreeObserver.OnGlobalFocusChangeListener { + method public abstract void onGlobalFocusChanged(android.view.View, android.view.View); + } + + public static abstract interface ViewTreeObserver.OnGlobalLayoutListener { + method public abstract void onGlobalLayout(); + } + + public static abstract interface ViewTreeObserver.OnPreDrawListener { + method public abstract boolean onPreDraw(); + } + + public static abstract interface ViewTreeObserver.OnScrollChangedListener { + method public abstract void onScrollChanged(); + } + + public static abstract interface ViewTreeObserver.OnTouchModeChangeListener { + method public abstract void onTouchModeChanged(boolean); + } + + public abstract class Window { + ctor public Window(android.content.Context); + method public abstract void addContentView(android.view.View, android.view.ViewGroup.LayoutParams); + method public void addFlags(int); + method public void clearFlags(int); + method public abstract void closeAllPanels(); + method public abstract void closePanel(int); + method public android.view.View findViewById(int); + method public final android.view.WindowManager.LayoutParams getAttributes(); + method public final android.view.Window.Callback getCallback(); + method public final android.view.Window getContainer(); + method public final android.content.Context getContext(); + method public abstract android.view.View getCurrentFocus(); + method public abstract android.view.View getDecorView(); + method protected final int getFeatures(); + method protected final int getForcedWindowFlags(); + method public abstract android.view.LayoutInflater getLayoutInflater(); + method protected final int getLocalFeatures(); + method public abstract int getVolumeControlStream(); + method public android.view.WindowManager getWindowManager(); + method public final android.content.res.TypedArray getWindowStyle(); + method public final boolean hasChildren(); + method public boolean hasFeature(int); + method protected final boolean hasSoftInputMode(); + method public abstract void invalidatePanelMenu(int); + method public final boolean isActive(); + method public abstract boolean isFloating(); + method public abstract boolean isShortcutKey(int, android.view.KeyEvent); + method public final void makeActive(); + method protected abstract void onActive(); + method public abstract void onConfigurationChanged(android.content.res.Configuration); + method public abstract void openPanel(int, android.view.KeyEvent); + method public abstract android.view.View peekDecorView(); + method public abstract boolean performContextMenuIdentifierAction(int, int); + method public abstract boolean performPanelIdentifierAction(int, int, int); + method public abstract boolean performPanelShortcut(int, int, android.view.KeyEvent, int); + method public boolean requestFeature(int); + method public abstract void restoreHierarchyState(android.os.Bundle); + method public abstract android.os.Bundle saveHierarchyState(); + method public void setAttributes(android.view.WindowManager.LayoutParams); + method public abstract void setBackgroundDrawable(android.graphics.drawable.Drawable); + method public void setBackgroundDrawableResource(int); + method public void setCallback(android.view.Window.Callback); + method public abstract void setChildDrawable(int, android.graphics.drawable.Drawable); + method public abstract void setChildInt(int, int); + method public void setContainer(android.view.Window); + method public abstract void setContentView(int); + method public abstract void setContentView(android.view.View); + method public abstract void setContentView(android.view.View, android.view.ViewGroup.LayoutParams); + method protected void setDefaultWindowFormat(int); + method public void setDimAmount(float); + method public abstract void setFeatureDrawable(int, android.graphics.drawable.Drawable); + method public abstract void setFeatureDrawableAlpha(int, int); + method public abstract void setFeatureDrawableResource(int, int); + method public abstract void setFeatureDrawableUri(int, android.net.Uri); + method public abstract void setFeatureInt(int, int); + method public void setFlags(int, int); + method public void setFormat(int); + method public void setGravity(int); + method public void setLayout(int, int); + method public void setSoftInputMode(int); + method public abstract void setTitle(java.lang.CharSequence); + method public abstract void setTitleColor(int); + method public void setType(int); + method public void setUiOptions(int); + method public void setUiOptions(int, int); + method public abstract void setVolumeControlStream(int); + method public void setWindowAnimations(int); + method public void setWindowManager(android.view.WindowManager, android.os.IBinder, java.lang.String); + method public void setWindowManager(android.view.WindowManager, android.os.IBinder, java.lang.String, boolean); + method public abstract boolean superDispatchGenericMotionEvent(android.view.MotionEvent); + method public abstract boolean superDispatchKeyEvent(android.view.KeyEvent); + method public abstract boolean superDispatchKeyShortcutEvent(android.view.KeyEvent); + method public abstract boolean superDispatchTouchEvent(android.view.MotionEvent); + method public abstract boolean superDispatchTrackballEvent(android.view.MotionEvent); + method public abstract void takeInputQueue(android.view.InputQueue.Callback); + method public abstract void takeKeyEvents(boolean); + method public abstract void takeSurface(android.view.SurfaceHolder.Callback2); + method public abstract void togglePanel(int, android.view.KeyEvent); + field protected static final int DEFAULT_FEATURES = 65; // 0x41 + field public static final int FEATURE_ACTION_BAR = 8; // 0x8 + field public static final int FEATURE_ACTION_BAR_OVERLAY = 9; // 0x9 + field public static final int FEATURE_ACTION_MODE_OVERLAY = 10; // 0xa + field public static final int FEATURE_CONTEXT_MENU = 6; // 0x6 + field public static final int FEATURE_CUSTOM_TITLE = 7; // 0x7 + field public static final int FEATURE_INDETERMINATE_PROGRESS = 5; // 0x5 + field public static final int FEATURE_LEFT_ICON = 3; // 0x3 + field public static final int FEATURE_NO_TITLE = 1; // 0x1 + field public static final int FEATURE_OPTIONS_PANEL = 0; // 0x0 + field public static final int FEATURE_PROGRESS = 2; // 0x2 + field public static final int FEATURE_RIGHT_ICON = 4; // 0x4 + field public static final int ID_ANDROID_CONTENT = 16908290; // 0x1020002 + field public static final int PROGRESS_END = 10000; // 0x2710 + field public static final int PROGRESS_INDETERMINATE_OFF = -4; // 0xfffffffc + field public static final int PROGRESS_INDETERMINATE_ON = -3; // 0xfffffffd + field public static final int PROGRESS_SECONDARY_END = 30000; // 0x7530 + field public static final int PROGRESS_SECONDARY_START = 20000; // 0x4e20 + field public static final int PROGRESS_START = 0; // 0x0 + field public static final int PROGRESS_VISIBILITY_OFF = -2; // 0xfffffffe + field public static final int PROGRESS_VISIBILITY_ON = -1; // 0xffffffff + } + + public static abstract interface Window.Callback { + method public abstract boolean dispatchGenericMotionEvent(android.view.MotionEvent); + method public abstract boolean dispatchKeyEvent(android.view.KeyEvent); + method public abstract boolean dispatchKeyShortcutEvent(android.view.KeyEvent); + method public abstract boolean dispatchPopulateAccessibilityEvent(android.view.accessibility.AccessibilityEvent); + method public abstract boolean dispatchTouchEvent(android.view.MotionEvent); + method public abstract boolean dispatchTrackballEvent(android.view.MotionEvent); + method public abstract void onActionModeFinished(android.view.ActionMode); + method public abstract void onActionModeStarted(android.view.ActionMode); + method public abstract void onAttachedToWindow(); + method public abstract void onContentChanged(); + method public abstract boolean onCreatePanelMenu(int, android.view.Menu); + method public abstract android.view.View onCreatePanelView(int); + method public abstract void onDetachedFromWindow(); + method public abstract boolean onMenuItemSelected(int, android.view.MenuItem); + method public abstract boolean onMenuOpened(int, android.view.Menu); + method public abstract void onPanelClosed(int, android.view.Menu); + method public abstract boolean onPreparePanel(int, android.view.View, android.view.Menu); + method public abstract boolean onSearchRequested(); + method public abstract void onWindowAttributesChanged(android.view.WindowManager.LayoutParams); + method public abstract void onWindowFocusChanged(boolean); + method public abstract android.view.ActionMode onWindowStartingActionMode(android.view.ActionMode.Callback); + } + + public abstract interface WindowManager implements android.view.ViewManager { + method public abstract android.view.Display getDefaultDisplay(); + method public abstract void removeViewImmediate(android.view.View); + } + + public static class WindowManager.BadTokenException extends java.lang.RuntimeException { + ctor public WindowManager.BadTokenException(); + ctor public WindowManager.BadTokenException(java.lang.String); + } + + public static class WindowManager.InvalidDisplayException extends java.lang.RuntimeException { + ctor public WindowManager.InvalidDisplayException(); + ctor public WindowManager.InvalidDisplayException(java.lang.String); + } + + public static class WindowManager.LayoutParams extends android.view.ViewGroup.LayoutParams implements android.os.Parcelable { + ctor public WindowManager.LayoutParams(); + ctor public WindowManager.LayoutParams(int); + ctor public WindowManager.LayoutParams(int, int); + ctor public WindowManager.LayoutParams(int, int, int); + ctor public WindowManager.LayoutParams(int, int, int, int, int); + ctor public WindowManager.LayoutParams(int, int, int, int, int, int, int); + ctor public WindowManager.LayoutParams(android.os.Parcel); + method public final int copyFrom(android.view.WindowManager.LayoutParams); + method public java.lang.String debug(java.lang.String); + method public int describeContents(); + method public final java.lang.CharSequence getTitle(); + method public static boolean mayUseInputMethod(int); + method public final void setTitle(java.lang.CharSequence); + method public void writeToParcel(android.os.Parcel, int); + field public static final int ALPHA_CHANGED = 128; // 0x80 + field public static final int ANIMATION_CHANGED = 16; // 0x10 + field public static final float BRIGHTNESS_OVERRIDE_FULL = 1.0f; + field public static final float BRIGHTNESS_OVERRIDE_NONE = -1.0f; + field public static final float BRIGHTNESS_OVERRIDE_OFF = 0.0f; + field public static final android.os.Parcelable.Creator CREATOR; + field public static final int DIM_AMOUNT_CHANGED = 32; // 0x20 + field public static final int FIRST_APPLICATION_WINDOW = 1; // 0x1 + field public static final int FIRST_SUB_WINDOW = 1000; // 0x3e8 + field public static final int FIRST_SYSTEM_WINDOW = 2000; // 0x7d0 + field public static final int FLAGS_CHANGED = 4; // 0x4 + field public static final int FLAG_ALLOW_LOCK_WHILE_SCREEN_ON = 1; // 0x1 + field public static final int FLAG_ALT_FOCUSABLE_IM = 131072; // 0x20000 + field public static final deprecated int FLAG_BLUR_BEHIND = 4; // 0x4 + field public static final int FLAG_DIM_BEHIND = 2; // 0x2 + field public static final int FLAG_DISMISS_KEYGUARD = 4194304; // 0x400000 + field public static final deprecated int FLAG_DITHER = 4096; // 0x1000 + field public static final int FLAG_FORCE_NOT_FULLSCREEN = 2048; // 0x800 + field public static final int FLAG_FULLSCREEN = 1024; // 0x400 + field public static final int FLAG_HARDWARE_ACCELERATED = 16777216; // 0x1000000 + field public static final int FLAG_IGNORE_CHEEK_PRESSES = 32768; // 0x8000 + field public static final int FLAG_KEEP_SCREEN_ON = 128; // 0x80 + field public static final int FLAG_LAYOUT_INSET_DECOR = 65536; // 0x10000 + field public static final int FLAG_LAYOUT_IN_SCREEN = 256; // 0x100 + field public static final int FLAG_LAYOUT_NO_LIMITS = 512; // 0x200 + field public static final int FLAG_NOT_FOCUSABLE = 8; // 0x8 + field public static final int FLAG_NOT_TOUCHABLE = 16; // 0x10 + field public static final int FLAG_NOT_TOUCH_MODAL = 32; // 0x20 + field public static final int FLAG_SCALED = 16384; // 0x4000 + field public static final int FLAG_SECURE = 8192; // 0x2000 + field public static final int FLAG_SHOW_WALLPAPER = 1048576; // 0x100000 + field public static final int FLAG_SHOW_WHEN_LOCKED = 524288; // 0x80000 + field public static final int FLAG_SPLIT_TOUCH = 8388608; // 0x800000 + field public static final int FLAG_TOUCHABLE_WHEN_WAKING = 64; // 0x40 + field public static final int FLAG_TURN_SCREEN_ON = 2097152; // 0x200000 + field public static final int FLAG_WATCH_OUTSIDE_TOUCH = 262144; // 0x40000 + field public static final int FORMAT_CHANGED = 8; // 0x8 + field public static final int LAST_APPLICATION_WINDOW = 99; // 0x63 + field public static final int LAST_SUB_WINDOW = 1999; // 0x7cf + field public static final int LAST_SYSTEM_WINDOW = 2999; // 0xbb7 + field public static final int LAYOUT_CHANGED = 1; // 0x1 + field public static final int MEMORY_TYPE_CHANGED = 256; // 0x100 + field public static final deprecated int MEMORY_TYPE_GPU = 2; // 0x2 + field public static final deprecated int MEMORY_TYPE_HARDWARE = 1; // 0x1 + field public static final deprecated int MEMORY_TYPE_NORMAL = 0; // 0x0 + field public static final deprecated int MEMORY_TYPE_PUSH_BUFFERS = 3; // 0x3 + field public static final int SCREEN_BRIGHTNESS_CHANGED = 2048; // 0x800 + field public static final int SCREEN_ORIENTATION_CHANGED = 1024; // 0x400 + field public static final int SOFT_INPUT_ADJUST_NOTHING = 48; // 0x30 + field public static final int SOFT_INPUT_ADJUST_PAN = 32; // 0x20 + field public static final int SOFT_INPUT_ADJUST_RESIZE = 16; // 0x10 + field public static final int SOFT_INPUT_ADJUST_UNSPECIFIED = 0; // 0x0 + field public static final int SOFT_INPUT_IS_FORWARD_NAVIGATION = 256; // 0x100 + field public static final int SOFT_INPUT_MASK_ADJUST = 240; // 0xf0 + field public static final int SOFT_INPUT_MASK_STATE = 15; // 0xf + field public static final int SOFT_INPUT_MODE_CHANGED = 512; // 0x200 + field public static final int SOFT_INPUT_STATE_ALWAYS_HIDDEN = 3; // 0x3 + field public static final int SOFT_INPUT_STATE_ALWAYS_VISIBLE = 5; // 0x5 + field public static final int SOFT_INPUT_STATE_HIDDEN = 2; // 0x2 + field public static final int SOFT_INPUT_STATE_UNCHANGED = 1; // 0x1 + field public static final int SOFT_INPUT_STATE_UNSPECIFIED = 0; // 0x0 + field public static final int SOFT_INPUT_STATE_VISIBLE = 4; // 0x4 + field public static final int TITLE_CHANGED = 64; // 0x40 + field public static final int TYPE_APPLICATION = 2; // 0x2 + field public static final int TYPE_APPLICATION_ATTACHED_DIALOG = 1003; // 0x3eb + field public static final int TYPE_APPLICATION_MEDIA = 1001; // 0x3e9 + field public static final int TYPE_APPLICATION_PANEL = 1000; // 0x3e8 + field public static final int TYPE_APPLICATION_STARTING = 3; // 0x3 + field public static final int TYPE_APPLICATION_SUB_PANEL = 1002; // 0x3ea + field public static final int TYPE_BASE_APPLICATION = 1; // 0x1 + field public static final int TYPE_CHANGED = 2; // 0x2 + field public static final int TYPE_INPUT_METHOD = 2011; // 0x7db + field public static final int TYPE_INPUT_METHOD_DIALOG = 2012; // 0x7dc + field public static final int TYPE_KEYGUARD = 2004; // 0x7d4 + field public static final int TYPE_KEYGUARD_DIALOG = 2009; // 0x7d9 + field public static final int TYPE_PHONE = 2002; // 0x7d2 + field public static final int TYPE_PRIORITY_PHONE = 2007; // 0x7d7 + field public static final int TYPE_SEARCH_BAR = 2001; // 0x7d1 + field public static final int TYPE_STATUS_BAR = 2000; // 0x7d0 + field public static final int TYPE_STATUS_BAR_PANEL = 2014; // 0x7de + field public static final int TYPE_SYSTEM_ALERT = 2003; // 0x7d3 + field public static final int TYPE_SYSTEM_DIALOG = 2008; // 0x7d8 + field public static final int TYPE_SYSTEM_ERROR = 2010; // 0x7da + field public static final int TYPE_SYSTEM_OVERLAY = 2006; // 0x7d6 + field public static final int TYPE_TOAST = 2005; // 0x7d5 + field public static final int TYPE_WALLPAPER = 2013; // 0x7dd + field public float alpha; + field public float buttonBrightness; + field public float dimAmount; + field public int flags; + field public int format; + field public int gravity; + field public float horizontalMargin; + field public float horizontalWeight; + field public deprecated int memoryType; + field public java.lang.String packageName; + field public float screenBrightness; + field public int screenOrientation; + field public int softInputMode; + field public int systemUiVisibility; + field public android.os.IBinder token; + field public int type; + field public float verticalMargin; + field public float verticalWeight; + field public int windowAnimations; + field public int x; + field public int y; + } + +} + +package android.view.accessibility { + + public final class AccessibilityEvent extends android.view.accessibility.AccessibilityRecord implements android.os.Parcelable { + method public void appendRecord(android.view.accessibility.AccessibilityRecord); + method public int describeContents(); + method public static java.lang.String eventTypeToString(int); + method public int getAction(); + method public long getEventTime(); + method public int getEventType(); + method public int getMovementGranularity(); + method public java.lang.CharSequence getPackageName(); + method public android.view.accessibility.AccessibilityRecord getRecord(int); + method public int getRecordCount(); + method public void initFromParcel(android.os.Parcel); + method public static android.view.accessibility.AccessibilityEvent obtain(int); + method public static android.view.accessibility.AccessibilityEvent obtain(android.view.accessibility.AccessibilityEvent); + method public static android.view.accessibility.AccessibilityEvent obtain(); + method public void setAction(int); + method public void setEventTime(long); + method public void setEventType(int); + method public void setMovementGranularity(int); + method public void setPackageName(java.lang.CharSequence); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + field public static final int INVALID_POSITION = -1; // 0xffffffff + field public static final deprecated int MAX_TEXT_LENGTH = 500; // 0x1f4 + field public static final int TYPES_ALL_MASK = -1; // 0xffffffff + field public static final int TYPE_ANNOUNCEMENT = 16384; // 0x4000 + field public static final int TYPE_GESTURE_DETECTION_END = 524288; // 0x80000 + field public static final int TYPE_GESTURE_DETECTION_START = 262144; // 0x40000 + field public static final int TYPE_NOTIFICATION_STATE_CHANGED = 64; // 0x40 + field public static final int TYPE_TOUCH_EXPLORATION_GESTURE_END = 1024; // 0x400 + field public static final int TYPE_TOUCH_EXPLORATION_GESTURE_START = 512; // 0x200 + field public static final int TYPE_TOUCH_INTERACTION_END = 2097152; // 0x200000 + field public static final int TYPE_TOUCH_INTERACTION_START = 1048576; // 0x100000 + field public static final int TYPE_VIEW_ACCESSIBILITY_FOCUSED = 32768; // 0x8000 + field public static final int TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED = 65536; // 0x10000 + field public static final int TYPE_VIEW_CLICKED = 1; // 0x1 + field public static final int TYPE_VIEW_FOCUSED = 8; // 0x8 + field public static final int TYPE_VIEW_HOVER_ENTER = 128; // 0x80 + field public static final int TYPE_VIEW_HOVER_EXIT = 256; // 0x100 + field public static final int TYPE_VIEW_LONG_CLICKED = 2; // 0x2 + field public static final int TYPE_VIEW_SCROLLED = 4096; // 0x1000 + field public static final int TYPE_VIEW_SELECTED = 4; // 0x4 + field public static final int TYPE_VIEW_TEXT_CHANGED = 16; // 0x10 + field public static final int TYPE_VIEW_TEXT_SELECTION_CHANGED = 8192; // 0x2000 + field public static final int TYPE_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY = 131072; // 0x20000 + field public static final int TYPE_WINDOW_CONTENT_CHANGED = 2048; // 0x800 + field public static final int TYPE_WINDOW_STATE_CHANGED = 32; // 0x20 + } + + public abstract interface AccessibilityEventSource { + method public abstract void sendAccessibilityEvent(int); + method public abstract void sendAccessibilityEventUnchecked(android.view.accessibility.AccessibilityEvent); + } + + public final class AccessibilityManager { + method public boolean addAccessibilityStateChangeListener(android.view.accessibility.AccessibilityManager.AccessibilityStateChangeListener); + method public deprecated java.util.List getAccessibilityServiceList(); + method public java.util.List getEnabledAccessibilityServiceList(int); + method public java.util.List getInstalledAccessibilityServiceList(); + method public void interrupt(); + method public boolean isEnabled(); + method public boolean isTouchExplorationEnabled(); + method public boolean removeAccessibilityStateChangeListener(android.view.accessibility.AccessibilityManager.AccessibilityStateChangeListener); + method public void sendAccessibilityEvent(android.view.accessibility.AccessibilityEvent); + } + + public static abstract interface AccessibilityManager.AccessibilityStateChangeListener { + method public abstract void onAccessibilityStateChanged(boolean); + } + + public class AccessibilityNodeInfo implements android.os.Parcelable { + method public void addAction(int); + method public void addChild(android.view.View); + method public void addChild(android.view.View, int); + method public int describeContents(); + method public java.util.List findAccessibilityNodeInfosByText(java.lang.String); + method public android.view.accessibility.AccessibilityNodeInfo findFocus(int); + method public android.view.accessibility.AccessibilityNodeInfo focusSearch(int); + method public int getActions(); + method public void getBoundsInParent(android.graphics.Rect); + method public void getBoundsInScreen(android.graphics.Rect); + method public android.view.accessibility.AccessibilityNodeInfo getChild(int); + method public int getChildCount(); + method public java.lang.CharSequence getClassName(); + method public java.lang.CharSequence getContentDescription(); + method public android.view.accessibility.AccessibilityNodeInfo getLabelFor(); + method public android.view.accessibility.AccessibilityNodeInfo getLabeledBy(); + method public int getMovementGranularities(); + method public java.lang.CharSequence getPackageName(); + method public android.view.accessibility.AccessibilityNodeInfo getParent(); + method public java.lang.CharSequence getText(); + method public int getWindowId(); + method public boolean isAccessibilityFocused(); + method public boolean isCheckable(); + method public boolean isChecked(); + method public boolean isClickable(); + method public boolean isEnabled(); + method public boolean isFocusable(); + method public boolean isFocused(); + method public boolean isLongClickable(); + method public boolean isPassword(); + method public boolean isScrollable(); + method public boolean isSelected(); + method public boolean isVisibleToUser(); + method public static android.view.accessibility.AccessibilityNodeInfo obtain(android.view.View); + method public static android.view.accessibility.AccessibilityNodeInfo obtain(android.view.View, int); + method public static android.view.accessibility.AccessibilityNodeInfo obtain(); + method public static android.view.accessibility.AccessibilityNodeInfo obtain(android.view.accessibility.AccessibilityNodeInfo); + method public boolean performAction(int); + method public boolean performAction(int, android.os.Bundle); + method public void recycle(); + method public void setAccessibilityFocused(boolean); + method public void setBoundsInParent(android.graphics.Rect); + method public void setBoundsInScreen(android.graphics.Rect); + method public void setCheckable(boolean); + method public void setChecked(boolean); + method public void setClassName(java.lang.CharSequence); + method public void setClickable(boolean); + method public void setContentDescription(java.lang.CharSequence); + method public void setEnabled(boolean); + method public void setFocusable(boolean); + method public void setFocused(boolean); + method public void setLabelFor(android.view.View); + method public void setLabelFor(android.view.View, int); + method public void setLabeledBy(android.view.View); + method public void setLabeledBy(android.view.View, int); + method public void setLongClickable(boolean); + method public void setMovementGranularities(int); + method public void setPackageName(java.lang.CharSequence); + method public void setParent(android.view.View); + method public void setParent(android.view.View, int); + method public void setPassword(boolean); + method public void setScrollable(boolean); + method public void setSelected(boolean); + method public void setSource(android.view.View); + method public void setSource(android.view.View, int); + method public void setText(java.lang.CharSequence); + method public void setVisibleToUser(boolean); + method public void writeToParcel(android.os.Parcel, int); + field public static final int ACTION_ACCESSIBILITY_FOCUS = 64; // 0x40 + field public static final java.lang.String ACTION_ARGUMENT_HTML_ELEMENT_STRING = "ACTION_ARGUMENT_HTML_ELEMENT_STRING"; + field public static final java.lang.String ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT = "ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT"; + field public static final int ACTION_CLEAR_ACCESSIBILITY_FOCUS = 128; // 0x80 + field public static final int ACTION_CLEAR_FOCUS = 2; // 0x2 + field public static final int ACTION_CLEAR_SELECTION = 8; // 0x8 + field public static final int ACTION_CLICK = 16; // 0x10 + field public static final int ACTION_FOCUS = 1; // 0x1 + field public static final int ACTION_LONG_CLICK = 32; // 0x20 + field public static final int ACTION_NEXT_AT_MOVEMENT_GRANULARITY = 256; // 0x100 + field public static final int ACTION_NEXT_HTML_ELEMENT = 1024; // 0x400 + field public static final int ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY = 512; // 0x200 + field public static final int ACTION_PREVIOUS_HTML_ELEMENT = 2048; // 0x800 + field public static final int ACTION_SCROLL_BACKWARD = 8192; // 0x2000 + field public static final int ACTION_SCROLL_FORWARD = 4096; // 0x1000 + field public static final int ACTION_SELECT = 4; // 0x4 + field public static final android.os.Parcelable.Creator CREATOR; + field public static final int FOCUS_ACCESSIBILITY = 2; // 0x2 + field public static final int FOCUS_INPUT = 1; // 0x1 + field public static final int MOVEMENT_GRANULARITY_CHARACTER = 1; // 0x1 + field public static final int MOVEMENT_GRANULARITY_LINE = 4; // 0x4 + field public static final int MOVEMENT_GRANULARITY_PAGE = 16; // 0x10 + field public static final int MOVEMENT_GRANULARITY_PARAGRAPH = 8; // 0x8 + field public static final int MOVEMENT_GRANULARITY_WORD = 2; // 0x2 + } + + public abstract class AccessibilityNodeProvider { + ctor public AccessibilityNodeProvider(); + method public android.view.accessibility.AccessibilityNodeInfo createAccessibilityNodeInfo(int); + method public java.util.List findAccessibilityNodeInfosByText(java.lang.String, int); + method public boolean performAction(int, int, android.os.Bundle); + } + + public class AccessibilityRecord { + method public int getAddedCount(); + method public java.lang.CharSequence getBeforeText(); + method public java.lang.CharSequence getClassName(); + method public java.lang.CharSequence getContentDescription(); + method public int getCurrentItemIndex(); + method public int getFromIndex(); + method public int getItemCount(); + method public int getMaxScrollX(); + method public int getMaxScrollY(); + method public android.os.Parcelable getParcelableData(); + method public int getRemovedCount(); + method public int getScrollX(); + method public int getScrollY(); + method public android.view.accessibility.AccessibilityNodeInfo getSource(); + method public java.util.List getText(); + method public int getToIndex(); + method public int getWindowId(); + method public boolean isChecked(); + method public boolean isEnabled(); + method public boolean isFullScreen(); + method public boolean isPassword(); + method public boolean isScrollable(); + method public static android.view.accessibility.AccessibilityRecord obtain(android.view.accessibility.AccessibilityRecord); + method public static android.view.accessibility.AccessibilityRecord obtain(); + method public void recycle(); + method public void setAddedCount(int); + method public void setBeforeText(java.lang.CharSequence); + method public void setChecked(boolean); + method public void setClassName(java.lang.CharSequence); + method public void setContentDescription(java.lang.CharSequence); + method public void setCurrentItemIndex(int); + method public void setEnabled(boolean); + method public void setFromIndex(int); + method public void setFullScreen(boolean); + method public void setItemCount(int); + method public void setMaxScrollX(int); + method public void setMaxScrollY(int); + method public void setParcelableData(android.os.Parcelable); + method public void setPassword(boolean); + method public void setRemovedCount(int); + method public void setScrollX(int); + method public void setScrollY(int); + method public void setScrollable(boolean); + method public void setSource(android.view.View); + method public void setSource(android.view.View, int); + method public void setToIndex(int); + } + +} + +package android.view.animation { + + public class AccelerateDecelerateInterpolator implements android.view.animation.Interpolator { + ctor public AccelerateDecelerateInterpolator(); + ctor public AccelerateDecelerateInterpolator(android.content.Context, android.util.AttributeSet); + method public float getInterpolation(float); + } + + public class AccelerateInterpolator implements android.view.animation.Interpolator { + ctor public AccelerateInterpolator(); + ctor public AccelerateInterpolator(float); + ctor public AccelerateInterpolator(android.content.Context, android.util.AttributeSet); + method public float getInterpolation(float); + } + + public class AlphaAnimation extends android.view.animation.Animation { + ctor public AlphaAnimation(android.content.Context, android.util.AttributeSet); + ctor public AlphaAnimation(float, float); + } + + public abstract class Animation implements java.lang.Cloneable { + ctor public Animation(); + ctor public Animation(android.content.Context, android.util.AttributeSet); + method protected void applyTransformation(float, android.view.animation.Transformation); + method public void cancel(); + method public long computeDurationHint(); + method protected void ensureInterpolator(); + method public int getBackgroundColor(); + method public boolean getDetachWallpaper(); + method public long getDuration(); + method public boolean getFillAfter(); + method public boolean getFillBefore(); + method public android.view.animation.Interpolator getInterpolator(); + method public int getRepeatCount(); + method public int getRepeatMode(); + method protected float getScaleFactor(); + method public long getStartOffset(); + method public long getStartTime(); + method public boolean getTransformation(long, android.view.animation.Transformation); + method public boolean getTransformation(long, android.view.animation.Transformation, float); + method public int getZAdjustment(); + method public boolean hasEnded(); + method public boolean hasStarted(); + method public void initialize(int, int, int, int); + method public boolean isFillEnabled(); + method public boolean isInitialized(); + method public void reset(); + method protected float resolveSize(int, float, int, int); + method public void restrictDuration(long); + method public void scaleCurrentDuration(float); + method public void setAnimationListener(android.view.animation.Animation.AnimationListener); + method public void setBackgroundColor(int); + method public void setDetachWallpaper(boolean); + method public void setDuration(long); + method public void setFillAfter(boolean); + method public void setFillBefore(boolean); + method public void setFillEnabled(boolean); + method public void setInterpolator(android.content.Context, int); + method public void setInterpolator(android.view.animation.Interpolator); + method public void setRepeatCount(int); + method public void setRepeatMode(int); + method public void setStartOffset(long); + method public void setStartTime(long); + method public void setZAdjustment(int); + method public void start(); + method public void startNow(); + method public boolean willChangeBounds(); + method public boolean willChangeTransformationMatrix(); + field public static final int ABSOLUTE = 0; // 0x0 + field public static final int INFINITE = -1; // 0xffffffff + field public static final int RELATIVE_TO_PARENT = 2; // 0x2 + field public static final int RELATIVE_TO_SELF = 1; // 0x1 + field public static final int RESTART = 1; // 0x1 + field public static final int REVERSE = 2; // 0x2 + field public static final int START_ON_FIRST_FRAME = -1; // 0xffffffff + field public static final int ZORDER_BOTTOM = -1; // 0xffffffff + field public static final int ZORDER_NORMAL = 0; // 0x0 + field public static final int ZORDER_TOP = 1; // 0x1 + } + + public static abstract interface Animation.AnimationListener { + method public abstract void onAnimationEnd(android.view.animation.Animation); + method public abstract void onAnimationRepeat(android.view.animation.Animation); + method public abstract void onAnimationStart(android.view.animation.Animation); + } + + protected static class Animation.Description { + ctor protected Animation.Description(); + field public int type; + field public float value; + } + + public class AnimationSet extends android.view.animation.Animation { + ctor public AnimationSet(android.content.Context, android.util.AttributeSet); + ctor public AnimationSet(boolean); + method public void addAnimation(android.view.animation.Animation); + method public java.util.List getAnimations(); + } + + public class AnimationUtils { + ctor public AnimationUtils(); + method public static long currentAnimationTimeMillis(); + method public static android.view.animation.Animation loadAnimation(android.content.Context, int) throws android.content.res.Resources.NotFoundException; + method public static android.view.animation.Interpolator loadInterpolator(android.content.Context, int) throws android.content.res.Resources.NotFoundException; + method public static android.view.animation.LayoutAnimationController loadLayoutAnimation(android.content.Context, int) throws android.content.res.Resources.NotFoundException; + method public static android.view.animation.Animation makeInAnimation(android.content.Context, boolean); + method public static android.view.animation.Animation makeInChildBottomAnimation(android.content.Context); + method public static android.view.animation.Animation makeOutAnimation(android.content.Context, boolean); + } + + public class AnticipateInterpolator implements android.view.animation.Interpolator { + ctor public AnticipateInterpolator(); + ctor public AnticipateInterpolator(float); + ctor public AnticipateInterpolator(android.content.Context, android.util.AttributeSet); + method public float getInterpolation(float); + } + + public class AnticipateOvershootInterpolator implements android.view.animation.Interpolator { + ctor public AnticipateOvershootInterpolator(); + ctor public AnticipateOvershootInterpolator(float); + ctor public AnticipateOvershootInterpolator(float, float); + ctor public AnticipateOvershootInterpolator(android.content.Context, android.util.AttributeSet); + method public float getInterpolation(float); + } + + public class BounceInterpolator implements android.view.animation.Interpolator { + ctor public BounceInterpolator(); + ctor public BounceInterpolator(android.content.Context, android.util.AttributeSet); + method public float getInterpolation(float); + } + + public class CycleInterpolator implements android.view.animation.Interpolator { + ctor public CycleInterpolator(float); + ctor public CycleInterpolator(android.content.Context, android.util.AttributeSet); + method public float getInterpolation(float); + } + + public class DecelerateInterpolator implements android.view.animation.Interpolator { + ctor public DecelerateInterpolator(); + ctor public DecelerateInterpolator(float); + ctor public DecelerateInterpolator(android.content.Context, android.util.AttributeSet); + method public float getInterpolation(float); + } + + public class GridLayoutAnimationController extends android.view.animation.LayoutAnimationController { + ctor public GridLayoutAnimationController(android.content.Context, android.util.AttributeSet); + ctor public GridLayoutAnimationController(android.view.animation.Animation); + ctor public GridLayoutAnimationController(android.view.animation.Animation, float, float); + method public float getColumnDelay(); + method public int getDirection(); + method public int getDirectionPriority(); + method public float getRowDelay(); + method public void setColumnDelay(float); + method public void setDirection(int); + method public void setDirectionPriority(int); + method public void setRowDelay(float); + field public static final int DIRECTION_BOTTOM_TO_TOP = 2; // 0x2 + field public static final int DIRECTION_HORIZONTAL_MASK = 1; // 0x1 + field public static final int DIRECTION_LEFT_TO_RIGHT = 0; // 0x0 + field public static final int DIRECTION_RIGHT_TO_LEFT = 1; // 0x1 + field public static final int DIRECTION_TOP_TO_BOTTOM = 0; // 0x0 + field public static final int DIRECTION_VERTICAL_MASK = 2; // 0x2 + field public static final int PRIORITY_COLUMN = 1; // 0x1 + field public static final int PRIORITY_NONE = 0; // 0x0 + field public static final int PRIORITY_ROW = 2; // 0x2 + } + + public static class GridLayoutAnimationController.AnimationParameters extends android.view.animation.LayoutAnimationController.AnimationParameters { + ctor public GridLayoutAnimationController.AnimationParameters(); + field public int column; + field public int columnsCount; + field public int row; + field public int rowsCount; + } + + public abstract interface Interpolator implements android.animation.TimeInterpolator { + } + + public class LayoutAnimationController { + ctor public LayoutAnimationController(android.content.Context, android.util.AttributeSet); + ctor public LayoutAnimationController(android.view.animation.Animation); + ctor public LayoutAnimationController(android.view.animation.Animation, float); + method public android.view.animation.Animation getAnimation(); + method public final android.view.animation.Animation getAnimationForView(android.view.View); + method public float getDelay(); + method protected long getDelayForView(android.view.View); + method public android.view.animation.Interpolator getInterpolator(); + method public int getOrder(); + method protected int getTransformedIndex(android.view.animation.LayoutAnimationController.AnimationParameters); + method public boolean isDone(); + method public void setAnimation(android.content.Context, int); + method public void setAnimation(android.view.animation.Animation); + method public void setDelay(float); + method public void setInterpolator(android.content.Context, int); + method public void setInterpolator(android.view.animation.Interpolator); + method public void setOrder(int); + method public void start(); + method public boolean willOverlap(); + field public static final int ORDER_NORMAL = 0; // 0x0 + field public static final int ORDER_RANDOM = 2; // 0x2 + field public static final int ORDER_REVERSE = 1; // 0x1 + field protected android.view.animation.Animation mAnimation; + field protected android.view.animation.Interpolator mInterpolator; + field protected java.util.Random mRandomizer; + } + + public static class LayoutAnimationController.AnimationParameters { + ctor public LayoutAnimationController.AnimationParameters(); + field public int count; + field public int index; + } + + public class LinearInterpolator implements android.view.animation.Interpolator { + ctor public LinearInterpolator(); + ctor public LinearInterpolator(android.content.Context, android.util.AttributeSet); + method public float getInterpolation(float); + } + + public class OvershootInterpolator implements android.view.animation.Interpolator { + ctor public OvershootInterpolator(); + ctor public OvershootInterpolator(float); + ctor public OvershootInterpolator(android.content.Context, android.util.AttributeSet); + method public float getInterpolation(float); + } + + public class RotateAnimation extends android.view.animation.Animation { + ctor public RotateAnimation(android.content.Context, android.util.AttributeSet); + ctor public RotateAnimation(float, float); + ctor public RotateAnimation(float, float, float, float); + ctor public RotateAnimation(float, float, int, float, int, float); + } + + public class ScaleAnimation extends android.view.animation.Animation { + ctor public ScaleAnimation(android.content.Context, android.util.AttributeSet); + ctor public ScaleAnimation(float, float, float, float); + ctor public ScaleAnimation(float, float, float, float, float, float); + ctor public ScaleAnimation(float, float, float, float, int, float, int, float); + } + + public class Transformation { + ctor public Transformation(); + method public void clear(); + method public void compose(android.view.animation.Transformation); + method public float getAlpha(); + method public android.graphics.Matrix getMatrix(); + method public int getTransformationType(); + method public void set(android.view.animation.Transformation); + method public void setAlpha(float); + method public void setTransformationType(int); + method public java.lang.String toShortString(); + field public static int TYPE_ALPHA; + field public static int TYPE_BOTH; + field public static int TYPE_IDENTITY; + field public static int TYPE_MATRIX; + field protected float mAlpha; + field protected android.graphics.Matrix mMatrix; + field protected int mTransformationType; + } + + public class TranslateAnimation extends android.view.animation.Animation { + ctor public TranslateAnimation(android.content.Context, android.util.AttributeSet); + ctor public TranslateAnimation(float, float, float, float); + ctor public TranslateAnimation(int, float, int, float, int, float, int, float); + } + +} + +package android.view.inputmethod { + + public class BaseInputConnection implements android.view.inputmethod.InputConnection { + ctor public BaseInputConnection(android.view.View, boolean); + method public boolean beginBatchEdit(); + method public boolean clearMetaKeyStates(int); + method public boolean commitCompletion(android.view.inputmethod.CompletionInfo); + method public boolean commitCorrection(android.view.inputmethod.CorrectionInfo); + method public boolean commitText(java.lang.CharSequence, int); + method public boolean deleteSurroundingText(int, int); + method public boolean endBatchEdit(); + method public boolean finishComposingText(); + method public static int getComposingSpanEnd(android.text.Spannable); + method public static int getComposingSpanStart(android.text.Spannable); + method public int getCursorCapsMode(int); + method public android.text.Editable getEditable(); + method public android.view.inputmethod.ExtractedText getExtractedText(android.view.inputmethod.ExtractedTextRequest, int); + method public java.lang.CharSequence getSelectedText(int); + method public java.lang.CharSequence getTextAfterCursor(int, int); + method public java.lang.CharSequence getTextBeforeCursor(int, int); + method public boolean performContextMenuAction(int); + method public boolean performEditorAction(int); + method public boolean performPrivateCommand(java.lang.String, android.os.Bundle); + method public static final void removeComposingSpans(android.text.Spannable); + method public boolean reportFullscreenMode(boolean); + method public boolean sendKeyEvent(android.view.KeyEvent); + method public boolean setComposingRegion(int, int); + method public static void setComposingSpans(android.text.Spannable); + method public boolean setComposingText(java.lang.CharSequence, int); + method public boolean setSelection(int, int); + } + + public final class CompletionInfo implements android.os.Parcelable { + ctor public CompletionInfo(long, int, java.lang.CharSequence); + ctor public CompletionInfo(long, int, java.lang.CharSequence, java.lang.CharSequence); + method public int describeContents(); + method public long getId(); + method public java.lang.CharSequence getLabel(); + method public int getPosition(); + method public java.lang.CharSequence getText(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + } + + public final class CorrectionInfo implements android.os.Parcelable { + ctor public CorrectionInfo(int, java.lang.CharSequence, java.lang.CharSequence); + method public int describeContents(); + method public java.lang.CharSequence getNewText(); + method public int getOffset(); + method public java.lang.CharSequence getOldText(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + } + + public class EditorInfo implements android.text.InputType android.os.Parcelable { + ctor public EditorInfo(); + method public int describeContents(); + method public void dump(android.util.Printer, java.lang.String); + method public final void makeCompatible(int); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + field public static final int IME_ACTION_DONE = 6; // 0x6 + field public static final int IME_ACTION_GO = 2; // 0x2 + field public static final int IME_ACTION_NEXT = 5; // 0x5 + field public static final int IME_ACTION_NONE = 1; // 0x1 + field public static final int IME_ACTION_PREVIOUS = 7; // 0x7 + field public static final int IME_ACTION_SEARCH = 3; // 0x3 + field public static final int IME_ACTION_SEND = 4; // 0x4 + field public static final int IME_ACTION_UNSPECIFIED = 0; // 0x0 + field public static final int IME_FLAG_FORCE_ASCII = -2147483648; // 0x80000000 + field public static final int IME_FLAG_NAVIGATE_NEXT = 134217728; // 0x8000000 + field public static final int IME_FLAG_NAVIGATE_PREVIOUS = 67108864; // 0x4000000 + field public static final int IME_FLAG_NO_ACCESSORY_ACTION = 536870912; // 0x20000000 + field public static final int IME_FLAG_NO_ENTER_ACTION = 1073741824; // 0x40000000 + field public static final int IME_FLAG_NO_EXTRACT_UI = 268435456; // 0x10000000 + field public static final int IME_FLAG_NO_FULLSCREEN = 33554432; // 0x2000000 + field public static final int IME_MASK_ACTION = 255; // 0xff + field public static final int IME_NULL = 0; // 0x0 + field public int actionId; + field public java.lang.CharSequence actionLabel; + field public android.os.Bundle extras; + field public int fieldId; + field public java.lang.String fieldName; + field public java.lang.CharSequence hintText; + field public int imeOptions; + field public int initialCapsMode; + field public int initialSelEnd; + field public int initialSelStart; + field public int inputType; + field public java.lang.CharSequence label; + field public java.lang.String packageName; + field public java.lang.String privateImeOptions; + } + + public class ExtractedText implements android.os.Parcelable { + ctor public ExtractedText(); + method public int describeContents(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + field public static final int FLAG_SELECTING = 2; // 0x2 + field public static final int FLAG_SINGLE_LINE = 1; // 0x1 + field public int flags; + field public int partialEndOffset; + field public int partialStartOffset; + field public int selectionEnd; + field public int selectionStart; + field public int startOffset; + field public java.lang.CharSequence text; + } + + public class ExtractedTextRequest implements android.os.Parcelable { + ctor public ExtractedTextRequest(); + method public int describeContents(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + field public int flags; + field public int hintMaxChars; + field public int hintMaxLines; + field public int token; + } + + public final class InputBinding implements android.os.Parcelable { + ctor public InputBinding(android.view.inputmethod.InputConnection, android.os.IBinder, int, int); + ctor public InputBinding(android.view.inputmethod.InputConnection, android.view.inputmethod.InputBinding); + method public int describeContents(); + method public android.view.inputmethod.InputConnection getConnection(); + method public android.os.IBinder getConnectionToken(); + method public int getPid(); + method public int getUid(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + } + + public abstract interface InputConnection { + method public abstract boolean beginBatchEdit(); + method public abstract boolean clearMetaKeyStates(int); + method public abstract boolean commitCompletion(android.view.inputmethod.CompletionInfo); + method public abstract boolean commitCorrection(android.view.inputmethod.CorrectionInfo); + method public abstract boolean commitText(java.lang.CharSequence, int); + method public abstract boolean deleteSurroundingText(int, int); + method public abstract boolean endBatchEdit(); + method public abstract boolean finishComposingText(); + method public abstract int getCursorCapsMode(int); + method public abstract android.view.inputmethod.ExtractedText getExtractedText(android.view.inputmethod.ExtractedTextRequest, int); + method public abstract java.lang.CharSequence getSelectedText(int); + method public abstract java.lang.CharSequence getTextAfterCursor(int, int); + method public abstract java.lang.CharSequence getTextBeforeCursor(int, int); + method public abstract boolean performContextMenuAction(int); + method public abstract boolean performEditorAction(int); + method public abstract boolean performPrivateCommand(java.lang.String, android.os.Bundle); + method public abstract boolean reportFullscreenMode(boolean); + method public abstract boolean sendKeyEvent(android.view.KeyEvent); + method public abstract boolean setComposingRegion(int, int); + method public abstract boolean setComposingText(java.lang.CharSequence, int); + method public abstract boolean setSelection(int, int); + field public static final int GET_EXTRACTED_TEXT_MONITOR = 1; // 0x1 + field public static final int GET_TEXT_WITH_STYLES = 1; // 0x1 + } + + public class InputConnectionWrapper implements android.view.inputmethod.InputConnection { + ctor public InputConnectionWrapper(android.view.inputmethod.InputConnection, boolean); + method public boolean beginBatchEdit(); + method public boolean clearMetaKeyStates(int); + method public boolean commitCompletion(android.view.inputmethod.CompletionInfo); + method public boolean commitCorrection(android.view.inputmethod.CorrectionInfo); + method public boolean commitText(java.lang.CharSequence, int); + method public boolean deleteSurroundingText(int, int); + method public boolean endBatchEdit(); + method public boolean finishComposingText(); + method public int getCursorCapsMode(int); + method public android.view.inputmethod.ExtractedText getExtractedText(android.view.inputmethod.ExtractedTextRequest, int); + method public java.lang.CharSequence getSelectedText(int); + method public java.lang.CharSequence getTextAfterCursor(int, int); + method public java.lang.CharSequence getTextBeforeCursor(int, int); + method public boolean performContextMenuAction(int); + method public boolean performEditorAction(int); + method public boolean performPrivateCommand(java.lang.String, android.os.Bundle); + method public boolean reportFullscreenMode(boolean); + method public boolean sendKeyEvent(android.view.KeyEvent); + method public boolean setComposingRegion(int, int); + method public boolean setComposingText(java.lang.CharSequence, int); + method public boolean setSelection(int, int); + method public void setTarget(android.view.inputmethod.InputConnection); + } + + public abstract interface InputMethod { + method public abstract void attachToken(android.os.IBinder); + method public abstract void bindInput(android.view.inputmethod.InputBinding); + method public abstract void changeInputMethodSubtype(android.view.inputmethod.InputMethodSubtype); + method public abstract void createSession(android.view.inputmethod.InputMethod.SessionCallback); + method public abstract void hideSoftInput(int, android.os.ResultReceiver); + method public abstract void restartInput(android.view.inputmethod.InputConnection, android.view.inputmethod.EditorInfo); + method public abstract void revokeSession(android.view.inputmethod.InputMethodSession); + method public abstract void setSessionEnabled(android.view.inputmethod.InputMethodSession, boolean); + method public abstract void showSoftInput(int, android.os.ResultReceiver); + method public abstract void startInput(android.view.inputmethod.InputConnection, android.view.inputmethod.EditorInfo); + method public abstract void unbindInput(); + field public static final java.lang.String SERVICE_INTERFACE = "android.view.InputMethod"; + field public static final java.lang.String SERVICE_META_DATA = "android.view.im"; + field public static final int SHOW_EXPLICIT = 1; // 0x1 + field public static final int SHOW_FORCED = 2; // 0x2 + } + + public static abstract interface InputMethod.SessionCallback { + method public abstract void sessionCreated(android.view.inputmethod.InputMethodSession); + } + + public final class InputMethodInfo implements android.os.Parcelable { + ctor public InputMethodInfo(android.content.Context, android.content.pm.ResolveInfo) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException; + ctor public InputMethodInfo(java.lang.String, java.lang.String, java.lang.CharSequence, java.lang.String); + method public int describeContents(); + method public void dump(android.util.Printer, java.lang.String); + method public android.content.ComponentName getComponent(); + method public java.lang.String getId(); + method public int getIsDefaultResourceId(); + method public java.lang.String getPackageName(); + method public android.content.pm.ServiceInfo getServiceInfo(); + method public java.lang.String getServiceName(); + method public java.lang.String getSettingsActivity(); + method public android.view.inputmethod.InputMethodSubtype getSubtypeAt(int); + method public int getSubtypeCount(); + method public android.graphics.drawable.Drawable loadIcon(android.content.pm.PackageManager); + method public java.lang.CharSequence loadLabel(android.content.pm.PackageManager); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + } + + public final class InputMethodManager { + method public void displayCompletions(android.view.View, android.view.inputmethod.CompletionInfo[]); + method public android.view.inputmethod.InputMethodSubtype getCurrentInputMethodSubtype(); + method public java.util.List getEnabledInputMethodList(); + method public java.util.List getEnabledInputMethodSubtypeList(android.view.inputmethod.InputMethodInfo, boolean); + method public java.util.List getInputMethodList(); + method public android.view.inputmethod.InputMethodSubtype getLastInputMethodSubtype(); + method public java.util.Map> getShortcutInputMethodsAndSubtypes(); + method public void hideSoftInputFromInputMethod(android.os.IBinder, int); + method public boolean hideSoftInputFromWindow(android.os.IBinder, int); + method public boolean hideSoftInputFromWindow(android.os.IBinder, int, android.os.ResultReceiver); + method public void hideStatusIcon(android.os.IBinder); + method public boolean isAcceptingText(); + method public boolean isActive(android.view.View); + method public boolean isActive(); + method public boolean isFullscreenMode(); + method public boolean isWatchingCursor(android.view.View); + method public void restartInput(android.view.View); + method public void sendAppPrivateCommand(android.view.View, java.lang.String, android.os.Bundle); + method public void setAdditionalInputMethodSubtypes(java.lang.String, android.view.inputmethod.InputMethodSubtype[]); + method public boolean setCurrentInputMethodSubtype(android.view.inputmethod.InputMethodSubtype); + method public void setInputMethod(android.os.IBinder, java.lang.String); + method public void setInputMethodAndSubtype(android.os.IBinder, java.lang.String, android.view.inputmethod.InputMethodSubtype); + method public void showInputMethodAndSubtypeEnabler(java.lang.String); + method public void showInputMethodPicker(); + method public boolean showSoftInput(android.view.View, int); + method public boolean showSoftInput(android.view.View, int, android.os.ResultReceiver); + method public void showSoftInputFromInputMethod(android.os.IBinder, int); + method public void showStatusIcon(android.os.IBinder, java.lang.String, int); + method public boolean switchToLastInputMethod(android.os.IBinder); + method public boolean switchToNextInputMethod(android.os.IBinder, boolean); + method public void toggleSoftInput(int, int); + method public void toggleSoftInputFromWindow(android.os.IBinder, int, int); + method public void updateCursor(android.view.View, int, int, int, int); + method public void updateExtractedText(android.view.View, int, android.view.inputmethod.ExtractedText); + method public void updateSelection(android.view.View, int, int, int, int); + method public void viewClicked(android.view.View); + field public static final int HIDE_IMPLICIT_ONLY = 1; // 0x1 + field public static final int HIDE_NOT_ALWAYS = 2; // 0x2 + field public static final int RESULT_HIDDEN = 3; // 0x3 + field public static final int RESULT_SHOWN = 2; // 0x2 + field public static final int RESULT_UNCHANGED_HIDDEN = 1; // 0x1 + field public static final int RESULT_UNCHANGED_SHOWN = 0; // 0x0 + field public static final int SHOW_FORCED = 2; // 0x2 + field public static final int SHOW_IMPLICIT = 1; // 0x1 + } + + public abstract interface InputMethodSession { + method public abstract void appPrivateCommand(java.lang.String, android.os.Bundle); + method public abstract void dispatchGenericMotionEvent(int, android.view.MotionEvent, android.view.inputmethod.InputMethodSession.EventCallback); + method public abstract void dispatchKeyEvent(int, android.view.KeyEvent, android.view.inputmethod.InputMethodSession.EventCallback); + method public abstract void dispatchTrackballEvent(int, android.view.MotionEvent, android.view.inputmethod.InputMethodSession.EventCallback); + method public abstract void displayCompletions(android.view.inputmethod.CompletionInfo[]); + method public abstract void finishInput(); + method public abstract void toggleSoftInput(int, int); + method public abstract void updateCursor(android.graphics.Rect); + method public abstract void updateExtractedText(int, android.view.inputmethod.ExtractedText); + method public abstract void updateSelection(int, int, int, int, int, int); + method public abstract void viewClicked(boolean); + } + + public static abstract interface InputMethodSession.EventCallback { + method public abstract void finishedEvent(int, boolean); + } + + public final class InputMethodSubtype implements android.os.Parcelable { + ctor public InputMethodSubtype(int, int, java.lang.String, java.lang.String, java.lang.String, boolean, boolean); + ctor public InputMethodSubtype(int, int, java.lang.String, java.lang.String, java.lang.String, boolean, boolean, int); + method public boolean containsExtraValueKey(java.lang.String); + method public int describeContents(); + method public java.lang.CharSequence getDisplayName(android.content.Context, java.lang.String, android.content.pm.ApplicationInfo); + method public java.lang.String getExtraValue(); + method public java.lang.String getExtraValueOf(java.lang.String); + method public int getIconResId(); + method public java.lang.String getLocale(); + method public java.lang.String getMode(); + method public int getNameResId(); + method public boolean isAuxiliary(); + method public boolean overridesImplicitlyEnabledSubtype(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + } + +} + +package android.view.textservice { + + public final class SentenceSuggestionsInfo implements android.os.Parcelable { + ctor public SentenceSuggestionsInfo(android.view.textservice.SuggestionsInfo[], int[], int[]); + ctor public SentenceSuggestionsInfo(android.os.Parcel); + method public int describeContents(); + method public int getLengthAt(int); + method public int getOffsetAt(int); + method public int getSuggestionsCount(); + method public android.view.textservice.SuggestionsInfo getSuggestionsInfoAt(int); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + } + + public final class SpellCheckerInfo implements android.os.Parcelable { + method public int describeContents(); + method public android.content.ComponentName getComponent(); + method public java.lang.String getId(); + method public java.lang.String getPackageName(); + method public android.content.pm.ServiceInfo getServiceInfo(); + method public java.lang.String getSettingsActivity(); + method public android.view.textservice.SpellCheckerSubtype getSubtypeAt(int); + method public int getSubtypeCount(); + method public android.graphics.drawable.Drawable loadIcon(android.content.pm.PackageManager); + method public java.lang.CharSequence loadLabel(android.content.pm.PackageManager); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + } + + public class SpellCheckerSession { + method public void cancel(); + method public void close(); + method public void getSentenceSuggestions(android.view.textservice.TextInfo[], int); + method public android.view.textservice.SpellCheckerInfo getSpellChecker(); + method public deprecated void getSuggestions(android.view.textservice.TextInfo, int); + method public deprecated void getSuggestions(android.view.textservice.TextInfo[], int, boolean); + method public boolean isSessionDisconnected(); + field public static final java.lang.String SERVICE_META_DATA = "android.view.textservice.scs"; + } + + public static abstract interface SpellCheckerSession.SpellCheckerSessionListener { + method public abstract void onGetSentenceSuggestions(android.view.textservice.SentenceSuggestionsInfo[]); + method public abstract void onGetSuggestions(android.view.textservice.SuggestionsInfo[]); + } + + public final class SpellCheckerSubtype implements android.os.Parcelable { + ctor public SpellCheckerSubtype(int, java.lang.String, java.lang.String); + method public boolean containsExtraValueKey(java.lang.String); + method public int describeContents(); + method public java.lang.CharSequence getDisplayName(android.content.Context, java.lang.String, android.content.pm.ApplicationInfo); + method public java.lang.String getExtraValue(); + method public java.lang.String getExtraValueOf(java.lang.String); + method public java.lang.String getLocale(); + method public int getNameResId(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + } + + public final class SuggestionsInfo implements android.os.Parcelable { + ctor public SuggestionsInfo(int, java.lang.String[]); + ctor public SuggestionsInfo(int, java.lang.String[], int, int); + ctor public SuggestionsInfo(android.os.Parcel); + method public int describeContents(); + method public int getCookie(); + method public int getSequence(); + method public java.lang.String getSuggestionAt(int); + method public int getSuggestionsAttributes(); + method public int getSuggestionsCount(); + method public void setCookieAndSequence(int, int); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + field public static final int RESULT_ATTR_HAS_RECOMMENDED_SUGGESTIONS = 4; // 0x4 + field public static final int RESULT_ATTR_IN_THE_DICTIONARY = 1; // 0x1 + field public static final int RESULT_ATTR_LOOKS_LIKE_TYPO = 2; // 0x2 + } + + public final class TextInfo implements android.os.Parcelable { + ctor public TextInfo(java.lang.String); + ctor public TextInfo(java.lang.String, int, int); + ctor public TextInfo(android.os.Parcel); + method public int describeContents(); + method public int getCookie(); + method public int getSequence(); + method public java.lang.String getText(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + } + + public final class TextServicesManager { + method public android.view.textservice.SpellCheckerSession newSpellCheckerSession(android.os.Bundle, java.util.Locale, android.view.textservice.SpellCheckerSession.SpellCheckerSessionListener, boolean); + } + +} + +package android.webkit { + + public class ConsoleMessage { + ctor public ConsoleMessage(java.lang.String, java.lang.String, int, android.webkit.ConsoleMessage.MessageLevel); + method public int lineNumber(); + method public java.lang.String message(); + method public android.webkit.ConsoleMessage.MessageLevel messageLevel(); + method public java.lang.String sourceId(); + } + + public static final class ConsoleMessage.MessageLevel extends java.lang.Enum { + method public static android.webkit.ConsoleMessage.MessageLevel valueOf(java.lang.String); + method public static final android.webkit.ConsoleMessage.MessageLevel[] values(); + enum_constant public static final android.webkit.ConsoleMessage.MessageLevel DEBUG; + enum_constant public static final android.webkit.ConsoleMessage.MessageLevel ERROR; + enum_constant public static final android.webkit.ConsoleMessage.MessageLevel LOG; + enum_constant public static final android.webkit.ConsoleMessage.MessageLevel TIP; + enum_constant public static final android.webkit.ConsoleMessage.MessageLevel WARNING; + } + + public class CookieManager { + method public synchronized boolean acceptCookie(); + method public static boolean allowFileSchemeCookies(); + method public java.lang.String getCookie(java.lang.String); + method public static synchronized android.webkit.CookieManager getInstance(); + method public synchronized boolean hasCookies(); + method public void removeAllCookie(); + method public void removeExpiredCookie(); + method public void removeSessionCookie(); + method public synchronized void setAcceptCookie(boolean); + method public static void setAcceptFileSchemeCookies(boolean); + method public void setCookie(java.lang.String, java.lang.String); + } + + public final class CookieSyncManager extends android.webkit.WebSyncManager { + method public static synchronized android.webkit.CookieSyncManager createInstance(android.content.Context); + method public static synchronized android.webkit.CookieSyncManager getInstance(); + method protected void syncFromRamToFlash(); + } + + public class DateSorter { + ctor public DateSorter(android.content.Context); + method public long getBoundary(int); + method public int getIndex(long); + method public java.lang.String getLabel(int); + field public static final int DAY_COUNT = 5; // 0x5 + } + + public abstract interface DownloadListener { + method public abstract void onDownloadStart(java.lang.String, java.lang.String, java.lang.String, java.lang.String, long); + } + + public class GeolocationPermissions { + method public void allow(java.lang.String); + method public void clear(java.lang.String); + method public void clearAll(); + method public void getAllowed(java.lang.String, android.webkit.ValueCallback); + method public static android.webkit.GeolocationPermissions getInstance(); + method public void getOrigins(android.webkit.ValueCallback>); + } + + public static abstract interface GeolocationPermissions.Callback { + method public abstract void invoke(java.lang.String, boolean, boolean); + } + + public class HttpAuthHandler extends android.os.Handler { + method public void cancel(); + method public void proceed(java.lang.String, java.lang.String); + method public boolean useHttpAuthUsernamePassword(); + } + + public abstract class JavascriptInterface implements java.lang.annotation.Annotation { + } + + public class JsPromptResult extends android.webkit.JsResult { + method public void confirm(java.lang.String); + } + + public class JsResult { + method public final void cancel(); + method public final void confirm(); + } + + public class MimeTypeMap { + method public java.lang.String getExtensionFromMimeType(java.lang.String); + method public static java.lang.String getFileExtensionFromUrl(java.lang.String); + method public java.lang.String getMimeTypeFromExtension(java.lang.String); + method public static android.webkit.MimeTypeMap getSingleton(); + method public boolean hasExtension(java.lang.String); + method public boolean hasMimeType(java.lang.String); + } + + public abstract interface PluginStub { + method public abstract android.view.View getEmbeddedView(int, android.content.Context); + method public abstract android.view.View getFullScreenView(int, android.content.Context); + } + + public class SslErrorHandler extends android.os.Handler { + method public void cancel(); + method public void proceed(); + } + + public final class URLUtil { + ctor public URLUtil(); + method public static java.lang.String composeSearchUrl(java.lang.String, java.lang.String, java.lang.String); + method public static byte[] decode(byte[]) throws java.lang.IllegalArgumentException; + method public static final java.lang.String guessFileName(java.lang.String, java.lang.String, java.lang.String); + method public static java.lang.String guessUrl(java.lang.String); + method public static boolean isAboutUrl(java.lang.String); + method public static boolean isAssetUrl(java.lang.String); + method public static boolean isContentUrl(java.lang.String); + method public static deprecated boolean isCookielessProxyUrl(java.lang.String); + method public static boolean isDataUrl(java.lang.String); + method public static boolean isFileUrl(java.lang.String); + method public static boolean isHttpUrl(java.lang.String); + method public static boolean isHttpsUrl(java.lang.String); + method public static boolean isJavaScriptUrl(java.lang.String); + method public static boolean isNetworkUrl(java.lang.String); + method public static boolean isValidUrl(java.lang.String); + method public static java.lang.String stripAnchor(java.lang.String); + } + + public abstract interface ValueCallback { + method public abstract void onReceiveValue(T); + } + + public class WebBackForwardList implements java.lang.Cloneable java.io.Serializable { + method public synchronized int getCurrentIndex(); + method public synchronized android.webkit.WebHistoryItem getCurrentItem(); + method public synchronized android.webkit.WebHistoryItem getItemAtIndex(int); + method public synchronized int getSize(); + } + + public class WebChromeClient { + ctor public WebChromeClient(); + method public android.graphics.Bitmap getDefaultVideoPoster(); + method public android.view.View getVideoLoadingProgressView(); + method public void getVisitedHistory(android.webkit.ValueCallback); + method public void onCloseWindow(android.webkit.WebView); + method public deprecated void onConsoleMessage(java.lang.String, int, java.lang.String); + method public boolean onConsoleMessage(android.webkit.ConsoleMessage); + method public boolean onCreateWindow(android.webkit.WebView, boolean, boolean, android.os.Message); + method public void onExceededDatabaseQuota(java.lang.String, java.lang.String, long, long, long, android.webkit.WebStorage.QuotaUpdater); + method public void onGeolocationPermissionsHidePrompt(); + method public void onGeolocationPermissionsShowPrompt(java.lang.String, android.webkit.GeolocationPermissions.Callback); + method public void onHideCustomView(); + method public boolean onJsAlert(android.webkit.WebView, java.lang.String, java.lang.String, android.webkit.JsResult); + method public boolean onJsBeforeUnload(android.webkit.WebView, java.lang.String, java.lang.String, android.webkit.JsResult); + method public boolean onJsConfirm(android.webkit.WebView, java.lang.String, java.lang.String, android.webkit.JsResult); + method public boolean onJsPrompt(android.webkit.WebView, java.lang.String, java.lang.String, java.lang.String, android.webkit.JsPromptResult); + method public deprecated boolean onJsTimeout(); + method public void onProgressChanged(android.webkit.WebView, int); + method public void onReachedMaxAppCacheSize(long, long, android.webkit.WebStorage.QuotaUpdater); + method public void onReceivedIcon(android.webkit.WebView, android.graphics.Bitmap); + method public void onReceivedTitle(android.webkit.WebView, java.lang.String); + method public void onReceivedTouchIconUrl(android.webkit.WebView, java.lang.String, boolean); + method public void onRequestFocus(android.webkit.WebView); + method public void onShowCustomView(android.view.View, android.webkit.WebChromeClient.CustomViewCallback); + method public void onShowCustomView(android.view.View, int, android.webkit.WebChromeClient.CustomViewCallback); + } + + public static abstract interface WebChromeClient.CustomViewCallback { + method public abstract void onCustomViewHidden(); + } + + public class WebHistoryItem implements java.lang.Cloneable { + method public android.graphics.Bitmap getFavicon(); + method public java.lang.String getOriginalUrl(); + method public java.lang.String getTitle(); + method public java.lang.String getUrl(); + } + + public class WebIconDatabase { + method public void close(); + method public static android.webkit.WebIconDatabase getInstance(); + method public void open(java.lang.String); + method public void releaseIconForPageUrl(java.lang.String); + method public void removeAllIcons(); + method public void requestIconForPageUrl(java.lang.String, android.webkit.WebIconDatabase.IconListener); + method public void retainIconForPageUrl(java.lang.String); + } + + public static abstract interface WebIconDatabase.IconListener { + method public abstract void onReceivedIcon(java.lang.String, android.graphics.Bitmap); + } + + public class WebResourceResponse { + ctor public WebResourceResponse(java.lang.String, java.lang.String, java.io.InputStream); + method public java.io.InputStream getData(); + method public java.lang.String getEncoding(); + method public java.lang.String getMimeType(); + method public void setData(java.io.InputStream); + method public void setEncoding(java.lang.String); + method public void setMimeType(java.lang.String); + } + + public abstract class WebSettings { + method public deprecated boolean enableSmoothTransition(); + method public boolean getAllowContentAccess(); + method public boolean getAllowFileAccess(); + method public abstract boolean getAllowFileAccessFromFileURLs(); + method public abstract boolean getAllowUniversalAccessFromFileURLs(); + method public synchronized boolean getBlockNetworkImage(); + method public synchronized boolean getBlockNetworkLoads(); + method public boolean getBuiltInZoomControls(); + method public int getCacheMode(); + method public synchronized java.lang.String getCursiveFontFamily(); + method public synchronized boolean getDatabaseEnabled(); + method public synchronized java.lang.String getDatabasePath(); + method public synchronized int getDefaultFixedFontSize(); + method public synchronized int getDefaultFontSize(); + method public synchronized java.lang.String getDefaultTextEncodingName(); + method public static java.lang.String getDefaultUserAgent(android.content.Context); + method public android.webkit.WebSettings.ZoomDensity getDefaultZoom(); + method public boolean getDisplayZoomControls(); + method public synchronized boolean getDomStorageEnabled(); + method public synchronized java.lang.String getFantasyFontFamily(); + method public synchronized java.lang.String getFixedFontFamily(); + method public synchronized boolean getJavaScriptCanOpenWindowsAutomatically(); + method public synchronized boolean getJavaScriptEnabled(); + method public synchronized android.webkit.WebSettings.LayoutAlgorithm getLayoutAlgorithm(); + method public boolean getLightTouchEnabled(); + method public boolean getLoadWithOverviewMode(); + method public synchronized boolean getLoadsImagesAutomatically(); + method public boolean getMediaPlaybackRequiresUserGesture(); + method public synchronized int getMinimumFontSize(); + method public synchronized int getMinimumLogicalFontSize(); + method public synchronized android.webkit.WebSettings.PluginState getPluginState(); + method public deprecated synchronized boolean getPluginsEnabled(); + method public deprecated synchronized java.lang.String getPluginsPath(); + method public synchronized java.lang.String getSansSerifFontFamily(); + method public boolean getSaveFormData(); + method public boolean getSavePassword(); + method public synchronized java.lang.String getSerifFontFamily(); + method public synchronized java.lang.String getStandardFontFamily(); + method public deprecated synchronized android.webkit.WebSettings.TextSize getTextSize(); + method public synchronized int getTextZoom(); + method public synchronized boolean getUseWideViewPort(); + method public synchronized java.lang.String getUserAgentString(); + method public void setAllowContentAccess(boolean); + method public void setAllowFileAccess(boolean); + method public abstract void setAllowFileAccessFromFileURLs(boolean); + method public abstract void setAllowUniversalAccessFromFileURLs(boolean); + method public synchronized void setAppCacheEnabled(boolean); + method public synchronized void setAppCacheMaxSize(long); + method public synchronized void setAppCachePath(java.lang.String); + method public synchronized void setBlockNetworkImage(boolean); + method public synchronized void setBlockNetworkLoads(boolean); + method public void setBuiltInZoomControls(boolean); + method public void setCacheMode(int); + method public synchronized void setCursiveFontFamily(java.lang.String); + method public synchronized void setDatabaseEnabled(boolean); + method public synchronized void setDatabasePath(java.lang.String); + method public synchronized void setDefaultFixedFontSize(int); + method public synchronized void setDefaultFontSize(int); + method public synchronized void setDefaultTextEncodingName(java.lang.String); + method public void setDefaultZoom(android.webkit.WebSettings.ZoomDensity); + method public void setDisplayZoomControls(boolean); + method public synchronized void setDomStorageEnabled(boolean); + method public deprecated void setEnableSmoothTransition(boolean); + method public synchronized void setFantasyFontFamily(java.lang.String); + method public synchronized void setFixedFontFamily(java.lang.String); + method public synchronized void setGeolocationDatabasePath(java.lang.String); + method public synchronized void setGeolocationEnabled(boolean); + method public synchronized void setJavaScriptCanOpenWindowsAutomatically(boolean); + method public synchronized void setJavaScriptEnabled(boolean); + method public synchronized void setLayoutAlgorithm(android.webkit.WebSettings.LayoutAlgorithm); + method public void setLightTouchEnabled(boolean); + method public void setLoadWithOverviewMode(boolean); + method public synchronized void setLoadsImagesAutomatically(boolean); + method public void setMediaPlaybackRequiresUserGesture(boolean); + method public synchronized void setMinimumFontSize(int); + method public synchronized void setMinimumLogicalFontSize(int); + method public void setNeedInitialFocus(boolean); + method public synchronized void setPluginState(android.webkit.WebSettings.PluginState); + method public deprecated synchronized void setPluginsEnabled(boolean); + method public deprecated synchronized void setPluginsPath(java.lang.String); + method public synchronized void setRenderPriority(android.webkit.WebSettings.RenderPriority); + method public synchronized void setSansSerifFontFamily(java.lang.String); + method public void setSaveFormData(boolean); + method public void setSavePassword(boolean); + method public synchronized void setSerifFontFamily(java.lang.String); + method public synchronized void setStandardFontFamily(java.lang.String); + method public synchronized void setSupportMultipleWindows(boolean); + method public void setSupportZoom(boolean); + method public deprecated synchronized void setTextSize(android.webkit.WebSettings.TextSize); + method public synchronized void setTextZoom(int); + method public synchronized void setUseWideViewPort(boolean); + method public synchronized void setUserAgentString(java.lang.String); + method public synchronized boolean supportMultipleWindows(); + method public boolean supportZoom(); + field public static final int LOAD_CACHE_ELSE_NETWORK = 1; // 0x1 + field public static final int LOAD_CACHE_ONLY = 3; // 0x3 + field public static final int LOAD_DEFAULT = -1; // 0xffffffff + field public static final deprecated int LOAD_NORMAL = 0; // 0x0 + field public static final int LOAD_NO_CACHE = 2; // 0x2 + } + + public static final class WebSettings.LayoutAlgorithm extends java.lang.Enum { + method public static android.webkit.WebSettings.LayoutAlgorithm valueOf(java.lang.String); + method public static final android.webkit.WebSettings.LayoutAlgorithm[] values(); + enum_constant public static final android.webkit.WebSettings.LayoutAlgorithm NARROW_COLUMNS; + enum_constant public static final android.webkit.WebSettings.LayoutAlgorithm NORMAL; + enum_constant public static final deprecated android.webkit.WebSettings.LayoutAlgorithm SINGLE_COLUMN; + } + + public static final class WebSettings.PluginState extends java.lang.Enum { + method public static android.webkit.WebSettings.PluginState valueOf(java.lang.String); + method public static final android.webkit.WebSettings.PluginState[] values(); + enum_constant public static final android.webkit.WebSettings.PluginState OFF; + enum_constant public static final android.webkit.WebSettings.PluginState ON; + enum_constant public static final android.webkit.WebSettings.PluginState ON_DEMAND; + } + + public static final class WebSettings.RenderPriority extends java.lang.Enum { + method public static android.webkit.WebSettings.RenderPriority valueOf(java.lang.String); + method public static final android.webkit.WebSettings.RenderPriority[] values(); + enum_constant public static final android.webkit.WebSettings.RenderPriority HIGH; + enum_constant public static final android.webkit.WebSettings.RenderPriority LOW; + enum_constant public static final android.webkit.WebSettings.RenderPriority NORMAL; + } + + public static final deprecated class WebSettings.TextSize extends java.lang.Enum { + method public static android.webkit.WebSettings.TextSize valueOf(java.lang.String); + method public static final android.webkit.WebSettings.TextSize[] values(); + enum_constant public static final android.webkit.WebSettings.TextSize LARGER; + enum_constant public static final android.webkit.WebSettings.TextSize LARGEST; + enum_constant public static final android.webkit.WebSettings.TextSize NORMAL; + enum_constant public static final android.webkit.WebSettings.TextSize SMALLER; + enum_constant public static final android.webkit.WebSettings.TextSize SMALLEST; + } + + public static final class WebSettings.ZoomDensity extends java.lang.Enum { + method public static android.webkit.WebSettings.ZoomDensity valueOf(java.lang.String); + method public static final android.webkit.WebSettings.ZoomDensity[] values(); + enum_constant public static final android.webkit.WebSettings.ZoomDensity CLOSE; + enum_constant public static final android.webkit.WebSettings.ZoomDensity FAR; + enum_constant public static final android.webkit.WebSettings.ZoomDensity MEDIUM; + } + + public class WebStorage { + method public void deleteAllData(); + method public void deleteOrigin(java.lang.String); + method public static android.webkit.WebStorage getInstance(); + method public void getOrigins(android.webkit.ValueCallback); + method public void getQuotaForOrigin(java.lang.String, android.webkit.ValueCallback); + method public void getUsageForOrigin(java.lang.String, android.webkit.ValueCallback); + method public void setQuotaForOrigin(java.lang.String, long); + } + + public static class WebStorage.Origin { + method public java.lang.String getOrigin(); + method public long getQuota(); + method public long getUsage(); + } + + public static abstract interface WebStorage.QuotaUpdater { + method public abstract void updateQuota(long); + } + + abstract class WebSyncManager implements java.lang.Runnable { + ctor protected WebSyncManager(android.content.Context, java.lang.String); + method protected void onSyncInit(); + method public void resetSync(); + method public void run(); + method public void startSync(); + method public void stopSync(); + method public void sync(); + field protected static final java.lang.String LOGTAG = "websync"; + field protected android.webkit.WebViewDatabase mDataBase; + field protected android.os.Handler mHandler; + } + + public class WebView extends android.widget.AbsoluteLayout implements android.view.ViewGroup.OnHierarchyChangeListener android.view.ViewTreeObserver.OnGlobalFocusChangeListener { + ctor public WebView(android.content.Context); + ctor public WebView(android.content.Context, android.util.AttributeSet); + ctor public WebView(android.content.Context, android.util.AttributeSet, int); + ctor public deprecated WebView(android.content.Context, android.util.AttributeSet, int, boolean); + method public void addJavascriptInterface(java.lang.Object, java.lang.String); + method public boolean canGoBack(); + method public boolean canGoBackOrForward(int); + method public boolean canGoForward(); + method public deprecated boolean canZoomIn(); + method public deprecated boolean canZoomOut(); + method public android.graphics.Picture capturePicture(); + method public void clearCache(boolean); + method public void clearFormData(); + method public void clearHistory(); + method public void clearMatches(); + method public void clearSslPreferences(); + method public void clearView(); + method public android.webkit.WebBackForwardList copyBackForwardList(); + method public void destroy(); + method public void documentHasImages(android.os.Message); + method public static java.lang.String findAddress(java.lang.String); + method public deprecated int findAll(java.lang.String); + method public void findAllAsync(java.lang.String); + method public void findNext(boolean); + method public void flingScroll(int, int); + method public void freeMemory(); + method public android.net.http.SslCertificate getCertificate(); + method public int getContentHeight(); + method public android.graphics.Bitmap getFavicon(); + method public android.webkit.WebView.HitTestResult getHitTestResult(); + method public java.lang.String[] getHttpAuthUsernamePassword(java.lang.String, java.lang.String); + method public java.lang.String getOriginalUrl(); + method public int getProgress(); + method public deprecated float getScale(); + method public android.webkit.WebSettings getSettings(); + method public java.lang.String getTitle(); + method public java.lang.String getUrl(); + method public void goBack(); + method public void goBackOrForward(int); + method public void goForward(); + method public void invokeZoomPicker(); + method public boolean isPrivateBrowsingEnabled(); + method public void loadData(java.lang.String, java.lang.String, java.lang.String); + method public void loadDataWithBaseURL(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String); + method public void loadUrl(java.lang.String, java.util.Map); + method public void loadUrl(java.lang.String); + method public deprecated void onChildViewAdded(android.view.View, android.view.View); + method public deprecated void onChildViewRemoved(android.view.View, android.view.View); + method public deprecated void onGlobalFocusChanged(android.view.View, android.view.View); + method public void onPause(); + method public void onResume(); + method public boolean overlayHorizontalScrollbar(); + method public boolean overlayVerticalScrollbar(); + method public boolean pageDown(boolean); + method public boolean pageUp(boolean); + method public void pauseTimers(); + method public void postUrl(java.lang.String, byte[]); + method public void reload(); + method public void removeJavascriptInterface(java.lang.String); + method public void requestFocusNodeHref(android.os.Message); + method public void requestImageRef(android.os.Message); + method public android.webkit.WebBackForwardList restoreState(android.os.Bundle); + method public void resumeTimers(); + method public void savePassword(java.lang.String, java.lang.String, java.lang.String); + method public android.webkit.WebBackForwardList saveState(android.os.Bundle); + method public void saveWebArchive(java.lang.String); + method public void saveWebArchive(java.lang.String, boolean, android.webkit.ValueCallback); + method public deprecated void setCertificate(android.net.http.SslCertificate); + method public void setDownloadListener(android.webkit.DownloadListener); + method public void setFindListener(android.webkit.WebView.FindListener); + method public void setHorizontalScrollbarOverlay(boolean); + method public void setHttpAuthUsernamePassword(java.lang.String, java.lang.String, java.lang.String, java.lang.String); + method public void setInitialScale(int); + method public deprecated void setMapTrackballToArrowKeys(boolean); + method public void setNetworkAvailable(boolean); + method public deprecated void setPictureListener(android.webkit.WebView.PictureListener); + method public void setVerticalScrollbarOverlay(boolean); + method public void setWebChromeClient(android.webkit.WebChromeClient); + method public void setWebViewClient(android.webkit.WebViewClient); + method public boolean showFindDialog(java.lang.String, boolean); + method public void stopLoading(); + method public boolean zoomIn(); + method public boolean zoomOut(); + field public static final java.lang.String SCHEME_GEO = "geo:0,0?q="; + field public static final java.lang.String SCHEME_MAILTO = "mailto:"; + field public static final java.lang.String SCHEME_TEL = "tel:"; + } + + public static abstract interface WebView.FindListener { + method public abstract void onFindResultReceived(int, int, boolean); + } + + public static class WebView.HitTestResult { + method public java.lang.String getExtra(); + method public int getType(); + field public static final deprecated int ANCHOR_TYPE = 1; // 0x1 + field public static final int EDIT_TEXT_TYPE = 9; // 0x9 + field public static final int EMAIL_TYPE = 4; // 0x4 + field public static final int GEO_TYPE = 3; // 0x3 + field public static final deprecated int IMAGE_ANCHOR_TYPE = 6; // 0x6 + field public static final int IMAGE_TYPE = 5; // 0x5 + field public static final int PHONE_TYPE = 2; // 0x2 + field public static final int SRC_ANCHOR_TYPE = 7; // 0x7 + field public static final int SRC_IMAGE_ANCHOR_TYPE = 8; // 0x8 + field public static final int UNKNOWN_TYPE = 0; // 0x0 + } + + public static abstract deprecated interface WebView.PictureListener { + method public abstract deprecated void onNewPicture(android.webkit.WebView, android.graphics.Picture); + } + + public class WebView.WebViewTransport { + ctor public WebView.WebViewTransport(); + method public synchronized android.webkit.WebView getWebView(); + method public synchronized void setWebView(android.webkit.WebView); + } + + public class WebViewClient { + ctor public WebViewClient(); + method public void doUpdateVisitedHistory(android.webkit.WebView, java.lang.String, boolean); + method public void onFormResubmission(android.webkit.WebView, android.os.Message, android.os.Message); + method public void onLoadResource(android.webkit.WebView, java.lang.String); + method public void onPageFinished(android.webkit.WebView, java.lang.String); + method public void onPageStarted(android.webkit.WebView, java.lang.String, android.graphics.Bitmap); + method public void onReceivedError(android.webkit.WebView, int, java.lang.String, java.lang.String); + method public void onReceivedHttpAuthRequest(android.webkit.WebView, android.webkit.HttpAuthHandler, java.lang.String, java.lang.String); + method public void onReceivedLoginRequest(android.webkit.WebView, java.lang.String, java.lang.String, java.lang.String); + method public void onReceivedSslError(android.webkit.WebView, android.webkit.SslErrorHandler, android.net.http.SslError); + method public void onScaleChanged(android.webkit.WebView, float, float); + method public deprecated void onTooManyRedirects(android.webkit.WebView, android.os.Message, android.os.Message); + method public void onUnhandledKeyEvent(android.webkit.WebView, android.view.KeyEvent); + method public android.webkit.WebResourceResponse shouldInterceptRequest(android.webkit.WebView, java.lang.String); + method public boolean shouldOverrideKeyEvent(android.webkit.WebView, android.view.KeyEvent); + method public boolean shouldOverrideUrlLoading(android.webkit.WebView, java.lang.String); + field public static final int ERROR_AUTHENTICATION = -4; // 0xfffffffc + field public static final int ERROR_BAD_URL = -12; // 0xfffffff4 + field public static final int ERROR_CONNECT = -6; // 0xfffffffa + field public static final int ERROR_FAILED_SSL_HANDSHAKE = -11; // 0xfffffff5 + field public static final int ERROR_FILE = -13; // 0xfffffff3 + field public static final int ERROR_FILE_NOT_FOUND = -14; // 0xfffffff2 + field public static final int ERROR_HOST_LOOKUP = -2; // 0xfffffffe + field public static final int ERROR_IO = -7; // 0xfffffff9 + field public static final int ERROR_PROXY_AUTHENTICATION = -5; // 0xfffffffb + field public static final int ERROR_REDIRECT_LOOP = -9; // 0xfffffff7 + field public static final int ERROR_TIMEOUT = -8; // 0xfffffff8 + field public static final int ERROR_TOO_MANY_REQUESTS = -15; // 0xfffffff1 + field public static final int ERROR_UNKNOWN = -1; // 0xffffffff + field public static final int ERROR_UNSUPPORTED_AUTH_SCHEME = -3; // 0xfffffffd + field public static final int ERROR_UNSUPPORTED_SCHEME = -10; // 0xfffffff6 + } + + public class WebViewDatabase { + method public void clearFormData(); + method public void clearHttpAuthUsernamePassword(); + method public void clearUsernamePassword(); + method public static android.webkit.WebViewDatabase getInstance(android.content.Context); + method public boolean hasFormData(); + method public boolean hasHttpAuthUsernamePassword(); + method public boolean hasUsernamePassword(); + } + + public class WebViewFragment extends android.app.Fragment { + ctor public WebViewFragment(); + method public android.webkit.WebView getWebView(); + } + +} + +package android.widget { + + public abstract class AbsListView extends android.widget.AdapterView implements android.widget.Filter.FilterListener android.text.TextWatcher android.view.ViewTreeObserver.OnGlobalLayoutListener android.view.ViewTreeObserver.OnTouchModeChangeListener { + ctor public AbsListView(android.content.Context); + ctor public AbsListView(android.content.Context, android.util.AttributeSet); + ctor public AbsListView(android.content.Context, android.util.AttributeSet, int); + method public void afterTextChanged(android.text.Editable); + method public void beforeTextChanged(java.lang.CharSequence, int, int, int); + method public void clearChoices(); + method public void clearTextFilter(); + method public void deferNotifyDataSetChanged(); + method public int getCacheColorHint(); + method public int getCheckedItemCount(); + method public long[] getCheckedItemIds(); + method public int getCheckedItemPosition(); + method public android.util.SparseBooleanArray getCheckedItemPositions(); + method public int getChoiceMode(); + method public int getListPaddingBottom(); + method public int getListPaddingLeft(); + method public int getListPaddingRight(); + method public int getListPaddingTop(); + method public android.view.View getSelectedView(); + method public android.graphics.drawable.Drawable getSelector(); + method public java.lang.CharSequence getTextFilter(); + method public int getTranscriptMode(); + method protected void handleDataChanged(); + method public boolean hasTextFilter(); + method public void invalidateViews(); + method public boolean isFastScrollAlwaysVisible(); + method public boolean isFastScrollEnabled(); + method protected boolean isInFilterMode(); + method public boolean isItemChecked(int); + method public boolean isScrollingCacheEnabled(); + method public boolean isSmoothScrollbarEnabled(); + method public boolean isStackFromBottom(); + method public boolean isTextFilterEnabled(); + method protected void layoutChildren(); + method public void onFilterComplete(int); + method public void onGlobalLayout(); + method public boolean onRemoteAdapterConnected(); + method public void onRemoteAdapterDisconnected(); + method public void onRestoreInstanceState(android.os.Parcelable); + method public android.os.Parcelable onSaveInstanceState(); + method public void onTextChanged(java.lang.CharSequence, int, int, int); + method public void onTouchModeChanged(boolean); + method public int pointToPosition(int, int); + method public long pointToRowId(int, int); + method public void reclaimViews(java.util.List); + method public void setAdapter(android.widget.ListAdapter); + method public void setCacheColorHint(int); + method public void setChoiceMode(int); + method public void setDrawSelectorOnTop(boolean); + method public void setFastScrollAlwaysVisible(boolean); + method public void setFastScrollEnabled(boolean); + method public void setFilterText(java.lang.String); + method public void setFriction(float); + method public void setItemChecked(int, boolean); + method public void setMultiChoiceModeListener(android.widget.AbsListView.MultiChoiceModeListener); + method public void setOnScrollListener(android.widget.AbsListView.OnScrollListener); + method public void setRecyclerListener(android.widget.AbsListView.RecyclerListener); + method public void setRemoteViewsAdapter(android.content.Intent); + method public void setScrollIndicators(android.view.View, android.view.View); + method public void setScrollingCacheEnabled(boolean); + method public void setSelector(int); + method public void setSelector(android.graphics.drawable.Drawable); + method public void setSmoothScrollbarEnabled(boolean); + method public void setStackFromBottom(boolean); + method public void setTextFilterEnabled(boolean); + method public void setTranscriptMode(int); + method public void setVelocityScale(float); + method public void smoothScrollBy(int, int); + method public void smoothScrollToPosition(int); + method public void smoothScrollToPosition(int, int); + method public void smoothScrollToPositionFromTop(int, int, int); + method public void smoothScrollToPositionFromTop(int, int); + method public boolean verifyDrawable(android.graphics.drawable.Drawable); + field public static final int CHOICE_MODE_MULTIPLE = 2; // 0x2 + field public static final int CHOICE_MODE_MULTIPLE_MODAL = 3; // 0x3 + field public static final int CHOICE_MODE_NONE = 0; // 0x0 + field public static final int CHOICE_MODE_SINGLE = 1; // 0x1 + field public static final int TRANSCRIPT_MODE_ALWAYS_SCROLL = 2; // 0x2 + field public static final int TRANSCRIPT_MODE_DISABLED = 0; // 0x0 + field public static final int TRANSCRIPT_MODE_NORMAL = 1; // 0x1 + } + + public static class AbsListView.LayoutParams extends android.view.ViewGroup.LayoutParams { + ctor public AbsListView.LayoutParams(android.content.Context, android.util.AttributeSet); + ctor public AbsListView.LayoutParams(int, int); + ctor public AbsListView.LayoutParams(int, int, int); + ctor public AbsListView.LayoutParams(android.view.ViewGroup.LayoutParams); + } + + public static abstract interface AbsListView.MultiChoiceModeListener implements android.view.ActionMode.Callback { + method public abstract void onItemCheckedStateChanged(android.view.ActionMode, int, long, boolean); + } + + public static abstract interface AbsListView.OnScrollListener { + method public abstract void onScroll(android.widget.AbsListView, int, int, int); + method public abstract void onScrollStateChanged(android.widget.AbsListView, int); + field public static final int SCROLL_STATE_FLING = 2; // 0x2 + field public static final int SCROLL_STATE_IDLE = 0; // 0x0 + field public static final int SCROLL_STATE_TOUCH_SCROLL = 1; // 0x1 + } + + public static abstract interface AbsListView.RecyclerListener { + method public abstract void onMovedToScrapHeap(android.view.View); + } + + public static abstract interface AbsListView.SelectionBoundsAdjuster { + method public abstract void adjustListItemSelectionBounds(android.graphics.Rect); + } + + public abstract class AbsSeekBar extends android.widget.ProgressBar { + ctor public AbsSeekBar(android.content.Context); + ctor public AbsSeekBar(android.content.Context, android.util.AttributeSet); + ctor public AbsSeekBar(android.content.Context, android.util.AttributeSet, int); + method public int getKeyProgressIncrement(); + method public android.graphics.drawable.Drawable getThumb(); + method public int getThumbOffset(); + method public void setKeyProgressIncrement(int); + method public void setThumb(android.graphics.drawable.Drawable); + method public void setThumbOffset(int); + } + + public abstract class AbsSpinner extends android.widget.AdapterView { + ctor public AbsSpinner(android.content.Context); + ctor public AbsSpinner(android.content.Context, android.util.AttributeSet); + ctor public AbsSpinner(android.content.Context, android.util.AttributeSet, int); + method public android.widget.SpinnerAdapter getAdapter(); + method public android.view.View getSelectedView(); + method public void onRestoreInstanceState(android.os.Parcelable); + method public android.os.Parcelable onSaveInstanceState(); + method public int pointToPosition(int, int); + method public void setAdapter(android.widget.SpinnerAdapter); + method public void setSelection(int, boolean); + method public void setSelection(int); + } + + public deprecated class AbsoluteLayout extends android.view.ViewGroup { + ctor public AbsoluteLayout(android.content.Context); + ctor public AbsoluteLayout(android.content.Context, android.util.AttributeSet); + ctor public AbsoluteLayout(android.content.Context, android.util.AttributeSet, int); + method protected void onLayout(boolean, int, int, int, int); + } + + public static class AbsoluteLayout.LayoutParams extends android.view.ViewGroup.LayoutParams { + ctor public AbsoluteLayout.LayoutParams(int, int, int, int); + ctor public AbsoluteLayout.LayoutParams(android.content.Context, android.util.AttributeSet); + ctor public AbsoluteLayout.LayoutParams(android.view.ViewGroup.LayoutParams); + method public java.lang.String debug(java.lang.String); + field public int x; + field public int y; + } + + public abstract interface Adapter { + method public abstract int getCount(); + method public abstract java.lang.Object getItem(int); + method public abstract long getItemId(int); + method public abstract int getItemViewType(int); + method public abstract android.view.View getView(int, android.view.View, android.view.ViewGroup); + method public abstract int getViewTypeCount(); + method public abstract boolean hasStableIds(); + method public abstract boolean isEmpty(); + method public abstract void registerDataSetObserver(android.database.DataSetObserver); + method public abstract void unregisterDataSetObserver(android.database.DataSetObserver); + field public static final int IGNORE_ITEM_VIEW_TYPE = -1; // 0xffffffff + field public static final int NO_SELECTION = -2147483648; // 0x80000000 + } + + public abstract class AdapterView extends android.view.ViewGroup { + ctor public AdapterView(android.content.Context); + ctor public AdapterView(android.content.Context, android.util.AttributeSet); + ctor public AdapterView(android.content.Context, android.util.AttributeSet, int); + method public abstract T getAdapter(); + method public int getCount(); + method public android.view.View getEmptyView(); + method public int getFirstVisiblePosition(); + method public java.lang.Object getItemAtPosition(int); + method public long getItemIdAtPosition(int); + method public int getLastVisiblePosition(); + method public final android.widget.AdapterView.OnItemClickListener getOnItemClickListener(); + method public final android.widget.AdapterView.OnItemLongClickListener getOnItemLongClickListener(); + method public final android.widget.AdapterView.OnItemSelectedListener getOnItemSelectedListener(); + method public int getPositionForView(android.view.View); + method public java.lang.Object getSelectedItem(); + method public long getSelectedItemId(); + method public int getSelectedItemPosition(); + method public abstract android.view.View getSelectedView(); + method protected void onLayout(boolean, int, int, int, int); + method public boolean performItemClick(android.view.View, int, long); + method public abstract void setAdapter(T); + method public void setEmptyView(android.view.View); + method public void setOnItemClickListener(android.widget.AdapterView.OnItemClickListener); + method public void setOnItemLongClickListener(android.widget.AdapterView.OnItemLongClickListener); + method public void setOnItemSelectedListener(android.widget.AdapterView.OnItemSelectedListener); + method public abstract void setSelection(int); + field public static final int INVALID_POSITION = -1; // 0xffffffff + field public static final long INVALID_ROW_ID = -9223372036854775808L; // 0x8000000000000000L + field public static final int ITEM_VIEW_TYPE_HEADER_OR_FOOTER = -2; // 0xfffffffe + field public static final int ITEM_VIEW_TYPE_IGNORE = -1; // 0xffffffff + } + + public static class AdapterView.AdapterContextMenuInfo implements android.view.ContextMenu.ContextMenuInfo { + ctor public AdapterView.AdapterContextMenuInfo(android.view.View, int, long); + field public long id; + field public int position; + field public android.view.View targetView; + } + + public static abstract interface AdapterView.OnItemClickListener { + method public abstract void onItemClick(android.widget.AdapterView, android.view.View, int, long); + } + + public static abstract interface AdapterView.OnItemLongClickListener { + method public abstract boolean onItemLongClick(android.widget.AdapterView, android.view.View, int, long); + } + + public static abstract interface AdapterView.OnItemSelectedListener { + method public abstract void onItemSelected(android.widget.AdapterView, android.view.View, int, long); + method public abstract void onNothingSelected(android.widget.AdapterView); + } + + public abstract class AdapterViewAnimator extends android.widget.AdapterView implements android.widget.Advanceable { + ctor public AdapterViewAnimator(android.content.Context); + ctor public AdapterViewAnimator(android.content.Context, android.util.AttributeSet); + ctor public AdapterViewAnimator(android.content.Context, android.util.AttributeSet, int); + method public void advance(); + method public void deferNotifyDataSetChanged(); + method public void fyiWillBeAdvancedByHostKThx(); + method public android.widget.Adapter getAdapter(); + method public android.view.View getCurrentView(); + method public int getDisplayedChild(); + method public android.animation.ObjectAnimator getInAnimation(); + method public android.animation.ObjectAnimator getOutAnimation(); + method public android.view.View getSelectedView(); + method public boolean onRemoteAdapterConnected(); + method public void onRemoteAdapterDisconnected(); + method public void onRestoreInstanceState(android.os.Parcelable); + method public android.os.Parcelable onSaveInstanceState(); + method public void setAdapter(android.widget.Adapter); + method public void setAnimateFirstView(boolean); + method public void setDisplayedChild(int); + method public void setInAnimation(android.animation.ObjectAnimator); + method public void setInAnimation(android.content.Context, int); + method public void setOutAnimation(android.animation.ObjectAnimator); + method public void setOutAnimation(android.content.Context, int); + method public void setRemoteViewsAdapter(android.content.Intent); + method public void setSelection(int); + method public void showNext(); + method public void showPrevious(); + } + + public class AdapterViewFlipper extends android.widget.AdapterViewAnimator { + ctor public AdapterViewFlipper(android.content.Context); + ctor public AdapterViewFlipper(android.content.Context, android.util.AttributeSet); + method public int getFlipInterval(); + method public boolean isAutoStart(); + method public boolean isFlipping(); + method public void setAutoStart(boolean); + method public void setFlipInterval(int); + method public void startFlipping(); + method public void stopFlipping(); + } + + public abstract interface Advanceable { + method public abstract void advance(); + method public abstract void fyiWillBeAdvancedByHostKThx(); + } + + public class AlphabetIndexer extends android.database.DataSetObserver implements android.widget.SectionIndexer { + ctor public AlphabetIndexer(android.database.Cursor, int, java.lang.CharSequence); + method protected int compare(java.lang.String, java.lang.String); + method public int getPositionForSection(int); + method public int getSectionForPosition(int); + method public java.lang.Object[] getSections(); + method public void setCursor(android.database.Cursor); + field protected java.lang.CharSequence mAlphabet; + field protected int mColumnIndex; + field protected android.database.Cursor mDataCursor; + } + + public class AnalogClock extends android.view.View { + ctor public AnalogClock(android.content.Context); + ctor public AnalogClock(android.content.Context, android.util.AttributeSet); + ctor public AnalogClock(android.content.Context, android.util.AttributeSet, int); + } + + public class ArrayAdapter extends android.widget.BaseAdapter implements android.widget.Filterable { + ctor public ArrayAdapter(android.content.Context, int); + ctor public ArrayAdapter(android.content.Context, int, int); + ctor public ArrayAdapter(android.content.Context, int, T[]); + ctor public ArrayAdapter(android.content.Context, int, int, T[]); + ctor public ArrayAdapter(android.content.Context, int, java.util.List); + ctor public ArrayAdapter(android.content.Context, int, int, java.util.List); + method public void add(T); + method public void addAll(java.util.Collection); + method public void addAll(T...); + method public void clear(); + method public static android.widget.ArrayAdapter createFromResource(android.content.Context, int, int); + method public android.content.Context getContext(); + method public int getCount(); + method public android.widget.Filter getFilter(); + method public T getItem(int); + method public long getItemId(int); + method public int getPosition(T); + method public android.view.View getView(int, android.view.View, android.view.ViewGroup); + method public void insert(T, int); + method public void remove(T); + method public void setDropDownViewResource(int); + method public void setNotifyOnChange(boolean); + method public void sort(java.util.Comparator); + } + + public class AutoCompleteTextView extends android.widget.EditText implements android.widget.Filter.FilterListener { + ctor public AutoCompleteTextView(android.content.Context); + ctor public AutoCompleteTextView(android.content.Context, android.util.AttributeSet); + ctor public AutoCompleteTextView(android.content.Context, android.util.AttributeSet, int); + method public void clearListSelection(); + method protected java.lang.CharSequence convertSelectionToString(java.lang.Object); + method public void dismissDropDown(); + method public boolean enoughToFilter(); + method public android.widget.ListAdapter getAdapter(); + method public java.lang.CharSequence getCompletionHint(); + method public int getDropDownAnchor(); + method public android.graphics.drawable.Drawable getDropDownBackground(); + method public int getDropDownHeight(); + method public int getDropDownHorizontalOffset(); + method public int getDropDownVerticalOffset(); + method public int getDropDownWidth(); + method protected android.widget.Filter getFilter(); + method public deprecated android.widget.AdapterView.OnItemClickListener getItemClickListener(); + method public deprecated android.widget.AdapterView.OnItemSelectedListener getItemSelectedListener(); + method public int getListSelection(); + method public android.widget.AdapterView.OnItemClickListener getOnItemClickListener(); + method public android.widget.AdapterView.OnItemSelectedListener getOnItemSelectedListener(); + method public int getThreshold(); + method public android.widget.AutoCompleteTextView.Validator getValidator(); + method public boolean isPerformingCompletion(); + method public boolean isPopupShowing(); + method public void onFilterComplete(int); + method public void performCompletion(); + method protected void performFiltering(java.lang.CharSequence, int); + method public void performValidation(); + method protected void replaceText(java.lang.CharSequence); + method public void setAdapter(T); + method public void setCompletionHint(java.lang.CharSequence); + method public void setDropDownAnchor(int); + method public void setDropDownBackgroundDrawable(android.graphics.drawable.Drawable); + method public void setDropDownBackgroundResource(int); + method public void setDropDownHeight(int); + method public void setDropDownHorizontalOffset(int); + method public void setDropDownVerticalOffset(int); + method public void setDropDownWidth(int); + method public void setListSelection(int); + method public void setOnDismissListener(android.widget.AutoCompleteTextView.OnDismissListener); + method public void setOnItemClickListener(android.widget.AdapterView.OnItemClickListener); + method public void setOnItemSelectedListener(android.widget.AdapterView.OnItemSelectedListener); + method public void setText(java.lang.CharSequence, boolean); + method public void setThreshold(int); + method public void setValidator(android.widget.AutoCompleteTextView.Validator); + method public void showDropDown(); + } + + public static abstract interface AutoCompleteTextView.OnDismissListener { + method public abstract void onDismiss(); + } + + public static abstract interface AutoCompleteTextView.Validator { + method public abstract java.lang.CharSequence fixText(java.lang.CharSequence); + method public abstract boolean isValid(java.lang.CharSequence); + } + + public abstract class BaseAdapter implements android.widget.ListAdapter android.widget.SpinnerAdapter { + ctor public BaseAdapter(); + method public boolean areAllItemsEnabled(); + method public android.view.View getDropDownView(int, android.view.View, android.view.ViewGroup); + method public int getItemViewType(int); + method public int getViewTypeCount(); + method public boolean hasStableIds(); + method public boolean isEmpty(); + method public boolean isEnabled(int); + method public void notifyDataSetChanged(); + method public void notifyDataSetInvalidated(); + method public void registerDataSetObserver(android.database.DataSetObserver); + method public void unregisterDataSetObserver(android.database.DataSetObserver); + } + + public abstract class BaseExpandableListAdapter implements android.widget.ExpandableListAdapter android.widget.HeterogeneousExpandableList { + ctor public BaseExpandableListAdapter(); + method public boolean areAllItemsEnabled(); + method public int getChildType(int, int); + method public int getChildTypeCount(); + method public long getCombinedChildId(long, long); + method public long getCombinedGroupId(long); + method public int getGroupType(int); + method public int getGroupTypeCount(); + method public boolean isEmpty(); + method public void notifyDataSetChanged(); + method public void notifyDataSetInvalidated(); + method public void onGroupCollapsed(int); + method public void onGroupExpanded(int); + method public void registerDataSetObserver(android.database.DataSetObserver); + method public void unregisterDataSetObserver(android.database.DataSetObserver); + } + + public class Button extends android.widget.TextView { + ctor public Button(android.content.Context); + ctor public Button(android.content.Context, android.util.AttributeSet); + ctor public Button(android.content.Context, android.util.AttributeSet, int); + } + + public class CalendarView extends android.widget.FrameLayout { + ctor public CalendarView(android.content.Context); + ctor public CalendarView(android.content.Context, android.util.AttributeSet); + ctor public CalendarView(android.content.Context, android.util.AttributeSet, int); + method public long getDate(); + method public int getDateTextAppearance(); + method public int getFirstDayOfWeek(); + method public int getFocusedMonthDateColor(); + method public long getMaxDate(); + method public long getMinDate(); + method public android.graphics.drawable.Drawable getSelectedDateVerticalBar(); + method public int getSelectedWeekBackgroundColor(); + method public boolean getShowWeekNumber(); + method public int getShownWeekCount(); + method public int getUnfocusedMonthDateColor(); + method public int getWeekDayTextAppearance(); + method public int getWeekNumberColor(); + method public int getWeekSeparatorLineColor(); + method public void setDate(long); + method public void setDate(long, boolean, boolean); + method public void setDateTextAppearance(int); + method public void setFirstDayOfWeek(int); + method public void setFocusedMonthDateColor(int); + method public void setMaxDate(long); + method public void setMinDate(long); + method public void setOnDateChangeListener(android.widget.CalendarView.OnDateChangeListener); + method public void setSelectedDateVerticalBar(int); + method public void setSelectedDateVerticalBar(android.graphics.drawable.Drawable); + method public void setSelectedWeekBackgroundColor(int); + method public void setShowWeekNumber(boolean); + method public void setShownWeekCount(int); + method public void setUnfocusedMonthDateColor(int); + method public void setWeekDayTextAppearance(int); + method public void setWeekNumberColor(int); + method public void setWeekSeparatorLineColor(int); + } + + public static abstract interface CalendarView.OnDateChangeListener { + method public abstract void onSelectedDayChange(android.widget.CalendarView, int, int, int); + } + + public class CheckBox extends android.widget.CompoundButton { + ctor public CheckBox(android.content.Context); + ctor public CheckBox(android.content.Context, android.util.AttributeSet); + ctor public CheckBox(android.content.Context, android.util.AttributeSet, int); + } + + public abstract interface Checkable { + method public abstract boolean isChecked(); + method public abstract void setChecked(boolean); + method public abstract void toggle(); + } + + public class CheckedTextView extends android.widget.TextView implements android.widget.Checkable { + ctor public CheckedTextView(android.content.Context); + ctor public CheckedTextView(android.content.Context, android.util.AttributeSet); + ctor public CheckedTextView(android.content.Context, android.util.AttributeSet, int); + method public android.graphics.drawable.Drawable getCheckMarkDrawable(); + method public boolean isChecked(); + method public void setCheckMarkDrawable(int); + method public void setCheckMarkDrawable(android.graphics.drawable.Drawable); + method public void setChecked(boolean); + method public void toggle(); + } + + public class Chronometer extends android.widget.TextView { + ctor public Chronometer(android.content.Context); + ctor public Chronometer(android.content.Context, android.util.AttributeSet); + ctor public Chronometer(android.content.Context, android.util.AttributeSet, int); + method public long getBase(); + method public java.lang.String getFormat(); + method public android.widget.Chronometer.OnChronometerTickListener getOnChronometerTickListener(); + method public void setBase(long); + method public void setFormat(java.lang.String); + method public void setOnChronometerTickListener(android.widget.Chronometer.OnChronometerTickListener); + method public void start(); + method public void stop(); + } + + public static abstract interface Chronometer.OnChronometerTickListener { + method public abstract void onChronometerTick(android.widget.Chronometer); + } + + public abstract class CompoundButton extends android.widget.Button implements android.widget.Checkable { + ctor public CompoundButton(android.content.Context); + ctor public CompoundButton(android.content.Context, android.util.AttributeSet); + ctor public CompoundButton(android.content.Context, android.util.AttributeSet, int); + method public boolean isChecked(); + method public void setButtonDrawable(int); + method public void setButtonDrawable(android.graphics.drawable.Drawable); + method public void setChecked(boolean); + method public void setOnCheckedChangeListener(android.widget.CompoundButton.OnCheckedChangeListener); + method public void toggle(); + } + + public static abstract interface CompoundButton.OnCheckedChangeListener { + method public abstract void onCheckedChanged(android.widget.CompoundButton, boolean); + } + + public abstract class CursorAdapter extends android.widget.BaseAdapter implements android.widget.Filterable { + ctor public deprecated CursorAdapter(android.content.Context, android.database.Cursor); + ctor public CursorAdapter(android.content.Context, android.database.Cursor, boolean); + ctor public CursorAdapter(android.content.Context, android.database.Cursor, int); + method public abstract void bindView(android.view.View, android.content.Context, android.database.Cursor); + method public void changeCursor(android.database.Cursor); + method public java.lang.CharSequence convertToString(android.database.Cursor); + method public int getCount(); + method public android.database.Cursor getCursor(); + method public android.widget.Filter getFilter(); + method public android.widget.FilterQueryProvider getFilterQueryProvider(); + method public java.lang.Object getItem(int); + method public long getItemId(int); + method public android.view.View getView(int, android.view.View, android.view.ViewGroup); + method protected deprecated void init(android.content.Context, android.database.Cursor, boolean); + method public android.view.View newDropDownView(android.content.Context, android.database.Cursor, android.view.ViewGroup); + method public abstract android.view.View newView(android.content.Context, android.database.Cursor, android.view.ViewGroup); + method protected void onContentChanged(); + method public android.database.Cursor runQueryOnBackgroundThread(java.lang.CharSequence); + method public void setFilterQueryProvider(android.widget.FilterQueryProvider); + method public android.database.Cursor swapCursor(android.database.Cursor); + field public static final deprecated int FLAG_AUTO_REQUERY = 1; // 0x1 + field public static final int FLAG_REGISTER_CONTENT_OBSERVER = 2; // 0x2 + } + + public abstract class CursorTreeAdapter extends android.widget.BaseExpandableListAdapter implements android.widget.Filterable { + ctor public CursorTreeAdapter(android.database.Cursor, android.content.Context); + ctor public CursorTreeAdapter(android.database.Cursor, android.content.Context, boolean); + method protected abstract void bindChildView(android.view.View, android.content.Context, android.database.Cursor, boolean); + method protected abstract void bindGroupView(android.view.View, android.content.Context, android.database.Cursor, boolean); + method public void changeCursor(android.database.Cursor); + method public java.lang.String convertToString(android.database.Cursor); + method public android.database.Cursor getChild(int, int); + method public long getChildId(int, int); + method public android.view.View getChildView(int, int, boolean, android.view.View, android.view.ViewGroup); + method public int getChildrenCount(int); + method protected abstract android.database.Cursor getChildrenCursor(android.database.Cursor); + method public android.database.Cursor getCursor(); + method public android.widget.Filter getFilter(); + method public android.widget.FilterQueryProvider getFilterQueryProvider(); + method public android.database.Cursor getGroup(int); + method public int getGroupCount(); + method public long getGroupId(int); + method public android.view.View getGroupView(int, boolean, android.view.View, android.view.ViewGroup); + method public boolean hasStableIds(); + method public boolean isChildSelectable(int, int); + method protected abstract android.view.View newChildView(android.content.Context, android.database.Cursor, boolean, android.view.ViewGroup); + method protected abstract android.view.View newGroupView(android.content.Context, android.database.Cursor, boolean, android.view.ViewGroup); + method public void notifyDataSetChanged(boolean); + method public android.database.Cursor runQueryOnBackgroundThread(java.lang.CharSequence); + method public void setChildrenCursor(int, android.database.Cursor); + method public void setFilterQueryProvider(android.widget.FilterQueryProvider); + method public void setGroupCursor(android.database.Cursor); + } + + public class DatePicker extends android.widget.FrameLayout { + ctor public DatePicker(android.content.Context); + ctor public DatePicker(android.content.Context, android.util.AttributeSet); + ctor public DatePicker(android.content.Context, android.util.AttributeSet, int); + method public android.widget.CalendarView getCalendarView(); + method public boolean getCalendarViewShown(); + method public int getDayOfMonth(); + method public long getMaxDate(); + method public long getMinDate(); + method public int getMonth(); + method public boolean getSpinnersShown(); + method public int getYear(); + method public void init(int, int, int, android.widget.DatePicker.OnDateChangedListener); + method public void setCalendarViewShown(boolean); + method public void setMaxDate(long); + method public void setMinDate(long); + method public void setSpinnersShown(boolean); + method public void updateDate(int, int, int); + } + + public static abstract interface DatePicker.OnDateChangedListener { + method public abstract void onDateChanged(android.widget.DatePicker, int, int, int); + } + + public class DialerFilter extends android.widget.RelativeLayout { + ctor public DialerFilter(android.content.Context); + ctor public DialerFilter(android.content.Context, android.util.AttributeSet); + method public void append(java.lang.String); + method public void clearText(); + method public java.lang.CharSequence getDigits(); + method public java.lang.CharSequence getFilterText(); + method public java.lang.CharSequence getLetters(); + method public int getMode(); + method public boolean isQwertyKeyboard(); + method protected void onModeChange(int, int); + method public void removeFilterWatcher(android.text.TextWatcher); + method public void setDigitsWatcher(android.text.TextWatcher); + method public void setFilterWatcher(android.text.TextWatcher); + method public void setLettersWatcher(android.text.TextWatcher); + method public void setMode(int); + field public static final int DIGITS_AND_LETTERS = 1; // 0x1 + field public static final int DIGITS_AND_LETTERS_NO_DIGITS = 2; // 0x2 + field public static final int DIGITS_AND_LETTERS_NO_LETTERS = 3; // 0x3 + field public static final int DIGITS_ONLY = 4; // 0x4 + field public static final int LETTERS_ONLY = 5; // 0x5 + } + + public deprecated class DigitalClock extends android.widget.TextView { + ctor public DigitalClock(android.content.Context); + ctor public DigitalClock(android.content.Context, android.util.AttributeSet); + } + + public class EdgeEffect { + ctor public EdgeEffect(android.content.Context); + method public boolean draw(android.graphics.Canvas); + method public void finish(); + method public boolean isFinished(); + method public void onAbsorb(int); + method public void onPull(float); + method public void onRelease(); + method public void setSize(int, int); + } + + public class EditText extends android.widget.TextView { + ctor public EditText(android.content.Context); + ctor public EditText(android.content.Context, android.util.AttributeSet); + ctor public EditText(android.content.Context, android.util.AttributeSet, int); + method public void extendSelection(int); + method public void selectAll(); + method public void setSelection(int, int); + method public void setSelection(int); + } + + public abstract interface ExpandableListAdapter { + method public abstract boolean areAllItemsEnabled(); + method public abstract java.lang.Object getChild(int, int); + method public abstract long getChildId(int, int); + method public abstract android.view.View getChildView(int, int, boolean, android.view.View, android.view.ViewGroup); + method public abstract int getChildrenCount(int); + method public abstract long getCombinedChildId(long, long); + method public abstract long getCombinedGroupId(long); + method public abstract java.lang.Object getGroup(int); + method public abstract int getGroupCount(); + method public abstract long getGroupId(int); + method public abstract android.view.View getGroupView(int, boolean, android.view.View, android.view.ViewGroup); + method public abstract boolean hasStableIds(); + method public abstract boolean isChildSelectable(int, int); + method public abstract boolean isEmpty(); + method public abstract void onGroupCollapsed(int); + method public abstract void onGroupExpanded(int); + method public abstract void registerDataSetObserver(android.database.DataSetObserver); + method public abstract void unregisterDataSetObserver(android.database.DataSetObserver); + } + + public class ExpandableListView extends android.widget.ListView { + ctor public ExpandableListView(android.content.Context); + ctor public ExpandableListView(android.content.Context, android.util.AttributeSet); + ctor public ExpandableListView(android.content.Context, android.util.AttributeSet, int); + method public boolean collapseGroup(int); + method public boolean expandGroup(int); + method public boolean expandGroup(int, boolean); + method public android.widget.ExpandableListAdapter getExpandableListAdapter(); + method public long getExpandableListPosition(int); + method public int getFlatListPosition(long); + method public static int getPackedPositionChild(long); + method public static long getPackedPositionForChild(int, int); + method public static long getPackedPositionForGroup(int); + method public static int getPackedPositionGroup(long); + method public static int getPackedPositionType(long); + method public long getSelectedId(); + method public long getSelectedPosition(); + method public boolean isGroupExpanded(int); + method public void setAdapter(android.widget.ExpandableListAdapter); + method public void setChildDivider(android.graphics.drawable.Drawable); + method public void setChildIndicator(android.graphics.drawable.Drawable); + method public void setChildIndicatorBounds(int, int); + method public void setGroupIndicator(android.graphics.drawable.Drawable); + method public void setIndicatorBounds(int, int); + method public void setOnChildClickListener(android.widget.ExpandableListView.OnChildClickListener); + method public void setOnGroupClickListener(android.widget.ExpandableListView.OnGroupClickListener); + method public void setOnGroupCollapseListener(android.widget.ExpandableListView.OnGroupCollapseListener); + method public void setOnGroupExpandListener(android.widget.ExpandableListView.OnGroupExpandListener); + method public boolean setSelectedChild(int, int, boolean); + method public void setSelectedGroup(int); + field public static final int CHILD_INDICATOR_INHERIT = -1; // 0xffffffff + field public static final int PACKED_POSITION_TYPE_CHILD = 1; // 0x1 + field public static final int PACKED_POSITION_TYPE_GROUP = 0; // 0x0 + field public static final int PACKED_POSITION_TYPE_NULL = 2; // 0x2 + field public static final long PACKED_POSITION_VALUE_NULL = 4294967295L; // 0xffffffffL + } + + public static class ExpandableListView.ExpandableListContextMenuInfo implements android.view.ContextMenu.ContextMenuInfo { + ctor public ExpandableListView.ExpandableListContextMenuInfo(android.view.View, long, long); + field public long id; + field public long packedPosition; + field public android.view.View targetView; + } + + public static abstract interface ExpandableListView.OnChildClickListener { + method public abstract boolean onChildClick(android.widget.ExpandableListView, android.view.View, int, int, long); + } + + public static abstract interface ExpandableListView.OnGroupClickListener { + method public abstract boolean onGroupClick(android.widget.ExpandableListView, android.view.View, int, long); + } + + public static abstract interface ExpandableListView.OnGroupCollapseListener { + method public abstract void onGroupCollapse(int); + } + + public static abstract interface ExpandableListView.OnGroupExpandListener { + method public abstract void onGroupExpand(int); + } + + public abstract class Filter { + ctor public Filter(); + method public java.lang.CharSequence convertResultToString(java.lang.Object); + method public final void filter(java.lang.CharSequence); + method public final void filter(java.lang.CharSequence, android.widget.Filter.FilterListener); + method protected abstract android.widget.Filter.FilterResults performFiltering(java.lang.CharSequence); + method protected abstract void publishResults(java.lang.CharSequence, android.widget.Filter.FilterResults); + } + + public static abstract interface Filter.FilterListener { + method public abstract void onFilterComplete(int); + } + + protected static class Filter.FilterResults { + ctor public Filter.FilterResults(); + field public int count; + field public java.lang.Object values; + } + + public abstract interface FilterQueryProvider { + method public abstract android.database.Cursor runQuery(java.lang.CharSequence); + } + + public abstract interface Filterable { + method public abstract android.widget.Filter getFilter(); + } + + public class FrameLayout extends android.view.ViewGroup { + ctor public FrameLayout(android.content.Context); + ctor public FrameLayout(android.content.Context, android.util.AttributeSet); + ctor public FrameLayout(android.content.Context, android.util.AttributeSet, int); + method public deprecated boolean getConsiderGoneChildrenWhenMeasuring(); + method public android.graphics.drawable.Drawable getForeground(); + method public int getForegroundGravity(); + method public boolean getMeasureAllChildren(); + method protected void onLayout(boolean, int, int, int, int); + method public void setForeground(android.graphics.drawable.Drawable); + method public void setForegroundGravity(int); + method public void setMeasureAllChildren(boolean); + } + + public static class FrameLayout.LayoutParams extends android.view.ViewGroup.MarginLayoutParams { + ctor public FrameLayout.LayoutParams(android.content.Context, android.util.AttributeSet); + ctor public FrameLayout.LayoutParams(int, int); + ctor public FrameLayout.LayoutParams(int, int, int); + ctor public FrameLayout.LayoutParams(android.view.ViewGroup.LayoutParams); + ctor public FrameLayout.LayoutParams(android.view.ViewGroup.MarginLayoutParams); + field public int gravity; + } + + public deprecated class Gallery extends android.widget.AbsSpinner implements android.view.GestureDetector.OnGestureListener { + ctor public Gallery(android.content.Context); + ctor public Gallery(android.content.Context, android.util.AttributeSet); + ctor public Gallery(android.content.Context, android.util.AttributeSet, int); + method public boolean onDown(android.view.MotionEvent); + method public boolean onFling(android.view.MotionEvent, android.view.MotionEvent, float, float); + method public void onLongPress(android.view.MotionEvent); + method public boolean onScroll(android.view.MotionEvent, android.view.MotionEvent, float, float); + method public void onShowPress(android.view.MotionEvent); + method public boolean onSingleTapUp(android.view.MotionEvent); + method public void setAnimationDuration(int); + method public void setCallbackDuringFling(boolean); + method public void setGravity(int); + method public void setSpacing(int); + method public void setUnselectedAlpha(float); + } + + public static class Gallery.LayoutParams extends android.view.ViewGroup.LayoutParams { + ctor public Gallery.LayoutParams(android.content.Context, android.util.AttributeSet); + ctor public Gallery.LayoutParams(int, int); + ctor public Gallery.LayoutParams(android.view.ViewGroup.LayoutParams); + } + + public class GridLayout extends android.view.ViewGroup { + ctor public GridLayout(android.content.Context, android.util.AttributeSet, int); + ctor public GridLayout(android.content.Context, android.util.AttributeSet); + ctor public GridLayout(android.content.Context); + method public int getAlignmentMode(); + method public int getColumnCount(); + method public int getOrientation(); + method public int getRowCount(); + method public boolean getUseDefaultMargins(); + method public boolean isColumnOrderPreserved(); + method public boolean isRowOrderPreserved(); + method protected void onLayout(boolean, int, int, int, int); + method public void setAlignmentMode(int); + method public void setColumnCount(int); + method public void setColumnOrderPreserved(boolean); + method public void setOrientation(int); + method public void setRowCount(int); + method public void setRowOrderPreserved(boolean); + method public void setUseDefaultMargins(boolean); + method public static android.widget.GridLayout.Spec spec(int, int, android.widget.GridLayout.Alignment); + method public static android.widget.GridLayout.Spec spec(int, android.widget.GridLayout.Alignment); + method public static android.widget.GridLayout.Spec spec(int, int); + method public static android.widget.GridLayout.Spec spec(int); + field public static final int ALIGN_BOUNDS = 0; // 0x0 + field public static final int ALIGN_MARGINS = 1; // 0x1 + field public static final android.widget.GridLayout.Alignment BASELINE; + field public static final android.widget.GridLayout.Alignment BOTTOM; + field public static final android.widget.GridLayout.Alignment CENTER; + field public static final android.widget.GridLayout.Alignment END; + field public static final android.widget.GridLayout.Alignment FILL; + field public static final int HORIZONTAL = 0; // 0x0 + field public static final android.widget.GridLayout.Alignment LEFT; + field public static final android.widget.GridLayout.Alignment RIGHT; + field public static final android.widget.GridLayout.Alignment START; + field public static final android.widget.GridLayout.Alignment TOP; + field public static final int UNDEFINED = -2147483648; // 0x80000000 + field public static final int VERTICAL = 1; // 0x1 + } + + public static abstract class GridLayout.Alignment { + } + + public static class GridLayout.LayoutParams extends android.view.ViewGroup.MarginLayoutParams { + ctor public GridLayout.LayoutParams(android.widget.GridLayout.Spec, android.widget.GridLayout.Spec); + ctor public GridLayout.LayoutParams(); + ctor public GridLayout.LayoutParams(android.view.ViewGroup.LayoutParams); + ctor public GridLayout.LayoutParams(android.view.ViewGroup.MarginLayoutParams); + ctor public GridLayout.LayoutParams(android.widget.GridLayout.LayoutParams); + ctor public GridLayout.LayoutParams(android.content.Context, android.util.AttributeSet); + method public void setGravity(int); + field public android.widget.GridLayout.Spec columnSpec; + field public android.widget.GridLayout.Spec rowSpec; + } + + public static class GridLayout.Spec { + } + + public class GridView extends android.widget.AbsListView { + ctor public GridView(android.content.Context); + ctor public GridView(android.content.Context, android.util.AttributeSet); + ctor public GridView(android.content.Context, android.util.AttributeSet, int); + method public android.widget.ListAdapter getAdapter(); + method public int getColumnWidth(); + method public int getGravity(); + method public int getHorizontalSpacing(); + method public int getNumColumns(); + method public int getRequestedColumnWidth(); + method public int getRequestedHorizontalSpacing(); + method public int getStretchMode(); + method public int getVerticalSpacing(); + method public void setColumnWidth(int); + method public void setGravity(int); + method public void setHorizontalSpacing(int); + method public void setNumColumns(int); + method public void setSelection(int); + method public void setStretchMode(int); + method public void setVerticalSpacing(int); + method public void smoothScrollByOffset(int); + field public static final int AUTO_FIT = -1; // 0xffffffff + field public static final int NO_STRETCH = 0; // 0x0 + field public static final int STRETCH_COLUMN_WIDTH = 2; // 0x2 + field public static final int STRETCH_SPACING = 1; // 0x1 + field public static final int STRETCH_SPACING_UNIFORM = 3; // 0x3 + } + + public class HeaderViewListAdapter implements android.widget.Filterable android.widget.WrapperListAdapter { + ctor public HeaderViewListAdapter(java.util.ArrayList, java.util.ArrayList, android.widget.ListAdapter); + method public boolean areAllItemsEnabled(); + method public int getCount(); + method public android.widget.Filter getFilter(); + method public int getFootersCount(); + method public int getHeadersCount(); + method public java.lang.Object getItem(int); + method public long getItemId(int); + method public int getItemViewType(int); + method public android.view.View getView(int, android.view.View, android.view.ViewGroup); + method public int getViewTypeCount(); + method public android.widget.ListAdapter getWrappedAdapter(); + method public boolean hasStableIds(); + method public boolean isEmpty(); + method public boolean isEnabled(int); + method public void registerDataSetObserver(android.database.DataSetObserver); + method public boolean removeFooter(android.view.View); + method public boolean removeHeader(android.view.View); + method public void unregisterDataSetObserver(android.database.DataSetObserver); + } + + public abstract interface HeterogeneousExpandableList { + method public abstract int getChildType(int, int); + method public abstract int getChildTypeCount(); + method public abstract int getGroupType(int); + method public abstract int getGroupTypeCount(); + } + + public class HorizontalScrollView extends android.widget.FrameLayout { + ctor public HorizontalScrollView(android.content.Context); + ctor public HorizontalScrollView(android.content.Context, android.util.AttributeSet); + ctor public HorizontalScrollView(android.content.Context, android.util.AttributeSet, int); + method public boolean arrowScroll(int); + method protected int computeScrollDeltaToGetChildRectOnScreen(android.graphics.Rect); + method public boolean executeKeyEvent(android.view.KeyEvent); + method public void fling(int); + method public boolean fullScroll(int); + method public int getMaxScrollAmount(); + method public boolean isFillViewport(); + method public boolean isSmoothScrollingEnabled(); + method public boolean pageScroll(int); + method public void setFillViewport(boolean); + method public void setSmoothScrollingEnabled(boolean); + method public final void smoothScrollBy(int, int); + method public final void smoothScrollTo(int, int); + } + + public class ImageButton extends android.widget.ImageView { + ctor public ImageButton(android.content.Context); + ctor public ImageButton(android.content.Context, android.util.AttributeSet); + ctor public ImageButton(android.content.Context, android.util.AttributeSet, int); + } + + public class ImageSwitcher extends android.widget.ViewSwitcher { + ctor public ImageSwitcher(android.content.Context); + ctor public ImageSwitcher(android.content.Context, android.util.AttributeSet); + method public void setImageDrawable(android.graphics.drawable.Drawable); + method public void setImageResource(int); + method public void setImageURI(android.net.Uri); + } + + public class ImageView extends android.view.View { + ctor public ImageView(android.content.Context); + ctor public ImageView(android.content.Context, android.util.AttributeSet); + ctor public ImageView(android.content.Context, android.util.AttributeSet, int); + method public final void clearColorFilter(); + method public boolean getAdjustViewBounds(); + method public boolean getBaselineAlignBottom(); + method public android.graphics.ColorFilter getColorFilter(); + method public boolean getCropToPadding(); + method public android.graphics.drawable.Drawable getDrawable(); + method public int getImageAlpha(); + method public android.graphics.Matrix getImageMatrix(); + method public int getMaxHeight(); + method public int getMaxWidth(); + method public android.widget.ImageView.ScaleType getScaleType(); + method public int[] onCreateDrawableState(int); + method public void setAdjustViewBounds(boolean); + method public deprecated void setAlpha(int); + method public void setBaseline(int); + method public void setBaselineAlignBottom(boolean); + method public final void setColorFilter(int, android.graphics.PorterDuff.Mode); + method public final void setColorFilter(int); + method public void setColorFilter(android.graphics.ColorFilter); + method public void setCropToPadding(boolean); + method protected boolean setFrame(int, int, int, int); + method public void setImageAlpha(int); + method public void setImageBitmap(android.graphics.Bitmap); + method public void setImageDrawable(android.graphics.drawable.Drawable); + method public void setImageLevel(int); + method public void setImageMatrix(android.graphics.Matrix); + method public void setImageResource(int); + method public void setImageState(int[], boolean); + method public void setImageURI(android.net.Uri); + method public void setMaxHeight(int); + method public void setMaxWidth(int); + method public void setScaleType(android.widget.ImageView.ScaleType); + } + + public static final class ImageView.ScaleType extends java.lang.Enum { + method public static android.widget.ImageView.ScaleType valueOf(java.lang.String); + method public static final android.widget.ImageView.ScaleType[] values(); + enum_constant public static final android.widget.ImageView.ScaleType CENTER; + enum_constant public static final android.widget.ImageView.ScaleType CENTER_CROP; + enum_constant public static final android.widget.ImageView.ScaleType CENTER_INSIDE; + enum_constant public static final android.widget.ImageView.ScaleType FIT_CENTER; + enum_constant public static final android.widget.ImageView.ScaleType FIT_END; + enum_constant public static final android.widget.ImageView.ScaleType FIT_START; + enum_constant public static final android.widget.ImageView.ScaleType FIT_XY; + enum_constant public static final android.widget.ImageView.ScaleType MATRIX; + } + + public class LinearLayout extends android.view.ViewGroup { + ctor public LinearLayout(android.content.Context); + ctor public LinearLayout(android.content.Context, android.util.AttributeSet); + ctor public LinearLayout(android.content.Context, android.util.AttributeSet, int); + method public int getBaselineAlignedChildIndex(); + method public android.graphics.drawable.Drawable getDividerDrawable(); + method public int getDividerPadding(); + method public int getOrientation(); + method public int getShowDividers(); + method public float getWeightSum(); + method public boolean isBaselineAligned(); + method public boolean isMeasureWithLargestChildEnabled(); + method protected void onLayout(boolean, int, int, int, int); + method public void setBaselineAligned(boolean); + method public void setBaselineAlignedChildIndex(int); + method public void setDividerDrawable(android.graphics.drawable.Drawable); + method public void setDividerPadding(int); + method public void setGravity(int); + method public void setHorizontalGravity(int); + method public void setMeasureWithLargestChildEnabled(boolean); + method public void setOrientation(int); + method public void setShowDividers(int); + method public void setVerticalGravity(int); + method public void setWeightSum(float); + field public static final int HORIZONTAL = 0; // 0x0 + field public static final int SHOW_DIVIDER_BEGINNING = 1; // 0x1 + field public static final int SHOW_DIVIDER_END = 4; // 0x4 + field public static final int SHOW_DIVIDER_MIDDLE = 2; // 0x2 + field public static final int SHOW_DIVIDER_NONE = 0; // 0x0 + field public static final int VERTICAL = 1; // 0x1 + } + + public static class LinearLayout.LayoutParams extends android.view.ViewGroup.MarginLayoutParams { + ctor public LinearLayout.LayoutParams(android.content.Context, android.util.AttributeSet); + ctor public LinearLayout.LayoutParams(int, int); + ctor public LinearLayout.LayoutParams(int, int, float); + ctor public LinearLayout.LayoutParams(android.view.ViewGroup.LayoutParams); + ctor public LinearLayout.LayoutParams(android.view.ViewGroup.MarginLayoutParams); + method public java.lang.String debug(java.lang.String); + field public int gravity; + field public float weight; + } + + public abstract interface ListAdapter implements android.widget.Adapter { + method public abstract boolean areAllItemsEnabled(); + method public abstract boolean isEnabled(int); + } + + public class ListPopupWindow { + ctor public ListPopupWindow(android.content.Context); + ctor public ListPopupWindow(android.content.Context, android.util.AttributeSet); + ctor public ListPopupWindow(android.content.Context, android.util.AttributeSet, int); + ctor public ListPopupWindow(android.content.Context, android.util.AttributeSet, int, int); + method public void clearListSelection(); + method public void dismiss(); + method public android.view.View getAnchorView(); + method public int getAnimationStyle(); + method public android.graphics.drawable.Drawable getBackground(); + method public int getHeight(); + method public int getHorizontalOffset(); + method public int getInputMethodMode(); + method public android.widget.ListView getListView(); + method public int getPromptPosition(); + method public java.lang.Object getSelectedItem(); + method public long getSelectedItemId(); + method public int getSelectedItemPosition(); + method public android.view.View getSelectedView(); + method public int getSoftInputMode(); + method public int getVerticalOffset(); + method public int getWidth(); + method public boolean isInputMethodNotNeeded(); + method public boolean isModal(); + method public boolean isShowing(); + method public boolean onKeyDown(int, android.view.KeyEvent); + method public boolean onKeyPreIme(int, android.view.KeyEvent); + method public boolean onKeyUp(int, android.view.KeyEvent); + method public boolean performItemClick(int); + method public void postShow(); + method public void setAdapter(android.widget.ListAdapter); + method public void setAnchorView(android.view.View); + method public void setAnimationStyle(int); + method public void setBackgroundDrawable(android.graphics.drawable.Drawable); + method public void setContentWidth(int); + method public void setHeight(int); + method public void setHorizontalOffset(int); + method public void setInputMethodMode(int); + method public void setListSelector(android.graphics.drawable.Drawable); + method public void setModal(boolean); + method public void setOnDismissListener(android.widget.PopupWindow.OnDismissListener); + method public void setOnItemClickListener(android.widget.AdapterView.OnItemClickListener); + method public void setOnItemSelectedListener(android.widget.AdapterView.OnItemSelectedListener); + method public void setPromptPosition(int); + method public void setPromptView(android.view.View); + method public void setSelection(int); + method public void setSoftInputMode(int); + method public void setVerticalOffset(int); + method public void setWidth(int); + method public void show(); + field public static final int INPUT_METHOD_FROM_FOCUSABLE = 0; // 0x0 + field public static final int INPUT_METHOD_NEEDED = 1; // 0x1 + field public static final int INPUT_METHOD_NOT_NEEDED = 2; // 0x2 + field public static final int MATCH_PARENT = -1; // 0xffffffff + field public static final int POSITION_PROMPT_ABOVE = 0; // 0x0 + field public static final int POSITION_PROMPT_BELOW = 1; // 0x1 + field public static final int WRAP_CONTENT = -2; // 0xfffffffe + } + + public class ListView extends android.widget.AbsListView { + ctor public ListView(android.content.Context); + ctor public ListView(android.content.Context, android.util.AttributeSet); + ctor public ListView(android.content.Context, android.util.AttributeSet, int); + method public void addFooterView(android.view.View, java.lang.Object, boolean); + method public void addFooterView(android.view.View); + method public void addHeaderView(android.view.View, java.lang.Object, boolean); + method public void addHeaderView(android.view.View); + method protected android.view.View findViewTraversal(int); + method protected android.view.View findViewWithTagTraversal(java.lang.Object); + method public android.widget.ListAdapter getAdapter(); + method public deprecated long[] getCheckItemIds(); + method public android.graphics.drawable.Drawable getDivider(); + method public int getDividerHeight(); + method public int getFooterViewsCount(); + method public int getHeaderViewsCount(); + method public boolean getItemsCanFocus(); + method public int getMaxScrollAmount(); + method public android.graphics.drawable.Drawable getOverscrollFooter(); + method public android.graphics.drawable.Drawable getOverscrollHeader(); + method public boolean removeFooterView(android.view.View); + method public boolean removeHeaderView(android.view.View); + method public void setDivider(android.graphics.drawable.Drawable); + method public void setDividerHeight(int); + method public void setFooterDividersEnabled(boolean); + method public void setHeaderDividersEnabled(boolean); + method public void setItemsCanFocus(boolean); + method public void setOverscrollFooter(android.graphics.drawable.Drawable); + method public void setOverscrollHeader(android.graphics.drawable.Drawable); + method public void setSelection(int); + method public void setSelectionAfterHeaderView(); + method public void setSelectionFromTop(int, int); + method public void smoothScrollByOffset(int); + } + + public class ListView.FixedViewInfo { + ctor public ListView.FixedViewInfo(); + field public java.lang.Object data; + field public boolean isSelectable; + field public android.view.View view; + } + + public class MediaController extends android.widget.FrameLayout { + ctor public MediaController(android.content.Context, android.util.AttributeSet); + ctor public MediaController(android.content.Context, boolean); + ctor public MediaController(android.content.Context); + method public void hide(); + method public boolean isShowing(); + method public void onFinishInflate(); + method public void setAnchorView(android.view.View); + method public void setMediaPlayer(android.widget.MediaController.MediaPlayerControl); + method public void setPrevNextListeners(android.view.View.OnClickListener, android.view.View.OnClickListener); + method public void show(); + method public void show(int); + } + + public static abstract interface MediaController.MediaPlayerControl { + method public abstract boolean canPause(); + method public abstract boolean canSeekBackward(); + method public abstract boolean canSeekForward(); + method public abstract int getBufferPercentage(); + method public abstract int getCurrentPosition(); + method public abstract int getDuration(); + method public abstract boolean isPlaying(); + method public abstract void pause(); + method public abstract void seekTo(int); + method public abstract void start(); + } + + public class MultiAutoCompleteTextView extends android.widget.AutoCompleteTextView { + ctor public MultiAutoCompleteTextView(android.content.Context); + ctor public MultiAutoCompleteTextView(android.content.Context, android.util.AttributeSet); + ctor public MultiAutoCompleteTextView(android.content.Context, android.util.AttributeSet, int); + method protected void performFiltering(java.lang.CharSequence, int, int, int); + method public void setTokenizer(android.widget.MultiAutoCompleteTextView.Tokenizer); + } + + public static class MultiAutoCompleteTextView.CommaTokenizer implements android.widget.MultiAutoCompleteTextView.Tokenizer { + ctor public MultiAutoCompleteTextView.CommaTokenizer(); + method public int findTokenEnd(java.lang.CharSequence, int); + method public int findTokenStart(java.lang.CharSequence, int); + method public java.lang.CharSequence terminateToken(java.lang.CharSequence); + } + + public static abstract interface MultiAutoCompleteTextView.Tokenizer { + method public abstract int findTokenEnd(java.lang.CharSequence, int); + method public abstract int findTokenStart(java.lang.CharSequence, int); + method public abstract java.lang.CharSequence terminateToken(java.lang.CharSequence); + } + + public class NumberPicker extends android.widget.LinearLayout { + ctor public NumberPicker(android.content.Context); + ctor public NumberPicker(android.content.Context, android.util.AttributeSet); + ctor public NumberPicker(android.content.Context, android.util.AttributeSet, int); + method public java.lang.String[] getDisplayedValues(); + method public int getMaxValue(); + method public int getMinValue(); + method public int getValue(); + method public boolean getWrapSelectorWheel(); + method public void setDisplayedValues(java.lang.String[]); + method public void setFormatter(android.widget.NumberPicker.Formatter); + method public void setMaxValue(int); + method public void setMinValue(int); + method public void setOnLongPressUpdateInterval(long); + method public void setOnScrollListener(android.widget.NumberPicker.OnScrollListener); + method public void setOnValueChangedListener(android.widget.NumberPicker.OnValueChangeListener); + method public void setValue(int); + method public void setWrapSelectorWheel(boolean); + } + + public static abstract interface NumberPicker.Formatter { + method public abstract java.lang.String format(int); + } + + public static abstract interface NumberPicker.OnScrollListener { + method public abstract void onScrollStateChange(android.widget.NumberPicker, int); + field public static final int SCROLL_STATE_FLING = 2; // 0x2 + field public static final int SCROLL_STATE_IDLE = 0; // 0x0 + field public static final int SCROLL_STATE_TOUCH_SCROLL = 1; // 0x1 + } + + public static abstract interface NumberPicker.OnValueChangeListener { + method public abstract void onValueChange(android.widget.NumberPicker, int, int); + } + + public class OverScroller { + ctor public OverScroller(android.content.Context); + ctor public OverScroller(android.content.Context, android.view.animation.Interpolator); + ctor public OverScroller(android.content.Context, android.view.animation.Interpolator, float, float); + ctor public OverScroller(android.content.Context, android.view.animation.Interpolator, float, float, boolean); + method public void abortAnimation(); + method public boolean computeScrollOffset(); + method public void fling(int, int, int, int, int, int, int, int); + method public void fling(int, int, int, int, int, int, int, int, int, int); + method public final void forceFinished(boolean); + method public float getCurrVelocity(); + method public final int getCurrX(); + method public final int getCurrY(); + method public final int getFinalX(); + method public final int getFinalY(); + method public final int getStartX(); + method public final int getStartY(); + method public final boolean isFinished(); + method public boolean isOverScrolled(); + method public void notifyHorizontalEdgeReached(int, int, int); + method public void notifyVerticalEdgeReached(int, int, int); + method public final void setFriction(float); + method public boolean springBack(int, int, int, int, int, int); + method public void startScroll(int, int, int, int); + method public void startScroll(int, int, int, int, int); + } + + public class PopupMenu { + ctor public PopupMenu(android.content.Context, android.view.View); + method public void dismiss(); + method public android.view.Menu getMenu(); + method public android.view.MenuInflater getMenuInflater(); + method public void inflate(int); + method public void setOnDismissListener(android.widget.PopupMenu.OnDismissListener); + method public void setOnMenuItemClickListener(android.widget.PopupMenu.OnMenuItemClickListener); + method public void show(); + } + + public static abstract interface PopupMenu.OnDismissListener { + method public abstract void onDismiss(android.widget.PopupMenu); + } + + public static abstract interface PopupMenu.OnMenuItemClickListener { + method public abstract boolean onMenuItemClick(android.view.MenuItem); + } + + public class PopupWindow { + ctor public PopupWindow(android.content.Context); + ctor public PopupWindow(android.content.Context, android.util.AttributeSet); + ctor public PopupWindow(android.content.Context, android.util.AttributeSet, int); + ctor public PopupWindow(android.content.Context, android.util.AttributeSet, int, int); + ctor public PopupWindow(); + ctor public PopupWindow(android.view.View); + ctor public PopupWindow(int, int); + ctor public PopupWindow(android.view.View, int, int); + ctor public PopupWindow(android.view.View, int, int, boolean); + method public void dismiss(); + method public int getAnimationStyle(); + method public android.graphics.drawable.Drawable getBackground(); + method public android.view.View getContentView(); + method public int getHeight(); + method public int getInputMethodMode(); + method public int getMaxAvailableHeight(android.view.View); + method public int getMaxAvailableHeight(android.view.View, int); + method public int getSoftInputMode(); + method public int getWidth(); + method public boolean isAboveAnchor(); + method public boolean isClippingEnabled(); + method public boolean isFocusable(); + method public boolean isOutsideTouchable(); + method public boolean isShowing(); + method public boolean isSplitTouchEnabled(); + method public boolean isTouchable(); + method public void setAnimationStyle(int); + method public void setBackgroundDrawable(android.graphics.drawable.Drawable); + method public void setClippingEnabled(boolean); + method public void setContentView(android.view.View); + method public void setFocusable(boolean); + method public void setHeight(int); + method public void setIgnoreCheekPress(); + method public void setInputMethodMode(int); + method public void setOnDismissListener(android.widget.PopupWindow.OnDismissListener); + method public void setOutsideTouchable(boolean); + method public void setSoftInputMode(int); + method public void setSplitTouchEnabled(boolean); + method public void setTouchInterceptor(android.view.View.OnTouchListener); + method public void setTouchable(boolean); + method public void setWidth(int); + method public void setWindowLayoutMode(int, int); + method public void showAsDropDown(android.view.View); + method public void showAsDropDown(android.view.View, int, int); + method public void showAtLocation(android.view.View, int, int, int); + method public void update(); + method public void update(int, int); + method public void update(int, int, int, int); + method public void update(int, int, int, int, boolean); + method public void update(android.view.View, int, int); + method public void update(android.view.View, int, int, int, int); + field public static final int INPUT_METHOD_FROM_FOCUSABLE = 0; // 0x0 + field public static final int INPUT_METHOD_NEEDED = 1; // 0x1 + field public static final int INPUT_METHOD_NOT_NEEDED = 2; // 0x2 + } + + public static abstract interface PopupWindow.OnDismissListener { + method public abstract void onDismiss(); + } + + public class ProgressBar extends android.view.View { + ctor public ProgressBar(android.content.Context); + ctor public ProgressBar(android.content.Context, android.util.AttributeSet); + ctor public ProgressBar(android.content.Context, android.util.AttributeSet, int); + method public android.graphics.drawable.Drawable getIndeterminateDrawable(); + method public android.view.animation.Interpolator getInterpolator(); + method public synchronized int getMax(); + method public synchronized int getProgress(); + method public android.graphics.drawable.Drawable getProgressDrawable(); + method public synchronized int getSecondaryProgress(); + method public final synchronized void incrementProgressBy(int); + method public final synchronized void incrementSecondaryProgressBy(int); + method public synchronized boolean isIndeterminate(); + method public void onRestoreInstanceState(android.os.Parcelable); + method public android.os.Parcelable onSaveInstanceState(); + method public synchronized void setIndeterminate(boolean); + method public void setIndeterminateDrawable(android.graphics.drawable.Drawable); + method public void setInterpolator(android.content.Context, int); + method public void setInterpolator(android.view.animation.Interpolator); + method public synchronized void setMax(int); + method public synchronized void setProgress(int); + method public void setProgressDrawable(android.graphics.drawable.Drawable); + method public synchronized void setSecondaryProgress(int); + } + + public class QuickContactBadge extends android.widget.ImageView implements android.view.View.OnClickListener { + ctor public QuickContactBadge(android.content.Context); + ctor public QuickContactBadge(android.content.Context, android.util.AttributeSet); + ctor public QuickContactBadge(android.content.Context, android.util.AttributeSet, int); + method public void assignContactFromEmail(java.lang.String, boolean); + method public void assignContactFromPhone(java.lang.String, boolean); + method public void assignContactUri(android.net.Uri); + method public void onClick(android.view.View); + method public void setExcludeMimes(java.lang.String[]); + method public void setImageToDefault(); + method public void setMode(int); + field protected java.lang.String[] mExcludeMimes; + } + + public class RadioButton extends android.widget.CompoundButton { + ctor public RadioButton(android.content.Context); + ctor public RadioButton(android.content.Context, android.util.AttributeSet); + ctor public RadioButton(android.content.Context, android.util.AttributeSet, int); + } + + public class RadioGroup extends android.widget.LinearLayout { + ctor public RadioGroup(android.content.Context); + ctor public RadioGroup(android.content.Context, android.util.AttributeSet); + method public void check(int); + method public void clearCheck(); + method public int getCheckedRadioButtonId(); + method public void setOnCheckedChangeListener(android.widget.RadioGroup.OnCheckedChangeListener); + } + + public static class RadioGroup.LayoutParams extends android.widget.LinearLayout.LayoutParams { + ctor public RadioGroup.LayoutParams(android.content.Context, android.util.AttributeSet); + ctor public RadioGroup.LayoutParams(int, int); + ctor public RadioGroup.LayoutParams(int, int, float); + ctor public RadioGroup.LayoutParams(android.view.ViewGroup.LayoutParams); + ctor public RadioGroup.LayoutParams(android.view.ViewGroup.MarginLayoutParams); + } + + public static abstract interface RadioGroup.OnCheckedChangeListener { + method public abstract void onCheckedChanged(android.widget.RadioGroup, int); + } + + public class RatingBar extends android.widget.AbsSeekBar { + ctor public RatingBar(android.content.Context, android.util.AttributeSet, int); + ctor public RatingBar(android.content.Context, android.util.AttributeSet); + ctor public RatingBar(android.content.Context); + method public int getNumStars(); + method public android.widget.RatingBar.OnRatingBarChangeListener getOnRatingBarChangeListener(); + method public float getRating(); + method public float getStepSize(); + method public boolean isIndicator(); + method public void setIsIndicator(boolean); + method public void setNumStars(int); + method public void setOnRatingBarChangeListener(android.widget.RatingBar.OnRatingBarChangeListener); + method public void setRating(float); + method public void setStepSize(float); + } + + public static abstract interface RatingBar.OnRatingBarChangeListener { + method public abstract void onRatingChanged(android.widget.RatingBar, float, boolean); + } + + public class RelativeLayout extends android.view.ViewGroup { + ctor public RelativeLayout(android.content.Context); + ctor public RelativeLayout(android.content.Context, android.util.AttributeSet); + ctor public RelativeLayout(android.content.Context, android.util.AttributeSet, int); + method public int getGravity(); + method protected void onLayout(boolean, int, int, int, int); + method public void setGravity(int); + method public void setHorizontalGravity(int); + method public void setIgnoreGravity(int); + method public void setVerticalGravity(int); + field public static final int ABOVE = 2; // 0x2 + field public static final int ALIGN_BASELINE = 4; // 0x4 + field public static final int ALIGN_BOTTOM = 8; // 0x8 + field public static final int ALIGN_END = 19; // 0x13 + field public static final int ALIGN_LEFT = 5; // 0x5 + field public static final int ALIGN_PARENT_BOTTOM = 12; // 0xc + field public static final int ALIGN_PARENT_END = 21; // 0x15 + field public static final int ALIGN_PARENT_LEFT = 9; // 0x9 + field public static final int ALIGN_PARENT_RIGHT = 11; // 0xb + field public static final int ALIGN_PARENT_START = 20; // 0x14 + field public static final int ALIGN_PARENT_TOP = 10; // 0xa + field public static final int ALIGN_RIGHT = 7; // 0x7 + field public static final int ALIGN_START = 18; // 0x12 + field public static final int ALIGN_TOP = 6; // 0x6 + field public static final int BELOW = 3; // 0x3 + field public static final int CENTER_HORIZONTAL = 14; // 0xe + field public static final int CENTER_IN_PARENT = 13; // 0xd + field public static final int CENTER_VERTICAL = 15; // 0xf + field public static final int END_OF = 17; // 0x11 + field public static final int LEFT_OF = 0; // 0x0 + field public static final int RIGHT_OF = 1; // 0x1 + field public static final int START_OF = 16; // 0x10 + field public static final int TRUE = -1; // 0xffffffff + } + + public static class RelativeLayout.LayoutParams extends android.view.ViewGroup.MarginLayoutParams { + ctor public RelativeLayout.LayoutParams(android.content.Context, android.util.AttributeSet); + ctor public RelativeLayout.LayoutParams(int, int); + ctor public RelativeLayout.LayoutParams(android.view.ViewGroup.LayoutParams); + ctor public RelativeLayout.LayoutParams(android.view.ViewGroup.MarginLayoutParams); + method public void addRule(int); + 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; + } + + public class RemoteViews implements android.view.LayoutInflater.Filter android.os.Parcelable { + ctor public RemoteViews(java.lang.String, int); + ctor public RemoteViews(android.widget.RemoteViews, android.widget.RemoteViews); + ctor public RemoteViews(android.os.Parcel); + method public void addView(int, android.widget.RemoteViews); + method public android.view.View apply(android.content.Context, android.view.ViewGroup); + method public android.widget.RemoteViews clone(); + method public int describeContents(); + method public int getLayoutId(); + method public java.lang.String getPackage(); + method public boolean onLoadClass(java.lang.Class); + method public void reapply(android.content.Context, android.view.View); + method public void removeAllViews(int); + method public void setBitmap(int, java.lang.String, android.graphics.Bitmap); + method public void setBoolean(int, java.lang.String, boolean); + method public void setBundle(int, java.lang.String, android.os.Bundle); + method public void setByte(int, java.lang.String, byte); + method public void setChar(int, java.lang.String, char); + method public void setCharSequence(int, java.lang.String, java.lang.CharSequence); + method public void setChronometer(int, long, java.lang.String, boolean); + method public void setContentDescription(int, java.lang.CharSequence); + method public void setDisplayedChild(int, int); + method public void setDouble(int, java.lang.String, double); + method public void setEmptyView(int, int); + method public void setFloat(int, java.lang.String, float); + method public void setImageViewBitmap(int, android.graphics.Bitmap); + method public void setImageViewResource(int, int); + method public void setImageViewUri(int, android.net.Uri); + method public void setInt(int, java.lang.String, int); + method public void setIntent(int, java.lang.String, android.content.Intent); + method public void setLabelFor(int, int); + method public void setLong(int, java.lang.String, long); + method public void setOnClickFillInIntent(int, android.content.Intent); + method public void setOnClickPendingIntent(int, android.app.PendingIntent); + method public void setPendingIntentTemplate(int, android.app.PendingIntent); + method public void setProgressBar(int, int, int, boolean); + method public void setRelativeScrollPosition(int, int); + method public deprecated void setRemoteAdapter(int, int, android.content.Intent); + method public void setRemoteAdapter(int, android.content.Intent); + method public void setScrollPosition(int, int); + method public void setShort(int, java.lang.String, short); + method public void setString(int, java.lang.String, java.lang.String); + method public void setTextColor(int, int); + method public void setTextViewCompoundDrawables(int, int, int, int, int); + method public void setTextViewCompoundDrawablesRelative(int, int, int, int, int); + method public void setTextViewText(int, java.lang.CharSequence); + method public void setTextViewTextSize(int, int, float); + method public void setUri(int, java.lang.String, android.net.Uri); + method public void setViewPadding(int, int, int, int, int); + method public void setViewVisibility(int, int); + method public void showNext(int); + method public void showPrevious(int); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + } + + public static class RemoteViews.ActionException extends java.lang.RuntimeException { + ctor public RemoteViews.ActionException(java.lang.Exception); + ctor public RemoteViews.ActionException(java.lang.String); + } + + public static abstract class RemoteViews.RemoteView implements java.lang.annotation.Annotation { + } + + public abstract class RemoteViewsService extends android.app.Service { + ctor public RemoteViewsService(); + method public android.os.IBinder onBind(android.content.Intent); + method public abstract android.widget.RemoteViewsService.RemoteViewsFactory onGetViewFactory(android.content.Intent); + } + + public static abstract interface RemoteViewsService.RemoteViewsFactory { + method public abstract int getCount(); + method public abstract long getItemId(int); + method public abstract android.widget.RemoteViews getLoadingView(); + method public abstract android.widget.RemoteViews getViewAt(int); + method public abstract int getViewTypeCount(); + method public abstract boolean hasStableIds(); + method public abstract void onCreate(); + method public abstract void onDataSetChanged(); + method public abstract void onDestroy(); + } + + public abstract class ResourceCursorAdapter extends android.widget.CursorAdapter { + ctor public deprecated ResourceCursorAdapter(android.content.Context, int, android.database.Cursor); + ctor public ResourceCursorAdapter(android.content.Context, int, android.database.Cursor, boolean); + ctor public ResourceCursorAdapter(android.content.Context, int, android.database.Cursor, int); + method public android.view.View newView(android.content.Context, android.database.Cursor, android.view.ViewGroup); + method public void setDropDownViewResource(int); + method public void setViewResource(int); + } + + public abstract class ResourceCursorTreeAdapter extends android.widget.CursorTreeAdapter { + ctor public ResourceCursorTreeAdapter(android.content.Context, android.database.Cursor, int, int, int, int); + ctor public ResourceCursorTreeAdapter(android.content.Context, android.database.Cursor, int, int, int); + ctor public ResourceCursorTreeAdapter(android.content.Context, android.database.Cursor, int, int); + method public android.view.View newChildView(android.content.Context, android.database.Cursor, boolean, android.view.ViewGroup); + method public android.view.View newGroupView(android.content.Context, android.database.Cursor, boolean, android.view.ViewGroup); + } + + public class ScrollView extends android.widget.FrameLayout { + ctor public ScrollView(android.content.Context); + ctor public ScrollView(android.content.Context, android.util.AttributeSet); + ctor public ScrollView(android.content.Context, android.util.AttributeSet, int); + method public boolean arrowScroll(int); + method protected int computeScrollDeltaToGetChildRectOnScreen(android.graphics.Rect); + method public boolean executeKeyEvent(android.view.KeyEvent); + method public void fling(int); + method public boolean fullScroll(int); + method public int getMaxScrollAmount(); + method public boolean isFillViewport(); + method public boolean isSmoothScrollingEnabled(); + method public boolean pageScroll(int); + method public void setFillViewport(boolean); + method public void setSmoothScrollingEnabled(boolean); + method public final void smoothScrollBy(int, int); + method public final void smoothScrollTo(int, int); + } + + public class Scroller { + ctor public Scroller(android.content.Context); + ctor public Scroller(android.content.Context, android.view.animation.Interpolator); + ctor public Scroller(android.content.Context, android.view.animation.Interpolator, boolean); + method public void abortAnimation(); + method public boolean computeScrollOffset(); + method public void extendDuration(int); + method public void fling(int, int, int, int, int, int, int, int); + method public final void forceFinished(boolean); + method public float getCurrVelocity(); + method public final int getCurrX(); + method public final int getCurrY(); + method public final int getDuration(); + method public final int getFinalX(); + method public final int getFinalY(); + method public final int getStartX(); + method public final int getStartY(); + method public final boolean isFinished(); + method public void setFinalX(int); + method public void setFinalY(int); + method public final void setFriction(float); + method public void startScroll(int, int, int, int); + method public void startScroll(int, int, int, int, int); + method public int timePassed(); + } + + public class SearchView extends android.widget.LinearLayout implements android.view.CollapsibleActionView { + ctor public SearchView(android.content.Context); + ctor public SearchView(android.content.Context, android.util.AttributeSet); + method public int getImeOptions(); + method public int getInputType(); + method public int getMaxWidth(); + method public java.lang.CharSequence getQuery(); + method public java.lang.CharSequence getQueryHint(); + method public android.widget.CursorAdapter getSuggestionsAdapter(); + method public boolean isIconfiedByDefault(); + method public boolean isIconified(); + method public boolean isQueryRefinementEnabled(); + method public boolean isSubmitButtonEnabled(); + method public void onActionViewCollapsed(); + method public void onActionViewExpanded(); + method public void setIconified(boolean); + method public void setIconifiedByDefault(boolean); + method public void setImeOptions(int); + method public void setInputType(int); + method public void setMaxWidth(int); + method public void setOnCloseListener(android.widget.SearchView.OnCloseListener); + method public void setOnQueryTextFocusChangeListener(android.view.View.OnFocusChangeListener); + method public void setOnQueryTextListener(android.widget.SearchView.OnQueryTextListener); + method public void setOnSearchClickListener(android.view.View.OnClickListener); + method public void setOnSuggestionListener(android.widget.SearchView.OnSuggestionListener); + method public void setQuery(java.lang.CharSequence, boolean); + method public void setQueryHint(java.lang.CharSequence); + method public void setQueryRefinementEnabled(boolean); + method public void setSearchableInfo(android.app.SearchableInfo); + method public void setSubmitButtonEnabled(boolean); + method public void setSuggestionsAdapter(android.widget.CursorAdapter); + } + + public static abstract interface SearchView.OnCloseListener { + method public abstract boolean onClose(); + } + + public static abstract interface SearchView.OnQueryTextListener { + method public abstract boolean onQueryTextChange(java.lang.String); + method public abstract boolean onQueryTextSubmit(java.lang.String); + } + + public static abstract interface SearchView.OnSuggestionListener { + method public abstract boolean onSuggestionClick(int); + method public abstract boolean onSuggestionSelect(int); + } + + public abstract interface SectionIndexer { + method public abstract int getPositionForSection(int); + method public abstract int getSectionForPosition(int); + method public abstract java.lang.Object[] getSections(); + } + + public class SeekBar extends android.widget.AbsSeekBar { + ctor public SeekBar(android.content.Context); + ctor public SeekBar(android.content.Context, android.util.AttributeSet); + ctor public SeekBar(android.content.Context, android.util.AttributeSet, int); + method public void setOnSeekBarChangeListener(android.widget.SeekBar.OnSeekBarChangeListener); + } + + public static abstract interface SeekBar.OnSeekBarChangeListener { + method public abstract void onProgressChanged(android.widget.SeekBar, int, boolean); + method public abstract void onStartTrackingTouch(android.widget.SeekBar); + method public abstract void onStopTrackingTouch(android.widget.SeekBar); + } + + public class ShareActionProvider extends android.view.ActionProvider { + ctor public ShareActionProvider(android.content.Context); + method public android.view.View onCreateActionView(); + method public void setOnShareTargetSelectedListener(android.widget.ShareActionProvider.OnShareTargetSelectedListener); + method public void setShareHistoryFileName(java.lang.String); + method public void setShareIntent(android.content.Intent); + field public static final java.lang.String DEFAULT_SHARE_HISTORY_FILE_NAME = "share_history.xml"; + } + + public static abstract interface ShareActionProvider.OnShareTargetSelectedListener { + method public abstract boolean onShareTargetSelected(android.widget.ShareActionProvider, android.content.Intent); + } + + public class SimpleAdapter extends android.widget.BaseAdapter implements android.widget.Filterable { + ctor public SimpleAdapter(android.content.Context, java.util.List>, int, java.lang.String[], int[]); + method public int getCount(); + method public android.widget.Filter getFilter(); + method public java.lang.Object getItem(int); + method public long getItemId(int); + method public android.view.View getView(int, android.view.View, android.view.ViewGroup); + method public android.widget.SimpleAdapter.ViewBinder getViewBinder(); + method public void setDropDownViewResource(int); + method public void setViewBinder(android.widget.SimpleAdapter.ViewBinder); + method public void setViewImage(android.widget.ImageView, int); + method public void setViewImage(android.widget.ImageView, java.lang.String); + method public void setViewText(android.widget.TextView, java.lang.String); + } + + public static abstract interface SimpleAdapter.ViewBinder { + method public abstract boolean setViewValue(android.view.View, java.lang.Object, java.lang.String); + } + + public class SimpleCursorAdapter extends android.widget.ResourceCursorAdapter { + ctor public deprecated SimpleCursorAdapter(android.content.Context, int, android.database.Cursor, java.lang.String[], int[]); + ctor public SimpleCursorAdapter(android.content.Context, int, android.database.Cursor, java.lang.String[], int[], int); + method public void bindView(android.view.View, android.content.Context, android.database.Cursor); + method public void changeCursorAndColumns(android.database.Cursor, java.lang.String[], int[]); + method public android.widget.SimpleCursorAdapter.CursorToStringConverter getCursorToStringConverter(); + method public int getStringConversionColumn(); + method public android.widget.SimpleCursorAdapter.ViewBinder getViewBinder(); + method public void setCursorToStringConverter(android.widget.SimpleCursorAdapter.CursorToStringConverter); + method public void setStringConversionColumn(int); + method public void setViewBinder(android.widget.SimpleCursorAdapter.ViewBinder); + method public void setViewImage(android.widget.ImageView, java.lang.String); + method public void setViewText(android.widget.TextView, java.lang.String); + } + + public static abstract interface SimpleCursorAdapter.CursorToStringConverter { + method public abstract java.lang.CharSequence convertToString(android.database.Cursor); + } + + public static abstract interface SimpleCursorAdapter.ViewBinder { + method public abstract boolean setViewValue(android.view.View, android.database.Cursor, int); + } + + public abstract class SimpleCursorTreeAdapter extends android.widget.ResourceCursorTreeAdapter { + ctor public SimpleCursorTreeAdapter(android.content.Context, android.database.Cursor, int, int, java.lang.String[], int[], int, int, java.lang.String[], int[]); + ctor public SimpleCursorTreeAdapter(android.content.Context, android.database.Cursor, int, int, java.lang.String[], int[], int, java.lang.String[], int[]); + ctor public SimpleCursorTreeAdapter(android.content.Context, android.database.Cursor, int, java.lang.String[], int[], int, java.lang.String[], int[]); + method protected void bindChildView(android.view.View, android.content.Context, android.database.Cursor, boolean); + method protected void bindGroupView(android.view.View, android.content.Context, android.database.Cursor, boolean); + method public android.widget.SimpleCursorTreeAdapter.ViewBinder getViewBinder(); + method public void setViewBinder(android.widget.SimpleCursorTreeAdapter.ViewBinder); + method protected void setViewImage(android.widget.ImageView, java.lang.String); + method public void setViewText(android.widget.TextView, java.lang.String); + } + + public static abstract interface SimpleCursorTreeAdapter.ViewBinder { + method public abstract boolean setViewValue(android.view.View, android.database.Cursor, int); + } + + public class SimpleExpandableListAdapter extends android.widget.BaseExpandableListAdapter { + ctor public SimpleExpandableListAdapter(android.content.Context, java.util.List>, int, java.lang.String[], int[], java.util.List>>, int, java.lang.String[], int[]); + ctor public SimpleExpandableListAdapter(android.content.Context, java.util.List>, int, int, java.lang.String[], int[], java.util.List>>, int, java.lang.String[], int[]); + ctor public SimpleExpandableListAdapter(android.content.Context, java.util.List>, int, int, java.lang.String[], int[], java.util.List>>, int, int, java.lang.String[], int[]); + method public java.lang.Object getChild(int, int); + method public long getChildId(int, int); + method public android.view.View getChildView(int, int, boolean, android.view.View, android.view.ViewGroup); + method public int getChildrenCount(int); + method public java.lang.Object getGroup(int); + method public int getGroupCount(); + method public long getGroupId(int); + method public android.view.View getGroupView(int, boolean, android.view.View, android.view.ViewGroup); + method public boolean hasStableIds(); + method public boolean isChildSelectable(int, int); + method public android.view.View newChildView(boolean, android.view.ViewGroup); + method public android.view.View newGroupView(boolean, android.view.ViewGroup); + } + + public deprecated class SlidingDrawer extends android.view.ViewGroup { + ctor public SlidingDrawer(android.content.Context, android.util.AttributeSet); + ctor public SlidingDrawer(android.content.Context, android.util.AttributeSet, int); + method public void animateClose(); + method public void animateOpen(); + method public void animateToggle(); + method public void close(); + method public android.view.View getContent(); + method public android.view.View getHandle(); + method public boolean isMoving(); + method public boolean isOpened(); + method public void lock(); + method protected void onLayout(boolean, int, int, int, int); + method public void open(); + method public void setOnDrawerCloseListener(android.widget.SlidingDrawer.OnDrawerCloseListener); + method public void setOnDrawerOpenListener(android.widget.SlidingDrawer.OnDrawerOpenListener); + method public void setOnDrawerScrollListener(android.widget.SlidingDrawer.OnDrawerScrollListener); + method public void toggle(); + method public void unlock(); + field public static final int ORIENTATION_HORIZONTAL = 0; // 0x0 + field public static final int ORIENTATION_VERTICAL = 1; // 0x1 + } + + public static abstract interface SlidingDrawer.OnDrawerCloseListener { + method public abstract void onDrawerClosed(); + } + + public static abstract interface SlidingDrawer.OnDrawerOpenListener { + method public abstract void onDrawerOpened(); + } + + public static abstract interface SlidingDrawer.OnDrawerScrollListener { + method public abstract void onScrollEnded(); + method public abstract void onScrollStarted(); + } + + public final class Space extends android.view.View { + ctor public Space(android.content.Context, android.util.AttributeSet, int); + ctor public Space(android.content.Context, android.util.AttributeSet); + ctor public Space(android.content.Context); + } + + public class Spinner extends android.widget.AbsSpinner implements android.content.DialogInterface.OnClickListener { + ctor public Spinner(android.content.Context); + ctor public Spinner(android.content.Context, int); + ctor public Spinner(android.content.Context, android.util.AttributeSet); + ctor public Spinner(android.content.Context, android.util.AttributeSet, int); + ctor public Spinner(android.content.Context, android.util.AttributeSet, int, int); + method public int getDropDownHorizontalOffset(); + method public int getDropDownVerticalOffset(); + method public int getDropDownWidth(); + method public int getGravity(); + method public android.graphics.drawable.Drawable getPopupBackground(); + method public java.lang.CharSequence getPrompt(); + method public void onClick(android.content.DialogInterface, int); + method public void setDropDownHorizontalOffset(int); + method public void setDropDownVerticalOffset(int); + method public void setDropDownWidth(int); + method public void setGravity(int); + method public void setPopupBackgroundDrawable(android.graphics.drawable.Drawable); + method public void setPopupBackgroundResource(int); + method public void setPrompt(java.lang.CharSequence); + method public void setPromptId(int); + field public static final int MODE_DIALOG = 0; // 0x0 + field public static final int MODE_DROPDOWN = 1; // 0x1 + } + + public abstract interface SpinnerAdapter implements android.widget.Adapter { + method public abstract android.view.View getDropDownView(int, android.view.View, android.view.ViewGroup); + } + + public class StackView extends android.widget.AdapterViewAnimator { + ctor public StackView(android.content.Context); + ctor public StackView(android.content.Context, android.util.AttributeSet); + ctor public StackView(android.content.Context, android.util.AttributeSet, int); + } + + public class Switch extends android.widget.CompoundButton { + ctor public Switch(android.content.Context); + ctor public Switch(android.content.Context, android.util.AttributeSet); + ctor public Switch(android.content.Context, android.util.AttributeSet, int); + method public int getSwitchMinWidth(); + method public int getSwitchPadding(); + method public java.lang.CharSequence getTextOff(); + method public java.lang.CharSequence getTextOn(); + method public android.graphics.drawable.Drawable getThumbDrawable(); + method public int getThumbTextPadding(); + method public android.graphics.drawable.Drawable getTrackDrawable(); + method public void onMeasure(int, int); + method public void setSwitchMinWidth(int); + method public void setSwitchPadding(int); + method public void setSwitchTextAppearance(android.content.Context, int); + method public void setSwitchTypeface(android.graphics.Typeface, int); + method public void setSwitchTypeface(android.graphics.Typeface); + method public void setTextOff(java.lang.CharSequence); + method public void setTextOn(java.lang.CharSequence); + method public void setThumbDrawable(android.graphics.drawable.Drawable); + method public void setThumbResource(int); + method public void setThumbTextPadding(int); + method public void setTrackDrawable(android.graphics.drawable.Drawable); + method public void setTrackResource(int); + } + + public class TabHost extends android.widget.FrameLayout implements android.view.ViewTreeObserver.OnTouchModeChangeListener { + ctor public TabHost(android.content.Context); + ctor public TabHost(android.content.Context, android.util.AttributeSet); + method public void addTab(android.widget.TabHost.TabSpec); + method public void clearAllTabs(); + method public int getCurrentTab(); + method public java.lang.String getCurrentTabTag(); + method public android.view.View getCurrentTabView(); + method public android.view.View getCurrentView(); + method public android.widget.FrameLayout getTabContentView(); + method public android.widget.TabWidget getTabWidget(); + method public android.widget.TabHost.TabSpec newTabSpec(java.lang.String); + method public void onTouchModeChanged(boolean); + method public void setCurrentTab(int); + method public void setCurrentTabByTag(java.lang.String); + method public void setOnTabChangedListener(android.widget.TabHost.OnTabChangeListener); + method public void setup(); + method public void setup(android.app.LocalActivityManager); + } + + public static abstract interface TabHost.OnTabChangeListener { + method public abstract void onTabChanged(java.lang.String); + } + + public static abstract interface TabHost.TabContentFactory { + method public abstract android.view.View createTabContent(java.lang.String); + } + + public class TabHost.TabSpec { + method public java.lang.String getTag(); + method public android.widget.TabHost.TabSpec setContent(int); + method public android.widget.TabHost.TabSpec setContent(android.widget.TabHost.TabContentFactory); + method public android.widget.TabHost.TabSpec setContent(android.content.Intent); + method public android.widget.TabHost.TabSpec setIndicator(java.lang.CharSequence); + method public android.widget.TabHost.TabSpec setIndicator(java.lang.CharSequence, android.graphics.drawable.Drawable); + method public android.widget.TabHost.TabSpec setIndicator(android.view.View); + } + + public class TabWidget extends android.widget.LinearLayout implements android.view.View.OnFocusChangeListener { + ctor public TabWidget(android.content.Context); + ctor public TabWidget(android.content.Context, android.util.AttributeSet); + ctor public TabWidget(android.content.Context, android.util.AttributeSet, int); + method public void dispatchDraw(android.graphics.Canvas); + method public void focusCurrentTab(int); + method public android.view.View getChildTabViewAt(int); + method public int getTabCount(); + method public boolean isStripEnabled(); + method public void onFocusChange(android.view.View, boolean); + method public void setCurrentTab(int); + method public void setDividerDrawable(int); + method public void setLeftStripDrawable(android.graphics.drawable.Drawable); + method public void setLeftStripDrawable(int); + method public void setRightStripDrawable(android.graphics.drawable.Drawable); + method public void setRightStripDrawable(int); + method public void setStripEnabled(boolean); + } + + public class TableLayout extends android.widget.LinearLayout { + ctor public TableLayout(android.content.Context); + ctor public TableLayout(android.content.Context, android.util.AttributeSet); + method public boolean isColumnCollapsed(int); + method public boolean isColumnShrinkable(int); + method public boolean isColumnStretchable(int); + method public boolean isShrinkAllColumns(); + method public boolean isStretchAllColumns(); + method public void setColumnCollapsed(int, boolean); + method public void setColumnShrinkable(int, boolean); + method public void setColumnStretchable(int, boolean); + method public void setShrinkAllColumns(boolean); + method public void setStretchAllColumns(boolean); + } + + public static class TableLayout.LayoutParams extends android.widget.LinearLayout.LayoutParams { + ctor public TableLayout.LayoutParams(android.content.Context, android.util.AttributeSet); + ctor public TableLayout.LayoutParams(int, int); + ctor public TableLayout.LayoutParams(int, int, float); + ctor public TableLayout.LayoutParams(); + ctor public TableLayout.LayoutParams(android.view.ViewGroup.LayoutParams); + ctor public TableLayout.LayoutParams(android.view.ViewGroup.MarginLayoutParams); + } + + public class TableRow extends android.widget.LinearLayout { + ctor public TableRow(android.content.Context); + ctor public TableRow(android.content.Context, android.util.AttributeSet); + method public android.view.View getVirtualChildAt(int); + method public int getVirtualChildCount(); + } + + public static class TableRow.LayoutParams extends android.widget.LinearLayout.LayoutParams { + ctor public TableRow.LayoutParams(android.content.Context, android.util.AttributeSet); + ctor public TableRow.LayoutParams(int, int); + ctor public TableRow.LayoutParams(int, int, float); + ctor public TableRow.LayoutParams(); + ctor public TableRow.LayoutParams(int); + ctor public TableRow.LayoutParams(android.view.ViewGroup.LayoutParams); + ctor public TableRow.LayoutParams(android.view.ViewGroup.MarginLayoutParams); + field public int column; + field public int span; + } + + public class TextClock extends android.widget.TextView { + ctor public TextClock(android.content.Context); + ctor public TextClock(android.content.Context, android.util.AttributeSet); + ctor public TextClock(android.content.Context, android.util.AttributeSet, int); + method public java.lang.CharSequence getFormat12Hour(); + method public java.lang.CharSequence getFormat24Hour(); + method public java.lang.String getTimeZone(); + method public boolean is24HourModeEnabled(); + method public void setFormat12Hour(java.lang.CharSequence); + method public void setFormat24Hour(java.lang.CharSequence); + method public void setTimeZone(java.lang.String); + field public static final java.lang.CharSequence DEFAULT_FORMAT_12_HOUR; + field public static final java.lang.CharSequence DEFAULT_FORMAT_24_HOUR; + } + + public class TextSwitcher extends android.widget.ViewSwitcher { + ctor public TextSwitcher(android.content.Context); + ctor public TextSwitcher(android.content.Context, android.util.AttributeSet); + method public void setCurrentText(java.lang.CharSequence); + method public void setText(java.lang.CharSequence); + } + + public class TextView extends android.view.View implements android.view.ViewTreeObserver.OnPreDrawListener { + ctor public TextView(android.content.Context); + ctor public TextView(android.content.Context, android.util.AttributeSet); + ctor public TextView(android.content.Context, android.util.AttributeSet, int); + method public void addTextChangedListener(android.text.TextWatcher); + method public final void append(java.lang.CharSequence); + method public void append(java.lang.CharSequence, int, int); + method public void beginBatchEdit(); + method public boolean bringPointIntoView(int); + method public void clearComposingText(); + method public void debug(int); + method public boolean didTouchFocusSelect(); + method public void endBatchEdit(); + method public boolean extractText(android.view.inputmethod.ExtractedTextRequest, android.view.inputmethod.ExtractedText); + method public final int getAutoLinkMask(); + method public int getCompoundDrawablePadding(); + method public android.graphics.drawable.Drawable[] getCompoundDrawables(); + method public android.graphics.drawable.Drawable[] getCompoundDrawablesRelative(); + method public int getCompoundPaddingBottom(); + method public int getCompoundPaddingEnd(); + method public int getCompoundPaddingLeft(); + method public int getCompoundPaddingRight(); + method public int getCompoundPaddingStart(); + method public int getCompoundPaddingTop(); + method public final int getCurrentHintTextColor(); + method public final int getCurrentTextColor(); + method public android.view.ActionMode.Callback getCustomSelectionActionModeCallback(); + method protected boolean getDefaultEditable(); + method protected android.text.method.MovementMethod getDefaultMovementMethod(); + method public android.text.Editable getEditableText(); + method public android.text.TextUtils.TruncateAt getEllipsize(); + method public java.lang.CharSequence getError(); + method public int getExtendedPaddingBottom(); + method public int getExtendedPaddingTop(); + method public android.text.InputFilter[] getFilters(); + method public boolean getFreezesText(); + method public int getGravity(); + method public int getHighlightColor(); + method public java.lang.CharSequence getHint(); + method public final android.content.res.ColorStateList getHintTextColors(); + method public int getImeActionId(); + method public java.lang.CharSequence getImeActionLabel(); + method public int getImeOptions(); + method public boolean getIncludeFontPadding(); + method public android.os.Bundle getInputExtras(boolean); + method public int getInputType(); + method public final android.text.method.KeyListener getKeyListener(); + method public final android.text.Layout getLayout(); + method public int getLineBounds(int, android.graphics.Rect); + method public int getLineCount(); + method public int getLineHeight(); + method public float getLineSpacingExtra(); + method public float getLineSpacingMultiplier(); + method public final android.content.res.ColorStateList getLinkTextColors(); + method public final boolean getLinksClickable(); + method public int getMarqueeRepeatLimit(); + method public int getMaxEms(); + method public int getMaxHeight(); + method public int getMaxLines(); + method public int getMaxWidth(); + method public int getMinEms(); + method public int getMinHeight(); + method public int getMinLines(); + method public int getMinWidth(); + method public final android.text.method.MovementMethod getMovementMethod(); + method public int getOffsetForPosition(float, float); + method public android.text.TextPaint getPaint(); + method public int getPaintFlags(); + method public java.lang.String getPrivateImeOptions(); + method public int getSelectionEnd(); + method public int getSelectionStart(); + method public int getShadowColor(); + method public float getShadowDx(); + method public float getShadowDy(); + method public float getShadowRadius(); + method public java.lang.CharSequence getText(); + method public static int getTextColor(android.content.Context, android.content.res.TypedArray, int); + method public final android.content.res.ColorStateList getTextColors(); + method public static android.content.res.ColorStateList getTextColors(android.content.Context, android.content.res.TypedArray); + method public java.util.Locale getTextLocale(); + method public float getTextScaleX(); + method public float getTextSize(); + method public int getTotalPaddingBottom(); + method public int getTotalPaddingEnd(); + method public int getTotalPaddingLeft(); + method public int getTotalPaddingRight(); + method public int getTotalPaddingStart(); + method public int getTotalPaddingTop(); + method public final android.text.method.TransformationMethod getTransformationMethod(); + method public android.graphics.Typeface getTypeface(); + method public android.text.style.URLSpan[] getUrls(); + method public boolean hasSelection(); + method public boolean isCursorVisible(); + method public boolean isInputMethodTarget(); + method public boolean isSuggestionsEnabled(); + method public boolean isTextSelectable(); + method public int length(); + method public boolean moveCursorToVisibleOffset(); + method public void onBeginBatchEdit(); + method public void onCommitCompletion(android.view.inputmethod.CompletionInfo); + method public void onCommitCorrection(android.view.inputmethod.CorrectionInfo); + method public void onEditorAction(int); + method public void onEndBatchEdit(); + method public boolean onPreDraw(); + method public boolean onPrivateIMECommand(java.lang.String, android.os.Bundle); + method public void onRestoreInstanceState(android.os.Parcelable); + method public android.os.Parcelable onSaveInstanceState(); + method protected void onSelectionChanged(int, int); + method protected void onTextChanged(java.lang.CharSequence, int, int, int); + method public boolean onTextContextMenuItem(int); + method public void removeTextChangedListener(android.text.TextWatcher); + method public void setAllCaps(boolean); + method public final void setAutoLinkMask(int); + method public void setCompoundDrawablePadding(int); + method public void setCompoundDrawables(android.graphics.drawable.Drawable, android.graphics.drawable.Drawable, android.graphics.drawable.Drawable, android.graphics.drawable.Drawable); + method public void setCompoundDrawablesRelative(android.graphics.drawable.Drawable, android.graphics.drawable.Drawable, android.graphics.drawable.Drawable, android.graphics.drawable.Drawable); + method public void setCompoundDrawablesRelativeWithIntrinsicBounds(int, int, int, int); + method public void setCompoundDrawablesRelativeWithIntrinsicBounds(android.graphics.drawable.Drawable, android.graphics.drawable.Drawable, android.graphics.drawable.Drawable, android.graphics.drawable.Drawable); + method public void setCompoundDrawablesWithIntrinsicBounds(int, int, int, int); + method public void setCompoundDrawablesWithIntrinsicBounds(android.graphics.drawable.Drawable, android.graphics.drawable.Drawable, android.graphics.drawable.Drawable, android.graphics.drawable.Drawable); + method public void setCursorVisible(boolean); + method public void setCustomSelectionActionModeCallback(android.view.ActionMode.Callback); + method public final void setEditableFactory(android.text.Editable.Factory); + method public void setEllipsize(android.text.TextUtils.TruncateAt); + method public void setEms(int); + method public void setError(java.lang.CharSequence); + method public void setError(java.lang.CharSequence, android.graphics.drawable.Drawable); + method public void setExtractedText(android.view.inputmethod.ExtractedText); + method public void setFilters(android.text.InputFilter[]); + method protected boolean setFrame(int, int, int, int); + method public void setFreezesText(boolean); + method public void setGravity(int); + method public void setHeight(int); + method public void setHighlightColor(int); + method public final void setHint(java.lang.CharSequence); + method public final void setHint(int); + method public final void setHintTextColor(int); + method public final void setHintTextColor(android.content.res.ColorStateList); + method public void setHorizontallyScrolling(boolean); + method public void setImeActionLabel(java.lang.CharSequence, int); + method public void setImeOptions(int); + method public void setIncludeFontPadding(boolean); + method public void setInputExtras(int) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException; + method public void setInputType(int); + method public void setKeyListener(android.text.method.KeyListener); + method public void setLineSpacing(float, float); + method public void setLines(int); + method public final void setLinkTextColor(int); + method public final void setLinkTextColor(android.content.res.ColorStateList); + method public final void setLinksClickable(boolean); + method public void setMarqueeRepeatLimit(int); + method public void setMaxEms(int); + method public void setMaxHeight(int); + method public void setMaxLines(int); + method public void setMaxWidth(int); + method public void setMinEms(int); + method public void setMinHeight(int); + method public void setMinLines(int); + method public void setMinWidth(int); + method public final void setMovementMethod(android.text.method.MovementMethod); + method public void setOnEditorActionListener(android.widget.TextView.OnEditorActionListener); + method public void setPaintFlags(int); + method public void setPrivateImeOptions(java.lang.String); + method public void setRawInputType(int); + method public void setScroller(android.widget.Scroller); + method public void setSelectAllOnFocus(boolean); + method public void setShadowLayer(float, float, float, int); + method public void setSingleLine(); + method public void setSingleLine(boolean); + method public final void setSpannableFactory(android.text.Spannable.Factory); + method public final void setText(java.lang.CharSequence); + method public void setText(java.lang.CharSequence, android.widget.TextView.BufferType); + method public final void setText(char[], int, int); + method public final void setText(int); + method public final void setText(int, android.widget.TextView.BufferType); + method public void setTextAppearance(android.content.Context, int); + method public void setTextColor(int); + method public void setTextColor(android.content.res.ColorStateList); + method public void setTextIsSelectable(boolean); + method public final void setTextKeepState(java.lang.CharSequence); + method public final void setTextKeepState(java.lang.CharSequence, android.widget.TextView.BufferType); + method public void setTextLocale(java.util.Locale); + method public void setTextScaleX(float); + method public void setTextSize(float); + method public void setTextSize(int, float); + method public final void setTransformationMethod(android.text.method.TransformationMethod); + method public void setTypeface(android.graphics.Typeface, int); + method public void setTypeface(android.graphics.Typeface); + method public void setWidth(int); + } + + public static final class TextView.BufferType extends java.lang.Enum { + method public static android.widget.TextView.BufferType valueOf(java.lang.String); + method public static final android.widget.TextView.BufferType[] values(); + enum_constant public static final android.widget.TextView.BufferType EDITABLE; + enum_constant public static final android.widget.TextView.BufferType NORMAL; + enum_constant public static final android.widget.TextView.BufferType SPANNABLE; + } + + public static abstract interface TextView.OnEditorActionListener { + method public abstract boolean onEditorAction(android.widget.TextView, int, android.view.KeyEvent); + } + + public static class TextView.SavedState extends android.view.View.BaseSavedState { + field public static final android.os.Parcelable.Creator CREATOR; + } + + public class TimePicker extends android.widget.FrameLayout { + ctor public TimePicker(android.content.Context); + ctor public TimePicker(android.content.Context, android.util.AttributeSet); + ctor public TimePicker(android.content.Context, android.util.AttributeSet, int); + method public java.lang.Integer getCurrentHour(); + method public java.lang.Integer getCurrentMinute(); + method public boolean is24HourView(); + method public void setCurrentHour(java.lang.Integer); + method public void setCurrentMinute(java.lang.Integer); + method public void setIs24HourView(java.lang.Boolean); + method public void setOnTimeChangedListener(android.widget.TimePicker.OnTimeChangedListener); + } + + public static abstract interface TimePicker.OnTimeChangedListener { + method public abstract void onTimeChanged(android.widget.TimePicker, int, int); + } + + public class Toast { + ctor public Toast(android.content.Context); + method public void cancel(); + method public int getDuration(); + method public int getGravity(); + method public float getHorizontalMargin(); + method public float getVerticalMargin(); + method public android.view.View getView(); + method public int getXOffset(); + method public int getYOffset(); + method public static android.widget.Toast makeText(android.content.Context, java.lang.CharSequence, int); + method public static android.widget.Toast makeText(android.content.Context, int, int) throws android.content.res.Resources.NotFoundException; + method public void setDuration(int); + method public void setGravity(int, int, int); + method public void setMargin(float, float); + method public void setText(int); + method public void setText(java.lang.CharSequence); + method public void setView(android.view.View); + method public void show(); + field public static final int LENGTH_LONG = 1; // 0x1 + field public static final int LENGTH_SHORT = 0; // 0x0 + } + + public class ToggleButton extends android.widget.CompoundButton { + ctor public ToggleButton(android.content.Context, android.util.AttributeSet, int); + ctor public ToggleButton(android.content.Context, android.util.AttributeSet); + ctor public ToggleButton(android.content.Context); + method public java.lang.CharSequence getTextOff(); + method public java.lang.CharSequence getTextOn(); + method public void setTextOff(java.lang.CharSequence); + method public void setTextOn(java.lang.CharSequence); + } + + public deprecated class TwoLineListItem extends android.widget.RelativeLayout { + ctor public TwoLineListItem(android.content.Context); + ctor public TwoLineListItem(android.content.Context, android.util.AttributeSet); + ctor public TwoLineListItem(android.content.Context, android.util.AttributeSet, int); + method public android.widget.TextView getText1(); + method public android.widget.TextView getText2(); + } + + public class VideoView extends android.view.SurfaceView implements android.widget.MediaController.MediaPlayerControl { + ctor public VideoView(android.content.Context); + ctor public VideoView(android.content.Context, android.util.AttributeSet); + ctor public VideoView(android.content.Context, android.util.AttributeSet, int); + method public boolean canPause(); + method public boolean canSeekBackward(); + method public boolean canSeekForward(); + method public int getBufferPercentage(); + method public int getCurrentPosition(); + method public int getDuration(); + method public boolean isPlaying(); + method public void pause(); + method public int resolveAdjustedSize(int, int); + method public void resume(); + method public void seekTo(int); + method public void setMediaController(android.widget.MediaController); + method public void setOnCompletionListener(android.media.MediaPlayer.OnCompletionListener); + method public void setOnErrorListener(android.media.MediaPlayer.OnErrorListener); + method public void setOnInfoListener(android.media.MediaPlayer.OnInfoListener); + method public void setOnPreparedListener(android.media.MediaPlayer.OnPreparedListener); + method public void setVideoPath(java.lang.String); + method public void setVideoURI(android.net.Uri); + method public void start(); + method public void stopPlayback(); + method public void suspend(); + } + + public class ViewAnimator extends android.widget.FrameLayout { + ctor public ViewAnimator(android.content.Context); + ctor public ViewAnimator(android.content.Context, android.util.AttributeSet); + method public boolean getAnimateFirstView(); + method public android.view.View getCurrentView(); + method public int getDisplayedChild(); + method public android.view.animation.Animation getInAnimation(); + method public android.view.animation.Animation getOutAnimation(); + method public void setAnimateFirstView(boolean); + method public void setDisplayedChild(int); + method public void setInAnimation(android.view.animation.Animation); + method public void setInAnimation(android.content.Context, int); + method public void setOutAnimation(android.view.animation.Animation); + method public void setOutAnimation(android.content.Context, int); + method public void showNext(); + method public void showPrevious(); + } + + public class ViewFlipper extends android.widget.ViewAnimator { + ctor public ViewFlipper(android.content.Context); + ctor public ViewFlipper(android.content.Context, android.util.AttributeSet); + method public boolean isAutoStart(); + method public boolean isFlipping(); + method public void setAutoStart(boolean); + method public void setFlipInterval(int); + method public void startFlipping(); + method public void stopFlipping(); + } + + public class ViewSwitcher extends android.widget.ViewAnimator { + ctor public ViewSwitcher(android.content.Context); + ctor public ViewSwitcher(android.content.Context, android.util.AttributeSet); + method public android.view.View getNextView(); + method public void reset(); + method public void setFactory(android.widget.ViewSwitcher.ViewFactory); + } + + public static abstract interface ViewSwitcher.ViewFactory { + method public abstract android.view.View makeView(); + } + + public abstract interface WrapperListAdapter implements android.widget.ListAdapter { + method public abstract android.widget.ListAdapter getWrappedAdapter(); + } + + public class ZoomButton extends android.widget.ImageButton implements android.view.View.OnLongClickListener { + ctor public ZoomButton(android.content.Context); + ctor public ZoomButton(android.content.Context, android.util.AttributeSet); + ctor public ZoomButton(android.content.Context, android.util.AttributeSet, int); + method public boolean onLongClick(android.view.View); + method public void setZoomSpeed(long); + } + + public class ZoomButtonsController implements android.view.View.OnTouchListener { + ctor public ZoomButtonsController(android.view.View); + method public android.view.ViewGroup getContainer(); + method public android.view.View getZoomControls(); + method public boolean isAutoDismissed(); + method public boolean isVisible(); + method public boolean onTouch(android.view.View, android.view.MotionEvent); + method public void setAutoDismissed(boolean); + method public void setFocusable(boolean); + method public void setOnZoomListener(android.widget.ZoomButtonsController.OnZoomListener); + method public void setVisible(boolean); + method public void setZoomInEnabled(boolean); + method public void setZoomOutEnabled(boolean); + method public void setZoomSpeed(long); + } + + public static abstract interface ZoomButtonsController.OnZoomListener { + method public abstract void onVisibilityChanged(boolean); + method public abstract void onZoom(boolean); + } + + public class ZoomControls extends android.widget.LinearLayout { + ctor public ZoomControls(android.content.Context); + ctor public ZoomControls(android.content.Context, android.util.AttributeSet); + method public void hide(); + method public void setIsZoomInEnabled(boolean); + method public void setIsZoomOutEnabled(boolean); + method public void setOnZoomInClickListener(android.view.View.OnClickListener); + method public void setOnZoomOutClickListener(android.view.View.OnClickListener); + method public void setZoomSpeed(long); + method public void show(); + } + +} + +package com.android.internal.util { + + public abstract interface Predicate { + method public abstract boolean apply(T); + } + +} + +package dalvik.annotation { + + public abstract deprecated class TestTarget implements java.lang.annotation.Annotation { + } + + public abstract deprecated class TestTargetClass implements java.lang.annotation.Annotation { + } + +} + +package dalvik.bytecode { + + public final class OpcodeInfo { + field public static final int MAXIMUM_PACKED_VALUE; + field public static final int MAXIMUM_VALUE; + } + + public abstract interface Opcodes { + field public static final int OP_ADD_DOUBLE = 171; // 0xab + field public static final int OP_ADD_DOUBLE_2ADDR = 203; // 0xcb + field public static final int OP_ADD_FLOAT = 166; // 0xa6 + field public static final int OP_ADD_FLOAT_2ADDR = 198; // 0xc6 + field public static final int OP_ADD_INT = 144; // 0x90 + field public static final int OP_ADD_INT_2ADDR = 176; // 0xb0 + field public static final int OP_ADD_INT_LIT16 = 208; // 0xd0 + field public static final int OP_ADD_INT_LIT8 = 216; // 0xd8 + field public static final int OP_ADD_LONG = 155; // 0x9b + field public static final int OP_ADD_LONG_2ADDR = 187; // 0xbb + field public static final int OP_AGET = 68; // 0x44 + field public static final int OP_AGET_BOOLEAN = 71; // 0x47 + field public static final int OP_AGET_BYTE = 72; // 0x48 + field public static final int OP_AGET_CHAR = 73; // 0x49 + field public static final int OP_AGET_OBJECT = 70; // 0x46 + field public static final int OP_AGET_SHORT = 74; // 0x4a + field public static final int OP_AGET_WIDE = 69; // 0x45 + field public static final int OP_AND_INT = 149; // 0x95 + field public static final int OP_AND_INT_2ADDR = 181; // 0xb5 + field public static final int OP_AND_INT_LIT16 = 213; // 0xd5 + field public static final int OP_AND_INT_LIT8 = 221; // 0xdd + field public static final int OP_AND_LONG = 160; // 0xa0 + field public static final int OP_AND_LONG_2ADDR = 192; // 0xc0 + field public static final int OP_APUT = 75; // 0x4b + field public static final int OP_APUT_BOOLEAN = 78; // 0x4e + field public static final int OP_APUT_BYTE = 79; // 0x4f + field public static final int OP_APUT_CHAR = 80; // 0x50 + field public static final int OP_APUT_OBJECT = 77; // 0x4d + field public static final int OP_APUT_SHORT = 81; // 0x51 + field public static final int OP_APUT_WIDE = 76; // 0x4c + field public static final int OP_ARRAY_LENGTH = 33; // 0x21 + field public static final deprecated int OP_BREAKPOINT = 236; // 0xec + field public static final int OP_CHECK_CAST = 31; // 0x1f + field public static final int OP_CHECK_CAST_JUMBO = 511; // 0x1ff + field public static final int OP_CMPG_DOUBLE = 48; // 0x30 + field public static final int OP_CMPG_FLOAT = 46; // 0x2e + field public static final int OP_CMPL_DOUBLE = 47; // 0x2f + field public static final int OP_CMPL_FLOAT = 45; // 0x2d + field public static final int OP_CMP_LONG = 49; // 0x31 + field public static final int OP_CONST = 20; // 0x14 + field public static final int OP_CONST_16 = 19; // 0x13 + field public static final int OP_CONST_4 = 18; // 0x12 + field public static final int OP_CONST_CLASS = 28; // 0x1c + field public static final int OP_CONST_CLASS_JUMBO = 255; // 0xff + field public static final int OP_CONST_HIGH16 = 21; // 0x15 + field public static final int OP_CONST_STRING = 26; // 0x1a + field public static final int OP_CONST_STRING_JUMBO = 27; // 0x1b + field public static final int OP_CONST_WIDE = 24; // 0x18 + field public static final int OP_CONST_WIDE_16 = 22; // 0x16 + field public static final int OP_CONST_WIDE_32 = 23; // 0x17 + field public static final int OP_CONST_WIDE_HIGH16 = 25; // 0x19 + field public static final int OP_DIV_DOUBLE = 174; // 0xae + field public static final int OP_DIV_DOUBLE_2ADDR = 206; // 0xce + field public static final int OP_DIV_FLOAT = 169; // 0xa9 + field public static final int OP_DIV_FLOAT_2ADDR = 201; // 0xc9 + field public static final int OP_DIV_INT = 147; // 0x93 + field public static final int OP_DIV_INT_2ADDR = 179; // 0xb3 + field public static final int OP_DIV_INT_LIT16 = 211; // 0xd3 + field public static final int OP_DIV_INT_LIT8 = 219; // 0xdb + field public static final int OP_DIV_LONG = 158; // 0x9e + field public static final int OP_DIV_LONG_2ADDR = 190; // 0xbe + field public static final int OP_DOUBLE_TO_FLOAT = 140; // 0x8c + field public static final int OP_DOUBLE_TO_INT = 138; // 0x8a + field public static final int OP_DOUBLE_TO_LONG = 139; // 0x8b + field public static final deprecated int OP_EXECUTE_INLINE = 238; // 0xee + field public static final deprecated int OP_EXECUTE_INLINE_RANGE = 239; // 0xef + field public static final int OP_FILLED_NEW_ARRAY = 36; // 0x24 + field public static final int OP_FILLED_NEW_ARRAY_JUMBO = 1535; // 0x5ff + field public static final int OP_FILLED_NEW_ARRAY_RANGE = 37; // 0x25 + field public static final int OP_FILL_ARRAY_DATA = 38; // 0x26 + field public static final int OP_FLOAT_TO_DOUBLE = 137; // 0x89 + field public static final int OP_FLOAT_TO_INT = 135; // 0x87 + field public static final int OP_FLOAT_TO_LONG = 136; // 0x88 + field public static final int OP_GOTO = 40; // 0x28 + field public static final int OP_GOTO_16 = 41; // 0x29 + field public static final int OP_GOTO_32 = 42; // 0x2a + field public static final int OP_IF_EQ = 50; // 0x32 + field public static final int OP_IF_EQZ = 56; // 0x38 + field public static final int OP_IF_GE = 53; // 0x35 + field public static final int OP_IF_GEZ = 59; // 0x3b + field public static final int OP_IF_GT = 54; // 0x36 + field public static final int OP_IF_GTZ = 60; // 0x3c + field public static final int OP_IF_LE = 55; // 0x37 + field public static final int OP_IF_LEZ = 61; // 0x3d + field public static final int OP_IF_LT = 52; // 0x34 + field public static final int OP_IF_LTZ = 58; // 0x3a + field public static final int OP_IF_NE = 51; // 0x33 + field public static final int OP_IF_NEZ = 57; // 0x39 + field public static final int OP_IGET = 82; // 0x52 + field public static final int OP_IGET_BOOLEAN = 85; // 0x55 + field public static final int OP_IGET_BOOLEAN_JUMBO = 2559; // 0x9ff + field public static final int OP_IGET_BYTE = 86; // 0x56 + field public static final int OP_IGET_BYTE_JUMBO = 2815; // 0xaff + field public static final int OP_IGET_CHAR = 87; // 0x57 + field public static final int OP_IGET_CHAR_JUMBO = 3071; // 0xbff + field public static final int OP_IGET_JUMBO = 1791; // 0x6ff + field public static final int OP_IGET_OBJECT = 84; // 0x54 + field public static final int OP_IGET_OBJECT_JUMBO = 2303; // 0x8ff + field public static final deprecated int OP_IGET_OBJECT_QUICK = 244; // 0xf4 + field public static final deprecated int OP_IGET_QUICK = 242; // 0xf2 + field public static final int OP_IGET_SHORT = 88; // 0x58 + field public static final int OP_IGET_SHORT_JUMBO = 3327; // 0xcff + field public static final int OP_IGET_WIDE = 83; // 0x53 + field public static final int OP_IGET_WIDE_JUMBO = 2047; // 0x7ff + field public static final deprecated int OP_IGET_WIDE_QUICK = 243; // 0xf3 + field public static final deprecated int OP_IGET_WIDE_VOLATILE = 232; // 0xe8 + field public static final int OP_INSTANCE_OF = 32; // 0x20 + field public static final int OP_INSTANCE_OF_JUMBO = 767; // 0x2ff + field public static final int OP_INT_TO_BYTE = 141; // 0x8d + field public static final int OP_INT_TO_CHAR = 142; // 0x8e + field public static final int OP_INT_TO_DOUBLE = 131; // 0x83 + field public static final int OP_INT_TO_FLOAT = 130; // 0x82 + field public static final int OP_INT_TO_LONG = 129; // 0x81 + field public static final int OP_INT_TO_SHORT = 143; // 0x8f + field public static final int OP_INVOKE_DIRECT = 112; // 0x70 + field public static final deprecated int OP_INVOKE_DIRECT_EMPTY = 240; // 0xf0 + field public static final int OP_INVOKE_DIRECT_JUMBO = 9471; // 0x24ff + field public static final int OP_INVOKE_DIRECT_RANGE = 118; // 0x76 + field public static final int OP_INVOKE_INTERFACE = 114; // 0x72 + field public static final int OP_INVOKE_INTERFACE_JUMBO = 9983; // 0x26ff + field public static final int OP_INVOKE_INTERFACE_RANGE = 120; // 0x78 + field public static final int OP_INVOKE_STATIC = 113; // 0x71 + field public static final int OP_INVOKE_STATIC_JUMBO = 9727; // 0x25ff + field public static final int OP_INVOKE_STATIC_RANGE = 119; // 0x77 + field public static final int OP_INVOKE_SUPER = 111; // 0x6f + field public static final int OP_INVOKE_SUPER_JUMBO = 9215; // 0x23ff + field public static final deprecated int OP_INVOKE_SUPER_QUICK = 250; // 0xfa + field public static final deprecated int OP_INVOKE_SUPER_QUICK_RANGE = 251; // 0xfb + field public static final int OP_INVOKE_SUPER_RANGE = 117; // 0x75 + field public static final int OP_INVOKE_VIRTUAL = 110; // 0x6e + field public static final int OP_INVOKE_VIRTUAL_JUMBO = 8959; // 0x22ff + field public static final deprecated int OP_INVOKE_VIRTUAL_QUICK = 248; // 0xf8 + field public static final deprecated int OP_INVOKE_VIRTUAL_QUICK_RANGE = 249; // 0xf9 + field public static final int OP_INVOKE_VIRTUAL_RANGE = 116; // 0x74 + field public static final int OP_IPUT = 89; // 0x59 + field public static final int OP_IPUT_BOOLEAN = 92; // 0x5c + field public static final int OP_IPUT_BOOLEAN_JUMBO = 4351; // 0x10ff + field public static final int OP_IPUT_BYTE = 93; // 0x5d + field public static final int OP_IPUT_BYTE_JUMBO = 4607; // 0x11ff + field public static final int OP_IPUT_CHAR = 94; // 0x5e + field public static final int OP_IPUT_CHAR_JUMBO = 4863; // 0x12ff + field public static final int OP_IPUT_JUMBO = 3583; // 0xdff + field public static final int OP_IPUT_OBJECT = 91; // 0x5b + field public static final int OP_IPUT_OBJECT_JUMBO = 4095; // 0xfff + field public static final deprecated int OP_IPUT_OBJECT_QUICK = 247; // 0xf7 + field public static final deprecated int OP_IPUT_QUICK = 245; // 0xf5 + field public static final int OP_IPUT_SHORT = 95; // 0x5f + field public static final int OP_IPUT_SHORT_JUMBO = 5119; // 0x13ff + field public static final int OP_IPUT_WIDE = 90; // 0x5a + field public static final int OP_IPUT_WIDE_JUMBO = 3839; // 0xeff + field public static final deprecated int OP_IPUT_WIDE_QUICK = 246; // 0xf6 + field public static final deprecated int OP_IPUT_WIDE_VOLATILE = 233; // 0xe9 + field public static final int OP_LONG_TO_DOUBLE = 134; // 0x86 + field public static final int OP_LONG_TO_FLOAT = 133; // 0x85 + field public static final int OP_LONG_TO_INT = 132; // 0x84 + field public static final int OP_MONITOR_ENTER = 29; // 0x1d + field public static final int OP_MONITOR_EXIT = 30; // 0x1e + field public static final int OP_MOVE = 1; // 0x1 + field public static final int OP_MOVE_16 = 3; // 0x3 + field public static final int OP_MOVE_EXCEPTION = 13; // 0xd + field public static final int OP_MOVE_FROM16 = 2; // 0x2 + field public static final int OP_MOVE_OBJECT = 7; // 0x7 + field public static final int OP_MOVE_OBJECT_16 = 9; // 0x9 + field public static final int OP_MOVE_OBJECT_FROM16 = 8; // 0x8 + field public static final int OP_MOVE_RESULT = 10; // 0xa + field public static final int OP_MOVE_RESULT_OBJECT = 12; // 0xc + field public static final int OP_MOVE_RESULT_WIDE = 11; // 0xb + field public static final int OP_MOVE_WIDE = 4; // 0x4 + field public static final int OP_MOVE_WIDE_16 = 6; // 0x6 + field public static final int OP_MOVE_WIDE_FROM16 = 5; // 0x5 + field public static final int OP_MUL_DOUBLE = 173; // 0xad + field public static final int OP_MUL_DOUBLE_2ADDR = 205; // 0xcd + field public static final int OP_MUL_FLOAT = 168; // 0xa8 + field public static final int OP_MUL_FLOAT_2ADDR = 200; // 0xc8 + field public static final int OP_MUL_INT = 146; // 0x92 + field public static final int OP_MUL_INT_2ADDR = 178; // 0xb2 + field public static final int OP_MUL_INT_LIT16 = 210; // 0xd2 + field public static final int OP_MUL_INT_LIT8 = 218; // 0xda + field public static final int OP_MUL_LONG = 157; // 0x9d + field public static final int OP_MUL_LONG_2ADDR = 189; // 0xbd + field public static final int OP_NEG_DOUBLE = 128; // 0x80 + field public static final int OP_NEG_FLOAT = 127; // 0x7f + field public static final int OP_NEG_INT = 123; // 0x7b + field public static final int OP_NEG_LONG = 125; // 0x7d + field public static final int OP_NEW_ARRAY = 35; // 0x23 + field public static final int OP_NEW_ARRAY_JUMBO = 1279; // 0x4ff + field public static final int OP_NEW_INSTANCE = 34; // 0x22 + field public static final int OP_NEW_INSTANCE_JUMBO = 1023; // 0x3ff + field public static final int OP_NOP = 0; // 0x0 + field public static final int OP_NOT_INT = 124; // 0x7c + field public static final int OP_NOT_LONG = 126; // 0x7e + field public static final int OP_OR_INT = 150; // 0x96 + field public static final int OP_OR_INT_2ADDR = 182; // 0xb6 + field public static final int OP_OR_INT_LIT16 = 214; // 0xd6 + field public static final int OP_OR_INT_LIT8 = 222; // 0xde + field public static final int OP_OR_LONG = 161; // 0xa1 + field public static final int OP_OR_LONG_2ADDR = 193; // 0xc1 + field public static final int OP_PACKED_SWITCH = 43; // 0x2b + field public static final int OP_REM_DOUBLE = 175; // 0xaf + field public static final int OP_REM_DOUBLE_2ADDR = 207; // 0xcf + field public static final int OP_REM_FLOAT = 170; // 0xaa + field public static final int OP_REM_FLOAT_2ADDR = 202; // 0xca + field public static final int OP_REM_INT = 148; // 0x94 + field public static final int OP_REM_INT_2ADDR = 180; // 0xb4 + field public static final int OP_REM_INT_LIT16 = 212; // 0xd4 + field public static final int OP_REM_INT_LIT8 = 220; // 0xdc + field public static final int OP_REM_LONG = 159; // 0x9f + field public static final int OP_REM_LONG_2ADDR = 191; // 0xbf + field public static final int OP_RETURN = 15; // 0xf + field public static final int OP_RETURN_OBJECT = 17; // 0x11 + field public static final int OP_RETURN_VOID = 14; // 0xe + field public static final int OP_RETURN_WIDE = 16; // 0x10 + field public static final int OP_RSUB_INT = 209; // 0xd1 + field public static final int OP_RSUB_INT_LIT8 = 217; // 0xd9 + field public static final int OP_SGET = 96; // 0x60 + field public static final int OP_SGET_BOOLEAN = 99; // 0x63 + field public static final int OP_SGET_BOOLEAN_JUMBO = 6143; // 0x17ff + field public static final int OP_SGET_BYTE = 100; // 0x64 + field public static final int OP_SGET_BYTE_JUMBO = 6399; // 0x18ff + field public static final int OP_SGET_CHAR = 101; // 0x65 + field public static final int OP_SGET_CHAR_JUMBO = 6655; // 0x19ff + field public static final int OP_SGET_JUMBO = 5375; // 0x14ff + field public static final int OP_SGET_OBJECT = 98; // 0x62 + field public static final int OP_SGET_OBJECT_JUMBO = 5887; // 0x16ff + field public static final int OP_SGET_SHORT = 102; // 0x66 + field public static final int OP_SGET_SHORT_JUMBO = 6911; // 0x1aff + field public static final int OP_SGET_WIDE = 97; // 0x61 + field public static final int OP_SGET_WIDE_JUMBO = 5631; // 0x15ff + field public static final deprecated int OP_SGET_WIDE_VOLATILE = 234; // 0xea + field public static final int OP_SHL_INT = 152; // 0x98 + field public static final int OP_SHL_INT_2ADDR = 184; // 0xb8 + field public static final int OP_SHL_INT_LIT8 = 224; // 0xe0 + field public static final int OP_SHL_LONG = 163; // 0xa3 + field public static final int OP_SHL_LONG_2ADDR = 195; // 0xc3 + field public static final int OP_SHR_INT = 153; // 0x99 + field public static final int OP_SHR_INT_2ADDR = 185; // 0xb9 + field public static final int OP_SHR_INT_LIT8 = 225; // 0xe1 + field public static final int OP_SHR_LONG = 164; // 0xa4 + field public static final int OP_SHR_LONG_2ADDR = 196; // 0xc4 + field public static final int OP_SPARSE_SWITCH = 44; // 0x2c + field public static final int OP_SPUT = 103; // 0x67 + field public static final int OP_SPUT_BOOLEAN = 106; // 0x6a + field public static final int OP_SPUT_BOOLEAN_JUMBO = 7935; // 0x1eff + field public static final int OP_SPUT_BYTE = 107; // 0x6b + field public static final int OP_SPUT_BYTE_JUMBO = 8191; // 0x1fff + field public static final int OP_SPUT_CHAR = 108; // 0x6c + field public static final int OP_SPUT_CHAR_JUMBO = 8447; // 0x20ff + field public static final int OP_SPUT_JUMBO = 7167; // 0x1bff + field public static final int OP_SPUT_OBJECT = 105; // 0x69 + field public static final int OP_SPUT_OBJECT_JUMBO = 7679; // 0x1dff + field public static final int OP_SPUT_SHORT = 109; // 0x6d + field public static final int OP_SPUT_SHORT_JUMBO = 8703; // 0x21ff + field public static final int OP_SPUT_WIDE = 104; // 0x68 + field public static final int OP_SPUT_WIDE_JUMBO = 7423; // 0x1cff + field public static final deprecated int OP_SPUT_WIDE_VOLATILE = 235; // 0xeb + field public static final int OP_SUB_DOUBLE = 172; // 0xac + field public static final int OP_SUB_DOUBLE_2ADDR = 204; // 0xcc + field public static final int OP_SUB_FLOAT = 167; // 0xa7 + field public static final int OP_SUB_FLOAT_2ADDR = 199; // 0xc7 + field public static final int OP_SUB_INT = 145; // 0x91 + field public static final int OP_SUB_INT_2ADDR = 177; // 0xb1 + field public static final int OP_SUB_LONG = 156; // 0x9c + field public static final int OP_SUB_LONG_2ADDR = 188; // 0xbc + field public static final int OP_THROW = 39; // 0x27 + field public static final deprecated int OP_THROW_VERIFICATION_ERROR = 237; // 0xed + field public static final int OP_USHR_INT = 154; // 0x9a + field public static final int OP_USHR_INT_2ADDR = 186; // 0xba + field public static final int OP_USHR_INT_LIT8 = 226; // 0xe2 + field public static final int OP_USHR_LONG = 165; // 0xa5 + field public static final int OP_USHR_LONG_2ADDR = 197; // 0xc5 + field public static final int OP_XOR_INT = 151; // 0x97 + field public static final int OP_XOR_INT_2ADDR = 183; // 0xb7 + field public static final int OP_XOR_INT_LIT16 = 215; // 0xd7 + field public static final int OP_XOR_INT_LIT8 = 223; // 0xdf + field public static final int OP_XOR_LONG = 162; // 0xa2 + field public static final int OP_XOR_LONG_2ADDR = 194; // 0xc2 + } + +} + +package dalvik.system { + + public class BaseDexClassLoader extends java.lang.ClassLoader { + ctor public BaseDexClassLoader(java.lang.String, java.io.File, java.lang.String, java.lang.ClassLoader); + method public java.lang.String findLibrary(java.lang.String); + } + + public class DexClassLoader extends dalvik.system.BaseDexClassLoader { + ctor public DexClassLoader(java.lang.String, java.lang.String, java.lang.String, java.lang.ClassLoader); + } + + public final class DexFile { + ctor public DexFile(java.io.File) throws java.io.IOException; + ctor public DexFile(java.lang.String) throws java.io.IOException; + method public void close() throws java.io.IOException; + method public java.util.Enumeration entries(); + method public java.lang.String getName(); + method public static boolean isDexOptNeeded(java.lang.String) throws java.io.FileNotFoundException, java.io.IOException; + method public java.lang.Class loadClass(java.lang.String, java.lang.ClassLoader); + method public static dalvik.system.DexFile loadDex(java.lang.String, java.lang.String, int) throws java.io.IOException; + } + + public class PathClassLoader extends dalvik.system.BaseDexClassLoader { + ctor public PathClassLoader(java.lang.String, java.lang.ClassLoader); + ctor public PathClassLoader(java.lang.String, java.lang.String, java.lang.ClassLoader); + } + +} + +package java.awt.font { + + public final class NumericShaper implements java.io.Serializable { + method public static java.awt.font.NumericShaper getContextualShaper(int, int); + method public static java.awt.font.NumericShaper getContextualShaper(int); + method public int getRanges(); + method public static java.awt.font.NumericShaper getShaper(int); + method public boolean isContextual(); + method public void shape(char[], int, int, int); + method public void shape(char[], int, int); + field public static final int ALL_RANGES = 524287; // 0x7ffff + field public static final int ARABIC = 2; // 0x2 + field public static final int BENGALI = 16; // 0x10 + field public static final int DEVANAGARI = 8; // 0x8 + field public static final int EASTERN_ARABIC = 4; // 0x4 + field public static final int ETHIOPIC = 65536; // 0x10000 + field public static final int EUROPEAN = 1; // 0x1 + field public static final int GUJARATI = 64; // 0x40 + field public static final int GURMUKHI = 32; // 0x20 + field public static final int KANNADA = 1024; // 0x400 + field public static final int KHMER = 131072; // 0x20000 + field public static final int LAO = 8192; // 0x2000 + field public static final int MALAYALAM = 2048; // 0x800 + field public static final int MONGOLIAN = 262144; // 0x40000 + field public static final int MYANMAR = 32768; // 0x8000 + field public static final int ORIYA = 128; // 0x80 + field public static final int TAMIL = 256; // 0x100 + field public static final int TELUGU = 512; // 0x200 + field public static final int THAI = 4096; // 0x1000 + field public static final int TIBETAN = 16384; // 0x4000 + } + + public final class TextAttribute extends java.text.AttributedCharacterIterator.Attribute { + ctor protected TextAttribute(java.lang.String); + field public static final java.awt.font.TextAttribute BACKGROUND; + field public static final java.awt.font.TextAttribute BIDI_EMBEDDING; + field public static final java.awt.font.TextAttribute CHAR_REPLACEMENT; + field public static final java.awt.font.TextAttribute FAMILY; + field public static final java.awt.font.TextAttribute FONT; + field public static final java.awt.font.TextAttribute FOREGROUND; + field public static final java.awt.font.TextAttribute INPUT_METHOD_HIGHLIGHT; + field public static final java.awt.font.TextAttribute INPUT_METHOD_UNDERLINE; + field public static final java.awt.font.TextAttribute JUSTIFICATION; + field public static final java.lang.Float JUSTIFICATION_FULL; + field public static final java.lang.Float JUSTIFICATION_NONE; + field public static final java.awt.font.TextAttribute KERNING; + field public static final java.lang.Integer KERNING_ON; + field public static final java.awt.font.TextAttribute LIGATURES; + field public static final java.lang.Integer LIGATURES_ON; + field public static final java.awt.font.TextAttribute NUMERIC_SHAPING; + field public static final java.awt.font.TextAttribute POSTURE; + field public static final java.lang.Float POSTURE_OBLIQUE; + field public static final java.lang.Float POSTURE_REGULAR; + field public static final java.awt.font.TextAttribute RUN_DIRECTION; + field public static final java.lang.Boolean RUN_DIRECTION_LTR; + field public static final java.lang.Boolean RUN_DIRECTION_RTL; + field public static final java.awt.font.TextAttribute SIZE; + field public static final java.awt.font.TextAttribute STRIKETHROUGH; + field public static final java.lang.Boolean STRIKETHROUGH_ON; + field public static final java.awt.font.TextAttribute SUPERSCRIPT; + field public static final java.lang.Integer SUPERSCRIPT_SUB; + field public static final java.lang.Integer SUPERSCRIPT_SUPER; + field public static final java.awt.font.TextAttribute SWAP_COLORS; + field public static final java.lang.Boolean SWAP_COLORS_ON; + field public static final java.awt.font.TextAttribute TRACKING; + field public static final java.lang.Float TRACKING_LOOSE; + field public static final java.lang.Float TRACKING_TIGHT; + field public static final java.awt.font.TextAttribute TRANSFORM; + field public static final java.awt.font.TextAttribute UNDERLINE; + field public static final java.lang.Integer UNDERLINE_LOW_DASHED; + field public static final java.lang.Integer UNDERLINE_LOW_DOTTED; + field public static final java.lang.Integer UNDERLINE_LOW_GRAY; + field public static final java.lang.Integer UNDERLINE_LOW_ONE_PIXEL; + field public static final java.lang.Integer UNDERLINE_LOW_TWO_PIXEL; + field public static final java.lang.Integer UNDERLINE_ON; + field public static final java.awt.font.TextAttribute WEIGHT; + field public static final java.lang.Float WEIGHT_BOLD; + field public static final java.lang.Float WEIGHT_DEMIBOLD; + field public static final java.lang.Float WEIGHT_DEMILIGHT; + field public static final java.lang.Float WEIGHT_EXTRABOLD; + field public static final java.lang.Float WEIGHT_EXTRA_LIGHT; + field public static final java.lang.Float WEIGHT_HEAVY; + field public static final java.lang.Float WEIGHT_LIGHT; + field public static final java.lang.Float WEIGHT_MEDIUM; + field public static final java.lang.Float WEIGHT_REGULAR; + field public static final java.lang.Float WEIGHT_SEMIBOLD; + field public static final java.lang.Float WEIGHT_ULTRABOLD; + field public static final java.awt.font.TextAttribute WIDTH; + field public static final java.lang.Float WIDTH_CONDENSED; + field public static final java.lang.Float WIDTH_EXTENDED; + field public static final java.lang.Float WIDTH_REGULAR; + field public static final java.lang.Float WIDTH_SEMI_CONDENSED; + field public static final java.lang.Float WIDTH_SEMI_EXTENDED; + } + +} + +package java.beans { + + public class IndexedPropertyChangeEvent extends java.beans.PropertyChangeEvent { + ctor public IndexedPropertyChangeEvent(java.lang.Object, java.lang.String, java.lang.Object, java.lang.Object, int); + method public int getIndex(); + } + + public class PropertyChangeEvent extends java.util.EventObject { + ctor public PropertyChangeEvent(java.lang.Object, java.lang.String, java.lang.Object, java.lang.Object); + method public java.lang.Object getNewValue(); + method public java.lang.Object getOldValue(); + method public java.lang.Object getPropagationId(); + method public java.lang.String getPropertyName(); + method public void setPropagationId(java.lang.Object); + } + + public abstract interface PropertyChangeListener implements java.util.EventListener { + method public abstract void propertyChange(java.beans.PropertyChangeEvent); + } + + public class PropertyChangeListenerProxy extends java.util.EventListenerProxy implements java.beans.PropertyChangeListener { + ctor public PropertyChangeListenerProxy(java.lang.String, java.beans.PropertyChangeListener); + method public java.lang.String getPropertyName(); + method public void propertyChange(java.beans.PropertyChangeEvent); + } + + public class PropertyChangeSupport implements java.io.Serializable { + ctor public PropertyChangeSupport(java.lang.Object); + method public void addPropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener); + method public void addPropertyChangeListener(java.beans.PropertyChangeListener); + method public void fireIndexedPropertyChange(java.lang.String, int, java.lang.Object, java.lang.Object); + method public void fireIndexedPropertyChange(java.lang.String, int, boolean, boolean); + method public void fireIndexedPropertyChange(java.lang.String, int, int, int); + method public void firePropertyChange(java.lang.String, java.lang.Object, java.lang.Object); + method public void firePropertyChange(java.lang.String, boolean, boolean); + method public void firePropertyChange(java.lang.String, int, int); + method public void firePropertyChange(java.beans.PropertyChangeEvent); + method public java.beans.PropertyChangeListener[] getPropertyChangeListeners(java.lang.String); + method public java.beans.PropertyChangeListener[] getPropertyChangeListeners(); + method public boolean hasListeners(java.lang.String); + method public void removePropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener); + method public void removePropertyChangeListener(java.beans.PropertyChangeListener); + } + +} + +package java.io { + + public class BufferedInputStream extends java.io.FilterInputStream { + ctor public BufferedInputStream(java.io.InputStream); + ctor public BufferedInputStream(java.io.InputStream, int); + field protected volatile byte[] buf; + field protected int count; + field protected int marklimit; + field protected int markpos; + field protected int pos; + } + + public class BufferedOutputStream extends java.io.FilterOutputStream { + ctor public BufferedOutputStream(java.io.OutputStream); + ctor public BufferedOutputStream(java.io.OutputStream, int); + field protected byte[] buf; + field protected int count; + } + + public class BufferedReader extends java.io.Reader { + ctor public BufferedReader(java.io.Reader); + ctor public BufferedReader(java.io.Reader, int); + method public void close() throws java.io.IOException; + method public int read(char[], int, int) throws java.io.IOException; + method public java.lang.String readLine() throws java.io.IOException; + } + + public class BufferedWriter extends java.io.Writer { + ctor public BufferedWriter(java.io.Writer); + ctor public BufferedWriter(java.io.Writer, int); + method public void close() throws java.io.IOException; + method public void flush() throws java.io.IOException; + method public void newLine() throws java.io.IOException; + method public void write(char[], int, int) throws java.io.IOException; + } + + public class ByteArrayInputStream extends java.io.InputStream { + ctor public ByteArrayInputStream(byte[]); + ctor public ByteArrayInputStream(byte[], int, int); + method public synchronized int read(); + field protected byte[] buf; + field protected int count; + field protected int mark; + field protected int pos; + } + + public class ByteArrayOutputStream extends java.io.OutputStream { + ctor public ByteArrayOutputStream(); + ctor public ByteArrayOutputStream(int); + method public synchronized void reset(); + method public int size(); + method public synchronized byte[] toByteArray(); + method public deprecated java.lang.String toString(int); + method public java.lang.String toString(java.lang.String) throws java.io.UnsupportedEncodingException; + method public synchronized void write(int); + method public synchronized void writeTo(java.io.OutputStream) throws java.io.IOException; + field protected byte[] buf; + field protected int count; + } + + public class CharArrayReader extends java.io.Reader { + ctor public CharArrayReader(char[]); + ctor public CharArrayReader(char[], int, int); + method public void close(); + method public int read(char[], int, int) throws java.io.IOException; + field protected char[] buf; + field protected int count; + field protected int markedPos; + field protected int pos; + } + + public class CharArrayWriter extends java.io.Writer { + ctor public CharArrayWriter(); + ctor public CharArrayWriter(int); + method public void close(); + method public void flush(); + method public void reset(); + method public int size(); + method public char[] toCharArray(); + method public void write(char[], int, int); + method public void writeTo(java.io.Writer) throws java.io.IOException; + field protected char[] buf; + field protected int count; + } + + public class CharConversionException extends java.io.IOException { + ctor public CharConversionException(); + ctor public CharConversionException(java.lang.String); + } + + public abstract interface Closeable { + method public abstract void close() throws java.io.IOException; + } + + public final class Console implements java.io.Flushable { + method public void flush(); + method public java.io.Console format(java.lang.String, java.lang.Object...); + method public java.io.Console printf(java.lang.String, java.lang.Object...); + method public java.lang.String readLine(); + method public java.lang.String readLine(java.lang.String, java.lang.Object...); + method public char[] readPassword(); + method public char[] readPassword(java.lang.String, java.lang.Object...); + method public java.io.Reader reader(); + method public java.io.PrintWriter writer(); + } + + public abstract interface DataInput { + method public abstract boolean readBoolean() throws java.io.IOException; + method public abstract byte readByte() throws java.io.IOException; + method public abstract char readChar() throws java.io.IOException; + method public abstract double readDouble() throws java.io.IOException; + method public abstract float readFloat() throws java.io.IOException; + method public abstract void readFully(byte[]) throws java.io.IOException; + method public abstract void readFully(byte[], int, int) throws java.io.IOException; + method public abstract int readInt() throws java.io.IOException; + method public abstract java.lang.String readLine() throws java.io.IOException; + method public abstract long readLong() throws java.io.IOException; + method public abstract short readShort() throws java.io.IOException; + method public abstract java.lang.String readUTF() throws java.io.IOException; + method public abstract int readUnsignedByte() throws java.io.IOException; + method public abstract int readUnsignedShort() throws java.io.IOException; + method public abstract int skipBytes(int) throws java.io.IOException; + } + + public class DataInputStream extends java.io.FilterInputStream implements java.io.DataInput { + ctor public DataInputStream(java.io.InputStream); + method public final int read(byte[]) throws java.io.IOException; + method public final int read(byte[], int, int) throws java.io.IOException; + method public final boolean readBoolean() throws java.io.IOException; + method public final byte readByte() throws java.io.IOException; + method public final char readChar() throws java.io.IOException; + method public final double readDouble() throws java.io.IOException; + method public final float readFloat() throws java.io.IOException; + method public final void readFully(byte[]) throws java.io.IOException; + method public final void readFully(byte[], int, int) throws java.io.IOException; + method public final int readInt() throws java.io.IOException; + method public final deprecated java.lang.String readLine() throws java.io.IOException; + method public final long readLong() throws java.io.IOException; + method public final short readShort() throws java.io.IOException; + method public final java.lang.String readUTF() throws java.io.IOException; + method public static final java.lang.String readUTF(java.io.DataInput) throws java.io.IOException; + method public final int readUnsignedByte() throws java.io.IOException; + method public final int readUnsignedShort() throws java.io.IOException; + method public final int skipBytes(int) throws java.io.IOException; + } + + public abstract interface DataOutput { + method public abstract void write(byte[]) throws java.io.IOException; + method public abstract void write(byte[], int, int) throws java.io.IOException; + method public abstract void write(int) throws java.io.IOException; + method public abstract void writeBoolean(boolean) throws java.io.IOException; + method public abstract void writeByte(int) throws java.io.IOException; + method public abstract void writeBytes(java.lang.String) throws java.io.IOException; + method public abstract void writeChar(int) throws java.io.IOException; + method public abstract void writeChars(java.lang.String) throws java.io.IOException; + method public abstract void writeDouble(double) throws java.io.IOException; + method public abstract void writeFloat(float) throws java.io.IOException; + method public abstract void writeInt(int) throws java.io.IOException; + method public abstract void writeLong(long) throws java.io.IOException; + method public abstract void writeShort(int) throws java.io.IOException; + method public abstract void writeUTF(java.lang.String) throws java.io.IOException; + } + + public class DataOutputStream extends java.io.FilterOutputStream implements java.io.DataOutput { + ctor public DataOutputStream(java.io.OutputStream); + method public final int size(); + method public final void writeBoolean(boolean) throws java.io.IOException; + method public final void writeByte(int) throws java.io.IOException; + method public final void writeBytes(java.lang.String) throws java.io.IOException; + method public final void writeChar(int) throws java.io.IOException; + method public final void writeChars(java.lang.String) throws java.io.IOException; + method public final void writeDouble(double) throws java.io.IOException; + method public final void writeFloat(float) throws java.io.IOException; + method public final void writeInt(int) throws java.io.IOException; + method public final void writeLong(long) throws java.io.IOException; + method public final void writeShort(int) throws java.io.IOException; + method public final void writeUTF(java.lang.String) throws java.io.IOException; + field protected int written; + } + + public class EOFException extends java.io.IOException { + ctor public EOFException(); + ctor public EOFException(java.lang.String); + } + + public abstract interface Externalizable implements java.io.Serializable { + method public abstract void readExternal(java.io.ObjectInput) throws java.lang.ClassNotFoundException, java.io.IOException; + method public abstract void writeExternal(java.io.ObjectOutput) throws java.io.IOException; + } + + public class File implements java.lang.Comparable java.io.Serializable { + ctor public File(java.io.File, java.lang.String); + ctor public File(java.lang.String); + ctor public File(java.lang.String, java.lang.String); + ctor public File(java.net.URI); + method public boolean canExecute(); + method public boolean canRead(); + method public boolean canWrite(); + method public int compareTo(java.io.File); + method public boolean createNewFile() throws java.io.IOException; + method public static java.io.File createTempFile(java.lang.String, java.lang.String) throws java.io.IOException; + method public static java.io.File createTempFile(java.lang.String, java.lang.String, java.io.File) throws java.io.IOException; + method public boolean delete(); + method public void deleteOnExit(); + method public boolean exists(); + method public java.io.File getAbsoluteFile(); + method public java.lang.String getAbsolutePath(); + method public java.io.File getCanonicalFile() throws java.io.IOException; + method public java.lang.String getCanonicalPath() throws java.io.IOException; + method public long getFreeSpace(); + method public java.lang.String getName(); + method public java.lang.String getParent(); + method public java.io.File getParentFile(); + method public java.lang.String getPath(); + method public long getTotalSpace(); + method public long getUsableSpace(); + method public boolean isAbsolute(); + method public boolean isDirectory(); + method public boolean isFile(); + method public boolean isHidden(); + method public long lastModified(); + method public long length(); + method public java.lang.String[] list(); + method public java.lang.String[] list(java.io.FilenameFilter); + method public java.io.File[] listFiles(); + method public java.io.File[] listFiles(java.io.FilenameFilter); + method public java.io.File[] listFiles(java.io.FileFilter); + method public static java.io.File[] listRoots(); + method public boolean mkdir(); + method public boolean mkdirs(); + method public boolean renameTo(java.io.File); + method public boolean setExecutable(boolean, boolean); + method public boolean setExecutable(boolean); + method public boolean setLastModified(long); + method public boolean setReadOnly(); + method public boolean setReadable(boolean, boolean); + method public boolean setReadable(boolean); + method public boolean setWritable(boolean, boolean); + method public boolean setWritable(boolean); + method public java.net.URI toURI(); + method public deprecated java.net.URL toURL() throws java.net.MalformedURLException; + field public static final java.lang.String pathSeparator; + field public static final char pathSeparatorChar; + field public static final java.lang.String separator; + field public static final char separatorChar; + } + + public final class FileDescriptor { + ctor public FileDescriptor(); + method public void sync() throws java.io.SyncFailedException; + method public boolean valid(); + field public static final java.io.FileDescriptor err; + field public static final java.io.FileDescriptor in; + field public static final java.io.FileDescriptor out; + } + + public abstract interface FileFilter { + method public abstract boolean accept(java.io.File); + } + + public class FileInputStream extends java.io.InputStream implements java.io.Closeable { + ctor public FileInputStream(java.io.File) throws java.io.FileNotFoundException; + ctor public FileInputStream(java.io.FileDescriptor); + ctor public FileInputStream(java.lang.String) throws java.io.FileNotFoundException; + method public java.nio.channels.FileChannel getChannel(); + method public final java.io.FileDescriptor getFD() throws java.io.IOException; + method public int read() throws java.io.IOException; + } + + public class FileNotFoundException extends java.io.IOException { + ctor public FileNotFoundException(); + ctor public FileNotFoundException(java.lang.String); + } + + public class FileOutputStream extends java.io.OutputStream implements java.io.Closeable { + ctor public FileOutputStream(java.io.File) throws java.io.FileNotFoundException; + ctor public FileOutputStream(java.io.File, boolean) throws java.io.FileNotFoundException; + ctor public FileOutputStream(java.io.FileDescriptor); + ctor public FileOutputStream(java.lang.String) throws java.io.FileNotFoundException; + ctor public FileOutputStream(java.lang.String, boolean) throws java.io.FileNotFoundException; + method public java.nio.channels.FileChannel getChannel(); + method public final java.io.FileDescriptor getFD() throws java.io.IOException; + method public void write(int) throws java.io.IOException; + } + + public final class FilePermission extends java.security.Permission implements java.io.Serializable { + ctor public FilePermission(java.lang.String, java.lang.String); + method public java.lang.String getActions(); + method public boolean implies(java.security.Permission); + } + + public class FileReader extends java.io.InputStreamReader { + ctor public FileReader(java.io.File) throws java.io.FileNotFoundException; + ctor public FileReader(java.io.FileDescriptor); + ctor public FileReader(java.lang.String) throws java.io.FileNotFoundException; + } + + public class FileWriter extends java.io.OutputStreamWriter { + ctor public FileWriter(java.io.File) throws java.io.IOException; + ctor public FileWriter(java.io.File, boolean) throws java.io.IOException; + ctor public FileWriter(java.io.FileDescriptor); + ctor public FileWriter(java.lang.String) throws java.io.IOException; + ctor public FileWriter(java.lang.String, boolean) throws java.io.IOException; + } + + public abstract interface FilenameFilter { + method public abstract boolean accept(java.io.File, java.lang.String); + } + + public class FilterInputStream extends java.io.InputStream { + ctor protected FilterInputStream(java.io.InputStream); + method public int read() throws java.io.IOException; + field protected volatile java.io.InputStream in; + } + + public class FilterOutputStream extends java.io.OutputStream { + ctor public FilterOutputStream(java.io.OutputStream); + method public void write(int) throws java.io.IOException; + field protected java.io.OutputStream out; + } + + public abstract class FilterReader extends java.io.Reader { + ctor protected FilterReader(java.io.Reader); + method public void close() throws java.io.IOException; + method public int read(char[], int, int) throws java.io.IOException; + field protected java.io.Reader in; + } + + public abstract class FilterWriter extends java.io.Writer { + ctor protected FilterWriter(java.io.Writer); + method public void close() throws java.io.IOException; + method public void flush() throws java.io.IOException; + method public void write(char[], int, int) throws java.io.IOException; + field protected java.io.Writer out; + } + + public abstract interface Flushable { + method public abstract void flush() throws java.io.IOException; + } + + public class IOError extends java.lang.Error { + ctor public IOError(java.lang.Throwable); + } + + public class IOException extends java.lang.Exception { + ctor public IOException(); + ctor public IOException(java.lang.String); + ctor public IOException(java.lang.String, java.lang.Throwable); + ctor public IOException(java.lang.Throwable); + } + + public abstract class InputStream implements java.io.Closeable { + ctor public InputStream(); + method public int available() throws java.io.IOException; + method public void close() throws java.io.IOException; + method public void mark(int); + method public boolean markSupported(); + method public abstract int read() throws java.io.IOException; + method public int read(byte[]) throws java.io.IOException; + method public int read(byte[], int, int) throws java.io.IOException; + method public synchronized void reset() throws java.io.IOException; + method public long skip(long) throws java.io.IOException; + } + + public class InputStreamReader extends java.io.Reader { + ctor public InputStreamReader(java.io.InputStream); + ctor public InputStreamReader(java.io.InputStream, java.lang.String) throws java.io.UnsupportedEncodingException; + ctor public InputStreamReader(java.io.InputStream, java.nio.charset.CharsetDecoder); + ctor public InputStreamReader(java.io.InputStream, java.nio.charset.Charset); + method public void close() throws java.io.IOException; + method public java.lang.String getEncoding(); + method public int read(char[], int, int) throws java.io.IOException; + } + + public class InterruptedIOException extends java.io.IOException { + ctor public InterruptedIOException(); + ctor public InterruptedIOException(java.lang.String); + field public int bytesTransferred; + } + + public class InvalidClassException extends java.io.ObjectStreamException { + ctor public InvalidClassException(java.lang.String); + ctor public InvalidClassException(java.lang.String, java.lang.String); + field public java.lang.String classname; + } + + public class InvalidObjectException extends java.io.ObjectStreamException { + ctor public InvalidObjectException(java.lang.String); + } + + public deprecated class LineNumberInputStream extends java.io.FilterInputStream { + ctor public LineNumberInputStream(java.io.InputStream); + method public int getLineNumber(); + method public void setLineNumber(int); + } + + public class LineNumberReader extends java.io.BufferedReader { + ctor public LineNumberReader(java.io.Reader); + ctor public LineNumberReader(java.io.Reader, int); + method public int getLineNumber(); + method public void setLineNumber(int); + } + + public class NotActiveException extends java.io.ObjectStreamException { + ctor public NotActiveException(); + ctor public NotActiveException(java.lang.String); + } + + public class NotSerializableException extends java.io.ObjectStreamException { + ctor public NotSerializableException(); + ctor public NotSerializableException(java.lang.String); + } + + public abstract interface ObjectInput implements java.io.DataInput { + method public abstract int available() throws java.io.IOException; + method public abstract void close() throws java.io.IOException; + method public abstract int read() throws java.io.IOException; + method public abstract int read(byte[]) throws java.io.IOException; + method public abstract int read(byte[], int, int) throws java.io.IOException; + method public abstract java.lang.Object readObject() throws java.lang.ClassNotFoundException, java.io.IOException; + method public abstract long skip(long) throws java.io.IOException; + } + + public class ObjectInputStream extends java.io.InputStream implements java.io.ObjectInput java.io.ObjectStreamConstants { + ctor protected ObjectInputStream() throws java.io.IOException; + ctor public ObjectInputStream(java.io.InputStream) throws java.io.IOException, java.io.StreamCorruptedException; + method public void defaultReadObject() throws java.lang.ClassNotFoundException, java.io.IOException, java.io.NotActiveException; + method protected boolean enableResolveObject(boolean); + method public int read() throws java.io.IOException; + method public boolean readBoolean() throws java.io.IOException; + method public byte readByte() throws java.io.IOException; + method public char readChar() throws java.io.IOException; + method protected java.io.ObjectStreamClass readClassDescriptor() throws java.lang.ClassNotFoundException, java.io.IOException; + method public double readDouble() throws java.io.IOException; + method public java.io.ObjectInputStream.GetField readFields() throws java.lang.ClassNotFoundException, java.io.IOException, java.io.NotActiveException; + method public float readFloat() throws java.io.IOException; + method public void readFully(byte[]) throws java.io.IOException; + method public void readFully(byte[], int, int) throws java.io.IOException; + method public int readInt() throws java.io.IOException; + method public deprecated java.lang.String readLine() throws java.io.IOException; + method public long readLong() throws java.io.IOException; + method public final java.lang.Object readObject() throws java.lang.ClassNotFoundException, java.io.IOException, java.io.OptionalDataException; + method protected java.lang.Object readObjectOverride() throws java.lang.ClassNotFoundException, java.io.IOException, java.io.OptionalDataException; + method public short readShort() throws java.io.IOException; + method protected void readStreamHeader() throws java.io.IOException, java.io.StreamCorruptedException; + method public java.lang.String readUTF() throws java.io.IOException; + method public java.lang.Object readUnshared() throws java.lang.ClassNotFoundException, java.io.IOException; + method public int readUnsignedByte() throws java.io.IOException; + method public int readUnsignedShort() throws java.io.IOException; + method public synchronized void registerValidation(java.io.ObjectInputValidation, int) throws java.io.InvalidObjectException, java.io.NotActiveException; + method protected java.lang.Class resolveClass(java.io.ObjectStreamClass) throws java.lang.ClassNotFoundException, java.io.IOException; + method protected java.lang.Object resolveObject(java.lang.Object) throws java.io.IOException; + method protected java.lang.Class resolveProxyClass(java.lang.String[]) throws java.lang.ClassNotFoundException, java.io.IOException; + method public int skipBytes(int) throws java.io.IOException; + } + + public static abstract class ObjectInputStream.GetField { + ctor public ObjectInputStream.GetField(); + method public abstract boolean defaulted(java.lang.String) throws java.io.IOException, java.lang.IllegalArgumentException; + method public abstract boolean get(java.lang.String, boolean) throws java.io.IOException, java.lang.IllegalArgumentException; + method public abstract char get(java.lang.String, char) throws java.io.IOException, java.lang.IllegalArgumentException; + method public abstract byte get(java.lang.String, byte) throws java.io.IOException, java.lang.IllegalArgumentException; + method public abstract short get(java.lang.String, short) throws java.io.IOException, java.lang.IllegalArgumentException; + method public abstract int get(java.lang.String, int) throws java.io.IOException, java.lang.IllegalArgumentException; + method public abstract long get(java.lang.String, long) throws java.io.IOException, java.lang.IllegalArgumentException; + method public abstract float get(java.lang.String, float) throws java.io.IOException, java.lang.IllegalArgumentException; + method public abstract double get(java.lang.String, double) throws java.io.IOException, java.lang.IllegalArgumentException; + method public abstract java.lang.Object get(java.lang.String, java.lang.Object) throws java.io.IOException, java.lang.IllegalArgumentException; + method public abstract java.io.ObjectStreamClass getObjectStreamClass(); + } + + public abstract interface ObjectInputValidation { + method public abstract void validateObject() throws java.io.InvalidObjectException; + } + + public abstract interface ObjectOutput implements java.io.DataOutput { + method public abstract void close() throws java.io.IOException; + method public abstract void flush() throws java.io.IOException; + method public abstract void write(byte[]) throws java.io.IOException; + method public abstract void write(byte[], int, int) throws java.io.IOException; + method public abstract void write(int) throws java.io.IOException; + method public abstract void writeObject(java.lang.Object) throws java.io.IOException; + } + + public class ObjectOutputStream extends java.io.OutputStream implements java.io.ObjectOutput java.io.ObjectStreamConstants { + ctor protected ObjectOutputStream() throws java.io.IOException; + ctor public ObjectOutputStream(java.io.OutputStream) throws java.io.IOException; + method protected void annotateClass(java.lang.Class) throws java.io.IOException; + method protected void annotateProxyClass(java.lang.Class) throws java.io.IOException; + method public void defaultWriteObject() throws java.io.IOException; + method protected void drain() throws java.io.IOException; + method protected boolean enableReplaceObject(boolean); + method public java.io.ObjectOutputStream.PutField putFields() throws java.io.IOException; + method protected java.lang.Object replaceObject(java.lang.Object) throws java.io.IOException; + method public void reset() throws java.io.IOException; + method public void useProtocolVersion(int) throws java.io.IOException; + method public void write(int) throws java.io.IOException; + method public void writeBoolean(boolean) throws java.io.IOException; + method public void writeByte(int) throws java.io.IOException; + method public void writeBytes(java.lang.String) throws java.io.IOException; + method public void writeChar(int) throws java.io.IOException; + method public void writeChars(java.lang.String) throws java.io.IOException; + method protected void writeClassDescriptor(java.io.ObjectStreamClass) throws java.io.IOException; + method public void writeDouble(double) throws java.io.IOException; + method public void writeFields() throws java.io.IOException; + method public void writeFloat(float) throws java.io.IOException; + method public void writeInt(int) throws java.io.IOException; + method public void writeLong(long) throws java.io.IOException; + method public final void writeObject(java.lang.Object) throws java.io.IOException; + method protected void writeObjectOverride(java.lang.Object) throws java.io.IOException; + method public void writeShort(int) throws java.io.IOException; + method protected void writeStreamHeader() throws java.io.IOException; + method public void writeUTF(java.lang.String) throws java.io.IOException; + method public void writeUnshared(java.lang.Object) throws java.io.IOException; + } + + public static abstract class ObjectOutputStream.PutField { + ctor public ObjectOutputStream.PutField(); + method public abstract void put(java.lang.String, boolean); + method public abstract void put(java.lang.String, char); + method public abstract void put(java.lang.String, byte); + method public abstract void put(java.lang.String, short); + method public abstract void put(java.lang.String, int); + method public abstract void put(java.lang.String, long); + method public abstract void put(java.lang.String, float); + method public abstract void put(java.lang.String, double); + method public abstract void put(java.lang.String, java.lang.Object); + method public abstract deprecated void write(java.io.ObjectOutput) throws java.io.IOException; + } + + public class ObjectStreamClass implements java.io.Serializable { + method public java.lang.Class forClass(); + method public java.io.ObjectStreamField getField(java.lang.String); + method public java.io.ObjectStreamField[] getFields(); + method public java.lang.String getName(); + method public long getSerialVersionUID(); + method public static java.io.ObjectStreamClass lookup(java.lang.Class); + method public static java.io.ObjectStreamClass lookupAny(java.lang.Class); + field public static final java.io.ObjectStreamField[] NO_FIELDS; + } + + public abstract interface ObjectStreamConstants { + field public static final int PROTOCOL_VERSION_1 = 1; // 0x1 + field public static final int PROTOCOL_VERSION_2 = 2; // 0x2 + field public static final byte SC_BLOCK_DATA = 8; // 0x8 + field public static final byte SC_ENUM = 16; // 0x10 + field public static final byte SC_EXTERNALIZABLE = 4; // 0x4 + field public static final byte SC_SERIALIZABLE = 2; // 0x2 + field public static final byte SC_WRITE_METHOD = 1; // 0x1 + field public static final short STREAM_MAGIC = -21267; // 0xffffaced + field public static final short STREAM_VERSION = 5; // 0x5 + field public static final java.io.SerializablePermission SUBCLASS_IMPLEMENTATION_PERMISSION; + field public static final java.io.SerializablePermission SUBSTITUTION_PERMISSION; + field public static final byte TC_ARRAY = 117; // 0x75 + field public static final byte TC_BASE = 112; // 0x70 + field public static final byte TC_BLOCKDATA = 119; // 0x77 + field public static final byte TC_BLOCKDATALONG = 122; // 0x7a + field public static final byte TC_CLASS = 118; // 0x76 + field public static final byte TC_CLASSDESC = 114; // 0x72 + field public static final byte TC_ENDBLOCKDATA = 120; // 0x78 + field public static final byte TC_ENUM = 126; // 0x7e + field public static final byte TC_EXCEPTION = 123; // 0x7b + field public static final byte TC_LONGSTRING = 124; // 0x7c + field public static final byte TC_MAX = 126; // 0x7e + field public static final byte TC_NULL = 112; // 0x70 + field public static final byte TC_OBJECT = 115; // 0x73 + field public static final byte TC_PROXYCLASSDESC = 125; // 0x7d + field public static final byte TC_REFERENCE = 113; // 0x71 + field public static final byte TC_RESET = 121; // 0x79 + field public static final byte TC_STRING = 116; // 0x74 + field public static final int baseWireHandle = 8257536; // 0x7e0000 + } + + public abstract class ObjectStreamException extends java.io.IOException { + ctor protected ObjectStreamException(); + ctor protected ObjectStreamException(java.lang.String); + } + + public class ObjectStreamField implements java.lang.Comparable { + ctor public ObjectStreamField(java.lang.String, java.lang.Class); + ctor public ObjectStreamField(java.lang.String, java.lang.Class, boolean); + method public int compareTo(java.lang.Object); + method public java.lang.String getName(); + method public int getOffset(); + method public java.lang.Class getType(); + method public char getTypeCode(); + method public java.lang.String getTypeString(); + method public boolean isPrimitive(); + method public boolean isUnshared(); + method protected void setOffset(int); + } + + public class OptionalDataException extends java.io.ObjectStreamException { + field public boolean eof; + field public int length; + } + + public abstract class OutputStream implements java.io.Closeable java.io.Flushable { + ctor public OutputStream(); + method public void close() throws java.io.IOException; + method public void flush() throws java.io.IOException; + method public void write(byte[]) throws java.io.IOException; + method public void write(byte[], int, int) throws java.io.IOException; + method public abstract void write(int) throws java.io.IOException; + } + + public class OutputStreamWriter extends java.io.Writer { + ctor public OutputStreamWriter(java.io.OutputStream); + ctor public OutputStreamWriter(java.io.OutputStream, java.lang.String) throws java.io.UnsupportedEncodingException; + ctor public OutputStreamWriter(java.io.OutputStream, java.nio.charset.Charset); + ctor public OutputStreamWriter(java.io.OutputStream, java.nio.charset.CharsetEncoder); + method public void close() throws java.io.IOException; + method public void flush() throws java.io.IOException; + method public java.lang.String getEncoding(); + method public void write(char[], int, int) throws java.io.IOException; + } + + public class PipedInputStream extends java.io.InputStream { + ctor public PipedInputStream(); + ctor public PipedInputStream(java.io.PipedOutputStream) throws java.io.IOException; + ctor public PipedInputStream(int); + ctor public PipedInputStream(java.io.PipedOutputStream, int) throws java.io.IOException; + method public void connect(java.io.PipedOutputStream) throws java.io.IOException; + method public synchronized int read() throws java.io.IOException; + method protected synchronized void receive(int) throws java.io.IOException; + field protected static final int PIPE_SIZE = 1024; // 0x400 + field protected byte[] buffer; + field protected int in; + field protected int out; + } + + public class PipedOutputStream extends java.io.OutputStream { + ctor public PipedOutputStream(); + ctor public PipedOutputStream(java.io.PipedInputStream) throws java.io.IOException; + method public void connect(java.io.PipedInputStream) throws java.io.IOException; + method public void write(int) throws java.io.IOException; + } + + public class PipedReader extends java.io.Reader { + ctor public PipedReader(); + ctor public PipedReader(java.io.PipedWriter) throws java.io.IOException; + ctor public PipedReader(int); + ctor public PipedReader(java.io.PipedWriter, int) throws java.io.IOException; + method public synchronized void close() throws java.io.IOException; + method public void connect(java.io.PipedWriter) throws java.io.IOException; + method public synchronized int read(char[], int, int) throws java.io.IOException; + } + + public class PipedWriter extends java.io.Writer { + ctor public PipedWriter(); + ctor public PipedWriter(java.io.PipedReader) throws java.io.IOException; + method public void close() throws java.io.IOException; + method public void connect(java.io.PipedReader) throws java.io.IOException; + method public void flush() throws java.io.IOException; + method public void write(char[], int, int) throws java.io.IOException; + } + + public class PrintStream extends java.io.FilterOutputStream implements java.lang.Appendable java.io.Closeable { + ctor public PrintStream(java.io.OutputStream); + ctor public PrintStream(java.io.OutputStream, boolean); + ctor public PrintStream(java.io.OutputStream, boolean, java.lang.String) throws java.io.UnsupportedEncodingException; + ctor public PrintStream(java.io.File) throws java.io.FileNotFoundException; + ctor public PrintStream(java.io.File, java.lang.String) throws java.io.FileNotFoundException, java.io.UnsupportedEncodingException; + ctor public PrintStream(java.lang.String) throws java.io.FileNotFoundException; + ctor public PrintStream(java.lang.String, java.lang.String) throws java.io.FileNotFoundException, java.io.UnsupportedEncodingException; + method public java.io.PrintStream append(char); + method public java.io.PrintStream append(java.lang.CharSequence); + method public java.io.PrintStream append(java.lang.CharSequence, int, int); + method public boolean checkError(); + method protected void clearError(); + method public java.io.PrintStream format(java.lang.String, java.lang.Object...); + method public java.io.PrintStream format(java.util.Locale, java.lang.String, java.lang.Object...); + method public void print(char[]); + method public void print(char); + method public void print(double); + method public void print(float); + method public void print(int); + method public void print(long); + method public void print(java.lang.Object); + method public synchronized void print(java.lang.String); + method public void print(boolean); + method public java.io.PrintStream printf(java.lang.String, java.lang.Object...); + method public java.io.PrintStream printf(java.util.Locale, java.lang.String, java.lang.Object...); + method public void println(); + method public void println(char[]); + method public void println(char); + method public void println(double); + method public void println(float); + method public void println(int); + method public void println(long); + method public void println(java.lang.Object); + method public synchronized void println(java.lang.String); + method public void println(boolean); + method protected void setError(); + } + + public class PrintWriter extends java.io.Writer { + ctor public PrintWriter(java.io.OutputStream); + ctor public PrintWriter(java.io.OutputStream, boolean); + ctor public PrintWriter(java.io.Writer); + ctor public PrintWriter(java.io.Writer, boolean); + ctor public PrintWriter(java.io.File) throws java.io.FileNotFoundException; + ctor public PrintWriter(java.io.File, java.lang.String) throws java.io.FileNotFoundException, java.io.UnsupportedEncodingException; + ctor public PrintWriter(java.lang.String) throws java.io.FileNotFoundException; + ctor public PrintWriter(java.lang.String, java.lang.String) throws java.io.FileNotFoundException, java.io.UnsupportedEncodingException; + method public boolean checkError(); + method protected void clearError(); + method public void close(); + method public void flush(); + method public java.io.PrintWriter format(java.lang.String, java.lang.Object...); + method public java.io.PrintWriter format(java.util.Locale, java.lang.String, java.lang.Object...); + method public void print(char[]); + method public void print(char); + method public void print(double); + method public void print(float); + method public void print(int); + method public void print(long); + method public void print(java.lang.Object); + method public void print(java.lang.String); + method public void print(boolean); + method public java.io.PrintWriter printf(java.lang.String, java.lang.Object...); + method public java.io.PrintWriter printf(java.util.Locale, java.lang.String, java.lang.Object...); + method public void println(); + method public void println(char[]); + method public void println(char); + method public void println(double); + method public void println(float); + method public void println(int); + method public void println(long); + method public void println(java.lang.Object); + method public void println(java.lang.String); + method public void println(boolean); + method protected void setError(); + method public void write(char[], int, int); + field protected java.io.Writer out; + } + + public class PushbackInputStream extends java.io.FilterInputStream { + ctor public PushbackInputStream(java.io.InputStream); + ctor public PushbackInputStream(java.io.InputStream, int); + method public void unread(byte[]) throws java.io.IOException; + method public void unread(byte[], int, int) throws java.io.IOException; + method public void unread(int) throws java.io.IOException; + field protected byte[] buf; + field protected int pos; + } + + public class PushbackReader extends java.io.FilterReader { + ctor public PushbackReader(java.io.Reader); + ctor public PushbackReader(java.io.Reader, int); + method public void unread(char[]) throws java.io.IOException; + method public void unread(char[], int, int) throws java.io.IOException; + method public void unread(int) throws java.io.IOException; + } + + public class RandomAccessFile implements java.io.Closeable java.io.DataInput java.io.DataOutput { + ctor public RandomAccessFile(java.io.File, java.lang.String) throws java.io.FileNotFoundException; + ctor public RandomAccessFile(java.lang.String, java.lang.String) throws java.io.FileNotFoundException; + method public void close() throws java.io.IOException; + method public final synchronized java.nio.channels.FileChannel getChannel(); + method public final java.io.FileDescriptor getFD() throws java.io.IOException; + method public long getFilePointer() throws java.io.IOException; + method public long length() throws java.io.IOException; + method public int read() throws java.io.IOException; + method public int read(byte[]) throws java.io.IOException; + method public int read(byte[], int, int) throws java.io.IOException; + method public final boolean readBoolean() throws java.io.IOException; + method public final byte readByte() throws java.io.IOException; + method public final char readChar() throws java.io.IOException; + method public final double readDouble() throws java.io.IOException; + method public final float readFloat() throws java.io.IOException; + method public final void readFully(byte[]) throws java.io.IOException; + method public final void readFully(byte[], int, int) throws java.io.IOException; + method public final int readInt() throws java.io.IOException; + method public final java.lang.String readLine() throws java.io.IOException; + method public final long readLong() throws java.io.IOException; + method public final short readShort() throws java.io.IOException; + method public final java.lang.String readUTF() throws java.io.IOException; + method public final int readUnsignedByte() throws java.io.IOException; + method public final int readUnsignedShort() throws java.io.IOException; + method public void seek(long) throws java.io.IOException; + method public void setLength(long) throws java.io.IOException; + method public int skipBytes(int) throws java.io.IOException; + method public void write(byte[]) throws java.io.IOException; + method public void write(byte[], int, int) throws java.io.IOException; + method public void write(int) throws java.io.IOException; + method public final void writeBoolean(boolean) throws java.io.IOException; + method public final void writeByte(int) throws java.io.IOException; + method public final void writeBytes(java.lang.String) throws java.io.IOException; + method public final void writeChar(int) throws java.io.IOException; + method public final void writeChars(java.lang.String) throws java.io.IOException; + method public final void writeDouble(double) throws java.io.IOException; + method public final void writeFloat(float) throws java.io.IOException; + method public final void writeInt(int) throws java.io.IOException; + method public final void writeLong(long) throws java.io.IOException; + method public final void writeShort(int) throws java.io.IOException; + method public final void writeUTF(java.lang.String) throws java.io.IOException; + } + + public abstract class Reader implements java.io.Closeable java.lang.Readable { + ctor protected Reader(); + ctor protected Reader(java.lang.Object); + method public abstract void close() throws java.io.IOException; + method public void mark(int) throws java.io.IOException; + method public boolean markSupported(); + method public int read() throws java.io.IOException; + method public int read(char[]) throws java.io.IOException; + method public abstract int read(char[], int, int) throws java.io.IOException; + method public int read(java.nio.CharBuffer) throws java.io.IOException; + method public boolean ready() throws java.io.IOException; + method public void reset() throws java.io.IOException; + method public long skip(long) throws java.io.IOException; + field protected java.lang.Object lock; + } + + public class SequenceInputStream extends java.io.InputStream { + ctor public SequenceInputStream(java.io.InputStream, java.io.InputStream); + ctor public SequenceInputStream(java.util.Enumeration); + method public int read() throws java.io.IOException; + } + + public abstract interface Serializable { + } + + public final class SerializablePermission extends java.security.BasicPermission { + ctor public SerializablePermission(java.lang.String); + ctor public SerializablePermission(java.lang.String, java.lang.String); + } + + public class StreamCorruptedException extends java.io.ObjectStreamException { + ctor public StreamCorruptedException(); + ctor public StreamCorruptedException(java.lang.String); + } + + public class StreamTokenizer { + ctor public deprecated StreamTokenizer(java.io.InputStream); + ctor public StreamTokenizer(java.io.Reader); + method public void commentChar(int); + method public void eolIsSignificant(boolean); + method public int lineno(); + method public void lowerCaseMode(boolean); + method public int nextToken() throws java.io.IOException; + method public void ordinaryChar(int); + method public void ordinaryChars(int, int); + method public void parseNumbers(); + method public void pushBack(); + method public void quoteChar(int); + method public void resetSyntax(); + method public void slashSlashComments(boolean); + method public void slashStarComments(boolean); + method public void whitespaceChars(int, int); + method public void wordChars(int, int); + field public static final int TT_EOF = -1; // 0xffffffff + field public static final int TT_EOL = 10; // 0xa + field public static final int TT_NUMBER = -2; // 0xfffffffe + field public static final int TT_WORD = -3; // 0xfffffffd + field public double nval; + field public java.lang.String sval; + field public int ttype; + } + + public deprecated class StringBufferInputStream extends java.io.InputStream { + ctor public StringBufferInputStream(java.lang.String); + method public synchronized int read(); + field protected java.lang.String buffer; + field protected int count; + field protected int pos; + } + + public class StringReader extends java.io.Reader { + ctor public StringReader(java.lang.String); + method public void close(); + method public int read(char[], int, int) throws java.io.IOException; + } + + public class StringWriter extends java.io.Writer { + ctor public StringWriter(); + ctor public StringWriter(int); + method public void close() throws java.io.IOException; + method public void flush(); + method public java.lang.StringBuffer getBuffer(); + method public void write(char[], int, int); + } + + public class SyncFailedException extends java.io.IOException { + ctor public SyncFailedException(java.lang.String); + } + + public class UTFDataFormatException extends java.io.IOException { + ctor public UTFDataFormatException(); + ctor public UTFDataFormatException(java.lang.String); + } + + public class UnsupportedEncodingException extends java.io.IOException { + ctor public UnsupportedEncodingException(); + ctor public UnsupportedEncodingException(java.lang.String); + } + + public class WriteAbortedException extends java.io.ObjectStreamException { + ctor public WriteAbortedException(java.lang.String, java.lang.Exception); + field public java.lang.Exception detail; + } + + public abstract class Writer implements java.lang.Appendable java.io.Closeable java.io.Flushable { + ctor protected Writer(); + ctor protected Writer(java.lang.Object); + method public java.io.Writer append(char) throws java.io.IOException; + method public java.io.Writer append(java.lang.CharSequence) throws java.io.IOException; + method public java.io.Writer append(java.lang.CharSequence, int, int) throws java.io.IOException; + method public abstract void close() throws java.io.IOException; + method public abstract void flush() throws java.io.IOException; + method public void write(char[]) throws java.io.IOException; + method public abstract void write(char[], int, int) throws java.io.IOException; + method public void write(int) throws java.io.IOException; + method public void write(java.lang.String) throws java.io.IOException; + method public void write(java.lang.String, int, int) throws java.io.IOException; + field protected java.lang.Object lock; + } + +} + +package java.lang { + + public class AbstractMethodError extends java.lang.IncompatibleClassChangeError { + ctor public AbstractMethodError(); + ctor public AbstractMethodError(java.lang.String); + } + + abstract class AbstractStringBuilder { + method public int capacity(); + method public char charAt(int); + method public int codePointAt(int); + method public int codePointBefore(int); + method public int codePointCount(int, int); + method public void ensureCapacity(int); + method public void getChars(int, int, char[], int); + method public int indexOf(java.lang.String); + method public int indexOf(java.lang.String, int); + method public int lastIndexOf(java.lang.String); + method public int lastIndexOf(java.lang.String, int); + method public int length(); + method public int offsetByCodePoints(int, int); + method public void setCharAt(int, char); + method public void setLength(int); + method public java.lang.CharSequence subSequence(int, int); + method public java.lang.String substring(int); + method public java.lang.String substring(int, int); + method public void trimToSize(); + } + + public abstract interface Appendable { + method public abstract java.lang.Appendable append(char) throws java.io.IOException; + method public abstract java.lang.Appendable append(java.lang.CharSequence) throws java.io.IOException; + method public abstract java.lang.Appendable append(java.lang.CharSequence, int, int) throws java.io.IOException; + } + + public class ArithmeticException extends java.lang.RuntimeException { + ctor public ArithmeticException(); + ctor public ArithmeticException(java.lang.String); + } + + public class ArrayIndexOutOfBoundsException extends java.lang.IndexOutOfBoundsException { + ctor public ArrayIndexOutOfBoundsException(); + ctor public ArrayIndexOutOfBoundsException(int); + ctor public ArrayIndexOutOfBoundsException(java.lang.String); + } + + public class ArrayStoreException extends java.lang.RuntimeException { + ctor public ArrayStoreException(); + ctor public ArrayStoreException(java.lang.String); + } + + public class AssertionError extends java.lang.Error { + ctor public AssertionError(); + ctor public AssertionError(java.lang.Object); + ctor public AssertionError(boolean); + ctor public AssertionError(char); + ctor public AssertionError(int); + ctor public AssertionError(long); + ctor public AssertionError(float); + ctor public AssertionError(double); + } + + public final class Boolean implements java.lang.Comparable java.io.Serializable { + ctor public Boolean(java.lang.String); + ctor public Boolean(boolean); + method public boolean booleanValue(); + method public int compareTo(java.lang.Boolean); + method public static boolean getBoolean(java.lang.String); + method public static boolean parseBoolean(java.lang.String); + method public static java.lang.String toString(boolean); + method public static java.lang.Boolean valueOf(java.lang.String); + method public static java.lang.Boolean valueOf(boolean); + field public static final java.lang.Boolean FALSE; + field public static final java.lang.Boolean TRUE; + field public static final java.lang.Class TYPE; + } + + public final class Byte extends java.lang.Number implements java.lang.Comparable { + ctor public Byte(byte); + ctor public Byte(java.lang.String) throws java.lang.NumberFormatException; + method public int compareTo(java.lang.Byte); + method public static java.lang.Byte decode(java.lang.String) throws java.lang.NumberFormatException; + method public double doubleValue(); + method public float floatValue(); + method public int intValue(); + method public long longValue(); + method public static byte parseByte(java.lang.String) throws java.lang.NumberFormatException; + method public static byte parseByte(java.lang.String, int) throws java.lang.NumberFormatException; + method public static java.lang.String toString(byte); + method public static java.lang.Byte valueOf(java.lang.String) throws java.lang.NumberFormatException; + method public static java.lang.Byte valueOf(java.lang.String, int) throws java.lang.NumberFormatException; + method public static java.lang.Byte valueOf(byte); + field public static final byte MAX_VALUE = 127; // 0x7f + field public static final byte MIN_VALUE = -128; // 0xffffff80 + field public static final int SIZE = 8; // 0x8 + field public static final java.lang.Class TYPE; + } + + public abstract interface CharSequence { + method public abstract char charAt(int); + method public abstract int length(); + method public abstract java.lang.CharSequence subSequence(int, int); + method public abstract java.lang.String toString(); + } + + public final class Character implements java.lang.Comparable java.io.Serializable { + ctor public Character(char); + method public static int charCount(int); + method public char charValue(); + method public static int codePointAt(java.lang.CharSequence, int); + method public static int codePointAt(char[], int); + method public static int codePointAt(char[], int, int); + method public static int codePointBefore(java.lang.CharSequence, int); + method public static int codePointBefore(char[], int); + method public static int codePointBefore(char[], int, int); + method public static int codePointCount(java.lang.CharSequence, int, int); + method public static int codePointCount(char[], int, int); + method public int compareTo(java.lang.Character); + method public static int digit(char, int); + method public static int digit(int, int); + method public static char forDigit(int, int); + method public static byte getDirectionality(char); + method public static byte getDirectionality(int); + method public static int getNumericValue(char); + method public static int getNumericValue(int); + method public static int getType(char); + method public static int getType(int); + method public static boolean isDefined(char); + method public static boolean isDefined(int); + method public static boolean isDigit(char); + method public static boolean isDigit(int); + method public static boolean isHighSurrogate(char); + method public static boolean isISOControl(char); + method public static boolean isISOControl(int); + method public static boolean isIdentifierIgnorable(char); + method public static boolean isIdentifierIgnorable(int); + method public static boolean isJavaIdentifierPart(char); + method public static boolean isJavaIdentifierPart(int); + method public static boolean isJavaIdentifierStart(char); + method public static boolean isJavaIdentifierStart(int); + method public static deprecated boolean isJavaLetter(char); + method public static deprecated boolean isJavaLetterOrDigit(char); + method public static boolean isLetter(char); + method public static boolean isLetter(int); + method public static boolean isLetterOrDigit(char); + method public static boolean isLetterOrDigit(int); + method public static boolean isLowSurrogate(char); + method public static boolean isLowerCase(char); + method public static boolean isLowerCase(int); + method public static boolean isMirrored(char); + method public static boolean isMirrored(int); + method public static deprecated boolean isSpace(char); + method public static boolean isSpaceChar(char); + method public static boolean isSpaceChar(int); + method public static boolean isSupplementaryCodePoint(int); + method public static boolean isSurrogatePair(char, char); + method public static boolean isTitleCase(char); + method public static boolean isTitleCase(int); + method public static boolean isUnicodeIdentifierPart(char); + method public static boolean isUnicodeIdentifierPart(int); + method public static boolean isUnicodeIdentifierStart(char); + method public static boolean isUnicodeIdentifierStart(int); + method public static boolean isUpperCase(char); + method public static boolean isUpperCase(int); + method public static boolean isValidCodePoint(int); + method public static boolean isWhitespace(char); + method public static boolean isWhitespace(int); + method public static int offsetByCodePoints(java.lang.CharSequence, int, int); + method public static int offsetByCodePoints(char[], int, int, int, int); + method public static char reverseBytes(char); + method public static int toChars(int, char[], int); + method public static char[] toChars(int); + method public static int toCodePoint(char, char); + method public static char toLowerCase(char); + method public static int toLowerCase(int); + method public static java.lang.String toString(char); + method public static char toTitleCase(char); + method public static int toTitleCase(int); + method public static char toUpperCase(char); + method public static int toUpperCase(int); + method public static java.lang.Character valueOf(char); + field public static final byte COMBINING_SPACING_MARK = 8; // 0x8 + field public static final byte CONNECTOR_PUNCTUATION = 23; // 0x17 + field public static final byte CONTROL = 15; // 0xf + field public static final byte CURRENCY_SYMBOL = 26; // 0x1a + field public static final byte DASH_PUNCTUATION = 20; // 0x14 + field public static final byte DECIMAL_DIGIT_NUMBER = 9; // 0x9 + field public static final byte DIRECTIONALITY_ARABIC_NUMBER = 6; // 0x6 + field public static final byte DIRECTIONALITY_BOUNDARY_NEUTRAL = 9; // 0x9 + field public static final byte DIRECTIONALITY_COMMON_NUMBER_SEPARATOR = 7; // 0x7 + field public static final byte DIRECTIONALITY_EUROPEAN_NUMBER = 3; // 0x3 + field public static final byte DIRECTIONALITY_EUROPEAN_NUMBER_SEPARATOR = 4; // 0x4 + field public static final byte DIRECTIONALITY_EUROPEAN_NUMBER_TERMINATOR = 5; // 0x5 + field public static final byte DIRECTIONALITY_LEFT_TO_RIGHT = 0; // 0x0 + field public static final byte DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING = 14; // 0xe + field public static final byte DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE = 15; // 0xf + field public static final byte DIRECTIONALITY_NONSPACING_MARK = 8; // 0x8 + field public static final byte DIRECTIONALITY_OTHER_NEUTRALS = 13; // 0xd + field public static final byte DIRECTIONALITY_PARAGRAPH_SEPARATOR = 10; // 0xa + field public static final byte DIRECTIONALITY_POP_DIRECTIONAL_FORMAT = 18; // 0x12 + field public static final byte DIRECTIONALITY_RIGHT_TO_LEFT = 1; // 0x1 + field public static final byte DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC = 2; // 0x2 + field public static final byte DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING = 16; // 0x10 + field public static final byte DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE = 17; // 0x11 + field public static final byte DIRECTIONALITY_SEGMENT_SEPARATOR = 11; // 0xb + field public static final byte DIRECTIONALITY_UNDEFINED = -1; // 0xffffffff + field public static final byte DIRECTIONALITY_WHITESPACE = 12; // 0xc + field public static final byte ENCLOSING_MARK = 7; // 0x7 + field public static final byte END_PUNCTUATION = 22; // 0x16 + field public static final byte FINAL_QUOTE_PUNCTUATION = 30; // 0x1e + field public static final byte FORMAT = 16; // 0x10 + field public static final byte INITIAL_QUOTE_PUNCTUATION = 29; // 0x1d + field public static final byte LETTER_NUMBER = 10; // 0xa + field public static final byte LINE_SEPARATOR = 13; // 0xd + field public static final byte LOWERCASE_LETTER = 2; // 0x2 + field public static final byte MATH_SYMBOL = 25; // 0x19 + field public static final int MAX_CODE_POINT = 1114111; // 0x10ffff + field public static final char MAX_HIGH_SURROGATE = 56319; // 0xdbff '\udbff' + field public static final char MAX_LOW_SURROGATE = 57343; // 0xdfff '\udfff' + field public static final int MAX_RADIX = 36; // 0x24 + field public static final char MAX_SURROGATE = 57343; // 0xdfff '\udfff' + field public static final char MAX_VALUE = 65535; // 0xffff '\uffff' + field public static final int MIN_CODE_POINT = 0; // 0x0 + field public static final char MIN_HIGH_SURROGATE = 55296; // 0xd800 '\ud800' + field public static final char MIN_LOW_SURROGATE = 56320; // 0xdc00 '\udc00' + field public static final int MIN_RADIX = 2; // 0x2 + field public static final int MIN_SUPPLEMENTARY_CODE_POINT = 65536; // 0x10000 + field public static final char MIN_SURROGATE = 55296; // 0xd800 '\ud800' + field public static final char MIN_VALUE = 0; // 0x0000 '\u0000' + field public static final byte MODIFIER_LETTER = 4; // 0x4 + field public static final byte MODIFIER_SYMBOL = 27; // 0x1b + field public static final byte NON_SPACING_MARK = 6; // 0x6 + field public static final byte OTHER_LETTER = 5; // 0x5 + field public static final byte OTHER_NUMBER = 11; // 0xb + field public static final byte OTHER_PUNCTUATION = 24; // 0x18 + field public static final byte OTHER_SYMBOL = 28; // 0x1c + field public static final byte PARAGRAPH_SEPARATOR = 14; // 0xe + field public static final byte PRIVATE_USE = 18; // 0x12 + field public static final int SIZE = 16; // 0x10 + field public static final byte SPACE_SEPARATOR = 12; // 0xc + field public static final byte START_PUNCTUATION = 21; // 0x15 + field public static final byte SURROGATE = 19; // 0x13 + field public static final byte TITLECASE_LETTER = 3; // 0x3 + field public static final java.lang.Class TYPE; + field public static final byte UNASSIGNED = 0; // 0x0 + field public static final byte UPPERCASE_LETTER = 1; // 0x1 + } + + public static class Character.Subset { + ctor protected Character.Subset(java.lang.String); + method public final boolean equals(java.lang.Object); + method public final int hashCode(); + method public final java.lang.String toString(); + } + + public static final class Character.UnicodeBlock extends java.lang.Character.Subset { + method public static java.lang.Character.UnicodeBlock forName(java.lang.String); + method public static java.lang.Character.UnicodeBlock of(char); + method public static java.lang.Character.UnicodeBlock of(int); + field public static final java.lang.Character.UnicodeBlock AEGEAN_NUMBERS; + field public static final java.lang.Character.UnicodeBlock ALPHABETIC_PRESENTATION_FORMS; + field public static final java.lang.Character.UnicodeBlock ARABIC; + field public static final java.lang.Character.UnicodeBlock ARABIC_PRESENTATION_FORMS_A; + field public static final java.lang.Character.UnicodeBlock ARABIC_PRESENTATION_FORMS_B; + field public static final java.lang.Character.UnicodeBlock ARMENIAN; + field public static final java.lang.Character.UnicodeBlock ARROWS; + field public static final java.lang.Character.UnicodeBlock BASIC_LATIN; + field public static final java.lang.Character.UnicodeBlock BENGALI; + field public static final java.lang.Character.UnicodeBlock BLOCK_ELEMENTS; + field public static final java.lang.Character.UnicodeBlock BOPOMOFO; + field public static final java.lang.Character.UnicodeBlock BOPOMOFO_EXTENDED; + field public static final java.lang.Character.UnicodeBlock BOX_DRAWING; + field public static final java.lang.Character.UnicodeBlock BRAILLE_PATTERNS; + field public static final java.lang.Character.UnicodeBlock BUHID; + field public static final java.lang.Character.UnicodeBlock BYZANTINE_MUSICAL_SYMBOLS; + field public static final java.lang.Character.UnicodeBlock CHEROKEE; + field public static final java.lang.Character.UnicodeBlock CJK_COMPATIBILITY; + field public static final java.lang.Character.UnicodeBlock CJK_COMPATIBILITY_FORMS; + field public static final java.lang.Character.UnicodeBlock CJK_COMPATIBILITY_IDEOGRAPHS; + field public static final java.lang.Character.UnicodeBlock CJK_COMPATIBILITY_IDEOGRAPHS_SUPPLEMENT; + field public static final java.lang.Character.UnicodeBlock CJK_RADICALS_SUPPLEMENT; + field public static final java.lang.Character.UnicodeBlock CJK_SYMBOLS_AND_PUNCTUATION; + field public static final java.lang.Character.UnicodeBlock CJK_UNIFIED_IDEOGRAPHS; + field public static final java.lang.Character.UnicodeBlock CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A; + field public static final java.lang.Character.UnicodeBlock CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B; + field public static final java.lang.Character.UnicodeBlock COMBINING_DIACRITICAL_MARKS; + field public static final java.lang.Character.UnicodeBlock COMBINING_HALF_MARKS; + field public static final java.lang.Character.UnicodeBlock COMBINING_MARKS_FOR_SYMBOLS; + field public static final java.lang.Character.UnicodeBlock CONTROL_PICTURES; + field public static final java.lang.Character.UnicodeBlock CURRENCY_SYMBOLS; + field public static final java.lang.Character.UnicodeBlock CYPRIOT_SYLLABARY; + field public static final java.lang.Character.UnicodeBlock CYRILLIC; + field public static final java.lang.Character.UnicodeBlock CYRILLIC_SUPPLEMENTARY; + field public static final java.lang.Character.UnicodeBlock DESERET; + field public static final java.lang.Character.UnicodeBlock DEVANAGARI; + field public static final java.lang.Character.UnicodeBlock DINGBATS; + field public static final java.lang.Character.UnicodeBlock ENCLOSED_ALPHANUMERICS; + field public static final java.lang.Character.UnicodeBlock ENCLOSED_CJK_LETTERS_AND_MONTHS; + field public static final java.lang.Character.UnicodeBlock ETHIOPIC; + field public static final java.lang.Character.UnicodeBlock GENERAL_PUNCTUATION; + field public static final java.lang.Character.UnicodeBlock GEOMETRIC_SHAPES; + field public static final java.lang.Character.UnicodeBlock GEORGIAN; + field public static final java.lang.Character.UnicodeBlock GOTHIC; + field public static final java.lang.Character.UnicodeBlock GREEK; + field public static final java.lang.Character.UnicodeBlock GREEK_EXTENDED; + field public static final java.lang.Character.UnicodeBlock GUJARATI; + field public static final java.lang.Character.UnicodeBlock GURMUKHI; + field public static final java.lang.Character.UnicodeBlock HALFWIDTH_AND_FULLWIDTH_FORMS; + field public static final java.lang.Character.UnicodeBlock HANGUL_COMPATIBILITY_JAMO; + field public static final java.lang.Character.UnicodeBlock HANGUL_JAMO; + field public static final java.lang.Character.UnicodeBlock HANGUL_SYLLABLES; + field public static final java.lang.Character.UnicodeBlock HANUNOO; + field public static final java.lang.Character.UnicodeBlock HEBREW; + field public static final java.lang.Character.UnicodeBlock HIGH_PRIVATE_USE_SURROGATES; + field public static final java.lang.Character.UnicodeBlock HIGH_SURROGATES; + field public static final java.lang.Character.UnicodeBlock HIRAGANA; + field public static final java.lang.Character.UnicodeBlock IDEOGRAPHIC_DESCRIPTION_CHARACTERS; + field public static final java.lang.Character.UnicodeBlock IPA_EXTENSIONS; + field public static final java.lang.Character.UnicodeBlock KANBUN; + field public static final java.lang.Character.UnicodeBlock KANGXI_RADICALS; + field public static final java.lang.Character.UnicodeBlock KANNADA; + field public static final java.lang.Character.UnicodeBlock KATAKANA; + field public static final java.lang.Character.UnicodeBlock KATAKANA_PHONETIC_EXTENSIONS; + field public static final java.lang.Character.UnicodeBlock KHMER; + field public static final java.lang.Character.UnicodeBlock KHMER_SYMBOLS; + field public static final java.lang.Character.UnicodeBlock LAO; + field public static final java.lang.Character.UnicodeBlock LATIN_1_SUPPLEMENT; + field public static final java.lang.Character.UnicodeBlock LATIN_EXTENDED_A; + field public static final java.lang.Character.UnicodeBlock LATIN_EXTENDED_ADDITIONAL; + field public static final java.lang.Character.UnicodeBlock LATIN_EXTENDED_B; + field public static final java.lang.Character.UnicodeBlock LETTERLIKE_SYMBOLS; + field public static final java.lang.Character.UnicodeBlock LIMBU; + field public static final java.lang.Character.UnicodeBlock LINEAR_B_IDEOGRAMS; + field public static final java.lang.Character.UnicodeBlock LINEAR_B_SYLLABARY; + field public static final java.lang.Character.UnicodeBlock LOW_SURROGATES; + field public static final java.lang.Character.UnicodeBlock MALAYALAM; + field public static final java.lang.Character.UnicodeBlock MATHEMATICAL_ALPHANUMERIC_SYMBOLS; + field public static final java.lang.Character.UnicodeBlock MATHEMATICAL_OPERATORS; + field public static final java.lang.Character.UnicodeBlock MISCELLANEOUS_MATHEMATICAL_SYMBOLS_A; + field public static final java.lang.Character.UnicodeBlock MISCELLANEOUS_MATHEMATICAL_SYMBOLS_B; + field public static final java.lang.Character.UnicodeBlock MISCELLANEOUS_SYMBOLS; + field public static final java.lang.Character.UnicodeBlock MISCELLANEOUS_SYMBOLS_AND_ARROWS; + field public static final java.lang.Character.UnicodeBlock MISCELLANEOUS_TECHNICAL; + field public static final java.lang.Character.UnicodeBlock MONGOLIAN; + field public static final java.lang.Character.UnicodeBlock MUSICAL_SYMBOLS; + field public static final java.lang.Character.UnicodeBlock MYANMAR; + field public static final java.lang.Character.UnicodeBlock NUMBER_FORMS; + field public static final java.lang.Character.UnicodeBlock OGHAM; + field public static final java.lang.Character.UnicodeBlock OLD_ITALIC; + field public static final java.lang.Character.UnicodeBlock OPTICAL_CHARACTER_RECOGNITION; + field public static final java.lang.Character.UnicodeBlock ORIYA; + field public static final java.lang.Character.UnicodeBlock OSMANYA; + field public static final java.lang.Character.UnicodeBlock PHONETIC_EXTENSIONS; + field public static final java.lang.Character.UnicodeBlock PRIVATE_USE_AREA; + field public static final java.lang.Character.UnicodeBlock RUNIC; + field public static final java.lang.Character.UnicodeBlock SHAVIAN; + field public static final java.lang.Character.UnicodeBlock SINHALA; + field public static final java.lang.Character.UnicodeBlock SMALL_FORM_VARIANTS; + field public static final java.lang.Character.UnicodeBlock SPACING_MODIFIER_LETTERS; + field public static final java.lang.Character.UnicodeBlock SPECIALS; + field public static final java.lang.Character.UnicodeBlock SUPERSCRIPTS_AND_SUBSCRIPTS; + field public static final java.lang.Character.UnicodeBlock SUPPLEMENTAL_ARROWS_A; + field public static final java.lang.Character.UnicodeBlock SUPPLEMENTAL_ARROWS_B; + field public static final java.lang.Character.UnicodeBlock SUPPLEMENTAL_MATHEMATICAL_OPERATORS; + field public static final java.lang.Character.UnicodeBlock SUPPLEMENTARY_PRIVATE_USE_AREA_A; + field public static final java.lang.Character.UnicodeBlock SUPPLEMENTARY_PRIVATE_USE_AREA_B; + field public static final deprecated java.lang.Character.UnicodeBlock SURROGATES_AREA; + field public static final java.lang.Character.UnicodeBlock SYRIAC; + field public static final java.lang.Character.UnicodeBlock TAGALOG; + field public static final java.lang.Character.UnicodeBlock TAGBANWA; + field public static final java.lang.Character.UnicodeBlock TAGS; + field public static final java.lang.Character.UnicodeBlock TAI_LE; + field public static final java.lang.Character.UnicodeBlock TAI_XUAN_JING_SYMBOLS; + field public static final java.lang.Character.UnicodeBlock TAMIL; + field public static final java.lang.Character.UnicodeBlock TELUGU; + field public static final java.lang.Character.UnicodeBlock THAANA; + field public static final java.lang.Character.UnicodeBlock THAI; + field public static final java.lang.Character.UnicodeBlock TIBETAN; + field public static final java.lang.Character.UnicodeBlock UGARITIC; + field public static final java.lang.Character.UnicodeBlock UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS; + field public static final java.lang.Character.UnicodeBlock VARIATION_SELECTORS; + field public static final java.lang.Character.UnicodeBlock VARIATION_SELECTORS_SUPPLEMENT; + field public static final java.lang.Character.UnicodeBlock YIJING_HEXAGRAM_SYMBOLS; + field public static final java.lang.Character.UnicodeBlock YI_RADICALS; + field public static final java.lang.Character.UnicodeBlock YI_SYLLABLES; + } + + public final class Class implements java.lang.reflect.AnnotatedElement java.lang.reflect.GenericDeclaration java.io.Serializable java.lang.reflect.Type { + method public java.lang.Class asSubclass(java.lang.Class); + method public T cast(java.lang.Object); + method public boolean desiredAssertionStatus(); + method public static java.lang.Class forName(java.lang.String) throws java.lang.ClassNotFoundException; + method public static java.lang.Class forName(java.lang.String, boolean, java.lang.ClassLoader) throws java.lang.ClassNotFoundException; + method public A getAnnotation(java.lang.Class); + method public java.lang.annotation.Annotation[] getAnnotations(); + method public java.lang.String getCanonicalName(); + method public java.lang.ClassLoader getClassLoader(); + method public java.lang.Class[] getClasses(); + method public java.lang.Class getComponentType(); + method public java.lang.reflect.Constructor getConstructor(java.lang.Class...) throws java.lang.NoSuchMethodException; + method public java.lang.reflect.Constructor[] getConstructors(); + method public java.lang.annotation.Annotation[] getDeclaredAnnotations(); + method public java.lang.Class[] getDeclaredClasses(); + method public java.lang.reflect.Constructor getDeclaredConstructor(java.lang.Class...) throws java.lang.NoSuchMethodException; + method public java.lang.reflect.Constructor[] getDeclaredConstructors(); + method public java.lang.reflect.Field getDeclaredField(java.lang.String) throws java.lang.NoSuchFieldException; + method public java.lang.reflect.Field[] getDeclaredFields(); + method public java.lang.reflect.Method getDeclaredMethod(java.lang.String, java.lang.Class...) throws java.lang.NoSuchMethodException; + method public java.lang.reflect.Method[] getDeclaredMethods(); + method public java.lang.Class getDeclaringClass(); + method public java.lang.Class getEnclosingClass(); + method public java.lang.reflect.Constructor getEnclosingConstructor(); + method public java.lang.reflect.Method getEnclosingMethod(); + method public T[] getEnumConstants(); + method public java.lang.reflect.Field getField(java.lang.String) throws java.lang.NoSuchFieldException; + method public java.lang.reflect.Field[] getFields(); + method public java.lang.reflect.Type[] getGenericInterfaces(); + method public java.lang.reflect.Type getGenericSuperclass(); + method public java.lang.Class[] getInterfaces(); + method public java.lang.reflect.Method getMethod(java.lang.String, java.lang.Class...) throws java.lang.NoSuchMethodException; + method public java.lang.reflect.Method[] getMethods(); + method public int getModifiers(); + method public java.lang.String getName(); + method public java.lang.Package getPackage(); + method public java.security.ProtectionDomain getProtectionDomain(); + method public java.net.URL getResource(java.lang.String); + method public java.io.InputStream getResourceAsStream(java.lang.String); + method public java.lang.Object[] getSigners(); + method public java.lang.String getSimpleName(); + method public java.lang.Class getSuperclass(); + method public synchronized java.lang.reflect.TypeVariable>[] getTypeParameters(); + method public boolean isAnnotation(); + method public boolean isAnnotationPresent(java.lang.Class); + method public boolean isAnonymousClass(); + method public boolean isArray(); + method public boolean isAssignableFrom(java.lang.Class); + method public boolean isEnum(); + method public boolean isInstance(java.lang.Object); + method public boolean isInterface(); + method public boolean isLocalClass(); + method public boolean isMemberClass(); + method public boolean isPrimitive(); + method public boolean isSynthetic(); + method public T newInstance() throws java.lang.IllegalAccessException, java.lang.InstantiationException; + } + + public class ClassCastException extends java.lang.RuntimeException { + ctor public ClassCastException(); + ctor public ClassCastException(java.lang.String); + } + + public class ClassCircularityError extends java.lang.LinkageError { + ctor public ClassCircularityError(); + ctor public ClassCircularityError(java.lang.String); + } + + public class ClassFormatError extends java.lang.LinkageError { + ctor public ClassFormatError(); + ctor public ClassFormatError(java.lang.String); + } + + public abstract class ClassLoader { + ctor protected ClassLoader(); + ctor protected ClassLoader(java.lang.ClassLoader); + method public void clearAssertionStatus(); + method protected final deprecated java.lang.Class defineClass(byte[], int, int) throws java.lang.ClassFormatError; + method protected final java.lang.Class defineClass(java.lang.String, byte[], int, int) throws java.lang.ClassFormatError; + method protected final java.lang.Class defineClass(java.lang.String, byte[], int, int, java.security.ProtectionDomain) throws java.lang.ClassFormatError; + method protected final java.lang.Class defineClass(java.lang.String, java.nio.ByteBuffer, java.security.ProtectionDomain) throws java.lang.ClassFormatError; + method protected java.lang.Package definePackage(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.net.URL) throws java.lang.IllegalArgumentException; + method protected java.lang.Class findClass(java.lang.String) throws java.lang.ClassNotFoundException; + method protected java.lang.String findLibrary(java.lang.String); + method protected final java.lang.Class findLoadedClass(java.lang.String); + method protected java.net.URL findResource(java.lang.String); + method protected java.util.Enumeration findResources(java.lang.String) throws java.io.IOException; + method protected final java.lang.Class findSystemClass(java.lang.String) throws java.lang.ClassNotFoundException; + method protected java.lang.Package getPackage(java.lang.String); + method protected java.lang.Package[] getPackages(); + method public final java.lang.ClassLoader getParent(); + method public java.net.URL getResource(java.lang.String); + method public java.io.InputStream getResourceAsStream(java.lang.String); + method public java.util.Enumeration getResources(java.lang.String) throws java.io.IOException; + method public static java.lang.ClassLoader getSystemClassLoader(); + method public static java.net.URL getSystemResource(java.lang.String); + method public static java.io.InputStream getSystemResourceAsStream(java.lang.String); + method public static java.util.Enumeration getSystemResources(java.lang.String) throws java.io.IOException; + method public java.lang.Class loadClass(java.lang.String) throws java.lang.ClassNotFoundException; + method protected java.lang.Class loadClass(java.lang.String, boolean) throws java.lang.ClassNotFoundException; + method protected final void resolveClass(java.lang.Class); + method public void setClassAssertionStatus(java.lang.String, boolean); + method public void setDefaultAssertionStatus(boolean); + method public void setPackageAssertionStatus(java.lang.String, boolean); + method protected final void setSigners(java.lang.Class, java.lang.Object[]); + } + + public class ClassNotFoundException extends java.lang.Exception { + ctor public ClassNotFoundException(); + ctor public ClassNotFoundException(java.lang.String); + ctor public ClassNotFoundException(java.lang.String, java.lang.Throwable); + method public java.lang.Throwable getException(); + } + + public class CloneNotSupportedException extends java.lang.Exception { + ctor public CloneNotSupportedException(); + ctor public CloneNotSupportedException(java.lang.String); + } + + public abstract interface Cloneable { + } + + public abstract interface Comparable { + method public abstract int compareTo(T); + } + + public final class Compiler { + method public static java.lang.Object command(java.lang.Object); + method public static boolean compileClass(java.lang.Class); + method public static boolean compileClasses(java.lang.String); + method public static void disable(); + method public static void enable(); + } + + public abstract class Deprecated implements java.lang.annotation.Annotation { + } + + public final class Double extends java.lang.Number implements java.lang.Comparable { + ctor public Double(double); + ctor public Double(java.lang.String) throws java.lang.NumberFormatException; + method public static int compare(double, double); + method public int compareTo(java.lang.Double); + method public static long doubleToLongBits(double); + method public static long doubleToRawLongBits(double); + method public double doubleValue(); + method public float floatValue(); + method public int intValue(); + method public boolean isInfinite(); + method public static boolean isInfinite(double); + method public boolean isNaN(); + method public static boolean isNaN(double); + method public static double longBitsToDouble(long); + method public long longValue(); + method public static double parseDouble(java.lang.String) throws java.lang.NumberFormatException; + method public static java.lang.String toHexString(double); + method public static java.lang.String toString(double); + method public static java.lang.Double valueOf(java.lang.String) throws java.lang.NumberFormatException; + method public static java.lang.Double valueOf(double); + field public static final int MAX_EXPONENT = 1023; // 0x3ff + field public static final double MAX_VALUE = 1.7976931348623157E308; + field public static final int MIN_EXPONENT = -1022; // 0xfffffc02 + field public static final double MIN_NORMAL = 2.2250738585072014E-308; + field public static final double MIN_VALUE = 4.9E-324; + field public static final double NEGATIVE_INFINITY = (-1.0/0.0); + field public static final double NaN = (0.0/0.0); + field public static final double POSITIVE_INFINITY = (1.0/0.0); + field public static final int SIZE = 64; // 0x40 + field public static final java.lang.Class TYPE; + } + + public abstract class Enum implements java.lang.Comparable java.io.Serializable { + ctor protected Enum(java.lang.String, int); + method protected final java.lang.Object clone() throws java.lang.CloneNotSupportedException; + method public final int compareTo(E); + method public final boolean equals(java.lang.Object); + method protected final void finalize(); + method public final java.lang.Class getDeclaringClass(); + method public final int hashCode(); + method public final java.lang.String name(); + method public final int ordinal(); + method public static T valueOf(java.lang.Class, java.lang.String); + } + + public class EnumConstantNotPresentException extends java.lang.RuntimeException { + ctor public EnumConstantNotPresentException(java.lang.Class, java.lang.String); + method public java.lang.String constantName(); + method public java.lang.Class enumType(); + } + + public class Error extends java.lang.Throwable { + ctor public Error(); + ctor public Error(java.lang.String); + ctor public Error(java.lang.String, java.lang.Throwable); + ctor public Error(java.lang.Throwable); + } + + public class Exception extends java.lang.Throwable { + ctor public Exception(); + ctor public Exception(java.lang.String); + ctor public Exception(java.lang.String, java.lang.Throwable); + ctor public Exception(java.lang.Throwable); + } + + public class ExceptionInInitializerError extends java.lang.LinkageError { + ctor public ExceptionInInitializerError(); + ctor public ExceptionInInitializerError(java.lang.String); + ctor public ExceptionInInitializerError(java.lang.Throwable); + method public java.lang.Throwable getException(); + } + + public final class Float extends java.lang.Number implements java.lang.Comparable { + ctor public Float(float); + ctor public Float(double); + ctor public Float(java.lang.String) throws java.lang.NumberFormatException; + method public static int compare(float, float); + method public int compareTo(java.lang.Float); + method public double doubleValue(); + method public static int floatToIntBits(float); + method public static int floatToRawIntBits(float); + method public float floatValue(); + method public static float intBitsToFloat(int); + method public int intValue(); + method public boolean isInfinite(); + method public static boolean isInfinite(float); + method public boolean isNaN(); + method public static boolean isNaN(float); + method public long longValue(); + method public static float parseFloat(java.lang.String) throws java.lang.NumberFormatException; + method public static java.lang.String toHexString(float); + method public static java.lang.String toString(float); + method public static java.lang.Float valueOf(java.lang.String) throws java.lang.NumberFormatException; + method public static java.lang.Float valueOf(float); + field public static final int MAX_EXPONENT = 127; // 0x7f + field public static final float MAX_VALUE = 3.4028235E38f; + field public static final int MIN_EXPONENT = -126; // 0xffffff82 + field public static final float MIN_NORMAL = 1.17549435E-38f; + field public static final float MIN_VALUE = 1.4E-45f; + field public static final float NEGATIVE_INFINITY = (-1.0f/0.0f); + field public static final float NaN = (0.0f/0.0f); + field public static final float POSITIVE_INFINITY = (1.0f/0.0f); + field public static final int SIZE = 32; // 0x20 + field public static final java.lang.Class TYPE; + } + + public class IllegalAccessError extends java.lang.IncompatibleClassChangeError { + ctor public IllegalAccessError(); + ctor public IllegalAccessError(java.lang.String); + } + + public class IllegalAccessException extends java.lang.Exception { + ctor public IllegalAccessException(); + ctor public IllegalAccessException(java.lang.String); + } + + public class IllegalArgumentException extends java.lang.RuntimeException { + ctor public IllegalArgumentException(); + ctor public IllegalArgumentException(java.lang.String); + ctor public IllegalArgumentException(java.lang.String, java.lang.Throwable); + ctor public IllegalArgumentException(java.lang.Throwable); + } + + public class IllegalMonitorStateException extends java.lang.RuntimeException { + ctor public IllegalMonitorStateException(); + ctor public IllegalMonitorStateException(java.lang.String); + } + + public class IllegalStateException extends java.lang.RuntimeException { + ctor public IllegalStateException(); + ctor public IllegalStateException(java.lang.String); + ctor public IllegalStateException(java.lang.String, java.lang.Throwable); + ctor public IllegalStateException(java.lang.Throwable); + } + + public class IllegalThreadStateException extends java.lang.IllegalArgumentException { + ctor public IllegalThreadStateException(); + ctor public IllegalThreadStateException(java.lang.String); + } + + public class IncompatibleClassChangeError extends java.lang.LinkageError { + ctor public IncompatibleClassChangeError(); + ctor public IncompatibleClassChangeError(java.lang.String); + } + + public class IndexOutOfBoundsException extends java.lang.RuntimeException { + ctor public IndexOutOfBoundsException(); + ctor public IndexOutOfBoundsException(java.lang.String); + } + + public class InheritableThreadLocal extends java.lang.ThreadLocal { + ctor public InheritableThreadLocal(); + method protected T childValue(T); + } + + public class InstantiationError extends java.lang.IncompatibleClassChangeError { + ctor public InstantiationError(); + ctor public InstantiationError(java.lang.String); + } + + public class InstantiationException extends java.lang.Exception { + ctor public InstantiationException(); + ctor public InstantiationException(java.lang.String); + } + + public final class Integer extends java.lang.Number implements java.lang.Comparable { + ctor public Integer(int); + ctor public Integer(java.lang.String) throws java.lang.NumberFormatException; + method public static int bitCount(int); + method public int compareTo(java.lang.Integer); + method public static java.lang.Integer decode(java.lang.String) throws java.lang.NumberFormatException; + method public double doubleValue(); + method public float floatValue(); + method public static java.lang.Integer getInteger(java.lang.String); + method public static java.lang.Integer getInteger(java.lang.String, int); + method public static java.lang.Integer getInteger(java.lang.String, java.lang.Integer); + method public static int highestOneBit(int); + method public int intValue(); + method public long longValue(); + method public static int lowestOneBit(int); + method public static int numberOfLeadingZeros(int); + method public static int numberOfTrailingZeros(int); + method public static int parseInt(java.lang.String) throws java.lang.NumberFormatException; + method public static int parseInt(java.lang.String, int) throws java.lang.NumberFormatException; + method public static int reverse(int); + method public static int reverseBytes(int); + method public static int rotateLeft(int, int); + method public static int rotateRight(int, int); + method public static int signum(int); + method public static java.lang.String toBinaryString(int); + method public static java.lang.String toHexString(int); + method public static java.lang.String toOctalString(int); + method public static java.lang.String toString(int); + method public static java.lang.String toString(int, int); + method public static java.lang.Integer valueOf(java.lang.String) throws java.lang.NumberFormatException; + method public static java.lang.Integer valueOf(java.lang.String, int) throws java.lang.NumberFormatException; + method public static java.lang.Integer valueOf(int); + field public static final int MAX_VALUE = 2147483647; // 0x7fffffff + field public static final int MIN_VALUE = -2147483648; // 0x80000000 + field public static final int SIZE = 32; // 0x20 + field public static final java.lang.Class TYPE; + } + + public class InternalError extends java.lang.VirtualMachineError { + ctor public InternalError(); + ctor public InternalError(java.lang.String); + } + + public class InterruptedException extends java.lang.Exception { + ctor public InterruptedException(); + ctor public InterruptedException(java.lang.String); + } + + public abstract interface Iterable { + method public abstract java.util.Iterator iterator(); + } + + public class LinkageError extends java.lang.Error { + ctor public LinkageError(); + ctor public LinkageError(java.lang.String); + } + + public final class Long extends java.lang.Number implements java.lang.Comparable { + ctor public Long(long); + ctor public Long(java.lang.String) throws java.lang.NumberFormatException; + method public static int bitCount(long); + method public int compareTo(java.lang.Long); + method public static java.lang.Long decode(java.lang.String) throws java.lang.NumberFormatException; + method public double doubleValue(); + method public float floatValue(); + method public static java.lang.Long getLong(java.lang.String); + method public static java.lang.Long getLong(java.lang.String, long); + method public static java.lang.Long getLong(java.lang.String, java.lang.Long); + method public static long highestOneBit(long); + method public int intValue(); + method public long longValue(); + method public static long lowestOneBit(long); + method public static int numberOfLeadingZeros(long); + method public static int numberOfTrailingZeros(long); + method public static long parseLong(java.lang.String) throws java.lang.NumberFormatException; + method public static long parseLong(java.lang.String, int) throws java.lang.NumberFormatException; + method public static long reverse(long); + method public static long reverseBytes(long); + method public static long rotateLeft(long, int); + method public static long rotateRight(long, int); + method public static int signum(long); + method public static java.lang.String toBinaryString(long); + method public static java.lang.String toHexString(long); + method public static java.lang.String toOctalString(long); + method public static java.lang.String toString(long); + method public static java.lang.String toString(long, int); + method public static java.lang.Long valueOf(java.lang.String) throws java.lang.NumberFormatException; + method public static java.lang.Long valueOf(java.lang.String, int) throws java.lang.NumberFormatException; + method public static java.lang.Long valueOf(long); + field public static final long MAX_VALUE = 9223372036854775807L; // 0x7fffffffffffffffL + field public static final long MIN_VALUE = -9223372036854775808L; // 0x8000000000000000L + field public static final int SIZE = 64; // 0x40 + field public static final java.lang.Class TYPE; + } + + public final class Math { + method public static double IEEEremainder(double, double); + method public static double abs(double); + method public static float abs(float); + method public static int abs(int); + method public static long abs(long); + method public static double acos(double); + method public static double asin(double); + method public static double atan(double); + method public static double atan2(double, double); + method public static double cbrt(double); + method public static double ceil(double); + method public static double copySign(double, double); + method public static float copySign(float, float); + method public static double cos(double); + method public static double cosh(double); + method public static double exp(double); + method public static double expm1(double); + method public static double floor(double); + method public static int getExponent(float); + method public static int getExponent(double); + method public static double hypot(double, double); + method public static double log(double); + method public static double log10(double); + method public static double log1p(double); + method public static double max(double, double); + method public static float max(float, float); + method public static int max(int, int); + method public static long max(long, long); + method public static double min(double, double); + method public static float min(float, float); + method public static int min(int, int); + method public static long min(long, long); + method public static double nextAfter(double, double); + method public static float nextAfter(float, double); + method public static double nextUp(double); + method public static float nextUp(float); + method public static double pow(double, double); + method public static synchronized double random(); + method public static double rint(double); + method public static long round(double); + method public static int round(float); + method public static double scalb(double, int); + method public static float scalb(float, int); + method public static double signum(double); + method public static float signum(float); + method public static double sin(double); + method public static double sinh(double); + method public static double sqrt(double); + method public static double tan(double); + method public static double tanh(double); + method public static double toDegrees(double); + method public static double toRadians(double); + method public static double ulp(double); + method public static float ulp(float); + field public static final double E = 2.718281828459045; + field public static final double PI = 3.141592653589793; + } + + public class NegativeArraySizeException extends java.lang.RuntimeException { + ctor public NegativeArraySizeException(); + ctor public NegativeArraySizeException(java.lang.String); + } + + public class NoClassDefFoundError extends java.lang.LinkageError { + ctor public NoClassDefFoundError(); + ctor public NoClassDefFoundError(java.lang.String); + } + + public class NoSuchFieldError extends java.lang.IncompatibleClassChangeError { + ctor public NoSuchFieldError(); + ctor public NoSuchFieldError(java.lang.String); + } + + public class NoSuchFieldException extends java.lang.Exception { + ctor public NoSuchFieldException(); + ctor public NoSuchFieldException(java.lang.String); + } + + public class NoSuchMethodError extends java.lang.IncompatibleClassChangeError { + ctor public NoSuchMethodError(); + ctor public NoSuchMethodError(java.lang.String); + } + + public class NoSuchMethodException extends java.lang.Exception { + ctor public NoSuchMethodException(); + ctor public NoSuchMethodException(java.lang.String); + } + + public class NullPointerException extends java.lang.RuntimeException { + ctor public NullPointerException(); + ctor public NullPointerException(java.lang.String); + } + + public abstract class Number implements java.io.Serializable { + ctor public Number(); + method public byte byteValue(); + method public abstract double doubleValue(); + method public abstract float floatValue(); + method public abstract int intValue(); + method public abstract long longValue(); + method public short shortValue(); + } + + public class NumberFormatException extends java.lang.IllegalArgumentException { + ctor public NumberFormatException(); + ctor public NumberFormatException(java.lang.String); + } + + public class Object { + ctor public Object(); + method protected java.lang.Object clone() throws java.lang.CloneNotSupportedException; + method public boolean equals(java.lang.Object); + method protected void finalize() throws java.lang.Throwable; + method public final java.lang.Class getClass(); + method public int hashCode(); + method public final void notify(); + method public final void notifyAll(); + method public java.lang.String toString(); + method public final void wait() throws java.lang.InterruptedException; + method public final void wait(long) throws java.lang.InterruptedException; + method public final void wait(long, int) throws java.lang.InterruptedException; + } + + public class OutOfMemoryError extends java.lang.VirtualMachineError { + ctor public OutOfMemoryError(); + ctor public OutOfMemoryError(java.lang.String); + } + + public abstract class Override implements java.lang.annotation.Annotation { + } + + public class Package implements java.lang.reflect.AnnotatedElement { + method public A getAnnotation(java.lang.Class); + method public java.lang.annotation.Annotation[] getAnnotations(); + method public java.lang.annotation.Annotation[] getDeclaredAnnotations(); + method public java.lang.String getImplementationTitle(); + method public java.lang.String getImplementationVendor(); + method public java.lang.String getImplementationVersion(); + method public java.lang.String getName(); + method public static java.lang.Package getPackage(java.lang.String); + method public static java.lang.Package[] getPackages(); + method public java.lang.String getSpecificationTitle(); + method public java.lang.String getSpecificationVendor(); + method public java.lang.String getSpecificationVersion(); + method public boolean isAnnotationPresent(java.lang.Class); + method public boolean isCompatibleWith(java.lang.String) throws java.lang.NumberFormatException; + method public boolean isSealed(); + method public boolean isSealed(java.net.URL); + } + + public abstract class Process { + ctor public Process(); + method public abstract void destroy(); + method public abstract int exitValue(); + method public abstract java.io.InputStream getErrorStream(); + method public abstract java.io.InputStream getInputStream(); + method public abstract java.io.OutputStream getOutputStream(); + method public abstract int waitFor() throws java.lang.InterruptedException; + } + + public final class ProcessBuilder { + ctor public ProcessBuilder(java.lang.String...); + ctor public ProcessBuilder(java.util.List); + method public java.util.List command(); + method public java.lang.ProcessBuilder command(java.lang.String...); + method public java.lang.ProcessBuilder command(java.util.List); + method public java.io.File directory(); + method public java.lang.ProcessBuilder directory(java.io.File); + method public java.util.Map environment(); + method public boolean redirectErrorStream(); + method public java.lang.ProcessBuilder redirectErrorStream(boolean); + method public java.lang.Process start() throws java.io.IOException; + } + + public abstract interface Readable { + method public abstract int read(java.nio.CharBuffer) throws java.io.IOException; + } + + public abstract interface Runnable { + method public abstract void run(); + } + + public class Runtime { + method public void addShutdownHook(java.lang.Thread); + method public int availableProcessors(); + method public java.lang.Process exec(java.lang.String[]) throws java.io.IOException; + method public java.lang.Process exec(java.lang.String[], java.lang.String[]) throws java.io.IOException; + method public java.lang.Process exec(java.lang.String[], java.lang.String[], java.io.File) throws java.io.IOException; + method public java.lang.Process exec(java.lang.String) throws java.io.IOException; + method public java.lang.Process exec(java.lang.String, java.lang.String[]) throws java.io.IOException; + method public java.lang.Process exec(java.lang.String, java.lang.String[], java.io.File) throws java.io.IOException; + method public void exit(int); + method public long freeMemory(); + method public void gc(); + method public deprecated java.io.InputStream getLocalizedInputStream(java.io.InputStream); + method public deprecated java.io.OutputStream getLocalizedOutputStream(java.io.OutputStream); + method public static java.lang.Runtime getRuntime(); + method public void halt(int); + method public void load(java.lang.String); + method public void loadLibrary(java.lang.String); + method public long maxMemory(); + method public boolean removeShutdownHook(java.lang.Thread); + method public void runFinalization(); + method public static deprecated void runFinalizersOnExit(boolean); + method public long totalMemory(); + method public void traceInstructions(boolean); + method public void traceMethodCalls(boolean); + } + + public class RuntimeException extends java.lang.Exception { + ctor public RuntimeException(); + ctor public RuntimeException(java.lang.String); + ctor public RuntimeException(java.lang.String, java.lang.Throwable); + ctor public RuntimeException(java.lang.Throwable); + } + + public final class RuntimePermission extends java.security.BasicPermission { + ctor public RuntimePermission(java.lang.String); + ctor public RuntimePermission(java.lang.String, java.lang.String); + } + + public class SecurityException extends java.lang.RuntimeException { + ctor public SecurityException(); + ctor public SecurityException(java.lang.String); + ctor public SecurityException(java.lang.String, java.lang.Throwable); + ctor public SecurityException(java.lang.Throwable); + } + + public class SecurityManager { + ctor public SecurityManager(); + method public void checkAccept(java.lang.String, int); + method public void checkAccess(java.lang.Thread); + method public void checkAccess(java.lang.ThreadGroup); + method public void checkAwtEventQueueAccess(); + method public void checkConnect(java.lang.String, int); + method public void checkConnect(java.lang.String, int, java.lang.Object); + method public void checkCreateClassLoader(); + method public void checkDelete(java.lang.String); + method public void checkExec(java.lang.String); + method public void checkExit(int); + method public void checkLink(java.lang.String); + method public void checkListen(int); + method public void checkMemberAccess(java.lang.Class, int); + method public void checkMulticast(java.net.InetAddress); + method public deprecated void checkMulticast(java.net.InetAddress, byte); + method public void checkPackageAccess(java.lang.String); + method public void checkPackageDefinition(java.lang.String); + method public void checkPermission(java.security.Permission); + method public void checkPermission(java.security.Permission, java.lang.Object); + method public void checkPrintJobAccess(); + method public void checkPropertiesAccess(); + method public void checkPropertyAccess(java.lang.String); + method public void checkRead(java.io.FileDescriptor); + method public void checkRead(java.lang.String); + method public void checkRead(java.lang.String, java.lang.Object); + method public void checkSecurityAccess(java.lang.String); + method public void checkSetFactory(); + method public void checkSystemClipboardAccess(); + method public boolean checkTopLevelWindow(java.lang.Object); + method public void checkWrite(java.io.FileDescriptor); + method public void checkWrite(java.lang.String); + method protected deprecated int classDepth(java.lang.String); + method protected deprecated int classLoaderDepth(); + method protected deprecated java.lang.ClassLoader currentClassLoader(); + method protected deprecated java.lang.Class currentLoadedClass(); + method protected java.lang.Class[] getClassContext(); + method public deprecated boolean getInCheck(); + method public java.lang.Object getSecurityContext(); + method public java.lang.ThreadGroup getThreadGroup(); + method protected deprecated boolean inClass(java.lang.String); + method protected deprecated boolean inClassLoader(); + field protected deprecated boolean inCheck; + } + + public final class Short extends java.lang.Number implements java.lang.Comparable { + ctor public Short(java.lang.String) throws java.lang.NumberFormatException; + ctor public Short(short); + method public int compareTo(java.lang.Short); + method public static java.lang.Short decode(java.lang.String) throws java.lang.NumberFormatException; + method public double doubleValue(); + method public float floatValue(); + method public int intValue(); + method public long longValue(); + method public static short parseShort(java.lang.String) throws java.lang.NumberFormatException; + method public static short parseShort(java.lang.String, int) throws java.lang.NumberFormatException; + method public static short reverseBytes(short); + method public static java.lang.String toString(short); + method public static java.lang.Short valueOf(java.lang.String) throws java.lang.NumberFormatException; + method public static java.lang.Short valueOf(java.lang.String, int) throws java.lang.NumberFormatException; + method public static java.lang.Short valueOf(short); + field public static final short MAX_VALUE = 32767; // 0x7fff + field public static final short MIN_VALUE = -32768; // 0xffff8000 + field public static final int SIZE = 16; // 0x10 + field public static final java.lang.Class TYPE; + } + + public class StackOverflowError extends java.lang.VirtualMachineError { + ctor public StackOverflowError(); + ctor public StackOverflowError(java.lang.String); + } + + public final class StackTraceElement implements java.io.Serializable { + ctor public StackTraceElement(java.lang.String, java.lang.String, java.lang.String, int); + method public java.lang.String getClassName(); + method public java.lang.String getFileName(); + method public int getLineNumber(); + method public java.lang.String getMethodName(); + method public boolean isNativeMethod(); + } + + public final class StrictMath { + method public static double IEEEremainder(double, double); + method public static double abs(double); + method public static float abs(float); + method public static int abs(int); + method public static long abs(long); + method public static double acos(double); + method public static double asin(double); + method public static double atan(double); + method public static double atan2(double, double); + method public static double cbrt(double); + method public static double ceil(double); + method public static double copySign(double, double); + method public static float copySign(float, float); + method public static double cos(double); + method public static double cosh(double); + method public static double exp(double); + method public static double expm1(double); + method public static double floor(double); + method public static int getExponent(float); + method public static int getExponent(double); + method public static double hypot(double, double); + method public static double log(double); + method public static double log10(double); + method public static double log1p(double); + method public static double max(double, double); + method public static float max(float, float); + method public static int max(int, int); + method public static long max(long, long); + method public static double min(double, double); + method public static float min(float, float); + method public static int min(int, int); + method public static long min(long, long); + method public static double nextAfter(double, double); + method public static float nextAfter(float, double); + method public static double nextUp(double); + method public static float nextUp(float); + method public static double pow(double, double); + method public static double random(); + method public static double rint(double); + method public static long round(double); + method public static int round(float); + method public static double scalb(double, int); + method public static float scalb(float, int); + method public static double signum(double); + method public static float signum(float); + method public static double sin(double); + method public static double sinh(double); + method public static double sqrt(double); + method public static double tan(double); + method public static double tanh(double); + method public static double toDegrees(double); + method public static double toRadians(double); + method public static double ulp(double); + method public static float ulp(float); + field public static final double E = 2.718281828459045; + field public static final double PI = 3.141592653589793; + } + + public final class String implements java.lang.CharSequence java.lang.Comparable java.io.Serializable { + ctor public String(); + ctor public String(byte[]); + ctor public deprecated String(byte[], int); + ctor public String(byte[], int, int); + ctor public deprecated String(byte[], int, int, int); + ctor public String(byte[], int, int, java.lang.String) throws java.io.UnsupportedEncodingException; + ctor public String(byte[], java.lang.String) throws java.io.UnsupportedEncodingException; + ctor public String(byte[], int, int, java.nio.charset.Charset); + ctor public String(byte[], java.nio.charset.Charset); + ctor public String(char[]); + ctor public String(char[], int, int); + ctor public String(java.lang.String); + ctor public String(java.lang.StringBuffer); + ctor public String(int[], int, int); + ctor public String(java.lang.StringBuilder); + method public char charAt(int); + method public int codePointAt(int); + method public int codePointBefore(int); + method public int codePointCount(int, int); + method public int compareTo(java.lang.String); + method public int compareToIgnoreCase(java.lang.String); + method public java.lang.String concat(java.lang.String); + method public boolean contains(java.lang.CharSequence); + method public boolean contentEquals(java.lang.StringBuffer); + method public boolean contentEquals(java.lang.CharSequence); + method public static java.lang.String copyValueOf(char[]); + method public static java.lang.String copyValueOf(char[], int, int); + method public boolean endsWith(java.lang.String); + method public boolean equalsIgnoreCase(java.lang.String); + method public static java.lang.String format(java.lang.String, java.lang.Object...); + method public static java.lang.String format(java.util.Locale, java.lang.String, java.lang.Object...); + method public deprecated void getBytes(int, int, byte[], int); + method public byte[] getBytes(); + method public byte[] getBytes(java.lang.String) throws java.io.UnsupportedEncodingException; + method public byte[] getBytes(java.nio.charset.Charset); + method public void getChars(int, int, char[], int); + method public int indexOf(int); + method public int indexOf(int, int); + method public int indexOf(java.lang.String); + method public int indexOf(java.lang.String, int); + method public java.lang.String intern(); + method public boolean isEmpty(); + method public int lastIndexOf(int); + method public int lastIndexOf(int, int); + method public int lastIndexOf(java.lang.String); + method public int lastIndexOf(java.lang.String, int); + method public int length(); + method public boolean matches(java.lang.String); + method public int offsetByCodePoints(int, int); + method public boolean regionMatches(int, java.lang.String, int, int); + method public boolean regionMatches(boolean, int, java.lang.String, int, int); + method public java.lang.String replace(char, char); + method public java.lang.String replace(java.lang.CharSequence, java.lang.CharSequence); + method public java.lang.String replaceAll(java.lang.String, java.lang.String); + method public java.lang.String replaceFirst(java.lang.String, java.lang.String); + method public java.lang.String[] split(java.lang.String); + method public java.lang.String[] split(java.lang.String, int); + method public boolean startsWith(java.lang.String); + method public boolean startsWith(java.lang.String, int); + method public java.lang.CharSequence subSequence(int, int); + method public java.lang.String substring(int); + method public java.lang.String substring(int, int); + method public char[] toCharArray(); + method public java.lang.String toLowerCase(); + method public java.lang.String toLowerCase(java.util.Locale); + method public java.lang.String toUpperCase(); + method public java.lang.String toUpperCase(java.util.Locale); + method public java.lang.String trim(); + method public static java.lang.String valueOf(char[]); + method public static java.lang.String valueOf(char[], int, int); + method public static java.lang.String valueOf(char); + method public static java.lang.String valueOf(double); + method public static java.lang.String valueOf(float); + method public static java.lang.String valueOf(int); + method public static java.lang.String valueOf(long); + method public static java.lang.String valueOf(java.lang.Object); + method public static java.lang.String valueOf(boolean); + field public static final java.util.Comparator CASE_INSENSITIVE_ORDER; + } + + public final class StringBuffer extends java.lang.AbstractStringBuilder implements java.lang.Appendable java.lang.CharSequence java.io.Serializable { + ctor public StringBuffer(); + ctor public StringBuffer(int); + ctor public StringBuffer(java.lang.String); + ctor public StringBuffer(java.lang.CharSequence); + method public java.lang.StringBuffer append(boolean); + method public synchronized java.lang.StringBuffer append(char); + method public java.lang.StringBuffer append(double); + method public java.lang.StringBuffer append(float); + method public java.lang.StringBuffer append(int); + method public java.lang.StringBuffer append(long); + method public synchronized java.lang.StringBuffer append(java.lang.Object); + method public synchronized java.lang.StringBuffer append(java.lang.String); + method public synchronized java.lang.StringBuffer append(java.lang.StringBuffer); + method public synchronized java.lang.StringBuffer append(char[]); + method public synchronized java.lang.StringBuffer append(char[], int, int); + method public synchronized java.lang.StringBuffer append(java.lang.CharSequence); + method public synchronized java.lang.StringBuffer append(java.lang.CharSequence, int, int); + method public java.lang.StringBuffer appendCodePoint(int); + method public synchronized java.lang.StringBuffer delete(int, int); + method public synchronized java.lang.StringBuffer deleteCharAt(int); + method public synchronized java.lang.StringBuffer insert(int, char); + method public java.lang.StringBuffer insert(int, boolean); + method public java.lang.StringBuffer insert(int, int); + method public java.lang.StringBuffer insert(int, long); + method public java.lang.StringBuffer insert(int, double); + method public java.lang.StringBuffer insert(int, float); + method public java.lang.StringBuffer insert(int, java.lang.Object); + method public synchronized java.lang.StringBuffer insert(int, java.lang.String); + method public synchronized java.lang.StringBuffer insert(int, char[]); + method public synchronized java.lang.StringBuffer insert(int, char[], int, int); + method public synchronized java.lang.StringBuffer insert(int, java.lang.CharSequence); + method public synchronized java.lang.StringBuffer insert(int, java.lang.CharSequence, int, int); + method public synchronized java.lang.StringBuffer replace(int, int, java.lang.String); + method public synchronized java.lang.StringBuffer reverse(); + } + + public final class StringBuilder extends java.lang.AbstractStringBuilder implements java.lang.Appendable java.lang.CharSequence java.io.Serializable { + ctor public StringBuilder(); + ctor public StringBuilder(int); + ctor public StringBuilder(java.lang.CharSequence); + ctor public StringBuilder(java.lang.String); + method public java.lang.StringBuilder append(boolean); + method public java.lang.StringBuilder append(char); + method public java.lang.StringBuilder append(int); + method public java.lang.StringBuilder append(long); + method public java.lang.StringBuilder append(float); + method public java.lang.StringBuilder append(double); + method public java.lang.StringBuilder append(java.lang.Object); + method public java.lang.StringBuilder append(java.lang.String); + method public java.lang.StringBuilder append(java.lang.StringBuffer); + method public java.lang.StringBuilder append(char[]); + method public java.lang.StringBuilder append(char[], int, int); + method public java.lang.StringBuilder append(java.lang.CharSequence); + method public java.lang.StringBuilder append(java.lang.CharSequence, int, int); + method public java.lang.StringBuilder appendCodePoint(int); + method public java.lang.StringBuilder delete(int, int); + method public java.lang.StringBuilder deleteCharAt(int); + method public java.lang.StringBuilder insert(int, boolean); + method public java.lang.StringBuilder insert(int, char); + method public java.lang.StringBuilder insert(int, int); + method public java.lang.StringBuilder insert(int, long); + method public java.lang.StringBuilder insert(int, float); + method public java.lang.StringBuilder insert(int, double); + method public java.lang.StringBuilder insert(int, java.lang.Object); + method public java.lang.StringBuilder insert(int, java.lang.String); + method public java.lang.StringBuilder insert(int, char[]); + method public java.lang.StringBuilder insert(int, char[], int, int); + method public java.lang.StringBuilder insert(int, java.lang.CharSequence); + method public java.lang.StringBuilder insert(int, java.lang.CharSequence, int, int); + method public java.lang.StringBuilder replace(int, int, java.lang.String); + method public java.lang.StringBuilder reverse(); + } + + public class StringIndexOutOfBoundsException extends java.lang.IndexOutOfBoundsException { + ctor public StringIndexOutOfBoundsException(); + ctor public StringIndexOutOfBoundsException(int); + ctor public StringIndexOutOfBoundsException(java.lang.String); + } + + public abstract class SuppressWarnings implements java.lang.annotation.Annotation { + } + + public final class System { + method public static void arraycopy(java.lang.Object, int, java.lang.Object, int, int); + method public static java.lang.String clearProperty(java.lang.String); + method public static java.io.Console console(); + method public static long currentTimeMillis(); + method public static void exit(int); + method public static void gc(); + method public static java.util.Properties getProperties(); + method public static java.lang.String getProperty(java.lang.String); + method public static java.lang.String getProperty(java.lang.String, java.lang.String); + method public static java.lang.SecurityManager getSecurityManager(); + method public static java.lang.String getenv(java.lang.String); + method public static java.util.Map getenv(); + method public static int identityHashCode(java.lang.Object); + method public static java.nio.channels.Channel inheritedChannel() throws java.io.IOException; + method public static void load(java.lang.String); + method public static void loadLibrary(java.lang.String); + method public static java.lang.String mapLibraryName(java.lang.String); + method public static long nanoTime(); + method public static void runFinalization(); + method public static deprecated void runFinalizersOnExit(boolean); + method public static void setErr(java.io.PrintStream); + method public static void setIn(java.io.InputStream); + method public static void setOut(java.io.PrintStream); + method public static void setProperties(java.util.Properties); + method public static java.lang.String setProperty(java.lang.String, java.lang.String); + method public static void setSecurityManager(java.lang.SecurityManager); + field public static final java.io.PrintStream err; + field public static final java.io.InputStream in; + field public static final java.io.PrintStream out; + } + + public class Thread implements java.lang.Runnable { + ctor public Thread(); + ctor public Thread(java.lang.Runnable); + ctor public Thread(java.lang.Runnable, java.lang.String); + ctor public Thread(java.lang.String); + ctor public Thread(java.lang.ThreadGroup, java.lang.Runnable); + ctor public Thread(java.lang.ThreadGroup, java.lang.Runnable, java.lang.String); + ctor public Thread(java.lang.ThreadGroup, java.lang.String); + ctor public Thread(java.lang.ThreadGroup, java.lang.Runnable, java.lang.String, long); + method public static int activeCount(); + method public final void checkAccess(); + method public deprecated int countStackFrames(); + method public static java.lang.Thread currentThread(); + method public deprecated void destroy(); + method public static void dumpStack(); + method public static int enumerate(java.lang.Thread[]); + method public static java.util.Map getAllStackTraces(); + method public java.lang.ClassLoader getContextClassLoader(); + method public static java.lang.Thread.UncaughtExceptionHandler getDefaultUncaughtExceptionHandler(); + method public long getId(); + method public final java.lang.String getName(); + method public final int getPriority(); + method public java.lang.StackTraceElement[] getStackTrace(); + method public java.lang.Thread.State getState(); + method public final java.lang.ThreadGroup getThreadGroup(); + method public java.lang.Thread.UncaughtExceptionHandler getUncaughtExceptionHandler(); + method public static boolean holdsLock(java.lang.Object); + method public void interrupt(); + method public static boolean interrupted(); + method public final boolean isAlive(); + method public final boolean isDaemon(); + method public boolean isInterrupted(); + method public final void join() throws java.lang.InterruptedException; + method public final void join(long) throws java.lang.InterruptedException; + method public final void join(long, int) throws java.lang.InterruptedException; + method public final deprecated void resume(); + method public void run(); + method public void setContextClassLoader(java.lang.ClassLoader); + method public final void setDaemon(boolean); + method public static void setDefaultUncaughtExceptionHandler(java.lang.Thread.UncaughtExceptionHandler); + method public final void setName(java.lang.String); + method public final void setPriority(int); + method public void setUncaughtExceptionHandler(java.lang.Thread.UncaughtExceptionHandler); + method public static void sleep(long) throws java.lang.InterruptedException; + method public static void sleep(long, int) throws java.lang.InterruptedException; + method public synchronized void start(); + method public final deprecated void stop(); + method public final deprecated synchronized void stop(java.lang.Throwable); + method public final deprecated void suspend(); + method public static void yield(); + field public static final int MAX_PRIORITY = 10; // 0xa + field public static final int MIN_PRIORITY = 1; // 0x1 + field public static final int NORM_PRIORITY = 5; // 0x5 + } + + public static final class Thread.State extends java.lang.Enum { + method public static java.lang.Thread.State valueOf(java.lang.String); + method public static final java.lang.Thread.State[] values(); + enum_constant public static final java.lang.Thread.State BLOCKED; + enum_constant public static final java.lang.Thread.State NEW; + enum_constant public static final java.lang.Thread.State RUNNABLE; + enum_constant public static final java.lang.Thread.State TERMINATED; + enum_constant public static final java.lang.Thread.State TIMED_WAITING; + enum_constant public static final java.lang.Thread.State WAITING; + } + + public static abstract interface Thread.UncaughtExceptionHandler { + method public abstract void uncaughtException(java.lang.Thread, java.lang.Throwable); + } + + public class ThreadDeath extends java.lang.Error { + ctor public ThreadDeath(); + } + + public class ThreadGroup implements java.lang.Thread.UncaughtExceptionHandler { + ctor public ThreadGroup(java.lang.String); + ctor public ThreadGroup(java.lang.ThreadGroup, java.lang.String); + method public int activeCount(); + method public int activeGroupCount(); + method public deprecated boolean allowThreadSuspension(boolean); + method public final void checkAccess(); + method public final void destroy(); + method public int enumerate(java.lang.Thread[]); + method public int enumerate(java.lang.Thread[], boolean); + method public int enumerate(java.lang.ThreadGroup[]); + method public int enumerate(java.lang.ThreadGroup[], boolean); + method public final int getMaxPriority(); + method public final java.lang.String getName(); + method public final java.lang.ThreadGroup getParent(); + method public final void interrupt(); + method public final boolean isDaemon(); + method public synchronized boolean isDestroyed(); + method public void list(); + method public final boolean parentOf(java.lang.ThreadGroup); + method public final deprecated void resume(); + method public final void setDaemon(boolean); + method public final void setMaxPriority(int); + method public final deprecated void stop(); + method public final deprecated void suspend(); + method public void uncaughtException(java.lang.Thread, java.lang.Throwable); + } + + public class ThreadLocal { + ctor public ThreadLocal(); + method public T get(); + method protected T initialValue(); + method public void remove(); + method public void set(T); + } + + public class Throwable implements java.io.Serializable { + ctor public Throwable(); + ctor public Throwable(java.lang.String); + ctor public Throwable(java.lang.String, java.lang.Throwable); + ctor public Throwable(java.lang.Throwable); + method public java.lang.Throwable fillInStackTrace(); + method public java.lang.Throwable getCause(); + method public java.lang.String getLocalizedMessage(); + method public java.lang.String getMessage(); + method public java.lang.StackTraceElement[] getStackTrace(); + method public java.lang.Throwable initCause(java.lang.Throwable); + method public void printStackTrace(); + method public void printStackTrace(java.io.PrintStream); + method public void printStackTrace(java.io.PrintWriter); + method public void setStackTrace(java.lang.StackTraceElement[]); + } + + public class TypeNotPresentException extends java.lang.RuntimeException { + ctor public TypeNotPresentException(java.lang.String, java.lang.Throwable); + method public java.lang.String typeName(); + } + + public class UnknownError extends java.lang.VirtualMachineError { + ctor public UnknownError(); + ctor public UnknownError(java.lang.String); + } + + public class UnsatisfiedLinkError extends java.lang.LinkageError { + ctor public UnsatisfiedLinkError(); + ctor public UnsatisfiedLinkError(java.lang.String); + } + + public class UnsupportedClassVersionError extends java.lang.ClassFormatError { + ctor public UnsupportedClassVersionError(); + ctor public UnsupportedClassVersionError(java.lang.String); + } + + public class UnsupportedOperationException extends java.lang.RuntimeException { + ctor public UnsupportedOperationException(); + ctor public UnsupportedOperationException(java.lang.String); + ctor public UnsupportedOperationException(java.lang.String, java.lang.Throwable); + ctor public UnsupportedOperationException(java.lang.Throwable); + } + + public class VerifyError extends java.lang.LinkageError { + ctor public VerifyError(); + ctor public VerifyError(java.lang.String); + } + + public abstract class VirtualMachineError extends java.lang.Error { + ctor public VirtualMachineError(); + ctor public VirtualMachineError(java.lang.String); + } + + public final class Void { + field public static final java.lang.Class TYPE; + } + +} + +package java.lang.annotation { + + public abstract interface Annotation { + method public abstract java.lang.Class annotationType(); + method public abstract boolean equals(java.lang.Object); + method public abstract int hashCode(); + method public abstract java.lang.String toString(); + } + + public class AnnotationFormatError extends java.lang.Error { + ctor public AnnotationFormatError(java.lang.String); + ctor public AnnotationFormatError(java.lang.String, java.lang.Throwable); + ctor public AnnotationFormatError(java.lang.Throwable); + } + + public class AnnotationTypeMismatchException extends java.lang.RuntimeException { + ctor public AnnotationTypeMismatchException(java.lang.reflect.Method, java.lang.String); + method public java.lang.reflect.Method element(); + method public java.lang.String foundType(); + } + + public abstract class Documented implements java.lang.annotation.Annotation { + } + + public final class ElementType extends java.lang.Enum { + method public static java.lang.annotation.ElementType valueOf(java.lang.String); + method public static final java.lang.annotation.ElementType[] values(); + enum_constant public static final java.lang.annotation.ElementType ANNOTATION_TYPE; + enum_constant public static final java.lang.annotation.ElementType CONSTRUCTOR; + enum_constant public static final java.lang.annotation.ElementType FIELD; + enum_constant public static final java.lang.annotation.ElementType LOCAL_VARIABLE; + enum_constant public static final java.lang.annotation.ElementType METHOD; + enum_constant public static final java.lang.annotation.ElementType PACKAGE; + enum_constant public static final java.lang.annotation.ElementType PARAMETER; + enum_constant public static final java.lang.annotation.ElementType TYPE; + } + + public class IncompleteAnnotationException extends java.lang.RuntimeException { + ctor public IncompleteAnnotationException(java.lang.Class, java.lang.String); + method public java.lang.Class annotationType(); + method public java.lang.String elementName(); + } + + public abstract class Inherited implements java.lang.annotation.Annotation { + } + + public abstract class Retention implements java.lang.annotation.Annotation { + } + + public final class RetentionPolicy extends java.lang.Enum { + method public static java.lang.annotation.RetentionPolicy valueOf(java.lang.String); + method public static final java.lang.annotation.RetentionPolicy[] values(); + enum_constant public static final java.lang.annotation.RetentionPolicy CLASS; + enum_constant public static final java.lang.annotation.RetentionPolicy RUNTIME; + enum_constant public static final java.lang.annotation.RetentionPolicy SOURCE; + } + + public abstract class Target implements java.lang.annotation.Annotation { + } + +} + +package java.lang.ref { + + public class PhantomReference extends java.lang.ref.Reference { + ctor public PhantomReference(T, java.lang.ref.ReferenceQueue); + } + + public abstract class Reference { + method public void clear(); + method public boolean enqueue(); + method public T get(); + method public boolean isEnqueued(); + } + + public class ReferenceQueue { + ctor public ReferenceQueue(); + method public synchronized java.lang.ref.Reference poll(); + method public java.lang.ref.Reference remove() throws java.lang.InterruptedException; + method public synchronized java.lang.ref.Reference remove(long) throws java.lang.InterruptedException; + } + + public class SoftReference extends java.lang.ref.Reference { + ctor public SoftReference(T); + ctor public SoftReference(T, java.lang.ref.ReferenceQueue); + } + + public class WeakReference extends java.lang.ref.Reference { + ctor public WeakReference(T); + ctor public WeakReference(T, java.lang.ref.ReferenceQueue); + } + +} + +package java.lang.reflect { + + public class AccessibleObject implements java.lang.reflect.AnnotatedElement { + ctor protected AccessibleObject(); + method public T getAnnotation(java.lang.Class); + method public java.lang.annotation.Annotation[] getAnnotations(); + method public java.lang.annotation.Annotation[] getDeclaredAnnotations(); + method public boolean isAccessible(); + method public boolean isAnnotationPresent(java.lang.Class); + method public static void setAccessible(java.lang.reflect.AccessibleObject[], boolean); + method public void setAccessible(boolean); + } + + public abstract interface AnnotatedElement { + method public abstract T getAnnotation(java.lang.Class); + method public abstract java.lang.annotation.Annotation[] getAnnotations(); + method public abstract java.lang.annotation.Annotation[] getDeclaredAnnotations(); + method public abstract boolean isAnnotationPresent(java.lang.Class); + } + + public final class Array { + method public static java.lang.Object get(java.lang.Object, int) throws java.lang.ArrayIndexOutOfBoundsException, java.lang.IllegalArgumentException; + method public static boolean getBoolean(java.lang.Object, int) throws java.lang.ArrayIndexOutOfBoundsException, java.lang.IllegalArgumentException; + method public static byte getByte(java.lang.Object, int) throws java.lang.ArrayIndexOutOfBoundsException, java.lang.IllegalArgumentException; + method public static char getChar(java.lang.Object, int) throws java.lang.ArrayIndexOutOfBoundsException, java.lang.IllegalArgumentException; + method public static double getDouble(java.lang.Object, int) throws java.lang.ArrayIndexOutOfBoundsException, java.lang.IllegalArgumentException; + method public static float getFloat(java.lang.Object, int) throws java.lang.ArrayIndexOutOfBoundsException, java.lang.IllegalArgumentException; + method public static int getInt(java.lang.Object, int) throws java.lang.ArrayIndexOutOfBoundsException, java.lang.IllegalArgumentException; + method public static int getLength(java.lang.Object); + method public static long getLong(java.lang.Object, int) throws java.lang.ArrayIndexOutOfBoundsException, java.lang.IllegalArgumentException; + method public static short getShort(java.lang.Object, int) throws java.lang.ArrayIndexOutOfBoundsException, java.lang.IllegalArgumentException; + method public static java.lang.Object newInstance(java.lang.Class, int...) throws java.lang.IllegalArgumentException, java.lang.NegativeArraySizeException; + method public static java.lang.Object newInstance(java.lang.Class, int) throws java.lang.NegativeArraySizeException; + method public static void set(java.lang.Object, int, java.lang.Object) throws java.lang.ArrayIndexOutOfBoundsException, java.lang.IllegalArgumentException; + method public static void setBoolean(java.lang.Object, int, boolean); + method public static void setByte(java.lang.Object, int, byte) throws java.lang.ArrayIndexOutOfBoundsException, java.lang.IllegalArgumentException; + method public static void setChar(java.lang.Object, int, char) throws java.lang.ArrayIndexOutOfBoundsException, java.lang.IllegalArgumentException; + method public static void setDouble(java.lang.Object, int, double) throws java.lang.ArrayIndexOutOfBoundsException, java.lang.IllegalArgumentException; + method public static void setFloat(java.lang.Object, int, float) throws java.lang.ArrayIndexOutOfBoundsException, java.lang.IllegalArgumentException; + method public static void setInt(java.lang.Object, int, int) throws java.lang.ArrayIndexOutOfBoundsException, java.lang.IllegalArgumentException; + method public static void setLong(java.lang.Object, int, long) throws java.lang.ArrayIndexOutOfBoundsException, java.lang.IllegalArgumentException; + method public static void setShort(java.lang.Object, int, short) throws java.lang.ArrayIndexOutOfBoundsException, java.lang.IllegalArgumentException; + } + + public final class Constructor extends java.lang.reflect.AccessibleObject implements java.lang.reflect.GenericDeclaration java.lang.reflect.Member { + method public A getAnnotation(java.lang.Class); + method public java.lang.Class getDeclaringClass(); + method public java.lang.Class[] getExceptionTypes(); + method public java.lang.reflect.Type[] getGenericExceptionTypes(); + method public java.lang.reflect.Type[] getGenericParameterTypes(); + method public int getModifiers(); + method public java.lang.String getName(); + method public java.lang.annotation.Annotation[][] getParameterAnnotations(); + method public java.lang.Class[] getParameterTypes(); + method public java.lang.reflect.TypeVariable>[] getTypeParameters(); + method public boolean isSynthetic(); + method public boolean isVarArgs(); + method public T newInstance(java.lang.Object...) throws java.lang.IllegalAccessException, java.lang.IllegalArgumentException, java.lang.InstantiationException, java.lang.reflect.InvocationTargetException; + method public java.lang.String toGenericString(); + } + + public final class Field extends java.lang.reflect.AccessibleObject implements java.lang.reflect.Member { + method public java.lang.Object get(java.lang.Object) throws java.lang.IllegalAccessException, java.lang.IllegalArgumentException; + method public A getAnnotation(java.lang.Class); + method public boolean getBoolean(java.lang.Object) throws java.lang.IllegalAccessException, java.lang.IllegalArgumentException; + method public byte getByte(java.lang.Object) throws java.lang.IllegalAccessException, java.lang.IllegalArgumentException; + method public char getChar(java.lang.Object) throws java.lang.IllegalAccessException, java.lang.IllegalArgumentException; + method public java.lang.Class getDeclaringClass(); + method public double getDouble(java.lang.Object) throws java.lang.IllegalAccessException, java.lang.IllegalArgumentException; + method public float getFloat(java.lang.Object) throws java.lang.IllegalAccessException, java.lang.IllegalArgumentException; + method public java.lang.reflect.Type getGenericType(); + method public int getInt(java.lang.Object) throws java.lang.IllegalAccessException, java.lang.IllegalArgumentException; + method public long getLong(java.lang.Object) throws java.lang.IllegalAccessException, java.lang.IllegalArgumentException; + method public int getModifiers(); + method public java.lang.String getName(); + method public short getShort(java.lang.Object) throws java.lang.IllegalAccessException, java.lang.IllegalArgumentException; + method public java.lang.Class getType(); + method public boolean isEnumConstant(); + method public boolean isSynthetic(); + method public void set(java.lang.Object, java.lang.Object) throws java.lang.IllegalAccessException, java.lang.IllegalArgumentException; + method public void setBoolean(java.lang.Object, boolean) throws java.lang.IllegalAccessException, java.lang.IllegalArgumentException; + method public void setByte(java.lang.Object, byte) throws java.lang.IllegalAccessException, java.lang.IllegalArgumentException; + method public void setChar(java.lang.Object, char) throws java.lang.IllegalAccessException, java.lang.IllegalArgumentException; + method public void setDouble(java.lang.Object, double) throws java.lang.IllegalAccessException, java.lang.IllegalArgumentException; + method public void setFloat(java.lang.Object, float) throws java.lang.IllegalAccessException, java.lang.IllegalArgumentException; + method public void setInt(java.lang.Object, int) throws java.lang.IllegalAccessException, java.lang.IllegalArgumentException; + method public void setLong(java.lang.Object, long) throws java.lang.IllegalAccessException, java.lang.IllegalArgumentException; + method public void setShort(java.lang.Object, short) throws java.lang.IllegalAccessException, java.lang.IllegalArgumentException; + method public java.lang.String toGenericString(); + } + + public abstract interface GenericArrayType implements java.lang.reflect.Type { + method public abstract java.lang.reflect.Type getGenericComponentType(); + } + + public abstract interface GenericDeclaration { + method public abstract java.lang.reflect.TypeVariable[] getTypeParameters(); + } + + public class GenericSignatureFormatError extends java.lang.ClassFormatError { + ctor public GenericSignatureFormatError(); + } + + public abstract interface InvocationHandler { + method public abstract java.lang.Object invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[]) throws java.lang.Throwable; + } + + public class InvocationTargetException extends java.lang.Exception { + ctor protected InvocationTargetException(); + ctor public InvocationTargetException(java.lang.Throwable); + ctor public InvocationTargetException(java.lang.Throwable, java.lang.String); + method public java.lang.Throwable getTargetException(); + } + + public class MalformedParameterizedTypeException extends java.lang.RuntimeException { + ctor public MalformedParameterizedTypeException(); + } + + public abstract interface Member { + method public abstract java.lang.Class getDeclaringClass(); + method public abstract int getModifiers(); + method public abstract java.lang.String getName(); + method public abstract boolean isSynthetic(); + field public static final int DECLARED = 1; // 0x1 + field public static final int PUBLIC = 0; // 0x0 + } + + public final class Method extends java.lang.reflect.AccessibleObject implements java.lang.reflect.GenericDeclaration java.lang.reflect.Member { + method public A getAnnotation(java.lang.Class); + method public java.lang.Class getDeclaringClass(); + method public java.lang.Object getDefaultValue(); + method public java.lang.Class[] getExceptionTypes(); + method public java.lang.reflect.Type[] getGenericExceptionTypes(); + method public java.lang.reflect.Type[] getGenericParameterTypes(); + method public java.lang.reflect.Type getGenericReturnType(); + method public int getModifiers(); + method public java.lang.String getName(); + method public java.lang.annotation.Annotation[][] getParameterAnnotations(); + method public java.lang.Class[] getParameterTypes(); + method public java.lang.Class getReturnType(); + method public java.lang.reflect.TypeVariable[] getTypeParameters(); + method public java.lang.Object invoke(java.lang.Object, java.lang.Object...) throws java.lang.IllegalAccessException, java.lang.IllegalArgumentException, java.lang.reflect.InvocationTargetException; + method public boolean isBridge(); + method public boolean isSynthetic(); + method public boolean isVarArgs(); + method public java.lang.String toGenericString(); + } + + public class Modifier { + ctor public Modifier(); + method public static boolean isAbstract(int); + method public static boolean isFinal(int); + method public static boolean isInterface(int); + method public static boolean isNative(int); + method public static boolean isPrivate(int); + method public static boolean isProtected(int); + method public static boolean isPublic(int); + method public static boolean isStatic(int); + method public static boolean isStrict(int); + method public static boolean isSynchronized(int); + method public static boolean isTransient(int); + method public static boolean isVolatile(int); + method public static java.lang.String toString(int); + field public static final int ABSTRACT = 1024; // 0x400 + field public static final int FINAL = 16; // 0x10 + field public static final int INTERFACE = 512; // 0x200 + field public static final int NATIVE = 256; // 0x100 + field public static final int PRIVATE = 2; // 0x2 + field public static final int PROTECTED = 4; // 0x4 + field public static final int PUBLIC = 1; // 0x1 + field public static final int STATIC = 8; // 0x8 + field public static final int STRICT = 2048; // 0x800 + field public static final int SYNCHRONIZED = 32; // 0x20 + field public static final int TRANSIENT = 128; // 0x80 + field public static final int VOLATILE = 64; // 0x40 + } + + public abstract interface ParameterizedType implements java.lang.reflect.Type { + method public abstract java.lang.reflect.Type[] getActualTypeArguments(); + method public abstract java.lang.reflect.Type getOwnerType(); + method public abstract java.lang.reflect.Type getRawType(); + } + + public class Proxy implements java.io.Serializable { + ctor protected Proxy(java.lang.reflect.InvocationHandler); + method public static java.lang.reflect.InvocationHandler getInvocationHandler(java.lang.Object) throws java.lang.IllegalArgumentException; + method public static java.lang.Class getProxyClass(java.lang.ClassLoader, java.lang.Class...) throws java.lang.IllegalArgumentException; + method public static boolean isProxyClass(java.lang.Class); + method public static java.lang.Object newProxyInstance(java.lang.ClassLoader, java.lang.Class[], java.lang.reflect.InvocationHandler) throws java.lang.IllegalArgumentException; + field protected java.lang.reflect.InvocationHandler h; + } + + public final class ReflectPermission extends java.security.BasicPermission { + ctor public ReflectPermission(java.lang.String); + ctor public ReflectPermission(java.lang.String, java.lang.String); + } + + public abstract interface Type { + } + + public abstract interface TypeVariable implements java.lang.reflect.Type { + method public abstract java.lang.reflect.Type[] getBounds(); + method public abstract D getGenericDeclaration(); + method public abstract java.lang.String getName(); + } + + public class UndeclaredThrowableException extends java.lang.RuntimeException { + ctor public UndeclaredThrowableException(java.lang.Throwable); + ctor public UndeclaredThrowableException(java.lang.Throwable, java.lang.String); + method public java.lang.Throwable getUndeclaredThrowable(); + } + + public abstract interface WildcardType implements java.lang.reflect.Type { + method public abstract java.lang.reflect.Type[] getLowerBounds(); + method public abstract java.lang.reflect.Type[] getUpperBounds(); + } + +} + +package java.math { + + public class BigDecimal extends java.lang.Number implements java.lang.Comparable java.io.Serializable { + ctor public BigDecimal(char[], int, int); + ctor public BigDecimal(char[], int, int, java.math.MathContext); + ctor public BigDecimal(char[]); + ctor public BigDecimal(char[], java.math.MathContext); + ctor public BigDecimal(java.lang.String); + ctor public BigDecimal(java.lang.String, java.math.MathContext); + ctor public BigDecimal(double); + ctor public BigDecimal(double, java.math.MathContext); + ctor public BigDecimal(java.math.BigInteger); + ctor public BigDecimal(java.math.BigInteger, java.math.MathContext); + ctor public BigDecimal(java.math.BigInteger, int); + ctor public BigDecimal(java.math.BigInteger, int, java.math.MathContext); + ctor public BigDecimal(int); + ctor public BigDecimal(int, java.math.MathContext); + ctor public BigDecimal(long); + ctor public BigDecimal(long, java.math.MathContext); + method public java.math.BigDecimal abs(); + method public java.math.BigDecimal abs(java.math.MathContext); + method public java.math.BigDecimal add(java.math.BigDecimal); + method public java.math.BigDecimal add(java.math.BigDecimal, java.math.MathContext); + method public byte byteValueExact(); + method public int compareTo(java.math.BigDecimal); + method public java.math.BigDecimal divide(java.math.BigDecimal, int, int); + method public java.math.BigDecimal divide(java.math.BigDecimal, int, java.math.RoundingMode); + method public java.math.BigDecimal divide(java.math.BigDecimal, int); + method public java.math.BigDecimal divide(java.math.BigDecimal, java.math.RoundingMode); + method public java.math.BigDecimal divide(java.math.BigDecimal); + method public java.math.BigDecimal divide(java.math.BigDecimal, java.math.MathContext); + method public java.math.BigDecimal[] divideAndRemainder(java.math.BigDecimal); + method public java.math.BigDecimal[] divideAndRemainder(java.math.BigDecimal, java.math.MathContext); + method public java.math.BigDecimal divideToIntegralValue(java.math.BigDecimal); + method public java.math.BigDecimal divideToIntegralValue(java.math.BigDecimal, java.math.MathContext); + method public double doubleValue(); + method public float floatValue(); + method public int intValue(); + method public int intValueExact(); + method public long longValue(); + method public long longValueExact(); + method public java.math.BigDecimal max(java.math.BigDecimal); + method public java.math.BigDecimal min(java.math.BigDecimal); + method public java.math.BigDecimal movePointLeft(int); + method public java.math.BigDecimal movePointRight(int); + method public java.math.BigDecimal multiply(java.math.BigDecimal); + method public java.math.BigDecimal multiply(java.math.BigDecimal, java.math.MathContext); + method public java.math.BigDecimal negate(); + method public java.math.BigDecimal negate(java.math.MathContext); + method public java.math.BigDecimal plus(); + method public java.math.BigDecimal plus(java.math.MathContext); + method public java.math.BigDecimal pow(int); + method public java.math.BigDecimal pow(int, java.math.MathContext); + method public int precision(); + method public java.math.BigDecimal remainder(java.math.BigDecimal); + method public java.math.BigDecimal remainder(java.math.BigDecimal, java.math.MathContext); + method public java.math.BigDecimal round(java.math.MathContext); + method public int scale(); + method public java.math.BigDecimal scaleByPowerOfTen(int); + method public java.math.BigDecimal setScale(int, java.math.RoundingMode); + method public java.math.BigDecimal setScale(int, int); + method public java.math.BigDecimal setScale(int); + method public short shortValueExact(); + method public int signum(); + method public java.math.BigDecimal stripTrailingZeros(); + method public java.math.BigDecimal subtract(java.math.BigDecimal); + method public java.math.BigDecimal subtract(java.math.BigDecimal, java.math.MathContext); + method public java.math.BigInteger toBigInteger(); + method public java.math.BigInteger toBigIntegerExact(); + method public java.lang.String toEngineeringString(); + method public java.lang.String toPlainString(); + method public java.math.BigDecimal ulp(); + method public java.math.BigInteger unscaledValue(); + method public static java.math.BigDecimal valueOf(long, int); + method public static java.math.BigDecimal valueOf(long); + method public static java.math.BigDecimal valueOf(double); + field public static final java.math.BigDecimal ONE; + field public static final int ROUND_CEILING = 2; // 0x2 + field public static final int ROUND_DOWN = 1; // 0x1 + field public static final int ROUND_FLOOR = 3; // 0x3 + field public static final int ROUND_HALF_DOWN = 5; // 0x5 + field public static final int ROUND_HALF_EVEN = 6; // 0x6 + field public static final int ROUND_HALF_UP = 4; // 0x4 + field public static final int ROUND_UNNECESSARY = 7; // 0x7 + field public static final int ROUND_UP = 0; // 0x0 + field public static final java.math.BigDecimal TEN; + field public static final java.math.BigDecimal ZERO; + } + + public class BigInteger extends java.lang.Number implements java.lang.Comparable java.io.Serializable { + ctor public BigInteger(int, java.util.Random); + ctor public BigInteger(int, int, java.util.Random); + ctor public BigInteger(java.lang.String); + ctor public BigInteger(java.lang.String, int); + ctor public BigInteger(int, byte[]); + ctor public BigInteger(byte[]); + method public java.math.BigInteger abs(); + method public java.math.BigInteger add(java.math.BigInteger); + method public java.math.BigInteger and(java.math.BigInteger); + method public java.math.BigInteger andNot(java.math.BigInteger); + method public int bitCount(); + method public int bitLength(); + method public java.math.BigInteger clearBit(int); + method public int compareTo(java.math.BigInteger); + method public java.math.BigInteger divide(java.math.BigInteger); + method public java.math.BigInteger[] divideAndRemainder(java.math.BigInteger); + method public double doubleValue(); + method public java.math.BigInteger flipBit(int); + method public float floatValue(); + method public java.math.BigInteger gcd(java.math.BigInteger); + method public int getLowestSetBit(); + method public int intValue(); + method public boolean isProbablePrime(int); + method public long longValue(); + method public java.math.BigInteger max(java.math.BigInteger); + method public java.math.BigInteger min(java.math.BigInteger); + method public java.math.BigInteger mod(java.math.BigInteger); + method public java.math.BigInteger modInverse(java.math.BigInteger); + method public java.math.BigInteger modPow(java.math.BigInteger, java.math.BigInteger); + method public java.math.BigInteger multiply(java.math.BigInteger); + method public java.math.BigInteger negate(); + method public java.math.BigInteger nextProbablePrime(); + method public java.math.BigInteger not(); + method public java.math.BigInteger or(java.math.BigInteger); + method public java.math.BigInteger pow(int); + method public static java.math.BigInteger probablePrime(int, java.util.Random); + method public java.math.BigInteger remainder(java.math.BigInteger); + method public java.math.BigInteger setBit(int); + method public java.math.BigInteger shiftLeft(int); + method public java.math.BigInteger shiftRight(int); + method public int signum(); + method public java.math.BigInteger subtract(java.math.BigInteger); + method public boolean testBit(int); + method public byte[] toByteArray(); + method public java.lang.String toString(int); + method public static java.math.BigInteger valueOf(long); + method public java.math.BigInteger xor(java.math.BigInteger); + field public static final java.math.BigInteger ONE; + field public static final java.math.BigInteger TEN; + field public static final java.math.BigInteger ZERO; + } + + public final class MathContext implements java.io.Serializable { + ctor public MathContext(int); + ctor public MathContext(int, java.math.RoundingMode); + ctor public MathContext(java.lang.String); + method public int getPrecision(); + method public java.math.RoundingMode getRoundingMode(); + field public static final java.math.MathContext DECIMAL128; + field public static final java.math.MathContext DECIMAL32; + field public static final java.math.MathContext DECIMAL64; + field public static final java.math.MathContext UNLIMITED; + } + + public final class RoundingMode extends java.lang.Enum { + method public static java.math.RoundingMode valueOf(java.lang.String); + method public static java.math.RoundingMode valueOf(int); + method public static final java.math.RoundingMode[] values(); + enum_constant public static final java.math.RoundingMode CEILING; + enum_constant public static final java.math.RoundingMode DOWN; + enum_constant public static final java.math.RoundingMode FLOOR; + enum_constant public static final java.math.RoundingMode HALF_DOWN; + enum_constant public static final java.math.RoundingMode HALF_EVEN; + enum_constant public static final java.math.RoundingMode HALF_UP; + enum_constant public static final java.math.RoundingMode UNNECESSARY; + enum_constant public static final java.math.RoundingMode UP; + } + +} + +package java.net { + + public abstract class Authenticator { + ctor public Authenticator(); + method protected java.net.PasswordAuthentication getPasswordAuthentication(); + method protected final java.lang.String getRequestingHost(); + method protected final int getRequestingPort(); + method protected final java.lang.String getRequestingPrompt(); + method protected final java.lang.String getRequestingProtocol(); + method protected final java.lang.String getRequestingScheme(); + method protected final java.net.InetAddress getRequestingSite(); + method protected java.net.URL getRequestingURL(); + method protected java.net.Authenticator.RequestorType getRequestorType(); + method public static synchronized java.net.PasswordAuthentication requestPasswordAuthentication(java.net.InetAddress, int, java.lang.String, java.lang.String, java.lang.String); + method public static synchronized java.net.PasswordAuthentication requestPasswordAuthentication(java.lang.String, java.net.InetAddress, int, java.lang.String, java.lang.String, java.lang.String); + method public static java.net.PasswordAuthentication requestPasswordAuthentication(java.lang.String, java.net.InetAddress, int, java.lang.String, java.lang.String, java.lang.String, java.net.URL, java.net.Authenticator.RequestorType); + method public static void setDefault(java.net.Authenticator); + } + + public static final class Authenticator.RequestorType extends java.lang.Enum { + method public static java.net.Authenticator.RequestorType valueOf(java.lang.String); + method public static final java.net.Authenticator.RequestorType[] values(); + enum_constant public static final java.net.Authenticator.RequestorType PROXY; + enum_constant public static final java.net.Authenticator.RequestorType SERVER; + } + + public class BindException extends java.net.SocketException { + ctor public BindException(); + ctor public BindException(java.lang.String); + } + + public abstract class CacheRequest { + ctor public CacheRequest(); + method public abstract void abort(); + method public abstract java.io.OutputStream getBody() throws java.io.IOException; + } + + public abstract class CacheResponse { + ctor public CacheResponse(); + method public abstract java.io.InputStream getBody() throws java.io.IOException; + method public abstract java.util.Map> getHeaders() throws java.io.IOException; + } + + public class ConnectException extends java.net.SocketException { + ctor public ConnectException(); + ctor public ConnectException(java.lang.String); + } + + public abstract class ContentHandler { + ctor public ContentHandler(); + method public abstract java.lang.Object getContent(java.net.URLConnection) throws java.io.IOException; + method public java.lang.Object getContent(java.net.URLConnection, java.lang.Class[]) throws java.io.IOException; + } + + public abstract interface ContentHandlerFactory { + method public abstract java.net.ContentHandler createContentHandler(java.lang.String); + } + + public abstract class CookieHandler { + ctor public CookieHandler(); + method public abstract java.util.Map> get(java.net.URI, java.util.Map>) throws java.io.IOException; + method public static java.net.CookieHandler getDefault(); + method public abstract void put(java.net.URI, java.util.Map>) throws java.io.IOException; + method public static void setDefault(java.net.CookieHandler); + } + + public class CookieManager extends java.net.CookieHandler { + ctor public CookieManager(); + ctor public CookieManager(java.net.CookieStore, java.net.CookiePolicy); + method public java.util.Map> get(java.net.URI, java.util.Map>) throws java.io.IOException; + method public java.net.CookieStore getCookieStore(); + method public void put(java.net.URI, java.util.Map>) throws java.io.IOException; + method public void setCookiePolicy(java.net.CookiePolicy); + } + + public abstract interface CookiePolicy { + method public abstract boolean shouldAccept(java.net.URI, java.net.HttpCookie); + field public static final java.net.CookiePolicy ACCEPT_ALL; + field public static final java.net.CookiePolicy ACCEPT_NONE; + field public static final java.net.CookiePolicy ACCEPT_ORIGINAL_SERVER; + } + + public abstract interface CookieStore { + method public abstract void add(java.net.URI, java.net.HttpCookie); + method public abstract java.util.List get(java.net.URI); + method public abstract java.util.List getCookies(); + method public abstract java.util.List getURIs(); + method public abstract boolean remove(java.net.URI, java.net.HttpCookie); + method public abstract boolean removeAll(); + } + + public final class DatagramPacket { + ctor public DatagramPacket(byte[], int); + ctor public DatagramPacket(byte[], int, int); + ctor public DatagramPacket(byte[], int, int, java.net.InetAddress, int); + ctor public DatagramPacket(byte[], int, java.net.InetAddress, int); + ctor public DatagramPacket(byte[], int, java.net.SocketAddress) throws java.net.SocketException; + ctor public DatagramPacket(byte[], int, int, java.net.SocketAddress) throws java.net.SocketException; + method public synchronized java.net.InetAddress getAddress(); + method public synchronized byte[] getData(); + method public synchronized int getLength(); + method public synchronized int getOffset(); + method public synchronized int getPort(); + method public synchronized java.net.SocketAddress getSocketAddress(); + method public synchronized void setAddress(java.net.InetAddress); + method public synchronized void setData(byte[], int, int); + method public synchronized void setData(byte[]); + method public synchronized void setLength(int); + method public synchronized void setPort(int); + method public synchronized void setSocketAddress(java.net.SocketAddress); + } + + public class DatagramSocket { + ctor public DatagramSocket() throws java.net.SocketException; + ctor public DatagramSocket(int) throws java.net.SocketException; + ctor public DatagramSocket(int, java.net.InetAddress) throws java.net.SocketException; + ctor protected DatagramSocket(java.net.DatagramSocketImpl); + ctor public DatagramSocket(java.net.SocketAddress) throws java.net.SocketException; + method public void bind(java.net.SocketAddress) throws java.net.SocketException; + method public void close(); + method public void connect(java.net.SocketAddress) throws java.net.SocketException; + method public void connect(java.net.InetAddress, int); + method public void disconnect(); + method public boolean getBroadcast() throws java.net.SocketException; + method public java.nio.channels.DatagramChannel getChannel(); + method public java.net.InetAddress getInetAddress(); + method public java.net.InetAddress getLocalAddress(); + method public int getLocalPort(); + method public java.net.SocketAddress getLocalSocketAddress(); + method public int getPort(); + method public synchronized int getReceiveBufferSize() throws java.net.SocketException; + method public java.net.SocketAddress getRemoteSocketAddress(); + method public boolean getReuseAddress() throws java.net.SocketException; + method public synchronized int getSendBufferSize() throws java.net.SocketException; + method public synchronized int getSoTimeout() throws java.net.SocketException; + method public int getTrafficClass() throws java.net.SocketException; + method public boolean isBound(); + method public boolean isClosed(); + method public boolean isConnected(); + method public synchronized void receive(java.net.DatagramPacket) throws java.io.IOException; + method public void send(java.net.DatagramPacket) throws java.io.IOException; + method public void setBroadcast(boolean) throws java.net.SocketException; + method public static synchronized void setDatagramSocketImplFactory(java.net.DatagramSocketImplFactory) throws java.io.IOException; + method public synchronized void setReceiveBufferSize(int) throws java.net.SocketException; + method public void setReuseAddress(boolean) throws java.net.SocketException; + method public synchronized void setSendBufferSize(int) throws java.net.SocketException; + method public synchronized void setSoTimeout(int) throws java.net.SocketException; + method public void setTrafficClass(int) throws java.net.SocketException; + } + + public abstract class DatagramSocketImpl implements java.net.SocketOptions { + ctor public DatagramSocketImpl(); + method protected abstract void bind(int, java.net.InetAddress) throws java.net.SocketException; + method protected abstract void close(); + method protected void connect(java.net.InetAddress, int) throws java.net.SocketException; + method protected abstract void create() throws java.net.SocketException; + method protected void disconnect(); + method protected java.io.FileDescriptor getFileDescriptor(); + method protected int getLocalPort(); + method protected abstract deprecated byte getTTL() throws java.io.IOException; + method protected abstract int getTimeToLive() throws java.io.IOException; + method protected abstract void join(java.net.InetAddress) throws java.io.IOException; + method protected abstract void joinGroup(java.net.SocketAddress, java.net.NetworkInterface) throws java.io.IOException; + method protected abstract void leave(java.net.InetAddress) throws java.io.IOException; + method protected abstract void leaveGroup(java.net.SocketAddress, java.net.NetworkInterface) throws java.io.IOException; + method protected abstract int peek(java.net.InetAddress) throws java.io.IOException; + method protected abstract int peekData(java.net.DatagramPacket) throws java.io.IOException; + method protected abstract void receive(java.net.DatagramPacket) throws java.io.IOException; + method protected abstract void send(java.net.DatagramPacket) throws java.io.IOException; + method protected abstract deprecated void setTTL(byte) throws java.io.IOException; + method protected abstract void setTimeToLive(int) throws java.io.IOException; + field protected java.io.FileDescriptor fd; + field protected int localPort; + } + + public abstract interface DatagramSocketImplFactory { + method public abstract java.net.DatagramSocketImpl createDatagramSocketImpl(); + } + + public abstract interface FileNameMap { + method public abstract java.lang.String getContentTypeFor(java.lang.String); + } + + public final class HttpCookie implements java.lang.Cloneable { + ctor public HttpCookie(java.lang.String, java.lang.String); + method public java.lang.Object clone(); + method public static boolean domainMatches(java.lang.String, java.lang.String); + method public java.lang.String getComment(); + method public java.lang.String getCommentURL(); + method public boolean getDiscard(); + method public java.lang.String getDomain(); + method public long getMaxAge(); + method public java.lang.String getName(); + method public java.lang.String getPath(); + method public java.lang.String getPortlist(); + method public boolean getSecure(); + method public java.lang.String getValue(); + method public int getVersion(); + method public boolean hasExpired(); + method public static java.util.List parse(java.lang.String); + method public void setComment(java.lang.String); + method public void setCommentURL(java.lang.String); + method public void setDiscard(boolean); + method public void setDomain(java.lang.String); + method public void setMaxAge(long); + method public void setPath(java.lang.String); + method public void setPortlist(java.lang.String); + method public void setSecure(boolean); + method public void setValue(java.lang.String); + method public void setVersion(int); + } + + public class HttpRetryException extends java.io.IOException { + ctor public HttpRetryException(java.lang.String, int); + ctor public HttpRetryException(java.lang.String, int, java.lang.String); + method public java.lang.String getLocation(); + method public java.lang.String getReason(); + method public int responseCode(); + } + + public abstract class HttpURLConnection extends java.net.URLConnection { + ctor protected HttpURLConnection(java.net.URL); + method public abstract void disconnect(); + method public java.io.InputStream getErrorStream(); + method public static boolean getFollowRedirects(); + method public boolean getInstanceFollowRedirects(); + method public java.lang.String getRequestMethod(); + method public int getResponseCode() throws java.io.IOException; + method public java.lang.String getResponseMessage() throws java.io.IOException; + method public void setChunkedStreamingMode(int); + method public void setFixedLengthStreamingMode(int); + method public static void setFollowRedirects(boolean); + method public void setInstanceFollowRedirects(boolean); + method public void setRequestMethod(java.lang.String) throws java.net.ProtocolException; + method public abstract boolean usingProxy(); + field public static final int HTTP_ACCEPTED = 202; // 0xca + field public static final int HTTP_BAD_GATEWAY = 502; // 0x1f6 + field public static final int HTTP_BAD_METHOD = 405; // 0x195 + field public static final int HTTP_BAD_REQUEST = 400; // 0x190 + field public static final int HTTP_CLIENT_TIMEOUT = 408; // 0x198 + field public static final int HTTP_CONFLICT = 409; // 0x199 + field public static final int HTTP_CREATED = 201; // 0xc9 + field public static final int HTTP_ENTITY_TOO_LARGE = 413; // 0x19d + field public static final int HTTP_FORBIDDEN = 403; // 0x193 + field public static final int HTTP_GATEWAY_TIMEOUT = 504; // 0x1f8 + field public static final int HTTP_GONE = 410; // 0x19a + field public static final int HTTP_INTERNAL_ERROR = 500; // 0x1f4 + field public static final int HTTP_LENGTH_REQUIRED = 411; // 0x19b + field public static final int HTTP_MOVED_PERM = 301; // 0x12d + field public static final int HTTP_MOVED_TEMP = 302; // 0x12e + field public static final int HTTP_MULT_CHOICE = 300; // 0x12c + field public static final int HTTP_NOT_ACCEPTABLE = 406; // 0x196 + field public static final int HTTP_NOT_AUTHORITATIVE = 203; // 0xcb + field public static final int HTTP_NOT_FOUND = 404; // 0x194 + field public static final int HTTP_NOT_IMPLEMENTED = 501; // 0x1f5 + field public static final int HTTP_NOT_MODIFIED = 304; // 0x130 + field public static final int HTTP_NO_CONTENT = 204; // 0xcc + field public static final int HTTP_OK = 200; // 0xc8 + field public static final int HTTP_PARTIAL = 206; // 0xce + field public static final int HTTP_PAYMENT_REQUIRED = 402; // 0x192 + field public static final int HTTP_PRECON_FAILED = 412; // 0x19c + field public static final int HTTP_PROXY_AUTH = 407; // 0x197 + field public static final int HTTP_REQ_TOO_LONG = 414; // 0x19e + field public static final int HTTP_RESET = 205; // 0xcd + field public static final int HTTP_SEE_OTHER = 303; // 0x12f + field public static final deprecated int HTTP_SERVER_ERROR = 500; // 0x1f4 + field public static final int HTTP_UNAUTHORIZED = 401; // 0x191 + field public static final int HTTP_UNAVAILABLE = 503; // 0x1f7 + field public static final int HTTP_UNSUPPORTED_TYPE = 415; // 0x19f + field public static final int HTTP_USE_PROXY = 305; // 0x131 + field public static final int HTTP_VERSION = 505; // 0x1f9 + field protected int chunkLength; + field protected int fixedContentLength; + field protected boolean instanceFollowRedirects; + field protected java.lang.String method; + field protected int responseCode; + field protected java.lang.String responseMessage; + } + + public final class IDN { + method public static java.lang.String toASCII(java.lang.String, int); + method public static java.lang.String toASCII(java.lang.String); + method public static java.lang.String toUnicode(java.lang.String, int); + method public static java.lang.String toUnicode(java.lang.String); + field public static final int ALLOW_UNASSIGNED = 1; // 0x1 + field public static final int USE_STD3_ASCII_RULES = 2; // 0x2 + } + + public final class Inet4Address extends java.net.InetAddress { + } + + public final class Inet6Address extends java.net.InetAddress { + method public static java.net.Inet6Address getByAddress(java.lang.String, byte[], int) throws java.net.UnknownHostException; + method public static java.net.Inet6Address getByAddress(java.lang.String, byte[], java.net.NetworkInterface) throws java.net.UnknownHostException; + method public int getScopeId(); + method public java.net.NetworkInterface getScopedInterface(); + method public boolean isIPv4CompatibleAddress(); + } + + public class InetAddress implements java.io.Serializable { + method public byte[] getAddress(); + method public static java.net.InetAddress[] getAllByName(java.lang.String) throws java.net.UnknownHostException; + method public static java.net.InetAddress getByAddress(byte[]) throws java.net.UnknownHostException; + method public static java.net.InetAddress getByAddress(java.lang.String, byte[]) throws java.net.UnknownHostException; + method public static java.net.InetAddress getByName(java.lang.String) throws java.net.UnknownHostException; + method public java.lang.String getCanonicalHostName(); + method public java.lang.String getHostAddress(); + method public java.lang.String getHostName(); + method public static java.net.InetAddress getLocalHost() throws java.net.UnknownHostException; + method public boolean isAnyLocalAddress(); + method public boolean isLinkLocalAddress(); + method public boolean isLoopbackAddress(); + method public boolean isMCGlobal(); + method public boolean isMCLinkLocal(); + method public boolean isMCNodeLocal(); + method public boolean isMCOrgLocal(); + method public boolean isMCSiteLocal(); + method public boolean isMulticastAddress(); + method public boolean isReachable(int) throws java.io.IOException; + method public boolean isReachable(java.net.NetworkInterface, int, int) throws java.io.IOException; + method public boolean isSiteLocalAddress(); + } + + public class InetSocketAddress extends java.net.SocketAddress { + ctor public InetSocketAddress(int); + ctor public InetSocketAddress(java.net.InetAddress, int); + ctor public InetSocketAddress(java.lang.String, int); + method public static java.net.InetSocketAddress createUnresolved(java.lang.String, int); + method public final boolean equals(java.lang.Object); + method public final java.net.InetAddress getAddress(); + method public final java.lang.String getHostName(); + method public final int getPort(); + method public final int hashCode(); + method public final boolean isUnresolved(); + } + + public class InterfaceAddress { + method public java.net.InetAddress getAddress(); + method public java.net.InetAddress getBroadcast(); + method public short getNetworkPrefixLength(); + } + + public abstract class JarURLConnection extends java.net.URLConnection { + ctor protected JarURLConnection(java.net.URL) throws java.net.MalformedURLException; + method public java.util.jar.Attributes getAttributes() throws java.io.IOException; + method public java.security.cert.Certificate[] getCertificates() throws java.io.IOException; + method public java.lang.String getEntryName(); + method public java.util.jar.JarEntry getJarEntry() throws java.io.IOException; + method public abstract java.util.jar.JarFile getJarFile() throws java.io.IOException; + method public java.net.URL getJarFileURL(); + method public java.util.jar.Attributes getMainAttributes() throws java.io.IOException; + method public java.util.jar.Manifest getManifest() throws java.io.IOException; + field protected java.net.URLConnection jarFileURLConnection; + } + + public class MalformedURLException extends java.io.IOException { + ctor public MalformedURLException(); + ctor public MalformedURLException(java.lang.String); + } + + public class MulticastSocket extends java.net.DatagramSocket { + ctor public MulticastSocket() throws java.io.IOException; + ctor public MulticastSocket(int) throws java.io.IOException; + ctor public MulticastSocket(java.net.SocketAddress) throws java.io.IOException; + method public java.net.InetAddress getInterface() throws java.net.SocketException; + method public boolean getLoopbackMode() throws java.net.SocketException; + method public java.net.NetworkInterface getNetworkInterface() throws java.net.SocketException; + method public deprecated byte getTTL() throws java.io.IOException; + method public int getTimeToLive() throws java.io.IOException; + method public void joinGroup(java.net.InetAddress) throws java.io.IOException; + method public void joinGroup(java.net.SocketAddress, java.net.NetworkInterface) throws java.io.IOException; + method public void leaveGroup(java.net.InetAddress) throws java.io.IOException; + method public void leaveGroup(java.net.SocketAddress, java.net.NetworkInterface) throws java.io.IOException; + method public deprecated void send(java.net.DatagramPacket, byte) throws java.io.IOException; + method public void setInterface(java.net.InetAddress) throws java.net.SocketException; + method public void setLoopbackMode(boolean) throws java.net.SocketException; + method public void setNetworkInterface(java.net.NetworkInterface) throws java.net.SocketException; + method public deprecated void setTTL(byte) throws java.io.IOException; + method public void setTimeToLive(int) throws java.io.IOException; + } + + public final class NetPermission extends java.security.BasicPermission { + ctor public NetPermission(java.lang.String); + ctor public NetPermission(java.lang.String, java.lang.String); + } + + public final class NetworkInterface { + method public static java.net.NetworkInterface getByInetAddress(java.net.InetAddress) throws java.net.SocketException; + method public static java.net.NetworkInterface getByName(java.lang.String) throws java.net.SocketException; + method public java.lang.String getDisplayName(); + method public byte[] getHardwareAddress() throws java.net.SocketException; + method public java.util.Enumeration getInetAddresses(); + method public java.util.List getInterfaceAddresses(); + method public int getMTU() throws java.net.SocketException; + method public java.lang.String getName(); + method public static java.util.Enumeration getNetworkInterfaces() throws java.net.SocketException; + method public java.net.NetworkInterface getParent(); + method public java.util.Enumeration getSubInterfaces(); + method public boolean isLoopback() throws java.net.SocketException; + method public boolean isPointToPoint() throws java.net.SocketException; + method public boolean isUp() throws java.net.SocketException; + method public boolean isVirtual(); + method public boolean supportsMulticast() throws java.net.SocketException; + } + + public class NoRouteToHostException extends java.net.SocketException { + ctor public NoRouteToHostException(); + ctor public NoRouteToHostException(java.lang.String); + } + + public final class PasswordAuthentication { + ctor public PasswordAuthentication(java.lang.String, char[]); + method public char[] getPassword(); + method public java.lang.String getUserName(); + } + + public class PortUnreachableException extends java.net.SocketException { + ctor public PortUnreachableException(); + ctor public PortUnreachableException(java.lang.String); + } + + public class ProtocolException extends java.io.IOException { + ctor public ProtocolException(); + ctor public ProtocolException(java.lang.String); + } + + public class Proxy { + ctor public Proxy(java.net.Proxy.Type, java.net.SocketAddress); + method public java.net.SocketAddress address(); + method public final boolean equals(java.lang.Object); + method public final int hashCode(); + method public java.net.Proxy.Type type(); + field public static final java.net.Proxy NO_PROXY; + } + + public static final class Proxy.Type extends java.lang.Enum { + method public static java.net.Proxy.Type valueOf(java.lang.String); + method public static final java.net.Proxy.Type[] values(); + enum_constant public static final java.net.Proxy.Type DIRECT; + enum_constant public static final java.net.Proxy.Type HTTP; + enum_constant public static final java.net.Proxy.Type SOCKS; + } + + public abstract class ProxySelector { + ctor public ProxySelector(); + method public abstract void connectFailed(java.net.URI, java.net.SocketAddress, java.io.IOException); + method public static java.net.ProxySelector getDefault(); + method public abstract java.util.List select(java.net.URI); + method public static void setDefault(java.net.ProxySelector); + } + + public abstract class ResponseCache { + ctor public ResponseCache(); + method public abstract java.net.CacheResponse get(java.net.URI, java.lang.String, java.util.Map>) throws java.io.IOException; + method public static java.net.ResponseCache getDefault(); + method public abstract java.net.CacheRequest put(java.net.URI, java.net.URLConnection) throws java.io.IOException; + method public static void setDefault(java.net.ResponseCache); + } + + public abstract class SecureCacheResponse extends java.net.CacheResponse { + ctor public SecureCacheResponse(); + method public abstract java.lang.String getCipherSuite(); + method public abstract java.util.List getLocalCertificateChain(); + method public abstract java.security.Principal getLocalPrincipal(); + method public abstract java.security.Principal getPeerPrincipal() throws javax.net.ssl.SSLPeerUnverifiedException; + method public abstract java.util.List getServerCertificateChain() throws javax.net.ssl.SSLPeerUnverifiedException; + } + + public class ServerSocket { + ctor public ServerSocket() throws java.io.IOException; + ctor public ServerSocket(int) throws java.io.IOException; + ctor public ServerSocket(int, int) throws java.io.IOException; + ctor public ServerSocket(int, int, java.net.InetAddress) throws java.io.IOException; + method public java.net.Socket accept() throws java.io.IOException; + method public void bind(java.net.SocketAddress) throws java.io.IOException; + method public void bind(java.net.SocketAddress, int) throws java.io.IOException; + method public void close() throws java.io.IOException; + method public java.nio.channels.ServerSocketChannel getChannel(); + method public java.net.InetAddress getInetAddress(); + method public int getLocalPort(); + method public java.net.SocketAddress getLocalSocketAddress(); + method public int getReceiveBufferSize() throws java.net.SocketException; + method public boolean getReuseAddress() throws java.net.SocketException; + method public synchronized int getSoTimeout() throws java.io.IOException; + method protected final void implAccept(java.net.Socket) throws java.io.IOException; + method public boolean isBound(); + method public boolean isClosed(); + method public void setPerformancePreferences(int, int, int); + method public void setReceiveBufferSize(int) throws java.net.SocketException; + method public void setReuseAddress(boolean) throws java.net.SocketException; + method public synchronized void setSoTimeout(int) throws java.net.SocketException; + method public static synchronized void setSocketFactory(java.net.SocketImplFactory) throws java.io.IOException; + } + + public class Socket { + ctor public Socket(); + ctor public Socket(java.net.Proxy); + ctor public Socket(java.lang.String, int) throws java.io.IOException, java.net.UnknownHostException; + ctor public Socket(java.lang.String, int, java.net.InetAddress, int) throws java.io.IOException; + ctor public deprecated Socket(java.lang.String, int, boolean) throws java.io.IOException; + ctor public Socket(java.net.InetAddress, int) throws java.io.IOException; + ctor public Socket(java.net.InetAddress, int, java.net.InetAddress, int) throws java.io.IOException; + ctor public deprecated Socket(java.net.InetAddress, int, boolean) throws java.io.IOException; + ctor protected Socket(java.net.SocketImpl) throws java.net.SocketException; + method public void bind(java.net.SocketAddress) throws java.io.IOException; + method public synchronized void close() throws java.io.IOException; + method public void connect(java.net.SocketAddress) throws java.io.IOException; + method public void connect(java.net.SocketAddress, int) throws java.io.IOException; + method public java.nio.channels.SocketChannel getChannel(); + method public java.net.InetAddress getInetAddress(); + method public java.io.InputStream getInputStream() throws java.io.IOException; + method public boolean getKeepAlive() throws java.net.SocketException; + method public java.net.InetAddress getLocalAddress(); + method public int getLocalPort(); + method public java.net.SocketAddress getLocalSocketAddress(); + method public boolean getOOBInline() throws java.net.SocketException; + method public java.io.OutputStream getOutputStream() throws java.io.IOException; + method public int getPort(); + method public synchronized int getReceiveBufferSize() throws java.net.SocketException; + method public java.net.SocketAddress getRemoteSocketAddress(); + method public boolean getReuseAddress() throws java.net.SocketException; + method public synchronized int getSendBufferSize() throws java.net.SocketException; + method public int getSoLinger() throws java.net.SocketException; + method public synchronized int getSoTimeout() throws java.net.SocketException; + method public boolean getTcpNoDelay() throws java.net.SocketException; + method public int getTrafficClass() throws java.net.SocketException; + method public boolean isBound(); + method public boolean isClosed(); + method public boolean isConnected(); + method public boolean isInputShutdown(); + method public boolean isOutputShutdown(); + method public void sendUrgentData(int) throws java.io.IOException; + method public void setKeepAlive(boolean) throws java.net.SocketException; + method public void setOOBInline(boolean) throws java.net.SocketException; + method public void setPerformancePreferences(int, int, int); + method public synchronized void setReceiveBufferSize(int) throws java.net.SocketException; + method public void setReuseAddress(boolean) throws java.net.SocketException; + method public synchronized void setSendBufferSize(int) throws java.net.SocketException; + method public void setSoLinger(boolean, int) throws java.net.SocketException; + method public synchronized void setSoTimeout(int) throws java.net.SocketException; + method public static synchronized void setSocketImplFactory(java.net.SocketImplFactory) throws java.io.IOException; + method public void setTcpNoDelay(boolean) throws java.net.SocketException; + method public void setTrafficClass(int) throws java.net.SocketException; + method public void shutdownInput() throws java.io.IOException; + method public void shutdownOutput() throws java.io.IOException; + } + + public abstract class SocketAddress implements java.io.Serializable { + ctor public SocketAddress(); + } + + public class SocketException extends java.io.IOException { + ctor public SocketException(); + ctor public SocketException(java.lang.String); + } + + public abstract class SocketImpl implements java.net.SocketOptions { + ctor public SocketImpl(); + method protected abstract void accept(java.net.SocketImpl) throws java.io.IOException; + method protected abstract int available() throws java.io.IOException; + method protected abstract void bind(java.net.InetAddress, int) throws java.io.IOException; + method protected abstract void close() throws java.io.IOException; + method protected abstract void connect(java.lang.String, int) throws java.io.IOException; + method protected abstract void connect(java.net.InetAddress, int) throws java.io.IOException; + method protected abstract void connect(java.net.SocketAddress, int) throws java.io.IOException; + method protected abstract void create(boolean) throws java.io.IOException; + method protected java.io.FileDescriptor getFileDescriptor(); + method protected java.net.InetAddress getInetAddress(); + method protected abstract java.io.InputStream getInputStream() throws java.io.IOException; + method protected int getLocalPort(); + method protected abstract java.io.OutputStream getOutputStream() throws java.io.IOException; + method protected int getPort(); + method protected abstract void listen(int) throws java.io.IOException; + method protected abstract void sendUrgentData(int) throws java.io.IOException; + method protected void setPerformancePreferences(int, int, int); + method protected void shutdownInput() throws java.io.IOException; + method protected void shutdownOutput() throws java.io.IOException; + method protected boolean supportsUrgentData(); + field protected java.net.InetAddress address; + field protected java.io.FileDescriptor fd; + field protected int localport; + field protected int port; + } + + public abstract interface SocketImplFactory { + method public abstract java.net.SocketImpl createSocketImpl(); + } + + public abstract interface SocketOptions { + method public abstract java.lang.Object getOption(int) throws java.net.SocketException; + method public abstract void setOption(int, java.lang.Object) throws java.net.SocketException; + field public static final int IP_MULTICAST_IF = 16; // 0x10 + field public static final int IP_MULTICAST_IF2 = 31; // 0x1f + field public static final int IP_MULTICAST_LOOP = 18; // 0x12 + field public static final int IP_TOS = 3; // 0x3 + field public static final int SO_BINDADDR = 15; // 0xf + field public static final int SO_BROADCAST = 32; // 0x20 + field public static final int SO_KEEPALIVE = 8; // 0x8 + field public static final int SO_LINGER = 128; // 0x80 + field public static final int SO_OOBINLINE = 4099; // 0x1003 + field public static final int SO_RCVBUF = 4098; // 0x1002 + field public static final int SO_REUSEADDR = 4; // 0x4 + field public static final int SO_SNDBUF = 4097; // 0x1001 + field public static final int SO_TIMEOUT = 4102; // 0x1006 + field public static final int TCP_NODELAY = 1; // 0x1 + } + + public final class SocketPermission extends java.security.Permission implements java.io.Serializable { + ctor public SocketPermission(java.lang.String, java.lang.String); + method public java.lang.String getActions(); + method public boolean implies(java.security.Permission); + } + + public class SocketTimeoutException extends java.io.InterruptedIOException { + ctor public SocketTimeoutException(); + ctor public SocketTimeoutException(java.lang.String); + } + + public final class URI implements java.lang.Comparable java.io.Serializable { + ctor public URI(java.lang.String) throws java.net.URISyntaxException; + ctor public URI(java.lang.String, java.lang.String, java.lang.String) throws java.net.URISyntaxException; + ctor public URI(java.lang.String, java.lang.String, java.lang.String, int, java.lang.String, java.lang.String, java.lang.String) throws java.net.URISyntaxException; + ctor public URI(java.lang.String, java.lang.String, java.lang.String, java.lang.String) throws java.net.URISyntaxException; + ctor public URI(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String) throws java.net.URISyntaxException; + method public int compareTo(java.net.URI); + method public static java.net.URI create(java.lang.String); + method public java.lang.String getAuthority(); + method public java.lang.String getFragment(); + method public java.lang.String getHost(); + method public java.lang.String getPath(); + method public int getPort(); + method public java.lang.String getQuery(); + method public java.lang.String getRawAuthority(); + method public java.lang.String getRawFragment(); + method public java.lang.String getRawPath(); + method public java.lang.String getRawQuery(); + method public java.lang.String getRawSchemeSpecificPart(); + method public java.lang.String getRawUserInfo(); + method public java.lang.String getScheme(); + method public java.lang.String getSchemeSpecificPart(); + method public java.lang.String getUserInfo(); + method public boolean isAbsolute(); + method public boolean isOpaque(); + method public java.net.URI normalize(); + method public java.net.URI parseServerAuthority() throws java.net.URISyntaxException; + method public java.net.URI relativize(java.net.URI); + method public java.net.URI resolve(java.net.URI); + method public java.net.URI resolve(java.lang.String); + method public java.lang.String toASCIIString(); + method public java.net.URL toURL() throws java.net.MalformedURLException; + } + + public class URISyntaxException extends java.lang.Exception { + ctor public URISyntaxException(java.lang.String, java.lang.String, int); + ctor public URISyntaxException(java.lang.String, java.lang.String); + method public int getIndex(); + method public java.lang.String getInput(); + method public java.lang.String getReason(); + } + + public final class URL implements java.io.Serializable { + ctor public URL(java.lang.String) throws java.net.MalformedURLException; + ctor public URL(java.net.URL, java.lang.String) throws java.net.MalformedURLException; + ctor public URL(java.net.URL, java.lang.String, java.net.URLStreamHandler) throws java.net.MalformedURLException; + ctor public URL(java.lang.String, java.lang.String, java.lang.String) throws java.net.MalformedURLException; + ctor public URL(java.lang.String, java.lang.String, int, java.lang.String) throws java.net.MalformedURLException; + ctor public URL(java.lang.String, java.lang.String, int, java.lang.String, java.net.URLStreamHandler) throws java.net.MalformedURLException; + method public java.lang.String getAuthority(); + method public final java.lang.Object getContent() throws java.io.IOException; + method public final java.lang.Object getContent(java.lang.Class[]) throws java.io.IOException; + method public int getDefaultPort(); + method public java.lang.String getFile(); + method public java.lang.String getHost(); + method public java.lang.String getPath(); + method public int getPort(); + method public java.lang.String getProtocol(); + method public java.lang.String getQuery(); + method public java.lang.String getRef(); + method public java.lang.String getUserInfo(); + method public java.net.URLConnection openConnection() throws java.io.IOException; + method public java.net.URLConnection openConnection(java.net.Proxy) throws java.io.IOException; + method public final java.io.InputStream openStream() throws java.io.IOException; + method public boolean sameFile(java.net.URL); + method protected void set(java.lang.String, java.lang.String, int, java.lang.String, java.lang.String); + method protected void set(java.lang.String, java.lang.String, int, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String); + method public static synchronized void setURLStreamHandlerFactory(java.net.URLStreamHandlerFactory); + method public java.lang.String toExternalForm(); + method public java.net.URI toURI() throws java.net.URISyntaxException; + } + + public class URLClassLoader extends java.security.SecureClassLoader { + ctor public URLClassLoader(java.net.URL[]); + ctor public URLClassLoader(java.net.URL[], java.lang.ClassLoader); + ctor public URLClassLoader(java.net.URL[], java.lang.ClassLoader, java.net.URLStreamHandlerFactory); + method protected void addURL(java.net.URL); + method protected java.lang.Package definePackage(java.lang.String, java.util.jar.Manifest, java.net.URL) throws java.lang.IllegalArgumentException; + method public java.net.URL findResource(java.lang.String); + method public java.util.Enumeration findResources(java.lang.String) throws java.io.IOException; + method public java.net.URL[] getURLs(); + method public static java.net.URLClassLoader newInstance(java.net.URL[]); + method public static java.net.URLClassLoader newInstance(java.net.URL[], java.lang.ClassLoader); + } + + public abstract class URLConnection { + ctor protected URLConnection(java.net.URL); + method public void addRequestProperty(java.lang.String, java.lang.String); + method public abstract void connect() throws java.io.IOException; + method public boolean getAllowUserInteraction(); + method public int getConnectTimeout(); + method public java.lang.Object getContent() throws java.io.IOException; + method public java.lang.Object getContent(java.lang.Class[]) throws java.io.IOException; + method public java.lang.String getContentEncoding(); + method public int getContentLength(); + method public java.lang.String getContentType(); + method public long getDate(); + method public static boolean getDefaultAllowUserInteraction(); + method public static deprecated java.lang.String getDefaultRequestProperty(java.lang.String); + method public boolean getDefaultUseCaches(); + method public boolean getDoInput(); + method public boolean getDoOutput(); + method public long getExpiration(); + method public static java.net.FileNameMap getFileNameMap(); + method public java.lang.String getHeaderField(int); + method public java.lang.String getHeaderField(java.lang.String); + method public long getHeaderFieldDate(java.lang.String, long); + method public int getHeaderFieldInt(java.lang.String, int); + method public java.lang.String getHeaderFieldKey(int); + method public java.util.Map> getHeaderFields(); + method public long getIfModifiedSince(); + method public java.io.InputStream getInputStream() throws java.io.IOException; + method public long getLastModified(); + method public java.io.OutputStream getOutputStream() throws java.io.IOException; + method public java.security.Permission getPermission() throws java.io.IOException; + method public int getReadTimeout(); + method public java.util.Map> getRequestProperties(); + method public java.lang.String getRequestProperty(java.lang.String); + method public java.net.URL getURL(); + method public boolean getUseCaches(); + method public static java.lang.String guessContentTypeFromName(java.lang.String); + method public static java.lang.String guessContentTypeFromStream(java.io.InputStream) throws java.io.IOException; + method public void setAllowUserInteraction(boolean); + method public void setConnectTimeout(int); + method public static synchronized void setContentHandlerFactory(java.net.ContentHandlerFactory); + method public static void setDefaultAllowUserInteraction(boolean); + method public static deprecated void setDefaultRequestProperty(java.lang.String, java.lang.String); + method public void setDefaultUseCaches(boolean); + method public void setDoInput(boolean); + method public void setDoOutput(boolean); + method public static void setFileNameMap(java.net.FileNameMap); + method public void setIfModifiedSince(long); + method public void setReadTimeout(int); + method public void setRequestProperty(java.lang.String, java.lang.String); + method public void setUseCaches(boolean); + field protected boolean allowUserInteraction; + field protected boolean connected; + field protected boolean doInput; + field protected boolean doOutput; + field protected long ifModifiedSince; + field protected java.net.URL url; + field protected boolean useCaches; + } + + public class URLDecoder { + ctor public URLDecoder(); + method public static deprecated java.lang.String decode(java.lang.String); + method public static java.lang.String decode(java.lang.String, java.lang.String) throws java.io.UnsupportedEncodingException; + } + + public class URLEncoder { + method public static deprecated java.lang.String encode(java.lang.String); + method public static java.lang.String encode(java.lang.String, java.lang.String) throws java.io.UnsupportedEncodingException; + } + + public abstract class URLStreamHandler { + ctor public URLStreamHandler(); + method protected boolean equals(java.net.URL, java.net.URL); + method protected int getDefaultPort(); + method protected java.net.InetAddress getHostAddress(java.net.URL); + method protected int hashCode(java.net.URL); + method protected boolean hostsEqual(java.net.URL, java.net.URL); + method protected abstract java.net.URLConnection openConnection(java.net.URL) throws java.io.IOException; + method protected java.net.URLConnection openConnection(java.net.URL, java.net.Proxy) throws java.io.IOException; + method protected void parseURL(java.net.URL, java.lang.String, int, int); + method protected boolean sameFile(java.net.URL, java.net.URL); + method protected deprecated void setURL(java.net.URL, java.lang.String, java.lang.String, int, java.lang.String, java.lang.String); + method protected void setURL(java.net.URL, java.lang.String, java.lang.String, int, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String); + method protected java.lang.String toExternalForm(java.net.URL); + } + + public abstract interface URLStreamHandlerFactory { + method public abstract java.net.URLStreamHandler createURLStreamHandler(java.lang.String); + } + + public class UnknownHostException extends java.io.IOException { + ctor public UnknownHostException(); + ctor public UnknownHostException(java.lang.String); + } + + public class UnknownServiceException extends java.io.IOException { + ctor public UnknownServiceException(); + ctor public UnknownServiceException(java.lang.String); + } + +} + +package java.nio { + + public abstract class Buffer { + method public abstract java.lang.Object array(); + method public abstract int arrayOffset(); + method public final int capacity(); + method public final java.nio.Buffer clear(); + method public final java.nio.Buffer flip(); + method public abstract boolean hasArray(); + method public final boolean hasRemaining(); + method public abstract boolean isDirect(); + method public abstract boolean isReadOnly(); + method public final int limit(); + method public final java.nio.Buffer limit(int); + method public final java.nio.Buffer mark(); + method public final int position(); + method public final java.nio.Buffer position(int); + method public final int remaining(); + method public final java.nio.Buffer reset(); + method public final java.nio.Buffer rewind(); + } + + public class BufferOverflowException extends java.lang.RuntimeException { + ctor public BufferOverflowException(); + } + + public class BufferUnderflowException extends java.lang.RuntimeException { + ctor public BufferUnderflowException(); + } + + public abstract class ByteBuffer extends java.nio.Buffer implements java.lang.Comparable { + method public static java.nio.ByteBuffer allocate(int); + method public static java.nio.ByteBuffer allocateDirect(int); + method public final byte[] array(); + method public final int arrayOffset(); + method public abstract java.nio.CharBuffer asCharBuffer(); + method public abstract java.nio.DoubleBuffer asDoubleBuffer(); + method public abstract java.nio.FloatBuffer asFloatBuffer(); + method public abstract java.nio.IntBuffer asIntBuffer(); + method public abstract java.nio.LongBuffer asLongBuffer(); + method public abstract java.nio.ByteBuffer asReadOnlyBuffer(); + method public abstract java.nio.ShortBuffer asShortBuffer(); + method public abstract java.nio.ByteBuffer compact(); + method public int compareTo(java.nio.ByteBuffer); + method public abstract java.nio.ByteBuffer duplicate(); + method public abstract byte get(); + method public java.nio.ByteBuffer get(byte[]); + method public java.nio.ByteBuffer get(byte[], int, int); + method public abstract byte get(int); + method public abstract char getChar(); + method public abstract char getChar(int); + method public abstract double getDouble(); + method public abstract double getDouble(int); + method public abstract float getFloat(); + method public abstract float getFloat(int); + method public abstract int getInt(); + method public abstract int getInt(int); + method public abstract long getLong(); + method public abstract long getLong(int); + method public abstract short getShort(); + method public abstract short getShort(int); + method public final boolean hasArray(); + method public abstract boolean isDirect(); + method public final java.nio.ByteOrder order(); + method public final java.nio.ByteBuffer order(java.nio.ByteOrder); + method public abstract java.nio.ByteBuffer put(byte); + method public final java.nio.ByteBuffer put(byte[]); + method public java.nio.ByteBuffer put(byte[], int, int); + method public java.nio.ByteBuffer put(java.nio.ByteBuffer); + method public abstract java.nio.ByteBuffer put(int, byte); + method public abstract java.nio.ByteBuffer putChar(char); + method public abstract java.nio.ByteBuffer putChar(int, char); + method public abstract java.nio.ByteBuffer putDouble(double); + method public abstract java.nio.ByteBuffer putDouble(int, double); + method public abstract java.nio.ByteBuffer putFloat(float); + method public abstract java.nio.ByteBuffer putFloat(int, float); + method public abstract java.nio.ByteBuffer putInt(int); + method public abstract java.nio.ByteBuffer putInt(int, int); + method public abstract java.nio.ByteBuffer putLong(long); + method public abstract java.nio.ByteBuffer putLong(int, long); + method public abstract java.nio.ByteBuffer putShort(short); + method public abstract java.nio.ByteBuffer putShort(int, short); + method public abstract java.nio.ByteBuffer slice(); + method public static java.nio.ByteBuffer wrap(byte[]); + method public static java.nio.ByteBuffer wrap(byte[], int, int); + } + + public final class ByteOrder { + method public static java.nio.ByteOrder nativeOrder(); + field public static final java.nio.ByteOrder BIG_ENDIAN; + field public static final java.nio.ByteOrder LITTLE_ENDIAN; + } + + public abstract class CharBuffer extends java.nio.Buffer implements java.lang.Appendable java.lang.CharSequence java.lang.Comparable java.lang.Readable { + method public static java.nio.CharBuffer allocate(int); + method public java.nio.CharBuffer append(char); + method public java.nio.CharBuffer append(java.lang.CharSequence); + method public java.nio.CharBuffer append(java.lang.CharSequence, int, int); + method public final char[] array(); + method public final int arrayOffset(); + method public abstract java.nio.CharBuffer asReadOnlyBuffer(); + method public final char charAt(int); + method public abstract java.nio.CharBuffer compact(); + method public int compareTo(java.nio.CharBuffer); + method public abstract java.nio.CharBuffer duplicate(); + method public abstract char get(); + method public java.nio.CharBuffer get(char[]); + method public java.nio.CharBuffer get(char[], int, int); + method public abstract char get(int); + method public final boolean hasArray(); + method public abstract boolean isDirect(); + method public final int length(); + method public abstract java.nio.ByteOrder order(); + method public abstract java.nio.CharBuffer put(char); + method public final java.nio.CharBuffer put(char[]); + method public java.nio.CharBuffer put(char[], int, int); + method public java.nio.CharBuffer put(java.nio.CharBuffer); + method public abstract java.nio.CharBuffer put(int, char); + method public final java.nio.CharBuffer put(java.lang.String); + method public java.nio.CharBuffer put(java.lang.String, int, int); + method public int read(java.nio.CharBuffer) throws java.io.IOException; + method public abstract java.nio.CharBuffer slice(); + method public abstract java.lang.CharSequence subSequence(int, int); + method public static java.nio.CharBuffer wrap(char[]); + method public static java.nio.CharBuffer wrap(char[], int, int); + method public static java.nio.CharBuffer wrap(java.lang.CharSequence); + method public static java.nio.CharBuffer wrap(java.lang.CharSequence, int, int); + } + + public abstract class DoubleBuffer extends java.nio.Buffer implements java.lang.Comparable { + method public static java.nio.DoubleBuffer allocate(int); + method public final double[] array(); + method public final int arrayOffset(); + method public abstract java.nio.DoubleBuffer asReadOnlyBuffer(); + method public abstract java.nio.DoubleBuffer compact(); + method public int compareTo(java.nio.DoubleBuffer); + method public abstract java.nio.DoubleBuffer duplicate(); + method public abstract double get(); + method public java.nio.DoubleBuffer get(double[]); + method public java.nio.DoubleBuffer get(double[], int, int); + method public abstract double get(int); + method public final boolean hasArray(); + method public abstract boolean isDirect(); + method public abstract java.nio.ByteOrder order(); + method public abstract java.nio.DoubleBuffer put(double); + method public final java.nio.DoubleBuffer put(double[]); + method public java.nio.DoubleBuffer put(double[], int, int); + method public java.nio.DoubleBuffer put(java.nio.DoubleBuffer); + method public abstract java.nio.DoubleBuffer put(int, double); + method public abstract java.nio.DoubleBuffer slice(); + method public static java.nio.DoubleBuffer wrap(double[]); + method public static java.nio.DoubleBuffer wrap(double[], int, int); + } + + public abstract class FloatBuffer extends java.nio.Buffer implements java.lang.Comparable { + method public static java.nio.FloatBuffer allocate(int); + method public final float[] array(); + method public final int arrayOffset(); + method public abstract java.nio.FloatBuffer asReadOnlyBuffer(); + method public abstract java.nio.FloatBuffer compact(); + method public int compareTo(java.nio.FloatBuffer); + method public abstract java.nio.FloatBuffer duplicate(); + method public abstract float get(); + method public java.nio.FloatBuffer get(float[]); + method public java.nio.FloatBuffer get(float[], int, int); + method public abstract float get(int); + method public final boolean hasArray(); + method public abstract boolean isDirect(); + method public abstract java.nio.ByteOrder order(); + method public abstract java.nio.FloatBuffer put(float); + method public final java.nio.FloatBuffer put(float[]); + method public java.nio.FloatBuffer put(float[], int, int); + method public java.nio.FloatBuffer put(java.nio.FloatBuffer); + method public abstract java.nio.FloatBuffer put(int, float); + method public abstract java.nio.FloatBuffer slice(); + method public static java.nio.FloatBuffer wrap(float[]); + method public static java.nio.FloatBuffer wrap(float[], int, int); + } + + public abstract class IntBuffer extends java.nio.Buffer implements java.lang.Comparable { + method public static java.nio.IntBuffer allocate(int); + method public final int[] array(); + method public final int arrayOffset(); + method public abstract java.nio.IntBuffer asReadOnlyBuffer(); + method public abstract java.nio.IntBuffer compact(); + method public int compareTo(java.nio.IntBuffer); + method public abstract java.nio.IntBuffer duplicate(); + method public abstract int get(); + method public java.nio.IntBuffer get(int[]); + method public java.nio.IntBuffer get(int[], int, int); + method public abstract int get(int); + method public final boolean hasArray(); + method public abstract boolean isDirect(); + method public abstract java.nio.ByteOrder order(); + method public abstract java.nio.IntBuffer put(int); + method public final java.nio.IntBuffer put(int[]); + method public java.nio.IntBuffer put(int[], int, int); + method public java.nio.IntBuffer put(java.nio.IntBuffer); + method public abstract java.nio.IntBuffer put(int, int); + method public abstract java.nio.IntBuffer slice(); + method public static java.nio.IntBuffer wrap(int[]); + method public static java.nio.IntBuffer wrap(int[], int, int); + } + + public class InvalidMarkException extends java.lang.IllegalStateException { + ctor public InvalidMarkException(); + } + + public abstract class LongBuffer extends java.nio.Buffer implements java.lang.Comparable { + method public static java.nio.LongBuffer allocate(int); + method public final long[] array(); + method public final int arrayOffset(); + method public abstract java.nio.LongBuffer asReadOnlyBuffer(); + method public abstract java.nio.LongBuffer compact(); + method public int compareTo(java.nio.LongBuffer); + method public abstract java.nio.LongBuffer duplicate(); + method public abstract long get(); + method public java.nio.LongBuffer get(long[]); + method public java.nio.LongBuffer get(long[], int, int); + method public abstract long get(int); + method public final boolean hasArray(); + method public abstract boolean isDirect(); + method public abstract java.nio.ByteOrder order(); + method public abstract java.nio.LongBuffer put(long); + method public final java.nio.LongBuffer put(long[]); + method public java.nio.LongBuffer put(long[], int, int); + method public java.nio.LongBuffer put(java.nio.LongBuffer); + method public abstract java.nio.LongBuffer put(int, long); + method public abstract java.nio.LongBuffer slice(); + method public static java.nio.LongBuffer wrap(long[]); + method public static java.nio.LongBuffer wrap(long[], int, int); + } + + public abstract class MappedByteBuffer extends java.nio.ByteBuffer { + method public final java.nio.MappedByteBuffer force(); + method public final boolean isLoaded(); + method public final java.nio.MappedByteBuffer load(); + } + + public class ReadOnlyBufferException extends java.lang.UnsupportedOperationException { + ctor public ReadOnlyBufferException(); + } + + public abstract class ShortBuffer extends java.nio.Buffer implements java.lang.Comparable { + method public static java.nio.ShortBuffer allocate(int); + method public final short[] array(); + method public final int arrayOffset(); + method public abstract java.nio.ShortBuffer asReadOnlyBuffer(); + method public abstract java.nio.ShortBuffer compact(); + method public int compareTo(java.nio.ShortBuffer); + method public abstract java.nio.ShortBuffer duplicate(); + method public abstract short get(); + method public java.nio.ShortBuffer get(short[]); + method public java.nio.ShortBuffer get(short[], int, int); + method public abstract short get(int); + method public final boolean hasArray(); + method public abstract boolean isDirect(); + method public abstract java.nio.ByteOrder order(); + method public abstract java.nio.ShortBuffer put(short); + method public final java.nio.ShortBuffer put(short[]); + method public java.nio.ShortBuffer put(short[], int, int); + method public java.nio.ShortBuffer put(java.nio.ShortBuffer); + method public abstract java.nio.ShortBuffer put(int, short); + method public abstract java.nio.ShortBuffer slice(); + method public static java.nio.ShortBuffer wrap(short[]); + method public static java.nio.ShortBuffer wrap(short[], int, int); + } + +} + +package java.nio.channels { + + public class AlreadyConnectedException extends java.lang.IllegalStateException { + ctor public AlreadyConnectedException(); + } + + public class AsynchronousCloseException extends java.nio.channels.ClosedChannelException { + ctor public AsynchronousCloseException(); + } + + public abstract interface ByteChannel implements java.nio.channels.ReadableByteChannel java.nio.channels.WritableByteChannel { + } + + public class CancelledKeyException extends java.lang.IllegalStateException { + ctor public CancelledKeyException(); + } + + public abstract interface Channel implements java.io.Closeable { + method public abstract void close() throws java.io.IOException; + method public abstract boolean isOpen(); + } + + public final class Channels { + method public static java.nio.channels.ReadableByteChannel newChannel(java.io.InputStream); + method public static java.nio.channels.WritableByteChannel newChannel(java.io.OutputStream); + method public static java.io.InputStream newInputStream(java.nio.channels.ReadableByteChannel); + method public static java.io.OutputStream newOutputStream(java.nio.channels.WritableByteChannel); + method public static java.io.Reader newReader(java.nio.channels.ReadableByteChannel, java.nio.charset.CharsetDecoder, int); + method public static java.io.Reader newReader(java.nio.channels.ReadableByteChannel, java.lang.String); + method public static java.io.Writer newWriter(java.nio.channels.WritableByteChannel, java.nio.charset.CharsetEncoder, int); + method public static java.io.Writer newWriter(java.nio.channels.WritableByteChannel, java.lang.String); + } + + public class ClosedByInterruptException extends java.nio.channels.AsynchronousCloseException { + ctor public ClosedByInterruptException(); + } + + public class ClosedChannelException extends java.io.IOException { + ctor public ClosedChannelException(); + } + + public class ClosedSelectorException extends java.lang.IllegalStateException { + ctor public ClosedSelectorException(); + } + + public class ConnectionPendingException extends java.lang.IllegalStateException { + ctor public ConnectionPendingException(); + } + + public abstract class DatagramChannel extends java.nio.channels.spi.AbstractSelectableChannel implements java.nio.channels.ByteChannel java.nio.channels.GatheringByteChannel java.nio.channels.ScatteringByteChannel { + ctor protected DatagramChannel(java.nio.channels.spi.SelectorProvider); + method public abstract java.nio.channels.DatagramChannel connect(java.net.SocketAddress) throws java.io.IOException; + method public abstract java.nio.channels.DatagramChannel disconnect() throws java.io.IOException; + method public abstract boolean isConnected(); + method public static java.nio.channels.DatagramChannel open() throws java.io.IOException; + method public abstract int read(java.nio.ByteBuffer) throws java.io.IOException; + method public abstract long read(java.nio.ByteBuffer[], int, int) throws java.io.IOException; + method public final synchronized long read(java.nio.ByteBuffer[]) throws java.io.IOException; + method public abstract java.net.SocketAddress receive(java.nio.ByteBuffer) throws java.io.IOException; + method public abstract int send(java.nio.ByteBuffer, java.net.SocketAddress) throws java.io.IOException; + method public abstract java.net.DatagramSocket socket(); + method public final int validOps(); + method public abstract int write(java.nio.ByteBuffer) throws java.io.IOException; + method public abstract long write(java.nio.ByteBuffer[], int, int) throws java.io.IOException; + method public final synchronized long write(java.nio.ByteBuffer[]) throws java.io.IOException; + } + + public abstract class FileChannel extends java.nio.channels.spi.AbstractInterruptibleChannel implements java.nio.channels.ByteChannel java.nio.channels.GatheringByteChannel java.nio.channels.ScatteringByteChannel { + ctor protected FileChannel(); + method public abstract void force(boolean) throws java.io.IOException; + method public final java.nio.channels.FileLock lock() throws java.io.IOException; + method public abstract java.nio.channels.FileLock lock(long, long, boolean) throws java.io.IOException; + method public abstract java.nio.MappedByteBuffer map(java.nio.channels.FileChannel.MapMode, long, long) throws java.io.IOException; + method public abstract long position() throws java.io.IOException; + method public abstract java.nio.channels.FileChannel position(long) throws java.io.IOException; + method public abstract int read(java.nio.ByteBuffer) throws java.io.IOException; + method public abstract int read(java.nio.ByteBuffer, long) throws java.io.IOException; + method public final long read(java.nio.ByteBuffer[]) throws java.io.IOException; + method public abstract long read(java.nio.ByteBuffer[], int, int) throws java.io.IOException; + method public abstract long size() throws java.io.IOException; + method public abstract long transferFrom(java.nio.channels.ReadableByteChannel, long, long) throws java.io.IOException; + method public abstract long transferTo(long, long, java.nio.channels.WritableByteChannel) throws java.io.IOException; + method public abstract java.nio.channels.FileChannel truncate(long) throws java.io.IOException; + method public final java.nio.channels.FileLock tryLock() throws java.io.IOException; + method public abstract java.nio.channels.FileLock tryLock(long, long, boolean) throws java.io.IOException; + method public abstract int write(java.nio.ByteBuffer) throws java.io.IOException; + method public abstract int write(java.nio.ByteBuffer, long) throws java.io.IOException; + method public final long write(java.nio.ByteBuffer[]) throws java.io.IOException; + method public abstract long write(java.nio.ByteBuffer[], int, int) throws java.io.IOException; + } + + public static class FileChannel.MapMode { + field public static final java.nio.channels.FileChannel.MapMode PRIVATE; + field public static final java.nio.channels.FileChannel.MapMode READ_ONLY; + field public static final java.nio.channels.FileChannel.MapMode READ_WRITE; + } + + public abstract class FileLock { + ctor protected FileLock(java.nio.channels.FileChannel, long, long, boolean); + method public final java.nio.channels.FileChannel channel(); + method public final boolean isShared(); + method public abstract boolean isValid(); + method public final boolean overlaps(long, long); + method public final long position(); + method public abstract void release() throws java.io.IOException; + method public final long size(); + method public final java.lang.String toString(); + } + + public class FileLockInterruptionException extends java.io.IOException { + ctor public FileLockInterruptionException(); + } + + public abstract interface GatheringByteChannel implements java.nio.channels.WritableByteChannel { + method public abstract long write(java.nio.ByteBuffer[]) throws java.io.IOException; + method public abstract long write(java.nio.ByteBuffer[], int, int) throws java.io.IOException; + } + + public class IllegalBlockingModeException extends java.lang.IllegalStateException { + ctor public IllegalBlockingModeException(); + } + + public class IllegalSelectorException extends java.lang.IllegalArgumentException { + ctor public IllegalSelectorException(); + } + + public abstract interface InterruptibleChannel implements java.nio.channels.Channel { + method public abstract void close() throws java.io.IOException; + } + + public class NoConnectionPendingException extends java.lang.IllegalStateException { + ctor public NoConnectionPendingException(); + } + + public class NonReadableChannelException extends java.lang.IllegalStateException { + ctor public NonReadableChannelException(); + } + + public class NonWritableChannelException extends java.lang.IllegalStateException { + ctor public NonWritableChannelException(); + } + + public class NotYetBoundException extends java.lang.IllegalStateException { + ctor public NotYetBoundException(); + } + + public class NotYetConnectedException extends java.lang.IllegalStateException { + ctor public NotYetConnectedException(); + } + + public class OverlappingFileLockException extends java.lang.IllegalStateException { + ctor public OverlappingFileLockException(); + } + + public abstract class Pipe { + ctor protected Pipe(); + method public static java.nio.channels.Pipe open() throws java.io.IOException; + method public abstract java.nio.channels.Pipe.SinkChannel sink(); + method public abstract java.nio.channels.Pipe.SourceChannel source(); + } + + public static abstract class Pipe.SinkChannel extends java.nio.channels.spi.AbstractSelectableChannel implements java.nio.channels.GatheringByteChannel java.nio.channels.WritableByteChannel { + ctor protected Pipe.SinkChannel(java.nio.channels.spi.SelectorProvider); + method public final int validOps(); + } + + public static abstract class Pipe.SourceChannel extends java.nio.channels.spi.AbstractSelectableChannel implements java.nio.channels.ReadableByteChannel java.nio.channels.ScatteringByteChannel { + ctor protected Pipe.SourceChannel(java.nio.channels.spi.SelectorProvider); + method public final int validOps(); + } + + public abstract interface ReadableByteChannel implements java.nio.channels.Channel { + method public abstract int read(java.nio.ByteBuffer) throws java.io.IOException; + } + + public abstract interface ScatteringByteChannel implements java.nio.channels.ReadableByteChannel { + method public abstract long read(java.nio.ByteBuffer[]) throws java.io.IOException; + method public abstract long read(java.nio.ByteBuffer[], int, int) throws java.io.IOException; + } + + public abstract class SelectableChannel extends java.nio.channels.spi.AbstractInterruptibleChannel implements java.nio.channels.Channel { + ctor protected SelectableChannel(); + method public abstract java.lang.Object blockingLock(); + method public abstract java.nio.channels.SelectableChannel configureBlocking(boolean) throws java.io.IOException; + method public abstract boolean isBlocking(); + method public abstract boolean isRegistered(); + method public abstract java.nio.channels.SelectionKey keyFor(java.nio.channels.Selector); + method public abstract java.nio.channels.spi.SelectorProvider provider(); + method public final java.nio.channels.SelectionKey register(java.nio.channels.Selector, int) throws java.nio.channels.ClosedChannelException; + method public abstract java.nio.channels.SelectionKey register(java.nio.channels.Selector, int, java.lang.Object) throws java.nio.channels.ClosedChannelException; + method public abstract int validOps(); + } + + public abstract class SelectionKey { + ctor protected SelectionKey(); + method public final java.lang.Object attach(java.lang.Object); + method public final java.lang.Object attachment(); + method public abstract void cancel(); + method public abstract java.nio.channels.SelectableChannel channel(); + method public abstract int interestOps(); + method public abstract java.nio.channels.SelectionKey interestOps(int); + method public final boolean isAcceptable(); + method public final boolean isConnectable(); + method public final boolean isReadable(); + method public abstract boolean isValid(); + method public final boolean isWritable(); + method public abstract int readyOps(); + method public abstract java.nio.channels.Selector selector(); + field public static final int OP_ACCEPT = 16; // 0x10 + field public static final int OP_CONNECT = 8; // 0x8 + field public static final int OP_READ = 1; // 0x1 + field public static final int OP_WRITE = 4; // 0x4 + } + + public abstract class Selector { + ctor protected Selector(); + method public abstract void close() throws java.io.IOException; + method public abstract boolean isOpen(); + method public abstract java.util.Set keys(); + method public static java.nio.channels.Selector open() throws java.io.IOException; + method public abstract java.nio.channels.spi.SelectorProvider provider(); + method public abstract int select() throws java.io.IOException; + method public abstract int select(long) throws java.io.IOException; + method public abstract int selectNow() throws java.io.IOException; + method public abstract java.util.Set selectedKeys(); + method public abstract java.nio.channels.Selector wakeup(); + } + + public abstract class ServerSocketChannel extends java.nio.channels.spi.AbstractSelectableChannel { + ctor protected ServerSocketChannel(java.nio.channels.spi.SelectorProvider); + method public abstract java.nio.channels.SocketChannel accept() throws java.io.IOException; + method public static java.nio.channels.ServerSocketChannel open() throws java.io.IOException; + method public abstract java.net.ServerSocket socket(); + method public final int validOps(); + } + + public abstract class SocketChannel extends java.nio.channels.spi.AbstractSelectableChannel implements java.nio.channels.ByteChannel java.nio.channels.GatheringByteChannel java.nio.channels.ScatteringByteChannel { + ctor protected SocketChannel(java.nio.channels.spi.SelectorProvider); + method public abstract boolean connect(java.net.SocketAddress) throws java.io.IOException; + method public abstract boolean finishConnect() throws java.io.IOException; + method public abstract boolean isConnected(); + method public abstract boolean isConnectionPending(); + method public static java.nio.channels.SocketChannel open() throws java.io.IOException; + method public static java.nio.channels.SocketChannel open(java.net.SocketAddress) throws java.io.IOException; + method public abstract int read(java.nio.ByteBuffer) throws java.io.IOException; + method public abstract long read(java.nio.ByteBuffer[], int, int) throws java.io.IOException; + method public final synchronized long read(java.nio.ByteBuffer[]) throws java.io.IOException; + method public abstract java.net.Socket socket(); + method public final int validOps(); + method public abstract int write(java.nio.ByteBuffer) throws java.io.IOException; + method public abstract long write(java.nio.ByteBuffer[], int, int) throws java.io.IOException; + method public final synchronized long write(java.nio.ByteBuffer[]) throws java.io.IOException; + } + + public class UnresolvedAddressException extends java.lang.IllegalArgumentException { + ctor public UnresolvedAddressException(); + } + + public class UnsupportedAddressTypeException extends java.lang.IllegalArgumentException { + ctor public UnsupportedAddressTypeException(); + } + + public abstract interface WritableByteChannel implements java.nio.channels.Channel { + method public abstract int write(java.nio.ByteBuffer) throws java.io.IOException; + } + +} + +package java.nio.channels.spi { + + public abstract class AbstractInterruptibleChannel implements java.nio.channels.Channel java.nio.channels.InterruptibleChannel { + ctor protected AbstractInterruptibleChannel(); + method protected final void begin(); + method public final void close() throws java.io.IOException; + method protected final void end(boolean) throws java.nio.channels.AsynchronousCloseException; + method protected abstract void implCloseChannel() throws java.io.IOException; + method public final synchronized boolean isOpen(); + } + + public abstract class AbstractSelectableChannel extends java.nio.channels.SelectableChannel { + ctor protected AbstractSelectableChannel(java.nio.channels.spi.SelectorProvider); + method public final java.lang.Object blockingLock(); + method public final java.nio.channels.SelectableChannel configureBlocking(boolean) throws java.io.IOException; + method protected final synchronized void implCloseChannel() throws java.io.IOException; + method protected abstract void implCloseSelectableChannel() throws java.io.IOException; + method protected abstract void implConfigureBlocking(boolean) throws java.io.IOException; + method public final boolean isBlocking(); + method public final synchronized boolean isRegistered(); + method public final synchronized java.nio.channels.SelectionKey keyFor(java.nio.channels.Selector); + method public final java.nio.channels.spi.SelectorProvider provider(); + method public final java.nio.channels.SelectionKey register(java.nio.channels.Selector, int, java.lang.Object) throws java.nio.channels.ClosedChannelException; + } + + public abstract class AbstractSelectionKey extends java.nio.channels.SelectionKey { + ctor protected AbstractSelectionKey(); + method public final void cancel(); + method public final boolean isValid(); + } + + public abstract class AbstractSelector extends java.nio.channels.Selector { + ctor protected AbstractSelector(java.nio.channels.spi.SelectorProvider); + method protected final void begin(); + method protected final java.util.Set cancelledKeys(); + method public final void close() throws java.io.IOException; + method protected final void deregister(java.nio.channels.spi.AbstractSelectionKey); + method protected final void end(); + method protected abstract void implCloseSelector() throws java.io.IOException; + method public final boolean isOpen(); + method public final java.nio.channels.spi.SelectorProvider provider(); + method protected abstract java.nio.channels.SelectionKey register(java.nio.channels.spi.AbstractSelectableChannel, int, java.lang.Object); + } + + public abstract class SelectorProvider { + ctor protected SelectorProvider(); + method public java.nio.channels.Channel inheritedChannel() throws java.io.IOException; + method public abstract java.nio.channels.DatagramChannel openDatagramChannel() throws java.io.IOException; + method public abstract java.nio.channels.Pipe openPipe() throws java.io.IOException; + method public abstract java.nio.channels.spi.AbstractSelector openSelector() throws java.io.IOException; + method public abstract java.nio.channels.ServerSocketChannel openServerSocketChannel() throws java.io.IOException; + method public abstract java.nio.channels.SocketChannel openSocketChannel() throws java.io.IOException; + method public static synchronized java.nio.channels.spi.SelectorProvider provider(); + } + +} + +package java.nio.charset { + + public class CharacterCodingException extends java.io.IOException { + ctor public CharacterCodingException(); + } + + public abstract class Charset implements java.lang.Comparable { + ctor protected Charset(java.lang.String, java.lang.String[]); + method public final java.util.Set aliases(); + method public static java.util.SortedMap availableCharsets(); + method public boolean canEncode(); + method public final int compareTo(java.nio.charset.Charset); + method public abstract boolean contains(java.nio.charset.Charset); + method public final java.nio.CharBuffer decode(java.nio.ByteBuffer); + method public static java.nio.charset.Charset defaultCharset(); + method public java.lang.String displayName(); + method public java.lang.String displayName(java.util.Locale); + method public final java.nio.ByteBuffer encode(java.nio.CharBuffer); + method public final java.nio.ByteBuffer encode(java.lang.String); + method public final boolean equals(java.lang.Object); + method public static java.nio.charset.Charset forName(java.lang.String); + method public final int hashCode(); + method public final boolean isRegistered(); + method public static boolean isSupported(java.lang.String); + method public final java.lang.String name(); + method public abstract java.nio.charset.CharsetDecoder newDecoder(); + method public abstract java.nio.charset.CharsetEncoder newEncoder(); + method public final java.lang.String toString(); + } + + public abstract class CharsetDecoder { + ctor protected CharsetDecoder(java.nio.charset.Charset, float, float); + method public final float averageCharsPerByte(); + method public final java.nio.charset.Charset charset(); + method public final java.nio.CharBuffer decode(java.nio.ByteBuffer) throws java.nio.charset.CharacterCodingException; + method public final java.nio.charset.CoderResult decode(java.nio.ByteBuffer, java.nio.CharBuffer, boolean); + method protected abstract java.nio.charset.CoderResult decodeLoop(java.nio.ByteBuffer, java.nio.CharBuffer); + method public java.nio.charset.Charset detectedCharset(); + method public final java.nio.charset.CoderResult flush(java.nio.CharBuffer); + method protected java.nio.charset.CoderResult implFlush(java.nio.CharBuffer); + method protected void implOnMalformedInput(java.nio.charset.CodingErrorAction); + method protected void implOnUnmappableCharacter(java.nio.charset.CodingErrorAction); + method protected void implReplaceWith(java.lang.String); + method protected void implReset(); + method public boolean isAutoDetecting(); + method public boolean isCharsetDetected(); + method public java.nio.charset.CodingErrorAction malformedInputAction(); + method public final float maxCharsPerByte(); + method public final java.nio.charset.CharsetDecoder onMalformedInput(java.nio.charset.CodingErrorAction); + method public final java.nio.charset.CharsetDecoder onUnmappableCharacter(java.nio.charset.CodingErrorAction); + method public final java.nio.charset.CharsetDecoder replaceWith(java.lang.String); + method public final java.lang.String replacement(); + method public final java.nio.charset.CharsetDecoder reset(); + method public java.nio.charset.CodingErrorAction unmappableCharacterAction(); + } + + public abstract class CharsetEncoder { + ctor protected CharsetEncoder(java.nio.charset.Charset, float, float); + ctor protected CharsetEncoder(java.nio.charset.Charset, float, float, byte[]); + method public final float averageBytesPerChar(); + method public boolean canEncode(char); + method public boolean canEncode(java.lang.CharSequence); + method public final java.nio.charset.Charset charset(); + method public final java.nio.ByteBuffer encode(java.nio.CharBuffer) throws java.nio.charset.CharacterCodingException; + method public final java.nio.charset.CoderResult encode(java.nio.CharBuffer, java.nio.ByteBuffer, boolean); + method protected abstract java.nio.charset.CoderResult encodeLoop(java.nio.CharBuffer, java.nio.ByteBuffer); + method public final java.nio.charset.CoderResult flush(java.nio.ByteBuffer); + method protected java.nio.charset.CoderResult implFlush(java.nio.ByteBuffer); + method protected void implOnMalformedInput(java.nio.charset.CodingErrorAction); + method protected void implOnUnmappableCharacter(java.nio.charset.CodingErrorAction); + method protected void implReplaceWith(byte[]); + method protected void implReset(); + method public boolean isLegalReplacement(byte[]); + method public java.nio.charset.CodingErrorAction malformedInputAction(); + method public final float maxBytesPerChar(); + method public final java.nio.charset.CharsetEncoder onMalformedInput(java.nio.charset.CodingErrorAction); + method public final java.nio.charset.CharsetEncoder onUnmappableCharacter(java.nio.charset.CodingErrorAction); + method public final java.nio.charset.CharsetEncoder replaceWith(byte[]); + method public final byte[] replacement(); + method public final java.nio.charset.CharsetEncoder reset(); + method public java.nio.charset.CodingErrorAction unmappableCharacterAction(); + } + + public class CoderMalfunctionError extends java.lang.Error { + ctor public CoderMalfunctionError(java.lang.Exception); + } + + public class CoderResult { + method public boolean isError(); + method public boolean isMalformed(); + method public boolean isOverflow(); + method public boolean isUnderflow(); + method public boolean isUnmappable(); + method public int length() throws java.lang.UnsupportedOperationException; + method public static synchronized java.nio.charset.CoderResult malformedForLength(int) throws java.lang.IllegalArgumentException; + method public void throwException() throws java.nio.BufferOverflowException, java.nio.BufferUnderflowException, java.nio.charset.CharacterCodingException, java.nio.charset.MalformedInputException, java.nio.charset.UnmappableCharacterException; + method public static synchronized java.nio.charset.CoderResult unmappableForLength(int) throws java.lang.IllegalArgumentException; + field public static final java.nio.charset.CoderResult OVERFLOW; + field public static final java.nio.charset.CoderResult UNDERFLOW; + } + + public class CodingErrorAction { + field public static final java.nio.charset.CodingErrorAction IGNORE; + field public static final java.nio.charset.CodingErrorAction REPLACE; + field public static final java.nio.charset.CodingErrorAction REPORT; + } + + public class IllegalCharsetNameException extends java.lang.IllegalArgumentException { + ctor public IllegalCharsetNameException(java.lang.String); + method public java.lang.String getCharsetName(); + } + + public class MalformedInputException extends java.nio.charset.CharacterCodingException { + ctor public MalformedInputException(int); + method public int getInputLength(); + } + + public class UnmappableCharacterException extends java.nio.charset.CharacterCodingException { + ctor public UnmappableCharacterException(int); + method public int getInputLength(); + } + + public class UnsupportedCharsetException extends java.lang.IllegalArgumentException { + ctor public UnsupportedCharsetException(java.lang.String); + method public java.lang.String getCharsetName(); + } + +} + +package java.nio.charset.spi { + + public abstract class CharsetProvider { + ctor protected CharsetProvider(); + method public abstract java.nio.charset.Charset charsetForName(java.lang.String); + method public abstract java.util.Iterator charsets(); + } + +} + +package java.security { + + public final class AccessControlContext { + ctor public AccessControlContext(java.security.AccessControlContext, java.security.DomainCombiner); + ctor public AccessControlContext(java.security.ProtectionDomain[]); + method public void checkPermission(java.security.Permission) throws java.security.AccessControlException; + method public java.security.DomainCombiner getDomainCombiner(); + } + + public class AccessControlException extends java.lang.SecurityException { + ctor public AccessControlException(java.lang.String); + ctor public AccessControlException(java.lang.String, java.security.Permission); + method public java.security.Permission getPermission(); + } + + public final class AccessController { + method public static void checkPermission(java.security.Permission) throws java.security.AccessControlException; + method public static T doPrivileged(java.security.PrivilegedAction); + method public static T doPrivileged(java.security.PrivilegedAction, java.security.AccessControlContext); + method public static T doPrivileged(java.security.PrivilegedExceptionAction) throws java.security.PrivilegedActionException; + method public static T doPrivileged(java.security.PrivilegedExceptionAction, java.security.AccessControlContext) throws java.security.PrivilegedActionException; + method public static T doPrivilegedWithCombiner(java.security.PrivilegedAction); + method public static T doPrivilegedWithCombiner(java.security.PrivilegedExceptionAction) throws java.security.PrivilegedActionException; + method public static java.security.AccessControlContext getContext(); + } + + public class AlgorithmParameterGenerator { + ctor protected AlgorithmParameterGenerator(java.security.AlgorithmParameterGeneratorSpi, java.security.Provider, java.lang.String); + method public final java.security.AlgorithmParameters generateParameters(); + method public final java.lang.String getAlgorithm(); + method public static java.security.AlgorithmParameterGenerator getInstance(java.lang.String) throws java.security.NoSuchAlgorithmException; + method public static java.security.AlgorithmParameterGenerator getInstance(java.lang.String, java.lang.String) throws java.security.NoSuchAlgorithmException, java.security.NoSuchProviderException; + method public static java.security.AlgorithmParameterGenerator getInstance(java.lang.String, java.security.Provider) throws java.security.NoSuchAlgorithmException; + method public final java.security.Provider getProvider(); + method public final void init(int); + method public final void init(int, java.security.SecureRandom); + method public final void init(java.security.spec.AlgorithmParameterSpec) throws java.security.InvalidAlgorithmParameterException; + method public final void init(java.security.spec.AlgorithmParameterSpec, java.security.SecureRandom) throws java.security.InvalidAlgorithmParameterException; + } + + public abstract class AlgorithmParameterGeneratorSpi { + ctor public AlgorithmParameterGeneratorSpi(); + method protected abstract java.security.AlgorithmParameters engineGenerateParameters(); + method protected abstract void engineInit(int, java.security.SecureRandom); + method protected abstract void engineInit(java.security.spec.AlgorithmParameterSpec, java.security.SecureRandom) throws java.security.InvalidAlgorithmParameterException; + } + + public class AlgorithmParameters { + ctor protected AlgorithmParameters(java.security.AlgorithmParametersSpi, java.security.Provider, java.lang.String); + method public final java.lang.String getAlgorithm(); + method public final byte[] getEncoded() throws java.io.IOException; + method public final byte[] getEncoded(java.lang.String) throws java.io.IOException; + method public static java.security.AlgorithmParameters getInstance(java.lang.String) throws java.security.NoSuchAlgorithmException; + method public static java.security.AlgorithmParameters getInstance(java.lang.String, java.lang.String) throws java.security.NoSuchAlgorithmException, java.security.NoSuchProviderException; + method public static java.security.AlgorithmParameters getInstance(java.lang.String, java.security.Provider) throws java.security.NoSuchAlgorithmException; + method public final T getParameterSpec(java.lang.Class) throws java.security.spec.InvalidParameterSpecException; + method public final java.security.Provider getProvider(); + method public final void init(java.security.spec.AlgorithmParameterSpec) throws java.security.spec.InvalidParameterSpecException; + method public final void init(byte[]) throws java.io.IOException; + method public final void init(byte[], java.lang.String) throws java.io.IOException; + method public final java.lang.String toString(); + } + + public abstract class AlgorithmParametersSpi { + ctor public AlgorithmParametersSpi(); + method protected abstract byte[] engineGetEncoded() throws java.io.IOException; + method protected abstract byte[] engineGetEncoded(java.lang.String) throws java.io.IOException; + method protected abstract T engineGetParameterSpec(java.lang.Class) throws java.security.spec.InvalidParameterSpecException; + method protected abstract void engineInit(java.security.spec.AlgorithmParameterSpec) throws java.security.spec.InvalidParameterSpecException; + method protected abstract void engineInit(byte[]) throws java.io.IOException; + method protected abstract void engineInit(byte[], java.lang.String) throws java.io.IOException; + method protected abstract java.lang.String engineToString(); + } + + public final class AllPermission extends java.security.Permission { + ctor public AllPermission(java.lang.String, java.lang.String); + ctor public AllPermission(); + method public java.lang.String getActions(); + method public boolean implies(java.security.Permission); + } + + public abstract class AuthProvider extends java.security.Provider { + ctor protected AuthProvider(java.lang.String, double, java.lang.String); + method public abstract void login(javax.security.auth.Subject, javax.security.auth.callback.CallbackHandler) throws javax.security.auth.login.LoginException; + method public abstract void logout() throws javax.security.auth.login.LoginException; + method public abstract void setCallbackHandler(javax.security.auth.callback.CallbackHandler); + } + + public abstract class BasicPermission extends java.security.Permission implements java.io.Serializable { + ctor public BasicPermission(java.lang.String); + ctor public BasicPermission(java.lang.String, java.lang.String); + method public java.lang.String getActions(); + method public boolean implies(java.security.Permission); + } + + public abstract deprecated interface Certificate { + method public abstract void decode(java.io.InputStream) throws java.io.IOException, java.security.KeyException; + method public abstract void encode(java.io.OutputStream) throws java.io.IOException, java.security.KeyException; + method public abstract java.lang.String getFormat(); + method public abstract java.security.Principal getGuarantor(); + method public abstract java.security.Principal getPrincipal(); + method public abstract java.security.PublicKey getPublicKey(); + method public abstract java.lang.String toString(boolean); + } + + public final class CodeSigner implements java.io.Serializable { + ctor public CodeSigner(java.security.cert.CertPath, java.security.Timestamp); + method public java.security.cert.CertPath getSignerCertPath(); + method public java.security.Timestamp getTimestamp(); + } + + public class CodeSource implements java.io.Serializable { + ctor public CodeSource(java.net.URL, java.security.cert.Certificate[]); + ctor public CodeSource(java.net.URL, java.security.CodeSigner[]); + method public final java.security.cert.Certificate[] getCertificates(); + method public final java.security.CodeSigner[] getCodeSigners(); + method public final java.net.URL getLocation(); + method public boolean implies(java.security.CodeSource); + } + + public class DigestException extends java.security.GeneralSecurityException { + ctor public DigestException(java.lang.String); + ctor public DigestException(); + ctor public DigestException(java.lang.String, java.lang.Throwable); + ctor public DigestException(java.lang.Throwable); + } + + public class DigestInputStream extends java.io.FilterInputStream { + ctor public DigestInputStream(java.io.InputStream, java.security.MessageDigest); + method public java.security.MessageDigest getMessageDigest(); + method public void on(boolean); + method public void setMessageDigest(java.security.MessageDigest); + field protected java.security.MessageDigest digest; + } + + public class DigestOutputStream extends java.io.FilterOutputStream { + ctor public DigestOutputStream(java.io.OutputStream, java.security.MessageDigest); + method public java.security.MessageDigest getMessageDigest(); + method public void on(boolean); + method public void setMessageDigest(java.security.MessageDigest); + field protected java.security.MessageDigest digest; + } + + public abstract interface DomainCombiner { + method public abstract java.security.ProtectionDomain[] combine(java.security.ProtectionDomain[], java.security.ProtectionDomain[]); + } + + public class GeneralSecurityException extends java.lang.Exception { + ctor public GeneralSecurityException(java.lang.String); + ctor public GeneralSecurityException(); + ctor public GeneralSecurityException(java.lang.String, java.lang.Throwable); + ctor public GeneralSecurityException(java.lang.Throwable); + } + + public abstract interface Guard { + method public abstract void checkGuard(java.lang.Object) throws java.lang.SecurityException; + } + + public class GuardedObject implements java.io.Serializable { + ctor public GuardedObject(java.lang.Object, java.security.Guard); + method public java.lang.Object getObject() throws java.lang.SecurityException; + } + + public abstract deprecated class Identity implements java.security.Principal java.io.Serializable { + ctor protected Identity(); + ctor public Identity(java.lang.String); + ctor public Identity(java.lang.String, java.security.IdentityScope) throws java.security.KeyManagementException; + method public void addCertificate(java.security.Certificate) throws java.security.KeyManagementException; + method public java.security.Certificate[] certificates(); + method public final boolean equals(java.lang.Object); + method public java.lang.String getInfo(); + method public final java.lang.String getName(); + method public java.security.PublicKey getPublicKey(); + method public final java.security.IdentityScope getScope(); + method protected boolean identityEquals(java.security.Identity); + method public void removeCertificate(java.security.Certificate) throws java.security.KeyManagementException; + method public void setInfo(java.lang.String); + method public void setPublicKey(java.security.PublicKey) throws java.security.KeyManagementException; + method public java.lang.String toString(boolean); + } + + public abstract deprecated class IdentityScope extends java.security.Identity { + ctor protected IdentityScope(); + ctor public IdentityScope(java.lang.String); + ctor public IdentityScope(java.lang.String, java.security.IdentityScope) throws java.security.KeyManagementException; + method public abstract void addIdentity(java.security.Identity) throws java.security.KeyManagementException; + method public abstract java.security.Identity getIdentity(java.lang.String); + method public java.security.Identity getIdentity(java.security.Principal); + method public abstract java.security.Identity getIdentity(java.security.PublicKey); + method public static java.security.IdentityScope getSystemScope(); + method public abstract java.util.Enumeration identities(); + method public abstract void removeIdentity(java.security.Identity) throws java.security.KeyManagementException; + method protected static void setSystemScope(java.security.IdentityScope); + method public abstract int size(); + } + + public class InvalidAlgorithmParameterException extends java.security.GeneralSecurityException { + ctor public InvalidAlgorithmParameterException(java.lang.String); + ctor public InvalidAlgorithmParameterException(); + ctor public InvalidAlgorithmParameterException(java.lang.String, java.lang.Throwable); + ctor public InvalidAlgorithmParameterException(java.lang.Throwable); + } + + public class InvalidKeyException extends java.security.KeyException { + ctor public InvalidKeyException(java.lang.String); + ctor public InvalidKeyException(); + ctor public InvalidKeyException(java.lang.String, java.lang.Throwable); + ctor public InvalidKeyException(java.lang.Throwable); + } + + public class InvalidParameterException extends java.lang.IllegalArgumentException { + ctor public InvalidParameterException(java.lang.String); + ctor public InvalidParameterException(); + } + + public abstract interface Key implements java.io.Serializable { + method public abstract java.lang.String getAlgorithm(); + method public abstract byte[] getEncoded(); + method public abstract java.lang.String getFormat(); + field public static final long serialVersionUID = 6603384152749567654L; // 0x5ba3eee69414eea6L + } + + public class KeyException extends java.security.GeneralSecurityException { + ctor public KeyException(java.lang.String); + ctor public KeyException(); + ctor public KeyException(java.lang.String, java.lang.Throwable); + ctor public KeyException(java.lang.Throwable); + } + + public class KeyFactory { + ctor protected KeyFactory(java.security.KeyFactorySpi, java.security.Provider, java.lang.String); + method public final java.security.PrivateKey generatePrivate(java.security.spec.KeySpec) throws java.security.spec.InvalidKeySpecException; + method public final java.security.PublicKey generatePublic(java.security.spec.KeySpec) throws java.security.spec.InvalidKeySpecException; + method public final java.lang.String getAlgorithm(); + method public static java.security.KeyFactory getInstance(java.lang.String) throws java.security.NoSuchAlgorithmException; + method public static java.security.KeyFactory getInstance(java.lang.String, java.lang.String) throws java.security.NoSuchAlgorithmException, java.security.NoSuchProviderException; + method public static java.security.KeyFactory getInstance(java.lang.String, java.security.Provider) throws java.security.NoSuchAlgorithmException; + method public final T getKeySpec(java.security.Key, java.lang.Class) throws java.security.spec.InvalidKeySpecException; + method public final java.security.Provider getProvider(); + method public final java.security.Key translateKey(java.security.Key) throws java.security.InvalidKeyException; + } + + public abstract class KeyFactorySpi { + ctor public KeyFactorySpi(); + method protected abstract java.security.PrivateKey engineGeneratePrivate(java.security.spec.KeySpec) throws java.security.spec.InvalidKeySpecException; + method protected abstract java.security.PublicKey engineGeneratePublic(java.security.spec.KeySpec) throws java.security.spec.InvalidKeySpecException; + method protected abstract T engineGetKeySpec(java.security.Key, java.lang.Class) throws java.security.spec.InvalidKeySpecException; + method protected abstract java.security.Key engineTranslateKey(java.security.Key) throws java.security.InvalidKeyException; + } + + public class KeyManagementException extends java.security.KeyException { + ctor public KeyManagementException(java.lang.String); + ctor public KeyManagementException(); + ctor public KeyManagementException(java.lang.String, java.lang.Throwable); + ctor public KeyManagementException(java.lang.Throwable); + } + + public final class KeyPair implements java.io.Serializable { + ctor public KeyPair(java.security.PublicKey, java.security.PrivateKey); + method public java.security.PrivateKey getPrivate(); + method public java.security.PublicKey getPublic(); + } + + public abstract class KeyPairGenerator extends java.security.KeyPairGeneratorSpi { + ctor protected KeyPairGenerator(java.lang.String); + method public final java.security.KeyPair genKeyPair(); + method public java.security.KeyPair generateKeyPair(); + method public java.lang.String getAlgorithm(); + method public static java.security.KeyPairGenerator getInstance(java.lang.String) throws java.security.NoSuchAlgorithmException; + method public static java.security.KeyPairGenerator getInstance(java.lang.String, java.lang.String) throws java.security.NoSuchAlgorithmException, java.security.NoSuchProviderException; + method public static java.security.KeyPairGenerator getInstance(java.lang.String, java.security.Provider) throws java.security.NoSuchAlgorithmException; + method public final java.security.Provider getProvider(); + method public void initialize(int); + method public void initialize(java.security.spec.AlgorithmParameterSpec) throws java.security.InvalidAlgorithmParameterException; + method public void initialize(int, java.security.SecureRandom); + } + + public abstract class KeyPairGeneratorSpi { + ctor public KeyPairGeneratorSpi(); + method public abstract java.security.KeyPair generateKeyPair(); + method public abstract void initialize(int, java.security.SecureRandom); + method public void initialize(java.security.spec.AlgorithmParameterSpec, java.security.SecureRandom) throws java.security.InvalidAlgorithmParameterException; + } + + public class KeyRep implements java.io.Serializable { + ctor public KeyRep(java.security.KeyRep.Type, java.lang.String, java.lang.String, byte[]); + method protected java.lang.Object readResolve() throws java.io.ObjectStreamException; + } + + public static final class KeyRep.Type extends java.lang.Enum { + method public static java.security.KeyRep.Type valueOf(java.lang.String); + method public static final java.security.KeyRep.Type[] values(); + enum_constant public static final java.security.KeyRep.Type PRIVATE; + enum_constant public static final java.security.KeyRep.Type PUBLIC; + enum_constant public static final java.security.KeyRep.Type SECRET; + } + + public class KeyStore { + ctor protected KeyStore(java.security.KeyStoreSpi, java.security.Provider, java.lang.String); + method public final java.util.Enumeration aliases() throws java.security.KeyStoreException; + method public final boolean containsAlias(java.lang.String) throws java.security.KeyStoreException; + method public final void deleteEntry(java.lang.String) throws java.security.KeyStoreException; + method public final boolean entryInstanceOf(java.lang.String, java.lang.Class) throws java.security.KeyStoreException; + method public final java.security.cert.Certificate getCertificate(java.lang.String) throws java.security.KeyStoreException; + method public final java.lang.String getCertificateAlias(java.security.cert.Certificate) throws java.security.KeyStoreException; + method public final java.security.cert.Certificate[] getCertificateChain(java.lang.String) throws java.security.KeyStoreException; + method public final java.util.Date getCreationDate(java.lang.String) throws java.security.KeyStoreException; + method public static final java.lang.String getDefaultType(); + method public final java.security.KeyStore.Entry getEntry(java.lang.String, java.security.KeyStore.ProtectionParameter) throws java.security.KeyStoreException, java.security.NoSuchAlgorithmException, java.security.UnrecoverableEntryException; + method public static java.security.KeyStore getInstance(java.lang.String) throws java.security.KeyStoreException; + method public static java.security.KeyStore getInstance(java.lang.String, java.lang.String) throws java.security.KeyStoreException, java.security.NoSuchProviderException; + method public static java.security.KeyStore getInstance(java.lang.String, java.security.Provider) throws java.security.KeyStoreException; + method public final java.security.Key getKey(java.lang.String, char[]) throws java.security.KeyStoreException, java.security.NoSuchAlgorithmException, java.security.UnrecoverableKeyException; + method public final java.security.Provider getProvider(); + method public final java.lang.String getType(); + method public final boolean isCertificateEntry(java.lang.String) throws java.security.KeyStoreException; + method public final boolean isKeyEntry(java.lang.String) throws java.security.KeyStoreException; + method public final void load(java.io.InputStream, char[]) throws java.security.cert.CertificateException, java.io.IOException, java.security.NoSuchAlgorithmException; + method public final void load(java.security.KeyStore.LoadStoreParameter) throws java.security.cert.CertificateException, java.io.IOException, java.security.NoSuchAlgorithmException; + method public final void setCertificateEntry(java.lang.String, java.security.cert.Certificate) throws java.security.KeyStoreException; + method public final void setEntry(java.lang.String, java.security.KeyStore.Entry, java.security.KeyStore.ProtectionParameter) throws java.security.KeyStoreException; + method public final void setKeyEntry(java.lang.String, java.security.Key, char[], java.security.cert.Certificate[]) throws java.security.KeyStoreException; + method public final void setKeyEntry(java.lang.String, byte[], java.security.cert.Certificate[]) throws java.security.KeyStoreException; + method public final int size() throws java.security.KeyStoreException; + method public final void store(java.io.OutputStream, char[]) throws java.security.cert.CertificateException, java.io.IOException, java.security.KeyStoreException, java.security.NoSuchAlgorithmException; + method public final void store(java.security.KeyStore.LoadStoreParameter) throws java.security.cert.CertificateException, java.io.IOException, java.security.KeyStoreException, java.security.NoSuchAlgorithmException; + } + + public static abstract class KeyStore.Builder { + ctor protected KeyStore.Builder(); + method public abstract java.security.KeyStore getKeyStore() throws java.security.KeyStoreException; + method public abstract java.security.KeyStore.ProtectionParameter getProtectionParameter(java.lang.String) throws java.security.KeyStoreException; + method public static java.security.KeyStore.Builder newInstance(java.security.KeyStore, java.security.KeyStore.ProtectionParameter); + method public static java.security.KeyStore.Builder newInstance(java.lang.String, java.security.Provider, java.io.File, java.security.KeyStore.ProtectionParameter); + method public static java.security.KeyStore.Builder newInstance(java.lang.String, java.security.Provider, java.security.KeyStore.ProtectionParameter); + } + + public static class KeyStore.CallbackHandlerProtection implements java.security.KeyStore.ProtectionParameter { + ctor public KeyStore.CallbackHandlerProtection(javax.security.auth.callback.CallbackHandler); + method public javax.security.auth.callback.CallbackHandler getCallbackHandler(); + } + + public static abstract interface KeyStore.Entry { + } + + public static abstract interface KeyStore.LoadStoreParameter { + method public abstract java.security.KeyStore.ProtectionParameter getProtectionParameter(); + } + + public static class KeyStore.PasswordProtection implements javax.security.auth.Destroyable java.security.KeyStore.ProtectionParameter { + ctor public KeyStore.PasswordProtection(char[]); + method public synchronized void destroy() throws javax.security.auth.DestroyFailedException; + method public synchronized char[] getPassword(); + method public synchronized boolean isDestroyed(); + } + + public static final class KeyStore.PrivateKeyEntry implements java.security.KeyStore.Entry { + ctor public KeyStore.PrivateKeyEntry(java.security.PrivateKey, java.security.cert.Certificate[]); + method public java.security.cert.Certificate getCertificate(); + method public java.security.cert.Certificate[] getCertificateChain(); + method public java.security.PrivateKey getPrivateKey(); + } + + public static abstract interface KeyStore.ProtectionParameter { + } + + public static final class KeyStore.SecretKeyEntry implements java.security.KeyStore.Entry { + ctor public KeyStore.SecretKeyEntry(javax.crypto.SecretKey); + method public javax.crypto.SecretKey getSecretKey(); + } + + public static final class KeyStore.TrustedCertificateEntry implements java.security.KeyStore.Entry { + ctor public KeyStore.TrustedCertificateEntry(java.security.cert.Certificate); + method public java.security.cert.Certificate getTrustedCertificate(); + } + + public class KeyStoreException extends java.security.GeneralSecurityException { + ctor public KeyStoreException(java.lang.String); + ctor public KeyStoreException(); + ctor public KeyStoreException(java.lang.String, java.lang.Throwable); + ctor public KeyStoreException(java.lang.Throwable); + } + + public abstract class KeyStoreSpi { + ctor public KeyStoreSpi(); + method public abstract java.util.Enumeration engineAliases(); + method public abstract boolean engineContainsAlias(java.lang.String); + method public abstract void engineDeleteEntry(java.lang.String) throws java.security.KeyStoreException; + method public boolean engineEntryInstanceOf(java.lang.String, java.lang.Class); + method public abstract java.security.cert.Certificate engineGetCertificate(java.lang.String); + method public abstract java.lang.String engineGetCertificateAlias(java.security.cert.Certificate); + method public abstract java.security.cert.Certificate[] engineGetCertificateChain(java.lang.String); + method public abstract java.util.Date engineGetCreationDate(java.lang.String); + method public java.security.KeyStore.Entry engineGetEntry(java.lang.String, java.security.KeyStore.ProtectionParameter) throws java.security.KeyStoreException, java.security.NoSuchAlgorithmException, java.security.UnrecoverableEntryException; + method public abstract java.security.Key engineGetKey(java.lang.String, char[]) throws java.security.NoSuchAlgorithmException, java.security.UnrecoverableKeyException; + method public abstract boolean engineIsCertificateEntry(java.lang.String); + method public abstract boolean engineIsKeyEntry(java.lang.String); + method public abstract void engineLoad(java.io.InputStream, char[]) throws java.security.cert.CertificateException, java.io.IOException, java.security.NoSuchAlgorithmException; + method public void engineLoad(java.security.KeyStore.LoadStoreParameter) throws java.security.cert.CertificateException, java.io.IOException, java.security.NoSuchAlgorithmException; + method public abstract void engineSetCertificateEntry(java.lang.String, java.security.cert.Certificate) throws java.security.KeyStoreException; + method public void engineSetEntry(java.lang.String, java.security.KeyStore.Entry, java.security.KeyStore.ProtectionParameter) throws java.security.KeyStoreException; + method public abstract void engineSetKeyEntry(java.lang.String, java.security.Key, char[], java.security.cert.Certificate[]) throws java.security.KeyStoreException; + method public abstract void engineSetKeyEntry(java.lang.String, byte[], java.security.cert.Certificate[]) throws java.security.KeyStoreException; + method public abstract int engineSize(); + method public abstract void engineStore(java.io.OutputStream, char[]) throws java.security.cert.CertificateException, java.io.IOException, java.security.NoSuchAlgorithmException; + method public void engineStore(java.security.KeyStore.LoadStoreParameter) throws java.security.cert.CertificateException, java.io.IOException, java.security.NoSuchAlgorithmException; + } + + public abstract class MessageDigest extends java.security.MessageDigestSpi { + ctor protected MessageDigest(java.lang.String); + method public byte[] digest(); + method public int digest(byte[], int, int) throws java.security.DigestException; + method public byte[] digest(byte[]); + method public final java.lang.String getAlgorithm(); + method public final int getDigestLength(); + method public static java.security.MessageDigest getInstance(java.lang.String) throws java.security.NoSuchAlgorithmException; + method public static java.security.MessageDigest getInstance(java.lang.String, java.lang.String) throws java.security.NoSuchAlgorithmException, java.security.NoSuchProviderException; + method public static java.security.MessageDigest getInstance(java.lang.String, java.security.Provider) throws java.security.NoSuchAlgorithmException; + method public final java.security.Provider getProvider(); + method public static boolean isEqual(byte[], byte[]); + method public void reset(); + method public void update(byte); + method public void update(byte[], int, int); + method public void update(byte[]); + method public final void update(java.nio.ByteBuffer); + } + + public abstract class MessageDigestSpi { + ctor public MessageDigestSpi(); + method public java.lang.Object clone() throws java.lang.CloneNotSupportedException; + method protected abstract byte[] engineDigest(); + method protected int engineDigest(byte[], int, int) throws java.security.DigestException; + method protected int engineGetDigestLength(); + method protected abstract void engineReset(); + method protected abstract void engineUpdate(byte); + method protected abstract void engineUpdate(byte[], int, int); + method protected void engineUpdate(java.nio.ByteBuffer); + } + + public class NoSuchAlgorithmException extends java.security.GeneralSecurityException { + ctor public NoSuchAlgorithmException(java.lang.String); + ctor public NoSuchAlgorithmException(); + ctor public NoSuchAlgorithmException(java.lang.String, java.lang.Throwable); + ctor public NoSuchAlgorithmException(java.lang.Throwable); + } + + public class NoSuchProviderException extends java.security.GeneralSecurityException { + ctor public NoSuchProviderException(java.lang.String); + ctor public NoSuchProviderException(); + } + + public abstract class Permission implements java.security.Guard java.io.Serializable { + ctor public Permission(java.lang.String); + method public void checkGuard(java.lang.Object) throws java.lang.SecurityException; + method public abstract java.lang.String getActions(); + method public final java.lang.String getName(); + method public abstract boolean implies(java.security.Permission); + method public java.security.PermissionCollection newPermissionCollection(); + } + + public abstract class PermissionCollection implements java.io.Serializable { + ctor public PermissionCollection(); + method public abstract void add(java.security.Permission); + method public abstract java.util.Enumeration elements(); + method public abstract boolean implies(java.security.Permission); + method public boolean isReadOnly(); + method public void setReadOnly(); + } + + public final class Permissions extends java.security.PermissionCollection implements java.io.Serializable { + ctor public Permissions(); + method public void add(java.security.Permission); + method public java.util.Enumeration elements(); + method public boolean implies(java.security.Permission); + } + + public abstract class Policy { + ctor public Policy(); + method public static java.security.Policy getInstance(java.lang.String, java.security.Policy.Parameters) throws java.security.NoSuchAlgorithmException; + method public static java.security.Policy getInstance(java.lang.String, java.security.Policy.Parameters, java.lang.String) throws java.security.NoSuchAlgorithmException, java.security.NoSuchProviderException; + method public static java.security.Policy getInstance(java.lang.String, java.security.Policy.Parameters, java.security.Provider) throws java.security.NoSuchAlgorithmException; + method public java.security.Policy.Parameters getParameters(); + method public java.security.PermissionCollection getPermissions(java.security.CodeSource); + method public java.security.PermissionCollection getPermissions(java.security.ProtectionDomain); + method public static java.security.Policy getPolicy(); + method public java.security.Provider getProvider(); + method public java.lang.String getType(); + method public boolean implies(java.security.ProtectionDomain, java.security.Permission); + method public void refresh(); + method public static void setPolicy(java.security.Policy); + field public static final java.security.PermissionCollection UNSUPPORTED_EMPTY_COLLECTION; + } + + public static abstract interface Policy.Parameters { + } + + public abstract class PolicySpi { + ctor public PolicySpi(); + method protected java.security.PermissionCollection engineGetPermissions(java.security.CodeSource); + method protected java.security.PermissionCollection engineGetPermissions(java.security.ProtectionDomain); + method protected abstract boolean engineImplies(java.security.ProtectionDomain, java.security.Permission); + method protected void engineRefresh(); + } + + public abstract interface Principal { + method public abstract boolean equals(java.lang.Object); + method public abstract java.lang.String getName(); + method public abstract int hashCode(); + method public abstract java.lang.String toString(); + } + + public abstract interface PrivateKey implements java.security.Key { + field public static final long serialVersionUID = 6034044314589513430L; // 0x53bd3b559a12c6d6L + } + + public abstract interface PrivilegedAction { + method public abstract T run(); + } + + public class PrivilegedActionException extends java.lang.Exception { + ctor public PrivilegedActionException(java.lang.Exception); + method public java.lang.Exception getException(); + } + + public abstract interface PrivilegedExceptionAction { + method public abstract T run() throws java.lang.Exception; + } + + public class ProtectionDomain { + ctor public ProtectionDomain(java.security.CodeSource, java.security.PermissionCollection); + ctor public ProtectionDomain(java.security.CodeSource, java.security.PermissionCollection, java.lang.ClassLoader, java.security.Principal[]); + method public final java.lang.ClassLoader getClassLoader(); + method public final java.security.CodeSource getCodeSource(); + method public final java.security.PermissionCollection getPermissions(); + method public final java.security.Principal[] getPrincipals(); + method public boolean implies(java.security.Permission); + } + + public abstract class Provider extends java.util.Properties { + ctor protected Provider(java.lang.String, double, java.lang.String); + method public java.lang.String getInfo(); + method public java.lang.String getName(); + method public synchronized java.security.Provider.Service getService(java.lang.String, java.lang.String); + method public synchronized java.util.Set getServices(); + method public double getVersion(); + method public synchronized java.lang.Object put(java.lang.Object, java.lang.Object); + method public synchronized void putAll(java.util.Map); + method protected synchronized void putService(java.security.Provider.Service); + method protected synchronized void removeService(java.security.Provider.Service); + } + + public static class Provider.Service { + ctor public Provider.Service(java.security.Provider, java.lang.String, java.lang.String, java.lang.String, java.util.List, java.util.Map); + method public final java.lang.String getAlgorithm(); + method public final java.lang.String getAttribute(java.lang.String); + method public final java.lang.String getClassName(); + method public final java.security.Provider getProvider(); + method public final java.lang.String getType(); + method public java.lang.Object newInstance(java.lang.Object) throws java.security.NoSuchAlgorithmException; + method public boolean supportsParameter(java.lang.Object); + } + + public class ProviderException extends java.lang.RuntimeException { + ctor public ProviderException(java.lang.String); + ctor public ProviderException(); + ctor public ProviderException(java.lang.String, java.lang.Throwable); + ctor public ProviderException(java.lang.Throwable); + } + + public abstract interface PublicKey implements java.security.Key { + field public static final long serialVersionUID = 7187392471159151072L; // 0x63bebf5f40c219e0L + } + + public class SecureClassLoader extends java.lang.ClassLoader { + ctor protected SecureClassLoader(); + ctor protected SecureClassLoader(java.lang.ClassLoader); + method protected final java.lang.Class defineClass(java.lang.String, byte[], int, int, java.security.CodeSource); + method protected final java.lang.Class defineClass(java.lang.String, java.nio.ByteBuffer, java.security.CodeSource); + method protected java.security.PermissionCollection getPermissions(java.security.CodeSource); + } + + public class SecureRandom extends java.util.Random { + ctor public SecureRandom(); + ctor public SecureRandom(byte[]); + ctor protected SecureRandom(java.security.SecureRandomSpi, java.security.Provider); + method public byte[] generateSeed(int); + method public java.lang.String getAlgorithm(); + method public static java.security.SecureRandom getInstance(java.lang.String) throws java.security.NoSuchAlgorithmException; + method public static java.security.SecureRandom getInstance(java.lang.String, java.lang.String) throws java.security.NoSuchAlgorithmException, java.security.NoSuchProviderException; + method public static java.security.SecureRandom getInstance(java.lang.String, java.security.Provider) throws java.security.NoSuchAlgorithmException; + method public final java.security.Provider getProvider(); + method public static byte[] getSeed(int); + method protected final int next(int); + method public synchronized void setSeed(byte[]); + } + + public abstract class SecureRandomSpi implements java.io.Serializable { + ctor public SecureRandomSpi(); + method protected abstract byte[] engineGenerateSeed(int); + method protected abstract void engineNextBytes(byte[]); + method protected abstract void engineSetSeed(byte[]); + } + + public final class Security { + method public static int addProvider(java.security.Provider); + method public static deprecated java.lang.String getAlgorithmProperty(java.lang.String, java.lang.String); + method public static java.util.Set getAlgorithms(java.lang.String); + method public static java.lang.String getProperty(java.lang.String); + method public static synchronized java.security.Provider getProvider(java.lang.String); + method public static synchronized java.security.Provider[] getProviders(); + method public static java.security.Provider[] getProviders(java.lang.String); + method public static synchronized java.security.Provider[] getProviders(java.util.Map); + method public static synchronized int insertProviderAt(java.security.Provider, int); + method public static synchronized void removeProvider(java.lang.String); + method public static void setProperty(java.lang.String, java.lang.String); + } + + public final class SecurityPermission extends java.security.BasicPermission { + ctor public SecurityPermission(java.lang.String); + ctor public SecurityPermission(java.lang.String, java.lang.String); + } + + public abstract class Signature extends java.security.SignatureSpi { + ctor protected Signature(java.lang.String); + method public final java.lang.String getAlgorithm(); + method public static java.security.Signature getInstance(java.lang.String) throws java.security.NoSuchAlgorithmException; + method public static java.security.Signature getInstance(java.lang.String, java.lang.String) throws java.security.NoSuchAlgorithmException, java.security.NoSuchProviderException; + method public static java.security.Signature getInstance(java.lang.String, java.security.Provider) throws java.security.NoSuchAlgorithmException; + method public final deprecated java.lang.Object getParameter(java.lang.String) throws java.security.InvalidParameterException; + method public final java.security.AlgorithmParameters getParameters(); + method public final java.security.Provider getProvider(); + method public final void initSign(java.security.PrivateKey) throws java.security.InvalidKeyException; + method public final void initSign(java.security.PrivateKey, java.security.SecureRandom) throws java.security.InvalidKeyException; + method public final void initVerify(java.security.PublicKey) throws java.security.InvalidKeyException; + method public final void initVerify(java.security.cert.Certificate) throws java.security.InvalidKeyException; + method public final deprecated void setParameter(java.lang.String, java.lang.Object) throws java.security.InvalidParameterException; + method public final void setParameter(java.security.spec.AlgorithmParameterSpec) throws java.security.InvalidAlgorithmParameterException; + method public final byte[] sign() throws java.security.SignatureException; + method public final int sign(byte[], int, int) throws java.security.SignatureException; + method public final void update(byte) throws java.security.SignatureException; + method public final void update(byte[]) throws java.security.SignatureException; + method public final void update(byte[], int, int) throws java.security.SignatureException; + method public final void update(java.nio.ByteBuffer) throws java.security.SignatureException; + method public final boolean verify(byte[]) throws java.security.SignatureException; + method public final boolean verify(byte[], int, int) throws java.security.SignatureException; + field protected static final int SIGN = 2; // 0x2 + field protected static final int UNINITIALIZED = 0; // 0x0 + field protected static final int VERIFY = 3; // 0x3 + field protected int state; + } + + public class SignatureException extends java.security.GeneralSecurityException { + ctor public SignatureException(java.lang.String); + ctor public SignatureException(); + ctor public SignatureException(java.lang.String, java.lang.Throwable); + ctor public SignatureException(java.lang.Throwable); + } + + public abstract class SignatureSpi { + ctor public SignatureSpi(); + method public java.lang.Object clone() throws java.lang.CloneNotSupportedException; + method protected abstract deprecated java.lang.Object engineGetParameter(java.lang.String) throws java.security.InvalidParameterException; + method protected java.security.AlgorithmParameters engineGetParameters(); + method protected abstract void engineInitSign(java.security.PrivateKey) throws java.security.InvalidKeyException; + method protected void engineInitSign(java.security.PrivateKey, java.security.SecureRandom) throws java.security.InvalidKeyException; + method protected abstract void engineInitVerify(java.security.PublicKey) throws java.security.InvalidKeyException; + method protected abstract deprecated void engineSetParameter(java.lang.String, java.lang.Object) throws java.security.InvalidParameterException; + method protected void engineSetParameter(java.security.spec.AlgorithmParameterSpec) throws java.security.InvalidAlgorithmParameterException; + method protected abstract byte[] engineSign() throws java.security.SignatureException; + method protected int engineSign(byte[], int, int) throws java.security.SignatureException; + method protected abstract void engineUpdate(byte) throws java.security.SignatureException; + method protected abstract void engineUpdate(byte[], int, int) throws java.security.SignatureException; + method protected void engineUpdate(java.nio.ByteBuffer); + method protected abstract boolean engineVerify(byte[]) throws java.security.SignatureException; + method protected boolean engineVerify(byte[], int, int) throws java.security.SignatureException; + field protected java.security.SecureRandom appRandom; + } + + public final class SignedObject implements java.io.Serializable { + ctor public SignedObject(java.io.Serializable, java.security.PrivateKey, java.security.Signature) throws java.io.IOException, java.security.InvalidKeyException, java.security.SignatureException; + method public java.lang.String getAlgorithm(); + method public java.lang.Object getObject() throws java.lang.ClassNotFoundException, java.io.IOException; + method public byte[] getSignature(); + method public boolean verify(java.security.PublicKey, java.security.Signature) throws java.security.InvalidKeyException, java.security.SignatureException; + } + + public abstract deprecated class Signer extends java.security.Identity { + ctor protected Signer(); + ctor public Signer(java.lang.String); + ctor public Signer(java.lang.String, java.security.IdentityScope) throws java.security.KeyManagementException; + method public java.security.PrivateKey getPrivateKey(); + method public final void setKeyPair(java.security.KeyPair) throws java.security.InvalidParameterException, java.security.KeyException; + } + + public final class Timestamp implements java.io.Serializable { + ctor public Timestamp(java.util.Date, java.security.cert.CertPath); + method public java.security.cert.CertPath getSignerCertPath(); + method public java.util.Date getTimestamp(); + } + + public class UnrecoverableEntryException extends java.security.GeneralSecurityException { + ctor public UnrecoverableEntryException(); + ctor public UnrecoverableEntryException(java.lang.String); + } + + public class UnrecoverableKeyException extends java.security.UnrecoverableEntryException { + ctor public UnrecoverableKeyException(java.lang.String); + ctor public UnrecoverableKeyException(); + } + + public final class UnresolvedPermission extends java.security.Permission implements java.io.Serializable { + ctor public UnresolvedPermission(java.lang.String, java.lang.String, java.lang.String, java.security.cert.Certificate[]); + method public java.lang.String getActions(); + method public java.lang.String getUnresolvedActions(); + method public java.security.cert.Certificate[] getUnresolvedCerts(); + method public java.lang.String getUnresolvedName(); + method public java.lang.String getUnresolvedType(); + method public boolean implies(java.security.Permission); + } + +} + +package java.security.acl { + + public abstract interface Acl implements java.security.acl.Owner { + method public abstract boolean addEntry(java.security.Principal, java.security.acl.AclEntry) throws java.security.acl.NotOwnerException; + method public abstract boolean checkPermission(java.security.Principal, java.security.acl.Permission); + method public abstract java.util.Enumeration entries(); + method public abstract java.lang.String getName(); + method public abstract java.util.Enumeration getPermissions(java.security.Principal); + method public abstract boolean removeEntry(java.security.Principal, java.security.acl.AclEntry) throws java.security.acl.NotOwnerException; + method public abstract void setName(java.security.Principal, java.lang.String) throws java.security.acl.NotOwnerException; + method public abstract java.lang.String toString(); + } + + public abstract interface AclEntry implements java.lang.Cloneable { + method public abstract boolean addPermission(java.security.acl.Permission); + method public abstract boolean checkPermission(java.security.acl.Permission); + method public abstract java.lang.Object clone(); + method public abstract java.security.Principal getPrincipal(); + method public abstract boolean isNegative(); + method public abstract java.util.Enumeration permissions(); + method public abstract boolean removePermission(java.security.acl.Permission); + method public abstract void setNegativePermissions(); + method public abstract boolean setPrincipal(java.security.Principal); + method public abstract java.lang.String toString(); + } + + public class AclNotFoundException extends java.lang.Exception { + ctor public AclNotFoundException(); + } + + public abstract interface Group implements java.security.Principal { + method public abstract boolean addMember(java.security.Principal); + method public abstract boolean isMember(java.security.Principal); + method public abstract java.util.Enumeration members(); + method public abstract boolean removeMember(java.security.Principal); + } + + public class LastOwnerException extends java.lang.Exception { + ctor public LastOwnerException(); + } + + public class NotOwnerException extends java.lang.Exception { + ctor public NotOwnerException(); + } + + public abstract interface Owner { + method public abstract boolean addOwner(java.security.Principal, java.security.Principal) throws java.security.acl.NotOwnerException; + method public abstract boolean deleteOwner(java.security.Principal, java.security.Principal) throws java.security.acl.LastOwnerException, java.security.acl.NotOwnerException; + method public abstract boolean isOwner(java.security.Principal); + } + + public abstract interface Permission { + method public abstract boolean equals(java.lang.Object); + method public abstract java.lang.String toString(); + } + +} + +package java.security.cert { + + public abstract class CRL { + ctor protected CRL(java.lang.String); + method public final java.lang.String getType(); + method public abstract boolean isRevoked(java.security.cert.Certificate); + method public abstract java.lang.String toString(); + } + + public class CRLException extends java.security.GeneralSecurityException { + ctor public CRLException(java.lang.String); + ctor public CRLException(); + ctor public CRLException(java.lang.String, java.lang.Throwable); + ctor public CRLException(java.lang.Throwable); + } + + public abstract interface CRLSelector implements java.lang.Cloneable { + method public abstract java.lang.Object clone(); + method public abstract boolean match(java.security.cert.CRL); + } + + public abstract class CertPath implements java.io.Serializable { + ctor protected CertPath(java.lang.String); + method public abstract java.util.List getCertificates(); + method public abstract byte[] getEncoded() throws java.security.cert.CertificateEncodingException; + method public abstract byte[] getEncoded(java.lang.String) throws java.security.cert.CertificateEncodingException; + method public abstract java.util.Iterator getEncodings(); + method public java.lang.String getType(); + method protected java.lang.Object writeReplace() throws java.io.ObjectStreamException; + } + + protected static class CertPath.CertPathRep implements java.io.Serializable { + ctor protected CertPath.CertPathRep(java.lang.String, byte[]); + method protected java.lang.Object readResolve() throws java.io.ObjectStreamException; + } + + public class CertPathBuilder { + ctor protected CertPathBuilder(java.security.cert.CertPathBuilderSpi, java.security.Provider, java.lang.String); + method public final java.security.cert.CertPathBuilderResult build(java.security.cert.CertPathParameters) throws java.security.cert.CertPathBuilderException, java.security.InvalidAlgorithmParameterException; + method public final java.lang.String getAlgorithm(); + method public static final java.lang.String getDefaultType(); + method public static java.security.cert.CertPathBuilder getInstance(java.lang.String) throws java.security.NoSuchAlgorithmException; + method public static java.security.cert.CertPathBuilder getInstance(java.lang.String, java.lang.String) throws java.security.NoSuchAlgorithmException, java.security.NoSuchProviderException; + method public static java.security.cert.CertPathBuilder getInstance(java.lang.String, java.security.Provider) throws java.security.NoSuchAlgorithmException; + method public final java.security.Provider getProvider(); + } + + public class CertPathBuilderException extends java.security.GeneralSecurityException { + ctor public CertPathBuilderException(java.lang.String, java.lang.Throwable); + ctor public CertPathBuilderException(java.lang.Throwable); + ctor public CertPathBuilderException(java.lang.String); + ctor public CertPathBuilderException(); + } + + public abstract interface CertPathBuilderResult implements java.lang.Cloneable { + method public abstract java.lang.Object clone(); + method public abstract java.security.cert.CertPath getCertPath(); + } + + public abstract class CertPathBuilderSpi { + ctor public CertPathBuilderSpi(); + method public abstract java.security.cert.CertPathBuilderResult engineBuild(java.security.cert.CertPathParameters) throws java.security.cert.CertPathBuilderException, java.security.InvalidAlgorithmParameterException; + } + + public abstract interface CertPathParameters implements java.lang.Cloneable { + method public abstract java.lang.Object clone(); + } + + public class CertPathValidator { + ctor protected CertPathValidator(java.security.cert.CertPathValidatorSpi, java.security.Provider, java.lang.String); + method public final java.lang.String getAlgorithm(); + method public static final java.lang.String getDefaultType(); + method public static java.security.cert.CertPathValidator getInstance(java.lang.String) throws java.security.NoSuchAlgorithmException; + method public static java.security.cert.CertPathValidator getInstance(java.lang.String, java.lang.String) throws java.security.NoSuchAlgorithmException, java.security.NoSuchProviderException; + method public static java.security.cert.CertPathValidator getInstance(java.lang.String, java.security.Provider) throws java.security.NoSuchAlgorithmException; + method public final java.security.Provider getProvider(); + method public final java.security.cert.CertPathValidatorResult validate(java.security.cert.CertPath, java.security.cert.CertPathParameters) throws java.security.cert.CertPathValidatorException, java.security.InvalidAlgorithmParameterException; + } + + public class CertPathValidatorException extends java.security.GeneralSecurityException { + ctor public CertPathValidatorException(java.lang.String, java.lang.Throwable, java.security.cert.CertPath, int); + ctor public CertPathValidatorException(java.lang.String, java.lang.Throwable); + ctor public CertPathValidatorException(java.lang.Throwable); + ctor public CertPathValidatorException(java.lang.String); + ctor public CertPathValidatorException(); + method public java.security.cert.CertPath getCertPath(); + method public int getIndex(); + } + + public abstract interface CertPathValidatorResult implements java.lang.Cloneable { + method public abstract java.lang.Object clone(); + } + + public abstract class CertPathValidatorSpi { + ctor public CertPathValidatorSpi(); + method public abstract java.security.cert.CertPathValidatorResult engineValidate(java.security.cert.CertPath, java.security.cert.CertPathParameters) throws java.security.cert.CertPathValidatorException, java.security.InvalidAlgorithmParameterException; + } + + public abstract interface CertSelector implements java.lang.Cloneable { + method public abstract java.lang.Object clone(); + method public abstract boolean match(java.security.cert.Certificate); + } + + public class CertStore { + ctor protected CertStore(java.security.cert.CertStoreSpi, java.security.Provider, java.lang.String, java.security.cert.CertStoreParameters); + method public final java.util.Collection getCRLs(java.security.cert.CRLSelector) throws java.security.cert.CertStoreException; + method public final java.security.cert.CertStoreParameters getCertStoreParameters(); + method public final java.util.Collection getCertificates(java.security.cert.CertSelector) throws java.security.cert.CertStoreException; + method public static final java.lang.String getDefaultType(); + method public static java.security.cert.CertStore getInstance(java.lang.String, java.security.cert.CertStoreParameters) throws java.security.InvalidAlgorithmParameterException, java.security.NoSuchAlgorithmException; + method public static java.security.cert.CertStore getInstance(java.lang.String, java.security.cert.CertStoreParameters, java.lang.String) throws java.security.InvalidAlgorithmParameterException, java.security.NoSuchAlgorithmException, java.security.NoSuchProviderException; + method public static java.security.cert.CertStore getInstance(java.lang.String, java.security.cert.CertStoreParameters, java.security.Provider) throws java.security.InvalidAlgorithmParameterException, java.security.NoSuchAlgorithmException; + method public final java.security.Provider getProvider(); + method public final java.lang.String getType(); + } + + public class CertStoreException extends java.security.GeneralSecurityException { + ctor public CertStoreException(java.lang.String, java.lang.Throwable); + ctor public CertStoreException(java.lang.Throwable); + ctor public CertStoreException(java.lang.String); + ctor public CertStoreException(); + } + + public abstract interface CertStoreParameters implements java.lang.Cloneable { + method public abstract java.lang.Object clone(); + } + + public abstract class CertStoreSpi { + ctor public CertStoreSpi(java.security.cert.CertStoreParameters) throws java.security.InvalidAlgorithmParameterException; + method public abstract java.util.Collection engineGetCRLs(java.security.cert.CRLSelector) throws java.security.cert.CertStoreException; + method public abstract java.util.Collection engineGetCertificates(java.security.cert.CertSelector) throws java.security.cert.CertStoreException; + } + + public abstract class Certificate implements java.io.Serializable { + ctor protected Certificate(java.lang.String); + method public abstract byte[] getEncoded() throws java.security.cert.CertificateEncodingException; + method public abstract java.security.PublicKey getPublicKey(); + method public final java.lang.String getType(); + method public abstract java.lang.String toString(); + method public abstract void verify(java.security.PublicKey) throws java.security.cert.CertificateException, java.security.InvalidKeyException, java.security.NoSuchAlgorithmException, java.security.NoSuchProviderException, java.security.SignatureException; + method public abstract void verify(java.security.PublicKey, java.lang.String) throws java.security.cert.CertificateException, java.security.InvalidKeyException, java.security.NoSuchAlgorithmException, java.security.NoSuchProviderException, java.security.SignatureException; + method protected java.lang.Object writeReplace() throws java.io.ObjectStreamException; + } + + protected static class Certificate.CertificateRep implements java.io.Serializable { + ctor protected Certificate.CertificateRep(java.lang.String, byte[]); + method protected java.lang.Object readResolve() throws java.io.ObjectStreamException; + } + + public class CertificateEncodingException extends java.security.cert.CertificateException { + ctor public CertificateEncodingException(java.lang.String); + ctor public CertificateEncodingException(); + ctor public CertificateEncodingException(java.lang.String, java.lang.Throwable); + ctor public CertificateEncodingException(java.lang.Throwable); + } + + public class CertificateException extends java.security.GeneralSecurityException { + ctor public CertificateException(java.lang.String); + ctor public CertificateException(); + ctor public CertificateException(java.lang.String, java.lang.Throwable); + ctor public CertificateException(java.lang.Throwable); + } + + public class CertificateExpiredException extends java.security.cert.CertificateException { + ctor public CertificateExpiredException(java.lang.String); + ctor public CertificateExpiredException(); + } + + public class CertificateFactory { + ctor protected CertificateFactory(java.security.cert.CertificateFactorySpi, java.security.Provider, java.lang.String); + method public final java.security.cert.CRL generateCRL(java.io.InputStream) throws java.security.cert.CRLException; + method public final java.util.Collection generateCRLs(java.io.InputStream) throws java.security.cert.CRLException; + method public final java.security.cert.CertPath generateCertPath(java.io.InputStream) throws java.security.cert.CertificateException; + method public final java.security.cert.CertPath generateCertPath(java.io.InputStream, java.lang.String) throws java.security.cert.CertificateException; + method public final java.security.cert.CertPath generateCertPath(java.util.List) throws java.security.cert.CertificateException; + method public final java.security.cert.Certificate generateCertificate(java.io.InputStream) throws java.security.cert.CertificateException; + method public final java.util.Collection generateCertificates(java.io.InputStream) throws java.security.cert.CertificateException; + method public final java.util.Iterator getCertPathEncodings(); + method public static final java.security.cert.CertificateFactory getInstance(java.lang.String) throws java.security.cert.CertificateException; + method public static final java.security.cert.CertificateFactory getInstance(java.lang.String, java.lang.String) throws java.security.cert.CertificateException, java.security.NoSuchProviderException; + method public static final java.security.cert.CertificateFactory getInstance(java.lang.String, java.security.Provider) throws java.security.cert.CertificateException; + method public final java.security.Provider getProvider(); + method public final java.lang.String getType(); + } + + public abstract class CertificateFactorySpi { + ctor public CertificateFactorySpi(); + method public abstract java.security.cert.CRL engineGenerateCRL(java.io.InputStream) throws java.security.cert.CRLException; + method public abstract java.util.Collection engineGenerateCRLs(java.io.InputStream) throws java.security.cert.CRLException; + method public java.security.cert.CertPath engineGenerateCertPath(java.io.InputStream) throws java.security.cert.CertificateException; + method public java.security.cert.CertPath engineGenerateCertPath(java.io.InputStream, java.lang.String) throws java.security.cert.CertificateException; + method public java.security.cert.CertPath engineGenerateCertPath(java.util.List) throws java.security.cert.CertificateException; + method public abstract java.security.cert.Certificate engineGenerateCertificate(java.io.InputStream) throws java.security.cert.CertificateException; + method public abstract java.util.Collection engineGenerateCertificates(java.io.InputStream) throws java.security.cert.CertificateException; + method public java.util.Iterator engineGetCertPathEncodings(); + } + + public class CertificateNotYetValidException extends java.security.cert.CertificateException { + ctor public CertificateNotYetValidException(java.lang.String); + ctor public CertificateNotYetValidException(); + } + + public class CertificateParsingException extends java.security.cert.CertificateException { + ctor public CertificateParsingException(java.lang.String); + ctor public CertificateParsingException(); + ctor public CertificateParsingException(java.lang.String, java.lang.Throwable); + ctor public CertificateParsingException(java.lang.Throwable); + } + + public class CollectionCertStoreParameters implements java.security.cert.CertStoreParameters { + ctor public CollectionCertStoreParameters(); + ctor public CollectionCertStoreParameters(java.util.Collection); + method public java.lang.Object clone(); + method public java.util.Collection getCollection(); + } + + public class LDAPCertStoreParameters implements java.security.cert.CertStoreParameters { + ctor public LDAPCertStoreParameters(java.lang.String, int); + ctor public LDAPCertStoreParameters(); + ctor public LDAPCertStoreParameters(java.lang.String); + method public java.lang.Object clone(); + method public int getPort(); + method public java.lang.String getServerName(); + } + + public class PKIXBuilderParameters extends java.security.cert.PKIXParameters { + ctor public PKIXBuilderParameters(java.util.Set, java.security.cert.CertSelector) throws java.security.InvalidAlgorithmParameterException; + ctor public PKIXBuilderParameters(java.security.KeyStore, java.security.cert.CertSelector) throws java.security.InvalidAlgorithmParameterException, java.security.KeyStoreException; + method public int getMaxPathLength(); + method public void setMaxPathLength(int); + } + + public class PKIXCertPathBuilderResult extends java.security.cert.PKIXCertPathValidatorResult implements java.security.cert.CertPathBuilderResult { + ctor public PKIXCertPathBuilderResult(java.security.cert.CertPath, java.security.cert.TrustAnchor, java.security.cert.PolicyNode, java.security.PublicKey); + method public java.security.cert.CertPath getCertPath(); + } + + public abstract class PKIXCertPathChecker implements java.lang.Cloneable { + ctor protected PKIXCertPathChecker(); + method public abstract void check(java.security.cert.Certificate, java.util.Collection) throws java.security.cert.CertPathValidatorException; + method public java.lang.Object clone(); + method public abstract java.util.Set getSupportedExtensions(); + method public abstract void init(boolean) throws java.security.cert.CertPathValidatorException; + method public abstract boolean isForwardCheckingSupported(); + } + + public class PKIXCertPathValidatorResult implements java.security.cert.CertPathValidatorResult { + ctor public PKIXCertPathValidatorResult(java.security.cert.TrustAnchor, java.security.cert.PolicyNode, java.security.PublicKey); + method public java.lang.Object clone(); + method public java.security.cert.PolicyNode getPolicyTree(); + method public java.security.PublicKey getPublicKey(); + method public java.security.cert.TrustAnchor getTrustAnchor(); + } + + public class PKIXParameters implements java.security.cert.CertPathParameters { + ctor public PKIXParameters(java.util.Set) throws java.security.InvalidAlgorithmParameterException; + ctor public PKIXParameters(java.security.KeyStore) throws java.security.InvalidAlgorithmParameterException, java.security.KeyStoreException; + method public void addCertPathChecker(java.security.cert.PKIXCertPathChecker); + method public void addCertStore(java.security.cert.CertStore); + method public java.lang.Object clone(); + method public java.util.List getCertPathCheckers(); + method public java.util.List getCertStores(); + method public java.util.Date getDate(); + method public java.util.Set getInitialPolicies(); + method public boolean getPolicyQualifiersRejected(); + method public java.lang.String getSigProvider(); + method public java.security.cert.CertSelector getTargetCertConstraints(); + method public java.util.Set getTrustAnchors(); + method public boolean isAnyPolicyInhibited(); + method public boolean isExplicitPolicyRequired(); + method public boolean isPolicyMappingInhibited(); + method public boolean isRevocationEnabled(); + method public void setAnyPolicyInhibited(boolean); + method public void setCertPathCheckers(java.util.List); + method public void setCertStores(java.util.List); + method public void setDate(java.util.Date); + method public void setExplicitPolicyRequired(boolean); + method public void setInitialPolicies(java.util.Set); + method public void setPolicyMappingInhibited(boolean); + method public void setPolicyQualifiersRejected(boolean); + method public void setRevocationEnabled(boolean); + method public void setSigProvider(java.lang.String); + method public void setTargetCertConstraints(java.security.cert.CertSelector); + method public void setTrustAnchors(java.util.Set) throws java.security.InvalidAlgorithmParameterException; + } + + public abstract interface PolicyNode { + method public abstract java.util.Iterator getChildren(); + method public abstract int getDepth(); + method public abstract java.util.Set getExpectedPolicies(); + method public abstract java.security.cert.PolicyNode getParent(); + method public abstract java.util.Set getPolicyQualifiers(); + method public abstract java.lang.String getValidPolicy(); + method public abstract boolean isCritical(); + } + + public class PolicyQualifierInfo { + ctor public PolicyQualifierInfo(byte[]) throws java.io.IOException; + method public final byte[] getEncoded(); + method public final byte[] getPolicyQualifier(); + method public final java.lang.String getPolicyQualifierId(); + } + + public class TrustAnchor { + ctor public TrustAnchor(java.security.cert.X509Certificate, byte[]); + ctor public TrustAnchor(java.lang.String, java.security.PublicKey, byte[]); + ctor public TrustAnchor(javax.security.auth.x500.X500Principal, java.security.PublicKey, byte[]); + method public final javax.security.auth.x500.X500Principal getCA(); + method public final java.lang.String getCAName(); + method public final java.security.PublicKey getCAPublicKey(); + method public final byte[] getNameConstraints(); + method public final java.security.cert.X509Certificate getTrustedCert(); + } + + public abstract class X509CRL extends java.security.cert.CRL implements java.security.cert.X509Extension { + ctor protected X509CRL(); + method public abstract byte[] getEncoded() throws java.security.cert.CRLException; + method public abstract java.security.Principal getIssuerDN(); + method public javax.security.auth.x500.X500Principal getIssuerX500Principal(); + method public abstract java.util.Date getNextUpdate(); + method public abstract java.security.cert.X509CRLEntry getRevokedCertificate(java.math.BigInteger); + method public java.security.cert.X509CRLEntry getRevokedCertificate(java.security.cert.X509Certificate); + method public abstract java.util.Set getRevokedCertificates(); + method public abstract java.lang.String getSigAlgName(); + method public abstract java.lang.String getSigAlgOID(); + method public abstract byte[] getSigAlgParams(); + method public abstract byte[] getSignature(); + method public abstract byte[] getTBSCertList() throws java.security.cert.CRLException; + method public abstract java.util.Date getThisUpdate(); + method public abstract int getVersion(); + method public abstract void verify(java.security.PublicKey) throws java.security.cert.CRLException, java.security.InvalidKeyException, java.security.NoSuchAlgorithmException, java.security.NoSuchProviderException, java.security.SignatureException; + method public abstract void verify(java.security.PublicKey, java.lang.String) throws java.security.cert.CRLException, java.security.InvalidKeyException, java.security.NoSuchAlgorithmException, java.security.NoSuchProviderException, java.security.SignatureException; + } + + public abstract class X509CRLEntry implements java.security.cert.X509Extension { + ctor public X509CRLEntry(); + method public javax.security.auth.x500.X500Principal getCertificateIssuer(); + method public abstract byte[] getEncoded() throws java.security.cert.CRLException; + method public abstract java.util.Date getRevocationDate(); + method public abstract java.math.BigInteger getSerialNumber(); + method public abstract boolean hasExtensions(); + method public abstract java.lang.String toString(); + } + + public class X509CRLSelector implements java.security.cert.CRLSelector { + ctor public X509CRLSelector(); + method public void addIssuer(javax.security.auth.x500.X500Principal); + method public void addIssuerName(java.lang.String) throws java.io.IOException; + method public void addIssuerName(byte[]) throws java.io.IOException; + method public java.lang.Object clone(); + method public java.security.cert.X509Certificate getCertificateChecking(); + method public java.util.Date getDateAndTime(); + method public java.util.Collection getIssuerNames(); + method public java.util.Collection getIssuers(); + method public java.math.BigInteger getMaxCRL(); + method public java.math.BigInteger getMinCRL(); + method public boolean match(java.security.cert.CRL); + method public void setCertificateChecking(java.security.cert.X509Certificate); + method public void setDateAndTime(java.util.Date); + method public void setIssuerNames(java.util.Collection) throws java.io.IOException; + method public void setIssuers(java.util.Collection); + method public void setMaxCRLNumber(java.math.BigInteger); + method public void setMinCRLNumber(java.math.BigInteger); + } + + public class X509CertSelector implements java.security.cert.CertSelector { + ctor public X509CertSelector(); + method public void addPathToName(int, java.lang.String) throws java.io.IOException; + method public void addPathToName(int, byte[]) throws java.io.IOException; + method public void addSubjectAlternativeName(int, java.lang.String) throws java.io.IOException; + method public void addSubjectAlternativeName(int, byte[]) throws java.io.IOException; + method public java.lang.Object clone(); + method public byte[] getAuthorityKeyIdentifier(); + method public int getBasicConstraints(); + method public java.security.cert.X509Certificate getCertificate(); + method public java.util.Date getCertificateValid(); + method public java.util.Set getExtendedKeyUsage(); + method public javax.security.auth.x500.X500Principal getIssuer(); + method public byte[] getIssuerAsBytes() throws java.io.IOException; + method public java.lang.String getIssuerAsString(); + method public boolean[] getKeyUsage(); + method public boolean getMatchAllSubjectAltNames(); + method public byte[] getNameConstraints(); + method public java.util.Collection> getPathToNames(); + method public java.util.Set getPolicy(); + method public java.util.Date getPrivateKeyValid(); + method public java.math.BigInteger getSerialNumber(); + method public javax.security.auth.x500.X500Principal getSubject(); + method public java.util.Collection> getSubjectAlternativeNames(); + method public byte[] getSubjectAsBytes() throws java.io.IOException; + method public java.lang.String getSubjectAsString(); + method public byte[] getSubjectKeyIdentifier(); + method public java.security.PublicKey getSubjectPublicKey(); + method public java.lang.String getSubjectPublicKeyAlgID(); + method public boolean match(java.security.cert.Certificate); + method public void setAuthorityKeyIdentifier(byte[]); + method public void setBasicConstraints(int); + method public void setCertificate(java.security.cert.X509Certificate); + method public void setCertificateValid(java.util.Date); + method public void setExtendedKeyUsage(java.util.Set) throws java.io.IOException; + method public void setIssuer(javax.security.auth.x500.X500Principal); + method public void setIssuer(java.lang.String) throws java.io.IOException; + method public void setIssuer(byte[]) throws java.io.IOException; + method public void setKeyUsage(boolean[]); + method public void setMatchAllSubjectAltNames(boolean); + method public void setNameConstraints(byte[]) throws java.io.IOException; + method public void setPathToNames(java.util.Collection>) throws java.io.IOException; + method public void setPolicy(java.util.Set) throws java.io.IOException; + method public void setPrivateKeyValid(java.util.Date); + method public void setSerialNumber(java.math.BigInteger); + method public void setSubject(javax.security.auth.x500.X500Principal); + method public void setSubject(java.lang.String) throws java.io.IOException; + method public void setSubject(byte[]) throws java.io.IOException; + method public void setSubjectAlternativeNames(java.util.Collection>) throws java.io.IOException; + method public void setSubjectKeyIdentifier(byte[]); + method public void setSubjectPublicKey(java.security.PublicKey); + method public void setSubjectPublicKey(byte[]) throws java.io.IOException; + method public void setSubjectPublicKeyAlgID(java.lang.String) throws java.io.IOException; + } + + public abstract class X509Certificate extends java.security.cert.Certificate implements java.security.cert.X509Extension { + ctor protected X509Certificate(); + method public abstract void checkValidity() throws java.security.cert.CertificateExpiredException, java.security.cert.CertificateNotYetValidException; + method public abstract void checkValidity(java.util.Date) throws java.security.cert.CertificateExpiredException, java.security.cert.CertificateNotYetValidException; + method public abstract int getBasicConstraints(); + method public java.util.List getExtendedKeyUsage() throws java.security.cert.CertificateParsingException; + method public java.util.Collection> getIssuerAlternativeNames() throws java.security.cert.CertificateParsingException; + method public abstract java.security.Principal getIssuerDN(); + method public abstract boolean[] getIssuerUniqueID(); + method public javax.security.auth.x500.X500Principal getIssuerX500Principal(); + method public abstract boolean[] getKeyUsage(); + method public abstract java.util.Date getNotAfter(); + method public abstract java.util.Date getNotBefore(); + method public abstract java.math.BigInteger getSerialNumber(); + method public abstract java.lang.String getSigAlgName(); + method public abstract java.lang.String getSigAlgOID(); + method public abstract byte[] getSigAlgParams(); + method public abstract byte[] getSignature(); + method public java.util.Collection> getSubjectAlternativeNames() throws java.security.cert.CertificateParsingException; + method public abstract java.security.Principal getSubjectDN(); + method public abstract boolean[] getSubjectUniqueID(); + method public javax.security.auth.x500.X500Principal getSubjectX500Principal(); + method public abstract byte[] getTBSCertificate() throws java.security.cert.CertificateEncodingException; + method public abstract int getVersion(); + } + + public abstract interface X509Extension { + method public abstract java.util.Set getCriticalExtensionOIDs(); + method public abstract byte[] getExtensionValue(java.lang.String); + method public abstract java.util.Set getNonCriticalExtensionOIDs(); + method public abstract boolean hasUnsupportedCriticalExtension(); + } + +} + +package java.security.interfaces { + + public abstract interface DSAKey { + method public abstract java.security.interfaces.DSAParams getParams(); + } + + public abstract interface DSAKeyPairGenerator { + method public abstract void initialize(java.security.interfaces.DSAParams, java.security.SecureRandom) throws java.security.InvalidParameterException; + method public abstract void initialize(int, boolean, java.security.SecureRandom) throws java.security.InvalidParameterException; + } + + public abstract interface DSAParams { + method public abstract java.math.BigInteger getG(); + method public abstract java.math.BigInteger getP(); + method public abstract java.math.BigInteger getQ(); + } + + public abstract interface DSAPrivateKey implements java.security.interfaces.DSAKey java.security.PrivateKey { + method public abstract java.math.BigInteger getX(); + field public static final long serialVersionUID = 7776497482533790279L; // 0x6bebab423b256247L + } + + public abstract interface DSAPublicKey implements java.security.interfaces.DSAKey java.security.PublicKey { + method public abstract java.math.BigInteger getY(); + field public static final long serialVersionUID = 1234526332779022332L; // 0x1121eb28ab28c7fcL + } + + public abstract interface ECKey { + method public abstract java.security.spec.ECParameterSpec getParams(); + } + + public abstract interface ECPrivateKey implements java.security.interfaces.ECKey java.security.PrivateKey { + method public abstract java.math.BigInteger getS(); + field public static final long serialVersionUID = -7896394956925609184L; // 0x926a5e9fa2435b20L + } + + public abstract interface ECPublicKey implements java.security.interfaces.ECKey java.security.PublicKey { + method public abstract java.security.spec.ECPoint getW(); + field public static final long serialVersionUID = -3314988629879632826L; // 0xd1fecb679990cc46L + } + + public abstract interface RSAKey { + method public abstract java.math.BigInteger getModulus(); + } + + public abstract interface RSAMultiPrimePrivateCrtKey implements java.security.interfaces.RSAPrivateKey { + method public abstract java.math.BigInteger getCrtCoefficient(); + method public abstract java.security.spec.RSAOtherPrimeInfo[] getOtherPrimeInfo(); + method public abstract java.math.BigInteger getPrimeExponentP(); + method public abstract java.math.BigInteger getPrimeExponentQ(); + method public abstract java.math.BigInteger getPrimeP(); + method public abstract java.math.BigInteger getPrimeQ(); + method public abstract java.math.BigInteger getPublicExponent(); + field public static final long serialVersionUID = 618058533534628008L; // 0x893c8f62dbaf8a8L + } + + public abstract interface RSAPrivateCrtKey implements java.security.interfaces.RSAPrivateKey { + method public abstract java.math.BigInteger getCrtCoefficient(); + method public abstract java.math.BigInteger getPrimeExponentP(); + method public abstract java.math.BigInteger getPrimeExponentQ(); + method public abstract java.math.BigInteger getPrimeP(); + method public abstract java.math.BigInteger getPrimeQ(); + method public abstract java.math.BigInteger getPublicExponent(); + field public static final long serialVersionUID = -5682214253527700368L; // 0xb124b83df8d1ec70L + } + + public abstract interface RSAPrivateKey implements java.security.PrivateKey java.security.interfaces.RSAKey { + method public abstract java.math.BigInteger getPrivateExponent(); + field public static final long serialVersionUID = 5187144804936595022L; // 0x47fc70b7a8c2364eL + } + + public abstract interface RSAPublicKey implements java.security.PublicKey java.security.interfaces.RSAKey { + method public abstract java.math.BigInteger getPublicExponent(); + field public static final long serialVersionUID = -8727434096241101194L; // 0x86e1ecedeceab676L + } + +} + +package java.security.spec { + + public abstract interface AlgorithmParameterSpec { + } + + public class DSAParameterSpec implements java.security.spec.AlgorithmParameterSpec java.security.interfaces.DSAParams { + ctor public DSAParameterSpec(java.math.BigInteger, java.math.BigInteger, java.math.BigInteger); + method public java.math.BigInteger getG(); + method public java.math.BigInteger getP(); + method public java.math.BigInteger getQ(); + } + + public class DSAPrivateKeySpec implements java.security.spec.KeySpec { + ctor public DSAPrivateKeySpec(java.math.BigInteger, java.math.BigInteger, java.math.BigInteger, java.math.BigInteger); + method public java.math.BigInteger getG(); + method public java.math.BigInteger getP(); + method public java.math.BigInteger getQ(); + method public java.math.BigInteger getX(); + } + + public class DSAPublicKeySpec implements java.security.spec.KeySpec { + ctor public DSAPublicKeySpec(java.math.BigInteger, java.math.BigInteger, java.math.BigInteger, java.math.BigInteger); + method public java.math.BigInteger getG(); + method public java.math.BigInteger getP(); + method public java.math.BigInteger getQ(); + method public java.math.BigInteger getY(); + } + + public abstract interface ECField { + method public abstract int getFieldSize(); + } + + public class ECFieldF2m implements java.security.spec.ECField { + ctor public ECFieldF2m(int); + ctor public ECFieldF2m(int, java.math.BigInteger); + ctor public ECFieldF2m(int, int[]); + method public int getFieldSize(); + method public int getM(); + method public int[] getMidTermsOfReductionPolynomial(); + method public java.math.BigInteger getReductionPolynomial(); + } + + public class ECFieldFp implements java.security.spec.ECField { + ctor public ECFieldFp(java.math.BigInteger); + method public int getFieldSize(); + method public java.math.BigInteger getP(); + } + + public class ECGenParameterSpec implements java.security.spec.AlgorithmParameterSpec { + ctor public ECGenParameterSpec(java.lang.String); + method public java.lang.String getName(); + } + + public class ECParameterSpec implements java.security.spec.AlgorithmParameterSpec { + ctor public ECParameterSpec(java.security.spec.EllipticCurve, java.security.spec.ECPoint, java.math.BigInteger, int); + method public int getCofactor(); + method public java.security.spec.EllipticCurve getCurve(); + method public java.security.spec.ECPoint getGenerator(); + method public java.math.BigInteger getOrder(); + } + + public class ECPoint { + ctor public ECPoint(java.math.BigInteger, java.math.BigInteger); + method public java.math.BigInteger getAffineX(); + method public java.math.BigInteger getAffineY(); + field public static final java.security.spec.ECPoint POINT_INFINITY; + } + + public class ECPrivateKeySpec implements java.security.spec.KeySpec { + ctor public ECPrivateKeySpec(java.math.BigInteger, java.security.spec.ECParameterSpec); + method public java.security.spec.ECParameterSpec getParams(); + method public java.math.BigInteger getS(); + } + + public class ECPublicKeySpec implements java.security.spec.KeySpec { + ctor public ECPublicKeySpec(java.security.spec.ECPoint, java.security.spec.ECParameterSpec); + method public java.security.spec.ECParameterSpec getParams(); + method public java.security.spec.ECPoint getW(); + } + + public class EllipticCurve { + ctor public EllipticCurve(java.security.spec.ECField, java.math.BigInteger, java.math.BigInteger, byte[]); + ctor public EllipticCurve(java.security.spec.ECField, java.math.BigInteger, java.math.BigInteger); + method public java.math.BigInteger getA(); + method public java.math.BigInteger getB(); + method public java.security.spec.ECField getField(); + method public byte[] getSeed(); + } + + public abstract class EncodedKeySpec implements java.security.spec.KeySpec { + ctor public EncodedKeySpec(byte[]); + method public byte[] getEncoded(); + method public abstract java.lang.String getFormat(); + } + + public class InvalidKeySpecException extends java.security.GeneralSecurityException { + ctor public InvalidKeySpecException(java.lang.String); + ctor public InvalidKeySpecException(); + ctor public InvalidKeySpecException(java.lang.String, java.lang.Throwable); + ctor public InvalidKeySpecException(java.lang.Throwable); + } + + public class InvalidParameterSpecException extends java.security.GeneralSecurityException { + ctor public InvalidParameterSpecException(java.lang.String); + ctor public InvalidParameterSpecException(); + } + + public abstract interface KeySpec { + } + + public class MGF1ParameterSpec implements java.security.spec.AlgorithmParameterSpec { + ctor public MGF1ParameterSpec(java.lang.String); + method public java.lang.String getDigestAlgorithm(); + field public static final java.security.spec.MGF1ParameterSpec SHA1; + field public static final java.security.spec.MGF1ParameterSpec SHA256; + field public static final java.security.spec.MGF1ParameterSpec SHA384; + field public static final java.security.spec.MGF1ParameterSpec SHA512; + } + + public class PKCS8EncodedKeySpec extends java.security.spec.EncodedKeySpec { + ctor public PKCS8EncodedKeySpec(byte[]); + method public final java.lang.String getFormat(); + } + + public class PSSParameterSpec implements java.security.spec.AlgorithmParameterSpec { + ctor public PSSParameterSpec(int); + ctor public PSSParameterSpec(java.lang.String, java.lang.String, java.security.spec.AlgorithmParameterSpec, int, int); + method public java.lang.String getDigestAlgorithm(); + method public java.lang.String getMGFAlgorithm(); + method public java.security.spec.AlgorithmParameterSpec getMGFParameters(); + method public int getSaltLength(); + method public int getTrailerField(); + field public static final java.security.spec.PSSParameterSpec DEFAULT; + } + + public class RSAKeyGenParameterSpec implements java.security.spec.AlgorithmParameterSpec { + ctor public RSAKeyGenParameterSpec(int, java.math.BigInteger); + method public int getKeysize(); + method public java.math.BigInteger getPublicExponent(); + field public static final java.math.BigInteger F0; + field public static final java.math.BigInteger F4; + } + + public class RSAMultiPrimePrivateCrtKeySpec extends java.security.spec.RSAPrivateKeySpec { + ctor public RSAMultiPrimePrivateCrtKeySpec(java.math.BigInteger, java.math.BigInteger, java.math.BigInteger, java.math.BigInteger, java.math.BigInteger, java.math.BigInteger, java.math.BigInteger, java.math.BigInteger, java.security.spec.RSAOtherPrimeInfo[]); + method public java.math.BigInteger getCrtCoefficient(); + method public java.security.spec.RSAOtherPrimeInfo[] getOtherPrimeInfo(); + method public java.math.BigInteger getPrimeExponentP(); + method public java.math.BigInteger getPrimeExponentQ(); + method public java.math.BigInteger getPrimeP(); + method public java.math.BigInteger getPrimeQ(); + method public java.math.BigInteger getPublicExponent(); + } + + public class RSAOtherPrimeInfo { + ctor public RSAOtherPrimeInfo(java.math.BigInteger, java.math.BigInteger, java.math.BigInteger); + method public final java.math.BigInteger getCrtCoefficient(); + method public final java.math.BigInteger getExponent(); + method public final java.math.BigInteger getPrime(); + } + + public class RSAPrivateCrtKeySpec extends java.security.spec.RSAPrivateKeySpec { + ctor public RSAPrivateCrtKeySpec(java.math.BigInteger, java.math.BigInteger, java.math.BigInteger, java.math.BigInteger, java.math.BigInteger, java.math.BigInteger, java.math.BigInteger, java.math.BigInteger); + method public java.math.BigInteger getCrtCoefficient(); + method public java.math.BigInteger getPrimeExponentP(); + method public java.math.BigInteger getPrimeExponentQ(); + method public java.math.BigInteger getPrimeP(); + method public java.math.BigInteger getPrimeQ(); + method public java.math.BigInteger getPublicExponent(); + } + + public class RSAPrivateKeySpec implements java.security.spec.KeySpec { + ctor public RSAPrivateKeySpec(java.math.BigInteger, java.math.BigInteger); + method public java.math.BigInteger getModulus(); + method public java.math.BigInteger getPrivateExponent(); + } + + public class RSAPublicKeySpec implements java.security.spec.KeySpec { + ctor public RSAPublicKeySpec(java.math.BigInteger, java.math.BigInteger); + method public java.math.BigInteger getModulus(); + method public java.math.BigInteger getPublicExponent(); + } + + public class X509EncodedKeySpec extends java.security.spec.EncodedKeySpec { + ctor public X509EncodedKeySpec(byte[]); + method public final java.lang.String getFormat(); + } + +} + +package java.sql { + + public abstract interface Array { + method public abstract void free() throws java.sql.SQLException; + method public abstract java.lang.Object getArray() throws java.sql.SQLException; + method public abstract java.lang.Object getArray(long, int) throws java.sql.SQLException; + method public abstract java.lang.Object getArray(long, int, java.util.Map>) throws java.sql.SQLException; + method public abstract java.lang.Object getArray(java.util.Map>) throws java.sql.SQLException; + method public abstract int getBaseType() throws java.sql.SQLException; + method public abstract java.lang.String getBaseTypeName() throws java.sql.SQLException; + method public abstract java.sql.ResultSet getResultSet() throws java.sql.SQLException; + method public abstract java.sql.ResultSet getResultSet(long, int) throws java.sql.SQLException; + method public abstract java.sql.ResultSet getResultSet(long, int, java.util.Map>) throws java.sql.SQLException; + method public abstract java.sql.ResultSet getResultSet(java.util.Map>) throws java.sql.SQLException; + } + + public class BatchUpdateException extends java.sql.SQLException implements java.io.Serializable { + ctor public BatchUpdateException(); + ctor public BatchUpdateException(java.lang.Throwable); + ctor public BatchUpdateException(int[], java.lang.Throwable); + ctor public BatchUpdateException(java.lang.String, int[], java.lang.Throwable); + ctor public BatchUpdateException(java.lang.String, java.lang.String, int[], java.lang.Throwable); + ctor public BatchUpdateException(java.lang.String, java.lang.String, int, int[], java.lang.Throwable); + ctor public BatchUpdateException(int[]); + ctor public BatchUpdateException(java.lang.String, int[]); + ctor public BatchUpdateException(java.lang.String, java.lang.String, int[]); + ctor public BatchUpdateException(java.lang.String, java.lang.String, int, int[]); + method public int[] getUpdateCounts(); + } + + public abstract interface Blob { + method public abstract void free() throws java.sql.SQLException; + method public abstract java.io.InputStream getBinaryStream() throws java.sql.SQLException; + method public abstract java.io.InputStream getBinaryStream(long, long) throws java.sql.SQLException; + method public abstract byte[] getBytes(long, int) throws java.sql.SQLException; + method public abstract long length() throws java.sql.SQLException; + method public abstract long position(java.sql.Blob, long) throws java.sql.SQLException; + method public abstract long position(byte[], long) throws java.sql.SQLException; + method public abstract java.io.OutputStream setBinaryStream(long) throws java.sql.SQLException; + method public abstract int setBytes(long, byte[]) throws java.sql.SQLException; + method public abstract int setBytes(long, byte[], int, int) throws java.sql.SQLException; + method public abstract void truncate(long) throws java.sql.SQLException; + } + + public abstract interface CallableStatement implements java.sql.PreparedStatement { + method public abstract java.sql.Array getArray(int) throws java.sql.SQLException; + method public abstract java.sql.Array getArray(java.lang.String) throws java.sql.SQLException; + method public abstract java.math.BigDecimal getBigDecimal(int) throws java.sql.SQLException; + method public abstract deprecated java.math.BigDecimal getBigDecimal(int, int) throws java.sql.SQLException; + method public abstract java.math.BigDecimal getBigDecimal(java.lang.String) throws java.sql.SQLException; + method public abstract java.sql.Blob getBlob(int) throws java.sql.SQLException; + method public abstract java.sql.Blob getBlob(java.lang.String) throws java.sql.SQLException; + method public abstract boolean getBoolean(int) throws java.sql.SQLException; + method public abstract boolean getBoolean(java.lang.String) throws java.sql.SQLException; + method public abstract byte getByte(int) throws java.sql.SQLException; + method public abstract byte getByte(java.lang.String) throws java.sql.SQLException; + method public abstract byte[] getBytes(int) throws java.sql.SQLException; + method public abstract byte[] getBytes(java.lang.String) throws java.sql.SQLException; + method public abstract java.io.Reader getCharacterStream(int) throws java.sql.SQLException; + method public abstract java.io.Reader getCharacterStream(java.lang.String) throws java.sql.SQLException; + method public abstract java.sql.Clob getClob(int) throws java.sql.SQLException; + method public abstract java.sql.Clob getClob(java.lang.String) throws java.sql.SQLException; + method public abstract java.sql.Date getDate(int) throws java.sql.SQLException; + method public abstract java.sql.Date getDate(int, java.util.Calendar) throws java.sql.SQLException; + method public abstract java.sql.Date getDate(java.lang.String) throws java.sql.SQLException; + method public abstract java.sql.Date getDate(java.lang.String, java.util.Calendar) throws java.sql.SQLException; + method public abstract double getDouble(int) throws java.sql.SQLException; + method public abstract double getDouble(java.lang.String) throws java.sql.SQLException; + method public abstract float getFloat(int) throws java.sql.SQLException; + method public abstract float getFloat(java.lang.String) throws java.sql.SQLException; + method public abstract int getInt(int) throws java.sql.SQLException; + method public abstract int getInt(java.lang.String) throws java.sql.SQLException; + method public abstract long getLong(int) throws java.sql.SQLException; + method public abstract long getLong(java.lang.String) throws java.sql.SQLException; + method public abstract java.io.Reader getNCharacterStream(int) throws java.sql.SQLException; + method public abstract java.io.Reader getNCharacterStream(java.lang.String) throws java.sql.SQLException; + method public abstract java.sql.NClob getNClob(int) throws java.sql.SQLException; + method public abstract java.sql.NClob getNClob(java.lang.String) throws java.sql.SQLException; + method public abstract java.lang.String getNString(int) throws java.sql.SQLException; + method public abstract java.lang.String getNString(java.lang.String) throws java.sql.SQLException; + method public abstract java.lang.Object getObject(int) throws java.sql.SQLException; + method public abstract java.lang.Object getObject(int, java.util.Map>) throws java.sql.SQLException; + method public abstract java.lang.Object getObject(java.lang.String) throws java.sql.SQLException; + method public abstract java.lang.Object getObject(java.lang.String, java.util.Map>) throws java.sql.SQLException; + method public abstract java.sql.Ref getRef(int) throws java.sql.SQLException; + method public abstract java.sql.Ref getRef(java.lang.String) throws java.sql.SQLException; + method public abstract java.sql.RowId getRowId(int) throws java.sql.SQLException; + method public abstract java.sql.RowId getRowId(java.lang.String) throws java.sql.SQLException; + method public abstract java.sql.SQLXML getSQLXML(int) throws java.sql.SQLException; + method public abstract java.sql.SQLXML getSQLXML(java.lang.String) throws java.sql.SQLException; + method public abstract short getShort(int) throws java.sql.SQLException; + method public abstract short getShort(java.lang.String) throws java.sql.SQLException; + method public abstract java.lang.String getString(int) throws java.sql.SQLException; + method public abstract java.lang.String getString(java.lang.String) throws java.sql.SQLException; + method public abstract java.sql.Time getTime(int) throws java.sql.SQLException; + method public abstract java.sql.Time getTime(int, java.util.Calendar) throws java.sql.SQLException; + method public abstract java.sql.Time getTime(java.lang.String) throws java.sql.SQLException; + method public abstract java.sql.Time getTime(java.lang.String, java.util.Calendar) throws java.sql.SQLException; + method public abstract java.sql.Timestamp getTimestamp(int) throws java.sql.SQLException; + method public abstract java.sql.Timestamp getTimestamp(int, java.util.Calendar) throws java.sql.SQLException; + method public abstract java.sql.Timestamp getTimestamp(java.lang.String) throws java.sql.SQLException; + method public abstract java.sql.Timestamp getTimestamp(java.lang.String, java.util.Calendar) throws java.sql.SQLException; + method public abstract java.net.URL getURL(int) throws java.sql.SQLException; + method public abstract java.net.URL getURL(java.lang.String) throws java.sql.SQLException; + method public abstract void registerOutParameter(int, int) throws java.sql.SQLException; + method public abstract void registerOutParameter(int, int, int) throws java.sql.SQLException; + method public abstract void registerOutParameter(int, int, java.lang.String) throws java.sql.SQLException; + method public abstract void registerOutParameter(java.lang.String, int) throws java.sql.SQLException; + method public abstract void registerOutParameter(java.lang.String, int, int) throws java.sql.SQLException; + method public abstract void registerOutParameter(java.lang.String, int, java.lang.String) throws java.sql.SQLException; + method public abstract void setAsciiStream(java.lang.String, java.io.InputStream, int) throws java.sql.SQLException; + method public abstract void setAsciiStream(java.lang.String, java.io.InputStream, long) throws java.sql.SQLException; + method public abstract void setAsciiStream(java.lang.String, java.io.InputStream) throws java.sql.SQLException; + method public abstract void setBigDecimal(java.lang.String, java.math.BigDecimal) throws java.sql.SQLException; + method public abstract void setBinaryStream(java.lang.String, java.io.InputStream, int) throws java.sql.SQLException; + method public abstract void setBinaryStream(java.lang.String, java.io.InputStream, long) throws java.sql.SQLException; + method public abstract void setBinaryStream(java.lang.String, java.io.InputStream) throws java.sql.SQLException; + method public abstract void setBlob(java.lang.String, java.io.InputStream, long) throws java.sql.SQLException; + method public abstract void setBlob(java.lang.String, java.sql.Blob) throws java.sql.SQLException; + method public abstract void setBlob(java.lang.String, java.io.InputStream) throws java.sql.SQLException; + method public abstract void setBoolean(java.lang.String, boolean) throws java.sql.SQLException; + method public abstract void setByte(java.lang.String, byte) throws java.sql.SQLException; + method public abstract void setBytes(java.lang.String, byte[]) throws java.sql.SQLException; + method public abstract void setCharacterStream(java.lang.String, java.io.Reader, int) throws java.sql.SQLException; + method public abstract void setCharacterStream(java.lang.String, java.io.Reader, long) throws java.sql.SQLException; + method public abstract void setCharacterStream(java.lang.String, java.io.Reader) throws java.sql.SQLException; + method public abstract void setClob(java.lang.String, java.io.Reader, long) throws java.sql.SQLException; + method public abstract void setClob(java.lang.String, java.sql.Clob) throws java.sql.SQLException; + method public abstract void setClob(java.lang.String, java.io.Reader) throws java.sql.SQLException; + method public abstract void setDate(java.lang.String, java.sql.Date) throws java.sql.SQLException; + method public abstract void setDate(java.lang.String, java.sql.Date, java.util.Calendar) throws java.sql.SQLException; + method public abstract void setDouble(java.lang.String, double) throws java.sql.SQLException; + method public abstract void setFloat(java.lang.String, float) throws java.sql.SQLException; + method public abstract void setInt(java.lang.String, int) throws java.sql.SQLException; + method public abstract void setLong(java.lang.String, long) throws java.sql.SQLException; + method public abstract void setNCharacterStream(java.lang.String, java.io.Reader, long) throws java.sql.SQLException; + method public abstract void setNCharacterStream(java.lang.String, java.io.Reader) throws java.sql.SQLException; + method public abstract void setNClob(java.lang.String, java.sql.NClob) throws java.sql.SQLException; + method public abstract void setNClob(java.lang.String, java.io.Reader, long) throws java.sql.SQLException; + method public abstract void setNClob(java.lang.String, java.io.Reader) throws java.sql.SQLException; + method public abstract void setNString(java.lang.String, java.lang.String) throws java.sql.SQLException; + method public abstract void setNull(java.lang.String, int) throws java.sql.SQLException; + method public abstract void setNull(java.lang.String, int, java.lang.String) throws java.sql.SQLException; + method public abstract void setObject(java.lang.String, java.lang.Object) throws java.sql.SQLException; + method public abstract void setObject(java.lang.String, java.lang.Object, int) throws java.sql.SQLException; + method public abstract void setObject(java.lang.String, java.lang.Object, int, int) throws java.sql.SQLException; + method public abstract void setRowId(java.lang.String, java.sql.RowId) throws java.sql.SQLException; + method public abstract void setSQLXML(java.lang.String, java.sql.SQLXML) throws java.sql.SQLException; + method public abstract void setShort(java.lang.String, short) throws java.sql.SQLException; + method public abstract void setString(java.lang.String, java.lang.String) throws java.sql.SQLException; + method public abstract void setTime(java.lang.String, java.sql.Time) throws java.sql.SQLException; + method public abstract void setTime(java.lang.String, java.sql.Time, java.util.Calendar) throws java.sql.SQLException; + method public abstract void setTimestamp(java.lang.String, java.sql.Timestamp) throws java.sql.SQLException; + method public abstract void setTimestamp(java.lang.String, java.sql.Timestamp, java.util.Calendar) throws java.sql.SQLException; + method public abstract void setURL(java.lang.String, java.net.URL) throws java.sql.SQLException; + method public abstract boolean wasNull() throws java.sql.SQLException; + } + + public final class ClientInfoStatus extends java.lang.Enum { + method public static java.sql.ClientInfoStatus valueOf(java.lang.String); + method public static final java.sql.ClientInfoStatus[] values(); + enum_constant public static final java.sql.ClientInfoStatus REASON_UNKNOWN; + enum_constant public static final java.sql.ClientInfoStatus REASON_UNKNOWN_PROPERTY; + enum_constant public static final java.sql.ClientInfoStatus REASON_VALUE_INVALID; + enum_constant public static final java.sql.ClientInfoStatus REASON_VALUE_TRUNCATED; + } + + public abstract interface Clob { + method public abstract void free() throws java.sql.SQLException; + method public abstract java.io.InputStream getAsciiStream() throws java.sql.SQLException; + method public abstract java.io.Reader getCharacterStream() throws java.sql.SQLException; + method public abstract java.io.Reader getCharacterStream(long, long) throws java.sql.SQLException; + method public abstract java.lang.String getSubString(long, int) throws java.sql.SQLException; + method public abstract long length() throws java.sql.SQLException; + method public abstract long position(java.sql.Clob, long) throws java.sql.SQLException; + method public abstract long position(java.lang.String, long) throws java.sql.SQLException; + method public abstract java.io.OutputStream setAsciiStream(long) throws java.sql.SQLException; + method public abstract java.io.Writer setCharacterStream(long) throws java.sql.SQLException; + method public abstract int setString(long, java.lang.String) throws java.sql.SQLException; + method public abstract int setString(long, java.lang.String, int, int) throws java.sql.SQLException; + method public abstract void truncate(long) throws java.sql.SQLException; + } + + public abstract interface Connection implements java.sql.Wrapper { + method public abstract void clearWarnings() throws java.sql.SQLException; + method public abstract void close() throws java.sql.SQLException; + method public abstract void commit() throws java.sql.SQLException; + method public abstract java.sql.Array createArrayOf(java.lang.String, java.lang.Object[]) throws java.sql.SQLException; + method public abstract java.sql.Blob createBlob() throws java.sql.SQLException; + method public abstract java.sql.Clob createClob() throws java.sql.SQLException; + method public abstract java.sql.NClob createNClob() throws java.sql.SQLException; + method public abstract java.sql.SQLXML createSQLXML() throws java.sql.SQLException; + method public abstract java.sql.Statement createStatement() throws java.sql.SQLException; + method public abstract java.sql.Statement createStatement(int, int) throws java.sql.SQLException; + method public abstract java.sql.Statement createStatement(int, int, int) throws java.sql.SQLException; + method public abstract java.sql.Struct createStruct(java.lang.String, java.lang.Object[]) throws java.sql.SQLException; + method public abstract boolean getAutoCommit() throws java.sql.SQLException; + method public abstract java.lang.String getCatalog() throws java.sql.SQLException; + method public abstract java.lang.String getClientInfo(java.lang.String) throws java.sql.SQLException; + method public abstract java.util.Properties getClientInfo() throws java.sql.SQLException; + method public abstract int getHoldability() throws java.sql.SQLException; + method public abstract java.sql.DatabaseMetaData getMetaData() throws java.sql.SQLException; + method public abstract int getTransactionIsolation() throws java.sql.SQLException; + method public abstract java.util.Map> getTypeMap() throws java.sql.SQLException; + method public abstract java.sql.SQLWarning getWarnings() throws java.sql.SQLException; + method public abstract boolean isClosed() throws java.sql.SQLException; + method public abstract boolean isReadOnly() throws java.sql.SQLException; + method public abstract boolean isValid(int) throws java.sql.SQLException; + method public abstract java.lang.String nativeSQL(java.lang.String) throws java.sql.SQLException; + method public abstract java.sql.CallableStatement prepareCall(java.lang.String) throws java.sql.SQLException; + method public abstract java.sql.CallableStatement prepareCall(java.lang.String, int, int) throws java.sql.SQLException; + method public abstract java.sql.CallableStatement prepareCall(java.lang.String, int, int, int) throws java.sql.SQLException; + method public abstract java.sql.PreparedStatement prepareStatement(java.lang.String) throws java.sql.SQLException; + method public abstract java.sql.PreparedStatement prepareStatement(java.lang.String, int) throws java.sql.SQLException; + method public abstract java.sql.PreparedStatement prepareStatement(java.lang.String, int[]) throws java.sql.SQLException; + method public abstract java.sql.PreparedStatement prepareStatement(java.lang.String, int, int) throws java.sql.SQLException; + method public abstract java.sql.PreparedStatement prepareStatement(java.lang.String, int, int, int) throws java.sql.SQLException; + method public abstract java.sql.PreparedStatement prepareStatement(java.lang.String, java.lang.String[]) throws java.sql.SQLException; + method public abstract void releaseSavepoint(java.sql.Savepoint) throws java.sql.SQLException; + method public abstract void rollback() throws java.sql.SQLException; + method public abstract void rollback(java.sql.Savepoint) throws java.sql.SQLException; + method public abstract void setAutoCommit(boolean) throws java.sql.SQLException; + method public abstract void setCatalog(java.lang.String) throws java.sql.SQLException; + method public abstract void setClientInfo(java.lang.String, java.lang.String) throws java.sql.SQLClientInfoException; + method public abstract void setClientInfo(java.util.Properties) throws java.sql.SQLClientInfoException; + method public abstract void setHoldability(int) throws java.sql.SQLException; + method public abstract void setReadOnly(boolean) throws java.sql.SQLException; + method public abstract java.sql.Savepoint setSavepoint() throws java.sql.SQLException; + method public abstract java.sql.Savepoint setSavepoint(java.lang.String) throws java.sql.SQLException; + method public abstract void setTransactionIsolation(int) throws java.sql.SQLException; + method public abstract void setTypeMap(java.util.Map>) throws java.sql.SQLException; + field public static final int TRANSACTION_NONE = 0; // 0x0 + field public static final int TRANSACTION_READ_COMMITTED = 2; // 0x2 + field public static final int TRANSACTION_READ_UNCOMMITTED = 1; // 0x1 + field public static final int TRANSACTION_REPEATABLE_READ = 4; // 0x4 + field public static final int TRANSACTION_SERIALIZABLE = 8; // 0x8 + } + + public class DataTruncation extends java.sql.SQLWarning implements java.io.Serializable { + ctor public DataTruncation(int, boolean, boolean, int, int); + ctor public DataTruncation(int, boolean, boolean, int, int, java.lang.Throwable); + method public int getDataSize(); + method public int getIndex(); + method public boolean getParameter(); + method public boolean getRead(); + method public int getTransferSize(); + } + + public abstract interface DatabaseMetaData implements java.sql.Wrapper { + method public abstract boolean allProceduresAreCallable() throws java.sql.SQLException; + method public abstract boolean allTablesAreSelectable() throws java.sql.SQLException; + method public abstract boolean autoCommitFailureClosesAllResultSets() throws java.sql.SQLException; + method public abstract boolean dataDefinitionCausesTransactionCommit() throws java.sql.SQLException; + method public abstract boolean dataDefinitionIgnoredInTransactions() throws java.sql.SQLException; + method public abstract boolean deletesAreDetected(int) throws java.sql.SQLException; + method public abstract boolean doesMaxRowSizeIncludeBlobs() throws java.sql.SQLException; + method public abstract java.sql.ResultSet getAttributes(java.lang.String, java.lang.String, java.lang.String, java.lang.String) throws java.sql.SQLException; + method public abstract java.sql.ResultSet getBestRowIdentifier(java.lang.String, java.lang.String, java.lang.String, int, boolean) throws java.sql.SQLException; + method public abstract java.lang.String getCatalogSeparator() throws java.sql.SQLException; + method public abstract java.lang.String getCatalogTerm() throws java.sql.SQLException; + method public abstract java.sql.ResultSet getCatalogs() throws java.sql.SQLException; + method public abstract java.sql.ResultSet getClientInfoProperties() throws java.sql.SQLException; + method public abstract java.sql.ResultSet getColumnPrivileges(java.lang.String, java.lang.String, java.lang.String, java.lang.String) throws java.sql.SQLException; + method public abstract java.sql.ResultSet getColumns(java.lang.String, java.lang.String, java.lang.String, java.lang.String) throws java.sql.SQLException; + method public abstract java.sql.Connection getConnection() throws java.sql.SQLException; + method public abstract java.sql.ResultSet getCrossReference(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String) throws java.sql.SQLException; + method public abstract int getDatabaseMajorVersion() throws java.sql.SQLException; + method public abstract int getDatabaseMinorVersion() throws java.sql.SQLException; + method public abstract java.lang.String getDatabaseProductName() throws java.sql.SQLException; + method public abstract java.lang.String getDatabaseProductVersion() throws java.sql.SQLException; + method public abstract int getDefaultTransactionIsolation() throws java.sql.SQLException; + method public abstract int getDriverMajorVersion(); + method public abstract int getDriverMinorVersion(); + method public abstract java.lang.String getDriverName() throws java.sql.SQLException; + method public abstract java.lang.String getDriverVersion() throws java.sql.SQLException; + method public abstract java.sql.ResultSet getExportedKeys(java.lang.String, java.lang.String, java.lang.String) throws java.sql.SQLException; + method public abstract java.lang.String getExtraNameCharacters() throws java.sql.SQLException; + method public abstract java.sql.ResultSet getFunctionColumns(java.lang.String, java.lang.String, java.lang.String, java.lang.String) throws java.sql.SQLException; + method public abstract java.sql.ResultSet getFunctions(java.lang.String, java.lang.String, java.lang.String) throws java.sql.SQLException; + method public abstract java.lang.String getIdentifierQuoteString() throws java.sql.SQLException; + method public abstract java.sql.ResultSet getImportedKeys(java.lang.String, java.lang.String, java.lang.String) throws java.sql.SQLException; + method public abstract java.sql.ResultSet getIndexInfo(java.lang.String, java.lang.String, java.lang.String, boolean, boolean) throws java.sql.SQLException; + method public abstract int getJDBCMajorVersion() throws java.sql.SQLException; + method public abstract int getJDBCMinorVersion() throws java.sql.SQLException; + method public abstract int getMaxBinaryLiteralLength() throws java.sql.SQLException; + method public abstract int getMaxCatalogNameLength() throws java.sql.SQLException; + method public abstract int getMaxCharLiteralLength() throws java.sql.SQLException; + method public abstract int getMaxColumnNameLength() throws java.sql.SQLException; + method public abstract int getMaxColumnsInGroupBy() throws java.sql.SQLException; + method public abstract int getMaxColumnsInIndex() throws java.sql.SQLException; + method public abstract int getMaxColumnsInOrderBy() throws java.sql.SQLException; + method public abstract int getMaxColumnsInSelect() throws java.sql.SQLException; + method public abstract int getMaxColumnsInTable() throws java.sql.SQLException; + method public abstract int getMaxConnections() throws java.sql.SQLException; + method public abstract int getMaxCursorNameLength() throws java.sql.SQLException; + method public abstract int getMaxIndexLength() throws java.sql.SQLException; + method public abstract int getMaxProcedureNameLength() throws java.sql.SQLException; + method public abstract int getMaxRowSize() throws java.sql.SQLException; + method public abstract int getMaxSchemaNameLength() throws java.sql.SQLException; + method public abstract int getMaxStatementLength() throws java.sql.SQLException; + method public abstract int getMaxStatements() throws java.sql.SQLException; + method public abstract int getMaxTableNameLength() throws java.sql.SQLException; + method public abstract int getMaxTablesInSelect() throws java.sql.SQLException; + method public abstract int getMaxUserNameLength() throws java.sql.SQLException; + method public abstract java.lang.String getNumericFunctions() throws java.sql.SQLException; + method public abstract java.sql.ResultSet getPrimaryKeys(java.lang.String, java.lang.String, java.lang.String) throws java.sql.SQLException; + method public abstract java.sql.ResultSet getProcedureColumns(java.lang.String, java.lang.String, java.lang.String, java.lang.String) throws java.sql.SQLException; + method public abstract java.lang.String getProcedureTerm() throws java.sql.SQLException; + method public abstract java.sql.ResultSet getProcedures(java.lang.String, java.lang.String, java.lang.String) throws java.sql.SQLException; + method public abstract int getResultSetHoldability() throws java.sql.SQLException; + method public abstract java.sql.RowIdLifetime getRowIdLifetime() throws java.sql.SQLException; + method public abstract java.lang.String getSQLKeywords() throws java.sql.SQLException; + method public abstract int getSQLStateType() throws java.sql.SQLException; + method public abstract java.lang.String getSchemaTerm() throws java.sql.SQLException; + method public abstract java.sql.ResultSet getSchemas() throws java.sql.SQLException; + method public abstract java.sql.ResultSet getSchemas(java.lang.String, java.lang.String) throws java.sql.SQLException; + method public abstract java.lang.String getSearchStringEscape() throws java.sql.SQLException; + method public abstract java.lang.String getStringFunctions() throws java.sql.SQLException; + method public abstract java.sql.ResultSet getSuperTables(java.lang.String, java.lang.String, java.lang.String) throws java.sql.SQLException; + method public abstract java.sql.ResultSet getSuperTypes(java.lang.String, java.lang.String, java.lang.String) throws java.sql.SQLException; + method public abstract java.lang.String getSystemFunctions() throws java.sql.SQLException; + method public abstract java.sql.ResultSet getTablePrivileges(java.lang.String, java.lang.String, java.lang.String) throws java.sql.SQLException; + method public abstract java.sql.ResultSet getTableTypes() throws java.sql.SQLException; + method public abstract java.sql.ResultSet getTables(java.lang.String, java.lang.String, java.lang.String, java.lang.String[]) throws java.sql.SQLException; + method public abstract java.lang.String getTimeDateFunctions() throws java.sql.SQLException; + method public abstract java.sql.ResultSet getTypeInfo() throws java.sql.SQLException; + method public abstract java.sql.ResultSet getUDTs(java.lang.String, java.lang.String, java.lang.String, int[]) throws java.sql.SQLException; + method public abstract java.lang.String getURL() throws java.sql.SQLException; + method public abstract java.lang.String getUserName() throws java.sql.SQLException; + method public abstract java.sql.ResultSet getVersionColumns(java.lang.String, java.lang.String, java.lang.String) throws java.sql.SQLException; + method public abstract boolean insertsAreDetected(int) throws java.sql.SQLException; + method public abstract boolean isCatalogAtStart() throws java.sql.SQLException; + method public abstract boolean isReadOnly() throws java.sql.SQLException; + method public abstract boolean locatorsUpdateCopy() throws java.sql.SQLException; + method public abstract boolean nullPlusNonNullIsNull() throws java.sql.SQLException; + method public abstract boolean nullsAreSortedAtEnd() throws java.sql.SQLException; + method public abstract boolean nullsAreSortedAtStart() throws java.sql.SQLException; + method public abstract boolean nullsAreSortedHigh() throws java.sql.SQLException; + method public abstract boolean nullsAreSortedLow() throws java.sql.SQLException; + method public abstract boolean othersDeletesAreVisible(int) throws java.sql.SQLException; + method public abstract boolean othersInsertsAreVisible(int) throws java.sql.SQLException; + method public abstract boolean othersUpdatesAreVisible(int) throws java.sql.SQLException; + method public abstract boolean ownDeletesAreVisible(int) throws java.sql.SQLException; + method public abstract boolean ownInsertsAreVisible(int) throws java.sql.SQLException; + method public abstract boolean ownUpdatesAreVisible(int) throws java.sql.SQLException; + method public abstract boolean storesLowerCaseIdentifiers() throws java.sql.SQLException; + method public abstract boolean storesLowerCaseQuotedIdentifiers() throws java.sql.SQLException; + method public abstract boolean storesMixedCaseIdentifiers() throws java.sql.SQLException; + method public abstract boolean storesMixedCaseQuotedIdentifiers() throws java.sql.SQLException; + method public abstract boolean storesUpperCaseIdentifiers() throws java.sql.SQLException; + method public abstract boolean storesUpperCaseQuotedIdentifiers() throws java.sql.SQLException; + method public abstract boolean supportsANSI92EntryLevelSQL() throws java.sql.SQLException; + method public abstract boolean supportsANSI92FullSQL() throws java.sql.SQLException; + method public abstract boolean supportsANSI92IntermediateSQL() throws java.sql.SQLException; + method public abstract boolean supportsAlterTableWithAddColumn() throws java.sql.SQLException; + method public abstract boolean supportsAlterTableWithDropColumn() throws java.sql.SQLException; + method public abstract boolean supportsBatchUpdates() throws java.sql.SQLException; + method public abstract boolean supportsCatalogsInDataManipulation() throws java.sql.SQLException; + method public abstract boolean supportsCatalogsInIndexDefinitions() throws java.sql.SQLException; + method public abstract boolean supportsCatalogsInPrivilegeDefinitions() throws java.sql.SQLException; + method public abstract boolean supportsCatalogsInProcedureCalls() throws java.sql.SQLException; + method public abstract boolean supportsCatalogsInTableDefinitions() throws java.sql.SQLException; + method public abstract boolean supportsColumnAliasing() throws java.sql.SQLException; + method public abstract boolean supportsConvert() throws java.sql.SQLException; + method public abstract boolean supportsConvert(int, int) throws java.sql.SQLException; + method public abstract boolean supportsCoreSQLGrammar() throws java.sql.SQLException; + method public abstract boolean supportsCorrelatedSubqueries() throws java.sql.SQLException; + method public abstract boolean supportsDataDefinitionAndDataManipulationTransactions() throws java.sql.SQLException; + method public abstract boolean supportsDataManipulationTransactionsOnly() throws java.sql.SQLException; + method public abstract boolean supportsDifferentTableCorrelationNames() throws java.sql.SQLException; + method public abstract boolean supportsExpressionsInOrderBy() throws java.sql.SQLException; + method public abstract boolean supportsExtendedSQLGrammar() throws java.sql.SQLException; + method public abstract boolean supportsFullOuterJoins() throws java.sql.SQLException; + method public abstract boolean supportsGetGeneratedKeys() throws java.sql.SQLException; + method public abstract boolean supportsGroupBy() throws java.sql.SQLException; + method public abstract boolean supportsGroupByBeyondSelect() throws java.sql.SQLException; + method public abstract boolean supportsGroupByUnrelated() throws java.sql.SQLException; + method public abstract boolean supportsIntegrityEnhancementFacility() throws java.sql.SQLException; + method public abstract boolean supportsLikeEscapeClause() throws java.sql.SQLException; + method public abstract boolean supportsLimitedOuterJoins() throws java.sql.SQLException; + method public abstract boolean supportsMinimumSQLGrammar() throws java.sql.SQLException; + method public abstract boolean supportsMixedCaseIdentifiers() throws java.sql.SQLException; + method public abstract boolean supportsMixedCaseQuotedIdentifiers() throws java.sql.SQLException; + method public abstract boolean supportsMultipleOpenResults() throws java.sql.SQLException; + method public abstract boolean supportsMultipleResultSets() throws java.sql.SQLException; + method public abstract boolean supportsMultipleTransactions() throws java.sql.SQLException; + method public abstract boolean supportsNamedParameters() throws java.sql.SQLException; + method public abstract boolean supportsNonNullableColumns() throws java.sql.SQLException; + method public abstract boolean supportsOpenCursorsAcrossCommit() throws java.sql.SQLException; + method public abstract boolean supportsOpenCursorsAcrossRollback() throws java.sql.SQLException; + method public abstract boolean supportsOpenStatementsAcrossCommit() throws java.sql.SQLException; + method public abstract boolean supportsOpenStatementsAcrossRollback() throws java.sql.SQLException; + method public abstract boolean supportsOrderByUnrelated() throws java.sql.SQLException; + method public abstract boolean supportsOuterJoins() throws java.sql.SQLException; + method public abstract boolean supportsPositionedDelete() throws java.sql.SQLException; + method public abstract boolean supportsPositionedUpdate() throws java.sql.SQLException; + method public abstract boolean supportsResultSetConcurrency(int, int) throws java.sql.SQLException; + method public abstract boolean supportsResultSetHoldability(int) throws java.sql.SQLException; + method public abstract boolean supportsResultSetType(int) throws java.sql.SQLException; + method public abstract boolean supportsSavepoints() throws java.sql.SQLException; + method public abstract boolean supportsSchemasInDataManipulation() throws java.sql.SQLException; + method public abstract boolean supportsSchemasInIndexDefinitions() throws java.sql.SQLException; + method public abstract boolean supportsSchemasInPrivilegeDefinitions() throws java.sql.SQLException; + method public abstract boolean supportsSchemasInProcedureCalls() throws java.sql.SQLException; + method public abstract boolean supportsSchemasInTableDefinitions() throws java.sql.SQLException; + method public abstract boolean supportsSelectForUpdate() throws java.sql.SQLException; + method public abstract boolean supportsStatementPooling() throws java.sql.SQLException; + method public abstract boolean supportsStoredFunctionsUsingCallSyntax() throws java.sql.SQLException; + method public abstract boolean supportsStoredProcedures() throws java.sql.SQLException; + method public abstract boolean supportsSubqueriesInComparisons() throws java.sql.SQLException; + method public abstract boolean supportsSubqueriesInExists() throws java.sql.SQLException; + method public abstract boolean supportsSubqueriesInIns() throws java.sql.SQLException; + method public abstract boolean supportsSubqueriesInQuantifieds() throws java.sql.SQLException; + method public abstract boolean supportsTableCorrelationNames() throws java.sql.SQLException; + method public abstract boolean supportsTransactionIsolationLevel(int) throws java.sql.SQLException; + method public abstract boolean supportsTransactions() throws java.sql.SQLException; + method public abstract boolean supportsUnion() throws java.sql.SQLException; + method public abstract boolean supportsUnionAll() throws java.sql.SQLException; + method public abstract boolean updatesAreDetected(int) throws java.sql.SQLException; + method public abstract boolean usesLocalFilePerTable() throws java.sql.SQLException; + method public abstract boolean usesLocalFiles() throws java.sql.SQLException; + field public static final short attributeNoNulls = 0; // 0x0 + field public static final short attributeNullable = 1; // 0x1 + field public static final short attributeNullableUnknown = 2; // 0x2 + field public static final int bestRowNotPseudo = 1; // 0x1 + field public static final int bestRowPseudo = 2; // 0x2 + field public static final int bestRowSession = 2; // 0x2 + field public static final int bestRowTemporary = 0; // 0x0 + field public static final int bestRowTransaction = 1; // 0x1 + field public static final int bestRowUnknown = 0; // 0x0 + field public static final int columnNoNulls = 0; // 0x0 + field public static final int columnNullable = 1; // 0x1 + field public static final int columnNullableUnknown = 2; // 0x2 + field public static final int functionColumnIn = 1; // 0x1 + field public static final int functionColumnInOut = 2; // 0x2 + field public static final int functionColumnOut = 3; // 0x3 + field public static final int functionColumnResult = 5; // 0x5 + field public static final int functionColumnUnknown = 0; // 0x0 + field public static final int functionNoNulls = 0; // 0x0 + field public static final int functionNoTable = 1; // 0x1 + field public static final int functionNullable = 1; // 0x1 + field public static final int functionNullableUnknown = 2; // 0x2 + field public static final int functionResultUnknown = 0; // 0x0 + field public static final int functionReturn = 4; // 0x4 + field public static final int functionReturnsTable = 2; // 0x2 + field public static final int importedKeyCascade = 0; // 0x0 + field public static final int importedKeyInitiallyDeferred = 5; // 0x5 + field public static final int importedKeyInitiallyImmediate = 6; // 0x6 + field public static final int importedKeyNoAction = 3; // 0x3 + field public static final int importedKeyNotDeferrable = 7; // 0x7 + field public static final int importedKeyRestrict = 1; // 0x1 + field public static final int importedKeySetDefault = 4; // 0x4 + field public static final int importedKeySetNull = 2; // 0x2 + field public static final int procedureColumnIn = 1; // 0x1 + field public static final int procedureColumnInOut = 2; // 0x2 + field public static final int procedureColumnOut = 4; // 0x4 + field public static final int procedureColumnResult = 3; // 0x3 + field public static final int procedureColumnReturn = 5; // 0x5 + field public static final int procedureColumnUnknown = 0; // 0x0 + field public static final int procedureNoNulls = 0; // 0x0 + field public static final int procedureNoResult = 1; // 0x1 + field public static final int procedureNullable = 1; // 0x1 + field public static final int procedureNullableUnknown = 2; // 0x2 + field public static final int procedureResultUnknown = 0; // 0x0 + field public static final int procedureReturnsResult = 2; // 0x2 + field public static final int sqlStateSQL = 2; // 0x2 + field public static final int sqlStateSQL99 = 2; // 0x2 + field public static final int sqlStateXOpen = 1; // 0x1 + field public static final short tableIndexClustered = 1; // 0x1 + field public static final short tableIndexHashed = 2; // 0x2 + field public static final short tableIndexOther = 3; // 0x3 + field public static final short tableIndexStatistic = 0; // 0x0 + field public static final int typeNoNulls = 0; // 0x0 + field public static final int typeNullable = 1; // 0x1 + field public static final int typeNullableUnknown = 2; // 0x2 + field public static final int typePredBasic = 2; // 0x2 + field public static final int typePredChar = 1; // 0x1 + field public static final int typePredNone = 0; // 0x0 + field public static final int typeSearchable = 3; // 0x3 + field public static final int versionColumnNotPseudo = 1; // 0x1 + field public static final int versionColumnPseudo = 2; // 0x2 + field public static final int versionColumnUnknown = 0; // 0x0 + } + + public class Date extends java.util.Date { + ctor public deprecated Date(int, int, int); + ctor public Date(long); + method public static java.sql.Date valueOf(java.lang.String); + } + + public abstract interface Driver { + method public abstract boolean acceptsURL(java.lang.String) throws java.sql.SQLException; + method public abstract java.sql.Connection connect(java.lang.String, java.util.Properties) throws java.sql.SQLException; + method public abstract int getMajorVersion(); + method public abstract int getMinorVersion(); + method public abstract java.sql.DriverPropertyInfo[] getPropertyInfo(java.lang.String, java.util.Properties) throws java.sql.SQLException; + method public abstract boolean jdbcCompliant(); + } + + public class DriverManager { + method public static void deregisterDriver(java.sql.Driver) throws java.sql.SQLException; + method public static java.sql.Connection getConnection(java.lang.String) throws java.sql.SQLException; + method public static java.sql.Connection getConnection(java.lang.String, java.util.Properties) throws java.sql.SQLException; + method public static java.sql.Connection getConnection(java.lang.String, java.lang.String, java.lang.String) throws java.sql.SQLException; + method public static java.sql.Driver getDriver(java.lang.String) throws java.sql.SQLException; + method public static java.util.Enumeration getDrivers(); + method public static deprecated java.io.PrintStream getLogStream(); + method public static java.io.PrintWriter getLogWriter(); + method public static int getLoginTimeout(); + method public static void println(java.lang.String); + method public static void registerDriver(java.sql.Driver) throws java.sql.SQLException; + method public static deprecated void setLogStream(java.io.PrintStream); + method public static void setLogWriter(java.io.PrintWriter); + method public static void setLoginTimeout(int); + } + + public class DriverPropertyInfo { + ctor public DriverPropertyInfo(java.lang.String, java.lang.String); + field public java.lang.String[] choices; + field public java.lang.String description; + field public java.lang.String name; + field public boolean required; + field public java.lang.String value; + } + + public abstract interface NClob implements java.sql.Clob { + } + + public abstract interface ParameterMetaData implements java.sql.Wrapper { + method public abstract java.lang.String getParameterClassName(int) throws java.sql.SQLException; + method public abstract int getParameterCount() throws java.sql.SQLException; + method public abstract int getParameterMode(int) throws java.sql.SQLException; + method public abstract int getParameterType(int) throws java.sql.SQLException; + method public abstract java.lang.String getParameterTypeName(int) throws java.sql.SQLException; + method public abstract int getPrecision(int) throws java.sql.SQLException; + method public abstract int getScale(int) throws java.sql.SQLException; + method public abstract int isNullable(int) throws java.sql.SQLException; + method public abstract boolean isSigned(int) throws java.sql.SQLException; + field public static final int parameterModeIn = 1; // 0x1 + field public static final int parameterModeInOut = 2; // 0x2 + field public static final int parameterModeOut = 4; // 0x4 + field public static final int parameterModeUnknown = 0; // 0x0 + field public static final int parameterNoNulls = 0; // 0x0 + field public static final int parameterNullable = 1; // 0x1 + field public static final int parameterNullableUnknown = 2; // 0x2 + } + + public abstract interface PreparedStatement implements java.sql.Statement { + method public abstract void addBatch() throws java.sql.SQLException; + method public abstract void clearParameters() throws java.sql.SQLException; + method public abstract boolean execute() throws java.sql.SQLException; + method public abstract java.sql.ResultSet executeQuery() throws java.sql.SQLException; + method public abstract int executeUpdate() throws java.sql.SQLException; + method public abstract java.sql.ResultSetMetaData getMetaData() throws java.sql.SQLException; + method public abstract java.sql.ParameterMetaData getParameterMetaData() throws java.sql.SQLException; + method public abstract void setArray(int, java.sql.Array) throws java.sql.SQLException; + method public abstract void setAsciiStream(int, java.io.InputStream, int) throws java.sql.SQLException; + method public abstract void setAsciiStream(int, java.io.InputStream, long) throws java.sql.SQLException; + method public abstract void setAsciiStream(int, java.io.InputStream) throws java.sql.SQLException; + method public abstract void setBigDecimal(int, java.math.BigDecimal) throws java.sql.SQLException; + method public abstract void setBinaryStream(int, java.io.InputStream, int) throws java.sql.SQLException; + method public abstract void setBinaryStream(int, java.io.InputStream, long) throws java.sql.SQLException; + method public abstract void setBinaryStream(int, java.io.InputStream) throws java.sql.SQLException; + method public abstract void setBlob(int, java.sql.Blob) throws java.sql.SQLException; + method public abstract void setBlob(int, java.io.InputStream, long) throws java.sql.SQLException; + method public abstract void setBlob(int, java.io.InputStream) throws java.sql.SQLException; + method public abstract void setBoolean(int, boolean) throws java.sql.SQLException; + method public abstract void setByte(int, byte) throws java.sql.SQLException; + method public abstract void setBytes(int, byte[]) throws java.sql.SQLException; + method public abstract void setCharacterStream(int, java.io.Reader, int) throws java.sql.SQLException; + method public abstract void setCharacterStream(int, java.io.Reader, long) throws java.sql.SQLException; + method public abstract void setCharacterStream(int, java.io.Reader) throws java.sql.SQLException; + method public abstract void setClob(int, java.sql.Clob) throws java.sql.SQLException; + method public abstract void setClob(int, java.io.Reader, long) throws java.sql.SQLException; + method public abstract void setClob(int, java.io.Reader) throws java.sql.SQLException; + method public abstract void setDate(int, java.sql.Date) throws java.sql.SQLException; + method public abstract void setDate(int, java.sql.Date, java.util.Calendar) throws java.sql.SQLException; + method public abstract void setDouble(int, double) throws java.sql.SQLException; + method public abstract void setFloat(int, float) throws java.sql.SQLException; + method public abstract void setInt(int, int) throws java.sql.SQLException; + method public abstract void setLong(int, long) throws java.sql.SQLException; + method public abstract void setNCharacterStream(int, java.io.Reader, long) throws java.sql.SQLException; + method public abstract void setNCharacterStream(int, java.io.Reader) throws java.sql.SQLException; + method public abstract void setNClob(int, java.sql.NClob) throws java.sql.SQLException; + method public abstract void setNClob(int, java.io.Reader, long) throws java.sql.SQLException; + method public abstract void setNClob(int, java.io.Reader) throws java.sql.SQLException; + method public abstract void setNString(int, java.lang.String) throws java.sql.SQLException; + method public abstract void setNull(int, int) throws java.sql.SQLException; + method public abstract void setNull(int, int, java.lang.String) throws java.sql.SQLException; + method public abstract void setObject(int, java.lang.Object) throws java.sql.SQLException; + method public abstract void setObject(int, java.lang.Object, int) throws java.sql.SQLException; + method public abstract void setObject(int, java.lang.Object, int, int) throws java.sql.SQLException; + method public abstract void setRef(int, java.sql.Ref) throws java.sql.SQLException; + method public abstract void setRowId(int, java.sql.RowId) throws java.sql.SQLException; + method public abstract void setSQLXML(int, java.sql.SQLXML) throws java.sql.SQLException; + method public abstract void setShort(int, short) throws java.sql.SQLException; + method public abstract void setString(int, java.lang.String) throws java.sql.SQLException; + method public abstract void setTime(int, java.sql.Time) throws java.sql.SQLException; + method public abstract void setTime(int, java.sql.Time, java.util.Calendar) throws java.sql.SQLException; + method public abstract void setTimestamp(int, java.sql.Timestamp) throws java.sql.SQLException; + method public abstract void setTimestamp(int, java.sql.Timestamp, java.util.Calendar) throws java.sql.SQLException; + method public abstract void setURL(int, java.net.URL) throws java.sql.SQLException; + method public abstract deprecated void setUnicodeStream(int, java.io.InputStream, int) throws java.sql.SQLException; + } + + public abstract interface Ref { + method public abstract java.lang.String getBaseTypeName() throws java.sql.SQLException; + method public abstract java.lang.Object getObject() throws java.sql.SQLException; + method public abstract java.lang.Object getObject(java.util.Map>) throws java.sql.SQLException; + method public abstract void setObject(java.lang.Object) throws java.sql.SQLException; + } + + public abstract interface ResultSet implements java.sql.Wrapper { + method public abstract boolean absolute(int) throws java.sql.SQLException; + method public abstract void afterLast() throws java.sql.SQLException; + method public abstract void beforeFirst() throws java.sql.SQLException; + method public abstract void cancelRowUpdates() throws java.sql.SQLException; + method public abstract void clearWarnings() throws java.sql.SQLException; + method public abstract void close() throws java.sql.SQLException; + method public abstract void deleteRow() throws java.sql.SQLException; + method public abstract int findColumn(java.lang.String) throws java.sql.SQLException; + method public abstract boolean first() throws java.sql.SQLException; + method public abstract java.sql.Array getArray(int) throws java.sql.SQLException; + method public abstract java.sql.Array getArray(java.lang.String) throws java.sql.SQLException; + method public abstract java.io.InputStream getAsciiStream(int) throws java.sql.SQLException; + method public abstract java.io.InputStream getAsciiStream(java.lang.String) throws java.sql.SQLException; + method public abstract java.math.BigDecimal getBigDecimal(int) throws java.sql.SQLException; + method public abstract deprecated java.math.BigDecimal getBigDecimal(int, int) throws java.sql.SQLException; + method public abstract java.math.BigDecimal getBigDecimal(java.lang.String) throws java.sql.SQLException; + method public abstract deprecated java.math.BigDecimal getBigDecimal(java.lang.String, int) throws java.sql.SQLException; + method public abstract java.io.InputStream getBinaryStream(int) throws java.sql.SQLException; + method public abstract java.io.InputStream getBinaryStream(java.lang.String) throws java.sql.SQLException; + method public abstract java.sql.Blob getBlob(int) throws java.sql.SQLException; + method public abstract java.sql.Blob getBlob(java.lang.String) throws java.sql.SQLException; + method public abstract boolean getBoolean(int) throws java.sql.SQLException; + method public abstract boolean getBoolean(java.lang.String) throws java.sql.SQLException; + method public abstract byte getByte(int) throws java.sql.SQLException; + method public abstract byte getByte(java.lang.String) throws java.sql.SQLException; + method public abstract byte[] getBytes(int) throws java.sql.SQLException; + method public abstract byte[] getBytes(java.lang.String) throws java.sql.SQLException; + method public abstract java.io.Reader getCharacterStream(int) throws java.sql.SQLException; + method public abstract java.io.Reader getCharacterStream(java.lang.String) throws java.sql.SQLException; + method public abstract java.sql.Clob getClob(int) throws java.sql.SQLException; + method public abstract java.sql.Clob getClob(java.lang.String) throws java.sql.SQLException; + method public abstract int getConcurrency() throws java.sql.SQLException; + method public abstract java.lang.String getCursorName() throws java.sql.SQLException; + method public abstract java.sql.Date getDate(int) throws java.sql.SQLException; + method public abstract java.sql.Date getDate(int, java.util.Calendar) throws java.sql.SQLException; + method public abstract java.sql.Date getDate(java.lang.String) throws java.sql.SQLException; + method public abstract java.sql.Date getDate(java.lang.String, java.util.Calendar) throws java.sql.SQLException; + method public abstract double getDouble(int) throws java.sql.SQLException; + method public abstract double getDouble(java.lang.String) throws java.sql.SQLException; + method public abstract int getFetchDirection() throws java.sql.SQLException; + method public abstract int getFetchSize() throws java.sql.SQLException; + method public abstract float getFloat(int) throws java.sql.SQLException; + method public abstract float getFloat(java.lang.String) throws java.sql.SQLException; + method public abstract int getHoldability() throws java.sql.SQLException; + method public abstract int getInt(int) throws java.sql.SQLException; + method public abstract int getInt(java.lang.String) throws java.sql.SQLException; + method public abstract long getLong(int) throws java.sql.SQLException; + method public abstract long getLong(java.lang.String) throws java.sql.SQLException; + method public abstract java.sql.ResultSetMetaData getMetaData() throws java.sql.SQLException; + method public abstract java.io.Reader getNCharacterStream(int) throws java.sql.SQLException; + method public abstract java.io.Reader getNCharacterStream(java.lang.String) throws java.sql.SQLException; + method public abstract java.sql.NClob getNClob(int) throws java.sql.SQLException; + method public abstract java.sql.NClob getNClob(java.lang.String) throws java.sql.SQLException; + method public abstract java.lang.String getNString(int) throws java.sql.SQLException; + method public abstract java.lang.String getNString(java.lang.String) throws java.sql.SQLException; + method public abstract java.lang.Object getObject(int) throws java.sql.SQLException; + method public abstract java.lang.Object getObject(int, java.util.Map>) throws java.sql.SQLException; + method public abstract java.lang.Object getObject(java.lang.String) throws java.sql.SQLException; + method public abstract java.lang.Object getObject(java.lang.String, java.util.Map>) throws java.sql.SQLException; + method public abstract java.sql.Ref getRef(int) throws java.sql.SQLException; + method public abstract java.sql.Ref getRef(java.lang.String) throws java.sql.SQLException; + method public abstract int getRow() throws java.sql.SQLException; + method public abstract java.sql.RowId getRowId(int) throws java.sql.SQLException; + method public abstract java.sql.RowId getRowId(java.lang.String) throws java.sql.SQLException; + method public abstract java.sql.SQLXML getSQLXML(int) throws java.sql.SQLException; + method public abstract java.sql.SQLXML getSQLXML(java.lang.String) throws java.sql.SQLException; + method public abstract short getShort(int) throws java.sql.SQLException; + method public abstract short getShort(java.lang.String) throws java.sql.SQLException; + method public abstract java.sql.Statement getStatement() throws java.sql.SQLException; + method public abstract java.lang.String getString(int) throws java.sql.SQLException; + method public abstract java.lang.String getString(java.lang.String) throws java.sql.SQLException; + method public abstract java.sql.Time getTime(int) throws java.sql.SQLException; + method public abstract java.sql.Time getTime(int, java.util.Calendar) throws java.sql.SQLException; + method public abstract java.sql.Time getTime(java.lang.String) throws java.sql.SQLException; + method public abstract java.sql.Time getTime(java.lang.String, java.util.Calendar) throws java.sql.SQLException; + method public abstract java.sql.Timestamp getTimestamp(int) throws java.sql.SQLException; + method public abstract java.sql.Timestamp getTimestamp(int, java.util.Calendar) throws java.sql.SQLException; + method public abstract java.sql.Timestamp getTimestamp(java.lang.String) throws java.sql.SQLException; + method public abstract java.sql.Timestamp getTimestamp(java.lang.String, java.util.Calendar) throws java.sql.SQLException; + method public abstract int getType() throws java.sql.SQLException; + method public abstract java.net.URL getURL(int) throws java.sql.SQLException; + method public abstract java.net.URL getURL(java.lang.String) throws java.sql.SQLException; + method public abstract deprecated java.io.InputStream getUnicodeStream(int) throws java.sql.SQLException; + method public abstract deprecated java.io.InputStream getUnicodeStream(java.lang.String) throws java.sql.SQLException; + method public abstract java.sql.SQLWarning getWarnings() throws java.sql.SQLException; + method public abstract void insertRow() throws java.sql.SQLException; + method public abstract boolean isAfterLast() throws java.sql.SQLException; + method public abstract boolean isBeforeFirst() throws java.sql.SQLException; + method public abstract boolean isClosed() throws java.sql.SQLException; + method public abstract boolean isFirst() throws java.sql.SQLException; + method public abstract boolean isLast() throws java.sql.SQLException; + method public abstract boolean last() throws java.sql.SQLException; + method public abstract void moveToCurrentRow() throws java.sql.SQLException; + method public abstract void moveToInsertRow() throws java.sql.SQLException; + method public abstract boolean next() throws java.sql.SQLException; + method public abstract boolean previous() throws java.sql.SQLException; + method public abstract void refreshRow() throws java.sql.SQLException; + method public abstract boolean relative(int) throws java.sql.SQLException; + method public abstract boolean rowDeleted() throws java.sql.SQLException; + method public abstract boolean rowInserted() throws java.sql.SQLException; + method public abstract boolean rowUpdated() throws java.sql.SQLException; + method public abstract void setFetchDirection(int) throws java.sql.SQLException; + method public abstract void setFetchSize(int) throws java.sql.SQLException; + method public abstract void updateArray(int, java.sql.Array) throws java.sql.SQLException; + method public abstract void updateArray(java.lang.String, java.sql.Array) throws java.sql.SQLException; + method public abstract void updateAsciiStream(int, java.io.InputStream, int) throws java.sql.SQLException; + method public abstract void updateAsciiStream(java.lang.String, java.io.InputStream, int) throws java.sql.SQLException; + method public abstract void updateAsciiStream(int, java.io.InputStream, long) throws java.sql.SQLException; + method public abstract void updateAsciiStream(java.lang.String, java.io.InputStream, long) throws java.sql.SQLException; + method public abstract void updateAsciiStream(int, java.io.InputStream) throws java.sql.SQLException; + method public abstract void updateAsciiStream(java.lang.String, java.io.InputStream) throws java.sql.SQLException; + method public abstract void updateBigDecimal(int, java.math.BigDecimal) throws java.sql.SQLException; + method public abstract void updateBigDecimal(java.lang.String, java.math.BigDecimal) throws java.sql.SQLException; + method public abstract void updateBinaryStream(int, java.io.InputStream, int) throws java.sql.SQLException; + method public abstract void updateBinaryStream(java.lang.String, java.io.InputStream, int) throws java.sql.SQLException; + method public abstract void updateBinaryStream(int, java.io.InputStream, long) throws java.sql.SQLException; + method public abstract void updateBinaryStream(java.lang.String, java.io.InputStream, long) throws java.sql.SQLException; + method public abstract void updateBinaryStream(int, java.io.InputStream) throws java.sql.SQLException; + method public abstract void updateBinaryStream(java.lang.String, java.io.InputStream) throws java.sql.SQLException; + method public abstract void updateBlob(int, java.sql.Blob) throws java.sql.SQLException; + method public abstract void updateBlob(java.lang.String, java.sql.Blob) throws java.sql.SQLException; + method public abstract void updateBlob(int, java.io.InputStream, long) throws java.sql.SQLException; + method public abstract void updateBlob(java.lang.String, java.io.InputStream, long) throws java.sql.SQLException; + method public abstract void updateBlob(int, java.io.InputStream) throws java.sql.SQLException; + method public abstract void updateBlob(java.lang.String, java.io.InputStream) throws java.sql.SQLException; + method public abstract void updateBoolean(int, boolean) throws java.sql.SQLException; + method public abstract void updateBoolean(java.lang.String, boolean) throws java.sql.SQLException; + method public abstract void updateByte(int, byte) throws java.sql.SQLException; + method public abstract void updateByte(java.lang.String, byte) throws java.sql.SQLException; + method public abstract void updateBytes(int, byte[]) throws java.sql.SQLException; + method public abstract void updateBytes(java.lang.String, byte[]) throws java.sql.SQLException; + method public abstract void updateCharacterStream(int, java.io.Reader, int) throws java.sql.SQLException; + method public abstract void updateCharacterStream(java.lang.String, java.io.Reader, int) throws java.sql.SQLException; + method public abstract void updateCharacterStream(int, java.io.Reader, long) throws java.sql.SQLException; + method public abstract void updateCharacterStream(java.lang.String, java.io.Reader, long) throws java.sql.SQLException; + method public abstract void updateCharacterStream(int, java.io.Reader) throws java.sql.SQLException; + method public abstract void updateCharacterStream(java.lang.String, java.io.Reader) throws java.sql.SQLException; + method public abstract void updateClob(int, java.sql.Clob) throws java.sql.SQLException; + method public abstract void updateClob(java.lang.String, java.sql.Clob) throws java.sql.SQLException; + method public abstract void updateClob(int, java.io.Reader, long) throws java.sql.SQLException; + method public abstract void updateClob(java.lang.String, java.io.Reader, long) throws java.sql.SQLException; + method public abstract void updateClob(int, java.io.Reader) throws java.sql.SQLException; + method public abstract void updateClob(java.lang.String, java.io.Reader) throws java.sql.SQLException; + method public abstract void updateDate(int, java.sql.Date) throws java.sql.SQLException; + method public abstract void updateDate(java.lang.String, java.sql.Date) throws java.sql.SQLException; + method public abstract void updateDouble(int, double) throws java.sql.SQLException; + method public abstract void updateDouble(java.lang.String, double) throws java.sql.SQLException; + method public abstract void updateFloat(int, float) throws java.sql.SQLException; + method public abstract void updateFloat(java.lang.String, float) throws java.sql.SQLException; + method public abstract void updateInt(int, int) throws java.sql.SQLException; + method public abstract void updateInt(java.lang.String, int) throws java.sql.SQLException; + method public abstract void updateLong(int, long) throws java.sql.SQLException; + method public abstract void updateLong(java.lang.String, long) throws java.sql.SQLException; + method public abstract void updateNCharacterStream(int, java.io.Reader, long) throws java.sql.SQLException; + method public abstract void updateNCharacterStream(java.lang.String, java.io.Reader, long) throws java.sql.SQLException; + method public abstract void updateNCharacterStream(int, java.io.Reader) throws java.sql.SQLException; + method public abstract void updateNCharacterStream(java.lang.String, java.io.Reader) throws java.sql.SQLException; + method public abstract void updateNClob(int, java.sql.NClob) throws java.sql.SQLException; + method public abstract void updateNClob(java.lang.String, java.sql.NClob) throws java.sql.SQLException; + method public abstract void updateNClob(int, java.io.Reader, long) throws java.sql.SQLException; + method public abstract void updateNClob(java.lang.String, java.io.Reader, long) throws java.sql.SQLException; + method public abstract void updateNClob(int, java.io.Reader) throws java.sql.SQLException; + method public abstract void updateNClob(java.lang.String, java.io.Reader) throws java.sql.SQLException; + method public abstract void updateNString(int, java.lang.String) throws java.sql.SQLException; + method public abstract void updateNString(java.lang.String, java.lang.String) throws java.sql.SQLException; + method public abstract void updateNull(int) throws java.sql.SQLException; + method public abstract void updateNull(java.lang.String) throws java.sql.SQLException; + method public abstract void updateObject(int, java.lang.Object) throws java.sql.SQLException; + method public abstract void updateObject(int, java.lang.Object, int) throws java.sql.SQLException; + method public abstract void updateObject(java.lang.String, java.lang.Object) throws java.sql.SQLException; + method public abstract void updateObject(java.lang.String, java.lang.Object, int) throws java.sql.SQLException; + method public abstract void updateRef(int, java.sql.Ref) throws java.sql.SQLException; + method public abstract void updateRef(java.lang.String, java.sql.Ref) throws java.sql.SQLException; + method public abstract void updateRow() throws java.sql.SQLException; + method public abstract void updateRowId(int, java.sql.RowId) throws java.sql.SQLException; + method public abstract void updateRowId(java.lang.String, java.sql.RowId) throws java.sql.SQLException; + method public abstract void updateSQLXML(int, java.sql.SQLXML) throws java.sql.SQLException; + method public abstract void updateSQLXML(java.lang.String, java.sql.SQLXML) throws java.sql.SQLException; + method public abstract void updateShort(int, short) throws java.sql.SQLException; + method public abstract void updateShort(java.lang.String, short) throws java.sql.SQLException; + method public abstract void updateString(int, java.lang.String) throws java.sql.SQLException; + method public abstract void updateString(java.lang.String, java.lang.String) throws java.sql.SQLException; + method public abstract void updateTime(int, java.sql.Time) throws java.sql.SQLException; + method public abstract void updateTime(java.lang.String, java.sql.Time) throws java.sql.SQLException; + method public abstract void updateTimestamp(int, java.sql.Timestamp) throws java.sql.SQLException; + method public abstract void updateTimestamp(java.lang.String, java.sql.Timestamp) throws java.sql.SQLException; + method public abstract boolean wasNull() throws java.sql.SQLException; + field public static final int CLOSE_CURSORS_AT_COMMIT = 2; // 0x2 + field public static final int CONCUR_READ_ONLY = 1007; // 0x3ef + field public static final int CONCUR_UPDATABLE = 1008; // 0x3f0 + field public static final int FETCH_FORWARD = 1000; // 0x3e8 + field public static final int FETCH_REVERSE = 1001; // 0x3e9 + field public static final int FETCH_UNKNOWN = 1002; // 0x3ea + field public static final int HOLD_CURSORS_OVER_COMMIT = 1; // 0x1 + field public static final int TYPE_FORWARD_ONLY = 1003; // 0x3eb + field public static final int TYPE_SCROLL_INSENSITIVE = 1004; // 0x3ec + field public static final int TYPE_SCROLL_SENSITIVE = 1005; // 0x3ed + } + + public abstract interface ResultSetMetaData implements java.sql.Wrapper { + method public abstract java.lang.String getCatalogName(int) throws java.sql.SQLException; + method public abstract java.lang.String getColumnClassName(int) throws java.sql.SQLException; + method public abstract int getColumnCount() throws java.sql.SQLException; + method public abstract int getColumnDisplaySize(int) throws java.sql.SQLException; + method public abstract java.lang.String getColumnLabel(int) throws java.sql.SQLException; + method public abstract java.lang.String getColumnName(int) throws java.sql.SQLException; + method public abstract int getColumnType(int) throws java.sql.SQLException; + method public abstract java.lang.String getColumnTypeName(int) throws java.sql.SQLException; + method public abstract int getPrecision(int) throws java.sql.SQLException; + method public abstract int getScale(int) throws java.sql.SQLException; + method public abstract java.lang.String getSchemaName(int) throws java.sql.SQLException; + method public abstract java.lang.String getTableName(int) throws java.sql.SQLException; + method public abstract boolean isAutoIncrement(int) throws java.sql.SQLException; + method public abstract boolean isCaseSensitive(int) throws java.sql.SQLException; + method public abstract boolean isCurrency(int) throws java.sql.SQLException; + method public abstract boolean isDefinitelyWritable(int) throws java.sql.SQLException; + method public abstract int isNullable(int) throws java.sql.SQLException; + method public abstract boolean isReadOnly(int) throws java.sql.SQLException; + method public abstract boolean isSearchable(int) throws java.sql.SQLException; + method public abstract boolean isSigned(int) throws java.sql.SQLException; + method public abstract boolean isWritable(int) throws java.sql.SQLException; + field public static final int columnNoNulls = 0; // 0x0 + field public static final int columnNullable = 1; // 0x1 + field public static final int columnNullableUnknown = 2; // 0x2 + } + + public abstract interface RowId { + method public abstract boolean equals(java.lang.Object); + method public abstract byte[] getBytes(); + method public abstract int hashCode(); + method public abstract java.lang.String toString(); + } + + public final class RowIdLifetime extends java.lang.Enum { + method public static java.sql.RowIdLifetime valueOf(java.lang.String); + method public static final java.sql.RowIdLifetime[] values(); + enum_constant public static final java.sql.RowIdLifetime ROWID_UNSUPPORTED; + enum_constant public static final java.sql.RowIdLifetime ROWID_VALID_FOREVER; + enum_constant public static final java.sql.RowIdLifetime ROWID_VALID_OTHER; + enum_constant public static final java.sql.RowIdLifetime ROWID_VALID_SESSION; + enum_constant public static final java.sql.RowIdLifetime ROWID_VALID_TRANSACTION; + } + + public class SQLClientInfoException extends java.sql.SQLException { + ctor public SQLClientInfoException(); + ctor public SQLClientInfoException(java.util.Map); + ctor public SQLClientInfoException(java.util.Map, java.lang.Throwable); + ctor public SQLClientInfoException(java.lang.String, java.util.Map); + ctor public SQLClientInfoException(java.lang.String, java.util.Map, java.lang.Throwable); + ctor public SQLClientInfoException(java.lang.String, java.lang.String, int, java.util.Map); + ctor public SQLClientInfoException(java.lang.String, java.lang.String, int, java.util.Map, java.lang.Throwable); + ctor public SQLClientInfoException(java.lang.String, java.lang.String, java.util.Map); + ctor public SQLClientInfoException(java.lang.String, java.lang.String, java.util.Map, java.lang.Throwable); + method public java.util.Map getFailedProperties(); + } + + public abstract interface SQLData { + method public abstract java.lang.String getSQLTypeName() throws java.sql.SQLException; + method public abstract void readSQL(java.sql.SQLInput, java.lang.String) throws java.sql.SQLException; + method public abstract void writeSQL(java.sql.SQLOutput) throws java.sql.SQLException; + } + + public class SQLDataException extends java.sql.SQLNonTransientException { + ctor public SQLDataException(); + ctor public SQLDataException(java.lang.String); + ctor public SQLDataException(java.lang.String, java.lang.String); + ctor public SQLDataException(java.lang.String, java.lang.String, int); + ctor public SQLDataException(java.lang.Throwable); + ctor public SQLDataException(java.lang.String, java.lang.Throwable); + ctor public SQLDataException(java.lang.String, java.lang.String, java.lang.Throwable); + ctor public SQLDataException(java.lang.String, java.lang.String, int, java.lang.Throwable); + } + + public class SQLException extends java.lang.Exception implements java.lang.Iterable java.io.Serializable { + ctor public SQLException(); + ctor public SQLException(java.lang.String); + ctor public SQLException(java.lang.String, java.lang.String); + ctor public SQLException(java.lang.String, java.lang.String, int); + ctor public SQLException(java.lang.Throwable); + ctor public SQLException(java.lang.String, java.lang.Throwable); + ctor public SQLException(java.lang.String, java.lang.String, java.lang.Throwable); + ctor public SQLException(java.lang.String, java.lang.String, int, java.lang.Throwable); + method public int getErrorCode(); + method public java.sql.SQLException getNextException(); + method public java.lang.String getSQLState(); + method public java.util.Iterator iterator(); + method public void setNextException(java.sql.SQLException); + } + + public class SQLFeatureNotSupportedException extends java.sql.SQLNonTransientException { + ctor public SQLFeatureNotSupportedException(); + ctor public SQLFeatureNotSupportedException(java.lang.String); + ctor public SQLFeatureNotSupportedException(java.lang.String, java.lang.String); + ctor public SQLFeatureNotSupportedException(java.lang.String, java.lang.String, int); + ctor public SQLFeatureNotSupportedException(java.lang.Throwable); + ctor public SQLFeatureNotSupportedException(java.lang.String, java.lang.Throwable); + ctor public SQLFeatureNotSupportedException(java.lang.String, java.lang.String, java.lang.Throwable); + ctor public SQLFeatureNotSupportedException(java.lang.String, java.lang.String, int, java.lang.Throwable); + } + + public abstract interface SQLInput { + method public abstract java.sql.Array readArray() throws java.sql.SQLException; + method public abstract java.io.InputStream readAsciiStream() throws java.sql.SQLException; + method public abstract java.math.BigDecimal readBigDecimal() throws java.sql.SQLException; + method public abstract java.io.InputStream readBinaryStream() throws java.sql.SQLException; + method public abstract java.sql.Blob readBlob() throws java.sql.SQLException; + method public abstract boolean readBoolean() throws java.sql.SQLException; + method public abstract byte readByte() throws java.sql.SQLException; + method public abstract byte[] readBytes() throws java.sql.SQLException; + method public abstract java.io.Reader readCharacterStream() throws java.sql.SQLException; + method public abstract java.sql.Clob readClob() throws java.sql.SQLException; + method public abstract java.sql.Date readDate() throws java.sql.SQLException; + method public abstract double readDouble() throws java.sql.SQLException; + method public abstract float readFloat() throws java.sql.SQLException; + method public abstract int readInt() throws java.sql.SQLException; + method public abstract long readLong() throws java.sql.SQLException; + method public abstract java.sql.NClob readNClob() throws java.sql.SQLException; + method public abstract java.lang.String readNString() throws java.sql.SQLException; + method public abstract java.lang.Object readObject() throws java.sql.SQLException; + method public abstract java.sql.Ref readRef() throws java.sql.SQLException; + method public abstract java.sql.RowId readRowId() throws java.sql.SQLException; + method public abstract java.sql.SQLXML readSQLXML() throws java.sql.SQLException; + method public abstract short readShort() throws java.sql.SQLException; + method public abstract java.lang.String readString() throws java.sql.SQLException; + method public abstract java.sql.Time readTime() throws java.sql.SQLException; + method public abstract java.sql.Timestamp readTimestamp() throws java.sql.SQLException; + method public abstract java.net.URL readURL() throws java.sql.SQLException; + method public abstract boolean wasNull() throws java.sql.SQLException; + } + + public class SQLIntegrityConstraintViolationException extends java.sql.SQLNonTransientException { + ctor public SQLIntegrityConstraintViolationException(); + ctor public SQLIntegrityConstraintViolationException(java.lang.String); + ctor public SQLIntegrityConstraintViolationException(java.lang.String, java.lang.String); + ctor public SQLIntegrityConstraintViolationException(java.lang.String, java.lang.String, int); + ctor public SQLIntegrityConstraintViolationException(java.lang.Throwable); + ctor public SQLIntegrityConstraintViolationException(java.lang.String, java.lang.Throwable); + ctor public SQLIntegrityConstraintViolationException(java.lang.String, java.lang.String, java.lang.Throwable); + ctor public SQLIntegrityConstraintViolationException(java.lang.String, java.lang.String, int, java.lang.Throwable); + } + + public class SQLInvalidAuthorizationSpecException extends java.sql.SQLNonTransientException { + ctor public SQLInvalidAuthorizationSpecException(); + ctor public SQLInvalidAuthorizationSpecException(java.lang.String); + ctor public SQLInvalidAuthorizationSpecException(java.lang.String, java.lang.String); + ctor public SQLInvalidAuthorizationSpecException(java.lang.String, java.lang.String, int); + ctor public SQLInvalidAuthorizationSpecException(java.lang.Throwable); + ctor public SQLInvalidAuthorizationSpecException(java.lang.String, java.lang.Throwable); + ctor public SQLInvalidAuthorizationSpecException(java.lang.String, java.lang.String, java.lang.Throwable); + ctor public SQLInvalidAuthorizationSpecException(java.lang.String, java.lang.String, int, java.lang.Throwable); + } + + public class SQLNonTransientConnectionException extends java.sql.SQLNonTransientException { + ctor public SQLNonTransientConnectionException(); + ctor public SQLNonTransientConnectionException(java.lang.String); + ctor public SQLNonTransientConnectionException(java.lang.String, java.lang.String); + ctor public SQLNonTransientConnectionException(java.lang.String, java.lang.String, int); + ctor public SQLNonTransientConnectionException(java.lang.Throwable); + ctor public SQLNonTransientConnectionException(java.lang.String, java.lang.Throwable); + ctor public SQLNonTransientConnectionException(java.lang.String, java.lang.String, java.lang.Throwable); + ctor public SQLNonTransientConnectionException(java.lang.String, java.lang.String, int, java.lang.Throwable); + } + + public class SQLNonTransientException extends java.sql.SQLException { + ctor public SQLNonTransientException(); + ctor public SQLNonTransientException(java.lang.String); + ctor public SQLNonTransientException(java.lang.String, java.lang.String); + ctor public SQLNonTransientException(java.lang.String, java.lang.String, int); + ctor public SQLNonTransientException(java.lang.Throwable); + ctor public SQLNonTransientException(java.lang.String, java.lang.Throwable); + ctor public SQLNonTransientException(java.lang.String, java.lang.String, java.lang.Throwable); + ctor public SQLNonTransientException(java.lang.String, java.lang.String, int, java.lang.Throwable); + } + + public abstract interface SQLOutput { + method public abstract void writeArray(java.sql.Array) throws java.sql.SQLException; + method public abstract void writeAsciiStream(java.io.InputStream) throws java.sql.SQLException; + method public abstract void writeBigDecimal(java.math.BigDecimal) throws java.sql.SQLException; + method public abstract void writeBinaryStream(java.io.InputStream) throws java.sql.SQLException; + method public abstract void writeBlob(java.sql.Blob) throws java.sql.SQLException; + method public abstract void writeBoolean(boolean) throws java.sql.SQLException; + method public abstract void writeByte(byte) throws java.sql.SQLException; + method public abstract void writeBytes(byte[]) throws java.sql.SQLException; + method public abstract void writeCharacterStream(java.io.Reader) throws java.sql.SQLException; + method public abstract void writeClob(java.sql.Clob) throws java.sql.SQLException; + method public abstract void writeDate(java.sql.Date) throws java.sql.SQLException; + method public abstract void writeDouble(double) throws java.sql.SQLException; + method public abstract void writeFloat(float) throws java.sql.SQLException; + method public abstract void writeInt(int) throws java.sql.SQLException; + method public abstract void writeLong(long) throws java.sql.SQLException; + method public abstract void writeNClob(java.sql.NClob) throws java.sql.SQLException; + method public abstract void writeNString(java.lang.String) throws java.sql.SQLException; + method public abstract void writeObject(java.sql.SQLData) throws java.sql.SQLException; + method public abstract void writeRef(java.sql.Ref) throws java.sql.SQLException; + method public abstract void writeRowId(java.sql.RowId) throws java.sql.SQLException; + method public abstract void writeSQLXML(java.sql.SQLXML) throws java.sql.SQLException; + method public abstract void writeShort(short) throws java.sql.SQLException; + method public abstract void writeString(java.lang.String) throws java.sql.SQLException; + method public abstract void writeStruct(java.sql.Struct) throws java.sql.SQLException; + method public abstract void writeTime(java.sql.Time) throws java.sql.SQLException; + method public abstract void writeTimestamp(java.sql.Timestamp) throws java.sql.SQLException; + method public abstract void writeURL(java.net.URL) throws java.sql.SQLException; + } + + public final class SQLPermission extends java.security.BasicPermission implements java.security.Guard java.io.Serializable { + ctor public SQLPermission(java.lang.String); + ctor public SQLPermission(java.lang.String, java.lang.String); + } + + public class SQLRecoverableException extends java.sql.SQLException { + ctor public SQLRecoverableException(); + ctor public SQLRecoverableException(java.lang.String); + ctor public SQLRecoverableException(java.lang.String, java.lang.String); + ctor public SQLRecoverableException(java.lang.String, java.lang.String, int); + ctor public SQLRecoverableException(java.lang.Throwable); + ctor public SQLRecoverableException(java.lang.String, java.lang.Throwable); + ctor public SQLRecoverableException(java.lang.String, java.lang.String, java.lang.Throwable); + ctor public SQLRecoverableException(java.lang.String, java.lang.String, int, java.lang.Throwable); + } + + public class SQLSyntaxErrorException extends java.sql.SQLNonTransientException { + ctor public SQLSyntaxErrorException(); + ctor public SQLSyntaxErrorException(java.lang.String); + ctor public SQLSyntaxErrorException(java.lang.String, java.lang.String); + ctor public SQLSyntaxErrorException(java.lang.String, java.lang.String, int); + ctor public SQLSyntaxErrorException(java.lang.Throwable); + ctor public SQLSyntaxErrorException(java.lang.String, java.lang.Throwable); + ctor public SQLSyntaxErrorException(java.lang.String, java.lang.String, java.lang.Throwable); + ctor public SQLSyntaxErrorException(java.lang.String, java.lang.String, int, java.lang.Throwable); + } + + public class SQLTimeoutException extends java.sql.SQLTransientException { + ctor public SQLTimeoutException(); + ctor public SQLTimeoutException(java.lang.String); + ctor public SQLTimeoutException(java.lang.String, java.lang.String); + ctor public SQLTimeoutException(java.lang.String, java.lang.String, int); + ctor public SQLTimeoutException(java.lang.Throwable); + ctor public SQLTimeoutException(java.lang.String, java.lang.Throwable); + ctor public SQLTimeoutException(java.lang.String, java.lang.String, java.lang.Throwable); + ctor public SQLTimeoutException(java.lang.String, java.lang.String, int, java.lang.Throwable); + } + + public class SQLTransactionRollbackException extends java.sql.SQLTransientException { + ctor public SQLTransactionRollbackException(); + ctor public SQLTransactionRollbackException(java.lang.String); + ctor public SQLTransactionRollbackException(java.lang.String, java.lang.String); + ctor public SQLTransactionRollbackException(java.lang.String, java.lang.String, int); + ctor public SQLTransactionRollbackException(java.lang.Throwable); + ctor public SQLTransactionRollbackException(java.lang.String, java.lang.Throwable); + ctor public SQLTransactionRollbackException(java.lang.String, java.lang.String, java.lang.Throwable); + ctor public SQLTransactionRollbackException(java.lang.String, java.lang.String, int, java.lang.Throwable); + } + + public class SQLTransientConnectionException extends java.sql.SQLTransientException { + ctor public SQLTransientConnectionException(); + ctor public SQLTransientConnectionException(java.lang.String); + ctor public SQLTransientConnectionException(java.lang.String, java.lang.String); + ctor public SQLTransientConnectionException(java.lang.String, java.lang.String, int); + ctor public SQLTransientConnectionException(java.lang.Throwable); + ctor public SQLTransientConnectionException(java.lang.String, java.lang.Throwable); + ctor public SQLTransientConnectionException(java.lang.String, java.lang.String, java.lang.Throwable); + ctor public SQLTransientConnectionException(java.lang.String, java.lang.String, int, java.lang.Throwable); + } + + public class SQLTransientException extends java.sql.SQLException { + ctor public SQLTransientException(); + ctor public SQLTransientException(java.lang.String); + ctor public SQLTransientException(java.lang.String, java.lang.String); + ctor public SQLTransientException(java.lang.String, java.lang.String, int); + ctor public SQLTransientException(java.lang.Throwable); + ctor public SQLTransientException(java.lang.String, java.lang.Throwable); + ctor public SQLTransientException(java.lang.String, java.lang.String, java.lang.Throwable); + ctor public SQLTransientException(java.lang.String, java.lang.String, int, java.lang.Throwable); + } + + public class SQLWarning extends java.sql.SQLException implements java.io.Serializable { + ctor public SQLWarning(); + ctor public SQLWarning(java.lang.String); + ctor public SQLWarning(java.lang.String, java.lang.String); + ctor public SQLWarning(java.lang.String, java.lang.String, int); + ctor public SQLWarning(java.lang.Throwable); + ctor public SQLWarning(java.lang.String, java.lang.Throwable); + ctor public SQLWarning(java.lang.String, java.lang.String, java.lang.Throwable); + ctor public SQLWarning(java.lang.String, java.lang.String, int, java.lang.Throwable); + method public java.sql.SQLWarning getNextWarning(); + method public void setNextWarning(java.sql.SQLWarning); + } + + public abstract interface SQLXML { + method public abstract void free() throws java.sql.SQLException; + method public abstract java.io.InputStream getBinaryStream() throws java.sql.SQLException; + method public abstract java.io.Reader getCharacterStream() throws java.sql.SQLException; + method public abstract T getSource(java.lang.Class) throws java.sql.SQLException; + method public abstract java.lang.String getString() throws java.sql.SQLException; + method public abstract java.io.OutputStream setBinaryStream() throws java.sql.SQLException; + method public abstract java.io.Writer setCharacterStream() throws java.sql.SQLException; + method public abstract T setResult(java.lang.Class) throws java.sql.SQLException; + method public abstract void setString(java.lang.String) throws java.sql.SQLException; + } + + public abstract interface Savepoint { + method public abstract int getSavepointId() throws java.sql.SQLException; + method public abstract java.lang.String getSavepointName() throws java.sql.SQLException; + } + + public abstract interface Statement implements java.sql.Wrapper { + method public abstract void addBatch(java.lang.String) throws java.sql.SQLException; + method public abstract void cancel() throws java.sql.SQLException; + method public abstract void clearBatch() throws java.sql.SQLException; + method public abstract void clearWarnings() throws java.sql.SQLException; + method public abstract void close() throws java.sql.SQLException; + method public abstract boolean execute(java.lang.String) throws java.sql.SQLException; + method public abstract boolean execute(java.lang.String, int) throws java.sql.SQLException; + method public abstract boolean execute(java.lang.String, int[]) throws java.sql.SQLException; + method public abstract boolean execute(java.lang.String, java.lang.String[]) throws java.sql.SQLException; + method public abstract int[] executeBatch() throws java.sql.SQLException; + method public abstract java.sql.ResultSet executeQuery(java.lang.String) throws java.sql.SQLException; + method public abstract int executeUpdate(java.lang.String) throws java.sql.SQLException; + method public abstract int executeUpdate(java.lang.String, int) throws java.sql.SQLException; + method public abstract int executeUpdate(java.lang.String, int[]) throws java.sql.SQLException; + method public abstract int executeUpdate(java.lang.String, java.lang.String[]) throws java.sql.SQLException; + method public abstract java.sql.Connection getConnection() throws java.sql.SQLException; + method public abstract int getFetchDirection() throws java.sql.SQLException; + method public abstract int getFetchSize() throws java.sql.SQLException; + method public abstract java.sql.ResultSet getGeneratedKeys() throws java.sql.SQLException; + method public abstract int getMaxFieldSize() throws java.sql.SQLException; + method public abstract int getMaxRows() throws java.sql.SQLException; + method public abstract boolean getMoreResults() throws java.sql.SQLException; + method public abstract boolean getMoreResults(int) throws java.sql.SQLException; + method public abstract int getQueryTimeout() throws java.sql.SQLException; + method public abstract java.sql.ResultSet getResultSet() throws java.sql.SQLException; + method public abstract int getResultSetConcurrency() throws java.sql.SQLException; + method public abstract int getResultSetHoldability() throws java.sql.SQLException; + method public abstract int getResultSetType() throws java.sql.SQLException; + method public abstract int getUpdateCount() throws java.sql.SQLException; + method public abstract java.sql.SQLWarning getWarnings() throws java.sql.SQLException; + method public abstract boolean isClosed() throws java.sql.SQLException; + method public abstract boolean isPoolable() throws java.sql.SQLException; + method public abstract void setCursorName(java.lang.String) throws java.sql.SQLException; + method public abstract void setEscapeProcessing(boolean) throws java.sql.SQLException; + method public abstract void setFetchDirection(int) throws java.sql.SQLException; + method public abstract void setFetchSize(int) throws java.sql.SQLException; + method public abstract void setMaxFieldSize(int) throws java.sql.SQLException; + method public abstract void setMaxRows(int) throws java.sql.SQLException; + method public abstract void setPoolable(boolean) throws java.sql.SQLException; + method public abstract void setQueryTimeout(int) throws java.sql.SQLException; + field public static final int CLOSE_ALL_RESULTS = 3; // 0x3 + field public static final int CLOSE_CURRENT_RESULT = 1; // 0x1 + field public static final int EXECUTE_FAILED = -3; // 0xfffffffd + field public static final int KEEP_CURRENT_RESULT = 2; // 0x2 + field public static final int NO_GENERATED_KEYS = 2; // 0x2 + field public static final int RETURN_GENERATED_KEYS = 1; // 0x1 + field public static final int SUCCESS_NO_INFO = -2; // 0xfffffffe + } + + public abstract interface Struct { + method public abstract java.lang.Object[] getAttributes() throws java.sql.SQLException; + method public abstract java.lang.Object[] getAttributes(java.util.Map>) throws java.sql.SQLException; + method public abstract java.lang.String getSQLTypeName() throws java.sql.SQLException; + } + + public class Time extends java.util.Date { + ctor public deprecated Time(int, int, int); + ctor public Time(long); + method public static java.sql.Time valueOf(java.lang.String); + } + + public class Timestamp extends java.util.Date { + ctor public deprecated Timestamp(int, int, int, int, int, int, int) throws java.lang.IllegalArgumentException; + ctor public Timestamp(long); + method public boolean after(java.sql.Timestamp); + method public boolean before(java.sql.Timestamp); + method public int compareTo(java.sql.Timestamp); + method public boolean equals(java.sql.Timestamp); + method public int getNanos(); + method public void setNanos(int) throws java.lang.IllegalArgumentException; + method public static java.sql.Timestamp valueOf(java.lang.String) throws java.lang.IllegalArgumentException; + } + + public class Types { + field public static final int ARRAY = 2003; // 0x7d3 + field public static final int BIGINT = -5; // 0xfffffffb + field public static final int BINARY = -2; // 0xfffffffe + field public static final int BIT = -7; // 0xfffffff9 + field public static final int BLOB = 2004; // 0x7d4 + field public static final int BOOLEAN = 16; // 0x10 + field public static final int CHAR = 1; // 0x1 + field public static final int CLOB = 2005; // 0x7d5 + field public static final int DATALINK = 70; // 0x46 + field public static final int DATE = 91; // 0x5b + field public static final int DECIMAL = 3; // 0x3 + field public static final int DISTINCT = 2001; // 0x7d1 + field public static final int DOUBLE = 8; // 0x8 + field public static final int FLOAT = 6; // 0x6 + field public static final int INTEGER = 4; // 0x4 + field public static final int JAVA_OBJECT = 2000; // 0x7d0 + field public static final int LONGNVARCHAR = -16; // 0xfffffff0 + field public static final int LONGVARBINARY = -4; // 0xfffffffc + field public static final int LONGVARCHAR = -1; // 0xffffffff + field public static final int NCHAR = -15; // 0xfffffff1 + field public static final int NCLOB = 2011; // 0x7db + field public static final int NULL = 0; // 0x0 + field public static final int NUMERIC = 2; // 0x2 + field public static final int NVARCHAR = -9; // 0xfffffff7 + field public static final int OTHER = 1111; // 0x457 + field public static final int REAL = 7; // 0x7 + field public static final int REF = 2006; // 0x7d6 + field public static final int ROWID = -8; // 0xfffffff8 + field public static final int SMALLINT = 5; // 0x5 + field public static final int SQLXML = 2009; // 0x7d9 + field public static final int STRUCT = 2002; // 0x7d2 + field public static final int TIME = 92; // 0x5c + field public static final int TIMESTAMP = 93; // 0x5d + field public static final int TINYINT = -6; // 0xfffffffa + field public static final int VARBINARY = -3; // 0xfffffffd + field public static final int VARCHAR = 12; // 0xc + } + + public abstract interface Wrapper { + method public abstract boolean isWrapperFor(java.lang.Class) throws java.sql.SQLException; + method public abstract T unwrap(java.lang.Class) throws java.sql.SQLException; + } + +} + +package java.text { + + public class Annotation { + ctor public Annotation(java.lang.Object); + method public java.lang.Object getValue(); + } + + public abstract interface AttributedCharacterIterator implements java.text.CharacterIterator { + method public abstract java.util.Set getAllAttributeKeys(); + method public abstract java.lang.Object getAttribute(java.text.AttributedCharacterIterator.Attribute); + method public abstract java.util.Map getAttributes(); + method public abstract int getRunLimit(); + method public abstract int getRunLimit(java.text.AttributedCharacterIterator.Attribute); + method public abstract int getRunLimit(java.util.Set); + method public abstract int getRunStart(); + method public abstract int getRunStart(java.text.AttributedCharacterIterator.Attribute); + method public abstract int getRunStart(java.util.Set); + } + + public static class AttributedCharacterIterator.Attribute implements java.io.Serializable { + ctor protected AttributedCharacterIterator.Attribute(java.lang.String); + method public final boolean equals(java.lang.Object); + method protected java.lang.String getName(); + method public final int hashCode(); + method protected java.lang.Object readResolve() throws java.io.InvalidObjectException; + field public static final java.text.AttributedCharacterIterator.Attribute INPUT_METHOD_SEGMENT; + field public static final java.text.AttributedCharacterIterator.Attribute LANGUAGE; + field public static final java.text.AttributedCharacterIterator.Attribute READING; + } + + public class AttributedString { + ctor public AttributedString(java.text.AttributedCharacterIterator); + ctor public AttributedString(java.text.AttributedCharacterIterator, int, int); + ctor public AttributedString(java.text.AttributedCharacterIterator, int, int, java.text.AttributedCharacterIterator.Attribute[]); + ctor public AttributedString(java.lang.String); + ctor public AttributedString(java.lang.String, java.util.Map); + method public void addAttribute(java.text.AttributedCharacterIterator.Attribute, java.lang.Object); + method public void addAttribute(java.text.AttributedCharacterIterator.Attribute, java.lang.Object, int, int); + method public void addAttributes(java.util.Map, int, int); + method public java.text.AttributedCharacterIterator getIterator(); + method public java.text.AttributedCharacterIterator getIterator(java.text.AttributedCharacterIterator.Attribute[]); + method public java.text.AttributedCharacterIterator getIterator(java.text.AttributedCharacterIterator.Attribute[], int, int); + } + + public final class Bidi { + ctor public Bidi(java.text.AttributedCharacterIterator); + ctor public Bidi(char[], int, byte[], int, int, int); + ctor public Bidi(java.lang.String, int); + method public boolean baseIsLeftToRight(); + method public java.text.Bidi createLineBidi(int, int); + method public int getBaseLevel(); + method public int getLength(); + method public int getLevelAt(int); + method public int getRunCount(); + method public int getRunLevel(int); + method public int getRunLimit(int); + method public int getRunStart(int); + method public boolean isLeftToRight(); + method public boolean isMixed(); + method public boolean isRightToLeft(); + method public static void reorderVisually(byte[], int, java.lang.Object[], int, int); + method public static boolean requiresBidi(char[], int, int); + field public static final int DIRECTION_DEFAULT_LEFT_TO_RIGHT = -2; // 0xfffffffe + field public static final int DIRECTION_DEFAULT_RIGHT_TO_LEFT = -1; // 0xffffffff + field public static final int DIRECTION_LEFT_TO_RIGHT = 0; // 0x0 + field public static final int DIRECTION_RIGHT_TO_LEFT = 1; // 0x1 + } + + public abstract class BreakIterator implements java.lang.Cloneable { + ctor protected BreakIterator(); + method public java.lang.Object clone(); + method public abstract int current(); + method public abstract int first(); + method public abstract int following(int); + method public static java.util.Locale[] getAvailableLocales(); + method public static java.text.BreakIterator getCharacterInstance(); + method public static java.text.BreakIterator getCharacterInstance(java.util.Locale); + method public static java.text.BreakIterator getLineInstance(); + method public static java.text.BreakIterator getLineInstance(java.util.Locale); + method public static java.text.BreakIterator getSentenceInstance(); + method public static java.text.BreakIterator getSentenceInstance(java.util.Locale); + method public abstract java.text.CharacterIterator getText(); + method public static java.text.BreakIterator getWordInstance(); + method public static java.text.BreakIterator getWordInstance(java.util.Locale); + method public boolean isBoundary(int); + method public abstract int last(); + method public abstract int next(); + method public abstract int next(int); + method public int preceding(int); + method public abstract int previous(); + method public void setText(java.lang.String); + method public abstract void setText(java.text.CharacterIterator); + field public static final int DONE = -1; // 0xffffffff + } + + public abstract interface CharacterIterator implements java.lang.Cloneable { + method public abstract java.lang.Object clone(); + method public abstract char current(); + method public abstract char first(); + method public abstract int getBeginIndex(); + method public abstract int getEndIndex(); + method public abstract int getIndex(); + method public abstract char last(); + method public abstract char next(); + method public abstract char previous(); + method public abstract char setIndex(int); + field public static final char DONE = 65535; // 0xffff '\uffff' + } + + public class ChoiceFormat extends java.text.NumberFormat { + ctor public ChoiceFormat(double[], java.lang.String[]); + ctor public ChoiceFormat(java.lang.String); + method public void applyPattern(java.lang.String); + method public java.lang.StringBuffer format(double, java.lang.StringBuffer, java.text.FieldPosition); + method public java.lang.StringBuffer format(long, java.lang.StringBuffer, java.text.FieldPosition); + method public java.lang.Object[] getFormats(); + method public double[] getLimits(); + method public static final double nextDouble(double); + method public static double nextDouble(double, boolean); + method public java.lang.Number parse(java.lang.String, java.text.ParsePosition); + method public static final double previousDouble(double); + method public void setChoices(double[], java.lang.String[]); + method public java.lang.String toPattern(); + } + + public final class CollationElementIterator { + method public int getMaxExpansion(int); + method public int getOffset(); + method public int next(); + method public int previous(); + method public static final int primaryOrder(int); + method public void reset(); + method public static final short secondaryOrder(int); + method public void setOffset(int); + method public void setText(java.text.CharacterIterator); + method public void setText(java.lang.String); + method public static final short tertiaryOrder(int); + field public static final int NULLORDER = -1; // 0xffffffff + } + + public abstract class CollationKey implements java.lang.Comparable { + ctor protected CollationKey(java.lang.String); + method public abstract int compareTo(java.text.CollationKey); + method public java.lang.String getSourceString(); + method public abstract byte[] toByteArray(); + } + + public abstract class Collator implements java.lang.Cloneable java.util.Comparator { + ctor protected Collator(); + method public java.lang.Object clone(); + method public int compare(java.lang.Object, java.lang.Object); + method public abstract int compare(java.lang.String, java.lang.String); + method public boolean equals(java.lang.String, java.lang.String); + method public static java.util.Locale[] getAvailableLocales(); + method public abstract java.text.CollationKey getCollationKey(java.lang.String); + method public int getDecomposition(); + method public static java.text.Collator getInstance(); + method public static java.text.Collator getInstance(java.util.Locale); + method public int getStrength(); + method public abstract int hashCode(); + method public void setDecomposition(int); + method public void setStrength(int); + field public static final int CANONICAL_DECOMPOSITION = 1; // 0x1 + field public static final int FULL_DECOMPOSITION = 2; // 0x2 + field public static final int IDENTICAL = 3; // 0x3 + field public static final int NO_DECOMPOSITION = 0; // 0x0 + field public static final int PRIMARY = 0; // 0x0 + field public static final int SECONDARY = 1; // 0x1 + field public static final int TERTIARY = 2; // 0x2 + } + + public abstract class DateFormat extends java.text.Format { + ctor protected DateFormat(); + method public final java.lang.StringBuffer format(java.lang.Object, java.lang.StringBuffer, java.text.FieldPosition); + method public final java.lang.String format(java.util.Date); + method public abstract java.lang.StringBuffer format(java.util.Date, java.lang.StringBuffer, java.text.FieldPosition); + method public static java.util.Locale[] getAvailableLocales(); + method public java.util.Calendar getCalendar(); + method public static final java.text.DateFormat getDateInstance(); + method public static final java.text.DateFormat getDateInstance(int); + method public static final java.text.DateFormat getDateInstance(int, java.util.Locale); + method public static final java.text.DateFormat getDateTimeInstance(); + method public static final java.text.DateFormat getDateTimeInstance(int, int); + method public static final java.text.DateFormat getDateTimeInstance(int, int, java.util.Locale); + method public static final java.text.DateFormat getInstance(); + method public java.text.NumberFormat getNumberFormat(); + method public static final java.text.DateFormat getTimeInstance(); + method public static final java.text.DateFormat getTimeInstance(int); + method public static final java.text.DateFormat getTimeInstance(int, java.util.Locale); + method public java.util.TimeZone getTimeZone(); + method public boolean isLenient(); + method public java.util.Date parse(java.lang.String) throws java.text.ParseException; + method public abstract java.util.Date parse(java.lang.String, java.text.ParsePosition); + method public java.lang.Object parseObject(java.lang.String, java.text.ParsePosition); + method public void setCalendar(java.util.Calendar); + method public void setLenient(boolean); + method public void setNumberFormat(java.text.NumberFormat); + method public void setTimeZone(java.util.TimeZone); + field public static final int AM_PM_FIELD = 14; // 0xe + field public static final int DATE_FIELD = 3; // 0x3 + field public static final int DAY_OF_WEEK_FIELD = 9; // 0x9 + field public static final int DAY_OF_WEEK_IN_MONTH_FIELD = 11; // 0xb + field public static final int DAY_OF_YEAR_FIELD = 10; // 0xa + field public static final int DEFAULT = 2; // 0x2 + field public static final int ERA_FIELD = 0; // 0x0 + field public static final int FULL = 0; // 0x0 + field public static final int HOUR0_FIELD = 16; // 0x10 + field public static final int HOUR1_FIELD = 15; // 0xf + field public static final int HOUR_OF_DAY0_FIELD = 5; // 0x5 + field public static final int HOUR_OF_DAY1_FIELD = 4; // 0x4 + field public static final int LONG = 1; // 0x1 + field public static final int MEDIUM = 2; // 0x2 + field public static final int MILLISECOND_FIELD = 8; // 0x8 + field public static final int MINUTE_FIELD = 6; // 0x6 + field public static final int MONTH_FIELD = 2; // 0x2 + field public static final int SECOND_FIELD = 7; // 0x7 + field public static final int SHORT = 3; // 0x3 + field public static final int TIMEZONE_FIELD = 17; // 0x11 + field public static final int WEEK_OF_MONTH_FIELD = 13; // 0xd + field public static final int WEEK_OF_YEAR_FIELD = 12; // 0xc + field public static final int YEAR_FIELD = 1; // 0x1 + field protected java.util.Calendar calendar; + field protected java.text.NumberFormat numberFormat; + } + + public static class DateFormat.Field extends java.text.Format.Field { + ctor protected DateFormat.Field(java.lang.String, int); + method public int getCalendarField(); + method public static java.text.DateFormat.Field ofCalendarField(int); + field public static final java.text.DateFormat.Field AM_PM; + field public static final java.text.DateFormat.Field DAY_OF_MONTH; + field public static final java.text.DateFormat.Field DAY_OF_WEEK; + field public static final java.text.DateFormat.Field DAY_OF_WEEK_IN_MONTH; + field public static final java.text.DateFormat.Field DAY_OF_YEAR; + field public static final java.text.DateFormat.Field ERA; + field public static final java.text.DateFormat.Field HOUR0; + field public static final java.text.DateFormat.Field HOUR1; + field public static final java.text.DateFormat.Field HOUR_OF_DAY0; + field public static final java.text.DateFormat.Field HOUR_OF_DAY1; + field public static final java.text.DateFormat.Field MILLISECOND; + field public static final java.text.DateFormat.Field MINUTE; + field public static final java.text.DateFormat.Field MONTH; + field public static final java.text.DateFormat.Field SECOND; + field public static final java.text.DateFormat.Field TIME_ZONE; + field public static final java.text.DateFormat.Field WEEK_OF_MONTH; + field public static final java.text.DateFormat.Field WEEK_OF_YEAR; + field public static final java.text.DateFormat.Field YEAR; + } + + public class DateFormatSymbols implements java.lang.Cloneable java.io.Serializable { + ctor public DateFormatSymbols(); + ctor public DateFormatSymbols(java.util.Locale); + method public java.lang.Object clone(); + method public java.lang.String[] getAmPmStrings(); + method public static java.util.Locale[] getAvailableLocales(); + method public java.lang.String[] getEras(); + method public static final java.text.DateFormatSymbols getInstance(); + method public static final java.text.DateFormatSymbols getInstance(java.util.Locale); + method public java.lang.String getLocalPatternChars(); + method public java.lang.String[] getMonths(); + method public java.lang.String[] getShortMonths(); + method public java.lang.String[] getShortWeekdays(); + method public java.lang.String[] getWeekdays(); + method public java.lang.String[][] getZoneStrings(); + method public void setAmPmStrings(java.lang.String[]); + method public void setEras(java.lang.String[]); + method public void setLocalPatternChars(java.lang.String); + method public void setMonths(java.lang.String[]); + method public void setShortMonths(java.lang.String[]); + method public void setShortWeekdays(java.lang.String[]); + method public void setWeekdays(java.lang.String[]); + method public void setZoneStrings(java.lang.String[][]); + } + + public class DecimalFormat extends java.text.NumberFormat { + ctor public DecimalFormat(); + ctor public DecimalFormat(java.lang.String); + ctor public DecimalFormat(java.lang.String, java.text.DecimalFormatSymbols); + method public void applyLocalizedPattern(java.lang.String); + method public void applyPattern(java.lang.String); + method public java.lang.StringBuffer format(double, java.lang.StringBuffer, java.text.FieldPosition); + method public java.lang.StringBuffer format(long, java.lang.StringBuffer, java.text.FieldPosition); + method public final java.lang.StringBuffer format(java.lang.Object, java.lang.StringBuffer, java.text.FieldPosition); + method public java.text.DecimalFormatSymbols getDecimalFormatSymbols(); + method public int getGroupingSize(); + method public int getMultiplier(); + method public java.lang.String getNegativePrefix(); + method public java.lang.String getNegativeSuffix(); + method public java.lang.String getPositivePrefix(); + method public java.lang.String getPositiveSuffix(); + method public boolean isDecimalSeparatorAlwaysShown(); + method public boolean isParseBigDecimal(); + method public java.lang.Number parse(java.lang.String, java.text.ParsePosition); + method public void setDecimalFormatSymbols(java.text.DecimalFormatSymbols); + method public void setDecimalSeparatorAlwaysShown(boolean); + method public void setGroupingSize(int); + method public void setMultiplier(int); + method public void setNegativePrefix(java.lang.String); + method public void setNegativeSuffix(java.lang.String); + method public void setParseBigDecimal(boolean); + method public void setPositivePrefix(java.lang.String); + method public void setPositiveSuffix(java.lang.String); + method public java.lang.String toLocalizedPattern(); + method public java.lang.String toPattern(); + } + + public class DecimalFormatSymbols implements java.lang.Cloneable java.io.Serializable { + ctor public DecimalFormatSymbols(); + ctor public DecimalFormatSymbols(java.util.Locale); + method public java.lang.Object clone(); + method public static java.util.Locale[] getAvailableLocales(); + method public java.util.Currency getCurrency(); + method public java.lang.String getCurrencySymbol(); + method public char getDecimalSeparator(); + method public char getDigit(); + method public java.lang.String getExponentSeparator(); + method public char getGroupingSeparator(); + method public java.lang.String getInfinity(); + method public static java.text.DecimalFormatSymbols getInstance(); + method public static java.text.DecimalFormatSymbols getInstance(java.util.Locale); + method public java.lang.String getInternationalCurrencySymbol(); + method public char getMinusSign(); + method public char getMonetaryDecimalSeparator(); + method public java.lang.String getNaN(); + method public char getPatternSeparator(); + method public char getPerMill(); + method public char getPercent(); + method public char getZeroDigit(); + method public void setCurrency(java.util.Currency); + method public void setCurrencySymbol(java.lang.String); + method public void setDecimalSeparator(char); + method public void setDigit(char); + method public void setExponentSeparator(java.lang.String); + method public void setGroupingSeparator(char); + method public void setInfinity(java.lang.String); + method public void setInternationalCurrencySymbol(java.lang.String); + method public void setMinusSign(char); + method public void setMonetaryDecimalSeparator(char); + method public void setNaN(java.lang.String); + method public void setPatternSeparator(char); + method public void setPerMill(char); + method public void setPercent(char); + method public void setZeroDigit(char); + } + + public class FieldPosition { + ctor public FieldPosition(int); + ctor public FieldPosition(java.text.Format.Field); + ctor public FieldPosition(java.text.Format.Field, int); + method public int getBeginIndex(); + method public int getEndIndex(); + method public int getField(); + method public java.text.Format.Field getFieldAttribute(); + method public void setBeginIndex(int); + method public void setEndIndex(int); + } + + public abstract class Format implements java.lang.Cloneable java.io.Serializable { + ctor protected Format(); + method public java.lang.Object clone(); + method public final java.lang.String format(java.lang.Object); + method public abstract java.lang.StringBuffer format(java.lang.Object, java.lang.StringBuffer, java.text.FieldPosition); + method public java.text.AttributedCharacterIterator formatToCharacterIterator(java.lang.Object); + method public java.lang.Object parseObject(java.lang.String) throws java.text.ParseException; + method public abstract java.lang.Object parseObject(java.lang.String, java.text.ParsePosition); + } + + public static class Format.Field extends java.text.AttributedCharacterIterator.Attribute { + ctor protected Format.Field(java.lang.String); + } + + public class MessageFormat extends java.text.Format { + ctor public MessageFormat(java.lang.String, java.util.Locale); + ctor public MessageFormat(java.lang.String); + method public void applyPattern(java.lang.String); + method public final java.lang.StringBuffer format(java.lang.Object[], java.lang.StringBuffer, java.text.FieldPosition); + method public final java.lang.StringBuffer format(java.lang.Object, java.lang.StringBuffer, java.text.FieldPosition); + method public static java.lang.String format(java.lang.String, java.lang.Object...); + method public java.text.Format[] getFormats(); + method public java.text.Format[] getFormatsByArgumentIndex(); + method public java.util.Locale getLocale(); + method public java.lang.Object[] parse(java.lang.String) throws java.text.ParseException; + method public java.lang.Object[] parse(java.lang.String, java.text.ParsePosition); + method public java.lang.Object parseObject(java.lang.String, java.text.ParsePosition); + method public void setFormat(int, java.text.Format); + method public void setFormatByArgumentIndex(int, java.text.Format); + method public void setFormats(java.text.Format[]); + method public void setFormatsByArgumentIndex(java.text.Format[]); + method public void setLocale(java.util.Locale); + method public java.lang.String toPattern(); + } + + public static class MessageFormat.Field extends java.text.Format.Field { + ctor protected MessageFormat.Field(java.lang.String); + field public static final java.text.MessageFormat.Field ARGUMENT; + } + + public final class Normalizer { + method public static boolean isNormalized(java.lang.CharSequence, java.text.Normalizer.Form); + method public static java.lang.String normalize(java.lang.CharSequence, java.text.Normalizer.Form); + } + + public static final class Normalizer.Form extends java.lang.Enum { + method public static java.text.Normalizer.Form valueOf(java.lang.String); + method public static final java.text.Normalizer.Form[] values(); + enum_constant public static final java.text.Normalizer.Form NFC; + enum_constant public static final java.text.Normalizer.Form NFD; + enum_constant public static final java.text.Normalizer.Form NFKC; + enum_constant public static final java.text.Normalizer.Form NFKD; + } + + public abstract class NumberFormat extends java.text.Format { + ctor protected NumberFormat(); + method public final java.lang.String format(double); + method public abstract java.lang.StringBuffer format(double, java.lang.StringBuffer, java.text.FieldPosition); + method public final java.lang.String format(long); + method public abstract java.lang.StringBuffer format(long, java.lang.StringBuffer, java.text.FieldPosition); + method public java.lang.StringBuffer format(java.lang.Object, java.lang.StringBuffer, java.text.FieldPosition); + method public static java.util.Locale[] getAvailableLocales(); + method public java.util.Currency getCurrency(); + method public static final java.text.NumberFormat getCurrencyInstance(); + method public static java.text.NumberFormat getCurrencyInstance(java.util.Locale); + method public static final java.text.NumberFormat getInstance(); + method public static java.text.NumberFormat getInstance(java.util.Locale); + method public static final java.text.NumberFormat getIntegerInstance(); + method public static java.text.NumberFormat getIntegerInstance(java.util.Locale); + method public int getMaximumFractionDigits(); + method public int getMaximumIntegerDigits(); + method public int getMinimumFractionDigits(); + method public int getMinimumIntegerDigits(); + method public static final java.text.NumberFormat getNumberInstance(); + method public static java.text.NumberFormat getNumberInstance(java.util.Locale); + method public static final java.text.NumberFormat getPercentInstance(); + method public static java.text.NumberFormat getPercentInstance(java.util.Locale); + method public java.math.RoundingMode getRoundingMode(); + method public boolean isGroupingUsed(); + method public boolean isParseIntegerOnly(); + method public java.lang.Number parse(java.lang.String) throws java.text.ParseException; + method public abstract java.lang.Number parse(java.lang.String, java.text.ParsePosition); + method public final java.lang.Object parseObject(java.lang.String, java.text.ParsePosition); + method public void setCurrency(java.util.Currency); + method public void setGroupingUsed(boolean); + method public void setMaximumFractionDigits(int); + method public void setMaximumIntegerDigits(int); + method public void setMinimumFractionDigits(int); + method public void setMinimumIntegerDigits(int); + method public void setParseIntegerOnly(boolean); + method public void setRoundingMode(java.math.RoundingMode); + field public static final int FRACTION_FIELD = 1; // 0x1 + field public static final int INTEGER_FIELD = 0; // 0x0 + } + + public static class NumberFormat.Field extends java.text.Format.Field { + ctor protected NumberFormat.Field(java.lang.String); + field public static final java.text.NumberFormat.Field CURRENCY; + field public static final java.text.NumberFormat.Field DECIMAL_SEPARATOR; + field public static final java.text.NumberFormat.Field EXPONENT; + field public static final java.text.NumberFormat.Field EXPONENT_SIGN; + field public static final java.text.NumberFormat.Field EXPONENT_SYMBOL; + field public static final java.text.NumberFormat.Field FRACTION; + field public static final java.text.NumberFormat.Field GROUPING_SEPARATOR; + field public static final java.text.NumberFormat.Field INTEGER; + field public static final java.text.NumberFormat.Field PERCENT; + field public static final java.text.NumberFormat.Field PERMILLE; + field public static final java.text.NumberFormat.Field SIGN; + } + + public class ParseException extends java.lang.Exception { + ctor public ParseException(java.lang.String, int); + method public int getErrorOffset(); + } + + public class ParsePosition { + ctor public ParsePosition(int); + method public int getErrorIndex(); + method public int getIndex(); + method public void setErrorIndex(int); + method public void setIndex(int); + } + + public class RuleBasedCollator extends java.text.Collator { + ctor public RuleBasedCollator(java.lang.String) throws java.text.ParseException; + method public int compare(java.lang.String, java.lang.String); + method public java.text.CollationElementIterator getCollationElementIterator(java.text.CharacterIterator); + method public java.text.CollationElementIterator getCollationElementIterator(java.lang.String); + method public java.text.CollationKey getCollationKey(java.lang.String); + method public java.lang.String getRules(); + method public int hashCode(); + } + + public class SimpleDateFormat extends java.text.DateFormat { + ctor public SimpleDateFormat(); + ctor public SimpleDateFormat(java.lang.String); + ctor public SimpleDateFormat(java.lang.String, java.text.DateFormatSymbols); + ctor public SimpleDateFormat(java.lang.String, java.util.Locale); + method public void applyLocalizedPattern(java.lang.String); + method public void applyPattern(java.lang.String); + method public java.lang.StringBuffer format(java.util.Date, java.lang.StringBuffer, java.text.FieldPosition); + method public java.util.Date get2DigitYearStart(); + method public java.text.DateFormatSymbols getDateFormatSymbols(); + method public java.util.Date parse(java.lang.String, java.text.ParsePosition); + method public void set2DigitYearStart(java.util.Date); + method public void setDateFormatSymbols(java.text.DateFormatSymbols); + method public java.lang.String toLocalizedPattern(); + method public java.lang.String toPattern(); + } + + public final class StringCharacterIterator implements java.text.CharacterIterator { + ctor public StringCharacterIterator(java.lang.String); + ctor public StringCharacterIterator(java.lang.String, int); + ctor public StringCharacterIterator(java.lang.String, int, int, int); + method public java.lang.Object clone(); + method public char current(); + method public char first(); + method public int getBeginIndex(); + method public int getEndIndex(); + method public int getIndex(); + method public char last(); + method public char next(); + method public char previous(); + method public char setIndex(int); + method public void setText(java.lang.String); + } + +} + +package java.util { + + public abstract class AbstractCollection implements java.util.Collection { + ctor protected AbstractCollection(); + method public boolean add(E); + method public boolean addAll(java.util.Collection); + method public void clear(); + method public boolean contains(java.lang.Object); + method public boolean containsAll(java.util.Collection); + method public boolean isEmpty(); + method public abstract java.util.Iterator iterator(); + method public boolean remove(java.lang.Object); + method public boolean removeAll(java.util.Collection); + method public boolean retainAll(java.util.Collection); + method public abstract int size(); + method public java.lang.Object[] toArray(); + method public T[] toArray(T[]); + } + + public abstract class AbstractList extends java.util.AbstractCollection implements java.util.List { + ctor protected AbstractList(); + method public void add(int, E); + method public boolean addAll(int, java.util.Collection); + method public abstract E get(int); + method public int indexOf(java.lang.Object); + method public java.util.Iterator iterator(); + method public int lastIndexOf(java.lang.Object); + method public java.util.ListIterator listIterator(); + method public java.util.ListIterator listIterator(int); + method public E remove(int); + method protected void removeRange(int, int); + method public E set(int, E); + method public java.util.List subList(int, int); + field protected transient int modCount; + } + + public abstract class AbstractMap implements java.util.Map { + ctor protected AbstractMap(); + method public void clear(); + method public boolean containsKey(java.lang.Object); + method public boolean containsValue(java.lang.Object); + method public abstract java.util.Set> entrySet(); + method public V get(java.lang.Object); + method public boolean isEmpty(); + method public java.util.Set keySet(); + method public V put(K, V); + method public void putAll(java.util.Map); + method public V remove(java.lang.Object); + method public int size(); + method public java.util.Collection values(); + } + + public static class AbstractMap.SimpleEntry implements java.util.Map.Entry java.io.Serializable { + ctor public AbstractMap.SimpleEntry(K, V); + ctor public AbstractMap.SimpleEntry(java.util.Map.Entry); + method public K getKey(); + method public V getValue(); + method public V setValue(V); + } + + public static class AbstractMap.SimpleImmutableEntry implements java.util.Map.Entry java.io.Serializable { + ctor public AbstractMap.SimpleImmutableEntry(K, V); + ctor public AbstractMap.SimpleImmutableEntry(java.util.Map.Entry); + method public K getKey(); + method public V getValue(); + method public V setValue(V); + } + + public abstract class AbstractQueue extends java.util.AbstractCollection implements java.util.Queue { + ctor protected AbstractQueue(); + method public E element(); + method public E remove(); + } + + public abstract class AbstractSequentialList extends java.util.AbstractList { + ctor protected AbstractSequentialList(); + method public E get(int); + method public abstract java.util.ListIterator listIterator(int); + } + + public abstract class AbstractSet extends java.util.AbstractCollection implements java.util.Set { + ctor protected AbstractSet(); + } + + public class ArrayDeque extends java.util.AbstractCollection implements java.lang.Cloneable java.util.Deque java.io.Serializable { + ctor public ArrayDeque(); + ctor public ArrayDeque(int); + ctor public ArrayDeque(java.util.Collection); + method public void addFirst(E); + method public void addLast(E); + method public java.util.ArrayDeque clone(); + method public java.util.Iterator descendingIterator(); + method public E element(); + method public E getFirst(); + method public E getLast(); + method public java.util.Iterator iterator(); + method public boolean offer(E); + method public boolean offerFirst(E); + method public boolean offerLast(E); + method public E peek(); + method public E peekFirst(); + method public E peekLast(); + method public E poll(); + method public E pollFirst(); + method public E pollLast(); + method public E pop(); + method public void push(E); + method public E remove(); + method public E removeFirst(); + method public boolean removeFirstOccurrence(java.lang.Object); + method public E removeLast(); + method public boolean removeLastOccurrence(java.lang.Object); + method public int size(); + } + + public class ArrayList extends java.util.AbstractList implements java.lang.Cloneable java.util.RandomAccess java.io.Serializable { + ctor public ArrayList(int); + ctor public ArrayList(); + ctor public ArrayList(java.util.Collection); + method public java.lang.Object clone(); + method public void ensureCapacity(int); + method public E get(int); + method public int size(); + method public void trimToSize(); + } + + public class Arrays { + method public static java.util.List asList(T...); + method public static int binarySearch(byte[], byte); + method public static int binarySearch(byte[], int, int, byte); + method public static int binarySearch(char[], char); + method public static int binarySearch(char[], int, int, char); + method public static int binarySearch(double[], double); + method public static int binarySearch(double[], int, int, double); + method public static int binarySearch(float[], float); + method public static int binarySearch(float[], int, int, float); + method public static int binarySearch(int[], int); + method public static int binarySearch(int[], int, int, int); + method public static int binarySearch(long[], long); + method public static int binarySearch(long[], int, int, long); + method public static int binarySearch(java.lang.Object[], java.lang.Object); + method public static int binarySearch(java.lang.Object[], int, int, java.lang.Object); + method public static int binarySearch(T[], T, java.util.Comparator); + method public static int binarySearch(T[], int, int, T, java.util.Comparator); + method public static int binarySearch(short[], short); + method public static int binarySearch(short[], int, int, short); + method public static boolean[] copyOf(boolean[], int); + method public static byte[] copyOf(byte[], int); + method public static char[] copyOf(char[], int); + method public static double[] copyOf(double[], int); + method public static float[] copyOf(float[], int); + method public static int[] copyOf(int[], int); + method public static long[] copyOf(long[], int); + method public static short[] copyOf(short[], int); + method public static T[] copyOf(T[], int); + method public static T[] copyOf(U[], int, java.lang.Class); + method public static boolean[] copyOfRange(boolean[], int, int); + method public static byte[] copyOfRange(byte[], int, int); + method public static char[] copyOfRange(char[], int, int); + method public static double[] copyOfRange(double[], int, int); + method public static float[] copyOfRange(float[], int, int); + method public static int[] copyOfRange(int[], int, int); + method public static long[] copyOfRange(long[], int, int); + method public static short[] copyOfRange(short[], int, int); + method public static T[] copyOfRange(T[], int, int); + method public static T[] copyOfRange(U[], int, int, java.lang.Class); + method public static boolean deepEquals(java.lang.Object[], java.lang.Object[]); + method public static int deepHashCode(java.lang.Object[]); + method public static java.lang.String deepToString(java.lang.Object[]); + method public static boolean equals(byte[], byte[]); + method public static boolean equals(short[], short[]); + method public static boolean equals(char[], char[]); + method public static boolean equals(int[], int[]); + method public static boolean equals(long[], long[]); + method public static boolean equals(float[], float[]); + method public static boolean equals(double[], double[]); + method public static boolean equals(boolean[], boolean[]); + method public static boolean equals(java.lang.Object[], java.lang.Object[]); + method public static void fill(byte[], byte); + method public static void fill(byte[], int, int, byte); + method public static void fill(short[], short); + method public static void fill(short[], int, int, short); + method public static void fill(char[], char); + method public static void fill(char[], int, int, char); + method public static void fill(int[], int); + method public static void fill(int[], int, int, int); + method public static void fill(long[], long); + method public static void fill(long[], int, int, long); + method public static void fill(float[], float); + method public static void fill(float[], int, int, float); + method public static void fill(double[], double); + method public static void fill(double[], int, int, double); + method public static void fill(boolean[], boolean); + method public static void fill(boolean[], int, int, boolean); + method public static void fill(java.lang.Object[], java.lang.Object); + method public static void fill(java.lang.Object[], int, int, java.lang.Object); + method public static int hashCode(boolean[]); + method public static int hashCode(int[]); + method public static int hashCode(short[]); + method public static int hashCode(char[]); + method public static int hashCode(byte[]); + method public static int hashCode(long[]); + method public static int hashCode(float[]); + method public static int hashCode(double[]); + method public static int hashCode(java.lang.Object[]); + method public static void sort(byte[]); + method public static void sort(byte[], int, int); + method public static void sort(char[]); + method public static void sort(char[], int, int); + method public static void sort(double[]); + method public static void sort(double[], int, int); + method public static void sort(float[]); + method public static void sort(float[], int, int); + method public static void sort(int[]); + method public static void sort(int[], int, int); + method public static void sort(long[]); + method public static void sort(long[], int, int); + method public static void sort(short[]); + method public static void sort(short[], int, int); + method public static void sort(java.lang.Object[]); + method public static void sort(java.lang.Object[], int, int); + method public static void sort(T[], int, int, java.util.Comparator); + method public static void sort(T[], java.util.Comparator); + method public static java.lang.String toString(boolean[]); + method public static java.lang.String toString(byte[]); + method public static java.lang.String toString(char[]); + method public static java.lang.String toString(double[]); + method public static java.lang.String toString(float[]); + method public static java.lang.String toString(int[]); + method public static java.lang.String toString(long[]); + method public static java.lang.String toString(short[]); + method public static java.lang.String toString(java.lang.Object[]); + } + + public class BitSet implements java.lang.Cloneable java.io.Serializable { + ctor public BitSet(); + ctor public BitSet(int); + method public void and(java.util.BitSet); + method public void andNot(java.util.BitSet); + method public int cardinality(); + method public void clear(int); + method public void clear(); + method public void clear(int, int); + method public java.lang.Object clone(); + method public void flip(int); + method public void flip(int, int); + method public boolean get(int); + method public java.util.BitSet get(int, int); + method public boolean intersects(java.util.BitSet); + method public boolean isEmpty(); + method public int length(); + method public int nextClearBit(int); + method public int nextSetBit(int); + method public void or(java.util.BitSet); + method public void set(int); + method public void set(int, boolean); + method public void set(int, int, boolean); + method public void set(int, int); + method public int size(); + method public void xor(java.util.BitSet); + } + + public abstract class Calendar implements java.lang.Cloneable java.lang.Comparable java.io.Serializable { + ctor protected Calendar(); + ctor protected Calendar(java.util.TimeZone, java.util.Locale); + method public abstract void add(int, int); + method public boolean after(java.lang.Object); + method public boolean before(java.lang.Object); + method public final void clear(); + method public final void clear(int); + method public java.lang.Object clone(); + method public int compareTo(java.util.Calendar); + method protected void complete(); + method protected abstract void computeFields(); + method protected abstract void computeTime(); + method public int get(int); + method public int getActualMaximum(int); + method public int getActualMinimum(int); + method public static synchronized java.util.Locale[] getAvailableLocales(); + method public java.lang.String getDisplayName(int, int, java.util.Locale); + method public java.util.Map getDisplayNames(int, int, java.util.Locale); + method public int getFirstDayOfWeek(); + method public abstract int getGreatestMinimum(int); + method public static synchronized java.util.Calendar getInstance(); + method public static synchronized java.util.Calendar getInstance(java.util.Locale); + method public static synchronized java.util.Calendar getInstance(java.util.TimeZone); + method public static synchronized java.util.Calendar getInstance(java.util.TimeZone, java.util.Locale); + method public abstract int getLeastMaximum(int); + method public abstract int getMaximum(int); + method public int getMinimalDaysInFirstWeek(); + method public abstract int getMinimum(int); + method public final java.util.Date getTime(); + method public long getTimeInMillis(); + method public java.util.TimeZone getTimeZone(); + method protected final int internalGet(int); + method public boolean isLenient(); + method public final boolean isSet(int); + method public void roll(int, int); + method public abstract void roll(int, boolean); + method public void set(int, int); + method public final void set(int, int, int); + method public final void set(int, int, int, int, int); + method public final void set(int, int, int, int, int, int); + method public void setFirstDayOfWeek(int); + method public void setLenient(boolean); + method public void setMinimalDaysInFirstWeek(int); + method public final void setTime(java.util.Date); + method public void setTimeInMillis(long); + method public void setTimeZone(java.util.TimeZone); + field public static final int ALL_STYLES = 0; // 0x0 + field public static final int AM = 0; // 0x0 + field public static final int AM_PM = 9; // 0x9 + field public static final int APRIL = 3; // 0x3 + field public static final int AUGUST = 7; // 0x7 + field public static final int DATE = 5; // 0x5 + field public static final int DAY_OF_MONTH = 5; // 0x5 + field public static final int DAY_OF_WEEK = 7; // 0x7 + field public static final int DAY_OF_WEEK_IN_MONTH = 8; // 0x8 + field public static final int DAY_OF_YEAR = 6; // 0x6 + field public static final int DECEMBER = 11; // 0xb + field public static final int DST_OFFSET = 16; // 0x10 + field public static final int ERA = 0; // 0x0 + field public static final int FEBRUARY = 1; // 0x1 + field public static final int FIELD_COUNT = 17; // 0x11 + field public static final int FRIDAY = 6; // 0x6 + field public static final int HOUR = 10; // 0xa + field public static final int HOUR_OF_DAY = 11; // 0xb + field public static final int JANUARY = 0; // 0x0 + field public static final int JULY = 6; // 0x6 + field public static final int JUNE = 5; // 0x5 + field public static final int LONG = 2; // 0x2 + field public static final int MARCH = 2; // 0x2 + field public static final int MAY = 4; // 0x4 + field public static final int MILLISECOND = 14; // 0xe + field public static final int MINUTE = 12; // 0xc + field public static final int MONDAY = 2; // 0x2 + field public static final int MONTH = 2; // 0x2 + field public static final int NOVEMBER = 10; // 0xa + field public static final int OCTOBER = 9; // 0x9 + field public static final int PM = 1; // 0x1 + field public static final int SATURDAY = 7; // 0x7 + field public static final int SECOND = 13; // 0xd + field public static final int SEPTEMBER = 8; // 0x8 + field public static final int SHORT = 1; // 0x1 + field public static final int SUNDAY = 1; // 0x1 + field public static final int THURSDAY = 5; // 0x5 + field public static final int TUESDAY = 3; // 0x3 + field public static final int UNDECIMBER = 12; // 0xc + field public static final int WEDNESDAY = 4; // 0x4 + field public static final int WEEK_OF_MONTH = 4; // 0x4 + field public static final int WEEK_OF_YEAR = 3; // 0x3 + field public static final int YEAR = 1; // 0x1 + field public static final int ZONE_OFFSET = 15; // 0xf + field protected boolean areFieldsSet; + field protected int[] fields; + field protected boolean[] isSet; + field protected boolean isTimeSet; + field protected long time; + } + + public abstract interface Collection implements java.lang.Iterable { + method public abstract boolean add(E); + method public abstract boolean addAll(java.util.Collection); + method public abstract void clear(); + method public abstract boolean contains(java.lang.Object); + method public abstract boolean containsAll(java.util.Collection); + method public abstract boolean equals(java.lang.Object); + method public abstract int hashCode(); + method public abstract boolean isEmpty(); + method public abstract java.util.Iterator iterator(); + method public abstract boolean remove(java.lang.Object); + method public abstract boolean removeAll(java.util.Collection); + method public abstract boolean retainAll(java.util.Collection); + method public abstract int size(); + method public abstract java.lang.Object[] toArray(); + method public abstract T[] toArray(T[]); + } + + public class Collections { + method public static boolean addAll(java.util.Collection, T...); + method public static java.util.Queue asLifoQueue(java.util.Deque); + method public static int binarySearch(java.util.List>, T); + method public static int binarySearch(java.util.List, T, java.util.Comparator); + method public static java.util.Collection checkedCollection(java.util.Collection, java.lang.Class); + method public static java.util.List checkedList(java.util.List, java.lang.Class); + method public static java.util.Map checkedMap(java.util.Map, java.lang.Class, java.lang.Class); + method public static java.util.Set checkedSet(java.util.Set, java.lang.Class); + method public static java.util.SortedMap checkedSortedMap(java.util.SortedMap, java.lang.Class, java.lang.Class); + method public static java.util.SortedSet checkedSortedSet(java.util.SortedSet, java.lang.Class); + method public static void copy(java.util.List, java.util.List); + method public static boolean disjoint(java.util.Collection, java.util.Collection); + method public static final java.util.List emptyList(); + method public static final java.util.Map emptyMap(); + method public static final java.util.Set emptySet(); + method public static java.util.Enumeration enumeration(java.util.Collection); + method public static void fill(java.util.List, T); + method public static int frequency(java.util.Collection, java.lang.Object); + method public static int indexOfSubList(java.util.List, java.util.List); + method public static int lastIndexOfSubList(java.util.List, java.util.List); + method public static java.util.ArrayList list(java.util.Enumeration); + method public static T max(java.util.Collection); + method public static T max(java.util.Collection, java.util.Comparator); + method public static T min(java.util.Collection); + method public static T min(java.util.Collection, java.util.Comparator); + method public static java.util.List nCopies(int, T); + method public static java.util.Set newSetFromMap(java.util.Map); + method public static boolean replaceAll(java.util.List, T, T); + method public static void reverse(java.util.List); + method public static java.util.Comparator reverseOrder(); + method public static java.util.Comparator reverseOrder(java.util.Comparator); + method public static void rotate(java.util.List, int); + method public static void shuffle(java.util.List); + method public static void shuffle(java.util.List, java.util.Random); + method public static java.util.Set singleton(E); + method public static java.util.List singletonList(E); + method public static java.util.Map singletonMap(K, V); + method public static void sort(java.util.List); + method public static void sort(java.util.List, java.util.Comparator); + method public static void swap(java.util.List, int, int); + method public static java.util.Collection synchronizedCollection(java.util.Collection); + method public static java.util.List synchronizedList(java.util.List); + method public static java.util.Map synchronizedMap(java.util.Map); + method public static java.util.Set synchronizedSet(java.util.Set); + method public static java.util.SortedMap synchronizedSortedMap(java.util.SortedMap); + method public static java.util.SortedSet synchronizedSortedSet(java.util.SortedSet); + method public static java.util.Collection unmodifiableCollection(java.util.Collection); + method public static java.util.List unmodifiableList(java.util.List); + method public static java.util.Map unmodifiableMap(java.util.Map); + method public static java.util.Set unmodifiableSet(java.util.Set); + method public static java.util.SortedMap unmodifiableSortedMap(java.util.SortedMap); + method public static java.util.SortedSet unmodifiableSortedSet(java.util.SortedSet); + field public static final java.util.List EMPTY_LIST; + field public static final java.util.Map EMPTY_MAP; + field public static final java.util.Set EMPTY_SET; + } + + public abstract interface Comparator { + method public abstract int compare(T, T); + method public abstract boolean equals(java.lang.Object); + } + + public class ConcurrentModificationException extends java.lang.RuntimeException { + ctor public ConcurrentModificationException(); + ctor public ConcurrentModificationException(java.lang.String); + } + + public final class Currency implements java.io.Serializable { + method public java.lang.String getCurrencyCode(); + method public int getDefaultFractionDigits(); + method public static java.util.Currency getInstance(java.lang.String); + method public static java.util.Currency getInstance(java.util.Locale); + method public java.lang.String getSymbol(); + method public java.lang.String getSymbol(java.util.Locale); + } + + public class Date implements java.lang.Cloneable java.lang.Comparable java.io.Serializable { + ctor public Date(); + ctor public deprecated Date(int, int, int); + ctor public deprecated Date(int, int, int, int, int); + ctor public deprecated Date(int, int, int, int, int, int); + ctor public Date(long); + ctor public deprecated Date(java.lang.String); + method public static deprecated long UTC(int, int, int, int, int, int); + method public boolean after(java.util.Date); + method public boolean before(java.util.Date); + method public java.lang.Object clone(); + method public int compareTo(java.util.Date); + method public deprecated int getDate(); + method public deprecated int getDay(); + method public deprecated int getHours(); + method public deprecated int getMinutes(); + method public deprecated int getMonth(); + method public deprecated int getSeconds(); + method public long getTime(); + method public deprecated int getTimezoneOffset(); + method public deprecated int getYear(); + method public static deprecated long parse(java.lang.String); + method public deprecated void setDate(int); + method public deprecated void setHours(int); + method public deprecated void setMinutes(int); + method public deprecated void setMonth(int); + method public deprecated void setSeconds(int); + method public void setTime(long); + method public deprecated void setYear(int); + method public deprecated java.lang.String toGMTString(); + method public deprecated java.lang.String toLocaleString(); + } + + public abstract interface Deque implements java.util.Queue { + method public abstract boolean add(E); + method public abstract void addFirst(E); + method public abstract void addLast(E); + method public abstract boolean contains(java.lang.Object); + method public abstract java.util.Iterator descendingIterator(); + method public abstract E element(); + method public abstract E getFirst(); + method public abstract E getLast(); + method public abstract java.util.Iterator iterator(); + method public abstract boolean offer(E); + method public abstract boolean offerFirst(E); + method public abstract boolean offerLast(E); + method public abstract E peek(); + method public abstract E peekFirst(); + method public abstract E peekLast(); + method public abstract E poll(); + method public abstract E pollFirst(); + method public abstract E pollLast(); + method public abstract E pop(); + method public abstract void push(E); + method public abstract E remove(); + method public abstract boolean remove(java.lang.Object); + method public abstract E removeFirst(); + method public abstract boolean removeFirstOccurrence(java.lang.Object); + method public abstract E removeLast(); + method public abstract boolean removeLastOccurrence(java.lang.Object); + method public abstract int size(); + } + + public abstract class Dictionary { + ctor public Dictionary(); + method public abstract java.util.Enumeration elements(); + method public abstract V get(java.lang.Object); + method public abstract boolean isEmpty(); + method public abstract java.util.Enumeration keys(); + method public abstract V put(K, V); + method public abstract V remove(java.lang.Object); + method public abstract int size(); + } + + public class DuplicateFormatFlagsException extends java.util.IllegalFormatException { + ctor public DuplicateFormatFlagsException(java.lang.String); + method public java.lang.String getFlags(); + } + + public class EmptyStackException extends java.lang.RuntimeException { + ctor public EmptyStackException(); + } + + public class EnumMap extends java.util.AbstractMap implements java.lang.Cloneable java.util.Map java.io.Serializable { + ctor public EnumMap(java.lang.Class); + ctor public EnumMap(java.util.EnumMap); + ctor public EnumMap(java.util.Map); + method public java.util.EnumMap clone(); + method public java.util.Set> entrySet(); + } + + public abstract class EnumSet extends java.util.AbstractSet implements java.lang.Cloneable java.io.Serializable { + method public static java.util.EnumSet allOf(java.lang.Class); + method public java.util.EnumSet clone(); + method public static java.util.EnumSet complementOf(java.util.EnumSet); + method public static java.util.EnumSet copyOf(java.util.EnumSet); + method public static java.util.EnumSet copyOf(java.util.Collection); + method public static java.util.EnumSet noneOf(java.lang.Class); + method public static java.util.EnumSet of(E); + method public static java.util.EnumSet of(E, E); + method public static java.util.EnumSet of(E, E, E); + method public static java.util.EnumSet of(E, E, E, E); + method public static java.util.EnumSet of(E, E, E, E, E); + method public static java.util.EnumSet of(E, E...); + method public static java.util.EnumSet range(E, E); + } + + public abstract interface Enumeration { + method public abstract boolean hasMoreElements(); + method public abstract E nextElement(); + } + + public abstract interface EventListener { + } + + public abstract class EventListenerProxy implements java.util.EventListener { + ctor public EventListenerProxy(java.util.EventListener); + method public java.util.EventListener getListener(); + } + + public class EventObject implements java.io.Serializable { + ctor public EventObject(java.lang.Object); + method public java.lang.Object getSource(); + field protected transient java.lang.Object source; + } + + public class FormatFlagsConversionMismatchException extends java.util.IllegalFormatException implements java.io.Serializable { + ctor public FormatFlagsConversionMismatchException(java.lang.String, char); + method public char getConversion(); + method public java.lang.String getFlags(); + } + + public abstract interface Formattable { + method public abstract void formatTo(java.util.Formatter, int, int, int) throws java.util.IllegalFormatException; + } + + public class FormattableFlags { + field public static final int ALTERNATE = 4; // 0x4 + field public static final int LEFT_JUSTIFY = 1; // 0x1 + field public static final int UPPERCASE = 2; // 0x2 + } + + public final class Formatter implements java.io.Closeable java.io.Flushable { + ctor public Formatter(); + ctor public Formatter(java.lang.Appendable); + ctor public Formatter(java.util.Locale); + ctor public Formatter(java.lang.Appendable, java.util.Locale); + ctor public Formatter(java.lang.String) throws java.io.FileNotFoundException; + ctor public Formatter(java.lang.String, java.lang.String) throws java.io.FileNotFoundException, java.io.UnsupportedEncodingException; + ctor public Formatter(java.lang.String, java.lang.String, java.util.Locale) throws java.io.FileNotFoundException, java.io.UnsupportedEncodingException; + ctor public Formatter(java.io.File) throws java.io.FileNotFoundException; + ctor public Formatter(java.io.File, java.lang.String) throws java.io.FileNotFoundException, java.io.UnsupportedEncodingException; + ctor public Formatter(java.io.File, java.lang.String, java.util.Locale) throws java.io.FileNotFoundException, java.io.UnsupportedEncodingException; + ctor public Formatter(java.io.OutputStream); + ctor public Formatter(java.io.OutputStream, java.lang.String) throws java.io.UnsupportedEncodingException; + ctor public Formatter(java.io.OutputStream, java.lang.String, java.util.Locale) throws java.io.UnsupportedEncodingException; + ctor public Formatter(java.io.PrintStream); + method public void close(); + method public void flush(); + method public java.util.Formatter format(java.lang.String, java.lang.Object...); + method public java.util.Formatter format(java.util.Locale, java.lang.String, java.lang.Object...); + method public java.io.IOException ioException(); + method public java.util.Locale locale(); + method public java.lang.Appendable out(); + } + + public static final class Formatter.BigDecimalLayoutForm extends java.lang.Enum { + method public static java.util.Formatter.BigDecimalLayoutForm valueOf(java.lang.String); + method public static final java.util.Formatter.BigDecimalLayoutForm[] values(); + enum_constant public static final java.util.Formatter.BigDecimalLayoutForm DECIMAL_FLOAT; + enum_constant public static final java.util.Formatter.BigDecimalLayoutForm SCIENTIFIC; + } + + public class FormatterClosedException extends java.lang.IllegalStateException implements java.io.Serializable { + ctor public FormatterClosedException(); + } + + public class GregorianCalendar extends java.util.Calendar { + ctor public GregorianCalendar(); + ctor public GregorianCalendar(int, int, int); + ctor public GregorianCalendar(int, int, int, int, int); + ctor public GregorianCalendar(int, int, int, int, int, int); + ctor public GregorianCalendar(java.util.Locale); + ctor public GregorianCalendar(java.util.TimeZone); + ctor public GregorianCalendar(java.util.TimeZone, java.util.Locale); + method public void add(int, int); + method protected void computeFields(); + method protected void computeTime(); + method public int getGreatestMinimum(int); + method public final java.util.Date getGregorianChange(); + method public int getLeastMaximum(int); + method public int getMaximum(int); + method public int getMinimum(int); + method public boolean isLeapYear(int); + method public void roll(int, boolean); + method public void setGregorianChange(java.util.Date); + field public static final int AD = 1; // 0x1 + field public static final int BC = 0; // 0x0 + } + + public class HashMap extends java.util.AbstractMap implements java.lang.Cloneable java.io.Serializable { + ctor public HashMap(); + ctor public HashMap(int); + ctor public HashMap(int, float); + ctor public HashMap(java.util.Map); + method public java.lang.Object clone(); + method public java.util.Set> entrySet(); + } + + public class HashSet extends java.util.AbstractSet implements java.lang.Cloneable java.io.Serializable java.util.Set { + ctor public HashSet(); + ctor public HashSet(int); + ctor public HashSet(int, float); + ctor public HashSet(java.util.Collection); + method public java.lang.Object clone(); + method public java.util.Iterator iterator(); + method public int size(); + } + + public class Hashtable extends java.util.Dictionary implements java.lang.Cloneable java.util.Map java.io.Serializable { + ctor public Hashtable(); + ctor public Hashtable(int); + ctor public Hashtable(int, float); + ctor public Hashtable(java.util.Map); + method public synchronized void clear(); + method public synchronized java.lang.Object clone(); + method public boolean contains(java.lang.Object); + method public synchronized boolean containsKey(java.lang.Object); + method public synchronized boolean containsValue(java.lang.Object); + method public synchronized java.util.Enumeration elements(); + method public synchronized java.util.Set> entrySet(); + method public synchronized V get(java.lang.Object); + method public synchronized boolean isEmpty(); + method public synchronized java.util.Set keySet(); + method public synchronized java.util.Enumeration keys(); + method public synchronized V put(K, V); + method public synchronized void putAll(java.util.Map); + method protected void rehash(); + method public synchronized V remove(java.lang.Object); + method public synchronized int size(); + method public synchronized java.util.Collection values(); + } + + public class IdentityHashMap extends java.util.AbstractMap implements java.lang.Cloneable java.util.Map java.io.Serializable { + ctor public IdentityHashMap(); + ctor public IdentityHashMap(int); + ctor public IdentityHashMap(java.util.Map); + method public java.lang.Object clone(); + method public java.util.Set> entrySet(); + } + + public class IllegalFormatCodePointException extends java.util.IllegalFormatException implements java.io.Serializable { + ctor public IllegalFormatCodePointException(int); + method public int getCodePoint(); + } + + public class IllegalFormatConversionException extends java.util.IllegalFormatException implements java.io.Serializable { + ctor public IllegalFormatConversionException(char, java.lang.Class); + method public java.lang.Class getArgumentClass(); + method public char getConversion(); + } + + public class IllegalFormatException extends java.lang.IllegalArgumentException implements java.io.Serializable { + } + + public class IllegalFormatFlagsException extends java.util.IllegalFormatException implements java.io.Serializable { + ctor public IllegalFormatFlagsException(java.lang.String); + method public java.lang.String getFlags(); + } + + public class IllegalFormatPrecisionException extends java.util.IllegalFormatException { + ctor public IllegalFormatPrecisionException(int); + method public int getPrecision(); + } + + public class IllegalFormatWidthException extends java.util.IllegalFormatException { + ctor public IllegalFormatWidthException(int); + method public int getWidth(); + } + + public class InputMismatchException extends java.util.NoSuchElementException implements java.io.Serializable { + ctor public InputMismatchException(); + ctor public InputMismatchException(java.lang.String); + } + + public class InvalidPropertiesFormatException extends java.io.IOException { + ctor public InvalidPropertiesFormatException(java.lang.String); + ctor public InvalidPropertiesFormatException(java.lang.Throwable); + } + + public abstract interface Iterator { + method public abstract boolean hasNext(); + method public abstract E next(); + method public abstract void remove(); + } + + public class LinkedHashMap extends java.util.HashMap { + ctor public LinkedHashMap(); + ctor public LinkedHashMap(int); + ctor public LinkedHashMap(int, float); + ctor public LinkedHashMap(int, float, boolean); + ctor public LinkedHashMap(java.util.Map); + method protected boolean removeEldestEntry(java.util.Map.Entry); + } + + public class LinkedHashSet extends java.util.HashSet implements java.lang.Cloneable java.io.Serializable java.util.Set { + ctor public LinkedHashSet(); + ctor public LinkedHashSet(int); + ctor public LinkedHashSet(int, float); + ctor public LinkedHashSet(java.util.Collection); + } + + public class LinkedList extends java.util.AbstractSequentialList implements java.lang.Cloneable java.util.Deque java.util.List java.util.Queue java.io.Serializable { + ctor public LinkedList(); + ctor public LinkedList(java.util.Collection); + method public void addFirst(E); + method public void addLast(E); + method public java.lang.Object clone(); + method public java.util.Iterator descendingIterator(); + method public E element(); + method public E getFirst(); + method public E getLast(); + method public java.util.ListIterator listIterator(int); + method public boolean offer(E); + method public boolean offerFirst(E); + method public boolean offerLast(E); + method public E peek(); + method public E peekFirst(); + method public E peekLast(); + method public E poll(); + method public E pollFirst(); + method public E pollLast(); + method public E pop(); + method public void push(E); + method public E remove(); + method public E removeFirst(); + method public boolean removeFirstOccurrence(java.lang.Object); + method public E removeLast(); + method public boolean removeLastOccurrence(java.lang.Object); + method public int size(); + } + + public abstract interface List implements java.util.Collection { + method public abstract void add(int, E); + method public abstract boolean add(E); + method public abstract boolean addAll(int, java.util.Collection); + method public abstract boolean addAll(java.util.Collection); + method public abstract void clear(); + method public abstract boolean contains(java.lang.Object); + method public abstract boolean containsAll(java.util.Collection); + method public abstract boolean equals(java.lang.Object); + method public abstract E get(int); + method public abstract int hashCode(); + method public abstract int indexOf(java.lang.Object); + method public abstract boolean isEmpty(); + method public abstract java.util.Iterator iterator(); + method public abstract int lastIndexOf(java.lang.Object); + method public abstract java.util.ListIterator listIterator(); + method public abstract java.util.ListIterator listIterator(int); + method public abstract E remove(int); + method public abstract boolean remove(java.lang.Object); + method public abstract boolean removeAll(java.util.Collection); + method public abstract boolean retainAll(java.util.Collection); + method public abstract E set(int, E); + method public abstract int size(); + method public abstract java.util.List subList(int, int); + method public abstract java.lang.Object[] toArray(); + method public abstract T[] toArray(T[]); + } + + public abstract interface ListIterator implements java.util.Iterator { + method public abstract void add(E); + method public abstract boolean hasNext(); + method public abstract boolean hasPrevious(); + method public abstract E next(); + method public abstract int nextIndex(); + method public abstract E previous(); + method public abstract int previousIndex(); + method public abstract void remove(); + method public abstract void set(E); + } + + public abstract class ListResourceBundle extends java.util.ResourceBundle { + ctor public ListResourceBundle(); + method protected abstract java.lang.Object[][] getContents(); + method public java.util.Enumeration getKeys(); + method public final java.lang.Object handleGetObject(java.lang.String); + } + + public final class Locale implements java.lang.Cloneable java.io.Serializable { + ctor public Locale(java.lang.String); + ctor public Locale(java.lang.String, java.lang.String); + ctor public Locale(java.lang.String, java.lang.String, java.lang.String); + method public java.lang.Object clone(); + method public static java.util.Locale[] getAvailableLocales(); + method public java.lang.String getCountry(); + method public static java.util.Locale getDefault(); + method public final java.lang.String getDisplayCountry(); + method public java.lang.String getDisplayCountry(java.util.Locale); + method public final java.lang.String getDisplayLanguage(); + method public java.lang.String getDisplayLanguage(java.util.Locale); + method public final java.lang.String getDisplayName(); + method public java.lang.String getDisplayName(java.util.Locale); + method public final java.lang.String getDisplayVariant(); + method public java.lang.String getDisplayVariant(java.util.Locale); + method public java.lang.String getISO3Country(); + method public java.lang.String getISO3Language(); + method public static java.lang.String[] getISOCountries(); + method public static java.lang.String[] getISOLanguages(); + method public java.lang.String getLanguage(); + method public java.lang.String getVariant(); + method public static synchronized void setDefault(java.util.Locale); + method public final java.lang.String toString(); + field public static final java.util.Locale CANADA; + field public static final java.util.Locale CANADA_FRENCH; + field public static final java.util.Locale CHINA; + field public static final java.util.Locale CHINESE; + field public static final java.util.Locale ENGLISH; + field public static final java.util.Locale FRANCE; + field public static final java.util.Locale FRENCH; + field public static final java.util.Locale GERMAN; + field public static final java.util.Locale GERMANY; + field public static final java.util.Locale ITALIAN; + field public static final java.util.Locale ITALY; + field public static final java.util.Locale JAPAN; + field public static final java.util.Locale JAPANESE; + field public static final java.util.Locale KOREA; + field public static final java.util.Locale KOREAN; + field public static final java.util.Locale PRC; + field public static final java.util.Locale ROOT; + field public static final java.util.Locale SIMPLIFIED_CHINESE; + field public static final java.util.Locale TAIWAN; + field public static final java.util.Locale TRADITIONAL_CHINESE; + field public static final java.util.Locale UK; + field public static final java.util.Locale US; + } + + public abstract interface Map { + method public abstract void clear(); + method public abstract boolean containsKey(java.lang.Object); + method public abstract boolean containsValue(java.lang.Object); + method public abstract java.util.Set> entrySet(); + method public abstract boolean equals(java.lang.Object); + method public abstract V get(java.lang.Object); + method public abstract int hashCode(); + method public abstract boolean isEmpty(); + method public abstract java.util.Set keySet(); + method public abstract V put(K, V); + method public abstract void putAll(java.util.Map); + method public abstract V remove(java.lang.Object); + method public abstract int size(); + method public abstract java.util.Collection values(); + } + + public static abstract interface Map.Entry { + method public abstract boolean equals(java.lang.Object); + method public abstract K getKey(); + method public abstract V getValue(); + method public abstract int hashCode(); + method public abstract V setValue(V); + } + + public class MissingFormatArgumentException extends java.util.IllegalFormatException { + ctor public MissingFormatArgumentException(java.lang.String); + method public java.lang.String getFormatSpecifier(); + } + + public class MissingFormatWidthException extends java.util.IllegalFormatException { + ctor public MissingFormatWidthException(java.lang.String); + method public java.lang.String getFormatSpecifier(); + } + + public class MissingResourceException extends java.lang.RuntimeException { + ctor public MissingResourceException(java.lang.String, java.lang.String, java.lang.String); + method public java.lang.String getClassName(); + method public java.lang.String getKey(); + } + + public abstract interface NavigableMap implements java.util.SortedMap { + method public abstract java.util.Map.Entry ceilingEntry(K); + method public abstract K ceilingKey(K); + method public abstract java.util.NavigableSet descendingKeySet(); + method public abstract java.util.NavigableMap descendingMap(); + method public abstract java.util.Map.Entry firstEntry(); + method public abstract java.util.Map.Entry floorEntry(K); + method public abstract K floorKey(K); + method public abstract java.util.NavigableMap headMap(K, boolean); + method public abstract java.util.SortedMap headMap(K); + method public abstract java.util.Map.Entry higherEntry(K); + method public abstract K higherKey(K); + method public abstract java.util.Map.Entry lastEntry(); + method public abstract java.util.Map.Entry lowerEntry(K); + method public abstract K lowerKey(K); + method public abstract java.util.NavigableSet navigableKeySet(); + method public abstract java.util.Map.Entry pollFirstEntry(); + method public abstract java.util.Map.Entry pollLastEntry(); + method public abstract java.util.NavigableMap subMap(K, boolean, K, boolean); + method public abstract java.util.SortedMap subMap(K, K); + method public abstract java.util.NavigableMap tailMap(K, boolean); + method public abstract java.util.SortedMap tailMap(K); + } + + public abstract interface NavigableSet implements java.util.SortedSet { + method public abstract E ceiling(E); + method public abstract java.util.Iterator descendingIterator(); + method public abstract java.util.NavigableSet descendingSet(); + method public abstract E floor(E); + method public abstract java.util.NavigableSet headSet(E, boolean); + method public abstract java.util.SortedSet headSet(E); + method public abstract E higher(E); + method public abstract java.util.Iterator iterator(); + method public abstract E lower(E); + method public abstract E pollFirst(); + method public abstract E pollLast(); + method public abstract java.util.NavigableSet subSet(E, boolean, E, boolean); + method public abstract java.util.SortedSet subSet(E, E); + method public abstract java.util.NavigableSet tailSet(E, boolean); + method public abstract java.util.SortedSet tailSet(E); + } + + public class NoSuchElementException extends java.lang.RuntimeException { + ctor public NoSuchElementException(); + ctor public NoSuchElementException(java.lang.String); + } + + public class Observable { + ctor public Observable(); + method public void addObserver(java.util.Observer); + method protected void clearChanged(); + method public int countObservers(); + method public synchronized void deleteObserver(java.util.Observer); + method public synchronized void deleteObservers(); + method public boolean hasChanged(); + method public void notifyObservers(); + method public void notifyObservers(java.lang.Object); + method protected void setChanged(); + } + + public abstract interface Observer { + method public abstract void update(java.util.Observable, java.lang.Object); + } + + public class PriorityQueue extends java.util.AbstractQueue implements java.io.Serializable { + ctor public PriorityQueue(); + ctor public PriorityQueue(int); + ctor public PriorityQueue(int, java.util.Comparator); + ctor public PriorityQueue(java.util.Collection); + ctor public PriorityQueue(java.util.PriorityQueue); + ctor public PriorityQueue(java.util.SortedSet); + method public java.util.Comparator comparator(); + method public java.util.Iterator iterator(); + method public boolean offer(E); + method public E peek(); + method public E poll(); + method public int size(); + } + + public class Properties extends java.util.Hashtable { + ctor public Properties(); + ctor public Properties(java.util.Properties); + method public java.lang.String getProperty(java.lang.String); + method public java.lang.String getProperty(java.lang.String, java.lang.String); + method public void list(java.io.PrintStream); + method public void list(java.io.PrintWriter); + method public synchronized void load(java.io.InputStream) throws java.io.IOException; + method public synchronized void load(java.io.Reader) throws java.io.IOException; + method public synchronized void loadFromXML(java.io.InputStream) throws java.io.IOException, java.util.InvalidPropertiesFormatException; + method public java.util.Enumeration propertyNames(); + method public deprecated void save(java.io.OutputStream, java.lang.String); + method public java.lang.Object setProperty(java.lang.String, java.lang.String); + method public synchronized void store(java.io.OutputStream, java.lang.String) throws java.io.IOException; + method public synchronized void store(java.io.Writer, java.lang.String) throws java.io.IOException; + method public void storeToXML(java.io.OutputStream, java.lang.String) throws java.io.IOException; + method public synchronized void storeToXML(java.io.OutputStream, java.lang.String, java.lang.String) throws java.io.IOException; + method public java.util.Set stringPropertyNames(); + field protected java.util.Properties defaults; + } + + public final class PropertyPermission extends java.security.BasicPermission { + ctor public PropertyPermission(java.lang.String, java.lang.String); + } + + public class PropertyResourceBundle extends java.util.ResourceBundle { + ctor public PropertyResourceBundle(java.io.InputStream) throws java.io.IOException; + ctor public PropertyResourceBundle(java.io.Reader) throws java.io.IOException; + method public java.util.Enumeration getKeys(); + method public java.lang.Object handleGetObject(java.lang.String); + } + + public abstract interface Queue implements java.util.Collection { + method public abstract boolean add(E); + method public abstract E element(); + method public abstract boolean offer(E); + method public abstract E peek(); + method public abstract E poll(); + method public abstract E remove(); + } + + public class Random implements java.io.Serializable { + ctor public Random(); + ctor public Random(long); + method protected synchronized int next(int); + method public boolean nextBoolean(); + method public void nextBytes(byte[]); + method public double nextDouble(); + method public float nextFloat(); + method public synchronized double nextGaussian(); + method public int nextInt(); + method public int nextInt(int); + method public long nextLong(); + method public synchronized void setSeed(long); + } + + public abstract interface RandomAccess { + } + + public abstract class ResourceBundle { + ctor public ResourceBundle(); + method public static void clearCache(); + method public static void clearCache(java.lang.ClassLoader); + method public boolean containsKey(java.lang.String); + method public static java.util.ResourceBundle getBundle(java.lang.String) throws java.util.MissingResourceException; + method public static java.util.ResourceBundle getBundle(java.lang.String, java.util.Locale); + method public static java.util.ResourceBundle getBundle(java.lang.String, java.util.Locale, java.lang.ClassLoader) throws java.util.MissingResourceException; + method public static java.util.ResourceBundle getBundle(java.lang.String, java.util.ResourceBundle.Control); + method public static java.util.ResourceBundle getBundle(java.lang.String, java.util.Locale, java.util.ResourceBundle.Control); + method public static java.util.ResourceBundle getBundle(java.lang.String, java.util.Locale, java.lang.ClassLoader, java.util.ResourceBundle.Control); + method public abstract java.util.Enumeration getKeys(); + method public java.util.Locale getLocale(); + method public final java.lang.Object getObject(java.lang.String); + method public final java.lang.String getString(java.lang.String); + method public final java.lang.String[] getStringArray(java.lang.String); + method protected abstract java.lang.Object handleGetObject(java.lang.String); + method protected java.util.Set handleKeySet(); + method public java.util.Set keySet(); + method protected void setParent(java.util.ResourceBundle); + field protected java.util.ResourceBundle parent; + } + + public static class ResourceBundle.Control { + ctor protected ResourceBundle.Control(); + method public java.util.List getCandidateLocales(java.lang.String, java.util.Locale); + method public static java.util.ResourceBundle.Control getControl(java.util.List); + method public java.util.Locale getFallbackLocale(java.lang.String, java.util.Locale); + method public java.util.List getFormats(java.lang.String); + method public static java.util.ResourceBundle.Control getNoFallbackControl(java.util.List); + method public long getTimeToLive(java.lang.String, java.util.Locale); + method public boolean needsReload(java.lang.String, java.util.Locale, java.lang.String, java.lang.ClassLoader, java.util.ResourceBundle, long); + method public java.util.ResourceBundle newBundle(java.lang.String, java.util.Locale, java.lang.String, java.lang.ClassLoader, boolean) throws java.io.IOException, java.lang.IllegalAccessException, java.lang.InstantiationException; + method public java.lang.String toBundleName(java.lang.String, java.util.Locale); + method public final java.lang.String toResourceName(java.lang.String, java.lang.String); + field public static final java.util.List FORMAT_CLASS; + field public static final java.util.List FORMAT_DEFAULT; + field public static final java.util.List FORMAT_PROPERTIES; + field public static final long TTL_DONT_CACHE = -1L; // 0xffffffffffffffffL + field public static final long TTL_NO_EXPIRATION_CONTROL = -2L; // 0xfffffffffffffffeL + } + + public final class Scanner implements java.util.Iterator { + ctor public Scanner(java.io.File) throws java.io.FileNotFoundException; + ctor public Scanner(java.io.File, java.lang.String) throws java.io.FileNotFoundException; + ctor public Scanner(java.lang.String); + ctor public Scanner(java.io.InputStream); + ctor public Scanner(java.io.InputStream, java.lang.String); + ctor public Scanner(java.lang.Readable); + ctor public Scanner(java.nio.channels.ReadableByteChannel); + ctor public Scanner(java.nio.channels.ReadableByteChannel, java.lang.String); + method public void close(); + method public java.util.regex.Pattern delimiter(); + method public java.lang.String findInLine(java.util.regex.Pattern); + method public java.lang.String findInLine(java.lang.String); + method public java.lang.String findWithinHorizon(java.util.regex.Pattern, int); + method public java.lang.String findWithinHorizon(java.lang.String, int); + method public boolean hasNext(); + method public boolean hasNext(java.util.regex.Pattern); + method public boolean hasNext(java.lang.String); + method public boolean hasNextBigDecimal(); + method public boolean hasNextBigInteger(); + method public boolean hasNextBigInteger(int); + method public boolean hasNextBoolean(); + method public boolean hasNextByte(); + method public boolean hasNextByte(int); + method public boolean hasNextDouble(); + method public boolean hasNextFloat(); + method public boolean hasNextInt(); + method public boolean hasNextInt(int); + method public boolean hasNextLine(); + method public boolean hasNextLong(); + method public boolean hasNextLong(int); + method public boolean hasNextShort(); + method public boolean hasNextShort(int); + method public java.io.IOException ioException(); + method public java.util.Locale locale(); + method public java.util.regex.MatchResult match(); + method public java.lang.String next(); + method public java.lang.String next(java.util.regex.Pattern); + method public java.lang.String next(java.lang.String); + method public java.math.BigDecimal nextBigDecimal(); + method public java.math.BigInteger nextBigInteger(); + method public java.math.BigInteger nextBigInteger(int); + method public boolean nextBoolean(); + method public byte nextByte(); + method public byte nextByte(int); + method public double nextDouble(); + method public float nextFloat(); + method public int nextInt(); + method public int nextInt(int); + method public java.lang.String nextLine(); + method public long nextLong(); + method public long nextLong(int); + method public short nextShort(); + method public short nextShort(int); + method public int radix(); + method public void remove(); + method public java.util.Scanner reset(); + method public java.util.Scanner skip(java.util.regex.Pattern); + method public java.util.Scanner skip(java.lang.String); + method public java.util.Scanner useDelimiter(java.util.regex.Pattern); + method public java.util.Scanner useDelimiter(java.lang.String); + method public java.util.Scanner useLocale(java.util.Locale); + method public java.util.Scanner useRadix(int); + } + + public class ServiceConfigurationError extends java.lang.Error { + ctor public ServiceConfigurationError(java.lang.String); + ctor public ServiceConfigurationError(java.lang.String, java.lang.Throwable); + } + + public final class ServiceLoader implements java.lang.Iterable { + method public java.util.Iterator iterator(); + method public static java.util.ServiceLoader load(java.lang.Class, java.lang.ClassLoader); + method public static java.util.ServiceLoader load(java.lang.Class); + method public static java.util.ServiceLoader loadInstalled(java.lang.Class); + method public void reload(); + } + + public abstract interface Set implements java.util.Collection { + method public abstract boolean add(E); + method public abstract boolean addAll(java.util.Collection); + method public abstract void clear(); + method public abstract boolean contains(java.lang.Object); + method public abstract boolean containsAll(java.util.Collection); + method public abstract boolean equals(java.lang.Object); + method public abstract int hashCode(); + method public abstract boolean isEmpty(); + method public abstract java.util.Iterator iterator(); + method public abstract boolean remove(java.lang.Object); + method public abstract boolean removeAll(java.util.Collection); + method public abstract boolean retainAll(java.util.Collection); + method public abstract int size(); + method public abstract java.lang.Object[] toArray(); + method public abstract T[] toArray(T[]); + } + + public class SimpleTimeZone extends java.util.TimeZone { + ctor public SimpleTimeZone(int, java.lang.String); + ctor public SimpleTimeZone(int, java.lang.String, int, int, int, int, int, int, int, int); + ctor public SimpleTimeZone(int, java.lang.String, int, int, int, int, int, int, int, int, int); + ctor public SimpleTimeZone(int, java.lang.String, int, int, int, int, int, int, int, int, int, int, int); + method public int getOffset(int, int, int, int, int, int); + method public int getRawOffset(); + method public boolean inDaylightTime(java.util.Date); + method public void setDSTSavings(int); + method public void setEndRule(int, int, int); + method public void setEndRule(int, int, int, int); + method public void setEndRule(int, int, int, int, boolean); + method public void setRawOffset(int); + method public void setStartRule(int, int, int); + method public void setStartRule(int, int, int, int); + method public void setStartRule(int, int, int, int, boolean); + method public void setStartYear(int); + method public boolean useDaylightTime(); + field public static final int STANDARD_TIME = 1; // 0x1 + field public static final int UTC_TIME = 2; // 0x2 + field public static final int WALL_TIME = 0; // 0x0 + } + + public abstract interface SortedMap implements java.util.Map { + method public abstract java.util.Comparator comparator(); + method public abstract K firstKey(); + method public abstract java.util.SortedMap headMap(K); + method public abstract K lastKey(); + method public abstract java.util.SortedMap subMap(K, K); + method public abstract java.util.SortedMap tailMap(K); + } + + public abstract interface SortedSet implements java.util.Set { + method public abstract java.util.Comparator comparator(); + method public abstract E first(); + method public abstract java.util.SortedSet headSet(E); + method public abstract E last(); + method public abstract java.util.SortedSet subSet(E, E); + method public abstract java.util.SortedSet tailSet(E); + } + + public class Stack extends java.util.Vector { + ctor public Stack(); + method public boolean empty(); + method public synchronized E peek(); + method public synchronized E pop(); + method public E push(E); + method public synchronized int search(java.lang.Object); + } + + public class StringTokenizer implements java.util.Enumeration { + ctor public StringTokenizer(java.lang.String); + ctor public StringTokenizer(java.lang.String, java.lang.String); + ctor public StringTokenizer(java.lang.String, java.lang.String, boolean); + method public int countTokens(); + method public boolean hasMoreElements(); + method public boolean hasMoreTokens(); + method public java.lang.Object nextElement(); + method public java.lang.String nextToken(); + method public java.lang.String nextToken(java.lang.String); + } + + public abstract class TimeZone implements java.lang.Cloneable java.io.Serializable { + ctor public TimeZone(); + method public java.lang.Object clone(); + method public static synchronized java.lang.String[] getAvailableIDs(); + method public static synchronized java.lang.String[] getAvailableIDs(int); + method public int getDSTSavings(); + method public static synchronized java.util.TimeZone getDefault(); + method public final java.lang.String getDisplayName(); + method public final java.lang.String getDisplayName(java.util.Locale); + method public final java.lang.String getDisplayName(boolean, int); + method public java.lang.String getDisplayName(boolean, int, java.util.Locale); + method public java.lang.String getID(); + method public int getOffset(long); + method public abstract int getOffset(int, int, int, int, int, int); + method public abstract int getRawOffset(); + method public static synchronized java.util.TimeZone getTimeZone(java.lang.String); + method public boolean hasSameRules(java.util.TimeZone); + method public abstract boolean inDaylightTime(java.util.Date); + method public static synchronized void setDefault(java.util.TimeZone); + method public void setID(java.lang.String); + method public abstract void setRawOffset(int); + method public abstract boolean useDaylightTime(); + field public static final int LONG = 1; // 0x1 + field public static final int SHORT = 0; // 0x0 + } + + public class Timer { + ctor public Timer(java.lang.String, boolean); + ctor public Timer(java.lang.String); + ctor public Timer(boolean); + ctor public Timer(); + method public void cancel(); + method public int purge(); + method public void schedule(java.util.TimerTask, java.util.Date); + method public void schedule(java.util.TimerTask, long); + method public void schedule(java.util.TimerTask, long, long); + method public void schedule(java.util.TimerTask, java.util.Date, long); + method public void scheduleAtFixedRate(java.util.TimerTask, long, long); + method public void scheduleAtFixedRate(java.util.TimerTask, java.util.Date, long); + } + + public abstract class TimerTask implements java.lang.Runnable { + ctor protected TimerTask(); + method public boolean cancel(); + method public abstract void run(); + method public long scheduledExecutionTime(); + } + + public class TooManyListenersException extends java.lang.Exception { + ctor public TooManyListenersException(); + ctor public TooManyListenersException(java.lang.String); + } + + public class TreeMap extends java.util.AbstractMap implements java.lang.Cloneable java.util.NavigableMap java.io.Serializable java.util.SortedMap { + ctor public TreeMap(); + ctor public TreeMap(java.util.Map); + ctor public TreeMap(java.util.Comparator); + ctor public TreeMap(java.util.SortedMap); + method public java.util.Map.Entry ceilingEntry(K); + method public K ceilingKey(K); + method public java.lang.Object clone(); + method public java.util.Comparator comparator(); + method public java.util.NavigableSet descendingKeySet(); + method public java.util.NavigableMap descendingMap(); + method public java.util.Set> entrySet(); + method public java.util.Map.Entry firstEntry(); + method public K firstKey(); + method public java.util.Map.Entry floorEntry(K); + method public K floorKey(K); + method public java.util.NavigableMap headMap(K, boolean); + method public java.util.SortedMap headMap(K); + method public java.util.Map.Entry higherEntry(K); + method public K higherKey(K); + method public java.util.Map.Entry lastEntry(); + method public K lastKey(); + method public java.util.Map.Entry lowerEntry(K); + method public K lowerKey(K); + method public java.util.NavigableSet navigableKeySet(); + method public java.util.Map.Entry pollFirstEntry(); + method public java.util.Map.Entry pollLastEntry(); + method public java.util.NavigableMap subMap(K, boolean, K, boolean); + method public java.util.SortedMap subMap(K, K); + method public java.util.NavigableMap tailMap(K, boolean); + method public java.util.SortedMap tailMap(K); + } + + public class TreeSet extends java.util.AbstractSet implements java.lang.Cloneable java.util.NavigableSet java.io.Serializable { + ctor public TreeSet(); + ctor public TreeSet(java.util.Collection); + ctor public TreeSet(java.util.Comparator); + ctor public TreeSet(java.util.SortedSet); + method public E ceiling(E); + method public java.lang.Object clone(); + method public java.util.Comparator comparator(); + method public java.util.Iterator descendingIterator(); + method public java.util.NavigableSet descendingSet(); + method public E first(); + method public E floor(E); + method public java.util.NavigableSet headSet(E, boolean); + method public java.util.SortedSet headSet(E); + method public E higher(E); + method public java.util.Iterator iterator(); + method public E last(); + method public E lower(E); + method public E pollFirst(); + method public E pollLast(); + method public int size(); + method public java.util.NavigableSet subSet(E, boolean, E, boolean); + method public java.util.SortedSet subSet(E, E); + method public java.util.NavigableSet tailSet(E, boolean); + method public java.util.SortedSet tailSet(E); + } + + public final class UUID implements java.lang.Comparable java.io.Serializable { + ctor public UUID(long, long); + method public int clockSequence(); + method public int compareTo(java.util.UUID); + method public static java.util.UUID fromString(java.lang.String); + method public long getLeastSignificantBits(); + method public long getMostSignificantBits(); + method public static java.util.UUID nameUUIDFromBytes(byte[]); + method public long node(); + method public static java.util.UUID randomUUID(); + method public long timestamp(); + method public int variant(); + method public int version(); + } + + public class UnknownFormatConversionException extends java.util.IllegalFormatException { + ctor public UnknownFormatConversionException(java.lang.String); + method public java.lang.String getConversion(); + } + + public class UnknownFormatFlagsException extends java.util.IllegalFormatException { + ctor public UnknownFormatFlagsException(java.lang.String); + method public java.lang.String getFlags(); + } + + public class Vector extends java.util.AbstractList implements java.lang.Cloneable java.util.List java.util.RandomAccess java.io.Serializable { + ctor public Vector(); + ctor public Vector(int); + ctor public Vector(int, int); + ctor public Vector(java.util.Collection); + method public synchronized void addElement(E); + method public synchronized int capacity(); + method public synchronized java.lang.Object clone(); + method public synchronized void copyInto(java.lang.Object[]); + method public synchronized E elementAt(int); + method public java.util.Enumeration elements(); + method public synchronized void ensureCapacity(int); + method public synchronized E firstElement(); + method public E get(int); + method public synchronized int indexOf(java.lang.Object, int); + method public synchronized void insertElementAt(E, int); + method public synchronized E lastElement(); + method public synchronized int lastIndexOf(java.lang.Object, int); + method public synchronized void removeAllElements(); + method public synchronized boolean removeElement(java.lang.Object); + method public synchronized void removeElementAt(int); + method public synchronized void setElementAt(E, int); + method public synchronized void setSize(int); + method public synchronized int size(); + method public synchronized void trimToSize(); + field protected int capacityIncrement; + field protected int elementCount; + field protected java.lang.Object[] elementData; + } + + public class WeakHashMap extends java.util.AbstractMap implements java.util.Map { + ctor public WeakHashMap(); + ctor public WeakHashMap(int); + ctor public WeakHashMap(int, float); + ctor public WeakHashMap(java.util.Map); + method public java.util.Set> entrySet(); + } + +} + +package java.util.concurrent { + + public abstract class AbstractExecutorService implements java.util.concurrent.ExecutorService { + ctor public AbstractExecutorService(); + method public java.util.List> invokeAll(java.util.Collection>) throws java.lang.InterruptedException; + method public java.util.List> invokeAll(java.util.Collection>, long, java.util.concurrent.TimeUnit) throws java.lang.InterruptedException; + method public T invokeAny(java.util.Collection>) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException; + method public T invokeAny(java.util.Collection>, long, java.util.concurrent.TimeUnit) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException, java.util.concurrent.TimeoutException; + method protected java.util.concurrent.RunnableFuture newTaskFor(java.lang.Runnable, T); + method protected java.util.concurrent.RunnableFuture newTaskFor(java.util.concurrent.Callable); + method public java.util.concurrent.Future submit(java.lang.Runnable); + method public java.util.concurrent.Future submit(java.lang.Runnable, T); + method public java.util.concurrent.Future submit(java.util.concurrent.Callable); + } + + public class ArrayBlockingQueue extends java.util.AbstractQueue implements java.util.concurrent.BlockingQueue java.io.Serializable { + ctor public ArrayBlockingQueue(int); + ctor public ArrayBlockingQueue(int, boolean); + ctor public ArrayBlockingQueue(int, boolean, java.util.Collection); + method public int drainTo(java.util.Collection); + method public int drainTo(java.util.Collection, int); + method public java.util.Iterator iterator(); + method public boolean offer(E); + method public boolean offer(E, long, java.util.concurrent.TimeUnit) throws java.lang.InterruptedException; + method public E peek(); + method public E poll(); + method public E poll(long, java.util.concurrent.TimeUnit) throws java.lang.InterruptedException; + method public void put(E) throws java.lang.InterruptedException; + method public int remainingCapacity(); + method public int size(); + method public E take() throws java.lang.InterruptedException; + } + + public abstract interface BlockingDeque implements java.util.concurrent.BlockingQueue java.util.Deque { + method public abstract boolean add(E); + method public abstract void addFirst(E); + method public abstract void addLast(E); + method public abstract boolean contains(java.lang.Object); + method public abstract E element(); + method public abstract java.util.Iterator iterator(); + method public abstract boolean offer(E); + method public abstract boolean offer(E, long, java.util.concurrent.TimeUnit) throws java.lang.InterruptedException; + method public abstract boolean offerFirst(E); + method public abstract boolean offerFirst(E, long, java.util.concurrent.TimeUnit) throws java.lang.InterruptedException; + method public abstract boolean offerLast(E); + method public abstract boolean offerLast(E, long, java.util.concurrent.TimeUnit) throws java.lang.InterruptedException; + method public abstract E peek(); + method public abstract E poll(); + method public abstract E poll(long, java.util.concurrent.TimeUnit) throws java.lang.InterruptedException; + method public abstract E pollFirst(long, java.util.concurrent.TimeUnit) throws java.lang.InterruptedException; + method public abstract E pollLast(long, java.util.concurrent.TimeUnit) throws java.lang.InterruptedException; + method public abstract void push(E); + method public abstract void put(E) throws java.lang.InterruptedException; + method public abstract void putFirst(E) throws java.lang.InterruptedException; + method public abstract void putLast(E) throws java.lang.InterruptedException; + method public abstract E remove(); + method public abstract boolean remove(java.lang.Object); + method public abstract boolean removeFirstOccurrence(java.lang.Object); + method public abstract boolean removeLastOccurrence(java.lang.Object); + method public abstract int size(); + method public abstract E take() throws java.lang.InterruptedException; + method public abstract E takeFirst() throws java.lang.InterruptedException; + method public abstract E takeLast() throws java.lang.InterruptedException; + } + + public abstract interface BlockingQueue implements java.util.Queue { + method public abstract boolean add(E); + method public abstract boolean contains(java.lang.Object); + method public abstract int drainTo(java.util.Collection); + method public abstract int drainTo(java.util.Collection, int); + method public abstract boolean offer(E); + method public abstract boolean offer(E, long, java.util.concurrent.TimeUnit) throws java.lang.InterruptedException; + method public abstract E poll(long, java.util.concurrent.TimeUnit) throws java.lang.InterruptedException; + method public abstract void put(E) throws java.lang.InterruptedException; + method public abstract int remainingCapacity(); + method public abstract boolean remove(java.lang.Object); + method public abstract E take() throws java.lang.InterruptedException; + } + + public class BrokenBarrierException extends java.lang.Exception { + ctor public BrokenBarrierException(); + ctor public BrokenBarrierException(java.lang.String); + } + + public abstract interface Callable { + method public abstract V call() throws java.lang.Exception; + } + + public class CancellationException extends java.lang.IllegalStateException { + ctor public CancellationException(); + ctor public CancellationException(java.lang.String); + } + + public abstract interface CompletionService { + method public abstract java.util.concurrent.Future poll(); + method public abstract java.util.concurrent.Future poll(long, java.util.concurrent.TimeUnit) throws java.lang.InterruptedException; + method public abstract java.util.concurrent.Future submit(java.util.concurrent.Callable); + method public abstract java.util.concurrent.Future submit(java.lang.Runnable, V); + method public abstract java.util.concurrent.Future take() throws java.lang.InterruptedException; + } + + public class ConcurrentHashMap extends java.util.AbstractMap implements java.util.concurrent.ConcurrentMap java.io.Serializable { + ctor public ConcurrentHashMap(int, float, int); + ctor public ConcurrentHashMap(int, float); + ctor public ConcurrentHashMap(int); + ctor public ConcurrentHashMap(); + ctor public ConcurrentHashMap(java.util.Map); + method public boolean contains(java.lang.Object); + method public java.util.Enumeration elements(); + method public java.util.Set> entrySet(); + method public java.util.Enumeration keys(); + method public V putIfAbsent(K, V); + method public boolean remove(java.lang.Object, java.lang.Object); + method public boolean replace(K, V, V); + method public V replace(K, V); + } + + public class ConcurrentLinkedQueue extends java.util.AbstractQueue implements java.util.Queue java.io.Serializable { + ctor public ConcurrentLinkedQueue(); + ctor public ConcurrentLinkedQueue(java.util.Collection); + method public java.util.Iterator iterator(); + method public boolean offer(E); + method public E peek(); + method public E poll(); + method public int size(); + } + + public abstract interface ConcurrentMap implements java.util.Map { + method public abstract V putIfAbsent(K, V); + method public abstract boolean remove(java.lang.Object, java.lang.Object); + method public abstract boolean replace(K, V, V); + method public abstract V replace(K, V); + } + + public abstract interface ConcurrentNavigableMap implements java.util.concurrent.ConcurrentMap java.util.NavigableMap { + method public abstract java.util.NavigableSet descendingKeySet(); + method public abstract java.util.concurrent.ConcurrentNavigableMap descendingMap(); + method public abstract java.util.concurrent.ConcurrentNavigableMap headMap(K, boolean); + method public abstract java.util.concurrent.ConcurrentNavigableMap headMap(K); + method public abstract java.util.NavigableSet keySet(); + method public abstract java.util.NavigableSet navigableKeySet(); + method public abstract java.util.concurrent.ConcurrentNavigableMap subMap(K, boolean, K, boolean); + method public abstract java.util.concurrent.ConcurrentNavigableMap subMap(K, K); + method public abstract java.util.concurrent.ConcurrentNavigableMap tailMap(K, boolean); + method public abstract java.util.concurrent.ConcurrentNavigableMap tailMap(K); + } + + public class ConcurrentSkipListMap extends java.util.AbstractMap implements java.lang.Cloneable java.util.concurrent.ConcurrentNavigableMap java.io.Serializable { + ctor public ConcurrentSkipListMap(); + ctor public ConcurrentSkipListMap(java.util.Comparator); + ctor public ConcurrentSkipListMap(java.util.Map); + ctor public ConcurrentSkipListMap(java.util.SortedMap); + method public java.util.Map.Entry ceilingEntry(K); + method public K ceilingKey(K); + method public java.util.concurrent.ConcurrentSkipListMap clone(); + method public java.util.Comparator comparator(); + method public java.util.NavigableSet descendingKeySet(); + method public java.util.concurrent.ConcurrentNavigableMap descendingMap(); + method public java.util.Set> entrySet(); + method public java.util.Map.Entry firstEntry(); + method public K firstKey(); + method public java.util.Map.Entry floorEntry(K); + method public K floorKey(K); + method public java.util.concurrent.ConcurrentNavigableMap headMap(K, boolean); + method public java.util.concurrent.ConcurrentNavigableMap headMap(K); + method public java.util.Map.Entry higherEntry(K); + method public K higherKey(K); + method public java.util.Map.Entry lastEntry(); + method public K lastKey(); + method public java.util.Map.Entry lowerEntry(K); + method public K lowerKey(K); + method public java.util.NavigableSet navigableKeySet(); + method public java.util.Map.Entry pollFirstEntry(); + method public java.util.Map.Entry pollLastEntry(); + method public V putIfAbsent(K, V); + method public boolean remove(java.lang.Object, java.lang.Object); + method public boolean replace(K, V, V); + method public V replace(K, V); + method public java.util.concurrent.ConcurrentNavigableMap subMap(K, boolean, K, boolean); + method public java.util.concurrent.ConcurrentNavigableMap subMap(K, K); + method public java.util.concurrent.ConcurrentNavigableMap tailMap(K, boolean); + method public java.util.concurrent.ConcurrentNavigableMap tailMap(K); + } + + public class ConcurrentSkipListSet extends java.util.AbstractSet implements java.lang.Cloneable java.util.NavigableSet java.io.Serializable { + ctor public ConcurrentSkipListSet(); + ctor public ConcurrentSkipListSet(java.util.Comparator); + ctor public ConcurrentSkipListSet(java.util.Collection); + ctor public ConcurrentSkipListSet(java.util.SortedSet); + method public E ceiling(E); + method public java.util.concurrent.ConcurrentSkipListSet clone(); + method public java.util.Comparator comparator(); + method public java.util.Iterator descendingIterator(); + method public java.util.NavigableSet descendingSet(); + method public E first(); + method public E floor(E); + method public java.util.NavigableSet headSet(E, boolean); + method public java.util.NavigableSet headSet(E); + method public E higher(E); + method public java.util.Iterator iterator(); + method public E last(); + method public E lower(E); + method public E pollFirst(); + method public E pollLast(); + method public int size(); + method public java.util.NavigableSet subSet(E, boolean, E, boolean); + method public java.util.NavigableSet subSet(E, E); + method public java.util.NavigableSet tailSet(E, boolean); + method public java.util.NavigableSet tailSet(E); + } + + public class CopyOnWriteArrayList implements java.lang.Cloneable java.util.List java.util.RandomAccess java.io.Serializable { + ctor public CopyOnWriteArrayList(); + ctor public CopyOnWriteArrayList(java.util.Collection); + ctor public CopyOnWriteArrayList(E[]); + method public synchronized boolean add(E); + method public synchronized void add(int, E); + method public synchronized boolean addAll(java.util.Collection); + method public synchronized boolean addAll(int, java.util.Collection); + method public synchronized int addAllAbsent(java.util.Collection); + method public synchronized boolean addIfAbsent(E); + method public synchronized void clear(); + method public java.lang.Object clone(); + method public boolean contains(java.lang.Object); + method public boolean containsAll(java.util.Collection); + method public E get(int); + method public int indexOf(E, int); + method public int indexOf(java.lang.Object); + method public boolean isEmpty(); + method public java.util.Iterator iterator(); + method public int lastIndexOf(E, int); + method public int lastIndexOf(java.lang.Object); + method public java.util.ListIterator listIterator(int); + method public java.util.ListIterator listIterator(); + method public synchronized E remove(int); + method public synchronized boolean remove(java.lang.Object); + method public synchronized boolean removeAll(java.util.Collection); + method public synchronized boolean retainAll(java.util.Collection); + method public synchronized E set(int, E); + method public int size(); + method public java.util.List subList(int, int); + method public java.lang.Object[] toArray(); + method public T[] toArray(T[]); + } + + public class CopyOnWriteArraySet extends java.util.AbstractSet implements java.io.Serializable { + ctor public CopyOnWriteArraySet(); + ctor public CopyOnWriteArraySet(java.util.Collection); + method public java.util.Iterator iterator(); + method public int size(); + } + + public class CountDownLatch { + ctor public CountDownLatch(int); + method public void await() throws java.lang.InterruptedException; + method public boolean await(long, java.util.concurrent.TimeUnit) throws java.lang.InterruptedException; + method public void countDown(); + method public long getCount(); + } + + public class CyclicBarrier { + ctor public CyclicBarrier(int, java.lang.Runnable); + ctor public CyclicBarrier(int); + method public int await() throws java.util.concurrent.BrokenBarrierException, java.lang.InterruptedException; + method public int await(long, java.util.concurrent.TimeUnit) throws java.util.concurrent.BrokenBarrierException, java.lang.InterruptedException, java.util.concurrent.TimeoutException; + method public int getNumberWaiting(); + method public int getParties(); + method public boolean isBroken(); + method public void reset(); + } + + public class DelayQueue extends java.util.AbstractQueue implements java.util.concurrent.BlockingQueue { + ctor public DelayQueue(); + ctor public DelayQueue(java.util.Collection); + method public int drainTo(java.util.Collection); + method public int drainTo(java.util.Collection, int); + method public java.util.Iterator iterator(); + method public boolean offer(E); + method public boolean offer(E, long, java.util.concurrent.TimeUnit); + method public E peek(); + method public E poll(); + method public E poll(long, java.util.concurrent.TimeUnit) throws java.lang.InterruptedException; + method public void put(E); + method public int remainingCapacity(); + method public int size(); + method public E take() throws java.lang.InterruptedException; + } + + public abstract interface Delayed implements java.lang.Comparable { + method public abstract long getDelay(java.util.concurrent.TimeUnit); + } + + public class Exchanger { + ctor public Exchanger(); + method public V exchange(V) throws java.lang.InterruptedException; + method public V exchange(V, long, java.util.concurrent.TimeUnit) throws java.lang.InterruptedException, java.util.concurrent.TimeoutException; + } + + public class ExecutionException extends java.lang.Exception { + ctor protected ExecutionException(); + ctor protected ExecutionException(java.lang.String); + ctor public ExecutionException(java.lang.String, java.lang.Throwable); + ctor public ExecutionException(java.lang.Throwable); + } + + public abstract interface Executor { + method public abstract void execute(java.lang.Runnable); + } + + public class ExecutorCompletionService implements java.util.concurrent.CompletionService { + ctor public ExecutorCompletionService(java.util.concurrent.Executor); + ctor public ExecutorCompletionService(java.util.concurrent.Executor, java.util.concurrent.BlockingQueue>); + method public java.util.concurrent.Future poll(); + method public java.util.concurrent.Future poll(long, java.util.concurrent.TimeUnit) throws java.lang.InterruptedException; + method public java.util.concurrent.Future submit(java.util.concurrent.Callable); + method public java.util.concurrent.Future submit(java.lang.Runnable, V); + method public java.util.concurrent.Future take() throws java.lang.InterruptedException; + } + + public abstract interface ExecutorService implements java.util.concurrent.Executor { + method public abstract boolean awaitTermination(long, java.util.concurrent.TimeUnit) throws java.lang.InterruptedException; + method public abstract java.util.List> invokeAll(java.util.Collection>) throws java.lang.InterruptedException; + method public abstract java.util.List> invokeAll(java.util.Collection>, long, java.util.concurrent.TimeUnit) throws java.lang.InterruptedException; + method public abstract T invokeAny(java.util.Collection>) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException; + method public abstract T invokeAny(java.util.Collection>, long, java.util.concurrent.TimeUnit) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException, java.util.concurrent.TimeoutException; + method public abstract boolean isShutdown(); + method public abstract boolean isTerminated(); + method public abstract void shutdown(); + method public abstract java.util.List shutdownNow(); + method public abstract java.util.concurrent.Future submit(java.util.concurrent.Callable); + method public abstract java.util.concurrent.Future submit(java.lang.Runnable, T); + method public abstract java.util.concurrent.Future submit(java.lang.Runnable); + } + + public class Executors { + method public static java.util.concurrent.Callable callable(java.lang.Runnable, T); + method public static java.util.concurrent.Callable callable(java.lang.Runnable); + method public static java.util.concurrent.Callable callable(java.security.PrivilegedAction); + method public static java.util.concurrent.Callable callable(java.security.PrivilegedExceptionAction); + method public static java.util.concurrent.ThreadFactory defaultThreadFactory(); + method public static java.util.concurrent.ExecutorService newCachedThreadPool(); + method public static java.util.concurrent.ExecutorService newCachedThreadPool(java.util.concurrent.ThreadFactory); + method public static java.util.concurrent.ExecutorService newFixedThreadPool(int); + method public static java.util.concurrent.ExecutorService newFixedThreadPool(int, java.util.concurrent.ThreadFactory); + method public static java.util.concurrent.ScheduledExecutorService newScheduledThreadPool(int); + method public static java.util.concurrent.ScheduledExecutorService newScheduledThreadPool(int, java.util.concurrent.ThreadFactory); + method public static java.util.concurrent.ExecutorService newSingleThreadExecutor(); + method public static java.util.concurrent.ExecutorService newSingleThreadExecutor(java.util.concurrent.ThreadFactory); + method public static java.util.concurrent.ScheduledExecutorService newSingleThreadScheduledExecutor(); + method public static java.util.concurrent.ScheduledExecutorService newSingleThreadScheduledExecutor(java.util.concurrent.ThreadFactory); + method public static java.util.concurrent.Callable privilegedCallable(java.util.concurrent.Callable); + method public static java.util.concurrent.Callable privilegedCallableUsingCurrentClassLoader(java.util.concurrent.Callable); + method public static java.util.concurrent.ThreadFactory privilegedThreadFactory(); + method public static java.util.concurrent.ExecutorService unconfigurableExecutorService(java.util.concurrent.ExecutorService); + method public static java.util.concurrent.ScheduledExecutorService unconfigurableScheduledExecutorService(java.util.concurrent.ScheduledExecutorService); + } + + public abstract interface Future { + method public abstract boolean cancel(boolean); + method public abstract V get() throws java.util.concurrent.ExecutionException, java.lang.InterruptedException; + method public abstract V get(long, java.util.concurrent.TimeUnit) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException, java.util.concurrent.TimeoutException; + method public abstract boolean isCancelled(); + method public abstract boolean isDone(); + } + + public class FutureTask implements java.util.concurrent.RunnableFuture { + ctor public FutureTask(java.util.concurrent.Callable); + ctor public FutureTask(java.lang.Runnable, V); + method public boolean cancel(boolean); + method protected void done(); + method public V get() throws java.util.concurrent.ExecutionException, java.lang.InterruptedException; + method public V get(long, java.util.concurrent.TimeUnit) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException, java.util.concurrent.TimeoutException; + method public boolean isCancelled(); + method public boolean isDone(); + method public void run(); + method protected boolean runAndReset(); + method protected void set(V); + method protected void setException(java.lang.Throwable); + } + + public class LinkedBlockingDeque extends java.util.AbstractQueue implements java.util.concurrent.BlockingDeque java.io.Serializable { + ctor public LinkedBlockingDeque(); + ctor public LinkedBlockingDeque(int); + ctor public LinkedBlockingDeque(java.util.Collection); + method public void addFirst(E); + method public void addLast(E); + method public java.util.Iterator descendingIterator(); + method public int drainTo(java.util.Collection); + method public int drainTo(java.util.Collection, int); + method public E getFirst(); + method public E getLast(); + method public java.util.Iterator iterator(); + method public boolean offer(E); + method public boolean offer(E, long, java.util.concurrent.TimeUnit) throws java.lang.InterruptedException; + method public boolean offerFirst(E); + method public boolean offerFirst(E, long, java.util.concurrent.TimeUnit) throws java.lang.InterruptedException; + method public boolean offerLast(E); + method public boolean offerLast(E, long, java.util.concurrent.TimeUnit) throws java.lang.InterruptedException; + method public E peek(); + method public E peekFirst(); + method public E peekLast(); + method public E poll(); + method public E poll(long, java.util.concurrent.TimeUnit) throws java.lang.InterruptedException; + method public E pollFirst(); + method public E pollFirst(long, java.util.concurrent.TimeUnit) throws java.lang.InterruptedException; + method public E pollLast(); + method public E pollLast(long, java.util.concurrent.TimeUnit) throws java.lang.InterruptedException; + method public E pop(); + method public void push(E); + method public void put(E) throws java.lang.InterruptedException; + method public void putFirst(E) throws java.lang.InterruptedException; + method public void putLast(E) throws java.lang.InterruptedException; + method public int remainingCapacity(); + method public E removeFirst(); + method public boolean removeFirstOccurrence(java.lang.Object); + method public E removeLast(); + method public boolean removeLastOccurrence(java.lang.Object); + method public int size(); + method public E take() throws java.lang.InterruptedException; + method public E takeFirst() throws java.lang.InterruptedException; + method public E takeLast() throws java.lang.InterruptedException; + } + + public class LinkedBlockingQueue extends java.util.AbstractQueue implements java.util.concurrent.BlockingQueue java.io.Serializable { + ctor public LinkedBlockingQueue(); + ctor public LinkedBlockingQueue(int); + ctor public LinkedBlockingQueue(java.util.Collection); + method public int drainTo(java.util.Collection); + method public int drainTo(java.util.Collection, int); + method public java.util.Iterator iterator(); + method public boolean offer(E, long, java.util.concurrent.TimeUnit) throws java.lang.InterruptedException; + method public boolean offer(E); + method public E peek(); + method public E poll(long, java.util.concurrent.TimeUnit) throws java.lang.InterruptedException; + method public E poll(); + method public void put(E) throws java.lang.InterruptedException; + method public int remainingCapacity(); + method public int size(); + method public E take() throws java.lang.InterruptedException; + } + + public class PriorityBlockingQueue extends java.util.AbstractQueue implements java.util.concurrent.BlockingQueue java.io.Serializable { + ctor public PriorityBlockingQueue(); + ctor public PriorityBlockingQueue(int); + ctor public PriorityBlockingQueue(int, java.util.Comparator); + ctor public PriorityBlockingQueue(java.util.Collection); + method public java.util.Comparator comparator(); + method public int drainTo(java.util.Collection); + method public int drainTo(java.util.Collection, int); + method public java.util.Iterator iterator(); + method public boolean offer(E); + method public boolean offer(E, long, java.util.concurrent.TimeUnit); + method public E peek(); + method public E poll(); + method public E poll(long, java.util.concurrent.TimeUnit) throws java.lang.InterruptedException; + method public void put(E); + method public int remainingCapacity(); + method public int size(); + method public E take() throws java.lang.InterruptedException; + } + + public class RejectedExecutionException extends java.lang.RuntimeException { + ctor public RejectedExecutionException(); + ctor public RejectedExecutionException(java.lang.String); + ctor public RejectedExecutionException(java.lang.String, java.lang.Throwable); + ctor public RejectedExecutionException(java.lang.Throwable); + } + + public abstract interface RejectedExecutionHandler { + method public abstract void rejectedExecution(java.lang.Runnable, java.util.concurrent.ThreadPoolExecutor); + } + + public abstract interface RunnableFuture implements java.util.concurrent.Future java.lang.Runnable { + method public abstract void run(); + } + + public abstract interface RunnableScheduledFuture implements java.util.concurrent.RunnableFuture java.util.concurrent.ScheduledFuture { + method public abstract boolean isPeriodic(); + } + + public abstract interface ScheduledExecutorService implements java.util.concurrent.ExecutorService { + method public abstract java.util.concurrent.ScheduledFuture schedule(java.lang.Runnable, long, java.util.concurrent.TimeUnit); + method public abstract java.util.concurrent.ScheduledFuture schedule(java.util.concurrent.Callable, long, java.util.concurrent.TimeUnit); + method public abstract java.util.concurrent.ScheduledFuture scheduleAtFixedRate(java.lang.Runnable, long, long, java.util.concurrent.TimeUnit); + method public abstract java.util.concurrent.ScheduledFuture scheduleWithFixedDelay(java.lang.Runnable, long, long, java.util.concurrent.TimeUnit); + } + + public abstract interface ScheduledFuture implements java.util.concurrent.Delayed java.util.concurrent.Future { + } + + public class ScheduledThreadPoolExecutor extends java.util.concurrent.ThreadPoolExecutor implements java.util.concurrent.ScheduledExecutorService { + ctor public ScheduledThreadPoolExecutor(int); + ctor public ScheduledThreadPoolExecutor(int, java.util.concurrent.ThreadFactory); + ctor public ScheduledThreadPoolExecutor(int, java.util.concurrent.RejectedExecutionHandler); + ctor public ScheduledThreadPoolExecutor(int, java.util.concurrent.ThreadFactory, java.util.concurrent.RejectedExecutionHandler); + method protected java.util.concurrent.RunnableScheduledFuture decorateTask(java.lang.Runnable, java.util.concurrent.RunnableScheduledFuture); + method protected java.util.concurrent.RunnableScheduledFuture decorateTask(java.util.concurrent.Callable, java.util.concurrent.RunnableScheduledFuture); + method public boolean getContinueExistingPeriodicTasksAfterShutdownPolicy(); + method public boolean getExecuteExistingDelayedTasksAfterShutdownPolicy(); + method public java.util.concurrent.ScheduledFuture schedule(java.lang.Runnable, long, java.util.concurrent.TimeUnit); + method public java.util.concurrent.ScheduledFuture schedule(java.util.concurrent.Callable, long, java.util.concurrent.TimeUnit); + method public java.util.concurrent.ScheduledFuture scheduleAtFixedRate(java.lang.Runnable, long, long, java.util.concurrent.TimeUnit); + method public java.util.concurrent.ScheduledFuture scheduleWithFixedDelay(java.lang.Runnable, long, long, java.util.concurrent.TimeUnit); + method public void setContinueExistingPeriodicTasksAfterShutdownPolicy(boolean); + method public void setExecuteExistingDelayedTasksAfterShutdownPolicy(boolean); + } + + public class Semaphore implements java.io.Serializable { + ctor public Semaphore(int); + ctor public Semaphore(int, boolean); + method public void acquire() throws java.lang.InterruptedException; + method public void acquire(int) throws java.lang.InterruptedException; + method public void acquireUninterruptibly(); + method public void acquireUninterruptibly(int); + method public int availablePermits(); + method public int drainPermits(); + method public final int getQueueLength(); + method protected java.util.Collection getQueuedThreads(); + method public final boolean hasQueuedThreads(); + method public boolean isFair(); + method protected void reducePermits(int); + method public void release(); + method public void release(int); + method public boolean tryAcquire(); + method public boolean tryAcquire(long, java.util.concurrent.TimeUnit) throws java.lang.InterruptedException; + method public boolean tryAcquire(int); + method public boolean tryAcquire(int, long, java.util.concurrent.TimeUnit) throws java.lang.InterruptedException; + } + + public class SynchronousQueue extends java.util.AbstractQueue implements java.util.concurrent.BlockingQueue java.io.Serializable { + ctor public SynchronousQueue(); + ctor public SynchronousQueue(boolean); + method public int drainTo(java.util.Collection); + method public int drainTo(java.util.Collection, int); + method public java.util.Iterator iterator(); + method public boolean offer(E, long, java.util.concurrent.TimeUnit) throws java.lang.InterruptedException; + method public boolean offer(E); + method public E peek(); + method public E poll(long, java.util.concurrent.TimeUnit) throws java.lang.InterruptedException; + method public E poll(); + method public void put(E) throws java.lang.InterruptedException; + method public int remainingCapacity(); + method public int size(); + method public E take() throws java.lang.InterruptedException; + } + + public abstract interface ThreadFactory { + method public abstract java.lang.Thread newThread(java.lang.Runnable); + } + + public class ThreadPoolExecutor extends java.util.concurrent.AbstractExecutorService { + ctor public ThreadPoolExecutor(int, int, long, java.util.concurrent.TimeUnit, java.util.concurrent.BlockingQueue); + ctor public ThreadPoolExecutor(int, int, long, java.util.concurrent.TimeUnit, java.util.concurrent.BlockingQueue, java.util.concurrent.ThreadFactory); + ctor public ThreadPoolExecutor(int, int, long, java.util.concurrent.TimeUnit, java.util.concurrent.BlockingQueue, java.util.concurrent.RejectedExecutionHandler); + ctor public ThreadPoolExecutor(int, int, long, java.util.concurrent.TimeUnit, java.util.concurrent.BlockingQueue, java.util.concurrent.ThreadFactory, java.util.concurrent.RejectedExecutionHandler); + method protected void afterExecute(java.lang.Runnable, java.lang.Throwable); + method public void allowCoreThreadTimeOut(boolean); + method public boolean allowsCoreThreadTimeOut(); + method public boolean awaitTermination(long, java.util.concurrent.TimeUnit) throws java.lang.InterruptedException; + method protected void beforeExecute(java.lang.Thread, java.lang.Runnable); + method public void execute(java.lang.Runnable); + method public int getActiveCount(); + method public long getCompletedTaskCount(); + method public int getCorePoolSize(); + method public long getKeepAliveTime(java.util.concurrent.TimeUnit); + method public int getLargestPoolSize(); + method public int getMaximumPoolSize(); + method public int getPoolSize(); + method public java.util.concurrent.BlockingQueue getQueue(); + method public java.util.concurrent.RejectedExecutionHandler getRejectedExecutionHandler(); + method public long getTaskCount(); + method public java.util.concurrent.ThreadFactory getThreadFactory(); + method public boolean isShutdown(); + method public boolean isTerminated(); + method public boolean isTerminating(); + method public int prestartAllCoreThreads(); + method public boolean prestartCoreThread(); + method public void purge(); + method public boolean remove(java.lang.Runnable); + method public void setCorePoolSize(int); + method public void setKeepAliveTime(long, java.util.concurrent.TimeUnit); + method public void setMaximumPoolSize(int); + method public void setRejectedExecutionHandler(java.util.concurrent.RejectedExecutionHandler); + method public void setThreadFactory(java.util.concurrent.ThreadFactory); + method public void shutdown(); + method public java.util.List shutdownNow(); + method protected void terminated(); + } + + public static class ThreadPoolExecutor.AbortPolicy implements java.util.concurrent.RejectedExecutionHandler { + ctor public ThreadPoolExecutor.AbortPolicy(); + method public void rejectedExecution(java.lang.Runnable, java.util.concurrent.ThreadPoolExecutor); + } + + public static class ThreadPoolExecutor.CallerRunsPolicy implements java.util.concurrent.RejectedExecutionHandler { + ctor public ThreadPoolExecutor.CallerRunsPolicy(); + method public void rejectedExecution(java.lang.Runnable, java.util.concurrent.ThreadPoolExecutor); + } + + public static class ThreadPoolExecutor.DiscardOldestPolicy implements java.util.concurrent.RejectedExecutionHandler { + ctor public ThreadPoolExecutor.DiscardOldestPolicy(); + method public void rejectedExecution(java.lang.Runnable, java.util.concurrent.ThreadPoolExecutor); + } + + public static class ThreadPoolExecutor.DiscardPolicy implements java.util.concurrent.RejectedExecutionHandler { + ctor public ThreadPoolExecutor.DiscardPolicy(); + method public void rejectedExecution(java.lang.Runnable, java.util.concurrent.ThreadPoolExecutor); + } + + public class TimeUnit extends java.lang.Enum { + method public long convert(long, java.util.concurrent.TimeUnit); + method public void sleep(long) throws java.lang.InterruptedException; + method public void timedJoin(java.lang.Thread, long) throws java.lang.InterruptedException; + method public void timedWait(java.lang.Object, long) throws java.lang.InterruptedException; + method public long toDays(long); + method public long toHours(long); + method public long toMicros(long); + method public long toMillis(long); + method public long toMinutes(long); + method public long toNanos(long); + method public long toSeconds(long); + method public static java.util.concurrent.TimeUnit valueOf(java.lang.String); + method public static final java.util.concurrent.TimeUnit[] values(); + enum_constant public static final java.util.concurrent.TimeUnit DAYS; + enum_constant public static final java.util.concurrent.TimeUnit HOURS; + enum_constant public static final java.util.concurrent.TimeUnit MICROSECONDS; + enum_constant public static final java.util.concurrent.TimeUnit MILLISECONDS; + enum_constant public static final java.util.concurrent.TimeUnit MINUTES; + enum_constant public static final java.util.concurrent.TimeUnit NANOSECONDS; + enum_constant public static final java.util.concurrent.TimeUnit SECONDS; + } + + public class TimeoutException extends java.lang.Exception { + ctor public TimeoutException(); + ctor public TimeoutException(java.lang.String); + } + +} + +package java.util.concurrent.atomic { + + public class AtomicBoolean implements java.io.Serializable { + ctor public AtomicBoolean(boolean); + ctor public AtomicBoolean(); + method public final boolean compareAndSet(boolean, boolean); + method public final boolean get(); + method public final boolean getAndSet(boolean); + method public final void lazySet(boolean); + method public final void set(boolean); + method public boolean weakCompareAndSet(boolean, boolean); + } + + public class AtomicInteger extends java.lang.Number implements java.io.Serializable { + ctor public AtomicInteger(int); + ctor public AtomicInteger(); + method public final int addAndGet(int); + method public final boolean compareAndSet(int, int); + method public final int decrementAndGet(); + method public double doubleValue(); + method public float floatValue(); + method public final int get(); + method public final int getAndAdd(int); + method public final int getAndDecrement(); + method public final int getAndIncrement(); + method public final int getAndSet(int); + method public final int incrementAndGet(); + method public int intValue(); + method public final void lazySet(int); + method public long longValue(); + method public final void set(int); + method public final boolean weakCompareAndSet(int, int); + } + + public class AtomicIntegerArray implements java.io.Serializable { + ctor public AtomicIntegerArray(int); + ctor public AtomicIntegerArray(int[]); + method public final int addAndGet(int, int); + method public final boolean compareAndSet(int, int, int); + method public final int decrementAndGet(int); + method public final int get(int); + method public final int getAndAdd(int, int); + method public final int getAndDecrement(int); + method public final int getAndIncrement(int); + method public final int getAndSet(int, int); + method public final int incrementAndGet(int); + method public final void lazySet(int, int); + method public final int length(); + method public final void set(int, int); + method public final boolean weakCompareAndSet(int, int, int); + } + + public abstract class AtomicIntegerFieldUpdater { + ctor protected AtomicIntegerFieldUpdater(); + method public int addAndGet(T, int); + method public abstract boolean compareAndSet(T, int, int); + method public int decrementAndGet(T); + method public abstract int get(T); + method public int getAndAdd(T, int); + method public int getAndDecrement(T); + method public int getAndIncrement(T); + method public int getAndSet(T, int); + method public int incrementAndGet(T); + method public abstract void lazySet(T, int); + method public static java.util.concurrent.atomic.AtomicIntegerFieldUpdater newUpdater(java.lang.Class, java.lang.String); + method public abstract void set(T, int); + method public abstract boolean weakCompareAndSet(T, int, int); + } + + public class AtomicLong extends java.lang.Number implements java.io.Serializable { + ctor public AtomicLong(long); + ctor public AtomicLong(); + method public final long addAndGet(long); + method public final boolean compareAndSet(long, long); + method public final long decrementAndGet(); + method public double doubleValue(); + method public float floatValue(); + method public final long get(); + method public final long getAndAdd(long); + method public final long getAndDecrement(); + method public final long getAndIncrement(); + method public final long getAndSet(long); + method public final long incrementAndGet(); + method public int intValue(); + method public final void lazySet(long); + method public long longValue(); + method public final void set(long); + method public final boolean weakCompareAndSet(long, long); + } + + public class AtomicLongArray implements java.io.Serializable { + ctor public AtomicLongArray(int); + ctor public AtomicLongArray(long[]); + method public long addAndGet(int, long); + method public final boolean compareAndSet(int, long, long); + method public final long decrementAndGet(int); + method public final long get(int); + method public final long getAndAdd(int, long); + method public final long getAndDecrement(int); + method public final long getAndIncrement(int); + method public final long getAndSet(int, long); + method public final long incrementAndGet(int); + method public final void lazySet(int, long); + method public final int length(); + method public final void set(int, long); + method public final boolean weakCompareAndSet(int, long, long); + } + + public abstract class AtomicLongFieldUpdater { + ctor protected AtomicLongFieldUpdater(); + method public long addAndGet(T, long); + method public abstract boolean compareAndSet(T, long, long); + method public long decrementAndGet(T); + method public abstract long get(T); + method public long getAndAdd(T, long); + method public long getAndDecrement(T); + method public long getAndIncrement(T); + method public long getAndSet(T, long); + method public long incrementAndGet(T); + method public abstract void lazySet(T, long); + method public static java.util.concurrent.atomic.AtomicLongFieldUpdater newUpdater(java.lang.Class, java.lang.String); + method public abstract void set(T, long); + method public abstract boolean weakCompareAndSet(T, long, long); + } + + public class AtomicMarkableReference { + ctor public AtomicMarkableReference(V, boolean); + method public boolean attemptMark(V, boolean); + method public boolean compareAndSet(V, V, boolean, boolean); + method public V get(boolean[]); + method public V getReference(); + method public boolean isMarked(); + method public void set(V, boolean); + method public boolean weakCompareAndSet(V, V, boolean, boolean); + } + + public class AtomicReference implements java.io.Serializable { + ctor public AtomicReference(V); + ctor public AtomicReference(); + method public final boolean compareAndSet(V, V); + method public final V get(); + method public final V getAndSet(V); + method public final void lazySet(V); + method public final void set(V); + method public final boolean weakCompareAndSet(V, V); + } + + public class AtomicReferenceArray implements java.io.Serializable { + ctor public AtomicReferenceArray(int); + ctor public AtomicReferenceArray(E[]); + method public final boolean compareAndSet(int, E, E); + method public final E get(int); + method public final E getAndSet(int, E); + method public final void lazySet(int, E); + method public final int length(); + method public final void set(int, E); + method public final boolean weakCompareAndSet(int, E, E); + } + + public abstract class AtomicReferenceFieldUpdater { + ctor protected AtomicReferenceFieldUpdater(); + method public abstract boolean compareAndSet(T, V, V); + method public abstract V get(T); + method public V getAndSet(T, V); + method public abstract void lazySet(T, V); + method public static java.util.concurrent.atomic.AtomicReferenceFieldUpdater newUpdater(java.lang.Class, java.lang.Class, java.lang.String); + method public abstract void set(T, V); + method public abstract boolean weakCompareAndSet(T, V, V); + } + + public class AtomicStampedReference { + ctor public AtomicStampedReference(V, int); + method public boolean attemptStamp(V, int); + method public boolean compareAndSet(V, V, int, int); + method public V get(int[]); + method public V getReference(); + method public int getStamp(); + method public void set(V, int); + method public boolean weakCompareAndSet(V, V, int, int); + } + +} + +package java.util.concurrent.locks { + + public abstract class AbstractOwnableSynchronizer implements java.io.Serializable { + ctor protected AbstractOwnableSynchronizer(); + method protected final java.lang.Thread getExclusiveOwnerThread(); + method protected final void setExclusiveOwnerThread(java.lang.Thread); + } + + public abstract class AbstractQueuedLongSynchronizer extends java.util.concurrent.locks.AbstractOwnableSynchronizer implements java.io.Serializable { + ctor protected AbstractQueuedLongSynchronizer(); + method public final void acquire(long); + method public final void acquireInterruptibly(long) throws java.lang.InterruptedException; + method public final void acquireShared(long); + method public final void acquireSharedInterruptibly(long) throws java.lang.InterruptedException; + method protected final boolean compareAndSetState(long, long); + method public final java.util.Collection getExclusiveQueuedThreads(); + method public final java.lang.Thread getFirstQueuedThread(); + method public final int getQueueLength(); + method public final java.util.Collection getQueuedThreads(); + method public final java.util.Collection getSharedQueuedThreads(); + method protected final long getState(); + method public final int getWaitQueueLength(java.util.concurrent.locks.AbstractQueuedLongSynchronizer.ConditionObject); + method public final java.util.Collection getWaitingThreads(java.util.concurrent.locks.AbstractQueuedLongSynchronizer.ConditionObject); + method public final boolean hasContended(); + method public final boolean hasQueuedThreads(); + method public final boolean hasWaiters(java.util.concurrent.locks.AbstractQueuedLongSynchronizer.ConditionObject); + method protected boolean isHeldExclusively(); + method public final boolean isQueued(java.lang.Thread); + method public final boolean owns(java.util.concurrent.locks.AbstractQueuedLongSynchronizer.ConditionObject); + method public final boolean release(long); + method public final boolean releaseShared(long); + method protected final void setState(long); + method protected boolean tryAcquire(long); + method public final boolean tryAcquireNanos(long, long) throws java.lang.InterruptedException; + method protected long tryAcquireShared(long); + method public final boolean tryAcquireSharedNanos(long, long) throws java.lang.InterruptedException; + method protected boolean tryRelease(long); + method protected boolean tryReleaseShared(long); + } + + public class AbstractQueuedLongSynchronizer.ConditionObject implements java.util.concurrent.locks.Condition java.io.Serializable { + ctor public AbstractQueuedLongSynchronizer.ConditionObject(); + method public final void await() throws java.lang.InterruptedException; + method public final boolean await(long, java.util.concurrent.TimeUnit) throws java.lang.InterruptedException; + method public final long awaitNanos(long) throws java.lang.InterruptedException; + method public final void awaitUninterruptibly(); + method public final boolean awaitUntil(java.util.Date) throws java.lang.InterruptedException; + method protected final int getWaitQueueLength(); + method protected final java.util.Collection getWaitingThreads(); + method protected final boolean hasWaiters(); + method public final void signal(); + method public final void signalAll(); + } + + public abstract class AbstractQueuedSynchronizer extends java.util.concurrent.locks.AbstractOwnableSynchronizer implements java.io.Serializable { + ctor protected AbstractQueuedSynchronizer(); + method public final void acquire(int); + method public final void acquireInterruptibly(int) throws java.lang.InterruptedException; + method public final void acquireShared(int); + method public final void acquireSharedInterruptibly(int) throws java.lang.InterruptedException; + method protected final boolean compareAndSetState(int, int); + method public final java.util.Collection getExclusiveQueuedThreads(); + method public final java.lang.Thread getFirstQueuedThread(); + method public final int getQueueLength(); + method public final java.util.Collection getQueuedThreads(); + method public final java.util.Collection getSharedQueuedThreads(); + method protected final int getState(); + method public final int getWaitQueueLength(java.util.concurrent.locks.AbstractQueuedSynchronizer.ConditionObject); + method public final java.util.Collection getWaitingThreads(java.util.concurrent.locks.AbstractQueuedSynchronizer.ConditionObject); + method public final boolean hasContended(); + method public final boolean hasQueuedThreads(); + method public final boolean hasWaiters(java.util.concurrent.locks.AbstractQueuedSynchronizer.ConditionObject); + method protected boolean isHeldExclusively(); + method public final boolean isQueued(java.lang.Thread); + method public final boolean owns(java.util.concurrent.locks.AbstractQueuedSynchronizer.ConditionObject); + method public final boolean release(int); + method public final boolean releaseShared(int); + method protected final void setState(int); + method protected boolean tryAcquire(int); + method public final boolean tryAcquireNanos(int, long) throws java.lang.InterruptedException; + method protected int tryAcquireShared(int); + method public final boolean tryAcquireSharedNanos(int, long) throws java.lang.InterruptedException; + method protected boolean tryRelease(int); + method protected boolean tryReleaseShared(int); + } + + public class AbstractQueuedSynchronizer.ConditionObject implements java.util.concurrent.locks.Condition java.io.Serializable { + ctor public AbstractQueuedSynchronizer.ConditionObject(); + method public final void await() throws java.lang.InterruptedException; + method public final boolean await(long, java.util.concurrent.TimeUnit) throws java.lang.InterruptedException; + method public final long awaitNanos(long) throws java.lang.InterruptedException; + method public final void awaitUninterruptibly(); + method public final boolean awaitUntil(java.util.Date) throws java.lang.InterruptedException; + method protected final int getWaitQueueLength(); + method protected final java.util.Collection getWaitingThreads(); + method protected final boolean hasWaiters(); + method public final void signal(); + method public final void signalAll(); + } + + public abstract interface Condition { + method public abstract void await() throws java.lang.InterruptedException; + method public abstract boolean await(long, java.util.concurrent.TimeUnit) throws java.lang.InterruptedException; + method public abstract long awaitNanos(long) throws java.lang.InterruptedException; + method public abstract void awaitUninterruptibly(); + method public abstract boolean awaitUntil(java.util.Date) throws java.lang.InterruptedException; + method public abstract void signal(); + method public abstract void signalAll(); + } + + public abstract interface Lock { + method public abstract void lock(); + method public abstract void lockInterruptibly() throws java.lang.InterruptedException; + method public abstract java.util.concurrent.locks.Condition newCondition(); + method public abstract boolean tryLock(); + method public abstract boolean tryLock(long, java.util.concurrent.TimeUnit) throws java.lang.InterruptedException; + method public abstract void unlock(); + } + + public class LockSupport { + method public static java.lang.Object getBlocker(java.lang.Thread); + method public static void park(java.lang.Object); + method public static void park(); + method public static void parkNanos(java.lang.Object, long); + method public static void parkNanos(long); + method public static void parkUntil(java.lang.Object, long); + method public static void parkUntil(long); + method public static void unpark(java.lang.Thread); + } + + public abstract interface ReadWriteLock { + method public abstract java.util.concurrent.locks.Lock readLock(); + method public abstract java.util.concurrent.locks.Lock writeLock(); + } + + public class ReentrantLock implements java.util.concurrent.locks.Lock java.io.Serializable { + ctor public ReentrantLock(); + ctor public ReentrantLock(boolean); + method public int getHoldCount(); + method protected java.lang.Thread getOwner(); + method public final int getQueueLength(); + method protected java.util.Collection getQueuedThreads(); + method public int getWaitQueueLength(java.util.concurrent.locks.Condition); + method protected java.util.Collection getWaitingThreads(java.util.concurrent.locks.Condition); + method public final boolean hasQueuedThread(java.lang.Thread); + method public final boolean hasQueuedThreads(); + method public boolean hasWaiters(java.util.concurrent.locks.Condition); + method public final boolean isFair(); + method public boolean isHeldByCurrentThread(); + method public boolean isLocked(); + method public void lock(); + method public void lockInterruptibly() throws java.lang.InterruptedException; + method public java.util.concurrent.locks.Condition newCondition(); + method public boolean tryLock(); + method public boolean tryLock(long, java.util.concurrent.TimeUnit) throws java.lang.InterruptedException; + method public void unlock(); + } + + public class ReentrantReadWriteLock implements java.util.concurrent.locks.ReadWriteLock java.io.Serializable { + ctor public ReentrantReadWriteLock(); + ctor public ReentrantReadWriteLock(boolean); + method protected java.lang.Thread getOwner(); + method public final int getQueueLength(); + method protected java.util.Collection getQueuedReaderThreads(); + method protected java.util.Collection getQueuedThreads(); + method protected java.util.Collection getQueuedWriterThreads(); + method public int getReadHoldCount(); + method public int getReadLockCount(); + method public int getWaitQueueLength(java.util.concurrent.locks.Condition); + method protected java.util.Collection getWaitingThreads(java.util.concurrent.locks.Condition); + method public int getWriteHoldCount(); + method public final boolean hasQueuedThread(java.lang.Thread); + method public final boolean hasQueuedThreads(); + method public boolean hasWaiters(java.util.concurrent.locks.Condition); + method public final boolean isFair(); + method public boolean isWriteLocked(); + method public boolean isWriteLockedByCurrentThread(); + method public java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock readLock(); + method public java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock writeLock(); + } + + public static class ReentrantReadWriteLock.ReadLock implements java.util.concurrent.locks.Lock java.io.Serializable { + ctor protected ReentrantReadWriteLock.ReadLock(java.util.concurrent.locks.ReentrantReadWriteLock); + method public void lock(); + method public void lockInterruptibly() throws java.lang.InterruptedException; + method public java.util.concurrent.locks.Condition newCondition(); + method public boolean tryLock(); + method public boolean tryLock(long, java.util.concurrent.TimeUnit) throws java.lang.InterruptedException; + method public void unlock(); + } + + public static class ReentrantReadWriteLock.WriteLock implements java.util.concurrent.locks.Lock java.io.Serializable { + ctor protected ReentrantReadWriteLock.WriteLock(java.util.concurrent.locks.ReentrantReadWriteLock); + method public int getHoldCount(); + method public boolean isHeldByCurrentThread(); + method public void lock(); + method public void lockInterruptibly() throws java.lang.InterruptedException; + method public java.util.concurrent.locks.Condition newCondition(); + method public boolean tryLock(); + method public boolean tryLock(long, java.util.concurrent.TimeUnit) throws java.lang.InterruptedException; + method public void unlock(); + } + +} + +package java.util.jar { + + public class Attributes implements java.lang.Cloneable java.util.Map { + ctor public Attributes(); + ctor public Attributes(java.util.jar.Attributes); + ctor public Attributes(int); + method public void clear(); + method public java.lang.Object clone(); + method public boolean containsKey(java.lang.Object); + method public boolean containsValue(java.lang.Object); + method public java.util.Set> entrySet(); + method public java.lang.Object get(java.lang.Object); + method public java.lang.String getValue(java.util.jar.Attributes.Name); + method public java.lang.String getValue(java.lang.String); + method public boolean isEmpty(); + method public java.util.Set keySet(); + method public java.lang.Object put(java.lang.Object, java.lang.Object); + method public void putAll(java.util.Map); + method public java.lang.String putValue(java.lang.String, java.lang.String); + method public java.lang.Object remove(java.lang.Object); + method public int size(); + method public java.util.Collection values(); + field protected java.util.Map map; + } + + public static class Attributes.Name { + ctor public Attributes.Name(java.lang.String); + field public static final java.util.jar.Attributes.Name CLASS_PATH; + field public static final java.util.jar.Attributes.Name CONTENT_TYPE; + field public static final java.util.jar.Attributes.Name EXTENSION_INSTALLATION; + field public static final java.util.jar.Attributes.Name EXTENSION_LIST; + field public static final java.util.jar.Attributes.Name EXTENSION_NAME; + field public static final java.util.jar.Attributes.Name IMPLEMENTATION_TITLE; + field public static final java.util.jar.Attributes.Name IMPLEMENTATION_URL; + field public static final java.util.jar.Attributes.Name IMPLEMENTATION_VENDOR; + field public static final java.util.jar.Attributes.Name IMPLEMENTATION_VENDOR_ID; + field public static final java.util.jar.Attributes.Name IMPLEMENTATION_VERSION; + field public static final java.util.jar.Attributes.Name MAIN_CLASS; + field public static final java.util.jar.Attributes.Name MANIFEST_VERSION; + field public static final java.util.jar.Attributes.Name SEALED; + field public static final java.util.jar.Attributes.Name SIGNATURE_VERSION; + field public static final java.util.jar.Attributes.Name SPECIFICATION_TITLE; + field public static final java.util.jar.Attributes.Name SPECIFICATION_VENDOR; + field public static final java.util.jar.Attributes.Name SPECIFICATION_VERSION; + } + + public class JarEntry extends java.util.zip.ZipEntry { + ctor public JarEntry(java.lang.String); + ctor public JarEntry(java.util.zip.ZipEntry); + ctor public JarEntry(java.util.jar.JarEntry); + method public java.util.jar.Attributes getAttributes() throws java.io.IOException; + method public java.security.cert.Certificate[] getCertificates(); + method public java.security.CodeSigner[] getCodeSigners(); + } + + public class JarException extends java.util.zip.ZipException { + ctor public JarException(); + ctor public JarException(java.lang.String); + } + + public class JarFile extends java.util.zip.ZipFile { + ctor public JarFile(java.io.File) throws java.io.IOException; + ctor public JarFile(java.io.File, boolean) throws java.io.IOException; + ctor public JarFile(java.io.File, boolean, int) throws java.io.IOException; + ctor public JarFile(java.lang.String) throws java.io.IOException; + ctor public JarFile(java.lang.String, boolean) throws java.io.IOException; + method public java.util.jar.JarEntry getJarEntry(java.lang.String); + method public java.util.jar.Manifest getManifest() throws java.io.IOException; + field public static final java.lang.String MANIFEST_NAME = "META-INF/MANIFEST.MF"; + } + + public class JarInputStream extends java.util.zip.ZipInputStream { + ctor public JarInputStream(java.io.InputStream, boolean) throws java.io.IOException; + ctor public JarInputStream(java.io.InputStream) throws java.io.IOException; + method public java.util.jar.Manifest getManifest(); + method public java.util.jar.JarEntry getNextJarEntry() throws java.io.IOException; + } + + public class JarOutputStream extends java.util.zip.ZipOutputStream { + ctor public JarOutputStream(java.io.OutputStream, java.util.jar.Manifest) throws java.io.IOException; + ctor public JarOutputStream(java.io.OutputStream) throws java.io.IOException; + } + + public class Manifest implements java.lang.Cloneable { + ctor public Manifest(); + ctor public Manifest(java.io.InputStream) throws java.io.IOException; + ctor public Manifest(java.util.jar.Manifest); + method public void clear(); + method public java.lang.Object clone(); + method public java.util.jar.Attributes getAttributes(java.lang.String); + method public java.util.Map getEntries(); + method public java.util.jar.Attributes getMainAttributes(); + method public void read(java.io.InputStream) throws java.io.IOException; + method public void write(java.io.OutputStream) throws java.io.IOException; + } + + public abstract class Pack200 { + method public static java.util.jar.Pack200.Packer newPacker(); + method public static java.util.jar.Pack200.Unpacker newUnpacker(); + } + + public static abstract interface Pack200.Packer { + method public abstract void addPropertyChangeListener(java.beans.PropertyChangeListener); + method public abstract void pack(java.util.jar.JarFile, java.io.OutputStream) throws java.io.IOException; + method public abstract void pack(java.util.jar.JarInputStream, java.io.OutputStream) throws java.io.IOException; + method public abstract java.util.SortedMap properties(); + method public abstract void removePropertyChangeListener(java.beans.PropertyChangeListener); + field public static final java.lang.String CLASS_ATTRIBUTE_PFX = "pack.class.attribute."; + field public static final java.lang.String CODE_ATTRIBUTE_PFX = "pack.code.attribute."; + field public static final java.lang.String DEFLATE_HINT = "pack.deflate.hint"; + field public static final java.lang.String EFFORT = "pack.effort"; + field public static final java.lang.String ERROR = "error"; + field public static final java.lang.String FALSE = "false"; + field public static final java.lang.String FIELD_ATTRIBUTE_PFX = "pack.field.attribute."; + field public static final java.lang.String KEEP = "keep"; + field public static final java.lang.String KEEP_FILE_ORDER = "pack.keep.file.order"; + field public static final java.lang.String LATEST = "latest"; + field public static final java.lang.String METHOD_ATTRIBUTE_PFX = "pack.method.attribute."; + field public static final java.lang.String MODIFICATION_TIME = "pack.modification.time"; + field public static final java.lang.String PASS = "pass"; + field public static final java.lang.String PASS_FILE_PFX = "pack.pass.file."; + field public static final java.lang.String PROGRESS = "pack.progress"; + field public static final java.lang.String SEGMENT_LIMIT = "pack.segment.limit"; + field public static final java.lang.String STRIP = "strip"; + field public static final java.lang.String TRUE = "true"; + field public static final java.lang.String UNKNOWN_ATTRIBUTE = "pack.unknown.attribute"; + } + + public static abstract interface Pack200.Unpacker { + method public abstract void addPropertyChangeListener(java.beans.PropertyChangeListener); + method public abstract java.util.SortedMap properties(); + method public abstract void removePropertyChangeListener(java.beans.PropertyChangeListener); + method public abstract void unpack(java.io.InputStream, java.util.jar.JarOutputStream) throws java.io.IOException; + method public abstract void unpack(java.io.File, java.util.jar.JarOutputStream) throws java.io.IOException; + field public static final java.lang.String DEFLATE_HINT = "unpack.deflate.hint"; + field public static final java.lang.String FALSE = "false"; + field public static final java.lang.String KEEP = "keep"; + field public static final java.lang.String PROGRESS = "unpack.progress"; + field public static final java.lang.String TRUE = "true"; + } + +} + +package java.util.logging { + + public class ConsoleHandler extends java.util.logging.StreamHandler { + ctor public ConsoleHandler(); + } + + public class ErrorManager { + ctor public ErrorManager(); + method public void error(java.lang.String, java.lang.Exception, int); + field public static final int CLOSE_FAILURE = 3; // 0x3 + field public static final int FLUSH_FAILURE = 2; // 0x2 + field public static final int FORMAT_FAILURE = 5; // 0x5 + field public static final int GENERIC_FAILURE = 0; // 0x0 + field public static final int OPEN_FAILURE = 4; // 0x4 + field public static final int WRITE_FAILURE = 1; // 0x1 + } + + public class FileHandler extends java.util.logging.StreamHandler { + ctor public FileHandler() throws java.io.IOException; + ctor public FileHandler(java.lang.String) throws java.io.IOException; + ctor public FileHandler(java.lang.String, boolean) throws java.io.IOException; + ctor public FileHandler(java.lang.String, int, int) throws java.io.IOException; + ctor public FileHandler(java.lang.String, int, int, boolean) throws java.io.IOException; + } + + public abstract interface Filter { + method public abstract boolean isLoggable(java.util.logging.LogRecord); + } + + public abstract class Formatter { + ctor protected Formatter(); + method public abstract java.lang.String format(java.util.logging.LogRecord); + method public java.lang.String formatMessage(java.util.logging.LogRecord); + method public java.lang.String getHead(java.util.logging.Handler); + method public java.lang.String getTail(java.util.logging.Handler); + } + + public abstract class Handler { + ctor protected Handler(); + method public abstract void close(); + method public abstract void flush(); + method public java.lang.String getEncoding(); + method public java.util.logging.ErrorManager getErrorManager(); + method public java.util.logging.Filter getFilter(); + method public java.util.logging.Formatter getFormatter(); + method public java.util.logging.Level getLevel(); + method public boolean isLoggable(java.util.logging.LogRecord); + method public abstract void publish(java.util.logging.LogRecord); + method protected void reportError(java.lang.String, java.lang.Exception, int); + method public void setEncoding(java.lang.String) throws java.io.UnsupportedEncodingException; + method public void setErrorManager(java.util.logging.ErrorManager); + method public void setFilter(java.util.logging.Filter); + method public void setFormatter(java.util.logging.Formatter); + method public void setLevel(java.util.logging.Level); + } + + public class Level implements java.io.Serializable { + ctor protected Level(java.lang.String, int); + ctor protected Level(java.lang.String, int, java.lang.String); + method public java.lang.String getLocalizedName(); + method public java.lang.String getName(); + method public java.lang.String getResourceBundleName(); + method public final int intValue(); + method public static java.util.logging.Level parse(java.lang.String) throws java.lang.IllegalArgumentException; + method public final java.lang.String toString(); + field public static final java.util.logging.Level ALL; + field public static final java.util.logging.Level CONFIG; + field public static final java.util.logging.Level FINE; + field public static final java.util.logging.Level FINER; + field public static final java.util.logging.Level FINEST; + field public static final java.util.logging.Level INFO; + field public static final java.util.logging.Level OFF; + field public static final java.util.logging.Level SEVERE; + field public static final java.util.logging.Level WARNING; + } + + public class LogManager { + ctor protected LogManager(); + method public synchronized boolean addLogger(java.util.logging.Logger); + method public void addPropertyChangeListener(java.beans.PropertyChangeListener); + method public void checkAccess(); + method public static java.util.logging.LogManager getLogManager(); + method public synchronized java.util.logging.Logger getLogger(java.lang.String); + method public synchronized java.util.Enumeration getLoggerNames(); + method public static java.util.logging.LoggingMXBean getLoggingMXBean(); + method public java.lang.String getProperty(java.lang.String); + method public void readConfiguration() throws java.io.IOException; + method public void readConfiguration(java.io.InputStream) throws java.io.IOException; + method public void removePropertyChangeListener(java.beans.PropertyChangeListener); + method public synchronized void reset(); + field public static final java.lang.String LOGGING_MXBEAN_NAME = "java.util.logging:type=Logging"; + } + + public class LogRecord implements java.io.Serializable { + ctor public LogRecord(java.util.logging.Level, java.lang.String); + method public java.util.logging.Level getLevel(); + method public java.lang.String getLoggerName(); + method public java.lang.String getMessage(); + method public long getMillis(); + method public java.lang.Object[] getParameters(); + method public java.util.ResourceBundle getResourceBundle(); + method public java.lang.String getResourceBundleName(); + method public long getSequenceNumber(); + method public java.lang.String getSourceClassName(); + method public java.lang.String getSourceMethodName(); + method public int getThreadID(); + method public java.lang.Throwable getThrown(); + method public void setLevel(java.util.logging.Level); + method public void setLoggerName(java.lang.String); + method public void setMessage(java.lang.String); + method public void setMillis(long); + method public void setParameters(java.lang.Object[]); + method public void setResourceBundle(java.util.ResourceBundle); + method public void setResourceBundleName(java.lang.String); + method public void setSequenceNumber(long); + method public void setSourceClassName(java.lang.String); + method public void setSourceMethodName(java.lang.String); + method public void setThreadID(int); + method public void setThrown(java.lang.Throwable); + } + + public class Logger { + ctor protected Logger(java.lang.String, java.lang.String); + method public void addHandler(java.util.logging.Handler); + method public void config(java.lang.String); + method public void entering(java.lang.String, java.lang.String); + method public void entering(java.lang.String, java.lang.String, java.lang.Object); + method public void entering(java.lang.String, java.lang.String, java.lang.Object[]); + method public void exiting(java.lang.String, java.lang.String); + method public void exiting(java.lang.String, java.lang.String, java.lang.Object); + method public void fine(java.lang.String); + method public void finer(java.lang.String); + method public void finest(java.lang.String); + method public static java.util.logging.Logger getAnonymousLogger(); + method public static java.util.logging.Logger getAnonymousLogger(java.lang.String); + method public java.util.logging.Filter getFilter(); + method public java.util.logging.Handler[] getHandlers(); + method public java.util.logging.Level getLevel(); + method public static java.util.logging.Logger getLogger(java.lang.String); + method public static java.util.logging.Logger getLogger(java.lang.String, java.lang.String); + method public java.lang.String getName(); + method public java.util.logging.Logger getParent(); + method public java.util.ResourceBundle getResourceBundle(); + method public java.lang.String getResourceBundleName(); + method public boolean getUseParentHandlers(); + method public void info(java.lang.String); + method public boolean isLoggable(java.util.logging.Level); + method public void log(java.util.logging.Level, java.lang.String); + method public void log(java.util.logging.Level, java.lang.String, java.lang.Object); + method public void log(java.util.logging.Level, java.lang.String, java.lang.Object[]); + method public void log(java.util.logging.Level, java.lang.String, java.lang.Throwable); + method public void log(java.util.logging.LogRecord); + method public void logp(java.util.logging.Level, java.lang.String, java.lang.String, java.lang.String); + method public void logp(java.util.logging.Level, java.lang.String, java.lang.String, java.lang.String, java.lang.Object); + method public void logp(java.util.logging.Level, java.lang.String, java.lang.String, java.lang.String, java.lang.Object[]); + method public void logp(java.util.logging.Level, java.lang.String, java.lang.String, java.lang.String, java.lang.Throwable); + method public void logrb(java.util.logging.Level, java.lang.String, java.lang.String, java.lang.String, java.lang.String); + method public void logrb(java.util.logging.Level, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.Object); + method public void logrb(java.util.logging.Level, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.Object[]); + method public void logrb(java.util.logging.Level, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.Throwable); + method public void removeHandler(java.util.logging.Handler); + method public void setFilter(java.util.logging.Filter); + method public void setLevel(java.util.logging.Level); + method public void setParent(java.util.logging.Logger); + method public void setUseParentHandlers(boolean); + method public void severe(java.lang.String); + method public void throwing(java.lang.String, java.lang.String, java.lang.Throwable); + method public void warning(java.lang.String); + field public static final java.lang.String GLOBAL_LOGGER_NAME = "global"; + field public static final deprecated java.util.logging.Logger global; + } + + public abstract interface LoggingMXBean { + method public abstract java.lang.String getLoggerLevel(java.lang.String); + method public abstract java.util.List getLoggerNames(); + method public abstract java.lang.String getParentLoggerName(java.lang.String); + method public abstract void setLoggerLevel(java.lang.String, java.lang.String); + } + + public final class LoggingPermission extends java.security.BasicPermission implements java.security.Guard java.io.Serializable { + ctor public LoggingPermission(java.lang.String, java.lang.String); + } + + public class MemoryHandler extends java.util.logging.Handler { + ctor public MemoryHandler(); + ctor public MemoryHandler(java.util.logging.Handler, int, java.util.logging.Level); + method public void close(); + method public void flush(); + method public java.util.logging.Level getPushLevel(); + method public synchronized void publish(java.util.logging.LogRecord); + method public void push(); + method public void setPushLevel(java.util.logging.Level); + } + + public class SimpleFormatter extends java.util.logging.Formatter { + ctor public SimpleFormatter(); + method public java.lang.String format(java.util.logging.LogRecord); + } + + public class SocketHandler extends java.util.logging.StreamHandler { + ctor public SocketHandler() throws java.io.IOException; + ctor public SocketHandler(java.lang.String, int) throws java.io.IOException; + } + + public class StreamHandler extends java.util.logging.Handler { + ctor public StreamHandler(); + ctor public StreamHandler(java.io.OutputStream, java.util.logging.Formatter); + method public void close(); + method public void flush(); + method public synchronized void publish(java.util.logging.LogRecord); + method protected void setOutputStream(java.io.OutputStream); + } + + public class XMLFormatter extends java.util.logging.Formatter { + ctor public XMLFormatter(); + method public java.lang.String format(java.util.logging.LogRecord); + } + +} + +package java.util.prefs { + + public abstract class AbstractPreferences extends java.util.prefs.Preferences { + ctor protected AbstractPreferences(java.util.prefs.AbstractPreferences, java.lang.String); + method public java.lang.String absolutePath(); + method public void addNodeChangeListener(java.util.prefs.NodeChangeListener); + method public void addPreferenceChangeListener(java.util.prefs.PreferenceChangeListener); + method protected final java.util.prefs.AbstractPreferences[] cachedChildren(); + method protected abstract java.util.prefs.AbstractPreferences childSpi(java.lang.String); + method public java.lang.String[] childrenNames() throws java.util.prefs.BackingStoreException; + method protected abstract java.lang.String[] childrenNamesSpi() throws java.util.prefs.BackingStoreException; + method public void clear() throws java.util.prefs.BackingStoreException; + method public void exportNode(java.io.OutputStream) throws java.util.prefs.BackingStoreException, java.io.IOException; + method public void exportSubtree(java.io.OutputStream) throws java.util.prefs.BackingStoreException, java.io.IOException; + method public void flush() throws java.util.prefs.BackingStoreException; + method protected abstract void flushSpi() throws java.util.prefs.BackingStoreException; + method public java.lang.String get(java.lang.String, java.lang.String); + method public boolean getBoolean(java.lang.String, boolean); + method public byte[] getByteArray(java.lang.String, byte[]); + method protected java.util.prefs.AbstractPreferences getChild(java.lang.String) throws java.util.prefs.BackingStoreException; + method public double getDouble(java.lang.String, double); + method public float getFloat(java.lang.String, float); + method public int getInt(java.lang.String, int); + method public long getLong(java.lang.String, long); + method protected abstract java.lang.String getSpi(java.lang.String); + method protected boolean isRemoved(); + method public boolean isUserNode(); + method public java.lang.String[] keys() throws java.util.prefs.BackingStoreException; + method protected abstract java.lang.String[] keysSpi() throws java.util.prefs.BackingStoreException; + method public java.lang.String name(); + method public java.util.prefs.Preferences node(java.lang.String); + method public boolean nodeExists(java.lang.String) throws java.util.prefs.BackingStoreException; + method public java.util.prefs.Preferences parent(); + method public void put(java.lang.String, java.lang.String); + method public void putBoolean(java.lang.String, boolean); + method public void putByteArray(java.lang.String, byte[]); + method public void putDouble(java.lang.String, double); + method public void putFloat(java.lang.String, float); + method public void putInt(java.lang.String, int); + method public void putLong(java.lang.String, long); + method protected abstract void putSpi(java.lang.String, java.lang.String); + method public void remove(java.lang.String); + method public void removeNode() throws java.util.prefs.BackingStoreException; + method public void removeNodeChangeListener(java.util.prefs.NodeChangeListener); + method protected abstract void removeNodeSpi() throws java.util.prefs.BackingStoreException; + method public void removePreferenceChangeListener(java.util.prefs.PreferenceChangeListener); + method protected abstract void removeSpi(java.lang.String); + method public void sync() throws java.util.prefs.BackingStoreException; + method protected abstract void syncSpi() throws java.util.prefs.BackingStoreException; + method public java.lang.String toString(); + field protected final java.lang.Object lock; + field protected boolean newNode; + } + + public class BackingStoreException extends java.lang.Exception { + ctor public BackingStoreException(java.lang.String); + ctor public BackingStoreException(java.lang.Throwable); + } + + public class InvalidPreferencesFormatException extends java.lang.Exception { + ctor public InvalidPreferencesFormatException(java.lang.String); + ctor public InvalidPreferencesFormatException(java.lang.String, java.lang.Throwable); + ctor public InvalidPreferencesFormatException(java.lang.Throwable); + } + + public class NodeChangeEvent extends java.util.EventObject implements java.io.Serializable { + ctor public NodeChangeEvent(java.util.prefs.Preferences, java.util.prefs.Preferences); + method public java.util.prefs.Preferences getChild(); + method public java.util.prefs.Preferences getParent(); + } + + public abstract interface NodeChangeListener implements java.util.EventListener { + method public abstract void childAdded(java.util.prefs.NodeChangeEvent); + method public abstract void childRemoved(java.util.prefs.NodeChangeEvent); + } + + public class PreferenceChangeEvent extends java.util.EventObject implements java.io.Serializable { + ctor public PreferenceChangeEvent(java.util.prefs.Preferences, java.lang.String, java.lang.String); + method public java.lang.String getKey(); + method public java.lang.String getNewValue(); + method public java.util.prefs.Preferences getNode(); + } + + public abstract interface PreferenceChangeListener implements java.util.EventListener { + method public abstract void preferenceChange(java.util.prefs.PreferenceChangeEvent); + } + + public abstract class Preferences { + ctor protected Preferences(); + method public abstract java.lang.String absolutePath(); + method public abstract void addNodeChangeListener(java.util.prefs.NodeChangeListener); + method public abstract void addPreferenceChangeListener(java.util.prefs.PreferenceChangeListener); + method public abstract java.lang.String[] childrenNames() throws java.util.prefs.BackingStoreException; + method public abstract void clear() throws java.util.prefs.BackingStoreException; + method public abstract void exportNode(java.io.OutputStream) throws java.util.prefs.BackingStoreException, java.io.IOException; + method public abstract void exportSubtree(java.io.OutputStream) throws java.util.prefs.BackingStoreException, java.io.IOException; + method public abstract void flush() throws java.util.prefs.BackingStoreException; + method public abstract java.lang.String get(java.lang.String, java.lang.String); + method public abstract boolean getBoolean(java.lang.String, boolean); + method public abstract byte[] getByteArray(java.lang.String, byte[]); + method public abstract double getDouble(java.lang.String, double); + method public abstract float getFloat(java.lang.String, float); + method public abstract int getInt(java.lang.String, int); + method public abstract long getLong(java.lang.String, long); + method public static void importPreferences(java.io.InputStream) throws java.io.IOException, java.util.prefs.InvalidPreferencesFormatException; + method public abstract boolean isUserNode(); + method public abstract java.lang.String[] keys() throws java.util.prefs.BackingStoreException; + method public abstract java.lang.String name(); + method public abstract java.util.prefs.Preferences node(java.lang.String); + method public abstract boolean nodeExists(java.lang.String) throws java.util.prefs.BackingStoreException; + method public abstract java.util.prefs.Preferences parent(); + method public abstract void put(java.lang.String, java.lang.String); + method public abstract void putBoolean(java.lang.String, boolean); + method public abstract void putByteArray(java.lang.String, byte[]); + method public abstract void putDouble(java.lang.String, double); + method public abstract void putFloat(java.lang.String, float); + method public abstract void putInt(java.lang.String, int); + method public abstract void putLong(java.lang.String, long); + method public abstract void remove(java.lang.String); + method public abstract void removeNode() throws java.util.prefs.BackingStoreException; + method public abstract void removeNodeChangeListener(java.util.prefs.NodeChangeListener); + method public abstract void removePreferenceChangeListener(java.util.prefs.PreferenceChangeListener); + method public abstract void sync() throws java.util.prefs.BackingStoreException; + method public static java.util.prefs.Preferences systemNodeForPackage(java.lang.Class); + method public static java.util.prefs.Preferences systemRoot(); + method public abstract java.lang.String toString(); + method public static java.util.prefs.Preferences userNodeForPackage(java.lang.Class); + method public static java.util.prefs.Preferences userRoot(); + field public static final int MAX_KEY_LENGTH = 80; // 0x50 + field public static final int MAX_NAME_LENGTH = 80; // 0x50 + field public static final int MAX_VALUE_LENGTH = 8192; // 0x2000 + } + + public abstract interface PreferencesFactory { + method public abstract java.util.prefs.Preferences systemRoot(); + method public abstract java.util.prefs.Preferences userRoot(); + } + +} + +package java.util.regex { + + public abstract interface MatchResult { + method public abstract int end(); + method public abstract int end(int); + method public abstract java.lang.String group(); + method public abstract java.lang.String group(int); + method public abstract int groupCount(); + method public abstract int start(); + method public abstract int start(int); + } + + public final class Matcher implements java.util.regex.MatchResult { + method public java.util.regex.Matcher appendReplacement(java.lang.StringBuffer, java.lang.String); + method public java.lang.StringBuffer appendTail(java.lang.StringBuffer); + method public int end(int); + method public int end(); + method public boolean find(int); + method public boolean find(); + method public java.lang.String group(int); + method public java.lang.String group(); + method public int groupCount(); + method public boolean hasAnchoringBounds(); + method public boolean hasTransparentBounds(); + method public boolean hitEnd(); + method public boolean lookingAt(); + method public boolean matches(); + method public java.util.regex.Pattern pattern(); + method public static java.lang.String quoteReplacement(java.lang.String); + method public java.util.regex.Matcher region(int, int); + method public int regionEnd(); + method public int regionStart(); + method public java.lang.String replaceAll(java.lang.String); + method public java.lang.String replaceFirst(java.lang.String); + method public boolean requireEnd(); + method public java.util.regex.Matcher reset(); + method public java.util.regex.Matcher reset(java.lang.CharSequence); + method public int start(int) throws java.lang.IllegalStateException; + method public int start(); + method public java.util.regex.MatchResult toMatchResult(); + method public java.util.regex.Matcher useAnchoringBounds(boolean); + method public java.util.regex.Matcher usePattern(java.util.regex.Pattern); + method public java.util.regex.Matcher useTransparentBounds(boolean); + } + + public final class Pattern implements java.io.Serializable { + method public static java.util.regex.Pattern compile(java.lang.String, int) throws java.util.regex.PatternSyntaxException; + method public static java.util.regex.Pattern compile(java.lang.String); + method public int flags(); + method public java.util.regex.Matcher matcher(java.lang.CharSequence); + method public static boolean matches(java.lang.String, java.lang.CharSequence); + method public java.lang.String pattern(); + method public static java.lang.String quote(java.lang.String); + method public java.lang.String[] split(java.lang.CharSequence, int); + method public java.lang.String[] split(java.lang.CharSequence); + field public static final int CANON_EQ = 128; // 0x80 + field public static final int CASE_INSENSITIVE = 2; // 0x2 + field public static final int COMMENTS = 4; // 0x4 + field public static final int DOTALL = 32; // 0x20 + field public static final int LITERAL = 16; // 0x10 + field public static final int MULTILINE = 8; // 0x8 + field public static final int UNICODE_CASE = 64; // 0x40 + field public static final int UNIX_LINES = 1; // 0x1 + } + + public class PatternSyntaxException extends java.lang.IllegalArgumentException { + ctor public PatternSyntaxException(java.lang.String, java.lang.String, int); + method public java.lang.String getDescription(); + method public int getIndex(); + method public java.lang.String getPattern(); + } + +} + +package java.util.zip { + + public class Adler32 implements java.util.zip.Checksum { + ctor public Adler32(); + method public long getValue(); + method public void reset(); + method public void update(int); + method public void update(byte[]); + method public void update(byte[], int, int); + } + + public class CRC32 implements java.util.zip.Checksum { + ctor public CRC32(); + method public long getValue(); + method public void reset(); + method public void update(int); + method public void update(byte[]); + method public void update(byte[], int, int); + } + + public class CheckedInputStream extends java.io.FilterInputStream { + ctor public CheckedInputStream(java.io.InputStream, java.util.zip.Checksum); + method public java.util.zip.Checksum getChecksum(); + } + + public class CheckedOutputStream extends java.io.FilterOutputStream { + ctor public CheckedOutputStream(java.io.OutputStream, java.util.zip.Checksum); + method public java.util.zip.Checksum getChecksum(); + } + + public abstract interface Checksum { + method public abstract long getValue(); + method public abstract void reset(); + method public abstract void update(byte[], int, int); + method public abstract void update(int); + } + + public class DataFormatException extends java.lang.Exception { + ctor public DataFormatException(); + ctor public DataFormatException(java.lang.String); + } + + public class Deflater { + ctor public Deflater(); + ctor public Deflater(int); + ctor public Deflater(int, boolean); + method public int deflate(byte[]); + method public synchronized int deflate(byte[], int, int); + method public synchronized void end(); + method public synchronized void finish(); + method public synchronized boolean finished(); + method public synchronized int getAdler(); + method public synchronized long getBytesRead(); + method public synchronized long getBytesWritten(); + method public synchronized int getTotalIn(); + method public synchronized int getTotalOut(); + method public synchronized boolean needsInput(); + method public synchronized void reset(); + method public void setDictionary(byte[]); + method public synchronized void setDictionary(byte[], int, int); + method public void setInput(byte[]); + method public synchronized void setInput(byte[], int, int); + method public synchronized void setLevel(int); + method public synchronized void setStrategy(int); + field public static final int BEST_COMPRESSION = 9; // 0x9 + field public static final int BEST_SPEED = 1; // 0x1 + field public static final int DEFAULT_COMPRESSION = -1; // 0xffffffff + field public static final int DEFAULT_STRATEGY = 0; // 0x0 + field public static final int DEFLATED = 8; // 0x8 + field public static final int FILTERED = 1; // 0x1 + field public static final int HUFFMAN_ONLY = 2; // 0x2 + field public static final int NO_COMPRESSION = 0; // 0x0 + } + + public class DeflaterInputStream extends java.io.FilterInputStream { + ctor public DeflaterInputStream(java.io.InputStream); + ctor public DeflaterInputStream(java.io.InputStream, java.util.zip.Deflater); + ctor public DeflaterInputStream(java.io.InputStream, java.util.zip.Deflater, int); + field protected final byte[] buf; + field protected final java.util.zip.Deflater def; + } + + public class DeflaterOutputStream extends java.io.FilterOutputStream { + ctor public DeflaterOutputStream(java.io.OutputStream, java.util.zip.Deflater); + ctor public DeflaterOutputStream(java.io.OutputStream); + ctor public DeflaterOutputStream(java.io.OutputStream, java.util.zip.Deflater, int); + method protected void deflate() throws java.io.IOException; + method public void finish() throws java.io.IOException; + field protected byte[] buf; + field protected java.util.zip.Deflater def; + } + + public class GZIPInputStream extends java.util.zip.InflaterInputStream { + ctor public GZIPInputStream(java.io.InputStream) throws java.io.IOException; + ctor public GZIPInputStream(java.io.InputStream, int) throws java.io.IOException; + field public static final int GZIP_MAGIC = 35615; // 0x8b1f + field protected java.util.zip.CRC32 crc; + field protected boolean eos; + } + + public class GZIPOutputStream extends java.util.zip.DeflaterOutputStream { + ctor public GZIPOutputStream(java.io.OutputStream) throws java.io.IOException; + ctor public GZIPOutputStream(java.io.OutputStream, int) throws java.io.IOException; + field protected java.util.zip.CRC32 crc; + } + + public class Inflater { + ctor public Inflater(); + ctor public Inflater(boolean); + method public synchronized void end(); + method public synchronized boolean finished(); + method public synchronized int getAdler(); + method public synchronized long getBytesRead(); + method public synchronized long getBytesWritten(); + method public synchronized int getRemaining(); + method public synchronized int getTotalIn(); + method public synchronized int getTotalOut(); + method public int inflate(byte[]) throws java.util.zip.DataFormatException; + method public synchronized int inflate(byte[], int, int) throws java.util.zip.DataFormatException; + method public synchronized boolean needsDictionary(); + method public synchronized boolean needsInput(); + method public synchronized void reset(); + method public synchronized void setDictionary(byte[]); + method public synchronized void setDictionary(byte[], int, int); + method public synchronized void setInput(byte[]); + method public synchronized void setInput(byte[], int, int); + } + + public class InflaterInputStream extends java.io.FilterInputStream { + ctor public InflaterInputStream(java.io.InputStream); + ctor public InflaterInputStream(java.io.InputStream, java.util.zip.Inflater); + ctor public InflaterInputStream(java.io.InputStream, java.util.zip.Inflater, int); + method protected void fill() throws java.io.IOException; + field protected byte[] buf; + field protected java.util.zip.Inflater inf; + field protected int len; + } + + public class InflaterOutputStream extends java.io.FilterOutputStream { + ctor public InflaterOutputStream(java.io.OutputStream); + ctor public InflaterOutputStream(java.io.OutputStream, java.util.zip.Inflater); + ctor public InflaterOutputStream(java.io.OutputStream, java.util.zip.Inflater, int); + method public void finish() throws java.io.IOException; + field protected final byte[] buf; + field protected final java.util.zip.Inflater inf; + } + + public class ZipEntry implements java.lang.Cloneable { + ctor public ZipEntry(java.lang.String); + ctor public ZipEntry(java.util.zip.ZipEntry); + method public java.lang.Object clone(); + method public java.lang.String getComment(); + method public long getCompressedSize(); + method public long getCrc(); + method public byte[] getExtra(); + method public int getMethod(); + method public java.lang.String getName(); + method public long getSize(); + method public long getTime(); + method public boolean isDirectory(); + method public void setComment(java.lang.String); + method public void setCompressedSize(long); + method public void setCrc(long); + method public void setExtra(byte[]); + method public void setMethod(int); + method public void setSize(long); + method public void setTime(long); + field public static final int DEFLATED = 8; // 0x8 + field public static final int STORED = 0; // 0x0 + } + + public class ZipError extends java.lang.InternalError { + ctor public ZipError(java.lang.String); + } + + public class ZipException extends java.io.IOException { + ctor public ZipException(); + ctor public ZipException(java.lang.String); + } + + public class ZipFile { + ctor public ZipFile(java.io.File) throws java.io.IOException, java.util.zip.ZipException; + ctor public ZipFile(java.io.File, int) throws java.io.IOException; + ctor public ZipFile(java.lang.String) throws java.io.IOException; + method public void close() throws java.io.IOException; + method public java.util.Enumeration entries(); + method public java.util.zip.ZipEntry getEntry(java.lang.String); + method public java.io.InputStream getInputStream(java.util.zip.ZipEntry) throws java.io.IOException; + method public java.lang.String getName(); + method public int size(); + field public static final int OPEN_DELETE = 4; // 0x4 + field public static final int OPEN_READ = 1; // 0x1 + } + + public class ZipInputStream extends java.util.zip.InflaterInputStream { + ctor public ZipInputStream(java.io.InputStream); + method public void closeEntry() throws java.io.IOException; + method protected java.util.zip.ZipEntry createZipEntry(java.lang.String); + method public java.util.zip.ZipEntry getNextEntry() throws java.io.IOException; + } + + public class ZipOutputStream extends java.util.zip.DeflaterOutputStream { + ctor public ZipOutputStream(java.io.OutputStream); + method public void closeEntry() throws java.io.IOException; + method public void putNextEntry(java.util.zip.ZipEntry) throws java.io.IOException; + method public void setComment(java.lang.String); + method public void setLevel(int); + method public void setMethod(int); + field public static final int DEFLATED = 8; // 0x8 + field public static final int STORED = 0; // 0x0 + } + +} + +package javax.crypto { + + public class BadPaddingException extends java.security.GeneralSecurityException { + ctor public BadPaddingException(java.lang.String); + ctor public BadPaddingException(); + } + + public class Cipher { + ctor protected Cipher(javax.crypto.CipherSpi, java.security.Provider, java.lang.String); + method public final byte[] doFinal() throws javax.crypto.BadPaddingException, javax.crypto.IllegalBlockSizeException; + method public final int doFinal(byte[], int) throws javax.crypto.BadPaddingException, javax.crypto.IllegalBlockSizeException, javax.crypto.ShortBufferException; + method public final byte[] doFinal(byte[]) throws javax.crypto.BadPaddingException, javax.crypto.IllegalBlockSizeException; + method public final byte[] doFinal(byte[], int, int) throws javax.crypto.BadPaddingException, javax.crypto.IllegalBlockSizeException; + method public final int doFinal(byte[], int, int, byte[]) throws javax.crypto.BadPaddingException, javax.crypto.IllegalBlockSizeException, javax.crypto.ShortBufferException; + method public final int doFinal(byte[], int, int, byte[], int) throws javax.crypto.BadPaddingException, javax.crypto.IllegalBlockSizeException, javax.crypto.ShortBufferException; + method public final int doFinal(java.nio.ByteBuffer, java.nio.ByteBuffer) throws javax.crypto.BadPaddingException, javax.crypto.IllegalBlockSizeException, javax.crypto.ShortBufferException; + method public final java.lang.String getAlgorithm(); + method public final int getBlockSize(); + method public final javax.crypto.ExemptionMechanism getExemptionMechanism(); + method public final byte[] getIV(); + method public static final javax.crypto.Cipher getInstance(java.lang.String) throws java.security.NoSuchAlgorithmException, javax.crypto.NoSuchPaddingException; + method public static final javax.crypto.Cipher getInstance(java.lang.String, java.lang.String) throws java.security.NoSuchAlgorithmException, javax.crypto.NoSuchPaddingException, java.security.NoSuchProviderException; + method public static final javax.crypto.Cipher getInstance(java.lang.String, java.security.Provider) throws java.security.NoSuchAlgorithmException, javax.crypto.NoSuchPaddingException; + method public static final int getMaxAllowedKeyLength(java.lang.String) throws java.security.NoSuchAlgorithmException; + method public static final java.security.spec.AlgorithmParameterSpec getMaxAllowedParameterSpec(java.lang.String) throws java.security.NoSuchAlgorithmException; + method public final int getOutputSize(int); + method public final java.security.AlgorithmParameters getParameters(); + method public final java.security.Provider getProvider(); + method public final void init(int, java.security.Key) throws java.security.InvalidKeyException; + method public final void init(int, java.security.Key, java.security.SecureRandom) throws java.security.InvalidKeyException; + method public final void init(int, java.security.Key, java.security.spec.AlgorithmParameterSpec) throws java.security.InvalidAlgorithmParameterException, java.security.InvalidKeyException; + method public final void init(int, java.security.Key, java.security.spec.AlgorithmParameterSpec, java.security.SecureRandom) throws java.security.InvalidAlgorithmParameterException, java.security.InvalidKeyException; + method public final void init(int, java.security.Key, java.security.AlgorithmParameters) throws java.security.InvalidAlgorithmParameterException, java.security.InvalidKeyException; + method public final void init(int, java.security.Key, java.security.AlgorithmParameters, java.security.SecureRandom) throws java.security.InvalidAlgorithmParameterException, java.security.InvalidKeyException; + method public final void init(int, java.security.cert.Certificate) throws java.security.InvalidKeyException; + method public final void init(int, java.security.cert.Certificate, java.security.SecureRandom) throws java.security.InvalidKeyException; + method public final java.security.Key unwrap(byte[], java.lang.String, int) throws java.security.InvalidKeyException, java.security.NoSuchAlgorithmException; + method public final byte[] update(byte[]); + method public final byte[] update(byte[], int, int); + method public final int update(byte[], int, int, byte[]) throws javax.crypto.ShortBufferException; + method public final int update(byte[], int, int, byte[], int) throws javax.crypto.ShortBufferException; + method public final int update(java.nio.ByteBuffer, java.nio.ByteBuffer) throws javax.crypto.ShortBufferException; + method public final byte[] wrap(java.security.Key) throws javax.crypto.IllegalBlockSizeException, java.security.InvalidKeyException; + field public static final int DECRYPT_MODE = 2; // 0x2 + field public static final int ENCRYPT_MODE = 1; // 0x1 + field public static final int PRIVATE_KEY = 2; // 0x2 + field public static final int PUBLIC_KEY = 1; // 0x1 + field public static final int SECRET_KEY = 3; // 0x3 + field public static final int UNWRAP_MODE = 4; // 0x4 + field public static final int WRAP_MODE = 3; // 0x3 + } + + public class CipherInputStream extends java.io.FilterInputStream { + ctor public CipherInputStream(java.io.InputStream, javax.crypto.Cipher); + ctor protected CipherInputStream(java.io.InputStream); + } + + public class CipherOutputStream extends java.io.FilterOutputStream { + ctor public CipherOutputStream(java.io.OutputStream, javax.crypto.Cipher); + ctor protected CipherOutputStream(java.io.OutputStream); + } + + public abstract class CipherSpi { + ctor public CipherSpi(); + method protected abstract byte[] engineDoFinal(byte[], int, int) throws javax.crypto.BadPaddingException, javax.crypto.IllegalBlockSizeException; + method protected abstract int engineDoFinal(byte[], int, int, byte[], int) throws javax.crypto.BadPaddingException, javax.crypto.IllegalBlockSizeException, javax.crypto.ShortBufferException; + method protected int engineDoFinal(java.nio.ByteBuffer, java.nio.ByteBuffer) throws javax.crypto.BadPaddingException, javax.crypto.IllegalBlockSizeException, javax.crypto.ShortBufferException; + method protected abstract int engineGetBlockSize(); + method protected abstract byte[] engineGetIV(); + method protected int engineGetKeySize(java.security.Key) throws java.security.InvalidKeyException; + method protected abstract int engineGetOutputSize(int); + method protected abstract java.security.AlgorithmParameters engineGetParameters(); + method protected abstract void engineInit(int, java.security.Key, java.security.SecureRandom) throws java.security.InvalidKeyException; + method protected abstract void engineInit(int, java.security.Key, java.security.spec.AlgorithmParameterSpec, java.security.SecureRandom) throws java.security.InvalidAlgorithmParameterException, java.security.InvalidKeyException; + method protected abstract void engineInit(int, java.security.Key, java.security.AlgorithmParameters, java.security.SecureRandom) throws java.security.InvalidAlgorithmParameterException, java.security.InvalidKeyException; + method protected abstract void engineSetMode(java.lang.String) throws java.security.NoSuchAlgorithmException; + method protected abstract void engineSetPadding(java.lang.String) throws javax.crypto.NoSuchPaddingException; + method protected java.security.Key engineUnwrap(byte[], java.lang.String, int) throws java.security.InvalidKeyException, java.security.NoSuchAlgorithmException; + method protected abstract byte[] engineUpdate(byte[], int, int); + method protected abstract int engineUpdate(byte[], int, int, byte[], int) throws javax.crypto.ShortBufferException; + method protected int engineUpdate(java.nio.ByteBuffer, java.nio.ByteBuffer) throws javax.crypto.ShortBufferException; + method protected byte[] engineWrap(java.security.Key) throws javax.crypto.IllegalBlockSizeException, java.security.InvalidKeyException; + } + + public class EncryptedPrivateKeyInfo { + ctor public EncryptedPrivateKeyInfo(byte[]) throws java.io.IOException; + ctor public EncryptedPrivateKeyInfo(java.lang.String, byte[]) throws java.security.NoSuchAlgorithmException; + ctor public EncryptedPrivateKeyInfo(java.security.AlgorithmParameters, byte[]) throws java.security.NoSuchAlgorithmException; + method public java.lang.String getAlgName(); + method public java.security.AlgorithmParameters getAlgParameters(); + method public byte[] getEncoded() throws java.io.IOException; + method public byte[] getEncryptedData(); + method public java.security.spec.PKCS8EncodedKeySpec getKeySpec(javax.crypto.Cipher) throws java.security.spec.InvalidKeySpecException; + method public java.security.spec.PKCS8EncodedKeySpec getKeySpec(java.security.Key) throws java.security.InvalidKeyException, java.security.NoSuchAlgorithmException; + method public java.security.spec.PKCS8EncodedKeySpec getKeySpec(java.security.Key, java.lang.String) throws java.security.InvalidKeyException, java.security.NoSuchAlgorithmException, java.security.NoSuchProviderException; + method public java.security.spec.PKCS8EncodedKeySpec getKeySpec(java.security.Key, java.security.Provider) throws java.security.InvalidKeyException, java.security.NoSuchAlgorithmException; + } + + public class ExemptionMechanism { + ctor protected ExemptionMechanism(javax.crypto.ExemptionMechanismSpi, java.security.Provider, java.lang.String); + method public final byte[] genExemptionBlob() throws javax.crypto.ExemptionMechanismException, java.lang.IllegalStateException; + method public final int genExemptionBlob(byte[]) throws javax.crypto.ExemptionMechanismException, java.lang.IllegalStateException, javax.crypto.ShortBufferException; + method public final int genExemptionBlob(byte[], int) throws javax.crypto.ExemptionMechanismException, java.lang.IllegalStateException, javax.crypto.ShortBufferException; + method public static final javax.crypto.ExemptionMechanism getInstance(java.lang.String) throws java.security.NoSuchAlgorithmException; + method public static final javax.crypto.ExemptionMechanism getInstance(java.lang.String, java.lang.String) throws java.security.NoSuchAlgorithmException, java.security.NoSuchProviderException; + method public static final javax.crypto.ExemptionMechanism getInstance(java.lang.String, java.security.Provider) throws java.security.NoSuchAlgorithmException; + method public final java.lang.String getName(); + method public final int getOutputSize(int) throws java.lang.IllegalStateException; + method public final java.security.Provider getProvider(); + method public final void init(java.security.Key) throws javax.crypto.ExemptionMechanismException, java.security.InvalidKeyException; + method public final void init(java.security.Key, java.security.AlgorithmParameters) throws javax.crypto.ExemptionMechanismException, java.security.InvalidAlgorithmParameterException, java.security.InvalidKeyException; + method public final void init(java.security.Key, java.security.spec.AlgorithmParameterSpec) throws javax.crypto.ExemptionMechanismException, java.security.InvalidAlgorithmParameterException, java.security.InvalidKeyException; + method public final boolean isCryptoAllowed(java.security.Key) throws javax.crypto.ExemptionMechanismException; + } + + public class ExemptionMechanismException extends java.security.GeneralSecurityException { + ctor public ExemptionMechanismException(java.lang.String); + ctor public ExemptionMechanismException(); + } + + public abstract class ExemptionMechanismSpi { + ctor public ExemptionMechanismSpi(); + method protected abstract byte[] engineGenExemptionBlob() throws javax.crypto.ExemptionMechanismException; + method protected abstract int engineGenExemptionBlob(byte[], int) throws javax.crypto.ExemptionMechanismException, javax.crypto.ShortBufferException; + method protected abstract int engineGetOutputSize(int); + method protected abstract void engineInit(java.security.Key) throws javax.crypto.ExemptionMechanismException, java.security.InvalidKeyException; + method protected abstract void engineInit(java.security.Key, java.security.AlgorithmParameters) throws javax.crypto.ExemptionMechanismException, java.security.InvalidAlgorithmParameterException, java.security.InvalidKeyException; + method protected abstract void engineInit(java.security.Key, java.security.spec.AlgorithmParameterSpec) throws javax.crypto.ExemptionMechanismException, java.security.InvalidAlgorithmParameterException, java.security.InvalidKeyException; + } + + public class IllegalBlockSizeException extends java.security.GeneralSecurityException { + ctor public IllegalBlockSizeException(java.lang.String); + ctor public IllegalBlockSizeException(); + } + + public class KeyAgreement { + ctor protected KeyAgreement(javax.crypto.KeyAgreementSpi, java.security.Provider, java.lang.String); + method public final java.security.Key doPhase(java.security.Key, boolean) throws java.lang.IllegalStateException, java.security.InvalidKeyException; + method public final byte[] generateSecret() throws java.lang.IllegalStateException; + method public final int generateSecret(byte[], int) throws java.lang.IllegalStateException, javax.crypto.ShortBufferException; + method public final javax.crypto.SecretKey generateSecret(java.lang.String) throws java.lang.IllegalStateException, java.security.InvalidKeyException, java.security.NoSuchAlgorithmException; + method public final java.lang.String getAlgorithm(); + method public static final javax.crypto.KeyAgreement getInstance(java.lang.String) throws java.security.NoSuchAlgorithmException; + method public static final javax.crypto.KeyAgreement getInstance(java.lang.String, java.lang.String) throws java.security.NoSuchAlgorithmException, java.security.NoSuchProviderException; + method public static final javax.crypto.KeyAgreement getInstance(java.lang.String, java.security.Provider) throws java.security.NoSuchAlgorithmException; + method public final java.security.Provider getProvider(); + method public final void init(java.security.Key) throws java.security.InvalidKeyException; + method public final void init(java.security.Key, java.security.SecureRandom) throws java.security.InvalidKeyException; + method public final void init(java.security.Key, java.security.spec.AlgorithmParameterSpec) throws java.security.InvalidAlgorithmParameterException, java.security.InvalidKeyException; + method public final void init(java.security.Key, java.security.spec.AlgorithmParameterSpec, java.security.SecureRandom) throws java.security.InvalidAlgorithmParameterException, java.security.InvalidKeyException; + } + + public abstract class KeyAgreementSpi { + ctor public KeyAgreementSpi(); + method protected abstract java.security.Key engineDoPhase(java.security.Key, boolean) throws java.lang.IllegalStateException, java.security.InvalidKeyException; + method protected abstract byte[] engineGenerateSecret() throws java.lang.IllegalStateException; + method protected abstract int engineGenerateSecret(byte[], int) throws java.lang.IllegalStateException, javax.crypto.ShortBufferException; + method protected abstract javax.crypto.SecretKey engineGenerateSecret(java.lang.String) throws java.lang.IllegalStateException, java.security.InvalidKeyException, java.security.NoSuchAlgorithmException; + method protected abstract void engineInit(java.security.Key, java.security.SecureRandom) throws java.security.InvalidKeyException; + method protected abstract void engineInit(java.security.Key, java.security.spec.AlgorithmParameterSpec, java.security.SecureRandom) throws java.security.InvalidAlgorithmParameterException, java.security.InvalidKeyException; + } + + public class KeyGenerator { + ctor protected KeyGenerator(javax.crypto.KeyGeneratorSpi, java.security.Provider, java.lang.String); + method public final javax.crypto.SecretKey generateKey(); + method public final java.lang.String getAlgorithm(); + method public static final javax.crypto.KeyGenerator getInstance(java.lang.String) throws java.security.NoSuchAlgorithmException; + method public static final javax.crypto.KeyGenerator getInstance(java.lang.String, java.lang.String) throws java.security.NoSuchAlgorithmException, java.security.NoSuchProviderException; + method public static final javax.crypto.KeyGenerator getInstance(java.lang.String, java.security.Provider) throws java.security.NoSuchAlgorithmException; + method public final java.security.Provider getProvider(); + method public final void init(java.security.spec.AlgorithmParameterSpec) throws java.security.InvalidAlgorithmParameterException; + method public final void init(java.security.spec.AlgorithmParameterSpec, java.security.SecureRandom) throws java.security.InvalidAlgorithmParameterException; + method public final void init(int); + method public final void init(int, java.security.SecureRandom); + method public final void init(java.security.SecureRandom); + } + + public abstract class KeyGeneratorSpi { + ctor public KeyGeneratorSpi(); + method protected abstract javax.crypto.SecretKey engineGenerateKey(); + method protected abstract void engineInit(java.security.spec.AlgorithmParameterSpec, java.security.SecureRandom) throws java.security.InvalidAlgorithmParameterException; + method protected abstract void engineInit(int, java.security.SecureRandom); + method protected abstract void engineInit(java.security.SecureRandom); + } + + public class Mac implements java.lang.Cloneable { + ctor protected Mac(javax.crypto.MacSpi, java.security.Provider, java.lang.String); + method public final java.lang.Object clone() throws java.lang.CloneNotSupportedException; + method public final byte[] doFinal() throws java.lang.IllegalStateException; + method public final void doFinal(byte[], int) throws java.lang.IllegalStateException, javax.crypto.ShortBufferException; + method public final byte[] doFinal(byte[]) throws java.lang.IllegalStateException; + method public final java.lang.String getAlgorithm(); + method public static final javax.crypto.Mac getInstance(java.lang.String) throws java.security.NoSuchAlgorithmException; + method public static final javax.crypto.Mac getInstance(java.lang.String, java.lang.String) throws java.security.NoSuchAlgorithmException, java.security.NoSuchProviderException; + method public static final javax.crypto.Mac getInstance(java.lang.String, java.security.Provider) throws java.security.NoSuchAlgorithmException; + method public final int getMacLength(); + method public final java.security.Provider getProvider(); + method public final void init(java.security.Key, java.security.spec.AlgorithmParameterSpec) throws java.security.InvalidAlgorithmParameterException, java.security.InvalidKeyException; + method public final void init(java.security.Key) throws java.security.InvalidKeyException; + method public final void reset(); + method public final void update(byte) throws java.lang.IllegalStateException; + method public final void update(byte[], int, int) throws java.lang.IllegalStateException; + method public final void update(byte[]) throws java.lang.IllegalStateException; + method public final void update(java.nio.ByteBuffer); + } + + public abstract class MacSpi { + ctor public MacSpi(); + method public java.lang.Object clone() throws java.lang.CloneNotSupportedException; + method protected abstract byte[] engineDoFinal(); + method protected abstract int engineGetMacLength(); + method protected abstract void engineInit(java.security.Key, java.security.spec.AlgorithmParameterSpec) throws java.security.InvalidAlgorithmParameterException, java.security.InvalidKeyException; + method protected abstract void engineReset(); + method protected abstract void engineUpdate(byte); + method protected abstract void engineUpdate(byte[], int, int); + method protected void engineUpdate(java.nio.ByteBuffer); + } + + public class NoSuchPaddingException extends java.security.GeneralSecurityException { + ctor public NoSuchPaddingException(java.lang.String); + ctor public NoSuchPaddingException(); + } + + public class NullCipher extends javax.crypto.Cipher { + ctor public NullCipher(); + } + + public class SealedObject implements java.io.Serializable { + ctor public SealedObject(java.io.Serializable, javax.crypto.Cipher) throws java.io.IOException, javax.crypto.IllegalBlockSizeException; + ctor protected SealedObject(javax.crypto.SealedObject); + method public final java.lang.String getAlgorithm(); + method public final java.lang.Object getObject(java.security.Key) throws java.lang.ClassNotFoundException, java.io.IOException, java.security.InvalidKeyException, java.security.NoSuchAlgorithmException; + method public final java.lang.Object getObject(javax.crypto.Cipher) throws javax.crypto.BadPaddingException, java.lang.ClassNotFoundException, java.io.IOException, javax.crypto.IllegalBlockSizeException; + method public final java.lang.Object getObject(java.security.Key, java.lang.String) throws java.lang.ClassNotFoundException, java.io.IOException, java.security.InvalidKeyException, java.security.NoSuchAlgorithmException, java.security.NoSuchProviderException; + field protected byte[] encodedParams; + } + + public abstract interface SecretKey implements java.security.Key { + field public static final long serialVersionUID = -4795878709595146952L; // 0xbd719db928b8f538L + } + + public class SecretKeyFactory { + ctor protected SecretKeyFactory(javax.crypto.SecretKeyFactorySpi, java.security.Provider, java.lang.String); + method public final javax.crypto.SecretKey generateSecret(java.security.spec.KeySpec) throws java.security.spec.InvalidKeySpecException; + method public final java.lang.String getAlgorithm(); + method public static final javax.crypto.SecretKeyFactory getInstance(java.lang.String) throws java.security.NoSuchAlgorithmException; + method public static final javax.crypto.SecretKeyFactory getInstance(java.lang.String, java.lang.String) throws java.security.NoSuchAlgorithmException, java.security.NoSuchProviderException; + method public static final javax.crypto.SecretKeyFactory getInstance(java.lang.String, java.security.Provider) throws java.security.NoSuchAlgorithmException; + method public final java.security.spec.KeySpec getKeySpec(javax.crypto.SecretKey, java.lang.Class) throws java.security.spec.InvalidKeySpecException; + method public final java.security.Provider getProvider(); + method public final javax.crypto.SecretKey translateKey(javax.crypto.SecretKey) throws java.security.InvalidKeyException; + } + + public abstract class SecretKeyFactorySpi { + ctor public SecretKeyFactorySpi(); + method protected abstract javax.crypto.SecretKey engineGenerateSecret(java.security.spec.KeySpec) throws java.security.spec.InvalidKeySpecException; + method protected abstract java.security.spec.KeySpec engineGetKeySpec(javax.crypto.SecretKey, java.lang.Class) throws java.security.spec.InvalidKeySpecException; + method protected abstract javax.crypto.SecretKey engineTranslateKey(javax.crypto.SecretKey) throws java.security.InvalidKeyException; + } + + public class ShortBufferException extends java.security.GeneralSecurityException { + ctor public ShortBufferException(java.lang.String); + ctor public ShortBufferException(); + } + +} + +package javax.crypto.interfaces { + + public abstract interface DHKey { + method public abstract javax.crypto.spec.DHParameterSpec getParams(); + } + + public abstract interface DHPrivateKey implements javax.crypto.interfaces.DHKey java.security.PrivateKey { + method public abstract java.math.BigInteger getX(); + field public static final long serialVersionUID = 2211791113380396553L; // 0x1eb1dc4c8e677e09L + } + + public abstract interface DHPublicKey implements javax.crypto.interfaces.DHKey java.security.PublicKey { + method public abstract java.math.BigInteger getY(); + field public static final long serialVersionUID = -6628103563352519193L; // 0xa4043eed23df4de7L + } + + public abstract interface PBEKey implements javax.crypto.SecretKey { + method public abstract int getIterationCount(); + method public abstract char[] getPassword(); + method public abstract byte[] getSalt(); + field public static final long serialVersionUID = -1430015993304333921L; // 0xec279007d7f7c19fL + } + +} + +package javax.crypto.spec { + + public class DESKeySpec implements java.security.spec.KeySpec { + ctor public DESKeySpec(byte[]) throws java.security.InvalidKeyException; + ctor public DESKeySpec(byte[], int) throws java.security.InvalidKeyException; + method public byte[] getKey(); + method public static boolean isParityAdjusted(byte[], int) throws java.security.InvalidKeyException; + method public static boolean isWeak(byte[], int) throws java.security.InvalidKeyException; + field public static final int DES_KEY_LEN = 8; // 0x8 + } + + public class DESedeKeySpec implements java.security.spec.KeySpec { + ctor public DESedeKeySpec(byte[]) throws java.security.InvalidKeyException; + ctor public DESedeKeySpec(byte[], int) throws java.security.InvalidKeyException; + method public byte[] getKey(); + method public static boolean isParityAdjusted(byte[], int) throws java.security.InvalidKeyException; + field public static final int DES_EDE_KEY_LEN = 24; // 0x18 + } + + public class DHGenParameterSpec implements java.security.spec.AlgorithmParameterSpec { + ctor public DHGenParameterSpec(int, int); + method public int getExponentSize(); + method public int getPrimeSize(); + } + + public class DHParameterSpec implements java.security.spec.AlgorithmParameterSpec { + ctor public DHParameterSpec(java.math.BigInteger, java.math.BigInteger); + ctor public DHParameterSpec(java.math.BigInteger, java.math.BigInteger, int); + method public java.math.BigInteger getG(); + method public int getL(); + method public java.math.BigInteger getP(); + } + + public class DHPrivateKeySpec implements java.security.spec.KeySpec { + ctor public DHPrivateKeySpec(java.math.BigInteger, java.math.BigInteger, java.math.BigInteger); + method public java.math.BigInteger getG(); + method public java.math.BigInteger getP(); + method public java.math.BigInteger getX(); + } + + public class DHPublicKeySpec implements java.security.spec.KeySpec { + ctor public DHPublicKeySpec(java.math.BigInteger, java.math.BigInteger, java.math.BigInteger); + method public java.math.BigInteger getG(); + method public java.math.BigInteger getP(); + method public java.math.BigInteger getY(); + } + + public class IvParameterSpec implements java.security.spec.AlgorithmParameterSpec { + ctor public IvParameterSpec(byte[]); + ctor public IvParameterSpec(byte[], int, int); + method public byte[] getIV(); + } + + public class OAEPParameterSpec implements java.security.spec.AlgorithmParameterSpec { + ctor public OAEPParameterSpec(java.lang.String, java.lang.String, java.security.spec.AlgorithmParameterSpec, javax.crypto.spec.PSource); + method public java.lang.String getDigestAlgorithm(); + method public java.lang.String getMGFAlgorithm(); + method public java.security.spec.AlgorithmParameterSpec getMGFParameters(); + method public javax.crypto.spec.PSource getPSource(); + field public static final javax.crypto.spec.OAEPParameterSpec DEFAULT; + } + + public class PBEKeySpec implements java.security.spec.KeySpec { + ctor public PBEKeySpec(char[]); + ctor public PBEKeySpec(char[], byte[], int, int); + ctor public PBEKeySpec(char[], byte[], int); + method public final void clearPassword(); + method public final int getIterationCount(); + method public final int getKeyLength(); + method public final char[] getPassword(); + method public final byte[] getSalt(); + } + + public class PBEParameterSpec implements java.security.spec.AlgorithmParameterSpec { + ctor public PBEParameterSpec(byte[], int); + method public int getIterationCount(); + method public byte[] getSalt(); + } + + public class PSource { + ctor protected PSource(java.lang.String); + method public java.lang.String getAlgorithm(); + } + + public static final class PSource.PSpecified extends javax.crypto.spec.PSource { + ctor public PSource.PSpecified(byte[]); + method public byte[] getValue(); + field public static final javax.crypto.spec.PSource.PSpecified DEFAULT; + } + + public class RC2ParameterSpec implements java.security.spec.AlgorithmParameterSpec { + ctor public RC2ParameterSpec(int); + ctor public RC2ParameterSpec(int, byte[]); + ctor public RC2ParameterSpec(int, byte[], int); + method public int getEffectiveKeyBits(); + method public byte[] getIV(); + } + + public class RC5ParameterSpec implements java.security.spec.AlgorithmParameterSpec { + ctor public RC5ParameterSpec(int, int, int); + ctor public RC5ParameterSpec(int, int, int, byte[]); + ctor public RC5ParameterSpec(int, int, int, byte[], int); + method public byte[] getIV(); + method public int getRounds(); + method public int getVersion(); + method public int getWordSize(); + } + + public class SecretKeySpec implements java.security.spec.KeySpec javax.crypto.SecretKey java.io.Serializable { + ctor public SecretKeySpec(byte[], java.lang.String); + ctor public SecretKeySpec(byte[], int, int, java.lang.String); + method public java.lang.String getAlgorithm(); + method public byte[] getEncoded(); + method public java.lang.String getFormat(); + } + +} + +package javax.microedition.khronos.egl { + + public abstract interface EGL { + } + + public abstract interface EGL10 implements javax.microedition.khronos.egl.EGL { + method public abstract boolean eglChooseConfig(javax.microedition.khronos.egl.EGLDisplay, int[], javax.microedition.khronos.egl.EGLConfig[], int, int[]); + method public abstract boolean eglCopyBuffers(javax.microedition.khronos.egl.EGLDisplay, javax.microedition.khronos.egl.EGLSurface, java.lang.Object); + method public abstract javax.microedition.khronos.egl.EGLContext eglCreateContext(javax.microedition.khronos.egl.EGLDisplay, javax.microedition.khronos.egl.EGLConfig, javax.microedition.khronos.egl.EGLContext, int[]); + method public abstract javax.microedition.khronos.egl.EGLSurface eglCreatePbufferSurface(javax.microedition.khronos.egl.EGLDisplay, javax.microedition.khronos.egl.EGLConfig, int[]); + method public abstract javax.microedition.khronos.egl.EGLSurface eglCreatePixmapSurface(javax.microedition.khronos.egl.EGLDisplay, javax.microedition.khronos.egl.EGLConfig, java.lang.Object, int[]); + method public abstract javax.microedition.khronos.egl.EGLSurface eglCreateWindowSurface(javax.microedition.khronos.egl.EGLDisplay, javax.microedition.khronos.egl.EGLConfig, java.lang.Object, int[]); + method public abstract boolean eglDestroyContext(javax.microedition.khronos.egl.EGLDisplay, javax.microedition.khronos.egl.EGLContext); + method public abstract boolean eglDestroySurface(javax.microedition.khronos.egl.EGLDisplay, javax.microedition.khronos.egl.EGLSurface); + method public abstract boolean eglGetConfigAttrib(javax.microedition.khronos.egl.EGLDisplay, javax.microedition.khronos.egl.EGLConfig, int, int[]); + method public abstract boolean eglGetConfigs(javax.microedition.khronos.egl.EGLDisplay, javax.microedition.khronos.egl.EGLConfig[], int, int[]); + method public abstract javax.microedition.khronos.egl.EGLContext eglGetCurrentContext(); + method public abstract javax.microedition.khronos.egl.EGLDisplay eglGetCurrentDisplay(); + method public abstract javax.microedition.khronos.egl.EGLSurface eglGetCurrentSurface(int); + method public abstract javax.microedition.khronos.egl.EGLDisplay eglGetDisplay(java.lang.Object); + method public abstract int eglGetError(); + method public abstract boolean eglInitialize(javax.microedition.khronos.egl.EGLDisplay, int[]); + method public abstract boolean eglMakeCurrent(javax.microedition.khronos.egl.EGLDisplay, javax.microedition.khronos.egl.EGLSurface, javax.microedition.khronos.egl.EGLSurface, javax.microedition.khronos.egl.EGLContext); + method public abstract boolean eglQueryContext(javax.microedition.khronos.egl.EGLDisplay, javax.microedition.khronos.egl.EGLContext, int, int[]); + method public abstract java.lang.String eglQueryString(javax.microedition.khronos.egl.EGLDisplay, int); + method public abstract boolean eglQuerySurface(javax.microedition.khronos.egl.EGLDisplay, javax.microedition.khronos.egl.EGLSurface, int, int[]); + method public abstract boolean eglSwapBuffers(javax.microedition.khronos.egl.EGLDisplay, javax.microedition.khronos.egl.EGLSurface); + method public abstract boolean eglTerminate(javax.microedition.khronos.egl.EGLDisplay); + method public abstract boolean eglWaitGL(); + method public abstract boolean eglWaitNative(int, java.lang.Object); + field public static final int EGL_ALPHA_FORMAT = 12424; // 0x3088 + field public static final int EGL_ALPHA_MASK_SIZE = 12350; // 0x303e + field public static final int EGL_ALPHA_SIZE = 12321; // 0x3021 + field public static final int EGL_BAD_ACCESS = 12290; // 0x3002 + field public static final int EGL_BAD_ALLOC = 12291; // 0x3003 + field public static final int EGL_BAD_ATTRIBUTE = 12292; // 0x3004 + field public static final int EGL_BAD_CONFIG = 12293; // 0x3005 + field public static final int EGL_BAD_CONTEXT = 12294; // 0x3006 + field public static final int EGL_BAD_CURRENT_SURFACE = 12295; // 0x3007 + field public static final int EGL_BAD_DISPLAY = 12296; // 0x3008 + field public static final int EGL_BAD_MATCH = 12297; // 0x3009 + field public static final int EGL_BAD_NATIVE_PIXMAP = 12298; // 0x300a + field public static final int EGL_BAD_NATIVE_WINDOW = 12299; // 0x300b + field public static final int EGL_BAD_PARAMETER = 12300; // 0x300c + field public static final int EGL_BAD_SURFACE = 12301; // 0x300d + field public static final int EGL_BLUE_SIZE = 12322; // 0x3022 + field public static final int EGL_BUFFER_SIZE = 12320; // 0x3020 + field public static final int EGL_COLORSPACE = 12423; // 0x3087 + field public static final int EGL_COLOR_BUFFER_TYPE = 12351; // 0x303f + field public static final int EGL_CONFIG_CAVEAT = 12327; // 0x3027 + field public static final int EGL_CONFIG_ID = 12328; // 0x3028 + field public static final int EGL_CORE_NATIVE_ENGINE = 12379; // 0x305b + field public static final java.lang.Object EGL_DEFAULT_DISPLAY; + field public static final int EGL_DEPTH_SIZE = 12325; // 0x3025 + field public static final int EGL_DONT_CARE = -1; // 0xffffffff + field public static final int EGL_DRAW = 12377; // 0x3059 + field public static final int EGL_EXTENSIONS = 12373; // 0x3055 + field public static final int EGL_GREEN_SIZE = 12323; // 0x3023 + field public static final int EGL_HEIGHT = 12374; // 0x3056 + field public static final int EGL_HORIZONTAL_RESOLUTION = 12432; // 0x3090 + field public static final int EGL_LARGEST_PBUFFER = 12376; // 0x3058 + field public static final int EGL_LEVEL = 12329; // 0x3029 + field public static final int EGL_LUMINANCE_BUFFER = 12431; // 0x308f + field public static final int EGL_LUMINANCE_SIZE = 12349; // 0x303d + field public static final int EGL_MAX_PBUFFER_HEIGHT = 12330; // 0x302a + field public static final int EGL_MAX_PBUFFER_PIXELS = 12331; // 0x302b + field public static final int EGL_MAX_PBUFFER_WIDTH = 12332; // 0x302c + field public static final int EGL_NATIVE_RENDERABLE = 12333; // 0x302d + field public static final int EGL_NATIVE_VISUAL_ID = 12334; // 0x302e + field public static final int EGL_NATIVE_VISUAL_TYPE = 12335; // 0x302f + field public static final int EGL_NONE = 12344; // 0x3038 + field public static final int EGL_NON_CONFORMANT_CONFIG = 12369; // 0x3051 + field public static final int EGL_NOT_INITIALIZED = 12289; // 0x3001 + field public static final javax.microedition.khronos.egl.EGLContext EGL_NO_CONTEXT; + field public static final javax.microedition.khronos.egl.EGLDisplay EGL_NO_DISPLAY; + field public static final javax.microedition.khronos.egl.EGLSurface EGL_NO_SURFACE; + field public static final int EGL_PBUFFER_BIT = 1; // 0x1 + field public static final int EGL_PIXEL_ASPECT_RATIO = 12434; // 0x3092 + field public static final int EGL_PIXMAP_BIT = 2; // 0x2 + field public static final int EGL_READ = 12378; // 0x305a + field public static final int EGL_RED_SIZE = 12324; // 0x3024 + field public static final int EGL_RENDERABLE_TYPE = 12352; // 0x3040 + field public static final int EGL_RENDER_BUFFER = 12422; // 0x3086 + field public static final int EGL_RGB_BUFFER = 12430; // 0x308e + field public static final int EGL_SAMPLES = 12337; // 0x3031 + field public static final int EGL_SAMPLE_BUFFERS = 12338; // 0x3032 + field public static final int EGL_SINGLE_BUFFER = 12421; // 0x3085 + field public static final int EGL_SLOW_CONFIG = 12368; // 0x3050 + field public static final int EGL_STENCIL_SIZE = 12326; // 0x3026 + field public static final int EGL_SUCCESS = 12288; // 0x3000 + field public static final int EGL_SURFACE_TYPE = 12339; // 0x3033 + field public static final int EGL_TRANSPARENT_BLUE_VALUE = 12341; // 0x3035 + field public static final int EGL_TRANSPARENT_GREEN_VALUE = 12342; // 0x3036 + field public static final int EGL_TRANSPARENT_RED_VALUE = 12343; // 0x3037 + field public static final int EGL_TRANSPARENT_RGB = 12370; // 0x3052 + field public static final int EGL_TRANSPARENT_TYPE = 12340; // 0x3034 + field public static final int EGL_VENDOR = 12371; // 0x3053 + field public static final int EGL_VERSION = 12372; // 0x3054 + field public static final int EGL_VERTICAL_RESOLUTION = 12433; // 0x3091 + field public static final int EGL_WIDTH = 12375; // 0x3057 + field public static final int EGL_WINDOW_BIT = 4; // 0x4 + } + + public abstract interface EGL11 implements javax.microedition.khronos.egl.EGL10 { + field public static final int EGL_CONTEXT_LOST = 12302; // 0x300e + } + + public abstract class EGLConfig { + ctor public EGLConfig(); + } + + public abstract class EGLContext { + ctor public EGLContext(); + method public static javax.microedition.khronos.egl.EGL getEGL(); + method public abstract javax.microedition.khronos.opengles.GL getGL(); + } + + public abstract class EGLDisplay { + ctor public EGLDisplay(); + } + + public abstract class EGLSurface { + ctor public EGLSurface(); + } + +} + +package javax.microedition.khronos.opengles { + + public abstract interface GL { + } + + public abstract interface GL10 implements javax.microedition.khronos.opengles.GL { + method public abstract void glActiveTexture(int); + method public abstract void glAlphaFunc(int, float); + method public abstract void glAlphaFuncx(int, int); + method public abstract void glBindTexture(int, int); + method public abstract void glBlendFunc(int, int); + method public abstract void glClear(int); + method public abstract void glClearColor(float, float, float, float); + method public abstract void glClearColorx(int, int, int, int); + method public abstract void glClearDepthf(float); + method public abstract void glClearDepthx(int); + method public abstract void glClearStencil(int); + method public abstract void glClientActiveTexture(int); + method public abstract void glColor4f(float, float, float, float); + method public abstract void glColor4x(int, int, int, int); + method public abstract void glColorMask(boolean, boolean, boolean, boolean); + method public abstract void glColorPointer(int, int, int, java.nio.Buffer); + method public abstract void glCompressedTexImage2D(int, int, int, int, int, int, int, java.nio.Buffer); + method public abstract void glCompressedTexSubImage2D(int, int, int, int, int, int, int, int, java.nio.Buffer); + method public abstract void glCopyTexImage2D(int, int, int, int, int, int, int, int); + method public abstract void glCopyTexSubImage2D(int, int, int, int, int, int, int, int); + method public abstract void glCullFace(int); + method public abstract void glDeleteTextures(int, int[], int); + method public abstract void glDeleteTextures(int, java.nio.IntBuffer); + method public abstract void glDepthFunc(int); + method public abstract void glDepthMask(boolean); + method public abstract void glDepthRangef(float, float); + method public abstract void glDepthRangex(int, int); + method public abstract void glDisable(int); + method public abstract void glDisableClientState(int); + method public abstract void glDrawArrays(int, int, int); + method public abstract void glDrawElements(int, int, int, java.nio.Buffer); + method public abstract void glEnable(int); + method public abstract void glEnableClientState(int); + method public abstract void glFinish(); + method public abstract void glFlush(); + method public abstract void glFogf(int, float); + method public abstract void glFogfv(int, float[], int); + method public abstract void glFogfv(int, java.nio.FloatBuffer); + method public abstract void glFogx(int, int); + method public abstract void glFogxv(int, int[], int); + method public abstract void glFogxv(int, java.nio.IntBuffer); + method public abstract void glFrontFace(int); + method public abstract void glFrustumf(float, float, float, float, float, float); + method public abstract void glFrustumx(int, int, int, int, int, int); + method public abstract void glGenTextures(int, int[], int); + method public abstract void glGenTextures(int, java.nio.IntBuffer); + method public abstract int glGetError(); + method public abstract void glGetIntegerv(int, int[], int); + method public abstract void glGetIntegerv(int, java.nio.IntBuffer); + method public abstract java.lang.String glGetString(int); + method public abstract void glHint(int, int); + method public abstract void glLightModelf(int, float); + method public abstract void glLightModelfv(int, float[], int); + method public abstract void glLightModelfv(int, java.nio.FloatBuffer); + method public abstract void glLightModelx(int, int); + method public abstract void glLightModelxv(int, int[], int); + method public abstract void glLightModelxv(int, java.nio.IntBuffer); + method public abstract void glLightf(int, int, float); + method public abstract void glLightfv(int, int, float[], int); + method public abstract void glLightfv(int, int, java.nio.FloatBuffer); + method public abstract void glLightx(int, int, int); + method public abstract void glLightxv(int, int, int[], int); + method public abstract void glLightxv(int, int, java.nio.IntBuffer); + method public abstract void glLineWidth(float); + method public abstract void glLineWidthx(int); + method public abstract void glLoadIdentity(); + method public abstract void glLoadMatrixf(float[], int); + method public abstract void glLoadMatrixf(java.nio.FloatBuffer); + method public abstract void glLoadMatrixx(int[], int); + method public abstract void glLoadMatrixx(java.nio.IntBuffer); + method public abstract void glLogicOp(int); + method public abstract void glMaterialf(int, int, float); + method public abstract void glMaterialfv(int, int, float[], int); + method public abstract void glMaterialfv(int, int, java.nio.FloatBuffer); + method public abstract void glMaterialx(int, int, int); + method public abstract void glMaterialxv(int, int, int[], int); + method public abstract void glMaterialxv(int, int, java.nio.IntBuffer); + method public abstract void glMatrixMode(int); + method public abstract void glMultMatrixf(float[], int); + method public abstract void glMultMatrixf(java.nio.FloatBuffer); + method public abstract void glMultMatrixx(int[], int); + method public abstract void glMultMatrixx(java.nio.IntBuffer); + method public abstract void glMultiTexCoord4f(int, float, float, float, float); + method public abstract void glMultiTexCoord4x(int, int, int, int, int); + method public abstract void glNormal3f(float, float, float); + method public abstract void glNormal3x(int, int, int); + method public abstract void glNormalPointer(int, int, java.nio.Buffer); + method public abstract void glOrthof(float, float, float, float, float, float); + method public abstract void glOrthox(int, int, int, int, int, int); + method public abstract void glPixelStorei(int, int); + method public abstract void glPointSize(float); + method public abstract void glPointSizex(int); + method public abstract void glPolygonOffset(float, float); + method public abstract void glPolygonOffsetx(int, int); + method public abstract void glPopMatrix(); + method public abstract void glPushMatrix(); + method public abstract void glReadPixels(int, int, int, int, int, int, java.nio.Buffer); + method public abstract void glRotatef(float, float, float, float); + method public abstract void glRotatex(int, int, int, int); + method public abstract void glSampleCoverage(float, boolean); + method public abstract void glSampleCoveragex(int, boolean); + method public abstract void glScalef(float, float, float); + method public abstract void glScalex(int, int, int); + method public abstract void glScissor(int, int, int, int); + method public abstract void glShadeModel(int); + method public abstract void glStencilFunc(int, int, int); + method public abstract void glStencilMask(int); + method public abstract void glStencilOp(int, int, int); + method public abstract void glTexCoordPointer(int, int, int, java.nio.Buffer); + method public abstract void glTexEnvf(int, int, float); + method public abstract void glTexEnvfv(int, int, float[], int); + method public abstract void glTexEnvfv(int, int, java.nio.FloatBuffer); + method public abstract void glTexEnvx(int, int, int); + method public abstract void glTexEnvxv(int, int, int[], int); + method public abstract void glTexEnvxv(int, int, java.nio.IntBuffer); + method public abstract void glTexImage2D(int, int, int, int, int, int, int, int, java.nio.Buffer); + method public abstract void glTexParameterf(int, int, float); + method public abstract void glTexParameterx(int, int, int); + method public abstract void glTexSubImage2D(int, int, int, int, int, int, int, int, java.nio.Buffer); + method public abstract void glTranslatef(float, float, float); + method public abstract void glTranslatex(int, int, int); + method public abstract void glVertexPointer(int, int, int, java.nio.Buffer); + method public abstract void glViewport(int, int, int, int); + field public static final int GL_ADD = 260; // 0x104 + field public static final int GL_ALIASED_LINE_WIDTH_RANGE = 33902; // 0x846e + field public static final int GL_ALIASED_POINT_SIZE_RANGE = 33901; // 0x846d + field public static final int GL_ALPHA = 6406; // 0x1906 + field public static final int GL_ALPHA_BITS = 3413; // 0xd55 + field public static final int GL_ALPHA_TEST = 3008; // 0xbc0 + field public static final int GL_ALWAYS = 519; // 0x207 + field public static final int GL_AMBIENT = 4608; // 0x1200 + field public static final int GL_AMBIENT_AND_DIFFUSE = 5634; // 0x1602 + field public static final int GL_AND = 5377; // 0x1501 + field public static final int GL_AND_INVERTED = 5380; // 0x1504 + field public static final int GL_AND_REVERSE = 5378; // 0x1502 + field public static final int GL_BACK = 1029; // 0x405 + field public static final int GL_BLEND = 3042; // 0xbe2 + field public static final int GL_BLUE_BITS = 3412; // 0xd54 + field public static final int GL_BYTE = 5120; // 0x1400 + field public static final int GL_CCW = 2305; // 0x901 + field public static final int GL_CLAMP_TO_EDGE = 33071; // 0x812f + field public static final int GL_CLEAR = 5376; // 0x1500 + field public static final int GL_COLOR_ARRAY = 32886; // 0x8076 + field public static final int GL_COLOR_BUFFER_BIT = 16384; // 0x4000 + field public static final int GL_COLOR_LOGIC_OP = 3058; // 0xbf2 + field public static final int GL_COLOR_MATERIAL = 2903; // 0xb57 + field public static final int GL_COMPRESSED_TEXTURE_FORMATS = 34467; // 0x86a3 + field public static final int GL_CONSTANT_ATTENUATION = 4615; // 0x1207 + field public static final int GL_COPY = 5379; // 0x1503 + field public static final int GL_COPY_INVERTED = 5388; // 0x150c + field public static final int GL_CULL_FACE = 2884; // 0xb44 + field public static final int GL_CW = 2304; // 0x900 + field public static final int GL_DECAL = 8449; // 0x2101 + field public static final int GL_DECR = 7683; // 0x1e03 + field public static final int GL_DEPTH_BITS = 3414; // 0xd56 + field public static final int GL_DEPTH_BUFFER_BIT = 256; // 0x100 + field public static final int GL_DEPTH_TEST = 2929; // 0xb71 + field public static final int GL_DIFFUSE = 4609; // 0x1201 + field public static final int GL_DITHER = 3024; // 0xbd0 + field public static final int GL_DONT_CARE = 4352; // 0x1100 + field public static final int GL_DST_ALPHA = 772; // 0x304 + field public static final int GL_DST_COLOR = 774; // 0x306 + field public static final int GL_EMISSION = 5632; // 0x1600 + field public static final int GL_EQUAL = 514; // 0x202 + field public static final int GL_EQUIV = 5385; // 0x1509 + field public static final int GL_EXP = 2048; // 0x800 + field public static final int GL_EXP2 = 2049; // 0x801 + field public static final int GL_EXTENSIONS = 7939; // 0x1f03 + field public static final int GL_FALSE = 0; // 0x0 + field public static final int GL_FASTEST = 4353; // 0x1101 + field public static final int GL_FIXED = 5132; // 0x140c + field public static final int GL_FLAT = 7424; // 0x1d00 + field public static final int GL_FLOAT = 5126; // 0x1406 + field public static final int GL_FOG = 2912; // 0xb60 + field public static final int GL_FOG_COLOR = 2918; // 0xb66 + field public static final int GL_FOG_DENSITY = 2914; // 0xb62 + field public static final int GL_FOG_END = 2916; // 0xb64 + field public static final int GL_FOG_HINT = 3156; // 0xc54 + field public static final int GL_FOG_MODE = 2917; // 0xb65 + field public static final int GL_FOG_START = 2915; // 0xb63 + field public static final int GL_FRONT = 1028; // 0x404 + field public static final int GL_FRONT_AND_BACK = 1032; // 0x408 + field public static final int GL_GEQUAL = 518; // 0x206 + field public static final int GL_GREATER = 516; // 0x204 + field public static final int GL_GREEN_BITS = 3411; // 0xd53 + field public static final int GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES = 35739; // 0x8b9b + field public static final int GL_IMPLEMENTATION_COLOR_READ_TYPE_OES = 35738; // 0x8b9a + field public static final int GL_INCR = 7682; // 0x1e02 + field public static final int GL_INVALID_ENUM = 1280; // 0x500 + field public static final int GL_INVALID_OPERATION = 1282; // 0x502 + field public static final int GL_INVALID_VALUE = 1281; // 0x501 + field public static final int GL_INVERT = 5386; // 0x150a + field public static final int GL_KEEP = 7680; // 0x1e00 + field public static final int GL_LEQUAL = 515; // 0x203 + field public static final int GL_LESS = 513; // 0x201 + field public static final int GL_LIGHT0 = 16384; // 0x4000 + field public static final int GL_LIGHT1 = 16385; // 0x4001 + field public static final int GL_LIGHT2 = 16386; // 0x4002 + field public static final int GL_LIGHT3 = 16387; // 0x4003 + field public static final int GL_LIGHT4 = 16388; // 0x4004 + field public static final int GL_LIGHT5 = 16389; // 0x4005 + field public static final int GL_LIGHT6 = 16390; // 0x4006 + field public static final int GL_LIGHT7 = 16391; // 0x4007 + field public static final int GL_LIGHTING = 2896; // 0xb50 + field public static final int GL_LIGHT_MODEL_AMBIENT = 2899; // 0xb53 + field public static final int GL_LIGHT_MODEL_TWO_SIDE = 2898; // 0xb52 + field public static final int GL_LINEAR = 9729; // 0x2601 + field public static final int GL_LINEAR_ATTENUATION = 4616; // 0x1208 + field public static final int GL_LINEAR_MIPMAP_LINEAR = 9987; // 0x2703 + field public static final int GL_LINEAR_MIPMAP_NEAREST = 9985; // 0x2701 + field public static final int GL_LINES = 1; // 0x1 + field public static final int GL_LINE_LOOP = 2; // 0x2 + field public static final int GL_LINE_SMOOTH = 2848; // 0xb20 + field public static final int GL_LINE_SMOOTH_HINT = 3154; // 0xc52 + field public static final int GL_LINE_STRIP = 3; // 0x3 + field public static final int GL_LUMINANCE = 6409; // 0x1909 + field public static final int GL_LUMINANCE_ALPHA = 6410; // 0x190a + field public static final int GL_MAX_ELEMENTS_INDICES = 33001; // 0x80e9 + field public static final int GL_MAX_ELEMENTS_VERTICES = 33000; // 0x80e8 + field public static final int GL_MAX_LIGHTS = 3377; // 0xd31 + field public static final int GL_MAX_MODELVIEW_STACK_DEPTH = 3382; // 0xd36 + field public static final int GL_MAX_PROJECTION_STACK_DEPTH = 3384; // 0xd38 + field public static final int GL_MAX_TEXTURE_SIZE = 3379; // 0xd33 + field public static final int GL_MAX_TEXTURE_STACK_DEPTH = 3385; // 0xd39 + field public static final int GL_MAX_TEXTURE_UNITS = 34018; // 0x84e2 + field public static final int GL_MAX_VIEWPORT_DIMS = 3386; // 0xd3a + field public static final int GL_MODELVIEW = 5888; // 0x1700 + field public static final int GL_MODULATE = 8448; // 0x2100 + field public static final int GL_MULTISAMPLE = 32925; // 0x809d + field public static final int GL_NAND = 5390; // 0x150e + field public static final int GL_NEAREST = 9728; // 0x2600 + field public static final int GL_NEAREST_MIPMAP_LINEAR = 9986; // 0x2702 + field public static final int GL_NEAREST_MIPMAP_NEAREST = 9984; // 0x2700 + field public static final int GL_NEVER = 512; // 0x200 + field public static final int GL_NICEST = 4354; // 0x1102 + field public static final int GL_NOOP = 5381; // 0x1505 + field public static final int GL_NOR = 5384; // 0x1508 + field public static final int GL_NORMALIZE = 2977; // 0xba1 + field public static final int GL_NORMAL_ARRAY = 32885; // 0x8075 + field public static final int GL_NOTEQUAL = 517; // 0x205 + field public static final int GL_NO_ERROR = 0; // 0x0 + field public static final int GL_NUM_COMPRESSED_TEXTURE_FORMATS = 34466; // 0x86a2 + field public static final int GL_ONE = 1; // 0x1 + field public static final int GL_ONE_MINUS_DST_ALPHA = 773; // 0x305 + field public static final int GL_ONE_MINUS_DST_COLOR = 775; // 0x307 + field public static final int GL_ONE_MINUS_SRC_ALPHA = 771; // 0x303 + field public static final int GL_ONE_MINUS_SRC_COLOR = 769; // 0x301 + field public static final int GL_OR = 5383; // 0x1507 + field public static final int GL_OR_INVERTED = 5389; // 0x150d + field public static final int GL_OR_REVERSE = 5387; // 0x150b + field public static final int GL_OUT_OF_MEMORY = 1285; // 0x505 + field public static final int GL_PACK_ALIGNMENT = 3333; // 0xd05 + field public static final int GL_PALETTE4_R5_G6_B5_OES = 35730; // 0x8b92 + field public static final int GL_PALETTE4_RGB5_A1_OES = 35732; // 0x8b94 + field public static final int GL_PALETTE4_RGB8_OES = 35728; // 0x8b90 + field public static final int GL_PALETTE4_RGBA4_OES = 35731; // 0x8b93 + field public static final int GL_PALETTE4_RGBA8_OES = 35729; // 0x8b91 + field public static final int GL_PALETTE8_R5_G6_B5_OES = 35735; // 0x8b97 + field public static final int GL_PALETTE8_RGB5_A1_OES = 35737; // 0x8b99 + field public static final int GL_PALETTE8_RGB8_OES = 35733; // 0x8b95 + field public static final int GL_PALETTE8_RGBA4_OES = 35736; // 0x8b98 + field public static final int GL_PALETTE8_RGBA8_OES = 35734; // 0x8b96 + field public static final int GL_PERSPECTIVE_CORRECTION_HINT = 3152; // 0xc50 + field public static final int GL_POINTS = 0; // 0x0 + field public static final int GL_POINT_FADE_THRESHOLD_SIZE = 33064; // 0x8128 + field public static final int GL_POINT_SIZE = 2833; // 0xb11 + field public static final int GL_POINT_SMOOTH = 2832; // 0xb10 + field public static final int GL_POINT_SMOOTH_HINT = 3153; // 0xc51 + field public static final int GL_POLYGON_OFFSET_FILL = 32823; // 0x8037 + field public static final int GL_POLYGON_SMOOTH_HINT = 3155; // 0xc53 + field public static final int GL_POSITION = 4611; // 0x1203 + field public static final int GL_PROJECTION = 5889; // 0x1701 + field public static final int GL_QUADRATIC_ATTENUATION = 4617; // 0x1209 + field public static final int GL_RED_BITS = 3410; // 0xd52 + field public static final int GL_RENDERER = 7937; // 0x1f01 + field public static final int GL_REPEAT = 10497; // 0x2901 + field public static final int GL_REPLACE = 7681; // 0x1e01 + field public static final int GL_RESCALE_NORMAL = 32826; // 0x803a + field public static final int GL_RGB = 6407; // 0x1907 + field public static final int GL_RGBA = 6408; // 0x1908 + field public static final int GL_SAMPLE_ALPHA_TO_COVERAGE = 32926; // 0x809e + field public static final int GL_SAMPLE_ALPHA_TO_ONE = 32927; // 0x809f + field public static final int GL_SAMPLE_COVERAGE = 32928; // 0x80a0 + field public static final int GL_SCISSOR_TEST = 3089; // 0xc11 + field public static final int GL_SET = 5391; // 0x150f + field public static final int GL_SHININESS = 5633; // 0x1601 + field public static final int GL_SHORT = 5122; // 0x1402 + field public static final int GL_SMOOTH = 7425; // 0x1d01 + field public static final int GL_SMOOTH_LINE_WIDTH_RANGE = 2850; // 0xb22 + field public static final int GL_SMOOTH_POINT_SIZE_RANGE = 2834; // 0xb12 + field public static final int GL_SPECULAR = 4610; // 0x1202 + field public static final int GL_SPOT_CUTOFF = 4614; // 0x1206 + field public static final int GL_SPOT_DIRECTION = 4612; // 0x1204 + field public static final int GL_SPOT_EXPONENT = 4613; // 0x1205 + field public static final int GL_SRC_ALPHA = 770; // 0x302 + field public static final int GL_SRC_ALPHA_SATURATE = 776; // 0x308 + field public static final int GL_SRC_COLOR = 768; // 0x300 + field public static final int GL_STACK_OVERFLOW = 1283; // 0x503 + field public static final int GL_STACK_UNDERFLOW = 1284; // 0x504 + field public static final int GL_STENCIL_BITS = 3415; // 0xd57 + field public static final int GL_STENCIL_BUFFER_BIT = 1024; // 0x400 + field public static final int GL_STENCIL_TEST = 2960; // 0xb90 + field public static final int GL_SUBPIXEL_BITS = 3408; // 0xd50 + field public static final int GL_TEXTURE = 5890; // 0x1702 + field public static final int GL_TEXTURE0 = 33984; // 0x84c0 + field public static final int GL_TEXTURE1 = 33985; // 0x84c1 + field public static final int GL_TEXTURE10 = 33994; // 0x84ca + field public static final int GL_TEXTURE11 = 33995; // 0x84cb + field public static final int GL_TEXTURE12 = 33996; // 0x84cc + field public static final int GL_TEXTURE13 = 33997; // 0x84cd + field public static final int GL_TEXTURE14 = 33998; // 0x84ce + field public static final int GL_TEXTURE15 = 33999; // 0x84cf + field public static final int GL_TEXTURE16 = 34000; // 0x84d0 + field public static final int GL_TEXTURE17 = 34001; // 0x84d1 + field public static final int GL_TEXTURE18 = 34002; // 0x84d2 + field public static final int GL_TEXTURE19 = 34003; // 0x84d3 + field public static final int GL_TEXTURE2 = 33986; // 0x84c2 + field public static final int GL_TEXTURE20 = 34004; // 0x84d4 + field public static final int GL_TEXTURE21 = 34005; // 0x84d5 + field public static final int GL_TEXTURE22 = 34006; // 0x84d6 + field public static final int GL_TEXTURE23 = 34007; // 0x84d7 + field public static final int GL_TEXTURE24 = 34008; // 0x84d8 + field public static final int GL_TEXTURE25 = 34009; // 0x84d9 + field public static final int GL_TEXTURE26 = 34010; // 0x84da + field public static final int GL_TEXTURE27 = 34011; // 0x84db + field public static final int GL_TEXTURE28 = 34012; // 0x84dc + field public static final int GL_TEXTURE29 = 34013; // 0x84dd + field public static final int GL_TEXTURE3 = 33987; // 0x84c3 + field public static final int GL_TEXTURE30 = 34014; // 0x84de + field public static final int GL_TEXTURE31 = 34015; // 0x84df + field public static final int GL_TEXTURE4 = 33988; // 0x84c4 + field public static final int GL_TEXTURE5 = 33989; // 0x84c5 + field public static final int GL_TEXTURE6 = 33990; // 0x84c6 + field public static final int GL_TEXTURE7 = 33991; // 0x84c7 + field public static final int GL_TEXTURE8 = 33992; // 0x84c8 + field public static final int GL_TEXTURE9 = 33993; // 0x84c9 + field public static final int GL_TEXTURE_2D = 3553; // 0xde1 + field public static final int GL_TEXTURE_COORD_ARRAY = 32888; // 0x8078 + field public static final int GL_TEXTURE_ENV = 8960; // 0x2300 + field public static final int GL_TEXTURE_ENV_COLOR = 8705; // 0x2201 + field public static final int GL_TEXTURE_ENV_MODE = 8704; // 0x2200 + field public static final int GL_TEXTURE_MAG_FILTER = 10240; // 0x2800 + field public static final int GL_TEXTURE_MIN_FILTER = 10241; // 0x2801 + field public static final int GL_TEXTURE_WRAP_S = 10242; // 0x2802 + field public static final int GL_TEXTURE_WRAP_T = 10243; // 0x2803 + field public static final int GL_TRIANGLES = 4; // 0x4 + field public static final int GL_TRIANGLE_FAN = 6; // 0x6 + field public static final int GL_TRIANGLE_STRIP = 5; // 0x5 + field public static final int GL_TRUE = 1; // 0x1 + field public static final int GL_UNPACK_ALIGNMENT = 3317; // 0xcf5 + field public static final int GL_UNSIGNED_BYTE = 5121; // 0x1401 + field public static final int GL_UNSIGNED_SHORT = 5123; // 0x1403 + field public static final int GL_UNSIGNED_SHORT_4_4_4_4 = 32819; // 0x8033 + field public static final int GL_UNSIGNED_SHORT_5_5_5_1 = 32820; // 0x8034 + field public static final int GL_UNSIGNED_SHORT_5_6_5 = 33635; // 0x8363 + field public static final int GL_VENDOR = 7936; // 0x1f00 + field public static final int GL_VERSION = 7938; // 0x1f02 + field public static final int GL_VERTEX_ARRAY = 32884; // 0x8074 + field public static final int GL_XOR = 5382; // 0x1506 + field public static final int GL_ZERO = 0; // 0x0 + } + + public abstract interface GL10Ext implements javax.microedition.khronos.opengles.GL { + method public abstract int glQueryMatrixxOES(int[], int, int[], int); + method public abstract int glQueryMatrixxOES(java.nio.IntBuffer, java.nio.IntBuffer); + } + + public abstract interface GL11 implements javax.microedition.khronos.opengles.GL10 { + method public abstract void glBindBuffer(int, int); + method public abstract void glBufferData(int, int, java.nio.Buffer, int); + method public abstract void glBufferSubData(int, int, int, java.nio.Buffer); + method public abstract void glClipPlanef(int, float[], int); + method public abstract void glClipPlanef(int, java.nio.FloatBuffer); + method public abstract void glClipPlanex(int, int[], int); + method public abstract void glClipPlanex(int, java.nio.IntBuffer); + method public abstract void glColor4ub(byte, byte, byte, byte); + method public abstract void glColorPointer(int, int, int, int); + method public abstract void glDeleteBuffers(int, int[], int); + method public abstract void glDeleteBuffers(int, java.nio.IntBuffer); + method public abstract void glDrawElements(int, int, int, int); + method public abstract void glGenBuffers(int, int[], int); + method public abstract void glGenBuffers(int, java.nio.IntBuffer); + method public abstract void glGetBooleanv(int, boolean[], int); + method public abstract void glGetBooleanv(int, java.nio.IntBuffer); + method public abstract void glGetBufferParameteriv(int, int, int[], int); + method public abstract void glGetBufferParameteriv(int, int, java.nio.IntBuffer); + method public abstract void glGetClipPlanef(int, float[], int); + method public abstract void glGetClipPlanef(int, java.nio.FloatBuffer); + method public abstract void glGetClipPlanex(int, int[], int); + method public abstract void glGetClipPlanex(int, java.nio.IntBuffer); + method public abstract void glGetFixedv(int, int[], int); + method public abstract void glGetFixedv(int, java.nio.IntBuffer); + method public abstract void glGetFloatv(int, float[], int); + method public abstract void glGetFloatv(int, java.nio.FloatBuffer); + method public abstract void glGetLightfv(int, int, float[], int); + method public abstract void glGetLightfv(int, int, java.nio.FloatBuffer); + method public abstract void glGetLightxv(int, int, int[], int); + method public abstract void glGetLightxv(int, int, java.nio.IntBuffer); + method public abstract void glGetMaterialfv(int, int, float[], int); + method public abstract void glGetMaterialfv(int, int, java.nio.FloatBuffer); + method public abstract void glGetMaterialxv(int, int, int[], int); + method public abstract void glGetMaterialxv(int, int, java.nio.IntBuffer); + method public abstract void glGetPointerv(int, java.nio.Buffer[]); + method public abstract void glGetTexEnviv(int, int, int[], int); + method public abstract void glGetTexEnviv(int, int, java.nio.IntBuffer); + method public abstract void glGetTexEnvxv(int, int, int[], int); + method public abstract void glGetTexEnvxv(int, int, java.nio.IntBuffer); + method public abstract void glGetTexParameterfv(int, int, float[], int); + method public abstract void glGetTexParameterfv(int, int, java.nio.FloatBuffer); + method public abstract void glGetTexParameteriv(int, int, int[], int); + method public abstract void glGetTexParameteriv(int, int, java.nio.IntBuffer); + method public abstract void glGetTexParameterxv(int, int, int[], int); + method public abstract void glGetTexParameterxv(int, int, java.nio.IntBuffer); + method public abstract boolean glIsBuffer(int); + method public abstract boolean glIsEnabled(int); + method public abstract boolean glIsTexture(int); + method public abstract void glNormalPointer(int, int, int); + method public abstract void glPointParameterf(int, float); + method public abstract void glPointParameterfv(int, float[], int); + method public abstract void glPointParameterfv(int, java.nio.FloatBuffer); + method public abstract void glPointParameterx(int, int); + method public abstract void glPointParameterxv(int, int[], int); + method public abstract void glPointParameterxv(int, java.nio.IntBuffer); + method public abstract void glPointSizePointerOES(int, int, java.nio.Buffer); + method public abstract void glTexCoordPointer(int, int, int, int); + method public abstract void glTexEnvi(int, int, int); + method public abstract void glTexEnviv(int, int, int[], int); + method public abstract void glTexEnviv(int, int, java.nio.IntBuffer); + method public abstract void glTexParameterfv(int, int, float[], int); + method public abstract void glTexParameterfv(int, int, java.nio.FloatBuffer); + method public abstract void glTexParameteri(int, int, int); + method public abstract void glTexParameteriv(int, int, int[], int); + method public abstract void glTexParameteriv(int, int, java.nio.IntBuffer); + method public abstract void glTexParameterxv(int, int, int[], int); + method public abstract void glTexParameterxv(int, int, java.nio.IntBuffer); + method public abstract void glVertexPointer(int, int, int, int); + field public static final int GL_ACTIVE_TEXTURE = 34016; // 0x84e0 + field public static final int GL_ADD_SIGNED = 34164; // 0x8574 + field public static final int GL_ALPHA_SCALE = 3356; // 0xd1c + field public static final int GL_ALPHA_TEST_FUNC = 3009; // 0xbc1 + field public static final int GL_ALPHA_TEST_REF = 3010; // 0xbc2 + field public static final int GL_ARRAY_BUFFER = 34962; // 0x8892 + field public static final int GL_ARRAY_BUFFER_BINDING = 34964; // 0x8894 + field public static final int GL_BLEND_DST = 3040; // 0xbe0 + field public static final int GL_BLEND_SRC = 3041; // 0xbe1 + field public static final int GL_BUFFER_ACCESS = 35003; // 0x88bb + field public static final int GL_BUFFER_SIZE = 34660; // 0x8764 + field public static final int GL_BUFFER_USAGE = 34661; // 0x8765 + field public static final int GL_CLIENT_ACTIVE_TEXTURE = 34017; // 0x84e1 + field public static final int GL_CLIP_PLANE0 = 12288; // 0x3000 + field public static final int GL_CLIP_PLANE1 = 12289; // 0x3001 + field public static final int GL_CLIP_PLANE2 = 12290; // 0x3002 + field public static final int GL_CLIP_PLANE3 = 12291; // 0x3003 + field public static final int GL_CLIP_PLANE4 = 12292; // 0x3004 + field public static final int GL_CLIP_PLANE5 = 12293; // 0x3005 + field public static final int GL_COLOR_ARRAY_BUFFER_BINDING = 34968; // 0x8898 + field public static final int GL_COLOR_ARRAY_POINTER = 32912; // 0x8090 + field public static final int GL_COLOR_ARRAY_SIZE = 32897; // 0x8081 + field public static final int GL_COLOR_ARRAY_STRIDE = 32899; // 0x8083 + field public static final int GL_COLOR_ARRAY_TYPE = 32898; // 0x8082 + field public static final int GL_COLOR_CLEAR_VALUE = 3106; // 0xc22 + field public static final int GL_COLOR_WRITEMASK = 3107; // 0xc23 + field public static final int GL_COMBINE = 34160; // 0x8570 + field public static final int GL_COMBINE_ALPHA = 34162; // 0x8572 + field public static final int GL_COMBINE_RGB = 34161; // 0x8571 + field public static final int GL_CONSTANT = 34166; // 0x8576 + field public static final int GL_COORD_REPLACE_OES = 34914; // 0x8862 + field public static final int GL_CULL_FACE_MODE = 2885; // 0xb45 + field public static final int GL_CURRENT_COLOR = 2816; // 0xb00 + field public static final int GL_CURRENT_NORMAL = 2818; // 0xb02 + field public static final int GL_CURRENT_TEXTURE_COORDS = 2819; // 0xb03 + field public static final int GL_DEPTH_CLEAR_VALUE = 2931; // 0xb73 + field public static final int GL_DEPTH_FUNC = 2932; // 0xb74 + field public static final int GL_DEPTH_RANGE = 2928; // 0xb70 + field public static final int GL_DEPTH_WRITEMASK = 2930; // 0xb72 + field public static final int GL_DOT3_RGB = 34478; // 0x86ae + field public static final int GL_DOT3_RGBA = 34479; // 0x86af + field public static final int GL_DYNAMIC_DRAW = 35048; // 0x88e8 + field public static final int GL_ELEMENT_ARRAY_BUFFER = 34963; // 0x8893 + field public static final int GL_ELEMENT_ARRAY_BUFFER_BINDING = 34965; // 0x8895 + field public static final int GL_FRONT_FACE = 2886; // 0xb46 + field public static final int GL_GENERATE_MIPMAP = 33169; // 0x8191 + field public static final int GL_GENERATE_MIPMAP_HINT = 33170; // 0x8192 + field public static final int GL_INTERPOLATE = 34165; // 0x8575 + field public static final int GL_LINE_WIDTH = 2849; // 0xb21 + field public static final int GL_LOGIC_OP_MODE = 3056; // 0xbf0 + field public static final int GL_MATRIX_MODE = 2976; // 0xba0 + field public static final int GL_MAX_CLIP_PLANES = 3378; // 0xd32 + field public static final int GL_MODELVIEW_MATRIX = 2982; // 0xba6 + field public static final int GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES = 35213; // 0x898d + field public static final int GL_MODELVIEW_STACK_DEPTH = 2979; // 0xba3 + field public static final int GL_NORMAL_ARRAY_BUFFER_BINDING = 34967; // 0x8897 + field public static final int GL_NORMAL_ARRAY_POINTER = 32911; // 0x808f + field public static final int GL_NORMAL_ARRAY_STRIDE = 32895; // 0x807f + field public static final int GL_NORMAL_ARRAY_TYPE = 32894; // 0x807e + field public static final int GL_OPERAND0_ALPHA = 34200; // 0x8598 + field public static final int GL_OPERAND0_RGB = 34192; // 0x8590 + field public static final int GL_OPERAND1_ALPHA = 34201; // 0x8599 + field public static final int GL_OPERAND1_RGB = 34193; // 0x8591 + field public static final int GL_OPERAND2_ALPHA = 34202; // 0x859a + field public static final int GL_OPERAND2_RGB = 34194; // 0x8592 + field public static final int GL_POINT_DISTANCE_ATTENUATION = 33065; // 0x8129 + field public static final int GL_POINT_FADE_THRESHOLD_SIZE = 33064; // 0x8128 + field public static final int GL_POINT_SIZE = 2833; // 0xb11 + field public static final int GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES = 35743; // 0x8b9f + field public static final int GL_POINT_SIZE_ARRAY_OES = 35740; // 0x8b9c + field public static final int GL_POINT_SIZE_ARRAY_POINTER_OES = 35212; // 0x898c + field public static final int GL_POINT_SIZE_ARRAY_STRIDE_OES = 35211; // 0x898b + field public static final int GL_POINT_SIZE_ARRAY_TYPE_OES = 35210; // 0x898a + field public static final int GL_POINT_SIZE_MAX = 33063; // 0x8127 + field public static final int GL_POINT_SIZE_MIN = 33062; // 0x8126 + field public static final int GL_POINT_SPRITE_OES = 34913; // 0x8861 + field public static final int GL_POLYGON_OFFSET_FACTOR = 32824; // 0x8038 + field public static final int GL_POLYGON_OFFSET_UNITS = 10752; // 0x2a00 + field public static final int GL_PREVIOUS = 34168; // 0x8578 + field public static final int GL_PRIMARY_COLOR = 34167; // 0x8577 + field public static final int GL_PROJECTION_MATRIX = 2983; // 0xba7 + field public static final int GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES = 35214; // 0x898e + field public static final int GL_PROJECTION_STACK_DEPTH = 2980; // 0xba4 + field public static final int GL_RGB_SCALE = 34163; // 0x8573 + field public static final int GL_SAMPLES = 32937; // 0x80a9 + field public static final int GL_SAMPLE_BUFFERS = 32936; // 0x80a8 + field public static final int GL_SAMPLE_COVERAGE_INVERT = 32939; // 0x80ab + field public static final int GL_SAMPLE_COVERAGE_VALUE = 32938; // 0x80aa + field public static final int GL_SCISSOR_BOX = 3088; // 0xc10 + field public static final int GL_SHADE_MODEL = 2900; // 0xb54 + field public static final int GL_SRC0_ALPHA = 34184; // 0x8588 + field public static final int GL_SRC0_RGB = 34176; // 0x8580 + field public static final int GL_SRC1_ALPHA = 34185; // 0x8589 + field public static final int GL_SRC1_RGB = 34177; // 0x8581 + field public static final int GL_SRC2_ALPHA = 34186; // 0x858a + field public static final int GL_SRC2_RGB = 34178; // 0x8582 + field public static final int GL_STATIC_DRAW = 35044; // 0x88e4 + field public static final int GL_STENCIL_CLEAR_VALUE = 2961; // 0xb91 + field public static final int GL_STENCIL_FAIL = 2964; // 0xb94 + field public static final int GL_STENCIL_FUNC = 2962; // 0xb92 + field public static final int GL_STENCIL_PASS_DEPTH_FAIL = 2965; // 0xb95 + field public static final int GL_STENCIL_PASS_DEPTH_PASS = 2966; // 0xb96 + field public static final int GL_STENCIL_REF = 2967; // 0xb97 + field public static final int GL_STENCIL_VALUE_MASK = 2963; // 0xb93 + field public static final int GL_STENCIL_WRITEMASK = 2968; // 0xb98 + field public static final int GL_SUBTRACT = 34023; // 0x84e7 + field public static final int GL_TEXTURE_BINDING_2D = 32873; // 0x8069 + field public static final int GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING = 34970; // 0x889a + field public static final int GL_TEXTURE_COORD_ARRAY_POINTER = 32914; // 0x8092 + field public static final int GL_TEXTURE_COORD_ARRAY_SIZE = 32904; // 0x8088 + field public static final int GL_TEXTURE_COORD_ARRAY_STRIDE = 32906; // 0x808a + field public static final int GL_TEXTURE_COORD_ARRAY_TYPE = 32905; // 0x8089 + field public static final int GL_TEXTURE_MATRIX = 2984; // 0xba8 + field public static final int GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES = 35215; // 0x898f + field public static final int GL_TEXTURE_STACK_DEPTH = 2981; // 0xba5 + field public static final int GL_VERTEX_ARRAY_BUFFER_BINDING = 34966; // 0x8896 + field public static final int GL_VERTEX_ARRAY_POINTER = 32910; // 0x808e + field public static final int GL_VERTEX_ARRAY_SIZE = 32890; // 0x807a + field public static final int GL_VERTEX_ARRAY_STRIDE = 32892; // 0x807c + field public static final int GL_VERTEX_ARRAY_TYPE = 32891; // 0x807b + field public static final int GL_VIEWPORT = 2978; // 0xba2 + field public static final int GL_WRITE_ONLY = 35001; // 0x88b9 + } + + public abstract interface GL11Ext implements javax.microedition.khronos.opengles.GL { + method public abstract void glCurrentPaletteMatrixOES(int); + method public abstract void glDrawTexfOES(float, float, float, float, float); + method public abstract void glDrawTexfvOES(float[], int); + method public abstract void glDrawTexfvOES(java.nio.FloatBuffer); + method public abstract void glDrawTexiOES(int, int, int, int, int); + method public abstract void glDrawTexivOES(int[], int); + method public abstract void glDrawTexivOES(java.nio.IntBuffer); + method public abstract void glDrawTexsOES(short, short, short, short, short); + method public abstract void glDrawTexsvOES(short[], int); + method public abstract void glDrawTexsvOES(java.nio.ShortBuffer); + method public abstract void glDrawTexxOES(int, int, int, int, int); + method public abstract void glDrawTexxvOES(int[], int); + method public abstract void glDrawTexxvOES(java.nio.IntBuffer); + method public abstract void glEnable(int); + method public abstract void glEnableClientState(int); + method public abstract void glLoadPaletteFromModelViewMatrixOES(); + method public abstract void glMatrixIndexPointerOES(int, int, int, java.nio.Buffer); + method public abstract void glMatrixIndexPointerOES(int, int, int, int); + method public abstract void glTexParameterfv(int, int, float[], int); + method public abstract void glWeightPointerOES(int, int, int, java.nio.Buffer); + method public abstract void glWeightPointerOES(int, int, int, int); + field public static final int GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES = 35742; // 0x8b9e + field public static final int GL_MATRIX_INDEX_ARRAY_OES = 34884; // 0x8844 + field public static final int GL_MATRIX_INDEX_ARRAY_POINTER_OES = 34889; // 0x8849 + field public static final int GL_MATRIX_INDEX_ARRAY_SIZE_OES = 34886; // 0x8846 + field public static final int GL_MATRIX_INDEX_ARRAY_STRIDE_OES = 34888; // 0x8848 + field public static final int GL_MATRIX_INDEX_ARRAY_TYPE_OES = 34887; // 0x8847 + field public static final int GL_MATRIX_PALETTE_OES = 34880; // 0x8840 + field public static final int GL_MAX_PALETTE_MATRICES_OES = 34882; // 0x8842 + field public static final int GL_MAX_VERTEX_UNITS_OES = 34468; // 0x86a4 + field public static final int GL_TEXTURE_CROP_RECT_OES = 35741; // 0x8b9d + field public static final int GL_WEIGHT_ARRAY_BUFFER_BINDING_OES = 34974; // 0x889e + field public static final int GL_WEIGHT_ARRAY_OES = 34477; // 0x86ad + field public static final int GL_WEIGHT_ARRAY_POINTER_OES = 34476; // 0x86ac + field public static final int GL_WEIGHT_ARRAY_SIZE_OES = 34475; // 0x86ab + field public static final int GL_WEIGHT_ARRAY_STRIDE_OES = 34474; // 0x86aa + field public static final int GL_WEIGHT_ARRAY_TYPE_OES = 34473; // 0x86a9 + } + + public abstract interface GL11ExtensionPack implements javax.microedition.khronos.opengles.GL { + method public abstract void glBindFramebufferOES(int, int); + method public abstract void glBindRenderbufferOES(int, int); + method public abstract void glBindTexture(int, int); + method public abstract void glBlendEquation(int); + method public abstract void glBlendEquationSeparate(int, int); + method public abstract void glBlendFuncSeparate(int, int, int, int); + method public abstract int glCheckFramebufferStatusOES(int); + method public abstract void glCompressedTexImage2D(int, int, int, int, int, int, int, java.nio.Buffer); + method public abstract void glCopyTexImage2D(int, int, int, int, int, int, int, int); + method public abstract void glDeleteFramebuffersOES(int, int[], int); + method public abstract void glDeleteFramebuffersOES(int, java.nio.IntBuffer); + method public abstract void glDeleteRenderbuffersOES(int, int[], int); + method public abstract void glDeleteRenderbuffersOES(int, java.nio.IntBuffer); + method public abstract void glEnable(int); + method public abstract void glFramebufferRenderbufferOES(int, int, int, int); + method public abstract void glFramebufferTexture2DOES(int, int, int, int, int); + method public abstract void glGenFramebuffersOES(int, int[], int); + method public abstract void glGenFramebuffersOES(int, java.nio.IntBuffer); + method public abstract void glGenRenderbuffersOES(int, int[], int); + method public abstract void glGenRenderbuffersOES(int, java.nio.IntBuffer); + method public abstract void glGenerateMipmapOES(int); + method public abstract void glGetFramebufferAttachmentParameterivOES(int, int, int, int[], int); + method public abstract void glGetFramebufferAttachmentParameterivOES(int, int, int, java.nio.IntBuffer); + method public abstract void glGetIntegerv(int, int[], int); + method public abstract void glGetIntegerv(int, java.nio.IntBuffer); + method public abstract void glGetRenderbufferParameterivOES(int, int, int[], int); + method public abstract void glGetRenderbufferParameterivOES(int, int, java.nio.IntBuffer); + method public abstract void glGetTexGenfv(int, int, float[], int); + method public abstract void glGetTexGenfv(int, int, java.nio.FloatBuffer); + method public abstract void glGetTexGeniv(int, int, int[], int); + method public abstract void glGetTexGeniv(int, int, java.nio.IntBuffer); + method public abstract void glGetTexGenxv(int, int, int[], int); + method public abstract void glGetTexGenxv(int, int, java.nio.IntBuffer); + method public abstract boolean glIsFramebufferOES(int); + method public abstract boolean glIsRenderbufferOES(int); + method public abstract void glRenderbufferStorageOES(int, int, int, int); + method public abstract void glStencilOp(int, int, int); + method public abstract void glTexEnvf(int, int, float); + method public abstract void glTexEnvfv(int, int, float[], int); + method public abstract void glTexEnvfv(int, int, java.nio.FloatBuffer); + method public abstract void glTexEnvx(int, int, int); + method public abstract void glTexEnvxv(int, int, int[], int); + method public abstract void glTexEnvxv(int, int, java.nio.IntBuffer); + method public abstract void glTexGenf(int, int, float); + method public abstract void glTexGenfv(int, int, float[], int); + method public abstract void glTexGenfv(int, int, java.nio.FloatBuffer); + method public abstract void glTexGeni(int, int, int); + method public abstract void glTexGeniv(int, int, int[], int); + method public abstract void glTexGeniv(int, int, java.nio.IntBuffer); + method public abstract void glTexGenx(int, int, int); + method public abstract void glTexGenxv(int, int, int[], int); + method public abstract void glTexGenxv(int, int, java.nio.IntBuffer); + method public abstract void glTexParameterf(int, int, float); + field public static final int GL_BLEND_DST_ALPHA = 32970; // 0x80ca + field public static final int GL_BLEND_DST_RGB = 32968; // 0x80c8 + field public static final int GL_BLEND_EQUATION = 32777; // 0x8009 + field public static final int GL_BLEND_EQUATION_ALPHA = 34877; // 0x883d + field public static final int GL_BLEND_EQUATION_RGB = 32777; // 0x8009 + field public static final int GL_BLEND_SRC_ALPHA = 32971; // 0x80cb + field public static final int GL_BLEND_SRC_RGB = 32969; // 0x80c9 + field public static final int GL_COLOR_ATTACHMENT0_OES = 36064; // 0x8ce0 + field public static final int GL_COLOR_ATTACHMENT10_OES = 36074; // 0x8cea + field public static final int GL_COLOR_ATTACHMENT11_OES = 36075; // 0x8ceb + field public static final int GL_COLOR_ATTACHMENT12_OES = 36076; // 0x8cec + field public static final int GL_COLOR_ATTACHMENT13_OES = 36077; // 0x8ced + field public static final int GL_COLOR_ATTACHMENT14_OES = 36078; // 0x8cee + field public static final int GL_COLOR_ATTACHMENT15_OES = 36079; // 0x8cef + field public static final int GL_COLOR_ATTACHMENT1_OES = 36065; // 0x8ce1 + field public static final int GL_COLOR_ATTACHMENT2_OES = 36066; // 0x8ce2 + field public static final int GL_COLOR_ATTACHMENT3_OES = 36067; // 0x8ce3 + field public static final int GL_COLOR_ATTACHMENT4_OES = 36068; // 0x8ce4 + field public static final int GL_COLOR_ATTACHMENT5_OES = 36069; // 0x8ce5 + field public static final int GL_COLOR_ATTACHMENT6_OES = 36070; // 0x8ce6 + field public static final int GL_COLOR_ATTACHMENT7_OES = 36071; // 0x8ce7 + field public static final int GL_COLOR_ATTACHMENT8_OES = 36072; // 0x8ce8 + field public static final int GL_COLOR_ATTACHMENT9_OES = 36073; // 0x8ce9 + field public static final int GL_DECR_WRAP = 34056; // 0x8508 + field public static final int GL_DEPTH_ATTACHMENT_OES = 36096; // 0x8d00 + field public static final int GL_DEPTH_COMPONENT = 6402; // 0x1902 + field public static final int GL_DEPTH_COMPONENT16 = 33189; // 0x81a5 + field public static final int GL_DEPTH_COMPONENT24 = 33190; // 0x81a6 + field public static final int GL_DEPTH_COMPONENT32 = 33191; // 0x81a7 + field public static final int GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_OES = 36049; // 0x8cd1 + field public static final int GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_OES = 36048; // 0x8cd0 + field public static final int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_OES = 36051; // 0x8cd3 + field public static final int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_OES = 36050; // 0x8cd2 + field public static final int GL_FRAMEBUFFER_BINDING_OES = 36006; // 0x8ca6 + field public static final int GL_FRAMEBUFFER_COMPLETE_OES = 36053; // 0x8cd5 + field public static final int GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES = 36054; // 0x8cd6 + field public static final int GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES = 36057; // 0x8cd9 + field public static final int GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_OES = 36059; // 0x8cdb + field public static final int GL_FRAMEBUFFER_INCOMPLETE_FORMATS_OES = 36058; // 0x8cda + field public static final int GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES = 36055; // 0x8cd7 + field public static final int GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_OES = 36060; // 0x8cdc + field public static final int GL_FRAMEBUFFER_OES = 36160; // 0x8d40 + field public static final int GL_FRAMEBUFFER_UNSUPPORTED_OES = 36061; // 0x8cdd + field public static final int GL_FUNC_ADD = 32774; // 0x8006 + field public static final int GL_FUNC_REVERSE_SUBTRACT = 32779; // 0x800b + field public static final int GL_FUNC_SUBTRACT = 32778; // 0x800a + field public static final int GL_INCR_WRAP = 34055; // 0x8507 + field public static final int GL_INVALID_FRAMEBUFFER_OPERATION_OES = 1286; // 0x506 + field public static final int GL_MAX_COLOR_ATTACHMENTS_OES = 36063; // 0x8cdf + field public static final int GL_MAX_CUBE_MAP_TEXTURE_SIZE = 34076; // 0x851c + field public static final int GL_MAX_RENDERBUFFER_SIZE_OES = 34024; // 0x84e8 + field public static final int GL_MIRRORED_REPEAT = 33648; // 0x8370 + field public static final int GL_NORMAL_MAP = 34065; // 0x8511 + field public static final int GL_REFLECTION_MAP = 34066; // 0x8512 + field public static final int GL_RENDERBUFFER_ALPHA_SIZE_OES = 36179; // 0x8d53 + field public static final int GL_RENDERBUFFER_BINDING_OES = 36007; // 0x8ca7 + field public static final int GL_RENDERBUFFER_BLUE_SIZE_OES = 36178; // 0x8d52 + field public static final int GL_RENDERBUFFER_DEPTH_SIZE_OES = 36180; // 0x8d54 + field public static final int GL_RENDERBUFFER_GREEN_SIZE_OES = 36177; // 0x8d51 + field public static final int GL_RENDERBUFFER_HEIGHT_OES = 36163; // 0x8d43 + field public static final int GL_RENDERBUFFER_INTERNAL_FORMAT_OES = 36164; // 0x8d44 + field public static final int GL_RENDERBUFFER_OES = 36161; // 0x8d41 + field public static final int GL_RENDERBUFFER_RED_SIZE_OES = 36176; // 0x8d50 + field public static final int GL_RENDERBUFFER_STENCIL_SIZE_OES = 36181; // 0x8d55 + field public static final int GL_RENDERBUFFER_WIDTH_OES = 36162; // 0x8d42 + field public static final int GL_RGB565_OES = 36194; // 0x8d62 + field public static final int GL_RGB5_A1 = 32855; // 0x8057 + field public static final int GL_RGB8 = 32849; // 0x8051 + field public static final int GL_RGBA4 = 32854; // 0x8056 + field public static final int GL_RGBA8 = 32856; // 0x8058 + field public static final int GL_STENCIL_ATTACHMENT_OES = 36128; // 0x8d20 + field public static final int GL_STENCIL_INDEX = 6401; // 0x1901 + field public static final int GL_STENCIL_INDEX1_OES = 36166; // 0x8d46 + field public static final int GL_STENCIL_INDEX4_OES = 36167; // 0x8d47 + field public static final int GL_STENCIL_INDEX8_OES = 36168; // 0x8d48 + field public static final int GL_STR = -1; // 0xffffffff + field public static final int GL_TEXTURE_BINDING_CUBE_MAP = 34068; // 0x8514 + field public static final int GL_TEXTURE_CUBE_MAP = 34067; // 0x8513 + field public static final int GL_TEXTURE_CUBE_MAP_NEGATIVE_X = 34070; // 0x8516 + field public static final int GL_TEXTURE_CUBE_MAP_NEGATIVE_Y = 34072; // 0x8518 + field public static final int GL_TEXTURE_CUBE_MAP_NEGATIVE_Z = 34074; // 0x851a + field public static final int GL_TEXTURE_CUBE_MAP_POSITIVE_X = 34069; // 0x8515 + field public static final int GL_TEXTURE_CUBE_MAP_POSITIVE_Y = 34071; // 0x8517 + field public static final int GL_TEXTURE_CUBE_MAP_POSITIVE_Z = 34073; // 0x8519 + field public static final int GL_TEXTURE_GEN_MODE = 9472; // 0x2500 + field public static final int GL_TEXTURE_GEN_STR = 36192; // 0x8d60 + } + +} + +package javax.net { + + public abstract class ServerSocketFactory { + ctor protected ServerSocketFactory(); + method public java.net.ServerSocket createServerSocket() throws java.io.IOException; + method public abstract java.net.ServerSocket createServerSocket(int) throws java.io.IOException; + method public abstract java.net.ServerSocket createServerSocket(int, int) throws java.io.IOException; + method public abstract java.net.ServerSocket createServerSocket(int, int, java.net.InetAddress) throws java.io.IOException; + method public static synchronized javax.net.ServerSocketFactory getDefault(); + } + + public abstract class SocketFactory { + ctor protected SocketFactory(); + method public java.net.Socket createSocket() throws java.io.IOException; + method public abstract java.net.Socket createSocket(java.lang.String, int) throws java.io.IOException, java.net.UnknownHostException; + method public abstract java.net.Socket createSocket(java.lang.String, int, java.net.InetAddress, int) throws java.io.IOException, java.net.UnknownHostException; + method public abstract java.net.Socket createSocket(java.net.InetAddress, int) throws java.io.IOException; + method public abstract java.net.Socket createSocket(java.net.InetAddress, int, java.net.InetAddress, int) throws java.io.IOException; + method public static synchronized javax.net.SocketFactory getDefault(); + } + +} + +package javax.net.ssl { + + public class CertPathTrustManagerParameters implements javax.net.ssl.ManagerFactoryParameters { + ctor public CertPathTrustManagerParameters(java.security.cert.CertPathParameters); + method public java.security.cert.CertPathParameters getParameters(); + } + + public class HandshakeCompletedEvent extends java.util.EventObject { + ctor public HandshakeCompletedEvent(javax.net.ssl.SSLSocket, javax.net.ssl.SSLSession); + method public java.lang.String getCipherSuite(); + method public java.security.cert.Certificate[] getLocalCertificates(); + method public java.security.Principal getLocalPrincipal(); + method public javax.security.cert.X509Certificate[] getPeerCertificateChain() throws javax.net.ssl.SSLPeerUnverifiedException; + method public java.security.cert.Certificate[] getPeerCertificates() throws javax.net.ssl.SSLPeerUnverifiedException; + method public java.security.Principal getPeerPrincipal() throws javax.net.ssl.SSLPeerUnverifiedException; + method public javax.net.ssl.SSLSession getSession(); + method public javax.net.ssl.SSLSocket getSocket(); + } + + public abstract interface HandshakeCompletedListener implements java.util.EventListener { + method public abstract void handshakeCompleted(javax.net.ssl.HandshakeCompletedEvent); + } + + public abstract interface HostnameVerifier { + method public abstract boolean verify(java.lang.String, javax.net.ssl.SSLSession); + } + + public abstract class HttpsURLConnection extends java.net.HttpURLConnection { + ctor protected HttpsURLConnection(java.net.URL); + method public abstract java.lang.String getCipherSuite(); + method public static javax.net.ssl.HostnameVerifier getDefaultHostnameVerifier(); + method public static javax.net.ssl.SSLSocketFactory getDefaultSSLSocketFactory(); + method public javax.net.ssl.HostnameVerifier getHostnameVerifier(); + method public abstract java.security.cert.Certificate[] getLocalCertificates(); + method public java.security.Principal getLocalPrincipal(); + method public java.security.Principal getPeerPrincipal() throws javax.net.ssl.SSLPeerUnverifiedException; + method public javax.net.ssl.SSLSocketFactory getSSLSocketFactory(); + method public abstract java.security.cert.Certificate[] getServerCertificates() throws javax.net.ssl.SSLPeerUnverifiedException; + method public static void setDefaultHostnameVerifier(javax.net.ssl.HostnameVerifier); + method public static void setDefaultSSLSocketFactory(javax.net.ssl.SSLSocketFactory); + method public void setHostnameVerifier(javax.net.ssl.HostnameVerifier); + method public void setSSLSocketFactory(javax.net.ssl.SSLSocketFactory); + field protected javax.net.ssl.HostnameVerifier hostnameVerifier; + } + + public abstract interface KeyManager { + } + + public class KeyManagerFactory { + ctor protected KeyManagerFactory(javax.net.ssl.KeyManagerFactorySpi, java.security.Provider, java.lang.String); + method public final java.lang.String getAlgorithm(); + method public static final java.lang.String getDefaultAlgorithm(); + method public static final javax.net.ssl.KeyManagerFactory getInstance(java.lang.String) throws java.security.NoSuchAlgorithmException; + method public static final javax.net.ssl.KeyManagerFactory getInstance(java.lang.String, java.lang.String) throws java.security.NoSuchAlgorithmException, java.security.NoSuchProviderException; + method public static final javax.net.ssl.KeyManagerFactory getInstance(java.lang.String, java.security.Provider) throws java.security.NoSuchAlgorithmException; + method public final javax.net.ssl.KeyManager[] getKeyManagers(); + method public final java.security.Provider getProvider(); + method public final void init(java.security.KeyStore, char[]) throws java.security.KeyStoreException, java.security.NoSuchAlgorithmException, java.security.UnrecoverableKeyException; + method public final void init(javax.net.ssl.ManagerFactoryParameters) throws java.security.InvalidAlgorithmParameterException; + } + + public abstract class KeyManagerFactorySpi { + ctor public KeyManagerFactorySpi(); + method protected abstract javax.net.ssl.KeyManager[] engineGetKeyManagers(); + method protected abstract void engineInit(java.security.KeyStore, char[]) throws java.security.KeyStoreException, java.security.NoSuchAlgorithmException, java.security.UnrecoverableKeyException; + method protected abstract void engineInit(javax.net.ssl.ManagerFactoryParameters) throws java.security.InvalidAlgorithmParameterException; + } + + public class KeyStoreBuilderParameters implements javax.net.ssl.ManagerFactoryParameters { + ctor public KeyStoreBuilderParameters(java.security.KeyStore.Builder); + ctor public KeyStoreBuilderParameters(java.util.List); + method public java.util.List getParameters(); + } + + public abstract interface ManagerFactoryParameters { + } + + public class SSLContext { + ctor protected SSLContext(javax.net.ssl.SSLContextSpi, java.security.Provider, java.lang.String); + method public final javax.net.ssl.SSLEngine createSSLEngine(); + method public final javax.net.ssl.SSLEngine createSSLEngine(java.lang.String, int); + method public final javax.net.ssl.SSLSessionContext getClientSessionContext(); + method public static javax.net.ssl.SSLContext getDefault() throws java.security.NoSuchAlgorithmException; + method public final javax.net.ssl.SSLParameters getDefaultSSLParameters(); + method public static javax.net.ssl.SSLContext getInstance(java.lang.String) throws java.security.NoSuchAlgorithmException; + method public static javax.net.ssl.SSLContext getInstance(java.lang.String, java.lang.String) throws java.security.NoSuchAlgorithmException, java.security.NoSuchProviderException; + method public static javax.net.ssl.SSLContext getInstance(java.lang.String, java.security.Provider) throws java.security.NoSuchAlgorithmException; + method public final java.lang.String getProtocol(); + method public final java.security.Provider getProvider(); + method public final javax.net.ssl.SSLSessionContext getServerSessionContext(); + method public final javax.net.ssl.SSLServerSocketFactory getServerSocketFactory(); + method public final javax.net.ssl.SSLSocketFactory getSocketFactory(); + method public final javax.net.ssl.SSLParameters getSupportedSSLParameters(); + method public final void init(javax.net.ssl.KeyManager[], javax.net.ssl.TrustManager[], java.security.SecureRandom) throws java.security.KeyManagementException; + method public static void setDefault(javax.net.ssl.SSLContext); + } + + public abstract class SSLContextSpi { + ctor public SSLContextSpi(); + method protected abstract javax.net.ssl.SSLEngine engineCreateSSLEngine(java.lang.String, int); + method protected abstract javax.net.ssl.SSLEngine engineCreateSSLEngine(); + method protected abstract javax.net.ssl.SSLSessionContext engineGetClientSessionContext(); + method protected javax.net.ssl.SSLParameters engineGetDefaultSSLParameters(); + method protected abstract javax.net.ssl.SSLSessionContext engineGetServerSessionContext(); + method protected abstract javax.net.ssl.SSLServerSocketFactory engineGetServerSocketFactory(); + method protected abstract javax.net.ssl.SSLSocketFactory engineGetSocketFactory(); + method protected javax.net.ssl.SSLParameters engineGetSupportedSSLParameters(); + method protected abstract void engineInit(javax.net.ssl.KeyManager[], javax.net.ssl.TrustManager[], java.security.SecureRandom) throws java.security.KeyManagementException; + } + + public abstract class SSLEngine { + ctor protected SSLEngine(); + ctor protected SSLEngine(java.lang.String, int); + method public abstract void beginHandshake() throws javax.net.ssl.SSLException; + method public abstract void closeInbound() throws javax.net.ssl.SSLException; + method public abstract void closeOutbound(); + method public abstract java.lang.Runnable getDelegatedTask(); + method public abstract boolean getEnableSessionCreation(); + method public abstract java.lang.String[] getEnabledCipherSuites(); + method public abstract java.lang.String[] getEnabledProtocols(); + method public abstract javax.net.ssl.SSLEngineResult.HandshakeStatus getHandshakeStatus(); + method public abstract boolean getNeedClientAuth(); + method public java.lang.String getPeerHost(); + method public int getPeerPort(); + method public javax.net.ssl.SSLParameters getSSLParameters(); + method public abstract javax.net.ssl.SSLSession getSession(); + method public abstract java.lang.String[] getSupportedCipherSuites(); + method public abstract java.lang.String[] getSupportedProtocols(); + method public abstract boolean getUseClientMode(); + method public abstract boolean getWantClientAuth(); + method public abstract boolean isInboundDone(); + method public abstract boolean isOutboundDone(); + method public abstract void setEnableSessionCreation(boolean); + method public abstract void setEnabledCipherSuites(java.lang.String[]); + method public abstract void setEnabledProtocols(java.lang.String[]); + method public abstract void setNeedClientAuth(boolean); + method public void setSSLParameters(javax.net.ssl.SSLParameters); + method public abstract void setUseClientMode(boolean); + method public abstract void setWantClientAuth(boolean); + method public abstract javax.net.ssl.SSLEngineResult unwrap(java.nio.ByteBuffer, java.nio.ByteBuffer[], int, int) throws javax.net.ssl.SSLException; + method public javax.net.ssl.SSLEngineResult unwrap(java.nio.ByteBuffer, java.nio.ByteBuffer) throws javax.net.ssl.SSLException; + method public javax.net.ssl.SSLEngineResult unwrap(java.nio.ByteBuffer, java.nio.ByteBuffer[]) throws javax.net.ssl.SSLException; + method public abstract javax.net.ssl.SSLEngineResult wrap(java.nio.ByteBuffer[], int, int, java.nio.ByteBuffer) throws javax.net.ssl.SSLException; + method public javax.net.ssl.SSLEngineResult wrap(java.nio.ByteBuffer[], java.nio.ByteBuffer) throws javax.net.ssl.SSLException; + method public javax.net.ssl.SSLEngineResult wrap(java.nio.ByteBuffer, java.nio.ByteBuffer) throws javax.net.ssl.SSLException; + } + + public class SSLEngineResult { + ctor public SSLEngineResult(javax.net.ssl.SSLEngineResult.Status, javax.net.ssl.SSLEngineResult.HandshakeStatus, int, int); + method public final int bytesConsumed(); + method public final int bytesProduced(); + method public final javax.net.ssl.SSLEngineResult.HandshakeStatus getHandshakeStatus(); + method public final javax.net.ssl.SSLEngineResult.Status getStatus(); + } + + public static final class SSLEngineResult.HandshakeStatus extends java.lang.Enum { + method public static javax.net.ssl.SSLEngineResult.HandshakeStatus valueOf(java.lang.String); + method public static final javax.net.ssl.SSLEngineResult.HandshakeStatus[] values(); + enum_constant public static final javax.net.ssl.SSLEngineResult.HandshakeStatus FINISHED; + enum_constant public static final javax.net.ssl.SSLEngineResult.HandshakeStatus NEED_TASK; + enum_constant public static final javax.net.ssl.SSLEngineResult.HandshakeStatus NEED_UNWRAP; + enum_constant public static final javax.net.ssl.SSLEngineResult.HandshakeStatus NEED_WRAP; + enum_constant public static final javax.net.ssl.SSLEngineResult.HandshakeStatus NOT_HANDSHAKING; + } + + public static final class SSLEngineResult.Status extends java.lang.Enum { + method public static javax.net.ssl.SSLEngineResult.Status valueOf(java.lang.String); + method public static final javax.net.ssl.SSLEngineResult.Status[] values(); + enum_constant public static final javax.net.ssl.SSLEngineResult.Status BUFFER_OVERFLOW; + enum_constant public static final javax.net.ssl.SSLEngineResult.Status BUFFER_UNDERFLOW; + enum_constant public static final javax.net.ssl.SSLEngineResult.Status CLOSED; + enum_constant public static final javax.net.ssl.SSLEngineResult.Status OK; + } + + public class SSLException extends java.io.IOException { + ctor public SSLException(java.lang.String); + ctor public SSLException(java.lang.String, java.lang.Throwable); + ctor public SSLException(java.lang.Throwable); + } + + public class SSLHandshakeException extends javax.net.ssl.SSLException { + ctor public SSLHandshakeException(java.lang.String); + } + + public class SSLKeyException extends javax.net.ssl.SSLException { + ctor public SSLKeyException(java.lang.String); + } + + public class SSLParameters { + ctor public SSLParameters(); + ctor public SSLParameters(java.lang.String[]); + ctor public SSLParameters(java.lang.String[], java.lang.String[]); + method public java.lang.String[] getCipherSuites(); + method public boolean getNeedClientAuth(); + method public java.lang.String[] getProtocols(); + method public boolean getWantClientAuth(); + method public void setCipherSuites(java.lang.String[]); + method public void setNeedClientAuth(boolean); + method public void setProtocols(java.lang.String[]); + method public void setWantClientAuth(boolean); + } + + public class SSLPeerUnverifiedException extends javax.net.ssl.SSLException { + ctor public SSLPeerUnverifiedException(java.lang.String); + } + + public final class SSLPermission extends java.security.BasicPermission { + ctor public SSLPermission(java.lang.String); + ctor public SSLPermission(java.lang.String, java.lang.String); + } + + public class SSLProtocolException extends javax.net.ssl.SSLException { + ctor public SSLProtocolException(java.lang.String); + } + + public abstract class SSLServerSocket extends java.net.ServerSocket { + ctor protected SSLServerSocket() throws java.io.IOException; + ctor protected SSLServerSocket(int) throws java.io.IOException; + ctor protected SSLServerSocket(int, int) throws java.io.IOException; + ctor protected SSLServerSocket(int, int, java.net.InetAddress) throws java.io.IOException; + method public abstract boolean getEnableSessionCreation(); + method public abstract java.lang.String[] getEnabledCipherSuites(); + method public abstract java.lang.String[] getEnabledProtocols(); + method public abstract boolean getNeedClientAuth(); + method public abstract java.lang.String[] getSupportedCipherSuites(); + method public abstract java.lang.String[] getSupportedProtocols(); + method public abstract boolean getUseClientMode(); + method public abstract boolean getWantClientAuth(); + method public abstract void setEnableSessionCreation(boolean); + method public abstract void setEnabledCipherSuites(java.lang.String[]); + method public abstract void setEnabledProtocols(java.lang.String[]); + method public abstract void setNeedClientAuth(boolean); + method public abstract void setUseClientMode(boolean); + method public abstract void setWantClientAuth(boolean); + } + + public abstract class SSLServerSocketFactory extends javax.net.ServerSocketFactory { + ctor protected SSLServerSocketFactory(); + method public static synchronized javax.net.ServerSocketFactory getDefault(); + method public abstract java.lang.String[] getDefaultCipherSuites(); + method public abstract java.lang.String[] getSupportedCipherSuites(); + } + + public abstract interface SSLSession { + method public abstract int getApplicationBufferSize(); + method public abstract java.lang.String getCipherSuite(); + method public abstract long getCreationTime(); + method public abstract byte[] getId(); + method public abstract long getLastAccessedTime(); + method public abstract java.security.cert.Certificate[] getLocalCertificates(); + method public abstract java.security.Principal getLocalPrincipal(); + method public abstract int getPacketBufferSize(); + method public abstract javax.security.cert.X509Certificate[] getPeerCertificateChain() throws javax.net.ssl.SSLPeerUnverifiedException; + method public abstract java.security.cert.Certificate[] getPeerCertificates() throws javax.net.ssl.SSLPeerUnverifiedException; + method public abstract java.lang.String getPeerHost(); + method public abstract int getPeerPort(); + method public abstract java.security.Principal getPeerPrincipal() throws javax.net.ssl.SSLPeerUnverifiedException; + method public abstract java.lang.String getProtocol(); + method public abstract javax.net.ssl.SSLSessionContext getSessionContext(); + method public abstract java.lang.Object getValue(java.lang.String); + method public abstract java.lang.String[] getValueNames(); + method public abstract void invalidate(); + method public abstract boolean isValid(); + method public abstract void putValue(java.lang.String, java.lang.Object); + method public abstract void removeValue(java.lang.String); + } + + public class SSLSessionBindingEvent extends java.util.EventObject { + ctor public SSLSessionBindingEvent(javax.net.ssl.SSLSession, java.lang.String); + method public java.lang.String getName(); + method public javax.net.ssl.SSLSession getSession(); + } + + public abstract interface SSLSessionBindingListener implements java.util.EventListener { + method public abstract void valueBound(javax.net.ssl.SSLSessionBindingEvent); + method public abstract void valueUnbound(javax.net.ssl.SSLSessionBindingEvent); + } + + public abstract interface SSLSessionContext { + method public abstract java.util.Enumeration getIds(); + method public abstract javax.net.ssl.SSLSession getSession(byte[]); + method public abstract int getSessionCacheSize(); + method public abstract int getSessionTimeout(); + method public abstract void setSessionCacheSize(int) throws java.lang.IllegalArgumentException; + method public abstract void setSessionTimeout(int) throws java.lang.IllegalArgumentException; + } + + public abstract class SSLSocket extends java.net.Socket { + ctor protected SSLSocket(); + ctor protected SSLSocket(java.lang.String, int) throws java.io.IOException, java.net.UnknownHostException; + ctor protected SSLSocket(java.net.InetAddress, int) throws java.io.IOException; + ctor protected SSLSocket(java.lang.String, int, java.net.InetAddress, int) throws java.io.IOException, java.net.UnknownHostException; + ctor protected SSLSocket(java.net.InetAddress, int, java.net.InetAddress, int) throws java.io.IOException; + method public abstract void addHandshakeCompletedListener(javax.net.ssl.HandshakeCompletedListener); + method public abstract boolean getEnableSessionCreation(); + method public abstract java.lang.String[] getEnabledCipherSuites(); + method public abstract java.lang.String[] getEnabledProtocols(); + method public abstract boolean getNeedClientAuth(); + method public javax.net.ssl.SSLParameters getSSLParameters(); + method public abstract javax.net.ssl.SSLSession getSession(); + method public abstract java.lang.String[] getSupportedCipherSuites(); + method public abstract java.lang.String[] getSupportedProtocols(); + method public abstract boolean getUseClientMode(); + method public abstract boolean getWantClientAuth(); + method public abstract void removeHandshakeCompletedListener(javax.net.ssl.HandshakeCompletedListener); + method public abstract void setEnableSessionCreation(boolean); + method public abstract void setEnabledCipherSuites(java.lang.String[]); + method public abstract void setEnabledProtocols(java.lang.String[]); + method public abstract void setNeedClientAuth(boolean); + method public void setSSLParameters(javax.net.ssl.SSLParameters); + method public abstract void setUseClientMode(boolean); + method public abstract void setWantClientAuth(boolean); + method public abstract void startHandshake() throws java.io.IOException; + } + + public abstract class SSLSocketFactory extends javax.net.SocketFactory { + ctor public SSLSocketFactory(); + method public abstract java.net.Socket createSocket(java.net.Socket, java.lang.String, int, boolean) throws java.io.IOException; + method public static synchronized javax.net.SocketFactory getDefault(); + method public abstract java.lang.String[] getDefaultCipherSuites(); + method public abstract java.lang.String[] getSupportedCipherSuites(); + } + + public abstract interface TrustManager { + } + + public class TrustManagerFactory { + ctor protected TrustManagerFactory(javax.net.ssl.TrustManagerFactorySpi, java.security.Provider, java.lang.String); + method public final java.lang.String getAlgorithm(); + method public static final java.lang.String getDefaultAlgorithm(); + method public static final javax.net.ssl.TrustManagerFactory getInstance(java.lang.String) throws java.security.NoSuchAlgorithmException; + method public static final javax.net.ssl.TrustManagerFactory getInstance(java.lang.String, java.lang.String) throws java.security.NoSuchAlgorithmException, java.security.NoSuchProviderException; + method public static final javax.net.ssl.TrustManagerFactory getInstance(java.lang.String, java.security.Provider) throws java.security.NoSuchAlgorithmException; + method public final java.security.Provider getProvider(); + method public final javax.net.ssl.TrustManager[] getTrustManagers(); + method public final void init(java.security.KeyStore) throws java.security.KeyStoreException; + method public final void init(javax.net.ssl.ManagerFactoryParameters) throws java.security.InvalidAlgorithmParameterException; + } + + public abstract class TrustManagerFactorySpi { + ctor public TrustManagerFactorySpi(); + method protected abstract javax.net.ssl.TrustManager[] engineGetTrustManagers(); + method protected abstract void engineInit(java.security.KeyStore) throws java.security.KeyStoreException; + method protected abstract void engineInit(javax.net.ssl.ManagerFactoryParameters) throws java.security.InvalidAlgorithmParameterException; + } + + public abstract class X509ExtendedKeyManager implements javax.net.ssl.X509KeyManager { + ctor protected X509ExtendedKeyManager(); + method public java.lang.String chooseEngineClientAlias(java.lang.String[], java.security.Principal[], javax.net.ssl.SSLEngine); + method public java.lang.String chooseEngineServerAlias(java.lang.String, java.security.Principal[], javax.net.ssl.SSLEngine); + } + + public abstract interface X509KeyManager implements javax.net.ssl.KeyManager { + method public abstract java.lang.String chooseClientAlias(java.lang.String[], java.security.Principal[], java.net.Socket); + method public abstract java.lang.String chooseServerAlias(java.lang.String, java.security.Principal[], java.net.Socket); + method public abstract java.security.cert.X509Certificate[] getCertificateChain(java.lang.String); + method public abstract java.lang.String[] getClientAliases(java.lang.String, java.security.Principal[]); + method public abstract java.security.PrivateKey getPrivateKey(java.lang.String); + method public abstract java.lang.String[] getServerAliases(java.lang.String, java.security.Principal[]); + } + + public abstract interface X509TrustManager implements javax.net.ssl.TrustManager { + method public abstract void checkClientTrusted(java.security.cert.X509Certificate[], java.lang.String) throws java.security.cert.CertificateException; + method public abstract void checkServerTrusted(java.security.cert.X509Certificate[], java.lang.String) throws java.security.cert.CertificateException; + method public abstract java.security.cert.X509Certificate[] getAcceptedIssuers(); + } + +} + +package javax.security.auth { + + public final class AuthPermission extends java.security.BasicPermission { + ctor public AuthPermission(java.lang.String); + ctor public AuthPermission(java.lang.String, java.lang.String); + } + + public class DestroyFailedException extends java.lang.Exception { + ctor public DestroyFailedException(); + ctor public DestroyFailedException(java.lang.String); + } + + public abstract interface Destroyable { + method public abstract void destroy() throws javax.security.auth.DestroyFailedException; + method public abstract boolean isDestroyed(); + } + + public final class PrivateCredentialPermission extends java.security.Permission { + ctor public PrivateCredentialPermission(java.lang.String, java.lang.String); + method public java.lang.String getActions(); + method public java.lang.String getCredentialClass(); + method public java.lang.String[][] getPrincipals(); + method public boolean implies(java.security.Permission); + } + + public final class Subject implements java.io.Serializable { + ctor public Subject(); + ctor public Subject(boolean, java.util.Set, java.util.Set, java.util.Set); + method public static T doAs(javax.security.auth.Subject, java.security.PrivilegedAction); + method public static T doAs(javax.security.auth.Subject, java.security.PrivilegedExceptionAction) throws java.security.PrivilegedActionException; + method public static T doAsPrivileged(javax.security.auth.Subject, java.security.PrivilegedAction, java.security.AccessControlContext); + method public static T doAsPrivileged(javax.security.auth.Subject, java.security.PrivilegedExceptionAction, java.security.AccessControlContext) throws java.security.PrivilegedActionException; + method public java.util.Set getPrincipals(); + method public java.util.Set getPrincipals(java.lang.Class); + method public java.util.Set getPrivateCredentials(); + method public java.util.Set getPrivateCredentials(java.lang.Class); + method public java.util.Set getPublicCredentials(); + method public java.util.Set getPublicCredentials(java.lang.Class); + method public static javax.security.auth.Subject getSubject(java.security.AccessControlContext); + method public boolean isReadOnly(); + method public void setReadOnly(); + } + + public class SubjectDomainCombiner implements java.security.DomainCombiner { + ctor public SubjectDomainCombiner(javax.security.auth.Subject); + method public java.security.ProtectionDomain[] combine(java.security.ProtectionDomain[], java.security.ProtectionDomain[]); + method public javax.security.auth.Subject getSubject(); + } + +} + +package javax.security.auth.callback { + + public abstract interface Callback { + } + + public abstract interface CallbackHandler { + method public abstract void handle(javax.security.auth.callback.Callback[]) throws java.io.IOException, javax.security.auth.callback.UnsupportedCallbackException; + } + + public class PasswordCallback implements javax.security.auth.callback.Callback java.io.Serializable { + ctor public PasswordCallback(java.lang.String, boolean); + method public void clearPassword(); + method public char[] getPassword(); + method public java.lang.String getPrompt(); + method public boolean isEchoOn(); + method public void setPassword(char[]); + } + + public class UnsupportedCallbackException extends java.lang.Exception { + ctor public UnsupportedCallbackException(javax.security.auth.callback.Callback); + ctor public UnsupportedCallbackException(javax.security.auth.callback.Callback, java.lang.String); + method public javax.security.auth.callback.Callback getCallback(); + } + +} + +package javax.security.auth.login { + + public class LoginException extends java.security.GeneralSecurityException { + ctor public LoginException(); + ctor public LoginException(java.lang.String); + } + +} + +package javax.security.auth.x500 { + + public final class X500Principal implements java.security.Principal java.io.Serializable { + ctor public X500Principal(byte[]); + ctor public X500Principal(java.io.InputStream); + ctor public X500Principal(java.lang.String); + ctor public X500Principal(java.lang.String, java.util.Map); + method public byte[] getEncoded(); + method public java.lang.String getName(); + method public java.lang.String getName(java.lang.String); + method public java.lang.String getName(java.lang.String, java.util.Map); + field public static final java.lang.String CANONICAL = "CANONICAL"; + field public static final java.lang.String RFC1779 = "RFC1779"; + field public static final java.lang.String RFC2253 = "RFC2253"; + } + +} + +package javax.security.cert { + + public abstract class Certificate { + ctor public Certificate(); + method public abstract byte[] getEncoded() throws javax.security.cert.CertificateEncodingException; + method public abstract java.security.PublicKey getPublicKey(); + method public abstract java.lang.String toString(); + method public abstract void verify(java.security.PublicKey) throws javax.security.cert.CertificateException, java.security.InvalidKeyException, java.security.NoSuchAlgorithmException, java.security.NoSuchProviderException, java.security.SignatureException; + method public abstract void verify(java.security.PublicKey, java.lang.String) throws javax.security.cert.CertificateException, java.security.InvalidKeyException, java.security.NoSuchAlgorithmException, java.security.NoSuchProviderException, java.security.SignatureException; + } + + public class CertificateEncodingException extends javax.security.cert.CertificateException { + ctor public CertificateEncodingException(java.lang.String); + ctor public CertificateEncodingException(); + } + + public class CertificateException extends java.lang.Exception { + ctor public CertificateException(java.lang.String); + ctor public CertificateException(); + } + + public class CertificateExpiredException extends javax.security.cert.CertificateException { + ctor public CertificateExpiredException(java.lang.String); + ctor public CertificateExpiredException(); + } + + public class CertificateNotYetValidException extends javax.security.cert.CertificateException { + ctor public CertificateNotYetValidException(java.lang.String); + ctor public CertificateNotYetValidException(); + } + + public class CertificateParsingException extends javax.security.cert.CertificateException { + ctor public CertificateParsingException(java.lang.String); + ctor public CertificateParsingException(); + } + + public abstract class X509Certificate extends javax.security.cert.Certificate { + ctor public X509Certificate(); + method public abstract void checkValidity() throws javax.security.cert.CertificateExpiredException, javax.security.cert.CertificateNotYetValidException; + method public abstract void checkValidity(java.util.Date) throws javax.security.cert.CertificateExpiredException, javax.security.cert.CertificateNotYetValidException; + method public static final javax.security.cert.X509Certificate getInstance(java.io.InputStream) throws javax.security.cert.CertificateException; + method public static final javax.security.cert.X509Certificate getInstance(byte[]) throws javax.security.cert.CertificateException; + method public abstract java.security.Principal getIssuerDN(); + method public abstract java.util.Date getNotAfter(); + method public abstract java.util.Date getNotBefore(); + method public abstract java.math.BigInteger getSerialNumber(); + method public abstract java.lang.String getSigAlgName(); + method public abstract java.lang.String getSigAlgOID(); + method public abstract byte[] getSigAlgParams(); + method public abstract java.security.Principal getSubjectDN(); + method public abstract int getVersion(); + } + +} + +package javax.sql { + + public abstract interface CommonDataSource { + method public abstract java.io.PrintWriter getLogWriter() throws java.sql.SQLException; + method public abstract int getLoginTimeout() throws java.sql.SQLException; + method public abstract void setLogWriter(java.io.PrintWriter) throws java.sql.SQLException; + method public abstract void setLoginTimeout(int) throws java.sql.SQLException; + } + + public class ConnectionEvent extends java.util.EventObject implements java.io.Serializable { + ctor public ConnectionEvent(javax.sql.PooledConnection); + ctor public ConnectionEvent(javax.sql.PooledConnection, java.sql.SQLException); + method public java.sql.SQLException getSQLException(); + } + + public abstract interface ConnectionEventListener implements java.util.EventListener { + method public abstract void connectionClosed(javax.sql.ConnectionEvent); + method public abstract void connectionErrorOccurred(javax.sql.ConnectionEvent); + } + + public abstract interface ConnectionPoolDataSource implements javax.sql.CommonDataSource { + method public abstract javax.sql.PooledConnection getPooledConnection() throws java.sql.SQLException; + method public abstract javax.sql.PooledConnection getPooledConnection(java.lang.String, java.lang.String) throws java.sql.SQLException; + } + + public abstract interface DataSource implements javax.sql.CommonDataSource java.sql.Wrapper { + method public abstract java.sql.Connection getConnection() throws java.sql.SQLException; + method public abstract java.sql.Connection getConnection(java.lang.String, java.lang.String) throws java.sql.SQLException; + } + + public abstract interface PooledConnection { + method public abstract void addConnectionEventListener(javax.sql.ConnectionEventListener); + method public abstract void addStatementEventListener(javax.sql.StatementEventListener); + method public abstract void close() throws java.sql.SQLException; + method public abstract java.sql.Connection getConnection() throws java.sql.SQLException; + method public abstract void removeConnectionEventListener(javax.sql.ConnectionEventListener); + method public abstract void removeStatementEventListener(javax.sql.StatementEventListener); + } + + public abstract interface RowSet implements java.sql.ResultSet { + method public abstract void addRowSetListener(javax.sql.RowSetListener); + method public abstract void clearParameters() throws java.sql.SQLException; + method public abstract void execute() throws java.sql.SQLException; + method public abstract java.lang.String getCommand(); + method public abstract java.lang.String getDataSourceName(); + method public abstract boolean getEscapeProcessing() throws java.sql.SQLException; + method public abstract int getMaxFieldSize() throws java.sql.SQLException; + method public abstract int getMaxRows() throws java.sql.SQLException; + method public abstract java.lang.String getPassword(); + method public abstract int getQueryTimeout() throws java.sql.SQLException; + method public abstract int getTransactionIsolation(); + method public abstract java.util.Map> getTypeMap() throws java.sql.SQLException; + method public abstract java.lang.String getUrl() throws java.sql.SQLException; + method public abstract java.lang.String getUsername(); + method public abstract boolean isReadOnly(); + method public abstract void removeRowSetListener(javax.sql.RowSetListener); + method public abstract void setArray(int, java.sql.Array) throws java.sql.SQLException; + method public abstract void setAsciiStream(int, java.io.InputStream, int) throws java.sql.SQLException; + method public abstract void setAsciiStream(int, java.io.InputStream) throws java.sql.SQLException; + method public abstract void setAsciiStream(java.lang.String, java.io.InputStream) throws java.sql.SQLException; + method public abstract void setAsciiStream(java.lang.String, java.io.InputStream, int) throws java.sql.SQLException; + method public abstract void setBigDecimal(int, java.math.BigDecimal) throws java.sql.SQLException; + method public abstract void setBigDecimal(java.lang.String, java.math.BigDecimal) throws java.sql.SQLException; + method public abstract void setBinaryStream(int, java.io.InputStream, int) throws java.sql.SQLException; + method public abstract void setBinaryStream(int, java.io.InputStream) throws java.sql.SQLException; + method public abstract void setBinaryStream(java.lang.String, java.io.InputStream) throws java.sql.SQLException; + method public abstract void setBinaryStream(java.lang.String, java.io.InputStream, int) throws java.sql.SQLException; + method public abstract void setBlob(int, java.sql.Blob) throws java.sql.SQLException; + method public abstract void setBlob(int, java.io.InputStream) throws java.sql.SQLException; + method public abstract void setBlob(int, java.io.InputStream, long) throws java.sql.SQLException; + method public abstract void setBlob(java.lang.String, java.io.InputStream) throws java.sql.SQLException; + method public abstract void setBlob(java.lang.String, java.io.InputStream, long) throws java.sql.SQLException; + method public abstract void setBlob(java.lang.String, java.sql.Blob) throws java.sql.SQLException; + method public abstract void setBoolean(int, boolean) throws java.sql.SQLException; + method public abstract void setBoolean(java.lang.String, boolean) throws java.sql.SQLException; + method public abstract void setByte(int, byte) throws java.sql.SQLException; + method public abstract void setByte(java.lang.String, byte) throws java.sql.SQLException; + method public abstract void setBytes(int, byte[]) throws java.sql.SQLException; + method public abstract void setBytes(java.lang.String, byte[]) throws java.sql.SQLException; + method public abstract void setCharacterStream(int, java.io.Reader, int) throws java.sql.SQLException; + method public abstract void setCharacterStream(int, java.io.Reader) throws java.sql.SQLException; + method public abstract void setCharacterStream(java.lang.String, java.io.Reader) throws java.sql.SQLException; + method public abstract void setCharacterStream(java.lang.String, java.io.Reader, int) throws java.sql.SQLException; + method public abstract void setClob(int, java.sql.Clob) throws java.sql.SQLException; + method public abstract void setClob(int, java.io.Reader) throws java.sql.SQLException; + method public abstract void setClob(int, java.io.Reader, long) throws java.sql.SQLException; + method public abstract void setClob(java.lang.String, java.sql.Clob) throws java.sql.SQLException; + method public abstract void setClob(java.lang.String, java.io.Reader) throws java.sql.SQLException; + method public abstract void setClob(java.lang.String, java.io.Reader, long) throws java.sql.SQLException; + method public abstract void setCommand(java.lang.String) throws java.sql.SQLException; + method public abstract void setConcurrency(int) throws java.sql.SQLException; + method public abstract void setDataSourceName(java.lang.String) throws java.sql.SQLException; + method public abstract void setDate(int, java.sql.Date) throws java.sql.SQLException; + method public abstract void setDate(int, java.sql.Date, java.util.Calendar) throws java.sql.SQLException; + method public abstract void setDate(java.lang.String, java.sql.Date) throws java.sql.SQLException; + method public abstract void setDate(java.lang.String, java.sql.Date, java.util.Calendar) throws java.sql.SQLException; + method public abstract void setDouble(int, double) throws java.sql.SQLException; + method public abstract void setDouble(java.lang.String, double) throws java.sql.SQLException; + method public abstract void setEscapeProcessing(boolean) throws java.sql.SQLException; + method public abstract void setFloat(int, float) throws java.sql.SQLException; + method public abstract void setFloat(java.lang.String, float) throws java.sql.SQLException; + method public abstract void setInt(int, int) throws java.sql.SQLException; + method public abstract void setInt(java.lang.String, int) throws java.sql.SQLException; + method public abstract void setLong(int, long) throws java.sql.SQLException; + method public abstract void setLong(java.lang.String, long) throws java.sql.SQLException; + method public abstract void setMaxFieldSize(int) throws java.sql.SQLException; + method public abstract void setMaxRows(int) throws java.sql.SQLException; + method public abstract void setNCharacterStream(int, java.io.Reader) throws java.sql.SQLException; + method public abstract void setNCharacterStream(int, java.io.Reader, long) throws java.sql.SQLException; + method public abstract void setNCharacterStream(java.lang.String, java.io.Reader) throws java.sql.SQLException; + method public abstract void setNCharacterStream(java.lang.String, java.io.Reader, long) throws java.sql.SQLException; + method public abstract void setNClob(int, java.sql.NClob) throws java.sql.SQLException; + method public abstract void setNClob(int, java.io.Reader) throws java.sql.SQLException; + method public abstract void setNClob(int, java.io.Reader, long) throws java.sql.SQLException; + method public abstract void setNClob(java.lang.String, java.sql.NClob) throws java.sql.SQLException; + method public abstract void setNClob(java.lang.String, java.io.Reader) throws java.sql.SQLException; + method public abstract void setNClob(java.lang.String, java.io.Reader, long) throws java.sql.SQLException; + method public abstract void setNString(int, java.lang.String) throws java.sql.SQLException; + method public abstract void setNString(java.lang.String, java.lang.String) throws java.sql.SQLException; + method public abstract void setNull(int, int) throws java.sql.SQLException; + method public abstract void setNull(int, int, java.lang.String) throws java.sql.SQLException; + method public abstract void setNull(java.lang.String, int) throws java.sql.SQLException; + method public abstract void setNull(java.lang.String, int, java.lang.String) throws java.sql.SQLException; + method public abstract void setObject(int, java.lang.Object) throws java.sql.SQLException; + method public abstract void setObject(int, java.lang.Object, int) throws java.sql.SQLException; + method public abstract void setObject(int, java.lang.Object, int, int) throws java.sql.SQLException; + method public abstract void setObject(java.lang.String, java.lang.Object) throws java.sql.SQLException; + method public abstract void setObject(java.lang.String, java.lang.Object, int) throws java.sql.SQLException; + method public abstract void setObject(java.lang.String, java.lang.Object, int, int) throws java.sql.SQLException; + method public abstract void setPassword(java.lang.String) throws java.sql.SQLException; + method public abstract void setQueryTimeout(int) throws java.sql.SQLException; + method public abstract void setReadOnly(boolean) throws java.sql.SQLException; + method public abstract void setRef(int, java.sql.Ref) throws java.sql.SQLException; + method public abstract void setRowId(int, java.sql.RowId) throws java.sql.SQLException; + method public abstract void setRowId(java.lang.String, java.sql.RowId) throws java.sql.SQLException; + method public abstract void setSQLXML(int, java.sql.SQLXML) throws java.sql.SQLException; + method public abstract void setSQLXML(java.lang.String, java.sql.SQLXML) throws java.sql.SQLException; + method public abstract void setShort(int, short) throws java.sql.SQLException; + method public abstract void setShort(java.lang.String, short) throws java.sql.SQLException; + method public abstract void setString(int, java.lang.String) throws java.sql.SQLException; + method public abstract void setString(java.lang.String, java.lang.String) throws java.sql.SQLException; + method public abstract void setTime(int, java.sql.Time) throws java.sql.SQLException; + method public abstract void setTime(int, java.sql.Time, java.util.Calendar) throws java.sql.SQLException; + method public abstract void setTime(java.lang.String, java.sql.Time) throws java.sql.SQLException; + method public abstract void setTime(java.lang.String, java.sql.Time, java.util.Calendar) throws java.sql.SQLException; + method public abstract void setTimestamp(int, java.sql.Timestamp) throws java.sql.SQLException; + method public abstract void setTimestamp(int, java.sql.Timestamp, java.util.Calendar) throws java.sql.SQLException; + method public abstract void setTimestamp(java.lang.String, java.sql.Timestamp) throws java.sql.SQLException; + method public abstract void setTimestamp(java.lang.String, java.sql.Timestamp, java.util.Calendar) throws java.sql.SQLException; + method public abstract void setTransactionIsolation(int) throws java.sql.SQLException; + method public abstract void setType(int) throws java.sql.SQLException; + method public abstract void setTypeMap(java.util.Map>) throws java.sql.SQLException; + method public abstract void setURL(int, java.net.URL) throws java.sql.SQLException; + method public abstract void setUrl(java.lang.String) throws java.sql.SQLException; + method public abstract void setUsername(java.lang.String) throws java.sql.SQLException; + } + + public class RowSetEvent extends java.util.EventObject implements java.io.Serializable { + ctor public RowSetEvent(javax.sql.RowSet); + } + + public abstract interface RowSetInternal { + method public abstract java.sql.Connection getConnection() throws java.sql.SQLException; + method public abstract java.sql.ResultSet getOriginal() throws java.sql.SQLException; + method public abstract java.sql.ResultSet getOriginalRow() throws java.sql.SQLException; + method public abstract java.lang.Object[] getParams() throws java.sql.SQLException; + method public abstract void setMetaData(javax.sql.RowSetMetaData) throws java.sql.SQLException; + } + + public abstract interface RowSetListener implements java.util.EventListener { + method public abstract void cursorMoved(javax.sql.RowSetEvent); + method public abstract void rowChanged(javax.sql.RowSetEvent); + method public abstract void rowSetChanged(javax.sql.RowSetEvent); + } + + public abstract interface RowSetMetaData implements java.sql.ResultSetMetaData { + method public abstract void setAutoIncrement(int, boolean) throws java.sql.SQLException; + method public abstract void setCaseSensitive(int, boolean) throws java.sql.SQLException; + method public abstract void setCatalogName(int, java.lang.String) throws java.sql.SQLException; + method public abstract void setColumnCount(int) throws java.sql.SQLException; + method public abstract void setColumnDisplaySize(int, int) throws java.sql.SQLException; + method public abstract void setColumnLabel(int, java.lang.String) throws java.sql.SQLException; + method public abstract void setColumnName(int, java.lang.String) throws java.sql.SQLException; + method public abstract void setColumnType(int, int) throws java.sql.SQLException; + method public abstract void setColumnTypeName(int, java.lang.String) throws java.sql.SQLException; + method public abstract void setCurrency(int, boolean) throws java.sql.SQLException; + method public abstract void setNullable(int, int) throws java.sql.SQLException; + method public abstract void setPrecision(int, int) throws java.sql.SQLException; + method public abstract void setScale(int, int) throws java.sql.SQLException; + method public abstract void setSchemaName(int, java.lang.String) throws java.sql.SQLException; + method public abstract void setSearchable(int, boolean) throws java.sql.SQLException; + method public abstract void setSigned(int, boolean) throws java.sql.SQLException; + method public abstract void setTableName(int, java.lang.String) throws java.sql.SQLException; + } + + public abstract interface RowSetReader { + method public abstract void readData(javax.sql.RowSetInternal) throws java.sql.SQLException; + } + + public abstract interface RowSetWriter { + method public abstract boolean writeData(javax.sql.RowSetInternal) throws java.sql.SQLException; + } + + public class StatementEvent extends java.util.EventObject { + ctor public StatementEvent(javax.sql.PooledConnection, java.sql.PreparedStatement, java.sql.SQLException); + ctor public StatementEvent(javax.sql.PooledConnection, java.sql.PreparedStatement); + method public java.sql.SQLException getSQLException(); + method public java.sql.PreparedStatement getStatement(); + } + + public abstract interface StatementEventListener implements java.util.EventListener { + method public abstract void statementClosed(javax.sql.StatementEvent); + method public abstract void statementErrorOccurred(javax.sql.StatementEvent); + } + +} + +package javax.xml { + + public final class XMLConstants { + field public static final java.lang.String DEFAULT_NS_PREFIX = ""; + field public static final java.lang.String FEATURE_SECURE_PROCESSING = "http://javax.xml.XMLConstants/feature/secure-processing"; + field public static final java.lang.String NULL_NS_URI = ""; + field public static final java.lang.String RELAXNG_NS_URI = "http://relaxng.org/ns/structure/1.0"; + field public static final java.lang.String W3C_XML_SCHEMA_INSTANCE_NS_URI = "http://www.w3.org/2001/XMLSchema-instance"; + field public static final java.lang.String W3C_XML_SCHEMA_NS_URI = "http://www.w3.org/2001/XMLSchema"; + field public static final java.lang.String W3C_XPATH_DATATYPE_NS_URI = "http://www.w3.org/2003/11/xpath-datatypes"; + field public static final java.lang.String XMLNS_ATTRIBUTE = "xmlns"; + field public static final java.lang.String XMLNS_ATTRIBUTE_NS_URI = "http://www.w3.org/2000/xmlns/"; + field public static final java.lang.String XML_DTD_NS_URI = "http://www.w3.org/TR/REC-xml"; + field public static final java.lang.String XML_NS_PREFIX = "xml"; + field public static final java.lang.String XML_NS_URI = "http://www.w3.org/XML/1998/namespace"; + } + +} + +package javax.xml.datatype { + + public class DatatypeConfigurationException extends java.lang.Exception { + ctor public DatatypeConfigurationException(); + ctor public DatatypeConfigurationException(java.lang.String); + ctor public DatatypeConfigurationException(java.lang.String, java.lang.Throwable); + ctor public DatatypeConfigurationException(java.lang.Throwable); + } + + public final class DatatypeConstants { + field public static final int APRIL = 4; // 0x4 + field public static final int AUGUST = 8; // 0x8 + field public static final javax.xml.namespace.QName DATE; + field public static final javax.xml.namespace.QName DATETIME; + field public static final javax.xml.datatype.DatatypeConstants.Field DAYS; + field public static final int DECEMBER = 12; // 0xc + field public static final javax.xml.namespace.QName DURATION; + field public static final javax.xml.namespace.QName DURATION_DAYTIME; + field public static final javax.xml.namespace.QName DURATION_YEARMONTH; + field public static final int EQUAL = 0; // 0x0 + field public static final int FEBRUARY = 2; // 0x2 + field public static final int FIELD_UNDEFINED = -2147483648; // 0x80000000 + field public static final javax.xml.namespace.QName GDAY; + field public static final javax.xml.namespace.QName GMONTH; + field public static final javax.xml.namespace.QName GMONTHDAY; + field public static final int GREATER = 1; // 0x1 + field public static final javax.xml.namespace.QName GYEAR; + field public static final javax.xml.namespace.QName GYEARMONTH; + field public static final javax.xml.datatype.DatatypeConstants.Field HOURS; + field public static final int INDETERMINATE = 2; // 0x2 + field public static final int JANUARY = 1; // 0x1 + field public static final int JULY = 7; // 0x7 + field public static final int JUNE = 6; // 0x6 + field public static final int LESSER = -1; // 0xffffffff + field public static final int MARCH = 3; // 0x3 + field public static final int MAX_TIMEZONE_OFFSET = -840; // 0xfffffcb8 + field public static final int MAY = 5; // 0x5 + field public static final javax.xml.datatype.DatatypeConstants.Field MINUTES; + field public static final int MIN_TIMEZONE_OFFSET = 840; // 0x348 + field public static final javax.xml.datatype.DatatypeConstants.Field MONTHS; + field public static final int NOVEMBER = 11; // 0xb + field public static final int OCTOBER = 10; // 0xa + field public static final javax.xml.datatype.DatatypeConstants.Field SECONDS; + field public static final int SEPTEMBER = 9; // 0x9 + field public static final javax.xml.namespace.QName TIME; + field public static final javax.xml.datatype.DatatypeConstants.Field YEARS; + } + + public static final class DatatypeConstants.Field { + method public int getId(); + } + + public abstract class DatatypeFactory { + ctor protected DatatypeFactory(); + method public abstract javax.xml.datatype.Duration newDuration(java.lang.String); + method public abstract javax.xml.datatype.Duration newDuration(long); + method public abstract javax.xml.datatype.Duration newDuration(boolean, java.math.BigInteger, java.math.BigInteger, java.math.BigInteger, java.math.BigInteger, java.math.BigInteger, java.math.BigDecimal); + method public javax.xml.datatype.Duration newDuration(boolean, int, int, int, int, int, int); + method public javax.xml.datatype.Duration newDurationDayTime(java.lang.String); + method public javax.xml.datatype.Duration newDurationDayTime(long); + method public javax.xml.datatype.Duration newDurationDayTime(boolean, java.math.BigInteger, java.math.BigInteger, java.math.BigInteger, java.math.BigInteger); + method public javax.xml.datatype.Duration newDurationDayTime(boolean, int, int, int, int); + method public javax.xml.datatype.Duration newDurationYearMonth(java.lang.String); + method public javax.xml.datatype.Duration newDurationYearMonth(long); + method public javax.xml.datatype.Duration newDurationYearMonth(boolean, java.math.BigInteger, java.math.BigInteger); + method public javax.xml.datatype.Duration newDurationYearMonth(boolean, int, int); + method public static javax.xml.datatype.DatatypeFactory newInstance() throws javax.xml.datatype.DatatypeConfigurationException; + method public static javax.xml.datatype.DatatypeFactory newInstance(java.lang.String, java.lang.ClassLoader) throws javax.xml.datatype.DatatypeConfigurationException; + method public abstract javax.xml.datatype.XMLGregorianCalendar newXMLGregorianCalendar(); + method public abstract javax.xml.datatype.XMLGregorianCalendar newXMLGregorianCalendar(java.lang.String); + method public abstract javax.xml.datatype.XMLGregorianCalendar newXMLGregorianCalendar(java.util.GregorianCalendar); + method public abstract javax.xml.datatype.XMLGregorianCalendar newXMLGregorianCalendar(java.math.BigInteger, int, int, int, int, int, java.math.BigDecimal, int); + method public javax.xml.datatype.XMLGregorianCalendar newXMLGregorianCalendar(int, int, int, int, int, int, int, int); + method public javax.xml.datatype.XMLGregorianCalendar newXMLGregorianCalendarDate(int, int, int, int); + method public javax.xml.datatype.XMLGregorianCalendar newXMLGregorianCalendarTime(int, int, int, int); + method public javax.xml.datatype.XMLGregorianCalendar newXMLGregorianCalendarTime(int, int, int, java.math.BigDecimal, int); + method public javax.xml.datatype.XMLGregorianCalendar newXMLGregorianCalendarTime(int, int, int, int, int); + field public static final java.lang.String DATATYPEFACTORY_IMPLEMENTATION_CLASS; + field public static final java.lang.String DATATYPEFACTORY_PROPERTY = "javax.xml.datatype.DatatypeFactory"; + } + + public abstract class Duration { + ctor public Duration(); + method public abstract javax.xml.datatype.Duration add(javax.xml.datatype.Duration); + method public abstract void addTo(java.util.Calendar); + method public void addTo(java.util.Date); + method public abstract int compare(javax.xml.datatype.Duration); + method public int getDays(); + method public abstract java.lang.Number getField(javax.xml.datatype.DatatypeConstants.Field); + method public int getHours(); + method public int getMinutes(); + method public int getMonths(); + method public int getSeconds(); + method public abstract int getSign(); + method public long getTimeInMillis(java.util.Calendar); + method public long getTimeInMillis(java.util.Date); + method public javax.xml.namespace.QName getXMLSchemaType(); + method public int getYears(); + method public abstract int hashCode(); + method public boolean isLongerThan(javax.xml.datatype.Duration); + method public abstract boolean isSet(javax.xml.datatype.DatatypeConstants.Field); + method public boolean isShorterThan(javax.xml.datatype.Duration); + method public javax.xml.datatype.Duration multiply(int); + method public abstract javax.xml.datatype.Duration multiply(java.math.BigDecimal); + method public abstract javax.xml.datatype.Duration negate(); + method public abstract javax.xml.datatype.Duration normalizeWith(java.util.Calendar); + method public javax.xml.datatype.Duration subtract(javax.xml.datatype.Duration); + } + + public abstract class XMLGregorianCalendar implements java.lang.Cloneable { + ctor public XMLGregorianCalendar(); + method public abstract void add(javax.xml.datatype.Duration); + method public abstract void clear(); + method public abstract java.lang.Object clone(); + method public abstract int compare(javax.xml.datatype.XMLGregorianCalendar); + method public abstract int getDay(); + method public abstract java.math.BigInteger getEon(); + method public abstract java.math.BigInteger getEonAndYear(); + method public abstract java.math.BigDecimal getFractionalSecond(); + method public abstract int getHour(); + method public int getMillisecond(); + method public abstract int getMinute(); + method public abstract int getMonth(); + method public abstract int getSecond(); + method public abstract java.util.TimeZone getTimeZone(int); + method public abstract int getTimezone(); + method public abstract javax.xml.namespace.QName getXMLSchemaType(); + method public abstract int getYear(); + method public abstract boolean isValid(); + method public abstract javax.xml.datatype.XMLGregorianCalendar normalize(); + method public abstract void reset(); + method public abstract void setDay(int); + method public abstract void setFractionalSecond(java.math.BigDecimal); + method public abstract void setHour(int); + method public abstract void setMillisecond(int); + method public abstract void setMinute(int); + method public abstract void setMonth(int); + method public abstract void setSecond(int); + method public void setTime(int, int, int); + method public void setTime(int, int, int, java.math.BigDecimal); + method public void setTime(int, int, int, int); + method public abstract void setTimezone(int); + method public abstract void setYear(java.math.BigInteger); + method public abstract void setYear(int); + method public abstract java.util.GregorianCalendar toGregorianCalendar(); + method public abstract java.util.GregorianCalendar toGregorianCalendar(java.util.TimeZone, java.util.Locale, javax.xml.datatype.XMLGregorianCalendar); + method public abstract java.lang.String toXMLFormat(); + } + +} + +package javax.xml.namespace { + + public abstract interface NamespaceContext { + method public abstract java.lang.String getNamespaceURI(java.lang.String); + method public abstract java.lang.String getPrefix(java.lang.String); + method public abstract java.util.Iterator getPrefixes(java.lang.String); + } + + public class QName implements java.io.Serializable { + ctor public QName(java.lang.String, java.lang.String); + ctor public QName(java.lang.String, java.lang.String, java.lang.String); + ctor public QName(java.lang.String); + method public final boolean equals(java.lang.Object); + method public java.lang.String getLocalPart(); + method public java.lang.String getNamespaceURI(); + method public java.lang.String getPrefix(); + method public final int hashCode(); + method public static javax.xml.namespace.QName valueOf(java.lang.String); + } + +} + +package javax.xml.parsers { + + public abstract class DocumentBuilder { + ctor protected DocumentBuilder(); + method public abstract org.w3c.dom.DOMImplementation getDOMImplementation(); + method public javax.xml.validation.Schema getSchema(); + method public abstract boolean isNamespaceAware(); + method public abstract boolean isValidating(); + method public boolean isXIncludeAware(); + method public abstract org.w3c.dom.Document newDocument(); + method public org.w3c.dom.Document parse(java.io.InputStream) throws java.io.IOException, org.xml.sax.SAXException; + method public org.w3c.dom.Document parse(java.io.InputStream, java.lang.String) throws java.io.IOException, org.xml.sax.SAXException; + method public org.w3c.dom.Document parse(java.lang.String) throws java.io.IOException, org.xml.sax.SAXException; + method public org.w3c.dom.Document parse(java.io.File) throws java.io.IOException, org.xml.sax.SAXException; + method public abstract org.w3c.dom.Document parse(org.xml.sax.InputSource) throws java.io.IOException, org.xml.sax.SAXException; + method public void reset(); + method public abstract void setEntityResolver(org.xml.sax.EntityResolver); + method public abstract void setErrorHandler(org.xml.sax.ErrorHandler); + } + + public abstract class DocumentBuilderFactory { + ctor protected DocumentBuilderFactory(); + method public abstract java.lang.Object getAttribute(java.lang.String) throws java.lang.IllegalArgumentException; + method public abstract boolean getFeature(java.lang.String) throws javax.xml.parsers.ParserConfigurationException; + method public javax.xml.validation.Schema getSchema(); + method public boolean isCoalescing(); + method public boolean isExpandEntityReferences(); + method public boolean isIgnoringComments(); + method public boolean isIgnoringElementContentWhitespace(); + method public boolean isNamespaceAware(); + method public boolean isValidating(); + method public boolean isXIncludeAware(); + method public abstract javax.xml.parsers.DocumentBuilder newDocumentBuilder() throws javax.xml.parsers.ParserConfigurationException; + method public static javax.xml.parsers.DocumentBuilderFactory newInstance(); + method public static javax.xml.parsers.DocumentBuilderFactory newInstance(java.lang.String, java.lang.ClassLoader); + method public abstract void setAttribute(java.lang.String, java.lang.Object) throws java.lang.IllegalArgumentException; + method public void setCoalescing(boolean); + method public void setExpandEntityReferences(boolean); + method public abstract void setFeature(java.lang.String, boolean) throws javax.xml.parsers.ParserConfigurationException; + method public void setIgnoringComments(boolean); + method public void setIgnoringElementContentWhitespace(boolean); + method public void setNamespaceAware(boolean); + method public void setSchema(javax.xml.validation.Schema); + method public void setValidating(boolean); + method public void setXIncludeAware(boolean); + } + + public class FactoryConfigurationError extends java.lang.Error { + ctor public FactoryConfigurationError(); + ctor public FactoryConfigurationError(java.lang.String); + ctor public FactoryConfigurationError(java.lang.Exception); + ctor public FactoryConfigurationError(java.lang.Exception, java.lang.String); + method public java.lang.Exception getException(); + } + + public class ParserConfigurationException extends java.lang.Exception { + ctor public ParserConfigurationException(); + ctor public ParserConfigurationException(java.lang.String); + } + + public abstract class SAXParser { + ctor protected SAXParser(); + method public abstract org.xml.sax.Parser getParser() throws org.xml.sax.SAXException; + method public abstract java.lang.Object getProperty(java.lang.String) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException; + method public javax.xml.validation.Schema getSchema(); + method public abstract org.xml.sax.XMLReader getXMLReader() throws org.xml.sax.SAXException; + method public abstract boolean isNamespaceAware(); + method public abstract boolean isValidating(); + method public boolean isXIncludeAware(); + method public void parse(java.io.InputStream, org.xml.sax.HandlerBase) throws java.io.IOException, org.xml.sax.SAXException; + method public void parse(java.io.InputStream, org.xml.sax.HandlerBase, java.lang.String) throws java.io.IOException, org.xml.sax.SAXException; + method public void parse(java.io.InputStream, org.xml.sax.helpers.DefaultHandler) throws java.io.IOException, org.xml.sax.SAXException; + method public void parse(java.io.InputStream, org.xml.sax.helpers.DefaultHandler, java.lang.String) throws java.io.IOException, org.xml.sax.SAXException; + method public void parse(java.lang.String, org.xml.sax.HandlerBase) throws java.io.IOException, org.xml.sax.SAXException; + method public void parse(java.lang.String, org.xml.sax.helpers.DefaultHandler) throws java.io.IOException, org.xml.sax.SAXException; + method public void parse(java.io.File, org.xml.sax.HandlerBase) throws java.io.IOException, org.xml.sax.SAXException; + method public void parse(java.io.File, org.xml.sax.helpers.DefaultHandler) throws java.io.IOException, org.xml.sax.SAXException; + method public void parse(org.xml.sax.InputSource, org.xml.sax.HandlerBase) throws java.io.IOException, org.xml.sax.SAXException; + method public void parse(org.xml.sax.InputSource, org.xml.sax.helpers.DefaultHandler) throws java.io.IOException, org.xml.sax.SAXException; + method public void reset(); + method public abstract void setProperty(java.lang.String, java.lang.Object) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException; + } + + public abstract class SAXParserFactory { + ctor protected SAXParserFactory(); + method public abstract boolean getFeature(java.lang.String) throws javax.xml.parsers.ParserConfigurationException, org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException; + method public javax.xml.validation.Schema getSchema(); + method public boolean isNamespaceAware(); + method public boolean isValidating(); + method public boolean isXIncludeAware(); + method public static javax.xml.parsers.SAXParserFactory newInstance(); + method public static javax.xml.parsers.SAXParserFactory newInstance(java.lang.String, java.lang.ClassLoader); + method public abstract javax.xml.parsers.SAXParser newSAXParser() throws javax.xml.parsers.ParserConfigurationException, org.xml.sax.SAXException; + method public abstract void setFeature(java.lang.String, boolean) throws javax.xml.parsers.ParserConfigurationException, org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException; + method public void setNamespaceAware(boolean); + method public void setSchema(javax.xml.validation.Schema); + method public void setValidating(boolean); + method public void setXIncludeAware(boolean); + } + +} + +package javax.xml.transform { + + public abstract interface ErrorListener { + method public abstract void error(javax.xml.transform.TransformerException) throws javax.xml.transform.TransformerException; + method public abstract void fatalError(javax.xml.transform.TransformerException) throws javax.xml.transform.TransformerException; + method public abstract void warning(javax.xml.transform.TransformerException) throws javax.xml.transform.TransformerException; + } + + public class OutputKeys { + field public static final java.lang.String CDATA_SECTION_ELEMENTS = "cdata-section-elements"; + field public static final java.lang.String DOCTYPE_PUBLIC = "doctype-public"; + field public static final java.lang.String DOCTYPE_SYSTEM = "doctype-system"; + field public static final java.lang.String ENCODING = "encoding"; + field public static final java.lang.String INDENT = "indent"; + field public static final java.lang.String MEDIA_TYPE = "media-type"; + field public static final java.lang.String METHOD = "method"; + field public static final java.lang.String OMIT_XML_DECLARATION = "omit-xml-declaration"; + field public static final java.lang.String STANDALONE = "standalone"; + field public static final java.lang.String VERSION = "version"; + } + + public abstract interface Result { + method public abstract java.lang.String getSystemId(); + method public abstract void setSystemId(java.lang.String); + field public static final java.lang.String PI_DISABLE_OUTPUT_ESCAPING = "javax.xml.transform.disable-output-escaping"; + field public static final java.lang.String PI_ENABLE_OUTPUT_ESCAPING = "javax.xml.transform.enable-output-escaping"; + } + + public abstract interface Source { + method public abstract java.lang.String getSystemId(); + method public abstract void setSystemId(java.lang.String); + } + + public abstract interface SourceLocator { + method public abstract int getColumnNumber(); + method public abstract int getLineNumber(); + method public abstract java.lang.String getPublicId(); + method public abstract java.lang.String getSystemId(); + } + + public abstract interface Templates { + method public abstract java.util.Properties getOutputProperties(); + method public abstract javax.xml.transform.Transformer newTransformer() throws javax.xml.transform.TransformerConfigurationException; + } + + public abstract class Transformer { + ctor protected Transformer(); + method public abstract void clearParameters(); + method public abstract javax.xml.transform.ErrorListener getErrorListener(); + method public abstract java.util.Properties getOutputProperties(); + method public abstract java.lang.String getOutputProperty(java.lang.String) throws java.lang.IllegalArgumentException; + method public abstract java.lang.Object getParameter(java.lang.String); + method public abstract javax.xml.transform.URIResolver getURIResolver(); + method public void reset(); + method public abstract void setErrorListener(javax.xml.transform.ErrorListener) throws java.lang.IllegalArgumentException; + method public abstract void setOutputProperties(java.util.Properties); + method public abstract void setOutputProperty(java.lang.String, java.lang.String) throws java.lang.IllegalArgumentException; + method public abstract void setParameter(java.lang.String, java.lang.Object); + method public abstract void setURIResolver(javax.xml.transform.URIResolver); + method public abstract void transform(javax.xml.transform.Source, javax.xml.transform.Result) throws javax.xml.transform.TransformerException; + } + + public class TransformerConfigurationException extends javax.xml.transform.TransformerException { + ctor public TransformerConfigurationException(); + ctor public TransformerConfigurationException(java.lang.String); + ctor public TransformerConfigurationException(java.lang.Throwable); + ctor public TransformerConfigurationException(java.lang.String, java.lang.Throwable); + ctor public TransformerConfigurationException(java.lang.String, javax.xml.transform.SourceLocator); + ctor public TransformerConfigurationException(java.lang.String, javax.xml.transform.SourceLocator, java.lang.Throwable); + } + + public class TransformerException extends java.lang.Exception { + ctor public TransformerException(java.lang.String); + ctor public TransformerException(java.lang.Throwable); + ctor public TransformerException(java.lang.String, java.lang.Throwable); + ctor public TransformerException(java.lang.String, javax.xml.transform.SourceLocator); + ctor public TransformerException(java.lang.String, javax.xml.transform.SourceLocator, java.lang.Throwable); + method public java.lang.Throwable getException(); + method public java.lang.String getLocationAsString(); + method public javax.xml.transform.SourceLocator getLocator(); + method public java.lang.String getMessageAndLocation(); + method public void setLocator(javax.xml.transform.SourceLocator); + } + + public abstract class TransformerFactory { + ctor protected TransformerFactory(); + method public abstract javax.xml.transform.Source getAssociatedStylesheet(javax.xml.transform.Source, java.lang.String, java.lang.String, java.lang.String) throws javax.xml.transform.TransformerConfigurationException; + method public abstract java.lang.Object getAttribute(java.lang.String); + method public abstract javax.xml.transform.ErrorListener getErrorListener(); + method public abstract boolean getFeature(java.lang.String); + method public abstract javax.xml.transform.URIResolver getURIResolver(); + method public static javax.xml.transform.TransformerFactory newInstance() throws javax.xml.transform.TransformerFactoryConfigurationError; + method public static javax.xml.transform.TransformerFactory newInstance(java.lang.String, java.lang.ClassLoader) throws javax.xml.transform.TransformerFactoryConfigurationError; + method public abstract javax.xml.transform.Templates newTemplates(javax.xml.transform.Source) throws javax.xml.transform.TransformerConfigurationException; + method public abstract javax.xml.transform.Transformer newTransformer(javax.xml.transform.Source) throws javax.xml.transform.TransformerConfigurationException; + method public abstract javax.xml.transform.Transformer newTransformer() throws javax.xml.transform.TransformerConfigurationException; + method public abstract void setAttribute(java.lang.String, java.lang.Object); + method public abstract void setErrorListener(javax.xml.transform.ErrorListener); + method public abstract void setFeature(java.lang.String, boolean) throws javax.xml.transform.TransformerConfigurationException; + method public abstract void setURIResolver(javax.xml.transform.URIResolver); + } + + public class TransformerFactoryConfigurationError extends java.lang.Error { + ctor public TransformerFactoryConfigurationError(); + ctor public TransformerFactoryConfigurationError(java.lang.String); + ctor public TransformerFactoryConfigurationError(java.lang.Exception); + ctor public TransformerFactoryConfigurationError(java.lang.Exception, java.lang.String); + method public java.lang.Exception getException(); + } + + public abstract interface URIResolver { + method public abstract javax.xml.transform.Source resolve(java.lang.String, java.lang.String) throws javax.xml.transform.TransformerException; + } + +} + +package javax.xml.transform.dom { + + public abstract interface DOMLocator implements javax.xml.transform.SourceLocator { + method public abstract org.w3c.dom.Node getOriginatingNode(); + } + + public class DOMResult implements javax.xml.transform.Result { + ctor public DOMResult(); + ctor public DOMResult(org.w3c.dom.Node); + ctor public DOMResult(org.w3c.dom.Node, java.lang.String); + ctor public DOMResult(org.w3c.dom.Node, org.w3c.dom.Node); + ctor public DOMResult(org.w3c.dom.Node, org.w3c.dom.Node, java.lang.String); + method public org.w3c.dom.Node getNextSibling(); + method public org.w3c.dom.Node getNode(); + method public java.lang.String getSystemId(); + method public void setNextSibling(org.w3c.dom.Node); + method public void setNode(org.w3c.dom.Node); + method public void setSystemId(java.lang.String); + field public static final java.lang.String FEATURE = "http://javax.xml.transform.dom.DOMResult/feature"; + } + + public class DOMSource implements javax.xml.transform.Source { + ctor public DOMSource(); + ctor public DOMSource(org.w3c.dom.Node); + ctor public DOMSource(org.w3c.dom.Node, java.lang.String); + method public org.w3c.dom.Node getNode(); + method public java.lang.String getSystemId(); + method public void setNode(org.w3c.dom.Node); + method public void setSystemId(java.lang.String); + field public static final java.lang.String FEATURE = "http://javax.xml.transform.dom.DOMSource/feature"; + } + +} + +package javax.xml.transform.sax { + + public class SAXResult implements javax.xml.transform.Result { + ctor public SAXResult(); + ctor public SAXResult(org.xml.sax.ContentHandler); + method public org.xml.sax.ContentHandler getHandler(); + method public org.xml.sax.ext.LexicalHandler getLexicalHandler(); + method public java.lang.String getSystemId(); + method public void setHandler(org.xml.sax.ContentHandler); + method public void setLexicalHandler(org.xml.sax.ext.LexicalHandler); + method public void setSystemId(java.lang.String); + field public static final java.lang.String FEATURE = "http://javax.xml.transform.sax.SAXResult/feature"; + } + + public class SAXSource implements javax.xml.transform.Source { + ctor public SAXSource(); + ctor public SAXSource(org.xml.sax.XMLReader, org.xml.sax.InputSource); + ctor public SAXSource(org.xml.sax.InputSource); + method public org.xml.sax.InputSource getInputSource(); + method public java.lang.String getSystemId(); + method public org.xml.sax.XMLReader getXMLReader(); + method public void setInputSource(org.xml.sax.InputSource); + method public void setSystemId(java.lang.String); + method public void setXMLReader(org.xml.sax.XMLReader); + method public static org.xml.sax.InputSource sourceToInputSource(javax.xml.transform.Source); + field public static final java.lang.String FEATURE = "http://javax.xml.transform.sax.SAXSource/feature"; + } + + public abstract class SAXTransformerFactory extends javax.xml.transform.TransformerFactory { + ctor protected SAXTransformerFactory(); + method public abstract javax.xml.transform.sax.TemplatesHandler newTemplatesHandler() throws javax.xml.transform.TransformerConfigurationException; + method public abstract javax.xml.transform.sax.TransformerHandler newTransformerHandler(javax.xml.transform.Source) throws javax.xml.transform.TransformerConfigurationException; + method public abstract javax.xml.transform.sax.TransformerHandler newTransformerHandler(javax.xml.transform.Templates) throws javax.xml.transform.TransformerConfigurationException; + method public abstract javax.xml.transform.sax.TransformerHandler newTransformerHandler() throws javax.xml.transform.TransformerConfigurationException; + method public abstract org.xml.sax.XMLFilter newXMLFilter(javax.xml.transform.Source) throws javax.xml.transform.TransformerConfigurationException; + method public abstract org.xml.sax.XMLFilter newXMLFilter(javax.xml.transform.Templates) throws javax.xml.transform.TransformerConfigurationException; + field public static final java.lang.String FEATURE = "http://javax.xml.transform.sax.SAXTransformerFactory/feature"; + field public static final java.lang.String FEATURE_XMLFILTER = "http://javax.xml.transform.sax.SAXTransformerFactory/feature/xmlfilter"; + } + + public abstract interface TemplatesHandler implements org.xml.sax.ContentHandler { + method public abstract java.lang.String getSystemId(); + method public abstract javax.xml.transform.Templates getTemplates(); + method public abstract void setSystemId(java.lang.String); + } + + public abstract interface TransformerHandler implements org.xml.sax.ContentHandler org.xml.sax.DTDHandler org.xml.sax.ext.LexicalHandler { + method public abstract java.lang.String getSystemId(); + method public abstract javax.xml.transform.Transformer getTransformer(); + method public abstract void setResult(javax.xml.transform.Result) throws java.lang.IllegalArgumentException; + method public abstract void setSystemId(java.lang.String); + } + +} + +package javax.xml.transform.stream { + + public class StreamResult implements javax.xml.transform.Result { + ctor public StreamResult(); + ctor public StreamResult(java.io.OutputStream); + ctor public StreamResult(java.io.Writer); + ctor public StreamResult(java.lang.String); + ctor public StreamResult(java.io.File); + method public java.io.OutputStream getOutputStream(); + method public java.lang.String getSystemId(); + method public java.io.Writer getWriter(); + method public void setOutputStream(java.io.OutputStream); + method public void setSystemId(java.lang.String); + method public void setSystemId(java.io.File); + method public void setWriter(java.io.Writer); + field public static final java.lang.String FEATURE = "http://javax.xml.transform.stream.StreamResult/feature"; + } + + public class StreamSource implements javax.xml.transform.Source { + ctor public StreamSource(); + ctor public StreamSource(java.io.InputStream); + ctor public StreamSource(java.io.InputStream, java.lang.String); + ctor public StreamSource(java.io.Reader); + ctor public StreamSource(java.io.Reader, java.lang.String); + ctor public StreamSource(java.lang.String); + ctor public StreamSource(java.io.File); + method public java.io.InputStream getInputStream(); + method public java.lang.String getPublicId(); + method public java.io.Reader getReader(); + method public java.lang.String getSystemId(); + method public void setInputStream(java.io.InputStream); + method public void setPublicId(java.lang.String); + method public void setReader(java.io.Reader); + method public void setSystemId(java.lang.String); + method public void setSystemId(java.io.File); + field public static final java.lang.String FEATURE = "http://javax.xml.transform.stream.StreamSource/feature"; + } + +} + +package javax.xml.validation { + + public abstract class Schema { + ctor protected Schema(); + method public abstract javax.xml.validation.Validator newValidator(); + method public abstract javax.xml.validation.ValidatorHandler newValidatorHandler(); + } + + public abstract class SchemaFactory { + ctor protected SchemaFactory(); + method public abstract org.xml.sax.ErrorHandler getErrorHandler(); + method public boolean getFeature(java.lang.String) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException; + method public java.lang.Object getProperty(java.lang.String) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException; + method public abstract org.w3c.dom.ls.LSResourceResolver getResourceResolver(); + method public abstract boolean isSchemaLanguageSupported(java.lang.String); + method public static javax.xml.validation.SchemaFactory newInstance(java.lang.String); + method public static javax.xml.validation.SchemaFactory newInstance(java.lang.String, java.lang.String, java.lang.ClassLoader); + method public javax.xml.validation.Schema newSchema(javax.xml.transform.Source) throws org.xml.sax.SAXException; + method public javax.xml.validation.Schema newSchema(java.io.File) throws org.xml.sax.SAXException; + method public javax.xml.validation.Schema newSchema(java.net.URL) throws org.xml.sax.SAXException; + method public abstract javax.xml.validation.Schema newSchema(javax.xml.transform.Source[]) throws org.xml.sax.SAXException; + method public abstract javax.xml.validation.Schema newSchema() throws org.xml.sax.SAXException; + method public abstract void setErrorHandler(org.xml.sax.ErrorHandler); + method public void setFeature(java.lang.String, boolean) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException; + method public void setProperty(java.lang.String, java.lang.Object) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException; + method public abstract void setResourceResolver(org.w3c.dom.ls.LSResourceResolver); + } + + public abstract class SchemaFactoryLoader { + ctor protected SchemaFactoryLoader(); + method public abstract javax.xml.validation.SchemaFactory newFactory(java.lang.String); + } + + public abstract class TypeInfoProvider { + ctor protected TypeInfoProvider(); + method public abstract org.w3c.dom.TypeInfo getAttributeTypeInfo(int); + method public abstract org.w3c.dom.TypeInfo getElementTypeInfo(); + method public abstract boolean isIdAttribute(int); + method public abstract boolean isSpecified(int); + } + + public abstract class Validator { + ctor protected Validator(); + method public abstract org.xml.sax.ErrorHandler getErrorHandler(); + method public boolean getFeature(java.lang.String) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException; + method public java.lang.Object getProperty(java.lang.String) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException; + method public abstract org.w3c.dom.ls.LSResourceResolver getResourceResolver(); + method public abstract void reset(); + method public abstract void setErrorHandler(org.xml.sax.ErrorHandler); + method public void setFeature(java.lang.String, boolean) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException; + method public void setProperty(java.lang.String, java.lang.Object) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException; + method public abstract void setResourceResolver(org.w3c.dom.ls.LSResourceResolver); + method public void validate(javax.xml.transform.Source) throws java.io.IOException, org.xml.sax.SAXException; + method public abstract void validate(javax.xml.transform.Source, javax.xml.transform.Result) throws java.io.IOException, org.xml.sax.SAXException; + } + + public abstract class ValidatorHandler implements org.xml.sax.ContentHandler { + ctor protected ValidatorHandler(); + method public abstract org.xml.sax.ContentHandler getContentHandler(); + method public abstract org.xml.sax.ErrorHandler getErrorHandler(); + method public boolean getFeature(java.lang.String) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException; + method public java.lang.Object getProperty(java.lang.String) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException; + method public abstract org.w3c.dom.ls.LSResourceResolver getResourceResolver(); + method public abstract javax.xml.validation.TypeInfoProvider getTypeInfoProvider(); + method public abstract void setContentHandler(org.xml.sax.ContentHandler); + method public abstract void setErrorHandler(org.xml.sax.ErrorHandler); + method public void setFeature(java.lang.String, boolean) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException; + method public void setProperty(java.lang.String, java.lang.Object) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException; + method public abstract void setResourceResolver(org.w3c.dom.ls.LSResourceResolver); + } + +} + +package javax.xml.xpath { + + public abstract interface XPath { + method public abstract javax.xml.xpath.XPathExpression compile(java.lang.String) throws javax.xml.xpath.XPathExpressionException; + method public abstract java.lang.Object evaluate(java.lang.String, java.lang.Object, javax.xml.namespace.QName) throws javax.xml.xpath.XPathExpressionException; + method public abstract java.lang.String evaluate(java.lang.String, java.lang.Object) throws javax.xml.xpath.XPathExpressionException; + method public abstract java.lang.Object evaluate(java.lang.String, org.xml.sax.InputSource, javax.xml.namespace.QName) throws javax.xml.xpath.XPathExpressionException; + method public abstract java.lang.String evaluate(java.lang.String, org.xml.sax.InputSource) throws javax.xml.xpath.XPathExpressionException; + method public abstract javax.xml.namespace.NamespaceContext getNamespaceContext(); + method public abstract javax.xml.xpath.XPathFunctionResolver getXPathFunctionResolver(); + method public abstract javax.xml.xpath.XPathVariableResolver getXPathVariableResolver(); + method public abstract void reset(); + method public abstract void setNamespaceContext(javax.xml.namespace.NamespaceContext); + method public abstract void setXPathFunctionResolver(javax.xml.xpath.XPathFunctionResolver); + method public abstract void setXPathVariableResolver(javax.xml.xpath.XPathVariableResolver); + } + + public class XPathConstants { + field public static final javax.xml.namespace.QName BOOLEAN; + field public static final java.lang.String DOM_OBJECT_MODEL = "http://java.sun.com/jaxp/xpath/dom"; + field public static final javax.xml.namespace.QName NODE; + field public static final javax.xml.namespace.QName NODESET; + field public static final javax.xml.namespace.QName NUMBER; + field public static final javax.xml.namespace.QName STRING; + } + + public class XPathException extends java.lang.Exception { + ctor public XPathException(java.lang.String); + ctor public XPathException(java.lang.Throwable); + } + + public abstract interface XPathExpression { + method public abstract java.lang.Object evaluate(java.lang.Object, javax.xml.namespace.QName) throws javax.xml.xpath.XPathExpressionException; + method public abstract java.lang.String evaluate(java.lang.Object) throws javax.xml.xpath.XPathExpressionException; + method public abstract java.lang.Object evaluate(org.xml.sax.InputSource, javax.xml.namespace.QName) throws javax.xml.xpath.XPathExpressionException; + method public abstract java.lang.String evaluate(org.xml.sax.InputSource) throws javax.xml.xpath.XPathExpressionException; + } + + public class XPathExpressionException extends javax.xml.xpath.XPathException { + ctor public XPathExpressionException(java.lang.String); + ctor public XPathExpressionException(java.lang.Throwable); + } + + public abstract class XPathFactory { + ctor protected XPathFactory(); + method public abstract boolean getFeature(java.lang.String) throws javax.xml.xpath.XPathFactoryConfigurationException; + method public abstract boolean isObjectModelSupported(java.lang.String); + method public static final javax.xml.xpath.XPathFactory newInstance(); + method public static final javax.xml.xpath.XPathFactory newInstance(java.lang.String) throws javax.xml.xpath.XPathFactoryConfigurationException; + method public static javax.xml.xpath.XPathFactory newInstance(java.lang.String, java.lang.String, java.lang.ClassLoader) throws javax.xml.xpath.XPathFactoryConfigurationException; + method public abstract javax.xml.xpath.XPath newXPath(); + method public abstract void setFeature(java.lang.String, boolean) throws javax.xml.xpath.XPathFactoryConfigurationException; + method public abstract void setXPathFunctionResolver(javax.xml.xpath.XPathFunctionResolver); + method public abstract void setXPathVariableResolver(javax.xml.xpath.XPathVariableResolver); + field public static final java.lang.String DEFAULT_OBJECT_MODEL_URI = "http://java.sun.com/jaxp/xpath/dom"; + field public static final java.lang.String DEFAULT_PROPERTY_NAME = "javax.xml.xpath.XPathFactory"; + } + + public class XPathFactoryConfigurationException extends javax.xml.xpath.XPathException { + ctor public XPathFactoryConfigurationException(java.lang.String); + ctor public XPathFactoryConfigurationException(java.lang.Throwable); + } + + public abstract interface XPathFunction { + method public abstract java.lang.Object evaluate(java.util.List) throws javax.xml.xpath.XPathFunctionException; + } + + public class XPathFunctionException extends javax.xml.xpath.XPathExpressionException { + ctor public XPathFunctionException(java.lang.String); + ctor public XPathFunctionException(java.lang.Throwable); + } + + public abstract interface XPathFunctionResolver { + method public abstract javax.xml.xpath.XPathFunction resolveFunction(javax.xml.namespace.QName, int); + } + + public abstract interface XPathVariableResolver { + method public abstract java.lang.Object resolveVariable(javax.xml.namespace.QName); + } + +} + +package junit.framework { + + public class Assert { + ctor protected Assert(); + method public static void assertEquals(java.lang.String, java.lang.Object, java.lang.Object); + method public static void assertEquals(java.lang.Object, java.lang.Object); + method public static void assertEquals(java.lang.String, java.lang.String, java.lang.String); + method public static void assertEquals(java.lang.String, java.lang.String); + method public static void assertEquals(java.lang.String, double, double, double); + method public static void assertEquals(double, double, double); + method public static void assertEquals(java.lang.String, float, float, float); + method public static void assertEquals(float, float, float); + method public static void assertEquals(java.lang.String, long, long); + method public static void assertEquals(long, long); + method public static void assertEquals(java.lang.String, boolean, boolean); + method public static void assertEquals(boolean, boolean); + method public static void assertEquals(java.lang.String, byte, byte); + method public static void assertEquals(byte, byte); + method public static void assertEquals(java.lang.String, char, char); + method public static void assertEquals(char, char); + method public static void assertEquals(java.lang.String, short, short); + method public static void assertEquals(short, short); + method public static void assertEquals(java.lang.String, int, int); + method public static void assertEquals(int, int); + method public static void assertFalse(java.lang.String, boolean); + method public static void assertFalse(boolean); + method public static void assertNotNull(java.lang.Object); + method public static void assertNotNull(java.lang.String, java.lang.Object); + method public static void assertNotSame(java.lang.String, java.lang.Object, java.lang.Object); + method public static void assertNotSame(java.lang.Object, java.lang.Object); + method public static void assertNull(java.lang.Object); + method public static void assertNull(java.lang.String, java.lang.Object); + method public static void assertSame(java.lang.String, java.lang.Object, java.lang.Object); + method public static void assertSame(java.lang.Object, java.lang.Object); + method public static void assertTrue(java.lang.String, boolean); + method public static void assertTrue(boolean); + method public static void fail(java.lang.String); + method public static void fail(); + method public static void failNotEquals(java.lang.String, java.lang.Object, java.lang.Object); + method public static void failNotSame(java.lang.String, java.lang.Object, java.lang.Object); + method public static void failSame(java.lang.String); + method public static java.lang.String format(java.lang.String, java.lang.Object, java.lang.Object); + } + + public class AssertionFailedError extends java.lang.AssertionError { + ctor public AssertionFailedError(); + ctor public AssertionFailedError(java.lang.String); + } + + public class ComparisonFailure extends junit.framework.AssertionFailedError { + ctor public ComparisonFailure(java.lang.String, java.lang.String, java.lang.String); + method public java.lang.String getActual(); + method public java.lang.String getExpected(); + } + + public abstract interface Protectable { + method public abstract void protect() throws java.lang.Throwable; + } + + public abstract interface Test { + method public abstract int countTestCases(); + method public abstract void run(junit.framework.TestResult); + } + + public abstract class TestCase extends junit.framework.Assert implements junit.framework.Test { + ctor public TestCase(); + ctor public TestCase(java.lang.String); + method public int countTestCases(); + method protected junit.framework.TestResult createResult(); + method public java.lang.String getName(); + method public junit.framework.TestResult run(); + method public void run(junit.framework.TestResult); + method public void runBare() throws java.lang.Throwable; + method protected void runTest() throws java.lang.Throwable; + method public void setName(java.lang.String); + method protected void setUp() throws java.lang.Exception; + method protected void tearDown() throws java.lang.Exception; + } + + public class TestFailure { + ctor public TestFailure(junit.framework.Test, java.lang.Throwable); + method public java.lang.String exceptionMessage(); + method public junit.framework.Test failedTest(); + method public boolean isFailure(); + method public java.lang.Throwable thrownException(); + method public java.lang.String trace(); + field protected junit.framework.Test fFailedTest; + field protected java.lang.Throwable fThrownException; + } + + public abstract interface TestListener { + method public abstract void addError(junit.framework.Test, java.lang.Throwable); + method public abstract void addFailure(junit.framework.Test, junit.framework.AssertionFailedError); + method public abstract void endTest(junit.framework.Test); + method public abstract void startTest(junit.framework.Test); + } + + public class TestResult { + ctor public TestResult(); + method public synchronized void addError(junit.framework.Test, java.lang.Throwable); + method public synchronized void addFailure(junit.framework.Test, junit.framework.AssertionFailedError); + method public synchronized void addListener(junit.framework.TestListener); + method public void endTest(junit.framework.Test); + method public synchronized int errorCount(); + method public synchronized java.util.Enumeration errors(); + method public synchronized int failureCount(); + method public synchronized java.util.Enumeration failures(); + method public synchronized void removeListener(junit.framework.TestListener); + method protected void run(junit.framework.TestCase); + method public synchronized int runCount(); + method public void runProtected(junit.framework.Test, junit.framework.Protectable); + method public synchronized boolean shouldStop(); + method public void startTest(junit.framework.Test); + method public synchronized void stop(); + method public synchronized boolean wasSuccessful(); + field protected java.util.Vector fErrors; + field protected java.util.Vector fFailures; + field protected java.util.Vector fListeners; + field protected int fRunTests; + } + + public class TestSuite implements junit.framework.Test { + ctor public TestSuite(); + ctor public TestSuite(java.lang.Class); + ctor public TestSuite(java.lang.Class, java.lang.String); + ctor public TestSuite(java.lang.String); + ctor public TestSuite(java.lang.Class...); + ctor public TestSuite(java.lang.Class[], java.lang.String); + method public void addTest(junit.framework.Test); + method public void addTestSuite(java.lang.Class); + method public int countTestCases(); + method public static junit.framework.Test createTest(java.lang.Class, java.lang.String); + method public java.lang.String getName(); + method public static java.lang.reflect.Constructor getTestConstructor(java.lang.Class) throws java.lang.NoSuchMethodException; + method public void run(junit.framework.TestResult); + method public void runTest(junit.framework.Test, junit.framework.TestResult); + method public void setName(java.lang.String); + method public junit.framework.Test testAt(int); + method public int testCount(); + method public java.util.Enumeration tests(); + method public static junit.framework.Test warning(java.lang.String); + } + +} + +package junit.runner { + + public abstract class BaseTestRunner implements junit.framework.TestListener { + ctor public BaseTestRunner(); + method public synchronized void addError(junit.framework.Test, java.lang.Throwable); + method public synchronized void addFailure(junit.framework.Test, junit.framework.AssertionFailedError); + method protected void clearStatus(); + method public java.lang.String elapsedTimeAsString(long); + method public synchronized void endTest(junit.framework.Test); + method public java.lang.String extractClassName(java.lang.String); + method public static java.lang.String getFilteredTrace(java.lang.Throwable); + method public static java.lang.String getFilteredTrace(java.lang.String); + method public deprecated junit.runner.TestSuiteLoader getLoader(); + method public static java.lang.String getPreference(java.lang.String); + method public static int getPreference(java.lang.String, int); + method protected static java.util.Properties getPreferences(); + method public junit.framework.Test getTest(java.lang.String); + method public static deprecated boolean inVAJava(); + method protected java.lang.Class loadSuiteClass(java.lang.String) throws java.lang.ClassNotFoundException; + method protected java.lang.String processArguments(java.lang.String[]); + method protected abstract void runFailed(java.lang.String); + method public static void savePreferences() throws java.io.IOException; + method public void setLoading(boolean); + method public void setPreference(java.lang.String, java.lang.String); + method protected static void setPreferences(java.util.Properties); + method protected static boolean showStackRaw(); + method public synchronized void startTest(junit.framework.Test); + method public abstract void testEnded(java.lang.String); + method public abstract void testFailed(int, junit.framework.Test, java.lang.Throwable); + method public abstract void testStarted(java.lang.String); + method public static java.lang.String truncate(java.lang.String); + method protected boolean useReloadingTestSuiteLoader(); + field public static final java.lang.String SUITE_METHODNAME = "suite"; + } + + public abstract interface TestSuiteLoader { + method public abstract java.lang.Class load(java.lang.String) throws java.lang.ClassNotFoundException; + method public abstract java.lang.Class reload(java.lang.Class) throws java.lang.ClassNotFoundException; + } + + public class Version { + method public static java.lang.String id(); + } + +} + +package org.apache.commons.logging { + + public abstract interface Log { + method public abstract void debug(java.lang.Object); + method public abstract void debug(java.lang.Object, java.lang.Throwable); + method public abstract void error(java.lang.Object); + method public abstract void error(java.lang.Object, java.lang.Throwable); + method public abstract void fatal(java.lang.Object); + method public abstract void fatal(java.lang.Object, java.lang.Throwable); + method public abstract void info(java.lang.Object); + method public abstract void info(java.lang.Object, java.lang.Throwable); + method public abstract boolean isDebugEnabled(); + method public abstract boolean isErrorEnabled(); + method public abstract boolean isFatalEnabled(); + method public abstract boolean isInfoEnabled(); + method public abstract boolean isTraceEnabled(); + method public abstract boolean isWarnEnabled(); + method public abstract void trace(java.lang.Object); + method public abstract void trace(java.lang.Object, java.lang.Throwable); + method public abstract void warn(java.lang.Object); + method public abstract void warn(java.lang.Object, java.lang.Throwable); + } + +} + +package org.apache.http { + + public class ConnectionClosedException extends java.io.IOException { + ctor public ConnectionClosedException(java.lang.String); + } + + public abstract interface ConnectionReuseStrategy { + method public abstract boolean keepAlive(org.apache.http.HttpResponse, org.apache.http.protocol.HttpContext); + } + + public abstract interface FormattedHeader implements org.apache.http.Header { + method public abstract org.apache.http.util.CharArrayBuffer getBuffer(); + method public abstract int getValuePos(); + } + + public abstract interface Header { + method public abstract org.apache.http.HeaderElement[] getElements() throws org.apache.http.ParseException; + method public abstract java.lang.String getName(); + method public abstract java.lang.String getValue(); + } + + public abstract interface HeaderElement { + method public abstract java.lang.String getName(); + method public abstract org.apache.http.NameValuePair getParameter(int); + method public abstract org.apache.http.NameValuePair getParameterByName(java.lang.String); + method public abstract int getParameterCount(); + method public abstract org.apache.http.NameValuePair[] getParameters(); + method public abstract java.lang.String getValue(); + } + + public abstract interface HeaderElementIterator implements java.util.Iterator { + method public abstract boolean hasNext(); + method public abstract org.apache.http.HeaderElement nextElement(); + } + + public abstract interface HeaderIterator implements java.util.Iterator { + method public abstract boolean hasNext(); + method public abstract org.apache.http.Header nextHeader(); + } + + public abstract interface HttpClientConnection implements org.apache.http.HttpConnection { + method public abstract void flush() throws java.io.IOException; + method public abstract boolean isResponseAvailable(int) throws java.io.IOException; + method public abstract void receiveResponseEntity(org.apache.http.HttpResponse) throws org.apache.http.HttpException, java.io.IOException; + method public abstract org.apache.http.HttpResponse receiveResponseHeader() throws org.apache.http.HttpException, java.io.IOException; + method public abstract void sendRequestEntity(org.apache.http.HttpEntityEnclosingRequest) throws org.apache.http.HttpException, java.io.IOException; + method public abstract void sendRequestHeader(org.apache.http.HttpRequest) throws org.apache.http.HttpException, java.io.IOException; + } + + public abstract interface HttpConnection { + method public abstract void close() throws java.io.IOException; + method public abstract org.apache.http.HttpConnectionMetrics getMetrics(); + method public abstract int getSocketTimeout(); + method public abstract boolean isOpen(); + method public abstract boolean isStale(); + method public abstract void setSocketTimeout(int); + method public abstract void shutdown() throws java.io.IOException; + } + + public abstract interface HttpConnectionMetrics { + method public abstract java.lang.Object getMetric(java.lang.String); + method public abstract long getReceivedBytesCount(); + method public abstract long getRequestCount(); + method public abstract long getResponseCount(); + method public abstract long getSentBytesCount(); + method public abstract void reset(); + } + + public abstract interface HttpEntity { + method public abstract void consumeContent() throws java.io.IOException; + method public abstract java.io.InputStream getContent() throws java.io.IOException, java.lang.IllegalStateException; + method public abstract org.apache.http.Header getContentEncoding(); + method public abstract long getContentLength(); + method public abstract org.apache.http.Header getContentType(); + method public abstract boolean isChunked(); + method public abstract boolean isRepeatable(); + method public abstract boolean isStreaming(); + method public abstract void writeTo(java.io.OutputStream) throws java.io.IOException; + } + + public abstract interface HttpEntityEnclosingRequest implements org.apache.http.HttpRequest { + method public abstract boolean expectContinue(); + method public abstract org.apache.http.HttpEntity getEntity(); + method public abstract void setEntity(org.apache.http.HttpEntity); + } + + public class HttpException extends java.lang.Exception { + ctor public HttpException(); + ctor public HttpException(java.lang.String); + ctor public HttpException(java.lang.String, java.lang.Throwable); + } + + public final class HttpHost implements java.lang.Cloneable { + ctor public HttpHost(java.lang.String, int, java.lang.String); + ctor public HttpHost(java.lang.String, int); + ctor public HttpHost(java.lang.String); + ctor public HttpHost(org.apache.http.HttpHost); + method public java.lang.Object clone() throws java.lang.CloneNotSupportedException; + method public java.lang.String getHostName(); + method public int getPort(); + method public java.lang.String getSchemeName(); + method public java.lang.String toHostString(); + method public java.lang.String toURI(); + field public static final java.lang.String DEFAULT_SCHEME_NAME = "http"; + field protected final java.lang.String hostname; + field protected final java.lang.String lcHostname; + field protected final int port; + field protected final java.lang.String schemeName; + } + + public abstract interface HttpInetConnection implements org.apache.http.HttpConnection { + method public abstract java.net.InetAddress getLocalAddress(); + method public abstract int getLocalPort(); + method public abstract java.net.InetAddress getRemoteAddress(); + method public abstract int getRemotePort(); + } + + public abstract interface HttpMessage { + method public abstract void addHeader(org.apache.http.Header); + method public abstract void addHeader(java.lang.String, java.lang.String); + method public abstract boolean containsHeader(java.lang.String); + method public abstract org.apache.http.Header[] getAllHeaders(); + method public abstract org.apache.http.Header getFirstHeader(java.lang.String); + method public abstract org.apache.http.Header[] getHeaders(java.lang.String); + method public abstract org.apache.http.Header getLastHeader(java.lang.String); + method public abstract org.apache.http.params.HttpParams getParams(); + method public abstract org.apache.http.ProtocolVersion getProtocolVersion(); + method public abstract org.apache.http.HeaderIterator headerIterator(); + method public abstract org.apache.http.HeaderIterator headerIterator(java.lang.String); + method public abstract void removeHeader(org.apache.http.Header); + method public abstract void removeHeaders(java.lang.String); + method public abstract void setHeader(org.apache.http.Header); + method public abstract void setHeader(java.lang.String, java.lang.String); + method public abstract void setHeaders(org.apache.http.Header[]); + method public abstract void setParams(org.apache.http.params.HttpParams); + } + + public abstract interface HttpRequest implements org.apache.http.HttpMessage { + method public abstract org.apache.http.RequestLine getRequestLine(); + } + + public abstract interface HttpRequestFactory { + method public abstract org.apache.http.HttpRequest newHttpRequest(org.apache.http.RequestLine) throws org.apache.http.MethodNotSupportedException; + method public abstract org.apache.http.HttpRequest newHttpRequest(java.lang.String, java.lang.String) throws org.apache.http.MethodNotSupportedException; + } + + public abstract interface HttpRequestInterceptor { + method public abstract void process(org.apache.http.HttpRequest, org.apache.http.protocol.HttpContext) throws org.apache.http.HttpException, java.io.IOException; + } + + public abstract interface HttpResponse implements org.apache.http.HttpMessage { + method public abstract org.apache.http.HttpEntity getEntity(); + method public abstract java.util.Locale getLocale(); + method public abstract org.apache.http.StatusLine getStatusLine(); + method public abstract void setEntity(org.apache.http.HttpEntity); + method public abstract void setLocale(java.util.Locale); + method public abstract void setReasonPhrase(java.lang.String) throws java.lang.IllegalStateException; + method public abstract void setStatusCode(int) throws java.lang.IllegalStateException; + method public abstract void setStatusLine(org.apache.http.StatusLine); + method public abstract void setStatusLine(org.apache.http.ProtocolVersion, int); + method public abstract void setStatusLine(org.apache.http.ProtocolVersion, int, java.lang.String); + } + + public abstract interface HttpResponseFactory { + method public abstract org.apache.http.HttpResponse newHttpResponse(org.apache.http.ProtocolVersion, int, org.apache.http.protocol.HttpContext); + method public abstract org.apache.http.HttpResponse newHttpResponse(org.apache.http.StatusLine, org.apache.http.protocol.HttpContext); + } + + public abstract interface HttpResponseInterceptor { + method public abstract void process(org.apache.http.HttpResponse, org.apache.http.protocol.HttpContext) throws org.apache.http.HttpException, java.io.IOException; + } + + public abstract interface HttpServerConnection implements org.apache.http.HttpConnection { + method public abstract void flush() throws java.io.IOException; + method public abstract void receiveRequestEntity(org.apache.http.HttpEntityEnclosingRequest) throws org.apache.http.HttpException, java.io.IOException; + method public abstract org.apache.http.HttpRequest receiveRequestHeader() throws org.apache.http.HttpException, java.io.IOException; + method public abstract void sendResponseEntity(org.apache.http.HttpResponse) throws org.apache.http.HttpException, java.io.IOException; + method public abstract void sendResponseHeader(org.apache.http.HttpResponse) throws org.apache.http.HttpException, java.io.IOException; + } + + public abstract interface HttpStatus { + field public static final int SC_ACCEPTED = 202; // 0xca + field public static final int SC_BAD_GATEWAY = 502; // 0x1f6 + field public static final int SC_BAD_REQUEST = 400; // 0x190 + field public static final int SC_CONFLICT = 409; // 0x199 + field public static final int SC_CONTINUE = 100; // 0x64 + field public static final int SC_CREATED = 201; // 0xc9 + field public static final int SC_EXPECTATION_FAILED = 417; // 0x1a1 + field public static final int SC_FAILED_DEPENDENCY = 424; // 0x1a8 + field public static final int SC_FORBIDDEN = 403; // 0x193 + field public static final int SC_GATEWAY_TIMEOUT = 504; // 0x1f8 + field public static final int SC_GONE = 410; // 0x19a + field public static final int SC_HTTP_VERSION_NOT_SUPPORTED = 505; // 0x1f9 + field public static final int SC_INSUFFICIENT_SPACE_ON_RESOURCE = 419; // 0x1a3 + field public static final int SC_INSUFFICIENT_STORAGE = 507; // 0x1fb + field public static final int SC_INTERNAL_SERVER_ERROR = 500; // 0x1f4 + field public static final int SC_LENGTH_REQUIRED = 411; // 0x19b + field public static final int SC_LOCKED = 423; // 0x1a7 + field public static final int SC_METHOD_FAILURE = 420; // 0x1a4 + field public static final int SC_METHOD_NOT_ALLOWED = 405; // 0x195 + field public static final int SC_MOVED_PERMANENTLY = 301; // 0x12d + field public static final int SC_MOVED_TEMPORARILY = 302; // 0x12e + field public static final int SC_MULTIPLE_CHOICES = 300; // 0x12c + field public static final int SC_MULTI_STATUS = 207; // 0xcf + field public static final int SC_NON_AUTHORITATIVE_INFORMATION = 203; // 0xcb + field public static final int SC_NOT_ACCEPTABLE = 406; // 0x196 + field public static final int SC_NOT_FOUND = 404; // 0x194 + field public static final int SC_NOT_IMPLEMENTED = 501; // 0x1f5 + field public static final int SC_NOT_MODIFIED = 304; // 0x130 + field public static final int SC_NO_CONTENT = 204; // 0xcc + field public static final int SC_OK = 200; // 0xc8 + field public static final int SC_PARTIAL_CONTENT = 206; // 0xce + field public static final int SC_PAYMENT_REQUIRED = 402; // 0x192 + field public static final int SC_PRECONDITION_FAILED = 412; // 0x19c + field public static final int SC_PROCESSING = 102; // 0x66 + field public static final int SC_PROXY_AUTHENTICATION_REQUIRED = 407; // 0x197 + field public static final int SC_REQUESTED_RANGE_NOT_SATISFIABLE = 416; // 0x1a0 + field public static final int SC_REQUEST_TIMEOUT = 408; // 0x198 + field public static final int SC_REQUEST_TOO_LONG = 413; // 0x19d + field public static final int SC_REQUEST_URI_TOO_LONG = 414; // 0x19e + field public static final int SC_RESET_CONTENT = 205; // 0xcd + field public static final int SC_SEE_OTHER = 303; // 0x12f + field public static final int SC_SERVICE_UNAVAILABLE = 503; // 0x1f7 + field public static final int SC_SWITCHING_PROTOCOLS = 101; // 0x65 + field public static final int SC_TEMPORARY_REDIRECT = 307; // 0x133 + field public static final int SC_UNAUTHORIZED = 401; // 0x191 + field public static final int SC_UNPROCESSABLE_ENTITY = 422; // 0x1a6 + field public static final int SC_UNSUPPORTED_MEDIA_TYPE = 415; // 0x19f + field public static final int SC_USE_PROXY = 305; // 0x131 + } + + public final class HttpVersion extends org.apache.http.ProtocolVersion implements java.io.Serializable { + ctor public HttpVersion(int, int); + field public static final java.lang.String HTTP = "HTTP"; + field public static final org.apache.http.HttpVersion HTTP_0_9; + field public static final org.apache.http.HttpVersion HTTP_1_0; + field public static final org.apache.http.HttpVersion HTTP_1_1; + } + + public class MalformedChunkCodingException extends java.io.IOException { + ctor public MalformedChunkCodingException(); + ctor public MalformedChunkCodingException(java.lang.String); + } + + public class MethodNotSupportedException extends org.apache.http.HttpException { + ctor public MethodNotSupportedException(java.lang.String); + ctor public MethodNotSupportedException(java.lang.String, java.lang.Throwable); + } + + public abstract interface NameValuePair { + method public abstract java.lang.String getName(); + method public abstract java.lang.String getValue(); + } + + public class NoHttpResponseException extends java.io.IOException { + ctor public NoHttpResponseException(java.lang.String); + } + + public class ParseException extends java.lang.RuntimeException { + ctor public ParseException(); + ctor public ParseException(java.lang.String); + } + + public class ProtocolException extends org.apache.http.HttpException { + ctor public ProtocolException(); + ctor public ProtocolException(java.lang.String); + ctor public ProtocolException(java.lang.String, java.lang.Throwable); + } + + public class ProtocolVersion implements java.lang.Cloneable java.io.Serializable { + ctor public ProtocolVersion(java.lang.String, int, int); + method public java.lang.Object clone() throws java.lang.CloneNotSupportedException; + method public int compareToVersion(org.apache.http.ProtocolVersion); + method public final boolean equals(java.lang.Object); + method public org.apache.http.ProtocolVersion forVersion(int, int); + method public final int getMajor(); + method public final int getMinor(); + method public final java.lang.String getProtocol(); + method public final boolean greaterEquals(org.apache.http.ProtocolVersion); + method public final int hashCode(); + method public boolean isComparable(org.apache.http.ProtocolVersion); + method public final boolean lessEquals(org.apache.http.ProtocolVersion); + field protected final int major; + field protected final int minor; + field protected final java.lang.String protocol; + } + + public abstract interface ReasonPhraseCatalog { + method public abstract java.lang.String getReason(int, java.util.Locale); + } + + public abstract interface RequestLine { + method public abstract java.lang.String getMethod(); + method public abstract org.apache.http.ProtocolVersion getProtocolVersion(); + method public abstract java.lang.String getUri(); + } + + public abstract interface StatusLine { + method public abstract org.apache.http.ProtocolVersion getProtocolVersion(); + method public abstract java.lang.String getReasonPhrase(); + method public abstract int getStatusCode(); + } + + public abstract interface TokenIterator implements java.util.Iterator { + method public abstract boolean hasNext(); + method public abstract java.lang.String nextToken(); + } + + public class UnsupportedHttpVersionException extends org.apache.http.ProtocolException { + ctor public UnsupportedHttpVersionException(); + ctor public UnsupportedHttpVersionException(java.lang.String); + } + +} + +package org.apache.http.auth { + + public final class AUTH { + field public static final java.lang.String PROXY_AUTH = "Proxy-Authenticate"; + field public static final java.lang.String PROXY_AUTH_RESP = "Proxy-Authorization"; + field public static final java.lang.String WWW_AUTH = "WWW-Authenticate"; + field public static final java.lang.String WWW_AUTH_RESP = "Authorization"; + } + + public abstract interface AuthScheme { + method public abstract org.apache.http.Header authenticate(org.apache.http.auth.Credentials, org.apache.http.HttpRequest) throws org.apache.http.auth.AuthenticationException; + method public abstract java.lang.String getParameter(java.lang.String); + method public abstract java.lang.String getRealm(); + method public abstract java.lang.String getSchemeName(); + method public abstract boolean isComplete(); + method public abstract boolean isConnectionBased(); + method public abstract void processChallenge(org.apache.http.Header) throws org.apache.http.auth.MalformedChallengeException; + } + + public abstract interface AuthSchemeFactory { + method public abstract org.apache.http.auth.AuthScheme newInstance(org.apache.http.params.HttpParams); + } + + public final class AuthSchemeRegistry { + ctor public AuthSchemeRegistry(); + method public synchronized org.apache.http.auth.AuthScheme getAuthScheme(java.lang.String, org.apache.http.params.HttpParams) throws java.lang.IllegalStateException; + method public synchronized java.util.List getSchemeNames(); + method public synchronized void register(java.lang.String, org.apache.http.auth.AuthSchemeFactory); + method public synchronized void setItems(java.util.Map); + method public synchronized void unregister(java.lang.String); + } + + public class AuthScope { + ctor public AuthScope(java.lang.String, int, java.lang.String, java.lang.String); + ctor public AuthScope(java.lang.String, int, java.lang.String); + ctor public AuthScope(java.lang.String, int); + ctor public AuthScope(org.apache.http.auth.AuthScope); + method public java.lang.String getHost(); + method public int getPort(); + method public java.lang.String getRealm(); + method public java.lang.String getScheme(); + method public int match(org.apache.http.auth.AuthScope); + field public static final org.apache.http.auth.AuthScope ANY; + field public static final java.lang.String ANY_HOST; + field public static final int ANY_PORT = -1; // 0xffffffff + field public static final java.lang.String ANY_REALM; + field public static final java.lang.String ANY_SCHEME; + } + + public class AuthState { + ctor public AuthState(); + method public org.apache.http.auth.AuthScheme getAuthScheme(); + method public org.apache.http.auth.AuthScope getAuthScope(); + method public org.apache.http.auth.Credentials getCredentials(); + method public void invalidate(); + method public boolean isValid(); + method public void setAuthScheme(org.apache.http.auth.AuthScheme); + method public void setAuthScope(org.apache.http.auth.AuthScope); + method public void setCredentials(org.apache.http.auth.Credentials); + } + + public class AuthenticationException extends org.apache.http.ProtocolException { + ctor public AuthenticationException(); + ctor public AuthenticationException(java.lang.String); + ctor public AuthenticationException(java.lang.String, java.lang.Throwable); + } + + public final class BasicUserPrincipal implements java.security.Principal { + ctor public BasicUserPrincipal(java.lang.String); + method public java.lang.String getName(); + } + + public abstract interface Credentials { + method public abstract java.lang.String getPassword(); + method public abstract java.security.Principal getUserPrincipal(); + } + + public class InvalidCredentialsException extends org.apache.http.auth.AuthenticationException { + ctor public InvalidCredentialsException(); + ctor public InvalidCredentialsException(java.lang.String); + ctor public InvalidCredentialsException(java.lang.String, java.lang.Throwable); + } + + public class MalformedChallengeException extends org.apache.http.ProtocolException { + ctor public MalformedChallengeException(); + ctor public MalformedChallengeException(java.lang.String); + ctor public MalformedChallengeException(java.lang.String, java.lang.Throwable); + } + + public class NTCredentials implements org.apache.http.auth.Credentials { + ctor public NTCredentials(java.lang.String); + ctor public NTCredentials(java.lang.String, java.lang.String, java.lang.String, java.lang.String); + method public java.lang.String getDomain(); + method public java.lang.String getPassword(); + method public java.lang.String getUserName(); + method public java.security.Principal getUserPrincipal(); + method public java.lang.String getWorkstation(); + } + + public class NTUserPrincipal implements java.security.Principal { + ctor public NTUserPrincipal(java.lang.String, java.lang.String); + method public java.lang.String getDomain(); + method public java.lang.String getName(); + method public java.lang.String getUsername(); + } + + public class UsernamePasswordCredentials implements org.apache.http.auth.Credentials { + ctor public UsernamePasswordCredentials(java.lang.String); + ctor public UsernamePasswordCredentials(java.lang.String, java.lang.String); + method public java.lang.String getPassword(); + method public java.lang.String getUserName(); + method public java.security.Principal getUserPrincipal(); + } + +} + +package org.apache.http.auth.params { + + public abstract interface AuthPNames { + field public static final java.lang.String CREDENTIAL_CHARSET = "http.auth.credential-charset"; + } + + public class AuthParamBean extends org.apache.http.params.HttpAbstractParamBean { + ctor public AuthParamBean(org.apache.http.params.HttpParams); + method public void setCredentialCharset(java.lang.String); + } + + public final class AuthParams { + method public static java.lang.String getCredentialCharset(org.apache.http.params.HttpParams); + method public static void setCredentialCharset(org.apache.http.params.HttpParams, java.lang.String); + } + +} + +package org.apache.http.client { + + public abstract interface AuthenticationHandler { + method public abstract java.util.Map getChallenges(org.apache.http.HttpResponse, org.apache.http.protocol.HttpContext) throws org.apache.http.auth.MalformedChallengeException; + method public abstract boolean isAuthenticationRequested(org.apache.http.HttpResponse, org.apache.http.protocol.HttpContext); + method public abstract org.apache.http.auth.AuthScheme selectScheme(java.util.Map, org.apache.http.HttpResponse, org.apache.http.protocol.HttpContext) throws org.apache.http.auth.AuthenticationException; + } + + public class CircularRedirectException extends org.apache.http.client.RedirectException { + ctor public CircularRedirectException(); + ctor public CircularRedirectException(java.lang.String); + ctor public CircularRedirectException(java.lang.String, java.lang.Throwable); + } + + public class ClientProtocolException extends java.io.IOException { + ctor public ClientProtocolException(); + ctor public ClientProtocolException(java.lang.String); + ctor public ClientProtocolException(java.lang.Throwable); + ctor public ClientProtocolException(java.lang.String, java.lang.Throwable); + } + + public abstract interface CookieStore { + method public abstract void addCookie(org.apache.http.cookie.Cookie); + method public abstract void clear(); + method public abstract boolean clearExpired(java.util.Date); + method public abstract java.util.List getCookies(); + } + + public abstract interface CredentialsProvider { + method public abstract void clear(); + method public abstract org.apache.http.auth.Credentials getCredentials(org.apache.http.auth.AuthScope); + method public abstract void setCredentials(org.apache.http.auth.AuthScope, org.apache.http.auth.Credentials); + } + + public abstract interface HttpClient { + method public abstract org.apache.http.HttpResponse execute(org.apache.http.client.methods.HttpUriRequest) throws org.apache.http.client.ClientProtocolException, java.io.IOException; + method public abstract org.apache.http.HttpResponse execute(org.apache.http.client.methods.HttpUriRequest, org.apache.http.protocol.HttpContext) throws org.apache.http.client.ClientProtocolException, java.io.IOException; + method public abstract org.apache.http.HttpResponse execute(org.apache.http.HttpHost, org.apache.http.HttpRequest) throws org.apache.http.client.ClientProtocolException, java.io.IOException; + method public abstract org.apache.http.HttpResponse execute(org.apache.http.HttpHost, org.apache.http.HttpRequest, org.apache.http.protocol.HttpContext) throws org.apache.http.client.ClientProtocolException, java.io.IOException; + method public abstract T execute(org.apache.http.client.methods.HttpUriRequest, org.apache.http.client.ResponseHandler) throws org.apache.http.client.ClientProtocolException, java.io.IOException; + method public abstract T execute(org.apache.http.client.methods.HttpUriRequest, org.apache.http.client.ResponseHandler, org.apache.http.protocol.HttpContext) throws org.apache.http.client.ClientProtocolException, java.io.IOException; + method public abstract T execute(org.apache.http.HttpHost, org.apache.http.HttpRequest, org.apache.http.client.ResponseHandler) throws org.apache.http.client.ClientProtocolException, java.io.IOException; + method public abstract T execute(org.apache.http.HttpHost, org.apache.http.HttpRequest, org.apache.http.client.ResponseHandler, org.apache.http.protocol.HttpContext) throws org.apache.http.client.ClientProtocolException, java.io.IOException; + method public abstract org.apache.http.conn.ClientConnectionManager getConnectionManager(); + method public abstract org.apache.http.params.HttpParams getParams(); + } + + public abstract interface HttpRequestRetryHandler { + method public abstract boolean retryRequest(java.io.IOException, int, org.apache.http.protocol.HttpContext); + } + + public class HttpResponseException extends org.apache.http.client.ClientProtocolException { + ctor public HttpResponseException(int, java.lang.String); + method public int getStatusCode(); + } + + public class NonRepeatableRequestException extends org.apache.http.ProtocolException { + ctor public NonRepeatableRequestException(); + ctor public NonRepeatableRequestException(java.lang.String); + } + + public class RedirectException extends org.apache.http.ProtocolException { + ctor public RedirectException(); + ctor public RedirectException(java.lang.String); + ctor public RedirectException(java.lang.String, java.lang.Throwable); + } + + public abstract interface RedirectHandler { + method public abstract java.net.URI getLocationURI(org.apache.http.HttpResponse, org.apache.http.protocol.HttpContext) throws org.apache.http.ProtocolException; + method public abstract boolean isRedirectRequested(org.apache.http.HttpResponse, org.apache.http.protocol.HttpContext); + } + + public abstract interface RequestDirector { + method public abstract org.apache.http.HttpResponse execute(org.apache.http.HttpHost, org.apache.http.HttpRequest, org.apache.http.protocol.HttpContext) throws org.apache.http.HttpException, java.io.IOException; + } + + public abstract interface ResponseHandler { + method public abstract T handleResponse(org.apache.http.HttpResponse) throws org.apache.http.client.ClientProtocolException, java.io.IOException; + } + + public abstract interface UserTokenHandler { + method public abstract java.lang.Object getUserToken(org.apache.http.protocol.HttpContext); + } + +} + +package org.apache.http.client.entity { + + public class UrlEncodedFormEntity extends org.apache.http.entity.StringEntity { + ctor public UrlEncodedFormEntity(java.util.List, java.lang.String) throws java.io.UnsupportedEncodingException; + ctor public UrlEncodedFormEntity(java.util.List) throws java.io.UnsupportedEncodingException; + } + +} + +package org.apache.http.client.methods { + + public abstract interface AbortableHttpRequest { + method public abstract void abort(); + method public abstract void setConnectionRequest(org.apache.http.conn.ClientConnectionRequest) throws java.io.IOException; + method public abstract void setReleaseTrigger(org.apache.http.conn.ConnectionReleaseTrigger) throws java.io.IOException; + } + + public class HttpDelete extends org.apache.http.client.methods.HttpRequestBase { + ctor public HttpDelete(); + ctor public HttpDelete(java.net.URI); + ctor public HttpDelete(java.lang.String); + method public java.lang.String getMethod(); + field public static final java.lang.String METHOD_NAME = "DELETE"; + } + + public abstract class HttpEntityEnclosingRequestBase extends org.apache.http.client.methods.HttpRequestBase implements org.apache.http.HttpEntityEnclosingRequest { + ctor public HttpEntityEnclosingRequestBase(); + method public boolean expectContinue(); + method public org.apache.http.HttpEntity getEntity(); + method public void setEntity(org.apache.http.HttpEntity); + } + + public class HttpGet extends org.apache.http.client.methods.HttpRequestBase { + ctor public HttpGet(); + ctor public HttpGet(java.net.URI); + ctor public HttpGet(java.lang.String); + method public java.lang.String getMethod(); + field public static final java.lang.String METHOD_NAME = "GET"; + } + + public class HttpHead extends org.apache.http.client.methods.HttpRequestBase { + ctor public HttpHead(); + ctor public HttpHead(java.net.URI); + ctor public HttpHead(java.lang.String); + method public java.lang.String getMethod(); + field public static final java.lang.String METHOD_NAME = "HEAD"; + } + + public class HttpOptions extends org.apache.http.client.methods.HttpRequestBase { + ctor public HttpOptions(); + ctor public HttpOptions(java.net.URI); + ctor public HttpOptions(java.lang.String); + method public java.util.Set getAllowedMethods(org.apache.http.HttpResponse); + method public java.lang.String getMethod(); + field public static final java.lang.String METHOD_NAME = "OPTIONS"; + } + + public class HttpPost extends org.apache.http.client.methods.HttpEntityEnclosingRequestBase { + ctor public HttpPost(); + ctor public HttpPost(java.net.URI); + ctor public HttpPost(java.lang.String); + method public java.lang.String getMethod(); + field public static final java.lang.String METHOD_NAME = "POST"; + } + + public class HttpPut extends org.apache.http.client.methods.HttpEntityEnclosingRequestBase { + ctor public HttpPut(); + ctor public HttpPut(java.net.URI); + ctor public HttpPut(java.lang.String); + method public java.lang.String getMethod(); + field public static final java.lang.String METHOD_NAME = "PUT"; + } + + public abstract class HttpRequestBase extends org.apache.http.message.AbstractHttpMessage implements org.apache.http.client.methods.AbortableHttpRequest java.lang.Cloneable org.apache.http.client.methods.HttpUriRequest { + ctor public HttpRequestBase(); + method public void abort(); + method public java.lang.Object clone() throws java.lang.CloneNotSupportedException; + method public abstract java.lang.String getMethod(); + method public org.apache.http.ProtocolVersion getProtocolVersion(); + method public org.apache.http.RequestLine getRequestLine(); + method public java.net.URI getURI(); + method public boolean isAborted(); + method public void setConnectionRequest(org.apache.http.conn.ClientConnectionRequest) throws java.io.IOException; + method public void setReleaseTrigger(org.apache.http.conn.ConnectionReleaseTrigger) throws java.io.IOException; + method public void setURI(java.net.URI); + } + + public class HttpTrace extends org.apache.http.client.methods.HttpRequestBase { + ctor public HttpTrace(); + ctor public HttpTrace(java.net.URI); + ctor public HttpTrace(java.lang.String); + method public java.lang.String getMethod(); + field public static final java.lang.String METHOD_NAME = "TRACE"; + } + + public abstract interface HttpUriRequest implements org.apache.http.HttpRequest { + method public abstract void abort() throws java.lang.UnsupportedOperationException; + method public abstract java.lang.String getMethod(); + method public abstract java.net.URI getURI(); + method public abstract boolean isAborted(); + } + +} + +package org.apache.http.client.params { + + public abstract interface AllClientPNames implements org.apache.http.auth.params.AuthPNames org.apache.http.client.params.ClientPNames org.apache.http.conn.params.ConnConnectionPNames org.apache.http.conn.params.ConnManagerPNames org.apache.http.conn.params.ConnRoutePNames org.apache.http.cookie.params.CookieSpecPNames org.apache.http.params.CoreConnectionPNames org.apache.http.params.CoreProtocolPNames { + } + + public final class AuthPolicy { + field public static final java.lang.String BASIC = "Basic"; + field public static final java.lang.String DIGEST = "Digest"; + field public static final java.lang.String NTLM = "NTLM"; + } + + public abstract interface ClientPNames { + field public static final java.lang.String ALLOW_CIRCULAR_REDIRECTS = "http.protocol.allow-circular-redirects"; + field public static final java.lang.String CONNECTION_MANAGER_FACTORY = "http.connection-manager.factory-object"; + field public static final java.lang.String CONNECTION_MANAGER_FACTORY_CLASS_NAME = "http.connection-manager.factory-class-name"; + field public static final java.lang.String COOKIE_POLICY = "http.protocol.cookie-policy"; + field public static final java.lang.String DEFAULT_HEADERS = "http.default-headers"; + field public static final java.lang.String DEFAULT_HOST = "http.default-host"; + field public static final java.lang.String HANDLE_AUTHENTICATION = "http.protocol.handle-authentication"; + field public static final java.lang.String HANDLE_REDIRECTS = "http.protocol.handle-redirects"; + field public static final java.lang.String MAX_REDIRECTS = "http.protocol.max-redirects"; + field public static final java.lang.String REJECT_RELATIVE_REDIRECT = "http.protocol.reject-relative-redirect"; + field public static final java.lang.String VIRTUAL_HOST = "http.virtual-host"; + } + + public class ClientParamBean extends org.apache.http.params.HttpAbstractParamBean { + ctor public ClientParamBean(org.apache.http.params.HttpParams); + method public void setAllowCircularRedirects(boolean); + method public void setConnectionManagerFactory(org.apache.http.conn.ClientConnectionManagerFactory); + method public void setConnectionManagerFactoryClassName(java.lang.String); + method public void setCookiePolicy(java.lang.String); + method public void setDefaultHeaders(java.util.Collection); + method public void setDefaultHost(org.apache.http.HttpHost); + method public void setHandleAuthentication(boolean); + method public void setHandleRedirects(boolean); + method public void setMaxRedirects(int); + method public void setRejectRelativeRedirect(boolean); + method public void setVirtualHost(org.apache.http.HttpHost); + } + + public final class CookiePolicy { + field public static final java.lang.String BEST_MATCH = "best-match"; + field public static final java.lang.String BROWSER_COMPATIBILITY = "compatibility"; + field public static final java.lang.String NETSCAPE = "netscape"; + field public static final java.lang.String RFC_2109 = "rfc2109"; + field public static final java.lang.String RFC_2965 = "rfc2965"; + } + + public class HttpClientParams { + method public static java.lang.String getCookiePolicy(org.apache.http.params.HttpParams); + method public static boolean isAuthenticating(org.apache.http.params.HttpParams); + method public static boolean isRedirecting(org.apache.http.params.HttpParams); + method public static void setAuthenticating(org.apache.http.params.HttpParams, boolean); + method public static void setCookiePolicy(org.apache.http.params.HttpParams, java.lang.String); + method public static void setRedirecting(org.apache.http.params.HttpParams, boolean); + } + +} + +package org.apache.http.client.protocol { + + public abstract interface ClientContext { + field public static final java.lang.String AUTHSCHEME_REGISTRY = "http.authscheme-registry"; + field public static final java.lang.String AUTH_SCHEME_PREF = "http.auth.scheme-pref"; + field public static final java.lang.String COOKIESPEC_REGISTRY = "http.cookiespec-registry"; + field public static final java.lang.String COOKIE_ORIGIN = "http.cookie-origin"; + field public static final java.lang.String COOKIE_SPEC = "http.cookie-spec"; + field public static final java.lang.String COOKIE_STORE = "http.cookie-store"; + field public static final java.lang.String CREDS_PROVIDER = "http.auth.credentials-provider"; + field public static final java.lang.String PROXY_AUTH_STATE = "http.auth.proxy-scope"; + field public static final java.lang.String TARGET_AUTH_STATE = "http.auth.target-scope"; + field public static final java.lang.String USER_TOKEN = "http.user-token"; + } + + public class ClientContextConfigurer implements org.apache.http.client.protocol.ClientContext { + ctor public ClientContextConfigurer(org.apache.http.protocol.HttpContext); + method public void setAuthSchemePref(java.util.List); + method public void setAuthSchemeRegistry(org.apache.http.auth.AuthSchemeRegistry); + method public void setCookieSpecRegistry(org.apache.http.cookie.CookieSpecRegistry); + method public void setCookieStore(org.apache.http.client.CookieStore); + method public void setCredentialsProvider(org.apache.http.client.CredentialsProvider); + } + + public class RequestAddCookies implements org.apache.http.HttpRequestInterceptor { + ctor public RequestAddCookies(); + method public void process(org.apache.http.HttpRequest, org.apache.http.protocol.HttpContext) throws org.apache.http.HttpException, java.io.IOException; + } + + public class RequestDefaultHeaders implements org.apache.http.HttpRequestInterceptor { + ctor public RequestDefaultHeaders(); + method public void process(org.apache.http.HttpRequest, org.apache.http.protocol.HttpContext) throws org.apache.http.HttpException, java.io.IOException; + } + + public class RequestProxyAuthentication implements org.apache.http.HttpRequestInterceptor { + ctor public RequestProxyAuthentication(); + method public void process(org.apache.http.HttpRequest, org.apache.http.protocol.HttpContext) throws org.apache.http.HttpException, java.io.IOException; + } + + public class RequestTargetAuthentication implements org.apache.http.HttpRequestInterceptor { + ctor public RequestTargetAuthentication(); + method public void process(org.apache.http.HttpRequest, org.apache.http.protocol.HttpContext) throws org.apache.http.HttpException, java.io.IOException; + } + + public class ResponseProcessCookies implements org.apache.http.HttpResponseInterceptor { + ctor public ResponseProcessCookies(); + method public void process(org.apache.http.HttpResponse, org.apache.http.protocol.HttpContext) throws org.apache.http.HttpException, java.io.IOException; + } + +} + +package org.apache.http.client.utils { + + public class CloneUtils { + method public static java.lang.Object clone(java.lang.Object) throws java.lang.CloneNotSupportedException; + } + + public class URIUtils { + method public static java.net.URI createURI(java.lang.String, java.lang.String, int, java.lang.String, java.lang.String, java.lang.String) throws java.net.URISyntaxException; + method public static java.net.URI resolve(java.net.URI, java.lang.String); + method public static java.net.URI resolve(java.net.URI, java.net.URI); + method public static java.net.URI rewriteURI(java.net.URI, org.apache.http.HttpHost, boolean) throws java.net.URISyntaxException; + method public static java.net.URI rewriteURI(java.net.URI, org.apache.http.HttpHost) throws java.net.URISyntaxException; + } + + public class URLEncodedUtils { + ctor public URLEncodedUtils(); + method public static java.lang.String format(java.util.List, java.lang.String); + method public static boolean isEncoded(org.apache.http.HttpEntity); + method public static java.util.List parse(java.net.URI, java.lang.String); + method public static java.util.List parse(org.apache.http.HttpEntity) throws java.io.IOException; + method public static void parse(java.util.List, java.util.Scanner, java.lang.String); + field public static final java.lang.String CONTENT_TYPE = "application/x-www-form-urlencoded"; + } + +} + +package org.apache.http.conn { + + public class BasicEofSensorWatcher implements org.apache.http.conn.EofSensorWatcher { + ctor public BasicEofSensorWatcher(org.apache.http.conn.ManagedClientConnection, boolean); + method public boolean eofDetected(java.io.InputStream) throws java.io.IOException; + method public boolean streamAbort(java.io.InputStream) throws java.io.IOException; + method public boolean streamClosed(java.io.InputStream) throws java.io.IOException; + field protected boolean attemptReuse; + field protected org.apache.http.conn.ManagedClientConnection managedConn; + } + + public class BasicManagedEntity extends org.apache.http.entity.HttpEntityWrapper implements org.apache.http.conn.ConnectionReleaseTrigger org.apache.http.conn.EofSensorWatcher { + ctor public BasicManagedEntity(org.apache.http.HttpEntity, org.apache.http.conn.ManagedClientConnection, boolean); + method public void abortConnection() throws java.io.IOException; + method public boolean eofDetected(java.io.InputStream) throws java.io.IOException; + method public void releaseConnection() throws java.io.IOException; + method protected void releaseManagedConnection() throws java.io.IOException; + method public boolean streamAbort(java.io.InputStream) throws java.io.IOException; + method public boolean streamClosed(java.io.InputStream) throws java.io.IOException; + field protected final boolean attemptReuse; + field protected org.apache.http.conn.ManagedClientConnection managedConn; + } + + public abstract interface ClientConnectionManager { + method public abstract void closeExpiredConnections(); + method public abstract void closeIdleConnections(long, java.util.concurrent.TimeUnit); + method public abstract org.apache.http.conn.scheme.SchemeRegistry getSchemeRegistry(); + method public abstract void releaseConnection(org.apache.http.conn.ManagedClientConnection, long, java.util.concurrent.TimeUnit); + method public abstract org.apache.http.conn.ClientConnectionRequest requestConnection(org.apache.http.conn.routing.HttpRoute, java.lang.Object); + method public abstract void shutdown(); + } + + public abstract interface ClientConnectionManagerFactory { + method public abstract org.apache.http.conn.ClientConnectionManager newInstance(org.apache.http.params.HttpParams, org.apache.http.conn.scheme.SchemeRegistry); + } + + public abstract interface ClientConnectionOperator { + method public abstract org.apache.http.conn.OperatedClientConnection createConnection(); + method public abstract void openConnection(org.apache.http.conn.OperatedClientConnection, org.apache.http.HttpHost, java.net.InetAddress, org.apache.http.protocol.HttpContext, org.apache.http.params.HttpParams) throws java.io.IOException; + method public abstract void updateSecureConnection(org.apache.http.conn.OperatedClientConnection, org.apache.http.HttpHost, org.apache.http.protocol.HttpContext, org.apache.http.params.HttpParams) throws java.io.IOException; + } + + public abstract interface ClientConnectionRequest { + method public abstract void abortRequest(); + method public abstract org.apache.http.conn.ManagedClientConnection getConnection(long, java.util.concurrent.TimeUnit) throws org.apache.http.conn.ConnectionPoolTimeoutException, java.lang.InterruptedException; + } + + public class ConnectTimeoutException extends java.io.InterruptedIOException { + ctor public ConnectTimeoutException(); + ctor public ConnectTimeoutException(java.lang.String); + } + + public abstract interface ConnectionKeepAliveStrategy { + method public abstract long getKeepAliveDuration(org.apache.http.HttpResponse, org.apache.http.protocol.HttpContext); + } + + public class ConnectionPoolTimeoutException extends org.apache.http.conn.ConnectTimeoutException { + ctor public ConnectionPoolTimeoutException(); + ctor public ConnectionPoolTimeoutException(java.lang.String); + } + + public abstract interface ConnectionReleaseTrigger { + method public abstract void abortConnection() throws java.io.IOException; + method public abstract void releaseConnection() throws java.io.IOException; + } + + public class EofSensorInputStream extends java.io.InputStream implements org.apache.http.conn.ConnectionReleaseTrigger { + ctor public EofSensorInputStream(java.io.InputStream, org.apache.http.conn.EofSensorWatcher); + method public void abortConnection() throws java.io.IOException; + method protected void checkAbort() throws java.io.IOException; + method protected void checkClose() throws java.io.IOException; + method protected void checkEOF(int) throws java.io.IOException; + method protected boolean isReadAllowed() throws java.io.IOException; + method public int read() throws java.io.IOException; + method public void releaseConnection() throws java.io.IOException; + field protected java.io.InputStream wrappedStream; + } + + public abstract interface EofSensorWatcher { + method public abstract boolean eofDetected(java.io.InputStream) throws java.io.IOException; + method public abstract boolean streamAbort(java.io.InputStream) throws java.io.IOException; + method public abstract boolean streamClosed(java.io.InputStream) throws java.io.IOException; + } + + public class HttpHostConnectException extends java.net.ConnectException { + ctor public HttpHostConnectException(org.apache.http.HttpHost, java.net.ConnectException); + method public org.apache.http.HttpHost getHost(); + } + + public abstract interface ManagedClientConnection implements org.apache.http.conn.ConnectionReleaseTrigger org.apache.http.HttpClientConnection org.apache.http.HttpInetConnection { + method public abstract org.apache.http.conn.routing.HttpRoute getRoute(); + method public abstract javax.net.ssl.SSLSession getSSLSession(); + method public abstract java.lang.Object getState(); + method public abstract boolean isMarkedReusable(); + method public abstract boolean isSecure(); + method public abstract void layerProtocol(org.apache.http.protocol.HttpContext, org.apache.http.params.HttpParams) throws java.io.IOException; + method public abstract void markReusable(); + method public abstract void open(org.apache.http.conn.routing.HttpRoute, org.apache.http.protocol.HttpContext, org.apache.http.params.HttpParams) throws java.io.IOException; + method public abstract void setIdleDuration(long, java.util.concurrent.TimeUnit); + method public abstract void setState(java.lang.Object); + method public abstract void tunnelProxy(org.apache.http.HttpHost, boolean, org.apache.http.params.HttpParams) throws java.io.IOException; + method public abstract void tunnelTarget(boolean, org.apache.http.params.HttpParams) throws java.io.IOException; + method public abstract void unmarkReusable(); + } + + public final class MultihomePlainSocketFactory implements org.apache.http.conn.scheme.SocketFactory { + method public java.net.Socket connectSocket(java.net.Socket, java.lang.String, int, java.net.InetAddress, int, org.apache.http.params.HttpParams) throws java.io.IOException; + method public java.net.Socket createSocket(); + method public static org.apache.http.conn.MultihomePlainSocketFactory getSocketFactory(); + method public final boolean isSecure(java.net.Socket) throws java.lang.IllegalArgumentException; + } + + public abstract interface OperatedClientConnection implements org.apache.http.HttpClientConnection org.apache.http.HttpInetConnection { + method public abstract java.net.Socket getSocket(); + method public abstract org.apache.http.HttpHost getTargetHost(); + method public abstract boolean isSecure(); + method public abstract void openCompleted(boolean, org.apache.http.params.HttpParams) throws java.io.IOException; + method public abstract void opening(java.net.Socket, org.apache.http.HttpHost) throws java.io.IOException; + method public abstract void update(java.net.Socket, org.apache.http.HttpHost, boolean, org.apache.http.params.HttpParams) throws java.io.IOException; + } + +} + +package org.apache.http.conn.params { + + public abstract interface ConnConnectionPNames { + field public static final java.lang.String MAX_STATUS_LINE_GARBAGE = "http.connection.max-status-line-garbage"; + } + + public class ConnConnectionParamBean extends org.apache.http.params.HttpAbstractParamBean { + ctor public ConnConnectionParamBean(org.apache.http.params.HttpParams); + method public void setMaxStatusLineGarbage(int); + } + + public abstract interface ConnManagerPNames { + field public static final java.lang.String MAX_CONNECTIONS_PER_ROUTE = "http.conn-manager.max-per-route"; + field public static final java.lang.String MAX_TOTAL_CONNECTIONS = "http.conn-manager.max-total"; + field public static final java.lang.String TIMEOUT = "http.conn-manager.timeout"; + } + + public class ConnManagerParamBean extends org.apache.http.params.HttpAbstractParamBean { + ctor public ConnManagerParamBean(org.apache.http.params.HttpParams); + method public void setConnectionsPerRoute(org.apache.http.conn.params.ConnPerRouteBean); + method public void setMaxTotalConnections(int); + method public void setTimeout(long); + } + + public final class ConnManagerParams implements org.apache.http.conn.params.ConnManagerPNames { + ctor public ConnManagerParams(); + method public static org.apache.http.conn.params.ConnPerRoute getMaxConnectionsPerRoute(org.apache.http.params.HttpParams); + method public static int getMaxTotalConnections(org.apache.http.params.HttpParams); + method public static long getTimeout(org.apache.http.params.HttpParams); + method public static void setMaxConnectionsPerRoute(org.apache.http.params.HttpParams, org.apache.http.conn.params.ConnPerRoute); + method public static void setMaxTotalConnections(org.apache.http.params.HttpParams, int); + method public static void setTimeout(org.apache.http.params.HttpParams, long); + field public static final int DEFAULT_MAX_TOTAL_CONNECTIONS = 20; // 0x14 + } + + public abstract interface ConnPerRoute { + method public abstract int getMaxForRoute(org.apache.http.conn.routing.HttpRoute); + } + + public final class ConnPerRouteBean implements org.apache.http.conn.params.ConnPerRoute { + ctor public ConnPerRouteBean(int); + ctor public ConnPerRouteBean(); + method public int getDefaultMax(); + method public int getMaxForRoute(org.apache.http.conn.routing.HttpRoute); + method public void setDefaultMaxPerRoute(int); + method public void setMaxForRoute(org.apache.http.conn.routing.HttpRoute, int); + method public void setMaxForRoutes(java.util.Map); + field public static final int DEFAULT_MAX_CONNECTIONS_PER_ROUTE = 2; // 0x2 + } + + public abstract interface ConnRoutePNames { + field public static final java.lang.String DEFAULT_PROXY = "http.route.default-proxy"; + field public static final java.lang.String FORCED_ROUTE = "http.route.forced-route"; + field public static final java.lang.String LOCAL_ADDRESS = "http.route.local-address"; + } + + public class ConnRouteParamBean extends org.apache.http.params.HttpAbstractParamBean { + ctor public ConnRouteParamBean(org.apache.http.params.HttpParams); + method public void setDefaultProxy(org.apache.http.HttpHost); + method public void setForcedRoute(org.apache.http.conn.routing.HttpRoute); + method public void setLocalAddress(java.net.InetAddress); + } + + public class ConnRouteParams implements org.apache.http.conn.params.ConnRoutePNames { + method public static org.apache.http.HttpHost getDefaultProxy(org.apache.http.params.HttpParams); + method public static org.apache.http.conn.routing.HttpRoute getForcedRoute(org.apache.http.params.HttpParams); + method public static java.net.InetAddress getLocalAddress(org.apache.http.params.HttpParams); + method public static void setDefaultProxy(org.apache.http.params.HttpParams, org.apache.http.HttpHost); + method public static void setForcedRoute(org.apache.http.params.HttpParams, org.apache.http.conn.routing.HttpRoute); + method public static void setLocalAddress(org.apache.http.params.HttpParams, java.net.InetAddress); + field public static final org.apache.http.HttpHost NO_HOST; + field public static final org.apache.http.conn.routing.HttpRoute NO_ROUTE; + } + +} + +package org.apache.http.conn.routing { + + public class BasicRouteDirector implements org.apache.http.conn.routing.HttpRouteDirector { + ctor public BasicRouteDirector(); + method protected int directStep(org.apache.http.conn.routing.RouteInfo, org.apache.http.conn.routing.RouteInfo); + method protected int firstStep(org.apache.http.conn.routing.RouteInfo); + method public int nextStep(org.apache.http.conn.routing.RouteInfo, org.apache.http.conn.routing.RouteInfo); + method protected int proxiedStep(org.apache.http.conn.routing.RouteInfo, org.apache.http.conn.routing.RouteInfo); + } + + public final class HttpRoute implements java.lang.Cloneable org.apache.http.conn.routing.RouteInfo { + ctor public HttpRoute(org.apache.http.HttpHost, java.net.InetAddress, org.apache.http.HttpHost[], boolean, org.apache.http.conn.routing.RouteInfo.TunnelType, org.apache.http.conn.routing.RouteInfo.LayerType); + ctor public HttpRoute(org.apache.http.HttpHost, java.net.InetAddress, org.apache.http.HttpHost, boolean, org.apache.http.conn.routing.RouteInfo.TunnelType, org.apache.http.conn.routing.RouteInfo.LayerType); + ctor public HttpRoute(org.apache.http.HttpHost, java.net.InetAddress, boolean); + ctor public HttpRoute(org.apache.http.HttpHost); + ctor public HttpRoute(org.apache.http.HttpHost, java.net.InetAddress, org.apache.http.HttpHost, boolean); + method public java.lang.Object clone() throws java.lang.CloneNotSupportedException; + method public final boolean equals(java.lang.Object); + method public final int getHopCount(); + method public final org.apache.http.HttpHost getHopTarget(int); + method public final org.apache.http.conn.routing.RouteInfo.LayerType getLayerType(); + method public final java.net.InetAddress getLocalAddress(); + method public final org.apache.http.HttpHost getProxyHost(); + method public final org.apache.http.HttpHost getTargetHost(); + method public final org.apache.http.conn.routing.RouteInfo.TunnelType getTunnelType(); + method public final int hashCode(); + method public final boolean isLayered(); + method public final boolean isSecure(); + method public final boolean isTunnelled(); + method public final java.lang.String toString(); + } + + public abstract interface HttpRouteDirector { + method public abstract int nextStep(org.apache.http.conn.routing.RouteInfo, org.apache.http.conn.routing.RouteInfo); + field public static final int COMPLETE = 0; // 0x0 + field public static final int CONNECT_PROXY = 2; // 0x2 + field public static final int CONNECT_TARGET = 1; // 0x1 + field public static final int LAYER_PROTOCOL = 5; // 0x5 + field public static final int TUNNEL_PROXY = 4; // 0x4 + field public static final int TUNNEL_TARGET = 3; // 0x3 + field public static final int UNREACHABLE = -1; // 0xffffffff + } + + public abstract interface HttpRoutePlanner { + method public abstract org.apache.http.conn.routing.HttpRoute determineRoute(org.apache.http.HttpHost, org.apache.http.HttpRequest, org.apache.http.protocol.HttpContext) throws org.apache.http.HttpException; + } + + public abstract interface RouteInfo { + method public abstract int getHopCount(); + method public abstract org.apache.http.HttpHost getHopTarget(int); + method public abstract org.apache.http.conn.routing.RouteInfo.LayerType getLayerType(); + method public abstract java.net.InetAddress getLocalAddress(); + method public abstract org.apache.http.HttpHost getProxyHost(); + method public abstract org.apache.http.HttpHost getTargetHost(); + method public abstract org.apache.http.conn.routing.RouteInfo.TunnelType getTunnelType(); + method public abstract boolean isLayered(); + method public abstract boolean isSecure(); + method public abstract boolean isTunnelled(); + } + + public static final class RouteInfo.LayerType extends java.lang.Enum { + method public static org.apache.http.conn.routing.RouteInfo.LayerType valueOf(java.lang.String); + method public static final org.apache.http.conn.routing.RouteInfo.LayerType[] values(); + enum_constant public static final org.apache.http.conn.routing.RouteInfo.LayerType LAYERED; + enum_constant public static final org.apache.http.conn.routing.RouteInfo.LayerType PLAIN; + } + + public static final class RouteInfo.TunnelType extends java.lang.Enum { + method public static org.apache.http.conn.routing.RouteInfo.TunnelType valueOf(java.lang.String); + method public static final org.apache.http.conn.routing.RouteInfo.TunnelType[] values(); + enum_constant public static final org.apache.http.conn.routing.RouteInfo.TunnelType PLAIN; + enum_constant public static final org.apache.http.conn.routing.RouteInfo.TunnelType TUNNELLED; + } + + public final class RouteTracker implements java.lang.Cloneable org.apache.http.conn.routing.RouteInfo { + ctor public RouteTracker(org.apache.http.HttpHost, java.net.InetAddress); + ctor public RouteTracker(org.apache.http.conn.routing.HttpRoute); + method public java.lang.Object clone() throws java.lang.CloneNotSupportedException; + method public final void connectProxy(org.apache.http.HttpHost, boolean); + method public final void connectTarget(boolean); + method public final boolean equals(java.lang.Object); + method public final int getHopCount(); + method public final org.apache.http.HttpHost getHopTarget(int); + method public final org.apache.http.conn.routing.RouteInfo.LayerType getLayerType(); + method public final java.net.InetAddress getLocalAddress(); + method public final org.apache.http.HttpHost getProxyHost(); + method public final org.apache.http.HttpHost getTargetHost(); + method public final org.apache.http.conn.routing.RouteInfo.TunnelType getTunnelType(); + method public final int hashCode(); + method public final boolean isConnected(); + method public final boolean isLayered(); + method public final boolean isSecure(); + method public final boolean isTunnelled(); + method public final void layerProtocol(boolean); + method public final org.apache.http.conn.routing.HttpRoute toRoute(); + method public final java.lang.String toString(); + method public final void tunnelProxy(org.apache.http.HttpHost, boolean); + method public final void tunnelTarget(boolean); + } + +} + +package org.apache.http.conn.scheme { + + public abstract interface HostNameResolver { + method public abstract java.net.InetAddress resolve(java.lang.String) throws java.io.IOException; + } + + public abstract interface LayeredSocketFactory implements org.apache.http.conn.scheme.SocketFactory { + method public abstract java.net.Socket createSocket(java.net.Socket, java.lang.String, int, boolean) throws java.io.IOException, java.net.UnknownHostException; + } + + public final class PlainSocketFactory implements org.apache.http.conn.scheme.SocketFactory { + ctor public PlainSocketFactory(org.apache.http.conn.scheme.HostNameResolver); + ctor public PlainSocketFactory(); + method public java.net.Socket connectSocket(java.net.Socket, java.lang.String, int, java.net.InetAddress, int, org.apache.http.params.HttpParams) throws java.io.IOException; + method public java.net.Socket createSocket(); + method public static org.apache.http.conn.scheme.PlainSocketFactory getSocketFactory(); + method public final boolean isSecure(java.net.Socket) throws java.lang.IllegalArgumentException; + } + + public final class Scheme { + ctor public Scheme(java.lang.String, org.apache.http.conn.scheme.SocketFactory, int); + method public final boolean equals(java.lang.Object); + method public final int getDefaultPort(); + method public final java.lang.String getName(); + method public final org.apache.http.conn.scheme.SocketFactory getSocketFactory(); + method public final boolean isLayered(); + method public final int resolvePort(int); + method public final java.lang.String toString(); + } + + public final class SchemeRegistry { + ctor public SchemeRegistry(); + method public final synchronized org.apache.http.conn.scheme.Scheme get(java.lang.String); + method public final synchronized org.apache.http.conn.scheme.Scheme getScheme(java.lang.String); + method public final synchronized org.apache.http.conn.scheme.Scheme getScheme(org.apache.http.HttpHost); + method public final synchronized java.util.List getSchemeNames(); + method public final synchronized org.apache.http.conn.scheme.Scheme register(org.apache.http.conn.scheme.Scheme); + method public synchronized void setItems(java.util.Map); + method public final synchronized org.apache.http.conn.scheme.Scheme unregister(java.lang.String); + } + + public abstract interface SocketFactory { + method public abstract java.net.Socket connectSocket(java.net.Socket, java.lang.String, int, java.net.InetAddress, int, org.apache.http.params.HttpParams) throws org.apache.http.conn.ConnectTimeoutException, java.io.IOException, java.net.UnknownHostException; + method public abstract java.net.Socket createSocket() throws java.io.IOException; + method public abstract boolean isSecure(java.net.Socket) throws java.lang.IllegalArgumentException; + } + +} + +package org.apache.http.conn.ssl { + + public abstract class AbstractVerifier implements org.apache.http.conn.ssl.X509HostnameVerifier { + ctor public AbstractVerifier(); + method public static boolean acceptableCountryWildcard(java.lang.String); + method public static int countDots(java.lang.String); + method public static java.lang.String[] getCNs(java.security.cert.X509Certificate); + method public static java.lang.String[] getDNSSubjectAlts(java.security.cert.X509Certificate); + method public final void verify(java.lang.String, javax.net.ssl.SSLSocket) throws java.io.IOException; + method public final boolean verify(java.lang.String, javax.net.ssl.SSLSession); + method public final void verify(java.lang.String, java.security.cert.X509Certificate) throws javax.net.ssl.SSLException; + method public final void verify(java.lang.String, java.lang.String[], java.lang.String[], boolean) throws javax.net.ssl.SSLException; + } + + public class AllowAllHostnameVerifier extends org.apache.http.conn.ssl.AbstractVerifier { + ctor public AllowAllHostnameVerifier(); + method public final java.lang.String toString(); + method public final void verify(java.lang.String, java.lang.String[], java.lang.String[]); + } + + public class BrowserCompatHostnameVerifier extends org.apache.http.conn.ssl.AbstractVerifier { + ctor public BrowserCompatHostnameVerifier(); + method public final java.lang.String toString(); + method public final void verify(java.lang.String, java.lang.String[], java.lang.String[]) throws javax.net.ssl.SSLException; + } + + public class SSLSocketFactory implements org.apache.http.conn.scheme.LayeredSocketFactory { + ctor public SSLSocketFactory(java.lang.String, java.security.KeyStore, java.lang.String, java.security.KeyStore, java.security.SecureRandom, org.apache.http.conn.scheme.HostNameResolver) throws java.security.KeyManagementException, java.security.KeyStoreException, java.security.NoSuchAlgorithmException, java.security.UnrecoverableKeyException; + ctor public SSLSocketFactory(java.security.KeyStore, java.lang.String, java.security.KeyStore) throws java.security.KeyManagementException, java.security.KeyStoreException, java.security.NoSuchAlgorithmException, java.security.UnrecoverableKeyException; + ctor public SSLSocketFactory(java.security.KeyStore, java.lang.String) throws java.security.KeyManagementException, java.security.KeyStoreException, java.security.NoSuchAlgorithmException, java.security.UnrecoverableKeyException; + ctor public SSLSocketFactory(java.security.KeyStore) throws java.security.KeyManagementException, java.security.KeyStoreException, java.security.NoSuchAlgorithmException, java.security.UnrecoverableKeyException; + method public java.net.Socket connectSocket(java.net.Socket, java.lang.String, int, java.net.InetAddress, int, org.apache.http.params.HttpParams) throws java.io.IOException; + method public java.net.Socket createSocket() throws java.io.IOException; + method public java.net.Socket createSocket(java.net.Socket, java.lang.String, int, boolean) throws java.io.IOException, java.net.UnknownHostException; + method public org.apache.http.conn.ssl.X509HostnameVerifier getHostnameVerifier(); + method public static org.apache.http.conn.ssl.SSLSocketFactory getSocketFactory(); + method public boolean isSecure(java.net.Socket) throws java.lang.IllegalArgumentException; + method public void setHostnameVerifier(org.apache.http.conn.ssl.X509HostnameVerifier); + field public static final org.apache.http.conn.ssl.X509HostnameVerifier ALLOW_ALL_HOSTNAME_VERIFIER; + field public static final org.apache.http.conn.ssl.X509HostnameVerifier BROWSER_COMPATIBLE_HOSTNAME_VERIFIER; + field public static final java.lang.String SSL = "SSL"; + field public static final java.lang.String SSLV2 = "SSLv2"; + field public static final org.apache.http.conn.ssl.X509HostnameVerifier STRICT_HOSTNAME_VERIFIER; + field public static final java.lang.String TLS = "TLS"; + } + + public class StrictHostnameVerifier extends org.apache.http.conn.ssl.AbstractVerifier { + ctor public StrictHostnameVerifier(); + method public final java.lang.String toString(); + method public final void verify(java.lang.String, java.lang.String[], java.lang.String[]) throws javax.net.ssl.SSLException; + } + + public abstract interface X509HostnameVerifier implements javax.net.ssl.HostnameVerifier { + method public abstract boolean verify(java.lang.String, javax.net.ssl.SSLSession); + method public abstract void verify(java.lang.String, javax.net.ssl.SSLSocket) throws java.io.IOException; + method public abstract void verify(java.lang.String, java.security.cert.X509Certificate) throws javax.net.ssl.SSLException; + method public abstract void verify(java.lang.String, java.lang.String[], java.lang.String[]) throws javax.net.ssl.SSLException; + } + +} + +package org.apache.http.conn.util { + + public class InetAddressUtils { + method public static boolean isIPv4Address(java.lang.String); + method public static boolean isIPv6Address(java.lang.String); + method public static boolean isIPv6HexCompressedAddress(java.lang.String); + method public static boolean isIPv6StdAddress(java.lang.String); + } + +} + +package org.apache.http.cookie { + + public abstract interface ClientCookie implements org.apache.http.cookie.Cookie { + method public abstract boolean containsAttribute(java.lang.String); + method public abstract java.lang.String getAttribute(java.lang.String); + field public static final java.lang.String COMMENTURL_ATTR = "commenturl"; + field public static final java.lang.String COMMENT_ATTR = "comment"; + field public static final java.lang.String DISCARD_ATTR = "discard"; + field public static final java.lang.String DOMAIN_ATTR = "domain"; + field public static final java.lang.String EXPIRES_ATTR = "expires"; + field public static final java.lang.String MAX_AGE_ATTR = "max-age"; + field public static final java.lang.String PATH_ATTR = "path"; + field public static final java.lang.String PORT_ATTR = "port"; + field public static final java.lang.String SECURE_ATTR = "secure"; + field public static final java.lang.String VERSION_ATTR = "version"; + } + + public abstract interface Cookie { + method public abstract java.lang.String getComment(); + method public abstract java.lang.String getCommentURL(); + method public abstract java.lang.String getDomain(); + method public abstract java.util.Date getExpiryDate(); + method public abstract java.lang.String getName(); + method public abstract java.lang.String getPath(); + method public abstract int[] getPorts(); + method public abstract java.lang.String getValue(); + method public abstract int getVersion(); + method public abstract boolean isExpired(java.util.Date); + method public abstract boolean isPersistent(); + method public abstract boolean isSecure(); + } + + public abstract interface CookieAttributeHandler { + method public abstract boolean match(org.apache.http.cookie.Cookie, org.apache.http.cookie.CookieOrigin); + method public abstract void parse(org.apache.http.cookie.SetCookie, java.lang.String) throws org.apache.http.cookie.MalformedCookieException; + method public abstract void validate(org.apache.http.cookie.Cookie, org.apache.http.cookie.CookieOrigin) throws org.apache.http.cookie.MalformedCookieException; + } + + public class CookieIdentityComparator implements java.util.Comparator java.io.Serializable { + ctor public CookieIdentityComparator(); + method public int compare(org.apache.http.cookie.Cookie, org.apache.http.cookie.Cookie); + } + + public final class CookieOrigin { + ctor public CookieOrigin(java.lang.String, int, java.lang.String, boolean); + method public java.lang.String getHost(); + method public java.lang.String getPath(); + method public int getPort(); + method public boolean isSecure(); + } + + public class CookiePathComparator implements java.util.Comparator java.io.Serializable { + ctor public CookiePathComparator(); + method public int compare(org.apache.http.cookie.Cookie, org.apache.http.cookie.Cookie); + } + + public abstract interface CookieSpec { + method public abstract java.util.List formatCookies(java.util.List); + method public abstract int getVersion(); + method public abstract org.apache.http.Header getVersionHeader(); + method public abstract boolean match(org.apache.http.cookie.Cookie, org.apache.http.cookie.CookieOrigin); + method public abstract java.util.List parse(org.apache.http.Header, org.apache.http.cookie.CookieOrigin) throws org.apache.http.cookie.MalformedCookieException; + method public abstract void validate(org.apache.http.cookie.Cookie, org.apache.http.cookie.CookieOrigin) throws org.apache.http.cookie.MalformedCookieException; + } + + public abstract interface CookieSpecFactory { + method public abstract org.apache.http.cookie.CookieSpec newInstance(org.apache.http.params.HttpParams); + } + + public final class CookieSpecRegistry { + ctor public CookieSpecRegistry(); + method public synchronized org.apache.http.cookie.CookieSpec getCookieSpec(java.lang.String, org.apache.http.params.HttpParams) throws java.lang.IllegalStateException; + method public synchronized org.apache.http.cookie.CookieSpec getCookieSpec(java.lang.String) throws java.lang.IllegalStateException; + method public synchronized java.util.List getSpecNames(); + method public synchronized void register(java.lang.String, org.apache.http.cookie.CookieSpecFactory); + method public synchronized void setItems(java.util.Map); + method public synchronized void unregister(java.lang.String); + } + + public class MalformedCookieException extends org.apache.http.ProtocolException { + ctor public MalformedCookieException(); + ctor public MalformedCookieException(java.lang.String); + ctor public MalformedCookieException(java.lang.String, java.lang.Throwable); + } + + public abstract interface SM { + field public static final java.lang.String COOKIE = "Cookie"; + field public static final java.lang.String COOKIE2 = "Cookie2"; + field public static final java.lang.String SET_COOKIE = "Set-Cookie"; + field public static final java.lang.String SET_COOKIE2 = "Set-Cookie2"; + } + + public abstract interface SetCookie implements org.apache.http.cookie.Cookie { + method public abstract void setComment(java.lang.String); + method public abstract void setDomain(java.lang.String); + method public abstract void setExpiryDate(java.util.Date); + method public abstract void setPath(java.lang.String); + method public abstract void setSecure(boolean); + method public abstract void setValue(java.lang.String); + method public abstract void setVersion(int); + } + + public abstract interface SetCookie2 implements org.apache.http.cookie.SetCookie { + method public abstract void setCommentURL(java.lang.String); + method public abstract void setDiscard(boolean); + method public abstract void setPorts(int[]); + } + +} + +package org.apache.http.cookie.params { + + public abstract interface CookieSpecPNames { + field public static final java.lang.String DATE_PATTERNS = "http.protocol.cookie-datepatterns"; + field public static final java.lang.String SINGLE_COOKIE_HEADER = "http.protocol.single-cookie-header"; + } + + public class CookieSpecParamBean extends org.apache.http.params.HttpAbstractParamBean { + ctor public CookieSpecParamBean(org.apache.http.params.HttpParams); + method public void setDatePatterns(java.util.Collection); + method public void setSingleHeader(boolean); + } + +} + +package org.apache.http.entity { + + public abstract class AbstractHttpEntity implements org.apache.http.HttpEntity { + ctor protected AbstractHttpEntity(); + method public void consumeContent() throws java.io.IOException, java.lang.UnsupportedOperationException; + method public org.apache.http.Header getContentEncoding(); + method public org.apache.http.Header getContentType(); + method public boolean isChunked(); + method public void setChunked(boolean); + method public void setContentEncoding(org.apache.http.Header); + method public void setContentEncoding(java.lang.String); + method public void setContentType(org.apache.http.Header); + method public void setContentType(java.lang.String); + field protected boolean chunked; + field protected org.apache.http.Header contentEncoding; + field protected org.apache.http.Header contentType; + } + + public class BasicHttpEntity extends org.apache.http.entity.AbstractHttpEntity { + ctor public BasicHttpEntity(); + method public java.io.InputStream getContent() throws java.lang.IllegalStateException; + method public long getContentLength(); + method public boolean isRepeatable(); + method public boolean isStreaming(); + method public void setContent(java.io.InputStream); + method public void setContentLength(long); + method public void writeTo(java.io.OutputStream) throws java.io.IOException; + } + + public class BufferedHttpEntity extends org.apache.http.entity.HttpEntityWrapper { + ctor public BufferedHttpEntity(org.apache.http.HttpEntity) throws java.io.IOException; + } + + public class ByteArrayEntity extends org.apache.http.entity.AbstractHttpEntity implements java.lang.Cloneable { + ctor public ByteArrayEntity(byte[]); + method public java.lang.Object clone() throws java.lang.CloneNotSupportedException; + method public java.io.InputStream getContent(); + method public long getContentLength(); + method public boolean isRepeatable(); + method public boolean isStreaming(); + method public void writeTo(java.io.OutputStream) throws java.io.IOException; + field protected final byte[] content; + } + + public abstract interface ContentLengthStrategy { + method public abstract long determineLength(org.apache.http.HttpMessage) throws org.apache.http.HttpException; + field public static final int CHUNKED = -2; // 0xfffffffe + field public static final int IDENTITY = -1; // 0xffffffff + } + + public abstract interface ContentProducer { + method public abstract void writeTo(java.io.OutputStream) throws java.io.IOException; + } + + public class EntityTemplate extends org.apache.http.entity.AbstractHttpEntity { + ctor public EntityTemplate(org.apache.http.entity.ContentProducer); + method public java.io.InputStream getContent(); + method public long getContentLength(); + method public boolean isRepeatable(); + method public boolean isStreaming(); + method public void writeTo(java.io.OutputStream) throws java.io.IOException; + } + + public class FileEntity extends org.apache.http.entity.AbstractHttpEntity implements java.lang.Cloneable { + ctor public FileEntity(java.io.File, java.lang.String); + method public java.lang.Object clone() throws java.lang.CloneNotSupportedException; + method public java.io.InputStream getContent() throws java.io.IOException; + method public long getContentLength(); + method public boolean isRepeatable(); + method public boolean isStreaming(); + method public void writeTo(java.io.OutputStream) throws java.io.IOException; + field protected final java.io.File file; + } + + public class HttpEntityWrapper implements org.apache.http.HttpEntity { + ctor public HttpEntityWrapper(org.apache.http.HttpEntity); + method public void consumeContent() throws java.io.IOException; + method public java.io.InputStream getContent() throws java.io.IOException; + method public org.apache.http.Header getContentEncoding(); + method public long getContentLength(); + method public org.apache.http.Header getContentType(); + method public boolean isChunked(); + method public boolean isRepeatable(); + method public boolean isStreaming(); + method public void writeTo(java.io.OutputStream) throws java.io.IOException; + field protected org.apache.http.HttpEntity wrappedEntity; + } + + public class InputStreamEntity extends org.apache.http.entity.AbstractHttpEntity { + ctor public InputStreamEntity(java.io.InputStream, long); + method public java.io.InputStream getContent() throws java.io.IOException; + method public long getContentLength(); + method public boolean isRepeatable(); + method public boolean isStreaming(); + method public void writeTo(java.io.OutputStream) throws java.io.IOException; + } + + public class SerializableEntity extends org.apache.http.entity.AbstractHttpEntity { + ctor public SerializableEntity(java.io.Serializable, boolean) throws java.io.IOException; + method public java.io.InputStream getContent() throws java.io.IOException, java.lang.IllegalStateException; + method public long getContentLength(); + method public boolean isRepeatable(); + method public boolean isStreaming(); + method public void writeTo(java.io.OutputStream) throws java.io.IOException; + } + + public class StringEntity extends org.apache.http.entity.AbstractHttpEntity implements java.lang.Cloneable { + ctor public StringEntity(java.lang.String, java.lang.String) throws java.io.UnsupportedEncodingException; + ctor public StringEntity(java.lang.String) throws java.io.UnsupportedEncodingException; + method public java.lang.Object clone() throws java.lang.CloneNotSupportedException; + method public java.io.InputStream getContent() throws java.io.IOException; + method public long getContentLength(); + method public boolean isRepeatable(); + method public boolean isStreaming(); + method public void writeTo(java.io.OutputStream) throws java.io.IOException; + field protected final byte[] content; + } + +} + +package org.apache.http.impl { + + public abstract class AbstractHttpClientConnection implements org.apache.http.HttpClientConnection { + ctor public AbstractHttpClientConnection(); + method protected abstract void assertOpen() throws java.lang.IllegalStateException; + method protected org.apache.http.impl.entity.EntityDeserializer createEntityDeserializer(); + method protected org.apache.http.impl.entity.EntitySerializer createEntitySerializer(); + method protected org.apache.http.HttpResponseFactory createHttpResponseFactory(); + method protected org.apache.http.io.HttpMessageWriter createRequestWriter(org.apache.http.io.SessionOutputBuffer, org.apache.http.params.HttpParams); + method protected org.apache.http.io.HttpMessageParser createResponseParser(org.apache.http.io.SessionInputBuffer, org.apache.http.HttpResponseFactory, org.apache.http.params.HttpParams); + method protected void doFlush() throws java.io.IOException; + method public void flush() throws java.io.IOException; + method public org.apache.http.HttpConnectionMetrics getMetrics(); + method protected void init(org.apache.http.io.SessionInputBuffer, org.apache.http.io.SessionOutputBuffer, org.apache.http.params.HttpParams); + method public boolean isResponseAvailable(int) throws java.io.IOException; + method public boolean isStale(); + method public void receiveResponseEntity(org.apache.http.HttpResponse) throws org.apache.http.HttpException, java.io.IOException; + method public org.apache.http.HttpResponse receiveResponseHeader() throws org.apache.http.HttpException, java.io.IOException; + method public void sendRequestEntity(org.apache.http.HttpEntityEnclosingRequest) throws org.apache.http.HttpException, java.io.IOException; + method public void sendRequestHeader(org.apache.http.HttpRequest) throws org.apache.http.HttpException, java.io.IOException; + } + + public abstract class AbstractHttpServerConnection implements org.apache.http.HttpServerConnection { + ctor public AbstractHttpServerConnection(); + method protected abstract void assertOpen() throws java.lang.IllegalStateException; + method protected org.apache.http.impl.entity.EntityDeserializer createEntityDeserializer(); + method protected org.apache.http.impl.entity.EntitySerializer createEntitySerializer(); + method protected org.apache.http.HttpRequestFactory createHttpRequestFactory(); + method protected org.apache.http.io.HttpMessageParser createRequestParser(org.apache.http.io.SessionInputBuffer, org.apache.http.HttpRequestFactory, org.apache.http.params.HttpParams); + method protected org.apache.http.io.HttpMessageWriter createResponseWriter(org.apache.http.io.SessionOutputBuffer, org.apache.http.params.HttpParams); + method protected void doFlush() throws java.io.IOException; + method public void flush() throws java.io.IOException; + method public org.apache.http.HttpConnectionMetrics getMetrics(); + method protected void init(org.apache.http.io.SessionInputBuffer, org.apache.http.io.SessionOutputBuffer, org.apache.http.params.HttpParams); + method public boolean isStale(); + method public void receiveRequestEntity(org.apache.http.HttpEntityEnclosingRequest) throws org.apache.http.HttpException, java.io.IOException; + method public org.apache.http.HttpRequest receiveRequestHeader() throws org.apache.http.HttpException, java.io.IOException; + method public void sendResponseEntity(org.apache.http.HttpResponse) throws org.apache.http.HttpException, java.io.IOException; + method public void sendResponseHeader(org.apache.http.HttpResponse) throws org.apache.http.HttpException, java.io.IOException; + } + + public class DefaultConnectionReuseStrategy implements org.apache.http.ConnectionReuseStrategy { + ctor public DefaultConnectionReuseStrategy(); + method protected org.apache.http.TokenIterator createTokenIterator(org.apache.http.HeaderIterator); + method public boolean keepAlive(org.apache.http.HttpResponse, org.apache.http.protocol.HttpContext); + } + + public class DefaultHttpClientConnection extends org.apache.http.impl.SocketHttpClientConnection { + ctor public DefaultHttpClientConnection(); + method public void bind(java.net.Socket, org.apache.http.params.HttpParams) throws java.io.IOException; + } + + public class DefaultHttpRequestFactory implements org.apache.http.HttpRequestFactory { + ctor public DefaultHttpRequestFactory(); + method public org.apache.http.HttpRequest newHttpRequest(org.apache.http.RequestLine) throws org.apache.http.MethodNotSupportedException; + method public org.apache.http.HttpRequest newHttpRequest(java.lang.String, java.lang.String) throws org.apache.http.MethodNotSupportedException; + } + + public class DefaultHttpResponseFactory implements org.apache.http.HttpResponseFactory { + ctor public DefaultHttpResponseFactory(org.apache.http.ReasonPhraseCatalog); + ctor public DefaultHttpResponseFactory(); + method protected java.util.Locale determineLocale(org.apache.http.protocol.HttpContext); + method public org.apache.http.HttpResponse newHttpResponse(org.apache.http.ProtocolVersion, int, org.apache.http.protocol.HttpContext); + method public org.apache.http.HttpResponse newHttpResponse(org.apache.http.StatusLine, org.apache.http.protocol.HttpContext); + field protected final org.apache.http.ReasonPhraseCatalog reasonCatalog; + } + + public class DefaultHttpServerConnection extends org.apache.http.impl.SocketHttpServerConnection { + ctor public DefaultHttpServerConnection(); + method public void bind(java.net.Socket, org.apache.http.params.HttpParams) throws java.io.IOException; + } + + public class EnglishReasonPhraseCatalog implements org.apache.http.ReasonPhraseCatalog { + ctor protected EnglishReasonPhraseCatalog(); + method public java.lang.String getReason(int, java.util.Locale); + field public static final org.apache.http.impl.EnglishReasonPhraseCatalog INSTANCE; + } + + public class HttpConnectionMetricsImpl implements org.apache.http.HttpConnectionMetrics { + ctor public HttpConnectionMetricsImpl(org.apache.http.io.HttpTransportMetrics, org.apache.http.io.HttpTransportMetrics); + method public java.lang.Object getMetric(java.lang.String); + method public long getReceivedBytesCount(); + method public long getRequestCount(); + method public long getResponseCount(); + method public long getSentBytesCount(); + method public void incrementRequestCount(); + method public void incrementResponseCount(); + method public void reset(); + method public void setMetric(java.lang.String, java.lang.Object); + field public static final java.lang.String RECEIVED_BYTES_COUNT = "http.received-bytes-count"; + field public static final java.lang.String REQUEST_COUNT = "http.request-count"; + field public static final java.lang.String RESPONSE_COUNT = "http.response-count"; + field public static final java.lang.String SENT_BYTES_COUNT = "http.sent-bytes-count"; + } + + public class NoConnectionReuseStrategy implements org.apache.http.ConnectionReuseStrategy { + ctor public NoConnectionReuseStrategy(); + method public boolean keepAlive(org.apache.http.HttpResponse, org.apache.http.protocol.HttpContext); + } + + public class SocketHttpClientConnection extends org.apache.http.impl.AbstractHttpClientConnection implements org.apache.http.HttpInetConnection { + ctor public SocketHttpClientConnection(); + method protected void assertNotOpen(); + method protected void assertOpen(); + method protected void bind(java.net.Socket, org.apache.http.params.HttpParams) throws java.io.IOException; + method public void close() throws java.io.IOException; + method protected org.apache.http.io.SessionInputBuffer createSessionInputBuffer(java.net.Socket, int, org.apache.http.params.HttpParams) throws java.io.IOException; + method protected org.apache.http.io.SessionOutputBuffer createSessionOutputBuffer(java.net.Socket, int, org.apache.http.params.HttpParams) throws java.io.IOException; + method public java.net.InetAddress getLocalAddress(); + method public int getLocalPort(); + method public java.net.InetAddress getRemoteAddress(); + method public int getRemotePort(); + method protected java.net.Socket getSocket(); + method public int getSocketTimeout(); + method public boolean isOpen(); + method public void setSocketTimeout(int); + method public void shutdown() throws java.io.IOException; + } + + public class SocketHttpServerConnection extends org.apache.http.impl.AbstractHttpServerConnection implements org.apache.http.HttpInetConnection { + ctor public SocketHttpServerConnection(); + method protected void assertNotOpen(); + method protected void assertOpen(); + method protected void bind(java.net.Socket, org.apache.http.params.HttpParams) throws java.io.IOException; + method public void close() throws java.io.IOException; + method protected org.apache.http.io.SessionInputBuffer createHttpDataReceiver(java.net.Socket, int, org.apache.http.params.HttpParams) throws java.io.IOException; + method protected org.apache.http.io.SessionOutputBuffer createHttpDataTransmitter(java.net.Socket, int, org.apache.http.params.HttpParams) throws java.io.IOException; + method public java.net.InetAddress getLocalAddress(); + method public int getLocalPort(); + method public java.net.InetAddress getRemoteAddress(); + method public int getRemotePort(); + method protected java.net.Socket getSocket(); + method public int getSocketTimeout(); + method public boolean isOpen(); + method public void setSocketTimeout(int); + method public void shutdown() throws java.io.IOException; + } + +} + +package org.apache.http.impl.auth { + + public abstract class AuthSchemeBase implements org.apache.http.auth.AuthScheme { + ctor public AuthSchemeBase(); + method public boolean isProxy(); + method protected abstract void parseChallenge(org.apache.http.util.CharArrayBuffer, int, int) throws org.apache.http.auth.MalformedChallengeException; + method public void processChallenge(org.apache.http.Header) throws org.apache.http.auth.MalformedChallengeException; + } + + public class BasicScheme extends org.apache.http.impl.auth.RFC2617Scheme { + ctor public BasicScheme(); + method public org.apache.http.Header authenticate(org.apache.http.auth.Credentials, org.apache.http.HttpRequest) throws org.apache.http.auth.AuthenticationException; + method public static org.apache.http.Header authenticate(org.apache.http.auth.Credentials, java.lang.String, boolean); + method public java.lang.String getSchemeName(); + method public boolean isComplete(); + method public boolean isConnectionBased(); + } + + public class BasicSchemeFactory implements org.apache.http.auth.AuthSchemeFactory { + ctor public BasicSchemeFactory(); + method public org.apache.http.auth.AuthScheme newInstance(org.apache.http.params.HttpParams); + } + + public class DigestScheme extends org.apache.http.impl.auth.RFC2617Scheme { + ctor public DigestScheme(); + method public org.apache.http.Header authenticate(org.apache.http.auth.Credentials, org.apache.http.HttpRequest) throws org.apache.http.auth.AuthenticationException; + method public static java.lang.String createCnonce(); + method public java.lang.String getSchemeName(); + method public boolean isComplete(); + method public boolean isConnectionBased(); + method public void overrideParamter(java.lang.String, java.lang.String); + } + + public class DigestSchemeFactory implements org.apache.http.auth.AuthSchemeFactory { + ctor public DigestSchemeFactory(); + method public org.apache.http.auth.AuthScheme newInstance(org.apache.http.params.HttpParams); + } + + public abstract interface NTLMEngine { + method public abstract java.lang.String generateType1Msg(java.lang.String, java.lang.String) throws org.apache.http.impl.auth.NTLMEngineException; + method public abstract java.lang.String generateType3Msg(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String) throws org.apache.http.impl.auth.NTLMEngineException; + } + + public class NTLMEngineException extends org.apache.http.auth.AuthenticationException { + ctor public NTLMEngineException(); + ctor public NTLMEngineException(java.lang.String); + ctor public NTLMEngineException(java.lang.String, java.lang.Throwable); + } + + public class NTLMScheme extends org.apache.http.impl.auth.AuthSchemeBase { + ctor public NTLMScheme(org.apache.http.impl.auth.NTLMEngine); + method public org.apache.http.Header authenticate(org.apache.http.auth.Credentials, org.apache.http.HttpRequest) throws org.apache.http.auth.AuthenticationException; + method public java.lang.String getParameter(java.lang.String); + method public java.lang.String getRealm(); + method public java.lang.String getSchemeName(); + method public boolean isComplete(); + method public boolean isConnectionBased(); + method protected void parseChallenge(org.apache.http.util.CharArrayBuffer, int, int) throws org.apache.http.auth.MalformedChallengeException; + } + + public abstract class RFC2617Scheme extends org.apache.http.impl.auth.AuthSchemeBase { + ctor public RFC2617Scheme(); + method public java.lang.String getParameter(java.lang.String); + method protected java.util.Map getParameters(); + method public java.lang.String getRealm(); + method protected void parseChallenge(org.apache.http.util.CharArrayBuffer, int, int) throws org.apache.http.auth.MalformedChallengeException; + } + + public class UnsupportedDigestAlgorithmException extends java.lang.RuntimeException { + ctor public UnsupportedDigestAlgorithmException(); + ctor public UnsupportedDigestAlgorithmException(java.lang.String); + ctor public UnsupportedDigestAlgorithmException(java.lang.String, java.lang.Throwable); + } + +} + +package org.apache.http.impl.client { + + public abstract class AbstractAuthenticationHandler implements org.apache.http.client.AuthenticationHandler { + ctor public AbstractAuthenticationHandler(); + method protected java.util.List getAuthPreferences(); + method protected java.util.Map parseChallenges(org.apache.http.Header[]) throws org.apache.http.auth.MalformedChallengeException; + method public org.apache.http.auth.AuthScheme selectScheme(java.util.Map, org.apache.http.HttpResponse, org.apache.http.protocol.HttpContext) throws org.apache.http.auth.AuthenticationException; + } + + public abstract class AbstractHttpClient implements org.apache.http.client.HttpClient { + ctor protected AbstractHttpClient(org.apache.http.conn.ClientConnectionManager, org.apache.http.params.HttpParams); + method public synchronized void addRequestInterceptor(org.apache.http.HttpRequestInterceptor); + method public synchronized void addRequestInterceptor(org.apache.http.HttpRequestInterceptor, int); + method public synchronized void addResponseInterceptor(org.apache.http.HttpResponseInterceptor); + method public synchronized void addResponseInterceptor(org.apache.http.HttpResponseInterceptor, int); + method public synchronized void clearRequestInterceptors(); + method public synchronized void clearResponseInterceptors(); + method protected abstract org.apache.http.auth.AuthSchemeRegistry createAuthSchemeRegistry(); + method protected abstract org.apache.http.conn.ClientConnectionManager createClientConnectionManager(); + method protected org.apache.http.client.RequestDirector createClientRequestDirector(org.apache.http.protocol.HttpRequestExecutor, org.apache.http.conn.ClientConnectionManager, org.apache.http.ConnectionReuseStrategy, org.apache.http.conn.ConnectionKeepAliveStrategy, org.apache.http.conn.routing.HttpRoutePlanner, org.apache.http.protocol.HttpProcessor, org.apache.http.client.HttpRequestRetryHandler, org.apache.http.client.RedirectHandler, org.apache.http.client.AuthenticationHandler, org.apache.http.client.AuthenticationHandler, org.apache.http.client.UserTokenHandler, org.apache.http.params.HttpParams); + method protected abstract org.apache.http.conn.ConnectionKeepAliveStrategy createConnectionKeepAliveStrategy(); + method protected abstract org.apache.http.ConnectionReuseStrategy createConnectionReuseStrategy(); + method protected abstract org.apache.http.cookie.CookieSpecRegistry createCookieSpecRegistry(); + method protected abstract org.apache.http.client.CookieStore createCookieStore(); + method protected abstract org.apache.http.client.CredentialsProvider createCredentialsProvider(); + method protected abstract org.apache.http.protocol.HttpContext createHttpContext(); + method protected abstract org.apache.http.params.HttpParams createHttpParams(); + method protected abstract org.apache.http.protocol.BasicHttpProcessor createHttpProcessor(); + method protected abstract org.apache.http.client.HttpRequestRetryHandler createHttpRequestRetryHandler(); + method protected abstract org.apache.http.conn.routing.HttpRoutePlanner createHttpRoutePlanner(); + method protected abstract org.apache.http.client.AuthenticationHandler createProxyAuthenticationHandler(); + method protected abstract org.apache.http.client.RedirectHandler createRedirectHandler(); + method protected abstract org.apache.http.protocol.HttpRequestExecutor createRequestExecutor(); + method protected abstract org.apache.http.client.AuthenticationHandler createTargetAuthenticationHandler(); + method protected abstract org.apache.http.client.UserTokenHandler createUserTokenHandler(); + method protected org.apache.http.params.HttpParams determineParams(org.apache.http.HttpRequest); + method public final org.apache.http.HttpResponse execute(org.apache.http.client.methods.HttpUriRequest) throws org.apache.http.client.ClientProtocolException, java.io.IOException; + method public final org.apache.http.HttpResponse execute(org.apache.http.client.methods.HttpUriRequest, org.apache.http.protocol.HttpContext) throws org.apache.http.client.ClientProtocolException, java.io.IOException; + method public final org.apache.http.HttpResponse execute(org.apache.http.HttpHost, org.apache.http.HttpRequest) throws org.apache.http.client.ClientProtocolException, java.io.IOException; + method public final org.apache.http.HttpResponse execute(org.apache.http.HttpHost, org.apache.http.HttpRequest, org.apache.http.protocol.HttpContext) throws org.apache.http.client.ClientProtocolException, java.io.IOException; + method public T execute(org.apache.http.client.methods.HttpUriRequest, org.apache.http.client.ResponseHandler) throws org.apache.http.client.ClientProtocolException, java.io.IOException; + method public T execute(org.apache.http.client.methods.HttpUriRequest, org.apache.http.client.ResponseHandler, org.apache.http.protocol.HttpContext) throws org.apache.http.client.ClientProtocolException, java.io.IOException; + method public T execute(org.apache.http.HttpHost, org.apache.http.HttpRequest, org.apache.http.client.ResponseHandler) throws org.apache.http.client.ClientProtocolException, java.io.IOException; + method public T execute(org.apache.http.HttpHost, org.apache.http.HttpRequest, org.apache.http.client.ResponseHandler, org.apache.http.protocol.HttpContext) throws org.apache.http.client.ClientProtocolException, java.io.IOException; + method public final synchronized org.apache.http.auth.AuthSchemeRegistry getAuthSchemes(); + method public final synchronized org.apache.http.conn.ConnectionKeepAliveStrategy getConnectionKeepAliveStrategy(); + method public final synchronized org.apache.http.conn.ClientConnectionManager getConnectionManager(); + method public final synchronized org.apache.http.ConnectionReuseStrategy getConnectionReuseStrategy(); + method public final synchronized org.apache.http.cookie.CookieSpecRegistry getCookieSpecs(); + method public final synchronized org.apache.http.client.CookieStore getCookieStore(); + method public final synchronized org.apache.http.client.CredentialsProvider getCredentialsProvider(); + method protected final synchronized org.apache.http.protocol.BasicHttpProcessor getHttpProcessor(); + method public final synchronized org.apache.http.client.HttpRequestRetryHandler getHttpRequestRetryHandler(); + method public final synchronized org.apache.http.params.HttpParams getParams(); + method public final synchronized org.apache.http.client.AuthenticationHandler getProxyAuthenticationHandler(); + method public final synchronized org.apache.http.client.RedirectHandler getRedirectHandler(); + method public final synchronized org.apache.http.protocol.HttpRequestExecutor getRequestExecutor(); + method public synchronized org.apache.http.HttpRequestInterceptor getRequestInterceptor(int); + method public synchronized int getRequestInterceptorCount(); + method public synchronized org.apache.http.HttpResponseInterceptor getResponseInterceptor(int); + method public synchronized int getResponseInterceptorCount(); + method public final synchronized org.apache.http.conn.routing.HttpRoutePlanner getRoutePlanner(); + method public final synchronized org.apache.http.client.AuthenticationHandler getTargetAuthenticationHandler(); + method public final synchronized org.apache.http.client.UserTokenHandler getUserTokenHandler(); + method public void removeRequestInterceptorByClass(java.lang.Class); + method public void removeResponseInterceptorByClass(java.lang.Class); + method public synchronized void setAuthSchemes(org.apache.http.auth.AuthSchemeRegistry); + method public synchronized void setCookieSpecs(org.apache.http.cookie.CookieSpecRegistry); + method public synchronized void setCookieStore(org.apache.http.client.CookieStore); + method public synchronized void setCredentialsProvider(org.apache.http.client.CredentialsProvider); + method public synchronized void setHttpRequestRetryHandler(org.apache.http.client.HttpRequestRetryHandler); + method public synchronized void setKeepAliveStrategy(org.apache.http.conn.ConnectionKeepAliveStrategy); + method public synchronized void setParams(org.apache.http.params.HttpParams); + method public synchronized void setProxyAuthenticationHandler(org.apache.http.client.AuthenticationHandler); + method public synchronized void setRedirectHandler(org.apache.http.client.RedirectHandler); + method public synchronized void setReuseStrategy(org.apache.http.ConnectionReuseStrategy); + method public synchronized void setRoutePlanner(org.apache.http.conn.routing.HttpRoutePlanner); + method public synchronized void setTargetAuthenticationHandler(org.apache.http.client.AuthenticationHandler); + method public synchronized void setUserTokenHandler(org.apache.http.client.UserTokenHandler); + } + + public class BasicCookieStore implements org.apache.http.client.CookieStore { + ctor public BasicCookieStore(); + method public synchronized void addCookie(org.apache.http.cookie.Cookie); + method public synchronized void addCookies(org.apache.http.cookie.Cookie[]); + method public synchronized void clear(); + method public synchronized boolean clearExpired(java.util.Date); + method public synchronized java.util.List getCookies(); + } + + public class BasicCredentialsProvider implements org.apache.http.client.CredentialsProvider { + ctor public BasicCredentialsProvider(); + method public synchronized void clear(); + method public synchronized org.apache.http.auth.Credentials getCredentials(org.apache.http.auth.AuthScope); + method public synchronized void setCredentials(org.apache.http.auth.AuthScope, org.apache.http.auth.Credentials); + } + + public class BasicResponseHandler implements org.apache.http.client.ResponseHandler { + ctor public BasicResponseHandler(); + method public java.lang.String handleResponse(org.apache.http.HttpResponse) throws org.apache.http.client.HttpResponseException, java.io.IOException; + } + + public class ClientParamsStack extends org.apache.http.params.AbstractHttpParams { + ctor public ClientParamsStack(org.apache.http.params.HttpParams, org.apache.http.params.HttpParams, org.apache.http.params.HttpParams, org.apache.http.params.HttpParams); + ctor public ClientParamsStack(org.apache.http.impl.client.ClientParamsStack); + ctor public ClientParamsStack(org.apache.http.impl.client.ClientParamsStack, org.apache.http.params.HttpParams, org.apache.http.params.HttpParams, org.apache.http.params.HttpParams, org.apache.http.params.HttpParams); + method public org.apache.http.params.HttpParams copy(); + method public final org.apache.http.params.HttpParams getApplicationParams(); + method public final org.apache.http.params.HttpParams getClientParams(); + method public final org.apache.http.params.HttpParams getOverrideParams(); + method public java.lang.Object getParameter(java.lang.String); + method public final org.apache.http.params.HttpParams getRequestParams(); + method public boolean removeParameter(java.lang.String); + method public org.apache.http.params.HttpParams setParameter(java.lang.String, java.lang.Object) throws java.lang.UnsupportedOperationException; + field protected final org.apache.http.params.HttpParams applicationParams; + field protected final org.apache.http.params.HttpParams clientParams; + field protected final org.apache.http.params.HttpParams overrideParams; + field protected final org.apache.http.params.HttpParams requestParams; + } + + public class DefaultConnectionKeepAliveStrategy implements org.apache.http.conn.ConnectionKeepAliveStrategy { + ctor public DefaultConnectionKeepAliveStrategy(); + method public long getKeepAliveDuration(org.apache.http.HttpResponse, org.apache.http.protocol.HttpContext); + } + + public class DefaultHttpClient extends org.apache.http.impl.client.AbstractHttpClient { + ctor public DefaultHttpClient(org.apache.http.conn.ClientConnectionManager, org.apache.http.params.HttpParams); + ctor public DefaultHttpClient(org.apache.http.params.HttpParams); + ctor public DefaultHttpClient(); + method protected org.apache.http.auth.AuthSchemeRegistry createAuthSchemeRegistry(); + method protected org.apache.http.conn.ClientConnectionManager createClientConnectionManager(); + method protected org.apache.http.conn.ConnectionKeepAliveStrategy createConnectionKeepAliveStrategy(); + method protected org.apache.http.ConnectionReuseStrategy createConnectionReuseStrategy(); + method protected org.apache.http.cookie.CookieSpecRegistry createCookieSpecRegistry(); + method protected org.apache.http.client.CookieStore createCookieStore(); + method protected org.apache.http.client.CredentialsProvider createCredentialsProvider(); + method protected org.apache.http.protocol.HttpContext createHttpContext(); + method protected org.apache.http.params.HttpParams createHttpParams(); + method protected org.apache.http.protocol.BasicHttpProcessor createHttpProcessor(); + method protected org.apache.http.client.HttpRequestRetryHandler createHttpRequestRetryHandler(); + method protected org.apache.http.conn.routing.HttpRoutePlanner createHttpRoutePlanner(); + method protected org.apache.http.client.AuthenticationHandler createProxyAuthenticationHandler(); + method protected org.apache.http.client.RedirectHandler createRedirectHandler(); + method protected org.apache.http.protocol.HttpRequestExecutor createRequestExecutor(); + method protected org.apache.http.client.AuthenticationHandler createTargetAuthenticationHandler(); + method protected org.apache.http.client.UserTokenHandler createUserTokenHandler(); + } + + public class DefaultHttpRequestRetryHandler implements org.apache.http.client.HttpRequestRetryHandler { + ctor public DefaultHttpRequestRetryHandler(int, boolean); + ctor public DefaultHttpRequestRetryHandler(); + method public int getRetryCount(); + method public boolean isRequestSentRetryEnabled(); + method public boolean retryRequest(java.io.IOException, int, org.apache.http.protocol.HttpContext); + } + + public class DefaultProxyAuthenticationHandler extends org.apache.http.impl.client.AbstractAuthenticationHandler { + ctor public DefaultProxyAuthenticationHandler(); + method public java.util.Map getChallenges(org.apache.http.HttpResponse, org.apache.http.protocol.HttpContext) throws org.apache.http.auth.MalformedChallengeException; + method public boolean isAuthenticationRequested(org.apache.http.HttpResponse, org.apache.http.protocol.HttpContext); + } + + public class DefaultRedirectHandler implements org.apache.http.client.RedirectHandler { + ctor public DefaultRedirectHandler(); + method public java.net.URI getLocationURI(org.apache.http.HttpResponse, org.apache.http.protocol.HttpContext) throws org.apache.http.ProtocolException; + method public boolean isRedirectRequested(org.apache.http.HttpResponse, org.apache.http.protocol.HttpContext); + } + + public class DefaultRequestDirector implements org.apache.http.client.RequestDirector { + ctor public DefaultRequestDirector(org.apache.http.protocol.HttpRequestExecutor, org.apache.http.conn.ClientConnectionManager, org.apache.http.ConnectionReuseStrategy, org.apache.http.conn.ConnectionKeepAliveStrategy, org.apache.http.conn.routing.HttpRoutePlanner, org.apache.http.protocol.HttpProcessor, org.apache.http.client.HttpRequestRetryHandler, org.apache.http.client.RedirectHandler, org.apache.http.client.AuthenticationHandler, org.apache.http.client.AuthenticationHandler, org.apache.http.client.UserTokenHandler, org.apache.http.params.HttpParams); + method protected org.apache.http.HttpRequest createConnectRequest(org.apache.http.conn.routing.HttpRoute, org.apache.http.protocol.HttpContext); + method protected boolean createTunnelToProxy(org.apache.http.conn.routing.HttpRoute, int, org.apache.http.protocol.HttpContext) throws org.apache.http.HttpException, java.io.IOException; + method protected boolean createTunnelToTarget(org.apache.http.conn.routing.HttpRoute, org.apache.http.protocol.HttpContext) throws org.apache.http.HttpException, java.io.IOException; + method protected org.apache.http.conn.routing.HttpRoute determineRoute(org.apache.http.HttpHost, org.apache.http.HttpRequest, org.apache.http.protocol.HttpContext) throws org.apache.http.HttpException; + method protected void establishRoute(org.apache.http.conn.routing.HttpRoute, org.apache.http.protocol.HttpContext) throws org.apache.http.HttpException, java.io.IOException; + method public org.apache.http.HttpResponse execute(org.apache.http.HttpHost, org.apache.http.HttpRequest, org.apache.http.protocol.HttpContext) throws org.apache.http.HttpException, java.io.IOException; + method protected org.apache.http.impl.client.RoutedRequest handleResponse(org.apache.http.impl.client.RoutedRequest, org.apache.http.HttpResponse, org.apache.http.protocol.HttpContext) throws org.apache.http.HttpException, java.io.IOException; + method protected void releaseConnection(); + method protected void rewriteRequestURI(org.apache.http.impl.client.RequestWrapper, org.apache.http.conn.routing.HttpRoute) throws org.apache.http.ProtocolException; + field protected final org.apache.http.conn.ClientConnectionManager connManager; + field protected final org.apache.http.protocol.HttpProcessor httpProcessor; + field protected final org.apache.http.conn.ConnectionKeepAliveStrategy keepAliveStrategy; + field protected org.apache.http.conn.ManagedClientConnection managedConn; + field protected final org.apache.http.params.HttpParams params; + field protected final org.apache.http.client.RedirectHandler redirectHandler; + field protected final org.apache.http.protocol.HttpRequestExecutor requestExec; + field protected final org.apache.http.client.HttpRequestRetryHandler retryHandler; + field protected final org.apache.http.ConnectionReuseStrategy reuseStrategy; + field protected final org.apache.http.conn.routing.HttpRoutePlanner routePlanner; + } + + public class DefaultTargetAuthenticationHandler extends org.apache.http.impl.client.AbstractAuthenticationHandler { + ctor public DefaultTargetAuthenticationHandler(); + method public java.util.Map getChallenges(org.apache.http.HttpResponse, org.apache.http.protocol.HttpContext) throws org.apache.http.auth.MalformedChallengeException; + method public boolean isAuthenticationRequested(org.apache.http.HttpResponse, org.apache.http.protocol.HttpContext); + } + + public class DefaultUserTokenHandler implements org.apache.http.client.UserTokenHandler { + ctor public DefaultUserTokenHandler(); + method public java.lang.Object getUserToken(org.apache.http.protocol.HttpContext); + } + + public class EntityEnclosingRequestWrapper extends org.apache.http.impl.client.RequestWrapper implements org.apache.http.HttpEntityEnclosingRequest { + ctor public EntityEnclosingRequestWrapper(org.apache.http.HttpEntityEnclosingRequest) throws org.apache.http.ProtocolException; + method public boolean expectContinue(); + method public org.apache.http.HttpEntity getEntity(); + method public void setEntity(org.apache.http.HttpEntity); + } + + public class RedirectLocations { + ctor public RedirectLocations(); + method public void add(java.net.URI); + method public boolean contains(java.net.URI); + method public boolean remove(java.net.URI); + } + + public class RequestWrapper extends org.apache.http.message.AbstractHttpMessage implements org.apache.http.client.methods.HttpUriRequest { + ctor public RequestWrapper(org.apache.http.HttpRequest) throws org.apache.http.ProtocolException; + method public void abort() throws java.lang.UnsupportedOperationException; + method public int getExecCount(); + method public java.lang.String getMethod(); + method public org.apache.http.HttpRequest getOriginal(); + method public org.apache.http.ProtocolVersion getProtocolVersion(); + method public org.apache.http.RequestLine getRequestLine(); + method public java.net.URI getURI(); + method public void incrementExecCount(); + method public boolean isAborted(); + method public boolean isRepeatable(); + method public void resetHeaders(); + method public void setMethod(java.lang.String); + method public void setProtocolVersion(org.apache.http.ProtocolVersion); + method public void setURI(java.net.URI); + } + + public class RoutedRequest { + ctor public RoutedRequest(org.apache.http.impl.client.RequestWrapper, org.apache.http.conn.routing.HttpRoute); + method public final org.apache.http.impl.client.RequestWrapper getRequest(); + method public final org.apache.http.conn.routing.HttpRoute getRoute(); + field protected final org.apache.http.impl.client.RequestWrapper request; + field protected final org.apache.http.conn.routing.HttpRoute route; + } + + public class TunnelRefusedException extends org.apache.http.HttpException { + ctor public TunnelRefusedException(java.lang.String, org.apache.http.HttpResponse); + method public org.apache.http.HttpResponse getResponse(); + } + +} + +package org.apache.http.impl.conn { + + public abstract class AbstractClientConnAdapter implements org.apache.http.conn.ManagedClientConnection { + ctor protected AbstractClientConnAdapter(org.apache.http.conn.ClientConnectionManager, org.apache.http.conn.OperatedClientConnection); + method public void abortConnection(); + method protected final void assertNotAborted() throws java.io.InterruptedIOException; + method protected final void assertValid(org.apache.http.conn.OperatedClientConnection); + method protected void detach(); + method public void flush() throws java.io.IOException; + method public java.net.InetAddress getLocalAddress(); + method public int getLocalPort(); + method protected org.apache.http.conn.ClientConnectionManager getManager(); + method public org.apache.http.HttpConnectionMetrics getMetrics(); + method public java.net.InetAddress getRemoteAddress(); + method public int getRemotePort(); + method public javax.net.ssl.SSLSession getSSLSession(); + method public int getSocketTimeout(); + method protected org.apache.http.conn.OperatedClientConnection getWrappedConnection(); + method public boolean isMarkedReusable(); + method public boolean isOpen(); + method public boolean isResponseAvailable(int) throws java.io.IOException; + method public boolean isSecure(); + method public boolean isStale(); + method public void markReusable(); + method public void receiveResponseEntity(org.apache.http.HttpResponse) throws org.apache.http.HttpException, java.io.IOException; + method public org.apache.http.HttpResponse receiveResponseHeader() throws org.apache.http.HttpException, java.io.IOException; + method public void releaseConnection(); + method public void sendRequestEntity(org.apache.http.HttpEntityEnclosingRequest) throws org.apache.http.HttpException, java.io.IOException; + method public void sendRequestHeader(org.apache.http.HttpRequest) throws org.apache.http.HttpException, java.io.IOException; + method public void setIdleDuration(long, java.util.concurrent.TimeUnit); + method public void setSocketTimeout(int); + method public void unmarkReusable(); + } + + public abstract class AbstractPoolEntry { + ctor protected AbstractPoolEntry(org.apache.http.conn.ClientConnectionOperator, org.apache.http.conn.routing.HttpRoute); + method public java.lang.Object getState(); + method public void layerProtocol(org.apache.http.protocol.HttpContext, org.apache.http.params.HttpParams) throws java.io.IOException; + method public void open(org.apache.http.conn.routing.HttpRoute, org.apache.http.protocol.HttpContext, org.apache.http.params.HttpParams) throws java.io.IOException; + method public void setState(java.lang.Object); + method protected void shutdownEntry(); + method public void tunnelProxy(org.apache.http.HttpHost, boolean, org.apache.http.params.HttpParams) throws java.io.IOException; + method public void tunnelTarget(boolean, org.apache.http.params.HttpParams) throws java.io.IOException; + field protected final org.apache.http.conn.ClientConnectionOperator connOperator; + field protected final org.apache.http.conn.OperatedClientConnection connection; + field protected volatile org.apache.http.conn.routing.HttpRoute route; + field protected volatile java.lang.Object state; + field protected volatile org.apache.http.conn.routing.RouteTracker tracker; + } + + public abstract class AbstractPooledConnAdapter extends org.apache.http.impl.conn.AbstractClientConnAdapter { + ctor protected AbstractPooledConnAdapter(org.apache.http.conn.ClientConnectionManager, org.apache.http.impl.conn.AbstractPoolEntry); + method protected final void assertAttached(); + method public void close() throws java.io.IOException; + method public org.apache.http.conn.routing.HttpRoute getRoute(); + method public java.lang.Object getState(); + method public void layerProtocol(org.apache.http.protocol.HttpContext, org.apache.http.params.HttpParams) throws java.io.IOException; + method public void open(org.apache.http.conn.routing.HttpRoute, org.apache.http.protocol.HttpContext, org.apache.http.params.HttpParams) throws java.io.IOException; + method public void setState(java.lang.Object); + method public void shutdown() throws java.io.IOException; + method public void tunnelProxy(org.apache.http.HttpHost, boolean, org.apache.http.params.HttpParams) throws java.io.IOException; + method public void tunnelTarget(boolean, org.apache.http.params.HttpParams) throws java.io.IOException; + field protected volatile org.apache.http.impl.conn.AbstractPoolEntry poolEntry; + } + + public class DefaultClientConnection extends org.apache.http.impl.SocketHttpClientConnection implements org.apache.http.conn.OperatedClientConnection { + ctor public DefaultClientConnection(); + method public final java.net.Socket getSocket(); + method public final org.apache.http.HttpHost getTargetHost(); + method public final boolean isSecure(); + method public void openCompleted(boolean, org.apache.http.params.HttpParams) throws java.io.IOException; + method public void opening(java.net.Socket, org.apache.http.HttpHost) throws java.io.IOException; + method public void update(java.net.Socket, org.apache.http.HttpHost, boolean, org.apache.http.params.HttpParams) throws java.io.IOException; + } + + public class DefaultClientConnectionOperator implements org.apache.http.conn.ClientConnectionOperator { + ctor public DefaultClientConnectionOperator(org.apache.http.conn.scheme.SchemeRegistry); + method public org.apache.http.conn.OperatedClientConnection createConnection(); + method public void openConnection(org.apache.http.conn.OperatedClientConnection, org.apache.http.HttpHost, java.net.InetAddress, org.apache.http.protocol.HttpContext, org.apache.http.params.HttpParams) throws java.io.IOException; + method protected void prepareSocket(java.net.Socket, org.apache.http.protocol.HttpContext, org.apache.http.params.HttpParams) throws java.io.IOException; + method public void updateSecureConnection(org.apache.http.conn.OperatedClientConnection, org.apache.http.HttpHost, org.apache.http.protocol.HttpContext, org.apache.http.params.HttpParams) throws java.io.IOException; + field protected org.apache.http.conn.scheme.SchemeRegistry schemeRegistry; + } + + public class DefaultHttpRoutePlanner implements org.apache.http.conn.routing.HttpRoutePlanner { + ctor public DefaultHttpRoutePlanner(org.apache.http.conn.scheme.SchemeRegistry); + method public org.apache.http.conn.routing.HttpRoute determineRoute(org.apache.http.HttpHost, org.apache.http.HttpRequest, org.apache.http.protocol.HttpContext) throws org.apache.http.HttpException; + field protected org.apache.http.conn.scheme.SchemeRegistry schemeRegistry; + } + + public class DefaultResponseParser extends org.apache.http.impl.io.AbstractMessageParser { + ctor public DefaultResponseParser(org.apache.http.io.SessionInputBuffer, org.apache.http.message.LineParser, org.apache.http.HttpResponseFactory, org.apache.http.params.HttpParams); + method protected org.apache.http.HttpMessage parseHead(org.apache.http.io.SessionInputBuffer) throws org.apache.http.HttpException, java.io.IOException; + } + + public class IdleConnectionHandler { + ctor public IdleConnectionHandler(); + method public void add(org.apache.http.HttpConnection, long, java.util.concurrent.TimeUnit); + method public void closeExpiredConnections(); + method public void closeIdleConnections(long); + method public boolean remove(org.apache.http.HttpConnection); + method public void removeAll(); + } + + public class LoggingSessionInputBuffer implements org.apache.http.io.SessionInputBuffer { + ctor public LoggingSessionInputBuffer(org.apache.http.io.SessionInputBuffer, org.apache.http.impl.conn.Wire); + method public org.apache.http.io.HttpTransportMetrics getMetrics(); + method public boolean isDataAvailable(int) throws java.io.IOException; + method public int read(byte[], int, int) throws java.io.IOException; + method public int read() throws java.io.IOException; + method public int read(byte[]) throws java.io.IOException; + method public java.lang.String readLine() throws java.io.IOException; + method public int readLine(org.apache.http.util.CharArrayBuffer) throws java.io.IOException; + } + + public class LoggingSessionOutputBuffer implements org.apache.http.io.SessionOutputBuffer { + ctor public LoggingSessionOutputBuffer(org.apache.http.io.SessionOutputBuffer, org.apache.http.impl.conn.Wire); + method public void flush() throws java.io.IOException; + method public org.apache.http.io.HttpTransportMetrics getMetrics(); + method public void write(byte[], int, int) throws java.io.IOException; + method public void write(int) throws java.io.IOException; + method public void write(byte[]) throws java.io.IOException; + method public void writeLine(org.apache.http.util.CharArrayBuffer) throws java.io.IOException; + method public void writeLine(java.lang.String) throws java.io.IOException; + } + + public class ProxySelectorRoutePlanner implements org.apache.http.conn.routing.HttpRoutePlanner { + ctor public ProxySelectorRoutePlanner(org.apache.http.conn.scheme.SchemeRegistry, java.net.ProxySelector); + method protected java.net.Proxy chooseProxy(java.util.List, org.apache.http.HttpHost, org.apache.http.HttpRequest, org.apache.http.protocol.HttpContext); + method protected org.apache.http.HttpHost determineProxy(org.apache.http.HttpHost, org.apache.http.HttpRequest, org.apache.http.protocol.HttpContext) throws org.apache.http.HttpException; + method public org.apache.http.conn.routing.HttpRoute determineRoute(org.apache.http.HttpHost, org.apache.http.HttpRequest, org.apache.http.protocol.HttpContext) throws org.apache.http.HttpException; + method protected java.lang.String getHost(java.net.InetSocketAddress); + method public java.net.ProxySelector getProxySelector(); + method public void setProxySelector(java.net.ProxySelector); + field protected java.net.ProxySelector proxySelector; + field protected org.apache.http.conn.scheme.SchemeRegistry schemeRegistry; + } + + public class SingleClientConnManager implements org.apache.http.conn.ClientConnectionManager { + ctor public SingleClientConnManager(org.apache.http.params.HttpParams, org.apache.http.conn.scheme.SchemeRegistry); + method protected final void assertStillUp() throws java.lang.IllegalStateException; + method public void closeExpiredConnections(); + method public void closeIdleConnections(long, java.util.concurrent.TimeUnit); + method protected org.apache.http.conn.ClientConnectionOperator createConnectionOperator(org.apache.http.conn.scheme.SchemeRegistry); + method public org.apache.http.conn.ManagedClientConnection getConnection(org.apache.http.conn.routing.HttpRoute, java.lang.Object); + method public org.apache.http.conn.scheme.SchemeRegistry getSchemeRegistry(); + method public void releaseConnection(org.apache.http.conn.ManagedClientConnection, long, java.util.concurrent.TimeUnit); + method public final org.apache.http.conn.ClientConnectionRequest requestConnection(org.apache.http.conn.routing.HttpRoute, java.lang.Object); + method protected void revokeConnection(); + method public void shutdown(); + field public static final java.lang.String MISUSE_MESSAGE = "Invalid use of SingleClientConnManager: connection still allocated.\nMake sure to release the connection before allocating another one."; + field protected boolean alwaysShutDown; + field protected org.apache.http.conn.ClientConnectionOperator connOperator; + field protected long connectionExpiresTime; + field protected volatile boolean isShutDown; + field protected long lastReleaseTime; + field protected org.apache.http.impl.conn.SingleClientConnManager.ConnAdapter managedConn; + field protected org.apache.http.conn.scheme.SchemeRegistry schemeRegistry; + field protected org.apache.http.impl.conn.SingleClientConnManager.PoolEntry uniquePoolEntry; + } + + protected class SingleClientConnManager.ConnAdapter extends org.apache.http.impl.conn.AbstractPooledConnAdapter { + ctor protected SingleClientConnManager.ConnAdapter(org.apache.http.impl.conn.SingleClientConnManager.PoolEntry, org.apache.http.conn.routing.HttpRoute); + } + + protected class SingleClientConnManager.PoolEntry extends org.apache.http.impl.conn.AbstractPoolEntry { + ctor protected SingleClientConnManager.PoolEntry(); + method protected void close() throws java.io.IOException; + method protected void shutdown() throws java.io.IOException; + } + + public class Wire { + ctor public Wire(org.apache.commons.logging.Log); + method public boolean enabled(); + method public void input(java.io.InputStream) throws java.io.IOException; + method public void input(byte[], int, int) throws java.io.IOException; + method public void input(byte[]) throws java.io.IOException; + method public void input(int) throws java.io.IOException; + method public void input(java.lang.String) throws java.io.IOException; + method public void output(java.io.InputStream) throws java.io.IOException; + method public void output(byte[], int, int) throws java.io.IOException; + method public void output(byte[]) throws java.io.IOException; + method public void output(int) throws java.io.IOException; + method public void output(java.lang.String) throws java.io.IOException; + } + +} + +package org.apache.http.impl.conn.tsccm { + + public abstract class AbstractConnPool implements org.apache.http.impl.conn.tsccm.RefQueueHandler { + ctor protected AbstractConnPool(); + method protected void closeConnection(org.apache.http.conn.OperatedClientConnection); + method public void closeExpiredConnections(); + method public void closeIdleConnections(long, java.util.concurrent.TimeUnit); + method public abstract void deleteClosedConnections(); + method public void enableConnectionGC() throws java.lang.IllegalStateException; + method public abstract void freeEntry(org.apache.http.impl.conn.tsccm.BasicPoolEntry, boolean, long, java.util.concurrent.TimeUnit); + method public final org.apache.http.impl.conn.tsccm.BasicPoolEntry getEntry(org.apache.http.conn.routing.HttpRoute, java.lang.Object, long, java.util.concurrent.TimeUnit) throws org.apache.http.conn.ConnectionPoolTimeoutException, java.lang.InterruptedException; + method protected abstract void handleLostEntry(org.apache.http.conn.routing.HttpRoute); + method public void handleReference(java.lang.ref.Reference); + method public abstract org.apache.http.impl.conn.tsccm.PoolEntryRequest requestPoolEntry(org.apache.http.conn.routing.HttpRoute, java.lang.Object); + method public void shutdown(); + field protected org.apache.http.impl.conn.IdleConnectionHandler idleConnHandler; + field protected volatile boolean isShutDown; + field protected java.util.Set issuedConnections; + field protected int numConnections; + field protected final java.util.concurrent.locks.Lock poolLock; + field protected java.lang.ref.ReferenceQueue refQueue; + } + + public class BasicPoolEntry extends org.apache.http.impl.conn.AbstractPoolEntry { + ctor public BasicPoolEntry(org.apache.http.conn.ClientConnectionOperator, org.apache.http.conn.routing.HttpRoute, java.lang.ref.ReferenceQueue); + method protected final org.apache.http.conn.OperatedClientConnection getConnection(); + method protected final org.apache.http.conn.routing.HttpRoute getPlannedRoute(); + method protected final org.apache.http.impl.conn.tsccm.BasicPoolEntryRef getWeakRef(); + } + + public class BasicPoolEntryRef extends java.lang.ref.WeakReference { + ctor public BasicPoolEntryRef(org.apache.http.impl.conn.tsccm.BasicPoolEntry, java.lang.ref.ReferenceQueue); + method public final org.apache.http.conn.routing.HttpRoute getRoute(); + } + + public class BasicPooledConnAdapter extends org.apache.http.impl.conn.AbstractPooledConnAdapter { + ctor protected BasicPooledConnAdapter(org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager, org.apache.http.impl.conn.AbstractPoolEntry); + method protected org.apache.http.impl.conn.AbstractPoolEntry getPoolEntry(); + } + + public class ConnPoolByRoute extends org.apache.http.impl.conn.tsccm.AbstractConnPool { + ctor public ConnPoolByRoute(org.apache.http.conn.ClientConnectionOperator, org.apache.http.params.HttpParams); + method protected org.apache.http.impl.conn.tsccm.BasicPoolEntry createEntry(org.apache.http.impl.conn.tsccm.RouteSpecificPool, org.apache.http.conn.ClientConnectionOperator); + method protected java.util.Queue createFreeConnQueue(); + method protected java.util.Map createRouteToPoolMap(); + method protected java.util.Queue createWaitingThreadQueue(); + method public void deleteClosedConnections(); + method protected void deleteEntry(org.apache.http.impl.conn.tsccm.BasicPoolEntry); + method protected void deleteLeastUsedEntry(); + method public void freeEntry(org.apache.http.impl.conn.tsccm.BasicPoolEntry, boolean, long, java.util.concurrent.TimeUnit); + method public int getConnectionsInPool(org.apache.http.conn.routing.HttpRoute); + method protected org.apache.http.impl.conn.tsccm.BasicPoolEntry getEntryBlocking(org.apache.http.conn.routing.HttpRoute, java.lang.Object, long, java.util.concurrent.TimeUnit, org.apache.http.impl.conn.tsccm.WaitingThreadAborter) throws org.apache.http.conn.ConnectionPoolTimeoutException, java.lang.InterruptedException; + method protected org.apache.http.impl.conn.tsccm.BasicPoolEntry getFreeEntry(org.apache.http.impl.conn.tsccm.RouteSpecificPool, java.lang.Object); + method protected org.apache.http.impl.conn.tsccm.RouteSpecificPool getRoutePool(org.apache.http.conn.routing.HttpRoute, boolean); + method protected void handleLostEntry(org.apache.http.conn.routing.HttpRoute); + method protected org.apache.http.impl.conn.tsccm.RouteSpecificPool newRouteSpecificPool(org.apache.http.conn.routing.HttpRoute); + method protected org.apache.http.impl.conn.tsccm.WaitingThread newWaitingThread(java.util.concurrent.locks.Condition, org.apache.http.impl.conn.tsccm.RouteSpecificPool); + method protected void notifyWaitingThread(org.apache.http.impl.conn.tsccm.RouteSpecificPool); + method public org.apache.http.impl.conn.tsccm.PoolEntryRequest requestPoolEntry(org.apache.http.conn.routing.HttpRoute, java.lang.Object); + field protected java.util.Queue freeConnections; + field protected final int maxTotalConnections; + field protected final org.apache.http.conn.ClientConnectionOperator operator; + field protected final java.util.Map routeToPool; + field protected java.util.Queue waitingThreads; + } + + public abstract interface PoolEntryRequest { + method public abstract void abortRequest(); + method public abstract org.apache.http.impl.conn.tsccm.BasicPoolEntry getPoolEntry(long, java.util.concurrent.TimeUnit) throws org.apache.http.conn.ConnectionPoolTimeoutException, java.lang.InterruptedException; + } + + public abstract interface RefQueueHandler { + method public abstract void handleReference(java.lang.ref.Reference); + } + + public class RefQueueWorker implements java.lang.Runnable { + ctor public RefQueueWorker(java.lang.ref.ReferenceQueue, org.apache.http.impl.conn.tsccm.RefQueueHandler); + method public void run(); + method public void shutdown(); + field protected final org.apache.http.impl.conn.tsccm.RefQueueHandler refHandler; + field protected final java.lang.ref.ReferenceQueue refQueue; + field protected volatile java.lang.Thread workerThread; + } + + public class RouteSpecificPool { + ctor public RouteSpecificPool(org.apache.http.conn.routing.HttpRoute, int); + method public org.apache.http.impl.conn.tsccm.BasicPoolEntry allocEntry(java.lang.Object); + method public void createdEntry(org.apache.http.impl.conn.tsccm.BasicPoolEntry); + method public boolean deleteEntry(org.apache.http.impl.conn.tsccm.BasicPoolEntry); + method public void dropEntry(); + method public void freeEntry(org.apache.http.impl.conn.tsccm.BasicPoolEntry); + method public int getCapacity(); + method public final int getEntryCount(); + method public final int getMaxEntries(); + method public final org.apache.http.conn.routing.HttpRoute getRoute(); + method public boolean hasThread(); + method public boolean isUnused(); + method public org.apache.http.impl.conn.tsccm.WaitingThread nextThread(); + method public void queueThread(org.apache.http.impl.conn.tsccm.WaitingThread); + method public void removeThread(org.apache.http.impl.conn.tsccm.WaitingThread); + field protected final java.util.LinkedList freeEntries; + field protected final int maxEntries; + field protected int numEntries; + field protected final org.apache.http.conn.routing.HttpRoute route; + field protected final java.util.Queue waitingThreads; + } + + public class ThreadSafeClientConnManager implements org.apache.http.conn.ClientConnectionManager { + ctor public ThreadSafeClientConnManager(org.apache.http.params.HttpParams, org.apache.http.conn.scheme.SchemeRegistry); + method public void closeExpiredConnections(); + method public void closeIdleConnections(long, java.util.concurrent.TimeUnit); + method protected org.apache.http.conn.ClientConnectionOperator createConnectionOperator(org.apache.http.conn.scheme.SchemeRegistry); + method protected org.apache.http.impl.conn.tsccm.AbstractConnPool createConnectionPool(org.apache.http.params.HttpParams); + method public int getConnectionsInPool(org.apache.http.conn.routing.HttpRoute); + method public int getConnectionsInPool(); + method public org.apache.http.conn.scheme.SchemeRegistry getSchemeRegistry(); + method public void releaseConnection(org.apache.http.conn.ManagedClientConnection, long, java.util.concurrent.TimeUnit); + method public org.apache.http.conn.ClientConnectionRequest requestConnection(org.apache.http.conn.routing.HttpRoute, java.lang.Object); + method public void shutdown(); + field protected org.apache.http.conn.ClientConnectionOperator connOperator; + field protected final org.apache.http.impl.conn.tsccm.AbstractConnPool connectionPool; + field protected org.apache.http.conn.scheme.SchemeRegistry schemeRegistry; + } + + public class WaitingThread { + ctor public WaitingThread(java.util.concurrent.locks.Condition, org.apache.http.impl.conn.tsccm.RouteSpecificPool); + method public boolean await(java.util.Date) throws java.lang.InterruptedException; + method public final java.util.concurrent.locks.Condition getCondition(); + method public final org.apache.http.impl.conn.tsccm.RouteSpecificPool getPool(); + method public final java.lang.Thread getThread(); + method public void interrupt(); + method public void wakeup(); + } + + public class WaitingThreadAborter { + ctor public WaitingThreadAborter(); + method public void abort(); + method public void setWaitingThread(org.apache.http.impl.conn.tsccm.WaitingThread); + } + +} + +package org.apache.http.impl.cookie { + + public abstract class AbstractCookieAttributeHandler implements org.apache.http.cookie.CookieAttributeHandler { + ctor public AbstractCookieAttributeHandler(); + method public boolean match(org.apache.http.cookie.Cookie, org.apache.http.cookie.CookieOrigin); + method public void validate(org.apache.http.cookie.Cookie, org.apache.http.cookie.CookieOrigin) throws org.apache.http.cookie.MalformedCookieException; + } + + public abstract class AbstractCookieSpec implements org.apache.http.cookie.CookieSpec { + ctor public AbstractCookieSpec(); + method protected org.apache.http.cookie.CookieAttributeHandler findAttribHandler(java.lang.String); + method protected org.apache.http.cookie.CookieAttributeHandler getAttribHandler(java.lang.String); + method protected java.util.Collection getAttribHandlers(); + method public void registerAttribHandler(java.lang.String, org.apache.http.cookie.CookieAttributeHandler); + } + + public class BasicClientCookie implements org.apache.http.cookie.ClientCookie java.lang.Cloneable org.apache.http.cookie.SetCookie { + ctor public BasicClientCookie(java.lang.String, java.lang.String); + method public java.lang.Object clone() throws java.lang.CloneNotSupportedException; + method public boolean containsAttribute(java.lang.String); + method public java.lang.String getAttribute(java.lang.String); + method public java.lang.String getComment(); + method public java.lang.String getCommentURL(); + method public java.lang.String getDomain(); + method public java.util.Date getExpiryDate(); + method public java.lang.String getName(); + method public java.lang.String getPath(); + method public int[] getPorts(); + method public java.lang.String getValue(); + method public int getVersion(); + method public boolean isExpired(java.util.Date); + method public boolean isPersistent(); + method public boolean isSecure(); + method public void setAttribute(java.lang.String, java.lang.String); + method public void setComment(java.lang.String); + method public void setDomain(java.lang.String); + method public void setExpiryDate(java.util.Date); + method public void setPath(java.lang.String); + method public void setSecure(boolean); + method public void setValue(java.lang.String); + method public void setVersion(int); + } + + public class BasicClientCookie2 extends org.apache.http.impl.cookie.BasicClientCookie implements org.apache.http.cookie.SetCookie2 { + ctor public BasicClientCookie2(java.lang.String, java.lang.String); + method public void setCommentURL(java.lang.String); + method public void setDiscard(boolean); + method public void setPorts(int[]); + } + + public class BasicCommentHandler extends org.apache.http.impl.cookie.AbstractCookieAttributeHandler { + ctor public BasicCommentHandler(); + method public void parse(org.apache.http.cookie.SetCookie, java.lang.String) throws org.apache.http.cookie.MalformedCookieException; + } + + public class BasicDomainHandler implements org.apache.http.cookie.CookieAttributeHandler { + ctor public BasicDomainHandler(); + method public boolean match(org.apache.http.cookie.Cookie, org.apache.http.cookie.CookieOrigin); + method public void parse(org.apache.http.cookie.SetCookie, java.lang.String) throws org.apache.http.cookie.MalformedCookieException; + method public void validate(org.apache.http.cookie.Cookie, org.apache.http.cookie.CookieOrigin) throws org.apache.http.cookie.MalformedCookieException; + } + + public class BasicExpiresHandler extends org.apache.http.impl.cookie.AbstractCookieAttributeHandler { + ctor public BasicExpiresHandler(java.lang.String[]); + method public void parse(org.apache.http.cookie.SetCookie, java.lang.String) throws org.apache.http.cookie.MalformedCookieException; + } + + public class BasicMaxAgeHandler extends org.apache.http.impl.cookie.AbstractCookieAttributeHandler { + ctor public BasicMaxAgeHandler(); + method public void parse(org.apache.http.cookie.SetCookie, java.lang.String) throws org.apache.http.cookie.MalformedCookieException; + } + + public class BasicPathHandler implements org.apache.http.cookie.CookieAttributeHandler { + ctor public BasicPathHandler(); + method public boolean match(org.apache.http.cookie.Cookie, org.apache.http.cookie.CookieOrigin); + method public void parse(org.apache.http.cookie.SetCookie, java.lang.String) throws org.apache.http.cookie.MalformedCookieException; + method public void validate(org.apache.http.cookie.Cookie, org.apache.http.cookie.CookieOrigin) throws org.apache.http.cookie.MalformedCookieException; + } + + public class BasicSecureHandler extends org.apache.http.impl.cookie.AbstractCookieAttributeHandler { + ctor public BasicSecureHandler(); + method public void parse(org.apache.http.cookie.SetCookie, java.lang.String) throws org.apache.http.cookie.MalformedCookieException; + } + + public class BestMatchSpec implements org.apache.http.cookie.CookieSpec { + ctor public BestMatchSpec(java.lang.String[], boolean); + ctor public BestMatchSpec(); + method public java.util.List formatCookies(java.util.List); + method public int getVersion(); + method public org.apache.http.Header getVersionHeader(); + method public boolean match(org.apache.http.cookie.Cookie, org.apache.http.cookie.CookieOrigin); + method public java.util.List parse(org.apache.http.Header, org.apache.http.cookie.CookieOrigin) throws org.apache.http.cookie.MalformedCookieException; + method public void validate(org.apache.http.cookie.Cookie, org.apache.http.cookie.CookieOrigin) throws org.apache.http.cookie.MalformedCookieException; + } + + public class BestMatchSpecFactory implements org.apache.http.cookie.CookieSpecFactory { + ctor public BestMatchSpecFactory(); + method public org.apache.http.cookie.CookieSpec newInstance(org.apache.http.params.HttpParams); + } + + public class BrowserCompatSpec extends org.apache.http.impl.cookie.CookieSpecBase { + ctor public BrowserCompatSpec(java.lang.String[]); + ctor public BrowserCompatSpec(); + method public java.util.List formatCookies(java.util.List); + method public int getVersion(); + method public org.apache.http.Header getVersionHeader(); + method public java.util.List parse(org.apache.http.Header, org.apache.http.cookie.CookieOrigin) throws org.apache.http.cookie.MalformedCookieException; + field protected static final java.lang.String[] DATE_PATTERNS; + } + + public class BrowserCompatSpecFactory implements org.apache.http.cookie.CookieSpecFactory { + ctor public BrowserCompatSpecFactory(); + method public org.apache.http.cookie.CookieSpec newInstance(org.apache.http.params.HttpParams); + } + + public abstract class CookieSpecBase extends org.apache.http.impl.cookie.AbstractCookieSpec { + ctor public CookieSpecBase(); + method protected static java.lang.String getDefaultDomain(org.apache.http.cookie.CookieOrigin); + method protected static java.lang.String getDefaultPath(org.apache.http.cookie.CookieOrigin); + method public boolean match(org.apache.http.cookie.Cookie, org.apache.http.cookie.CookieOrigin); + method protected java.util.List parse(org.apache.http.HeaderElement[], org.apache.http.cookie.CookieOrigin) throws org.apache.http.cookie.MalformedCookieException; + method public void validate(org.apache.http.cookie.Cookie, org.apache.http.cookie.CookieOrigin) throws org.apache.http.cookie.MalformedCookieException; + } + + public class DateParseException extends java.lang.Exception { + ctor public DateParseException(); + ctor public DateParseException(java.lang.String); + } + + public final class DateUtils { + method public static java.lang.String formatDate(java.util.Date); + method public static java.lang.String formatDate(java.util.Date, java.lang.String); + method public static java.util.Date parseDate(java.lang.String) throws org.apache.http.impl.cookie.DateParseException; + method public static java.util.Date parseDate(java.lang.String, java.lang.String[]) throws org.apache.http.impl.cookie.DateParseException; + method public static java.util.Date parseDate(java.lang.String, java.lang.String[], java.util.Date) throws org.apache.http.impl.cookie.DateParseException; + field public static final java.util.TimeZone GMT; + field public static final java.lang.String PATTERN_ASCTIME = "EEE MMM d HH:mm:ss yyyy"; + field public static final java.lang.String PATTERN_RFC1036 = "EEEE, dd-MMM-yy HH:mm:ss zzz"; + field public static final java.lang.String PATTERN_RFC1123 = "EEE, dd MMM yyyy HH:mm:ss zzz"; + } + + public class NetscapeDomainHandler extends org.apache.http.impl.cookie.BasicDomainHandler { + ctor public NetscapeDomainHandler(); + } + + public class NetscapeDraftHeaderParser { + ctor public NetscapeDraftHeaderParser(); + method public org.apache.http.HeaderElement parseHeader(org.apache.http.util.CharArrayBuffer, org.apache.http.message.ParserCursor) throws org.apache.http.ParseException; + field public static final org.apache.http.impl.cookie.NetscapeDraftHeaderParser DEFAULT; + } + + public class NetscapeDraftSpec extends org.apache.http.impl.cookie.CookieSpecBase { + ctor public NetscapeDraftSpec(java.lang.String[]); + ctor public NetscapeDraftSpec(); + method public java.util.List formatCookies(java.util.List); + method public int getVersion(); + method public org.apache.http.Header getVersionHeader(); + method public java.util.List parse(org.apache.http.Header, org.apache.http.cookie.CookieOrigin) throws org.apache.http.cookie.MalformedCookieException; + field protected static final java.lang.String EXPIRES_PATTERN = "EEE, dd-MMM-yyyy HH:mm:ss z"; + } + + public class NetscapeDraftSpecFactory implements org.apache.http.cookie.CookieSpecFactory { + ctor public NetscapeDraftSpecFactory(); + method public org.apache.http.cookie.CookieSpec newInstance(org.apache.http.params.HttpParams); + } + + public class RFC2109DomainHandler implements org.apache.http.cookie.CookieAttributeHandler { + ctor public RFC2109DomainHandler(); + method public boolean match(org.apache.http.cookie.Cookie, org.apache.http.cookie.CookieOrigin); + method public void parse(org.apache.http.cookie.SetCookie, java.lang.String) throws org.apache.http.cookie.MalformedCookieException; + method public void validate(org.apache.http.cookie.Cookie, org.apache.http.cookie.CookieOrigin) throws org.apache.http.cookie.MalformedCookieException; + } + + public class RFC2109Spec extends org.apache.http.impl.cookie.CookieSpecBase { + ctor public RFC2109Spec(java.lang.String[], boolean); + ctor public RFC2109Spec(); + method protected void formatCookieAsVer(org.apache.http.util.CharArrayBuffer, org.apache.http.cookie.Cookie, int); + method public java.util.List formatCookies(java.util.List); + method protected void formatParamAsVer(org.apache.http.util.CharArrayBuffer, java.lang.String, java.lang.String, int); + method public int getVersion(); + method public org.apache.http.Header getVersionHeader(); + method public java.util.List parse(org.apache.http.Header, org.apache.http.cookie.CookieOrigin) throws org.apache.http.cookie.MalformedCookieException; + } + + public class RFC2109SpecFactory implements org.apache.http.cookie.CookieSpecFactory { + ctor public RFC2109SpecFactory(); + method public org.apache.http.cookie.CookieSpec newInstance(org.apache.http.params.HttpParams); + } + + public class RFC2109VersionHandler extends org.apache.http.impl.cookie.AbstractCookieAttributeHandler { + ctor public RFC2109VersionHandler(); + method public void parse(org.apache.http.cookie.SetCookie, java.lang.String) throws org.apache.http.cookie.MalformedCookieException; + } + + public class RFC2965CommentUrlAttributeHandler implements org.apache.http.cookie.CookieAttributeHandler { + ctor public RFC2965CommentUrlAttributeHandler(); + method public boolean match(org.apache.http.cookie.Cookie, org.apache.http.cookie.CookieOrigin); + method public void parse(org.apache.http.cookie.SetCookie, java.lang.String) throws org.apache.http.cookie.MalformedCookieException; + method public void validate(org.apache.http.cookie.Cookie, org.apache.http.cookie.CookieOrigin) throws org.apache.http.cookie.MalformedCookieException; + } + + public class RFC2965DiscardAttributeHandler implements org.apache.http.cookie.CookieAttributeHandler { + ctor public RFC2965DiscardAttributeHandler(); + method public boolean match(org.apache.http.cookie.Cookie, org.apache.http.cookie.CookieOrigin); + method public void parse(org.apache.http.cookie.SetCookie, java.lang.String) throws org.apache.http.cookie.MalformedCookieException; + method public void validate(org.apache.http.cookie.Cookie, org.apache.http.cookie.CookieOrigin) throws org.apache.http.cookie.MalformedCookieException; + } + + public class RFC2965DomainAttributeHandler implements org.apache.http.cookie.CookieAttributeHandler { + ctor public RFC2965DomainAttributeHandler(); + method public boolean domainMatch(java.lang.String, java.lang.String); + method public boolean match(org.apache.http.cookie.Cookie, org.apache.http.cookie.CookieOrigin); + method public void parse(org.apache.http.cookie.SetCookie, java.lang.String) throws org.apache.http.cookie.MalformedCookieException; + method public void validate(org.apache.http.cookie.Cookie, org.apache.http.cookie.CookieOrigin) throws org.apache.http.cookie.MalformedCookieException; + } + + public class RFC2965PortAttributeHandler implements org.apache.http.cookie.CookieAttributeHandler { + ctor public RFC2965PortAttributeHandler(); + method public boolean match(org.apache.http.cookie.Cookie, org.apache.http.cookie.CookieOrigin); + method public void parse(org.apache.http.cookie.SetCookie, java.lang.String) throws org.apache.http.cookie.MalformedCookieException; + method public void validate(org.apache.http.cookie.Cookie, org.apache.http.cookie.CookieOrigin) throws org.apache.http.cookie.MalformedCookieException; + } + + public class RFC2965Spec extends org.apache.http.impl.cookie.RFC2109Spec { + ctor public RFC2965Spec(); + ctor public RFC2965Spec(java.lang.String[], boolean); + } + + public class RFC2965SpecFactory implements org.apache.http.cookie.CookieSpecFactory { + ctor public RFC2965SpecFactory(); + method public org.apache.http.cookie.CookieSpec newInstance(org.apache.http.params.HttpParams); + } + + public class RFC2965VersionAttributeHandler implements org.apache.http.cookie.CookieAttributeHandler { + ctor public RFC2965VersionAttributeHandler(); + method public boolean match(org.apache.http.cookie.Cookie, org.apache.http.cookie.CookieOrigin); + method public void parse(org.apache.http.cookie.SetCookie, java.lang.String) throws org.apache.http.cookie.MalformedCookieException; + method public void validate(org.apache.http.cookie.Cookie, org.apache.http.cookie.CookieOrigin) throws org.apache.http.cookie.MalformedCookieException; + } + +} + +package org.apache.http.impl.entity { + + public class EntityDeserializer { + ctor public EntityDeserializer(org.apache.http.entity.ContentLengthStrategy); + method public org.apache.http.HttpEntity deserialize(org.apache.http.io.SessionInputBuffer, org.apache.http.HttpMessage) throws org.apache.http.HttpException, java.io.IOException; + method protected org.apache.http.entity.BasicHttpEntity doDeserialize(org.apache.http.io.SessionInputBuffer, org.apache.http.HttpMessage) throws org.apache.http.HttpException, java.io.IOException; + } + + public class EntitySerializer { + ctor public EntitySerializer(org.apache.http.entity.ContentLengthStrategy); + method protected java.io.OutputStream doSerialize(org.apache.http.io.SessionOutputBuffer, org.apache.http.HttpMessage) throws org.apache.http.HttpException, java.io.IOException; + method public void serialize(org.apache.http.io.SessionOutputBuffer, org.apache.http.HttpMessage, org.apache.http.HttpEntity) throws org.apache.http.HttpException, java.io.IOException; + } + + public class LaxContentLengthStrategy implements org.apache.http.entity.ContentLengthStrategy { + ctor public LaxContentLengthStrategy(); + method public long determineLength(org.apache.http.HttpMessage) throws org.apache.http.HttpException; + } + + public class StrictContentLengthStrategy implements org.apache.http.entity.ContentLengthStrategy { + ctor public StrictContentLengthStrategy(); + method public long determineLength(org.apache.http.HttpMessage) throws org.apache.http.HttpException; + } + +} + +package org.apache.http.impl.io { + + public abstract class AbstractMessageParser implements org.apache.http.io.HttpMessageParser { + ctor public AbstractMessageParser(org.apache.http.io.SessionInputBuffer, org.apache.http.message.LineParser, org.apache.http.params.HttpParams); + method public org.apache.http.HttpMessage parse() throws org.apache.http.HttpException, java.io.IOException; + method protected abstract org.apache.http.HttpMessage parseHead(org.apache.http.io.SessionInputBuffer) throws org.apache.http.HttpException, java.io.IOException, org.apache.http.ParseException; + method public static org.apache.http.Header[] parseHeaders(org.apache.http.io.SessionInputBuffer, int, int, org.apache.http.message.LineParser) throws org.apache.http.HttpException, java.io.IOException; + field protected final org.apache.http.message.LineParser lineParser; + } + + public abstract class AbstractMessageWriter implements org.apache.http.io.HttpMessageWriter { + ctor public AbstractMessageWriter(org.apache.http.io.SessionOutputBuffer, org.apache.http.message.LineFormatter, org.apache.http.params.HttpParams); + method public void write(org.apache.http.HttpMessage) throws org.apache.http.HttpException, java.io.IOException; + method protected abstract void writeHeadLine(org.apache.http.HttpMessage) throws java.io.IOException; + field protected final org.apache.http.util.CharArrayBuffer lineBuf; + field protected final org.apache.http.message.LineFormatter lineFormatter; + field protected final org.apache.http.io.SessionOutputBuffer sessionBuffer; + } + + public abstract class AbstractSessionInputBuffer implements org.apache.http.io.SessionInputBuffer { + ctor public AbstractSessionInputBuffer(); + method protected int fillBuffer() throws java.io.IOException; + method public org.apache.http.io.HttpTransportMetrics getMetrics(); + method protected boolean hasBufferedData(); + method protected void init(java.io.InputStream, int, org.apache.http.params.HttpParams); + method public int read() throws java.io.IOException; + method public int read(byte[], int, int) throws java.io.IOException; + method public int read(byte[]) throws java.io.IOException; + method public int readLine(org.apache.http.util.CharArrayBuffer) throws java.io.IOException; + method public java.lang.String readLine() throws java.io.IOException; + } + + public abstract class AbstractSessionOutputBuffer implements org.apache.http.io.SessionOutputBuffer { + ctor public AbstractSessionOutputBuffer(); + method public void flush() throws java.io.IOException; + method protected void flushBuffer() throws java.io.IOException; + method public org.apache.http.io.HttpTransportMetrics getMetrics(); + method protected void init(java.io.OutputStream, int, org.apache.http.params.HttpParams); + method public void write(byte[], int, int) throws java.io.IOException; + method public void write(byte[]) throws java.io.IOException; + method public void write(int) throws java.io.IOException; + method public void writeLine(java.lang.String) throws java.io.IOException; + method public void writeLine(org.apache.http.util.CharArrayBuffer) throws java.io.IOException; + } + + public class ChunkedInputStream extends java.io.InputStream { + ctor public ChunkedInputStream(org.apache.http.io.SessionInputBuffer); + method public org.apache.http.Header[] getFooters(); + method public int read() throws java.io.IOException; + } + + public class ChunkedOutputStream extends java.io.OutputStream { + ctor public ChunkedOutputStream(org.apache.http.io.SessionOutputBuffer, int) throws java.io.IOException; + ctor public ChunkedOutputStream(org.apache.http.io.SessionOutputBuffer) throws java.io.IOException; + method public void finish() throws java.io.IOException; + method protected void flushCache() throws java.io.IOException; + method protected void flushCacheWithAppend(byte[], int, int) throws java.io.IOException; + method public void write(int) throws java.io.IOException; + method protected void writeClosingChunk() throws java.io.IOException; + } + + public class ContentLengthInputStream extends java.io.InputStream { + ctor public ContentLengthInputStream(org.apache.http.io.SessionInputBuffer, long); + method public int read() throws java.io.IOException; + } + + public class ContentLengthOutputStream extends java.io.OutputStream { + ctor public ContentLengthOutputStream(org.apache.http.io.SessionOutputBuffer, long); + method public void write(int) throws java.io.IOException; + } + + public class HttpRequestParser extends org.apache.http.impl.io.AbstractMessageParser { + ctor public HttpRequestParser(org.apache.http.io.SessionInputBuffer, org.apache.http.message.LineParser, org.apache.http.HttpRequestFactory, org.apache.http.params.HttpParams); + method protected org.apache.http.HttpMessage parseHead(org.apache.http.io.SessionInputBuffer) throws org.apache.http.HttpException, java.io.IOException, org.apache.http.ParseException; + } + + public class HttpRequestWriter extends org.apache.http.impl.io.AbstractMessageWriter { + ctor public HttpRequestWriter(org.apache.http.io.SessionOutputBuffer, org.apache.http.message.LineFormatter, org.apache.http.params.HttpParams); + method protected void writeHeadLine(org.apache.http.HttpMessage) throws java.io.IOException; + } + + public class HttpResponseParser extends org.apache.http.impl.io.AbstractMessageParser { + ctor public HttpResponseParser(org.apache.http.io.SessionInputBuffer, org.apache.http.message.LineParser, org.apache.http.HttpResponseFactory, org.apache.http.params.HttpParams); + method protected org.apache.http.HttpMessage parseHead(org.apache.http.io.SessionInputBuffer) throws org.apache.http.HttpException, java.io.IOException, org.apache.http.ParseException; + } + + public class HttpResponseWriter extends org.apache.http.impl.io.AbstractMessageWriter { + ctor public HttpResponseWriter(org.apache.http.io.SessionOutputBuffer, org.apache.http.message.LineFormatter, org.apache.http.params.HttpParams); + method protected void writeHeadLine(org.apache.http.HttpMessage) throws java.io.IOException; + } + + public class HttpTransportMetricsImpl implements org.apache.http.io.HttpTransportMetrics { + ctor public HttpTransportMetricsImpl(); + method public long getBytesTransferred(); + method public void incrementBytesTransferred(long); + method public void reset(); + method public void setBytesTransferred(long); + } + + public class IdentityInputStream extends java.io.InputStream { + ctor public IdentityInputStream(org.apache.http.io.SessionInputBuffer); + method public int read() throws java.io.IOException; + } + + public class IdentityOutputStream extends java.io.OutputStream { + ctor public IdentityOutputStream(org.apache.http.io.SessionOutputBuffer); + method public void write(int) throws java.io.IOException; + } + + public class SocketInputBuffer extends org.apache.http.impl.io.AbstractSessionInputBuffer { + ctor public SocketInputBuffer(java.net.Socket, int, org.apache.http.params.HttpParams) throws java.io.IOException; + method public boolean isDataAvailable(int) throws java.io.IOException; + } + + public class SocketOutputBuffer extends org.apache.http.impl.io.AbstractSessionOutputBuffer { + ctor public SocketOutputBuffer(java.net.Socket, int, org.apache.http.params.HttpParams) throws java.io.IOException; + } + +} + +package org.apache.http.io { + + public abstract interface HttpMessageParser { + method public abstract org.apache.http.HttpMessage parse() throws org.apache.http.HttpException, java.io.IOException; + } + + public abstract interface HttpMessageWriter { + method public abstract void write(org.apache.http.HttpMessage) throws org.apache.http.HttpException, java.io.IOException; + } + + public abstract interface HttpTransportMetrics { + method public abstract long getBytesTransferred(); + method public abstract void reset(); + } + + public abstract interface SessionInputBuffer { + method public abstract org.apache.http.io.HttpTransportMetrics getMetrics(); + method public abstract boolean isDataAvailable(int) throws java.io.IOException; + method public abstract int read(byte[], int, int) throws java.io.IOException; + method public abstract int read(byte[]) throws java.io.IOException; + method public abstract int read() throws java.io.IOException; + method public abstract int readLine(org.apache.http.util.CharArrayBuffer) throws java.io.IOException; + method public abstract java.lang.String readLine() throws java.io.IOException; + } + + public abstract interface SessionOutputBuffer { + method public abstract void flush() throws java.io.IOException; + method public abstract org.apache.http.io.HttpTransportMetrics getMetrics(); + method public abstract void write(byte[], int, int) throws java.io.IOException; + method public abstract void write(byte[]) throws java.io.IOException; + method public abstract void write(int) throws java.io.IOException; + method public abstract void writeLine(java.lang.String) throws java.io.IOException; + method public abstract void writeLine(org.apache.http.util.CharArrayBuffer) throws java.io.IOException; + } + +} + +package org.apache.http.message { + + public abstract class AbstractHttpMessage implements org.apache.http.HttpMessage { + ctor protected AbstractHttpMessage(org.apache.http.params.HttpParams); + ctor protected AbstractHttpMessage(); + method public void addHeader(org.apache.http.Header); + method public void addHeader(java.lang.String, java.lang.String); + method public boolean containsHeader(java.lang.String); + method public org.apache.http.Header[] getAllHeaders(); + method public org.apache.http.Header getFirstHeader(java.lang.String); + method public org.apache.http.Header[] getHeaders(java.lang.String); + method public org.apache.http.Header getLastHeader(java.lang.String); + method public org.apache.http.params.HttpParams getParams(); + method public org.apache.http.HeaderIterator headerIterator(); + method public org.apache.http.HeaderIterator headerIterator(java.lang.String); + method public void removeHeader(org.apache.http.Header); + method public void removeHeaders(java.lang.String); + method public void setHeader(org.apache.http.Header); + method public void setHeader(java.lang.String, java.lang.String); + method public void setHeaders(org.apache.http.Header[]); + method public void setParams(org.apache.http.params.HttpParams); + field protected org.apache.http.message.HeaderGroup headergroup; + field protected org.apache.http.params.HttpParams params; + } + + public class BasicHeader implements java.lang.Cloneable org.apache.http.Header { + ctor public BasicHeader(java.lang.String, java.lang.String); + method public java.lang.Object clone() throws java.lang.CloneNotSupportedException; + method public org.apache.http.HeaderElement[] getElements() throws org.apache.http.ParseException; + method public java.lang.String getName(); + method public java.lang.String getValue(); + } + + public class BasicHeaderElement implements java.lang.Cloneable org.apache.http.HeaderElement { + ctor public BasicHeaderElement(java.lang.String, java.lang.String, org.apache.http.NameValuePair[]); + ctor public BasicHeaderElement(java.lang.String, java.lang.String); + method public java.lang.Object clone() throws java.lang.CloneNotSupportedException; + method public java.lang.String getName(); + method public org.apache.http.NameValuePair getParameter(int); + method public org.apache.http.NameValuePair getParameterByName(java.lang.String); + method public int getParameterCount(); + method public org.apache.http.NameValuePair[] getParameters(); + method public java.lang.String getValue(); + } + + public class BasicHeaderElementIterator implements org.apache.http.HeaderElementIterator { + ctor public BasicHeaderElementIterator(org.apache.http.HeaderIterator, org.apache.http.message.HeaderValueParser); + ctor public BasicHeaderElementIterator(org.apache.http.HeaderIterator); + method public boolean hasNext(); + method public final java.lang.Object next() throws java.util.NoSuchElementException; + method public org.apache.http.HeaderElement nextElement() throws java.util.NoSuchElementException; + method public void remove() throws java.lang.UnsupportedOperationException; + } + + public class BasicHeaderIterator implements org.apache.http.HeaderIterator { + ctor public BasicHeaderIterator(org.apache.http.Header[], java.lang.String); + method protected boolean filterHeader(int); + method protected int findNext(int); + method public boolean hasNext(); + method public final java.lang.Object next() throws java.util.NoSuchElementException; + method public org.apache.http.Header nextHeader() throws java.util.NoSuchElementException; + method public void remove() throws java.lang.UnsupportedOperationException; + field protected final org.apache.http.Header[] allHeaders; + field protected int currentIndex; + field protected java.lang.String headerName; + } + + public class BasicHeaderValueFormatter implements org.apache.http.message.HeaderValueFormatter { + ctor public BasicHeaderValueFormatter(); + method protected void doFormatValue(org.apache.http.util.CharArrayBuffer, java.lang.String, boolean); + method protected int estimateElementsLen(org.apache.http.HeaderElement[]); + method protected int estimateHeaderElementLen(org.apache.http.HeaderElement); + method protected int estimateNameValuePairLen(org.apache.http.NameValuePair); + method protected int estimateParametersLen(org.apache.http.NameValuePair[]); + method public static final java.lang.String formatElements(org.apache.http.HeaderElement[], boolean, org.apache.http.message.HeaderValueFormatter); + method public org.apache.http.util.CharArrayBuffer formatElements(org.apache.http.util.CharArrayBuffer, org.apache.http.HeaderElement[], boolean); + method public static final java.lang.String formatHeaderElement(org.apache.http.HeaderElement, boolean, org.apache.http.message.HeaderValueFormatter); + method public org.apache.http.util.CharArrayBuffer formatHeaderElement(org.apache.http.util.CharArrayBuffer, org.apache.http.HeaderElement, boolean); + method public static final java.lang.String formatNameValuePair(org.apache.http.NameValuePair, boolean, org.apache.http.message.HeaderValueFormatter); + method public org.apache.http.util.CharArrayBuffer formatNameValuePair(org.apache.http.util.CharArrayBuffer, org.apache.http.NameValuePair, boolean); + method public static final java.lang.String formatParameters(org.apache.http.NameValuePair[], boolean, org.apache.http.message.HeaderValueFormatter); + method public org.apache.http.util.CharArrayBuffer formatParameters(org.apache.http.util.CharArrayBuffer, org.apache.http.NameValuePair[], boolean); + method protected boolean isSeparator(char); + method protected boolean isUnsafe(char); + field public static final org.apache.http.message.BasicHeaderValueFormatter DEFAULT; + field public static final java.lang.String SEPARATORS = " ;,:@()<>\\\"/[]?={}\t"; + field public static final java.lang.String UNSAFE_CHARS = "\"\\"; + } + + public class BasicHeaderValueParser implements org.apache.http.message.HeaderValueParser { + ctor public BasicHeaderValueParser(); + method protected org.apache.http.HeaderElement createHeaderElement(java.lang.String, java.lang.String, org.apache.http.NameValuePair[]); + method protected org.apache.http.NameValuePair createNameValuePair(java.lang.String, java.lang.String); + method public static final org.apache.http.HeaderElement[] parseElements(java.lang.String, org.apache.http.message.HeaderValueParser) throws org.apache.http.ParseException; + method public org.apache.http.HeaderElement[] parseElements(org.apache.http.util.CharArrayBuffer, org.apache.http.message.ParserCursor); + method public static final org.apache.http.HeaderElement parseHeaderElement(java.lang.String, org.apache.http.message.HeaderValueParser) throws org.apache.http.ParseException; + method public org.apache.http.HeaderElement parseHeaderElement(org.apache.http.util.CharArrayBuffer, org.apache.http.message.ParserCursor); + method public static final org.apache.http.NameValuePair parseNameValuePair(java.lang.String, org.apache.http.message.HeaderValueParser) throws org.apache.http.ParseException; + method public org.apache.http.NameValuePair parseNameValuePair(org.apache.http.util.CharArrayBuffer, org.apache.http.message.ParserCursor); + method public org.apache.http.NameValuePair parseNameValuePair(org.apache.http.util.CharArrayBuffer, org.apache.http.message.ParserCursor, char[]); + method public static final org.apache.http.NameValuePair[] parseParameters(java.lang.String, org.apache.http.message.HeaderValueParser) throws org.apache.http.ParseException; + method public org.apache.http.NameValuePair[] parseParameters(org.apache.http.util.CharArrayBuffer, org.apache.http.message.ParserCursor); + field public static final org.apache.http.message.BasicHeaderValueParser DEFAULT; + } + + public class BasicHttpEntityEnclosingRequest extends org.apache.http.message.BasicHttpRequest implements org.apache.http.HttpEntityEnclosingRequest { + ctor public BasicHttpEntityEnclosingRequest(java.lang.String, java.lang.String); + ctor public BasicHttpEntityEnclosingRequest(java.lang.String, java.lang.String, org.apache.http.ProtocolVersion); + ctor public BasicHttpEntityEnclosingRequest(org.apache.http.RequestLine); + method public boolean expectContinue(); + method public org.apache.http.HttpEntity getEntity(); + method public void setEntity(org.apache.http.HttpEntity); + } + + public class BasicHttpRequest extends org.apache.http.message.AbstractHttpMessage implements org.apache.http.HttpRequest { + ctor public BasicHttpRequest(java.lang.String, java.lang.String); + ctor public BasicHttpRequest(java.lang.String, java.lang.String, org.apache.http.ProtocolVersion); + ctor public BasicHttpRequest(org.apache.http.RequestLine); + method public org.apache.http.ProtocolVersion getProtocolVersion(); + method public org.apache.http.RequestLine getRequestLine(); + } + + public class BasicHttpResponse extends org.apache.http.message.AbstractHttpMessage implements org.apache.http.HttpResponse { + ctor public BasicHttpResponse(org.apache.http.StatusLine, org.apache.http.ReasonPhraseCatalog, java.util.Locale); + ctor public BasicHttpResponse(org.apache.http.StatusLine); + ctor public BasicHttpResponse(org.apache.http.ProtocolVersion, int, java.lang.String); + method public org.apache.http.HttpEntity getEntity(); + method public java.util.Locale getLocale(); + method public org.apache.http.ProtocolVersion getProtocolVersion(); + method protected java.lang.String getReason(int); + method public org.apache.http.StatusLine getStatusLine(); + method public void setEntity(org.apache.http.HttpEntity); + method public void setLocale(java.util.Locale); + method public void setReasonPhrase(java.lang.String); + method public void setStatusCode(int); + method public void setStatusLine(org.apache.http.StatusLine); + method public void setStatusLine(org.apache.http.ProtocolVersion, int); + method public void setStatusLine(org.apache.http.ProtocolVersion, int, java.lang.String); + } + + public class BasicLineFormatter implements org.apache.http.message.LineFormatter { + ctor public BasicLineFormatter(); + method public org.apache.http.util.CharArrayBuffer appendProtocolVersion(org.apache.http.util.CharArrayBuffer, org.apache.http.ProtocolVersion); + method protected void doFormatHeader(org.apache.http.util.CharArrayBuffer, org.apache.http.Header); + method protected void doFormatRequestLine(org.apache.http.util.CharArrayBuffer, org.apache.http.RequestLine); + method protected void doFormatStatusLine(org.apache.http.util.CharArrayBuffer, org.apache.http.StatusLine); + method protected int estimateProtocolVersionLen(org.apache.http.ProtocolVersion); + method public static final java.lang.String formatHeader(org.apache.http.Header, org.apache.http.message.LineFormatter); + method public org.apache.http.util.CharArrayBuffer formatHeader(org.apache.http.util.CharArrayBuffer, org.apache.http.Header); + method public static final java.lang.String formatProtocolVersion(org.apache.http.ProtocolVersion, org.apache.http.message.LineFormatter); + method public static final java.lang.String formatRequestLine(org.apache.http.RequestLine, org.apache.http.message.LineFormatter); + method public org.apache.http.util.CharArrayBuffer formatRequestLine(org.apache.http.util.CharArrayBuffer, org.apache.http.RequestLine); + method public static final java.lang.String formatStatusLine(org.apache.http.StatusLine, org.apache.http.message.LineFormatter); + method public org.apache.http.util.CharArrayBuffer formatStatusLine(org.apache.http.util.CharArrayBuffer, org.apache.http.StatusLine); + method protected org.apache.http.util.CharArrayBuffer initBuffer(org.apache.http.util.CharArrayBuffer); + field public static final org.apache.http.message.BasicLineFormatter DEFAULT; + } + + public class BasicLineParser implements org.apache.http.message.LineParser { + ctor public BasicLineParser(org.apache.http.ProtocolVersion); + ctor public BasicLineParser(); + method protected org.apache.http.ProtocolVersion createProtocolVersion(int, int); + method protected org.apache.http.RequestLine createRequestLine(java.lang.String, java.lang.String, org.apache.http.ProtocolVersion); + method protected org.apache.http.StatusLine createStatusLine(org.apache.http.ProtocolVersion, int, java.lang.String); + method public boolean hasProtocolVersion(org.apache.http.util.CharArrayBuffer, org.apache.http.message.ParserCursor); + method public static final org.apache.http.Header parseHeader(java.lang.String, org.apache.http.message.LineParser) throws org.apache.http.ParseException; + method public org.apache.http.Header parseHeader(org.apache.http.util.CharArrayBuffer) throws org.apache.http.ParseException; + method public static final org.apache.http.ProtocolVersion parseProtocolVersion(java.lang.String, org.apache.http.message.LineParser) throws org.apache.http.ParseException; + method public org.apache.http.ProtocolVersion parseProtocolVersion(org.apache.http.util.CharArrayBuffer, org.apache.http.message.ParserCursor) throws org.apache.http.ParseException; + method public static final org.apache.http.RequestLine parseRequestLine(java.lang.String, org.apache.http.message.LineParser) throws org.apache.http.ParseException; + method public org.apache.http.RequestLine parseRequestLine(org.apache.http.util.CharArrayBuffer, org.apache.http.message.ParserCursor) throws org.apache.http.ParseException; + method public static final org.apache.http.StatusLine parseStatusLine(java.lang.String, org.apache.http.message.LineParser) throws org.apache.http.ParseException; + method public org.apache.http.StatusLine parseStatusLine(org.apache.http.util.CharArrayBuffer, org.apache.http.message.ParserCursor) throws org.apache.http.ParseException; + method protected void skipWhitespace(org.apache.http.util.CharArrayBuffer, org.apache.http.message.ParserCursor); + field public static final org.apache.http.message.BasicLineParser DEFAULT; + field protected final org.apache.http.ProtocolVersion protocol; + } + + public class BasicListHeaderIterator implements org.apache.http.HeaderIterator { + ctor public BasicListHeaderIterator(java.util.List, java.lang.String); + method protected boolean filterHeader(int); + method protected int findNext(int); + method public boolean hasNext(); + method public final java.lang.Object next() throws java.util.NoSuchElementException; + method public org.apache.http.Header nextHeader() throws java.util.NoSuchElementException; + method public void remove() throws java.lang.UnsupportedOperationException; + field protected final java.util.List allHeaders; + field protected int currentIndex; + field protected java.lang.String headerName; + field protected int lastIndex; + } + + public class BasicNameValuePair implements java.lang.Cloneable org.apache.http.NameValuePair { + ctor public BasicNameValuePair(java.lang.String, java.lang.String); + method public java.lang.Object clone() throws java.lang.CloneNotSupportedException; + method public java.lang.String getName(); + method public java.lang.String getValue(); + } + + public class BasicRequestLine implements java.lang.Cloneable org.apache.http.RequestLine { + ctor public BasicRequestLine(java.lang.String, java.lang.String, org.apache.http.ProtocolVersion); + method public java.lang.Object clone() throws java.lang.CloneNotSupportedException; + method public java.lang.String getMethod(); + method public org.apache.http.ProtocolVersion getProtocolVersion(); + method public java.lang.String getUri(); + } + + public class BasicStatusLine implements java.lang.Cloneable org.apache.http.StatusLine { + ctor public BasicStatusLine(org.apache.http.ProtocolVersion, int, java.lang.String); + method public java.lang.Object clone() throws java.lang.CloneNotSupportedException; + method public org.apache.http.ProtocolVersion getProtocolVersion(); + method public java.lang.String getReasonPhrase(); + method public int getStatusCode(); + } + + public class BasicTokenIterator implements org.apache.http.TokenIterator { + ctor public BasicTokenIterator(org.apache.http.HeaderIterator); + method protected java.lang.String createToken(java.lang.String, int, int); + method protected int findNext(int) throws org.apache.http.ParseException; + method protected int findTokenEnd(int); + method protected int findTokenSeparator(int); + method protected int findTokenStart(int); + method public boolean hasNext(); + method protected boolean isHttpSeparator(char); + method protected boolean isTokenChar(char); + method protected boolean isTokenSeparator(char); + method protected boolean isWhitespace(char); + method public final java.lang.Object next() throws java.util.NoSuchElementException, org.apache.http.ParseException; + method public java.lang.String nextToken() throws java.util.NoSuchElementException, org.apache.http.ParseException; + method public final void remove() throws java.lang.UnsupportedOperationException; + field public static final java.lang.String HTTP_SEPARATORS = " ,;=()<>@:\\\"/[]?{}\t"; + field protected java.lang.String currentHeader; + field protected java.lang.String currentToken; + field protected final org.apache.http.HeaderIterator headerIt; + field protected int searchPos; + } + + public class BufferedHeader implements java.lang.Cloneable org.apache.http.FormattedHeader { + ctor public BufferedHeader(org.apache.http.util.CharArrayBuffer) throws org.apache.http.ParseException; + method public java.lang.Object clone() throws java.lang.CloneNotSupportedException; + method public org.apache.http.util.CharArrayBuffer getBuffer(); + method public org.apache.http.HeaderElement[] getElements() throws org.apache.http.ParseException; + method public java.lang.String getName(); + method public java.lang.String getValue(); + method public int getValuePos(); + } + + public class HeaderGroup implements java.lang.Cloneable { + ctor public HeaderGroup(); + method public void addHeader(org.apache.http.Header); + method public void clear(); + method public java.lang.Object clone() throws java.lang.CloneNotSupportedException; + method public boolean containsHeader(java.lang.String); + method public org.apache.http.message.HeaderGroup copy(); + method public org.apache.http.Header[] getAllHeaders(); + method public org.apache.http.Header getCondensedHeader(java.lang.String); + method public org.apache.http.Header getFirstHeader(java.lang.String); + method public org.apache.http.Header[] getHeaders(java.lang.String); + method public org.apache.http.Header getLastHeader(java.lang.String); + method public org.apache.http.HeaderIterator iterator(); + method public org.apache.http.HeaderIterator iterator(java.lang.String); + method public void removeHeader(org.apache.http.Header); + method public void setHeaders(org.apache.http.Header[]); + method public void updateHeader(org.apache.http.Header); + } + + public abstract interface HeaderValueFormatter { + method public abstract org.apache.http.util.CharArrayBuffer formatElements(org.apache.http.util.CharArrayBuffer, org.apache.http.HeaderElement[], boolean); + method public abstract org.apache.http.util.CharArrayBuffer formatHeaderElement(org.apache.http.util.CharArrayBuffer, org.apache.http.HeaderElement, boolean); + method public abstract org.apache.http.util.CharArrayBuffer formatNameValuePair(org.apache.http.util.CharArrayBuffer, org.apache.http.NameValuePair, boolean); + method public abstract org.apache.http.util.CharArrayBuffer formatParameters(org.apache.http.util.CharArrayBuffer, org.apache.http.NameValuePair[], boolean); + } + + public abstract interface HeaderValueParser { + method public abstract org.apache.http.HeaderElement[] parseElements(org.apache.http.util.CharArrayBuffer, org.apache.http.message.ParserCursor) throws org.apache.http.ParseException; + method public abstract org.apache.http.HeaderElement parseHeaderElement(org.apache.http.util.CharArrayBuffer, org.apache.http.message.ParserCursor) throws org.apache.http.ParseException; + method public abstract org.apache.http.NameValuePair parseNameValuePair(org.apache.http.util.CharArrayBuffer, org.apache.http.message.ParserCursor) throws org.apache.http.ParseException; + method public abstract org.apache.http.NameValuePair[] parseParameters(org.apache.http.util.CharArrayBuffer, org.apache.http.message.ParserCursor) throws org.apache.http.ParseException; + } + + public abstract interface LineFormatter { + method public abstract org.apache.http.util.CharArrayBuffer appendProtocolVersion(org.apache.http.util.CharArrayBuffer, org.apache.http.ProtocolVersion); + method public abstract org.apache.http.util.CharArrayBuffer formatHeader(org.apache.http.util.CharArrayBuffer, org.apache.http.Header); + method public abstract org.apache.http.util.CharArrayBuffer formatRequestLine(org.apache.http.util.CharArrayBuffer, org.apache.http.RequestLine); + method public abstract org.apache.http.util.CharArrayBuffer formatStatusLine(org.apache.http.util.CharArrayBuffer, org.apache.http.StatusLine); + } + + public abstract interface LineParser { + method public abstract boolean hasProtocolVersion(org.apache.http.util.CharArrayBuffer, org.apache.http.message.ParserCursor); + method public abstract org.apache.http.Header parseHeader(org.apache.http.util.CharArrayBuffer) throws org.apache.http.ParseException; + method public abstract org.apache.http.ProtocolVersion parseProtocolVersion(org.apache.http.util.CharArrayBuffer, org.apache.http.message.ParserCursor) throws org.apache.http.ParseException; + method public abstract org.apache.http.RequestLine parseRequestLine(org.apache.http.util.CharArrayBuffer, org.apache.http.message.ParserCursor) throws org.apache.http.ParseException; + method public abstract org.apache.http.StatusLine parseStatusLine(org.apache.http.util.CharArrayBuffer, org.apache.http.message.ParserCursor) throws org.apache.http.ParseException; + } + + public class ParserCursor { + ctor public ParserCursor(int, int); + method public boolean atEnd(); + method public int getLowerBound(); + method public int getPos(); + method public int getUpperBound(); + method public void updatePos(int); + } + +} + +package org.apache.http.params { + + public abstract class AbstractHttpParams implements org.apache.http.params.HttpParams { + ctor protected AbstractHttpParams(); + method public boolean getBooleanParameter(java.lang.String, boolean); + method public double getDoubleParameter(java.lang.String, double); + method public int getIntParameter(java.lang.String, int); + method public long getLongParameter(java.lang.String, long); + method public boolean isParameterFalse(java.lang.String); + method public boolean isParameterTrue(java.lang.String); + method public org.apache.http.params.HttpParams setBooleanParameter(java.lang.String, boolean); + method public org.apache.http.params.HttpParams setDoubleParameter(java.lang.String, double); + method public org.apache.http.params.HttpParams setIntParameter(java.lang.String, int); + method public org.apache.http.params.HttpParams setLongParameter(java.lang.String, long); + } + + public final class BasicHttpParams extends org.apache.http.params.AbstractHttpParams implements java.lang.Cloneable java.io.Serializable { + ctor public BasicHttpParams(); + method public void clear(); + method public java.lang.Object clone() throws java.lang.CloneNotSupportedException; + method public org.apache.http.params.HttpParams copy(); + method protected void copyParams(org.apache.http.params.HttpParams); + method public java.lang.Object getParameter(java.lang.String); + method public boolean isParameterSet(java.lang.String); + method public boolean isParameterSetLocally(java.lang.String); + method public boolean removeParameter(java.lang.String); + method public org.apache.http.params.HttpParams setParameter(java.lang.String, java.lang.Object); + method public void setParameters(java.lang.String[], java.lang.Object); + } + + public abstract interface CoreConnectionPNames { + field public static final java.lang.String CONNECTION_TIMEOUT = "http.connection.timeout"; + field public static final java.lang.String MAX_HEADER_COUNT = "http.connection.max-header-count"; + field public static final java.lang.String MAX_LINE_LENGTH = "http.connection.max-line-length"; + field public static final java.lang.String SOCKET_BUFFER_SIZE = "http.socket.buffer-size"; + field public static final java.lang.String SO_LINGER = "http.socket.linger"; + field public static final java.lang.String SO_TIMEOUT = "http.socket.timeout"; + field public static final java.lang.String STALE_CONNECTION_CHECK = "http.connection.stalecheck"; + field public static final java.lang.String TCP_NODELAY = "http.tcp.nodelay"; + } + + public abstract interface CoreProtocolPNames { + field public static final java.lang.String HTTP_CONTENT_CHARSET = "http.protocol.content-charset"; + field public static final java.lang.String HTTP_ELEMENT_CHARSET = "http.protocol.element-charset"; + field public static final java.lang.String ORIGIN_SERVER = "http.origin-server"; + field public static final java.lang.String PROTOCOL_VERSION = "http.protocol.version"; + field public static final java.lang.String STRICT_TRANSFER_ENCODING = "http.protocol.strict-transfer-encoding"; + field public static final java.lang.String USER_AGENT = "http.useragent"; + field public static final java.lang.String USE_EXPECT_CONTINUE = "http.protocol.expect-continue"; + field public static final java.lang.String WAIT_FOR_CONTINUE = "http.protocol.wait-for-continue"; + } + + public final class DefaultedHttpParams extends org.apache.http.params.AbstractHttpParams { + ctor public DefaultedHttpParams(org.apache.http.params.HttpParams, org.apache.http.params.HttpParams); + method public org.apache.http.params.HttpParams copy(); + method public org.apache.http.params.HttpParams getDefaults(); + method public java.lang.Object getParameter(java.lang.String); + method public boolean removeParameter(java.lang.String); + method public org.apache.http.params.HttpParams setParameter(java.lang.String, java.lang.Object); + } + + public abstract class HttpAbstractParamBean { + ctor public HttpAbstractParamBean(org.apache.http.params.HttpParams); + field protected final org.apache.http.params.HttpParams params; + } + + public class HttpConnectionParamBean extends org.apache.http.params.HttpAbstractParamBean { + ctor public HttpConnectionParamBean(org.apache.http.params.HttpParams); + method public void setConnectionTimeout(int); + method public void setLinger(int); + method public void setSoTimeout(int); + method public void setSocketBufferSize(int); + method public void setStaleCheckingEnabled(boolean); + method public void setTcpNoDelay(boolean); + } + + public final class HttpConnectionParams implements org.apache.http.params.CoreConnectionPNames { + method public static int getConnectionTimeout(org.apache.http.params.HttpParams); + method public static int getLinger(org.apache.http.params.HttpParams); + method public static int getSoTimeout(org.apache.http.params.HttpParams); + method public static int getSocketBufferSize(org.apache.http.params.HttpParams); + method public static boolean getTcpNoDelay(org.apache.http.params.HttpParams); + method public static boolean isStaleCheckingEnabled(org.apache.http.params.HttpParams); + method public static void setConnectionTimeout(org.apache.http.params.HttpParams, int); + method public static void setLinger(org.apache.http.params.HttpParams, int); + method public static void setSoTimeout(org.apache.http.params.HttpParams, int); + method public static void setSocketBufferSize(org.apache.http.params.HttpParams, int); + method public static void setStaleCheckingEnabled(org.apache.http.params.HttpParams, boolean); + method public static void setTcpNoDelay(org.apache.http.params.HttpParams, boolean); + } + + public abstract interface HttpParams { + method public abstract org.apache.http.params.HttpParams copy(); + method public abstract boolean getBooleanParameter(java.lang.String, boolean); + method public abstract double getDoubleParameter(java.lang.String, double); + method public abstract int getIntParameter(java.lang.String, int); + method public abstract long getLongParameter(java.lang.String, long); + method public abstract java.lang.Object getParameter(java.lang.String); + method public abstract boolean isParameterFalse(java.lang.String); + method public abstract boolean isParameterTrue(java.lang.String); + method public abstract boolean removeParameter(java.lang.String); + method public abstract org.apache.http.params.HttpParams setBooleanParameter(java.lang.String, boolean); + method public abstract org.apache.http.params.HttpParams setDoubleParameter(java.lang.String, double); + method public abstract org.apache.http.params.HttpParams setIntParameter(java.lang.String, int); + method public abstract org.apache.http.params.HttpParams setLongParameter(java.lang.String, long); + method public abstract org.apache.http.params.HttpParams setParameter(java.lang.String, java.lang.Object); + } + + public class HttpProtocolParamBean extends org.apache.http.params.HttpAbstractParamBean { + ctor public HttpProtocolParamBean(org.apache.http.params.HttpParams); + method public void setContentCharset(java.lang.String); + method public void setHttpElementCharset(java.lang.String); + method public void setUseExpectContinue(boolean); + method public void setUserAgent(java.lang.String); + method public void setVersion(org.apache.http.HttpVersion); + } + + public final class HttpProtocolParams implements org.apache.http.params.CoreProtocolPNames { + method public static java.lang.String getContentCharset(org.apache.http.params.HttpParams); + method public static java.lang.String getHttpElementCharset(org.apache.http.params.HttpParams); + method public static java.lang.String getUserAgent(org.apache.http.params.HttpParams); + method public static org.apache.http.ProtocolVersion getVersion(org.apache.http.params.HttpParams); + method public static void setContentCharset(org.apache.http.params.HttpParams, java.lang.String); + method public static void setHttpElementCharset(org.apache.http.params.HttpParams, java.lang.String); + method public static void setUseExpectContinue(org.apache.http.params.HttpParams, boolean); + method public static void setUserAgent(org.apache.http.params.HttpParams, java.lang.String); + method public static void setVersion(org.apache.http.params.HttpParams, org.apache.http.ProtocolVersion); + method public static boolean useExpectContinue(org.apache.http.params.HttpParams); + } + +} + +package org.apache.http.protocol { + + public class BasicHttpContext implements org.apache.http.protocol.HttpContext { + ctor public BasicHttpContext(); + ctor public BasicHttpContext(org.apache.http.protocol.HttpContext); + method public java.lang.Object getAttribute(java.lang.String); + method public java.lang.Object removeAttribute(java.lang.String); + method public void setAttribute(java.lang.String, java.lang.Object); + } + + public final class BasicHttpProcessor implements java.lang.Cloneable org.apache.http.protocol.HttpProcessor org.apache.http.protocol.HttpRequestInterceptorList org.apache.http.protocol.HttpResponseInterceptorList { + ctor public BasicHttpProcessor(); + method public final void addInterceptor(org.apache.http.HttpRequestInterceptor); + method public final void addInterceptor(org.apache.http.HttpRequestInterceptor, int); + method public final void addInterceptor(org.apache.http.HttpResponseInterceptor); + method public final void addInterceptor(org.apache.http.HttpResponseInterceptor, int); + method public void addRequestInterceptor(org.apache.http.HttpRequestInterceptor); + method public void addRequestInterceptor(org.apache.http.HttpRequestInterceptor, int); + method public void addResponseInterceptor(org.apache.http.HttpResponseInterceptor, int); + method public void addResponseInterceptor(org.apache.http.HttpResponseInterceptor); + method public void clearInterceptors(); + method public void clearRequestInterceptors(); + method public void clearResponseInterceptors(); + method public java.lang.Object clone() throws java.lang.CloneNotSupportedException; + method public org.apache.http.protocol.BasicHttpProcessor copy(); + method protected void copyInterceptors(org.apache.http.protocol.BasicHttpProcessor); + method public org.apache.http.HttpRequestInterceptor getRequestInterceptor(int); + method public int getRequestInterceptorCount(); + method public org.apache.http.HttpResponseInterceptor getResponseInterceptor(int); + method public int getResponseInterceptorCount(); + method public void process(org.apache.http.HttpRequest, org.apache.http.protocol.HttpContext) throws org.apache.http.HttpException, java.io.IOException; + method public void process(org.apache.http.HttpResponse, org.apache.http.protocol.HttpContext) throws org.apache.http.HttpException, java.io.IOException; + method public void removeRequestInterceptorByClass(java.lang.Class); + method public void removeResponseInterceptorByClass(java.lang.Class); + method public void setInterceptors(java.util.List); + field protected java.util.List requestInterceptors; + field protected java.util.List responseInterceptors; + } + + public final class DefaultedHttpContext implements org.apache.http.protocol.HttpContext { + ctor public DefaultedHttpContext(org.apache.http.protocol.HttpContext, org.apache.http.protocol.HttpContext); + method public java.lang.Object getAttribute(java.lang.String); + method public org.apache.http.protocol.HttpContext getDefaults(); + method public java.lang.Object removeAttribute(java.lang.String); + method public void setAttribute(java.lang.String, java.lang.Object); + } + + public abstract interface ExecutionContext { + field public static final java.lang.String HTTP_CONNECTION = "http.connection"; + field public static final java.lang.String HTTP_PROXY_HOST = "http.proxy_host"; + field public static final java.lang.String HTTP_REQUEST = "http.request"; + field public static final java.lang.String HTTP_REQ_SENT = "http.request_sent"; + field public static final java.lang.String HTTP_RESPONSE = "http.response"; + field public static final java.lang.String HTTP_TARGET_HOST = "http.target_host"; + } + + public final class HTTP { + method public static boolean isWhitespace(char); + field public static final java.lang.String ASCII = "ASCII"; + field public static final java.lang.String CHARSET_PARAM = "; charset="; + field public static final java.lang.String CHUNK_CODING = "chunked"; + field public static final java.lang.String CONN_CLOSE = "Close"; + field public static final java.lang.String CONN_DIRECTIVE = "Connection"; + field public static final java.lang.String CONN_KEEP_ALIVE = "Keep-Alive"; + field public static final java.lang.String CONTENT_ENCODING = "Content-Encoding"; + field public static final java.lang.String CONTENT_LEN = "Content-Length"; + field public static final java.lang.String CONTENT_TYPE = "Content-Type"; + field public static final int CR = 13; // 0xd + field public static final java.lang.String DATE_HEADER = "Date"; + field public static final java.lang.String DEFAULT_CONTENT_CHARSET = "ISO-8859-1"; + field public static final java.lang.String DEFAULT_CONTENT_TYPE = "application/octet-stream"; + field public static final java.lang.String DEFAULT_PROTOCOL_CHARSET = "US-ASCII"; + field public static final java.lang.String EXPECT_CONTINUE = "100-continue"; + field public static final java.lang.String EXPECT_DIRECTIVE = "Expect"; + field public static final int HT = 9; // 0x9 + field public static final java.lang.String IDENTITY_CODING = "identity"; + field public static final java.lang.String ISO_8859_1 = "ISO-8859-1"; + field public static final int LF = 10; // 0xa + field public static final java.lang.String OCTET_STREAM_TYPE = "application/octet-stream"; + field public static final java.lang.String PLAIN_TEXT_TYPE = "text/plain"; + field public static final java.lang.String SERVER_HEADER = "Server"; + field public static final int SP = 32; // 0x20 + field public static final java.lang.String TARGET_HOST = "Host"; + field public static final java.lang.String TRANSFER_ENCODING = "Transfer-Encoding"; + field public static final java.lang.String USER_AGENT = "User-Agent"; + field public static final java.lang.String US_ASCII = "US-ASCII"; + field public static final java.lang.String UTF_16 = "UTF-16"; + field public static final java.lang.String UTF_8 = "UTF-8"; + } + + public abstract interface HttpContext { + method public abstract java.lang.Object getAttribute(java.lang.String); + method public abstract java.lang.Object removeAttribute(java.lang.String); + method public abstract void setAttribute(java.lang.String, java.lang.Object); + field public static final java.lang.String RESERVED_PREFIX = "http."; + } + + public class HttpDateGenerator { + ctor public HttpDateGenerator(); + method public synchronized java.lang.String getCurrentDate(); + field public static final java.util.TimeZone GMT; + field public static final java.lang.String PATTERN_RFC1123 = "EEE, dd MMM yyyy HH:mm:ss zzz"; + } + + public abstract interface HttpExpectationVerifier { + method public abstract void verify(org.apache.http.HttpRequest, org.apache.http.HttpResponse, org.apache.http.protocol.HttpContext) throws org.apache.http.HttpException; + } + + public abstract interface HttpProcessor implements org.apache.http.HttpRequestInterceptor org.apache.http.HttpResponseInterceptor { + } + + public class HttpRequestExecutor { + ctor public HttpRequestExecutor(); + method protected boolean canResponseHaveBody(org.apache.http.HttpRequest, org.apache.http.HttpResponse); + method protected org.apache.http.HttpResponse doReceiveResponse(org.apache.http.HttpRequest, org.apache.http.HttpClientConnection, org.apache.http.protocol.HttpContext) throws org.apache.http.HttpException, java.io.IOException; + method protected org.apache.http.HttpResponse doSendRequest(org.apache.http.HttpRequest, org.apache.http.HttpClientConnection, org.apache.http.protocol.HttpContext) throws org.apache.http.HttpException, java.io.IOException; + method public org.apache.http.HttpResponse execute(org.apache.http.HttpRequest, org.apache.http.HttpClientConnection, org.apache.http.protocol.HttpContext) throws org.apache.http.HttpException, java.io.IOException; + method public void postProcess(org.apache.http.HttpResponse, org.apache.http.protocol.HttpProcessor, org.apache.http.protocol.HttpContext) throws org.apache.http.HttpException, java.io.IOException; + method public void preProcess(org.apache.http.HttpRequest, org.apache.http.protocol.HttpProcessor, org.apache.http.protocol.HttpContext) throws org.apache.http.HttpException, java.io.IOException; + } + + public abstract interface HttpRequestHandler { + method public abstract void handle(org.apache.http.HttpRequest, org.apache.http.HttpResponse, org.apache.http.protocol.HttpContext) throws org.apache.http.HttpException, java.io.IOException; + } + + public class HttpRequestHandlerRegistry implements org.apache.http.protocol.HttpRequestHandlerResolver { + ctor public HttpRequestHandlerRegistry(); + method public org.apache.http.protocol.HttpRequestHandler lookup(java.lang.String); + method protected deprecated boolean matchUriRequestPattern(java.lang.String, java.lang.String); + method public void register(java.lang.String, org.apache.http.protocol.HttpRequestHandler); + method public void setHandlers(java.util.Map); + method public void unregister(java.lang.String); + } + + public abstract interface HttpRequestHandlerResolver { + method public abstract org.apache.http.protocol.HttpRequestHandler lookup(java.lang.String); + } + + public abstract interface HttpRequestInterceptorList { + method public abstract void addRequestInterceptor(org.apache.http.HttpRequestInterceptor); + method public abstract void addRequestInterceptor(org.apache.http.HttpRequestInterceptor, int); + method public abstract void clearRequestInterceptors(); + method public abstract org.apache.http.HttpRequestInterceptor getRequestInterceptor(int); + method public abstract int getRequestInterceptorCount(); + method public abstract void removeRequestInterceptorByClass(java.lang.Class); + method public abstract void setInterceptors(java.util.List); + } + + public abstract interface HttpResponseInterceptorList { + method public abstract void addResponseInterceptor(org.apache.http.HttpResponseInterceptor); + method public abstract void addResponseInterceptor(org.apache.http.HttpResponseInterceptor, int); + method public abstract void clearResponseInterceptors(); + method public abstract org.apache.http.HttpResponseInterceptor getResponseInterceptor(int); + method public abstract int getResponseInterceptorCount(); + method public abstract void removeResponseInterceptorByClass(java.lang.Class); + method public abstract void setInterceptors(java.util.List); + } + + public class HttpService { + ctor public HttpService(org.apache.http.protocol.HttpProcessor, org.apache.http.ConnectionReuseStrategy, org.apache.http.HttpResponseFactory); + method protected void doService(org.apache.http.HttpRequest, org.apache.http.HttpResponse, org.apache.http.protocol.HttpContext) throws org.apache.http.HttpException, java.io.IOException; + method public org.apache.http.params.HttpParams getParams(); + method protected void handleException(org.apache.http.HttpException, org.apache.http.HttpResponse); + method public void handleRequest(org.apache.http.HttpServerConnection, org.apache.http.protocol.HttpContext) throws org.apache.http.HttpException, java.io.IOException; + method public void setConnReuseStrategy(org.apache.http.ConnectionReuseStrategy); + method public void setExpectationVerifier(org.apache.http.protocol.HttpExpectationVerifier); + method public void setHandlerResolver(org.apache.http.protocol.HttpRequestHandlerResolver); + method public void setHttpProcessor(org.apache.http.protocol.HttpProcessor); + method public void setParams(org.apache.http.params.HttpParams); + method public void setResponseFactory(org.apache.http.HttpResponseFactory); + } + + public class RequestConnControl implements org.apache.http.HttpRequestInterceptor { + ctor public RequestConnControl(); + method public void process(org.apache.http.HttpRequest, org.apache.http.protocol.HttpContext) throws org.apache.http.HttpException, java.io.IOException; + } + + public class RequestContent implements org.apache.http.HttpRequestInterceptor { + ctor public RequestContent(); + method public void process(org.apache.http.HttpRequest, org.apache.http.protocol.HttpContext) throws org.apache.http.HttpException, java.io.IOException; + } + + public class RequestDate implements org.apache.http.HttpRequestInterceptor { + ctor public RequestDate(); + method public void process(org.apache.http.HttpRequest, org.apache.http.protocol.HttpContext) throws org.apache.http.HttpException, java.io.IOException; + } + + public class RequestExpectContinue implements org.apache.http.HttpRequestInterceptor { + ctor public RequestExpectContinue(); + method public void process(org.apache.http.HttpRequest, org.apache.http.protocol.HttpContext) throws org.apache.http.HttpException, java.io.IOException; + } + + public class RequestTargetHost implements org.apache.http.HttpRequestInterceptor { + ctor public RequestTargetHost(); + method public void process(org.apache.http.HttpRequest, org.apache.http.protocol.HttpContext) throws org.apache.http.HttpException, java.io.IOException; + } + + public class RequestUserAgent implements org.apache.http.HttpRequestInterceptor { + ctor public RequestUserAgent(); + method public void process(org.apache.http.HttpRequest, org.apache.http.protocol.HttpContext) throws org.apache.http.HttpException, java.io.IOException; + } + + public class ResponseConnControl implements org.apache.http.HttpResponseInterceptor { + ctor public ResponseConnControl(); + method public void process(org.apache.http.HttpResponse, org.apache.http.protocol.HttpContext) throws org.apache.http.HttpException, java.io.IOException; + } + + public class ResponseContent implements org.apache.http.HttpResponseInterceptor { + ctor public ResponseContent(); + method public void process(org.apache.http.HttpResponse, org.apache.http.protocol.HttpContext) throws org.apache.http.HttpException, java.io.IOException; + } + + public class ResponseDate implements org.apache.http.HttpResponseInterceptor { + ctor public ResponseDate(); + method public void process(org.apache.http.HttpResponse, org.apache.http.protocol.HttpContext) throws org.apache.http.HttpException, java.io.IOException; + } + + public class ResponseServer implements org.apache.http.HttpResponseInterceptor { + ctor public ResponseServer(); + method public void process(org.apache.http.HttpResponse, org.apache.http.protocol.HttpContext) throws org.apache.http.HttpException, java.io.IOException; + } + + public class SyncBasicHttpContext extends org.apache.http.protocol.BasicHttpContext { + ctor public SyncBasicHttpContext(org.apache.http.protocol.HttpContext); + } + + public class UriPatternMatcher { + ctor public UriPatternMatcher(); + method public java.lang.Object lookup(java.lang.String); + method protected boolean matchUriRequestPattern(java.lang.String, java.lang.String); + method public void register(java.lang.String, java.lang.Object); + method public void setHandlers(java.util.Map); + method public void unregister(java.lang.String); + } + +} + +package org.apache.http.util { + + public final class ByteArrayBuffer { + ctor public ByteArrayBuffer(int); + method public void append(byte[], int, int); + method public void append(int); + method public void append(char[], int, int); + method public void append(org.apache.http.util.CharArrayBuffer, int, int); + method public byte[] buffer(); + method public int byteAt(int); + method public int capacity(); + method public void clear(); + method public boolean isEmpty(); + method public boolean isFull(); + method public int length(); + method public void setLength(int); + method public byte[] toByteArray(); + } + + public final class CharArrayBuffer { + ctor public CharArrayBuffer(int); + method public void append(char[], int, int); + method public void append(java.lang.String); + method public void append(org.apache.http.util.CharArrayBuffer, int, int); + method public void append(org.apache.http.util.CharArrayBuffer); + method public void append(char); + method public void append(byte[], int, int); + method public void append(org.apache.http.util.ByteArrayBuffer, int, int); + method public void append(java.lang.Object); + method public char[] buffer(); + method public int capacity(); + method public char charAt(int); + method public void clear(); + method public void ensureCapacity(int); + method public int indexOf(int, int, int); + method public int indexOf(int); + method public boolean isEmpty(); + method public boolean isFull(); + method public int length(); + method public void setLength(int); + method public java.lang.String substring(int, int); + method public java.lang.String substringTrimmed(int, int); + method public char[] toCharArray(); + } + + public final class EncodingUtils { + method public static byte[] getAsciiBytes(java.lang.String); + method public static java.lang.String getAsciiString(byte[], int, int); + method public static java.lang.String getAsciiString(byte[]); + method public static byte[] getBytes(java.lang.String, java.lang.String); + method public static java.lang.String getString(byte[], int, int, java.lang.String); + method public static java.lang.String getString(byte[], java.lang.String); + } + + public final class EntityUtils { + method public static java.lang.String getContentCharSet(org.apache.http.HttpEntity) throws org.apache.http.ParseException; + method public static byte[] toByteArray(org.apache.http.HttpEntity) throws java.io.IOException; + method public static java.lang.String toString(org.apache.http.HttpEntity, java.lang.String) throws java.io.IOException, org.apache.http.ParseException; + method public static java.lang.String toString(org.apache.http.HttpEntity) throws java.io.IOException, org.apache.http.ParseException; + } + + public final class ExceptionUtils { + method public static void initCause(java.lang.Throwable, java.lang.Throwable); + } + + public final class LangUtils { + method public static boolean equals(java.lang.Object, java.lang.Object); + method public static boolean equals(java.lang.Object[], java.lang.Object[]); + method public static int hashCode(int, int); + method public static int hashCode(int, boolean); + method public static int hashCode(int, java.lang.Object); + field public static final int HASH_OFFSET = 37; // 0x25 + field public static final int HASH_SEED = 17; // 0x11 + } + + public class VersionInfo { + ctor protected VersionInfo(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String); + method protected static final org.apache.http.util.VersionInfo fromMap(java.lang.String, java.util.Map, java.lang.ClassLoader); + method public final java.lang.String getClassloader(); + method public final java.lang.String getModule(); + method public final java.lang.String getPackage(); + method public final java.lang.String getRelease(); + method public final java.lang.String getTimestamp(); + method public static final org.apache.http.util.VersionInfo[] loadVersionInfo(java.lang.String[], java.lang.ClassLoader); + method public static final org.apache.http.util.VersionInfo loadVersionInfo(java.lang.String, java.lang.ClassLoader); + field public static final java.lang.String PROPERTY_MODULE = "info.module"; + field public static final java.lang.String PROPERTY_RELEASE = "info.release"; + field public static final java.lang.String PROPERTY_TIMESTAMP = "info.timestamp"; + field public static final java.lang.String UNAVAILABLE = "UNAVAILABLE"; + field public static final java.lang.String VERSION_PROPERTY_FILE = "version.properties"; + } + +} + +package org.json { + + public class JSONArray { + ctor public JSONArray(); + ctor public JSONArray(java.util.Collection); + ctor public JSONArray(org.json.JSONTokener) throws org.json.JSONException; + ctor public JSONArray(java.lang.String) throws org.json.JSONException; + method public java.lang.Object get(int) throws org.json.JSONException; + method public boolean getBoolean(int) throws org.json.JSONException; + method public double getDouble(int) throws org.json.JSONException; + method public int getInt(int) throws org.json.JSONException; + method public org.json.JSONArray getJSONArray(int) throws org.json.JSONException; + method public org.json.JSONObject getJSONObject(int) throws org.json.JSONException; + method public long getLong(int) throws org.json.JSONException; + method public java.lang.String getString(int) throws org.json.JSONException; + method public boolean isNull(int); + method public java.lang.String join(java.lang.String) throws org.json.JSONException; + method public int length(); + method public java.lang.Object opt(int); + method public boolean optBoolean(int); + method public boolean optBoolean(int, boolean); + method public double optDouble(int); + method public double optDouble(int, double); + method public int optInt(int); + method public int optInt(int, int); + method public org.json.JSONArray optJSONArray(int); + method public org.json.JSONObject optJSONObject(int); + method public long optLong(int); + method public long optLong(int, long); + method public java.lang.String optString(int); + method public java.lang.String optString(int, java.lang.String); + method public org.json.JSONArray put(boolean); + method public org.json.JSONArray put(double) throws org.json.JSONException; + method public org.json.JSONArray put(int); + method public org.json.JSONArray put(long); + method public org.json.JSONArray put(java.lang.Object); + method public org.json.JSONArray put(int, boolean) throws org.json.JSONException; + method public org.json.JSONArray put(int, double) throws org.json.JSONException; + method public org.json.JSONArray put(int, int) throws org.json.JSONException; + method public org.json.JSONArray put(int, long) throws org.json.JSONException; + method public org.json.JSONArray put(int, java.lang.Object) throws org.json.JSONException; + method public org.json.JSONObject toJSONObject(org.json.JSONArray) throws org.json.JSONException; + method public java.lang.String toString(int) throws org.json.JSONException; + } + + public class JSONException extends java.lang.Exception { + ctor public JSONException(java.lang.String); + } + + public class JSONObject { + ctor public JSONObject(); + ctor public JSONObject(java.util.Map); + ctor public JSONObject(org.json.JSONTokener) throws org.json.JSONException; + ctor public JSONObject(java.lang.String) throws org.json.JSONException; + ctor public JSONObject(org.json.JSONObject, java.lang.String[]) throws org.json.JSONException; + method public org.json.JSONObject accumulate(java.lang.String, java.lang.Object) throws org.json.JSONException; + method public java.lang.Object get(java.lang.String) throws org.json.JSONException; + method public boolean getBoolean(java.lang.String) throws org.json.JSONException; + method public double getDouble(java.lang.String) throws org.json.JSONException; + method public int getInt(java.lang.String) throws org.json.JSONException; + method public org.json.JSONArray getJSONArray(java.lang.String) throws org.json.JSONException; + method public org.json.JSONObject getJSONObject(java.lang.String) throws org.json.JSONException; + method public long getLong(java.lang.String) throws org.json.JSONException; + method public java.lang.String getString(java.lang.String) throws org.json.JSONException; + method public boolean has(java.lang.String); + method public boolean isNull(java.lang.String); + method public java.util.Iterator keys(); + method public int length(); + method public org.json.JSONArray names(); + method public static java.lang.String numberToString(java.lang.Number) throws org.json.JSONException; + method public java.lang.Object opt(java.lang.String); + method public boolean optBoolean(java.lang.String); + method public boolean optBoolean(java.lang.String, boolean); + method public double optDouble(java.lang.String); + method public double optDouble(java.lang.String, double); + method public int optInt(java.lang.String); + method public int optInt(java.lang.String, int); + method public org.json.JSONArray optJSONArray(java.lang.String); + method public org.json.JSONObject optJSONObject(java.lang.String); + method public long optLong(java.lang.String); + method public long optLong(java.lang.String, long); + method public java.lang.String optString(java.lang.String); + method public java.lang.String optString(java.lang.String, java.lang.String); + method public org.json.JSONObject put(java.lang.String, boolean) throws org.json.JSONException; + method public org.json.JSONObject put(java.lang.String, double) throws org.json.JSONException; + method public org.json.JSONObject put(java.lang.String, int) throws org.json.JSONException; + method public org.json.JSONObject put(java.lang.String, long) throws org.json.JSONException; + method public org.json.JSONObject put(java.lang.String, java.lang.Object) throws org.json.JSONException; + method public org.json.JSONObject putOpt(java.lang.String, java.lang.Object) throws org.json.JSONException; + method public static java.lang.String quote(java.lang.String); + method public java.lang.Object remove(java.lang.String); + method public org.json.JSONArray toJSONArray(org.json.JSONArray) throws org.json.JSONException; + method public java.lang.String toString(int) throws org.json.JSONException; + field public static final java.lang.Object NULL; + } + + public class JSONStringer { + ctor public JSONStringer(); + method public org.json.JSONStringer array() throws org.json.JSONException; + method public org.json.JSONStringer endArray() throws org.json.JSONException; + method public org.json.JSONStringer endObject() throws org.json.JSONException; + method public org.json.JSONStringer key(java.lang.String) throws org.json.JSONException; + method public org.json.JSONStringer object() throws org.json.JSONException; + method public org.json.JSONStringer value(java.lang.Object) throws org.json.JSONException; + method public org.json.JSONStringer value(boolean) throws org.json.JSONException; + method public org.json.JSONStringer value(double) throws org.json.JSONException; + method public org.json.JSONStringer value(long) throws org.json.JSONException; + } + + public class JSONTokener { + ctor public JSONTokener(java.lang.String); + method public void back(); + method public static int dehexchar(char); + method public boolean more(); + method public char next(); + method public char next(char) throws org.json.JSONException; + method public java.lang.String next(int) throws org.json.JSONException; + method public char nextClean() throws org.json.JSONException; + method public java.lang.String nextString(char) throws org.json.JSONException; + method public java.lang.String nextTo(java.lang.String); + method public java.lang.String nextTo(char); + method public java.lang.Object nextValue() throws org.json.JSONException; + method public void skipPast(java.lang.String); + method public char skipTo(char); + method public org.json.JSONException syntaxError(java.lang.String); + } + +} + +package org.w3c.dom { + + public abstract interface Attr implements org.w3c.dom.Node { + method public abstract java.lang.String getName(); + method public abstract org.w3c.dom.Element getOwnerElement(); + method public abstract org.w3c.dom.TypeInfo getSchemaTypeInfo(); + method public abstract boolean getSpecified(); + method public abstract java.lang.String getValue(); + method public abstract boolean isId(); + method public abstract void setValue(java.lang.String) throws org.w3c.dom.DOMException; + } + + public abstract interface CDATASection implements org.w3c.dom.Text { + } + + public abstract interface CharacterData implements org.w3c.dom.Node { + method public abstract void appendData(java.lang.String) throws org.w3c.dom.DOMException; + method public abstract void deleteData(int, int) throws org.w3c.dom.DOMException; + method public abstract java.lang.String getData() throws org.w3c.dom.DOMException; + method public abstract int getLength(); + method public abstract void insertData(int, java.lang.String) throws org.w3c.dom.DOMException; + method public abstract void replaceData(int, int, java.lang.String) throws org.w3c.dom.DOMException; + method public abstract void setData(java.lang.String) throws org.w3c.dom.DOMException; + method public abstract java.lang.String substringData(int, int) throws org.w3c.dom.DOMException; + } + + public abstract interface Comment implements org.w3c.dom.CharacterData { + } + + public abstract interface DOMConfiguration { + method public abstract boolean canSetParameter(java.lang.String, java.lang.Object); + method public abstract java.lang.Object getParameter(java.lang.String) throws org.w3c.dom.DOMException; + method public abstract org.w3c.dom.DOMStringList getParameterNames(); + method public abstract void setParameter(java.lang.String, java.lang.Object) throws org.w3c.dom.DOMException; + } + + public abstract interface DOMError { + method public abstract org.w3c.dom.DOMLocator getLocation(); + method public abstract java.lang.String getMessage(); + method public abstract java.lang.Object getRelatedData(); + method public abstract java.lang.Object getRelatedException(); + method public abstract short getSeverity(); + method public abstract java.lang.String getType(); + field public static final short SEVERITY_ERROR = 2; // 0x2 + field public static final short SEVERITY_FATAL_ERROR = 3; // 0x3 + field public static final short SEVERITY_WARNING = 1; // 0x1 + } + + public abstract interface DOMErrorHandler { + method public abstract boolean handleError(org.w3c.dom.DOMError); + } + + public class DOMException extends java.lang.RuntimeException { + ctor public DOMException(short, java.lang.String); + field public static final short DOMSTRING_SIZE_ERR = 2; // 0x2 + field public static final short HIERARCHY_REQUEST_ERR = 3; // 0x3 + field public static final short INDEX_SIZE_ERR = 1; // 0x1 + field public static final short INUSE_ATTRIBUTE_ERR = 10; // 0xa + field public static final short INVALID_ACCESS_ERR = 15; // 0xf + field public static final short INVALID_CHARACTER_ERR = 5; // 0x5 + field public static final short INVALID_MODIFICATION_ERR = 13; // 0xd + field public static final short INVALID_STATE_ERR = 11; // 0xb + field public static final short NAMESPACE_ERR = 14; // 0xe + field public static final short NOT_FOUND_ERR = 8; // 0x8 + field public static final short NOT_SUPPORTED_ERR = 9; // 0x9 + field public static final short NO_DATA_ALLOWED_ERR = 6; // 0x6 + field public static final short NO_MODIFICATION_ALLOWED_ERR = 7; // 0x7 + field public static final short SYNTAX_ERR = 12; // 0xc + field public static final short TYPE_MISMATCH_ERR = 17; // 0x11 + field public static final short VALIDATION_ERR = 16; // 0x10 + field public static final short WRONG_DOCUMENT_ERR = 4; // 0x4 + field public short code; + } + + public abstract interface DOMImplementation { + method public abstract org.w3c.dom.Document createDocument(java.lang.String, java.lang.String, org.w3c.dom.DocumentType) throws org.w3c.dom.DOMException; + method public abstract org.w3c.dom.DocumentType createDocumentType(java.lang.String, java.lang.String, java.lang.String) throws org.w3c.dom.DOMException; + method public abstract java.lang.Object getFeature(java.lang.String, java.lang.String); + method public abstract boolean hasFeature(java.lang.String, java.lang.String); + } + + public abstract interface DOMImplementationList { + method public abstract int getLength(); + method public abstract org.w3c.dom.DOMImplementation item(int); + } + + public abstract interface DOMImplementationSource { + method public abstract org.w3c.dom.DOMImplementation getDOMImplementation(java.lang.String); + method public abstract org.w3c.dom.DOMImplementationList getDOMImplementationList(java.lang.String); + } + + public abstract interface DOMLocator { + method public abstract int getByteOffset(); + method public abstract int getColumnNumber(); + method public abstract int getLineNumber(); + method public abstract org.w3c.dom.Node getRelatedNode(); + method public abstract java.lang.String getUri(); + method public abstract int getUtf16Offset(); + } + + public abstract interface DOMStringList { + method public abstract boolean contains(java.lang.String); + method public abstract int getLength(); + method public abstract java.lang.String item(int); + } + + public abstract interface Document implements org.w3c.dom.Node { + method public abstract org.w3c.dom.Node adoptNode(org.w3c.dom.Node) throws org.w3c.dom.DOMException; + method public abstract org.w3c.dom.Attr createAttribute(java.lang.String) throws org.w3c.dom.DOMException; + method public abstract org.w3c.dom.Attr createAttributeNS(java.lang.String, java.lang.String) throws org.w3c.dom.DOMException; + method public abstract org.w3c.dom.CDATASection createCDATASection(java.lang.String) throws org.w3c.dom.DOMException; + method public abstract org.w3c.dom.Comment createComment(java.lang.String); + method public abstract org.w3c.dom.DocumentFragment createDocumentFragment(); + method public abstract org.w3c.dom.Element createElement(java.lang.String) throws org.w3c.dom.DOMException; + method public abstract org.w3c.dom.Element createElementNS(java.lang.String, java.lang.String) throws org.w3c.dom.DOMException; + method public abstract org.w3c.dom.EntityReference createEntityReference(java.lang.String) throws org.w3c.dom.DOMException; + method public abstract org.w3c.dom.ProcessingInstruction createProcessingInstruction(java.lang.String, java.lang.String) throws org.w3c.dom.DOMException; + method public abstract org.w3c.dom.Text createTextNode(java.lang.String); + method public abstract org.w3c.dom.DocumentType getDoctype(); + method public abstract org.w3c.dom.Element getDocumentElement(); + method public abstract java.lang.String getDocumentURI(); + method public abstract org.w3c.dom.DOMConfiguration getDomConfig(); + method public abstract org.w3c.dom.Element getElementById(java.lang.String); + method public abstract org.w3c.dom.NodeList getElementsByTagName(java.lang.String); + method public abstract org.w3c.dom.NodeList getElementsByTagNameNS(java.lang.String, java.lang.String); + method public abstract org.w3c.dom.DOMImplementation getImplementation(); + method public abstract java.lang.String getInputEncoding(); + method public abstract boolean getStrictErrorChecking(); + method public abstract java.lang.String getXmlEncoding(); + method public abstract boolean getXmlStandalone(); + method public abstract java.lang.String getXmlVersion(); + method public abstract org.w3c.dom.Node importNode(org.w3c.dom.Node, boolean) throws org.w3c.dom.DOMException; + method public abstract void normalizeDocument(); + method public abstract org.w3c.dom.Node renameNode(org.w3c.dom.Node, java.lang.String, java.lang.String) throws org.w3c.dom.DOMException; + method public abstract void setDocumentURI(java.lang.String); + method public abstract void setStrictErrorChecking(boolean); + method public abstract void setXmlStandalone(boolean) throws org.w3c.dom.DOMException; + method public abstract void setXmlVersion(java.lang.String) throws org.w3c.dom.DOMException; + } + + public abstract interface DocumentFragment implements org.w3c.dom.Node { + } + + public abstract interface DocumentType implements org.w3c.dom.Node { + method public abstract org.w3c.dom.NamedNodeMap getEntities(); + method public abstract java.lang.String getInternalSubset(); + method public abstract java.lang.String getName(); + method public abstract org.w3c.dom.NamedNodeMap getNotations(); + method public abstract java.lang.String getPublicId(); + method public abstract java.lang.String getSystemId(); + } + + public abstract interface Element implements org.w3c.dom.Node { + method public abstract java.lang.String getAttribute(java.lang.String); + method public abstract java.lang.String getAttributeNS(java.lang.String, java.lang.String) throws org.w3c.dom.DOMException; + method public abstract org.w3c.dom.Attr getAttributeNode(java.lang.String); + method public abstract org.w3c.dom.Attr getAttributeNodeNS(java.lang.String, java.lang.String) throws org.w3c.dom.DOMException; + method public abstract org.w3c.dom.NodeList getElementsByTagName(java.lang.String); + method public abstract org.w3c.dom.NodeList getElementsByTagNameNS(java.lang.String, java.lang.String) throws org.w3c.dom.DOMException; + method public abstract org.w3c.dom.TypeInfo getSchemaTypeInfo(); + method public abstract java.lang.String getTagName(); + method public abstract boolean hasAttribute(java.lang.String); + method public abstract boolean hasAttributeNS(java.lang.String, java.lang.String) throws org.w3c.dom.DOMException; + method public abstract void removeAttribute(java.lang.String) throws org.w3c.dom.DOMException; + method public abstract void removeAttributeNS(java.lang.String, java.lang.String) throws org.w3c.dom.DOMException; + method public abstract org.w3c.dom.Attr removeAttributeNode(org.w3c.dom.Attr) throws org.w3c.dom.DOMException; + method public abstract void setAttribute(java.lang.String, java.lang.String) throws org.w3c.dom.DOMException; + method public abstract void setAttributeNS(java.lang.String, java.lang.String, java.lang.String) throws org.w3c.dom.DOMException; + method public abstract org.w3c.dom.Attr setAttributeNode(org.w3c.dom.Attr) throws org.w3c.dom.DOMException; + method public abstract org.w3c.dom.Attr setAttributeNodeNS(org.w3c.dom.Attr) throws org.w3c.dom.DOMException; + method public abstract void setIdAttribute(java.lang.String, boolean) throws org.w3c.dom.DOMException; + method public abstract void setIdAttributeNS(java.lang.String, java.lang.String, boolean) throws org.w3c.dom.DOMException; + method public abstract void setIdAttributeNode(org.w3c.dom.Attr, boolean) throws org.w3c.dom.DOMException; + } + + public abstract interface Entity implements org.w3c.dom.Node { + method public abstract java.lang.String getInputEncoding(); + method public abstract java.lang.String getNotationName(); + method public abstract java.lang.String getPublicId(); + method public abstract java.lang.String getSystemId(); + method public abstract java.lang.String getXmlEncoding(); + method public abstract java.lang.String getXmlVersion(); + } + + public abstract interface EntityReference implements org.w3c.dom.Node { + } + + public abstract interface NameList { + method public abstract boolean contains(java.lang.String); + method public abstract boolean containsNS(java.lang.String, java.lang.String); + method public abstract int getLength(); + method public abstract java.lang.String getName(int); + method public abstract java.lang.String getNamespaceURI(int); + } + + public abstract interface NamedNodeMap { + method public abstract int getLength(); + method public abstract org.w3c.dom.Node getNamedItem(java.lang.String); + method public abstract org.w3c.dom.Node getNamedItemNS(java.lang.String, java.lang.String) throws org.w3c.dom.DOMException; + method public abstract org.w3c.dom.Node item(int); + method public abstract org.w3c.dom.Node removeNamedItem(java.lang.String) throws org.w3c.dom.DOMException; + method public abstract org.w3c.dom.Node removeNamedItemNS(java.lang.String, java.lang.String) throws org.w3c.dom.DOMException; + method public abstract org.w3c.dom.Node setNamedItem(org.w3c.dom.Node) throws org.w3c.dom.DOMException; + method public abstract org.w3c.dom.Node setNamedItemNS(org.w3c.dom.Node) throws org.w3c.dom.DOMException; + } + + public abstract interface Node { + method public abstract org.w3c.dom.Node appendChild(org.w3c.dom.Node) throws org.w3c.dom.DOMException; + method public abstract org.w3c.dom.Node cloneNode(boolean); + method public abstract short compareDocumentPosition(org.w3c.dom.Node) throws org.w3c.dom.DOMException; + method public abstract org.w3c.dom.NamedNodeMap getAttributes(); + method public abstract java.lang.String getBaseURI(); + method public abstract org.w3c.dom.NodeList getChildNodes(); + method public abstract java.lang.Object getFeature(java.lang.String, java.lang.String); + method public abstract org.w3c.dom.Node getFirstChild(); + method public abstract org.w3c.dom.Node getLastChild(); + method public abstract java.lang.String getLocalName(); + method public abstract java.lang.String getNamespaceURI(); + method public abstract org.w3c.dom.Node getNextSibling(); + method public abstract java.lang.String getNodeName(); + method public abstract short getNodeType(); + method public abstract java.lang.String getNodeValue() throws org.w3c.dom.DOMException; + method public abstract org.w3c.dom.Document getOwnerDocument(); + method public abstract org.w3c.dom.Node getParentNode(); + method public abstract java.lang.String getPrefix(); + method public abstract org.w3c.dom.Node getPreviousSibling(); + method public abstract java.lang.String getTextContent() throws org.w3c.dom.DOMException; + method public abstract java.lang.Object getUserData(java.lang.String); + method public abstract boolean hasAttributes(); + method public abstract boolean hasChildNodes(); + method public abstract org.w3c.dom.Node insertBefore(org.w3c.dom.Node, org.w3c.dom.Node) throws org.w3c.dom.DOMException; + method public abstract boolean isDefaultNamespace(java.lang.String); + method public abstract boolean isEqualNode(org.w3c.dom.Node); + method public abstract boolean isSameNode(org.w3c.dom.Node); + method public abstract boolean isSupported(java.lang.String, java.lang.String); + method public abstract java.lang.String lookupNamespaceURI(java.lang.String); + method public abstract java.lang.String lookupPrefix(java.lang.String); + method public abstract void normalize(); + method public abstract org.w3c.dom.Node removeChild(org.w3c.dom.Node) throws org.w3c.dom.DOMException; + method public abstract org.w3c.dom.Node replaceChild(org.w3c.dom.Node, org.w3c.dom.Node) throws org.w3c.dom.DOMException; + method public abstract void setNodeValue(java.lang.String) throws org.w3c.dom.DOMException; + method public abstract void setPrefix(java.lang.String) throws org.w3c.dom.DOMException; + method public abstract void setTextContent(java.lang.String) throws org.w3c.dom.DOMException; + method public abstract java.lang.Object setUserData(java.lang.String, java.lang.Object, org.w3c.dom.UserDataHandler); + field public static final short ATTRIBUTE_NODE = 2; // 0x2 + field public static final short CDATA_SECTION_NODE = 4; // 0x4 + field public static final short COMMENT_NODE = 8; // 0x8 + field public static final short DOCUMENT_FRAGMENT_NODE = 11; // 0xb + field public static final short DOCUMENT_NODE = 9; // 0x9 + field public static final short DOCUMENT_POSITION_CONTAINED_BY = 16; // 0x10 + field public static final short DOCUMENT_POSITION_CONTAINS = 8; // 0x8 + field public static final short DOCUMENT_POSITION_DISCONNECTED = 1; // 0x1 + field public static final short DOCUMENT_POSITION_FOLLOWING = 4; // 0x4 + field public static final short DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 32; // 0x20 + field public static final short DOCUMENT_POSITION_PRECEDING = 2; // 0x2 + field public static final short DOCUMENT_TYPE_NODE = 10; // 0xa + field public static final short ELEMENT_NODE = 1; // 0x1 + field public static final short ENTITY_NODE = 6; // 0x6 + field public static final short ENTITY_REFERENCE_NODE = 5; // 0x5 + field public static final short NOTATION_NODE = 12; // 0xc + field public static final short PROCESSING_INSTRUCTION_NODE = 7; // 0x7 + field public static final short TEXT_NODE = 3; // 0x3 + } + + public abstract interface NodeList { + method public abstract int getLength(); + method public abstract org.w3c.dom.Node item(int); + } + + public abstract interface Notation implements org.w3c.dom.Node { + method public abstract java.lang.String getPublicId(); + method public abstract java.lang.String getSystemId(); + } + + public abstract interface ProcessingInstruction implements org.w3c.dom.Node { + method public abstract java.lang.String getData(); + method public abstract java.lang.String getTarget(); + method public abstract void setData(java.lang.String) throws org.w3c.dom.DOMException; + } + + public abstract interface Text implements org.w3c.dom.CharacterData { + method public abstract java.lang.String getWholeText(); + method public abstract boolean isElementContentWhitespace(); + method public abstract org.w3c.dom.Text replaceWholeText(java.lang.String) throws org.w3c.dom.DOMException; + method public abstract org.w3c.dom.Text splitText(int) throws org.w3c.dom.DOMException; + } + + public abstract interface TypeInfo { + method public abstract java.lang.String getTypeName(); + method public abstract java.lang.String getTypeNamespace(); + method public abstract boolean isDerivedFrom(java.lang.String, java.lang.String, int); + field public static final int DERIVATION_EXTENSION = 2; // 0x2 + field public static final int DERIVATION_LIST = 8; // 0x8 + field public static final int DERIVATION_RESTRICTION = 1; // 0x1 + field public static final int DERIVATION_UNION = 4; // 0x4 + } + + public abstract interface UserDataHandler { + method public abstract void handle(short, java.lang.String, java.lang.Object, org.w3c.dom.Node, org.w3c.dom.Node); + field public static final short NODE_ADOPTED = 5; // 0x5 + field public static final short NODE_CLONED = 1; // 0x1 + field public static final short NODE_DELETED = 3; // 0x3 + field public static final short NODE_IMPORTED = 2; // 0x2 + field public static final short NODE_RENAMED = 4; // 0x4 + } + +} + +package org.w3c.dom.ls { + + public abstract interface DOMImplementationLS { + method public abstract org.w3c.dom.ls.LSInput createLSInput(); + method public abstract org.w3c.dom.ls.LSOutput createLSOutput(); + method public abstract org.w3c.dom.ls.LSParser createLSParser(short, java.lang.String) throws org.w3c.dom.DOMException; + method public abstract org.w3c.dom.ls.LSSerializer createLSSerializer(); + field public static final short MODE_ASYNCHRONOUS = 2; // 0x2 + field public static final short MODE_SYNCHRONOUS = 1; // 0x1 + } + + public class LSException extends java.lang.RuntimeException { + ctor public LSException(short, java.lang.String); + field public static final short PARSE_ERR = 81; // 0x51 + field public static final short SERIALIZE_ERR = 82; // 0x52 + field public short code; + } + + public abstract interface LSInput { + method public abstract java.lang.String getBaseURI(); + method public abstract java.io.InputStream getByteStream(); + method public abstract boolean getCertifiedText(); + method public abstract java.io.Reader getCharacterStream(); + method public abstract java.lang.String getEncoding(); + method public abstract java.lang.String getPublicId(); + method public abstract java.lang.String getStringData(); + method public abstract java.lang.String getSystemId(); + method public abstract void setBaseURI(java.lang.String); + method public abstract void setByteStream(java.io.InputStream); + method public abstract void setCertifiedText(boolean); + method public abstract void setCharacterStream(java.io.Reader); + method public abstract void setEncoding(java.lang.String); + method public abstract void setPublicId(java.lang.String); + method public abstract void setStringData(java.lang.String); + method public abstract void setSystemId(java.lang.String); + } + + public abstract interface LSOutput { + method public abstract java.io.OutputStream getByteStream(); + method public abstract java.io.Writer getCharacterStream(); + method public abstract java.lang.String getEncoding(); + method public abstract java.lang.String getSystemId(); + method public abstract void setByteStream(java.io.OutputStream); + method public abstract void setCharacterStream(java.io.Writer); + method public abstract void setEncoding(java.lang.String); + method public abstract void setSystemId(java.lang.String); + } + + public abstract interface LSParser { + method public abstract void abort(); + method public abstract boolean getAsync(); + method public abstract boolean getBusy(); + method public abstract org.w3c.dom.DOMConfiguration getDomConfig(); + method public abstract org.w3c.dom.ls.LSParserFilter getFilter(); + method public abstract org.w3c.dom.Document parse(org.w3c.dom.ls.LSInput) throws org.w3c.dom.DOMException, org.w3c.dom.ls.LSException; + method public abstract org.w3c.dom.Document parseURI(java.lang.String) throws org.w3c.dom.DOMException, org.w3c.dom.ls.LSException; + method public abstract org.w3c.dom.Node parseWithContext(org.w3c.dom.ls.LSInput, org.w3c.dom.Node, short) throws org.w3c.dom.DOMException, org.w3c.dom.ls.LSException; + method public abstract void setFilter(org.w3c.dom.ls.LSParserFilter); + field public static final short ACTION_APPEND_AS_CHILDREN = 1; // 0x1 + field public static final short ACTION_INSERT_AFTER = 4; // 0x4 + field public static final short ACTION_INSERT_BEFORE = 3; // 0x3 + field public static final short ACTION_REPLACE = 5; // 0x5 + field public static final short ACTION_REPLACE_CHILDREN = 2; // 0x2 + } + + public abstract interface LSParserFilter { + method public abstract short acceptNode(org.w3c.dom.Node); + method public abstract int getWhatToShow(); + method public abstract short startElement(org.w3c.dom.Element); + field public static final short FILTER_ACCEPT = 1; // 0x1 + field public static final short FILTER_INTERRUPT = 4; // 0x4 + field public static final short FILTER_REJECT = 2; // 0x2 + field public static final short FILTER_SKIP = 3; // 0x3 + } + + public abstract interface LSResourceResolver { + method public abstract org.w3c.dom.ls.LSInput resolveResource(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String); + } + + public abstract interface LSSerializer { + method public abstract org.w3c.dom.DOMConfiguration getDomConfig(); + method public abstract java.lang.String getNewLine(); + method public abstract void setNewLine(java.lang.String); + method public abstract boolean write(org.w3c.dom.Node, org.w3c.dom.ls.LSOutput) throws org.w3c.dom.ls.LSException; + method public abstract java.lang.String writeToString(org.w3c.dom.Node) throws org.w3c.dom.DOMException, org.w3c.dom.ls.LSException; + method public abstract boolean writeToURI(org.w3c.dom.Node, java.lang.String) throws org.w3c.dom.ls.LSException; + } + +} + +package org.xml.sax { + + public abstract deprecated interface AttributeList { + method public abstract int getLength(); + method public abstract java.lang.String getName(int); + method public abstract java.lang.String getType(int); + method public abstract java.lang.String getType(java.lang.String); + method public abstract java.lang.String getValue(int); + method public abstract java.lang.String getValue(java.lang.String); + } + + public abstract interface Attributes { + method public abstract int getIndex(java.lang.String, java.lang.String); + method public abstract int getIndex(java.lang.String); + method public abstract int getLength(); + method public abstract java.lang.String getLocalName(int); + method public abstract java.lang.String getQName(int); + method public abstract java.lang.String getType(int); + method public abstract java.lang.String getType(java.lang.String, java.lang.String); + method public abstract java.lang.String getType(java.lang.String); + method public abstract java.lang.String getURI(int); + method public abstract java.lang.String getValue(int); + method public abstract java.lang.String getValue(java.lang.String, java.lang.String); + method public abstract java.lang.String getValue(java.lang.String); + } + + public abstract interface ContentHandler { + method public abstract void characters(char[], int, int) throws org.xml.sax.SAXException; + method public abstract void endDocument() throws org.xml.sax.SAXException; + method public abstract void endElement(java.lang.String, java.lang.String, java.lang.String) throws org.xml.sax.SAXException; + method public abstract void endPrefixMapping(java.lang.String) throws org.xml.sax.SAXException; + method public abstract void ignorableWhitespace(char[], int, int) throws org.xml.sax.SAXException; + method public abstract void processingInstruction(java.lang.String, java.lang.String) throws org.xml.sax.SAXException; + method public abstract void setDocumentLocator(org.xml.sax.Locator); + method public abstract void skippedEntity(java.lang.String) throws org.xml.sax.SAXException; + method public abstract void startDocument() throws org.xml.sax.SAXException; + method public abstract void startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes) throws org.xml.sax.SAXException; + method public abstract void startPrefixMapping(java.lang.String, java.lang.String) throws org.xml.sax.SAXException; + } + + public abstract interface DTDHandler { + method public abstract void notationDecl(java.lang.String, java.lang.String, java.lang.String) throws org.xml.sax.SAXException; + method public abstract void unparsedEntityDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String) throws org.xml.sax.SAXException; + } + + public abstract deprecated interface DocumentHandler { + method public abstract void characters(char[], int, int) throws org.xml.sax.SAXException; + method public abstract void endDocument() throws org.xml.sax.SAXException; + method public abstract void endElement(java.lang.String) throws org.xml.sax.SAXException; + method public abstract void ignorableWhitespace(char[], int, int) throws org.xml.sax.SAXException; + method public abstract void processingInstruction(java.lang.String, java.lang.String) throws org.xml.sax.SAXException; + method public abstract void setDocumentLocator(org.xml.sax.Locator); + method public abstract void startDocument() throws org.xml.sax.SAXException; + method public abstract void startElement(java.lang.String, org.xml.sax.AttributeList) throws org.xml.sax.SAXException; + } + + public abstract interface EntityResolver { + method public abstract org.xml.sax.InputSource resolveEntity(java.lang.String, java.lang.String) throws java.io.IOException, org.xml.sax.SAXException; + } + + public abstract interface ErrorHandler { + method public abstract void error(org.xml.sax.SAXParseException) throws org.xml.sax.SAXException; + method public abstract void fatalError(org.xml.sax.SAXParseException) throws org.xml.sax.SAXException; + method public abstract void warning(org.xml.sax.SAXParseException) throws org.xml.sax.SAXException; + } + + public deprecated class HandlerBase implements org.xml.sax.DTDHandler org.xml.sax.DocumentHandler org.xml.sax.EntityResolver org.xml.sax.ErrorHandler { + ctor public HandlerBase(); + method public void characters(char[], int, int) throws org.xml.sax.SAXException; + method public void endDocument() throws org.xml.sax.SAXException; + method public void endElement(java.lang.String) throws org.xml.sax.SAXException; + method public void error(org.xml.sax.SAXParseException) throws org.xml.sax.SAXException; + method public void fatalError(org.xml.sax.SAXParseException) throws org.xml.sax.SAXException; + method public void ignorableWhitespace(char[], int, int) throws org.xml.sax.SAXException; + method public void notationDecl(java.lang.String, java.lang.String, java.lang.String); + method public void processingInstruction(java.lang.String, java.lang.String) throws org.xml.sax.SAXException; + method public org.xml.sax.InputSource resolveEntity(java.lang.String, java.lang.String) throws org.xml.sax.SAXException; + method public void setDocumentLocator(org.xml.sax.Locator); + method public void startDocument() throws org.xml.sax.SAXException; + method public void startElement(java.lang.String, org.xml.sax.AttributeList) throws org.xml.sax.SAXException; + method public void unparsedEntityDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String); + method public void warning(org.xml.sax.SAXParseException) throws org.xml.sax.SAXException; + } + + public class InputSource { + ctor public InputSource(); + ctor public InputSource(java.lang.String); + ctor public InputSource(java.io.InputStream); + ctor public InputSource(java.io.Reader); + method public java.io.InputStream getByteStream(); + method public java.io.Reader getCharacterStream(); + method public java.lang.String getEncoding(); + method public java.lang.String getPublicId(); + method public java.lang.String getSystemId(); + method public void setByteStream(java.io.InputStream); + method public void setCharacterStream(java.io.Reader); + method public void setEncoding(java.lang.String); + method public void setPublicId(java.lang.String); + method public void setSystemId(java.lang.String); + } + + public abstract interface Locator { + method public abstract int getColumnNumber(); + method public abstract int getLineNumber(); + method public abstract java.lang.String getPublicId(); + method public abstract java.lang.String getSystemId(); + } + + public abstract deprecated interface Parser { + method public abstract void parse(org.xml.sax.InputSource) throws java.io.IOException, org.xml.sax.SAXException; + method public abstract void parse(java.lang.String) throws java.io.IOException, org.xml.sax.SAXException; + method public abstract void setDTDHandler(org.xml.sax.DTDHandler); + method public abstract void setDocumentHandler(org.xml.sax.DocumentHandler); + method public abstract void setEntityResolver(org.xml.sax.EntityResolver); + method public abstract void setErrorHandler(org.xml.sax.ErrorHandler); + method public abstract void setLocale(java.util.Locale) throws org.xml.sax.SAXException; + } + + public class SAXException extends java.lang.Exception { + ctor public SAXException(); + ctor public SAXException(java.lang.String); + ctor public SAXException(java.lang.Exception); + ctor public SAXException(java.lang.String, java.lang.Exception); + method public java.lang.Exception getException(); + } + + public class SAXNotRecognizedException extends org.xml.sax.SAXException { + ctor public SAXNotRecognizedException(); + ctor public SAXNotRecognizedException(java.lang.String); + } + + public class SAXNotSupportedException extends org.xml.sax.SAXException { + ctor public SAXNotSupportedException(); + ctor public SAXNotSupportedException(java.lang.String); + } + + public class SAXParseException extends org.xml.sax.SAXException { + ctor public SAXParseException(java.lang.String, org.xml.sax.Locator); + ctor public SAXParseException(java.lang.String, org.xml.sax.Locator, java.lang.Exception); + ctor public SAXParseException(java.lang.String, java.lang.String, java.lang.String, int, int); + ctor public SAXParseException(java.lang.String, java.lang.String, java.lang.String, int, int, java.lang.Exception); + method public int getColumnNumber(); + method public int getLineNumber(); + method public java.lang.String getPublicId(); + method public java.lang.String getSystemId(); + } + + public abstract interface XMLFilter implements org.xml.sax.XMLReader { + method public abstract org.xml.sax.XMLReader getParent(); + method public abstract void setParent(org.xml.sax.XMLReader); + } + + public abstract interface XMLReader { + method public abstract org.xml.sax.ContentHandler getContentHandler(); + method public abstract org.xml.sax.DTDHandler getDTDHandler(); + method public abstract org.xml.sax.EntityResolver getEntityResolver(); + method public abstract org.xml.sax.ErrorHandler getErrorHandler(); + method public abstract boolean getFeature(java.lang.String) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException; + method public abstract java.lang.Object getProperty(java.lang.String) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException; + method public abstract void parse(org.xml.sax.InputSource) throws java.io.IOException, org.xml.sax.SAXException; + method public abstract void parse(java.lang.String) throws java.io.IOException, org.xml.sax.SAXException; + method public abstract void setContentHandler(org.xml.sax.ContentHandler); + method public abstract void setDTDHandler(org.xml.sax.DTDHandler); + method public abstract void setEntityResolver(org.xml.sax.EntityResolver); + method public abstract void setErrorHandler(org.xml.sax.ErrorHandler); + method public abstract void setFeature(java.lang.String, boolean) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException; + method public abstract void setProperty(java.lang.String, java.lang.Object) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException; + } + +} + +package org.xml.sax.ext { + + public abstract interface Attributes2 implements org.xml.sax.Attributes { + method public abstract boolean isDeclared(int); + method public abstract boolean isDeclared(java.lang.String); + method public abstract boolean isDeclared(java.lang.String, java.lang.String); + method public abstract boolean isSpecified(int); + method public abstract boolean isSpecified(java.lang.String, java.lang.String); + method public abstract boolean isSpecified(java.lang.String); + } + + public class Attributes2Impl extends org.xml.sax.helpers.AttributesImpl implements org.xml.sax.ext.Attributes2 { + ctor public Attributes2Impl(); + ctor public Attributes2Impl(org.xml.sax.Attributes); + method public boolean isDeclared(int); + method public boolean isDeclared(java.lang.String, java.lang.String); + method public boolean isDeclared(java.lang.String); + method public boolean isSpecified(int); + method public boolean isSpecified(java.lang.String, java.lang.String); + method public boolean isSpecified(java.lang.String); + method public void setDeclared(int, boolean); + method public void setSpecified(int, boolean); + } + + public abstract interface DeclHandler { + method public abstract void attributeDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String) throws org.xml.sax.SAXException; + method public abstract void elementDecl(java.lang.String, java.lang.String) throws org.xml.sax.SAXException; + method public abstract void externalEntityDecl(java.lang.String, java.lang.String, java.lang.String) throws org.xml.sax.SAXException; + method public abstract void internalEntityDecl(java.lang.String, java.lang.String) throws org.xml.sax.SAXException; + } + + public class DefaultHandler2 extends org.xml.sax.helpers.DefaultHandler implements org.xml.sax.ext.DeclHandler org.xml.sax.ext.EntityResolver2 org.xml.sax.ext.LexicalHandler { + ctor public DefaultHandler2(); + method public void attributeDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String) throws org.xml.sax.SAXException; + method public void comment(char[], int, int) throws org.xml.sax.SAXException; + method public void elementDecl(java.lang.String, java.lang.String) throws org.xml.sax.SAXException; + method public void endCDATA() throws org.xml.sax.SAXException; + method public void endDTD() throws org.xml.sax.SAXException; + method public void endEntity(java.lang.String) throws org.xml.sax.SAXException; + method public void externalEntityDecl(java.lang.String, java.lang.String, java.lang.String) throws org.xml.sax.SAXException; + method public org.xml.sax.InputSource getExternalSubset(java.lang.String, java.lang.String) throws java.io.IOException, org.xml.sax.SAXException; + method public void internalEntityDecl(java.lang.String, java.lang.String) throws org.xml.sax.SAXException; + method public org.xml.sax.InputSource resolveEntity(java.lang.String, java.lang.String, java.lang.String, java.lang.String) throws java.io.IOException, org.xml.sax.SAXException; + method public void startCDATA() throws org.xml.sax.SAXException; + method public void startDTD(java.lang.String, java.lang.String, java.lang.String) throws org.xml.sax.SAXException; + method public void startEntity(java.lang.String) throws org.xml.sax.SAXException; + } + + public abstract interface EntityResolver2 implements org.xml.sax.EntityResolver { + method public abstract org.xml.sax.InputSource getExternalSubset(java.lang.String, java.lang.String) throws java.io.IOException, org.xml.sax.SAXException; + method public abstract org.xml.sax.InputSource resolveEntity(java.lang.String, java.lang.String, java.lang.String, java.lang.String) throws java.io.IOException, org.xml.sax.SAXException; + } + + public abstract interface LexicalHandler { + method public abstract void comment(char[], int, int) throws org.xml.sax.SAXException; + method public abstract void endCDATA() throws org.xml.sax.SAXException; + method public abstract void endDTD() throws org.xml.sax.SAXException; + method public abstract void endEntity(java.lang.String) throws org.xml.sax.SAXException; + method public abstract void startCDATA() throws org.xml.sax.SAXException; + method public abstract void startDTD(java.lang.String, java.lang.String, java.lang.String) throws org.xml.sax.SAXException; + method public abstract void startEntity(java.lang.String) throws org.xml.sax.SAXException; + } + + public abstract interface Locator2 implements org.xml.sax.Locator { + method public abstract java.lang.String getEncoding(); + method public abstract java.lang.String getXMLVersion(); + } + + public class Locator2Impl extends org.xml.sax.helpers.LocatorImpl implements org.xml.sax.ext.Locator2 { + ctor public Locator2Impl(); + ctor public Locator2Impl(org.xml.sax.Locator); + method public java.lang.String getEncoding(); + method public java.lang.String getXMLVersion(); + method public void setEncoding(java.lang.String); + method public void setXMLVersion(java.lang.String); + } + +} + +package org.xml.sax.helpers { + + public deprecated class AttributeListImpl implements org.xml.sax.AttributeList { + ctor public AttributeListImpl(); + ctor public AttributeListImpl(org.xml.sax.AttributeList); + method public void addAttribute(java.lang.String, java.lang.String, java.lang.String); + method public void clear(); + method public int getLength(); + method public java.lang.String getName(int); + method public java.lang.String getType(int); + method public java.lang.String getType(java.lang.String); + method public java.lang.String getValue(int); + method public java.lang.String getValue(java.lang.String); + method public void removeAttribute(java.lang.String); + method public void setAttributeList(org.xml.sax.AttributeList); + } + + public class AttributesImpl implements org.xml.sax.Attributes { + ctor public AttributesImpl(); + ctor public AttributesImpl(org.xml.sax.Attributes); + method public void addAttribute(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String); + method public void clear(); + method public int getIndex(java.lang.String, java.lang.String); + method public int getIndex(java.lang.String); + method public int getLength(); + method public java.lang.String getLocalName(int); + method public java.lang.String getQName(int); + method public java.lang.String getType(int); + method public java.lang.String getType(java.lang.String, java.lang.String); + method public java.lang.String getType(java.lang.String); + method public java.lang.String getURI(int); + method public java.lang.String getValue(int); + method public java.lang.String getValue(java.lang.String, java.lang.String); + method public java.lang.String getValue(java.lang.String); + method public void removeAttribute(int); + method public void setAttribute(int, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String); + method public void setAttributes(org.xml.sax.Attributes); + method public void setLocalName(int, java.lang.String); + method public void setQName(int, java.lang.String); + method public void setType(int, java.lang.String); + method public void setURI(int, java.lang.String); + method public void setValue(int, java.lang.String); + } + + public class DefaultHandler implements org.xml.sax.ContentHandler org.xml.sax.DTDHandler org.xml.sax.EntityResolver org.xml.sax.ErrorHandler { + ctor public DefaultHandler(); + method public void characters(char[], int, int) throws org.xml.sax.SAXException; + method public void endDocument() throws org.xml.sax.SAXException; + method public void endElement(java.lang.String, java.lang.String, java.lang.String) throws org.xml.sax.SAXException; + method public void endPrefixMapping(java.lang.String) throws org.xml.sax.SAXException; + method public void error(org.xml.sax.SAXParseException) throws org.xml.sax.SAXException; + method public void fatalError(org.xml.sax.SAXParseException) throws org.xml.sax.SAXException; + method public void ignorableWhitespace(char[], int, int) throws org.xml.sax.SAXException; + method public void notationDecl(java.lang.String, java.lang.String, java.lang.String) throws org.xml.sax.SAXException; + method public void processingInstruction(java.lang.String, java.lang.String) throws org.xml.sax.SAXException; + method public org.xml.sax.InputSource resolveEntity(java.lang.String, java.lang.String) throws java.io.IOException, org.xml.sax.SAXException; + method public void setDocumentLocator(org.xml.sax.Locator); + method public void skippedEntity(java.lang.String) throws org.xml.sax.SAXException; + method public void startDocument() throws org.xml.sax.SAXException; + method public void startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes) throws org.xml.sax.SAXException; + method public void startPrefixMapping(java.lang.String, java.lang.String) throws org.xml.sax.SAXException; + method public void unparsedEntityDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String) throws org.xml.sax.SAXException; + method public void warning(org.xml.sax.SAXParseException) throws org.xml.sax.SAXException; + } + + public class LocatorImpl implements org.xml.sax.Locator { + ctor public LocatorImpl(); + ctor public LocatorImpl(org.xml.sax.Locator); + method public int getColumnNumber(); + method public int getLineNumber(); + method public java.lang.String getPublicId(); + method public java.lang.String getSystemId(); + method public void setColumnNumber(int); + method public void setLineNumber(int); + method public void setPublicId(java.lang.String); + method public void setSystemId(java.lang.String); + } + + public class NamespaceSupport { + ctor public NamespaceSupport(); + method public boolean declarePrefix(java.lang.String, java.lang.String); + method public java.util.Enumeration getDeclaredPrefixes(); + method public java.lang.String getPrefix(java.lang.String); + method public java.util.Enumeration getPrefixes(); + method public java.util.Enumeration getPrefixes(java.lang.String); + method public java.lang.String getURI(java.lang.String); + method public boolean isNamespaceDeclUris(); + method public void popContext(); + method public java.lang.String[] processName(java.lang.String, java.lang.String[], boolean); + method public void pushContext(); + method public void reset(); + method public void setNamespaceDeclUris(boolean); + field public static final java.lang.String NSDECL = "http://www.w3.org/xmlns/2000/"; + field public static final java.lang.String XMLNS = "http://www.w3.org/XML/1998/namespace"; + } + + public class ParserAdapter implements org.xml.sax.DocumentHandler org.xml.sax.XMLReader { + ctor public ParserAdapter() throws org.xml.sax.SAXException; + ctor public ParserAdapter(org.xml.sax.Parser); + method public void characters(char[], int, int) throws org.xml.sax.SAXException; + method public void endDocument() throws org.xml.sax.SAXException; + method public void endElement(java.lang.String) throws org.xml.sax.SAXException; + method public org.xml.sax.ContentHandler getContentHandler(); + method public org.xml.sax.DTDHandler getDTDHandler(); + method public org.xml.sax.EntityResolver getEntityResolver(); + method public org.xml.sax.ErrorHandler getErrorHandler(); + method public boolean getFeature(java.lang.String) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException; + method public java.lang.Object getProperty(java.lang.String) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException; + method public void ignorableWhitespace(char[], int, int) throws org.xml.sax.SAXException; + method public void parse(java.lang.String) throws java.io.IOException, org.xml.sax.SAXException; + method public void parse(org.xml.sax.InputSource) throws java.io.IOException, org.xml.sax.SAXException; + method public void processingInstruction(java.lang.String, java.lang.String) throws org.xml.sax.SAXException; + method public void setContentHandler(org.xml.sax.ContentHandler); + method public void setDTDHandler(org.xml.sax.DTDHandler); + method public void setDocumentLocator(org.xml.sax.Locator); + method public void setEntityResolver(org.xml.sax.EntityResolver); + method public void setErrorHandler(org.xml.sax.ErrorHandler); + method public void setFeature(java.lang.String, boolean) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException; + method public void setProperty(java.lang.String, java.lang.Object) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException; + method public void startDocument() throws org.xml.sax.SAXException; + method public void startElement(java.lang.String, org.xml.sax.AttributeList) throws org.xml.sax.SAXException; + } + + public deprecated class ParserFactory { + method public static org.xml.sax.Parser makeParser() throws java.lang.ClassCastException, java.lang.ClassNotFoundException, java.lang.IllegalAccessException, java.lang.InstantiationException, java.lang.NullPointerException; + method public static org.xml.sax.Parser makeParser(java.lang.String) throws java.lang.ClassCastException, java.lang.ClassNotFoundException, java.lang.IllegalAccessException, java.lang.InstantiationException; + } + + public class XMLFilterImpl implements org.xml.sax.ContentHandler org.xml.sax.DTDHandler org.xml.sax.EntityResolver org.xml.sax.ErrorHandler org.xml.sax.XMLFilter { + ctor public XMLFilterImpl(); + ctor public XMLFilterImpl(org.xml.sax.XMLReader); + method public void characters(char[], int, int) throws org.xml.sax.SAXException; + method public void endDocument() throws org.xml.sax.SAXException; + method public void endElement(java.lang.String, java.lang.String, java.lang.String) throws org.xml.sax.SAXException; + method public void endPrefixMapping(java.lang.String) throws org.xml.sax.SAXException; + method public void error(org.xml.sax.SAXParseException) throws org.xml.sax.SAXException; + method public void fatalError(org.xml.sax.SAXParseException) throws org.xml.sax.SAXException; + method public org.xml.sax.ContentHandler getContentHandler(); + method public org.xml.sax.DTDHandler getDTDHandler(); + method public org.xml.sax.EntityResolver getEntityResolver(); + method public org.xml.sax.ErrorHandler getErrorHandler(); + method public boolean getFeature(java.lang.String) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException; + method public org.xml.sax.XMLReader getParent(); + method public java.lang.Object getProperty(java.lang.String) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException; + method public void ignorableWhitespace(char[], int, int) throws org.xml.sax.SAXException; + method public void notationDecl(java.lang.String, java.lang.String, java.lang.String) throws org.xml.sax.SAXException; + method public void parse(org.xml.sax.InputSource) throws java.io.IOException, org.xml.sax.SAXException; + method public void parse(java.lang.String) throws java.io.IOException, org.xml.sax.SAXException; + method public void processingInstruction(java.lang.String, java.lang.String) throws org.xml.sax.SAXException; + method public org.xml.sax.InputSource resolveEntity(java.lang.String, java.lang.String) throws java.io.IOException, org.xml.sax.SAXException; + method public void setContentHandler(org.xml.sax.ContentHandler); + method public void setDTDHandler(org.xml.sax.DTDHandler); + method public void setDocumentLocator(org.xml.sax.Locator); + method public void setEntityResolver(org.xml.sax.EntityResolver); + method public void setErrorHandler(org.xml.sax.ErrorHandler); + method public void setFeature(java.lang.String, boolean) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException; + method public void setParent(org.xml.sax.XMLReader); + method public void setProperty(java.lang.String, java.lang.Object) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException; + method public void skippedEntity(java.lang.String) throws org.xml.sax.SAXException; + method public void startDocument() throws org.xml.sax.SAXException; + method public void startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes) throws org.xml.sax.SAXException; + method public void startPrefixMapping(java.lang.String, java.lang.String) throws org.xml.sax.SAXException; + method public void unparsedEntityDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String) throws org.xml.sax.SAXException; + method public void warning(org.xml.sax.SAXParseException) throws org.xml.sax.SAXException; + } + + public class XMLReaderAdapter implements org.xml.sax.ContentHandler org.xml.sax.Parser { + ctor public XMLReaderAdapter() throws org.xml.sax.SAXException; + ctor public XMLReaderAdapter(org.xml.sax.XMLReader); + method public void characters(char[], int, int) throws org.xml.sax.SAXException; + method public void endDocument() throws org.xml.sax.SAXException; + method public void endElement(java.lang.String, java.lang.String, java.lang.String) throws org.xml.sax.SAXException; + method public void endPrefixMapping(java.lang.String); + method public void ignorableWhitespace(char[], int, int) throws org.xml.sax.SAXException; + method public void parse(java.lang.String) throws java.io.IOException, org.xml.sax.SAXException; + method public void parse(org.xml.sax.InputSource) throws java.io.IOException, org.xml.sax.SAXException; + method public void processingInstruction(java.lang.String, java.lang.String) throws org.xml.sax.SAXException; + method public void setDTDHandler(org.xml.sax.DTDHandler); + method public void setDocumentHandler(org.xml.sax.DocumentHandler); + method public void setDocumentLocator(org.xml.sax.Locator); + method public void setEntityResolver(org.xml.sax.EntityResolver); + method public void setErrorHandler(org.xml.sax.ErrorHandler); + method public void setLocale(java.util.Locale) throws org.xml.sax.SAXException; + method public void skippedEntity(java.lang.String) throws org.xml.sax.SAXException; + method public void startDocument() throws org.xml.sax.SAXException; + method public void startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes) throws org.xml.sax.SAXException; + method public void startPrefixMapping(java.lang.String, java.lang.String); + } + + public final class XMLReaderFactory { + method public static org.xml.sax.XMLReader createXMLReader() throws org.xml.sax.SAXException; + method public static org.xml.sax.XMLReader createXMLReader(java.lang.String) throws org.xml.sax.SAXException; + } + +} + +package org.xmlpull.v1 { + + public abstract interface XmlPullParser { + method public abstract void defineEntityReplacementText(java.lang.String, java.lang.String) throws org.xmlpull.v1.XmlPullParserException; + method public abstract int getAttributeCount(); + method public abstract java.lang.String getAttributeName(int); + method public abstract java.lang.String getAttributeNamespace(int); + method public abstract java.lang.String getAttributePrefix(int); + method public abstract java.lang.String getAttributeType(int); + method public abstract java.lang.String getAttributeValue(int); + method public abstract java.lang.String getAttributeValue(java.lang.String, java.lang.String); + method public abstract int getColumnNumber(); + method public abstract int getDepth(); + method public abstract int getEventType() throws org.xmlpull.v1.XmlPullParserException; + method public abstract boolean getFeature(java.lang.String); + method public abstract java.lang.String getInputEncoding(); + method public abstract int getLineNumber(); + method public abstract java.lang.String getName(); + method public abstract java.lang.String getNamespace(java.lang.String); + method public abstract java.lang.String getNamespace(); + method public abstract int getNamespaceCount(int) throws org.xmlpull.v1.XmlPullParserException; + method public abstract java.lang.String getNamespacePrefix(int) throws org.xmlpull.v1.XmlPullParserException; + method public abstract java.lang.String getNamespaceUri(int) throws org.xmlpull.v1.XmlPullParserException; + method public abstract java.lang.String getPositionDescription(); + method public abstract java.lang.String getPrefix(); + method public abstract java.lang.Object getProperty(java.lang.String); + method public abstract java.lang.String getText(); + method public abstract char[] getTextCharacters(int[]); + method public abstract boolean isAttributeDefault(int); + method public abstract boolean isEmptyElementTag() throws org.xmlpull.v1.XmlPullParserException; + method public abstract boolean isWhitespace() throws org.xmlpull.v1.XmlPullParserException; + method public abstract int next() throws java.io.IOException, org.xmlpull.v1.XmlPullParserException; + method public abstract int nextTag() throws java.io.IOException, org.xmlpull.v1.XmlPullParserException; + method public abstract java.lang.String nextText() throws java.io.IOException, org.xmlpull.v1.XmlPullParserException; + method public abstract int nextToken() throws java.io.IOException, org.xmlpull.v1.XmlPullParserException; + method public abstract void require(int, java.lang.String, java.lang.String) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException; + method public abstract void setFeature(java.lang.String, boolean) throws org.xmlpull.v1.XmlPullParserException; + method public abstract void setInput(java.io.Reader) throws org.xmlpull.v1.XmlPullParserException; + method public abstract void setInput(java.io.InputStream, java.lang.String) throws org.xmlpull.v1.XmlPullParserException; + method public abstract void setProperty(java.lang.String, java.lang.Object) throws org.xmlpull.v1.XmlPullParserException; + field public static final int CDSECT = 5; // 0x5 + field public static final int COMMENT = 9; // 0x9 + field public static final int DOCDECL = 10; // 0xa + field public static final int END_DOCUMENT = 1; // 0x1 + field public static final int END_TAG = 3; // 0x3 + field public static final int ENTITY_REF = 6; // 0x6 + field public static final java.lang.String FEATURE_PROCESS_DOCDECL = "http://xmlpull.org/v1/doc/features.html#process-docdecl"; + field public static final java.lang.String FEATURE_PROCESS_NAMESPACES = "http://xmlpull.org/v1/doc/features.html#process-namespaces"; + field public static final java.lang.String FEATURE_REPORT_NAMESPACE_ATTRIBUTES = "http://xmlpull.org/v1/doc/features.html#report-namespace-prefixes"; + field public static final java.lang.String FEATURE_VALIDATION = "http://xmlpull.org/v1/doc/features.html#validation"; + field public static final int IGNORABLE_WHITESPACE = 7; // 0x7 + field public static final java.lang.String NO_NAMESPACE = ""; + field public static final int PROCESSING_INSTRUCTION = 8; // 0x8 + field public static final int START_DOCUMENT = 0; // 0x0 + field public static final int START_TAG = 2; // 0x2 + field public static final int TEXT = 4; // 0x4 + field public static final java.lang.String[] TYPES; + } + + public class XmlPullParserException extends java.lang.Exception { + ctor public XmlPullParserException(java.lang.String); + ctor public XmlPullParserException(java.lang.String, org.xmlpull.v1.XmlPullParser, java.lang.Throwable); + method public int getColumnNumber(); + method public java.lang.Throwable getDetail(); + method public int getLineNumber(); + field protected int column; + field protected java.lang.Throwable detail; + field protected int row; + } + + public class XmlPullParserFactory { + ctor protected XmlPullParserFactory(); + method public boolean getFeature(java.lang.String); + method public boolean isNamespaceAware(); + method public boolean isValidating(); + method public static org.xmlpull.v1.XmlPullParserFactory newInstance() throws org.xmlpull.v1.XmlPullParserException; + method public static org.xmlpull.v1.XmlPullParserFactory newInstance(java.lang.String, java.lang.Class) throws org.xmlpull.v1.XmlPullParserException; + method public org.xmlpull.v1.XmlPullParser newPullParser() throws org.xmlpull.v1.XmlPullParserException; + method public org.xmlpull.v1.XmlSerializer newSerializer() throws org.xmlpull.v1.XmlPullParserException; + method public void setFeature(java.lang.String, boolean) throws org.xmlpull.v1.XmlPullParserException; + method public void setNamespaceAware(boolean); + method public void setValidating(boolean); + field public static final java.lang.String PROPERTY_NAME = "org.xmlpull.v1.XmlPullParserFactory"; + field protected java.lang.String classNamesLocation; + field protected java.util.HashMap features; + field protected java.util.ArrayList parserClasses; + field protected java.util.ArrayList serializerClasses; + } + + public abstract interface XmlSerializer { + method public abstract org.xmlpull.v1.XmlSerializer attribute(java.lang.String, java.lang.String, java.lang.String) throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.IllegalStateException; + method public abstract void cdsect(java.lang.String) throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.IllegalStateException; + method public abstract void comment(java.lang.String) throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.IllegalStateException; + method public abstract void docdecl(java.lang.String) throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.IllegalStateException; + method public abstract void endDocument() throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.IllegalStateException; + method public abstract org.xmlpull.v1.XmlSerializer endTag(java.lang.String, java.lang.String) throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.IllegalStateException; + method public abstract void entityRef(java.lang.String) throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.IllegalStateException; + method public abstract void flush() throws java.io.IOException; + method public abstract int getDepth(); + method public abstract boolean getFeature(java.lang.String); + method public abstract java.lang.String getName(); + method public abstract java.lang.String getNamespace(); + method public abstract java.lang.String getPrefix(java.lang.String, boolean) throws java.lang.IllegalArgumentException; + method public abstract java.lang.Object getProperty(java.lang.String); + method public abstract void ignorableWhitespace(java.lang.String) throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.IllegalStateException; + method public abstract void processingInstruction(java.lang.String) throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.IllegalStateException; + method public abstract void setFeature(java.lang.String, boolean) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException; + method public abstract void setOutput(java.io.OutputStream, java.lang.String) throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.IllegalStateException; + method public abstract void setOutput(java.io.Writer) throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.IllegalStateException; + method public abstract void setPrefix(java.lang.String, java.lang.String) throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.IllegalStateException; + method public abstract void setProperty(java.lang.String, java.lang.Object) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException; + method public abstract void startDocument(java.lang.String, java.lang.Boolean) throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.IllegalStateException; + method public abstract org.xmlpull.v1.XmlSerializer startTag(java.lang.String, java.lang.String) throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.IllegalStateException; + method public abstract org.xmlpull.v1.XmlSerializer text(java.lang.String) throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.IllegalStateException; + method public abstract org.xmlpull.v1.XmlSerializer text(char[], int, int) throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.IllegalStateException; + } + +} + +package org.xmlpull.v1.sax2 { + + public class Driver implements org.xml.sax.Attributes org.xml.sax.Locator org.xml.sax.XMLReader { + ctor public Driver() throws org.xmlpull.v1.XmlPullParserException; + ctor public Driver(org.xmlpull.v1.XmlPullParser) throws org.xmlpull.v1.XmlPullParserException; + method public int getColumnNumber(); + method public org.xml.sax.ContentHandler getContentHandler(); + method public org.xml.sax.DTDHandler getDTDHandler(); + method public org.xml.sax.EntityResolver getEntityResolver(); + method public org.xml.sax.ErrorHandler getErrorHandler(); + method public boolean getFeature(java.lang.String) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException; + method public int getIndex(java.lang.String, java.lang.String); + method public int getIndex(java.lang.String); + method public int getLength(); + method public int getLineNumber(); + method public java.lang.String getLocalName(int); + method public java.lang.Object getProperty(java.lang.String) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException; + method public java.lang.String getPublicId(); + method public java.lang.String getQName(int); + method public java.lang.String getSystemId(); + method public java.lang.String getType(int); + method public java.lang.String getType(java.lang.String, java.lang.String); + method public java.lang.String getType(java.lang.String); + method public java.lang.String getURI(int); + method public java.lang.String getValue(int); + method public java.lang.String getValue(java.lang.String, java.lang.String); + method public java.lang.String getValue(java.lang.String); + method public void parse(org.xml.sax.InputSource) throws java.io.IOException, org.xml.sax.SAXException; + method public void parse(java.lang.String) throws java.io.IOException, org.xml.sax.SAXException; + method public void parseSubTree(org.xmlpull.v1.XmlPullParser) throws java.io.IOException, org.xml.sax.SAXException; + method public void setContentHandler(org.xml.sax.ContentHandler); + method public void setDTDHandler(org.xml.sax.DTDHandler); + method public void setEntityResolver(org.xml.sax.EntityResolver); + method public void setErrorHandler(org.xml.sax.ErrorHandler); + method public void setFeature(java.lang.String, boolean) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException; + method public void setProperty(java.lang.String, java.lang.Object) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException; + method protected void startElement(java.lang.String, java.lang.String, java.lang.String) throws org.xml.sax.SAXException; + field protected static final java.lang.String APACHE_DYNAMIC_VALIDATION_FEATURE = "http://apache.org/xml/features/validation/dynamic"; + field protected static final java.lang.String APACHE_SCHEMA_VALIDATION_FEATURE = "http://apache.org/xml/features/validation/schema"; + field protected static final java.lang.String DECLARATION_HANDLER_PROPERTY = "http://xml.org/sax/properties/declaration-handler"; + field protected static final java.lang.String LEXICAL_HANDLER_PROPERTY = "http://xml.org/sax/properties/lexical-handler"; + field protected static final java.lang.String NAMESPACES_FEATURE = "http://xml.org/sax/features/namespaces"; + field protected static final java.lang.String NAMESPACE_PREFIXES_FEATURE = "http://xml.org/sax/features/namespace-prefixes"; + field protected static final java.lang.String VALIDATION_FEATURE = "http://xml.org/sax/features/validation"; + field protected org.xml.sax.ContentHandler contentHandler; + field protected org.xml.sax.ErrorHandler errorHandler; + field protected org.xmlpull.v1.XmlPullParser pp; + field protected java.lang.String systemId; + } + +} + diff --git a/api/current.txt b/api/current.txt index bc97e814752bf..c57a5412e49e3 100644 --- a/api/current.txt +++ b/api/current.txt @@ -141,16 +141,35 @@ package android { public static final class Manifest.permission_group { ctor public Manifest.permission_group(); field public static final java.lang.String ACCOUNTS = "android.permission-group.ACCOUNTS"; + field public static final java.lang.String AFFECTS_BATTERY = "android.permission-group.AFFECTS_BATTERY"; + field public static final java.lang.String APP_INFO = "android.permission-group.APP_INFO"; + field public static final java.lang.String AUDIO_SETTINGS = "android.permission-group.AUDIO_SETTINGS"; + field public static final java.lang.String BLUETOOTH_NETWORK = "android.permission-group.BLUETOOTH_NETWORK"; + field public static final java.lang.String BOOKMARKS = "android.permission-group.BOOKMARKS"; + field public static final java.lang.String CALENDAR = "android.permission-group.CALENDAR"; + field public static final java.lang.String CAMERA = "android.permission-group.CAMERA"; field public static final java.lang.String COST_MONEY = "android.permission-group.COST_MONEY"; field public static final java.lang.String DEVELOPMENT_TOOLS = "android.permission-group.DEVELOPMENT_TOOLS"; + field public static final java.lang.String DEVICE_ALARMS = "android.permission-group.DEVICE_ALARMS"; + field public static final java.lang.String DISPLAY = "android.permission-group.DISPLAY"; field public static final java.lang.String HARDWARE_CONTROLS = "android.permission-group.HARDWARE_CONTROLS"; field public static final java.lang.String LOCATION = "android.permission-group.LOCATION"; field public static final java.lang.String MESSAGES = "android.permission-group.MESSAGES"; + field public static final java.lang.String MICROPHONE = "android.permission-group.MICROPHONE"; field public static final java.lang.String NETWORK = "android.permission-group.NETWORK"; field public static final java.lang.String PERSONAL_INFO = "android.permission-group.PERSONAL_INFO"; field public static final java.lang.String PHONE_CALLS = "android.permission-group.PHONE_CALLS"; + field public static final java.lang.String SCREENLOCK = "android.permission-group.SCREENLOCK"; + field public static final java.lang.String SOCIAL_INFO = "android.permission-group.SOCIAL_INFO"; + field public static final java.lang.String STATUS_BAR = "android.permission-group.STATUS_BAR"; field public static final java.lang.String STORAGE = "android.permission-group.STORAGE"; + field public static final java.lang.String SYNC_SETTINGS = "android.permission-group.SYNC_SETTINGS"; + field public static final java.lang.String SYSTEM_CLOCK = "android.permission-group.SYSTEM_CLOCK"; field public static final java.lang.String SYSTEM_TOOLS = "android.permission-group.SYSTEM_TOOLS"; + field public static final java.lang.String USER_DICTIONARY = "android.permission-group.USER_DICTIONARY"; + field public static final java.lang.String VOICEMAIL = "android.permission-group.VOICEMAIL"; + field public static final java.lang.String WALLPAPER = "android.permission-group.WALLPAPER"; + field public static final java.lang.String WRITE_USER_DICTIONARY = "android.permission-group.WRITE_USER_DICTIONARY"; } public final class R { @@ -312,6 +331,7 @@ package android { field public static final int checkboxStyle = 16842860; // 0x101006c field public static final int checked = 16843014; // 0x1010106 field public static final int checkedButton = 16843080; // 0x1010148 + field public static final int checkedTextViewStyle = 16843720; // 0x10103c8 field public static final int childDivider = 16843025; // 0x1010111 field public static final int childIndicator = 16843020; // 0x101010c field public static final int childIndicatorLeft = 16843023; // 0x101010f @@ -471,6 +491,8 @@ package android { field public static final int foreground = 16843017; // 0x1010109 field public static final int foregroundGravity = 16843264; // 0x1010200 field public static final int format = 16843013; // 0x1010105 + field public static final int format12Hour = 16843722; // 0x10103ca + field public static final int format24Hour = 16843723; // 0x10103cb field public static final int fragment = 16843491; // 0x10102e3 field public static final int fragmentCloseEnterAnimation = 16843495; // 0x10102e7 field public static final int fragmentCloseExitAnimation = 16843496; // 0x10102e8 @@ -551,6 +573,7 @@ package android { field public static final int indicatorRight = 16843022; // 0x101010e field public static final int inflatedId = 16842995; // 0x10100f3 field public static final int initOrder = 16842778; // 0x101001a + field public static final int initialKeyguardLayout = 16843714; // 0x10103c2 field public static final int initialLayout = 16843345; // 0x1010251 field public static final int innerRadius = 16843359; // 0x101025f field public static final int innerRadiusRatio = 16843163; // 0x101019b @@ -594,6 +617,7 @@ package android { field public static final int keycode = 16842949; // 0x10100c5 field public static final int killAfterRestore = 16843420; // 0x101029c field public static final int label = 16842753; // 0x1010001 + field public static final int labelFor = 16843718; // 0x10103c6 field public static final int labelTextSize = 16843317; // 0x1010235 field public static final int largeHeap = 16843610; // 0x101035a field public static final int largeScreens = 16843398; // 0x1010286 @@ -602,15 +626,20 @@ package android { field public static final int layerType = 16843604; // 0x1010354 field public static final int layout = 16842994; // 0x10100f2 field public static final int layoutAnimation = 16842988; // 0x10100ec + field public static final int layoutDirection = 16843698; // 0x10103b2 field public static final int layout_above = 16843140; // 0x1010184 field public static final int layout_alignBaseline = 16843142; // 0x1010186 field public static final int layout_alignBottom = 16843146; // 0x101018a + field public static final int layout_alignEnd = 16843706; // 0x10103ba field public static final int layout_alignLeft = 16843143; // 0x1010187 field public static final int layout_alignParentBottom = 16843150; // 0x101018e + field public static final int layout_alignParentEnd = 16843708; // 0x10103bc field public static final int layout_alignParentLeft = 16843147; // 0x101018b field public static final int layout_alignParentRight = 16843149; // 0x101018d + field public static final int layout_alignParentStart = 16843707; // 0x10103bb field public static final int layout_alignParentTop = 16843148; // 0x101018c field public static final int layout_alignRight = 16843145; // 0x1010189 + field public static final int layout_alignStart = 16843705; // 0x10103b9 field public static final int layout_alignTop = 16843144; // 0x1010188 field public static final int layout_alignWithParentIfMissing = 16843154; // 0x1010192 field public static final int layout_below = 16843141; // 0x1010185 @@ -623,15 +652,19 @@ package android { field public static final int layout_height = 16842997; // 0x10100f5 field public static final int layout_margin = 16842998; // 0x10100f6 field public static final int layout_marginBottom = 16843002; // 0x10100fa + field public static final int layout_marginEnd = 16843702; // 0x10103b6 field public static final int layout_marginLeft = 16842999; // 0x10100f7 field public static final int layout_marginRight = 16843001; // 0x10100f9 + field public static final int layout_marginStart = 16843701; // 0x10103b5 field public static final int layout_marginTop = 16843000; // 0x10100f8 field public static final int layout_row = 16843643; // 0x101037b field public static final int layout_rowSpan = 16843644; // 0x101037c field public static final int layout_scale = 16843155; // 0x1010193 field public static final int layout_span = 16843085; // 0x101014d + field public static final int layout_toEndOf = 16843704; // 0x10103b8 field public static final int layout_toLeftOf = 16843138; // 0x1010182 field public static final int layout_toRightOf = 16843139; // 0x1010183 + field public static final int layout_toStartOf = 16843703; // 0x10103b7 field public static final int layout_weight = 16843137; // 0x1010181 field public static final int layout_width = 16842996; // 0x10100f4 field public static final int layout_x = 16843135; // 0x101017f @@ -650,8 +683,10 @@ package android { field public static final int listPreferredItemHeight = 16842829; // 0x101004d field public static final int listPreferredItemHeightLarge = 16843654; // 0x1010386 field public static final int listPreferredItemHeightSmall = 16843655; // 0x1010387 + field public static final int listPreferredItemPaddingEnd = 16843710; // 0x10103be field public static final int listPreferredItemPaddingLeft = 16843683; // 0x10103a3 field public static final int listPreferredItemPaddingRight = 16843684; // 0x10103a4 + field public static final int listPreferredItemPaddingStart = 16843709; // 0x10103bd field public static final int listSelector = 16843003; // 0x10100fb field public static final int listSeparatorTextViewStyle = 16843272; // 0x1010208 field public static final int listViewStyle = 16842868; // 0x1010074 @@ -722,8 +757,10 @@ package android { field public static final int packageNames = 16843649; // 0x1010381 field public static final int padding = 16842965; // 0x10100d5 field public static final int paddingBottom = 16842969; // 0x10100d9 + field public static final int paddingEnd = 16843700; // 0x10103b4 field public static final int paddingLeft = 16842966; // 0x10100d6 field public static final int paddingRight = 16842968; // 0x10100d8 + field public static final int paddingStart = 16843699; // 0x10103b3 field public static final int paddingTop = 16842967; // 0x10100d7 field public static final int panelBackground = 16842846; // 0x101005e field public static final int panelColorBackground = 16842849; // 0x1010061 @@ -736,7 +773,9 @@ package android { field public static final int pathPattern = 16842796; // 0x101002c field public static final int pathPrefix = 16842795; // 0x101002b field public static final int permission = 16842758; // 0x1010006 + field public static final int permissionFlags = 16843719; // 0x10103c7 field public static final int permissionGroup = 16842762; // 0x101000a + field public static final int permissionGroupFlags = 16843717; // 0x10103c5 field public static final int persistent = 16842765; // 0x101000d field public static final int persistentDrawingCache = 16842990; // 0x10100ee field public static final deprecated int phoneNumber = 16843111; // 0x1010167 @@ -756,6 +795,7 @@ package android { field public static final int preferenceLayoutChild = 16842900; // 0x1010094 field public static final int preferenceScreenStyle = 16842891; // 0x101008b field public static final int preferenceStyle = 16842894; // 0x101008e + field public static final int presentationTheme = 16843712; // 0x10103c0 field public static final int previewImage = 16843482; // 0x10102da field public static final int priority = 16842780; // 0x101001c field public static final int privateImeOptions = 16843299; // 0x1010223 @@ -874,11 +914,13 @@ package android { field public static final int showAsAction = 16843481; // 0x10102d9 field public static final int showDefault = 16843258; // 0x10101fa field public static final int showDividers = 16843561; // 0x1010329 + field public static final int showOnLockScreen = 16843721; // 0x10103c9 field public static final int showSilent = 16843259; // 0x10101fb field public static final int showWeekNumber = 16843582; // 0x101033e field public static final int shownWeekCount = 16843585; // 0x1010341 field public static final int shrinkColumns = 16843082; // 0x101014a field public static final deprecated int singleLine = 16843101; // 0x101015d + field public static final int singleUser = 16843711; // 0x10103bf field public static final int smallIcon = 16843422; // 0x101029e field public static final int smallScreens = 16843396; // 0x1010284 field public static final int smoothScrollbar = 16843313; // 0x1010231 @@ -928,6 +970,7 @@ package android { field public static final int subtitle = 16843473; // 0x10102d1 field public static final int subtitleTextStyle = 16843513; // 0x10102f9 field public static final int subtypeExtraValue = 16843674; // 0x101039a + field public static final int subtypeId = 16843713; // 0x10103c1 field public static final int subtypeLocale = 16843673; // 0x1010399 field public static final int suggestActionMsg = 16843228; // 0x10101dc field public static final int suggestActionMsgColumn = 16843229; // 0x10101dd @@ -935,6 +978,7 @@ package android { field public static final int summaryColumn = 16843426; // 0x10102a2 field public static final int summaryOff = 16843248; // 0x10101f0 field public static final int summaryOn = 16843247; // 0x10101ef + field public static final int supportsRtl = 16843695; // 0x10103af field public static final int supportsUploading = 16843419; // 0x101029b field public static final int switchMinWidth = 16843632; // 0x1010370 field public static final int switchPadding = 16843633; // 0x1010371 @@ -965,6 +1009,7 @@ package android { field public static final int tension = 16843370; // 0x101026a field public static final int testOnly = 16843378; // 0x1010272 field public static final int text = 16843087; // 0x101014f + field public static final int textAlignment = 16843697; // 0x10103b1 field public static final int textAllCaps = 16843660; // 0x101038c field public static final int textAppearance = 16842804; // 0x1010034 field public static final int textAppearanceButton = 16843271; // 0x1010207 @@ -1004,6 +1049,7 @@ package android { field public static final int textColorTertiary = 16843282; // 0x1010212 field public static final int textColorTertiaryInverse = 16843283; // 0x1010213 field public static final int textCursorDrawable = 16843618; // 0x1010362 + field public static final int textDirection = 16843696; // 0x10103b0 field public static final int textEditNoPasteWindowLayout = 16843541; // 0x1010315 field public static final int textEditPasteWindowLayout = 16843540; // 0x1010314 field public static final int textEditSideNoPasteWindowLayout = 16843615; // 0x101035f @@ -1030,6 +1076,7 @@ package android { field public static final int thumbTextPadding = 16843634; // 0x1010372 field public static final int thumbnail = 16843429; // 0x10102a5 field public static final int tileMode = 16843265; // 0x1010201 + field public static final int timeZone = 16843724; // 0x10103cc field public static final int tint = 16843041; // 0x1010121 field public static final int title = 16843233; // 0x10101e1 field public static final int titleCondensed = 16843234; // 0x10101e2 @@ -1097,6 +1144,7 @@ package android { field public static final int weekNumberColor = 16843589; // 0x1010345 field public static final int weekSeparatorLineColor = 16843590; // 0x1010346 field public static final int weightSum = 16843048; // 0x1010128 + field public static final int widgetCategory = 16843716; // 0x10103c4 field public static final int widgetLayout = 16843243; // 0x10101eb field public static final int width = 16843097; // 0x1010159 field public static final int windowActionBar = 16843469; // 0x10102cd @@ -1745,6 +1793,7 @@ package android { field public static final int Widget_DeviceDefault_Button_Small = 16974146; // 0x1030142 field public static final int Widget_DeviceDefault_Button_Toggle = 16974148; // 0x1030144 field public static final int Widget_DeviceDefault_CalendarView = 16974190; // 0x103016e + field public static final int Widget_DeviceDefault_CheckedTextView = 16974299; // 0x10301db field public static final int Widget_DeviceDefault_CompoundButton_CheckBox = 16974152; // 0x1030148 field public static final int Widget_DeviceDefault_CompoundButton_RadioButton = 16974169; // 0x1030159 field public static final int Widget_DeviceDefault_CompoundButton_Star = 16974173; // 0x103015d @@ -1778,6 +1827,7 @@ package android { field public static final int Widget_DeviceDefault_Light_Button_Small = 16974198; // 0x1030176 field public static final int Widget_DeviceDefault_Light_Button_Toggle = 16974200; // 0x1030178 field public static final int Widget_DeviceDefault_Light_CalendarView = 16974238; // 0x103019e + field public static final int Widget_DeviceDefault_Light_CheckedTextView = 16974300; // 0x10301dc field public static final int Widget_DeviceDefault_Light_CompoundButton_CheckBox = 16974204; // 0x103017c field public static final int Widget_DeviceDefault_Light_CompoundButton_RadioButton = 16974224; // 0x1030190 field public static final int Widget_DeviceDefault_Light_CompoundButton_Star = 16974228; // 0x1030194 @@ -1863,6 +1913,7 @@ package android { field public static final int Widget_Holo_Button_Small = 16973964; // 0x103008c field public static final int Widget_Holo_Button_Toggle = 16973966; // 0x103008e field public static final int Widget_Holo_CalendarView = 16974060; // 0x10300ec + field public static final int Widget_Holo_CheckedTextView = 16974297; // 0x10301d9 field public static final int Widget_Holo_CompoundButton_CheckBox = 16973969; // 0x1030091 field public static final int Widget_Holo_CompoundButton_RadioButton = 16973986; // 0x10300a2 field public static final int Widget_Holo_CompoundButton_Star = 16973990; // 0x10300a6 @@ -1896,6 +1947,7 @@ package android { field public static final int Widget_Holo_Light_Button_Small = 16974007; // 0x10300b7 field public static final int Widget_Holo_Light_Button_Toggle = 16974009; // 0x10300b9 field public static final int Widget_Holo_Light_CalendarView = 16974061; // 0x10300ed + field public static final int Widget_Holo_Light_CheckedTextView = 16974298; // 0x10301da field public static final int Widget_Holo_Light_CompoundButton_CheckBox = 16974012; // 0x10300bc field public static final int Widget_Holo_Light_CompoundButton_RadioButton = 16974032; // 0x10300d0 field public static final int Widget_Holo_Light_CompoundButton_Star = 16974036; // 0x10300d4 @@ -2022,6 +2074,7 @@ package android.accessibilityservice { field public static final int GLOBAL_ACTION_BACK = 1; // 0x1 field public static final int GLOBAL_ACTION_HOME = 2; // 0x2 field public static final int GLOBAL_ACTION_NOTIFICATIONS = 4; // 0x4 + field public static final int GLOBAL_ACTION_QUICK_SETTINGS = 5; // 0x5 field public static final int GLOBAL_ACTION_RECENTS = 3; // 0x3 field public static final java.lang.String SERVICE_INTERFACE = "android.accessibilityservice.AccessibilityService"; field public static final java.lang.String SERVICE_META_DATA = "android.accessibilityservice"; @@ -2043,6 +2096,7 @@ package android.accessibilityservice { field public static final int DEFAULT = 1; // 0x1 field public static final int FEEDBACK_ALL_MASK = -1; // 0xffffffff field public static final int FEEDBACK_AUDIBLE = 4; // 0x4 + field public static final int FEEDBACK_BRAILLE = 32; // 0x20 field public static final int FEEDBACK_GENERIC = 16; // 0x10 field public static final int FEEDBACK_HAPTIC = 2; // 0x2 field public static final int FEEDBACK_SPOKEN = 1; // 0x1 @@ -2627,6 +2681,7 @@ package android.app { method public void invalidateOptionsMenu(); method public boolean isChangingConfigurations(); method public final boolean isChild(); + method public boolean isDestroyed(); method public boolean isFinishing(); method public boolean isTaskRoot(); method public final deprecated android.database.Cursor managedQuery(android.net.Uri, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String); @@ -2992,6 +3047,7 @@ package android.app { method public android.app.AlertDialog.Builder setNeutralButton(int, android.content.DialogInterface.OnClickListener); method public android.app.AlertDialog.Builder setNeutralButton(java.lang.CharSequence, android.content.DialogInterface.OnClickListener); method public android.app.AlertDialog.Builder setOnCancelListener(android.content.DialogInterface.OnCancelListener); + method public android.app.AlertDialog.Builder setOnDismissListener(android.content.DialogInterface.OnDismissListener); method public android.app.AlertDialog.Builder setOnItemSelectedListener(android.widget.AdapterView.OnItemSelectedListener); method public android.app.AlertDialog.Builder setOnKeyListener(android.content.DialogInterface.OnKeyListener); method public android.app.AlertDialog.Builder setPositiveButton(int, android.content.DialogInterface.OnClickListener); @@ -3324,9 +3380,11 @@ package android.app { method public final boolean equals(java.lang.Object); method public final android.app.Activity getActivity(); method public final android.os.Bundle getArguments(); + method public final android.app.FragmentManager getChildFragmentManager(); method public final android.app.FragmentManager getFragmentManager(); method public final int getId(); method public android.app.LoaderManager getLoaderManager(); + method public final android.app.Fragment getParentFragment(); method public final android.content.res.Resources getResources(); method public final boolean getRetainInstance(); method public final java.lang.String getString(int); @@ -3375,6 +3433,7 @@ package android.app { method public void onStop(); method public void onTrimMemory(int); method public void onViewCreated(android.view.View, android.os.Bundle); + method public void onViewStateRestored(android.os.Bundle); method public void registerForContextMenu(android.view.View); method public void setArguments(android.os.Bundle); method public void setHasOptionsMenu(boolean); @@ -3430,6 +3489,7 @@ package android.app { method public abstract int getBackStackEntryCount(); method public abstract android.app.Fragment getFragment(android.os.Bundle, java.lang.String); method public void invalidateOptionsMenu(); + method public abstract boolean isDestroyed(); method public abstract void popBackStack(); method public abstract void popBackStack(java.lang.String, int); method public abstract void popBackStack(int, int); @@ -3799,6 +3859,7 @@ package android.app { method public android.app.Notification.Builder setOnlyAlertOnce(boolean); method public android.app.Notification.Builder setPriority(int); method public android.app.Notification.Builder setProgress(int, int, boolean); + method public android.app.Notification.Builder setShowWhen(boolean); method public android.app.Notification.Builder setSmallIcon(int); method public android.app.Notification.Builder setSmallIcon(int, int); method public android.app.Notification.Builder setSound(android.net.Uri); @@ -3848,9 +3909,12 @@ package android.app { method public static android.app.PendingIntent getActivity(android.content.Context, int, android.content.Intent, int); method public static android.app.PendingIntent getActivity(android.content.Context, int, android.content.Intent, int, android.os.Bundle); method public static android.app.PendingIntent getBroadcast(android.content.Context, int, android.content.Intent, int); + method public java.lang.String getCreatorPackage(); + method public int getCreatorUid(); + method public android.os.UserHandle getCreatorUserHandle(); method public android.content.IntentSender getIntentSender(); method public static android.app.PendingIntent getService(android.content.Context, int, android.content.Intent, int); - method public java.lang.String getTargetPackage(); + method public deprecated java.lang.String getTargetPackage(); method public static android.app.PendingIntent readPendingIntentOrNullFromParcel(android.os.Parcel); method public void send() throws android.app.PendingIntent.CanceledException; method public void send(int) throws android.app.PendingIntent.CanceledException; @@ -3877,6 +3941,15 @@ package android.app { method public abstract void onSendFinished(android.app.PendingIntent, android.content.Intent, int, java.lang.String, android.os.Bundle); } + public class Presentation extends android.app.Dialog { + ctor public Presentation(android.content.Context, android.view.Display); + ctor public Presentation(android.content.Context, android.view.Display, int); + method public android.view.Display getDisplay(); + method public android.content.res.Resources getResources(); + method public void onDisplayChanged(); + method public void onDisplayRemoved(); + } + public class ProgressDialog extends android.app.AlertDialog { ctor public ProgressDialog(android.content.Context); ctor public ProgressDialog(android.content.Context, int); @@ -4105,6 +4178,7 @@ package android.app { method public android.graphics.drawable.Drawable getFastDrawable(); method public static android.app.WallpaperManager getInstance(android.content.Context); method public android.app.WallpaperInfo getWallpaperInfo(); + method public boolean hasResourceWallpaper(int); method public android.graphics.drawable.Drawable peekDrawable(); method public android.graphics.drawable.Drawable peekFastDrawable(); method public void sendWallpaperCommand(android.os.IBinder, java.lang.String, int, int, int, android.os.Bundle); @@ -4145,6 +4219,7 @@ package android.app.admin { field public static final android.os.Parcelable.Creator CREATOR; field public static final int USES_ENCRYPTED_STORAGE = 7; // 0x7 field public static final int USES_POLICY_DISABLE_CAMERA = 8; // 0x8 + field public static final int USES_POLICY_DISABLE_KEYGUARD_FEATURES = 9; // 0x9 field public static final int USES_POLICY_EXPIRE_PASSWORD = 6; // 0x6 field public static final int USES_POLICY_FORCE_LOCK = 3; // 0x3 field public static final int USES_POLICY_LIMIT_PASSWORD = 0; // 0x0 @@ -4180,6 +4255,7 @@ package android.app.admin { method public java.util.List getActiveAdmins(); method public boolean getCameraDisabled(android.content.ComponentName); method public int getCurrentFailedPasswordAttempts(); + method public int getKeyguardDisabledFeatures(android.content.ComponentName); method public int getMaximumFailedPasswordsForWipe(android.content.ComponentName); method public long getMaximumTimeToLock(android.content.ComponentName); method public long getPasswordExpiration(android.content.ComponentName); @@ -4203,6 +4279,7 @@ package android.app.admin { method public void removeActiveAdmin(android.content.ComponentName); method public boolean resetPassword(java.lang.String, int); method public void setCameraDisabled(android.content.ComponentName, boolean); + method public void setKeyguardDisabledFeatures(android.content.ComponentName, int); method public void setMaximumFailedPasswordsForWipe(android.content.ComponentName, int); method public void setMaximumTimeToLock(android.content.ComponentName, long); method public void setPasswordExpirationTimeout(android.content.ComponentName, long); @@ -4226,6 +4303,10 @@ package android.app.admin { field public static final int ENCRYPTION_STATUS_UNSUPPORTED = 0; // 0x0 field public static final java.lang.String EXTRA_ADD_EXPLANATION = "android.app.extra.ADD_EXPLANATION"; field public static final java.lang.String EXTRA_DEVICE_ADMIN = "android.app.extra.DEVICE_ADMIN"; + field public static final int KEYGUARD_DISABLE_FEATURES_ALL = 2147483647; // 0x7fffffff + field public static final int KEYGUARD_DISABLE_FEATURES_NONE = 0; // 0x0 + field public static final int KEYGUARD_DISABLE_SECURE_CAMERA = 2; // 0x2 + field public static final int KEYGUARD_DISABLE_WIDGETS_ALL = 1; // 0x1 field public static final int PASSWORD_QUALITY_ALPHABETIC = 262144; // 0x40000 field public static final int PASSWORD_QUALITY_ALPHANUMERIC = 327680; // 0x50000 field public static final int PASSWORD_QUALITY_BIOMETRIC_WEAK = 32768; // 0x8000 @@ -4333,6 +4414,7 @@ package android.appwidget { method public void deleteHost(); method protected android.appwidget.AppWidgetHostView onCreateView(android.content.Context, int, android.appwidget.AppWidgetProviderInfo); method protected void onProviderChanged(int, android.appwidget.AppWidgetProviderInfo); + method protected void onProvidersChanged(); method public void startListening(); method public void stopListening(); } @@ -4354,6 +4436,7 @@ package android.appwidget { public class AppWidgetManager { method public boolean bindAppWidgetIdIfAllowed(int, android.content.ComponentName); + method public boolean bindAppWidgetIdIfAllowed(int, android.content.ComponentName, android.os.Bundle); method public int[] getAppWidgetIds(android.content.ComponentName); method public android.appwidget.AppWidgetProviderInfo getAppWidgetInfo(int); method public android.os.Bundle getAppWidgetOptions(int); @@ -4383,6 +4466,7 @@ package android.appwidget { field public static final java.lang.String EXTRA_CUSTOM_INFO = "customInfo"; field public static final int INVALID_APPWIDGET_ID = 0; // 0x0 field public static final java.lang.String META_DATA_APPWIDGET_PROVIDER = "android.appwidget.provider"; + field public static final java.lang.String OPTION_APPWIDGET_HOST_CATEGORY = "appWidgetCategory"; field public static final java.lang.String OPTION_APPWIDGET_MAX_HEIGHT = "appWidgetMaxHeight"; field public static final java.lang.String OPTION_APPWIDGET_MAX_WIDTH = "appWidgetMaxWidth"; field public static final java.lang.String OPTION_APPWIDGET_MIN_HEIGHT = "appWidgetMinHeight"; @@ -4402,6 +4486,7 @@ package android.appwidget { public class AppWidgetProviderInfo implements android.os.Parcelable { ctor public AppWidgetProviderInfo(); ctor public AppWidgetProviderInfo(android.os.Parcel); + method public android.appwidget.AppWidgetProviderInfo clone(); method public int describeContents(); method public void writeToParcel(android.os.Parcel, int); field public static final android.os.Parcelable.Creator CREATOR; @@ -4409,9 +4494,12 @@ package android.appwidget { field public static final int RESIZE_HORIZONTAL = 1; // 0x1 field public static final int RESIZE_NONE = 0; // 0x0 field public static final int RESIZE_VERTICAL = 2; // 0x2 + field public static final int WIDGET_CATEGORY_HOME_SCREEN = 1; // 0x1 + field public static final int WIDGET_CATEGORY_KEYGUARD = 2; // 0x2 field public int autoAdvanceViewId; field public android.content.ComponentName configure; field public int icon; + field public int initialKeyguardLayout; field public int initialLayout; field public java.lang.String label; field public int minHeight; @@ -4422,6 +4510,7 @@ package android.appwidget { field public android.content.ComponentName provider; field public int resizeMode; field public int updatePeriodMillis; + field public int widgetCategory; } } @@ -4429,6 +4518,7 @@ package android.appwidget { package android.bluetooth { public final class BluetoothA2dp implements android.bluetooth.BluetoothProfile { + method public void finalize(); method public java.util.List getConnectedDevices(); method public int getConnectionState(android.bluetooth.BluetoothDevice); method public java.util.List getDevicesMatchingConnectionStates(int[]); @@ -5054,6 +5144,7 @@ package android.content { public class ContentProviderClient { method public android.content.ContentProviderResult[] applyBatch(java.util.ArrayList) throws android.content.OperationApplicationException, android.os.RemoteException; method public int bulkInsert(android.net.Uri, android.content.ContentValues[]) throws android.os.RemoteException; + method public android.os.Bundle call(java.lang.String, java.lang.String, android.os.Bundle) throws android.os.RemoteException; method public int delete(android.net.Uri, java.lang.String, java.lang.String[]) throws android.os.RemoteException; method public android.content.ContentProvider getLocalContentProvider(); method public java.lang.String[] getStreamTypes(android.net.Uri, java.lang.String) throws android.os.RemoteException; @@ -5240,6 +5331,8 @@ package android.content { method public abstract int checkUriPermission(android.net.Uri, int, int, int); method public abstract int checkUriPermission(android.net.Uri, java.lang.String, java.lang.String, int, int, int); method public abstract deprecated void clearWallpaper() throws java.io.IOException; + method public abstract android.content.Context createConfigurationContext(android.content.res.Configuration); + method public abstract android.content.Context createDisplayContext(android.view.Display); method public abstract android.content.Context createPackageContext(java.lang.String, int) throws android.content.pm.PackageManager.NameNotFoundException; method public abstract java.lang.String[] databaseList(); method public abstract boolean deleteDatabase(java.lang.String); @@ -5295,13 +5388,19 @@ package android.content { method public abstract android.content.Intent registerReceiver(android.content.BroadcastReceiver, android.content.IntentFilter); method public abstract android.content.Intent registerReceiver(android.content.BroadcastReceiver, android.content.IntentFilter, java.lang.String, android.os.Handler); method public abstract void removeStickyBroadcast(android.content.Intent); + method public abstract void removeStickyBroadcastAsUser(android.content.Intent, android.os.UserHandle); method public abstract void revokeUriPermission(android.net.Uri, int); method public abstract void sendBroadcast(android.content.Intent); method public abstract void sendBroadcast(android.content.Intent, java.lang.String); + method public abstract void sendBroadcastAsUser(android.content.Intent, android.os.UserHandle); + method public abstract void sendBroadcastAsUser(android.content.Intent, android.os.UserHandle, java.lang.String); method public abstract void sendOrderedBroadcast(android.content.Intent, java.lang.String); method public abstract void sendOrderedBroadcast(android.content.Intent, java.lang.String, android.content.BroadcastReceiver, android.os.Handler, int, java.lang.String, android.os.Bundle); + method public abstract void sendOrderedBroadcastAsUser(android.content.Intent, android.os.UserHandle, java.lang.String, android.content.BroadcastReceiver, android.os.Handler, int, java.lang.String, android.os.Bundle); method public abstract void sendStickyBroadcast(android.content.Intent); + method public abstract void sendStickyBroadcastAsUser(android.content.Intent, android.os.UserHandle); method public abstract void sendStickyOrderedBroadcast(android.content.Intent, android.content.BroadcastReceiver, android.os.Handler, int, java.lang.String, android.os.Bundle); + method public abstract void sendStickyOrderedBroadcastAsUser(android.content.Intent, android.os.UserHandle, android.content.BroadcastReceiver, android.os.Handler, int, java.lang.String, android.os.Bundle); method public abstract void setTheme(int); method public abstract deprecated void setWallpaper(android.graphics.Bitmap) throws java.io.IOException; method public abstract deprecated void setWallpaper(java.io.InputStream) throws java.io.IOException; @@ -5336,6 +5435,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"; @@ -5348,8 +5448,8 @@ package android.content { field public static final int MODE_ENABLE_WRITE_AHEAD_LOGGING = 8; // 0x8 field public static final int MODE_MULTI_PROCESS = 4; // 0x4 field public static final int MODE_PRIVATE = 0; // 0x0 - field public static final int MODE_WORLD_READABLE = 1; // 0x1 - field public static final int MODE_WORLD_WRITEABLE = 2; // 0x2 + field public static final deprecated int MODE_WORLD_READABLE = 1; // 0x1 + field public static final deprecated int MODE_WORLD_WRITEABLE = 2; // 0x2 field public static final java.lang.String NFC_SERVICE = "nfc"; field public static final java.lang.String NOTIFICATION_SERVICE = "notification"; field public static final java.lang.String NSD_SERVICE = "servicediscovery"; @@ -5361,6 +5461,7 @@ package android.content { field public static final java.lang.String TEXT_SERVICES_MANAGER_SERVICE = "textservices"; field public static final java.lang.String UI_MODE_SERVICE = "uimode"; field public static final java.lang.String USB_SERVICE = "usb"; + field public static final java.lang.String USER_SERVICE = "user"; field public static final java.lang.String VIBRATOR_SERVICE = "vibrator"; field public static final java.lang.String WALLPAPER_SERVICE = "wallpaper"; field public static final java.lang.String WIFI_P2P_SERVICE = "wifip2p"; @@ -5380,6 +5481,8 @@ package android.content { method public int checkUriPermission(android.net.Uri, int, int, int); method public int checkUriPermission(android.net.Uri, java.lang.String, java.lang.String, int, int, int); method public void clearWallpaper() throws java.io.IOException; + method public android.content.Context createConfigurationContext(android.content.res.Configuration); + method public android.content.Context createDisplayContext(android.view.Display); method public android.content.Context createPackageContext(java.lang.String, int) throws android.content.pm.PackageManager.NameNotFoundException; method public java.lang.String[] databaseList(); method public boolean deleteDatabase(java.lang.String); @@ -5427,13 +5530,19 @@ package android.content { method public android.content.Intent registerReceiver(android.content.BroadcastReceiver, android.content.IntentFilter); method public android.content.Intent registerReceiver(android.content.BroadcastReceiver, android.content.IntentFilter, java.lang.String, android.os.Handler); method public void removeStickyBroadcast(android.content.Intent); + method public void removeStickyBroadcastAsUser(android.content.Intent, android.os.UserHandle); method public void revokeUriPermission(android.net.Uri, int); method public void sendBroadcast(android.content.Intent); method public void sendBroadcast(android.content.Intent, java.lang.String); + method public void sendBroadcastAsUser(android.content.Intent, android.os.UserHandle); + method public void sendBroadcastAsUser(android.content.Intent, android.os.UserHandle, java.lang.String); method public void sendOrderedBroadcast(android.content.Intent, java.lang.String); method public void sendOrderedBroadcast(android.content.Intent, java.lang.String, android.content.BroadcastReceiver, android.os.Handler, int, java.lang.String, android.os.Bundle); + method public void sendOrderedBroadcastAsUser(android.content.Intent, android.os.UserHandle, java.lang.String, android.content.BroadcastReceiver, android.os.Handler, int, java.lang.String, android.os.Bundle); method public void sendStickyBroadcast(android.content.Intent); + method public void sendStickyBroadcastAsUser(android.content.Intent, android.os.UserHandle); method public void sendStickyOrderedBroadcast(android.content.Intent, android.content.BroadcastReceiver, android.os.Handler, int, java.lang.String, android.os.Bundle); + method public void sendStickyOrderedBroadcastAsUser(android.content.Intent, android.os.UserHandle, android.content.BroadcastReceiver, android.os.Handler, int, java.lang.String, android.os.Bundle); method public void setTheme(int); method public void setWallpaper(android.graphics.Bitmap) throws java.io.IOException; method public void setWallpaper(java.io.InputStream) throws java.io.IOException; @@ -5674,6 +5783,8 @@ package android.content { field public static final java.lang.String ACTION_DEVICE_STORAGE_OK = "android.intent.action.DEVICE_STORAGE_OK"; field public static final java.lang.String ACTION_DIAL = "android.intent.action.DIAL"; field public static final java.lang.String ACTION_DOCK_EVENT = "android.intent.action.DOCK_EVENT"; + field public static final java.lang.String ACTION_DREAMING_STARTED = "android.intent.action.DREAMING_STARTED"; + field public static final java.lang.String ACTION_DREAMING_STOPPED = "android.intent.action.DREAMING_STOPPED"; field public static final java.lang.String ACTION_EDIT = "android.intent.action.EDIT"; field public static final java.lang.String ACTION_EXTERNAL_APPLICATIONS_AVAILABLE = "android.intent.action.EXTERNAL_APPLICATIONS_AVAILABLE"; field public static final java.lang.String ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE = "android.intent.action.EXTERNAL_APPLICATIONS_UNAVAILABLE"; @@ -5715,6 +5826,7 @@ package android.content { field public static final java.lang.String ACTION_PACKAGE_REMOVED = "android.intent.action.PACKAGE_REMOVED"; field public static final java.lang.String ACTION_PACKAGE_REPLACED = "android.intent.action.PACKAGE_REPLACED"; field public static final java.lang.String ACTION_PACKAGE_RESTARTED = "android.intent.action.PACKAGE_RESTARTED"; + field public static final java.lang.String ACTION_PACKAGE_VERIFIED = "android.intent.action.PACKAGE_VERIFIED"; field public static final java.lang.String ACTION_PASTE = "android.intent.action.PASTE"; field public static final java.lang.String ACTION_PICK = "android.intent.action.PICK"; field public static final java.lang.String ACTION_PICK_ACTIVITY = "android.intent.action.PICK_ACTIVITY"; @@ -5722,6 +5834,7 @@ package android.content { field public static final java.lang.String ACTION_POWER_DISCONNECTED = "android.intent.action.ACTION_POWER_DISCONNECTED"; field public static final java.lang.String ACTION_POWER_USAGE_SUMMARY = "android.intent.action.POWER_USAGE_SUMMARY"; field public static final java.lang.String ACTION_PROVIDER_CHANGED = "android.intent.action.PROVIDER_CHANGED"; + field public static final java.lang.String ACTION_QUICK_CLOCK = "android.intent.action.QUICK_CLOCK"; field public static final java.lang.String ACTION_REBOOT = "android.intent.action.REBOOT"; field public static final java.lang.String ACTION_RUN = "android.intent.action.RUN"; field public static final java.lang.String ACTION_SCREEN_OFF = "android.intent.action.SCREEN_OFF"; @@ -5742,6 +5855,9 @@ package android.content { field public static final deprecated java.lang.String ACTION_UMS_CONNECTED = "android.intent.action.UMS_CONNECTED"; field public static final deprecated java.lang.String ACTION_UMS_DISCONNECTED = "android.intent.action.UMS_DISCONNECTED"; field public static final java.lang.String ACTION_UNINSTALL_PACKAGE = "android.intent.action.UNINSTALL_PACKAGE"; + field public static final java.lang.String ACTION_USER_BACKGROUND = "android.intent.action.USER_BACKGROUND"; + field public static final java.lang.String ACTION_USER_FOREGROUND = "android.intent.action.USER_FOREGROUND"; + field public static final java.lang.String ACTION_USER_INITIALIZE = "android.intent.action.USER_INITIALIZE"; field public static final java.lang.String ACTION_USER_PRESENT = "android.intent.action.USER_PRESENT"; field public static final java.lang.String ACTION_VIEW = "android.intent.action.VIEW"; field public static final java.lang.String ACTION_VOICE_COMMAND = "android.intent.action.VOICE_COMMAND"; @@ -5805,7 +5921,9 @@ package android.content { field public static final java.lang.String EXTRA_KEY_EVENT = "android.intent.extra.KEY_EVENT"; field public static final java.lang.String EXTRA_LOCAL_ONLY = "android.intent.extra.LOCAL_ONLY"; field public static final java.lang.String EXTRA_NOT_UNKNOWN_SOURCE = "android.intent.extra.NOT_UNKNOWN_SOURCE"; + field public static final java.lang.String EXTRA_ORIGINATING_URI = "android.intent.extra.ORIGINATING_URI"; field public static final java.lang.String EXTRA_PHONE_NUMBER = "android.intent.extra.PHONE_NUMBER"; + field public static final java.lang.String EXTRA_REFERRER = "android.intent.extra.REFERRER"; field public static final java.lang.String EXTRA_REMOTE_INTENT_TOKEN = "android.intent.extra.remote_intent_token"; field public static final java.lang.String EXTRA_REPLACING = "android.intent.extra.REPLACING"; field public static final java.lang.String EXTRA_RETURN_RESULT = "android.intent.extra.RETURN_RESULT"; @@ -5953,7 +6071,10 @@ package android.content { public class IntentSender implements android.os.Parcelable { method public int describeContents(); - method public java.lang.String getTargetPackage(); + method public java.lang.String getCreatorPackage(); + method public int getCreatorUid(); + method public android.os.UserHandle getCreatorUserHandle(); + method public deprecated java.lang.String getTargetPackage(); method public static android.content.IntentSender readIntentSenderOrNullFromParcel(android.os.Parcel); method public void sendIntent(android.content.Context, int, android.content.Intent, android.content.IntentSender.OnFinished, android.os.Handler) throws android.content.IntentSender.SendIntentException; method public void sendIntent(android.content.Context, int, android.content.Intent, android.content.IntentSender.OnFinished, android.os.Handler, java.lang.String) throws android.content.IntentSender.SendIntentException; @@ -6186,9 +6307,11 @@ package android.content.pm { method public int describeContents(); method public void dump(android.util.Printer, java.lang.String); method public final int getThemeResource(); + field public static final int CONFIG_DENSITY = 4096; // 0x1000 field public static final int CONFIG_FONT_SCALE = 1073741824; // 0x40000000 field public static final int CONFIG_KEYBOARD = 16; // 0x10 field public static final int CONFIG_KEYBOARD_HIDDEN = 32; // 0x20 + field public static final int CONFIG_LAYOUT_DIRECTION = 8192; // 0x2000 field public static final int CONFIG_LOCALE = 4; // 0x4 field public static final int CONFIG_MCC = 1; // 0x1 field public static final int CONFIG_MNC = 2; // 0x2 @@ -6209,6 +6332,7 @@ package android.content.pm { field public static final int FLAG_HARDWARE_ACCELERATED = 512; // 0x200 field public static final int FLAG_MULTIPROCESS = 1; // 0x1 field public static final int FLAG_NO_HISTORY = 128; // 0x80 + field public static final int FLAG_SINGLE_USER = 1073741824; // 0x40000000 field public static final int FLAG_STATE_NOT_NEEDED = 16; // 0x10 field public static final int LAUNCH_MULTIPLE = 0; // 0x0 field public static final int LAUNCH_SINGLE_INSTANCE = 3; // 0x3 @@ -6254,6 +6378,8 @@ package android.content.pm { field public static final int FLAG_EXTERNAL_STORAGE = 262144; // 0x40000 field public static final int FLAG_FACTORY_TEST = 16; // 0x10 field public static final int FLAG_HAS_CODE = 4; // 0x4 + field public static final int FLAG_INSTALLED = 8388608; // 0x800000 + field public static final int FLAG_IS_DATA_ONLY = 16777216; // 0x1000000 field public static final int FLAG_KILL_AFTER_RESTORE = 65536; // 0x10000 field public static final int FLAG_LARGE_HEAP = 1048576; // 0x100000 field public static final int FLAG_PERSISTENT = 8; // 0x8 @@ -6262,6 +6388,7 @@ package android.content.pm { field public static final int FLAG_STOPPED = 2097152; // 0x200000 field public static final int FLAG_SUPPORTS_LARGE_SCREENS = 2048; // 0x800 field public static final int FLAG_SUPPORTS_NORMAL_SCREENS = 1024; // 0x400 + field public static final int FLAG_SUPPORTS_RTL = 4194304; // 0x400000 field public static final int FLAG_SUPPORTS_SCREEN_DENSITIES = 8192; // 0x2000 field public static final int FLAG_SUPPORTS_SMALL_SCREENS = 512; // 0x200 field public static final int FLAG_SUPPORTS_XLARGE_SCREENS = 524288; // 0x80000 @@ -6434,6 +6561,7 @@ package android.content.pm { method public abstract int checkSignatures(int, int); method public abstract void clearPackagePreferredActivities(java.lang.String); method public abstract java.lang.String[] currentToCanonicalPackageNames(java.lang.String[]); + method public abstract void extendVerificationTimeout(int, int, long); method public abstract android.graphics.drawable.Drawable getActivityIcon(android.content.ComponentName) throws android.content.pm.PackageManager.NameNotFoundException; method public abstract android.graphics.drawable.Drawable getActivityIcon(android.content.Intent) throws android.content.pm.PackageManager.NameNotFoundException; method public abstract android.content.pm.ActivityInfo getActivityInfo(android.content.ComponentName, int) throws android.content.pm.PackageManager.NameNotFoundException; @@ -6498,9 +6626,11 @@ package android.content.pm { field public static final int COMPONENT_ENABLED_STATE_ENABLED = 1; // 0x1 field public static final int DONT_KILL_APP = 1; // 0x1 field public static final java.lang.String EXTRA_VERIFICATION_ID = "android.content.pm.extra.VERIFICATION_ID"; + field public static final java.lang.String EXTRA_VERIFICATION_RESULT = "android.content.pm.extra.VERIFICATION_RESULT"; field public static final java.lang.String FEATURE_AUDIO_LOW_LATENCY = "android.hardware.audio.low_latency"; field public static final java.lang.String FEATURE_BLUETOOTH = "android.hardware.bluetooth"; field public static final java.lang.String FEATURE_CAMERA = "android.hardware.camera"; + field public static final java.lang.String FEATURE_CAMERA_ANY = "android.hardware.camera.any"; field public static final java.lang.String FEATURE_CAMERA_AUTOFOCUS = "android.hardware.camera.autofocus"; field public static final java.lang.String FEATURE_CAMERA_FLASH = "android.hardware.camera.flash"; field public static final java.lang.String FEATURE_CAMERA_FRONT = "android.hardware.camera.front"; @@ -6552,6 +6682,7 @@ package android.content.pm { field public static final int GET_UNINSTALLED_PACKAGES = 8192; // 0x2000 field public static final int GET_URI_PERMISSION_PATTERNS = 2048; // 0x800 field public static final int MATCH_DEFAULT_ONLY = 65536; // 0x10000 + field public static final long MAXIMUM_VERIFICATION_TIMEOUT = 3600000L; // 0x36ee80L field public static final int PERMISSION_DENIED = -1; // 0xffffffff field public static final int PERMISSION_GRANTED = 0; // 0x0 field public static final int SIGNATURE_FIRST_NOT_SIGNED = -1; // 0xffffffff @@ -6601,8 +6732,11 @@ package android.content.pm { method public int describeContents(); method public java.lang.CharSequence loadDescription(android.content.pm.PackageManager); field public static final android.os.Parcelable.Creator CREATOR; + field public static final int FLAG_PERSONAL_INFO = 1; // 0x1 field public int descriptionRes; + field public int flags; field public java.lang.CharSequence nonLocalizedDescription; + field public int priority; } public class PermissionInfo extends android.content.pm.PackageItemInfo implements android.os.Parcelable { @@ -6611,6 +6745,7 @@ package android.content.pm { method public int describeContents(); method public java.lang.CharSequence loadDescription(android.content.pm.PackageManager); field public static final android.os.Parcelable.Creator CREATOR; + field public static final int FLAG_COSTS_MONEY = 1; // 0x1 field public static final int PROTECTION_DANGEROUS = 1; // 0x1 field public static final int PROTECTION_FLAG_DEVELOPMENT = 32; // 0x20 field public static final int PROTECTION_FLAG_SYSTEM = 16; // 0x10 @@ -6620,6 +6755,7 @@ package android.content.pm { field public static final int PROTECTION_SIGNATURE = 2; // 0x2 field public static final int PROTECTION_SIGNATURE_OR_SYSTEM = 3; // 0x3 field public int descriptionRes; + field public int flags; field public java.lang.String group; field public java.lang.CharSequence nonLocalizedDescription; field public int protectionLevel; @@ -6630,7 +6766,9 @@ package android.content.pm { ctor public ProviderInfo(android.content.pm.ProviderInfo); method public int describeContents(); field public static final android.os.Parcelable.Creator CREATOR; + field public static final int FLAG_SINGLE_USER = 1073741824; // 0x40000000 field public java.lang.String authority; + field public int flags; field public boolean grantUriPermissions; field public int initOrder; field public deprecated boolean isSyncable; @@ -6643,6 +6781,7 @@ package android.content.pm { public class ResolveInfo implements android.os.Parcelable { ctor public ResolveInfo(); + ctor public ResolveInfo(android.content.pm.ResolveInfo); method public int describeContents(); method public void dump(android.util.Printer, java.lang.String); method public final int getIconResource(); @@ -6676,6 +6815,7 @@ package android.content.pm { method public void dump(android.util.Printer, java.lang.String); field public static final android.os.Parcelable.Creator CREATOR; field public static final int FLAG_ISOLATED_PROCESS = 2; // 0x2 + field public static final int FLAG_SINGLE_USER = 1073741824; // 0x40000000 field public static final int FLAG_STOP_WITH_TASK = 1; // 0x1 field public int flags; field public java.lang.String permission; @@ -6771,14 +6911,18 @@ package android.content.res { method public int describeContents(); method public int diff(android.content.res.Configuration); method public boolean equals(android.content.res.Configuration); + method public int getLayoutDirection(); method public boolean isLayoutSizeAtLeast(int); method public static boolean needNewResources(int, int); method public void readFromParcel(android.os.Parcel); + method public void setLayoutDirection(java.util.Locale); + method public void setLocale(java.util.Locale); method public void setTo(android.content.res.Configuration); method public void setToDefaults(); method public int updateFrom(android.content.res.Configuration); method public void writeToParcel(android.os.Parcel, int); field public static final android.os.Parcelable.Creator CREATOR; + field public static final int DENSITY_DPI_UNDEFINED = 0; // 0x0 field public static final int HARDKEYBOARDHIDDEN_NO = 1; // 0x1 field public static final int HARDKEYBOARDHIDDEN_UNDEFINED = 0; // 0x0 field public static final int HARDKEYBOARDHIDDEN_YES = 2; // 0x2 @@ -6801,6 +6945,11 @@ package android.content.res { field public static final int ORIENTATION_PORTRAIT = 1; // 0x1 field public static final deprecated int ORIENTATION_SQUARE = 3; // 0x3 field public static final int ORIENTATION_UNDEFINED = 0; // 0x0 + field public static final int SCREENLAYOUT_LAYOUTDIR_LTR = 64; // 0x40 + field public static final int SCREENLAYOUT_LAYOUTDIR_MASK = 192; // 0xc0 + field public static final int SCREENLAYOUT_LAYOUTDIR_RTL = 128; // 0x80 + field public static final int SCREENLAYOUT_LAYOUTDIR_SHIFT = 6; // 0x6 + field public static final int SCREENLAYOUT_LAYOUTDIR_UNDEFINED = 0; // 0x0 field public static final int SCREENLAYOUT_LONG_MASK = 48; // 0x30 field public static final int SCREENLAYOUT_LONG_NO = 16; // 0x10 field public static final int SCREENLAYOUT_LONG_UNDEFINED = 0; // 0x0 @@ -6811,6 +6960,7 @@ package android.content.res { field public static final int SCREENLAYOUT_SIZE_SMALL = 1; // 0x1 field public static final int SCREENLAYOUT_SIZE_UNDEFINED = 0; // 0x0 field public static final int SCREENLAYOUT_SIZE_XLARGE = 4; // 0x4 + field public static final int SCREENLAYOUT_UNDEFINED = 0; // 0x0 field public static final int SCREEN_HEIGHT_DP_UNDEFINED = 0; // 0x0 field public static final int SCREEN_WIDTH_DP_UNDEFINED = 0; // 0x0 field public static final int SMALLEST_SCREEN_WIDTH_DP_UNDEFINED = 0; // 0x0 @@ -6829,6 +6979,7 @@ package android.content.res { field public static final int UI_MODE_TYPE_NORMAL = 1; // 0x1 field public static final int UI_MODE_TYPE_TELEVISION = 4; // 0x4 field public static final int UI_MODE_TYPE_UNDEFINED = 0; // 0x0 + field public int densityDpi; field public float fontScale; field public int hardKeyboardHidden; field public int keyboard; @@ -7307,7 +7458,7 @@ package android.database { field public static final int STATEMENT_UPDATE = 2; // 0x2 } - public static class DatabaseUtils.InsertHelper { + public static deprecated class DatabaseUtils.InsertHelper { ctor public DatabaseUtils.InsertHelper(android.database.sqlite.SQLiteDatabase, java.lang.String); method public void bind(int, double); method public void bind(int, float); @@ -7324,7 +7475,6 @@ package android.database { method public void prepareForInsert(); method public void prepareForReplace(); method public long replace(android.content.ContentValues); - field public static final int TABLE_INFO_PRAGMA_DEFAULT_INDEX = 4; // 0x4 } public final class DefaultDatabaseErrorHandler implements android.database.DatabaseErrorHandler { @@ -8085,8 +8235,11 @@ package android.graphics { method public static android.graphics.Bitmap createBitmap(android.graphics.Bitmap, int, int, int, int); method public static android.graphics.Bitmap createBitmap(android.graphics.Bitmap, int, int, int, int, android.graphics.Matrix, boolean); method public static android.graphics.Bitmap createBitmap(int, int, android.graphics.Bitmap.Config); + method public static android.graphics.Bitmap createBitmap(android.util.DisplayMetrics, int, int, android.graphics.Bitmap.Config); method public static android.graphics.Bitmap createBitmap(int[], int, int, int, int, android.graphics.Bitmap.Config); + method public static android.graphics.Bitmap createBitmap(android.util.DisplayMetrics, int[], int, int, int, int, android.graphics.Bitmap.Config); method public static android.graphics.Bitmap createBitmap(int[], int, int, android.graphics.Bitmap.Config); + method public static android.graphics.Bitmap createBitmap(android.util.DisplayMetrics, int[], int, int, android.graphics.Bitmap.Config); method public static android.graphics.Bitmap createScaledBitmap(android.graphics.Bitmap, int, int, boolean); method public int describeContents(); method public void eraseColor(int); @@ -8109,13 +8262,16 @@ package android.graphics { method public int getScaledWidth(int); method public final int getWidth(); method public final boolean hasAlpha(); + method public final boolean hasMipMap(); method public final boolean isMutable(); + method public final boolean isPremultiplied(); method public final boolean isRecycled(); method public void prepareToDraw(); method public void recycle(); method public boolean sameAs(android.graphics.Bitmap); method public void setDensity(int); method public void setHasAlpha(boolean); + method public final void setHasMipMap(boolean); method public void setPixel(int, int, int); method public void setPixels(int[], int, int, int, int, int, int); method public void writeToParcel(android.os.Parcel, int); @@ -8599,6 +8755,7 @@ package android.graphics { method public android.graphics.Paint.Align getTextAlign(); method public void getTextBounds(java.lang.String, int, int, android.graphics.Rect); method public void getTextBounds(char[], int, int, android.graphics.Rect); + method public java.util.Locale getTextLocale(); method public void getTextPath(char[], int, int, float, float, android.graphics.Path); method public void getTextPath(java.lang.String, int, int, float, float, android.graphics.Path); method public float getTextScaleX(); @@ -8648,6 +8805,7 @@ package android.graphics { method public void setStyle(android.graphics.Paint.Style); method public void setSubpixelText(boolean); method public void setTextAlign(android.graphics.Paint.Align); + method public void setTextLocale(java.util.Locale); method public void setTextScaleX(float); method public void setTextSize(float); method public void setTextSkewX(float); @@ -9547,6 +9705,7 @@ package android.hardware { method public final void addCallbackBuffer(byte[]); method public final void autoFocus(android.hardware.Camera.AutoFocusCallback); method public final void cancelAutoFocus(); + method public final boolean enableShutterSound(boolean); method public static void getCameraInfo(int, android.hardware.Camera.CameraInfo); method public static int getNumberOfCameras(); method public android.hardware.Camera.Parameters getParameters(); @@ -9599,6 +9758,7 @@ package android.hardware { ctor public Camera.CameraInfo(); field public static final int CAMERA_FACING_BACK = 0; // 0x0 field public static final int CAMERA_FACING_FRONT = 1; // 0x1 + field public boolean canDisableShutterSound; field public int facing; field public int orientation; } @@ -9644,6 +9804,7 @@ package android.hardware { method public int getJpegQuality(); method public int getJpegThumbnailQuality(); method public android.hardware.Camera.Size getJpegThumbnailSize(); + method public java.lang.String getPowerMode(); method public int getMaxExposureCompensation(); method public int getMaxNumDetectedFaces(); method public int getMaxNumFocusAreas(); @@ -9680,6 +9841,7 @@ package android.hardware { method public java.util.List getZoomRatios(); method public boolean isAutoExposureLockSupported(); method public boolean isAutoWhiteBalanceLockSupported(); + method public boolean isPowerModeSupported(); method public boolean isSmoothZoomSupported(); method public boolean isVideoSnapshotSupported(); method public boolean isVideoStabilizationSupported(); @@ -9707,6 +9869,7 @@ package android.hardware { method public void setMeteringAreas(java.util.List); method public void setPictureFormat(int); method public void setPictureSize(int, int); + method public void setPowerMode(java.lang.String); method public void setPreviewFormat(int); method public void setPreviewFpsRange(int, int); method public deprecated void setPreviewFrameRate(int); @@ -9746,6 +9909,8 @@ package android.hardware { field public static final java.lang.String FOCUS_MODE_FIXED = "fixed"; field public static final java.lang.String FOCUS_MODE_INFINITY = "infinity"; field public static final java.lang.String FOCUS_MODE_MACRO = "macro"; + field public static final java.lang.String LOW_POWER = "Low_Power"; + field public static final java.lang.String NORMAL_POWER = "Normal_Power"; field public static final int PREVIEW_FPS_MAX_INDEX = 1; // 0x1 field public static final int PREVIEW_FPS_MIN_INDEX = 0; // 0x0 field public static final java.lang.String SCENE_MODE_ACTION = "action"; @@ -9754,6 +9919,7 @@ package android.hardware { field public static final java.lang.String SCENE_MODE_BEACH = "beach"; field public static final java.lang.String SCENE_MODE_CANDLELIGHT = "candlelight"; field public static final java.lang.String SCENE_MODE_FIREWORKS = "fireworks"; + field public static final java.lang.String SCENE_MODE_HDR = "hdr"; field public static final java.lang.String SCENE_MODE_LANDSCAPE = "landscape"; field public static final java.lang.String SCENE_MODE_NIGHT = "night"; field public static final java.lang.String SCENE_MODE_NIGHT_PORTRAIT = "night-portrait"; @@ -9803,7 +9969,7 @@ package android.hardware { method public float getZ(); } - public class Sensor { + public final class Sensor { method public float getMaximumRange(); method public int getMinDelay(); method public java.lang.String getName(); @@ -9926,6 +10092,25 @@ package android.hardware { } +package android.hardware.display { + + public final class DisplayManager { + method public android.view.Display getDisplay(int); + method public android.view.Display[] getDisplays(); + method public android.view.Display[] getDisplays(java.lang.String); + method public void registerDisplayListener(android.hardware.display.DisplayManager.DisplayListener, android.os.Handler); + method public void unregisterDisplayListener(android.hardware.display.DisplayManager.DisplayListener); + field public static final java.lang.String DISPLAY_CATEGORY_PRESENTATION = "android.hardware.display.category.PRESENTATION"; + } + + public static abstract interface DisplayManager.DisplayListener { + method public abstract void onDisplayAdded(int); + method public abstract void onDisplayChanged(int); + method public abstract void onDisplayRemoved(int); + } + +} + package android.hardware.input { public final class InputManager { @@ -10089,6 +10274,7 @@ package android.inputmethodservice { method public final android.os.IBinder onBind(android.content.Intent); method public abstract android.inputmethodservice.AbstractInputMethodService.AbstractInputMethodImpl onCreateInputMethodInterface(); method public abstract android.inputmethodservice.AbstractInputMethodService.AbstractInputMethodSessionImpl onCreateInputMethodSessionInterface(); + method public boolean onGenericMotionEvent(android.view.MotionEvent); method public boolean onTrackballEvent(android.view.MotionEvent); } @@ -10101,6 +10287,7 @@ package android.inputmethodservice { public abstract class AbstractInputMethodService.AbstractInputMethodSessionImpl implements android.view.inputmethod.InputMethodSession { ctor public AbstractInputMethodService.AbstractInputMethodSessionImpl(); + method public void dispatchGenericMotionEvent(int, android.view.MotionEvent, android.view.inputmethod.InputMethodSession.EventCallback); method public void dispatchKeyEvent(int, android.view.KeyEvent, android.view.inputmethod.InputMethodSession.EventCallback); method public void dispatchTrackballEvent(int, android.view.MotionEvent, android.view.inputmethod.InputMethodSession.EventCallback); method public boolean isEnabled(); @@ -10120,6 +10307,7 @@ package android.inputmethodservice { public class InputMethodService extends android.inputmethodservice.AbstractInputMethodService { ctor public InputMethodService(); + method public boolean enableHardwareAcceleration(); method public int getBackDisposition(); method public int getCandidatesHiddenVisibility(); method public android.view.inputmethod.InputBinding getCurrentInputBinding(); @@ -10486,6 +10674,7 @@ package android.location { method public float getAccuracy(); method public double getAltitude(); method public float getBearing(); + method public long getElapsedRealtimeNanos(); method public android.os.Bundle getExtras(); method public double getLatitude(); method public double getLongitude(); @@ -10505,6 +10694,7 @@ package android.location { method public void setAccuracy(float); method public void setAltitude(double); method public void setBearing(float); + method public void setElapsedRealtimeNanos(long); method public void setExtras(android.os.Bundle); method public void setLatitude(double); method public void setLongitude(double); @@ -10570,18 +10760,18 @@ package android.location { field public static final java.lang.String PROVIDERS_CHANGED_ACTION = "android.location.PROVIDERS_CHANGED"; } - public abstract class LocationProvider { - method public abstract int getAccuracy(); + public class LocationProvider { + method public int getAccuracy(); method public java.lang.String getName(); - method public abstract int getPowerRequirement(); - method public abstract boolean hasMonetaryCost(); + method public int getPowerRequirement(); + method public boolean hasMonetaryCost(); method public boolean meetsCriteria(android.location.Criteria); - method public abstract boolean requiresCell(); - method public abstract boolean requiresNetwork(); - method public abstract boolean requiresSatellite(); - method public abstract boolean supportsAltitude(); - method public abstract boolean supportsBearing(); - method public abstract boolean supportsSpeed(); + method public boolean requiresCell(); + method public boolean requiresNetwork(); + method public boolean requiresSatellite(); + method public boolean supportsAltitude(); + method public boolean supportsBearing(); + method public boolean supportsSpeed(); field public static final int AVAILABLE = 2; // 0x2 field public static final int OUT_OF_SERVICE = 0; // 0x0 field public static final int TEMPORARILY_UNAVAILABLE = 1; // 0x1 @@ -10650,6 +10840,7 @@ package android.media { method public void adjustVolume(int, int); method public int getMode(); method public java.lang.String getParameters(java.lang.String); + method public java.lang.String getProperty(java.lang.String); method public int getRingerMode(); method public deprecated int getRouting(int); method public int getStreamMaxVolume(int); @@ -10727,6 +10918,8 @@ package android.media { field public static final int MODE_NORMAL = 0; // 0x0 field public static final int MODE_RINGTONE = 1; // 0x1 field public static final deprecated int NUM_STREAMS = 5; // 0x5 + field public static final java.lang.String PROPERTY_OUTPUT_FRAMES_PER_BUFFER = "android.media.property.OUTPUT_FRAMES_PER_BUFFER"; + field public static final java.lang.String PROPERTY_OUTPUT_SAMPLE_RATE = "android.media.property.OUTPUT_SAMPLE_RATE"; field public static final java.lang.String RINGER_MODE_CHANGED_ACTION = "android.media.RINGER_MODE_CHANGED"; field public static final int RINGER_MODE_NORMAL = 2; // 0x2 field public static final int RINGER_MODE_SILENT = 0; // 0x0 @@ -11305,6 +11498,7 @@ package android.media { field public static final int METADATA_KEY_NUM_TRACKS = 10; // 0xa field public static final int METADATA_KEY_TITLE = 7; // 0x7 field public static final int METADATA_KEY_VIDEO_HEIGHT = 19; // 0x13 + field public static final int METADATA_KEY_VIDEO_ROTATION = 24; // 0x18 field public static final int METADATA_KEY_VIDEO_WIDTH = 18; // 0x12 field public static final int METADATA_KEY_WRITER = 11; // 0xb field public static final int METADATA_KEY_YEAR = 8; // 0x8 @@ -11366,15 +11560,20 @@ package android.media { method public void setWakeMode(android.content.Context, int); method public void start() throws java.lang.IllegalStateException; method public void stop() throws java.lang.IllegalStateException; + field public static final int MEDIA_ERROR_IO = -1004; // 0xfffffc14 + field public static final int MEDIA_ERROR_MALFORMED = -1007; // 0xfffffc11 field public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK = 200; // 0xc8 field public static final int MEDIA_ERROR_SERVER_DIED = 100; // 0x64 + field public static final int MEDIA_ERROR_TIMED_OUT = -110; // 0xffffff92 field public static final int MEDIA_ERROR_UNKNOWN = 1; // 0x1 + field public static final int MEDIA_ERROR_UNSUPPORTED = -1010; // 0xfffffc0e field public static final int MEDIA_INFO_BAD_INTERLEAVING = 800; // 0x320 field public static final int MEDIA_INFO_BUFFERING_END = 702; // 0x2be field public static final int MEDIA_INFO_BUFFERING_START = 701; // 0x2bd field public static final int MEDIA_INFO_METADATA_UPDATE = 802; // 0x322 field public static final int MEDIA_INFO_NOT_SEEKABLE = 801; // 0x321 field public static final int MEDIA_INFO_UNKNOWN = 1; // 0x1 + field public static final int MEDIA_INFO_VIDEO_RENDERING_START = 3; // 0x3 field public static final int MEDIA_INFO_VIDEO_TRACK_LAGGING = 700; // 0x2bc field public static final java.lang.String MEDIA_MIMETYPE_TEXT_SUBRIP = "application/x-subrip"; field public static final int VIDEO_SCALING_MODE_SCALE_TO_FIT = 1; // 0x1 @@ -11456,6 +11655,7 @@ package android.media { method public void setVideoSource(int) throws java.lang.IllegalStateException; method public void start() throws java.lang.IllegalStateException; method public void stop() throws java.lang.IllegalStateException; + field public static final int MEDIA_ERROR_SERVER_DIED = 100; // 0x64 field public static final int MEDIA_RECORDER_ERROR_UNKNOWN = 1; // 0x1 field public static final int MEDIA_RECORDER_INFO_MAX_DURATION_REACHED = 800; // 0x320 field public static final int MEDIA_RECORDER_INFO_MAX_FILESIZE_REACHED = 801; // 0x321 @@ -11528,6 +11728,7 @@ package android.media { method public void removeUserRoute(android.media.MediaRouter.UserRouteInfo); method public void selectRoute(int, android.media.MediaRouter.RouteInfo); field public static final int ROUTE_TYPE_LIVE_AUDIO = 1; // 0x1 + field public static final int ROUTE_TYPE_LIVE_VIDEO = 2; // 0x2 field public static final int ROUTE_TYPE_USER = 8388608; // 0x800000 } @@ -11536,6 +11737,7 @@ package android.media { method public abstract void onRouteAdded(android.media.MediaRouter, android.media.MediaRouter.RouteInfo); method public abstract void onRouteChanged(android.media.MediaRouter, android.media.MediaRouter.RouteInfo); method public abstract void onRouteGrouped(android.media.MediaRouter, android.media.MediaRouter.RouteInfo, android.media.MediaRouter.RouteGroup, int); + method public void onRoutePresentationDisplayChanged(android.media.MediaRouter, android.media.MediaRouter.RouteInfo); method public abstract void onRouteRemoved(android.media.MediaRouter, android.media.MediaRouter.RouteInfo); method public abstract void onRouteSelected(android.media.MediaRouter, int, android.media.MediaRouter.RouteInfo); method public abstract void onRouteUngrouped(android.media.MediaRouter, android.media.MediaRouter.RouteInfo, android.media.MediaRouter.RouteGroup); @@ -11570,12 +11772,14 @@ package android.media { method public java.lang.CharSequence getName(android.content.Context); method public int getPlaybackStream(); method public int getPlaybackType(); + method public android.view.Display getPresentationDisplay(); method public java.lang.CharSequence getStatus(); method public int getSupportedTypes(); method public java.lang.Object getTag(); method public int getVolume(); method public int getVolumeHandling(); method public int getVolumeMax(); + method public boolean isEnabled(); method public void requestSetVolume(int); method public void requestUpdateVolume(int); method public void setTag(java.lang.Object); @@ -12353,6 +12557,7 @@ package android.net { field public static final java.lang.String EXTRA_EXTRA_INFO = "extraInfo"; field public static final java.lang.String EXTRA_IS_FAILOVER = "isFailover"; field public static final deprecated java.lang.String EXTRA_NETWORK_INFO = "networkInfo"; + field public static final java.lang.String EXTRA_NETWORK_TYPE = "networkType"; field public static final java.lang.String EXTRA_NO_CONNECTIVITY = "noConnectivity"; field public static final java.lang.String EXTRA_OTHER_NETWORK_INFO = "otherNetwork"; field public static final java.lang.String EXTRA_REASON = "reason"; @@ -12397,7 +12602,7 @@ package android.net { method public android.net.LocalSocketAddress getLocalSocketAddress(); } - public class LocalSocket { + public class LocalSocket implements java.io.Closeable { ctor public LocalSocket(); method public void bind(android.net.LocalSocketAddress) throws java.io.IOException; method public void close() throws java.io.IOException; @@ -12475,6 +12680,7 @@ package android.net { method public static final android.net.NetworkInfo.DetailedState[] values(); enum_constant public static final android.net.NetworkInfo.DetailedState AUTHENTICATING; enum_constant public static final android.net.NetworkInfo.DetailedState BLOCKED; + enum_constant public static final android.net.NetworkInfo.DetailedState CAPTIVE_PORTAL_CHECK; enum_constant public static final android.net.NetworkInfo.DetailedState CONNECTED; enum_constant public static final android.net.NetworkInfo.DetailedState CONNECTING; enum_constant public static final android.net.NetworkInfo.DetailedState DISCONNECTED; @@ -12525,9 +12731,11 @@ package android.net { method public static javax.net.ssl.SSLSocketFactory getInsecure(int, android.net.SSLSessionCache); method public byte[] getNpnSelectedProtocol(java.net.Socket); method public java.lang.String[] getSupportedCipherSuites(); + method public void setHostname(java.net.Socket, java.lang.String); method public void setKeyManagers(javax.net.ssl.KeyManager[]); method public void setNpnProtocols(byte[][]); method public void setTrustManagers(javax.net.ssl.TrustManager[]); + method public void setUseSessionTickets(java.net.Socket, boolean); } public final class SSLSessionCache { @@ -12812,6 +13020,11 @@ package android.net.http { field public static final int SSL_UNTRUSTED = 3; // 0x3 } + public class X509TrustManagerExtensions { + ctor public X509TrustManagerExtensions(javax.net.ssl.X509TrustManager) throws java.lang.IllegalArgumentException; + method public java.util.List checkServerTrusted(java.security.cert.X509Certificate[], java.lang.String, java.lang.String) throws java.security.cert.CertificateException; + } + } package android.net.nsd { @@ -13114,6 +13327,7 @@ package android.net.wifi { field public java.lang.String capabilities; field public int frequency; field public int level; + field public long timestamp; } public final class SupplicantState extends java.lang.Enum implements android.os.Parcelable { @@ -13718,6 +13932,14 @@ package android.nfc.tech { method public byte[] transceive(byte[]) throws java.io.IOException; } + public final class NfcBarcode extends android.nfc.tech.BasicTagTechnology { + method public static android.nfc.tech.NfcBarcode get(android.nfc.Tag); + method public byte[] getBarcode(); + method public int getType(); + field public static final int TYPE_KOVIO = 1; // 0x1 + field public static final int TYPE_UNKNOWN = -1; // 0xffffffff + } + public final class NfcF extends android.nfc.tech.BasicTagTechnology { method public static android.nfc.tech.NfcF get(android.nfc.Tag); method public byte[] getManufacturer(); @@ -13747,6 +13969,174 @@ package android.nfc.tech { package android.opengl { + public class EGL14 { + ctor public EGL14(); + method public static boolean eglBindAPI(int); + method public static boolean eglBindTexImage(android.opengl.EGLDisplay, android.opengl.EGLSurface, int); + method public static boolean eglChooseConfig(android.opengl.EGLDisplay, int[], int, android.opengl.EGLConfig[], int, int, int[], int); + method public static boolean eglCopyBuffers(android.opengl.EGLDisplay, android.opengl.EGLSurface, int); + method public static android.opengl.EGLContext eglCreateContext(android.opengl.EGLDisplay, android.opengl.EGLConfig, android.opengl.EGLContext, int[], int); + method public static android.opengl.EGLSurface eglCreatePbufferFromClientBuffer(android.opengl.EGLDisplay, int, int, android.opengl.EGLConfig, int[], int); + method public static android.opengl.EGLSurface eglCreatePbufferSurface(android.opengl.EGLDisplay, android.opengl.EGLConfig, int[], int); + method public static android.opengl.EGLSurface eglCreatePixmapSurface(android.opengl.EGLDisplay, android.opengl.EGLConfig, int, int[], int); + method public static android.opengl.EGLSurface eglCreateWindowSurface(android.opengl.EGLDisplay, android.opengl.EGLConfig, java.lang.Object, int[], int); + method public static boolean eglDestroyContext(android.opengl.EGLDisplay, android.opengl.EGLContext); + method public static boolean eglDestroySurface(android.opengl.EGLDisplay, android.opengl.EGLSurface); + method public static boolean eglGetConfigAttrib(android.opengl.EGLDisplay, android.opengl.EGLConfig, int, int[], int); + method public static boolean eglGetConfigs(android.opengl.EGLDisplay, android.opengl.EGLConfig[], int, int, int[], int); + method public static android.opengl.EGLContext eglGetCurrentContext(); + method public static android.opengl.EGLDisplay eglGetCurrentDisplay(); + method public static android.opengl.EGLSurface eglGetCurrentSurface(int); + method public static android.opengl.EGLDisplay eglGetDisplay(int); + method public static int eglGetError(); + method public static boolean eglInitialize(android.opengl.EGLDisplay, int[], int, int[], int); + method public static boolean eglMakeCurrent(android.opengl.EGLDisplay, android.opengl.EGLSurface, android.opengl.EGLSurface, android.opengl.EGLContext); + method public static int eglQueryAPI(); + method public static boolean eglQueryContext(android.opengl.EGLDisplay, android.opengl.EGLContext, int, int[], int); + method public static java.lang.String eglQueryString(android.opengl.EGLDisplay, int); + method public static boolean eglQuerySurface(android.opengl.EGLDisplay, android.opengl.EGLSurface, int, int[], int); + method public static boolean eglReleaseTexImage(android.opengl.EGLDisplay, android.opengl.EGLSurface, int); + method public static boolean eglReleaseThread(); + method public static boolean eglSurfaceAttrib(android.opengl.EGLDisplay, android.opengl.EGLSurface, int, int); + method public static boolean eglSwapBuffers(android.opengl.EGLDisplay, android.opengl.EGLSurface); + method public static boolean eglSwapInterval(android.opengl.EGLDisplay, int); + method public static boolean eglTerminate(android.opengl.EGLDisplay); + method public static boolean eglWaitClient(); + method public static boolean eglWaitGL(); + method public static boolean eglWaitNative(int); + field public static final int EGL_ALPHA_MASK_SIZE = 12350; // 0x303e + field public static final int EGL_ALPHA_SIZE = 12321; // 0x3021 + field public static final int EGL_BACK_BUFFER = 12420; // 0x3084 + field public static final int EGL_BAD_ACCESS = 12290; // 0x3002 + field public static final int EGL_BAD_ALLOC = 12291; // 0x3003 + field public static final int EGL_BAD_ATTRIBUTE = 12292; // 0x3004 + field public static final int EGL_BAD_CONFIG = 12293; // 0x3005 + field public static final int EGL_BAD_CONTEXT = 12294; // 0x3006 + field public static final int EGL_BAD_CURRENT_SURFACE = 12295; // 0x3007 + field public static final int EGL_BAD_DISPLAY = 12296; // 0x3008 + field public static final int EGL_BAD_MATCH = 12297; // 0x3009 + field public static final int EGL_BAD_NATIVE_PIXMAP = 12298; // 0x300a + field public static final int EGL_BAD_NATIVE_WINDOW = 12299; // 0x300b + field public static final int EGL_BAD_PARAMETER = 12300; // 0x300c + field public static final int EGL_BAD_SURFACE = 12301; // 0x300d + field public static final int EGL_BIND_TO_TEXTURE_RGB = 12345; // 0x3039 + field public static final int EGL_BIND_TO_TEXTURE_RGBA = 12346; // 0x303a + field public static final int EGL_BLUE_SIZE = 12322; // 0x3022 + field public static final int EGL_BUFFER_DESTROYED = 12437; // 0x3095 + field public static final int EGL_BUFFER_PRESERVED = 12436; // 0x3094 + field public static final int EGL_BUFFER_SIZE = 12320; // 0x3020 + field public static final int EGL_CLIENT_APIS = 12429; // 0x308d + field public static final int EGL_COLOR_BUFFER_TYPE = 12351; // 0x303f + field public static final int EGL_CONFIG_CAVEAT = 12327; // 0x3027 + field public static final int EGL_CONFIG_ID = 12328; // 0x3028 + field public static final int EGL_CONFORMANT = 12354; // 0x3042 + field public static final int EGL_CONTEXT_CLIENT_TYPE = 12439; // 0x3097 + field public static final int EGL_CONTEXT_CLIENT_VERSION = 12440; // 0x3098 + field public static final int EGL_CONTEXT_LOST = 12302; // 0x300e + field public static final int EGL_CORE_NATIVE_ENGINE = 12379; // 0x305b + field public static final int EGL_DEFAULT_DISPLAY = 0; // 0x0 + field public static final int EGL_DEPTH_SIZE = 12325; // 0x3025 + field public static final int EGL_DISPLAY_SCALING = 10000; // 0x2710 + field public static final int EGL_DRAW = 12377; // 0x3059 + field public static final int EGL_EXTENSIONS = 12373; // 0x3055 + field public static final int EGL_FALSE = 0; // 0x0 + field public static final int EGL_GREEN_SIZE = 12323; // 0x3023 + field public static final int EGL_HEIGHT = 12374; // 0x3056 + field public static final int EGL_HORIZONTAL_RESOLUTION = 12432; // 0x3090 + field public static final int EGL_LARGEST_PBUFFER = 12376; // 0x3058 + field public static final int EGL_LEVEL = 12329; // 0x3029 + field public static final int EGL_LUMINANCE_BUFFER = 12431; // 0x308f + field public static final int EGL_LUMINANCE_SIZE = 12349; // 0x303d + field public static final int EGL_MATCH_NATIVE_PIXMAP = 12353; // 0x3041 + field public static final int EGL_MAX_PBUFFER_HEIGHT = 12330; // 0x302a + field public static final int EGL_MAX_PBUFFER_PIXELS = 12331; // 0x302b + field public static final int EGL_MAX_PBUFFER_WIDTH = 12332; // 0x302c + field public static final int EGL_MAX_SWAP_INTERVAL = 12348; // 0x303c + field public static final int EGL_MIN_SWAP_INTERVAL = 12347; // 0x303b + field public static final int EGL_MIPMAP_LEVEL = 12419; // 0x3083 + field public static final int EGL_MIPMAP_TEXTURE = 12418; // 0x3082 + field public static final int EGL_MULTISAMPLE_RESOLVE = 12441; // 0x3099 + field public static final int EGL_MULTISAMPLE_RESOLVE_BOX = 12443; // 0x309b + field public static final int EGL_MULTISAMPLE_RESOLVE_BOX_BIT = 512; // 0x200 + field public static final int EGL_MULTISAMPLE_RESOLVE_DEFAULT = 12442; // 0x309a + field public static final int EGL_NATIVE_RENDERABLE = 12333; // 0x302d + field public static final int EGL_NATIVE_VISUAL_ID = 12334; // 0x302e + field public static final int EGL_NATIVE_VISUAL_TYPE = 12335; // 0x302f + field public static final int EGL_NONE = 12344; // 0x3038 + field public static final int EGL_NON_CONFORMANT_CONFIG = 12369; // 0x3051 + field public static final int EGL_NOT_INITIALIZED = 12289; // 0x3001 + field public static android.opengl.EGLContext EGL_NO_CONTEXT; + field public static android.opengl.EGLDisplay EGL_NO_DISPLAY; + field public static android.opengl.EGLSurface EGL_NO_SURFACE; + field public static final int EGL_NO_TEXTURE = 12380; // 0x305c + field public static final int EGL_OPENGL_API = 12450; // 0x30a2 + field public static final int EGL_OPENGL_BIT = 8; // 0x8 + field public static final int EGL_OPENGL_ES2_BIT = 4; // 0x4 + field public static final int EGL_OPENGL_ES_API = 12448; // 0x30a0 + field public static final int EGL_OPENGL_ES_BIT = 1; // 0x1 + field public static final int EGL_OPENVG_API = 12449; // 0x30a1 + field public static final int EGL_OPENVG_BIT = 2; // 0x2 + field public static final int EGL_OPENVG_IMAGE = 12438; // 0x3096 + field public static final int EGL_PBUFFER_BIT = 1; // 0x1 + field public static final int EGL_PIXEL_ASPECT_RATIO = 12434; // 0x3092 + field public static final int EGL_PIXMAP_BIT = 2; // 0x2 + field public static final int EGL_READ = 12378; // 0x305a + field public static final int EGL_RED_SIZE = 12324; // 0x3024 + field public static final int EGL_RENDERABLE_TYPE = 12352; // 0x3040 + field public static final int EGL_RENDER_BUFFER = 12422; // 0x3086 + field public static final int EGL_RGB_BUFFER = 12430; // 0x308e + field public static final int EGL_SAMPLES = 12337; // 0x3031 + field public static final int EGL_SAMPLE_BUFFERS = 12338; // 0x3032 + field public static final int EGL_SINGLE_BUFFER = 12421; // 0x3085 + field public static final int EGL_SLOW_CONFIG = 12368; // 0x3050 + field public static final int EGL_STENCIL_SIZE = 12326; // 0x3026 + field public static final int EGL_SUCCESS = 12288; // 0x3000 + field public static final int EGL_SURFACE_TYPE = 12339; // 0x3033 + field public static final int EGL_SWAP_BEHAVIOR = 12435; // 0x3093 + field public static final int EGL_SWAP_BEHAVIOR_PRESERVED_BIT = 1024; // 0x400 + field public static final int EGL_TEXTURE_2D = 12383; // 0x305f + field public static final int EGL_TEXTURE_FORMAT = 12416; // 0x3080 + field public static final int EGL_TEXTURE_RGB = 12381; // 0x305d + field public static final int EGL_TEXTURE_RGBA = 12382; // 0x305e + field public static final int EGL_TEXTURE_TARGET = 12417; // 0x3081 + field public static final int EGL_TRANSPARENT_BLUE_VALUE = 12341; // 0x3035 + field public static final int EGL_TRANSPARENT_GREEN_VALUE = 12342; // 0x3036 + field public static final int EGL_TRANSPARENT_RED_VALUE = 12343; // 0x3037 + field public static final int EGL_TRANSPARENT_RGB = 12370; // 0x3052 + field public static final int EGL_TRANSPARENT_TYPE = 12340; // 0x3034 + field public static final int EGL_TRUE = 1; // 0x1 + field public static final int EGL_VENDOR = 12371; // 0x3053 + field public static final int EGL_VERSION = 12372; // 0x3054 + field public static final int EGL_VERTICAL_RESOLUTION = 12433; // 0x3091 + field public static final int EGL_VG_ALPHA_FORMAT = 12424; // 0x3088 + field public static final int EGL_VG_ALPHA_FORMAT_NONPRE = 12427; // 0x308b + field public static final int EGL_VG_ALPHA_FORMAT_PRE = 12428; // 0x308c + field public static final int EGL_VG_ALPHA_FORMAT_PRE_BIT = 64; // 0x40 + field public static final int EGL_VG_COLORSPACE = 12423; // 0x3087 + field public static final int EGL_VG_COLORSPACE_LINEAR = 12426; // 0x308a + field public static final int EGL_VG_COLORSPACE_LINEAR_BIT = 32; // 0x20 + field public static final int EGL_VG_COLORSPACE_sRGB = 12425; // 0x3089 + field public static final int EGL_WIDTH = 12375; // 0x3057 + field public static final int EGL_WINDOW_BIT = 4; // 0x4 + } + + public class EGLConfig extends android.opengl.EGLObjectHandle { + } + + public class EGLContext extends android.opengl.EGLObjectHandle { + } + + public class EGLDisplay extends android.opengl.EGLObjectHandle { + } + + public abstract class EGLObjectHandle { + ctor protected EGLObjectHandle(int); + method public int getHandle(); + } + + public class EGLSurface extends android.opengl.EGLObjectHandle { + } + public class ETC1 { ctor public ETC1(); method public static void decodeBlock(java.nio.Buffer, java.nio.Buffer); @@ -14654,8 +15044,12 @@ package android.opengl { method public static void glGenerateMipmap(int); method public static void glGetActiveAttrib(int, int, int, int[], int, int[], int, int[], int, byte[], int); method public static void glGetActiveAttrib(int, int, int, java.nio.IntBuffer, java.nio.IntBuffer, java.nio.IntBuffer, byte); + method public static java.lang.String glGetActiveAttrib(int, int, int[], int, int[], int); + method public static java.lang.String glGetActiveAttrib(int, int, java.nio.IntBuffer, java.nio.IntBuffer); method public static void glGetActiveUniform(int, int, int, int[], int, int[], int, int[], int, byte[], int); method public static void glGetActiveUniform(int, int, int, java.nio.IntBuffer, java.nio.IntBuffer, java.nio.IntBuffer, byte); + method public static java.lang.String glGetActiveUniform(int, int, int[], int, int[], int); + method public static java.lang.String glGetActiveUniform(int, int, java.nio.IntBuffer, java.nio.IntBuffer); method public static void glGetAttachedShaders(int, int, int[], int, int[], int); method public static void glGetAttachedShaders(int, int, java.nio.IntBuffer, java.nio.IntBuffer); method public static int glGetAttribLocation(int, java.lang.String); @@ -14680,6 +15074,7 @@ package android.opengl { method public static void glGetShaderPrecisionFormat(int, int, java.nio.IntBuffer, java.nio.IntBuffer); method public static void glGetShaderSource(int, int, int[], int, byte[], int); method public static void glGetShaderSource(int, int, java.nio.IntBuffer, byte); + method public static java.lang.String glGetShaderSource(int); method public static void glGetShaderiv(int, int, int[], int); method public static void glGetShaderiv(int, int, java.nio.IntBuffer); method public static java.lang.String glGetString(int); @@ -15239,6 +15634,7 @@ package android.os { field public static final int BATTERY_HEALTH_UNSPECIFIED_FAILURE = 6; // 0x6 field public static final int BATTERY_PLUGGED_AC = 1; // 0x1 field public static final int BATTERY_PLUGGED_USB = 2; // 0x2 + field public static final int BATTERY_PLUGGED_WIRELESS = 4; // 0x4 field public static final int BATTERY_STATUS_CHARGING = 2; // 0x2 field public static final int BATTERY_STATUS_DISCHARGING = 3; // 0x3 field public static final int BATTERY_STATUS_FULL = 5; // 0x5 @@ -15266,6 +15662,7 @@ package android.os { method public static final void flushPendingCommands(); method public static final int getCallingPid(); method public static final int getCallingUid(); + method public static final android.os.UserHandle getCallingUserHandle(); method public java.lang.String getInterfaceDescriptor(); method public boolean isBinderAlive(); method public static final void joinThreadPool(); @@ -15332,6 +15729,7 @@ package android.os { field public static final int ICE_CREAM_SANDWICH = 14; // 0xe field public static final int ICE_CREAM_SANDWICH_MR1 = 15; // 0xf field public static final int JELLY_BEAN = 16; // 0x10 + field public static final int JELLY_BEAN_MR1 = 17; // 0x11 } public final class Bundle implements java.lang.Cloneable android.os.Parcelable { @@ -15991,21 +16389,22 @@ package android.os { field public static final int PATTERN_SIMPLE_GLOB = 2; // 0x2 } - public class PowerManager { + public final class PowerManager { method public void goToSleep(long); method public boolean isScreenOn(); method public android.os.PowerManager.WakeLock newWakeLock(int, java.lang.String); method public void reboot(java.lang.String); method public void userActivity(long, boolean); + method public void wakeUp(long); 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 class PowerManager.WakeLock { + public final class PowerManager.WakeLock { method public void acquire(); method public void acquire(long); method public boolean isHeld(); @@ -16024,6 +16423,7 @@ package android.os { method public static final int myPid(); method public static final int myTid(); method public static final int myUid(); + method public static final android.os.UserHandle myUserHandle(); method public static final void sendSignal(int, int); method public static final void setThreadPriority(int, int) throws java.lang.IllegalArgumentException, java.lang.SecurityException; method public static final void setThreadPriority(int) throws java.lang.IllegalArgumentException, java.lang.SecurityException; @@ -16066,6 +16466,7 @@ package android.os { method public void finishBroadcast(); method public java.lang.Object getBroadcastCookie(int); method public E getBroadcastItem(int); + method public int getRegisteredCallbackCount(); method public void kill(); method public void onCallbackDied(E); method public void onCallbackDied(E, java.lang.Object); @@ -16156,6 +16557,7 @@ package android.os { public final class SystemClock { method public static long currentThreadTimeMillis(); method public static long elapsedRealtime(); + method public static long elapsedRealtimeNanos(); method public static boolean setCurrentTimeMillis(long); method public static void sleep(long); method public static long uptimeMillis(); @@ -16177,6 +16579,25 @@ package android.os { ctor public TransactionTooLargeException(); } + public final class UserHandle implements android.os.Parcelable { + ctor public UserHandle(android.os.Parcel); + method public int describeContents(); + method public static android.os.UserHandle readFromParcel(android.os.Parcel); + method public void writeToParcel(android.os.Parcel, int); + method public static void writeToParcel(android.os.UserHandle, android.os.Parcel); + field public static final android.os.Parcelable.Creator CREATOR; + } + + public class UserManager { + method public long getSerialNumberForUser(android.os.UserHandle); + method public int getUserCount(); + method public android.os.UserHandle getUserForSerialNumber(long); + method public java.lang.String getUserName(); + method public boolean isUserAGoat(); + method public boolean isUserRunning(android.os.UserHandle); + method public boolean isUserRunningOrStopping(android.os.UserHandle); + } + public abstract class Vibrator { method public abstract void cancel(); method public abstract boolean hasVibrator(); @@ -16755,6 +17176,7 @@ package android.provider { field public static final int CAL_ACCESS_ROOT = 800; // 0x320 field public static final java.lang.String CAN_MODIFY_TIME_ZONE = "canModifyTimeZone"; field public static final java.lang.String CAN_ORGANIZER_RESPOND = "canOrganizerRespond"; + field public static final java.lang.String IS_PRIMARY = "isPrimary"; field public static final java.lang.String MAX_REMINDERS = "maxReminders"; field public static final java.lang.String OWNER_ACCOUNT = "ownerAccount"; field public static final java.lang.String SYNC_EVENTS = "sync_events"; @@ -16846,6 +17268,7 @@ package android.provider { field public static final java.lang.String HAS_ALARM = "hasAlarm"; field public static final java.lang.String HAS_ATTENDEE_DATA = "hasAttendeeData"; field public static final java.lang.String HAS_EXTENDED_PROPERTIES = "hasExtendedProperties"; + field public static final java.lang.String IS_ORGANIZER = "isOrganizer"; field public static final java.lang.String LAST_DATE = "lastDate"; field public static final java.lang.String LAST_SYNCED = "lastSynced"; field public static final java.lang.String ORGANIZER = "organizer"; @@ -16871,6 +17294,7 @@ package android.provider { field public static final java.lang.String SYNC_DATA8 = "sync_data8"; field public static final java.lang.String SYNC_DATA9 = "sync_data9"; field public static final java.lang.String TITLE = "title"; + field public static final java.lang.String UID_2445 = "uid2445"; } public static final class CalendarContract.EventsEntity implements android.provider.BaseColumns android.provider.CalendarContract.EventsColumns android.provider.CalendarContract.SyncColumns { @@ -16956,9 +17380,11 @@ package android.provider { field public static final java.lang.String DURATION = "duration"; field public static final int INCOMING_TYPE = 1; // 0x1 field public static final java.lang.String IS_READ = "is_read"; + field public static final java.lang.String LIMIT_PARAM_KEY = "limit"; field public static final int MISSED_TYPE = 3; // 0x3 field public static final java.lang.String NEW = "new"; field public static final java.lang.String NUMBER = "number"; + field public static final java.lang.String OFFSET_PARAM_KEY = "offset"; field public static final int OUTGOING_TYPE = 2; // 0x2 field public static final java.lang.String TYPE = "type"; } @@ -17992,6 +18418,7 @@ package android.provider { method public static android.net.Uri getMediaScannerUri(); method public static java.lang.String getVersion(android.content.Context); field public static final java.lang.String ACTION_IMAGE_CAPTURE = "android.media.action.IMAGE_CAPTURE"; + field public static final java.lang.String ACTION_IMAGE_CAPTURE_SECURE = "android.media.action.IMAGE_CAPTURE_SECURE"; field public static final java.lang.String ACTION_VIDEO_CAPTURE = "android.media.action.VIDEO_CAPTURE"; field public static final java.lang.String AUTHORITY = "media"; field public static final java.lang.String EXTRA_DURATION_LIMIT = "android.intent.extra.durationLimit"; @@ -18010,7 +18437,10 @@ package android.provider { field public static final java.lang.String INTENT_ACTION_MEDIA_SEARCH = "android.intent.action.MEDIA_SEARCH"; field public static final deprecated java.lang.String INTENT_ACTION_MUSIC_PLAYER = "android.intent.action.MUSIC_PLAYER"; field public static final java.lang.String INTENT_ACTION_STILL_IMAGE_CAMERA = "android.media.action.STILL_IMAGE_CAMERA"; + field public static final java.lang.String INTENT_ACTION_STILL_IMAGE_CAMERA_SECURE = "android.media.action.STILL_IMAGE_CAMERA_SECURE"; + field public static final java.lang.String INTENT_ACTION_TEXT_OPEN_FROM_SEARCH = "android.media.action.TEXT_OPEN_FROM_SEARCH"; field public static final java.lang.String INTENT_ACTION_VIDEO_CAMERA = "android.media.action.VIDEO_CAMERA"; + field public static final java.lang.String INTENT_ACTION_VIDEO_PLAY_FROM_SEARCH = "android.media.action.VIDEO_PLAY_FROM_SEARCH"; field public static final java.lang.String MEDIA_IGNORE_FILENAME = ".nomedia"; field public static final java.lang.String MEDIA_SCANNER_VOLUME = "volume"; field public static final java.lang.String UNKNOWN_STRING = ""; @@ -18349,6 +18779,62 @@ package android.provider { field public static final java.lang.String EXTRA_INPUT_METHOD_ID = "input_method_id"; } + public static final class Settings.Global extends android.provider.Settings.NameValueTable { + ctor public Settings.Global(); + method public static float getFloat(android.content.ContentResolver, java.lang.String, float); + method public static float getFloat(android.content.ContentResolver, java.lang.String) throws android.provider.Settings.SettingNotFoundException; + method public static int getInt(android.content.ContentResolver, java.lang.String, int); + method public static int getInt(android.content.ContentResolver, java.lang.String) throws android.provider.Settings.SettingNotFoundException; + method public static long getLong(android.content.ContentResolver, java.lang.String, long); + method public static long getLong(android.content.ContentResolver, java.lang.String) throws android.provider.Settings.SettingNotFoundException; + method public static java.lang.String getString(android.content.ContentResolver, java.lang.String); + method public static android.net.Uri getUriFor(java.lang.String); + method public static boolean putFloat(android.content.ContentResolver, java.lang.String, float); + method public static boolean putInt(android.content.ContentResolver, java.lang.String, int); + method public static boolean putLong(android.content.ContentResolver, java.lang.String, long); + method public static boolean putString(android.content.ContentResolver, java.lang.String, java.lang.String); + field public static final java.lang.String ADB_ENABLED = "adb_enabled"; + field public static final java.lang.String AIRPLANE_MODE_ON = "airplane_mode_on"; + field public static final java.lang.String AIRPLANE_MODE_RADIOS = "airplane_mode_radios"; + field public static final java.lang.String ALWAYS_FINISH_ACTIVITIES = "always_finish_activities"; + field public static final java.lang.String ANIMATOR_DURATION_SCALE = "animator_duration_scale"; + field public static final java.lang.String AUTO_TIME = "auto_time"; + field public static final java.lang.String AUTO_TIME_ZONE = "auto_time_zone"; + field public static final java.lang.String BLUETOOTH_ON = "bluetooth_on"; + field public static final android.net.Uri CONTENT_URI; + field public static final java.lang.String DATA_ROAMING = "data_roaming"; + field public static final java.lang.String DEBUG_APP = "debug_app"; + field public static final java.lang.String DEVELOPMENT_SETTINGS_ENABLED = "development_settings_enabled"; + field public static final java.lang.String DEVICE_PROVISIONED = "device_provisioned"; + field public static final java.lang.String HTTP_PROXY = "http_proxy"; + field public static final java.lang.String INSTALL_NON_MARKET_APPS = "install_non_market_apps"; + field public static final java.lang.String MODE_RINGER = "mode_ringer"; + field public static final java.lang.String NETWORK_PREFERENCE = "network_preference"; + field public static final java.lang.String RADIO_BLUETOOTH = "bluetooth"; + field public static final java.lang.String RADIO_CELL = "cell"; + field public static final java.lang.String RADIO_NFC = "nfc"; + field public static final java.lang.String RADIO_WIFI = "wifi"; + field public static final java.lang.String SHOW_PROCESSES = "show_processes"; + field public static final java.lang.String STAY_ON_WHILE_PLUGGED_IN = "stay_on_while_plugged_in"; + field public static final java.lang.String SYS_PROP_SETTING_VERSION = "sys.settings_global_version"; + field public static final java.lang.String TRANSITION_ANIMATION_SCALE = "transition_animation_scale"; + field public static final java.lang.String USB_MASS_STORAGE_ENABLED = "usb_mass_storage_enabled"; + field public static final java.lang.String USE_GOOGLE_MAIL = "use_google_mail"; + field public static final java.lang.String WAIT_FOR_DEBUGGER = "wait_for_debugger"; + field public static final java.lang.String WIFI_MAX_DHCP_RETRY_COUNT = "wifi_max_dhcp_retry_count"; + field public static final java.lang.String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS = "wifi_mobile_data_transition_wakelock_timeout_ms"; + field public static final java.lang.String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON = "wifi_networks_available_notification_on"; + field public static final java.lang.String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY = "wifi_networks_available_repeat_delay"; + field public static final java.lang.String WIFI_NUM_OPEN_NETWORKS_KEPT = "wifi_num_open_networks_kept"; + field public static final java.lang.String WIFI_ON = "wifi_on"; + field public static final java.lang.String WIFI_SLEEP_POLICY = "wifi_sleep_policy"; + field public static final int WIFI_SLEEP_POLICY_DEFAULT = 0; // 0x0 + field public static final int WIFI_SLEEP_POLICY_NEVER = 2; // 0x2 + field public static final int WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED = 1; // 0x1 + field public static final java.lang.String WIFI_WATCHDOG_ON = "wifi_watchdog_on"; + field public static final java.lang.String WINDOW_ANIMATION_SCALE = "window_animation_scale"; + } + public static class Settings.NameValueTable implements android.provider.BaseColumns { ctor public Settings.NameValueTable(); method public static android.net.Uri getUriFor(android.net.Uri, java.lang.String); @@ -18365,7 +18851,7 @@ package android.provider { method public static int getInt(android.content.ContentResolver, java.lang.String) throws android.provider.Settings.SettingNotFoundException; method public static long getLong(android.content.ContentResolver, java.lang.String, long); method public static long getLong(android.content.ContentResolver, java.lang.String) throws android.provider.Settings.SettingNotFoundException; - method public static synchronized java.lang.String getString(android.content.ContentResolver, java.lang.String); + method public static java.lang.String getString(android.content.ContentResolver, java.lang.String); method public static android.net.Uri getUriFor(java.lang.String); method public static final boolean isLocationProviderEnabled(android.content.ContentResolver, java.lang.String); method public static boolean putFloat(android.content.ContentResolver, java.lang.String, float); @@ -18375,28 +18861,28 @@ package android.provider { method public static final void setLocationProviderEnabled(android.content.ContentResolver, java.lang.String, boolean); field public static final java.lang.String ACCESSIBILITY_ENABLED = "accessibility_enabled"; field public static final java.lang.String ACCESSIBILITY_SPEAK_PASSWORD = "speak_password"; - field public static final java.lang.String ADB_ENABLED = "adb_enabled"; + field public static final deprecated java.lang.String ADB_ENABLED = "adb_enabled"; field public static final java.lang.String ALLOWED_GEOLOCATION_ORIGINS = "allowed_geolocation_origins"; field public static final java.lang.String ALLOW_MOCK_LOCATION = "mock_location"; field public static final java.lang.String ANDROID_ID = "android_id"; field public static final deprecated java.lang.String BACKGROUND_DATA = "background_data"; - field public static final java.lang.String BLUETOOTH_ON = "bluetooth_on"; + field public static final deprecated java.lang.String BLUETOOTH_ON = "bluetooth_on"; field public static final android.net.Uri CONTENT_URI; - field public static final java.lang.String DATA_ROAMING = "data_roaming"; + field public static final deprecated java.lang.String DATA_ROAMING = "data_roaming"; field public static final java.lang.String DEFAULT_INPUT_METHOD = "default_input_method"; - field public static final java.lang.String DEVELOPMENT_SETTINGS_ENABLED = "development_settings_enabled"; - field public static final java.lang.String DEVICE_PROVISIONED = "device_provisioned"; + field public static final deprecated java.lang.String DEVELOPMENT_SETTINGS_ENABLED = "development_settings_enabled"; + field public static final deprecated java.lang.String DEVICE_PROVISIONED = "device_provisioned"; field public static final java.lang.String ENABLED_ACCESSIBILITY_SERVICES = "enabled_accessibility_services"; field public static final java.lang.String ENABLED_INPUT_METHODS = "enabled_input_methods"; - field public static final java.lang.String HTTP_PROXY = "http_proxy"; + field public static final deprecated java.lang.String HTTP_PROXY = "http_proxy"; field public static final java.lang.String INPUT_METHOD_SELECTOR_VISIBILITY = "input_method_selector_visibility"; - field public static final java.lang.String INSTALL_NON_MARKET_APPS = "install_non_market_apps"; + field public static final deprecated java.lang.String INSTALL_NON_MARKET_APPS = "install_non_market_apps"; field public static final java.lang.String LOCATION_PROVIDERS_ALLOWED = "location_providers_allowed"; field public static final java.lang.String LOCK_PATTERN_ENABLED = "lock_pattern_autolock"; - field public static final java.lang.String LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED = "lock_pattern_tactile_feedback_enabled"; + field public static final deprecated java.lang.String LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED = "lock_pattern_tactile_feedback_enabled"; field public static final java.lang.String LOCK_PATTERN_VISIBLE = "lock_pattern_visible_pattern"; field public static final deprecated java.lang.String LOGGING_ID = "logging_id"; - field public static final java.lang.String NETWORK_PREFERENCE = "network_preference"; + field public static final deprecated java.lang.String NETWORK_PREFERENCE = "network_preference"; field public static final java.lang.String PARENTAL_CONTROL_ENABLED = "parental_control_enabled"; field public static final java.lang.String PARENTAL_CONTROL_LAST_UPDATE = "parental_control_last_update"; field public static final java.lang.String PARENTAL_CONTROL_REDIRECT_URL = "parental_control_redirect_url"; @@ -18412,14 +18898,14 @@ package android.provider { field public static final deprecated java.lang.String TTS_DEFAULT_VARIANT = "tts_default_variant"; field public static final java.lang.String TTS_ENABLED_PLUGINS = "tts_enabled_plugins"; field public static final deprecated java.lang.String TTS_USE_DEFAULTS = "tts_use_defaults"; - field public static final java.lang.String USB_MASS_STORAGE_ENABLED = "usb_mass_storage_enabled"; - field public static final java.lang.String USE_GOOGLE_MAIL = "use_google_mail"; - field public static final java.lang.String WIFI_MAX_DHCP_RETRY_COUNT = "wifi_max_dhcp_retry_count"; - field public static final java.lang.String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS = "wifi_mobile_data_transition_wakelock_timeout_ms"; - field public static final java.lang.String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON = "wifi_networks_available_notification_on"; - field public static final java.lang.String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY = "wifi_networks_available_repeat_delay"; - field public static final java.lang.String WIFI_NUM_OPEN_NETWORKS_KEPT = "wifi_num_open_networks_kept"; - field public static final java.lang.String WIFI_ON = "wifi_on"; + field public static final deprecated java.lang.String USB_MASS_STORAGE_ENABLED = "usb_mass_storage_enabled"; + field public static final deprecated java.lang.String USE_GOOGLE_MAIL = "use_google_mail"; + field public static final deprecated java.lang.String WIFI_MAX_DHCP_RETRY_COUNT = "wifi_max_dhcp_retry_count"; + field public static final deprecated java.lang.String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS = "wifi_mobile_data_transition_wakelock_timeout_ms"; + field public static final deprecated java.lang.String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON = "wifi_networks_available_notification_on"; + field public static final deprecated java.lang.String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY = "wifi_networks_available_repeat_delay"; + field public static final deprecated java.lang.String WIFI_NUM_OPEN_NETWORKS_KEPT = "wifi_num_open_networks_kept"; + field public static final deprecated java.lang.String WIFI_ON = "wifi_on"; field public static final deprecated java.lang.String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE = "wifi_watchdog_acceptable_packet_loss_percentage"; field public static final deprecated java.lang.String WIFI_WATCHDOG_AP_COUNT = "wifi_watchdog_ap_count"; field public static final deprecated java.lang.String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS = "wifi_watchdog_background_check_delay_ms"; @@ -18427,7 +18913,7 @@ package android.provider { field public static final deprecated java.lang.String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS = "wifi_watchdog_background_check_timeout_ms"; field public static final deprecated java.lang.String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT = "wifi_watchdog_initial_ignored_ping_count"; field public static final deprecated java.lang.String WIFI_WATCHDOG_MAX_AP_CHECKS = "wifi_watchdog_max_ap_checks"; - field public static final java.lang.String WIFI_WATCHDOG_ON = "wifi_watchdog_on"; + field public static final deprecated java.lang.String WIFI_WATCHDOG_ON = "wifi_watchdog_on"; field public static final deprecated java.lang.String WIFI_WATCHDOG_PING_COUNT = "wifi_watchdog_ping_count"; field public static final deprecated java.lang.String WIFI_WATCHDOG_PING_DELAY_MS = "wifi_watchdog_ping_delay_ms"; field public static final deprecated java.lang.String WIFI_WATCHDOG_PING_TIMEOUT_MS = "wifi_watchdog_ping_timeout_ms"; @@ -18447,38 +18933,38 @@ package android.provider { method public static int getInt(android.content.ContentResolver, java.lang.String) throws android.provider.Settings.SettingNotFoundException; method public static long getLong(android.content.ContentResolver, java.lang.String, long); method public static long getLong(android.content.ContentResolver, java.lang.String) throws android.provider.Settings.SettingNotFoundException; - method public static boolean getShowGTalkServiceStatus(android.content.ContentResolver); - method public static synchronized java.lang.String getString(android.content.ContentResolver, java.lang.String); + method public static deprecated boolean getShowGTalkServiceStatus(android.content.ContentResolver); + method public static java.lang.String getString(android.content.ContentResolver, java.lang.String); method public static android.net.Uri getUriFor(java.lang.String); method public static boolean putConfiguration(android.content.ContentResolver, android.content.res.Configuration); method public static boolean putFloat(android.content.ContentResolver, java.lang.String, float); method public static boolean putInt(android.content.ContentResolver, java.lang.String, int); method public static boolean putLong(android.content.ContentResolver, java.lang.String, long); method public static boolean putString(android.content.ContentResolver, java.lang.String, java.lang.String); - method public static void setShowGTalkServiceStatus(android.content.ContentResolver, boolean); + method public static deprecated void setShowGTalkServiceStatus(android.content.ContentResolver, boolean); field public static final java.lang.String ACCELEROMETER_ROTATION = "accelerometer_rotation"; field public static final deprecated java.lang.String ADB_ENABLED = "adb_enabled"; - field public static final java.lang.String AIRPLANE_MODE_ON = "airplane_mode_on"; - field public static final java.lang.String AIRPLANE_MODE_RADIOS = "airplane_mode_radios"; + field public static final deprecated java.lang.String AIRPLANE_MODE_ON = "airplane_mode_on"; + field public static final deprecated java.lang.String AIRPLANE_MODE_RADIOS = "airplane_mode_radios"; field public static final java.lang.String ALARM_ALERT = "alarm_alert"; - field public static final java.lang.String ALWAYS_FINISH_ACTIVITIES = "always_finish_activities"; + field public static final deprecated java.lang.String ALWAYS_FINISH_ACTIVITIES = "always_finish_activities"; field public static final deprecated java.lang.String ANDROID_ID = "android_id"; - field public static final java.lang.String ANIMATOR_DURATION_SCALE = "animator_duration_scale"; + field public static final deprecated java.lang.String ANIMATOR_DURATION_SCALE = "animator_duration_scale"; field public static final java.lang.String APPEND_FOR_LAST_AUDIBLE = "_last_audible"; - field public static final java.lang.String AUTO_TIME = "auto_time"; - field public static final java.lang.String AUTO_TIME_ZONE = "auto_time_zone"; + field public static final deprecated java.lang.String AUTO_TIME = "auto_time"; + field public static final deprecated java.lang.String AUTO_TIME_ZONE = "auto_time_zone"; field public static final java.lang.String BLUETOOTH_DISCOVERABILITY = "bluetooth_discoverability"; field public static final java.lang.String BLUETOOTH_DISCOVERABILITY_TIMEOUT = "bluetooth_discoverability_timeout"; field public static final deprecated java.lang.String BLUETOOTH_ON = "bluetooth_on"; field public static final android.net.Uri CONTENT_URI; field public static final deprecated java.lang.String DATA_ROAMING = "data_roaming"; field public static final java.lang.String DATE_FORMAT = "date_format"; - field public static final java.lang.String DEBUG_APP = "debug_app"; + field public static final deprecated java.lang.String DEBUG_APP = "debug_app"; field public static final android.net.Uri DEFAULT_ALARM_ALERT_URI; field public static final android.net.Uri DEFAULT_NOTIFICATION_URI; field public static final android.net.Uri DEFAULT_RINGTONE_URI; field public static final deprecated java.lang.String DEVICE_PROVISIONED = "device_provisioned"; - field public static final java.lang.String DIM_SCREEN = "dim_screen"; + field public static final deprecated java.lang.String DIM_SCREEN = "dim_screen"; field public static final java.lang.String DTMF_TONE_WHEN_DIALING = "dtmf_tone"; field public static final java.lang.String END_BUTTON_BEHAVIOR = "end_button_behavior"; field public static final java.lang.String FONT_SCALE = "font_scale"; @@ -18490,7 +18976,7 @@ package android.provider { field public static final deprecated java.lang.String LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED = "lock_pattern_tactile_feedback_enabled"; field public static final deprecated java.lang.String LOCK_PATTERN_VISIBLE = "lock_pattern_visible_pattern"; field public static final deprecated java.lang.String LOGGING_ID = "logging_id"; - field public static final java.lang.String MODE_RINGER = "mode_ringer"; + field public static final deprecated java.lang.String MODE_RINGER = "mode_ringer"; field public static final java.lang.String MODE_RINGER_STREAMS_AFFECTED = "mode_ringer_streams_affected"; field public static final java.lang.String MUTE_STREAMS_AFFECTED = "mute_streams_affected"; field public static final deprecated java.lang.String NETWORK_PREFERENCE = "network_preference"; @@ -18499,10 +18985,10 @@ package android.provider { field public static final deprecated java.lang.String PARENTAL_CONTROL_ENABLED = "parental_control_enabled"; field public static final deprecated java.lang.String PARENTAL_CONTROL_LAST_UPDATE = "parental_control_last_update"; field public static final deprecated java.lang.String PARENTAL_CONTROL_REDIRECT_URL = "parental_control_redirect_url"; - field public static final java.lang.String RADIO_BLUETOOTH = "bluetooth"; - field public static final java.lang.String RADIO_CELL = "cell"; - field public static final java.lang.String RADIO_NFC = "nfc"; - field public static final java.lang.String RADIO_WIFI = "wifi"; + field public static final deprecated java.lang.String RADIO_BLUETOOTH = "bluetooth"; + field public static final deprecated java.lang.String RADIO_CELL = "cell"; + field public static final deprecated java.lang.String RADIO_NFC = "nfc"; + field public static final deprecated java.lang.String RADIO_WIFI = "wifi"; field public static final java.lang.String RINGTONE = "ringtone"; field public static final java.lang.String SCREEN_BRIGHTNESS = "screen_brightness"; field public static final java.lang.String SCREEN_BRIGHTNESS_MODE = "screen_brightness_mode"; @@ -18512,17 +18998,17 @@ package android.provider { field public static final deprecated java.lang.String SETTINGS_CLASSNAME = "settings_classname"; field public static final java.lang.String SETUP_WIZARD_HAS_RUN = "setup_wizard_has_run"; field public static final java.lang.String SHOW_GTALK_SERVICE_STATUS = "SHOW_GTALK_SERVICE_STATUS"; - field public static final java.lang.String SHOW_PROCESSES = "show_processes"; + field public static final deprecated java.lang.String SHOW_PROCESSES = "show_processes"; field public static final deprecated java.lang.String SHOW_WEB_SUGGESTIONS = "show_web_suggestions"; field public static final java.lang.String SOUND_EFFECTS_ENABLED = "sound_effects_enabled"; - field public static final java.lang.String STAY_ON_WHILE_PLUGGED_IN = "stay_on_while_plugged_in"; + field public static final deprecated java.lang.String STAY_ON_WHILE_PLUGGED_IN = "stay_on_while_plugged_in"; field public static final java.lang.String SYS_PROP_SETTING_VERSION = "sys.settings_system_version"; field public static final java.lang.String TEXT_AUTO_CAPS = "auto_caps"; field public static final java.lang.String TEXT_AUTO_PUNCTUATE = "auto_punctuate"; field public static final java.lang.String TEXT_AUTO_REPLACE = "auto_replace"; field public static final java.lang.String TEXT_SHOW_PASSWORD = "show_password"; field public static final java.lang.String TIME_12_24 = "time_12_24"; - field public static final java.lang.String TRANSITION_ANIMATION_SCALE = "transition_animation_scale"; + field public static final deprecated java.lang.String TRANSITION_ANIMATION_SCALE = "transition_animation_scale"; field public static final deprecated java.lang.String USB_MASS_STORAGE_ENABLED = "usb_mass_storage_enabled"; field public static final java.lang.String USER_ROTATION = "user_rotation"; field public static final deprecated java.lang.String USE_GOOGLE_MAIL = "use_google_mail"; @@ -18535,24 +19021,24 @@ package android.provider { field public static final java.lang.String[] VOLUME_SETTINGS; field public static final java.lang.String VOLUME_SYSTEM = "volume_system"; field public static final java.lang.String VOLUME_VOICE = "volume_voice"; - field public static final java.lang.String WAIT_FOR_DEBUGGER = "wait_for_debugger"; - field public static final java.lang.String WALLPAPER_ACTIVITY = "wallpaper_activity"; + field public static final deprecated java.lang.String WAIT_FOR_DEBUGGER = "wait_for_debugger"; + field public static final deprecated java.lang.String WALLPAPER_ACTIVITY = "wallpaper_activity"; field public static final deprecated java.lang.String WIFI_MAX_DHCP_RETRY_COUNT = "wifi_max_dhcp_retry_count"; field public static final deprecated java.lang.String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS = "wifi_mobile_data_transition_wakelock_timeout_ms"; field public static final deprecated java.lang.String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON = "wifi_networks_available_notification_on"; field public static final deprecated java.lang.String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY = "wifi_networks_available_repeat_delay"; field public static final deprecated java.lang.String WIFI_NUM_OPEN_NETWORKS_KEPT = "wifi_num_open_networks_kept"; field public static final deprecated java.lang.String WIFI_ON = "wifi_on"; - field public static final java.lang.String WIFI_SLEEP_POLICY = "wifi_sleep_policy"; - field public static final int WIFI_SLEEP_POLICY_DEFAULT = 0; // 0x0 - field public static final int WIFI_SLEEP_POLICY_NEVER = 2; // 0x2 - field public static final int WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED = 1; // 0x1 - field public static final java.lang.String WIFI_STATIC_DNS1 = "wifi_static_dns1"; - field public static final java.lang.String WIFI_STATIC_DNS2 = "wifi_static_dns2"; - field public static final java.lang.String WIFI_STATIC_GATEWAY = "wifi_static_gateway"; - field public static final java.lang.String WIFI_STATIC_IP = "wifi_static_ip"; - field public static final java.lang.String WIFI_STATIC_NETMASK = "wifi_static_netmask"; - field public static final java.lang.String WIFI_USE_STATIC_IP = "wifi_use_static_ip"; + field public static final deprecated java.lang.String WIFI_SLEEP_POLICY = "wifi_sleep_policy"; + field public static final deprecated int WIFI_SLEEP_POLICY_DEFAULT = 0; // 0x0 + field public static final deprecated int WIFI_SLEEP_POLICY_NEVER = 2; // 0x2 + field public static final deprecated int WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED = 1; // 0x1 + field public static final deprecated java.lang.String WIFI_STATIC_DNS1 = "wifi_static_dns1"; + field public static final deprecated java.lang.String WIFI_STATIC_DNS2 = "wifi_static_dns2"; + field public static final deprecated java.lang.String WIFI_STATIC_GATEWAY = "wifi_static_gateway"; + field public static final deprecated java.lang.String WIFI_STATIC_IP = "wifi_static_ip"; + field public static final deprecated java.lang.String WIFI_STATIC_NETMASK = "wifi_static_netmask"; + field public static final deprecated java.lang.String WIFI_USE_STATIC_IP = "wifi_use_static_ip"; field public static final deprecated java.lang.String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE = "wifi_watchdog_acceptable_packet_loss_percentage"; field public static final deprecated java.lang.String WIFI_WATCHDOG_AP_COUNT = "wifi_watchdog_ap_count"; field public static final deprecated java.lang.String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS = "wifi_watchdog_background_check_delay_ms"; @@ -18564,7 +19050,7 @@ package android.provider { field public static final deprecated java.lang.String WIFI_WATCHDOG_PING_COUNT = "wifi_watchdog_ping_count"; field public static final deprecated java.lang.String WIFI_WATCHDOG_PING_DELAY_MS = "wifi_watchdog_ping_delay_ms"; field public static final deprecated java.lang.String WIFI_WATCHDOG_PING_TIMEOUT_MS = "wifi_watchdog_ping_timeout_ms"; - field public static final java.lang.String WINDOW_ANIMATION_SCALE = "window_animation_scale"; + field public static final deprecated java.lang.String WINDOW_ANIMATION_SCALE = "window_animation_scale"; } public class SyncStateContract { @@ -19546,6 +20032,8 @@ package android.renderscript { public class Script extends android.renderscript.BaseObj { method public void bindAllocation(android.renderscript.Allocation, int); + method protected android.renderscript.Script.FieldID createFieldID(int, android.renderscript.Element); + method protected android.renderscript.Script.KernelID createKernelID(int, int, android.renderscript.Element, android.renderscript.Element); method protected void forEach(int, android.renderscript.Allocation, android.renderscript.Allocation, android.renderscript.FieldPacker); method protected void invoke(int); method protected void invoke(int, android.renderscript.FieldPacker); @@ -19575,11 +20063,124 @@ package android.renderscript { field protected android.renderscript.Element mElement; } + public static final class Script.FieldID extends android.renderscript.BaseObj { + } + + public static final class Script.KernelID extends android.renderscript.BaseObj { + } + public class ScriptC extends android.renderscript.Script { ctor protected ScriptC(int, android.renderscript.RenderScript); ctor protected ScriptC(android.renderscript.RenderScript, android.content.res.Resources, int); } + public final class ScriptGroup extends android.renderscript.BaseObj { + method public void execute(); + method public void setInput(android.renderscript.Script.KernelID, android.renderscript.Allocation); + method public void setOutput(android.renderscript.Script.KernelID, android.renderscript.Allocation); + } + + public static final class ScriptGroup.Builder { + ctor public ScriptGroup.Builder(android.renderscript.RenderScript); + method public android.renderscript.ScriptGroup.Builder addConnection(android.renderscript.Type, android.renderscript.Script.KernelID, android.renderscript.Script.FieldID); + method public android.renderscript.ScriptGroup.Builder addConnection(android.renderscript.Type, android.renderscript.Script.KernelID, android.renderscript.Script.KernelID); + method public android.renderscript.ScriptGroup.Builder addKernel(android.renderscript.Script.KernelID); + method public android.renderscript.ScriptGroup create(); + } + + public abstract class ScriptIntrinsic extends android.renderscript.Script { + } + + public class ScriptIntrinsicBlend extends android.renderscript.ScriptIntrinsic { + method public static android.renderscript.ScriptIntrinsicBlend create(android.renderscript.RenderScript, android.renderscript.Element); + method public void forEachAdd(android.renderscript.Allocation, android.renderscript.Allocation); + method public void forEachClear(android.renderscript.Allocation, android.renderscript.Allocation); + method public void forEachDst(android.renderscript.Allocation, android.renderscript.Allocation); + method public void forEachDstAtop(android.renderscript.Allocation, android.renderscript.Allocation); + method public void forEachDstIn(android.renderscript.Allocation, android.renderscript.Allocation); + method public void forEachDstOut(android.renderscript.Allocation, android.renderscript.Allocation); + method public void forEachDstOver(android.renderscript.Allocation, android.renderscript.Allocation); + method public void forEachMultiply(android.renderscript.Allocation, android.renderscript.Allocation); + method public void forEachSrc(android.renderscript.Allocation, android.renderscript.Allocation); + method public void forEachSrcAtop(android.renderscript.Allocation, android.renderscript.Allocation); + method public void forEachSrcIn(android.renderscript.Allocation, android.renderscript.Allocation); + method public void forEachSrcOut(android.renderscript.Allocation, android.renderscript.Allocation); + method public void forEachSrcOver(android.renderscript.Allocation, android.renderscript.Allocation); + method public void forEachSubtract(android.renderscript.Allocation, android.renderscript.Allocation); + method public void forEachXor(android.renderscript.Allocation, android.renderscript.Allocation); + method public android.renderscript.Script.KernelID getKernelIDAdd(); + method public android.renderscript.Script.KernelID getKernelIDClear(); + method public android.renderscript.Script.KernelID getKernelIDDst(); + method public android.renderscript.Script.KernelID getKernelIDDstAtop(); + method public android.renderscript.Script.KernelID getKernelIDDstIn(); + method public android.renderscript.Script.KernelID getKernelIDDstOut(); + method public android.renderscript.Script.KernelID getKernelIDDstOver(); + method public android.renderscript.Script.KernelID getKernelIDMultiply(); + method public android.renderscript.Script.KernelID getKernelIDSrc(); + method public android.renderscript.Script.KernelID getKernelIDSrcAtop(); + method public android.renderscript.Script.KernelID getKernelIDSrcIn(); + method public android.renderscript.Script.KernelID getKernelIDSrcOut(); + method public android.renderscript.Script.KernelID getKernelIDSrcOver(); + method public android.renderscript.Script.KernelID getKernelIDSubtract(); + method public android.renderscript.Script.KernelID getKernelIDXor(); + } + + public final class ScriptIntrinsicBlur extends android.renderscript.ScriptIntrinsic { + method public static android.renderscript.ScriptIntrinsicBlur create(android.renderscript.RenderScript, android.renderscript.Element); + method public void forEach(android.renderscript.Allocation); + method public android.renderscript.Script.FieldID getFieldID_Input(); + method public android.renderscript.Script.KernelID getKernelID(); + method public void setInput(android.renderscript.Allocation); + method public void setRadius(float); + } + + public final class ScriptIntrinsicColorMatrix extends android.renderscript.ScriptIntrinsic { + method public static android.renderscript.ScriptIntrinsicColorMatrix create(android.renderscript.RenderScript, android.renderscript.Element); + method public void forEach(android.renderscript.Allocation, android.renderscript.Allocation); + method public android.renderscript.Script.KernelID getKernelID(); + method public void setColorMatrix(android.renderscript.Matrix4f); + method public void setColorMatrix(android.renderscript.Matrix3f); + method public void setGreyscale(); + method public void setRGBtoYUV(); + method public void setYUVtoRGB(); + } + + public final class ScriptIntrinsicConvolve3x3 extends android.renderscript.ScriptIntrinsic { + method public static android.renderscript.ScriptIntrinsicConvolve3x3 create(android.renderscript.RenderScript, android.renderscript.Element); + method public void forEach(android.renderscript.Allocation); + method public android.renderscript.Script.FieldID getFieldID_Input(); + method public android.renderscript.Script.KernelID getKernelID(); + method public void setCoefficients(float[]); + method public void setInput(android.renderscript.Allocation); + } + + public final class ScriptIntrinsicConvolve5x5 extends android.renderscript.ScriptIntrinsic { + method public static android.renderscript.ScriptIntrinsicConvolve5x5 create(android.renderscript.RenderScript, android.renderscript.Element); + method public void forEach(android.renderscript.Allocation); + method public android.renderscript.Script.FieldID getFieldID_Input(); + method public android.renderscript.Script.KernelID getKernelID(); + method public void setCoefficients(float[]); + method public void setInput(android.renderscript.Allocation); + } + + public final class ScriptIntrinsicLUT extends android.renderscript.ScriptIntrinsic { + method public static android.renderscript.ScriptIntrinsicLUT create(android.renderscript.RenderScript, android.renderscript.Element); + method public void forEach(android.renderscript.Allocation, android.renderscript.Allocation); + method public android.renderscript.Script.KernelID getKernelID(); + method public void setAlpha(int, int); + method public void setBlue(int, int); + method public void setGreen(int, int); + method public void setRed(int, int); + } + + public final class ScriptIntrinsicYuvToRGB extends android.renderscript.ScriptIntrinsic { + method public static android.renderscript.ScriptIntrinsicYuvToRGB create(android.renderscript.RenderScript, android.renderscript.Element); + method public void forEach(android.renderscript.Allocation); + method public android.renderscript.Script.FieldID getFieldID_Input(); + method public android.renderscript.Script.KernelID getKernelID(); + method public void setInput(android.renderscript.Allocation); + } + public class Short2 { ctor public Short2(); ctor public Short2(short, short); @@ -19706,6 +20307,54 @@ package android.security { } +package android.service.dreams { + + public class DreamService extends android.app.Service implements android.view.Window.Callback { + ctor public DreamService(); + method public void addContentView(android.view.View, android.view.ViewGroup.LayoutParams); + method public boolean dispatchGenericMotionEvent(android.view.MotionEvent); + method public boolean dispatchKeyEvent(android.view.KeyEvent); + method public boolean dispatchKeyShortcutEvent(android.view.KeyEvent); + method public boolean dispatchPopulateAccessibilityEvent(android.view.accessibility.AccessibilityEvent); + method public boolean dispatchTouchEvent(android.view.MotionEvent); + method public boolean dispatchTrackballEvent(android.view.MotionEvent); + method public android.view.View findViewById(int); + method public final void finish(); + method public android.view.Window getWindow(); + method public android.view.WindowManager getWindowManager(); + method public boolean isFullscreen(); + method public boolean isInteractive(); + method public boolean isScreenBright(); + method public void onActionModeFinished(android.view.ActionMode); + method public void onActionModeStarted(android.view.ActionMode); + method public void onAttachedToWindow(); + method public final android.os.IBinder onBind(android.content.Intent); + method public void onContentChanged(); + method public boolean onCreatePanelMenu(int, android.view.Menu); + method public android.view.View onCreatePanelView(int); + method public void onDetachedFromWindow(); + method public void onDreamingStarted(); + method public void onDreamingStopped(); + method public boolean onMenuItemSelected(int, android.view.MenuItem); + method public boolean onMenuOpened(int, android.view.Menu); + method public void onPanelClosed(int, android.view.Menu); + method public boolean onPreparePanel(int, android.view.View, android.view.Menu); + method public boolean onSearchRequested(); + method public void onWindowAttributesChanged(android.view.WindowManager.LayoutParams); + method public void onWindowFocusChanged(boolean); + method public android.view.ActionMode onWindowStartingActionMode(android.view.ActionMode.Callback); + method public void setContentView(int); + method public void setContentView(android.view.View); + method public void setContentView(android.view.View, android.view.ViewGroup.LayoutParams); + method public void setFullscreen(boolean); + method public void setInteractive(boolean); + method public void setScreenBright(boolean); + field public static final java.lang.String DREAM_META_DATA = "android.service.dream"; + field public static final java.lang.String SERVICE_INTERFACE = "android.service.dreams.DreamService"; + } + +} + package android.service.textservice { public abstract class SpellCheckerService extends android.app.Service { @@ -19992,12 +20641,123 @@ package android.speech.tts { package android.telephony { + public final class CellIdentityCdma implements android.os.Parcelable { + method public int describeContents(); + method public int getBasestationId(); + method public int getLatitude(); + method public int getLongitude(); + method public int getNetworkId(); + method public int getSystemId(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + } + + public final class CellIdentityGsm implements android.os.Parcelable { + method public int describeContents(); + method public int getCid(); + method public int getLac(); + method public int getMcc(); + method public int getMnc(); + method public int getPsc(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + } + + public final class CellIdentityLte implements android.os.Parcelable { + method public int describeContents(); + method public int getCi(); + method public int getMcc(); + method public int getMnc(); + method public int getPci(); + method public int getTac(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + } + + public abstract class CellInfo implements android.os.Parcelable { + method public int describeContents(); + method public long getTimeStamp(); + method public boolean isRegistered(); + method public abstract void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + } + + public final class CellInfoCdma extends android.telephony.CellInfo implements android.os.Parcelable { + method public android.telephony.CellIdentityCdma getCellIdentity(); + method public android.telephony.CellSignalStrengthCdma getCellSignalStrength(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + } + + public final class CellInfoGsm extends android.telephony.CellInfo implements android.os.Parcelable { + method public android.telephony.CellIdentityGsm getCellIdentity(); + method public android.telephony.CellSignalStrengthGsm getCellSignalStrength(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + } + + public final class CellInfoLte extends android.telephony.CellInfo implements android.os.Parcelable { + method public android.telephony.CellIdentityLte getCellIdentity(); + method public android.telephony.CellSignalStrengthLte getCellSignalStrength(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + } + public abstract class CellLocation { ctor public CellLocation(); method public static android.telephony.CellLocation getEmpty(); method public static void requestLocationUpdate(); } + public abstract class CellSignalStrength { + method public abstract boolean equals(java.lang.Object); + method public abstract int getAsuLevel(); + method public abstract int getDbm(); + method public abstract int getLevel(); + method public abstract int hashCode(); + } + + public final class CellSignalStrengthCdma extends android.telephony.CellSignalStrength implements android.os.Parcelable { + method public int describeContents(); + method public boolean equals(java.lang.Object); + method public int getAsuLevel(); + method public int getCdmaDbm(); + method public int getCdmaEcio(); + method public int getCdmaLevel(); + method public int getDbm(); + method public int getEvdoDbm(); + method public int getEvdoEcio(); + method public int getEvdoLevel(); + method public int getEvdoSnr(); + method public int getLevel(); + method public int hashCode(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + } + + public final class CellSignalStrengthGsm extends android.telephony.CellSignalStrength implements android.os.Parcelable { + method public int describeContents(); + method public boolean equals(java.lang.Object); + method public int getAsuLevel(); + method public int getDbm(); + method public int getLevel(); + method public int hashCode(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + } + + public final class CellSignalStrengthLte extends android.telephony.CellSignalStrength implements android.os.Parcelable { + method public int describeContents(); + method public boolean equals(java.lang.Object); + method public int getAsuLevel(); + method public int getDbm(); + method public int getLevel(); + method public int getTimingAdvance(); + method public int hashCode(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + } + public class NeighboringCellInfo implements android.os.Parcelable { ctor public deprecated NeighboringCellInfo(); ctor public deprecated NeighboringCellInfo(int, int); @@ -20070,6 +20830,7 @@ package android.telephony { ctor public PhoneStateListener(); method public void onCallForwardingIndicatorChanged(boolean); method public void onCallStateChanged(int, java.lang.String); + method public void onCellInfoChanged(java.util.List); method public void onCellLocationChanged(android.telephony.CellLocation); method public void onDataActivity(int); method public void onDataConnectionStateChanged(int); @@ -20080,6 +20841,7 @@ package android.telephony { method public void onSignalStrengthsChanged(android.telephony.SignalStrength); field public static final int LISTEN_CALL_FORWARDING_INDICATOR = 8; // 0x8 field public static final int LISTEN_CALL_STATE = 32; // 0x20 + field public static final int LISTEN_CELL_INFO = 1024; // 0x400 field public static final int LISTEN_CELL_LOCATION = 16; // 0x10 field public static final int LISTEN_DATA_ACTIVITY = 128; // 0x80 field public static final int LISTEN_DATA_CONNECTION_STATE = 64; // 0x40 @@ -20205,6 +20967,7 @@ package android.telephony { } public class TelephonyManager { + method public java.util.List getAllCellInfo(); method public int getCallState(); method public android.telephony.CellLocation getCellLocation(); method public int getDataActivity(); @@ -20282,6 +21045,7 @@ package android.telephony.cdma { public class CdmaCellLocation extends android.telephony.CellLocation { ctor public CdmaCellLocation(); ctor public CdmaCellLocation(android.os.Bundle); + method public static double convertQuartSecToDecDegrees(int); method public void fillInNotifierBundle(android.os.Bundle); method public int getBaseStationId(); method public int getBaseStationLatitude(); @@ -20724,6 +21488,8 @@ package android.test.mock { method public int checkUriPermission(android.net.Uri, int, int, int); method public int checkUriPermission(android.net.Uri, java.lang.String, java.lang.String, int, int, int); method public void clearWallpaper(); + method public android.content.Context createConfigurationContext(android.content.res.Configuration); + method public android.content.Context createDisplayContext(android.view.Display); method public android.content.Context createPackageContext(java.lang.String, int) throws android.content.pm.PackageManager.NameNotFoundException; method public java.lang.String[] databaseList(); method public boolean deleteDatabase(java.lang.String); @@ -20770,13 +21536,19 @@ package android.test.mock { method public android.content.Intent registerReceiver(android.content.BroadcastReceiver, android.content.IntentFilter); method public android.content.Intent registerReceiver(android.content.BroadcastReceiver, android.content.IntentFilter, java.lang.String, android.os.Handler); method public void removeStickyBroadcast(android.content.Intent); + method public void removeStickyBroadcastAsUser(android.content.Intent, android.os.UserHandle); method public void revokeUriPermission(android.net.Uri, int); method public void sendBroadcast(android.content.Intent); method public void sendBroadcast(android.content.Intent, java.lang.String); + method public void sendBroadcastAsUser(android.content.Intent, android.os.UserHandle); + method public void sendBroadcastAsUser(android.content.Intent, android.os.UserHandle, java.lang.String); method public void sendOrderedBroadcast(android.content.Intent, java.lang.String); method public void sendOrderedBroadcast(android.content.Intent, java.lang.String, android.content.BroadcastReceiver, android.os.Handler, int, java.lang.String, android.os.Bundle); + method public void sendOrderedBroadcastAsUser(android.content.Intent, android.os.UserHandle, java.lang.String, android.content.BroadcastReceiver, android.os.Handler, int, java.lang.String, android.os.Bundle); method public void sendStickyBroadcast(android.content.Intent); + method public void sendStickyBroadcastAsUser(android.content.Intent, android.os.UserHandle); method public void sendStickyOrderedBroadcast(android.content.Intent, android.content.BroadcastReceiver, android.os.Handler, int, java.lang.String, android.os.Bundle); + method public void sendStickyOrderedBroadcastAsUser(android.content.Intent, android.os.UserHandle, android.content.BroadcastReceiver, android.os.Handler, int, java.lang.String, android.os.Bundle); method public void setTheme(int); method public void setWallpaper(android.graphics.Bitmap) throws java.io.IOException; method public void setWallpaper(java.io.InputStream) throws java.io.IOException; @@ -20854,6 +21626,7 @@ package android.test.mock { method public int checkSignatures(int, int); method public void clearPackagePreferredActivities(java.lang.String); method public java.lang.String[] currentToCanonicalPackageNames(java.lang.String[]); + method public void extendVerificationTimeout(int, int, long); method public android.graphics.drawable.Drawable getActivityIcon(android.content.ComponentName) throws android.content.pm.PackageManager.NameNotFoundException; method public android.graphics.drawable.Drawable getActivityIcon(android.content.Intent) throws android.content.pm.PackageManager.NameNotFoundException; method public android.content.pm.ActivityInfo getActivityInfo(android.content.ComponentName, int) throws android.content.pm.PackageManager.NameNotFoundException; @@ -21422,6 +22195,7 @@ package android.text { method public static java.lang.CharSequence expandTemplate(java.lang.CharSequence, java.lang.CharSequence...); method public static int getCapsMode(java.lang.CharSequence, int, int); method public static void getChars(java.lang.CharSequence, int, int, char[], int); + method public static int getLayoutDirectionFromLocale(java.util.Locale); method public static int getOffsetAfter(java.lang.CharSequence, int); method public static int getOffsetBefore(java.lang.CharSequence, int); method public static java.lang.CharSequence getReverse(java.lang.CharSequence, int, int); @@ -21493,14 +22267,14 @@ package android.text.format { public class DateFormat { ctor public DateFormat(); - method public static final java.lang.CharSequence format(java.lang.CharSequence, long); - method public static final java.lang.CharSequence format(java.lang.CharSequence, java.util.Date); - method public static final java.lang.CharSequence format(java.lang.CharSequence, java.util.Calendar); - method public static final java.text.DateFormat getDateFormat(android.content.Context); - method public static final char[] getDateFormatOrder(android.content.Context); - method public static final java.text.DateFormat getLongDateFormat(android.content.Context); - method public static final java.text.DateFormat getMediumDateFormat(android.content.Context); - method public static final java.text.DateFormat getTimeFormat(android.content.Context); + method public static java.lang.CharSequence format(java.lang.CharSequence, long); + method public static java.lang.CharSequence format(java.lang.CharSequence, java.util.Date); + method public static java.lang.CharSequence format(java.lang.CharSequence, java.util.Calendar); + method public static java.text.DateFormat getDateFormat(android.content.Context); + method public static char[] getDateFormatOrder(android.content.Context); + method public static java.text.DateFormat getLongDateFormat(android.content.Context); + method public static java.text.DateFormat getMediumDateFormat(android.content.Context); + method public static java.text.DateFormat getTimeFormat(android.content.Context); method public static boolean is24HourFormat(android.content.Context); field public static final char AM_PM = 97; // 0x0061 'a' field public static final char CAPITAL_AM_PM = 65; // 0x0041 'A' @@ -21512,6 +22286,7 @@ package android.text.format { field public static final char MONTH = 77; // 0x004d 'M' field public static final char QUOTE = 39; // 0x0027 '\'' field public static final char SECONDS = 115; // 0x0073 's' + field public static final char STANDALONE_MONTH = 76; // 0x004c 'L' field public static final char TIME_ZONE = 122; // 0x007a 'z' field public static final char YEAR = 121; // 0x0079 'y' } @@ -21525,9 +22300,9 @@ package android.text.format { method public static java.lang.String formatElapsedTime(long); method public static java.lang.String formatElapsedTime(java.lang.StringBuilder, long); method public static final java.lang.CharSequence formatSameDayTime(long, long, int, int); - method public static java.lang.String getAMPMString(int); - method public static java.lang.String getDayOfWeekString(int, int); - method public static java.lang.String getMonthString(int, int); + method public static deprecated java.lang.String getAMPMString(int); + method public static deprecated java.lang.String getDayOfWeekString(int, int); + method public static deprecated java.lang.String getMonthString(int, int); method public static java.lang.CharSequence getRelativeDateTimeString(android.content.Context, long, long, long, int); method public static java.lang.CharSequence getRelativeTimeSpanString(long); method public static java.lang.CharSequence getRelativeTimeSpanString(long, long, long); @@ -21535,24 +22310,24 @@ package android.text.format { method public static java.lang.CharSequence getRelativeTimeSpanString(android.content.Context, long, boolean); method public static java.lang.CharSequence getRelativeTimeSpanString(android.content.Context, long); method public static boolean isToday(long); - field public static final java.lang.String ABBREV_MONTH_FORMAT = "%b"; + field public static final deprecated java.lang.String ABBREV_MONTH_FORMAT = "%b"; field public static final java.lang.String ABBREV_WEEKDAY_FORMAT = "%a"; field public static final long DAY_IN_MILLIS = 86400000L; // 0x5265c00L - field public static final int FORMAT_12HOUR = 64; // 0x40 - field public static final int FORMAT_24HOUR = 128; // 0x80 + field public static final deprecated int FORMAT_12HOUR = 64; // 0x40 + field public static final deprecated int FORMAT_24HOUR = 128; // 0x80 field public static final int FORMAT_ABBREV_ALL = 524288; // 0x80000 field public static final int FORMAT_ABBREV_MONTH = 65536; // 0x10000 field public static final int FORMAT_ABBREV_RELATIVE = 262144; // 0x40000 field public static final int FORMAT_ABBREV_TIME = 16384; // 0x4000 field public static final int FORMAT_ABBREV_WEEKDAY = 32768; // 0x8000 - field public static final int FORMAT_CAP_AMPM = 256; // 0x100 - field public static final int FORMAT_CAP_MIDNIGHT = 4096; // 0x1000 - field public static final int FORMAT_CAP_NOON = 1024; // 0x400 - field public static final int FORMAT_CAP_NOON_MIDNIGHT = 5120; // 0x1400 + field public static final deprecated int FORMAT_CAP_AMPM = 256; // 0x100 + field public static final deprecated int FORMAT_CAP_MIDNIGHT = 4096; // 0x1000 + field public static final deprecated int FORMAT_CAP_NOON = 1024; // 0x400 + field public static final deprecated int FORMAT_CAP_NOON_MIDNIGHT = 5120; // 0x1400 field public static final int FORMAT_NO_MIDNIGHT = 2048; // 0x800 field public static final int FORMAT_NO_MONTH_DAY = 32; // 0x20 field public static final int FORMAT_NO_NOON = 512; // 0x200 - field public static final int FORMAT_NO_NOON_MIDNIGHT = 2560; // 0xa00 + field public static final deprecated int FORMAT_NO_NOON_MIDNIGHT = 2560; // 0xa00 field public static final int FORMAT_NO_YEAR = 8; // 0x8 field public static final int FORMAT_NUMERIC_DATE = 131072; // 0x20000 field public static final int FORMAT_SHOW_DATE = 16; // 0x10 @@ -21561,12 +22336,12 @@ package android.text.format { field public static final int FORMAT_SHOW_YEAR = 4; // 0x4 field public static final deprecated int FORMAT_UTC = 8192; // 0x2000 field public static final long HOUR_IN_MILLIS = 3600000L; // 0x36ee80L - field public static final java.lang.String HOUR_MINUTE_24 = "%H:%M"; - field public static final int LENGTH_LONG = 10; // 0xa - field public static final int LENGTH_MEDIUM = 20; // 0x14 - field public static final int LENGTH_SHORT = 30; // 0x1e - field public static final int LENGTH_SHORTER = 40; // 0x28 - field public static final int LENGTH_SHORTEST = 50; // 0x32 + field public static final deprecated java.lang.String HOUR_MINUTE_24 = "%H:%M"; + field public static final deprecated int LENGTH_LONG = 10; // 0xa + field public static final deprecated int LENGTH_MEDIUM = 20; // 0x14 + field public static final deprecated int LENGTH_SHORT = 30; // 0x1e + field public static final deprecated int LENGTH_SHORTER = 40; // 0x28 + field public static final deprecated int LENGTH_SHORTEST = 50; // 0x32 field public static final long MINUTE_IN_MILLIS = 60000L; // 0xea60L field public static final java.lang.String MONTH_DAY_FORMAT = "%-d"; field public static final java.lang.String MONTH_FORMAT = "%B"; @@ -21577,8 +22352,8 @@ package android.text.format { field public static final java.lang.String YEAR_FORMAT = "%Y"; field public static final java.lang.String YEAR_FORMAT_TWO_DIGITS = "%g"; field public static final long YEAR_IN_MILLIS = 31449600000L; // 0x7528ad000L - field public static final int[] sameMonthTable; - field public static final int[] sameYearTable; + field public static final deprecated int[] sameMonthTable; + field public static final deprecated int[] sameYearTable; } public final class Formatter { @@ -22050,6 +22825,17 @@ package android.text.style { method public abstract void chooseHeight(java.lang.CharSequence, int, int, int, int, android.graphics.Paint.FontMetricsInt, android.text.TextPaint); } + public class LocaleSpan extends android.text.style.MetricAffectingSpan implements android.text.ParcelableSpan { + ctor public LocaleSpan(java.util.Locale); + ctor public LocaleSpan(android.os.Parcel); + method public int describeContents(); + method public java.util.Locale getLocale(); + method public int getSpanTypeId(); + method public void updateDrawState(android.text.TextPaint); + method public void updateMeasureState(android.text.TextPaint); + method public void writeToParcel(android.os.Parcel, int); + } + public class MaskFilterSpan extends android.text.style.CharacterStyle implements android.text.style.UpdateAppearance { ctor public MaskFilterSpan(android.graphics.MaskFilter); method public android.graphics.MaskFilter getMaskFilter(); @@ -22311,6 +23097,17 @@ package android.util { ctor public AndroidRuntimeException(java.lang.Exception); } + public class AtomicFile { + ctor public AtomicFile(java.io.File); + method public void delete(); + method public void failWrite(java.io.FileOutputStream); + method public void finishWrite(java.io.FileOutputStream); + method public java.io.File getBaseFile(); + method public java.io.FileInputStream openRead() throws java.io.FileNotFoundException; + method public byte[] readFully() throws java.io.IOException; + method public java.io.FileOutputStream startWrite() throws java.io.IOException; + } + public abstract interface AttributeSet { method public abstract boolean getAttributeBooleanValue(java.lang.String, java.lang.String, boolean); method public abstract boolean getAttributeBooleanValue(int, boolean); @@ -22378,6 +23175,7 @@ package android.util { public class DisplayMetrics { ctor public DisplayMetrics(); + method public boolean equals(android.util.DisplayMetrics); method public void setTo(android.util.DisplayMetrics); method public void setToDefaults(); field public static final int DENSITY_DEFAULT = 160; // 0xa0 @@ -22429,7 +23227,10 @@ package android.util { public class FloatMath { method public static float ceil(float); method public static float cos(float); + method public static float exp(float); method public static float floor(float); + method public static float hypot(float, float); + method public static float pow(float, float); method public static float sin(float); method public static float sqrt(float); } @@ -22559,6 +23360,7 @@ package android.util { method protected int sizeOf(K, V); method public final synchronized java.util.Map snapshot(); method public final synchronized java.lang.String toString(); + method public void trimToSize(int); } public final class MalformedJsonException extends java.io.IOException { @@ -22890,22 +23692,30 @@ package android.view { public class ContextThemeWrapper extends android.content.ContextWrapper { ctor public ContextThemeWrapper(); ctor public ContextThemeWrapper(android.content.Context, int); + method public void applyOverrideConfiguration(android.content.res.Configuration); 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 int getFlags(); method public deprecated int getHeight(); method public void getMetrics(android.util.DisplayMetrics); + method public java.lang.String getName(); 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(); method public void getSize(android.graphics.Point); method public deprecated int getWidth(); + method public boolean isValid(); field public static final int DEFAULT_DISPLAY = 0; // 0x0 + field public static final int FLAG_SECURE = 2; // 0x2 + field public static final int FLAG_SUPPORTS_PROTECTED_BUFFERS = 1; // 0x1 } public class DragEvent implements android.os.Parcelable { @@ -22977,8 +23787,12 @@ package android.view { public class Gravity { ctor public Gravity(); method public static void apply(int, int, int, android.graphics.Rect, android.graphics.Rect); + method public static void apply(int, int, int, android.graphics.Rect, android.graphics.Rect, int); method public static void apply(int, int, int, android.graphics.Rect, int, int, android.graphics.Rect); + method public static void apply(int, int, int, android.graphics.Rect, int, int, android.graphics.Rect, int); method public static void applyDisplay(int, android.graphics.Rect, android.graphics.Rect); + method public static void applyDisplay(int, android.graphics.Rect, android.graphics.Rect, int); + method public static int getAbsoluteGravity(int, int); method public static boolean isHorizontal(int); method public static boolean isVertical(int); field public static final int AXIS_CLIP = 8; // 0x8 @@ -23891,7 +24705,7 @@ package android.view { method public android.graphics.Canvas lockCanvas(android.graphics.Rect) throws java.lang.IllegalArgumentException, android.view.Surface.OutOfResourcesException; method public void readFromParcel(android.os.Parcel); method public void release(); - method public void unlockCanvas(android.graphics.Canvas); + method public deprecated void unlockCanvas(android.graphics.Canvas); method public void unlockCanvasAndPost(android.graphics.Canvas); method public void writeToParcel(android.os.Parcel, int); field public static final android.os.Parcelable.Creator CREATOR; @@ -23947,6 +24761,7 @@ package android.view { ctor public SurfaceView(android.content.Context, android.util.AttributeSet, int); method public boolean gatherTransparentRegion(android.graphics.Region); method public android.view.SurfaceHolder getHolder(); + method public void setSecure(boolean); method public void setZOrderMediaOverlay(boolean); method public void setZOrderOnTop(boolean); } @@ -24073,6 +24888,7 @@ package android.view { method protected boolean fitSystemWindows(android.graphics.Rect); method public android.view.View focusSearch(int); method public void forceLayout(); + method public static int generateViewId(); method public android.view.accessibility.AccessibilityNodeProvider getAccessibilityNodeProvider(); method public float getAlpha(); method public android.view.animation.Animation getAnimation(); @@ -24087,6 +24903,7 @@ package android.view { method public final android.content.Context getContext(); method protected android.view.ContextMenu.ContextMenuInfo getContextMenuInfo(); method public static int getDefaultSize(int, int); + method public android.view.Display getDisplay(); method public final int[] getDrawableState(); method public android.graphics.Bitmap getDrawingCache(); method public android.graphics.Bitmap getDrawingCache(boolean); @@ -24109,7 +24926,9 @@ package android.view { method public int getImportantForAccessibility(); method public boolean getKeepScreenOn(); method public android.view.KeyEvent.DispatcherState getKeyDispatcherState(); + method public int getLabelFor(); method public int getLayerType(); + method public int getLayoutDirection(); method public android.view.ViewGroup.LayoutParams getLayoutParams(); method public final int getLeft(); method protected float getLeftFadingEdgeStrength(); @@ -24133,8 +24952,10 @@ package android.view { method public android.view.View.OnFocusChangeListener getOnFocusChangeListener(); method public int getOverScrollMode(); method public int getPaddingBottom(); + method public int getPaddingEnd(); method public int getPaddingLeft(); method public int getPaddingRight(); + method public int getPaddingStart(); method public int getPaddingTop(); method public final android.view.ViewParent getParent(); method public android.view.ViewParent getParentForAccessibility(); @@ -24162,6 +24983,8 @@ package android.view { method public int getSystemUiVisibility(); method public java.lang.Object getTag(); method public java.lang.Object getTag(int); + method public int getTextAlignment(); + method public int getTextDirection(); method public final int getTop(); method protected float getTopFadingEdgeStrength(); method protected int getTopPaddingOffset(); @@ -24215,6 +25038,7 @@ package android.view { method public boolean isLongClickable(); method public boolean isOpaque(); method protected boolean isPaddingOffsetRequired(); + method public boolean isPaddingRelative(); method public boolean isPressed(); method public boolean isSaveEnabled(); method public boolean isSaveFromParentEnabled(); @@ -24264,6 +25088,7 @@ package android.view { method protected void onOverScrolled(int, int, boolean, boolean); method public void onPopulateAccessibilityEvent(android.view.accessibility.AccessibilityEvent); method protected void onRestoreInstanceState(android.os.Parcelable); + method public void onRtlPropertiesChanged(int); method protected android.os.Parcelable onSaveInstanceState(); method public void onScreenStateChanged(int); method protected void onScrollChanged(int, int, int, int); @@ -24344,7 +25169,10 @@ package android.view { method public void setId(int); method public void setImportantForAccessibility(int); method public void setKeepScreenOn(boolean); + method public void setLabelFor(int); + method public void setLayerPaint(android.graphics.Paint); method public void setLayerType(int, android.graphics.Paint); + method public void setLayoutDirection(int); method public void setLayoutParams(android.view.ViewGroup.LayoutParams); method public final void setLeft(int); method public void setLongClickable(boolean); @@ -24368,6 +25196,7 @@ package android.view { method public void setOnTouchListener(android.view.View.OnTouchListener); method public void setOverScrollMode(int); method public void setPadding(int, int, int, int); + method public void setPaddingRelative(int, int, int, int); method public void setPivotX(float); method public void setPivotY(float); method public void setPressed(boolean); @@ -24392,6 +25221,8 @@ package android.view { method public void setSystemUiVisibility(int); method public void setTag(java.lang.Object); method public void setTag(int, java.lang.Object); + method public void setTextAlignment(int); + method public void setTextDirection(int); method public final void setTop(int); method public void setTouchDelegate(android.view.TouchDelegate); method public void setTranslationX(float); @@ -24450,6 +25281,10 @@ package android.view { field public static final int LAYER_TYPE_HARDWARE = 2; // 0x2 field public static final int LAYER_TYPE_NONE = 0; // 0x0 field public static final int LAYER_TYPE_SOFTWARE = 1; // 0x1 + field public static final int LAYOUT_DIRECTION_INHERIT = 2; // 0x2 + field public static final int LAYOUT_DIRECTION_LOCALE = 3; // 0x3 + field public static final int LAYOUT_DIRECTION_LTR = 0; // 0x0 + field public static final int LAYOUT_DIRECTION_RTL = 1; // 0x1 field public static final int MEASURED_HEIGHT_STATE_SHIFT = 16; // 0x10 field public static final int MEASURED_SIZE_MASK = 16777215; // 0xffffff field public static final int MEASURED_STATE_MASK = -16777216; // 0xff000000 @@ -24500,8 +25335,19 @@ package android.view { field public static final int SYSTEM_UI_FLAG_LOW_PROFILE = 1; // 0x1 field public static final int SYSTEM_UI_FLAG_VISIBLE = 0; // 0x0 field public static final int SYSTEM_UI_LAYOUT_FLAGS = 1536; // 0x600 + field public static final int TEXT_ALIGNMENT_CENTER = 4; // 0x4 + field public static final int TEXT_ALIGNMENT_GRAVITY = 1; // 0x1 field public static final int TEXT_ALIGNMENT_INHERIT = 0; // 0x0 - field public static final int TEXT_ALIGNMENT_RESOLVED_DEFAULT = 131072; // 0x20000 + field public static final int TEXT_ALIGNMENT_TEXT_END = 3; // 0x3 + field public static final int TEXT_ALIGNMENT_TEXT_START = 2; // 0x2 + field public static final int TEXT_ALIGNMENT_VIEW_END = 6; // 0x6 + field public static final int TEXT_ALIGNMENT_VIEW_START = 5; // 0x5 + field public static final int TEXT_DIRECTION_ANY_RTL = 2; // 0x2 + field public static final int TEXT_DIRECTION_FIRST_STRONG = 1; // 0x1 + field public static final int TEXT_DIRECTION_INHERIT = 0; // 0x0 + field public static final int TEXT_DIRECTION_LOCALE = 5; // 0x5 + field public static final int TEXT_DIRECTION_LTR = 3; // 0x3 + field public static final int TEXT_DIRECTION_RTL = 4; // 0x4 field public static final android.util.Property TRANSLATION_X; field public static final android.util.Property TRANSLATION_Y; field protected static final java.lang.String VIEW_LOG_TAG = "View"; @@ -24805,6 +25651,7 @@ package android.view { ctor public ViewGroup.LayoutParams(android.content.Context, android.util.AttributeSet); ctor public ViewGroup.LayoutParams(int, int); ctor public ViewGroup.LayoutParams(android.view.ViewGroup.LayoutParams); + method public void resolveLayoutDirection(int); method protected void setBaseAttributes(android.content.res.TypedArray, int, int); field public static final deprecated int FILL_PARENT = -1; // 0xffffffff field public static final int MATCH_PARENT = -1; // 0xffffffff @@ -24819,6 +25666,13 @@ package android.view { ctor public ViewGroup.MarginLayoutParams(int, int); ctor public ViewGroup.MarginLayoutParams(android.view.ViewGroup.MarginLayoutParams); ctor public ViewGroup.MarginLayoutParams(android.view.ViewGroup.LayoutParams); + method public int getLayoutDirection(); + method public int getMarginEnd(); + method public int getMarginStart(); + method public boolean isMarginRelative(); + method public void setLayoutDirection(int); + method public void setMarginEnd(int); + method public void setMarginStart(int); method public void setMargins(int, int, int, int); field public int bottomMargin; field public int leftMargin; @@ -25095,6 +25949,11 @@ package android.view { ctor public WindowManager.BadTokenException(java.lang.String); } + public static class WindowManager.InvalidDisplayException extends java.lang.RuntimeException { + ctor public WindowManager.InvalidDisplayException(); + ctor public WindowManager.InvalidDisplayException(java.lang.String); + } + public static class WindowManager.LayoutParams extends android.view.ViewGroup.LayoutParams implements android.os.Parcelable { ctor public WindowManager.LayoutParams(); ctor public WindowManager.LayoutParams(int); @@ -25126,7 +25985,7 @@ package android.view { field public static final deprecated int FLAG_BLUR_BEHIND = 4; // 0x4 field public static final int FLAG_DIM_BEHIND = 2; // 0x2 field public static final int FLAG_DISMISS_KEYGUARD = 4194304; // 0x400000 - field public static final int FLAG_DITHER = 4096; // 0x1000 + field public static final deprecated int FLAG_DITHER = 4096; // 0x1000 field public static final int FLAG_FORCE_NOT_FULLSCREEN = 2048; // 0x800 field public static final int FLAG_FULLSCREEN = 1024; // 0x400 field public static final int FLAG_HARDWARE_ACCELERATED = 16777216; // 0x1000000 @@ -25249,9 +26108,13 @@ package android.view.accessibility { field public static final deprecated int MAX_TEXT_LENGTH = 500; // 0x1f4 field public static final int TYPES_ALL_MASK = -1; // 0xffffffff field public static final int TYPE_ANNOUNCEMENT = 16384; // 0x4000 + field public static final int TYPE_GESTURE_DETECTION_END = 524288; // 0x80000 + field public static final int TYPE_GESTURE_DETECTION_START = 262144; // 0x40000 field public static final int TYPE_NOTIFICATION_STATE_CHANGED = 64; // 0x40 field public static final int TYPE_TOUCH_EXPLORATION_GESTURE_END = 1024; // 0x400 field public static final int TYPE_TOUCH_EXPLORATION_GESTURE_START = 512; // 0x200 + field public static final int TYPE_TOUCH_INTERACTION_END = 2097152; // 0x200000 + field public static final int TYPE_TOUCH_INTERACTION_START = 1048576; // 0x100000 field public static final int TYPE_VIEW_ACCESSIBILITY_FOCUSED = 32768; // 0x8000 field public static final int TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED = 65536; // 0x10000 field public static final int TYPE_VIEW_CLICKED = 1; // 0x1 @@ -25304,6 +26167,8 @@ package android.view.accessibility { method public int getChildCount(); method public java.lang.CharSequence getClassName(); method public java.lang.CharSequence getContentDescription(); + method public android.view.accessibility.AccessibilityNodeInfo getLabelFor(); + method public android.view.accessibility.AccessibilityNodeInfo getLabeledBy(); method public int getMovementGranularities(); method public java.lang.CharSequence getPackageName(); method public android.view.accessibility.AccessibilityNodeInfo getParent(); @@ -25339,6 +26204,10 @@ package android.view.accessibility { method public void setEnabled(boolean); method public void setFocusable(boolean); method public void setFocused(boolean); + method public void setLabelFor(android.view.View); + method public void setLabelFor(android.view.View, int); + method public void setLabeledBy(android.view.View); + method public void setLabeledBy(android.view.View, int); method public void setLongClickable(boolean); method public void setMovementGranularities(int); method public void setPackageName(java.lang.CharSequence); @@ -25979,6 +26848,7 @@ package android.view.inputmethod { public abstract interface InputMethodSession { method public abstract void appPrivateCommand(java.lang.String, android.os.Bundle); + method public abstract void dispatchGenericMotionEvent(int, android.view.MotionEvent, android.view.inputmethod.InputMethodSession.EventCallback); method public abstract void dispatchKeyEvent(int, android.view.KeyEvent, android.view.inputmethod.InputMethodSession.EventCallback); method public abstract void dispatchTrackballEvent(int, android.view.MotionEvent, android.view.inputmethod.InputMethodSession.EventCallback); method public abstract void displayCompletions(android.view.inputmethod.CompletionInfo[]); @@ -25996,6 +26866,7 @@ package android.view.inputmethod { public final class InputMethodSubtype implements android.os.Parcelable { ctor public InputMethodSubtype(int, int, java.lang.String, java.lang.String, java.lang.String, boolean, boolean); + ctor public InputMethodSubtype(int, int, java.lang.String, java.lang.String, java.lang.String, boolean, boolean, int); method public boolean containsExtraValueKey(java.lang.String); method public int describeContents(); method public java.lang.CharSequence getDisplayName(android.content.Context, java.lang.String, android.content.pm.ApplicationInfo); @@ -26109,35 +26980,6 @@ package android.view.textservice { package android.webkit { - public final deprecated class CacheManager { - ctor public CacheManager(); - method public static deprecated boolean cacheDisabled(); - method public static deprecated boolean endCacheTransaction(); - method public static deprecated android.webkit.CacheManager.CacheResult getCacheFile(java.lang.String, java.util.Map); - method public static deprecated java.io.File getCacheFileBaseDir(); - method public static deprecated void saveCacheFile(java.lang.String, android.webkit.CacheManager.CacheResult); - method public static deprecated boolean startCacheTransaction(); - } - - public static deprecated class CacheManager.CacheResult { - ctor public CacheManager.CacheResult(); - method public java.lang.String getContentDisposition(); - method public long getContentLength(); - method public java.lang.String getETag(); - method public java.lang.String getEncoding(); - method public long getExpires(); - method public java.lang.String getExpiresString(); - method public int getHttpStatusCode(); - method public java.io.InputStream getInputStream(); - method public java.lang.String getLastModified(); - method public java.lang.String getLocalPath(); - method public java.lang.String getLocation(); - method public java.lang.String getMimeType(); - method public java.io.OutputStream getOutputStream(); - method public void setEncoding(java.lang.String); - method public void setInputStream(java.io.InputStream); - } - public class ConsoleMessage { ctor public ConsoleMessage(java.lang.String, java.lang.String, int, android.webkit.ConsoleMessage.MessageLevel); method public int lineNumber(); @@ -26207,6 +27049,9 @@ package android.webkit { method public boolean useHttpAuthUsernamePassword(); } + public abstract class JavascriptInterface implements java.lang.annotation.Annotation { + } + public class JsPromptResult extends android.webkit.JsResult { method public void confirm(java.lang.String); } @@ -26283,7 +27128,7 @@ package android.webkit { method public boolean onJsBeforeUnload(android.webkit.WebView, java.lang.String, java.lang.String, android.webkit.JsResult); method public boolean onJsConfirm(android.webkit.WebView, java.lang.String, java.lang.String, android.webkit.JsResult); method public boolean onJsPrompt(android.webkit.WebView, java.lang.String, java.lang.String, java.lang.String, android.webkit.JsPromptResult); - method public boolean onJsTimeout(); + method public deprecated boolean onJsTimeout(); method public void onProgressChanged(android.webkit.WebView, int); method public void onReachedMaxAppCacheSize(long, long, android.webkit.WebStorage.QuotaUpdater); method public void onReceivedIcon(android.webkit.WebView, android.graphics.Bitmap); @@ -26300,7 +27145,6 @@ package android.webkit { public class WebHistoryItem implements java.lang.Cloneable { method public android.graphics.Bitmap getFavicon(); - method public deprecated int getId(); method public java.lang.String getOriginalUrl(); method public java.lang.String getTitle(); method public java.lang.String getUrl(); @@ -26331,7 +27175,7 @@ package android.webkit { } public abstract class WebSettings { - method public boolean enableSmoothTransition(); + method public deprecated boolean enableSmoothTransition(); method public boolean getAllowContentAccess(); method public boolean getAllowFileAccess(); method public abstract boolean getAllowFileAccessFromFileURLs(); @@ -26346,6 +27190,7 @@ package android.webkit { method public synchronized int getDefaultFixedFontSize(); method public synchronized int getDefaultFontSize(); method public synchronized java.lang.String getDefaultTextEncodingName(); + method public static java.lang.String getDefaultUserAgent(android.content.Context); method public android.webkit.WebSettings.ZoomDensity getDefaultZoom(); method public boolean getDisplayZoomControls(); method public synchronized boolean getDomStorageEnabled(); @@ -26357,9 +27202,9 @@ package android.webkit { method public boolean getLightTouchEnabled(); method public boolean getLoadWithOverviewMode(); method public synchronized boolean getLoadsImagesAutomatically(); + method public boolean getMediaPlaybackRequiresUserGesture(); method public synchronized int getMinimumFontSize(); method public synchronized int getMinimumLogicalFontSize(); - method public deprecated boolean getNavDump(); method public synchronized android.webkit.WebSettings.PluginState getPluginState(); method public deprecated synchronized boolean getPluginsEnabled(); method public deprecated synchronized java.lang.String getPluginsPath(); @@ -26370,10 +27215,7 @@ package android.webkit { method public synchronized java.lang.String getStandardFontFamily(); method public deprecated synchronized android.webkit.WebSettings.TextSize getTextSize(); method public synchronized int getTextZoom(); - method public deprecated synchronized boolean getUseDoubleTree(); - method public deprecated boolean getUseWebViewBackgroundForOverscrollBackground(); method public synchronized boolean getUseWideViewPort(); - method public deprecated synchronized int getUserAgent(); method public synchronized java.lang.String getUserAgentString(); method public void setAllowContentAccess(boolean); method public void setAllowFileAccess(boolean); @@ -26395,7 +27237,7 @@ package android.webkit { method public void setDefaultZoom(android.webkit.WebSettings.ZoomDensity); method public void setDisplayZoomControls(boolean); method public synchronized void setDomStorageEnabled(boolean); - method public void setEnableSmoothTransition(boolean); + method public deprecated void setEnableSmoothTransition(boolean); method public synchronized void setFantasyFontFamily(java.lang.String); method public synchronized void setFixedFontFamily(java.lang.String); method public synchronized void setGeolocationDatabasePath(java.lang.String); @@ -26406,9 +27248,9 @@ package android.webkit { method public void setLightTouchEnabled(boolean); method public void setLoadWithOverviewMode(boolean); method public synchronized void setLoadsImagesAutomatically(boolean); + method public void setMediaPlaybackRequiresUserGesture(boolean); method public synchronized void setMinimumFontSize(int); method public synchronized void setMinimumLogicalFontSize(int); - method public deprecated void setNavDump(boolean); method public void setNeedInitialFocus(boolean); method public synchronized void setPluginState(android.webkit.WebSettings.PluginState); method public deprecated synchronized void setPluginsEnabled(boolean); @@ -26423,17 +27265,14 @@ package android.webkit { method public void setSupportZoom(boolean); method public deprecated synchronized void setTextSize(android.webkit.WebSettings.TextSize); method public synchronized void setTextZoom(int); - method public deprecated synchronized void setUseDoubleTree(boolean); - method public deprecated void setUseWebViewBackgroundForOverscrollBackground(boolean); method public synchronized void setUseWideViewPort(boolean); - method public deprecated synchronized void setUserAgent(int); method public synchronized void setUserAgentString(java.lang.String); method public synchronized boolean supportMultipleWindows(); method public boolean supportZoom(); field public static final int LOAD_CACHE_ELSE_NETWORK = 1; // 0x1 field public static final int LOAD_CACHE_ONLY = 3; // 0x3 field public static final int LOAD_DEFAULT = -1; // 0xffffffff - field public static final int LOAD_NORMAL = 0; // 0x0 + field public static final deprecated int LOAD_NORMAL = 0; // 0x0 field public static final int LOAD_NO_CACHE = 2; // 0x2 } @@ -26516,13 +27355,13 @@ package android.webkit { ctor public WebView(android.content.Context); ctor public WebView(android.content.Context, android.util.AttributeSet); ctor public WebView(android.content.Context, android.util.AttributeSet, int); - ctor public WebView(android.content.Context, android.util.AttributeSet, int, boolean); + ctor public deprecated WebView(android.content.Context, android.util.AttributeSet, int, boolean); method public void addJavascriptInterface(java.lang.Object, java.lang.String); method public boolean canGoBack(); method public boolean canGoBackOrForward(int); method public boolean canGoForward(); - method public boolean canZoomIn(); - method public boolean canZoomOut(); + method public deprecated boolean canZoomIn(); + method public deprecated boolean canZoomOut(); method public android.graphics.Picture capturePicture(); method public void clearCache(boolean); method public void clearFormData(); @@ -26531,12 +27370,8 @@ package android.webkit { method public void clearSslPreferences(); method public void clearView(); method public android.webkit.WebBackForwardList copyBackForwardList(); - method public deprecated void debugDump(); method public void destroy(); - method public static deprecated void disablePlatformNotifications(); method public void documentHasImages(android.os.Message); - method public deprecated void emulateShiftHeld(); - method public static deprecated void enablePlatformNotifications(); method public static java.lang.String findAddress(java.lang.String); method public deprecated int findAll(java.lang.String); method public void findAllAsync(java.lang.String); @@ -26550,11 +27385,10 @@ package android.webkit { method public java.lang.String[] getHttpAuthUsernamePassword(java.lang.String, java.lang.String); method public java.lang.String getOriginalUrl(); method public int getProgress(); - method public float getScale(); + method public deprecated float getScale(); method public android.webkit.WebSettings getSettings(); method public java.lang.String getTitle(); method public java.lang.String getUrl(); - method public deprecated int getVisibleTitleHeight(); method public void goBack(); method public void goBackOrForward(int); method public void goForward(); @@ -26579,21 +27413,19 @@ package android.webkit { method public void removeJavascriptInterface(java.lang.String); method public void requestFocusNodeHref(android.os.Message); method public void requestImageRef(android.os.Message); - method public deprecated boolean restorePicture(android.os.Bundle, java.io.File); method public android.webkit.WebBackForwardList restoreState(android.os.Bundle); method public void resumeTimers(); method public void savePassword(java.lang.String, java.lang.String, java.lang.String); - method public deprecated boolean savePicture(android.os.Bundle, java.io.File); method public android.webkit.WebBackForwardList saveState(android.os.Bundle); method public void saveWebArchive(java.lang.String); method public void saveWebArchive(java.lang.String, boolean, android.webkit.ValueCallback); - method public void setCertificate(android.net.http.SslCertificate); + method public deprecated void setCertificate(android.net.http.SslCertificate); method public void setDownloadListener(android.webkit.DownloadListener); method public void setFindListener(android.webkit.WebView.FindListener); method public void setHorizontalScrollbarOverlay(boolean); method public void setHttpAuthUsernamePassword(java.lang.String, java.lang.String, java.lang.String, java.lang.String); method public void setInitialScale(int); - method public void setMapTrackballToArrowKeys(boolean); + method public deprecated void setMapTrackballToArrowKeys(boolean); method public void setNetworkAvailable(boolean); method public deprecated void setPictureListener(android.webkit.WebView.PictureListener); method public void setVerticalScrollbarOverlay(boolean); @@ -26675,11 +27507,10 @@ package android.webkit { method public void clearFormData(); method public void clearHttpAuthUsernamePassword(); method public void clearUsernamePassword(); - method public static synchronized android.webkit.WebViewDatabase getInstance(android.content.Context); + method public static android.webkit.WebViewDatabase getInstance(android.content.Context); method public boolean hasFormData(); method public boolean hasHttpAuthUsernamePassword(); method public boolean hasUsernamePassword(); - field protected static final java.lang.String LOGTAG = "webviewdatabase"; } public class WebViewFragment extends android.app.Fragment { @@ -27043,13 +27874,19 @@ package android.widget { method public void setDropDownVerticalOffset(int); method public void setDropDownWidth(int); method public void setListSelection(int); + method public void setOnDismissListener(android.widget.AutoCompleteTextView.OnDismissListener); method public void setOnItemClickListener(android.widget.AdapterView.OnItemClickListener); method public void setOnItemSelectedListener(android.widget.AdapterView.OnItemSelectedListener); + method public void setText(java.lang.CharSequence, boolean); method public void setThreshold(int); method public void setValidator(android.widget.AutoCompleteTextView.Validator); method public void showDropDown(); } + public static abstract interface AutoCompleteTextView.OnDismissListener { + method public abstract void onDismiss(); + } + public static abstract interface AutoCompleteTextView.Validator { method public abstract java.lang.CharSequence fixText(java.lang.CharSequence); method public abstract boolean isValid(java.lang.CharSequence); @@ -27153,7 +27990,6 @@ package android.widget { ctor public CheckedTextView(android.content.Context, android.util.AttributeSet, int); method public android.graphics.drawable.Drawable getCheckMarkDrawable(); method public boolean isChecked(); - method public void onPaddingChanged(int); method public void setCheckMarkDrawable(int); method public void setCheckMarkDrawable(android.graphics.drawable.Drawable); method public void setChecked(boolean); @@ -27296,7 +28132,7 @@ package android.widget { field public static final int LETTERS_ONLY = 5; // 0x5 } - public class DigitalClock extends android.widget.TextView { + public deprecated class DigitalClock extends android.widget.TextView { ctor public DigitalClock(android.content.Context); ctor public DigitalClock(android.content.Context, android.util.AttributeSet); } @@ -28112,19 +28948,25 @@ package android.widget { field public static final int ABOVE = 2; // 0x2 field public static final int ALIGN_BASELINE = 4; // 0x4 field public static final int ALIGN_BOTTOM = 8; // 0x8 + field public static final int ALIGN_END = 19; // 0x13 field public static final int ALIGN_LEFT = 5; // 0x5 field public static final int ALIGN_PARENT_BOTTOM = 12; // 0xc + field public static final int ALIGN_PARENT_END = 21; // 0x15 field public static final int ALIGN_PARENT_LEFT = 9; // 0x9 field public static final int ALIGN_PARENT_RIGHT = 11; // 0xb + field public static final int ALIGN_PARENT_START = 20; // 0x14 field public static final int ALIGN_PARENT_TOP = 10; // 0xa field public static final int ALIGN_RIGHT = 7; // 0x7 + field public static final int ALIGN_START = 18; // 0x12 field public static final int ALIGN_TOP = 6; // 0x6 field public static final int BELOW = 3; // 0x3 field public static final int CENTER_HORIZONTAL = 14; // 0xe field public static final int CENTER_IN_PARENT = 13; // 0xd field public static final int CENTER_VERTICAL = 15; // 0xf + field public static final int END_OF = 17; // 0x11 field public static final int LEFT_OF = 0; // 0x0 field public static final int RIGHT_OF = 1; // 0x1 + field public static final int START_OF = 16; // 0x10 field public static final int TRUE = -1; // 0xffffffff } @@ -28137,6 +28979,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; } @@ -28170,6 +29013,7 @@ package android.widget { method public void setImageViewUri(int, android.net.Uri); method public void setInt(int, java.lang.String, int); method public void setIntent(int, java.lang.String, android.content.Intent); + method public void setLabelFor(int, int); method public void setLong(int, java.lang.String, long); method public void setOnClickFillInIntent(int, android.content.Intent); method public void setOnClickPendingIntent(int, android.app.PendingIntent); @@ -28438,7 +29282,7 @@ package android.widget { method public android.view.View newGroupView(boolean, android.view.ViewGroup); } - public class SlidingDrawer extends android.view.ViewGroup { + public deprecated class SlidingDrawer extends android.view.ViewGroup { ctor public SlidingDrawer(android.content.Context, android.util.AttributeSet); ctor public SlidingDrawer(android.content.Context, android.util.AttributeSet, int); method public void animateClose(); @@ -28641,6 +29485,21 @@ package android.widget { field public int span; } + public class TextClock extends android.widget.TextView { + ctor public TextClock(android.content.Context); + ctor public TextClock(android.content.Context, android.util.AttributeSet); + ctor public TextClock(android.content.Context, android.util.AttributeSet, int); + method public java.lang.CharSequence getFormat12Hour(); + method public java.lang.CharSequence getFormat24Hour(); + method public java.lang.String getTimeZone(); + method public boolean is24HourModeEnabled(); + method public void setFormat12Hour(java.lang.CharSequence); + method public void setFormat24Hour(java.lang.CharSequence); + method public void setTimeZone(java.lang.String); + field public static final java.lang.CharSequence DEFAULT_FORMAT_12_HOUR; + field public static final java.lang.CharSequence DEFAULT_FORMAT_24_HOUR; + } + public class TextSwitcher extends android.widget.ViewSwitcher { ctor public TextSwitcher(android.content.Context); ctor public TextSwitcher(android.content.Context, android.util.AttributeSet); @@ -28665,9 +29524,12 @@ package android.widget { method public final int getAutoLinkMask(); method public int getCompoundDrawablePadding(); method public android.graphics.drawable.Drawable[] getCompoundDrawables(); + method public android.graphics.drawable.Drawable[] getCompoundDrawablesRelative(); method public int getCompoundPaddingBottom(); + method public int getCompoundPaddingEnd(); method public int getCompoundPaddingLeft(); method public int getCompoundPaddingRight(); + method public int getCompoundPaddingStart(); method public int getCompoundPaddingTop(); method public final int getCurrentHintTextColor(); method public final int getCurrentTextColor(); @@ -28724,11 +29586,14 @@ package android.widget { method public static int getTextColor(android.content.Context, android.content.res.TypedArray, int); method public final android.content.res.ColorStateList getTextColors(); method public static android.content.res.ColorStateList getTextColors(android.content.Context, android.content.res.TypedArray); + method public java.util.Locale getTextLocale(); method public float getTextScaleX(); method public float getTextSize(); method public int getTotalPaddingBottom(); + method public int getTotalPaddingEnd(); method public int getTotalPaddingLeft(); method public int getTotalPaddingRight(); + method public int getTotalPaddingStart(); method public int getTotalPaddingTop(); method public final android.text.method.TransformationMethod getTransformationMethod(); method public android.graphics.Typeface getTypeface(); @@ -28753,12 +29618,13 @@ package android.widget { method protected void onTextChanged(java.lang.CharSequence, int, int, int); method public boolean onTextContextMenuItem(int); method public void removeTextChangedListener(android.text.TextWatcher); - method protected void resetResolvedDrawables(); - method protected void resolveDrawables(); method public void setAllCaps(boolean); method public final void setAutoLinkMask(int); method public void setCompoundDrawablePadding(int); method public void setCompoundDrawables(android.graphics.drawable.Drawable, android.graphics.drawable.Drawable, android.graphics.drawable.Drawable, android.graphics.drawable.Drawable); + method public void setCompoundDrawablesRelative(android.graphics.drawable.Drawable, android.graphics.drawable.Drawable, android.graphics.drawable.Drawable, android.graphics.drawable.Drawable); + method public void setCompoundDrawablesRelativeWithIntrinsicBounds(int, int, int, int); + method public void setCompoundDrawablesRelativeWithIntrinsicBounds(android.graphics.drawable.Drawable, android.graphics.drawable.Drawable, android.graphics.drawable.Drawable, android.graphics.drawable.Drawable); method public void setCompoundDrawablesWithIntrinsicBounds(int, int, int, int); method public void setCompoundDrawablesWithIntrinsicBounds(android.graphics.drawable.Drawable, android.graphics.drawable.Drawable, android.graphics.drawable.Drawable, android.graphics.drawable.Drawable); method public void setCursorVisible(boolean); @@ -28802,7 +29668,6 @@ package android.widget { method public void setMinWidth(int); method public final void setMovementMethod(android.text.method.MovementMethod); method public void setOnEditorActionListener(android.widget.TextView.OnEditorActionListener); - method public void setPaddingRelative(int, int, int, int); method public void setPaintFlags(int); method public void setPrivateImeOptions(java.lang.String); method public void setRawInputType(int); @@ -28823,6 +29688,7 @@ package android.widget { method public void setTextIsSelectable(boolean); method public final void setTextKeepState(java.lang.CharSequence); method public final void setTextKeepState(java.lang.CharSequence, android.widget.TextView.BufferType); + method public void setTextLocale(java.util.Locale); method public void setTextScaleX(float); method public void setTextSize(float); method public void setTextSize(int, float); @@ -28898,7 +29764,7 @@ package android.widget { method public void setTextOn(java.lang.CharSequence); } - public class TwoLineListItem extends android.widget.RelativeLayout { + public deprecated class TwoLineListItem extends android.widget.RelativeLayout { ctor public TwoLineListItem(android.content.Context); ctor public TwoLineListItem(android.content.Context, android.util.AttributeSet); ctor public TwoLineListItem(android.content.Context, android.util.AttributeSet, int); @@ -28924,6 +29790,7 @@ package android.widget { method public void setMediaController(android.widget.MediaController); method public void setOnCompletionListener(android.media.MediaPlayer.OnCompletionListener); method public void setOnErrorListener(android.media.MediaPlayer.OnErrorListener); + method public void setOnInfoListener(android.media.MediaPlayer.OnInfoListener); method public void setOnPreparedListener(android.media.MediaPlayer.OnPreparedListener); method public void setVideoPath(java.lang.String); method public void setVideoURI(android.net.Uri); @@ -28935,6 +29802,7 @@ package android.widget { public class ViewAnimator extends android.widget.FrameLayout { ctor public ViewAnimator(android.content.Context); ctor public ViewAnimator(android.content.Context, android.util.AttributeSet); + method public boolean getAnimateFirstView(); method public android.view.View getCurrentView(); method public int getDisplayedChild(); method public android.view.animation.Animation getInAnimation(); diff --git a/cmds/am/src/com/android/commands/am/Am.java b/cmds/am/src/com/android/commands/am/Am.java index 54b5836c99315..add7a23e41387 100644 --- a/cmds/am/src/com/android/commands/am/Am.java +++ b/cmds/am/src/com/android/commands/am/Am.java @@ -31,13 +31,14 @@ import android.content.pm.IPackageManager; import android.content.pm.ResolveInfo; import android.net.Uri; -import android.os.Binder; import android.os.Bundle; import android.os.ParcelFileDescriptor; import android.os.RemoteException; import android.os.ServiceManager; import android.os.SystemProperties; +import android.os.UserHandle; import android.util.AndroidException; +import android.view.Display; import android.view.IWindowManager; import java.io.BufferedReader; @@ -62,7 +63,7 @@ public class Am { private boolean mStopOption = false; private int mRepeat = 0; - private int mUserId = 0; + private int mUserId; private String mProfileFile; @@ -126,24 +127,42 @@ private void run(String[] args) throws Exception { runSetDebugApp(); } else if (op.equals("clear-debug-app")) { runClearDebugApp(); + } else if (op.equals("bug-report")) { + runBugReport(); } else if (op.equals("monitor")) { runMonitor(); } else if (op.equals("screen-compat")) { runScreenCompat(); } else if (op.equals("display-size")) { runDisplaySize(); + } else if (op.equals("display-density")) { + runDisplayDensity(); } else if (op.equals("to-uri")) { runToUri(false); } else if (op.equals("to-intent-uri")) { runToUri(true); } else if (op.equals("switch-user")) { runSwitchUser(); + } else if (op.equals("stop-user")) { + runStopUser(); } else { throw new IllegalArgumentException("Unknown command: " + op); } } - private Intent makeIntent() throws URISyntaxException { + int parseUserArg(String arg) { + int userId; + if ("all".equals(arg)) { + userId = UserHandle.USER_ALL; + } else if ("current".equals(arg) || "cur".equals(arg)) { + userId = UserHandle.USER_CURRENT; + } else { + userId = Integer.parseInt(arg); + } + return userId; + } + + private Intent makeIntent(int defUser) throws URISyntaxException { Intent intent = new Intent(); Intent baseIntent = intent; boolean hasIntentInfo = false; @@ -153,7 +172,7 @@ private Intent makeIntent() throws URISyntaxException { mStopOption = false; mRepeat = 0; mProfileFile = null; - mUserId = 0; + mUserId = defUser; Uri data = null; String type = null; @@ -317,10 +336,9 @@ private Intent makeIntent() throws URISyntaxException { } else if (opt.equals("--opengl-trace")) { mStartFlags |= ActivityManager.START_FLAG_OPENGL_TRACES; } else if (opt.equals("--user")) { - mUserId = Integer.parseInt(nextArgRequired()); + mUserId = parseUserArg(nextArgRequired()); } else { System.err.println("Error: Unknown option: " + opt); - showUsage(); return null; } } @@ -388,21 +406,34 @@ private Intent makeIntent() throws URISyntaxException { } private void runStartService() throws Exception { - Intent intent = makeIntent(); + Intent intent = makeIntent(UserHandle.USER_CURRENT); + if (mUserId == UserHandle.USER_ALL) { + System.err.println("Error: Can't start activity with user 'all'"); + return; + } System.out.println("Starting service: " + intent); - ComponentName cn = mAm.startService(null, intent, intent.getType()); + ComponentName cn = mAm.startService(null, intent, intent.getType(), mUserId); if (cn == null) { System.err.println("Error: Not found; no service started."); + } else if (cn.getPackageName().equals("!")) { + System.err.println("Error: Requires permission " + cn.getClassName()); + } else if (cn.getPackageName().equals("!!")) { + System.err.println("Error: " + cn.getClassName()); } } private void runStart() throws Exception { - Intent intent = makeIntent(); + Intent intent = makeIntent(UserHandle.USER_CURRENT); + + if (mUserId == UserHandle.USER_ALL) { + System.err.println("Error: Can't start service with user 'all'"); + return; + } String mimeType = intent.getType(); if (mimeType == null && intent.getData() != null && "content".equals(intent.getData().getScheme())) { - mimeType = mAm.getProviderMimeType(intent.getData()); + mimeType = mAm.getProviderMimeType(intent.getData(), mUserId); } do { @@ -431,7 +462,7 @@ private void runStart() throws Exception { packageName = activities.get(0).activityInfo.packageName; } System.out.println("Stopping: " + packageName); - mAm.forceStopPackage(packageName); + mAm.forceStopPackage(packageName, mUserId); Thread.sleep(250); } @@ -457,11 +488,11 @@ private void runStart() throws Exception { int res; if (mWaitOption) { result = mAm.startActivityAndWait(null, intent, mimeType, - null, null, 0, mStartFlags, mProfileFile, fd, null); + null, null, 0, mStartFlags, mProfileFile, fd, null, mUserId); res = result.result; } else { - res = mAm.startActivity(null, intent, mimeType, - null, null, 0, mStartFlags, mProfileFile, fd, null); + res = mAm.startActivityAsUser(null, intent, mimeType, + null, null, 0, mStartFlags, mProfileFile, fd, null, mUserId); } PrintStream out = mWaitOption ? System.out : System.err; boolean launched = false; @@ -545,11 +576,33 @@ private void runStart() throws Exception { } private void runForceStop() throws Exception { - mAm.forceStopPackage(nextArgRequired()); + int userId = UserHandle.USER_ALL; + + String opt; + while ((opt=nextOption()) != null) { + if (opt.equals("--user")) { + userId = parseUserArg(nextArgRequired()); + } else { + System.err.println("Error: Unknown option: " + opt); + return; + } + } + mAm.forceStopPackage(nextArgRequired(), userId); } private void runKill() throws Exception { - mAm.killBackgroundProcesses(nextArgRequired()); + int userId = UserHandle.USER_ALL; + + String opt; + while ((opt=nextOption()) != null) { + if (opt.equals("--user")) { + userId = parseUserArg(nextArgRequired()); + } else { + System.err.println("Error: Unknown option: " + opt); + return; + } + } + mAm.killBackgroundProcesses(nextArgRequired(), userId); } private void runKillAll() throws Exception { @@ -557,7 +610,7 @@ private void runKillAll() throws Exception { } private void sendBroadcast() throws Exception { - Intent intent = makeIntent(); + Intent intent = makeIntent(UserHandle.USER_ALL); IntentReceiver receiver = new IntentReceiver(); System.out.println("Broadcasting: " + intent); mAm.broadcastIntent(null, intent, null, receiver, 0, null, null, null, true, false, @@ -570,6 +623,7 @@ private void runInstrument() throws Exception { boolean wait = false; boolean rawMode = false; boolean no_window_animation = false; + int userId = UserHandle.USER_CURRENT; Bundle args = new Bundle(); String argKey = null, argValue = null; IWindowManager wm = IWindowManager.Stub.asInterface(ServiceManager.getService("window")); @@ -589,13 +643,19 @@ private void runInstrument() throws Exception { } else if (opt.equals("--no_window_animation") || opt.equals("--no-window-animation")) { no_window_animation = true; + } else if (opt.equals("--user")) { + userId = parseUserArg(nextArgRequired()); } else { System.err.println("Error: Unknown option: " + opt); - showUsage(); return; } } + if (userId == UserHandle.USER_ALL) { + System.err.println("Error: Can't start instrumentation with user 'all'"); + return; + } + String cnArg = nextArgRequired(); ComponentName cn = ComponentName.unflattenFromString(cnArg); if (cn == null) throw new IllegalArgumentException("Bad component name: " + cnArg); @@ -612,7 +672,7 @@ private void runInstrument() throws Exception { wm.setAnimationScale(1, 0.0f); } - if (!mAm.startInstrumentation(cn, profileFile, 0, args, watcher)) { + if (!mAm.startInstrumentation(cn, profileFile, 0, args, watcher, userId)) { throw new AndroidException("INSTRUMENTATION_FAILED: " + cn.flattenToString()); } @@ -640,17 +700,37 @@ private void runProfile() throws Exception { String profileFile = null; boolean start = false; boolean wall = false; + int userId = UserHandle.USER_CURRENT; int profileType = 0; - + String process = null; - + String cmd = nextArgRequired(); if ("start".equals(cmd)) { start = true; - wall = "--wall".equals(nextOption()); + String opt; + while ((opt=nextOption()) != null) { + if (opt.equals("--user")) { + userId = parseUserArg(nextArgRequired()); + } else if (opt.equals("--wall")) { + wall = true; + } else { + System.err.println("Error: Unknown option: " + opt); + return; + } + } process = nextArgRequired(); } else if ("stop".equals(cmd)) { + String opt; + while ((opt=nextOption()) != null) { + if (opt.equals("--user")) { + userId = parseUserArg(nextArgRequired()); + } else { + System.err.println("Error: Unknown option: " + opt); + return; + } + } process = nextArg(); } else { // Compatibility with old syntax: process is specified first. @@ -662,7 +742,12 @@ private void runProfile() throws Exception { throw new IllegalArgumentException("Profile command " + process + " not valid"); } } - + + if (userId == UserHandle.USER_ALL) { + System.err.println("Error: Can't profile with user 'all'"); + return; + } + ParcelFileDescriptor fd = null; if (start) { @@ -690,7 +775,7 @@ private void runProfile() throws Exception { } else if (start) { //removeWallOption(); } - if (!mAm.profileControl(process, start, profileFile, fd, profileType)) { + if (!mAm.profileControl(process, userId, start, profileFile, fd, profileType)) { wall = false; throw new AndroidException("PROFILE FAILED on process " + process); } @@ -702,14 +787,32 @@ private void runProfile() throws Exception { } private void runDumpHeap() throws Exception { - boolean managed = !"-n".equals(nextOption()); + boolean managed = true; + int userId = UserHandle.USER_CURRENT; + + String opt; + while ((opt=nextOption()) != null) { + if (opt.equals("--user")) { + userId = parseUserArg(nextArgRequired()); + if (userId == UserHandle.USER_ALL) { + System.err.println("Error: Can't dump heap with user 'all'"); + return; + } + } else if (opt.equals("-n")) { + managed = false; + } else { + System.err.println("Error: Unknown option: " + opt); + return; + } + } String process = nextArgRequired(); String heapFile = nextArgRequired(); ParcelFileDescriptor fd = null; try { - fd = ParcelFileDescriptor.open( - new File(heapFile), + File file = new File(heapFile); + file.delete(); + fd = ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_CREATE | ParcelFileDescriptor.MODE_TRUNCATE | ParcelFileDescriptor.MODE_READ_WRITE); @@ -718,7 +821,7 @@ private void runDumpHeap() throws Exception { return; } - if (!mAm.dumpHeap(process, managed, heapFile, fd)) { + if (!mAm.dumpHeap(process, userId, managed, heapFile, fd)) { throw new AndroidException("HEAP DUMP FAILED on process " + process); } } @@ -735,7 +838,6 @@ private void runSetDebugApp() throws Exception { persistent = true; } else { System.err.println("Error: Unknown option: " + opt); - showUsage(); return; } } @@ -748,14 +850,33 @@ private void runClearDebugApp() throws Exception { mAm.setDebugApp(null, false, true); } + private void runBugReport() throws Exception { + mAm.requestBugReport(); + System.out.println("Your lovely bug report is being created; please be patient."); + } + private void runSwitchUser() throws Exception { - if (android.os.Process.myUid() != 0) { - throw new RuntimeException("switchuser can only be run as root"); - } String user = nextArgRequired(); mAm.switchUser(Integer.parseInt(user)); } + private void runStopUser() throws Exception { + String user = nextArgRequired(); + int res = mAm.stopUser(Integer.parseInt(user), null); + if (res != ActivityManager.USER_OP_SUCCESS) { + String txt = ""; + switch (res) { + case ActivityManager.USER_OP_IS_CURRENT: + txt = " (Can't stop current user)"; + break; + case ActivityManager.USER_OP_UNKNOWN_USER: + txt = " (Unknown user " + user + ")"; + break; + } + System.err.println("Switch failed: " + res + txt); + } + } + class MyActivityController extends IActivityController.Stub { final String mGdbPort; @@ -1044,7 +1165,6 @@ private void runMonitor() throws Exception { gdbPort = nextArgRequired(); } else { System.err.println("Error: Unknown option: " + opt); - showUsage(); return; } } @@ -1062,7 +1182,6 @@ private void runScreenCompat() throws Exception { enabled = false; } else { System.err.println("Error: enabled mode must be 'on' or 'off' at " + mode); - showUsage(); return; } @@ -1080,32 +1199,60 @@ private void runScreenCompat() throws Exception { private void runDisplaySize() throws Exception { String size = nextArgRequired(); - int m, n; + int w, h; if ("reset".equals(size)) { - m = n = -1; + w = h = -1; } else { int div = size.indexOf('x'); if (div <= 0 || div >= (size.length()-1)) { System.err.println("Error: bad size " + size); - showUsage(); return; } - String mstr = size.substring(0, div); - String nstr = size.substring(div+1); + String wstr = size.substring(0, div); + String hstr = size.substring(div+1); try { - m = Integer.parseInt(mstr); - n = Integer.parseInt(nstr); + w = Integer.parseInt(wstr); + h = Integer.parseInt(hstr); } catch (NumberFormatException e) { System.err.println("Error: bad number " + e); - showUsage(); return; } } - if (m < n) { - int tmp = m; - m = n; - n = tmp; + IWindowManager wm = IWindowManager.Stub.asInterface(ServiceManager.checkService( + Context.WINDOW_SERVICE)); + if (wm == null) { + System.err.println(NO_SYSTEM_ERROR_CODE); + throw new AndroidException("Can't connect to window manager; is the system running?"); + } + + try { + if (w >= 0 && h >= 0) { + // TODO(multidisplay): For now Configuration only applies to main screen. + wm.setForcedDisplaySize(Display.DEFAULT_DISPLAY, w, h); + } else { + wm.clearForcedDisplaySize(Display.DEFAULT_DISPLAY); + } + } catch (RemoteException e) { + } + } + + private void runDisplayDensity() throws Exception { + String densityStr = nextArgRequired(); + int density; + if ("reset".equals(densityStr)) { + density = -1; + } else { + try { + density = Integer.parseInt(densityStr); + } catch (NumberFormatException e) { + System.err.println("Error: bad number " + e); + return; + } + if (density < 72) { + System.err.println("Error: density must be >= 72"); + return; + } } IWindowManager wm = IWindowManager.Stub.asInterface(ServiceManager.checkService( @@ -1116,32 +1263,35 @@ private void runDisplaySize() throws Exception { } try { - if (m >= 0 && n >= 0) { - wm.setForcedDisplaySize(m, n); + if (density > 0) { + // TODO(multidisplay): For now Configuration only applies to main screen. + wm.setForcedDisplayDensity(Display.DEFAULT_DISPLAY, density); } else { - wm.clearForcedDisplaySize(); + wm.clearForcedDisplayDensity(Display.DEFAULT_DISPLAY); } } catch (RemoteException e) { } } private void runToUri(boolean intentScheme) throws Exception { - Intent intent = makeIntent(); + Intent intent = makeIntent(UserHandle.USER_CURRENT); System.out.println(intent.toUri(intentScheme ? Intent.URI_INTENT_SCHEME : 0)); } private class IntentReceiver extends IIntentReceiver.Stub { private boolean mFinished = false; - public synchronized void performReceive( - Intent intent, int rc, String data, Bundle ext, boolean ord, - boolean sticky) { - String line = "Broadcast completed: result=" + rc; + @Override + public void performReceive(Intent intent, int resultCode, String data, Bundle extras, + boolean ordered, boolean sticky, int sendingUser) throws RemoteException { + String line = "Broadcast completed: result=" + resultCode; if (data != null) line = line + ", data=\"" + data + "\""; - if (ext != null) line = line + ", extras: " + ext; + if (extras != null) line = line + ", extras: " + extras; System.out.println(line); - mFinished = true; - notifyAll(); + synchronized (this) { + mFinished = true; + notifyAll(); + } } public synchronized void waitForFinish() { @@ -1283,24 +1433,29 @@ private static void showUsage() { System.err.println( "usage: am [subcommand] [options]\n" + "usage: am start [-D] [-W] [-P ] [--start-profiler ]\n" + - " [--R COUNT] [-S] [--opengl-trace] \n" + - " am startservice \n" + - " am force-stop \n" + - " am kill \n" + + " [--R COUNT] [-S] [--opengl-trace]\n" + + " [--user | current] \n" + + " am startservice [--user | current] \n" + + " am force-stop [--user | all | current] \n" + + " am kill [--user | all | current] \n" + " am kill-all\n" + - " am broadcast \n" + + " am broadcast [--user | all | current] \n" + " am instrument [-r] [-e ] [-p ] [-w]\n" + + " [--user | current]\n" + " [--no-window-animation] \n" + - " am profile start \n" + - " am profile stop []\n" + - " am dumpheap [flags] \n" + + " am profile start [--user current] \n" + + " am profile stop [--user current] []\n" + + " am dumpheap [--user current] [-n] \n" + " am set-debug-app [-w] [--persistent] \n" + " am clear-debug-app\n" + " am monitor [--gdb ]\n" + " am screen-compat [on|off] \n" + - " am display-size [reset|MxN]\n" + + " am display-size [reset|WxH]\n" + + " am display-density [reset|DENSITY]\n" + " am to-uri [INTENT]\n" + " am to-intent-uri [INTENT]\n" + + " am switch-user \n" + + " am stop-user \n" + "\n" + "am start: start an Activity. Options are:\n" + " -D: enable debugging\n" + @@ -1311,18 +1466,28 @@ private static void showUsage() { " the top activity will be finished.\n" + " -S: force stop the target app before starting the activity\n" + " --opengl-trace: enable tracing of OpenGL functions\n" + + " --user | current: Specify which user to run as; if not\n" + + " specified then run as the current user.\n" + "\n" + - "am startservice: start a Service.\n" + + "am startservice: start a Service. Options are:\n" + + " --user | current: Specify which user to run as; if not\n" + + " specified then run as the current user.\n" + "\n" + "am force-stop: force stop everything associated with .\n" + + " --user | all | current: Specify user to force stop;\n" + + " all users if not specified.\n" + "\n" + "am kill: Kill all processes associated with . Only kills.\n" + " processes that are safe to kill -- that is, will not impact the user\n" + " experience.\n" + + " --user | all | current: Specify user whose processes to kill;\n" + + " all users if not specified.\n" + "\n" + "am kill-all: Kill all background processes.\n" + "\n" + - "am broadcast: send a broadcast Intent.\n" + + "am broadcast: send a broadcast Intent. Options are:\n" + + " --user | all | current: Specify which user to send to; if not\n" + + " specified then send to all users.\n" + "\n" + "am instrument: start an Instrumentation. Typically this target \n" + " is the form /. Options are:\n" + @@ -1333,12 +1498,20 @@ private static void showUsage() { " -p : write profiling data to \n" + " -w: wait for instrumentation to finish before returning. Required for\n" + " test runners.\n" + + " --user | current: Specify user instrumentation runs in;\n" + + " current user if not specified.\n" + " --no-window-animation: turn off window animations will running.\n" + "\n" + - "am profile: start and stop profiler on a process.\n" + + "am profile: start and stop profiler on a process. The given argument\n" + + " may be either a process name or pid. Options are:\n" + + " --user | current: When supplying a process name,\n" + + " specify user of process to profile; uses current user if not specified.\n" + "\n" + - "am dumpheap: dump the heap of a process. Options are:\n" + + "am dumpheap: dump the heap of a process. The given argument may\n" + + " be either a process name or pid. Options are:\n" + " -n: dump native heap instead of managed heap\n" + + " --user | current: When supplying a process name,\n" + + " specify user of process to dump; uses current user if not specified.\n" + "\n" + "am set-debug-app: set application to debug. Options are:\n" + " -w: wait for debugger when application starts\n" + @@ -1346,6 +1519,9 @@ private static void showUsage() { "\n" + "am clear-debug-app: clear the previously set-debug-app.\n" + "\n" + + "am bug-report: request bug report generation; will launch UI\n" + + " when done to select where it should be delivered." + + "\n" + "am monitor: start monitoring for crashes or ANRs.\n" + " --gdb: start gdbserv on the given port at crash/ANR\n" + "\n" + @@ -1353,10 +1529,18 @@ private static void showUsage() { "\n" + "am display-size: override display size.\n" + "\n" + + "am display-density: override display density.\n" + + "\n" + "am to-uri: print the given Intent specification as a URI.\n" + "\n" + "am to-intent-uri: print the given Intent specification as an intent: URI.\n" + "\n" + + "am switch-user: switch to put USER_ID in the foreground, starting\n" + + " execution of that user if it is currently stopped.\n" + + "\n" + + "am stop-user: stop execution of USER_ID, not allowing it to run any\n" + + " code until a later explicit switch to it.\n" + + "\n" + " specifications include these flags and arguments:\n" + " [-a ] [-d ] [-t ]\n" + " [-c [-c ] ...]\n" + diff --git a/cmds/bootanimation/Android.mk b/cmds/bootanimation/Android.mk index 8c46b212814ad..b260975cd1ad5 100644 --- a/cmds/bootanimation/Android.mk +++ b/cmds/bootanimation/Android.mk @@ -21,6 +21,10 @@ LOCAL_SHARED_LIBRARIES := \ LOCAL_C_INCLUDES := \ $(call include-path-for, corecg graphics) +ifeq ($(TARGET_BOOTANIMATION_USE_RGB565),true) + LOCAL_CFLAGS += -DUSE_565 +endif + LOCAL_MODULE:= bootanimation diff --git a/cmds/bootanimation/BootAnimation.cpp b/cmds/bootanimation/BootAnimation.cpp index 6b50486074df6..cc5764e96ffc1 100644 --- a/cmds/bootanimation/BootAnimation.cpp +++ b/cmds/bootanimation/BootAnimation.cpp @@ -38,6 +38,7 @@ #include #include +#include #include #include @@ -161,7 +162,11 @@ status_t BootAnimation::initTexture(void* buffer, size_t len) codec->setDitherImage(false); if (codec) { codec->decode(&stream, &bitmap, + #ifdef USE_565 + SkBitmap::kRGB_565_Config, + #else SkBitmap::kARGB_8888_Config, + #endif SkImageDecoder::kDecodePixels_Mode); delete codec; } @@ -216,14 +221,16 @@ status_t BootAnimation::initTexture(void* buffer, size_t len) status_t BootAnimation::readyToRun() { mAssets.addDefaultAssets(); + sp dtoken(SurfaceComposerClient::getBuiltInDisplay( + ISurfaceComposer::eDisplayIdMain)); DisplayInfo dinfo; - status_t status = session()->getDisplayInfo(0, &dinfo); + status_t status = SurfaceComposerClient::getDisplayInfo(dtoken, &dinfo); if (status) return -1; // create the native surface - sp control = session()->createSurface( - 0, dinfo.w, dinfo.h, PIXEL_FORMAT_RGB_565); + sp control = session()->createSurface(String8("BootAnimation"), + dinfo.w, dinfo.h, PIXEL_FORMAT_RGB_565); SurfaceComposerClient::openGlobalTransaction(); control->setLayer(0x40000000); diff --git a/cmds/content/src/com/android/commands/content/Content.java b/cmds/content/src/com/android/commands/content/Content.java index bd9eb9a930f9d..787fbdb89062f 100644 --- a/cmds/content/src/com/android/commands/content/Content.java +++ b/cmds/content/src/com/android/commands/content/Content.java @@ -25,6 +25,7 @@ import android.net.Uri; import android.os.Binder; import android.os.IBinder; +import android.os.UserHandle; import android.text.TextUtils; /** @@ -63,7 +64,8 @@ public class Content { private static final String USAGE = "usage: adb shell content [subcommand] [options]\n" + "\n" - + "usage: adb shell content insert --uri --bind [--bind ...]\n" + + "usage: adb shell content insert --uri [--user ]" + + " --bind [--bind ...]\n" + " a content provider URI.\n" + " binds a typed value to a column and is formatted:\n" + " :: where:\n" @@ -75,7 +77,7 @@ public class Content { + " adb shell content insert --uri content://settings/secure --bind name:s:new_setting" + " --bind value:s:new_value\n" + "\n" - + "usage: adb shell content update --uri [--where ]\n" + + "usage: adb shell content update --uri [--user ] [--where ]\n" + " is a SQL style where clause in quotes (You have to escape single quotes" + " - see example below).\n" + " Example:\n" @@ -83,15 +85,15 @@ public class Content { + " adb shell content update --uri content://settings/secure --bind" + " value:s:newer_value --where \"name=\'new_setting\'\"\n" + "\n" - + "usage: adb shell content delete --uri --bind " + + "usage: adb shell content delete --uri [--user ] --bind " + " [--bind ...] [--where ]\n" + " Example:\n" + " # Remove \"new_setting\" secure setting.\n" + " adb shell content delete --uri content://settings/secure " + "--where \"name=\'new_setting\'\"\n" + "\n" - + "usage: adb shell content query --uri [--projection ]" - + " [--where ] [--sort ]\n" + + "usage: adb shell content query --uri [--user ]" + + " [--projection ] [--where ] [--sort ]\n" + " is a list of colon separated column names and is formatted:\n" + " [:...]\n" + " is the order in which rows in the result should be sorted.\n" @@ -110,6 +112,7 @@ private static class Parser { private static final String ARGUMENT_WHERE = "--where"; private static final String ARGUMENT_BIND = "--bind"; private static final String ARGUMENT_URI = "--uri"; + private static final String ARGUMENT_USER = "--user"; private static final String ARGUMENT_PROJECTION = "--projection"; private static final String ARGUMENT_SORT = "--sort"; private static final String TYPE_BOOLEAN = "b"; @@ -150,10 +153,13 @@ public Command parseCommand() { private InsertCommand parseInsertCommand() { Uri uri = null; + int userId = UserHandle.USER_OWNER; ContentValues values = new ContentValues(); for (String argument; (argument = mTokenizer.nextArg()) != null;) { if (ARGUMENT_URI.equals(argument)) { uri = Uri.parse(argumentValueRequired(argument)); + } else if (ARGUMENT_USER.equals(argument)) { + userId = Integer.parseInt(argumentValueRequired(argument)); } else if (ARGUMENT_BIND.equals(argument)) { parseBindValue(values); } else { @@ -168,15 +174,18 @@ private InsertCommand parseInsertCommand() { throw new IllegalArgumentException("Bindings not specified." + " Did you specify --bind argument(s)?"); } - return new InsertCommand(uri, values); + return new InsertCommand(uri, userId, values); } private DeleteCommand parseDeleteCommand() { Uri uri = null; + int userId = UserHandle.USER_OWNER; String where = null; for (String argument; (argument = mTokenizer.nextArg())!= null;) { if (ARGUMENT_URI.equals(argument)) { uri = Uri.parse(argumentValueRequired(argument)); + } else if (ARGUMENT_USER.equals(argument)) { + userId = Integer.parseInt(argumentValueRequired(argument)); } else if (ARGUMENT_WHERE.equals(argument)) { where = argumentValueRequired(argument); } else { @@ -187,16 +196,19 @@ private DeleteCommand parseDeleteCommand() { throw new IllegalArgumentException("Content provider URI not specified." + " Did you specify --uri argument?"); } - return new DeleteCommand(uri, where); + return new DeleteCommand(uri, userId, where); } private UpdateCommand parseUpdateCommand() { Uri uri = null; + int userId = UserHandle.USER_OWNER; String where = null; ContentValues values = new ContentValues(); for (String argument; (argument = mTokenizer.nextArg())!= null;) { if (ARGUMENT_URI.equals(argument)) { uri = Uri.parse(argumentValueRequired(argument)); + } else if (ARGUMENT_USER.equals(argument)) { + userId = Integer.parseInt(argumentValueRequired(argument)); } else if (ARGUMENT_WHERE.equals(argument)) { where = argumentValueRequired(argument); } else if (ARGUMENT_BIND.equals(argument)) { @@ -213,17 +225,20 @@ private UpdateCommand parseUpdateCommand() { throw new IllegalArgumentException("Bindings not specified." + " Did you specify --bind argument(s)?"); } - return new UpdateCommand(uri, values, where); + return new UpdateCommand(uri, userId, values, where); } public QueryCommand parseQueryCommand() { Uri uri = null; + int userId = UserHandle.USER_OWNER; String[] projection = null; String sort = null; String where = null; for (String argument; (argument = mTokenizer.nextArg())!= null;) { if (ARGUMENT_URI.equals(argument)) { uri = Uri.parse(argumentValueRequired(argument)); + } else if (ARGUMENT_USER.equals(argument)) { + userId = Integer.parseInt(argumentValueRequired(argument)); } else if (ARGUMENT_WHERE.equals(argument)) { where = argumentValueRequired(argument); } else if (ARGUMENT_SORT.equals(argument)) { @@ -238,7 +253,7 @@ public QueryCommand parseQueryCommand() { throw new IllegalArgumentException("Content provider URI not specified." + " Did you specify --uri argument?"); } - return new QueryCommand(uri, projection, where, sort); + return new QueryCommand(uri, userId, projection, where, sort); } private void parseBindValue(ContentValues values) { @@ -298,9 +313,11 @@ private String nextArg() { private static abstract class Command { final Uri mUri; + final int mUserId; - public Command(Uri uri) { + public Command(Uri uri, int userId) { mUri = uri; + mUserId = userId; } public final void execute() { @@ -311,7 +328,7 @@ public final void execute() { IBinder token = new Binder(); try { ContentProviderHolder holder = activityManager.getContentProviderExternal( - providerName, token); + providerName, mUserId, token); if (holder == null) { throw new IllegalStateException("Could not find provider: " + providerName); } @@ -334,8 +351,8 @@ public final void execute() { private static class InsertCommand extends Command { final ContentValues mContentValues; - public InsertCommand(Uri uri, ContentValues contentValues) { - super(uri); + public InsertCommand(Uri uri, int userId, ContentValues contentValues) { + super(uri, userId); mContentValues = contentValues; } @@ -348,8 +365,8 @@ public void onExecute(IContentProvider provider) throws Exception { private static class DeleteCommand extends Command { final String mWhere; - public DeleteCommand(Uri uri, String where) { - super(uri); + public DeleteCommand(Uri uri, int userId, String where) { + super(uri, userId); mWhere = where; } @@ -363,8 +380,9 @@ private static class QueryCommand extends DeleteCommand { final String[] mProjection; final String mSortOrder; - public QueryCommand(Uri uri, String[] projection, String where, String sortOrder) { - super(uri, where); + public QueryCommand( + Uri uri, int userId, String[] projection, String where, String sortOrder) { + super(uri, userId, where); mProjection = projection; mSortOrder = sortOrder; } @@ -426,8 +444,8 @@ public void onExecute(IContentProvider provider) throws Exception { private static class UpdateCommand extends InsertCommand { final String mWhere; - public UpdateCommand(Uri uri, ContentValues contentValues, String where) { - super(uri, contentValues); + public UpdateCommand(Uri uri, int userId, ContentValues contentValues, String where) { + super(uri, userId, contentValues); mWhere = where; } diff --git a/cmds/input/src/com/android/commands/input/Input.java b/cmds/input/src/com/android/commands/input/Input.java index 341f30fbaf9e2..a21df0d2c8b22 100755 --- a/cmds/input/src/com/android/commands/input/Input.java +++ b/cmds/input/src/com/android/commands/input/Input.java @@ -66,15 +66,54 @@ private void run(String[] args) { } } else if (command.equals("tap")) { if (args.length == 3) { - sendTap(Float.parseFloat(args[1]), Float.parseFloat(args[2])); + sendTap(InputDevice.SOURCE_TOUCHSCREEN, Float.parseFloat(args[1]), Float.parseFloat(args[2])); return; } } else if (command.equals("swipe")) { if (args.length == 5) { - sendSwipe(Float.parseFloat(args[1]), Float.parseFloat(args[2]), + sendSwipe(InputDevice.SOURCE_TOUCHSCREEN, Float.parseFloat(args[1]), Float.parseFloat(args[2]), Float.parseFloat(args[3]), Float.parseFloat(args[4])); return; } + } else if (command.equals("touchscreen") || command.equals("touchpad")) { + // determine input source + int inputSource = InputDevice.SOURCE_TOUCHSCREEN; + if (command.equals("touchpad")) { + inputSource = InputDevice.SOURCE_TOUCHPAD; + } + // determine subcommand + if (args.length > 1) { + String subcommand = args[1]; + if (subcommand.equals("tap")) { + if (args.length == 4) { + sendTap(inputSource, Float.parseFloat(args[2]), + Float.parseFloat(args[3])); + return; + } + } else if (subcommand.equals("swipe")) { + if (args.length == 6) { + sendSwipe(inputSource, Float.parseFloat(args[2]), + Float.parseFloat(args[3]), Float.parseFloat(args[4]), + Float.parseFloat(args[5])); + return; + } + } + } + } else if (command.equals("trackball")) { + // determine subcommand + if (args.length > 1) { + String subcommand = args[1]; + if (subcommand.equals("press")) { + sendTap(InputDevice.SOURCE_TRACKBALL, 0.0f, 0.0f); + return; + } else if (subcommand.equals("roll")) { + if (args.length == 4) { + sendMove(InputDevice.SOURCE_TRACKBALL, Float.parseFloat(args[2]), + Float.parseFloat(args[3])); + return; + } + } + } } else { System.err.println("Error: Unknown command: " + command); showUsage(); @@ -127,33 +166,64 @@ private void sendKeyEvent(int keyCode) { KeyCharacterMap.VIRTUAL_KEYBOARD, 0, 0, InputDevice.SOURCE_KEYBOARD)); } - private void sendTap(float x, float y) { + private void sendTap(int inputSource, float x, float y) { long now = SystemClock.uptimeMillis(); - injectPointerEvent(MotionEvent.obtain(now, now, MotionEvent.ACTION_DOWN, x, y, 0)); - injectPointerEvent(MotionEvent.obtain(now, now, MotionEvent.ACTION_UP, x, y, 0)); + injectMotionEvent(inputSource, MotionEvent.ACTION_DOWN, now, x, y, 1.0f); + injectMotionEvent(inputSource, MotionEvent.ACTION_UP, now, x, y, 0.0f); } - private void sendSwipe(float x1, float y1, float x2, float y2) { + private void sendSwipe(int inputSource, float x1, float y1, float x2, float y2) { final int NUM_STEPS = 11; long now = SystemClock.uptimeMillis(); - injectPointerEvent(MotionEvent.obtain(now, now, MotionEvent.ACTION_DOWN, x1, y1, 0)); + injectMotionEvent(inputSource, MotionEvent.ACTION_DOWN, now, x1, y1, 1.0f); for (int i = 1; i < NUM_STEPS; i++) { - float alpha = (float)i / NUM_STEPS; - injectPointerEvent(MotionEvent.obtain(now, now, MotionEvent.ACTION_MOVE, - lerp(x1, x2, alpha), lerp(y1, y2, alpha), 0)); + float alpha = (float) i / NUM_STEPS; + injectMotionEvent(inputSource, MotionEvent.ACTION_MOVE, now, lerp(x1, x2, alpha), + lerp(y1, y2, alpha), 1.0f); } - injectPointerEvent(MotionEvent.obtain(now, now, MotionEvent.ACTION_UP, x2, y2, 0)); + injectMotionEvent(inputSource, MotionEvent.ACTION_UP, now, x1, y1, 0.0f); + } + + /** + * Sends a simple zero-pressure move event. + * + * @param inputSource the InputDevice.SOURCE_* sending the input event + * @param dx change in x coordinate due to move + * @param dy change in y coordinate due to move + */ + private void sendMove(int inputSource, float dx, float dy) { + long now = SystemClock.uptimeMillis(); + injectMotionEvent(inputSource, MotionEvent.ACTION_MOVE, now, dx, dy, 0.0f); } private void injectKeyEvent(KeyEvent event) { - Log.i(TAG, "InjectKeyEvent: " + event); + Log.i(TAG, "injectKeyEvent: " + event); InputManager.getInstance().injectInputEvent(event, InputManager.INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH); } - private void injectPointerEvent(MotionEvent event) { - event.setSource(InputDevice.SOURCE_TOUCHSCREEN); - Log.i("Input", "InjectPointerEvent: " + event); + /** + * Builds a MotionEvent and injects it into the event stream. + * + * @param inputSource the InputDevice.SOURCE_* sending the input event + * @param action the MotionEvent.ACTION_* for the event + * @param when the value of SystemClock.uptimeMillis() at which the event happened + * @param x x coordinate of event + * @param y y coordinate of event + * @param pressure pressure of event + */ + private void injectMotionEvent(int inputSource, int action, long when, float x, float y, float pressure) { + final float DEFAULT_SIZE = 1.0f; + final int DEFAULT_META_STATE = 0; + final float DEFAULT_PRECISION_X = 1.0f; + final float DEFAULT_PRECISION_Y = 1.0f; + final int DEFAULT_DEVICE_ID = 0; + final int DEFAULT_EDGE_FLAGS = 0; + MotionEvent event = MotionEvent.obtain(when, when, action, x, y, pressure, DEFAULT_SIZE, + DEFAULT_META_STATE, DEFAULT_PRECISION_X, DEFAULT_PRECISION_Y, DEFAULT_DEVICE_ID, + DEFAULT_EDGE_FLAGS); + event.setSource(inputSource); + Log.i("Input", "injectMotionEvent: " + event); InputManager.getInstance().injectInputEvent(event, InputManager.INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH); } @@ -166,7 +236,9 @@ private void showUsage() { System.err.println("usage: input ..."); System.err.println(" input text "); System.err.println(" input keyevent "); - System.err.println(" input tap "); - System.err.println(" input swipe "); + System.err.println(" input [touchscreen|touchpad] tap "); + System.err.println(" input [touchscreen|touchpad] swipe "); + System.err.println(" input trackball press"); + System.err.println(" input trackball roll "); } } diff --git a/cmds/installd/Android.mk b/cmds/installd/Android.mk index f277339a8eb02..3e722ea8b1eaa 100644 --- a/cmds/installd/Android.mk +++ b/cmds/installd/Android.mk @@ -34,6 +34,12 @@ LOCAL_SHARED_LIBRARIES := \ LOCAL_STATIC_LIBRARIES := \ libdiskusage +ifeq ($(HAVE_SELINUX),true) +LOCAL_C_INCLUDES += external/libselinux/include +LOCAL_SHARED_LIBRARIES += libselinux +LOCAL_CFLAGS := -DHAVE_SELINUX +endif # HAVE_SELINUX + LOCAL_MODULE := installd LOCAL_MODULE_TAGS := optional diff --git a/cmds/installd/commands.c b/cmds/installd/commands.c index a509156305175..a44d62673727e 100644 --- a/cmds/installd/commands.c +++ b/cmds/installd/commands.c @@ -14,20 +14,29 @@ ** limitations under the License. */ +#include #include "installd.h" #include +#ifdef HAVE_SELINUX +#include +#endif + /* Directory records that are used in execution of commands. */ dir_rec_t android_data_dir; dir_rec_t android_asec_dir; dir_rec_t android_app_dir; dir_rec_t android_app_private_dir; +dir_rec_t android_app_lib_dir; +dir_rec_t android_media_dir; dir_rec_array_t android_system_dirs; int install(const char *pkgname, uid_t uid, gid_t gid) { char pkgdir[PKG_PATH_MAX]; - char libdir[PKG_PATH_MAX]; + char libsymlink[PKG_PATH_MAX]; + char applibdir[PKG_PATH_MAX]; + struct stat libStat; if ((uid < AID_SYSTEM) || (gid < AID_SYSTEM)) { ALOGE("invalid uid/gid: %d %d\n", uid, gid); @@ -39,45 +48,68 @@ int install(const char *pkgname, uid_t uid, gid_t gid) return -1; } - if (create_pkg_path(libdir, pkgname, PKG_LIB_POSTFIX, 0)) { - ALOGE("cannot create package lib path\n"); + if (create_pkg_path(libsymlink, pkgname, PKG_LIB_POSTFIX, 0)) { + ALOGE("cannot create package lib symlink origin path\n"); + return -1; + } + + if (create_pkg_path_in_dir(applibdir, &android_app_lib_dir, pkgname, PKG_DIR_POSTFIX)) { + ALOGE("cannot create package lib symlink dest path\n"); return -1; } if (mkdir(pkgdir, 0751) < 0) { ALOGE("cannot create dir '%s': %s\n", pkgdir, strerror(errno)); - return -errno; + return -1; } if (chmod(pkgdir, 0751) < 0) { ALOGE("cannot chmod dir '%s': %s\n", pkgdir, strerror(errno)); unlink(pkgdir); - return -errno; + return -1; } - if (mkdir(libdir, 0755) < 0) { - ALOGE("cannot create dir '%s': %s\n", libdir, strerror(errno)); - unlink(pkgdir); - return -errno; + if (lstat(libsymlink, &libStat) < 0) { + if (errno != ENOENT) { + ALOGE("couldn't stat lib dir: %s\n", strerror(errno)); + return -1; + } + } else { + if (S_ISDIR(libStat.st_mode)) { + if (delete_dir_contents(libsymlink, 1, 0) < 0) { + ALOGE("couldn't delete lib directory during install for: %s", libsymlink); + return -1; + } + } else if (S_ISLNK(libStat.st_mode)) { + if (unlink(libsymlink) < 0) { + ALOGE("couldn't unlink lib directory during install for: %s", libsymlink); + return -1; + } + } } - if (chmod(libdir, 0755) < 0) { - ALOGE("cannot chmod dir '%s': %s\n", libdir, strerror(errno)); - unlink(libdir); + + if (symlink(applibdir, libsymlink) < 0) { + ALOGE("couldn't symlink directory '%s' -> '%s': %s\n", libsymlink, applibdir, + strerror(errno)); unlink(pkgdir); - return -errno; + return -1; } - if (chown(libdir, AID_SYSTEM, AID_SYSTEM) < 0) { - ALOGE("cannot chown dir '%s': %s\n", libdir, strerror(errno)); - unlink(libdir); + +#ifdef HAVE_SELINUX + if (selinux_android_setfilecon(pkgdir, pkgname, uid) < 0) { + ALOGE("cannot setfilecon dir '%s': %s\n", pkgdir, strerror(errno)); + unlink(libsymlink); unlink(pkgdir); - return -errno; + return -1; } +#endif if (chown(pkgdir, uid, gid) < 0) { ALOGE("cannot chown dir '%s': %s\n", pkgdir, strerror(errno)); - unlink(libdir); + unlink(libsymlink); unlink(pkgdir); - return -errno; + return -1; } + return 0; } @@ -128,7 +160,7 @@ int fix_uid(const char *pkgname, uid_t uid, gid_t gid) if (stat(pkgdir, &s) < 0) return -1; if (s.st_uid != 0 || s.st_gid != 0) { - ALOGE("fixing uid of non-root pkg: %s %d %d\n", pkgdir, s.st_uid, s.st_gid); + ALOGE("fixing uid of non-root pkg: %s %lu %lu\n", pkgdir, s.st_uid, s.st_gid); return -1; } @@ -160,32 +192,102 @@ int delete_user_data(const char *pkgname, uid_t persona) int make_user_data(const char *pkgname, uid_t uid, uid_t persona) { char pkgdir[PKG_PATH_MAX]; - char real_libdir[PKG_PATH_MAX]; + char applibdir[PKG_PATH_MAX]; + char libsymlink[PKG_PATH_MAX]; + struct stat libStat; // Create the data dir for the package if (create_pkg_path(pkgdir, pkgname, PKG_DIR_POSTFIX, persona)) { return -1; } + if (create_pkg_path(libsymlink, pkgname, PKG_LIB_POSTFIX, persona)) { + ALOGE("cannot create package lib symlink origin path\n"); + return -1; + } + if (create_pkg_path_in_dir(applibdir, &android_app_lib_dir, pkgname, PKG_DIR_POSTFIX)) { + ALOGE("cannot create package lib symlink dest path\n"); + return -1; + } + if (mkdir(pkgdir, 0751) < 0) { ALOGE("cannot create dir '%s': %s\n", pkgdir, strerror(errno)); return -errno; } + if (chmod(pkgdir, 0751) < 0) { + ALOGE("cannot chmod dir '%s': %s\n", pkgdir, strerror(errno)); + unlink(pkgdir); + return -errno; + } + + if (lstat(libsymlink, &libStat) < 0) { + if (errno != ENOENT) { + ALOGE("couldn't stat lib dir for non-primary: %s\n", strerror(errno)); + unlink(pkgdir); + return -1; + } + } else { + if (S_ISDIR(libStat.st_mode)) { + if (delete_dir_contents(libsymlink, 1, 0) < 0) { + ALOGE("couldn't delete lib directory during install for non-primary: %s", + libsymlink); + unlink(pkgdir); + return -1; + } + } else if (S_ISLNK(libStat.st_mode)) { + if (unlink(libsymlink) < 0) { + ALOGE("couldn't unlink lib directory during install for non-primary: %s", + libsymlink); + unlink(pkgdir); + return -1; + } + } + } + + if (symlink(applibdir, libsymlink) < 0) { + ALOGE("couldn't symlink directory for non-primary '%s' -> '%s': %s\n", libsymlink, + applibdir, strerror(errno)); + unlink(pkgdir); + return -1; + } + if (chown(pkgdir, uid, uid) < 0) { ALOGE("cannot chown dir '%s': %s\n", pkgdir, strerror(errno)); + unlink(libsymlink); + unlink(pkgdir); + return -errno; + } + +#ifdef HAVE_SELINUX + if (selinux_android_setfilecon(pkgdir, pkgname, uid) < 0) { + ALOGE("cannot setfilecon dir '%s': %s\n", pkgdir, strerror(errno)); + unlink(libsymlink); unlink(pkgdir); return -errno; } +#endif + return 0; } int delete_persona(uid_t persona) { - char pkgdir[PKG_PATH_MAX]; + char data_path[PKG_PATH_MAX]; + if (create_persona_path(data_path, persona)) { + return -1; + } + if (delete_dir_contents(data_path, 1, NULL)) { + return -1; + } - if (create_persona_path(pkgdir, persona)) + char media_path[PATH_MAX]; + if (create_persona_media_path(media_path, (userid_t) persona) == -1) { return -1; + } + if (delete_dir_contents(media_path, 1, NULL) == -1) { + return -1; + } - return delete_dir_contents(pkgdir, 1, NULL); + return 0; } int clone_persona_data(uid_t src_persona, uid_t target_persona, int copy) @@ -218,7 +320,7 @@ int clone_persona_data(uid_t src_persona, uid_t target_persona, int copy) /* Get the file stat */ if (stat(pkg_path, &s) < 0) continue; /* Get the uid of the package */ - ALOGI("Adding datadir for uid = %d\n", s.st_uid); + ALOGI("Adding datadir for uid = %lu\n", s.st_uid); uid = (uid_t) s.st_uid % PER_USER_RANGE; /* Create the directory for the target */ make_user_data(name, uid + target_persona * PER_USER_RANGE, @@ -227,31 +329,25 @@ int clone_persona_data(uid_t src_persona, uid_t target_persona, int copy) } closedir(d); } + + if (ensure_media_user_dirs((userid_t) target_persona) == -1) { + return -1; + } + return 0; } -int delete_cache(const char *pkgname) +int delete_cache(const char *pkgname, uid_t persona) { char cachedir[PKG_PATH_MAX]; - if (create_pkg_path(cachedir, pkgname, CACHE_DIR_POSTFIX, 0)) + if (create_pkg_path(cachedir, pkgname, CACHE_DIR_POSTFIX, persona)) return -1; /* delete contents, not the directory, no exceptions */ return delete_dir_contents(cachedir, 0, 0); } -static int64_t disk_free() -{ - struct statfs sfs; - if (statfs(android_data_dir.path, &sfs) == 0) { - return sfs.f_bavail * sfs.f_bsize; - } else { - ALOGE("Couldn't statfs %s: %s\n", android_data_dir.path, strerror(errno)); - return -1; - } -} - /* Try to ensure free_size bytes of storage are available. * Returns 0 on success. * This is rather simple-minded because doing a full LRU would @@ -261,57 +357,85 @@ static int64_t disk_free() */ int free_cache(int64_t free_size) { - const char *name; - int dfd, subfd; + cache_t* cache; + int64_t avail; DIR *d; struct dirent *de; - int64_t avail; - char datadir[PKG_PATH_MAX]; + char tmpdir[PATH_MAX]; + char *dirpos; - avail = disk_free(); + avail = data_disk_free(); if (avail < 0) return -1; ALOGI("free_cache(%" PRId64 ") avail %" PRId64 "\n", free_size, avail); if (avail >= free_size) return 0; - if (create_persona_path(datadir, 0)) { - ALOGE("couldn't get directory for persona 0"); - return -1; - } + cache = start_cache_collection(); - d = opendir(datadir); - if (d == NULL) { - ALOGE("cannot open %s: %s\n", datadir, strerror(errno)); - return -1; + // Collect cache files for primary user. + if (create_persona_path(tmpdir, 0) == 0) { + //ALOGI("adding cache files from %s\n", tmpdir); + add_cache_files(cache, tmpdir, "cache"); } - dfd = dirfd(d); - - while ((de = readdir(d))) { - if (de->d_type != DT_DIR) continue; - name = de->d_name; - /* always skip "." and ".." */ - if (name[0] == '.') { - if (name[1] == 0) continue; - if ((name[1] == '.') && (name[2] == 0)) continue; + // Search for other users and add any cache files from them. + snprintf(tmpdir, sizeof(tmpdir), "%s%s", android_data_dir.path, + SECONDARY_USER_PREFIX); + dirpos = tmpdir + strlen(tmpdir); + d = opendir(tmpdir); + if (d != NULL) { + while ((de = readdir(d))) { + if (de->d_type == DT_DIR) { + const char *name = de->d_name; + /* always skip "." and ".." */ + if (name[0] == '.') { + if (name[1] == 0) continue; + if ((name[1] == '.') && (name[2] == 0)) continue; + } + if ((strlen(name)+(dirpos-tmpdir)) < (sizeof(tmpdir)-1)) { + strcpy(dirpos, name); + //ALOGI("adding cache files from %s\n", tmpdir); + add_cache_files(cache, tmpdir, "cache"); + } else { + ALOGW("Path exceeds limit: %s%s", tmpdir, name); + } + } } + closedir(d); + } - subfd = openat(dfd, name, O_RDONLY | O_DIRECTORY); - if (subfd < 0) continue; - - delete_dir_contents_fd(subfd, "cache"); - close(subfd); - - avail = disk_free(); - if (avail >= free_size) { - closedir(d); - return 0; + // Collect cache files on external storage for all users (if it is mounted as part + // of the internal storage). + strcpy(tmpdir, android_media_dir.path); + dirpos = tmpdir + strlen(tmpdir); + d = opendir(tmpdir); + if (d != NULL) { + while ((de = readdir(d))) { + if (de->d_type == DT_DIR) { + const char *name = de->d_name; + /* skip any dir that doesn't start with a number, so not a user */ + if (name[0] < '0' || name[0] > '9') { + continue; + } + if ((strlen(name)+(dirpos-tmpdir)) < (sizeof(tmpdir)-1)) { + strcpy(dirpos, name); + if (lookup_media_dir(tmpdir, "Android") == 0 + && lookup_media_dir(tmpdir, "data") == 0) { + //ALOGI("adding cache files from %s\n", tmpdir); + add_cache_files(cache, tmpdir, "cache"); + } + } else { + ALOGW("Path exceeds limit: %s%s", tmpdir, name); + } + } } + closedir(d); } - closedir(d); - /* Fail case - not possible to free space */ - return -1; + clear_cache_files(cache, free_size); + finish_cache_collection(cache); + + return data_disk_free() >= free_size ? 0 : -1; } int move_dex(const char *src, const char *dst) @@ -350,32 +474,7 @@ int rm_dex(const char *path) } } -int protect(char *pkgname, gid_t gid) -{ - struct stat s; - char pkgpath[PKG_PATH_MAX]; - - if (gid < AID_SYSTEM) return -1; - - if (create_pkg_path_in_dir(pkgpath, &android_app_private_dir, pkgname, ".apk")) - return -1; - - if (stat(pkgpath, &s) < 0) return -1; - - if (chown(pkgpath, s.st_uid, gid) < 0) { - ALOGE("failed to chgrp '%s': %s\n", pkgpath, strerror(errno)); - return -1; - } - - if (chmod(pkgpath, S_IRUSR|S_IWUSR|S_IRGRP) < 0) { - ALOGE("failed to chmod '%s': %s\n", pkgpath, strerror(errno)); - return -1; - } - - return 0; -} - -int get_size(const char *pkgname, const char *apkpath, +int get_size(const char *pkgname, int persona, const char *apkpath, const char *fwdlock_apkpath, const char *asecpath, int64_t *_codesize, int64_t *_datasize, int64_t *_cachesize, int64_t* _asecsize) @@ -414,6 +513,16 @@ int get_size(const char *pkgname, const char *apkpath, } } + /* add in size of any libraries */ + if (!create_pkg_path_in_dir(path, &android_app_lib_dir, pkgname, PKG_DIR_POSTFIX)) { + d = opendir(path); + if (d != NULL) { + dfd = dirfd(d); + codesize += calculate_dir_size(dfd); + closedir(d); + } + } + /* compute asec size if it is given */ if (asecpath != NULL && asecpath[0] != '!') { @@ -422,7 +531,7 @@ int get_size(const char *pkgname, const char *apkpath, } } - if (create_pkg_path(path, pkgname, PKG_DIR_POSTFIX, 0)) { + if (create_pkg_path(path, pkgname, PKG_DIR_POSTFIX, persona)) { goto done; } @@ -441,21 +550,33 @@ int get_size(const char *pkgname, const char *apkpath, if (de->d_type == DT_DIR) { int subfd; + int64_t statsize = 0; + int64_t dirsize = 0; /* always skip "." and ".." */ if (name[0] == '.') { if (name[1] == 0) continue; if ((name[1] == '.') && (name[2] == 0)) continue; } + if (fstatat(dfd, name, &s, AT_SYMLINK_NOFOLLOW) == 0) { + statsize = stat_size(&s); + } subfd = openat(dfd, name, O_RDONLY | O_DIRECTORY); if (subfd >= 0) { - int64_t size = calculate_dir_size(subfd); - if (!strcmp(name,"lib")) { - codesize += size; - } else if(!strcmp(name,"cache")) { - cachesize += size; - } else { - datasize += size; - } + dirsize = calculate_dir_size(subfd); + } + if(!strcmp(name,"lib")) { + codesize += dirsize + statsize; + } else if(!strcmp(name,"cache")) { + cachesize += dirsize + statsize; + } else { + datasize += dirsize + statsize; + } + } else if (de->d_type == DT_LNK && !strcmp(name,"lib")) { + // This is the symbolic link to the application's library + // code. We'll count this as code instead of data, since + // it is not something that the app creates. + if (fstatat(dfd, name, &s, AT_SYMLINK_NOFOLLOW) == 0) { + codesize += stat_size(&s); } } else { if (fstatat(dfd, name, &s, AT_SYMLINK_NOFOLLOW) == 0) { @@ -479,6 +600,7 @@ int create_cache_path(char path[PKG_PATH_MAX], const char *src) char *tmp; int srclen; int dstlen; + char dexopt_data_only[PROPERTY_VALUE_MAX]; srclen = strlen(src); @@ -491,7 +613,15 @@ int create_cache_path(char path[PKG_PATH_MAX], const char *src) return -1; } - dstlen = srclen + strlen(DALVIK_CACHE_PREFIX) + + const char *cache_path = DALVIK_CACHE_PREFIX; + if (!strncmp(src, "/system", 7)) { + property_get("dalvik.vm.dexopt-data-only", dexopt_data_only, ""); + if (strcmp(dexopt_data_only, "1") != 0) { + cache_path = DALVIK_SYSTEM_CACHE_PREFIX; + } + } + + dstlen = srclen + strlen(cache_path) + strlen(DALVIK_CACHE_POSTFIX) + 1; if (dstlen > PKG_PATH_MAX) { @@ -499,11 +629,11 @@ int create_cache_path(char path[PKG_PATH_MAX], const char *src) } sprintf(path,"%s%s%s", - DALVIK_CACHE_PREFIX, + cache_path, src + 1, /* skip the leading / */ DALVIK_CACHE_POSTFIX); - for(tmp = path + strlen(DALVIK_CACHE_PREFIX); *tmp; tmp++) { + for(tmp = path + strlen(cache_path); *tmp; tmp++) { if (*tmp == '/') { *tmp = '@'; } @@ -607,16 +737,16 @@ int dexopt(const char *apk_path, uid_t uid, int is_public) ALOGE("dexopt cannot open '%s' for output\n", dex_path); goto fail; } - if (fchown(odex_fd, AID_SYSTEM, uid) < 0) { - ALOGE("dexopt cannot chown '%s'\n", dex_path); - goto fail; - } if (fchmod(odex_fd, S_IRUSR|S_IWUSR|S_IRGRP | (is_public ? S_IROTH : 0)) < 0) { ALOGE("dexopt cannot chmod '%s'\n", dex_path); goto fail; } + if (fchown(odex_fd, AID_SYSTEM, uid) < 0) { + ALOGE("dexopt cannot chown '%s'\n", dex_path); + goto fail; + } ALOGV("DexInv: --- BEGIN '%s' ---\n", apk_path); @@ -632,13 +762,23 @@ int dexopt(const char *apk_path, uid_t uid, int is_public) ALOGE("setuid(%d) during dexopt\n", uid); exit(65); } + // drop capabilities + struct __user_cap_header_struct capheader; + struct __user_cap_data_struct capdata[2]; + memset(&capheader, 0, sizeof(capheader)); + memset(&capdata, 0, sizeof(capdata)); + capheader.version = _LINUX_CAPABILITY_VERSION_3; + if (capset(&capheader, &capdata[0]) < 0) { + ALOGE("capset failed: %s\n", strerror(errno)); + exit(66); + } if (flock(odex_fd, LOCK_EX | LOCK_NB) != 0) { ALOGE("flock(%s) failed: %s\n", dex_path, strerror(errno)); - exit(66); + exit(67); } run_dexopt(zip_fd, odex_fd, apk_path, dexopt_flags); - exit(67); /* only get here on exec failure */ + exit(68); /* only get here on exec failure */ } else { res = wait_dexopt(pid, apk_path); if (res != 0) { @@ -926,159 +1066,73 @@ int movefiles() return 0; } -int linklib(const char* dataDir, const char* asecLibDir) +int linklib(const char* pkgname, const char* asecLibDir, int userId) { - char libdir[PKG_PATH_MAX]; + char pkgdir[PKG_PATH_MAX]; + char libsymlink[PKG_PATH_MAX]; struct stat s, libStat; int rc = 0; - const size_t libdirLen = strlen(dataDir) + strlen(PKG_LIB_POSTFIX); - if (libdirLen >= PKG_PATH_MAX) { - ALOGE("library dir len too large"); + if (create_pkg_path(pkgdir, pkgname, PKG_DIR_POSTFIX, userId)) { + ALOGE("cannot create package path\n"); return -1; } - - if (snprintf(libdir, sizeof(libdir), "%s%s", dataDir, PKG_LIB_POSTFIX) != (ssize_t)libdirLen) { - ALOGE("library dir not written successfully: %s\n", strerror(errno)); + if (create_pkg_path(libsymlink, pkgname, PKG_LIB_POSTFIX, userId)) { + ALOGE("cannot create package lib symlink origin path\n"); return -1; } - if (stat(dataDir, &s) < 0) return -1; + if (stat(pkgdir, &s) < 0) return -1; - if (chown(dataDir, 0, 0) < 0) { - ALOGE("failed to chown '%s': %s\n", dataDir, strerror(errno)); + if (chown(pkgdir, AID_INSTALL, AID_INSTALL) < 0) { + ALOGE("failed to chown '%s': %s\n", pkgdir, strerror(errno)); return -1; } - if (chmod(dataDir, 0700) < 0) { - ALOGE("failed to chmod '%s': %s\n", dataDir, strerror(errno)); - rc = -1; - goto out; - } - - if (lstat(libdir, &libStat) < 0) { - ALOGE("couldn't stat lib dir: %s\n", strerror(errno)); + if (chmod(pkgdir, 0700) < 0) { + ALOGE("linklib() 1: failed to chmod '%s': %s\n", pkgdir, strerror(errno)); rc = -1; goto out; } - if (S_ISDIR(libStat.st_mode)) { - if (delete_dir_contents(libdir, 1, 0) < 0) { + if (lstat(libsymlink, &libStat) < 0) { + if (errno != ENOENT) { + ALOGE("couldn't stat lib dir: %s\n", strerror(errno)); rc = -1; goto out; } - } else if (S_ISLNK(libStat.st_mode)) { - if (unlink(libdir) < 0) { - rc = -1; - goto out; + } else { + if (S_ISDIR(libStat.st_mode)) { + if (delete_dir_contents(libsymlink, 1, 0) < 0) { + rc = -1; + goto out; + } + } else if (S_ISLNK(libStat.st_mode)) { + if (unlink(libsymlink) < 0) { + ALOGE("couldn't unlink lib dir: %s\n", strerror(errno)); + rc = -1; + goto out; + } } } - if (symlink(asecLibDir, libdir) < 0) { - ALOGE("couldn't symlink directory '%s' -> '%s': %s\n", libdir, asecLibDir, strerror(errno)); - rc = -errno; - goto out; - } - - if (lchown(libdir, AID_SYSTEM, AID_SYSTEM) < 0) { - ALOGE("cannot chown dir '%s': %s\n", libdir, strerror(errno)); - unlink(libdir); + if (symlink(asecLibDir, libsymlink) < 0) { + ALOGE("couldn't symlink directory '%s' -> '%s': %s\n", libsymlink, asecLibDir, + strerror(errno)); rc = -errno; goto out; } out: - if (chmod(dataDir, s.st_mode) < 0) { - ALOGE("failed to chmod '%s': %s\n", dataDir, strerror(errno)); + if (chmod(pkgdir, s.st_mode) < 0) { + ALOGE("linklib() 2: failed to chmod '%s': %s\n", pkgdir, strerror(errno)); rc = -errno; } - if (chown(dataDir, s.st_uid, s.st_gid) < 0) { - ALOGE("failed to chown '%s' : %s\n", dataDir, strerror(errno)); + if (chown(pkgdir, s.st_uid, s.st_gid) < 0) { + ALOGE("failed to chown '%s' : %s\n", pkgdir, strerror(errno)); return -errno; } return rc; } - -int unlinklib(const char* dataDir) -{ - char libdir[PKG_PATH_MAX]; - struct stat s, libStat; - int rc = 0; - - const size_t libdirLen = strlen(dataDir) + strlen(PKG_LIB_POSTFIX); - if (libdirLen >= PKG_PATH_MAX) { - return -1; - } - - if (snprintf(libdir, sizeof(libdir), "%s%s", dataDir, PKG_LIB_POSTFIX) != (ssize_t)libdirLen) { - ALOGE("library dir not written successfully: %s\n", strerror(errno)); - return -1; - } - - if (stat(dataDir, &s) < 0) { - ALOGE("couldn't state data dir"); - return -1; - } - - if (chown(dataDir, 0, 0) < 0) { - ALOGE("failed to chown '%s': %s\n", dataDir, strerror(errno)); - return -1; - } - - if (chmod(dataDir, 0700) < 0) { - ALOGE("failed to chmod '%s': %s\n", dataDir, strerror(errno)); - rc = -1; - goto out; - } - - if (lstat(libdir, &libStat) < 0) { - ALOGE("couldn't stat lib dir: %s\n", strerror(errno)); - rc = -1; - goto out; - } - - if (S_ISDIR(libStat.st_mode)) { - if (delete_dir_contents(libdir, 1, 0) < 0) { - rc = -1; - goto out; - } - } else if (S_ISLNK(libStat.st_mode)) { - if (unlink(libdir) < 0) { - rc = -1; - goto out; - } - } - - if (mkdir(libdir, 0755) < 0) { - ALOGE("cannot create dir '%s': %s\n", libdir, strerror(errno)); - rc = -errno; - goto out; - } - if (chmod(libdir, 0755) < 0) { - ALOGE("cannot chmod dir '%s': %s\n", libdir, strerror(errno)); - unlink(libdir); - rc = -errno; - goto out; - } - if (chown(libdir, AID_SYSTEM, AID_SYSTEM) < 0) { - ALOGE("cannot chown dir '%s': %s\n", libdir, strerror(errno)); - unlink(libdir); - rc = -errno; - goto out; - } - -out: - if (chmod(dataDir, s.st_mode) < 0) { - ALOGE("failed to chmod '%s': %s\n", dataDir, strerror(errno)); - rc = -1; - } - - if (chown(dataDir, s.st_uid, s.st_gid) < 0) { - ALOGE("failed to chown '%s' : %s\n", dataDir, strerror(errno)); - return -1; - } - - return rc; -} diff --git a/cmds/installd/installd.c b/cmds/installd/installd.c index fa4b8a6a17491..21d674a03bb6c 100644 --- a/cmds/installd/installd.c +++ b/cmds/installd/installd.c @@ -14,6 +14,9 @@ ** limitations under the License. */ +#include +#include + #include "installd.h" @@ -69,12 +72,7 @@ static int do_free_cache(char **arg, char reply[REPLY_MAX]) /* TODO int:free_siz static int do_rm_cache(char **arg, char reply[REPLY_MAX]) { - return delete_cache(arg[0]); /* pkgname */ -} - -static int do_protect(char **arg, char reply[REPLY_MAX]) -{ - return protect(arg[0], atoi(arg[1])); /* pkgname, gid */ + return delete_cache(arg[0], atoi(arg[1])); /* pkgname, userid */ } static int do_get_size(char **arg, char reply[REPLY_MAX]) @@ -85,8 +83,9 @@ static int do_get_size(char **arg, char reply[REPLY_MAX]) int64_t asecsize = 0; int res = 0; - /* pkgdir, apkpath */ - res = get_size(arg[0], arg[1], arg[2], arg[3], &codesize, &datasize, &cachesize, &asecsize); + /* pkgdir, persona, apkpath */ + res = get_size(arg[0], atoi(arg[1]), arg[2], arg[3], arg[4], + &codesize, &datasize, &cachesize, &asecsize); /* * Each int64_t can take up 22 characters printed out. Make sure it @@ -124,12 +123,7 @@ static int do_movefiles(char **arg, char reply[REPLY_MAX]) static int do_linklib(char **arg, char reply[REPLY_MAX]) { - return linklib(arg[0], arg[1]); -} - -static int do_unlinklib(char **arg, char reply[REPLY_MAX]) -{ - return unlinklib(arg[0]); + return linklib(arg[0], arg[1], atoi(arg[2])); } struct cmdinfo { @@ -148,13 +142,11 @@ struct cmdinfo cmds[] = { { "rename", 2, do_rename }, { "fixuid", 3, do_fixuid }, { "freecache", 1, do_free_cache }, - { "rmcache", 1, do_rm_cache }, - { "protect", 2, do_protect }, - { "getsize", 4, do_get_size }, + { "rmcache", 2, do_rm_cache }, + { "getsize", 5, do_get_size }, { "rmuserdata", 2, do_rm_user_data }, { "movefiles", 0, do_movefiles }, - { "linklib", 2, do_linklib }, - { "unlinklib", 1, do_unlinklib }, + { "linklib", 3, do_linklib }, { "mkuserdata", 3, do_mk_user_data }, { "rmuser", 1, do_rm_user }, { "cloneuserdata", 3, do_clone_user_data }, @@ -292,11 +284,21 @@ int initialize_globals() { return -1; } + // Get the android app native library directory. + if (copy_and_append(&android_app_lib_dir, &android_data_dir, APP_LIB_SUBDIR) < 0) { + return -1; + } + // Get the sd-card ASEC mount point. if (get_path_from_env(&android_asec_dir, "ASEC_MOUNTPOINT") < 0) { return -1; } + // Get the android media directory. + if (copy_and_append(&android_media_dir, &android_data_dir, MEDIA_SUBDIR) < 0) { + return -1; + } + // Take note of the system and vendor directories. android_system_dirs.count = 2; @@ -326,37 +328,202 @@ int initialize_globals() { } int initialize_directories() { + int res = -1; + + // Read current filesystem layout version to handle upgrade paths + char version_path[PATH_MAX]; + snprintf(version_path, PATH_MAX, "%s.layout_version", android_data_dir.path); + + int oldVersion; + if (fs_read_atomic_int(version_path, &oldVersion) == -1) { + oldVersion = 0; + } + int version = oldVersion; + // /data/user char *user_data_dir = build_string2(android_data_dir.path, SECONDARY_USER_PREFIX); // /data/data char *legacy_data_dir = build_string2(android_data_dir.path, PRIMARY_USER_PREFIX); // /data/user/0 - char *primary_data_dir = build_string3(android_data_dir.path, SECONDARY_USER_PREFIX, - "0"); - int ret = -1; - if (user_data_dir != NULL && primary_data_dir != NULL && legacy_data_dir != NULL) { - ret = 0; - // Make the /data/user directory if necessary - if (access(user_data_dir, R_OK) < 0) { - if (mkdir(user_data_dir, 0711) < 0) { - return -1; + char *primary_data_dir = build_string3(android_data_dir.path, SECONDARY_USER_PREFIX, "0"); + if (!user_data_dir || !legacy_data_dir || !primary_data_dir) { + goto fail; + } + + // Make the /data/user directory if necessary + if (access(user_data_dir, R_OK) < 0) { + if (mkdir(user_data_dir, 0711) < 0) { + goto fail; + } + if (chown(user_data_dir, AID_SYSTEM, AID_SYSTEM) < 0) { + goto fail; + } + if (chmod(user_data_dir, 0711) < 0) { + goto fail; + } + } + // Make the /data/user/0 symlink to /data/data if necessary + if (access(primary_data_dir, R_OK) < 0) { + if (symlink(legacy_data_dir, primary_data_dir)) { + goto fail; + } + } + + if (version == 0) { + // Introducing multi-user, so migrate /data/media contents into /data/media/0 + ALOGD("Upgrading /data/media for multi-user"); + + // Ensure /data/media + if (fs_prepare_dir(android_media_dir.path, 0770, AID_MEDIA_RW, AID_MEDIA_RW) == -1) { + goto fail; + } + + // /data/media.tmp + char media_tmp_dir[PATH_MAX]; + snprintf(media_tmp_dir, PATH_MAX, "%smedia.tmp", android_data_dir.path); + + // Only copy when upgrade not already in progress + if (access(media_tmp_dir, F_OK) == -1) { + if (rename(android_media_dir.path, media_tmp_dir) == -1) { + ALOGE("Failed to move legacy media path: %s", strerror(errno)); + goto fail; + } + } + + // Create /data/media again + if (fs_prepare_dir(android_media_dir.path, 0770, AID_MEDIA_RW, AID_MEDIA_RW) == -1) { + goto fail; + } + + // /data/media/0 + char owner_media_dir[PATH_MAX]; + snprintf(owner_media_dir, PATH_MAX, "%s0", android_media_dir.path); + + // Move any owner data into place + if (access(media_tmp_dir, F_OK) == 0) { + if (rename(media_tmp_dir, owner_media_dir) == -1) { + ALOGE("Failed to move owner media path: %s", strerror(errno)); + goto fail; } - if (chown(user_data_dir, AID_SYSTEM, AID_SYSTEM) < 0) { - return -1; + } + + // Ensure media directories for any existing users + DIR *dir; + struct dirent *dirent; + char user_media_dir[PATH_MAX]; + + dir = opendir(user_data_dir); + if (dir != NULL) { + while ((dirent = readdir(dir))) { + if (dirent->d_type == DT_DIR) { + const char *name = dirent->d_name; + + // skip "." and ".." + if (name[0] == '.') { + if (name[1] == 0) continue; + if ((name[1] == '.') && (name[2] == 0)) continue; + } + + // /data/media/ + snprintf(user_media_dir, PATH_MAX, "%s%s", android_media_dir.path, name); + if (fs_prepare_dir(user_media_dir, 0770, AID_MEDIA_RW, AID_MEDIA_RW) == -1) { + goto fail; + } + } } - if (chmod(user_data_dir, 0711) < 0) { - return -1; + closedir(dir); + } + + version = 1; + } + + // /data/media/obb + char media_obb_dir[PATH_MAX]; + snprintf(media_obb_dir, PATH_MAX, "%sobb", android_media_dir.path); + + if (version == 1) { + // Introducing /data/media/obb for sharing OBB across users; migrate + // any existing OBB files from owner. + ALOGD("Upgrading to shared /data/media/obb"); + + // /data/media/0/Android/obb + char owner_obb_path[PATH_MAX]; + snprintf(owner_obb_path, PATH_MAX, "%s0/Android/obb", android_media_dir.path); + + // Only move if target doesn't already exist + if (access(media_obb_dir, F_OK) != 0 && access(owner_obb_path, F_OK) == 0) { + if (rename(owner_obb_path, media_obb_dir) == -1) { + ALOGE("Failed to move OBB from owner: %s", strerror(errno)); + goto fail; } } - // Make the /data/user/0 symlink to /data/data if necessary - if (access(primary_data_dir, R_OK) < 0) { - ret = symlink(legacy_data_dir, primary_data_dir); + + version = 2; + } + + if (ensure_media_user_dirs(0) == -1) { + ALOGE("Failed to setup media for user 0"); + goto fail; + } + if (fs_prepare_dir(media_obb_dir, 0770, AID_MEDIA_RW, AID_MEDIA_RW) == -1) { + goto fail; + } + + // Persist layout version if changed + if (version != oldVersion) { + if (fs_write_atomic_int(version_path, version) == -1) { + ALOGE("Failed to save version to %s: %s", version_path, strerror(errno)); + goto fail; } - free(user_data_dir); - free(legacy_data_dir); - free(primary_data_dir); } - return ret; + + // Success! + res = 0; + +fail: + free(user_data_dir); + free(legacy_data_dir); + free(primary_data_dir); + return res; +} + +static void drop_privileges() { + if (prctl(PR_SET_KEEPCAPS, 1) < 0) { + ALOGE("prctl(PR_SET_KEEPCAPS) failed: %s\n", strerror(errno)); + exit(1); + } + + if (setgid(AID_INSTALL) < 0) { + ALOGE("setgid() can't drop privileges; exiting.\n"); + exit(1); + } + + if (setuid(AID_INSTALL) < 0) { + ALOGE("setuid() can't drop privileges; exiting.\n"); + exit(1); + } + + struct __user_cap_header_struct capheader; + struct __user_cap_data_struct capdata[2]; + memset(&capheader, 0, sizeof(capheader)); + memset(&capdata, 0, sizeof(capdata)); + capheader.version = _LINUX_CAPABILITY_VERSION_3; + capheader.pid = 0; + + capdata[CAP_TO_INDEX(CAP_DAC_OVERRIDE)].permitted |= CAP_TO_MASK(CAP_DAC_OVERRIDE); + capdata[CAP_TO_INDEX(CAP_CHOWN)].permitted |= CAP_TO_MASK(CAP_CHOWN); + capdata[CAP_TO_INDEX(CAP_SETUID)].permitted |= CAP_TO_MASK(CAP_SETUID); + capdata[CAP_TO_INDEX(CAP_SETGID)].permitted |= CAP_TO_MASK(CAP_SETGID); + + capdata[0].effective = capdata[0].permitted; + capdata[1].effective = capdata[1].permitted; + capdata[0].inheritable = 0; + capdata[1].inheritable = 0; + + if (capset(&capheader, &capdata[0]) < 0) { + ALOGE("capset failed: %s\n", strerror(errno)); + exit(1); + } } int main(const int argc, const char *argv[]) { @@ -365,6 +532,8 @@ int main(const int argc, const char *argv[]) { socklen_t alen; int lsocket, s, count; + ALOGI("installd firing up\n"); + if (initialize_globals() < 0) { ALOGE("Could not initialize globals; exiting.\n"); exit(1); @@ -375,6 +544,8 @@ int main(const int argc, const char *argv[]) { exit(1); } + drop_privileges(); + lsocket = android_get_control_socket(SOCKET_PATH); if (lsocket < 0) { ALOGE("Failed to get socket from environment: %s\n", strerror(errno)); diff --git a/cmds/installd/installd.h b/cmds/installd/installd.h index 1b843fd997ba1..c352b60e6a914 100644 --- a/cmds/installd/installd.h +++ b/cmds/installd/installd.h @@ -32,9 +32,11 @@ #include #include +#include #include #include #include +#include #include @@ -60,12 +62,17 @@ #define APP_SUBDIR "app/" // sub-directory under ANDROID_DATA +#define APP_LIB_SUBDIR "app-lib/" // sub-directory under ANDROID_DATA + +#define MEDIA_SUBDIR "media/" // sub-directory under ANDROID_DATA + /* other handy constants */ #define PRIVATE_APP_SUBDIR "app-private/" // sub-directory under ANDROID_DATA #define DALVIK_CACHE_PREFIX "/data/dalvik-cache/" #define DALVIK_CACHE_POSTFIX "/classes.dex" +#define DALVIK_SYSTEM_CACHE_PREFIX "/cache/dalvik-cache/" #define UPDATE_COMMANDS_DIR_PREFIX "/system/etc/updatecmds/" @@ -89,10 +96,39 @@ typedef struct { extern dir_rec_t android_app_dir; extern dir_rec_t android_app_private_dir; +extern dir_rec_t android_app_lib_dir; extern dir_rec_t android_data_dir; extern dir_rec_t android_asec_dir; +extern dir_rec_t android_media_dir; extern dir_rec_array_t android_system_dirs; +typedef struct cache_dir_struct { + struct cache_dir_struct* parent; + int32_t childCount; + int32_t hiddenCount; + int32_t deleted; + char name[]; +} cache_dir_t; + +typedef struct { + cache_dir_t* dir; + time_t modTime; + char name[]; +} cache_file_t; + +typedef struct { + size_t numDirs; + size_t availDirs; + cache_dir_t** dirs; + size_t numFiles; + size_t availFiles; + cache_file_t** files; + size_t numCollected; + void* memBlocks; + int8_t* curMemBlockAvail; + int8_t* curMemBlockEnd; +} cache_t; + /* util.c */ int create_pkg_path_in_dir(char path[PKG_PATH_MAX], @@ -108,6 +144,8 @@ int create_pkg_path(char path[PKG_PATH_MAX], int create_persona_path(char path[PKG_PATH_MAX], uid_t persona); +int create_persona_media_path(char path[PKG_PATH_MAX], userid_t userid); + int create_move_path(char path[PKG_PATH_MAX], const char* pkgname, const char* leaf, @@ -123,6 +161,18 @@ int delete_dir_contents(const char *pathname, int delete_dir_contents_fd(int dfd, const char *name); +int lookup_media_dir(char basepath[PATH_MAX], const char *dir); + +int64_t data_disk_free(); + +cache_t* start_cache_collection(); + +void add_cache_files(cache_t* cache, const char *basepath, const char *cachedir); + +void clear_cache_files(cache_t* cache, int64_t free_size); + +void finish_cache_collection(cache_t* cache); + int validate_system_app_path(const char* path); int get_path_from_env(dir_rec_t* rec, const char* var); @@ -138,6 +188,9 @@ int append_and_increment(char** dst, const char* src, size_t* dst_size); char *build_string2(char *s1, char *s2); char *build_string3(char *s1, char *s2, char *s3); +int ensure_dir(const char* path, mode_t mode, uid_t uid, gid_t gid); +int ensure_media_user_dirs(userid_t userid); + /* commands.c */ int install(const char *pkgname, uid_t uid, gid_t gid); @@ -148,15 +201,14 @@ int delete_user_data(const char *pkgname, uid_t persona); int make_user_data(const char *pkgname, uid_t uid, uid_t persona); int delete_persona(uid_t persona); int clone_persona_data(uid_t src_persona, uid_t target_persona, int copy); -int delete_cache(const char *pkgname); +int delete_cache(const char *pkgname, uid_t persona); int move_dex(const char *src, const char *dst); int rm_dex(const char *path); int protect(char *pkgname, gid_t gid); -int get_size(const char *pkgname, const char *apkpath, const char *fwdlock_apkpath, +int get_size(const char *pkgname, int persona, const char *apkpath, const char *fwdlock_apkpath, const char *asecpath, int64_t *codesize, int64_t *datasize, int64_t *cachesize, int64_t *asecsize); int free_cache(int64_t free_size); int dexopt(const char *apk_path, uid_t uid, int is_public); int movefiles(); -int linklib(const char* target, const char* source); -int unlinklib(const char* libPath); +int linklib(const char* target, const char* source, int userId); diff --git a/cmds/installd/utils.c b/cmds/installd/utils.c index 52ec9e86a44a0..625a35efec936 100644 --- a/cmds/installd/utils.c +++ b/cmds/installd/utils.c @@ -16,6 +16,8 @@ #include "installd.h" +#define CACHE_NOISY(x) //x + int create_pkg_path_in_dir(char path[PKG_PATH_MAX], const dir_rec_t* dir, const char* pkgname, @@ -135,6 +137,17 @@ int create_persona_path(char path[PKG_PATH_MAX], return 0; } +/** + * Create the path name for media for a certain persona. + * Returns 0 on success, and -1 on failure. + */ +int create_persona_media_path(char path[PATH_MAX], userid_t userid) { + if (snprintf(path, PATH_MAX, "%s%d", android_media_dir.path, userid) > PATH_MAX) { + return -1; + } + return 0; +} + int create_move_path(char path[PKG_PATH_MAX], const char* pkgname, const char* leaf, @@ -296,6 +309,489 @@ int delete_dir_contents_fd(int dfd, const char *name) return res; } +int lookup_media_dir(char basepath[PATH_MAX], const char *dir) +{ + DIR *d; + struct dirent *de; + struct stat s; + char* dirpos = basepath + strlen(basepath); + + if ((*(dirpos-1)) != '/') { + *dirpos = '/'; + dirpos++; + } + + CACHE_NOISY(ALOGI("Looking up %s in %s\n", dir, basepath)); + // Verify the path won't extend beyond our buffer, to avoid + // repeated checking later. + if ((dirpos-basepath+strlen(dir)) >= (PATH_MAX-1)) { + ALOGW("Path exceeds limit: %s%s", basepath, dir); + return -1; + } + + // First, can we find this directory with the case that is given? + strcpy(dirpos, dir); + if (stat(basepath, &s) >= 0) { + CACHE_NOISY(ALOGI("Found direct: %s\n", basepath)); + return 0; + } + + // Not found with that case... search through all entries to find + // one that matches regardless of case. + *dirpos = 0; + + d = opendir(basepath); + if (d == NULL) { + return -1; + } + + while ((de = readdir(d))) { + if (strcasecmp(de->d_name, dir) == 0) { + strcpy(dirpos, de->d_name); + closedir(d); + CACHE_NOISY(ALOGI("Found search: %s\n", basepath)); + return 0; + } + } + + ALOGW("Couldn't find %s in %s", dir, basepath); + closedir(d); + return -1; +} + +int64_t data_disk_free() +{ + struct statfs sfs; + if (statfs(android_data_dir.path, &sfs) == 0) { + return sfs.f_bavail * sfs.f_bsize; + } else { + ALOGE("Couldn't statfs %s: %s\n", android_data_dir.path, strerror(errno)); + return -1; + } +} + +cache_t* start_cache_collection() +{ + cache_t* cache = (cache_t*)calloc(1, sizeof(cache_t)); + return cache; +} + +#define CACHE_BLOCK_SIZE (512*1024) + +static void* _cache_malloc(cache_t* cache, size_t len) +{ + len = (len+3)&~3; + if (len > (CACHE_BLOCK_SIZE/2)) { + // It doesn't make sense to try to put this allocation into one + // of our blocks, because it is so big. Instead, make a new dedicated + // block for it. + int8_t* res = (int8_t*)malloc(len+sizeof(void*)); + if (res == NULL) { + return NULL; + } + CACHE_NOISY(ALOGI("Allocated large cache mem block: %p size %d", res, len)); + // Link it into our list of blocks, not disrupting the current one. + if (cache->memBlocks == NULL) { + *(void**)res = NULL; + cache->memBlocks = res; + } else { + *(void**)res = *(void**)cache->memBlocks; + *(void**)cache->memBlocks = res; + } + return res + sizeof(void*); + } + int8_t* res = cache->curMemBlockAvail; + int8_t* nextPos = res + len; + if (cache->memBlocks == NULL || nextPos > cache->curMemBlockEnd) { + int8_t* newBlock = malloc(CACHE_BLOCK_SIZE); + if (newBlock == NULL) { + return NULL; + } + CACHE_NOISY(ALOGI("Allocated new cache mem block: %p", newBlock)); + *(void**)newBlock = cache->memBlocks; + cache->memBlocks = newBlock; + res = cache->curMemBlockAvail = newBlock + sizeof(void*); + cache->curMemBlockEnd = newBlock + CACHE_BLOCK_SIZE; + nextPos = res + len; + } + CACHE_NOISY(ALOGI("cache_malloc: ret %p size %d, block=%p, nextPos=%p", + res, len, cache->memBlocks, nextPos)); + cache->curMemBlockAvail = nextPos; + return res; +} + +static void* _cache_realloc(cache_t* cache, void* cur, size_t origLen, size_t len) +{ + // This isn't really a realloc, but it is good enough for our purposes here. + void* alloc = _cache_malloc(cache, len); + if (alloc != NULL && cur != NULL) { + memcpy(alloc, cur, origLen < len ? origLen : len); + } + return alloc; +} + +static void _inc_num_cache_collected(cache_t* cache) +{ + cache->numCollected++; + if ((cache->numCollected%20000) == 0) { + ALOGI("Collected cache so far: %d directories, %d files", + cache->numDirs, cache->numFiles); + } +} + +static cache_dir_t* _add_cache_dir_t(cache_t* cache, cache_dir_t* parent, const char *name) +{ + size_t nameLen = strlen(name); + cache_dir_t* dir = (cache_dir_t*)_cache_malloc(cache, sizeof(cache_dir_t)+nameLen+1); + if (dir != NULL) { + dir->parent = parent; + dir->childCount = 0; + dir->hiddenCount = 0; + dir->deleted = 0; + strcpy(dir->name, name); + if (cache->numDirs >= cache->availDirs) { + size_t newAvail = cache->availDirs < 1000 ? 1000 : cache->availDirs*2; + cache_dir_t** newDirs = (cache_dir_t**)_cache_realloc(cache, cache->dirs, + cache->availDirs*sizeof(cache_dir_t*), newAvail*sizeof(cache_dir_t*)); + if (newDirs == NULL) { + ALOGE("Failure growing cache dirs array for %s\n", name); + return NULL; + } + cache->availDirs = newAvail; + cache->dirs = newDirs; + } + cache->dirs[cache->numDirs] = dir; + cache->numDirs++; + if (parent != NULL) { + parent->childCount++; + } + _inc_num_cache_collected(cache); + } else { + ALOGE("Failure allocating cache_dir_t for %s\n", name); + } + return dir; +} + +static cache_file_t* _add_cache_file_t(cache_t* cache, cache_dir_t* dir, time_t modTime, + const char *name) +{ + size_t nameLen = strlen(name); + cache_file_t* file = (cache_file_t*)_cache_malloc(cache, sizeof(cache_file_t)+nameLen+1); + if (file != NULL) { + file->dir = dir; + file->modTime = modTime; + strcpy(file->name, name); + if (cache->numFiles >= cache->availFiles) { + size_t newAvail = cache->availFiles < 1000 ? 1000 : cache->availFiles*2; + cache_file_t** newFiles = (cache_file_t**)_cache_realloc(cache, cache->files, + cache->availFiles*sizeof(cache_file_t*), newAvail*sizeof(cache_file_t*)); + if (newFiles == NULL) { + ALOGE("Failure growing cache file array for %s\n", name); + return NULL; + } + cache->availFiles = newAvail; + cache->files = newFiles; + } + CACHE_NOISY(ALOGI("Setting file %p at position %d in array %p", file, + cache->numFiles, cache->files)); + cache->files[cache->numFiles] = file; + cache->numFiles++; + dir->childCount++; + _inc_num_cache_collected(cache); + } else { + ALOGE("Failure allocating cache_file_t for %s\n", name); + } + return file; +} + +static int _add_cache_files(cache_t *cache, cache_dir_t *parentDir, const char *dirName, + DIR* dir, char *pathBase, char *pathPos, size_t pathAvailLen) +{ + struct dirent *de; + cache_dir_t* cacheDir = NULL; + int dfd; + + CACHE_NOISY(ALOGI("_add_cache_files: parent=%p dirName=%s dir=%p pathBase=%s", + parentDir, dirName, dir, pathBase)); + + dfd = dirfd(dir); + + if (dfd < 0) return 0; + + // Sub-directories always get added to the data structure, so if they + // are empty we will know about them to delete them later. + cacheDir = _add_cache_dir_t(cache, parentDir, dirName); + + while ((de = readdir(dir))) { + const char *name = de->d_name; + + if (de->d_type == DT_DIR) { + int subfd; + DIR *subdir; + + /* always skip "." and ".." */ + if (name[0] == '.') { + if (name[1] == 0) continue; + if ((name[1] == '.') && (name[2] == 0)) continue; + } + + subfd = openat(dfd, name, O_RDONLY | O_DIRECTORY); + if (subfd < 0) { + ALOGE("Couldn't openat %s: %s\n", name, strerror(errno)); + continue; + } + subdir = fdopendir(subfd); + if (subdir == NULL) { + ALOGE("Couldn't fdopendir %s: %s\n", name, strerror(errno)); + close(subfd); + continue; + } + if (cacheDir == NULL) { + cacheDir = _add_cache_dir_t(cache, parentDir, dirName); + } + if (cacheDir != NULL) { + // Update pathBase for the new path... this may change dirName + // if that is also pointing to the path, but we are done with it + // now. + size_t finallen = snprintf(pathPos, pathAvailLen, "/%s", name); + CACHE_NOISY(ALOGI("Collecting dir %s\n", pathBase)); + if (finallen < pathAvailLen) { + _add_cache_files(cache, cacheDir, name, subdir, pathBase, + pathPos+finallen, pathAvailLen-finallen); + } else { + // Whoops, the final path is too long! We'll just delete + // this directory. + ALOGW("Cache dir %s truncated in path %s; deleting dir\n", + name, pathBase); + _delete_dir_contents(subdir, NULL); + if (unlinkat(dfd, name, AT_REMOVEDIR) < 0) { + ALOGE("Couldn't unlinkat %s: %s\n", name, strerror(errno)); + } + } + } + closedir(subdir); + } else if (de->d_type == DT_REG) { + // Skip files that start with '.'; they will be deleted if + // their entire directory is deleted. This allows for metadata + // like ".nomedia" to remain in the directory until the entire + // directory is deleted. + if (cacheDir == NULL) { + cacheDir = _add_cache_dir_t(cache, parentDir, dirName); + } + if (name[0] == '.') { + cacheDir->hiddenCount++; + continue; + } + if (cacheDir != NULL) { + // Build final full path for file... this may change dirName + // if that is also pointing to the path, but we are done with it + // now. + size_t finallen = snprintf(pathPos, pathAvailLen, "/%s", name); + CACHE_NOISY(ALOGI("Collecting file %s\n", pathBase)); + if (finallen < pathAvailLen) { + struct stat s; + if (stat(pathBase, &s) >= 0) { + _add_cache_file_t(cache, cacheDir, s.st_mtime, name); + } else { + ALOGW("Unable to stat cache file %s; deleting\n", pathBase); + if (unlink(pathBase) < 0) { + ALOGE("Couldn't unlink %s: %s\n", pathBase, strerror(errno)); + } + } + } else { + // Whoops, the final path is too long! We'll just delete + // this file. + ALOGW("Cache file %s truncated in path %s; deleting\n", + name, pathBase); + if (unlinkat(dfd, name, 0) < 0) { + *pathPos = 0; + ALOGE("Couldn't unlinkat %s in %s: %s\n", name, pathBase, + strerror(errno)); + } + } + } + } else { + cacheDir->hiddenCount++; + } + } + return 0; +} + +void add_cache_files(cache_t* cache, const char *basepath, const char *cachedir) +{ + DIR *d; + struct dirent *de; + char dirname[PATH_MAX]; + + CACHE_NOISY(ALOGI("add_cache_files: base=%s cachedir=%s\n", basepath, cachedir)); + + d = opendir(basepath); + if (d == NULL) { + return; + } + + while ((de = readdir(d))) { + if (de->d_type == DT_DIR) { + DIR* subdir; + const char *name = de->d_name; + char* pathpos; + + /* always skip "." and ".." */ + if (name[0] == '.') { + if (name[1] == 0) continue; + if ((name[1] == '.') && (name[2] == 0)) continue; + } + + strcpy(dirname, basepath); + pathpos = dirname + strlen(dirname); + if ((*(pathpos-1)) != '/') { + *pathpos = '/'; + pathpos++; + *pathpos = 0; + } + if (cachedir != NULL) { + snprintf(pathpos, sizeof(dirname)-(pathpos-dirname), "%s/%s", name, cachedir); + } else { + snprintf(pathpos, sizeof(dirname)-(pathpos-dirname), "%s", name); + } + CACHE_NOISY(ALOGI("Adding cache files from dir: %s\n", dirname)); + subdir = opendir(dirname); + if (subdir != NULL) { + size_t dirnameLen = strlen(dirname); + _add_cache_files(cache, NULL, dirname, subdir, dirname, dirname+dirnameLen, + PATH_MAX - dirnameLen); + closedir(subdir); + } + } + } + + closedir(d); +} + +static char *create_dir_path(char path[PATH_MAX], cache_dir_t* dir) +{ + char *pos = path; + if (dir->parent != NULL) { + pos = create_dir_path(path, dir->parent); + } + // Note that we don't need to worry about going beyond the buffer, + // since when we were constructing the cache entries our maximum + // buffer size for full paths was PATH_MAX. + strcpy(pos, dir->name); + pos += strlen(pos); + *pos = '/'; + pos++; + *pos = 0; + return pos; +} + +static void delete_cache_dir(char path[PATH_MAX], cache_dir_t* dir) +{ + if (dir->parent != NULL) { + create_dir_path(path, dir); + ALOGI("DEL DIR %s\n", path); + if (dir->hiddenCount <= 0) { + if (rmdir(path)) { + ALOGE("Couldn't rmdir %s: %s\n", path, strerror(errno)); + return; + } + } else { + // The directory contains hidden files so we need to delete + // them along with the directory itself. + if (delete_dir_contents(path, 1, NULL)) { + return; + } + } + dir->parent->childCount--; + dir->deleted = 1; + if (dir->parent->childCount <= 0) { + delete_cache_dir(path, dir->parent); + } + } else if (dir->hiddenCount > 0) { + // This is a root directory, but it has hidden files. Get rid of + // all of those files, but not the directory itself. + create_dir_path(path, dir); + ALOGI("DEL CONTENTS %s\n", path); + delete_dir_contents(path, 0, NULL); + } +} + +static int cache_modtime_sort(const void *lhsP, const void *rhsP) +{ + const cache_file_t *lhs = *(const cache_file_t**)lhsP; + const cache_file_t *rhs = *(const cache_file_t**)rhsP; + return lhs->modTime < rhs->modTime ? -1 : (lhs->modTime > rhs->modTime ? 1 : 0); +} + +void clear_cache_files(cache_t* cache, int64_t free_size) +{ + size_t i; + int skip = 0; + char path[PATH_MAX]; + + ALOGI("Collected cache files: %d directories, %d files", + cache->numDirs, cache->numFiles); + + CACHE_NOISY(ALOGI("Sorting files...")); + qsort(cache->files, cache->numFiles, sizeof(cache_file_t*), + cache_modtime_sort); + + CACHE_NOISY(ALOGI("Cleaning empty directories...")); + for (i=cache->numDirs; i>0; i--) { + cache_dir_t* dir = cache->dirs[i-1]; + if (dir->childCount <= 0 && !dir->deleted) { + delete_cache_dir(path, dir); + } + } + + CACHE_NOISY(ALOGI("Trimming files...")); + for (i=0; inumFiles; i++) { + skip++; + if (skip > 10) { + if (data_disk_free() > free_size) { + return; + } + skip = 0; + } + cache_file_t* file = cache->files[i]; + strcpy(create_dir_path(path, file->dir), file->name); + ALOGI("DEL (mod %d) %s\n", (int)file->modTime, path); + if (unlink(path) < 0) { + ALOGE("Couldn't unlink %s: %s\n", path, strerror(errno)); + } + file->dir->childCount--; + if (file->dir->childCount <= 0) { + delete_cache_dir(path, file->dir); + } + } +} + +void finish_cache_collection(cache_t* cache) +{ + size_t i; + + CACHE_NOISY(ALOGI("clear_cache_files: %d dirs, %d files\n", cache->numDirs, cache->numFiles)); + CACHE_NOISY( + for (i=0; inumDirs; i++) { + cache_dir_t* dir = cache->dirs[i]; + ALOGI("dir #%d: %p %s parent=%p\n", i, dir, dir->name, dir->parent); + }) + CACHE_NOISY( + for (i=0; inumFiles; i++) { + cache_file_t* file = cache->files[i]; + ALOGI("file #%d: %p %s time=%d dir=%p\n", i, file, file->name, + (int)file->modTime, file->dir); + }) + void* block = cache->memBlocks; + while (block != NULL) { + void* nextBlock = *(void**)block; + CACHE_NOISY(ALOGI("Freeing cache mem block: %p", block)); + free(block); + block = nextBlock; + } + free(cache); +} + /** * Checks whether a path points to a system app (.apk file). Returns 0 * if it is a system app or -1 if it is not. @@ -494,3 +990,17 @@ char *build_string3(char *s1, char *s2, char *s3) { return result; } + +/* Ensure that /data/media directories are prepared for given user. */ +int ensure_media_user_dirs(userid_t userid) { + char media_user_path[PATH_MAX]; + char path[PATH_MAX]; + + // Ensure /data/media/ exists + create_persona_media_path(media_user_path, userid); + if (fs_prepare_dir(media_user_path, 0770, AID_MEDIA_RW, AID_MEDIA_RW) == -1) { + return -1; + } + + return 0; +} diff --git a/cmds/pm/src/com/android/commands/pm/Pm.java b/cmds/pm/src/com/android/commands/pm/Pm.java index 88a025e3c96df..42c9d34f31b08 100644 --- a/cmds/pm/src/com/android/commands/pm/Pm.java +++ b/cmds/pm/src/com/android/commands/pm/Pm.java @@ -35,13 +35,15 @@ import android.content.pm.PermissionGroupInfo; import android.content.pm.PermissionInfo; import android.content.pm.UserInfo; +import android.content.pm.VerificationParams; import android.content.res.AssetManager; import android.content.res.Resources; import android.net.Uri; -import android.os.Binder; -import android.os.Process; +import android.os.IUserManager; import android.os.RemoteException; import android.os.ServiceManager; +import android.os.UserHandle; +import android.os.UserManager; import java.io.File; import java.lang.reflect.Field; @@ -59,6 +61,7 @@ public final class Pm { IPackageManager mPm; + IUserManager mUm; private WeakHashMap mResourceCache = new WeakHashMap(); @@ -69,7 +72,6 @@ public final class Pm { private static final String PM_NOT_RUNNING_ERR = "Error: Could not access the Package Manager. Is the system running?"; - private static final int ROOT_UID = 0; public static void main(String[] args) { new Pm().run(args); @@ -82,6 +84,7 @@ public void run(String[] args) { return; } + mUm = IUserManager.Stub.asInterface(ServiceManager.getService("user")); mPm = IPackageManager.Stub.asInterface(ServiceManager.getService("package")); if (mPm == null) { System.err.println(PM_NOT_RUNNING_ERR); @@ -157,6 +160,11 @@ public void run(String[] args) { return; } + if ("trim-caches".equals(op)) { + runTrimCaches(); + return; + } + if ("create-user".equals(op)) { runCreateUser(); return; @@ -167,8 +175,8 @@ public void run(String[] args) { return; } - if ("list-users".equals(op)) { - runListUsers(); + if ("get-max-users".equals(op)) { + runGetMaxUsers(); return; } @@ -211,7 +219,6 @@ private void runList() { String type = nextArg(); if (type == null) { System.err.println("Error: didn't specify type of data to list"); - showUsage(); return; } if ("package".equals(type) || "packages".equals(type)) { @@ -230,7 +237,6 @@ private void runList() { runListUsers(); } else { System.err.println("Error: unknown list type '" + type + "'"); - showUsage(); } } @@ -242,6 +248,7 @@ private void runListPackages(boolean showApplicationPackage) { boolean listDisabled = false, listEnabled = false; boolean listSystem = false, listThirdParty = false; boolean listInstaller = false; + int userId = UserHandle.USER_OWNER; try { String opt; while ((opt=nextOption()) != null) { @@ -261,24 +268,24 @@ private void runListPackages(boolean showApplicationPackage) { listThirdParty = true; } else if (opt.equals("-i")) { listInstaller = true; + } else if (opt.equals("--user")) { + userId = Integer.parseInt(nextArg()); } else if (opt.equals("-u")) { getFlags |= PackageManager.GET_UNINSTALLED_PACKAGES; } else { System.err.println("Error: Unknown option: " + opt); - showUsage(); return; } } } catch (RuntimeException ex) { System.err.println("Error: " + ex.toString()); - showUsage(); return; } String filter = nextArg(); try { - final List packages = getInstalledPackages(mPm, getFlags); + final List packages = getInstalledPackages(mPm, getFlags, userId); int count = packages.size(); for (int p = 0 ; p < count ; p++) { @@ -312,7 +319,7 @@ private void runListPackages(boolean showApplicationPackage) { } @SuppressWarnings("unchecked") - private List getInstalledPackages(IPackageManager pm, int flags) + private List getInstalledPackages(IPackageManager pm, int flags, int userId) throws RemoteException { final List packageInfos = new ArrayList(); PackageInfo lastItem = null; @@ -320,7 +327,7 @@ private List getInstalledPackages(IPackageManager pm, int flags) do { final String lastKey = lastItem != null ? lastItem.packageName : null; - slice = pm.getInstalledPackages(flags, lastKey); + slice = pm.getInstalledPackages(flags, lastKey, userId); lastItem = slice.populateList(packageInfos, PackageInfo.CREATOR); } while (!slice.isLastSlice()); @@ -420,13 +427,11 @@ private void runListInstrumentation() { targetPackage = opt; } else { System.err.println("Error: Unknown option: " + opt); - showUsage(); return; } } } catch (RuntimeException ex) { System.err.println("Error: " + ex.toString()); - showUsage(); return; } @@ -518,7 +523,6 @@ private void runListPermissions() { dangerousOnly = true; } else { System.err.println("Error: Unknown option: " + opt); - showUsage(); return; } } @@ -667,7 +671,6 @@ private void runPath() { String pkg = nextArg(); if (pkg == null) { System.err.println("Error: no package specified"); - showUsage(); return; } displayPackageFilePath(pkg); @@ -725,20 +728,17 @@ private void runSetInstallLocation() { String arg = nextArg(); if (arg == null) { System.err.println("Error: no install location specified."); - showUsage(); return; } try { loc = Integer.parseInt(arg); } catch (NumberFormatException e) { System.err.println("Error: install location has to be a number."); - showUsage(); return; } try { if (!mPm.setInstallLocation(loc)) { System.err.println("Error: install location has to be a number."); - showUsage(); } } catch (RemoteException e) { System.err.println(e.toString()); @@ -765,7 +765,7 @@ private void runGetInstallLocation() { } private void runInstall() { - int installFlags = 0; + int installFlags = PackageManager.INSTALL_ALL_USERS; String installerPackageName = null; String opt; @@ -777,6 +777,8 @@ private void runInstall() { String macAlgo = null; byte[] macKey = null; byte[] tag = null; + String originatingUriString = null; + String referrer = null; while ((opt=nextOption()) != null) { if (opt.equals("-l")) { @@ -787,7 +789,6 @@ private void runInstall() { installerPackageName = nextOptionData(); if (installerPackageName == null) { System.err.println("Error: no value specified for -i"); - showUsage(); return; } } else if (opt.equals("-t")) { @@ -798,51 +799,58 @@ private void runInstall() { } else if (opt.equals("-f")) { // Override if -s option is specified. installFlags |= PackageManager.INSTALL_INTERNAL; + } else if (opt.equals("-d")) { + installFlags |= PackageManager.INSTALL_ALLOW_DOWNGRADE; } else if (opt.equals("--algo")) { algo = nextOptionData(); if (algo == null) { System.err.println("Error: must supply argument for --algo"); - showUsage(); return; } } else if (opt.equals("--iv")) { iv = hexToBytes(nextOptionData()); if (iv == null) { System.err.println("Error: must supply argument for --iv"); - showUsage(); return; } } else if (opt.equals("--key")) { key = hexToBytes(nextOptionData()); if (key == null) { System.err.println("Error: must supply argument for --key"); - showUsage(); return; } } else if (opt.equals("--macalgo")) { macAlgo = nextOptionData(); if (macAlgo == null) { System.err.println("Error: must supply argument for --macalgo"); - showUsage(); return; } } else if (opt.equals("--mackey")) { macKey = hexToBytes(nextOptionData()); if (macKey == null) { System.err.println("Error: must supply argument for --mackey"); - showUsage(); return; } } else if (opt.equals("--tag")) { tag = hexToBytes(nextOptionData()); if (tag == null) { System.err.println("Error: must supply argument for --tag"); - showUsage(); + return; + } + } else if (opt.equals("--originating-uri")) { + originatingUriString = nextOptionData(); + if (originatingUriString == null) { + System.err.println("Error: must supply argument for --originating-uri"); + return; + } + } else if (opt.equals("--referrer")) { + referrer = nextOptionData(); + if (referrer == null) { + System.err.println("Error: must supply argument for --referrer"); return; } } else { System.err.println("Error: Unknown option: " + opt); - showUsage(); return; } } @@ -852,7 +860,6 @@ private void runInstall() { || tag != null) { if (algo == null || iv == null || key == null) { System.err.println("Error: all of --algo, --iv, and --key must be specified"); - showUsage(); return; } @@ -860,7 +867,6 @@ private void runInstall() { if (macAlgo == null || macKey == null || tag == null) { System.err.println("Error: all of --macalgo, --mackey, and --tag must " + "be specified"); - showUsage(); return; } } @@ -887,6 +893,20 @@ private void runInstall() { final Uri apkURI; final Uri verificationURI; + final Uri originatingURI; + final Uri referrerURI; + + if (originatingUriString != null) { + originatingURI = Uri.parse(originatingUriString); + } else { + originatingURI = null; + } + + if (referrer != null) { + referrerURI = Uri.parse(referrer); + } else { + referrerURI = null; + } // Populate apkURI, must be present final String apkFilePath = nextArg(); @@ -895,7 +915,6 @@ private void runInstall() { apkURI = Uri.fromFile(new File(apkFilePath)); } else { System.err.println("Error: no package specified"); - showUsage(); return; } @@ -910,8 +929,11 @@ private void runInstall() { PackageInstallObserver obs = new PackageInstallObserver(); try { - mPm.installPackageWithVerification(apkURI, obs, installFlags, installerPackageName, - verificationURI, null, encryptionParams); + VerificationParams verificationParams = new VerificationParams(verificationURI, + originatingURI, referrerURI, VerificationParams.NO_UID, null); + + mPm.installPackageWithVerificationAndEncryption(apkURI, obs, installFlags, + installerPackageName, verificationParams, encryptionParams); synchronized (obs) { while (!obs.finished) { @@ -966,23 +988,19 @@ private byte[] hexToBytes(String input) { } public void runCreateUser() { - // Need to be run as root - if (Process.myUid() != ROOT_UID) { - System.err.println("Error: create-user must be run as root"); - return; - } String name; String arg = nextArg(); if (arg == null) { System.err.println("Error: no user name specified."); - showUsage(); return; } name = arg; try { - if (mPm.createUser(name, 0) == null) { + final UserInfo info = mUm.createUser(name, 0); + if (info != null) { + System.out.println("Success: created user id " + info.id); + } else { System.err.println("Error: couldn't create User."); - showUsage(); } } catch (RemoteException e) { System.err.println(e.toString()); @@ -992,29 +1010,23 @@ public void runCreateUser() { } public void runRemoveUser() { - // Need to be run as root - if (Process.myUid() != ROOT_UID) { - System.err.println("Error: remove-user must be run as root"); - return; - } int userId; String arg = nextArg(); if (arg == null) { System.err.println("Error: no user id specified."); - showUsage(); return; } try { userId = Integer.parseInt(arg); } catch (NumberFormatException e) { - System.err.println("Error: user id has to be a number."); - showUsage(); + System.err.println("Error: user id '" + arg + "' is not a number."); return; } try { - if (!mPm.removeUser(userId)) { - System.err.println("Error: couldn't remove user."); - showUsage(); + if (mUm.removeUser(userId)) { + System.out.println("Success: removed user"); + } else { + System.err.println("Error: couldn't remove user id " + userId); } } catch (RemoteException e) { System.err.println(e.toString()); @@ -1023,13 +1035,8 @@ public void runRemoveUser() { } public void runListUsers() { - // Need to be run as root - if (Process.myUid() != ROOT_UID) { - System.err.println("Error: list-users must be run as root"); - return; - } try { - List users = mPm.getUsers(); + List users = mUm.getUsers(false); if (users == null) { System.err.println("Error: couldn't get users"); } else { @@ -1043,6 +1050,11 @@ public void runListUsers() { System.err.println(PM_NOT_RUNNING_ERR); } } + + public void runGetMaxUsers() { + System.out.println("Maximum supported users: " + UserManager.getMaxSupportedUsers()); + } + class PackageDeleteObserver extends IPackageDeleteObserver.Stub { boolean finished; boolean result; @@ -1057,11 +1069,16 @@ public void packageDeleted(String packageName, int returnCode) { } private void runUninstall() { - int unInstallFlags = 0; + int unInstallFlags = PackageManager.DELETE_ALL_USERS; - String opt = nextOption(); - if (opt != null && opt.equals("-k")) { - unInstallFlags = PackageManager.DONT_DELETE_DATA; + String opt; + while ((opt=nextOption()) != null) { + if (opt.equals("-k")) { + unInstallFlags |= PackageManager.DELETE_KEEP_DATA; + } else { + System.err.println("Error: Unknown option: " + opt); + return; + } } String pkg = nextArg(); @@ -1098,7 +1115,7 @@ private boolean deletePackage(String pkg, int unInstallFlags) { return obs.result; } - class ClearDataObserver extends IPackageDataObserver.Stub { + static class ClearDataObserver extends IPackageDataObserver.Stub { boolean finished; boolean result; @@ -1114,6 +1131,19 @@ public void onRemoveCompleted(String packageName, boolean succeeded) throws Remo } private void runClear() { + int userId = 0; + String option = nextOption(); + if (option != null && option.equals("--user")) { + String optionData = nextOptionData(); + if (optionData == null || !isNumber(optionData)) { + System.err.println("Error: no USER_ID specified"); + showUsage(); + return; + } else { + userId = Integer.parseInt(optionData); + } + } + String pkg = nextArg(); if (pkg == null) { System.err.println("Error: no package specified"); @@ -1123,8 +1153,7 @@ private void runClear() { ClearDataObserver obs = new ClearDataObserver(); try { - if (!ActivityManagerNative.getDefault().clearApplicationUserData(pkg, obs, - Binder.getOrigCallingUser())) { + if (!ActivityManagerNative.getDefault().clearApplicationUserData(pkg, obs, userId)) { System.err.println("Failed"); } @@ -1162,7 +1191,7 @@ private static String enabledSettingToString(int state) { return "unknown"; } - private boolean isNumber(String s) { + private static boolean isNumber(String s) { try { Integer.parseInt(s); } catch (NumberFormatException nfe) { @@ -1272,6 +1301,75 @@ private void runSetPermissionEnforced() { } } + static class ClearCacheObserver extends IPackageDataObserver.Stub { + boolean finished; + boolean result; + + @Override + public void onRemoveCompleted(String packageName, boolean succeeded) throws RemoteException { + synchronized (this) { + finished = true; + result = succeeded; + notifyAll(); + } + } + + } + + private void runTrimCaches() { + String size = nextArg(); + if (size == null) { + System.err.println("Error: no size specified"); + showUsage(); + return; + } + int len = size.length(); + long multiplier = 1; + if (len > 1) { + char c = size.charAt(len-1); + if (c == 'K' || c == 'k') { + multiplier = 1024L; + } else if (c == 'M' || c == 'm') { + multiplier = 1024L*1024L; + } else if (c == 'G' || c == 'g') { + multiplier = 1024L*1024L*1024L; + } else { + System.err.println("Invalid suffix: " + c); + showUsage(); + return; + } + size = size.substring(0, len-1); + } + long sizeVal; + try { + sizeVal = Long.parseLong(size) * multiplier; + } catch (NumberFormatException e) { + System.err.println("Error: expected number at: " + size); + showUsage(); + return; + } + ClearDataObserver obs = new ClearDataObserver(); + try { + mPm.freeStorageAndNotify(sizeVal, obs); + synchronized (obs) { + while (!obs.finished) { + try { + obs.wait(); + } catch (InterruptedException e) { + } + } + } + } catch (RemoteException e) { + System.err.println(e.toString()); + System.err.println(PM_NOT_RUNNING_ERR); + } catch (IllegalArgumentException e) { + System.err.println("Bad argument: " + e.toString()); + showUsage(); + } catch (SecurityException e) { + System.err.println("Operation not allowed: " + e.toString()); + } + } + /** * Displays the package file for a package. * @param pckg @@ -1354,25 +1452,31 @@ private String nextArg() { } private static void showUsage() { - System.err.println("usage: pm list packages [-f] [-d] [-e] [-s] [-3] [-i] [-u] [FILTER]"); + System.err.println("usage: pm list packages [-f] [-d] [-e] [-s] [-3] [-i] [-u] [--user USER_ID] [FILTER]"); System.err.println(" pm list permission-groups"); System.err.println(" pm list permissions [-g] [-f] [-d] [-u] [GROUP]"); System.err.println(" pm list instrumentation [-f] [TARGET-PACKAGE]"); System.err.println(" pm list features"); System.err.println(" pm list libraries"); + System.err.println(" pm list users"); System.err.println(" pm path PACKAGE"); System.err.println(" pm install [-l] [-r] [-t] [-i INSTALLER_PACKAGE_NAME] [-s] [-f]"); - System.err.println(" [--algo --key --iv ] PATH"); + System.err.println(" [--algo --key --iv ]"); + System.err.println(" [--originating-uri ] [--referrer ] PATH"); System.err.println(" pm uninstall [-k] PACKAGE"); - System.err.println(" pm clear PACKAGE"); - System.err.println(" pm enable PACKAGE_OR_COMPONENT"); - System.err.println(" pm disable PACKAGE_OR_COMPONENT"); - System.err.println(" pm disable-user PACKAGE_OR_COMPONENT"); + System.err.println(" pm clear [--user USER_ID] PACKAGE"); + System.err.println(" pm enable [--user USER_ID] PACKAGE_OR_COMPONENT"); + System.err.println(" pm disable [--user USER_ID] PACKAGE_OR_COMPONENT"); + System.err.println(" pm disable-user [--user USER_ID] PACKAGE_OR_COMPONENT"); System.err.println(" pm grant PACKAGE PERMISSION"); System.err.println(" pm revoke PACKAGE PERMISSION"); System.err.println(" pm set-install-location [0/auto] [1/internal] [2/external]"); System.err.println(" pm get-install-location"); System.err.println(" pm set-permission-enforced PERMISSION [true|false]"); + System.err.println(" pm trim-caches DESIRED_FREE_SPACE"); + System.err.println(" pm create-user USER_NAME"); + System.err.println(" pm remove-user USER_ID"); + System.err.println(" pm get-max-users"); System.err.println(""); System.err.println("pm list packages: prints all packages, optionally only"); System.err.println(" those whose package name contains the text in FILTER. Options:"); @@ -1401,6 +1505,8 @@ private static void showUsage() { System.err.println(""); System.err.println("pm list features: prints all features of the system."); System.err.println(""); + System.err.println("pm list users: prints all users on the system."); + System.err.println(""); System.err.println("pm path: print the path to the .apk of the given PACKAGE."); System.err.println(""); System.err.println("pm install: installs a package to the system. Options:"); @@ -1410,6 +1516,7 @@ private static void showUsage() { System.err.println(" -i: specify the installer package name."); System.err.println(" -s: install package on sdcard."); System.err.println(" -f: install package on internal flash."); + System.err.println(" -d: allow version code downgrade."); System.err.println(""); System.err.println("pm uninstall: removes a package from the system. Options:"); System.err.println(" -k: keep the data and cache directories around after package removal."); @@ -1434,5 +1541,13 @@ private static void showUsage() { System.err.println(" 0 [auto]: Let system decide the best location"); System.err.println(" 1 [internal]: Install on internal device storage"); System.err.println(" 2 [external]: Install on external media"); + System.err.println(""); + System.err.println("pm trim-caches: trim cache files to reach the given free space."); + System.err.println(""); + System.err.println("pm create-user: create a new user with the given USER_NAME,"); + System.err.println(" printing the new user identifier of the user."); + System.err.println(""); + System.err.println("pm remove-user: remove the user with the given USER_IDENTIFIER,"); + System.err.println(" deleting all data associated with that user"); } } diff --git a/cmds/screencap/screencap.cpp b/cmds/screencap/screencap.cpp index 46e41e3d476ea..a1ea81ae6fe1d 100644 --- a/cmds/screencap/screencap.cpp +++ b/cmds/screencap/screencap.cpp @@ -25,6 +25,7 @@ #include #include +#include #include #include @@ -33,15 +34,18 @@ using namespace android; +static uint32_t DEFAULT_DISPLAY_ID = ISurfaceComposer::eDisplayIdMain; + static void usage(const char* pname) { fprintf(stderr, - "usage: %s [-hp] [FILENAME]\n" + "usage: %s [-hp] [-d display-id] [FILENAME]\n" " -h: this message\n" " -p: save the file as a png.\n" + " -d: specify the display id to capture, default %d.\n" "If FILENAME ends with .png it will be saved as a png.\n" "If FILENAME is not given, the results will be printed to stdout.\n", - pname + pname, DEFAULT_DISPLAY_ID ); } @@ -87,12 +91,16 @@ int main(int argc, char** argv) { const char* pname = argv[0]; bool png = false; + int32_t displayId = DEFAULT_DISPLAY_ID; int c; - while ((c = getopt(argc, argv, "ph")) != -1) { + while ((c = getopt(argc, argv, "phd:")) != -1) { switch (c) { case 'p': png = true; break; + case 'd': + displayId = atoi(optarg); + break; case '?': case 'h': usage(pname); @@ -131,7 +139,8 @@ int main(int argc, char** argv) size_t size = 0; ScreenshotClient screenshot; - if (screenshot.update() == NO_ERROR) { + sp display = SurfaceComposerClient::getBuiltInDisplay(displayId); + if (display != NULL && screenshot.update(display) == NO_ERROR) { base = screenshot.getPixels(); w = screenshot.getWidth(); h = screenshot.getHeight(); diff --git a/cmds/sensorservice/Android.mk b/cmds/sensorservice/Android.mk deleted file mode 100644 index 0811be57f61d9..0000000000000 --- a/cmds/sensorservice/Android.mk +++ /dev/null @@ -1,19 +0,0 @@ -LOCAL_PATH:= $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_SRC_FILES:= \ - main_sensorservice.cpp - -LOCAL_SHARED_LIBRARIES := \ - libsensorservice \ - libbinder \ - libutils - -LOCAL_C_INCLUDES := \ - $(LOCAL_PATH)/../../services/sensorservice - -LOCAL_MODULE_TAGS := optional - -LOCAL_MODULE:= sensorservice - -include $(BUILD_EXECUTABLE) diff --git a/cmds/sensorservice/main_sensorservice.cpp b/cmds/sensorservice/main_sensorservice.cpp deleted file mode 100644 index 8610627b80c32..0000000000000 --- a/cmds/sensorservice/main_sensorservice.cpp +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include -#include - -using namespace android; - -int main(int argc, char** argv) { - SensorService::publishAndJoinThreadPool(); - return 0; -} diff --git a/cmds/servicemanager/Android.mk b/cmds/servicemanager/Android.mk index 8840867a9dfa9..07860e53c264d 100644 --- a/cmds/servicemanager/Android.mk +++ b/cmds/servicemanager/Android.mk @@ -9,4 +9,10 @@ include $(CLEAR_VARS) LOCAL_SHARED_LIBRARIES := liblog LOCAL_SRC_FILES := service_manager.c binder.c LOCAL_MODULE := servicemanager +ifeq ($(BOARD_USE_YAMAHAPLAYER),true) + LOCAL_CFLAGS += -DYAMAHAPLAYER +endif +ifeq ($(BOARD_USE_SECTVOUT),true) + LOCAL_CFLAGS += -DSECTVOUT +endif include $(BUILD_EXECUTABLE) diff --git a/cmds/servicemanager/service_manager.c b/cmds/servicemanager/service_manager.c index 71c5622ec382c..63823a30a47cf 100644 --- a/cmds/servicemanager/service_manager.c +++ b/cmds/servicemanager/service_manager.c @@ -31,8 +31,16 @@ static struct { { AID_MEDIA, "media.player" }, { AID_MEDIA, "media.camera" }, { AID_MEDIA, "media.audio_policy" }, + { AID_MEDIA, "media.nvidia.audio_alsa" }, +#ifdef YAMAHAPLAYER + { AID_MEDIA, "media.yamahaplayer" }, +#endif +#ifdef SECTVOUT + { AID_MEDIA, "SecTVOutService" }, +#endif { AID_DRM, "drm.drmManager" }, { AID_NFC, "nfc" }, + { AID_BLUETOOTH, "bluetooth" }, { AID_RADIO, "radio.phone" }, { AID_RADIO, "radio.sms" }, { AID_RADIO, "radio.phonesubinfo" }, diff --git a/cmds/settings/Android.mk b/cmds/settings/Android.mk new file mode 100644 index 0000000000000..05deb99f72283 --- /dev/null +++ b/cmds/settings/Android.mk @@ -0,0 +1,18 @@ +# Copyright 2011 The Android Open Source Project +# +LOCAL_PATH:= $(call my-dir) +include $(CLEAR_VARS) + +LOCAL_SRC_FILES := $(call all-subdir-java-files) +LOCAL_MODULE := settings +LOCAL_MODULE_TAGS := optional +include $(BUILD_JAVA_LIBRARY) + +include $(CLEAR_VARS) +LOCAL_MODULE := settings +LOCAL_SRC_FILES := settings +LOCAL_MODULE_CLASS := EXECUTABLES +LOCAL_MODULE_TAGS := optional +include $(BUILD_PREBUILT) + + diff --git a/cmds/settings/settings b/cmds/settings/settings new file mode 100755 index 0000000000000..ef459ca7d4c4a --- /dev/null +++ b/cmds/settings/settings @@ -0,0 +1,5 @@ +# Script to start "settings" on the device +# +base=/system +export CLASSPATH=$base/framework/settings.jar +exec app_process $base/bin com.android.commands.settings.SettingsCmd "$@" diff --git a/cmds/settings/src/com/android/commands/settings/SettingsCmd.java b/cmds/settings/src/com/android/commands/settings/SettingsCmd.java new file mode 100644 index 0000000000000..0c69f01246b26 --- /dev/null +++ b/cmds/settings/src/com/android/commands/settings/SettingsCmd.java @@ -0,0 +1,220 @@ +/* + * 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.commands.settings; + +import android.app.ActivityManagerNative; +import android.app.IActivityManager; +import android.app.IActivityManager.ContentProviderHolder; +import android.content.IContentProvider; +import android.os.Binder; +import android.os.Bundle; +import android.os.IBinder; +import android.os.RemoteException; +import android.os.UserHandle; +import android.provider.Settings; + +public final class SettingsCmd { + static final String TAG = "settings"; + + enum CommandVerb { + UNSPECIFIED, + GET, + PUT + } + + static String[] mArgs; + int mNextArg; + int mUser = -1; // unspecified + CommandVerb mVerb = CommandVerb.UNSPECIFIED; + String mTable = null; + String mKey = null; + String mValue = null; + + public static void main(String[] args) { + if (args == null || args.length < 3) { + printUsage(); + return; + } + + mArgs = args; + try { + new SettingsCmd().run(); + } catch (Exception e) { + System.err.println("Unable to run settings command"); + } + } + + public void run() { + boolean valid = false; + String arg; + try { + while ((arg = nextArg()) != null) { + if ("--user".equals(arg)) { + if (mUser != -1) { + // --user specified more than once; invalid + break; + } + mUser = Integer.parseInt(nextArg()); + } else if (mVerb == CommandVerb.UNSPECIFIED) { + if ("get".equalsIgnoreCase(arg)) { + mVerb = CommandVerb.GET; + } else if ("put".equalsIgnoreCase(arg)) { + mVerb = CommandVerb.PUT; + } else { + // invalid + System.err.println("Invalid command: " + arg); + break; + } + } else if (mTable == null) { + if (!"system".equalsIgnoreCase(arg) + && !"secure".equalsIgnoreCase(arg) + && !"global".equalsIgnoreCase(arg)) { + System.err.println("Invalid namespace '" + arg + "'"); + break; // invalid + } + mTable = arg.toLowerCase(); + } else if (mVerb == CommandVerb.GET) { + mKey = arg; + if (mNextArg >= mArgs.length) { + valid = true; + } else { + System.err.println("Too many arguments"); + } + break; + } else if (mKey == null) { + mKey = arg; + // keep going; there's another PUT arg + } else { // PUT, final arg + mValue = arg; + if (mNextArg >= mArgs.length) { + valid = true; + } else { + System.err.println("Too many arguments"); + } + break; + } + } + } catch (Exception e) { + valid = false; + } + + if (valid) { + if (mUser < 0) { + mUser = UserHandle.USER_OWNER; + } + + try { + IActivityManager activityManager = ActivityManagerNative.getDefault(); + IContentProvider provider = null; + IBinder token = new Binder(); + try { + ContentProviderHolder holder = activityManager.getContentProviderExternal( + "settings", UserHandle.USER_OWNER, token); + if (holder == null) { + throw new IllegalStateException("Could not find settings provider"); + } + provider = holder.provider; + + switch (mVerb) { + case GET: + System.out.println(getForUser(provider, mUser, mTable, mKey)); + break; + case PUT: + putForUser(provider, mUser, mTable, mKey, mValue); + break; + default: + System.err.println("Unspecified command"); + break; + } + + } finally { + if (provider != null) { + activityManager.removeContentProviderExternal("settings", token); + } + } + } catch (Exception e) { + System.err.println("Error while accessing settings provider"); + e.printStackTrace(); + } + + } else { + printUsage(); + } + } + + private String nextArg() { + if (mNextArg >= mArgs.length) { + return null; + } + String arg = mArgs[mNextArg]; + mNextArg++; + return arg; + } + + String getForUser(IContentProvider provider, int userHandle, + final String table, final String key) { + final String callGetCommand; + if ("system".equals(table)) callGetCommand = Settings.CALL_METHOD_GET_SYSTEM; + else if ("secure".equals(table)) callGetCommand = Settings.CALL_METHOD_GET_SECURE; + else if ("global".equals(table)) callGetCommand = Settings.CALL_METHOD_GET_GLOBAL; + else { + System.err.println("Invalid table; no put performed"); + throw new IllegalArgumentException("Invalid table " + table); + } + + String result = null; + try { + Bundle arg = new Bundle(); + arg.putInt(Settings.CALL_METHOD_USER_KEY, userHandle); + Bundle b = provider.call(callGetCommand, key, arg); + if (b != null) { + result = b.getPairValue(); + } + } catch (RemoteException e) { + System.err.println("Can't read key " + key + " in " + table + " for user " + userHandle); + } + return result; + } + + void putForUser(IContentProvider provider, int userHandle, + final String table, final String key, final String value) { + final String callPutCommand; + if ("system".equals(table)) callPutCommand = Settings.CALL_METHOD_PUT_SYSTEM; + else if ("secure".equals(table)) callPutCommand = Settings.CALL_METHOD_PUT_SECURE; + else if ("global".equals(table)) callPutCommand = Settings.CALL_METHOD_PUT_GLOBAL; + else { + System.err.println("Invalid table; no put performed"); + return; + } + + try { + Bundle arg = new Bundle(); + arg.putString(Settings.NameValueTable.VALUE, value); + arg.putInt(Settings.CALL_METHOD_USER_KEY, userHandle); + provider.call(callPutCommand, key, arg); + } catch (RemoteException e) { + System.err.println("Can't set key " + key + " in " + table + " for user " + userHandle); + } + } + + private static void printUsage() { + System.err.println("usage: settings [--user NUM] get namespace key"); + System.err.println(" settings [--user NUM] put namespace key value"); + System.err.println("\n'namespace' is one of {system, secure, global}, case-insensitive"); + System.err.println("If '--user NUM' is not given, the operations are performed on the owner user."); + } +} diff --git a/cmds/svc/src/com/android/commands/svc/PowerCommand.java b/cmds/svc/src/com/android/commands/svc/PowerCommand.java index e1d6619916017..58105fae96cce 100644 --- a/cmds/svc/src/com/android/commands/svc/PowerCommand.java +++ b/cmds/svc/src/com/android/commands/svc/PowerCommand.java @@ -16,14 +16,12 @@ package com.android.commands.svc; -import android.os.Binder; -import android.os.IBinder; +import android.content.Context; +import android.os.BatteryManager; import android.os.IPowerManager; -import android.os.PowerManager; -import android.os.ServiceManager; import android.os.RemoteException; -import android.os.BatteryManager; -import android.content.Context; +import android.os.ServiceManager; +import android.os.SystemClock; public class PowerCommand extends Svc.Command { public PowerCommand() { @@ -37,7 +35,7 @@ public String shortHelp() { public String longHelp() { return shortHelp() + "\n" + "\n" - + "usage: svc power stayon [true|false|usb|ac]\n" + + "usage: svc power stayon [true|false|usb|ac|wireless]\n" + " Set the 'keep awake while plugged in' setting.\n"; } @@ -48,7 +46,8 @@ public void run(String[] args) { int val; if ("true".equals(args[2])) { val = BatteryManager.BATTERY_PLUGGED_AC | - BatteryManager.BATTERY_PLUGGED_USB; + BatteryManager.BATTERY_PLUGGED_USB | + BatteryManager.BATTERY_PLUGGED_WIRELESS; } else if ("false".equals(args[2])) { val = 0; @@ -56,17 +55,20 @@ else if ("false".equals(args[2])) { val = BatteryManager.BATTERY_PLUGGED_USB; } else if ("ac".equals(args[2])) { val = BatteryManager.BATTERY_PLUGGED_AC; - } - else { + } else if ("wireless".equals(args[2])) { + val = BatteryManager.BATTERY_PLUGGED_WIRELESS; + } else { break fail; } IPowerManager pm = IPowerManager.Stub.asInterface(ServiceManager.getService(Context.POWER_SERVICE)); try { - IBinder lock = new Binder(); - pm.acquireWakeLock(PowerManager.FULL_WAKE_LOCK, lock, "svc power", null); + if (val != 0) { + // if the request is not to set it to false, wake up the screen so that + // it can stay on as requested + pm.wakeUp(SystemClock.uptimeMillis()); + } pm.setStayOnSetting(val); - pm.releaseWakeLock(lock, 0); } catch (RemoteException e) { System.err.println("Faild to set setting: " + e); diff --git a/cmds/system_server/library/Android.mk b/cmds/system_server/library/Android.mk index 9f92330aec84c..c42424c607b4b 100644 --- a/cmds/system_server/library/Android.mk +++ b/cmds/system_server/library/Android.mk @@ -8,7 +8,7 @@ base = $(LOCAL_PATH)/../../.. native = $(LOCAL_PATH)/../../../../native LOCAL_C_INCLUDES := \ - $(base)/services/sensorservice \ + $(native)/services/sensorservice \ $(native)/services/surfaceflinger \ $(JNI_H_INCLUDE) diff --git a/core/java/android/accessibilityservice/AccessibilityService.java b/core/java/android/accessibilityservice/AccessibilityService.java index 81ee1920e4a84..b0bad07212187 100644 --- a/core/java/android/accessibilityservice/AccessibilityService.java +++ b/core/java/android/accessibilityservice/AccessibilityService.java @@ -323,7 +323,7 @@ public abstract class AccessibilityService extends Service { public static final int GLOBAL_ACTION_HOME = 2; /** - * Action to open the recents. + * Action to open the recent apps. */ public static final int GLOBAL_ACTION_RECENTS = 3; @@ -332,6 +332,11 @@ public abstract class AccessibilityService extends Service { */ public static final int GLOBAL_ACTION_NOTIFICATIONS = 4; + /** + * Action to open the quick settings. + */ + public static final int GLOBAL_ACTION_QUICK_SETTINGS = 5; + private static final String LOG_TAG = "AccessibilityService"; interface Callbacks { diff --git a/core/java/android/accessibilityservice/AccessibilityServiceInfo.java b/core/java/android/accessibilityservice/AccessibilityServiceInfo.java index 10ea0fe4da942..75a4f838ac1b9 100644 --- a/core/java/android/accessibilityservice/AccessibilityServiceInfo.java +++ b/core/java/android/accessibilityservice/AccessibilityServiceInfo.java @@ -84,6 +84,11 @@ public class AccessibilityServiceInfo implements Parcelable { */ public static final int FEEDBACK_GENERIC = 0x0000010; + /** + * Denotes braille feedback. + */ + public static final int FEEDBACK_BRAILLE = 0x0000020; + /** * Mask for all feedback types. * @@ -92,6 +97,7 @@ public class AccessibilityServiceInfo implements Parcelable { * @see #FEEDBACK_AUDIBLE * @see #FEEDBACK_VISUAL * @see #FEEDBACK_GENERIC + * @see #FEEDBACK_BRAILLE */ public static final int FEEDBACK_ALL_MASK = 0xFFFFFFFF; @@ -186,6 +192,7 @@ public class AccessibilityServiceInfo implements Parcelable { * @see #FEEDBACK_HAPTIC * @see #FEEDBACK_SPOKEN * @see #FEEDBACK_VISUAL + * @see #FEEDBACK_BRAILLE */ public int feedbackType; @@ -591,6 +598,12 @@ public static String feedbackTypeToString(int feedbackType) { } builder.append("FEEDBACK_VISUAL"); break; + case FEEDBACK_BRAILLE: + if (builder.length() > 1) { + builder.append(", "); + } + builder.append("FEEDBACK_BRAILLE"); + break; } } builder.append("]"); diff --git a/core/java/android/accounts/AccountAuthenticatorCache.java b/core/java/android/accounts/AccountAuthenticatorCache.java index 7214c5091cc68..f937cde82877d 100644 --- a/core/java/android/accounts/AccountAuthenticatorCache.java +++ b/core/java/android/accounts/AccountAuthenticatorCache.java @@ -16,17 +16,18 @@ package android.accounts; +import android.content.Context; import android.content.pm.PackageManager; import android.content.pm.RegisteredServicesCache; import android.content.pm.XmlSerializerAndParser; import android.content.res.Resources; import android.content.res.TypedArray; -import android.content.Context; -import android.util.AttributeSet; import android.text.TextUtils; +import android.util.AttributeSet; + import org.xmlpull.v1.XmlPullParser; -import org.xmlpull.v1.XmlSerializer; import org.xmlpull.v1.XmlPullParserException; +import org.xmlpull.v1.XmlSerializer; import java.io.IOException; diff --git a/core/java/android/accounts/AccountManager.java b/core/java/android/accounts/AccountManager.java index f3c6566eaf769..bcb35d5fdaf0d 100644 --- a/core/java/android/accounts/AccountManager.java +++ b/core/java/android/accounts/AccountManager.java @@ -28,6 +28,8 @@ import android.os.RemoteException; import android.os.Parcelable; import android.os.Build; +import android.os.Process; +import android.os.UserHandle; import android.util.Log; import android.text.TextUtils; @@ -42,7 +44,6 @@ import java.util.HashMap; import java.util.Map; -import com.google.android.collect.Lists; import com.google.android.collect.Maps; /** @@ -396,8 +397,13 @@ public Account[] getAccounts() { * (never null) if no accounts of the specified type have been added. */ public Account[] getAccountsByType(String type) { + return getAccountsByTypeAsUser(type, Process.myUserHandle()); + } + + /** @hide Same as {@link #getAccountsByType(String)} but for a specific user. */ + public Account[] getAccountsByTypeAsUser(String type, UserHandle userHandle) { try { - return mService.getAccounts(type); + return mService.getAccountsAsUser(type, userHandle.getIdentifier()); } catch (RemoteException e) { // won't ever happen throw new RuntimeException(e); @@ -1175,10 +1181,26 @@ public AccountManagerFuture confirmCredentials(final Account account, final Activity activity, final AccountManagerCallback callback, final Handler handler) { + return confirmCredentialsAsUser(account, options, activity, callback, handler, + Process.myUserHandle()); + } + + /** + * @hide + * Same as {@link #confirmCredentials(Account, Bundle, Activity, AccountManagerCallback, Handler)} + * but for the specified user. + */ + public AccountManagerFuture confirmCredentialsAsUser(final Account account, + final Bundle options, + final Activity activity, + final AccountManagerCallback callback, + final Handler handler, UserHandle userHandle) { if (account == null) throw new IllegalArgumentException("account is null"); + final int userId = userHandle.getIdentifier(); return new AmsTask(activity, handler, callback) { public void doWork() throws RemoteException { - mService.confirmCredentials(mResponse, account, options, activity != null); + mService.confirmCredentialsAsUser(mResponse, account, options, activity != null, + userId); } }.start(); } diff --git a/core/java/android/accounts/AccountManagerService.java b/core/java/android/accounts/AccountManagerService.java index 22e454f9dc2fd..2b1a2b21c5a3e 100644 --- a/core/java/android/accounts/AccountManagerService.java +++ b/core/java/android/accounts/AccountManagerService.java @@ -18,7 +18,7 @@ import android.Manifest; import android.app.ActivityManager; -import android.app.AppGlobals; +import android.app.ActivityManagerNative; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; @@ -32,10 +32,10 @@ import android.content.pm.ApplicationInfo; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; +import android.content.pm.PackageManager.NameNotFoundException; import android.content.pm.RegisteredServicesCache; import android.content.pm.RegisteredServicesCacheListener; import android.content.pm.UserInfo; -import android.content.res.Resources; import android.database.Cursor; import android.database.DatabaseUtils; import android.database.sqlite.SQLiteDatabase; @@ -50,14 +50,18 @@ import android.os.Message; import android.os.RemoteException; import android.os.SystemClock; -import android.os.UserId; +import android.os.UserHandle; +import android.os.UserManager; import android.text.TextUtils; import android.util.Log; import android.util.Pair; +import android.util.Slog; import android.util.SparseArray; import com.android.internal.R; import com.android.internal.util.IndentingPrintWriter; +import com.google.android.collect.Lists; +import com.google.android.collect.Sets; import java.io.File; import java.io.FileDescriptor; @@ -66,6 +70,7 @@ import java.util.Arrays; import java.util.Collection; import java.util.HashMap; +import java.util.HashSet; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -92,6 +97,7 @@ public class AccountManagerService private final Context mContext; private final PackageManager mPackageManager; + private UserManager mUserManager; private HandlerThread mMessageThread; private final MessageHandler mMessageHandler; @@ -241,8 +247,13 @@ public void onReceive(Context context, Intent intent) { } public void systemReady() { - mAuthenticatorCache.generateServicesMap(); - initUser(0); + } + + private UserManager getUserManager() { + if (mUserManager == null) { + mUserManager = (UserManager) mContext.getSystemService(Context.USER_SERVICE); + } + return mUserManager; } private UserAccounts initUser(int userId) { @@ -252,7 +263,7 @@ private UserAccounts initUser(int userId) { accounts = new UserAccounts(mContext, userId); mUsers.append(userId, accounts); purgeOldGrants(accounts); - validateAccountsAndPopulateCache(accounts); + validateAccountsInternal(accounts, true /* invalidateAuthenticatorCache */); } return accounts; } @@ -290,7 +301,34 @@ private void purgeOldGrants(UserAccounts accounts) { } } - private void validateAccountsAndPopulateCache(UserAccounts accounts) { + /** + * Validate internal set of accounts against installed authenticators for + * given user. Clears cached authenticators before validating. + */ + public void validateAccounts(int userId) { + final UserAccounts accounts = getUserAccounts(userId); + + // Invalidate user-specific cache to make sure we catch any + // removed authenticators. + validateAccountsInternal(accounts, true /* invalidateAuthenticatorCache */); + } + + /** + * Validate internal set of accounts against installed authenticators for + * given user. Clear cached authenticators before validating when requested. + */ + private void validateAccountsInternal( + UserAccounts accounts, boolean invalidateAuthenticatorCache) { + if (invalidateAuthenticatorCache) { + mAuthenticatorCache.invalidateCache(accounts.userId); + } + + final HashSet knownAuth = Sets.newHashSet(); + for (RegisteredServicesCache.ServiceInfo service : + mAuthenticatorCache.getAllServices(accounts.userId)) { + knownAuth.add(service.type); + } + synchronized (accounts.cacheLock) { final SQLiteDatabase db = accounts.openHelper.getWritableDatabase(); boolean accountDeleted = false; @@ -305,9 +343,9 @@ private void validateAccountsAndPopulateCache(UserAccounts accounts) { final long accountId = cursor.getLong(0); final String accountType = cursor.getString(1); final String accountName = cursor.getString(2); - if (mAuthenticatorCache.getServiceInfo( - AuthenticatorDescription.newKey(accountType)) == null) { - Log.d(TAG, "deleting account " + accountName + " because type " + + if (!knownAuth.contains(AuthenticatorDescription.newKey(accountType))) { + Slog.w(TAG, "deleting account " + accountName + " because type " + accountType + " no longer has a registered authenticator"); db.delete(TABLE_ACCOUNTS, ACCOUNTS_ID + "=" + accountId, null); accountDeleted = true; @@ -345,7 +383,7 @@ private void validateAccountsAndPopulateCache(UserAccounts accounts) { } private UserAccounts getUserAccountsForCaller() { - return getUserAccounts(UserId.getCallingUserId()); + return getUserAccounts(UserHandle.getCallingUserId()); } protected UserAccounts getUserAccounts(int userId) { @@ -360,7 +398,7 @@ protected UserAccounts getUserAccounts(int userId) { } private void onUserRemoved(Intent intent) { - int userId = intent.getIntExtra(Intent.EXTRA_USERID, -1); + int userId = intent.getIntExtra(Intent.EXTRA_USER_HANDLE, -1); if (userId < 1) return; UserAccounts accounts; @@ -381,25 +419,10 @@ private void onUserRemoved(Intent intent) { } } - private List getAllUsers() { - try { - return AppGlobals.getPackageManager().getUsers(); - } catch (RemoteException re) { - // Local to system process, shouldn't happen - } - return null; - } - - public void onServiceChanged(AuthenticatorDescription desc, boolean removed) { - // Validate accounts for all users - List users = getAllUsers(); - if (users == null) { - validateAccountsAndPopulateCache(getUserAccountsForCaller()); - } else { - for (UserInfo user : users) { - validateAccountsAndPopulateCache(getUserAccounts(user.id)); - } - } + @Override + public void onServiceChanged(AuthenticatorDescription desc, int userId, boolean removed) { + Slog.d(TAG, "onServiceChanged() for userId " + userId); + validateAccountsInternal(getUserAccounts(userId), false /* invalidateAuthenticatorCache */); } public String getPassword(Account account) { @@ -466,10 +489,11 @@ public AuthenticatorDescription[] getAuthenticatorTypes() { + "caller's uid " + Binder.getCallingUid() + ", pid " + Binder.getCallingPid()); } - long identityToken = clearCallingIdentity(); + final int userId = UserHandle.getCallingUserId(); + final long identityToken = clearCallingIdentity(); try { Collection> - authenticatorCollection = mAuthenticatorCache.getAllServices(); + authenticatorCollection = mAuthenticatorCache.getAllServices(userId); AuthenticatorDescription[] types = new AuthenticatorDescription[authenticatorCollection.size()]; int i = 0; @@ -643,16 +667,17 @@ public void removeAccount(IAccountManagerResponse response, Account account) { if (response == null) throw new IllegalArgumentException("response is null"); if (account == null) throw new IllegalArgumentException("account is null"); checkManageAccountsPermission(); + UserHandle user = Binder.getCallingUserHandle(); UserAccounts accounts = getUserAccountsForCaller(); long identityToken = clearCallingIdentity(); - cancelNotification(getSigninRequiredNotificationId(accounts, account)); + cancelNotification(getSigninRequiredNotificationId(accounts, account), user); synchronized(accounts.credentialsPermissionNotificationIds) { for (Pair, Integer> pair: accounts.credentialsPermissionNotificationIds.keySet()) { if (account.equals(pair.first.first)) { int id = accounts.credentialsPermissionNotificationIds.get(pair); - cancelNotification(id); + cancelNotification(id, user); } } } @@ -785,7 +810,8 @@ private boolean saveAuthTokenToDatabase(UserAccounts accounts, Account account, if (account == null || type == null) { return false; } - cancelNotification(getSigninRequiredNotificationId(accounts, account)); + cancelNotification(getSigninRequiredNotificationId(accounts, account), + new UserHandle(accounts.userId)); synchronized (accounts.cacheLock) { final SQLiteDatabase db = accounts.openHelper.getWritableDatabase(); db.beginTransaction(); @@ -896,7 +922,7 @@ private void setPasswordInternal(UserAccounts accounts, Account account, String private void sendAccountsChangedBroadcast(int userId) { Log.i(TAG, "the accounts changed, sending broadcast of " + ACCOUNTS_CHANGED_INTENT.getAction()); - mContext.sendBroadcast(ACCOUNTS_CHANGED_INTENT, userId); + mContext.sendBroadcastAsUser(ACCOUNTS_CHANGED_INTENT, new UserHandle(userId)); } public void clearPassword(Account account) { @@ -1000,7 +1026,7 @@ public void getAuthTokenLabel(IAccountManagerResponse response, final String acc if (callingUid != android.os.Process.SYSTEM_UID) { throw new SecurityException("can only call from system"); } - UserAccounts accounts = getUserAccounts(UserId.getUserId(callingUid)); + UserAccounts accounts = getUserAccounts(UserHandle.getUserId(callingUid)); long identityToken = clearCallingIdentity(); try { new Session(accounts, response, accountType, false, @@ -1048,10 +1074,10 @@ public void getAuthToken(IAccountManagerResponse response, final Account account if (account == null) throw new IllegalArgumentException("account is null"); if (authTokenType == null) throw new IllegalArgumentException("authTokenType is null"); checkBinderPermission(Manifest.permission.USE_CREDENTIALS); - UserAccounts accounts = getUserAccountsForCaller(); - AccountAuthenticatorCache.ServiceInfo authenticatorInfo = - mAuthenticatorCache.getServiceInfo( - AuthenticatorDescription.newKey(account.type)); + final UserAccounts accounts = getUserAccountsForCaller(); + final RegisteredServicesCache.ServiceInfo authenticatorInfo; + authenticatorInfo = mAuthenticatorCache.getServiceInfo( + AuthenticatorDescription.newKey(account.type), accounts.userId); final boolean customTokens = authenticatorInfo != null && authenticatorInfo.type.customTokens; @@ -1068,7 +1094,7 @@ public void getAuthToken(IAccountManagerResponse response, final Account account if (notifyOnAuthFailure) { loginOptions.putBoolean(AccountManager.KEY_NOTIFY_ON_FAILURE, true); } - + long identityToken = clearCallingIdentity(); try { // if the caller has permission, do the peek. otherwise go the more expensive @@ -1137,7 +1163,7 @@ public void onResult(Bundle result) { if (intent != null && notifyOnAuthFailure && !customTokens) { doNotification(mAccounts, account, result.getString(AccountManager.KEY_AUTH_FAILED_MESSAGE), - intent); + intent, accounts.userId); } } super.onResult(result); @@ -1148,7 +1174,8 @@ public void onResult(Bundle result) { } } - private void createNoCredentialsPermissionNotification(Account account, Intent intent) { + private void createNoCredentialsPermissionNotification(Account account, Intent intent, + int userId) { int uid = intent.getIntExtra( GrantCredentialsPermissionActivity.EXTRAS_REQUESTING_UID, -1); String authTokenType = intent.getStringExtra( @@ -1168,32 +1195,12 @@ private void createNoCredentialsPermissionNotification(Account account, Intent i title = titleAndSubtitle.substring(0, index); subtitle = titleAndSubtitle.substring(index + 1); } - n.setLatestEventInfo(mContext, - title, subtitle, - PendingIntent.getActivity(mContext, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT)); - installNotification(getCredentialPermissionNotificationId(account, authTokenType, uid), n); - } - - String getAccountLabel(String accountType) { - RegisteredServicesCache.ServiceInfo serviceInfo = - mAuthenticatorCache.getServiceInfo( - AuthenticatorDescription.newKey(accountType)); - if (serviceInfo == null) { - throw new IllegalArgumentException("unknown account type: " + accountType); - } - - final Context authContext; - try { - authContext = mContext.createPackageContext( - serviceInfo.type.packageName, 0); - } catch (PackageManager.NameNotFoundException e) { - throw new IllegalArgumentException("unknown account type: " + accountType); - } - try { - return authContext.getString(serviceInfo.type.labelId); - } catch (Resources.NotFoundException e) { - throw new IllegalArgumentException("unknown account type: " + accountType); - } + UserHandle user = new UserHandle(userId); + n.setLatestEventInfo(mContext, title, subtitle, + PendingIntent.getActivityAsUser(mContext, 0, intent, + PendingIntent.FLAG_CANCEL_CURRENT, null, user)); + installNotification(getCredentialPermissionNotificationId( + account, authTokenType, uid), n, user); } private Intent newGrantCredentialsPermissionIntent(Account account, int uid, @@ -1218,7 +1225,7 @@ private Intent newGrantCredentialsPermissionIntent(Account account, int uid, private Integer getCredentialPermissionNotificationId(Account account, String authTokenType, int uid) { Integer id; - UserAccounts accounts = getUserAccounts(UserId.getUserId(uid)); + UserAccounts accounts = getUserAccounts(UserHandle.getUserId(uid)); synchronized (accounts.credentialsPermissionNotificationIds) { final Pair, Integer> key = new Pair, Integer>( @@ -1290,8 +1297,17 @@ protected String toDebugString(long now) { } } - public void confirmCredentials(IAccountManagerResponse response, - final Account account, final Bundle options, final boolean expectActivityLaunch) { + @Override + public void confirmCredentialsAsUser(IAccountManagerResponse response, + final Account account, final Bundle options, final boolean expectActivityLaunch, + int userId) { + // Only allow the system process to read accounts of other users + if (userId != UserHandle.getCallingUserId() + && Binder.getCallingUid() != android.os.Process.myUid()) { + throw new SecurityException("User " + UserHandle.getCallingUserId() + + " trying to confirm account credentials for " + userId); + } + if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "confirmCredentials: " + account + ", response " + response @@ -1302,7 +1318,7 @@ public void confirmCredentials(IAccountManagerResponse response, if (response == null) throw new IllegalArgumentException("response is null"); if (account == null) throw new IllegalArgumentException("account is null"); checkManageAccountsPermission(); - UserAccounts accounts = getUserAccountsForCaller(); + UserAccounts accounts = getUserAccounts(userId); long identityToken = clearCallingIdentity(); try { new Session(accounts, response, account.type, expectActivityLaunch, @@ -1497,38 +1513,66 @@ public Account[] getAccounts(int userId) { } /** - * Returns all the accounts qualified by user. + * Returns accounts for all running users. + * * @hide */ + public AccountAndUser[] getRunningAccounts() { + final int[] runningUserIds; + try { + runningUserIds = ActivityManagerNative.getDefault().getRunningUserIds(); + } catch (RemoteException e) { + // Running in system_server; should never happen + throw new RuntimeException(e); + } + return getAccounts(runningUserIds); + } + + /** {@hide} */ public AccountAndUser[] getAllAccounts() { - ArrayList allAccounts = new ArrayList(); - List users = getAllUsers(); - if (users == null) return new AccountAndUser[0]; + final List users = getUserManager().getUsers(); + final int[] userIds = new int[users.size()]; + for (int i = 0; i < userIds.length; i++) { + userIds[i] = users.get(i).id; + } + return getAccounts(userIds); + } - synchronized(mUsers) { - for (UserInfo user : users) { - UserAccounts userAccounts = getUserAccounts(user.id); + private AccountAndUser[] getAccounts(int[] userIds) { + final ArrayList runningAccounts = Lists.newArrayList(); + synchronized (mUsers) { + for (int userId : userIds) { + UserAccounts userAccounts = getUserAccounts(userId); if (userAccounts == null) continue; synchronized (userAccounts.cacheLock) { Account[] accounts = getAccountsFromCacheLocked(userAccounts, null); for (int a = 0; a < accounts.length; a++) { - allAccounts.add(new AccountAndUser(accounts[a], user.id)); + runningAccounts.add(new AccountAndUser(accounts[a], userId)); } } } } - AccountAndUser[] accountsArray = new AccountAndUser[allAccounts.size()]; - return allAccounts.toArray(accountsArray); + + AccountAndUser[] accountsArray = new AccountAndUser[runningAccounts.size()]; + return runningAccounts.toArray(accountsArray); } - public Account[] getAccounts(String type) { + @Override + public Account[] getAccountsAsUser(String type, int userId) { + // Only allow the system process to read accounts of other users + if (userId != UserHandle.getCallingUserId() + && Binder.getCallingUid() != android.os.Process.myUid()) { + throw new SecurityException("User " + UserHandle.getCallingUserId() + + " trying to get account for " + userId); + } + if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "getAccounts: accountType " + type + ", caller's uid " + Binder.getCallingUid() + ", pid " + Binder.getCallingPid()); } checkReadAccountsPermission(); - UserAccounts accounts = getUserAccountsForCaller(); + UserAccounts accounts = getUserAccounts(userId); long identityToken = clearCallingIdentity(); try { synchronized (accounts.cacheLock) { @@ -1539,6 +1583,11 @@ public Account[] getAccounts(String type) { } } + @Override + public Account[] getAccounts(String type) { + return getAccountsAsUser(type, UserHandle.getCallingUserId()); + } + public void getAccountsByFeatures(IAccountManagerResponse response, String type, String[] features) { if (Log.isLoggable(TAG, Log.VERBOSE)) { @@ -1757,7 +1806,8 @@ public void onResult(Bundle result) { String accountType = result.getString(AccountManager.KEY_ACCOUNT_TYPE); if (!TextUtils.isEmpty(accountName) && !TextUtils.isEmpty(accountType)) { Account account = new Account(accountName, accountType); - cancelNotification(getSigninRequiredNotificationId(mAccounts, account)); + cancelNotification(getSigninRequiredNotificationId(mAccounts, account), + new UserHandle(mAccounts.userId)); } } IAccountManagerResponse response; @@ -1826,9 +1876,9 @@ public void onError(int errorCode, String errorMessage) { * if no authenticator or the bind fails then return false, otherwise return true */ private boolean bindToAuthenticator(String authenticatorType) { - AccountAuthenticatorCache.ServiceInfo authenticatorInfo = - mAuthenticatorCache.getServiceInfo( - AuthenticatorDescription.newKey(authenticatorType)); + final AccountAuthenticatorCache.ServiceInfo authenticatorInfo; + authenticatorInfo = mAuthenticatorCache.getServiceInfo( + AuthenticatorDescription.newKey(authenticatorType), mAccounts.userId); if (authenticatorInfo == null) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "there is no authenticator for " + authenticatorType @@ -1875,7 +1925,7 @@ public void handleMessage(Message msg) { private static String getDatabaseName(int userId) { File systemDir = Environment.getSystemSecureDirectory(); - File databaseFile = new File(systemDir, "users/" + userId + "/" + DATABASE_NAME); + File databaseFile = new File(Environment.getUserSystemDirectory(userId), DATABASE_NAME); if (userId == 0) { // Migrate old file, if it exists, to the new location. // Make sure the new file doesn't already exist. A dummy file could have been @@ -1884,7 +1934,7 @@ private static String getDatabaseName(int userId) { File oldFile = new File(systemDir, DATABASE_NAME); if (oldFile.exists() && !databaseFile.exists()) { // Check for use directory; create if it doesn't exist, else renameTo will fail - File userDir = new File(systemDir, "users/" + userId); + File userDir = Environment.getUserSystemDirectory(userId); if (!userDir.exists()) { if (!userDir.mkdirs()) { throw new IllegalStateException("User dir cannot be created: " + userDir); @@ -2014,6 +2064,7 @@ private static boolean scanArgs(String[] args, String value) { return false; } + @Override protected void dump(FileDescriptor fd, PrintWriter fout, String[] args) { if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.DUMP) != PackageManager.PERMISSION_GRANTED) { @@ -2023,17 +2074,15 @@ protected void dump(FileDescriptor fd, PrintWriter fout, String[] args) { return; } final boolean isCheckinRequest = scanArgs(args, "--checkin") || scanArgs(args, "-c"); + final IndentingPrintWriter ipw = new IndentingPrintWriter(fout, " "); - fout = new IndentingPrintWriter(fout, " "); - int size = mUsers.size(); - for (int i = 0; i < size; i++) { - fout.println("User " + mUsers.keyAt(i) + ":"); - ((IndentingPrintWriter) fout).increaseIndent(); - dumpUser(mUsers.valueAt(i), fd, fout, args, isCheckinRequest); - ((IndentingPrintWriter) fout).decreaseIndent(); - if (i < size - 1) { - fout.println(); - } + final List users = getUserManager().getUsers(); + for (UserInfo user : users) { + ipw.println("User " + user + ":"); + ipw.increaseIndent(); + dumpUser(getUserAccounts(user.id), fd, ipw, args, isCheckinRequest); + ipw.println(); + ipw.decreaseIndent(); } } @@ -2073,13 +2122,13 @@ private void dumpUser(UserAccounts userAccounts, FileDescriptor fd, PrintWriter } fout.println(); - mAuthenticatorCache.dump(fd, fout, args); + mAuthenticatorCache.dump(fd, fout, args, userAccounts.userId); } } } private void doNotification(UserAccounts accounts, Account account, CharSequence message, - Intent intent) { + Intent intent, int userId) { long identityToken = clearCallingIdentity(); try { if (Log.isLoggable(TAG, Log.VERBOSE)) { @@ -2089,35 +2138,38 @@ private void doNotification(UserAccounts accounts, Account account, CharSequence if (intent.getComponent() != null && GrantCredentialsPermissionActivity.class.getName().equals( intent.getComponent().getClassName())) { - createNoCredentialsPermissionNotification(account, intent); + createNoCredentialsPermissionNotification(account, intent, userId); } else { final Integer notificationId = getSigninRequiredNotificationId(accounts, account); intent.addCategory(String.valueOf(notificationId)); Notification n = new Notification(android.R.drawable.stat_sys_warning, null, 0 /* when */); + UserHandle user = new UserHandle(userId); final String notificationTitleFormat = mContext.getText(R.string.notification_title).toString(); n.setLatestEventInfo(mContext, String.format(notificationTitleFormat, account.name), - message, PendingIntent.getActivity( - mContext, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT)); - installNotification(notificationId, n); + message, PendingIntent.getActivityAsUser( + mContext, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT, + null, user)); + installNotification(notificationId, n, user); } } finally { restoreCallingIdentity(identityToken); } } - protected void installNotification(final int notificationId, final Notification n) { + protected void installNotification(final int notificationId, final Notification n, + UserHandle user) { ((NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE)) - .notify(notificationId, n); + .notifyAsUser(null, notificationId, n, user); } - protected void cancelNotification(int id) { + protected void cancelNotification(int id, UserHandle user) { long identityToken = clearCallingIdentity(); try { ((NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE)) - .cancel(id); + .cancelAsUser(null, id, user); } finally { restoreCallingIdentity(identityToken); } @@ -2141,11 +2193,21 @@ private void checkBinderPermission(String... permissions) { throw new SecurityException(msg); } - private boolean inSystemImage(int callerUid) { - String[] packages = mPackageManager.getPackagesForUid(callerUid); + private boolean inSystemImage(int callingUid) { + final int callingUserId = UserHandle.getUserId(callingUid); + + final PackageManager userPackageManager; + try { + userPackageManager = mContext.createPackageContextAsUser( + "android", 0, new UserHandle(callingUserId)).getPackageManager(); + } catch (NameNotFoundException e) { + return false; + } + + String[] packages = userPackageManager.getPackagesForUid(callingUid); for (String name : packages) { try { - PackageInfo packageInfo = mPackageManager.getPackageInfo(name, 0 /* flags */); + PackageInfo packageInfo = userPackageManager.getPackageInfo(name, 0 /* flags */); if (packageInfo != null && (packageInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0) { return true; @@ -2173,8 +2235,9 @@ private boolean permissionIsGranted(Account account, String authTokenType, int c } private boolean hasAuthenticatorUid(String accountType, int callingUid) { + final int callingUserId = UserHandle.getUserId(callingUid); for (RegisteredServicesCache.ServiceInfo serviceInfo : - mAuthenticatorCache.getAllServices()) { + mAuthenticatorCache.getAllServices(callingUserId)) { if (serviceInfo.type.type.equals(accountType)) { return (serviceInfo.uid == callingUid) || (mPackageManager.checkSignatures(serviceInfo.uid, callingUid) @@ -2265,7 +2328,7 @@ private void grantAppPermission(Account account, String authTokenType, int uid) Log.e(TAG, "grantAppPermission: called with invalid arguments", new Exception()); return; } - UserAccounts accounts = getUserAccounts(UserId.getUserId(uid)); + UserAccounts accounts = getUserAccounts(UserHandle.getUserId(uid)); synchronized (accounts.cacheLock) { final SQLiteDatabase db = accounts.openHelper.getWritableDatabase(); db.beginTransaction(); @@ -2282,7 +2345,8 @@ private void grantAppPermission(Account account, String authTokenType, int uid) } finally { db.endTransaction(); } - cancelNotification(getCredentialPermissionNotificationId(account, authTokenType, uid)); + cancelNotification(getCredentialPermissionNotificationId(account, authTokenType, uid), + new UserHandle(accounts.userId)); } } @@ -2299,7 +2363,7 @@ private void revokeAppPermission(Account account, String authTokenType, int uid) Log.e(TAG, "revokeAppPermission: called with invalid arguments", new Exception()); return; } - UserAccounts accounts = getUserAccounts(UserId.getUserId(uid)); + UserAccounts accounts = getUserAccounts(UserHandle.getUserId(uid)); synchronized (accounts.cacheLock) { final SQLiteDatabase db = accounts.openHelper.getWritableDatabase(); db.beginTransaction(); @@ -2316,7 +2380,8 @@ private void revokeAppPermission(Account account, String authTokenType, int uid) } finally { db.endTransaction(); } - cancelNotification(getCredentialPermissionNotificationId(account, authTokenType, uid)); + cancelNotification(getCredentialPermissionNotificationId(account, authTokenType, uid), + new UserHandle(accounts.userId)); } } diff --git a/core/java/android/accounts/ChooseAccountTypeActivity.java b/core/java/android/accounts/ChooseAccountTypeActivity.java index acc85496ba22f..5b3b553fa783b 100644 --- a/core/java/android/accounts/ChooseAccountTypeActivity.java +++ b/core/java/android/accounts/ChooseAccountTypeActivity.java @@ -134,7 +134,6 @@ private void buildTypeToAuthDescriptionMap() { if (sequence != null) { name = sequence.toString(); } - name = sequence.toString(); } catch (PackageManager.NameNotFoundException e) { // Nothing we can do much here, just log if (Log.isLoggable(TAG, Log.WARN)) { diff --git a/core/java/android/accounts/ChooseTypeAndAccountActivity.java b/core/java/android/accounts/ChooseTypeAndAccountActivity.java index 6b3b7fd59f528..5358bc796ab94 100644 --- a/core/java/android/accounts/ChooseTypeAndAccountActivity.java +++ b/core/java/android/accounts/ChooseTypeAndAccountActivity.java @@ -15,6 +15,8 @@ */ package android.accounts; +import com.google.android.collect.Sets; + import android.app.Activity; import android.content.Intent; import android.os.Bundle; @@ -105,6 +107,13 @@ public class ChooseTypeAndAccountActivity extends Activity private static final int SELECTED_ITEM_NONE = -1; + private Set mSetOfAllowableAccounts; + private Set mSetOfRelevantAccountTypes; + private String mSelectedAccountName = null; + private boolean mSelectedAddNewAccount = false; + private boolean mAlwaysPromptForAccount = false; + private String mDescriptionOverride; + private ArrayList mAccounts; private int mPendingRequest = REQUEST_NULL; private Parcelable[] mExistingAccounts = null; @@ -120,22 +129,18 @@ public void onCreate(Bundle savedInstanceState) { } // save some items we use frequently - final AccountManager accountManager = AccountManager.get(this); final Intent intent = getIntent(); - String selectedAccountName = null; - boolean selectedAddNewAccount = false; - if (savedInstanceState != null) { mPendingRequest = savedInstanceState.getInt(KEY_INSTANCE_STATE_PENDING_REQUEST); mExistingAccounts = savedInstanceState.getParcelableArray(KEY_INSTANCE_STATE_EXISTING_ACCOUNTS); // Makes sure that any user selection is preserved across orientation changes. - selectedAccountName = savedInstanceState.getString( + mSelectedAccountName = savedInstanceState.getString( KEY_INSTANCE_STATE_SELECTED_ACCOUNT_NAME); - selectedAddNewAccount = savedInstanceState.getBoolean( + mSelectedAddNewAccount = savedInstanceState.getBoolean( KEY_INSTANCE_STATE_SELECTED_ADD_ACCOUNT, false); } else { mPendingRequest = REQUEST_NULL; @@ -144,85 +149,38 @@ public void onCreate(Bundle savedInstanceState) { // show is as pre-selected. Account selectedAccount = (Account) intent.getParcelableExtra(EXTRA_SELECTED_ACCOUNT); if (selectedAccount != null) { - selectedAccountName = selectedAccount.name; + mSelectedAccountName = selectedAccount.name; } } if (Log.isLoggable(TAG, Log.VERBOSE)) { - Log.v(TAG, "selected account name is " + selectedAccountName); + Log.v(TAG, "selected account name is " + mSelectedAccountName); } - // build an efficiently queryable map of account types to authenticator descriptions - final HashMap typeToAuthDescription = - new HashMap(); - for(AuthenticatorDescription desc : accountManager.getAuthenticatorTypes()) { - typeToAuthDescription.put(desc.type, desc); - } - - // Read the validAccounts, if present, and add them to the setOfAllowableAccounts - Set setOfAllowableAccounts = null; - final ArrayList validAccounts = - intent.getParcelableArrayListExtra(EXTRA_ALLOWABLE_ACCOUNTS_ARRAYLIST); - if (validAccounts != null) { - setOfAllowableAccounts = new HashSet(validAccounts.size()); - for (Parcelable parcelable : validAccounts) { - setOfAllowableAccounts.add((Account)parcelable); - } - } - // An account type is relevant iff it is allowed by the caller and supported by the account - // manager. - Set setOfRelevantAccountTypes = null; - final String[] allowedAccountTypes = - intent.getStringArrayExtra(EXTRA_ALLOWABLE_ACCOUNT_TYPES_STRING_ARRAY); - if (allowedAccountTypes != null) { - - setOfRelevantAccountTypes = new HashSet(allowedAccountTypes.length); - Set setOfAllowedAccountTypes = new HashSet(allowedAccountTypes.length); - for (String type : allowedAccountTypes) { - setOfAllowedAccountTypes.add(type); - } - - AuthenticatorDescription[] descs = AccountManager.get(this).getAuthenticatorTypes(); - Set supportedAccountTypes = new HashSet(descs.length); - for (AuthenticatorDescription desc : descs) { - supportedAccountTypes.add(desc.type); - } + mSetOfAllowableAccounts = getAllowableAccountSet(intent); + mSetOfRelevantAccountTypes = getReleventAccountTypes(intent); + mAlwaysPromptForAccount = intent.getBooleanExtra(EXTRA_ALWAYS_PROMPT_FOR_ACCOUNT, false); + mDescriptionOverride = intent.getStringExtra(EXTRA_DESCRIPTION_TEXT_OVERRIDE); + } - for (String acctType : setOfAllowedAccountTypes) { - if (supportedAccountTypes.contains(acctType)) { - setOfRelevantAccountTypes.add(acctType); - } - } - } + @Override + protected void onResume() { + super.onResume(); + final AccountManager accountManager = AccountManager.get(this); - // Create a list of AccountInfo objects for each account that is allowable. Filter out - // accounts that don't match the allowable types, if provided, or that don't match the - // allowable accounts, if provided. - final Account[] accounts = accountManager.getAccounts(); - mAccounts = new ArrayList(accounts.length); - mSelectedItemIndex = SELECTED_ITEM_NONE; - for (Account account : accounts) { - if (setOfAllowableAccounts != null - && !setOfAllowableAccounts.contains(account)) { - continue; - } - if (setOfRelevantAccountTypes != null - && !setOfRelevantAccountTypes.contains(account.type)) { - continue; - } - if (account.name.equals(selectedAccountName)) { - mSelectedItemIndex = mAccounts.size(); - } - mAccounts.add(account); - } + mAccounts = getAcceptableAccountChoices(accountManager); + // In cases where the activity does not need to show an account picker, cut the chase + // and return the result directly. Eg: + // Single account -> select it directly + // No account -> launch add account activity directly if (mPendingRequest == REQUEST_NULL) { // If there are no relevant accounts and only one relevant account type go directly to // add account. Otherwise let the user choose. if (mAccounts.isEmpty()) { - if (setOfRelevantAccountTypes.size() == 1) { - runAddAccountForAuthenticator(setOfRelevantAccountTypes.iterator().next()); + if (mSetOfRelevantAccountTypes.size() == 1) { + runAddAccountForAuthenticator(mSetOfRelevantAccountTypes.iterator().next()); } else { startChooseAccountTypeActivity(); } @@ -230,61 +188,22 @@ public void onCreate(Bundle savedInstanceState) { } // if there is only one allowable account return it - if (!intent.getBooleanExtra(EXTRA_ALWAYS_PROMPT_FOR_ACCOUNT, false) - && mAccounts.size() == 1) { + if (!mAlwaysPromptForAccount && mAccounts.size() == 1) { Account account = mAccounts.get(0); setResultAndFinish(account.name, account.type); return; } } + String[] listItems = getListOfDisplayableOptions(mAccounts); + mSelectedItemIndex = getItemIndexToSelect( + mAccounts, mSelectedAccountName, mSelectedAddNewAccount); + // Cannot set content view until we know that mPendingRequest is not null, otherwise // would cause screen flicker. setContentView(R.layout.choose_type_and_account); - - // Override the description text if supplied - final String descriptionOverride = - intent.getStringExtra(EXTRA_DESCRIPTION_TEXT_OVERRIDE); - TextView descriptionView = (TextView) findViewById(R.id.description); - if (!TextUtils.isEmpty(descriptionOverride)) { - descriptionView.setText(descriptionOverride); - } else { - descriptionView.setVisibility(View.GONE); - } - - // List of options includes all accounts found together with "Add new account" as the - // last item in the list. - String[] listItems = new String[mAccounts.size() + 1]; - for (int i = 0; i < mAccounts.size(); i++) { - listItems[i] = mAccounts.get(i).name; - } - listItems[mAccounts.size()] = getResources().getString( - R.string.add_account_button_label); - - ListView list = (ListView) findViewById(android.R.id.list); - list.setAdapter(new ArrayAdapter(this, - android.R.layout.simple_list_item_single_choice, listItems)); - list.setChoiceMode(ListView.CHOICE_MODE_SINGLE); - list.setItemsCanFocus(false); - list.setOnItemClickListener(new AdapterView.OnItemClickListener() { - @Override - public void onItemClick(AdapterView parent, View v, int position, long id) { - mSelectedItemIndex = position; - mOkButton.setEnabled(true); - } - }); - - // If "Add account" option was previously selected by user, preserve it across - // orientation changes. - if (selectedAddNewAccount) { - mSelectedItemIndex = mAccounts.size(); - } - if (mSelectedItemIndex != SELECTED_ITEM_NONE) { - list.setItemChecked(mSelectedItemIndex, true); - if (Log.isLoggable(TAG, Log.VERBOSE)) { - Log.v(TAG, "List item " + mSelectedItemIndex + " should be selected"); - } - } + overrideDescriptionIfSupplied(mDescriptionOverride); + populateUIAccountList(listItems); // Only enable "OK" button if something has been selected. mOkButton = (Button) findViewById(android.R.id.button2); @@ -480,4 +399,137 @@ private void startChooseAccountTypeActivity() { startActivityForResult(intent, REQUEST_CHOOSE_TYPE); mPendingRequest = REQUEST_CHOOSE_TYPE; } + + /** + * @return a value between 0 (inclusive) and accounts.size() (inclusive) or SELECTED_ITEM_NONE. + * An index value of accounts.size() indicates 'Add account' option. + */ + private int getItemIndexToSelect(ArrayList accounts, String selectedAccountName, + boolean selectedAddNewAccount) { + // If "Add account" option was previously selected by user, preserve it across + // orientation changes. + if (selectedAddNewAccount) { + return accounts.size(); + } + // search for the selected account name if present + for (int i = 0; i < accounts.size(); i++) { + if (accounts.get(i).name.equals(selectedAccountName)) { + return i; + } + } + // no account selected. + return SELECTED_ITEM_NONE; + } + + private String[] getListOfDisplayableOptions(ArrayList accounts) { + // List of options includes all accounts found together with "Add new account" as the + // last item in the list. + String[] listItems = new String[accounts.size() + 1]; + for (int i = 0; i < accounts.size(); i++) { + listItems[i] = accounts.get(i).name; + } + listItems[accounts.size()] = getResources().getString( + R.string.add_account_button_label); + return listItems; + } + + /** + * Create a list of Account objects for each account that is acceptable. Filter out + * accounts that don't match the allowable types, if provided, or that don't match the + * allowable accounts, if provided. + */ + private ArrayList getAcceptableAccountChoices(AccountManager accountManager) { + final Account[] accounts = accountManager.getAccounts(); + ArrayList accountsToPopulate = new ArrayList(accounts.length); + for (Account account : accounts) { + if (mSetOfAllowableAccounts != null + && !mSetOfAllowableAccounts.contains(account)) { + continue; + } + if (mSetOfRelevantAccountTypes != null + && !mSetOfRelevantAccountTypes.contains(account.type)) { + continue; + } + accountsToPopulate.add(account); + } + return accountsToPopulate; + } + + /** + * Return a set of account types speficied by the intent as well as supported by the + * AccountManager. + */ + private Set getReleventAccountTypes(final Intent intent) { + // An account type is relevant iff it is allowed by the caller and supported by the account + // manager. + Set setOfRelevantAccountTypes = null; + final String[] allowedAccountTypes = + intent.getStringArrayExtra(EXTRA_ALLOWABLE_ACCOUNT_TYPES_STRING_ARRAY); + if (allowedAccountTypes != null) { + setOfRelevantAccountTypes = Sets.newHashSet(allowedAccountTypes); + AuthenticatorDescription[] descs = AccountManager.get(this).getAuthenticatorTypes(); + Set supportedAccountTypes = new HashSet(descs.length); + for (AuthenticatorDescription desc : descs) { + supportedAccountTypes.add(desc.type); + } + setOfRelevantAccountTypes.retainAll(supportedAccountTypes); + } + return setOfRelevantAccountTypes; + } + + /** + * Returns a set of whitelisted accounts given by the intent or null if none specified by the + * intent. + */ + private Set getAllowableAccountSet(final Intent intent) { + Set setOfAllowableAccounts = null; + final ArrayList validAccounts = + intent.getParcelableArrayListExtra(EXTRA_ALLOWABLE_ACCOUNTS_ARRAYLIST); + if (validAccounts != null) { + setOfAllowableAccounts = new HashSet(validAccounts.size()); + for (Parcelable parcelable : validAccounts) { + setOfAllowableAccounts.add((Account)parcelable); + } + } + return setOfAllowableAccounts; + } + + /** + * Overrides the description text view for the picker activity if specified by the intent. + * If not specified then makes the description invisible. + */ + private void overrideDescriptionIfSupplied(String descriptionOverride) { + TextView descriptionView = (TextView) findViewById(R.id.description); + if (!TextUtils.isEmpty(descriptionOverride)) { + descriptionView.setText(descriptionOverride); + } else { + descriptionView.setVisibility(View.GONE); + } + } + + /** + * Populates the UI ListView with the given list of items and selects an item + * based on {@code mSelectedItemIndex} member variable. + */ + private final void populateUIAccountList(String[] listItems) { + ListView list = (ListView) findViewById(android.R.id.list); + list.setAdapter(new ArrayAdapter(this, + android.R.layout.simple_list_item_single_choice, listItems)); + list.setChoiceMode(ListView.CHOICE_MODE_SINGLE); + list.setItemsCanFocus(false); + list.setOnItemClickListener( + new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView parent, View v, int position, long id) { + mSelectedItemIndex = position; + mOkButton.setEnabled(true); + } + }); + if (mSelectedItemIndex != SELECTED_ITEM_NONE) { + list.setItemChecked(mSelectedItemIndex, true); + if (Log.isLoggable(TAG, Log.VERBOSE)) { + Log.v(TAG, "List item " + mSelectedItemIndex + " should be selected"); + } + } + } } diff --git a/core/java/android/accounts/IAccountAuthenticatorCache.java b/core/java/android/accounts/IAccountAuthenticatorCache.java index 20dd585a45a22..06c21065e7e58 100644 --- a/core/java/android/accounts/IAccountAuthenticatorCache.java +++ b/core/java/android/accounts/IAccountAuthenticatorCache.java @@ -39,18 +39,19 @@ public interface IAccountAuthenticatorCache { * matches the account type or null if none is present */ RegisteredServicesCache.ServiceInfo getServiceInfo( - AuthenticatorDescription type); + AuthenticatorDescription type, int userId); /** * @return A copy of a Collection of all the current Authenticators. */ - Collection> getAllServices(); + Collection> getAllServices( + int userId); /** * Dumps the state of the cache. See * {@link android.os.Binder#dump(java.io.FileDescriptor, java.io.PrintWriter, String[])} */ - void dump(FileDescriptor fd, PrintWriter fout, String[] args); + void dump(FileDescriptor fd, PrintWriter fout, String[] args, int userId); /** * Sets a listener that will be notified whenever the authenticator set changes @@ -61,8 +62,5 @@ RegisteredServicesCache.ServiceInfo getServiceInfo( void setListener(RegisteredServicesCacheListener listener, Handler handler); - /** - * Refreshes the authenticator cache. - */ - void generateServicesMap(); -} \ No newline at end of file + void invalidateCache(int userId); +} diff --git a/core/java/android/accounts/IAccountManager.aidl b/core/java/android/accounts/IAccountManager.aidl index 60073217c3f40..dbb492424acb3 100644 --- a/core/java/android/accounts/IAccountManager.aidl +++ b/core/java/android/accounts/IAccountManager.aidl @@ -31,6 +31,7 @@ interface IAccountManager { String getUserData(in Account account, String key); AuthenticatorDescription[] getAuthenticatorTypes(); Account[] getAccounts(String accountType); + Account[] getAccountsAsUser(String accountType, int userId); void hasFeatures(in IAccountManagerResponse response, in Account account, in String[] features); void getAccountsByFeatures(in IAccountManagerResponse response, String accountType, in String[] features); boolean addAccount(in Account account, String password, in Bundle extras); @@ -53,8 +54,8 @@ interface IAccountManager { String authTokenType, boolean expectActivityLaunch, in Bundle options); void editProperties(in IAccountManagerResponse response, String accountType, boolean expectActivityLaunch); - void confirmCredentials(in IAccountManagerResponse response, in Account account, - in Bundle options, boolean expectActivityLaunch); + void confirmCredentialsAsUser(in IAccountManagerResponse response, in Account account, + in Bundle options, boolean expectActivityLaunch, int userId); void getAuthTokenLabel(in IAccountManagerResponse response, String accountType, String authTokenType); } diff --git a/core/java/android/animation/ArgbEvaluator.java b/core/java/android/animation/ArgbEvaluator.java index c3875bee2c2d3..717a3d91f97e3 100644 --- a/core/java/android/animation/ArgbEvaluator.java +++ b/core/java/android/animation/ArgbEvaluator.java @@ -40,13 +40,13 @@ public class ArgbEvaluator implements TypeEvaluator { */ public Object evaluate(float fraction, Object startValue, Object endValue) { int startInt = (Integer) startValue; - int startA = (startInt >> 24); + int startA = (startInt >> 24) & 0xff; int startR = (startInt >> 16) & 0xff; int startG = (startInt >> 8) & 0xff; int startB = startInt & 0xff; int endInt = (Integer) endValue; - int endA = (endInt >> 24); + int endA = (endInt >> 24) & 0xff; int endR = (endInt >> 16) & 0xff; int endG = (endInt >> 8) & 0xff; int endB = endInt & 0xff; diff --git a/core/java/android/animation/Keyframe.java b/core/java/android/animation/Keyframe.java index e98719a75311c..dc8538fc60037 100644 --- a/core/java/android/animation/Keyframe.java +++ b/core/java/android/animation/Keyframe.java @@ -261,7 +261,7 @@ public void setValue(Object value) { @Override public ObjectKeyframe clone() { - ObjectKeyframe kfClone = new ObjectKeyframe(getFraction(), mValue); + ObjectKeyframe kfClone = new ObjectKeyframe(getFraction(), mHasValue ? mValue : null); kfClone.setInterpolator(getInterpolator()); return kfClone; } @@ -306,7 +306,9 @@ public void setValue(Object value) { @Override public IntKeyframe clone() { - IntKeyframe kfClone = new IntKeyframe(getFraction(), mValue); + IntKeyframe kfClone = mHasValue ? + new IntKeyframe(getFraction(), mValue) : + new IntKeyframe(getFraction()); kfClone.setInterpolator(getInterpolator()); return kfClone; } @@ -350,7 +352,9 @@ public void setValue(Object value) { @Override public FloatKeyframe clone() { - FloatKeyframe kfClone = new FloatKeyframe(getFraction(), mValue); + FloatKeyframe kfClone = mHasValue ? + new FloatKeyframe(getFraction(), mValue) : + new FloatKeyframe(getFraction()); kfClone.setInterpolator(getInterpolator()); return kfClone; } diff --git a/core/java/android/animation/TimeAnimator.java b/core/java/android/animation/TimeAnimator.java index 088d20da84636..f9aa00ec25010 100644 --- a/core/java/android/animation/TimeAnimator.java +++ b/core/java/android/animation/TimeAnimator.java @@ -12,6 +12,12 @@ public class TimeAnimator extends ValueAnimator { private TimeListener mListener; private long mPreviousTime = -1; + @Override + public void start() { + mPreviousTime = -1; + super.start(); + } + @Override boolean animationFrame(long currentTime) { if (mListener != null) { diff --git a/core/java/android/animation/ValueAnimator.java b/core/java/android/animation/ValueAnimator.java index f3a442ab35712..f7460c44034f0 100755 --- a/core/java/android/animation/ValueAnimator.java +++ b/core/java/android/animation/ValueAnimator.java @@ -231,6 +231,13 @@ public static void setDurationScale(float durationScale) { sDurationScale = durationScale; } + /** + * @hide + */ + public static float getDurationScale() { + return sDurationScale; + } + /** * Creates a new ValueAnimator object. This default constructor is primarily for * use internally; the factory methods which take parameters are more generally @@ -529,6 +536,9 @@ private static class AnimationHandler implements Runnable { // The per-thread list of all active animations private final ArrayList mAnimations = new ArrayList(); + // Used in doAnimationFrame() to avoid concurrent modifications of mAnimations + private final ArrayList mTmpAnimations = new ArrayList(); + // The per-thread set of animations to be started on the next animation frame private final ArrayList mPendingAnimations = new ArrayList(); @@ -598,28 +608,18 @@ private void doAnimationFrame(long frameTime) { // Now process all active animations. The return value from animationFrame() // tells the handler whether it should now be ended int numAnims = mAnimations.size(); - int i = 0; - while (i < numAnims) { - ValueAnimator anim = mAnimations.get(i); - if (anim.doAnimationFrame(frameTime)) { + for (int i = 0; i < numAnims; ++i) { + mTmpAnimations.add(mAnimations.get(i)); + } + for (int i = 0; i < numAnims; ++i) { + ValueAnimator anim = mTmpAnimations.get(i); + if (mAnimations.contains(anim) && anim.doAnimationFrame(frameTime)) { mEndingAnims.add(anim); } - if (mAnimations.size() == numAnims) { - ++i; - } else { - // An animation might be canceled or ended by client code - // during the animation frame. Check to see if this happened by - // seeing whether the current index is the same as it was before - // calling animationFrame(). Another approach would be to copy - // animations to a temporary list and process that list instead, - // but that entails garbage and processing overhead that would - // be nice to avoid. - --numAnims; - mEndingAnims.remove(anim); - } } + mTmpAnimations.clear(); if (mEndingAnims.size() > 0) { - for (i = 0; i < mEndingAnims.size(); ++i) { + for (int i = 0; i < mEndingAnims.size(); ++i) { mEndingAnims.get(i).endAnimation(this); } mEndingAnims.clear(); @@ -958,13 +958,7 @@ public void end() { } else if (!mInitialized) { initAnimation(); } - // The final value set on the target varies, depending on whether the animation - // was supposed to repeat an odd number of times - if (mRepeatCount > 0 && (mRepeatCount & 0x01) == 1) { - animateValue(0f); - } else { - animateValue(1f); - } + animateValue(mPlayingBackwards ? 0f : 1f); endAnimation(handler); } diff --git a/core/java/android/app/ActionBar.java b/core/java/android/app/ActionBar.java index cff16ff615923..2337790833d5e 100644 --- a/core/java/android/app/ActionBar.java +++ b/core/java/android/app/ActionBar.java @@ -918,6 +918,8 @@ public static class LayoutParams extends MarginLayoutParams { @ViewDebug.IntToString(from = Gravity.BOTTOM, to = "BOTTOM"), @ViewDebug.IntToString(from = Gravity.LEFT, to = "LEFT"), @ViewDebug.IntToString(from = Gravity.RIGHT, to = "RIGHT"), + @ViewDebug.IntToString(from = Gravity.START, to = "START"), + @ViewDebug.IntToString(from = Gravity.END, to = "END"), @ViewDebug.IntToString(from = Gravity.CENTER_VERTICAL, to = "CENTER_VERTICAL"), @ViewDebug.IntToString(from = Gravity.FILL_VERTICAL, to = "FILL_VERTICAL"), @ViewDebug.IntToString(from = Gravity.CENTER_HORIZONTAL, to = "CENTER_HORIZONTAL"), @@ -925,7 +927,7 @@ public static class LayoutParams extends MarginLayoutParams { @ViewDebug.IntToString(from = Gravity.CENTER, to = "CENTER"), @ViewDebug.IntToString(from = Gravity.FILL, to = "FILL") }) - public int gravity = -1; + public int gravity = Gravity.NO_GRAVITY; public LayoutParams(Context c, AttributeSet attrs) { super(c, attrs); @@ -933,13 +935,14 @@ public LayoutParams(Context c, AttributeSet attrs) { TypedArray a = c.obtainStyledAttributes(attrs, com.android.internal.R.styleable.ActionBar_LayoutParams); gravity = a.getInt( - com.android.internal.R.styleable.ActionBar_LayoutParams_layout_gravity, -1); + com.android.internal.R.styleable.ActionBar_LayoutParams_layout_gravity, + Gravity.NO_GRAVITY); a.recycle(); } public LayoutParams(int width, int height) { super(width, height); - this.gravity = Gravity.CENTER_VERTICAL | Gravity.LEFT; + this.gravity = Gravity.CENTER_VERTICAL | Gravity.START; } public LayoutParams(int width, int height, int gravity) { diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java index f20fd337695f3..5dc9da285ee95 100644 --- a/core/java/android/app/Activity.java +++ b/core/java/android/app/Activity.java @@ -48,6 +48,7 @@ import android.os.Parcelable; import android.os.RemoteException; import android.os.StrictMode; +import android.os.UserHandle; import android.text.Selection; import android.text.SpannableStringBuilder; import android.text.TextUtils; @@ -74,7 +75,7 @@ import android.view.ViewManager; import android.view.Window; import android.view.WindowManager; -import android.view.WindowManagerImpl; +import android.view.WindowManagerGlobal; import android.view.accessibility.AccessibilityEvent; import android.widget.AdapterView; @@ -652,8 +653,9 @@ public class Activity extends ContextThemeWrapper /** Start of user-defined activity results. */ public static final int RESULT_FIRST_USER = 1; + static final String FRAGMENTS_TAG = "android:fragments"; + private static final String WINDOW_HIERARCHY_TAG = "android:viewHierarchyState"; - private static final String FRAGMENTS_TAG = "android:fragments"; private static final String SAVED_DIALOG_IDS_KEY = "android:savedDialogIds"; private static final String SAVED_DIALOGS_TAG = "android:savedDialogs"; private static final String SAVED_DIALOG_KEY_PREFIX = "android:dialog_"; @@ -683,6 +685,7 @@ private static class ManagedDialog { private boolean mStopped; boolean mFinished; boolean mStartedActivity; + private boolean mDestroyed; /** true if the activity is going through a transient pause */ /*package*/ boolean mTemporaryPause = false; /** true if the activity is being destroyed in order to recreate it with a new configuration */ @@ -696,7 +699,7 @@ static final class NonConfigurationInstances { Object activity; HashMap children; ArrayList fragments; - SparseArray loaders; + HashMap loaders; } /* package */ NonConfigurationInstances mLastNonConfigurationInstances; @@ -714,8 +717,14 @@ static final class NonConfigurationInstances { private int mTitleColor = 0; final FragmentManagerImpl mFragments = new FragmentManagerImpl(); + final FragmentContainer mContainer = new FragmentContainer() { + @Override + public View findViewById(int id) { + return Activity.this.findViewById(id); + } + }; - SparseArray mAllLoaderManagers; + HashMap mAllLoaderManagers; LoaderManagerImpl mLoaderManager; private static final class ManagedCursor { @@ -743,6 +752,7 @@ private static final class ManagedCursor { protected static final int[] FOCUSED_STATE_SET = {com.android.internal.R.attr.state_focused}; + @SuppressWarnings("unused") private final Object mInstanceTracker = StrictMode.trackActivity(this); private Thread mUiThread; @@ -807,19 +817,19 @@ public LoaderManager getLoaderManager() { return mLoaderManager; } mCheckedForLoaderManager = true; - mLoaderManager = getLoaderManager(-1, mLoadersStarted, true); + mLoaderManager = getLoaderManager(null, mLoadersStarted, true); return mLoaderManager; } - LoaderManagerImpl getLoaderManager(int index, boolean started, boolean create) { + LoaderManagerImpl getLoaderManager(String who, boolean started, boolean create) { if (mAllLoaderManagers == null) { - mAllLoaderManagers = new SparseArray(); + mAllLoaderManagers = new HashMap(); } - LoaderManagerImpl lm = mAllLoaderManagers.get(index); + LoaderManagerImpl lm = mAllLoaderManagers.get(who); if (lm == null) { if (create) { - lm = new LoaderManagerImpl(this, started); - mAllLoaderManagers.put(index, lm); + lm = new LoaderManagerImpl(who, this, started); + mAllLoaderManagers.put(who, lm); } } else { lm.updateActivity(this); @@ -1024,7 +1034,7 @@ protected void onStart() { if (mLoaderManager != null) { mLoaderManager.doStart(); } else if (!mCheckedForLoaderManager) { - mLoaderManager = getLoaderManager(-1, mLoadersStarted, false); + mLoaderManager = getLoaderManager(null, mLoadersStarted, false); } mCheckedForLoaderManager = true; } @@ -1600,13 +1610,17 @@ NonConfigurationInstances retainNonConfigurationInstances() { if (mAllLoaderManagers != null) { // prune out any loader managers that were already stopped and so // have nothing useful to retain. - for (int i=mAllLoaderManagers.size()-1; i>=0; i--) { - LoaderManagerImpl lm = mAllLoaderManagers.valueAt(i); - if (lm.mRetaining) { - retainLoaders = true; - } else { - lm.doDestroy(); - mAllLoaderManagers.removeAt(i); + LoaderManagerImpl loaders[] = new LoaderManagerImpl[mAllLoaderManagers.size()]; + mAllLoaderManagers.values().toArray(loaders); + if (loaders != null) { + for (int i=0; i=0; i--) { - LoaderManagerImpl lm = mAllLoaderManagers.valueAt(i); - lm.finishRetain(); - lm.doReportStart(); + LoaderManagerImpl loaders[] = new LoaderManagerImpl[mAllLoaderManagers.size()]; + mAllLoaderManagers.values().toArray(loaders); + if (loaders != null) { + for (int i=0; i= (512*1024*1024)) { @@ -374,6 +388,9 @@ static public boolean isHighEndGfx(Display display) { // we can afford the overhead of graphics acceleration. return true; } + + Display display = DisplayManagerGlobal.getInstance().getRealDisplay( + Display.DEFAULT_DISPLAY); Point p = new Point(); display.getRealSize(p); int pixels = p.x * p.y; @@ -529,7 +546,36 @@ public List getRecentTasks(int maxNum, int flags) throws SecurityException { try { return ActivityManagerNative.getDefault().getRecentTasks(maxNum, - flags); + flags, UserHandle.myUserId()); + } catch (RemoteException e) { + // System dead, we will be dead too soon! + return null; + } + } + + /** + * Same as {@link #getRecentTasks(int, int)} but returns the recent tasks for a + * specific user. It requires holding + * the {@link android.Manifest.permission#INTERACT_ACROSS_USERS_FULL} permission. + * @param maxNum The maximum number of entries to return in the list. The + * actual number returned may be smaller, depending on how many tasks the + * user has started and the maximum number the system can remember. + * @param flags Information about what to return. May be any combination + * of {@link #RECENT_WITH_EXCLUDED} and {@link #RECENT_IGNORE_UNAVAILABLE}. + * + * @return Returns a list of RecentTaskInfo records describing each of + * the recent tasks. + * + * @throws SecurityException Throws SecurityException if the caller does + * not hold the {@link android.Manifest.permission#GET_TASKS} or the + * {@link android.Manifest.permission#INTERACT_ACROSS_USERS_FULL} permissions. + * @hide + */ + public List getRecentTasksForUser(int maxNum, int flags, int userId) + throws SecurityException { + try { + return ActivityManagerNative.getDefault().getRecentTasks(maxNum, + flags, userId); } catch (RemoteException e) { // System dead, we will be dead too soon! return null; @@ -820,7 +866,17 @@ public TaskThumbnails getTaskThumbnails(int id) throws SecurityException { return null; } } - + + /** @hide */ + public Bitmap getTaskTopThumbnail(int id) throws SecurityException { + try { + return ActivityManagerNative.getDefault().getTaskTopThumbnail(id); + } catch (RemoteException e) { + // System dead, we will be dead too soon! + return null; + } + } + /** * Flag for {@link #moveTaskToFront(int, int)}: also move the "home" * activity along with the task, so it is positioned immediately behind @@ -1182,7 +1238,7 @@ public void getMemoryInfo(MemoryInfo outInfo) { public boolean clearApplicationUserData(String packageName, IPackageDataObserver observer) { try { return ActivityManagerNative.getDefault().clearApplicationUserData(packageName, - observer, Binder.getOrigCallingUser()); + observer, UserHandle.myUserId()); } catch (RemoteException e) { return false; } @@ -1345,6 +1401,13 @@ public static class RunningAppProcessInfo implements Parcelable { */ public static final int FLAG_PERSISTENT = 1<<1; + /** + * Constant for {@link #flags}: this process is associated with a + * persistent system app. + * @hide + */ + public static final int FLAG_HAS_ACTIVITIES = 1<<2; + /** * Flags of information. May be any of * {@link #FLAG_CANT_SAVE_STATE}. @@ -1559,6 +1622,16 @@ public List getRunningExternalApplications() { return null; } } + /** + * @hide + */ + public Configuration getConfiguration() { + try { + return ActivityManagerNative.getDefault().getConfiguration(); + } catch (RemoteException e) { + return null; + } + } /** * Returns a list of application processes that are running on the device. @@ -1642,7 +1715,8 @@ public void restartPackage(String packageName) { */ public void killBackgroundProcesses(String packageName) { try { - ActivityManagerNative.getDefault().killBackgroundProcesses(packageName); + ActivityManagerNative.getDefault().killBackgroundProcesses(packageName, + UserHandle.myUserId()); } catch (RemoteException e) { } } @@ -1667,7 +1741,8 @@ public void killBackgroundProcesses(String packageName) { */ public void forceStopPackage(String packageName) { try { - ActivityManagerNative.getDefault().forceStopPackage(packageName); + ActivityManagerNative.getDefault().forceStopPackage(packageName, + UserHandle.myUserId()); } catch (RemoteException e) { } } @@ -1814,12 +1889,12 @@ public static int checkComponentPermission(String permission, int uid, return PackageManager.PERMISSION_GRANTED; } // Isolated processes don't get any permissions. - if (UserId.isIsolated(uid)) { + if (UserHandle.isIsolated(uid)) { return PackageManager.PERMISSION_DENIED; } // If there is a uid that owns whatever is being accessed, it has // blanket access to it regardless of the permissions it requires. - if (owningUid >= 0 && UserId.isSameApp(uid, owningUid)) { + if (owningUid >= 0 && UserHandle.isSameApp(uid, owningUid)) { return PackageManager.PERMISSION_GRANTED; } // If the target is not exported, then nobody else can get to it. @@ -1840,6 +1915,43 @@ public static int checkComponentPermission(String permission, int uid, return PackageManager.PERMISSION_DENIED; } + /** @hide */ + public static int checkUidPermission(String permission, int uid) { + try { + return AppGlobals.getPackageManager() + .checkUidPermission(permission, uid); + } catch (RemoteException e) { + // Should never happen, but if it does... deny! + Slog.e(TAG, "PackageManager is dead?!?", e); + } + return PackageManager.PERMISSION_DENIED; + } + + /** @hide */ + public static int handleIncomingUser(int callingPid, int callingUid, int userId, + boolean allowAll, boolean requireFull, String name, String callerPackage) { + if (UserHandle.getUserId(callingUid) == userId) { + return userId; + } + try { + return ActivityManagerNative.getDefault().handleIncomingUser(callingPid, + callingUid, userId, allowAll, requireFull, name, callerPackage); + } catch (RemoteException e) { + throw new SecurityException("Failed calling activity manager", e); + } + } + + /** @hide */ + public static int getCurrentUser() { + UserInfo ui; + try { + ui = ActivityManagerNative.getDefault().getCurrentUser(); + return ui != null ? ui.id : 0; + } catch (RemoteException e) { + return 0; + } + } + /** * Returns the usage statistics of each installed package. * @@ -1869,4 +1981,34 @@ public boolean switchUser(int userid) { return false; } } + + /** + * Return whether the given user is actively running. This means that + * the user is in the "started" state, not "stopped" -- it is currently + * allowed to run code through scheduled alarms, receiving broadcasts, + * etc. A started user may be either the current foreground user or a + * background user; the result here does not distinguish between the two. + * @param userid the user's id. Zero indicates the default user. + * @hide + */ + public boolean isUserRunning(int userid) { + try { + return ActivityManagerNative.getDefault().isUserRunning(userid, false); + } catch (RemoteException e) { + return false; + } + } + + /** + * @throws SecurityException Throws SecurityException if the caller does + * not hold the {@link android.Manifest.permission#CHANGE_CONFIGURATION} permission. + * + * @hide + */ + public void updateConfiguration(Configuration values) throws SecurityException { + try { + ActivityManagerNative.getDefault().updateConfiguration(values); + } catch (RemoteException e) { + } + } } diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java index e12fa19f44784..67d3930436689 100644 --- a/core/java/android/app/ActivityManagerNative.java +++ b/core/java/android/app/ActivityManagerNative.java @@ -39,6 +39,7 @@ import android.os.RemoteException; import android.os.ServiceManager; import android.os.StrictMode; +import android.os.UserHandle; import android.text.TextUtils; import android.util.Log; import android.util.Singleton; @@ -88,11 +89,11 @@ static public boolean isSystemReady() { * Convenience for sending a sticky broadcast. For internal use only. * If you don't care about permission, use null. */ - static public void broadcastStickyIntent(Intent intent, String permission) { + static public void broadcastStickyIntent(Intent intent, String permission, int userId) { try { getDefault().broadcastIntent( null, intent, null, null, Activity.RESULT_OK, null, null, - null /*permission*/, false, true, Binder.getOrigCallingUser()); + null /*permission*/, false, true, userId); } catch (RemoteException ex) { } } @@ -135,6 +136,31 @@ public boolean onTransact(int code, Parcel data, Parcel reply, int flags) return true; } + case START_ACTIVITY_AS_USER_TRANSACTION: + { + data.enforceInterface(IActivityManager.descriptor); + IBinder b = data.readStrongBinder(); + IApplicationThread app = ApplicationThreadNative.asInterface(b); + Intent intent = Intent.CREATOR.createFromParcel(data); + String resolvedType = data.readString(); + IBinder resultTo = data.readStrongBinder(); + String resultWho = data.readString(); + int requestCode = data.readInt(); + int startFlags = data.readInt(); + String profileFile = data.readString(); + ParcelFileDescriptor profileFd = data.readInt() != 0 + ? data.readFileDescriptor() : null; + Bundle options = data.readInt() != 0 + ? Bundle.CREATOR.createFromParcel(data) : null; + int userId = data.readInt(); + int result = startActivityAsUser(app, intent, resolvedType, + resultTo, resultWho, requestCode, startFlags, + profileFile, profileFd, options, userId); + reply.writeNoException(); + reply.writeInt(result); + return true; + } + case START_ACTIVITY_AND_WAIT_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); @@ -151,9 +177,10 @@ public boolean onTransact(int code, Parcel data, Parcel reply, int flags) ? data.readFileDescriptor() : null; Bundle options = data.readInt() != 0 ? Bundle.CREATOR.createFromParcel(data) : null; + int userId = data.readInt(); WaitResult result = startActivityAndWait(app, intent, resolvedType, resultTo, resultWho, requestCode, startFlags, - profileFile, profileFd, options); + profileFile, profileFd, options, userId); reply.writeNoException(); result.writeToParcel(reply, 0); return true; @@ -173,8 +200,9 @@ public boolean onTransact(int code, Parcel data, Parcel reply, int flags) Configuration config = Configuration.CREATOR.createFromParcel(data); Bundle options = data.readInt() != 0 ? Bundle.CREATOR.createFromParcel(data) : null; + int userId = data.readInt(); int result = startActivityWithConfig(app, intent, resolvedType, - resultTo, resultWho, requestCode, startFlags, config, options); + resultTo, resultWho, requestCode, startFlags, config, options, userId); reply.writeNoException(); reply.writeInt(result); return true; @@ -273,7 +301,8 @@ public boolean onTransact(int code, Parcel data, Parcel reply, int flags) = b != null ? IIntentReceiver.Stub.asInterface(b) : null; IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data); String perm = data.readString(); - Intent intent = registerReceiver(app, packageName, rec, filter, perm); + int userId = data.readInt(); + Intent intent = registerReceiver(app, packageName, rec, filter, perm, userId); reply.writeNoException(); if (intent != null) { reply.writeInt(1); @@ -375,6 +404,14 @@ public boolean onTransact(int code, Parcel data, Parcel reply, int flags) return true; } + case ACTIVITY_RESUMED_TRANSACTION: { + data.enforceInterface(IActivityManager.descriptor); + IBinder token = data.readStrongBinder(); + activityResumed(token); + reply.writeNoException(); + return true; + } + case ACTIVITY_PAUSED_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); IBinder token = data.readStrongBinder(); @@ -454,13 +491,14 @@ public boolean onTransact(int code, Parcel data, Parcel reply, int flags) data.enforceInterface(IActivityManager.descriptor); int maxNum = data.readInt(); int fl = data.readInt(); + int userId = data.readInt(); List list = getRecentTasks(maxNum, - fl); + fl, userId); reply.writeNoException(); reply.writeTypedList(list); return true; } - + case GET_TASK_THUMBNAILS_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); int id = data.readInt(); @@ -474,7 +512,21 @@ public boolean onTransact(int code, Parcel data, Parcel reply, int flags) } return true; } - + + case GET_TASK_TOP_THUMBNAIL_TRANSACTION: { + data.enforceInterface(IActivityManager.descriptor); + int id = data.readInt(); + Bitmap bm = getTaskTopThumbnail(id); + reply.writeNoException(); + if (bm != null) { + reply.writeInt(1); + bm.writeToParcel(reply, 0); + } else { + reply.writeInt(0); + } + return true; + } + case GET_SERVICES_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); int maxNum = data.readInt(); @@ -580,8 +632,9 @@ public boolean onTransact(int code, Parcel data, Parcel reply, int flags) IBinder b = data.readStrongBinder(); IApplicationThread app = ApplicationThreadNative.asInterface(b); String name = data.readString(); + int userId = data.readInt(); boolean stable = data.readInt() != 0; - ContentProviderHolder cph = getContentProvider(app, name, stable); + ContentProviderHolder cph = getContentProvider(app, name, userId, stable); reply.writeNoException(); if (cph != null) { reply.writeInt(1); @@ -595,8 +648,9 @@ public boolean onTransact(int code, Parcel data, Parcel reply, int flags) case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); String name = data.readString(); + int userId = data.readInt(); IBinder token = data.readStrongBinder(); - ContentProviderHolder cph = getContentProviderExternal(name, token); + ContentProviderHolder cph = getContentProviderExternal(name, userId, token); reply.writeNoException(); if (cph != null) { reply.writeInt(1); @@ -670,7 +724,8 @@ public boolean onTransact(int code, Parcel data, Parcel reply, int flags) IApplicationThread app = ApplicationThreadNative.asInterface(b); Intent service = Intent.CREATOR.createFromParcel(data); String resolvedType = data.readString(); - ComponentName cn = startService(app, service, resolvedType); + int userId = data.readInt(); + ComponentName cn = startService(app, service, resolvedType, userId); reply.writeNoException(); ComponentName.writeToParcel(cn, reply); return true; @@ -682,7 +737,8 @@ public boolean onTransact(int code, Parcel data, Parcel reply, int flags) IApplicationThread app = ApplicationThreadNative.asInterface(b); Intent service = Intent.CREATOR.createFromParcel(data); String resolvedType = data.readString(); - int res = stopService(app, service, resolvedType); + int userId = data.readInt(); + int res = stopService(app, service, resolvedType, userId); reply.writeNoException(); reply.writeInt(res); return true; @@ -780,7 +836,8 @@ public boolean onTransact(int code, Parcel data, Parcel reply, int flags) Bundle arguments = data.readBundle(); IBinder b = data.readStrongBinder(); IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b); - boolean res = startInstrumentation(className, profileFile, fl, arguments, w); + int userId = data.readInt(); + boolean res = startInstrumentation(className, profileFile, fl, arguments, w, userId); reply.writeNoException(); reply.writeInt(res ? 1 : 0); return true; @@ -868,9 +925,10 @@ public boolean onTransact(int code, Parcel data, Parcel reply, int flags) int fl = data.readInt(); Bundle options = data.readInt() != 0 ? Bundle.CREATOR.createFromParcel(data) : null; + int userId = data.readInt(); IIntentSender res = getIntentSender(type, packageName, token, resultWho, requestCode, requestIntents, - requestResolvedTypes, fl, options); + requestResolvedTypes, fl, options, userId); reply.writeNoException(); reply.writeStrongBinder(res != null ? res.asBinder() : null); return true; @@ -905,6 +963,22 @@ public boolean onTransact(int code, Parcel data, Parcel reply, int flags) return true; } + case HANDLE_INCOMING_USER_TRANSACTION: { + data.enforceInterface(IActivityManager.descriptor); + int callingPid = data.readInt(); + int callingUid = data.readInt(); + int userId = data.readInt(); + boolean allowAll = data.readInt() != 0 ; + boolean requireFull = data.readInt() != 0; + String name = data.readString(); + String callerPackage = data.readString(); + int res = handleIncomingUser(callingPid, callingUid, userId, allowAll, + requireFull, name, callerPackage); + reply.writeNoException(); + reply.writeInt(res); + return true; + } + case SET_PROCESS_LIMIT_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); int max = data.readInt(); @@ -1164,7 +1238,8 @@ public boolean onTransact(int code, Parcel data, Parcel reply, int flags) case KILL_BACKGROUND_PROCESSES_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); String packageName = data.readString(); - killBackgroundProcesses(packageName); + int userId = data.readInt(); + killBackgroundProcesses(packageName, userId); reply.writeNoException(); return true; } @@ -1179,7 +1254,8 @@ public boolean onTransact(int code, Parcel data, Parcel reply, int flags) case FORCE_STOP_PACKAGE_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); String packageName = data.readString(); - forceStopPackage(packageName); + int userId = data.readInt(); + forceStopPackage(packageName, userId); reply.writeNoException(); return true; } @@ -1205,12 +1281,13 @@ public boolean onTransact(int code, Parcel data, Parcel reply, int flags) case PROFILE_CONTROL_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); String process = data.readString(); + int userId = data.readInt(); boolean start = data.readInt() != 0; int profileType = data.readInt(); String path = data.readString(); ParcelFileDescriptor fd = data.readInt() != 0 ? data.readFileDescriptor() : null; - boolean res = profileControl(process, start, path, fd, profileType); + boolean res = profileControl(process, userId, start, path, fd, profileType); reply.writeNoException(); reply.writeInt(res ? 1 : 0); return true; @@ -1275,30 +1352,11 @@ public boolean onTransact(int code, Parcel data, Parcel reply, int flags) return true; } - case START_ACTIVITY_IN_PACKAGE_TRANSACTION: - { - data.enforceInterface(IActivityManager.descriptor); - int uid = data.readInt(); - Intent intent = Intent.CREATOR.createFromParcel(data); - String resolvedType = data.readString(); - IBinder resultTo = data.readStrongBinder(); - String resultWho = data.readString(); - int requestCode = data.readInt(); - int startFlags = data.readInt(); - Bundle options = data.readInt() != 0 - ? Bundle.CREATOR.createFromParcel(data) : null; - int result = startActivityInPackage(uid, intent, resolvedType, - resultTo, resultWho, requestCode, startFlags, options); - reply.writeNoException(); - reply.writeInt(result); - return true; - } - - case KILL_APPLICATION_WITH_UID_TRANSACTION: { + case KILL_APPLICATION_WITH_APPID_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); String pkg = data.readString(); - int uid = data.readInt(); - killApplicationWithUid(pkg, uid); + int appid = data.readInt(); + killApplicationWithAppId(pkg, appid); reply.writeNoException(); return true; } @@ -1395,7 +1453,8 @@ public boolean onTransact(int code, Parcel data, Parcel reply, int flags) case GET_PROVIDER_MIME_TYPE_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); Uri uri = Uri.CREATOR.createFromParcel(data); - String type = getProviderMimeType(uri); + int userId = data.readInt(); + String type = getProviderMimeType(uri, userId); reply.writeNoException(); reply.writeString(type); return true; @@ -1450,32 +1509,17 @@ public boolean onTransact(int code, Parcel data, Parcel reply, int flags) case DUMP_HEAP_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); String process = data.readString(); + int userId = data.readInt(); boolean managed = data.readInt() != 0; String path = data.readString(); ParcelFileDescriptor fd = data.readInt() != 0 ? data.readFileDescriptor() : null; - boolean res = dumpHeap(process, managed, path, fd); + boolean res = dumpHeap(process, userId, managed, path, fd); reply.writeNoException(); reply.writeInt(res ? 1 : 0); return true; } - case START_ACTIVITIES_IN_PACKAGE_TRANSACTION: - { - data.enforceInterface(IActivityManager.descriptor); - int uid = data.readInt(); - Intent[] intents = data.createTypedArray(Intent.CREATOR); - String[] resolvedTypes = data.createStringArray(); - IBinder resultTo = data.readStrongBinder(); - Bundle options = data.readInt() != 0 - ? Bundle.CREATOR.createFromParcel(data) : null; - int result = startActivitiesInPackage(uid, intents, resolvedTypes, - resultTo, options); - reply.writeNoException(); - reply.writeInt(result); - return true; - } - case START_ACTIVITIES_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); @@ -1486,8 +1530,9 @@ public boolean onTransact(int code, Parcel data, Parcel reply, int flags) IBinder resultTo = data.readStrongBinder(); Bundle options = data.readInt() != 0 ? Bundle.CREATOR.createFromParcel(data) : null; + int userId = data.readInt(); int result = startActivities(app, intents, resolvedTypes, resultTo, - options); + options, userId); reply.writeNoException(); reply.writeInt(result); return true; @@ -1541,6 +1586,17 @@ public boolean onTransact(int code, Parcel data, Parcel reply, int flags) return true; } + case STOP_USER_TRANSACTION: { + data.enforceInterface(IActivityManager.descriptor); + int userid = data.readInt(); + IStopUserCallback callback = IStopUserCallback.Stub.asInterface( + data.readStrongBinder()); + int result = stopUser(userid, callback); + reply.writeNoException(); + reply.writeInt(result); + return true; + } + case GET_CURRENT_USER_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); UserInfo userInfo = getCurrentUser(); @@ -1549,6 +1605,24 @@ public boolean onTransact(int code, Parcel data, Parcel reply, int flags) return true; } + case IS_USER_RUNNING_TRANSACTION: { + data.enforceInterface(IActivityManager.descriptor); + int userid = data.readInt(); + boolean orStopping = data.readInt() != 0; + boolean result = isUserRunning(userid, orStopping); + reply.writeNoException(); + reply.writeInt(result ? 1 : 0); + return true; + } + + case GET_RUNNING_USER_IDS_TRANSACTION: { + data.enforceInterface(IActivityManager.descriptor); + int[] result = getRunningUserIds(); + reply.writeNoException(); + reply.writeIntArray(result); + return true; + } + case REMOVE_SUB_TASK_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); @@ -1694,6 +1768,41 @@ public boolean onTransact(int code, Parcel data, Parcel reply, int flags) return true; } + case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: { + data.enforceInterface(IActivityManager.descriptor); + IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface( + data.readStrongBinder()); + registerUserSwitchObserver(observer); + reply.writeNoException(); + return true; + } + + case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: { + data.enforceInterface(IActivityManager.descriptor); + IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface( + data.readStrongBinder()); + unregisterUserSwitchObserver(observer); + reply.writeNoException(); + return true; + } + + case REQUEST_BUG_REPORT_TRANSACTION: { + data.enforceInterface(IActivityManager.descriptor); + requestBugReport(); + reply.writeNoException(); + return true; + } + + case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: { + data.enforceInterface(IActivityManager.descriptor); + int pid = data.readInt(); + boolean aboveSystem = data.readInt() != 0; + long res = inputDispatchingTimedOut(pid, aboveSystem); + reply.writeNoException(); + reply.writeLong(res); + return true; + } + } return super.onTransact(code, data, reply, flags); @@ -1764,10 +1873,46 @@ public int startActivity(IApplicationThread caller, Intent intent, data.recycle(); return result; } + + public int startActivityAsUser(IApplicationThread caller, Intent intent, + String resolvedType, IBinder resultTo, String resultWho, int requestCode, + int startFlags, String profileFile, + ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException { + Parcel data = Parcel.obtain(); + Parcel reply = Parcel.obtain(); + data.writeInterfaceToken(IActivityManager.descriptor); + data.writeStrongBinder(caller != null ? caller.asBinder() : null); + intent.writeToParcel(data, 0); + data.writeString(resolvedType); + data.writeStrongBinder(resultTo); + data.writeString(resultWho); + data.writeInt(requestCode); + data.writeInt(startFlags); + data.writeString(profileFile); + if (profileFd != null) { + data.writeInt(1); + profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE); + } else { + data.writeInt(0); + } + if (options != null) { + data.writeInt(1); + options.writeToParcel(data, 0); + } else { + data.writeInt(0); + } + data.writeInt(userId); + mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0); + reply.readException(); + int result = reply.readInt(); + reply.recycle(); + data.recycle(); + return result; + } public WaitResult startActivityAndWait(IApplicationThread caller, Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode, int startFlags, String profileFile, - ParcelFileDescriptor profileFd, Bundle options) throws RemoteException { + ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); data.writeInterfaceToken(IActivityManager.descriptor); @@ -1791,6 +1936,7 @@ public WaitResult startActivityAndWait(IApplicationThread caller, Intent intent, } else { data.writeInt(0); } + data.writeInt(userId); mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0); reply.readException(); WaitResult result = WaitResult.CREATOR.createFromParcel(reply); @@ -1801,7 +1947,7 @@ public WaitResult startActivityAndWait(IApplicationThread caller, Intent intent, public int startActivityWithConfig(IApplicationThread caller, Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode, int startFlags, Configuration config, - Bundle options) throws RemoteException { + Bundle options, int userId) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); data.writeInterfaceToken(IActivityManager.descriptor); @@ -1819,6 +1965,7 @@ public int startActivityWithConfig(IApplicationThread caller, Intent intent, } else { data.writeInt(0); } + data.writeInt(userId); mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0); reply.readException(); int result = reply.readInt(); @@ -1939,7 +2086,7 @@ public boolean willActivityBeVisible(IBinder token) throws RemoteException { } public Intent registerReceiver(IApplicationThread caller, String packageName, IIntentReceiver receiver, - IntentFilter filter, String perm) throws RemoteException + IntentFilter filter, String perm, int userId) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); @@ -1949,6 +2096,7 @@ public Intent registerReceiver(IApplicationThread caller, String packageName, data.writeStrongBinder(receiver != null ? receiver.asBinder() : null); filter.writeToParcel(data, 0); data.writeString(perm); + data.writeInt(userId); mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0); reply.readException(); Intent intent = null; @@ -2057,6 +2205,17 @@ public void activityIdle(IBinder token, Configuration config, boolean stopProfil data.recycle(); reply.recycle(); } + public void activityResumed(IBinder token) throws RemoteException + { + Parcel data = Parcel.obtain(); + Parcel reply = Parcel.obtain(); + data.writeInterfaceToken(IActivityManager.descriptor); + data.writeStrongBinder(token); + mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0); + reply.readException(); + data.recycle(); + reply.recycle(); + } public void activityPaused(IBinder token) throws RemoteException { Parcel data = Parcel.obtain(); @@ -2163,12 +2322,13 @@ public List getTasks(int maxNum, int flags, return list; } public List getRecentTasks(int maxNum, - int flags) throws RemoteException { + int flags, int userId) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); data.writeInterfaceToken(IActivityManager.descriptor); data.writeInt(maxNum); data.writeInt(flags); + data.writeInt(userId); mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0); reply.readException(); ArrayList list @@ -2192,6 +2352,21 @@ public ActivityManager.TaskThumbnails getTaskThumbnails(int id) throws RemoteExc reply.recycle(); return bm; } + public Bitmap getTaskTopThumbnail(int id) throws RemoteException { + Parcel data = Parcel.obtain(); + Parcel reply = Parcel.obtain(); + data.writeInterfaceToken(IActivityManager.descriptor); + data.writeInt(id); + mRemote.transact(GET_TASK_TOP_THUMBNAIL_TRANSACTION, data, reply, 0); + reply.readException(); + Bitmap bm = null; + if (reply.readInt() != 0) { + bm = Bitmap.CREATOR.createFromParcel(reply); + } + data.recycle(); + reply.recycle(); + return bm; + } public List getServices(int maxNum, int flags) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); @@ -2343,12 +2518,13 @@ public void reportThumbnail(IBinder token, reply.recycle(); } public ContentProviderHolder getContentProvider(IApplicationThread caller, - String name, boolean stable) throws RemoteException { + String name, int userId, boolean stable) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); data.writeInterfaceToken(IActivityManager.descriptor); data.writeStrongBinder(caller != null ? caller.asBinder() : null); data.writeString(name); + data.writeInt(userId); data.writeInt(stable ? 1 : 0); mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0); reply.readException(); @@ -2361,13 +2537,13 @@ public ContentProviderHolder getContentProvider(IApplicationThread caller, reply.recycle(); return cph; } - public ContentProviderHolder getContentProviderExternal(String name, IBinder token) - throws RemoteException - { + public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token) + throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); data.writeInterfaceToken(IActivityManager.descriptor); data.writeString(name); + data.writeInt(userId); data.writeStrongBinder(token); mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0); reply.readException(); @@ -2459,7 +2635,7 @@ public PendingIntent getRunningServiceControlPanel(ComponentName service) } public ComponentName startService(IApplicationThread caller, Intent service, - String resolvedType) throws RemoteException + String resolvedType, int userId) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); @@ -2467,6 +2643,7 @@ public ComponentName startService(IApplicationThread caller, Intent service, data.writeStrongBinder(caller != null ? caller.asBinder() : null); service.writeToParcel(data, 0); data.writeString(resolvedType); + data.writeInt(userId); mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0); reply.readException(); ComponentName res = ComponentName.readFromParcel(reply); @@ -2475,7 +2652,7 @@ public ComponentName startService(IApplicationThread caller, Intent service, return res; } public int stopService(IApplicationThread caller, Intent service, - String resolvedType) throws RemoteException + String resolvedType, int userId) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); @@ -2483,6 +2660,7 @@ public int stopService(IApplicationThread caller, Intent service, data.writeStrongBinder(caller != null ? caller.asBinder() : null); service.writeToParcel(data, 0); data.writeString(resolvedType); + data.writeInt(userId); mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0); reply.readException(); int res = reply.readInt(); @@ -2631,6 +2809,15 @@ public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode) return success; } + public void clearPendingBackup() throws RemoteException { + Parcel data = Parcel.obtain(); + Parcel reply = Parcel.obtain(); + data.writeInterfaceToken(IActivityManager.descriptor); + mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0); + reply.recycle(); + data.recycle(); + } + public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); @@ -2654,7 +2841,7 @@ public void unbindBackupAgent(ApplicationInfo app) throws RemoteException { } public boolean startInstrumentation(ComponentName className, String profileFile, - int flags, Bundle arguments, IInstrumentationWatcher watcher) + int flags, Bundle arguments, IInstrumentationWatcher watcher, int userId) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); @@ -2664,6 +2851,7 @@ public boolean startInstrumentation(ComponentName className, String profileFile, data.writeInt(flags); data.writeBundle(arguments); data.writeStrongBinder(watcher != null ? watcher.asBinder() : null); + data.writeInt(userId); mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0); reply.readException(); boolean res = reply.readInt() != 0; @@ -2761,7 +2949,7 @@ public String getPackageForToken(IBinder token) throws RemoteException public IIntentSender getIntentSender(int type, String packageName, IBinder token, String resultWho, int requestCode, Intent[] intents, String[] resolvedTypes, int flags, - Bundle options) throws RemoteException { + Bundle options, int userId) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); data.writeInterfaceToken(IActivityManager.descriptor); @@ -2784,6 +2972,7 @@ public IIntentSender getIntentSender(int type, } else { data.writeInt(0); } + data.writeInt(userId); mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0); reply.readException(); IIntentSender res = IIntentSender.Stub.asInterface( @@ -2826,6 +3015,25 @@ public int getUidForIntentSender(IIntentSender sender) throws RemoteException { reply.recycle(); return res; } + public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll, + boolean requireFull, String name, String callerPackage) throws RemoteException { + Parcel data = Parcel.obtain(); + Parcel reply = Parcel.obtain(); + data.writeInterfaceToken(IActivityManager.descriptor); + data.writeInt(callingPid); + data.writeInt(callingUid); + data.writeInt(userId); + data.writeInt(allowAll ? 1 : 0); + data.writeInt(requireFull ? 1 : 0); + data.writeString(name); + data.writeString(callerPackage); + mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0); + reply.readException(); + int res = reply.readInt(); + data.recycle(); + reply.recycle(); + return res; + } public void setProcessLimit(int max) throws RemoteException { Parcel data = Parcel.obtain(); @@ -3165,11 +3373,12 @@ public void signalPersistentProcesses(int sig) throws RemoteException { reply.recycle(); } - public void killBackgroundProcesses(String packageName) throws RemoteException { + public void killBackgroundProcesses(String packageName, int userId) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); data.writeInterfaceToken(IActivityManager.descriptor); data.writeString(packageName); + data.writeInt(userId); mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0); reply.readException(); data.recycle(); @@ -3186,11 +3395,12 @@ public void killAllBackgroundProcesses() throws RemoteException { reply.recycle(); } - public void forceStopPackage(String packageName) throws RemoteException { + public void forceStopPackage(String packageName, int userId) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); data.writeInterfaceToken(IActivityManager.descriptor); data.writeString(packageName); + data.writeInt(userId); mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0); reply.readException(); data.recycle(); @@ -3223,13 +3433,14 @@ public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException return res; } - public boolean profileControl(String process, boolean start, + public boolean profileControl(String process, int userId, boolean start, String path, ParcelFileDescriptor fd, int profileType) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); data.writeInterfaceToken(IActivityManager.descriptor); data.writeString(process); + data.writeInt(userId); data.writeInt(start ? 1 : 0); data.writeInt(profileType); data.writeString(path); @@ -3281,41 +3492,13 @@ public void resumeAppSwitches() throws RemoteException { data.recycle(); } - public int startActivityInPackage(int uid, - Intent intent, String resolvedType, IBinder resultTo, - String resultWho, int requestCode, int startFlags, Bundle options) - throws RemoteException { - Parcel data = Parcel.obtain(); - Parcel reply = Parcel.obtain(); - data.writeInterfaceToken(IActivityManager.descriptor); - data.writeInt(uid); - intent.writeToParcel(data, 0); - data.writeString(resolvedType); - data.writeStrongBinder(resultTo); - data.writeString(resultWho); - data.writeInt(requestCode); - data.writeInt(startFlags); - if (options != null) { - data.writeInt(1); - options.writeToParcel(data, 0); - } else { - data.writeInt(0); - } - mRemote.transact(START_ACTIVITY_IN_PACKAGE_TRANSACTION, data, reply, 0); - reply.readException(); - int result = reply.readInt(); - reply.recycle(); - data.recycle(); - return result; - } - - public void killApplicationWithUid(String pkg, int uid) throws RemoteException { + public void killApplicationWithAppId(String pkg, int appid) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); data.writeInterfaceToken(IActivityManager.descriptor); data.writeString(pkg); - data.writeInt(uid); - mRemote.transact(KILL_APPLICATION_WITH_UID_TRANSACTION, data, reply, 0); + data.writeInt(appid); + mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0); reply.readException(); data.recycle(); reply.recycle(); @@ -3450,12 +3633,12 @@ public void crashApplication(int uid, int initialPid, String packageName, reply.recycle(); } - public String getProviderMimeType(Uri uri) - throws RemoteException { + public String getProviderMimeType(Uri uri, int userId) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); data.writeInterfaceToken(IActivityManager.descriptor); uri.writeToParcel(data, 0); + data.writeInt(userId); mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0); reply.readException(); String res = reply.readString(); @@ -3530,12 +3713,13 @@ public int checkGrantUriPermission(int callingUid, String targetPkg, return res; } - public boolean dumpHeap(String process, boolean managed, + public boolean dumpHeap(String process, int userId, boolean managed, String path, ParcelFileDescriptor fd) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); data.writeInterfaceToken(IActivityManager.descriptor); data.writeString(process); + data.writeInt(userId); data.writeInt(managed ? 1 : 0); data.writeString(path); if (fd != null) { @@ -3554,7 +3738,7 @@ public boolean dumpHeap(String process, boolean managed, public int startActivities(IApplicationThread caller, Intent[] intents, String[] resolvedTypes, IBinder resultTo, - Bundle options) throws RemoteException { + Bundle options, int userId) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); data.writeInterfaceToken(IActivityManager.descriptor); @@ -3568,6 +3752,7 @@ public int startActivities(IApplicationThread caller, } else { data.writeInt(0); } + data.writeInt(userId); mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0); reply.readException(); int result = reply.readInt(); @@ -3576,30 +3761,6 @@ public int startActivities(IApplicationThread caller, return result; } - public int startActivitiesInPackage(int uid, - Intent[] intents, String[] resolvedTypes, IBinder resultTo, - Bundle options) throws RemoteException { - Parcel data = Parcel.obtain(); - Parcel reply = Parcel.obtain(); - data.writeInterfaceToken(IActivityManager.descriptor); - data.writeInt(uid); - data.writeTypedArray(intents, 0); - data.writeStringArray(resolvedTypes); - data.writeStrongBinder(resultTo); - if (options != null) { - data.writeInt(1); - options.writeToParcel(data, 0); - } else { - data.writeInt(0); - } - mRemote.transact(START_ACTIVITIES_IN_PACKAGE_TRANSACTION, data, reply, 0); - reply.readException(); - int result = reply.readInt(); - reply.recycle(); - data.recycle(); - return result; - } - public int getFrontActivityScreenCompatMode() throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); @@ -3688,11 +3849,25 @@ public boolean switchUser(int userid) throws RemoteException { return result; } + public int stopUser(int userid, IStopUserCallback callback) throws RemoteException { + Parcel data = Parcel.obtain(); + Parcel reply = Parcel.obtain(); + data.writeInterfaceToken(IActivityManager.descriptor); + data.writeInt(userid); + data.writeStrongInterface(callback); + mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0); + reply.readException(); + int result = reply.readInt(); + reply.recycle(); + data.recycle(); + return result; + } + public UserInfo getCurrentUser() throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); data.writeInterfaceToken(IActivityManager.descriptor); - mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0); + mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0); reply.readException(); UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply); reply.recycle(); @@ -3700,6 +3875,32 @@ public UserInfo getCurrentUser() throws RemoteException { return userInfo; } + public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException { + Parcel data = Parcel.obtain(); + Parcel reply = Parcel.obtain(); + data.writeInterfaceToken(IActivityManager.descriptor); + data.writeInt(userid); + data.writeInt(orStopping ? 1 : 0); + mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0); + reply.readException(); + boolean result = reply.readInt() != 0; + reply.recycle(); + data.recycle(); + return result; + } + + public int[] getRunningUserIds() throws RemoteException { + Parcel data = Parcel.obtain(); + Parcel reply = Parcel.obtain(); + data.writeInterfaceToken(IActivityManager.descriptor); + mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0); + reply.readException(); + int[] result = reply.createIntArray(); + reply.recycle(); + data.recycle(); + return result; + } + public boolean removeSubTask(int taskId, int subTaskIndex) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); @@ -3873,5 +4074,51 @@ public int getLaunchedFromUid(IBinder activityToken) throws RemoteException { return result; } + public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException { + Parcel data = Parcel.obtain(); + Parcel reply = Parcel.obtain(); + data.writeInterfaceToken(IActivityManager.descriptor); + data.writeStrongBinder(observer != null ? observer.asBinder() : null); + mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0); + reply.readException(); + data.recycle(); + reply.recycle(); + } + + public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException { + Parcel data = Parcel.obtain(); + Parcel reply = Parcel.obtain(); + data.writeInterfaceToken(IActivityManager.descriptor); + data.writeStrongBinder(observer != null ? observer.asBinder() : null); + mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0); + reply.readException(); + data.recycle(); + reply.recycle(); + } + + public void requestBugReport() throws RemoteException { + Parcel data = Parcel.obtain(); + Parcel reply = Parcel.obtain(); + data.writeInterfaceToken(IActivityManager.descriptor); + mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0); + reply.readException(); + data.recycle(); + reply.recycle(); + } + + public long inputDispatchingTimedOut(int pid, boolean aboveSystem) throws RemoteException { + Parcel data = Parcel.obtain(); + Parcel reply = Parcel.obtain(); + data.writeInterfaceToken(IActivityManager.descriptor); + data.writeInt(pid); + data.writeInt(aboveSystem ? 1 : 0); + mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0); + reply.readException(); + long res = reply.readInt(); + data.recycle(); + reply.recycle(); + return res; + } + private IBinder mRemote; } diff --git a/core/java/android/app/ActivityOptions.java b/core/java/android/app/ActivityOptions.java index 4edfdfb32a35e..87b1e2413368f 100644 --- a/core/java/android/app/ActivityOptions.java +++ b/core/java/android/app/ActivityOptions.java @@ -97,9 +97,9 @@ public class ActivityOptions { /** @hide */ public static final int ANIM_SCALE_UP = 2; /** @hide */ - public static final int ANIM_THUMBNAIL = 3; + public static final int ANIM_THUMBNAIL_SCALE_UP = 3; /** @hide */ - public static final int ANIM_THUMBNAIL_DELAYED = 4; + public static final int ANIM_THUMBNAIL_SCALE_DOWN = 4; private String mPackageName; private int mAnimationType = ANIM_NONE; @@ -262,20 +262,19 @@ public static ActivityOptions makeThumbnailScaleUpAnimation(View source, */ public static ActivityOptions makeThumbnailScaleUpAnimation(View source, Bitmap thumbnail, int startX, int startY, OnAnimationStartedListener listener) { - return makeThumbnailScaleUpAnimation(source, thumbnail, startX, startY, listener, false); + return makeThumbnailAnimation(source, thumbnail, startX, startY, listener, true); } /** - * Create an ActivityOptions specifying an animation where a thumbnail - * is scaled from a given position to the new activity window that is - * being started. Before the animation, there is a short delay. + * Create an ActivityOptions specifying an animation where an activity window + * is scaled from a given position to a thumbnail at a specified location. * - * @param source The View that this thumbnail is animating from. This + * @param source The View that this thumbnail is animating to. This * defines the coordinate space for startX and startY. - * @param thumbnail The bitmap that will be shown as the initial thumbnail + * @param thumbnail The bitmap that will be shown as the final thumbnail * of the animation. - * @param startX The x starting location of the bitmap, relative to source. - * @param startY The y starting location of the bitmap, relative to source. + * @param startX The x end location of the bitmap, relative to source. + * @param startY The y end location of the bitmap, relative to source. * @param listener Optional OnAnimationStartedListener to find out when the * requested animation has started running. If for some reason the animation * is not executed, the callback will happen immediately. @@ -283,17 +282,17 @@ public static ActivityOptions makeThumbnailScaleUpAnimation(View source, * supply these options as the options Bundle when starting an activity. * @hide */ - public static ActivityOptions makeDelayedThumbnailScaleUpAnimation(View source, + public static ActivityOptions makeThumbnailScaleDownAnimation(View source, Bitmap thumbnail, int startX, int startY, OnAnimationStartedListener listener) { - return makeThumbnailScaleUpAnimation(source, thumbnail, startX, startY, listener, true); + return makeThumbnailAnimation(source, thumbnail, startX, startY, listener, false); } - private static ActivityOptions makeThumbnailScaleUpAnimation(View source, + private static ActivityOptions makeThumbnailAnimation(View source, Bitmap thumbnail, int startX, int startY, OnAnimationStartedListener listener, - boolean delayed) { + boolean scaleUp) { ActivityOptions opts = new ActivityOptions(); opts.mPackageName = source.getContext().getPackageName(); - opts.mAnimationType = delayed ? ANIM_THUMBNAIL_DELAYED : ANIM_THUMBNAIL; + opts.mAnimationType = scaleUp ? ANIM_THUMBNAIL_SCALE_UP : ANIM_THUMBNAIL_SCALE_DOWN; opts.mThumbnail = thumbnail; int[] pts = new int[2]; source.getLocationOnScreen(pts); @@ -320,8 +319,8 @@ public ActivityOptions(Bundle opts) { mStartY = opts.getInt(KEY_ANIM_START_Y, 0); mStartWidth = opts.getInt(KEY_ANIM_START_WIDTH, 0); mStartHeight = opts.getInt(KEY_ANIM_START_HEIGHT, 0); - } else if (mAnimationType == ANIM_THUMBNAIL || - mAnimationType == ANIM_THUMBNAIL_DELAYED) { + } else if (mAnimationType == ANIM_THUMBNAIL_SCALE_UP || + mAnimationType == ANIM_THUMBNAIL_SCALE_DOWN) { mThumbnail = (Bitmap)opts.getParcelable(KEY_ANIM_THUMBNAIL); mStartX = opts.getInt(KEY_ANIM_START_X, 0); mStartY = opts.getInt(KEY_ANIM_START_Y, 0); @@ -434,8 +433,8 @@ public void update(ActivityOptions otherOptions) { } mAnimationStartedListener = null; break; - case ANIM_THUMBNAIL: - case ANIM_THUMBNAIL_DELAYED: + case ANIM_THUMBNAIL_SCALE_UP: + case ANIM_THUMBNAIL_SCALE_DOWN: mAnimationType = otherOptions.mAnimationType; mThumbnail = otherOptions.mThumbnail; mStartX = otherOptions.mStartX; @@ -479,8 +478,8 @@ public Bundle toBundle() { b.putInt(KEY_ANIM_START_WIDTH, mStartWidth); b.putInt(KEY_ANIM_START_HEIGHT, mStartHeight); break; - case ANIM_THUMBNAIL: - case ANIM_THUMBNAIL_DELAYED: + case ANIM_THUMBNAIL_SCALE_UP: + case ANIM_THUMBNAIL_SCALE_DOWN: b.putInt(KEY_ANIM_TYPE, mAnimationType); b.putParcelable(KEY_ANIM_THUMBNAIL, mThumbnail); b.putInt(KEY_ANIM_START_X, mStartX); diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index 7242029a7c031..3c13fbbf8ffb8 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2006 The Android Open Source Project + * This code has been modified. Portions copyright (C) 2010, T-Mobile USA, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,19 +17,28 @@ package android.app; +import com.android.internal.app.IAssetRedirectionManager; +import com.android.internal.os.BinderInternal; +import com.android.internal.os.RuntimeInit; +import com.android.internal.os.SamplingProfilerIntegration; + +import org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl; + import android.app.backup.BackupAgent; import android.content.BroadcastReceiver; import android.content.ComponentCallbacks2; import android.content.ComponentName; import android.content.ContentProvider; import android.content.Context; +import android.content.ContextWrapper; import android.content.IContentProvider; -import android.content.Intent; import android.content.IIntentReceiver; +import android.content.Intent; import android.content.pm.ActivityInfo; import android.content.pm.ApplicationInfo; import android.content.pm.IPackageManager; import android.content.pm.InstrumentationInfo; +import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.content.pm.ProviderInfo; @@ -36,20 +46,27 @@ import android.content.res.AssetManager; import android.content.res.CompatibilityInfo; import android.content.res.Configuration; +import android.content.res.CustomTheme; +import android.content.res.PackageRedirectionMap; import android.content.res.Resources; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDebug; import android.database.sqlite.SQLiteDebug.DbStats; import android.graphics.Bitmap; import android.graphics.Canvas; +import android.hardware.display.DisplayManager; +import android.hardware.display.DisplayManagerGlobal; import android.net.IConnectivityManager; import android.net.Proxy; import android.net.ProxyProperties; import android.opengl.GLUtils; import android.os.AsyncTask; +import android.net.Uri; import android.os.Binder; import android.os.Bundle; import android.os.Debug; +import android.os.DropBoxManager; +import android.os.Environment; import android.os.Handler; import android.os.IBinder; import android.os.Looper; @@ -61,8 +78,10 @@ import android.os.ServiceManager; import android.os.StrictMode; import android.os.SystemClock; +import android.os.SystemProperties; import android.os.Trace; -import android.os.UserId; +import android.os.UserHandle; +import android.text.TextUtils; import android.util.AndroidRuntimeException; import android.util.DisplayMetrics; import android.util.EventLog; @@ -70,22 +89,20 @@ import android.util.LogPrinter; import android.util.PrintWriterPrinter; import android.util.Slog; +import android.view.CompatibilityInfoHolder; import android.view.Display; import android.view.HardwareRenderer; +import android.view.InflateException; import android.view.View; import android.view.ViewDebug; import android.view.ViewManager; import android.view.ViewRootImpl; import android.view.Window; import android.view.WindowManager; -import android.view.WindowManagerImpl; +import android.view.WindowManagerGlobal; import android.renderscript.RenderScript; -import com.android.internal.os.BinderInternal; -import com.android.internal.os.RuntimeInit; -import com.android.internal.os.SamplingProfilerIntegration; - -import org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl; +import com.android.internal.util.Objects; import java.io.File; import java.io.FileDescriptor; @@ -94,6 +111,7 @@ import java.io.PrintWriter; import java.lang.ref.WeakReference; import java.net.InetAddress; +import java.security.Security; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; @@ -103,6 +121,8 @@ import java.util.TimeZone; import java.util.regex.Pattern; +import libcore.io.DropBox; +import libcore.io.EventLogger; import libcore.io.IoUtils; import dalvik.system.CloseGuard; @@ -150,6 +170,7 @@ public final class ActivityThread { static ContextImpl mSystemContext = null; static IPackageManager sPackageManager; + static IAssetRedirectionManager sAssetRedirectionManager; final ApplicationThread mAppThread = new ApplicationThread(); final Looper mLooper = Looper.myLooper(); @@ -165,6 +186,8 @@ public final class ActivityThread { = new HashMap(); AppBindData mBoundApplication; Profiler mProfiler; + int mCurDefaultDisplayDpi; + boolean mDensityCompatMode; Configuration mConfiguration; Configuration mCompatConfiguration; Configuration mResConfiguration; @@ -196,7 +219,7 @@ public final class ActivityThread { = new HashMap>(); final HashMap> mResourcePackages = new HashMap>(); - final HashMap mDisplayMetrics + final HashMap mDefaultDisplayMetrics = new HashMap(); final HashMap > mActiveResources = new HashMap >(); @@ -204,9 +227,33 @@ public final class ActivityThread { = new ArrayList(); Configuration mPendingConfiguration = null; + private static final class ProviderKey { + final String authority; + final int userId; + + public ProviderKey(String authority, int userId) { + this.authority = authority; + this.userId = userId; + } + + @Override + public boolean equals(Object o) { + if (o instanceof ProviderKey) { + final ProviderKey other = (ProviderKey) o; + return Objects.equal(authority, other.authority) && userId == other.userId; + } + return false; + } + + @Override + public int hashCode() { + return ((authority != null) ? authority.hashCode() : 0) ^ userId; + } + } + // The lock of mProviderMap protects the following variables. - final HashMap mProviderMap - = new HashMap(); + final HashMap mProviderMap + = new HashMap(); final HashMap mProviderRefCountMap = new HashMap(); final HashMap mLocalProviders @@ -313,8 +360,9 @@ public String toString() { static final class ReceiverData extends BroadcastReceiver.PendingResult { public ReceiverData(Intent intent, int resultCode, String resultData, Bundle resultExtras, - boolean ordered, boolean sticky, IBinder token) { - super(resultCode, resultData, resultExtras, TYPE_COMPONENT, ordered, sticky, token); + boolean ordered, boolean sticky, IBinder token, int sendingUser) { + super(resultCode, resultData, resultExtras, TYPE_COMPONENT, ordered, sticky, + token, sendingUser); this.intent = intent; } @@ -606,9 +654,9 @@ public final void scheduleDestroyActivity(IBinder token, boolean finishing, public final void scheduleReceiver(Intent intent, ActivityInfo info, CompatibilityInfo compatInfo, int resultCode, String data, Bundle extras, - boolean sync) { + boolean sync, int sendingUser) { ReceiverData r = new ReceiverData(intent, resultCode, data, extras, - sync, false, mAppThread.asBinder()); + sync, false, mAppThread.asBinder(), sendingUser); r.info = info; r.compatInfo = compatInfo; queueOrSendMessage(H.RECEIVER, r); @@ -767,8 +815,9 @@ public void dumpService(FileDescriptor fd, IBinder servicetoken, String[] args) // applies transaction ordering per object for such calls. public void scheduleRegisteredReceiver(IIntentReceiver receiver, Intent intent, int resultCode, String dataStr, Bundle extras, boolean ordered, - boolean sticky) throws RemoteException { - receiver.performReceive(intent, resultCode, dataStr, extras, ordered, sticky); + boolean sticky, int sendingUser) throws RemoteException { + receiver.performReceive(intent, resultCode, dataStr, extras, ordered, + sticky, sendingUser); } public void scheduleLowMemory() { @@ -1052,7 +1101,7 @@ private Debug.MemoryInfo dumpMemInfo(PrintWriter pw, boolean checkin, boolean al @Override public void dumpGfxInfo(FileDescriptor fd, String[] args) { dumpGraphicsInfo(fd); - WindowManagerImpl.getDefault().dumpGfxInfo(fd); + WindowManagerGlobal.getInstance().dumpGfxInfo(fd); } @Override @@ -1235,7 +1284,7 @@ public void handleMessage(Message msg) { case RESUME_ACTIVITY: Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "activityResume"); handleResumeActivity((IBinder)msg.obj, true, - msg.arg1 != 0); + msg.arg1 != 0, true); Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER); break; case SEND_RESULT: @@ -1305,6 +1354,7 @@ public void handleMessage(Message msg) { break; case CONFIGURATION_CHANGED: Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "configChanged"); + mCurDefaultDisplayDpi = ((Configuration)msg.obj).densityDpi; handleConfigurationChanged((Configuration)msg.obj, null); Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER); break; @@ -1467,13 +1517,31 @@ public final boolean queueIdle() { private static class ResourcesKey { final private String mResDir; + final private int mDisplayId; + final private Configuration mOverrideConfiguration; final private float mScale; + final private boolean mIsThemeable; final private int mHash; - ResourcesKey(String resDir, float scale) { + ResourcesKey(String resDir, int displayId, Configuration overrideConfiguration, float scale, boolean isThemeable) { mResDir = resDir; + mDisplayId = displayId; + if (overrideConfiguration != null) { + if (Configuration.EMPTY.equals(overrideConfiguration)) { + overrideConfiguration = null; + } + } + mOverrideConfiguration = overrideConfiguration; mScale = scale; - mHash = mResDir.hashCode() << 2 + (int) (mScale * 2); + mIsThemeable = isThemeable; + int hash = 17; + hash = 31 * hash + mResDir.hashCode(); + hash = 31 * hash + mDisplayId; + hash = 31 * hash + (mOverrideConfiguration != null + ? mOverrideConfiguration.hashCode() : 0); + hash = 31 * hash + Float.floatToIntBits(mScale); + hash = 31 * hash + (mIsThemeable ? 1 : 0); + mHash = hash; } @Override @@ -1487,7 +1555,24 @@ public boolean equals(Object obj) { return false; } ResourcesKey peer = (ResourcesKey) obj; - return mResDir.equals(peer.mResDir) && mScale == peer.mScale; + if (!mResDir.equals(peer.mResDir)) { + return false; + } + if (mDisplayId != peer.mDisplayId) { + return false; + } + if (mOverrideConfiguration != peer.mOverrideConfiguration) { + if (mOverrideConfiguration == null || peer.mOverrideConfiguration == null) { + return false; + } + if (!mOverrideConfiguration.equals(peer.mOverrideConfiguration)) { + return false; + } + } + if (mScale != peer.mScale) { + return false; + } + return mIsThemeable == peer.mIsThemeable; } } @@ -1518,17 +1603,53 @@ public static IPackageManager getPackageManager() { return sPackageManager; } - DisplayMetrics getDisplayMetricsLocked(CompatibilityInfo ci, boolean forceUpdate) { - DisplayMetrics dm = mDisplayMetrics.get(ci); - if (dm != null && !forceUpdate) { + private void flushDisplayMetricsLocked() { + mDefaultDisplayMetrics.clear(); + } + + // NOTE: this method can return null if the SystemServer is still + // initializing (for example, of another SystemServer component is accessing + // a resources object) + public static IAssetRedirectionManager getAssetRedirectionManager() { + if (sAssetRedirectionManager != null) { + return sAssetRedirectionManager; + } + IBinder b = ServiceManager.getService("assetredirection"); + sAssetRedirectionManager = IAssetRedirectionManager.Stub.asInterface(b); + return sAssetRedirectionManager; + } + + DisplayMetrics getDisplayMetricsLocked(int displayId, CompatibilityInfo ci) { + boolean isDefaultDisplay = (displayId == Display.DEFAULT_DISPLAY); + DisplayMetrics dm = isDefaultDisplay ? mDefaultDisplayMetrics.get(ci) : null; + if (dm != null) { return dm; } - if (dm == null) { - dm = new DisplayMetrics(); - mDisplayMetrics.put(ci, dm); + dm = new DisplayMetrics(); + + DisplayManagerGlobal displayManager = DisplayManagerGlobal.getInstance(); + if (displayManager == null) { + // may be null early in system startup + dm.setToDefaults(); + return dm; + } + + if (isDefaultDisplay) { + mDefaultDisplayMetrics.put(ci, dm); + } + + CompatibilityInfoHolder cih = new CompatibilityInfoHolder(); + cih.set(ci); + Display d = displayManager.getCompatibleDisplay(displayId, cih); + if (d != null) { + d.getMetrics(dm); + } else { + // Display no longer exists + // FIXME: This would not be a problem if we kept the Display object around + // instead of using the raw display id everywhere. The Display object caches + // its information even after the display has been removed. + dm.setToDefaults(); } - Display d = WindowManagerImpl.getDefault(ci).getDefaultDisplay(); - d.getMetrics(dm); //Slog.i("foo", "New metrics: w=" + metrics.widthPixels + " h=" // + metrics.heightPixels + " den=" + metrics.density // + " xdpi=" + metrics.xdpi + " ydpi=" + metrics.ydpi); @@ -1536,14 +1657,15 @@ DisplayMetrics getDisplayMetricsLocked(CompatibilityInfo ci, boolean forceUpdate } private Configuration mMainThreadConfig = new Configuration(); - Configuration applyConfigCompatMainThread(Configuration config, CompatibilityInfo compat) { + Configuration applyConfigCompatMainThread(int displayDensity, Configuration config, + CompatibilityInfo compat) { if (config == null) { return null; } if (compat != null && !compat.supportsScreen()) { mMainThreadConfig.setTo(config); config = mMainThreadConfig; - compat.applyToConfiguration(config); + compat.applyToConfiguration(displayDensity, config); } return config; } @@ -1555,8 +1677,13 @@ Configuration applyConfigCompatMainThread(Configuration config, CompatibilityInf * @param compInfo the compability info. It will use the default compatibility info when it's * null. */ - Resources getTopLevelResources(String resDir, CompatibilityInfo compInfo) { - ResourcesKey key = new ResourcesKey(resDir, compInfo.applicationScale); + Resources getTopLevelResources(String resDir, + int displayId, Configuration overrideConfiguration, + CompatibilityInfo compInfo) { + ResourcesKey key = new ResourcesKey(resDir, + displayId, overrideConfiguration, + compInfo.applicationScale, + compInfo.isThemeable); Resources r; synchronized (mPackages) { // Resources is app scale dependent. @@ -1582,19 +1709,45 @@ Resources getTopLevelResources(String resDir, CompatibilityInfo compInfo) { //} AssetManager assets = new AssetManager(); + assets.setThemeSupport(compInfo.isThemeable); if (assets.addAssetPath(resDir) == 0) { return null; } //Slog.i(TAG, "Resource: key=" + key + ", display metrics=" + metrics); - DisplayMetrics metrics = getDisplayMetricsLocked(null, false); - r = new Resources(assets, metrics, getConfiguration(), compInfo); + DisplayMetrics dm = getDisplayMetricsLocked(displayId, null); + Configuration config; + boolean isDefaultDisplay = (displayId == Display.DEFAULT_DISPLAY); + if (!isDefaultDisplay || key.mOverrideConfiguration != null) { + config = new Configuration(getConfiguration()); + if (!isDefaultDisplay) { + applyNonDefaultDisplayMetricsToConfigurationLocked(dm, config); + } + if (key.mOverrideConfiguration != null) { + config.updateFrom(key.mOverrideConfiguration); + } + } else { + config = getConfiguration(); + } + + /* Attach theme information to the resulting AssetManager when appropriate. */ + if (compInfo.isThemeable && config != null) { + if (config.customTheme == null) { + config.customTheme = CustomTheme.getBootTheme(); + } + + if (!TextUtils.isEmpty(config.customTheme.getThemePackageName())) { + attachThemeAssets(assets, config.customTheme); + } + } + + r = new Resources(assets, dm, config, compInfo); if (false) { Slog.i(TAG, "Created app resources " + resDir + " " + r + ": " + r.getConfiguration() + " appScale=" + r.getCompatibilityInfo().applicationScale); } - + synchronized (mPackages) { WeakReference wr = mActiveResources.get(key); Resources existing = wr != null ? wr.get() : null; @@ -1611,11 +1764,89 @@ Resources getTopLevelResources(String resDir, CompatibilityInfo compInfo) { } } + private void detachThemeAssets(AssetManager assets) { + String themePackageName = assets.getThemePackageName(); + int themeCookie = assets.getThemeCookie(); + if (!TextUtils.isEmpty(themePackageName) && themeCookie != 0) { + assets.detachThemePath(themePackageName, themeCookie); + assets.setThemePackageName(null); + assets.setThemeCookie(0); + assets.clearRedirections(); + } + } + + /** + * Attach the necessary theme asset paths and meta information to convert an + * AssetManager to being globally "theme-aware". + * + * @param assets + * @param theme + * @return true if the AssetManager is now theme-aware; false otherwise. + * This can fail, for example, if the theme package has been been + * removed and the theme manager has yet to revert formally back to + * the framework default. + */ + private boolean attachThemeAssets(AssetManager assets, CustomTheme theme) { + IAssetRedirectionManager rm = getAssetRedirectionManager(); + if (rm == null) { + return false; + } + PackageInfo pi = null; + try { + pi = getPackageManager().getPackageInfo(theme.getThemePackageName(), 0, 0); + } catch (RemoteException e) { + } + if (pi != null && pi.applicationInfo != null && pi.themeInfos != null) { + String themeResDir = pi.applicationInfo.publicSourceDir; + int cookie = assets.attachThemePath(themeResDir); + if (cookie != 0) { + String themePackageName = theme.getThemePackageName(); + String themeId = theme.getThemeId(); + int N = assets.getBasePackageCount(); + for (int i = 0; i < N; i++) { + String packageName = assets.getBasePackageName(i); + int packageId = assets.getBasePackageId(i); + + /* + * For now, we only consider redirections coming from the + * framework or regular android packages. This excludes + * themes and other specialty APKs we are not aware of. + */ + if (packageId != 0x01 && packageId != 0x7f) { + continue; + } + + try { + PackageRedirectionMap map = rm.getPackageRedirectionMap(themePackageName, themeId, + packageName); + if (map != null) { + assets.addRedirections(map); + } + } catch (RemoteException e) { + Log.e(TAG, "Failure accessing package redirection map, removing theme support."); + assets.detachThemePath(themePackageName, cookie); + return false; + } + } + + assets.setThemePackageName(theme.getThemePackageName()); + assets.setThemeCookie(cookie); + return true; + } else { + Log.e(TAG, "Unable to attach theme assets at " + themeResDir); + } + } + return false; + } + /** * Creates the top level resources for the given package. */ - Resources getTopLevelResources(String resDir, LoadedApk pkgInfo) { - return getTopLevelResources(resDir, pkgInfo.mCompatibilityInfo.get()); + Resources getTopLevelResources(String resDir, + int displayId, Configuration overrideConfiguration, + LoadedApk pkgInfo) { + return getTopLevelResources(resDir, displayId, overrideConfiguration, + pkgInfo.mCompatibilityInfo.get()); } final Handler getHandler() { @@ -1624,6 +1855,11 @@ final Handler getHandler() { public final LoadedApk getPackageInfo(String packageName, CompatibilityInfo compatInfo, int flags) { + return getPackageInfo(packageName, compatInfo, flags, UserHandle.myUserId()); + } + + public final LoadedApk getPackageInfo(String packageName, CompatibilityInfo compatInfo, + int flags, int userId) { synchronized (mPackages) { WeakReference ref; if ((flags&Context.CONTEXT_INCLUDE_CODE) != 0) { @@ -1652,7 +1888,7 @@ public final LoadedApk getPackageInfo(String packageName, CompatibilityInfo comp ApplicationInfo ai = null; try { ai = getPackageManager().getApplicationInfo(packageName, - PackageManager.GET_SHARED_LIBRARY_FILES, UserId.myUserId()); + PackageManager.GET_SHARED_LIBRARY_FILES, userId); } catch (RemoteException e) { // Ignore } @@ -1669,7 +1905,7 @@ public final LoadedApk getPackageInfo(ApplicationInfo ai, CompatibilityInfo comp boolean includeCode = (flags&Context.CONTEXT_INCLUDE_CODE) != 0; boolean securityViolation = includeCode && ai.uid != 0 && ai.uid != Process.SYSTEM_UID && (mBoundApplication != null - ? !UserId.isSameApp(ai.uid, mBoundApplication.appInfo.uid) + ? !UserHandle.isSameApp(ai.uid, mBoundApplication.appInfo.uid) : true); if ((flags&(Context.CONTEXT_INCLUDE_CODE |Context.CONTEXT_IGNORE_SECURITY)) @@ -1786,7 +2022,8 @@ public ContextImpl getSystemContext() { context.init(info, null, this); context.getResources().updateConfiguration( getConfiguration(), getDisplayMetricsLocked( - CompatibilityInfo.DEFAULT_COMPATIBILITY_INFO, false)); + Display.DEFAULT_DISPLAY, + CompatibilityInfo.DEFAULT_COMPATIBILITY_INFO)); mSystemContext = context; //Slog.i(TAG, "Created system resources " + context.getResources() // + ": " + context.getResources().getConfiguration()); @@ -1998,9 +2235,7 @@ private Activity performLaunchActivity(ActivityClientRecord r, Intent customInte + ", dir=" + r.packageInfo.getAppDir()); if (activity != null) { - ContextImpl appContext = new ContextImpl(); - appContext.init(r.packageInfo, r.token, this); - appContext.setOuterContext(activity); + Context appContext = createBaseContextForActivity(r, activity); CharSequence title = r.activityInfo.loadLabel(appContext.getPackageManager()); Configuration config = new Configuration(mCompatConfiguration); if (DEBUG_CONFIGURATION) Slog.v(TAG, "Launching activity " @@ -2056,6 +2291,16 @@ private Activity performLaunchActivity(ActivityClientRecord r, Intent customInte } catch (Exception e) { if (!mInstrumentation.onException(activity, e)) { + if (e instanceof InflateException) { + Log.e(TAG, "Failed to inflate", e); + String pkg = null; + if (r.packageInfo != null && !TextUtils.isEmpty(r.packageInfo.getPackageName())) { + pkg = r.packageInfo.getPackageName(); + } + Intent intent = new Intent(Intent.ACTION_APP_LAUNCH_FAILURE, + (pkg != null)? Uri.fromParts("package", pkg, null) : null); + getSystemContext().sendBroadcast(intent); + } throw new RuntimeException( "Unable to start activity " + component + ": " + e.toString(), e); @@ -2065,6 +2310,31 @@ private Activity performLaunchActivity(ActivityClientRecord r, Intent customInte return activity; } + private Context createBaseContextForActivity(ActivityClientRecord r, + final Activity activity) { + ContextImpl appContext = new ContextImpl(); + appContext.init(r.packageInfo, r.token, this); + appContext.setOuterContext(activity); + + // For debugging purposes, if the activity's package name contains the value of + // the "debug.use-second-display" system property as a substring, then show + // its content on a secondary display if there is one. + Context baseContext = appContext; + String pkgName = SystemProperties.get("debug.second-display.pkg"); + if (pkgName != null && !pkgName.isEmpty() + && r.packageInfo.mPackageName.contains(pkgName)) { + DisplayManagerGlobal dm = DisplayManagerGlobal.getInstance(); + for (int displayId : dm.getDisplayIds()) { + if (displayId != Display.DEFAULT_DISPLAY) { + Display display = dm.getRealDisplay(displayId); + baseContext = appContext.createDisplayContext(display); + break; + } + } + } + return baseContext; + } + private void handleLaunchActivity(ActivityClientRecord r, Intent customIntent) { // If we are getting ready to gc after going to the background, well // we are back active so skip it. @@ -2086,7 +2356,8 @@ private void handleLaunchActivity(ActivityClientRecord r, Intent customIntent) { if (a != null) { r.createdConfig = new Configuration(mConfiguration); Bundle oldState = r.state; - handleResumeActivity(r.token, false, r.isForward); + handleResumeActivity(r.token, false, r.isForward, + !r.activity.mFinished && !r.startsNotResumed); if (!r.activity.mFinished && r.startsNotResumed) { // The activity manager actually wants this one to start out @@ -2250,12 +2521,31 @@ private void handleReceiver(ReceiverData data) { private void handleCreateBackupAgent(CreateBackupAgentData data) { if (DEBUG_BACKUP) Slog.v(TAG, "handleCreateBackupAgent: " + data); + // Sanity check the requested target package's uid against ours + try { + PackageInfo requestedPackage = getPackageManager().getPackageInfo( + data.appInfo.packageName, 0, UserHandle.myUserId()); + if (requestedPackage.applicationInfo.uid != Process.myUid()) { + Slog.w(TAG, "Asked to instantiate non-matching package " + + data.appInfo.packageName); + return; + } + } catch (RemoteException e) { + Slog.e(TAG, "Can't reach package manager", e); + return; + } + // no longer idle; we have backup work to do unscheduleGcIdler(); // instantiate the BackupAgent class named in the manifest LoadedApk packageInfo = getPackageInfoNoCheck(data.appInfo, data.compatInfo); String packageName = packageInfo.mPackageName; + if (packageName == null) { + Slog.d(TAG, "Asked to create backup agent for nonexistent package"); + return; + } + if (mBackupAgents.get(packageName) != null) { Slog.d(TAG, "BackupAgent " + " for " + packageName + " already exists"); @@ -2554,6 +2844,7 @@ public final ActivityClientRecord performResumeActivity(IBinder token, r.activity.mStartedActivity = false; } try { + r.activity.mFragments.noteStateNotSaved(); if (r.pendingIntents != null) { deliverNewIntents(r, r.pendingIntents); r.pendingIntents = null; @@ -2565,7 +2856,7 @@ public final ActivityClientRecord performResumeActivity(IBinder token, r.activity.performResume(); EventLog.writeEvent(LOG_ON_RESUME_CALLED, - r.activity.getComponentName().getClassName()); + UserHandle.myUserId(), r.activity.getComponentName().getClassName()); r.paused = false; r.stopped = false; @@ -2587,7 +2878,7 @@ static final void cleanUpPendingRemoveWindows(ActivityClientRecord r) { r.mPendingRemoveWindowManager.removeViewImmediate(r.mPendingRemoveWindow); IBinder wtoken = r.mPendingRemoveWindow.getWindowToken(); if (wtoken != null) { - WindowManagerImpl.getDefault().closeAll(wtoken, + WindowManagerGlobal.getInstance().closeAll(wtoken, r.activity.getClass().getName(), "Activity"); } } @@ -2595,7 +2886,8 @@ static final void cleanUpPendingRemoveWindows(ActivityClientRecord r) { r.mPendingRemoveWindowManager = null; } - final void handleResumeActivity(IBinder token, boolean clearHide, boolean isForward) { + final void handleResumeActivity(IBinder token, boolean clearHide, boolean isForward, + boolean reallyResume) { // If we are getting ready to gc after going to the background, well // we are back active so skip it. unscheduleGcIdler(); @@ -2692,6 +2984,14 @@ final void handleResumeActivity(IBinder token, boolean clearHide, boolean isForw } r.onlyLocalRequest = false; + // Tell the activity manager we have resumed. + if (reallyResume) { + try { + ActivityManagerNative.getDefault().activityResumed(token); + } catch (RemoteException ex) { + } + } + } else { // If an exception was thrown when trying to resume, then // just end this activity. @@ -2727,7 +3027,8 @@ private Bitmap createThumbnailBitmap(ActivityClientRecord r) { // On platforms where we don't want thumbnails, set dims to (0,0) if ((w > 0) && (h > 0)) { - thumbnail = Bitmap.createBitmap(w, h, THUMBNAIL_FORMAT); + thumbnail = Bitmap.createBitmap(r.activity.getResources().getDisplayMetrics(), + w, h, THUMBNAIL_FORMAT); thumbnail.eraseColor(0); } } @@ -2775,7 +3076,7 @@ private void handlePauseActivity(IBinder token, boolean finished, if (r.isPreHoneycomb()) { QueuedWork.waitToFinish(); } - + // Tell the activity manager we have paused. try { ActivityManagerNative.getDefault().activityPaused(token); @@ -2823,7 +3124,8 @@ final Bundle performPauseActivity(ActivityClientRecord r, boolean finished, // Now we are idle. r.activity.mCalled = false; mInstrumentation.callActivityOnPause(r.activity); - EventLog.writeEvent(LOG_ON_PAUSE_CALLED, r.activity.getComponentName().getClassName()); + EventLog.writeEvent(LOG_ON_PAUSE_CALLED, UserHandle.myUserId(), + r.activity.getComponentName().getClassName()); if (!r.activity.mCalled) { throw new SuperNotCalledException( "Activity " + r.intent.getComponent().toShortString() + @@ -3121,7 +3423,7 @@ private void handleUpdatePackageCompatibilityInfo(UpdateCompatibilityData data) apk.mCompatibilityInfo.set(data.info); } handleConfigurationChanged(mConfiguration, data.info); - WindowManagerImpl.getDefault().reportNewConfiguration(mConfiguration); + WindowManagerGlobal.getInstance().reportNewConfiguration(mConfiguration); } private void deliverResults(ActivityClientRecord r, List results) { @@ -3208,7 +3510,7 @@ private ActivityClientRecord performDestroyActivity(IBinder token, boolean finis try { r.activity.mCalled = false; mInstrumentation.callActivityOnPause(r.activity); - EventLog.writeEvent(LOG_ON_PAUSE_CALLED, + EventLog.writeEvent(LOG_ON_PAUSE_CALLED, UserHandle.myUserId(), r.activity.getComponentName().getClassName()); if (!r.activity.mCalled) { throw new SuperNotCalledException( @@ -3310,7 +3612,7 @@ private void handleDestroyActivity(IBinder token, boolean finishing, } } if (wtoken != null && r.mPendingRemoveWindow == null) { - WindowManagerImpl.getDefault().closeAll(wtoken, + WindowManagerGlobal.getInstance().closeAll(wtoken, r.activity.getClass().getName(), "Activity"); } r.activity.mDecor = null; @@ -3322,7 +3624,7 @@ private void handleDestroyActivity(IBinder token, boolean finishing, // by the app will leak. Well we try to warning them a lot // about leaking windows, because that is a bug, so if they are // using this recreate facility then they get to live with leaks. - WindowManagerImpl.getDefault().closeAll(token, + WindowManagerGlobal.getInstance().closeAll(token, r.activity.getClass().getName(), "Activity"); } @@ -3461,6 +3763,8 @@ private void handleRelaunchActivity(ActivityClientRecord tmp) { // If there was a pending configuration change, execute it first. if (changedConfig != null) { + mCurDefaultDisplayDpi = changedConfig.densityDpi; + updateDefaultDensity(); handleConfigurationChanged(changedConfig, null); } @@ -3534,39 +3838,45 @@ private void handleRequestThumbnail(IBinder token) { } } - ArrayList collectComponentCallbacksLocked( + ArrayList collectComponentCallbacks( boolean allActivities, Configuration newConfig) { ArrayList callbacks = new ArrayList(); - if (mActivities.size() > 0) { - for (ActivityClientRecord ar : mActivities.values()) { - Activity a = ar.activity; - if (a != null) { - Configuration thisConfig = applyConfigCompatMainThread(newConfig, - ar.packageInfo.mCompatibilityInfo.getIfNeeded()); - if (!ar.activity.mFinished && (allActivities || !ar.paused)) { - // If the activity is currently resumed, its configuration - // needs to change right now. - callbacks.add(a); - } else if (thisConfig != null) { - // Otherwise, we will tell it about the change - // the next time it is resumed or shown. Note that - // the activity manager may, before then, decide the - // activity needs to be destroyed to handle its new - // configuration. - if (DEBUG_CONFIGURATION) { - Slog.v(TAG, "Setting activity " - + ar.activityInfo.name + " newConfig=" + thisConfig); + synchronized (mPackages) { + final int N = mAllApplications.size(); + for (int i=0; i 0) { + for (ActivityClientRecord ar : mActivities.values()) { + Activity a = ar.activity; + if (a != null) { + Configuration thisConfig = applyConfigCompatMainThread(mCurDefaultDisplayDpi, + newConfig, ar.packageInfo.mCompatibilityInfo.getIfNeeded()); + if (!ar.activity.mFinished && (allActivities || !ar.paused)) { + // If the activity is currently resumed, its configuration + // needs to change right now. + callbacks.add(a); + } else if (thisConfig != null) { + // Otherwise, we will tell it about the change + // the next time it is resumed or shown. Note that + // the activity manager may, before then, decide the + // activity needs to be destroyed to handle its new + // configuration. + if (DEBUG_CONFIGURATION) { + Slog.v(TAG, "Setting activity " + + ar.activityInfo.name + " newConfig=" + thisConfig); + } + ar.newConfig = thisConfig; } - ar.newConfig = thisConfig; } } } - } - if (mServices.size() > 0) { - for (Service service : mServices.values()) { - callbacks.add(service); + if (mServices.size() > 0) { + for (Service service : mServices.values()) { + callbacks.add(service); + } } } synchronized (mProviderMap) { @@ -3576,10 +3886,6 @@ ArrayList collectComponentCallbacksLocked( } } } - final int N = mAllApplications.size(); - for (int i=0; i> it = - mActiveResources.values().iterator(); - //Iterator>> it = - // mActiveResources.entrySet().iterator(); + + Configuration tmpConfig = null; + + Iterator>> it = + mActiveResources.entrySet().iterator(); while (it.hasNext()) { - WeakReference v = it.next(); - Resources r = v.get(); + Map.Entry> entry = it.next(); + Resources r = entry.getValue().get(); if (r != null) { if (DEBUG_CONFIGURATION) Slog.v(TAG, "Changing resources " + r + " config to: " + config); - r.updateConfiguration(config, dm, compat); + int displayId = entry.getKey().mDisplayId; + boolean isDefaultDisplay = (displayId == Display.DEFAULT_DISPLAY); + DisplayMetrics dm = defaultDisplayMetrics; + Configuration overrideConfig = entry.getKey().mOverrideConfiguration; + boolean themeChanged = (changes & ActivityInfo.CONFIG_THEME_RESOURCE) != 0; + if (themeChanged) { + AssetManager am = r.getAssets(); + if (am.hasThemeSupport()) { + detachThemeAssets(am); + if (!TextUtils.isEmpty(config.customTheme.getThemePackageName())) { + attachThemeAssets(am, config.customTheme); + } + } + } + if (!isDefaultDisplay || overrideConfig != null) { + if (tmpConfig == null) { + tmpConfig = new Configuration(); + } + tmpConfig.setTo(config); + if (!isDefaultDisplay) { + dm = getDisplayMetricsLocked(displayId, null); + applyNonDefaultDisplayMetricsToConfigurationLocked(dm, tmpConfig); + } + if (overrideConfig != null) { + tmpConfig.updateFrom(overrideConfig); + } + r.updateConfiguration(tmpConfig, dm, compat); + } else { + r.updateConfiguration(config, dm, compat); + } + if (themeChanged) { + r.updateStringCache(); + } //Slog.i(TAG, "Updated app resources " + v.getKey() // + " " + r + ": " + r.getConfiguration()); } else { @@ -3685,17 +4025,39 @@ final boolean applyConfigurationToResourcesLocked(Configuration config, } } - return changes != 0; + return changes; + } + + final void applyNonDefaultDisplayMetricsToConfigurationLocked( + DisplayMetrics dm, Configuration config) { + config.touchscreen = Configuration.TOUCHSCREEN_NOTOUCH; + config.densityDpi = dm.densityDpi; + config.screenWidthDp = (int)(dm.widthPixels / dm.density); + config.screenHeightDp = (int)(dm.heightPixels / dm.density); + int sl = Configuration.resetScreenLayout(config.screenLayout); + if (dm.widthPixels > dm.heightPixels) { + config.orientation = Configuration.ORIENTATION_LANDSCAPE; + config.screenLayout = Configuration.reduceScreenLayout(sl, + config.screenWidthDp, config.screenHeightDp); + } else { + config.orientation = Configuration.ORIENTATION_PORTRAIT; + config.screenLayout = Configuration.reduceScreenLayout(sl, + config.screenHeightDp, config.screenWidthDp); + } + config.smallestScreenWidthDp = config.screenWidthDp; // assume screen does not rotate + config.compatScreenWidthDp = config.screenWidthDp; + config.compatScreenHeightDp = config.screenHeightDp; + config.compatSmallestScreenWidthDp = config.smallestScreenWidthDp; } - final Configuration applyCompatConfiguration() { + final Configuration applyCompatConfiguration(int displayDensity) { Configuration config = mConfiguration; if (mCompatConfiguration == null) { mCompatConfiguration = new Configuration(); } mCompatConfiguration.setTo(mConfiguration); if (mResCompatibilityInfo != null && !mResCompatibilityInfo.supportsScreen()) { - mResCompatibilityInfo.applyToConfiguration(mCompatConfiguration); + mResCompatibilityInfo.applyToConfiguration(displayDensity, mCompatConfiguration); config = mCompatConfiguration; } return config; @@ -3703,13 +4065,16 @@ final Configuration applyCompatConfiguration() { final void handleConfigurationChanged(Configuration config, CompatibilityInfo compat) { - ArrayList callbacks = null; int configDiff = 0; + int diff = 0; + synchronized (mPackages) { if (mPendingConfiguration != null) { if (!mPendingConfiguration.isOtherSeqNewer(config)) { config = mPendingConfiguration; + mCurDefaultDisplayDpi = config.densityDpi; + updateDefaultDensity(); } mPendingConfiguration = null; } @@ -3721,7 +4086,7 @@ final void handleConfigurationChanged(Configuration config, CompatibilityInfo co if (DEBUG_CONFIGURATION) Slog.v(TAG, "Handle configuration changed: " + config); - applyConfigurationToResourcesLocked(config, compat); + diff = applyConfigurationToResourcesLocked(config, compat); if (mConfiguration == null) { mConfiguration = new Configuration(); @@ -3731,19 +4096,33 @@ final void handleConfigurationChanged(Configuration config, CompatibilityInfo co } configDiff = mConfiguration.diff(config); mConfiguration.updateFrom(config); - config = applyCompatConfiguration(); - callbacks = collectComponentCallbacksLocked(false, config); + config = applyCompatConfiguration(mCurDefaultDisplayDpi); } - + + ArrayList callbacks = collectComponentCallbacks(false, config); + // Cleanup hardware accelerated stuff - WindowManagerImpl.getDefault().trimLocalMemory(); + WindowManagerGlobal.getInstance().trimLocalMemory(); freeTextLayoutCachesIfNeeded(configDiff); if (callbacks != null) { final int N = callbacks.size(); for (int i=0; i callbacks; - - synchronized (mPackages) { - callbacks = collectComponentCallbacksLocked(true, null); - } + ArrayList callbacks = collectComponentCallbacks(true, null); final int N = callbacks.size(); for (int i=0; i callbacks; - synchronized (mPackages) { - callbacks = collectComponentCallbacksLocked(true, null); - } + ArrayList callbacks = collectComponentCallbacks(true, null); final int N = callbacks.size(); for (int i = 0; i < N; i++) { callbacks.get(i).onTrimMemory(level); } - windowManager.endTrimMemory(); + windowManager.endTrimMemory(); } private void setupGraphicsSupport(LoadedApk info, File cacheDir) { @@ -3910,8 +4282,20 @@ private void setupGraphicsSupport(LoadedApk info, File cacheDir) { } catch (RemoteException e) { // Ignore } - } - + } + + private void updateDefaultDensity() { + if (mCurDefaultDisplayDpi != Configuration.DENSITY_DPI_UNDEFINED + && mCurDefaultDisplayDpi != DisplayMetrics.DENSITY_DEVICE + && !mDensityCompatMode) { + Slog.i(TAG, "Switching default density from " + + DisplayMetrics.DENSITY_DEVICE + " to " + + mCurDefaultDisplayDpi); + DisplayMetrics.DENSITY_DEVICE = mCurDefaultDisplayDpi; + Bitmap.setDefaultDensity(DisplayMetrics.DENSITY_DEFAULT); + } + } + private void handleBindApplication(AppBindData data) { mBoundApplication = data; mConfiguration = new Configuration(data.config); @@ -3924,14 +4308,14 @@ private void handleBindApplication(AppBindData data) { // send up app name; do this *before* waiting for debugger Process.setArgV0(data.processName); - android.ddm.DdmHandleAppName.setAppName(data.processName); + android.ddm.DdmHandleAppName.setAppName(data.processName, + UserHandle.myUserId()); if (data.persistent) { // Persistent processes on low-memory devices do not get to // use hardware accelerated drawing, since this can add too much // overhead to the process. - Display display = WindowManagerImpl.getDefault().getDefaultDisplay(); - if (!ActivityManager.isHighEndGfx(display)) { + if (!ActivityManager.isHighEndGfx()) { HardwareRenderer.disable(false); } } @@ -3967,19 +4351,35 @@ private void handleBindApplication(AppBindData data) { * in AppBindData can be safely assumed to be up to date */ applyConfigurationToResourcesLocked(data.config, data.compatInfo); - applyCompatConfiguration(); + mCurDefaultDisplayDpi = data.config.densityDpi; + applyCompatConfiguration(mCurDefaultDisplayDpi); data.info = getPackageInfoNoCheck(data.appInfo, data.compatInfo); + /** + * Switch this process to density compatibility mode if needed. + */ + if ((data.appInfo.flags&ApplicationInfo.FLAG_SUPPORTS_SCREEN_DENSITIES) + == 0) { + mDensityCompatMode = true; + Bitmap.setDefaultDensity(DisplayMetrics.DENSITY_DEFAULT); + } + updateDefaultDensity(); + final ContextImpl appContext = new ContextImpl(); appContext.init(data.info, null, this); - final File cacheDir = appContext.getCacheDir(); - - // Provide a usable directory for temporary files - System.setProperty("java.io.tmpdir", cacheDir.getAbsolutePath()); - - setupGraphicsSupport(data.info, cacheDir); + if (!Process.isIsolated()) { + final File cacheDir = appContext.getCacheDir(); + if (cacheDir != null) { + // Provide a usable directory for temporary files + System.setProperty("java.io.tmpdir", cacheDir.getAbsolutePath()); + + setupGraphicsSupport(data.info, cacheDir); + } else { + Log.e(TAG, "Unable to setupGraphicsSupport due to missing cache directory"); + } + } /** * For system applications on userdebug/eng builds, log stack * traces of disk and network access to dropbox for analysis. @@ -4001,14 +4401,6 @@ private void handleBindApplication(AppBindData data) { StrictMode.enableDeathOnNetwork(); } - /** - * Switch this process to density compatibility mode if needed. - */ - if ((data.appInfo.flags&ApplicationInfo.FLAG_SUPPORTS_SCREEN_DENSITIES) - == 0) { - Bitmap.setDefaultDensity(DisplayMetrics.DENSITY_DEFAULT); - } - if (data.debugMode != IApplicationThread.DEBUG_OFF) { // XXX should have option to change the port. Debug.changeDebugPort(8100); @@ -4202,8 +4594,9 @@ private void installContentProviders( } } - public final IContentProvider acquireProvider(Context c, String name, boolean stable) { - IContentProvider provider = acquireExistingProvider(c, name, stable); + public final IContentProvider acquireProvider( + Context c, String auth, int userId, boolean stable) { + final IContentProvider provider = acquireExistingProvider(c, auth, userId, stable); if (provider != null) { return provider; } @@ -4217,11 +4610,11 @@ public final IContentProvider acquireProvider(Context c, String name, boolean st IActivityManager.ContentProviderHolder holder = null; try { holder = ActivityManagerNative.getDefault().getContentProvider( - getApplicationThread(), name, stable); + getApplicationThread(), auth, userId, stable); } catch (RemoteException ex) { } if (holder == null) { - Slog.e(TAG, "Failed to find provider info for " + name); + Slog.e(TAG, "Failed to find provider info for " + auth); return null; } @@ -4298,16 +4691,25 @@ private final void incProviderRefLocked(ProviderRefCount prc, boolean stable) { } } - public final IContentProvider acquireExistingProvider(Context c, String name, - boolean stable) { + public final IContentProvider acquireExistingProvider( + Context c, String auth, int userId, boolean stable) { synchronized (mProviderMap) { - ProviderClientRecord pr = mProviderMap.get(name); + final ProviderKey key = new ProviderKey(auth, userId); + final ProviderClientRecord pr = mProviderMap.get(key); if (pr == null) { return null; } IContentProvider provider = pr.mProvider; IBinder jBinder = provider.asBinder(); + if (!jBinder.isBinderAlive()) { + // The hosting process of the provider has died; we can't + // use this one. + Log.i(TAG, "Acquiring provider " + auth + " for user " + userId + + ": existing object's process dead"); + handleUnstableProviderDiedLocked(jBinder, true); + return null; + } // Only increment the ref count if we have one. If we don't then the // provider is not reference counted and never needs to be released. @@ -4448,50 +4850,57 @@ final void completeRemoveProvider(ProviderRefCount prc) { } final void handleUnstableProviderDied(IBinder provider, boolean fromClient) { - synchronized(mProviderMap) { - ProviderRefCount prc = mProviderRefCountMap.get(provider); - if (prc != null) { - if (DEBUG_PROVIDER) Slog.v(TAG, "Cleaning up dead provider " - + provider + " " + prc.holder.info.name); - mProviderRefCountMap.remove(provider); - if (prc.client != null && prc.client.mNames != null) { - for (String name : prc.client.mNames) { - ProviderClientRecord pr = mProviderMap.get(name); - if (pr != null && pr.mProvider.asBinder() == provider) { - Slog.i(TAG, "Removing dead content provider: " + name); - mProviderMap.remove(name); - } + synchronized (mProviderMap) { + handleUnstableProviderDiedLocked(provider, fromClient); + } + } + + final void handleUnstableProviderDiedLocked(IBinder provider, boolean fromClient) { + ProviderRefCount prc = mProviderRefCountMap.get(provider); + if (prc != null) { + if (DEBUG_PROVIDER) Slog.v(TAG, "Cleaning up dead provider " + + provider + " " + prc.holder.info.name); + mProviderRefCountMap.remove(provider); + if (prc.client != null && prc.client.mNames != null) { + for (String name : prc.client.mNames) { + ProviderClientRecord pr = mProviderMap.get(name); + if (pr != null && pr.mProvider.asBinder() == provider) { + Slog.i(TAG, "Removing dead content provider: " + name); + mProviderMap.remove(name); } } - if (fromClient) { - // We found out about this due to execution in our client - // code. Tell the activity manager about it now, to ensure - // that the next time we go to do anything with the provider - // it knows it is dead (so we don't race with its death - // notification). - try { - ActivityManagerNative.getDefault().unstableProviderDied( - prc.holder.connection); - } catch (RemoteException e) { - //do nothing content provider object is dead any way - } + } + if (fromClient) { + // We found out about this due to execution in our client + // code. Tell the activity manager about it now, to ensure + // that the next time we go to do anything with the provider + // it knows it is dead (so we don't race with its death + // notification). + try { + ActivityManagerNative.getDefault().unstableProviderDied( + prc.holder.connection); + } catch (RemoteException e) { + //do nothing content provider object is dead any way } } } } private ProviderClientRecord installProviderAuthoritiesLocked(IContentProvider provider, - ContentProvider localProvider,IActivityManager.ContentProviderHolder holder) { - String names[] = PATTERN_SEMICOLON.split(holder.info.authority); - ProviderClientRecord pcr = new ProviderClientRecord(names, provider, - localProvider, holder); - for (int i = 0; i < names.length; i++) { - ProviderClientRecord existing = mProviderMap.get(names[i]); + ContentProvider localProvider, IActivityManager.ContentProviderHolder holder) { + final String auths[] = PATTERN_SEMICOLON.split(holder.info.authority); + final int userId = UserHandle.getUserId(holder.info.applicationInfo.uid); + + final ProviderClientRecord pcr = new ProviderClientRecord( + auths, provider, localProvider, holder); + for (String auth : auths) { + final ProviderKey key = new ProviderKey(auth, userId); + final ProviderClientRecord existing = mProviderMap.get(key); if (existing != null) { Slog.w(TAG, "Content provider " + pcr.mHolder.info.name - + " already published as " + names[i]); + + " already published as " + auth); } else { - mProviderMap.put(names[i], pcr); + mProviderMap.put(key, pcr); } } return pcr; @@ -4643,7 +5052,8 @@ public void run() { ensureJitEnabled(); } }); - android.ddm.DdmHandleAppName.setAppName(""); + android.ddm.DdmHandleAppName.setAppName("", + UserHandle.myUserId()); RuntimeInit.setApplicationObject(mAppThread.asBinder()); IActivityManager mgr = ActivityManagerNative.getDefault(); try { @@ -4654,7 +5064,8 @@ public void run() { } else { // Don't set application object here -- if the system crashes, // we can't display an alert, we just want to die die die. - android.ddm.DdmHandleAppName.setAppName("system_process"); + android.ddm.DdmHandleAppName.setAppName("system_process", + UserHandle.myUserId()); try { mInstrumentation = new Instrumentation(); ContextImpl context = new ContextImpl(); @@ -4668,14 +5079,17 @@ public void run() { "Unable to instantiate Application():" + e.toString(), e); } } - + + // add dropbox logging to libcore + DropBox.setReporter(new DropBoxReporter()); + ViewRootImpl.addConfigCallback(new ComponentCallbacks2() { public void onConfigurationChanged(Configuration newConfig) { synchronized (mPackages) { // We need to apply this change to the resources // immediately, because upon returning the view // hierarchy will be informed about it. - if (applyConfigurationToResourcesLocked(newConfig, null)) { + if (applyConfigurationToResourcesLocked(newConfig, null) != 0) { // This actually changed the resources! Tell // everyone about it. if (mPendingConfiguration == null || @@ -4717,6 +5131,32 @@ public int getIntCoreSetting(String key, int defaultValue) { } } + private static class EventLoggingReporter implements EventLogger.Reporter { + @Override + public void report (int code, Object... list) { + EventLog.writeEvent(code, list); + } + } + + private class DropBoxReporter implements DropBox.Reporter { + + private DropBoxManager dropBox; + + public DropBoxReporter() { + dropBox = (DropBoxManager) getSystemContext().getSystemService(Context.DROPBOX_SERVICE); + } + + @Override + public void addData(String tag, byte[] data, int flags) { + dropBox.addData(tag, data, flags); + } + + @Override + public void addText(String tag, String data) { + dropBox.addText(tag, data); + } + } + public static void main(String[] args) { SamplingProfilerIntegration.start(); @@ -4725,16 +5165,22 @@ public static void main(String[] args) { // StrictMode) on debug builds, but using DropBox, not logs. CloseGuard.setEnabled(false); + Environment.initForCurrentUser(); + + // Set the reporter for event logging in libcore + EventLogger.setReporter(new EventLoggingReporter()); + Process.setArgV0(""); Looper.prepareMainLooper(); - if (sMainThreadHandler == null) { - sMainThreadHandler = new Handler(); - } ActivityThread thread = new ActivityThread(); thread.attach(false); + if (sMainThreadHandler == null) { + sMainThreadHandler = thread.getHandler(); + } + AsyncTask.init(); if (false) { diff --git a/core/java/android/app/AirplaneModeSettings.java b/core/java/android/app/AirplaneModeSettings.java new file mode 100644 index 0000000000000..7b4022ac94270 --- /dev/null +++ b/core/java/android/app/AirplaneModeSettings.java @@ -0,0 +1,133 @@ +package android.app; + +import android.content.Context; +import android.content.Intent; +import android.provider.Settings; +import android.os.Parcel; +import android.os.Parcelable; + +import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; + + +import java.io.IOException; + +/** @hide */ +public final class AirplaneModeSettings implements Parcelable { + + private int mValue; + private boolean mOverride; + private boolean mDirty; + + /** @hide */ + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + public AirplaneModeSettings createFromParcel(Parcel in) { + return new AirplaneModeSettings(in); + } + + @Override + public AirplaneModeSettings[] newArray(int size) { + return new AirplaneModeSettings[size]; + } + }; + + + public AirplaneModeSettings(Parcel parcel) { + readFromParcel(parcel); + } + + public AirplaneModeSettings() { + this(0, false); + } + + public AirplaneModeSettings(int value, boolean override) { + mValue = value; + mOverride = override; + mDirty = false; + } + + public int getValue() { + return mValue; + } + + public void setValue(int value) { + mValue = value; + mDirty = true; + } + + public void setOverride(boolean override) { + mOverride = override; + mDirty = true; + } + + public boolean isOverride() { + return mOverride; + } + + /** @hide */ + public boolean isDirty() { + return mDirty; + } + + public void processOverride(Context context) { + if (isOverride()) { + int current = Settings.Global.getInt(context.getContentResolver(), Settings.Global.AIRPLANE_MODE_ON, 0); + if (current != mValue) { + Settings.Global.putInt(context.getContentResolver(), Settings.Global.AIRPLANE_MODE_ON, mValue); + Intent intent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED); + intent.putExtra("state", mValue == 1); + context.sendBroadcast(intent); + } + } + } + + /** @hide */ + public static AirplaneModeSettings fromXml(XmlPullParser xpp, Context context) + throws XmlPullParserException, IOException { + int event = xpp.next(); + AirplaneModeSettings connectionDescriptor = new AirplaneModeSettings(); + while (event != XmlPullParser.END_TAG) { + if (event == XmlPullParser.START_TAG) { + String name = xpp.getName(); + if (name.equals("value")) { + connectionDescriptor.mValue = Integer.parseInt(xpp.nextText()); + } else if (name.equals("override")) { + connectionDescriptor.mOverride = Boolean.parseBoolean(xpp.nextText()); + } + } + event = xpp.next(); + } + return connectionDescriptor; + } + + /** @hide */ + public void getXmlString(StringBuilder builder, Context context) { + builder.append("\n"); + builder.append(mValue); + builder.append("\n"); + builder.append(mOverride); + builder.append("\n\n"); + } + + @Override + public int describeContents() { + return 0; + } + + /** @hide */ + @Override + public void writeToParcel(Parcel dest, int flags) { + dest.writeInt(mOverride ? 1 : 0); + dest.writeInt(mValue); + dest.writeInt(mDirty ? 1 : 0); + } + + /** @hide */ + public void readFromParcel(Parcel in) { + mOverride = in.readInt() != 0; + mValue = in.readInt(); + mDirty = in.readInt() != 0; + } + + +} diff --git a/core/java/android/app/AlertDialog.java b/core/java/android/app/AlertDialog.java index e37b3faae054c..6ab2bd1c2e90c 100644 --- a/core/java/android/app/AlertDialog.java +++ b/core/java/android/app/AlertDialog.java @@ -110,8 +110,9 @@ protected AlertDialog(Context context, int theme) { this(context, theme, true); } - AlertDialog(Context context, int theme, boolean createContextWrapper) { - super(context, resolveDialogTheme(context, theme), createContextWrapper); + AlertDialog(Context context, int theme, boolean createThemeContextWrapper) { + super(context, resolveDialogTheme(context, theme), createThemeContextWrapper); + mWindow.alwaysReadCloseOnTouchAttr(); mAlert = new AlertController(getContext(), this, getWindow()); } @@ -566,7 +567,14 @@ public Builder setCancelable(boolean cancelable) { /** * Sets the callback that will be called if the dialog is canceled. + * + *

Even in a cancelable dialog, the dialog may be dismissed for reasons other than + * being canceled or one of the supplied choices being selected. + * If you are interested in listening for all cases where the dialog is dismissed + * and not just when it is canceled, see + * {@link #setOnDismissListener(android.content.DialogInterface.OnDismissListener) setOnDismissListener}.

* @see #setCancelable(boolean) + * @see #setOnDismissListener(android.content.DialogInterface.OnDismissListener) * * @return This Builder object to allow for chaining of calls to set methods */ @@ -575,6 +583,16 @@ public Builder setOnCancelListener(OnCancelListener onCancelListener) { return this; } + /** + * Sets the callback that will be called when the dialog is dismissed for any reason. + * + * @return This Builder object to allow for chaining of calls to set methods + */ + public Builder setOnDismissListener(OnDismissListener onDismissListener) { + P.mOnDismissListener = onDismissListener; + return this; + } + /** * Sets the callback that will be called if a key is dispatched to the dialog. * @@ -917,6 +935,7 @@ public AlertDialog create() { dialog.setCanceledOnTouchOutside(true); } dialog.setOnCancelListener(P.mOnCancelListener); + dialog.setOnDismissListener(P.mOnDismissListener); if (P.mOnKeyListener != null) { dialog.setOnKeyListener(P.mOnKeyListener); } diff --git a/core/java/android/app/Application.java b/core/java/android/app/Application.java index dd9ea267c1744..3a67cecfe5609 100644 --- a/core/java/android/app/Application.java +++ b/core/java/android/app/Application.java @@ -64,11 +64,12 @@ public Application() { } /** - * Called when the application is starting, before any other application - * objects have been created. Implementations should be as quick as - * possible (for example using lazy initialization of state) since the time - * spent in this function directly impacts the performance of starting the - * first activity, service, or receiver in a process. + * Called when the application is starting, before any activity, service, + * or receiver objects (excluding content providers) have been created. + * Implementations should be as quick as possible (for example using + * lazy initialization of state) since the time spent in this function + * directly impacts the performance of starting the first activity, + * service, or receiver in a process. * If you override this method, be sure to call super.onCreate(). */ public void onCreate() { diff --git a/core/java/android/app/ApplicationErrorReport.java b/core/java/android/app/ApplicationErrorReport.java index ebf426190d092..954476dbeb488 100644 --- a/core/java/android/app/ApplicationErrorReport.java +++ b/core/java/android/app/ApplicationErrorReport.java @@ -158,8 +158,8 @@ public ApplicationErrorReport() { public static ComponentName getErrorReportReceiver(Context context, String packageName, int appFlags) { // check if error reporting is enabled in secure settings - int enabled = Settings.Secure.getInt(context.getContentResolver(), - Settings.Secure.SEND_ACTION_APP_ERROR, 0); + int enabled = Settings.Global.getInt(context.getContentResolver(), + Settings.Global.SEND_ACTION_APP_ERROR, 0); if (enabled == 0) { return null; } diff --git a/core/java/android/app/ApplicationPackageManager.java b/core/java/android/app/ApplicationPackageManager.java index 191a69612a169..b93771fe2f3cb 100644 --- a/core/java/android/app/ApplicationPackageManager.java +++ b/core/java/android/app/ApplicationPackageManager.java @@ -41,8 +41,8 @@ import android.content.pm.ProviderInfo; import android.content.pm.ResolveInfo; import android.content.pm.ServiceInfo; -import android.content.pm.UserInfo; import android.content.pm.ManifestDigest; +import android.content.pm.VerificationParams; import android.content.pm.VerifierDeviceIdentity; import android.content.res.Resources; import android.content.res.XmlResourceParser; @@ -50,8 +50,8 @@ import android.net.Uri; import android.os.Process; import android.os.RemoteException; -import android.os.UserId; import android.util.Log; +import android.view.Display; import java.lang.ref.WeakReference; import java.util.ArrayList; @@ -69,7 +69,7 @@ final class ApplicationPackageManager extends PackageManager { public PackageInfo getPackageInfo(String packageName, int flags) throws NameNotFoundException { try { - PackageInfo pi = mPM.getPackageInfo(packageName, flags, UserId.myUserId()); + PackageInfo pi = mPM.getPackageInfo(packageName, flags, mContext.getUserId()); if (pi != null) { return pi; } @@ -199,7 +199,7 @@ public List getAllPermissionGroups(int flags) { public ApplicationInfo getApplicationInfo(String packageName, int flags) throws NameNotFoundException { try { - ApplicationInfo ai = mPM.getApplicationInfo(packageName, flags, UserId.myUserId()); + ApplicationInfo ai = mPM.getApplicationInfo(packageName, flags, mContext.getUserId()); if (ai != null) { return ai; } @@ -214,7 +214,7 @@ public ApplicationInfo getApplicationInfo(String packageName, int flags) public ActivityInfo getActivityInfo(ComponentName className, int flags) throws NameNotFoundException { try { - ActivityInfo ai = mPM.getActivityInfo(className, flags, UserId.myUserId()); + ActivityInfo ai = mPM.getActivityInfo(className, flags, mContext.getUserId()); if (ai != null) { return ai; } @@ -229,7 +229,7 @@ public ActivityInfo getActivityInfo(ComponentName className, int flags) public ActivityInfo getReceiverInfo(ComponentName className, int flags) throws NameNotFoundException { try { - ActivityInfo ai = mPM.getReceiverInfo(className, flags, UserId.myUserId()); + ActivityInfo ai = mPM.getReceiverInfo(className, flags, mContext.getUserId()); if (ai != null) { return ai; } @@ -244,7 +244,7 @@ public ActivityInfo getReceiverInfo(ComponentName className, int flags) public ServiceInfo getServiceInfo(ComponentName className, int flags) throws NameNotFoundException { try { - ServiceInfo si = mPM.getServiceInfo(className, flags, UserId.myUserId()); + ServiceInfo si = mPM.getServiceInfo(className, flags, mContext.getUserId()); if (si != null) { return si; } @@ -259,7 +259,7 @@ public ServiceInfo getServiceInfo(ComponentName className, int flags) public ProviderInfo getProviderInfo(ComponentName className, int flags) throws NameNotFoundException { try { - ProviderInfo pi = mPM.getProviderInfo(className, flags, UserId.myUserId()); + ProviderInfo pi = mPM.getProviderInfo(className, flags, mContext.getUserId()); if (pi != null) { return pi; } @@ -404,6 +404,12 @@ public int getUidForSharedUser(String sharedUserName) @SuppressWarnings("unchecked") @Override public List getInstalledPackages(int flags) { + return getInstalledPackages(flags, mContext.getUserId()); + } + + /** @hide */ + @Override + public List getInstalledPackages(int flags, int userId) { try { final List packageInfos = new ArrayList(); PackageInfo lastItem = null; @@ -411,7 +417,7 @@ public List getInstalledPackages(int flags) { do { final String lastKey = lastItem != null ? lastItem.packageName : null; - slice = mPM.getInstalledPackages(flags, lastKey); + slice = mPM.getInstalledPackages(flags, lastKey, userId); lastItem = slice.populateList(packageInfos, PackageInfo.CREATOR); } while (!slice.isLastSlice()); @@ -421,10 +427,20 @@ public List getInstalledPackages(int flags) { } } + @SuppressWarnings("unchecked") + @Override + public List getInstalledThemePackages() { + try { + return mPM.getInstalledThemePackages(); + } catch (RemoteException e) { + throw new RuntimeException("Package manager has died", e); + } + } + @SuppressWarnings("unchecked") @Override public List getInstalledApplications(int flags) { - int userId = UserId.getUserId(Process.myUid()); + final int userId = mContext.getUserId(); try { final List applicationInfos = new ArrayList(); ApplicationInfo lastItem = null; @@ -444,11 +460,17 @@ public List getInstalledApplications(int flags) { @Override public ResolveInfo resolveActivity(Intent intent, int flags) { + return resolveActivityAsUser(intent, flags, mContext.getUserId()); + } + + @Override + public ResolveInfo resolveActivityAsUser(Intent intent, int flags, int userId) { try { return mPM.resolveIntent( intent, intent.resolveTypeIfNeeded(mContext.getContentResolver()), - flags, UserId.myUserId()); + flags, + userId); } catch (RemoteException e) { throw new RuntimeException("Package manager has died", e); } @@ -457,12 +479,19 @@ public ResolveInfo resolveActivity(Intent intent, int flags) { @Override public List queryIntentActivities(Intent intent, int flags) { + return queryIntentActivitiesAsUser(intent, flags, mContext.getUserId()); + } + + /** @hide Same as above but for a specific user */ + @Override + public List queryIntentActivitiesAsUser(Intent intent, + int flags, int userId) { try { return mPM.queryIntentActivities( intent, intent.resolveTypeIfNeeded(mContext.getContentResolver()), flags, - UserId.myUserId()); + userId); } catch (RemoteException e) { throw new RuntimeException("Package manager has died", e); } @@ -494,25 +523,33 @@ public List queryIntentActivityOptions( try { return mPM.queryIntentActivityOptions(caller, specifics, specificTypes, intent, intent.resolveTypeIfNeeded(resolver), - flags, UserId.myUserId()); + flags, mContext.getUserId()); } catch (RemoteException e) { throw new RuntimeException("Package manager has died", e); } } + /** + * @hide + */ @Override - public List queryBroadcastReceivers(Intent intent, int flags) { + public List queryBroadcastReceivers(Intent intent, int flags, int userId) { try { return mPM.queryIntentReceivers( intent, intent.resolveTypeIfNeeded(mContext.getContentResolver()), flags, - UserId.myUserId()); + userId); } catch (RemoteException e) { throw new RuntimeException("Package manager has died", e); } } + @Override + public List queryBroadcastReceivers(Intent intent, int flags) { + return queryBroadcastReceivers(intent, flags, mContext.getUserId()); + } + @Override public ResolveInfo resolveService(Intent intent, int flags) { try { @@ -520,30 +557,35 @@ public ResolveInfo resolveService(Intent intent, int flags) { intent, intent.resolveTypeIfNeeded(mContext.getContentResolver()), flags, - UserId.myUserId()); + mContext.getUserId()); } catch (RemoteException e) { throw new RuntimeException("Package manager has died", e); } } @Override - public List queryIntentServices(Intent intent, int flags) { + public List queryIntentServicesAsUser(Intent intent, int flags, int userId) { try { return mPM.queryIntentServices( intent, intent.resolveTypeIfNeeded(mContext.getContentResolver()), flags, - UserId.myUserId()); + userId); } catch (RemoteException e) { throw new RuntimeException("Package manager has died", e); } } + @Override + public List queryIntentServices(Intent intent, int flags) { + return queryIntentServicesAsUser(intent, flags, mContext.getUserId()); + } + @Override public ProviderInfo resolveContentProvider(String name, int flags) { try { - return mPM.resolveContentProvider(name, flags, UserId.myUserId()); + return mPM.resolveContentProvider(name, flags, mContext.getUserId()); } catch (RemoteException e) { throw new RuntimeException("Package manager has died", e); } @@ -712,8 +754,8 @@ public Drawable getApplicationLogo(String packageName) return mContext.mMainThread.getSystemContext().getResources(); } Resources r = mContext.mMainThread.getTopLevelResources( - app.uid == Process.myUid() ? app.sourceDir - : app.publicSourceDir, mContext.mPackageInfo); + app.uid == Process.myUid() ? app.sourceDir : app.publicSourceDir, + Display.DEFAULT_DISPLAY, null, mContext.mPackageInfo); if (r != null) { return r; } @@ -726,6 +768,28 @@ public Drawable getApplicationLogo(String packageName) getApplicationInfo(appPackageName, 0)); } + /** @hide */ + @Override + public Resources getResourcesForApplicationAsUser(String appPackageName, int userId) + throws NameNotFoundException { + if (userId < 0) { + throw new IllegalArgumentException( + "Call does not support special user #" + userId); + } + if ("system".equals(appPackageName)) { + return mContext.mMainThread.getSystemContext().getResources(); + } + try { + ApplicationInfo ai = mPM.getApplicationInfo(appPackageName, 0, userId); + if (ai != null) { + return getResourcesForApplication(ai); + } + } catch (RemoteException e) { + throw new RuntimeException("Package manager has died", e); + } + throw new NameNotFoundException("Package " + appPackageName + " doesn't exist"); + } + int mCachedSafeMode = -1; @Override public boolean isSafeMode() { try { @@ -983,6 +1047,33 @@ public void installPackageWithVerification(Uri packageURI, IPackageInstallObserv } } + @Override + public void installPackageWithVerificationAndEncryption(Uri packageURI, + IPackageInstallObserver observer, int flags, String installerPackageName, + VerificationParams verificationParams, ContainerEncryptionParams encryptionParams) { + try { + mPM.installPackageWithVerificationAndEncryption(packageURI, observer, flags, + installerPackageName, verificationParams, encryptionParams); + } catch (RemoteException e) { + // Should never happen! + } + } + + @Override + public int installExistingPackage(String packageName) + throws NameNotFoundException { + try { + int res = mPM.installExistingPackage(packageName); + if (res == INSTALL_FAILED_INVALID_URI) { + throw new NameNotFoundException("Package " + packageName + " doesn't exist"); + } + return res; + } catch (RemoteException e) { + // Should never happen! + throw new NameNotFoundException("Package " + packageName + " doesn't exist"); + } + } + @Override public void verifyPendingInstall(int id, int response) { try { @@ -992,6 +1083,16 @@ public void verifyPendingInstall(int id, int response) { } } + @Override + public void extendVerificationTimeout(int id, int verificationCodeAtTimeout, + long millisecondsToDelay) { + try { + mPM.extendVerificationTimeout(id, verificationCodeAtTimeout, millisecondsToDelay); + } catch (RemoteException e) { + // Should never happen! + } + } + @Override public void setInstallerPackageName(String targetPackage, String installerPackageName) { @@ -1033,7 +1134,7 @@ public void deletePackage(String packageName, IPackageDeleteObserver observer, i public void clearApplicationUserData(String packageName, IPackageDataObserver observer) { try { - mPM.clearApplicationUserData(packageName, observer, UserId.myUserId()); + mPM.clearApplicationUserData(packageName, observer, mContext.getUserId()); } catch (RemoteException e) { // Should never happen! } @@ -1066,10 +1167,10 @@ public void freeStorage(long freeStorageSize, IntentSender pi) { } @Override - public void getPackageSizeInfo(String packageName, - IPackageStatsObserver observer) { + public void getPackageSizeInfo(String packageName, int userHandle, + IPackageStatsObserver observer) { try { - mPM.getPackageSizeInfo(packageName, observer); + mPM.getPackageSizeInfo(packageName, userHandle, observer); } catch (RemoteException e) { // Should never happen! } @@ -1106,7 +1207,17 @@ public List getPreferredPackages(int flags) { public void addPreferredActivity(IntentFilter filter, int match, ComponentName[] set, ComponentName activity) { try { - mPM.addPreferredActivity(filter, match, set, activity); + mPM.addPreferredActivity(filter, match, set, activity, mContext.getUserId()); + } catch (RemoteException e) { + // Should never happen! + } + } + + @Override + public void addPreferredActivity(IntentFilter filter, int match, + ComponentName[] set, ComponentName activity, int userId) { + try { + mPM.addPreferredActivity(filter, match, set, activity, userId); } catch (RemoteException e) { // Should never happen! } @@ -1146,7 +1257,7 @@ public int getPreferredActivities(List outFilters, public void setComponentEnabledSetting(ComponentName componentName, int newState, int flags) { try { - mPM.setComponentEnabledSetting(componentName, newState, flags, UserId.myUserId()); + mPM.setComponentEnabledSetting(componentName, newState, flags, mContext.getUserId()); } catch (RemoteException e) { // Should never happen! } @@ -1155,7 +1266,7 @@ public void setComponentEnabledSetting(ComponentName componentName, @Override public int getComponentEnabledSetting(ComponentName componentName) { try { - return mPM.getComponentEnabledSetting(componentName, UserId.myUserId()); + return mPM.getComponentEnabledSetting(componentName, mContext.getUserId()); } catch (RemoteException e) { // Should never happen! } @@ -1166,7 +1277,7 @@ public int getComponentEnabledSetting(ComponentName componentName) { public void setApplicationEnabledSetting(String packageName, int newState, int flags) { try { - mPM.setApplicationEnabledSetting(packageName, newState, flags, UserId.myUserId()); + mPM.setApplicationEnabledSetting(packageName, newState, flags, mContext.getUserId()); } catch (RemoteException e) { // Should never happen! } @@ -1175,86 +1286,13 @@ public void setApplicationEnabledSetting(String packageName, @Override public int getApplicationEnabledSetting(String packageName) { try { - return mPM.getApplicationEnabledSetting(packageName, UserId.myUserId()); + return mPM.getApplicationEnabledSetting(packageName, mContext.getUserId()); } catch (RemoteException e) { // Should never happen! } return PackageManager.COMPONENT_ENABLED_STATE_DEFAULT; } - // Multi-user support - - /** - * @hide - */ - @Override - public UserInfo createUser(String name, int flags) { - try { - return mPM.createUser(name, flags); - } catch (RemoteException e) { - // Should never happen! - } - return null; - } - - /** - * @hide - */ - @Override - public List getUsers() { - try { - return mPM.getUsers(); - } catch (RemoteException re) { - ArrayList users = new ArrayList(); - UserInfo primary = new UserInfo(0, "Root!", UserInfo.FLAG_ADMIN | UserInfo.FLAG_PRIMARY); - users.add(primary); - return users; - } - } - - /** - * @hide - */ - @Override - public UserInfo getUser(int userId) { - try { - return mPM.getUser(userId); - } catch (RemoteException re) { - return null; - } - } - - /** - * @hide - */ - @Override - public boolean removeUser(int id) { - try { - return mPM.removeUser(id); - } catch (RemoteException e) { - return false; - } - } - - /** - * @hide - */ - @Override - public void updateUserName(int id, String name) { - try { - mPM.updateUserName(id, name); - } catch (RemoteException re) { - } - } - - /** - * @hide - */ - @Override - public void updateUserFlags(int id, int flags) { - // TODO: - } - /** * @hide */ diff --git a/core/java/android/app/ApplicationThreadNative.java b/core/java/android/app/ApplicationThreadNative.java index 3e726e035c784..63aa5f9b5f34f 100644 --- a/core/java/android/app/ApplicationThreadNative.java +++ b/core/java/android/app/ApplicationThreadNative.java @@ -193,8 +193,9 @@ public boolean onTransact(int code, Parcel data, Parcel reply, int flags) String resultData = data.readString(); Bundle resultExtras = data.readBundle(); boolean sync = data.readInt() != 0; + int sendingUser = data.readInt(); scheduleReceiver(intent, info, compatInfo, resultCode, resultData, - resultExtras, sync); + resultExtras, sync, sendingUser); return true; } @@ -378,13 +379,15 @@ public boolean onTransact(int code, Parcel data, Parcel reply, int flags) Bundle extras = data.readBundle(); boolean ordered = data.readInt() != 0; boolean sticky = data.readInt() != 0; + int sendingUser = data.readInt(); scheduleRegisteredReceiver(receiver, intent, - resultCode, dataStr, extras, ordered, sticky); + resultCode, dataStr, extras, ordered, sticky, sendingUser); return true; } case SCHEDULE_LOW_MEMORY_TRANSACTION: { + data.enforceInterface(IApplicationThread.descriptor); scheduleLowMemory(); return true; } @@ -754,7 +757,7 @@ public final void scheduleDestroyActivity(IBinder token, boolean finishing, public final void scheduleReceiver(Intent intent, ActivityInfo info, CompatibilityInfo compatInfo, int resultCode, String resultData, - Bundle map, boolean sync) throws RemoteException { + Bundle map, boolean sync, int sendingUser) throws RemoteException { Parcel data = Parcel.obtain(); data.writeInterfaceToken(IApplicationThread.descriptor); intent.writeToParcel(data, 0); @@ -764,6 +767,7 @@ public final void scheduleReceiver(Intent intent, ActivityInfo info, data.writeString(resultData); data.writeBundle(map); data.writeInt(sync ? 1 : 0); + data.writeInt(sendingUser); mRemote.transact(SCHEDULE_RECEIVER_TRANSACTION, data, null, IBinder.FLAG_ONEWAY); data.recycle(); @@ -990,8 +994,8 @@ public void dumpProvider(FileDescriptor fd, IBinder token, String[] args) } public void scheduleRegisteredReceiver(IIntentReceiver receiver, Intent intent, - int resultCode, String dataStr, Bundle extras, boolean ordered, boolean sticky) - throws RemoteException { + int resultCode, String dataStr, Bundle extras, boolean ordered, + boolean sticky, int sendingUser) throws RemoteException { Parcel data = Parcel.obtain(); data.writeInterfaceToken(IApplicationThread.descriptor); data.writeStrongBinder(receiver.asBinder()); @@ -1001,6 +1005,7 @@ public void scheduleRegisteredReceiver(IIntentReceiver receiver, Intent intent, data.writeBundle(extras); data.writeInt(ordered ? 1 : 0); data.writeInt(sticky ? 1 : 0); + data.writeInt(sendingUser); mRemote.transact(SCHEDULE_REGISTERED_RECEIVER_TRANSACTION, data, null, IBinder.FLAG_ONEWAY); data.recycle(); diff --git a/core/java/android/app/BackStackRecord.java b/core/java/android/app/BackStackRecord.java index 96814b725463f..1b1d3418a5b11 100644 --- a/core/java/android/app/BackStackRecord.java +++ b/core/java/android/app/BackStackRecord.java @@ -20,6 +20,7 @@ import android.os.Parcelable; import android.text.TextUtils; import android.util.Log; +import android.util.LogWriter; import java.io.FileDescriptor; import java.io.PrintWriter; @@ -94,11 +95,12 @@ public BackStackState(Parcel in) { public BackStackRecord instantiate(FragmentManagerImpl fm) { BackStackRecord bse = new BackStackRecord(fm); int pos = 0; + int num = 0; while (pos < mOps.length) { BackStackRecord.Op op = new BackStackRecord.Op(); op.cmd = mOps[pos++]; if (FragmentManagerImpl.DEBUG) Log.v(FragmentManagerImpl.TAG, - "BSE " + bse + " set base fragment #" + mOps[pos]); + "Instantiate " + bse + " op #" + num + " base fragment #" + mOps[pos]); int findex = mOps[pos++]; if (findex >= 0) { Fragment f = fm.mActive.get(findex); @@ -115,12 +117,13 @@ public BackStackRecord instantiate(FragmentManagerImpl fm) { op.removed = new ArrayList(N); for (int i=0; i= 0) { + sb.append(" #"); + sb.append(mIndex); } - if (mBreadCrumbTitleRes != 0 || mBreadCrumbTitleText != null) { - writer.print(prefix); writer.print("mBreadCrumbTitleRes=#"); - writer.print(Integer.toHexString(mBreadCrumbTitleRes)); - writer.print(" mBreadCrumbTitleText="); - writer.println(mBreadCrumbTitleText); + if (mName != null) { + sb.append(" "); + sb.append(mName); } - if (mBreadCrumbShortTitleRes != 0 || mBreadCrumbShortTitleText != null) { - writer.print(prefix); writer.print("mBreadCrumbShortTitleRes=#"); - writer.print(Integer.toHexString(mBreadCrumbShortTitleRes)); - writer.print(" mBreadCrumbShortTitleText="); - writer.println(mBreadCrumbShortTitleText); + sb.append("}"); + return sb.toString(); + } + + public void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args) { + dump(prefix, writer, true); + } + + void dump(String prefix, PrintWriter writer, boolean full) { + if (full) { + writer.print(prefix); writer.print("mName="); writer.print(mName); + writer.print(" mIndex="); writer.print(mIndex); + writer.print(" mCommitted="); writer.println(mCommitted); + if (mTransition != FragmentTransaction.TRANSIT_NONE) { + writer.print(prefix); writer.print("mTransition=#"); + writer.print(Integer.toHexString(mTransition)); + writer.print(" mTransitionStyle=#"); + writer.println(Integer.toHexString(mTransitionStyle)); + } + if (mEnterAnim != 0 || mExitAnim !=0) { + writer.print(prefix); writer.print("mEnterAnim=#"); + writer.print(Integer.toHexString(mEnterAnim)); + writer.print(" mExitAnim=#"); + writer.println(Integer.toHexString(mExitAnim)); + } + if (mPopEnterAnim != 0 || mPopExitAnim !=0) { + writer.print(prefix); writer.print("mPopEnterAnim=#"); + writer.print(Integer.toHexString(mPopEnterAnim)); + writer.print(" mPopExitAnim=#"); + writer.println(Integer.toHexString(mPopExitAnim)); + } + if (mBreadCrumbTitleRes != 0 || mBreadCrumbTitleText != null) { + writer.print(prefix); writer.print("mBreadCrumbTitleRes=#"); + writer.print(Integer.toHexString(mBreadCrumbTitleRes)); + writer.print(" mBreadCrumbTitleText="); + writer.println(mBreadCrumbTitleText); + } + if (mBreadCrumbShortTitleRes != 0 || mBreadCrumbShortTitleText != null) { + writer.print(prefix); writer.print("mBreadCrumbShortTitleRes=#"); + writer.print(Integer.toHexString(mBreadCrumbShortTitleRes)); + writer.print(" mBreadCrumbShortTitleText="); + writer.println(mBreadCrumbShortTitleText); + } } if (mHead != null) { @@ -254,21 +280,34 @@ public void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] Op op = mHead; int num = 0; while (op != null) { - writer.print(prefix); writer.print(" Op #"); writer.print(num); - writer.println(":"); - writer.print(innerPrefix); writer.print("cmd="); writer.print(op.cmd); - writer.print(" fragment="); writer.println(op.fragment); - if (op.enterAnim != 0 || op.exitAnim != 0) { - writer.print(prefix); writer.print("enterAnim=#"); - writer.print(Integer.toHexString(op.enterAnim)); - writer.print(" exitAnim=#"); - writer.println(Integer.toHexString(op.exitAnim)); + String cmdStr; + switch (op.cmd) { + case OP_NULL: cmdStr="NULL"; break; + case OP_ADD: cmdStr="ADD"; break; + case OP_REPLACE: cmdStr="REPLACE"; break; + case OP_REMOVE: cmdStr="REMOVE"; break; + case OP_HIDE: cmdStr="HIDE"; break; + case OP_SHOW: cmdStr="SHOW"; break; + case OP_DETACH: cmdStr="DETACH"; break; + case OP_ATTACH: cmdStr="ATTACH"; break; + default: cmdStr="cmd=" + op.cmd; break; } - if (op.popEnterAnim != 0 || op.popExitAnim != 0) { - writer.print(prefix); writer.print("popEnterAnim=#"); - writer.print(Integer.toHexString(op.popEnterAnim)); - writer.print(" popExitAnim=#"); - writer.println(Integer.toHexString(op.popExitAnim)); + writer.print(prefix); writer.print(" Op #"); writer.print(num); + writer.print(": "); writer.print(cmdStr); + writer.print(" "); writer.println(op.fragment); + if (full) { + if (op.enterAnim != 0 || op.exitAnim != 0) { + writer.print(innerPrefix); writer.print("enterAnim=#"); + writer.print(Integer.toHexString(op.enterAnim)); + writer.print(" exitAnim=#"); + writer.println(Integer.toHexString(op.exitAnim)); + } + if (op.popEnterAnim != 0 || op.popExitAnim != 0) { + writer.print(innerPrefix); writer.print("popEnterAnim=#"); + writer.print(Integer.toHexString(op.popEnterAnim)); + writer.print(" popExitAnim=#"); + writer.println(Integer.toHexString(op.popExitAnim)); + } } if (op.removed != null && op.removed.size() > 0) { for (int i=0; i CREATOR = new Parcelable.Creator() { + public ConnectionSettings createFromParcel(Parcel in) { + return new ConnectionSettings(in); + } + + @Override + public ConnectionSettings[] newArray(int size) { + return new ConnectionSettings[size]; + } + }; + + + public ConnectionSettings(Parcel parcel) { + readFromParcel(parcel); + } + + public ConnectionSettings(int connectionId) { + this(connectionId, 0, false); + } + + public ConnectionSettings(int connectionId, int value, boolean override) { + mConnectionId = connectionId; + mValue = value; + mOverride = override; + mDirty = false; + } + + public int getConnectionId() { + return mConnectionId; + } + + public int getValue() { + return mValue; + } + + public void setValue(int value) { + mValue = value; + mDirty = true; + } + + public void setOverride(boolean override) { + mOverride = override; + mDirty = true; + } + + public boolean isOverride() { + return mOverride; + } + + /** @hide */ + public boolean isDirty() { + return mDirty; + } + + public void processOverride(Context context) { + BluetoothAdapter bta = BluetoothAdapter.getDefaultAdapter(); + LocationManager lm = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE); + WifiManager wm = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); + ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); + + boolean forcedState = getValue() == 1; + boolean currentState; + + switch (getConnectionId()) { + case PROFILE_CONNECTION_MOBILEDATA: + currentState = cm.getMobileDataEnabled(); + if (forcedState != currentState) { + cm.setMobileDataEnabled(forcedState); + } + break; + case PROFILE_CONNECTION_BLUETOOTH: + currentState = bta.isEnabled(); + if (forcedState && !currentState) { + bta.enable(); + } else if (!forcedState && currentState) { + bta.disable(); + } + break; + case PROFILE_CONNECTION_GPS: + currentState = lm.isProviderEnabled(LocationManager.GPS_PROVIDER); + if (currentState != forcedState) { + Settings.Secure.setLocationProviderEnabled(context.getContentResolver(), + LocationManager.GPS_PROVIDER, forcedState); + } + break; + case PROFILE_CONNECTION_SYNC: + currentState = ContentResolver.getMasterSyncAutomatically(); + if (forcedState != currentState) { + ContentResolver.setMasterSyncAutomatically(forcedState); + } + break; + case PROFILE_CONNECTION_WIFI: + int wifiApState = wm.getWifiApState(); + currentState = wm.isWifiEnabled(); + if (currentState != forcedState) { + // Disable wifi tether + if (forcedState && (wifiApState == WifiManager.WIFI_AP_STATE_ENABLING) || + (wifiApState == WifiManager.WIFI_AP_STATE_ENABLED)) { + wm.setWifiApEnabled(null, false); + } + wm.setWifiEnabled(forcedState); + } + break; + case PROFILE_CONNECTION_WIFIAP: + int wifiState = wm.getWifiState(); + currentState = wm.isWifiApEnabled(); + if (currentState != forcedState) { + // Disable wifi + if (forcedState && (wifiState == WifiManager.WIFI_STATE_ENABLING) || (wifiState == WifiManager.WIFI_STATE_ENABLED)) { + wm.setWifiEnabled(false); + } + wm.setWifiApEnabled(null, forcedState); + } + break; + case PROFILE_CONNECTION_WIMAX: + if (WimaxHelper.isWimaxSupported(context)) { + currentState = WimaxHelper.isWimaxEnabled(context); + if (currentState != forcedState) { + WimaxHelper.setWimaxEnabled(context, forcedState); + } + } + break; + } + } + + /** @hide */ + public static ConnectionSettings fromXml(XmlPullParser xpp, Context context) + throws XmlPullParserException, IOException { + int event = xpp.next(); + ConnectionSettings connectionDescriptor = new ConnectionSettings(0); + while (event != XmlPullParser.END_TAG || !xpp.getName().equals("connectionDescriptor")) { + if (event == XmlPullParser.START_TAG) { + String name = xpp.getName(); + if (name.equals("connectionId")) { + connectionDescriptor.mConnectionId = Integer.parseInt(xpp.nextText()); + } else if (name.equals("value")) { + connectionDescriptor.mValue = Integer.parseInt(xpp.nextText()); + } else if (name.equals("override")) { + connectionDescriptor.mOverride = Boolean.parseBoolean(xpp.nextText()); + } + } + event = xpp.next(); + } + return connectionDescriptor; + } + + /** @hide */ + public void getXmlString(StringBuilder builder, Context context) { + builder.append("\n"); + builder.append(mConnectionId); + builder.append("\n"); + builder.append(mValue); + builder.append("\n"); + builder.append(mOverride); + builder.append("\n\n"); + } + + @Override + public int describeContents() { + return 0; + } + + /** @hide */ + @Override + public void writeToParcel(Parcel dest, int flags) { + dest.writeInt(mConnectionId); + dest.writeInt(mOverride ? 1 : 0); + dest.writeInt(mValue); + dest.writeInt(mDirty ? 1 : 0); + } + + /** @hide */ + public void readFromParcel(Parcel in) { + mConnectionId = in.readInt(); + mOverride = in.readInt() != 0; + mValue = in.readInt(); + mDirty = in.readInt() != 0; + } + + +} diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java index 411f6d00b0bfe..74394269a30b2 100644 --- a/core/java/android/app/ContextImpl.java +++ b/core/java/android/app/ContextImpl.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2006 The Android Open Source Project + * This code has been modified. Portions copyright (C) 2010, T-Mobile USA, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,16 +18,20 @@ package android.app; import com.android.internal.policy.PolicyManager; +import com.android.internal.util.Preconditions; +import android.accounts.AccountManager; +import android.accounts.IAccountManager; +import android.bluetooth.BluetoothAdapter; import android.content.BroadcastReceiver; import android.content.ComponentName; import android.content.ContentResolver; import android.content.Context; import android.content.ContextWrapper; import android.content.IContentProvider; +import android.content.IIntentReceiver; import android.content.Intent; import android.content.IntentFilter; -import android.content.IIntentReceiver; import android.content.IntentSender; import android.content.ReceiverCallNotAllowedException; import android.content.ServiceConnection; @@ -34,8 +39,11 @@ import android.content.pm.ApplicationInfo; import android.content.pm.IPackageManager; import android.content.pm.PackageManager; +import android.content.pm.PackageManager.NameNotFoundException; import android.content.res.AssetManager; import android.content.res.CompatibilityInfo; +import android.content.res.Configuration; +import android.content.res.CustomTheme; import android.content.res.Resources; import android.database.DatabaseErrorHandler; import android.database.sqlite.SQLiteDatabase; @@ -46,6 +54,7 @@ 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; @@ -69,28 +78,36 @@ import android.net.wifi.WifiManager; import android.net.wifi.p2p.IWifiP2pManager; import android.net.wifi.p2p.WifiP2pManager; +import android.net.wimax.WimaxHelper; +import android.net.wimax.WimaxManagerConstants; import android.nfc.NfcManager; import android.os.Binder; import android.os.Bundle; +import android.os.Debug; import android.os.DropBoxManager; import android.os.Environment; import android.os.FileUtils; import android.os.Handler; import android.os.IBinder; import android.os.IPowerManager; +import android.os.IUserManager; import android.os.Looper; import android.os.PowerManager; import android.os.Process; import android.os.RemoteException; import android.os.ServiceManager; -import android.os.UserId; +import android.os.UserHandle; import android.os.SystemVibrator; +import android.os.UserManager; import android.os.storage.StorageManager; import android.telephony.TelephonyManager; import android.content.ClipboardManager; import android.util.AndroidRuntimeException; import android.util.Log; +import android.util.Slog; +import android.view.CompatibilityInfoHolder; import android.view.ContextThemeWrapper; +import android.view.Display; import android.view.WindowManagerImpl; import android.view.accessibility.AccessibilityManager; import android.view.inputmethod.InputMethodManager; @@ -122,21 +139,33 @@ public Intent registerReceiver(BroadcastReceiver receiver, IntentFilter filter) @Override public Intent registerReceiver(BroadcastReceiver receiver, IntentFilter filter, String broadcastPermission, Handler scheduler) { - throw new ReceiverCallNotAllowedException( - "IntentReceiver components are not allowed to register to receive intents"); - //ex.fillInStackTrace(); - //Log.e("IntentReceiver", ex.getMessage(), ex); - //return mContext.registerReceiver(receiver, filter, broadcastPermission, - // scheduler); + if (receiver == null) { + // Allow retrieving current sticky broadcast; this is safe since we + // aren't actually registering a receiver. + return super.registerReceiver(null, filter, broadcastPermission, scheduler); + } else { + throw new ReceiverCallNotAllowedException( + "BroadcastReceiver components are not allowed to register to receive intents"); + } + } + + @Override + public Intent registerReceiverAsUser(BroadcastReceiver receiver, UserHandle user, + IntentFilter filter, String broadcastPermission, Handler scheduler) { + if (receiver == null) { + // Allow retrieving current sticky broadcast; this is safe since we + // aren't actually registering a receiver. + return super.registerReceiverAsUser(null, user, filter, broadcastPermission, scheduler); + } else { + throw new ReceiverCallNotAllowedException( + "BroadcastReceiver components are not allowed to register to receive intents"); + } } @Override public boolean bindService(Intent service, ServiceConnection conn, int flags) { throw new ReceiverCallNotAllowedException( - "IntentReceiver components are not allowed to bind to services"); - //ex.fillInStackTrace(); - //Log.e("IntentReceiver", ex.getMessage(), ex); - //return mContext.bindService(service, interfaceName, conn, flags); + "BroadcastReceiver components are not allowed to bind to services"); } } @@ -161,8 +190,10 @@ class ContextImpl extends Context { private int mThemeResource = 0; private Resources.Theme mTheme = null; private PackageManager mPackageManager; + private Display mDisplay; // may be null if default display private Context mReceiverRestrictedContext = null; private boolean mRestricted; + private UserHandle mUser; private final Object mSync = new Object(); @@ -294,6 +325,11 @@ public Object createService(ContextImpl ctx) { return new MediaRouter(ctx); }}); + registerService(BLUETOOTH_SERVICE, new ServiceFetcher() { + public Object createService(ContextImpl ctx) { + return BluetoothAdapter.getDefaultAdapter(); + }}); + registerService(CLIPBOARD_SERVICE, new ServiceFetcher() { public Object createService(ContextImpl ctx) { return new ClipboardManager(ctx.getOuterContext(), @@ -337,6 +373,12 @@ public Object createStaticService() { return InputManager.getInstance(); }}); + registerService(DISPLAY_SERVICE, new ServiceFetcher() { + @Override + public Object createService(ContextImpl ctx) { + return new DisplayManager(ctx.getOuterContext()); + }}); + registerService(INPUT_METHOD_SERVICE, new ServiceFetcher() { public Object createService(ContextImpl ctx) { return InputMethodManager.getInstance(ctx); @@ -403,7 +445,8 @@ public Object createService(ContextImpl ctx) { public Object createService(ContextImpl ctx) { IBinder b = ServiceManager.getService(POWER_SERVICE); IPowerManager service = IPowerManager.Stub.asInterface(b); - return new PowerManager(service, ctx.mMainThread.getHandler()); + return new PowerManager(ctx.getOuterContext(), + service, ctx.mMainThread.getHandler()); }}); registerService(SEARCH_SERVICE, new ServiceFetcher() { @@ -471,7 +514,7 @@ public Object createService(ContextImpl ctx) { public Object createService(ContextImpl ctx) { IBinder b = ServiceManager.getService(WIFI_SERVICE); IWifiManager service = IWifiManager.Stub.asInterface(b); - return new WifiManager(service, ctx.mMainThread.getHandler()); + return new WifiManager(ctx.getOuterContext(), service); }}); registerService(WIFI_P2P_SERVICE, new ServiceFetcher() { @@ -483,7 +526,31 @@ public Object createService(ContextImpl ctx) { registerService(WINDOW_SERVICE, new ServiceFetcher() { public Object getService(ContextImpl ctx) { - return WindowManagerImpl.getDefault(ctx.mPackageInfo.mCompatibilityInfo); + Display display = ctx.mDisplay; + if (display == null) { + DisplayManager dm = (DisplayManager)ctx.getOuterContext().getSystemService( + Context.DISPLAY_SERVICE); + display = dm.getDisplay(Display.DEFAULT_DISPLAY); + } + return new WindowManagerImpl(display); + }}); + + registerService(USER_SERVICE, new ServiceFetcher() { + public Object getService(ContextImpl ctx) { + IBinder b = ServiceManager.getService(USER_SERVICE); + IUserManager service = IUserManager.Stub.asInterface(b); + return new UserManager(ctx, service); + }}); + + registerService(PROFILE_SERVICE, new ServiceFetcher() { + public Object createService(ContextImpl ctx) { + final Context outerContext = ctx.getOuterContext(); + return new ProfileManager (outerContext, ctx.mMainThread.getHandler()); + }}); + + registerService(WimaxManagerConstants.WIMAX_SERVICE, new ServiceFetcher() { + public Object createService(ContextImpl ctx) { + return WimaxHelper.createWimaxService(ctx, ctx.mMainThread.getHandler()); }}); } @@ -503,7 +570,7 @@ static ContextImpl getImpl(Context context) { @Override public AssetManager getAssets() { - return mResources.getAssets(); + return getResources().getAssets(); } @Override @@ -511,6 +578,20 @@ public Resources getResources() { return mResources; } + /** + * Refresh resources object which may have been changed by a theme + * configuration change. + */ + /* package */ void refreshResourcesIfNecessary() { + if (mResources == Resources.getSystem()) { + return; + } + + if (mPackageInfo.mCompatibilityInfo.get().isThemeable) { + mTheme = null; + } + } + @Override public PackageManager getPackageManager() { if (mPackageManager != null) { @@ -743,7 +824,7 @@ public File getCacheDir() { } if (!mCacheDir.exists()) { if(!mCacheDir.mkdirs()) { - Log.w(TAG, "Unable to create cache directory"); + Log.w(TAG, "Unable to create cache directory " + mCacheDir.getAbsolutePath()); return null; } FileUtils.setPermissions( @@ -877,11 +958,19 @@ public void clearWallpaper() throws IOException { @Override public void startActivity(Intent intent) { + warnIfCallingFromSystemProcess(); startActivity(intent, null); } + /** @hide */ + @Override + public void startActivityAsUser(Intent intent, UserHandle user) { + startActivityAsUser(intent, null, user); + } + @Override public void startActivity(Intent intent, Bundle options) { + warnIfCallingFromSystemProcess(); if ((intent.getFlags()&Intent.FLAG_ACTIVITY_NEW_TASK) == 0) { throw new AndroidRuntimeException( "Calling startActivity() from outside of an Activity " @@ -893,13 +982,42 @@ public void startActivity(Intent intent, Bundle options) { (Activity)null, intent, -1, options); } + /** @hide */ + @Override + public void startActivityAsUser(Intent intent, Bundle options, UserHandle user) { + try { + ActivityManagerNative.getDefault().startActivityAsUser( + mMainThread.getApplicationThread(), intent, + intent.resolveTypeIfNeeded(getContentResolver()), + null, null, 0, Intent.FLAG_ACTIVITY_NEW_TASK, null, null, options, + user.getIdentifier()); + } catch (RemoteException re) { + } + } + @Override public void startActivities(Intent[] intents) { + warnIfCallingFromSystemProcess(); startActivities(intents, null); } + /** @hide */ + @Override + public void startActivitiesAsUser(Intent[] intents, Bundle options, UserHandle userHandle) { + if ((intents[0].getFlags()&Intent.FLAG_ACTIVITY_NEW_TASK) == 0) { + throw new AndroidRuntimeException( + "Calling startActivities() from outside of an Activity " + + " context requires the FLAG_ACTIVITY_NEW_TASK flag on first Intent." + + " Is this really what you want?"); + } + mMainThread.getInstrumentation().execStartActivitiesAsUser( + getOuterContext(), mMainThread.getApplicationThread(), null, + (Activity)null, intents, options, userHandle.getIdentifier()); + } + @Override public void startActivities(Intent[] intents, Bundle options) { + warnIfCallingFromSystemProcess(); if ((intents[0].getFlags()&Intent.FLAG_ACTIVITY_NEW_TASK) == 0) { throw new AndroidRuntimeException( "Calling startActivities() from outside of an Activity " @@ -942,62 +1060,111 @@ public void startIntentSender(IntentSender intent, Intent fillInIntent, @Override public void sendBroadcast(Intent intent) { + warnIfCallingFromSystemProcess(); String resolvedType = intent.resolveTypeIfNeeded(getContentResolver()); try { intent.setAllowFds(false); ActivityManagerNative.getDefault().broadcastIntent( mMainThread.getApplicationThread(), intent, resolvedType, null, Activity.RESULT_OK, null, null, null, false, false, - Binder.getOrigCallingUser()); + getUserId()); } catch (RemoteException e) { } } - /** @hide */ @Override - public void sendBroadcast(Intent intent, int userId) { + public void sendBroadcast(Intent intent, String receiverPermission) { + warnIfCallingFromSystemProcess(); String resolvedType = intent.resolveTypeIfNeeded(getContentResolver()); try { intent.setAllowFds(false); - ActivityManagerNative.getDefault().broadcastIntent(mMainThread.getApplicationThread(), - intent, resolvedType, null, Activity.RESULT_OK, null, null, null, false, false, - userId); + ActivityManagerNative.getDefault().broadcastIntent( + mMainThread.getApplicationThread(), intent, resolvedType, null, + Activity.RESULT_OK, null, null, receiverPermission, false, false, + getUserId()); } catch (RemoteException e) { } } @Override - public void sendBroadcast(Intent intent, String receiverPermission) { + public void sendOrderedBroadcast(Intent intent, + String receiverPermission) { + warnIfCallingFromSystemProcess(); String resolvedType = intent.resolveTypeIfNeeded(getContentResolver()); try { intent.setAllowFds(false); ActivityManagerNative.getDefault().broadcastIntent( mMainThread.getApplicationThread(), intent, resolvedType, null, - Activity.RESULT_OK, null, null, receiverPermission, false, false, - Binder.getOrigCallingUser()); + Activity.RESULT_OK, null, null, receiverPermission, true, false, + getUserId()); } catch (RemoteException e) { } } @Override public void sendOrderedBroadcast(Intent intent, + String receiverPermission, BroadcastReceiver resultReceiver, + Handler scheduler, int initialCode, String initialData, + Bundle initialExtras) { + warnIfCallingFromSystemProcess(); + IIntentReceiver rd = null; + if (resultReceiver != null) { + if (mPackageInfo != null) { + if (scheduler == null) { + scheduler = mMainThread.getHandler(); + } + rd = mPackageInfo.getReceiverDispatcher( + resultReceiver, getOuterContext(), scheduler, + mMainThread.getInstrumentation(), false); + } else { + if (scheduler == null) { + scheduler = mMainThread.getHandler(); + } + rd = new LoadedApk.ReceiverDispatcher( + resultReceiver, getOuterContext(), scheduler, null, false).getIIntentReceiver(); + } + } + String resolvedType = intent.resolveTypeIfNeeded(getContentResolver()); + try { + intent.setAllowFds(false); + ActivityManagerNative.getDefault().broadcastIntent( + mMainThread.getApplicationThread(), intent, resolvedType, rd, + initialCode, initialData, initialExtras, receiverPermission, + true, false, getUserId()); + } catch (RemoteException e) { + } + } + + @Override + public void sendBroadcastAsUser(Intent intent, UserHandle user) { + String resolvedType = intent.resolveTypeIfNeeded(getContentResolver()); + try { + intent.setAllowFds(false); + ActivityManagerNative.getDefault().broadcastIntent(mMainThread.getApplicationThread(), + intent, resolvedType, null, Activity.RESULT_OK, null, null, null, false, false, + user.getIdentifier()); + } catch (RemoteException e) { + } + } + + @Override + public void sendBroadcastAsUser(Intent intent, UserHandle user, String receiverPermission) { String resolvedType = intent.resolveTypeIfNeeded(getContentResolver()); try { intent.setAllowFds(false); ActivityManagerNative.getDefault().broadcastIntent( mMainThread.getApplicationThread(), intent, resolvedType, null, - Activity.RESULT_OK, null, null, receiverPermission, true, false, - Binder.getOrigCallingUser()); + Activity.RESULT_OK, null, null, receiverPermission, false, false, + user.getIdentifier()); } catch (RemoteException e) { } } @Override - public void sendOrderedBroadcast(Intent intent, - String receiverPermission, BroadcastReceiver resultReceiver, - Handler scheduler, int initialCode, String initialData, - Bundle initialExtras) { + public void sendOrderedBroadcastAsUser(Intent intent, UserHandle user, + String receiverPermission, BroadcastReceiver resultReceiver, Handler scheduler, + int initialCode, String initialData, Bundle initialExtras) { IIntentReceiver rd = null; if (resultReceiver != null) { if (mPackageInfo != null) { @@ -1021,20 +1188,21 @@ resultReceiver, getOuterContext(), scheduler, ActivityManagerNative.getDefault().broadcastIntent( mMainThread.getApplicationThread(), intent, resolvedType, rd, initialCode, initialData, initialExtras, receiverPermission, - true, false, Binder.getOrigCallingUser()); + true, false, user.getIdentifier()); } catch (RemoteException e) { } } @Override public void sendStickyBroadcast(Intent intent) { + warnIfCallingFromSystemProcess(); String resolvedType = intent.resolveTypeIfNeeded(getContentResolver()); try { intent.setAllowFds(false); ActivityManagerNative.getDefault().broadcastIntent( mMainThread.getApplicationThread(), intent, resolvedType, null, Activity.RESULT_OK, null, null, null, false, true, - Binder.getOrigCallingUser()); + getUserId()); } catch (RemoteException e) { } } @@ -1044,6 +1212,7 @@ public void sendStickyOrderedBroadcast(Intent intent, BroadcastReceiver resultReceiver, Handler scheduler, int initialCode, String initialData, Bundle initialExtras) { + warnIfCallingFromSystemProcess(); IIntentReceiver rd = null; if (resultReceiver != null) { if (mPackageInfo != null) { @@ -1067,7 +1236,7 @@ resultReceiver, getOuterContext(), scheduler, ActivityManagerNative.getDefault().broadcastIntent( mMainThread.getApplicationThread(), intent, resolvedType, rd, initialCode, initialData, initialExtras, null, - true, true, Binder.getOrigCallingUser()); + true, true, getUserId()); } catch (RemoteException e) { } } @@ -1082,7 +1251,67 @@ public void removeStickyBroadcast(Intent intent) { try { intent.setAllowFds(false); ActivityManagerNative.getDefault().unbroadcastIntent( - mMainThread.getApplicationThread(), intent, Binder.getOrigCallingUser()); + mMainThread.getApplicationThread(), intent, getUserId()); + } catch (RemoteException e) { + } + } + + @Override + public void sendStickyBroadcastAsUser(Intent intent, UserHandle user) { + String resolvedType = intent.resolveTypeIfNeeded(getContentResolver()); + try { + intent.setAllowFds(false); + ActivityManagerNative.getDefault().broadcastIntent( + mMainThread.getApplicationThread(), intent, resolvedType, null, + Activity.RESULT_OK, null, null, null, false, true, user.getIdentifier()); + } catch (RemoteException e) { + } + } + + @Override + public void sendStickyOrderedBroadcastAsUser(Intent intent, + UserHandle user, BroadcastReceiver resultReceiver, + Handler scheduler, int initialCode, String initialData, + Bundle initialExtras) { + IIntentReceiver rd = null; + if (resultReceiver != null) { + if (mPackageInfo != null) { + if (scheduler == null) { + scheduler = mMainThread.getHandler(); + } + rd = mPackageInfo.getReceiverDispatcher( + resultReceiver, getOuterContext(), scheduler, + mMainThread.getInstrumentation(), false); + } else { + if (scheduler == null) { + scheduler = mMainThread.getHandler(); + } + rd = new LoadedApk.ReceiverDispatcher( + resultReceiver, getOuterContext(), scheduler, null, false).getIIntentReceiver(); + } + } + String resolvedType = intent.resolveTypeIfNeeded(getContentResolver()); + try { + intent.setAllowFds(false); + ActivityManagerNative.getDefault().broadcastIntent( + mMainThread.getApplicationThread(), intent, resolvedType, rd, + initialCode, initialData, initialExtras, null, + true, true, user.getIdentifier()); + } catch (RemoteException e) { + } + } + + @Override + public void removeStickyBroadcastAsUser(Intent intent, UserHandle user) { + String resolvedType = intent.resolveTypeIfNeeded(getContentResolver()); + if (resolvedType != null) { + intent = new Intent(intent); + intent.setDataAndType(intent.getData(), resolvedType); + } + try { + intent.setAllowFds(false); + ActivityManagerNative.getDefault().unbroadcastIntent( + mMainThread.getApplicationThread(), intent, user.getIdentifier()); } catch (RemoteException e) { } } @@ -1095,11 +1324,18 @@ public Intent registerReceiver(BroadcastReceiver receiver, IntentFilter filter) @Override public Intent registerReceiver(BroadcastReceiver receiver, IntentFilter filter, String broadcastPermission, Handler scheduler) { - return registerReceiverInternal(receiver, filter, broadcastPermission, - scheduler, getOuterContext()); + return registerReceiverInternal(receiver, getUserId(), + filter, broadcastPermission, scheduler, getOuterContext()); } - private Intent registerReceiverInternal(BroadcastReceiver receiver, + @Override + public Intent registerReceiverAsUser(BroadcastReceiver receiver, UserHandle user, + IntentFilter filter, String broadcastPermission, Handler scheduler) { + return registerReceiverInternal(receiver, user.getIdentifier(), + filter, broadcastPermission, scheduler, getOuterContext()); + } + + private Intent registerReceiverInternal(BroadcastReceiver receiver, int userId, IntentFilter filter, String broadcastPermission, Handler scheduler, Context context) { IIntentReceiver rd = null; @@ -1122,7 +1358,7 @@ private Intent registerReceiverInternal(BroadcastReceiver receiver, try { return ActivityManagerNative.getDefault().registerReceiver( mMainThread.getApplicationThread(), mBasePackageName, - rd, filter, broadcastPermission); + rd, filter, broadcastPermission, userId); } catch (RemoteException e) { return null; } @@ -1144,15 +1380,33 @@ public void unregisterReceiver(BroadcastReceiver receiver) { @Override public ComponentName startService(Intent service) { + warnIfCallingFromSystemProcess(); + return startServiceAsUser(service, mUser); + } + + @Override + public boolean stopService(Intent service) { + warnIfCallingFromSystemProcess(); + return stopServiceAsUser(service, mUser); + } + + @Override + public ComponentName startServiceAsUser(Intent service, UserHandle user) { try { service.setAllowFds(false); ComponentName cn = ActivityManagerNative.getDefault().startService( mMainThread.getApplicationThread(), service, - service.resolveTypeIfNeeded(getContentResolver())); - if (cn != null && cn.getPackageName().equals("!")) { - throw new SecurityException( - "Not allowed to start service " + service - + " without permission " + cn.getClassName()); + service.resolveTypeIfNeeded(getContentResolver()), user.getIdentifier()); + if (cn != null) { + if (cn.getPackageName().equals("!")) { + throw new SecurityException( + "Not allowed to start service " + service + + " without permission " + cn.getClassName()); + } else if (cn.getPackageName().equals("!!")) { + throw new SecurityException( + "Unable to start service " + service + + ": " + cn.getClassName()); + } } return cn; } catch (RemoteException e) { @@ -1161,12 +1415,12 @@ public ComponentName startService(Intent service) { } @Override - public boolean stopService(Intent service) { + public boolean stopServiceAsUser(Intent service, UserHandle user) { try { service.setAllowFds(false); int res = ActivityManagerNative.getDefault().stopService( mMainThread.getApplicationThread(), service, - service.resolveTypeIfNeeded(getContentResolver())); + service.resolveTypeIfNeeded(getContentResolver()), user.getIdentifier()); if (res < 0) { throw new SecurityException( "Not allowed to stop service " + service); @@ -1180,13 +1434,17 @@ public boolean stopService(Intent service) { @Override public boolean bindService(Intent service, ServiceConnection conn, int flags) { - return bindService(service, conn, flags, UserId.getUserId(Process.myUid())); + warnIfCallingFromSystemProcess(); + return bindService(service, conn, flags, UserHandle.getUserId(Process.myUid())); } /** @hide */ @Override - public boolean bindService(Intent service, ServiceConnection conn, int flags, int userId) { + public boolean bindService(Intent service, ServiceConnection conn, int flags, int userHandle) { IServiceConnection sd; + if (conn == null) { + throw new IllegalArgumentException("connection is null"); + } if (mPackageInfo != null) { sd = mPackageInfo.getServiceDispatcher(conn, getOuterContext(), mMainThread.getHandler(), flags); @@ -1204,7 +1462,7 @@ public boolean bindService(Intent service, ServiceConnection conn, int flags, in int res = ActivityManagerNative.getDefault().bindService( mMainThread.getApplicationThread(), getActivityToken(), service, service.resolveTypeIfNeeded(getContentResolver()), - sd, flags, userId); + sd, flags, userHandle); if (res < 0) { throw new SecurityException( "Not allowed to bind to service " + service); @@ -1217,6 +1475,9 @@ public boolean bindService(Intent service, ServiceConnection conn, int flags, in @Override public void unbindService(ServiceConnection conn) { + if (conn == null) { + throw new IllegalArgumentException("connection is null"); + } if (mPackageInfo != null) { IServiceConnection sd = mPackageInfo.forgetServiceDispatcher( getOuterContext(), conn); @@ -1237,7 +1498,7 @@ public boolean startInstrumentation(ComponentName className, arguments.setAllowFds(false); } return ActivityManagerNative.getDefault().startInstrumentation( - className, profileFile, 0, arguments, null); + className, profileFile, 0, arguments, null, getUserId()); } catch (RemoteException e) { // System has crashed, nothing we can do. } @@ -1312,7 +1573,7 @@ private void enforce( (message != null ? (message + ": ") : "") + (selfToo ? "Neither user " + uid + " nor current process has " - : "User " + uid + " does not have ") + + : "uid " + uid + " does not have ") + permission + "."); } @@ -1482,21 +1743,37 @@ public void enforceUriPermission( message); } + private void warnIfCallingFromSystemProcess() { + if (Process.myUid() == Process.SYSTEM_UID) { + Slog.w(TAG, "Calling a method in the system process without a qualified user: " + + Debug.getCallers(3)); + } + } + @Override public Context createPackageContext(String packageName, int flags) - throws PackageManager.NameNotFoundException { + throws NameNotFoundException { + return createPackageContextAsUser(packageName, flags, + mUser != null ? mUser : Process.myUserHandle()); + } + + @Override + public Context createPackageContextAsUser(String packageName, int flags, UserHandle user) + throws NameNotFoundException { if (packageName.equals("system") || packageName.equals("android")) { final ContextImpl context = new ContextImpl(mMainThread.getSystemContext()); - context.mBasePackageName = mBasePackageName; + context.mRestricted = (flags & CONTEXT_RESTRICTED) == CONTEXT_RESTRICTED; + context.init(mPackageInfo, null, mMainThread, mResources, mBasePackageName, user); return context; } LoadedApk pi = - mMainThread.getPackageInfo(packageName, mResources.getCompatibilityInfo(), flags); + mMainThread.getPackageInfo(packageName, mResources.getCompatibilityInfo(), flags, + user.getIdentifier()); if (pi != null) { ContextImpl c = new ContextImpl(); c.mRestricted = (flags & CONTEXT_RESTRICTED) == CONTEXT_RESTRICTED; - c.init(pi, null, mMainThread, mResources, mBasePackageName); + c.init(pi, null, mMainThread, mResources, mBasePackageName, user); if (c.mResources != null) { return c; } @@ -1507,11 +1784,56 @@ public Context createPackageContext(String packageName, int flags) "Application package " + packageName + " not found"); } + @Override + public Context createConfigurationContext(Configuration overrideConfiguration) { + if (overrideConfiguration == null) { + throw new IllegalArgumentException("overrideConfiguration must not be null"); + } + + ContextImpl c = new ContextImpl(); + c.init(mPackageInfo, null, mMainThread); + c.mResources = mMainThread.getTopLevelResources( + mPackageInfo.getResDir(), + getDisplayId(), overrideConfiguration, + mResources.getCompatibilityInfo()); + return c; + } + + @Override + public Context createDisplayContext(Display display) { + if (display == null) { + throw new IllegalArgumentException("display must not be null"); + } + + int displayId = display.getDisplayId(); + CompatibilityInfo ci = CompatibilityInfo.DEFAULT_COMPATIBILITY_INFO; + CompatibilityInfoHolder cih = getCompatibilityInfo(displayId); + if (cih != null) { + ci = cih.get(); + } + + ContextImpl context = new ContextImpl(); + context.init(mPackageInfo, null, mMainThread); + context.mDisplay = display; + context.mResources = mMainThread.getTopLevelResources( + mPackageInfo.getResDir(), displayId, null, ci); + return context; + } + + private int getDisplayId() { + return mDisplay != null ? mDisplay.getDisplayId() : Display.DEFAULT_DISPLAY; + } + @Override public boolean isRestricted() { return mRestricted; } + @Override + public CompatibilityInfoHolder getCompatibilityInfo(int displayId) { + return displayId == Display.DEFAULT_DISPLAY ? mPackageInfo.mCompatibilityInfo : null; + } + private File getDataDirFile() { if (mPackageInfo != null) { return mPackageInfo.getDataDirFile(); @@ -1531,9 +1853,14 @@ public File getDir(String name, int mode) { return file; } + /** {@hide} */ + public int getUserId() { + return mUser.getIdentifier(); + } + static ContextImpl createSystemContext(ActivityThread mainThread) { - ContextImpl context = new ContextImpl(); - context.init(Resources.getSystem(), mainThread); + final ContextImpl context = new ContextImpl(); + context.init(Resources.getSystem(), mainThread, Process.myUserHandle()); return context; } @@ -1553,17 +1880,17 @@ public ContextImpl(ContextImpl context) { mResources = context.mResources; mMainThread = context.mMainThread; mContentResolver = context.mContentResolver; + mUser = context.mUser; + mDisplay = context.mDisplay; mOuterContext = this; } - final void init(LoadedApk packageInfo, - IBinder activityToken, ActivityThread mainThread) { - init(packageInfo, activityToken, mainThread, null, null); + final void init(LoadedApk packageInfo, IBinder activityToken, ActivityThread mainThread) { + init(packageInfo, activityToken, mainThread, null, null, Process.myUserHandle()); } - final void init(LoadedApk packageInfo, - IBinder activityToken, ActivityThread mainThread, - Resources container, String basePackageName) { + final void init(LoadedApk packageInfo, IBinder activityToken, ActivityThread mainThread, + Resources container, String basePackageName, UserHandle user) { mPackageInfo = packageInfo; mBasePackageName = basePackageName != null ? basePackageName : packageInfo.mPackageName; mResources = mPackageInfo.getResources(mainThread); @@ -1576,20 +1903,22 @@ final void init(LoadedApk packageInfo, " compatiblity info:" + container.getDisplayMetrics()); } mResources = mainThread.getTopLevelResources( - mPackageInfo.getResDir(), container.getCompatibilityInfo()); + mPackageInfo.getResDir(), Display.DEFAULT_DISPLAY, + null, container.getCompatibilityInfo()); } mMainThread = mainThread; - mContentResolver = new ApplicationContentResolver(this, mainThread); - - setActivityToken(activityToken); + mActivityToken = activityToken; + mContentResolver = new ApplicationContentResolver(this, mainThread, user); + mUser = user; } - final void init(Resources resources, ActivityThread mainThread) { + final void init(Resources resources, ActivityThread mainThread, UserHandle user) { mPackageInfo = null; mBasePackageName = null; mResources = resources; mMainThread = mainThread; - mContentResolver = new ApplicationContentResolver(this, mainThread); + mContentResolver = new ApplicationContentResolver(this, mainThread, user); + mUser = user; } final void scheduleFinalCleanup(String who, String what) { @@ -1608,10 +1937,6 @@ final Context getReceiverRestrictedContext() { return mReceiverRestrictedContext = new ReceiverRestrictedContext(getOuterContext()); } - final void setActivityToken(IBinder token) { - mActivityToken = token; - } - final void setOuterContext(Context context) { mOuterContext = context; } @@ -1678,19 +2003,24 @@ private File makeFilename(File base, String name) { // ---------------------------------------------------------------------- private static final class ApplicationContentResolver extends ContentResolver { - public ApplicationContentResolver(Context context, ActivityThread mainThread) { + private final ActivityThread mMainThread; + private final UserHandle mUser; + + public ApplicationContentResolver( + Context context, ActivityThread mainThread, UserHandle user) { super(context); - mMainThread = mainThread; + mMainThread = Preconditions.checkNotNull(mainThread); + mUser = Preconditions.checkNotNull(user); } @Override - protected IContentProvider acquireProvider(Context context, String name) { - return mMainThread.acquireProvider(context, name, true); + protected IContentProvider acquireProvider(Context context, String auth) { + return mMainThread.acquireProvider(context, auth, mUser.getIdentifier(), true); } @Override - protected IContentProvider acquireExistingProvider(Context context, String name) { - return mMainThread.acquireExistingProvider(context, name, true); + protected IContentProvider acquireExistingProvider(Context context, String auth) { + return mMainThread.acquireExistingProvider(context, auth, mUser.getIdentifier(), true); } @Override @@ -1699,8 +2029,8 @@ public boolean releaseProvider(IContentProvider provider) { } @Override - protected IContentProvider acquireUnstableProvider(Context c, String name) { - return mMainThread.acquireProvider(c, name, false); + protected IContentProvider acquireUnstableProvider(Context c, String auth) { + return mMainThread.acquireProvider(c, auth, mUser.getIdentifier(), false); } @Override @@ -1712,7 +2042,5 @@ public boolean releaseUnstableProvider(IContentProvider icp) { public void unstableProviderDied(IContentProvider icp) { mMainThread.handleUnstableProviderDied(icp.asBinder(), true); } - - private final ActivityThread mMainThread; } } diff --git a/core/java/android/app/Dialog.java b/core/java/android/app/Dialog.java index 2cc3b02e5080a..b3d99c5242f0e 100644 --- a/core/java/android/app/Dialog.java +++ b/core/java/android/app/Dialog.java @@ -147,15 +147,19 @@ public Dialog(Context context, int theme) { this(context, theme, true); } - Dialog(Context context, int theme, boolean createContextWrapper) { - if (theme == 0) { - TypedValue outValue = new TypedValue(); - context.getTheme().resolveAttribute(com.android.internal.R.attr.dialogTheme, - outValue, true); - theme = outValue.resourceId; + Dialog(Context context, int theme, boolean createContextThemeWrapper) { + if (createContextThemeWrapper) { + if (theme == 0) { + TypedValue outValue = new TypedValue(); + context.getTheme().resolveAttribute(com.android.internal.R.attr.dialogTheme, + outValue, true); + theme = outValue.resourceId; + } + mContext = new ContextThemeWrapper(context, theme); + } else { + mContext = context; } - mContext = createContextWrapper ? new ContextThemeWrapper(context, theme) : context; mWindowManager = (WindowManager)context.getSystemService(Context.WINDOW_SERVICE); Window w = PolicyManager.makeNewWindow(mContext); mWindow = w; @@ -164,7 +168,7 @@ public Dialog(Context context, int theme) { w.setGravity(Gravity.CENTER); mListenersHandler = new ListenersHandler(this); } - + /** * @deprecated * @hide @@ -1106,10 +1110,12 @@ public void cancel() { /** * Set a listener to be invoked when the dialog is canceled. - *

- * This will only be invoked when the dialog is canceled, if the creator - * needs to know when it is dismissed in general, use - * {@link #setOnDismissListener}. + * + *

This will only be invoked when the dialog is canceled. + * Cancel events alone will not capture all ways that + * the dialog might be dismissed. If the creator needs + * to know when a dialog is dismissed in general, use + * {@link #setOnDismissListener}.

* * @param listener The {@link DialogInterface.OnCancelListener} to use. */ diff --git a/core/java/android/app/DownloadManager.java b/core/java/android/app/DownloadManager.java index 17700f91213b2..6cf4dd0163df3 100644 --- a/core/java/android/app/DownloadManager.java +++ b/core/java/android/app/DownloadManager.java @@ -344,6 +344,13 @@ public static class Request { */ public static final int NETWORK_WIFI = 1 << 1; + /** + * Bit flag for {@link #setAllowedNetworkTypes} corresponding to + * {@link ConnectivityManager#TYPE_BLUETOOTH}. + * @hide + */ + public static final int NETWORK_BLUETOOTH = 1 << 2; + private Uri mUri; private Uri mDestinationUri; private List> mRequestHeaders = new ArrayList>(); @@ -1091,8 +1098,8 @@ public void restartDownload(long... ids) { */ public static Long getMaxBytesOverMobile(Context context) { try { - return Settings.Secure.getLong(context.getContentResolver(), - Settings.Secure.DOWNLOAD_MAX_BYTES_OVER_MOBILE); + return Settings.Global.getLong(context.getContentResolver(), + Settings.Global.DOWNLOAD_MAX_BYTES_OVER_MOBILE); } catch (SettingNotFoundException exc) { return null; } @@ -1109,8 +1116,8 @@ public static Long getMaxBytesOverMobile(Context context) { */ public static Long getRecommendedMaxBytesOverMobile(Context context) { try { - return Settings.Secure.getLong(context.getContentResolver(), - Settings.Secure.DOWNLOAD_RECOMMENDED_MAX_BYTES_OVER_MOBILE); + return Settings.Global.getLong(context.getContentResolver(), + Settings.Global.DOWNLOAD_RECOMMENDED_MAX_BYTES_OVER_MOBILE); } catch (SettingNotFoundException exc) { return null; } diff --git a/core/java/android/app/Fragment.java b/core/java/android/app/Fragment.java index 28876d3286d9a..c5a382d47dfd1 100644 --- a/core/java/android/app/Fragment.java +++ b/core/java/android/app/Fragment.java @@ -85,7 +85,7 @@ public FragmentState(Parcel in) { mSavedFragmentState = in.readBundle(); } - public Fragment instantiate(Activity activity) { + public Fragment instantiate(Activity activity, Fragment parent) { if (mInstance != null) { return mInstance; } @@ -100,7 +100,7 @@ public Fragment instantiate(Activity activity) { mSavedFragmentState.setClassLoader(activity.getClassLoader()); mInstance.mSavedFragmentState = mSavedFragmentState; } - mInstance.setIndex(mIndex); + mInstance.setIndex(mIndex, parent); mInstance.mFromLayout = mFromLayout; mInstance.mRestored = true; mInstance.mFragmentId = mFragmentId; @@ -207,6 +207,8 @@ public FragmentState[] newArray(int size) { * with the fragment. *
  • {@link #onActivityCreated} tells the fragment that its activity has * completed its own {@link Activity#onCreate Activity.onCreate()}. + *
  • {@link #onViewStateRestored} tells the fragment that all of the saved + * state of its view hierarchy has been restored. *
  • {@link #onStart} makes the fragment visible to the user (based on its * containing activity being started). *
  • {@link #onResume} makes the fragment interacting with the user (based on its @@ -412,7 +414,13 @@ public class Fragment implements ComponentCallbacks2, OnCreateContextMenuListene // Activity this fragment is attached to. Activity mActivity; - + + // Private fragment manager for child fragments inside of this one. + FragmentManagerImpl mChildFragmentManager; + + // If this Fragment is contained in another Fragment, this is that container. + Fragment mParentFragment; + // The optional identifier for this fragment -- either the container ID if it // was dynamically added to the view hierarchy, or the ID supplied in // layout. @@ -595,18 +603,28 @@ public static Fragment instantiate(Context context, String fname, Bundle args) { } } - final void restoreViewState() { + final void restoreViewState(Bundle savedInstanceState) { if (mSavedViewState != null) { mView.restoreHierarchyState(mSavedViewState); mSavedViewState = null; } + mCalled = false; + onViewStateRestored(savedInstanceState); + if (!mCalled) { + throw new SuperNotCalledException("Fragment " + this + + " did not call through to super.onViewStateRestored()"); + } } - - final void setIndex(int index) { + + final void setIndex(int index, Fragment parent) { mIndex = index; - mWho = "android:fragment:" + mIndex; - } - + if (parent != null) { + mWho = parent.mWho + ":" + mIndex; + } else { + mWho = "android:fragment:" + mIndex; + } + } + final boolean isInBackStack() { return mBackStackNesting > 0; } @@ -785,11 +803,42 @@ public final String getString(int resId, Object... formatArgs) { * before {@link #getActivity()}, during the time from when the fragment is * placed in a {@link FragmentTransaction} until it is committed and * attached to its activity. + * + *

    If this Fragment is a child of another Fragment, the FragmentManager + * returned here will be the parent's {@link #getChildFragmentManager()}. */ final public FragmentManager getFragmentManager() { return mFragmentManager; } + /** + * Return a private FragmentManager for placing and managing Fragments + * inside of this Fragment. + */ + final public FragmentManager getChildFragmentManager() { + if (mChildFragmentManager == null) { + instantiateChildFragmentManager(); + if (mState >= RESUMED) { + mChildFragmentManager.dispatchResume(); + } else if (mState >= STARTED) { + mChildFragmentManager.dispatchStart(); + } else if (mState >= ACTIVITY_CREATED) { + mChildFragmentManager.dispatchActivityCreated(); + } else if (mState >= CREATED) { + mChildFragmentManager.dispatchCreate(); + } + } + return mChildFragmentManager; + } + + /** + * Returns the parent Fragment containing this Fragment. If this Fragment + * is attached directly to an Activity, returns null. + */ + final public Fragment getParentFragment() { + return mParentFragment; + } + /** * Return true if the fragment is currently added to its activity. */ @@ -880,6 +929,10 @@ public void onHiddenChanged(boolean hidden) { * */ public void setRetainInstance(boolean retain) { + if (retain && mParentFragment != null) { + throw new IllegalStateException( + "Can't retain fragements that are nested in other fragments"); + } mRetainInstance = retain; } @@ -961,7 +1014,7 @@ public LoaderManager getLoaderManager() { throw new IllegalStateException("Fragment " + this + " not attached to Activity"); } mCheckedForLoaderManager = true; - mLoaderManager = mActivity.getLoaderManager(mIndex, mLoadersStarted, true); + mLoaderManager = mActivity.getLoaderManager(mWho, mLoadersStarted, true); return mLoaderManager; } @@ -1135,20 +1188,7 @@ public Animator onCreateAnimator(int transit, boolean enter, int nextAnim) { public void onCreate(Bundle savedInstanceState) { mCalled = true; } - - /** - * Called immediately after {@link #onCreateView(LayoutInflater, ViewGroup, Bundle)} - * has returned, but before any saved state has been restored in to the view. - * This gives subclasses a chance to initialize themselves once - * they know their view hierarchy has been completely created. The fragment's - * view hierarchy is not however attached to its parent at this point. - * @param view The View returned by {@link #onCreateView(LayoutInflater, ViewGroup, Bundle)}. - * @param savedInstanceState If non-null, this fragment is being re-constructed - * from a previous saved state as given here. - */ - public void onViewCreated(View view, Bundle savedInstanceState) { - } - + /** * Called to have the fragment instantiate its user interface view. * This is optional, and non-graphical fragments can return null (which @@ -1172,6 +1212,19 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { return null; } + + /** + * Called immediately after {@link #onCreateView(LayoutInflater, ViewGroup, Bundle)} + * has returned, but before any saved state has been restored in to the view. + * This gives subclasses a chance to initialize themselves once + * they know their view hierarchy has been completely created. The fragment's + * view hierarchy is not however attached to its parent at this point. + * @param view The View returned by {@link #onCreateView(LayoutInflater, ViewGroup, Bundle)}. + * @param savedInstanceState If non-null, this fragment is being re-constructed + * from a previous saved state as given here. + */ + public void onViewCreated(View view, Bundle savedInstanceState) { + } /** * Get the root view for the fragment's layout (the one returned by {@link #onCreateView}), @@ -1191,15 +1244,30 @@ public View getView() { * {@link #setRetainInstance(boolean)} to retain their instance, * as this callback tells the fragment when it is fully associated with * the new activity instance. This is called after {@link #onCreateView} - * and before {@link #onStart()}. - * + * and before {@link #onViewStateRestored(Bundle)}. + * * @param savedInstanceState If the fragment is being re-created from * a previous saved state, this is the state. */ public void onActivityCreated(Bundle savedInstanceState) { mCalled = true; } - + + /** + * Called when all saved state has been restored into the view hierarchy + * of the fragment. This can be used to do initialization based on saved + * state that you are letting the view hierarchy track itself, such as + * whether check box widgets are currently checked. This is called + * after {@link #onActivityCreated(Bundle)} and before + * {@link #onStart()}. + * + * @param savedInstanceState If the fragment is being re-created from + * a previous saved state, this is the state. + */ + public void onViewStateRestored(Bundle savedInstanceState) { + mCalled = true; + } + /** * Called when the Fragment is visible to the user. This is generally * tied to {@link Activity#onStart() Activity.onStart} of the containing @@ -1212,7 +1280,7 @@ public void onStart() { mLoadersStarted = true; if (!mCheckedForLoaderManager) { mCheckedForLoaderManager = true; - mLoaderManager = mActivity.getLoaderManager(mIndex, mLoadersStarted, false); + mLoaderManager = mActivity.getLoaderManager(mWho, mLoadersStarted, false); } if (mLoaderManager != null) { mLoaderManager.doStart(); @@ -1305,7 +1373,7 @@ public void onDestroy() { // + " mLoaderManager=" + mLoaderManager); if (!mCheckedForLoaderManager) { mCheckedForLoaderManager = true; - mLoaderManager = mActivity.getLoaderManager(mIndex, mLoadersStarted, false); + mLoaderManager = mActivity.getLoaderManager(mWho, mLoadersStarted, false); } if (mLoaderManager != null) { mLoaderManager.doDestroy(); @@ -1530,6 +1598,10 @@ public void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] writer.print(prefix); writer.print("mActivity="); writer.println(mActivity); } + if (mParentFragment != null) { + writer.print(prefix); writer.print("mParentFragment="); + writer.println(mParentFragment); + } if (mArguments != null) { writer.print(prefix); writer.print("mArguments="); writer.println(mArguments); } @@ -1564,23 +1636,244 @@ public void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] writer.print(prefix); writer.println("Loader Manager:"); mLoaderManager.dump(prefix + " ", fd, writer, args); } + if (mChildFragmentManager != null) { + writer.print(prefix); writer.println("Child " + mChildFragmentManager + ":"); + mChildFragmentManager.dump(prefix + " ", fd, writer, args); + } + } + + Fragment findFragmentByWho(String who) { + if (who.equals(mWho)) { + return this; + } + if (mChildFragmentManager != null) { + return mChildFragmentManager.findFragmentByWho(who); + } + return null; + } + + void instantiateChildFragmentManager() { + mChildFragmentManager = new FragmentManagerImpl(); + mChildFragmentManager.attachActivity(mActivity, new FragmentContainer() { + @Override + public View findViewById(int id) { + if (mView == null) { + throw new IllegalStateException("Fragment does not have a view"); + } + return mView.findViewById(id); + } + }, this); + } + + void performCreate(Bundle savedInstanceState) { + if (mChildFragmentManager != null) { + mChildFragmentManager.noteStateNotSaved(); + } + mCalled = false; + onCreate(savedInstanceState); + if (!mCalled) { + throw new SuperNotCalledException("Fragment " + this + + " did not call through to super.onCreate()"); + } + if (savedInstanceState != null) { + Parcelable p = savedInstanceState.getParcelable(Activity.FRAGMENTS_TAG); + if (p != null) { + if (mChildFragmentManager == null) { + instantiateChildFragmentManager(); + } + mChildFragmentManager.restoreAllState(p, null); + mChildFragmentManager.dispatchCreate(); + } + } + } + + View performCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + if (mChildFragmentManager != null) { + mChildFragmentManager.noteStateNotSaved(); + } + return onCreateView(inflater, container, savedInstanceState); + } + + void performActivityCreated(Bundle savedInstanceState) { + if (mChildFragmentManager != null) { + mChildFragmentManager.noteStateNotSaved(); + } + mCalled = false; + onActivityCreated(savedInstanceState); + if (!mCalled) { + throw new SuperNotCalledException("Fragment " + this + + " did not call through to super.onActivityCreated()"); + } + if (mChildFragmentManager != null) { + mChildFragmentManager.dispatchActivityCreated(); + } } void performStart() { + if (mChildFragmentManager != null) { + mChildFragmentManager.noteStateNotSaved(); + mChildFragmentManager.execPendingActions(); + } + mCalled = false; onStart(); + if (!mCalled) { + throw new SuperNotCalledException("Fragment " + this + + " did not call through to super.onStart()"); + } + if (mChildFragmentManager != null) { + mChildFragmentManager.dispatchStart(); + } if (mLoaderManager != null) { mLoaderManager.doReportStart(); } } + void performResume() { + if (mChildFragmentManager != null) { + mChildFragmentManager.noteStateNotSaved(); + mChildFragmentManager.execPendingActions(); + } + mCalled = false; + onResume(); + if (!mCalled) { + throw new SuperNotCalledException("Fragment " + this + + " did not call through to super.onResume()"); + } + if (mChildFragmentManager != null) { + mChildFragmentManager.dispatchResume(); + mChildFragmentManager.execPendingActions(); + } + } + + void performConfigurationChanged(Configuration newConfig) { + onConfigurationChanged(newConfig); + if (mChildFragmentManager != null) { + mChildFragmentManager.dispatchConfigurationChanged(newConfig); + } + } + + void performLowMemory() { + onLowMemory(); + if (mChildFragmentManager != null) { + mChildFragmentManager.dispatchLowMemory(); + } + } + + void performTrimMemory(int level) { + onTrimMemory(level); + if (mChildFragmentManager != null) { + mChildFragmentManager.dispatchTrimMemory(level); + } + } + + boolean performCreateOptionsMenu(Menu menu, MenuInflater inflater) { + boolean show = false; + if (!mHidden) { + if (mHasMenu && mMenuVisible) { + show = true; + onCreateOptionsMenu(menu, inflater); + } + if (mChildFragmentManager != null) { + show |= mChildFragmentManager.dispatchCreateOptionsMenu(menu, inflater); + } + } + return show; + } + + boolean performPrepareOptionsMenu(Menu menu) { + boolean show = false; + if (!mHidden) { + if (mHasMenu && mMenuVisible) { + show = true; + onPrepareOptionsMenu(menu); + } + if (mChildFragmentManager != null) { + show |= mChildFragmentManager.dispatchPrepareOptionsMenu(menu); + } + } + return show; + } + + boolean performOptionsItemSelected(MenuItem item) { + if (!mHidden) { + if (mHasMenu && mMenuVisible) { + if (onOptionsItemSelected(item)) { + return true; + } + } + if (mChildFragmentManager != null) { + if (mChildFragmentManager.dispatchOptionsItemSelected(item)) { + return true; + } + } + } + return false; + } + + boolean performContextItemSelected(MenuItem item) { + if (!mHidden) { + if (onContextItemSelected(item)) { + return true; + } + if (mChildFragmentManager != null) { + if (mChildFragmentManager.dispatchContextItemSelected(item)) { + return true; + } + } + } + return false; + } + + void performOptionsMenuClosed(Menu menu) { + if (!mHidden) { + if (mHasMenu && mMenuVisible) { + onOptionsMenuClosed(menu); + } + if (mChildFragmentManager != null) { + mChildFragmentManager.dispatchOptionsMenuClosed(menu); + } + } + } + + void performSaveInstanceState(Bundle outState) { + onSaveInstanceState(outState); + if (mChildFragmentManager != null) { + Parcelable p = mChildFragmentManager.saveAllState(); + if (p != null) { + outState.putParcelable(Activity.FRAGMENTS_TAG, p); + } + } + } + + void performPause() { + if (mChildFragmentManager != null) { + mChildFragmentManager.dispatchPause(); + } + mCalled = false; + onPause(); + if (!mCalled) { + throw new SuperNotCalledException("Fragment " + this + + " did not call through to super.onPause()"); + } + } + void performStop() { + if (mChildFragmentManager != null) { + mChildFragmentManager.dispatchStop(); + } + mCalled = false; onStop(); + if (!mCalled) { + throw new SuperNotCalledException("Fragment " + this + + " did not call through to super.onStop()"); + } if (mLoadersStarted) { mLoadersStarted = false; if (!mCheckedForLoaderManager) { mCheckedForLoaderManager = true; - mLoaderManager = mActivity.getLoaderManager(mIndex, mLoadersStarted, false); + mLoaderManager = mActivity.getLoaderManager(mWho, mLoadersStarted, false); } if (mLoaderManager != null) { if (mActivity == null || !mActivity.mChangingConfigurations) { @@ -1593,9 +1886,29 @@ void performStop() { } void performDestroyView() { + if (mChildFragmentManager != null) { + mChildFragmentManager.dispatchDestroyView(); + } + mCalled = false; onDestroyView(); + if (!mCalled) { + throw new SuperNotCalledException("Fragment " + this + + " did not call through to super.onDestroyView()"); + } if (mLoaderManager != null) { mLoaderManager.doReportNextStart(); } } + + void performDestroy() { + if (mChildFragmentManager != null) { + mChildFragmentManager.dispatchDestroy(); + } + mCalled = false; + onDestroy(); + if (!mCalled) { + throw new SuperNotCalledException("Fragment " + this + + " did not call through to super.onDestroy()"); + } + } } diff --git a/core/java/android/app/FragmentBreadCrumbs.java b/core/java/android/app/FragmentBreadCrumbs.java index df64035b4be99..b810b893b7046 100644 --- a/core/java/android/app/FragmentBreadCrumbs.java +++ b/core/java/android/app/FragmentBreadCrumbs.java @@ -19,7 +19,9 @@ import android.animation.LayoutTransition; import android.app.FragmentManager.BackStackEntry; import android.content.Context; +import android.content.res.TypedArray; import android.util.AttributeSet; +import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -51,7 +53,11 @@ public class FragmentBreadCrumbs extends ViewGroup private OnClickListener mParentClickListener; private OnBreadCrumbClickListener mOnBreadCrumbClickListener; - + + private int mGravity; + + private static final int DEFAULT_GRAVITY = Gravity.START | Gravity.CENTER_VERTICAL; + /** * Interface to intercept clicks on the bread crumbs. */ @@ -80,6 +86,14 @@ public FragmentBreadCrumbs(Context context, AttributeSet attrs) { public FragmentBreadCrumbs(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); + + TypedArray a = context.obtainStyledAttributes(attrs, + com.android.internal.R.styleable.FragmentBreadCrumbs, defStyle, 0); + + mGravity = a.getInt(com.android.internal.R.styleable.FragmentBreadCrumbs_gravity, + DEFAULT_GRAVITY); + + a.recycle(); } /** @@ -159,16 +173,50 @@ public void setTitle(CharSequence title, CharSequence shortTitle) { @Override protected void onLayout(boolean changed, int l, int t, int r, int b) { - // Eventually we should implement our own layout of the views, - // rather than relying on a linear layout. + // Eventually we should implement our own layout of the views, rather than relying on + // a single linear layout. final int childCount = getChildCount(); - for (int i = 0; i < childCount; i++) { - final View child = getChildAt(i); + if (childCount == 0) { + return; + } + + final View child = getChildAt(0); - int childRight = mPaddingLeft + child.getMeasuredWidth() - mPaddingRight; - int childBottom = mPaddingTop + child.getMeasuredHeight() - mPaddingBottom; - child.layout(mPaddingLeft, mPaddingTop, childRight, childBottom); + final int childTop = mPaddingTop; + final int childBottom = mPaddingTop + child.getMeasuredHeight() - mPaddingBottom; + + int childLeft; + int childRight; + + final int layoutDirection = getLayoutDirection(); + final int horizontalGravity = mGravity & Gravity.RELATIVE_HORIZONTAL_GRAVITY_MASK; + switch (Gravity.getAbsoluteGravity(horizontalGravity, layoutDirection)) { + case Gravity.RIGHT: + childRight = mRight - mLeft - mPaddingRight; + childLeft = childRight - child.getMeasuredWidth(); + break; + + case Gravity.CENTER_HORIZONTAL: + childLeft = mPaddingLeft + (mRight - mLeft - child.getMeasuredWidth()) / 2; + childRight = childLeft + child.getMeasuredWidth(); + break; + + case Gravity.LEFT: + default: + childLeft = mPaddingLeft; + childRight = childLeft + child.getMeasuredWidth(); + break; } + + if (childLeft < mPaddingLeft) { + childLeft = mPaddingLeft; + } + + if (childRight > mRight - mLeft - mPaddingRight) { + childRight = mRight - mLeft - mPaddingRight; + } + + child.layout(childLeft, childTop, childRight, childBottom); } @Override diff --git a/core/java/android/app/FragmentManager.java b/core/java/android/app/FragmentManager.java index 39e24239ecb7e..10ea109edc080 100644 --- a/core/java/android/app/FragmentManager.java +++ b/core/java/android/app/FragmentManager.java @@ -22,6 +22,7 @@ import android.content.res.Configuration; import android.content.res.TypedArray; import android.os.Bundle; +import android.os.Debug; import android.os.Handler; import android.os.Looper; import android.os.Parcel; @@ -29,7 +30,6 @@ import android.util.DebugUtils; import android.util.Log; import android.util.LogWriter; -import android.util.Slog; import android.util.SparseArray; import android.view.Menu; import android.view.MenuInflater; @@ -317,6 +317,12 @@ public FragmentTransaction openTransaction() { */ public abstract Fragment.SavedState saveFragmentInstanceState(Fragment f); + /** + * Returns true if the final {@link Activity#onDestroy() Activity.onDestroy()} + * call has been made on the FragmentManager's Activity, so this instance is now dead. + */ + public abstract boolean isDestroyed(); + /** * Print the FragmentManager's state into the given stream. * @@ -379,6 +385,13 @@ public FragmentManagerState[] newArray(int size) { }; } +/** + * Callbacks from FragmentManagerImpl to its container. + */ +interface FragmentContainer { + public View findViewById(int id); +} + /** * Container for fragments associated with an activity. */ @@ -409,6 +422,8 @@ final class FragmentManagerImpl extends FragmentManager { int mCurState = Fragment.INITIALIZING; Activity mActivity; + FragmentContainer mContainer; + Fragment mParent; boolean mNeedMenuInvalidate; boolean mStateSaved; @@ -427,6 +442,28 @@ public void run() { } }; + private void throwException(RuntimeException ex) { + Log.e(TAG, ex.getMessage()); + LogWriter logw = new LogWriter(Log.ERROR, TAG); + PrintWriter pw = new PrintWriter(logw); + if (mActivity != null) { + Log.e(TAG, "Activity state:"); + try { + mActivity.dump(" ", null, pw, new String[] { }); + } catch (Exception e) { + Log.e(TAG, "Failed dumping state", e); + } + } else { + Log.e(TAG, "Fragment manager state:"); + try { + dump(" ", null, pw, new String[] { }); + } catch (Exception e) { + Log.e(TAG, "Failed dumping state", e); + } + } + throw ex; + } + @Override public FragmentTransaction beginTransaction() { return new BackStackRecord(this); @@ -519,8 +556,8 @@ public void removeOnBackStackChangedListener(OnBackStackChangedListener listener @Override public void putFragment(Bundle bundle, String key, Fragment fragment) { if (fragment.mIndex < 0) { - throw new IllegalStateException("Fragment " + fragment - + " is not currently in the FragmentManager"); + throwException(new IllegalStateException("Fragment " + fragment + + " is not currently in the FragmentManager")); } bundle.putInt(key, fragment.mIndex); } @@ -532,13 +569,13 @@ public Fragment getFragment(Bundle bundle, String key) { return null; } if (index >= mActive.size()) { - throw new IllegalStateException("Fragement no longer exists for key " - + key + ": index " + index); + throwException(new IllegalStateException("Fragement no longer exists for key " + + key + ": index " + index)); } Fragment f = mActive.get(index); if (f == null) { - throw new IllegalStateException("Fragement no longer exists for key " - + key + ": index " + index); + throwException(new IllegalStateException("Fragement no longer exists for key " + + key + ": index " + index)); } return f; } @@ -546,8 +583,8 @@ public Fragment getFragment(Bundle bundle, String key) { @Override public Fragment.SavedState saveFragmentInstanceState(Fragment fragment) { if (fragment.mIndex < 0) { - throw new IllegalStateException("Fragment " + fragment - + " is not currently in the FragmentManager"); + throwException(new IllegalStateException("Fragment " + fragment + + " is not currently in the FragmentManager")); } if (fragment.mState > Fragment.INITIALIZING) { Bundle result = saveFragmentBasicState(fragment); @@ -556,13 +593,22 @@ public Fragment.SavedState saveFragmentInstanceState(Fragment fragment) { return null; } + @Override + public boolean isDestroyed() { + return mDestroyed; + } + @Override public String toString() { StringBuilder sb = new StringBuilder(128); sb.append("FragmentManager{"); sb.append(Integer.toHexString(System.identityHashCode(this))); sb.append(" in "); - DebugUtils.buildShortClassTag(mActivity, sb); + if (mParent != null) { + DebugUtils.buildShortClassTag(mParent, sb); + } else { + DebugUtils.buildShortClassTag(mActivity, sb); + } sb.append("}}"); return sb.toString(); } @@ -658,6 +704,11 @@ public void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] } writer.print(prefix); writer.println("FragmentManager misc state:"); + writer.print(prefix); writer.print(" mActivity="); writer.println(mActivity); + writer.print(prefix); writer.print(" mContainer="); writer.println(mContainer); + if (mParent != null) { + writer.print(prefix); writer.print(" mParent="); writer.println(mParent); + } writer.print(prefix); writer.print(" mCurState="); writer.print(mCurState); writer.print(" mStateSaved="); writer.print(mStateSaved); writer.print(" mDestroyed="); writer.println(mDestroyed); @@ -732,8 +783,12 @@ public void performPendingDeferredStart(Fragment f) { void moveToState(Fragment f, int newState, int transit, int transitionStyle, boolean keepActive) { + if (DEBUG && false) Log.v(TAG, "moveToState: " + f + + " oldState=" + f.mState + " newState=" + newState + + " mRemoving=" + f.mRemoving + " Callers=" + Debug.getCallers(5)); + // Fragments that are not currently added will sit in the onCreate() state. - if (!f.mAdded && newState > Fragment.CREATED) { + if ((!f.mAdded || f.mDetached) && newState > Fragment.CREATED) { newState = Fragment.CREATED; } if (f.mRemoving && newState > f.mState) { @@ -782,30 +837,29 @@ void moveToState(Fragment f, int newState, int transit, int transitionStyle, } } f.mActivity = mActivity; - f.mFragmentManager = mActivity.mFragments; + f.mParentFragment = mParent; + f.mFragmentManager = mParent != null + ? mParent.mChildFragmentManager : mActivity.mFragments; f.mCalled = false; f.onAttach(mActivity); if (!f.mCalled) { throw new SuperNotCalledException("Fragment " + f + " did not call through to super.onAttach()"); } - mActivity.onAttachFragment(f); - + if (f.mParentFragment == null) { + mActivity.onAttachFragment(f); + } + if (!f.mRetaining) { - f.mCalled = false; - f.onCreate(f.mSavedFragmentState); - if (!f.mCalled) { - throw new SuperNotCalledException("Fragment " + f - + " did not call through to super.onCreate()"); - } + f.performCreate(f.mSavedFragmentState); } f.mRetaining = false; if (f.mFromLayout) { // For fragments that are part of the content view // layout, we need to instantiate the view immediately // and the inflater will take care of adding it. - f.mView = f.onCreateView(f.getLayoutInflater(f.mSavedFragmentState), - null, f.mSavedFragmentState); + f.mView = f.performCreateView(f.getLayoutInflater( + f.mSavedFragmentState), null, f.mSavedFragmentState); if (f.mView != null) { f.mView.setSaveFromParentEnabled(false); if (f.mHidden) f.mView.setVisibility(View.GONE); @@ -818,16 +872,18 @@ void moveToState(Fragment f, int newState, int transit, int transitionStyle, if (!f.mFromLayout) { ViewGroup container = null; if (f.mContainerId != 0) { - container = (ViewGroup)mActivity.findViewById(f.mContainerId); + container = (ViewGroup)mContainer.findViewById(f.mContainerId); if (container == null && !f.mRestored) { - throw new IllegalArgumentException("No view found for id 0x" - + Integer.toHexString(f.mContainerId) - + " for fragment " + f); + throwException(new IllegalArgumentException( + "No view found for id 0x" + + Integer.toHexString(f.mContainerId) + " (" + + f.getResources().getResourceName(f.mContainerId) + + ") for fragment " + f)); } } f.mContainer = container; - f.mView = f.onCreateView(f.getLayoutInflater(f.mSavedFragmentState), - container, f.mSavedFragmentState); + f.mView = f.performCreateView(f.getLayoutInflater( + f.mSavedFragmentState), container, f.mSavedFragmentState); if (f.mView != null) { f.mView.setSaveFromParentEnabled(false); if (container != null) { @@ -843,15 +899,10 @@ void moveToState(Fragment f, int newState, int transit, int transitionStyle, f.onViewCreated(f.mView, f.mSavedFragmentState); } } - - f.mCalled = false; - f.onActivityCreated(f.mSavedFragmentState); - if (!f.mCalled) { - throw new SuperNotCalledException("Fragment " + f - + " did not call through to super.onActivityCreated()"); - } + + f.performActivityCreated(f.mSavedFragmentState); if (f.mView != null) { - f.restoreViewState(); + f.restoreViewState(f.mSavedFragmentState); } f.mSavedFragmentState = null; } @@ -859,23 +910,13 @@ void moveToState(Fragment f, int newState, int transit, int transitionStyle, case Fragment.STOPPED: if (newState > Fragment.STOPPED) { if (DEBUG) Log.v(TAG, "moveto STARTED: " + f); - f.mCalled = false; f.performStart(); - if (!f.mCalled) { - throw new SuperNotCalledException("Fragment " + f - + " did not call through to super.onStart()"); - } } case Fragment.STARTED: if (newState > Fragment.STARTED) { if (DEBUG) Log.v(TAG, "moveto RESUMED: " + f); - f.mCalled = false; f.mResumed = true; - f.onResume(); - if (!f.mCalled) { - throw new SuperNotCalledException("Fragment " + f - + " did not call through to super.onResume()"); - } + f.performResume(); // Get rid of this in case we saved it and never needed it. f.mSavedFragmentState = null; f.mSavedViewState = null; @@ -886,23 +927,13 @@ void moveToState(Fragment f, int newState, int transit, int transitionStyle, case Fragment.RESUMED: if (newState < Fragment.RESUMED) { if (DEBUG) Log.v(TAG, "movefrom RESUMED: " + f); - f.mCalled = false; - f.onPause(); - if (!f.mCalled) { - throw new SuperNotCalledException("Fragment " + f - + " did not call through to super.onPause()"); - } + f.performPause(); f.mResumed = false; } case Fragment.STARTED: if (newState < Fragment.STARTED) { if (DEBUG) Log.v(TAG, "movefrom STARTED: " + f); - f.mCalled = false; f.performStop(); - if (!f.mCalled) { - throw new SuperNotCalledException("Fragment " + f - + " did not call through to super.onStop()"); - } } case Fragment.STOPPED: case Fragment.ACTIVITY_CREATED: @@ -915,12 +946,7 @@ void moveToState(Fragment f, int newState, int transit, int transitionStyle, saveFragmentViewState(f); } } - f.mCalled = false; f.performDestroyView(); - if (!f.mCalled) { - throw new SuperNotCalledException("Fragment " + f - + " did not call through to super.onDestroyView()"); - } if (f.mView != null && f.mContainer != null) { Animator anim = null; if (mCurState > Fragment.INITIALIZING && !mDestroyed) { @@ -979,12 +1005,7 @@ public void onAnimationEnd(Animator anim) { } else { if (DEBUG) Log.v(TAG, "movefrom CREATED: " + f); if (!f.mRetaining) { - f.mCalled = false; - f.onDestroy(); - if (!f.mCalled) { - throw new SuperNotCalledException("Fragment " + f - + " did not call through to super.onDestroy()"); - } + f.performDestroy(); } f.mCalled = false; @@ -998,6 +1019,7 @@ public void onAnimationEnd(Animator anim) { makeInactive(f); } else { f.mActivity = null; + f.mParentFragment = null; f.mFragmentManager = null; } } @@ -1021,11 +1043,11 @@ void moveToState(int newState, int transit, int transitStyle, boolean always) { if (mActivity == null && newState != Fragment.INITIALIZING) { throw new IllegalStateException("No activity"); } - + if (!always && mCurState == newState) { return; } - + mCurState = newState; if (mActive != null) { boolean loadersRunning = false; @@ -1070,11 +1092,11 @@ void makeActive(Fragment f) { if (mActive == null) { mActive = new ArrayList(); } - f.setIndex(mActive.size()); + f.setIndex(mActive.size(), mParent); mActive.add(f); } else { - f.setIndex(mAvailIndices.remove(mAvailIndices.size()-1)); + f.setIndex(mAvailIndices.remove(mAvailIndices.size()-1), mParent); mActive.set(f.mIndex, f); } if (DEBUG) Log.v(TAG, "Allocated fragment index " + f); @@ -1091,7 +1113,7 @@ void makeInactive(Fragment f) { mAvailIndices = new ArrayList(); } mAvailIndices.add(f.mIndex); - mActivity.invalidateFragmentIndex(f.mIndex); + mActivity.invalidateFragment(f.mWho); f.initState(); } @@ -1102,6 +1124,9 @@ public void addFragment(Fragment fragment, boolean moveToStateNow) { if (DEBUG) Log.v(TAG, "add: " + fragment); makeActive(fragment); if (!fragment.mDetached) { + if (mAdded.contains(fragment)) { + throw new IllegalStateException("Fragment already added: " + fragment); + } mAdded.add(fragment); fragment.mAdded = true; fragment.mRemoving = false; @@ -1118,6 +1143,14 @@ public void removeFragment(Fragment fragment, int transition, int transitionStyl if (DEBUG) Log.v(TAG, "remove: " + fragment + " nesting=" + fragment.mBackStackNesting); final boolean inactive = !fragment.isInBackStack(); if (!fragment.mDetached || inactive) { + if (false) { + // Would be nice to catch a bad remove here, but we need + // time to test this to make sure we aren't crashes cases + // where it is not a problem. + if (!mAdded.contains(fragment)) { + throw new IllegalStateException("Fragment not added: " + fragment); + } + } if (mAdded != null) { mAdded.remove(fragment); } @@ -1190,6 +1223,7 @@ public void detachFragment(Fragment fragment, int transition, int transitionStyl if (fragment.mAdded) { // We are not already in back stack, so need to remove the fragment. if (mAdded != null) { + if (DEBUG) Log.v(TAG, "remove from detach: " + fragment); mAdded.remove(fragment); } if (fragment.mHasMenu && fragment.mMenuVisible) { @@ -1209,6 +1243,10 @@ public void attachFragment(Fragment fragment, int transition, int transitionStyl if (mAdded == null) { mAdded = new ArrayList(); } + if (mAdded.contains(fragment)) { + throw new IllegalStateException("Fragment already added: " + fragment); + } + if (DEBUG) Log.v(TAG, "add from attach: " + fragment); mAdded.add(fragment); fragment.mAdded = true; if (fragment.mHasMenu && fragment.mMenuVisible) { @@ -1267,7 +1305,7 @@ public Fragment findFragmentByWho(String who) { if (mActive != null && who != null) { for (int i=mActive.size()-1; i>=0; i--) { Fragment f = mActive.get(i); - if (f != null && who.equals(f.mWho)) { + if (f != null && (f=f.findFragmentByWho(who)) != null) { return f; } } @@ -1537,7 +1575,7 @@ Bundle saveFragmentBasicState(Fragment f) { if (mStateBundle == null) { mStateBundle = new Bundle(); } - f.onSaveInstanceState(mStateBundle); + f.performSaveInstanceState(mStateBundle); if (!mStateBundle.isEmpty()) { result = mStateBundle; mStateBundle = null; @@ -1583,12 +1621,9 @@ Parcelable saveAllState() { Fragment f = mActive.get(i); if (f != null) { if (f.mIndex < 0) { - String msg = "Failure saving state: active " + f - + " has cleared index: " + f.mIndex; - Slog.e(TAG, msg); - dump(" ", null, new PrintWriter(new LogWriter( - Log.ERROR, TAG, Log.LOG_ID_SYSTEM)), new String[] { }); - throw new IllegalStateException(msg); + throwException(new IllegalStateException( + "Failure saving state: active " + f + + " has cleared index: " + f.mIndex)); } haveFragments = true; @@ -1601,12 +1636,9 @@ Parcelable saveAllState() { if (f.mTarget != null) { if (f.mTarget.mIndex < 0) { - String msg = "Failure saving state: " + f - + " has target not in fragment manager: " + f.mTarget; - Slog.e(TAG, msg); - dump(" ", null, new PrintWriter(new LogWriter( - Log.ERROR, TAG, Log.LOG_ID_SYSTEM)), new String[] { }); - throw new IllegalStateException(msg); + throwException(new IllegalStateException( + "Failure saving state: " + f + + " has target not in fragment manager: " + f.mTarget)); } if (fs.mSavedFragmentState == null) { fs.mSavedFragmentState = new Bundle(); @@ -1645,12 +1677,9 @@ Parcelable saveAllState() { for (int i=0; i nonConfig) { for (int i=0; i(); } - if (DEBUG) Log.v(TAG, "restoreAllState: adding avail #" + i); + if (DEBUG) Log.v(TAG, "restoreAllState: avail #" + i); mAvailIndices.add(i); } } @@ -1755,11 +1783,14 @@ void restoreAllState(Parcelable state, ArrayList nonConfig) { for (int i=0; i nonConfig) { mBackStack = new ArrayList(fms.mBackStack.length); for (int i=0; i= 0) { setBackStackIndex(bse.mIndex, bse); @@ -1783,9 +1819,11 @@ void restoreAllState(Parcelable state, ArrayList nonConfig) { } } - public void attachActivity(Activity activity) { - if (mActivity != null) throw new IllegalStateException(); + public void attachActivity(Activity activity, FragmentContainer container, Fragment parent) { + if (mActivity != null) throw new IllegalStateException("Already attached"); mActivity = activity; + mContainer = container; + mParent = parent; } public void noteStateNotSaved() { @@ -1820,11 +1858,17 @@ public void dispatchStop() { moveToState(Fragment.STOPPED, false); } + public void dispatchDestroyView() { + moveToState(Fragment.CREATED, false); + } + public void dispatchDestroy() { mDestroyed = true; execPendingActions(); moveToState(Fragment.INITIALIZING, false); mActivity = null; + mContainer = null; + mParent = null; } public void dispatchConfigurationChanged(Configuration newConfig) { @@ -1832,7 +1876,7 @@ public void dispatchConfigurationChanged(Configuration newConfig) { for (int i=0; i(); + if (f != null) { + if (f.performCreateOptionsMenu(menu, inflater)) { + show = true; + if (newMenus == null) { + newMenus = new ArrayList(); + } + newMenus.add(f); } - newMenus.add(f); } } } @@ -1896,9 +1941,10 @@ public boolean dispatchPrepareOptionsMenu(Menu menu) { if (mAdded != null) { for (int i=0; i getRecentTasks(int maxNum, - int flags) throws RemoteException; + int flags, int userId) throws RemoteException; public ActivityManager.TaskThumbnails getTaskThumbnails(int taskId) throws RemoteException; + public Bitmap getTaskTopThumbnail(int taskId) throws RemoteException; public List getServices(int maxNum, int flags) throws RemoteException; public List getProcessesInErrorState() throws RemoteException; @@ -116,8 +117,8 @@ public List getProcessesInErrorState() public void reportThumbnail(IBinder token, Bitmap thumbnail, CharSequence description) throws RemoteException; public ContentProviderHolder getContentProvider(IApplicationThread caller, - String name, boolean stable) throws RemoteException; - public ContentProviderHolder getContentProviderExternal(String name, IBinder token) + String name, int userId, boolean stable) throws RemoteException; + public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token) throws RemoteException; public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException; public void removeContentProviderExternal(String name, IBinder token) throws RemoteException; @@ -129,9 +130,9 @@ public boolean refContentProvider(IBinder connection, int stableDelta, int unsta public PendingIntent getRunningServiceControlPanel(ComponentName service) throws RemoteException; public ComponentName startService(IApplicationThread caller, Intent service, - String resolvedType) throws RemoteException; + String resolvedType, int userId) throws RemoteException; public int stopService(IApplicationThread caller, Intent service, - String resolvedType) throws RemoteException; + String resolvedType, int userId) throws RemoteException; public boolean stopServiceToken(ComponentName className, IBinder token, int startId) throws RemoteException; public void setServiceForeground(ComponentName className, IBinder token, @@ -151,12 +152,13 @@ public void serviceDoneExecuting(IBinder token, int type, int startId, public boolean bindBackupAgent(ApplicationInfo appInfo, int backupRestoreMode) throws RemoteException; + public void clearPendingBackup() throws RemoteException; public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException; public void unbindBackupAgent(ApplicationInfo appInfo) throws RemoteException; public void killApplicationProcess(String processName, int uid) throws RemoteException; public boolean startInstrumentation(ComponentName className, String profileFile, - int flags, Bundle arguments, IInstrumentationWatcher watcher) + int flags, Bundle arguments, IInstrumentationWatcher watcher, int userId) throws RemoteException; public void finishInstrumentation(IApplicationThread target, int resultCode, Bundle results) throws RemoteException; @@ -173,13 +175,16 @@ public void setRequestedOrientation(IBinder token, public IIntentSender getIntentSender(int type, String packageName, IBinder token, String resultWho, int requestCode, Intent[] intents, String[] resolvedTypes, - int flags, Bundle options) throws RemoteException; + int flags, Bundle options, int userId) throws RemoteException; public void cancelIntentSender(IIntentSender sender) throws RemoteException; public boolean clearApplicationUserData(final String packageName, final IPackageDataObserver observer, int userId) throws RemoteException; public String getPackageForIntentSender(IIntentSender sender) throws RemoteException; public int getUidForIntentSender(IIntentSender sender) throws RemoteException; + public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll, + boolean requireFull, String name, String callerPackage) throws RemoteException; + public void setProcessLimit(int max) throws RemoteException; public int getProcessLimit() throws RemoteException; @@ -201,9 +206,10 @@ public void showWaitingForDebugger(IApplicationThread who, boolean waiting) public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException; - public void killBackgroundProcesses(final String packageName) throws RemoteException; + public void killBackgroundProcesses(final String packageName, int userId) + throws RemoteException; public void killAllBackgroundProcesses() throws RemoteException; - public void forceStopPackage(final String packageName) throws RemoteException; + public void forceStopPackage(final String packageName, int userId) throws RemoteException; // Note: probably don't want to allow applications access to these. public void goingToSleep() throws RemoteException; @@ -260,7 +266,7 @@ public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo) public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException; // Turn on/off profiling in a particular process. - public boolean profileControl(String process, boolean start, + public boolean profileControl(String process, int userId, boolean start, String path, ParcelFileDescriptor fd, int profileType) throws RemoteException; public boolean shutdown(int timeout) throws RemoteException; @@ -268,12 +274,7 @@ public boolean profileControl(String process, boolean start, public void stopAppSwitches() throws RemoteException; public void resumeAppSwitches() throws RemoteException; - public int startActivityInPackage(int uid, - Intent intent, String resolvedType, IBinder resultTo, - String resultWho, int requestCode, int startFlags, Bundle options) - throws RemoteException; - - public void killApplicationWithUid(String pkg, int uid) throws RemoteException; + public void killApplicationWithAppId(String pkg, int appid) throws RemoteException; public void closeSystemDialogs(String reason) throws RemoteException; @@ -294,7 +295,7 @@ public void overridePendingTransition(IBinder token, String packageName, public void crashApplication(int uid, int initialPid, String packageName, String message) throws RemoteException; - public String getProviderMimeType(Uri uri) throws RemoteException; + public String getProviderMimeType(Uri uri, int userId) throws RemoteException; public IBinder newUriPermissionOwner(String name) throws RemoteException; public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg, @@ -306,15 +307,12 @@ public int checkGrantUriPermission(int callingUid, String targetPkg, Uri uri, int modeFlags) throws RemoteException; // Cause the specified process to dump the specified heap. - public boolean dumpHeap(String process, boolean managed, String path, + public boolean dumpHeap(String process, int userId, boolean managed, String path, ParcelFileDescriptor fd) throws RemoteException; public int startActivities(IApplicationThread caller, Intent[] intents, String[] resolvedTypes, IBinder resultTo, - Bundle options) throws RemoteException; - public int startActivitiesInPackage(int uid, - Intent[] intents, String[] resolvedTypes, IBinder resultTo, - Bundle options) throws RemoteException; + Bundle options, int userId) throws RemoteException; public int getFrontActivityScreenCompatMode() throws RemoteException; public void setFrontActivityScreenCompatMode(int mode) throws RemoteException; @@ -327,7 +325,10 @@ public void setPackageAskScreenCompat(String packageName, boolean ask) // Multi-user APIs public boolean switchUser(int userid) throws RemoteException; + public int stopUser(int userid, IStopUserCallback callback) throws RemoteException; public UserInfo getCurrentUser() throws RemoteException; + public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException; + public int[] getRunningUserIds() throws RemoteException; public boolean removeSubTask(int taskId, int subTaskIndex) throws RemoteException; @@ -358,6 +359,13 @@ public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent // manage your activity to make sure it is always the uid you expect. public int getLaunchedFromUid(IBinder activityToken) throws RemoteException; + public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException; + public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException; + + public void requestBugReport() throws RemoteException; + + public long inputDispatchingTimedOut(int pid, boolean aboveSystem) throws RemoteException; + /* * Private non-Binder interfaces */ @@ -491,7 +499,7 @@ private WaitResult(Parcel source) { int BIND_SERVICE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+35; int UNBIND_SERVICE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+36; int PUBLISH_SERVICE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+37; - + int ACTIVITY_RESUMED_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+38; int GOING_TO_SLEEP_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+39; int WAKING_UP_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+40; int SET_DEBUG_APP_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+41; @@ -546,10 +554,9 @@ private WaitResult(Parcel source) { int BACKUP_AGENT_CREATED_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+90; int UNBIND_BACKUP_AGENT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+91; int GET_UID_FOR_INTENT_SENDER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+92; - - - int START_ACTIVITY_IN_PACKAGE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+94; - int KILL_APPLICATION_WITH_UID_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+95; + int HANDLE_INCOMING_USER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+93; + int GET_TASK_TOP_THUMBNAIL_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+94; + int KILL_APPLICATION_WITH_APPID_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+95; int CLOSE_SYSTEM_DIALOGS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+96; int GET_PROCESS_MEMORY_INFO_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+97; int KILL_APPLICATION_PROCESS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+98; @@ -575,7 +582,7 @@ private WaitResult(Parcel source) { int CHECK_GRANT_URI_PERMISSION_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+118; int DUMP_HEAP_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+119; int START_ACTIVITIES_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+120; - int START_ACTIVITIES_IN_PACKAGE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+121; + int IS_USER_RUNNING_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+121; int ACTIVITY_SLEPT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+122; int GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+123; int SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+124; @@ -606,4 +613,12 @@ private WaitResult(Parcel source) { int GET_LAUNCHED_FROM_UID_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+149; int UNSTABLE_PROVIDER_DIED_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+150; int IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+151; + int START_ACTIVITY_AS_USER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+152; + int STOP_USER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+153; + int REGISTER_USER_SWITCH_OBSERVER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+154; + int UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+155; + int GET_RUNNING_USER_IDS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+156; + int REQUEST_BUG_REPORT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+157; + int INPUT_DISPATCHING_TIMED_OUT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+158; + int CLEAR_PENDING_BACKUP_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+159; } diff --git a/core/java/android/app/IApplicationThread.java b/core/java/android/app/IApplicationThread.java index f60cfd6b091ee..03a26d4274c41 100644 --- a/core/java/android/app/IApplicationThread.java +++ b/core/java/android/app/IApplicationThread.java @@ -65,7 +65,8 @@ void scheduleRelaunchActivity(IBinder token, List pendingResults, void scheduleDestroyActivity(IBinder token, boolean finished, int configChanges) throws RemoteException; void scheduleReceiver(Intent intent, ActivityInfo info, CompatibilityInfo compatInfo, - int resultCode, String data, Bundle extras, boolean sync) throws RemoteException; + int resultCode, String data, Bundle extras, boolean sync, + int sendingUser) throws RemoteException; static final int BACKUP_MODE_INCREMENTAL = 0; static final int BACKUP_MODE_FULL = 1; static final int BACKUP_MODE_RESTORE = 2; @@ -105,8 +106,8 @@ void dumpService(FileDescriptor fd, IBinder servicetoken, String[] args) void dumpProvider(FileDescriptor fd, IBinder servicetoken, String[] args) throws RemoteException; void scheduleRegisteredReceiver(IIntentReceiver receiver, Intent intent, - int resultCode, String data, Bundle extras, boolean ordered, boolean sticky) - throws RemoteException; + int resultCode, String data, Bundle extras, boolean ordered, + boolean sticky, int sendingUser) throws RemoteException; void scheduleLowMemory() throws RemoteException; void scheduleActivityConfigurationChanged(IBinder token) throws RemoteException; void profilerControl(boolean start, String path, ParcelFileDescriptor fd, int profileType) diff --git a/core/java/android/app/IInstrumentationWatcher.aidl b/core/java/android/app/IInstrumentationWatcher.aidl index 405a3d80128ef..6c8c4d6e03ef4 100644 --- a/core/java/android/app/IInstrumentationWatcher.aidl +++ b/core/java/android/app/IInstrumentationWatcher.aidl @@ -21,7 +21,7 @@ import android.content.ComponentName; import android.os.Bundle; /** @hide */ -oneway interface IInstrumentationWatcher +interface IInstrumentationWatcher { void instrumentationStatus(in ComponentName name, int resultCode, in Bundle results); diff --git a/core/java/android/app/INotificationManager.aidl b/core/java/android/app/INotificationManager.aidl index 6f95e26ae79bc..62d496216748e 100644 --- a/core/java/android/app/INotificationManager.aidl +++ b/core/java/android/app/INotificationManager.aidl @@ -24,16 +24,13 @@ import android.content.Intent; /** {@hide} */ interface INotificationManager { - /** @deprecated use {@link #enqueueNotificationWithTag} instead */ - void enqueueNotification(String pkg, int id, in Notification notification, inout int[] idReceived); - /** @deprecated use {@link #cancelNotificationWithTag} instead */ - void cancelNotification(String pkg, int id); - void cancelAllNotifications(String pkg); + void cancelAllNotifications(String pkg, int userId); void enqueueToast(String pkg, ITransientNotification callback, int duration); void cancelToast(String pkg, ITransientNotification callback); - void enqueueNotificationWithTag(String pkg, String tag, int id, in Notification notification, inout int[] idReceived); - void cancelNotificationWithTag(String pkg, String tag, int id); + void enqueueNotificationWithTag(String pkg, String tag, int id, + in Notification notification, inout int[] idReceived, int userId); + void cancelNotificationWithTag(String pkg, String tag, int id, int userId); void setNotificationsEnabledForPackage(String pkg, boolean enabled); boolean areNotificationsEnabledForPackage(String pkg); diff --git a/core/java/android/app/IProfileManager.aidl b/core/java/android/app/IProfileManager.aidl new file mode 100644 index 0000000000000..c7c6744f17aaa --- /dev/null +++ b/core/java/android/app/IProfileManager.aidl @@ -0,0 +1,50 @@ +/* //device/java/android/android/app/IProfileManager.aidl +** +** Copyright 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. +*/ + +package android.app; + +import android.app.Profile; +import android.app.NotificationGroup; +import android.os.ParcelUuid; + +/** {@hide} */ +interface IProfileManager +{ + boolean setActiveProfile(in ParcelUuid profileParcelUuid); + boolean setActiveProfileByName(String profileName); + Profile getActiveProfile(); + + boolean addProfile(in Profile profile); + boolean removeProfile(in Profile profile); + void updateProfile(in Profile profile); + + Profile getProfile(in ParcelUuid profileParcelUuid); + Profile getProfileByName(String profileName); + Profile[] getProfiles(); + boolean profileExists(in ParcelUuid profileUuid); + boolean profileExistsByName(String profileName); + boolean notificationGroupExistsByName(String notificationGroupName); + + NotificationGroup[] getNotificationGroups(); + void addNotificationGroup(in NotificationGroup group); + void removeNotificationGroup(in NotificationGroup group); + void updateNotificationGroup(in NotificationGroup group); + NotificationGroup getNotificationGroupForPackage(in String pkg); + NotificationGroup getNotificationGroup(in ParcelUuid groupParcelUuid); + + void resetAll(); +} diff --git a/core/java/android/app/ISearchManager.aidl b/core/java/android/app/ISearchManager.aidl index 688cdfd66eb5c..074d34398379a 100644 --- a/core/java/android/app/ISearchManager.aidl +++ b/core/java/android/app/ISearchManager.aidl @@ -30,4 +30,5 @@ interface ISearchManager { List getGlobalSearchActivities(); ComponentName getGlobalSearchActivity(); ComponentName getWebSearchActivity(); + ComponentName getAssistIntent(int userHandle); } diff --git a/core/java/android/app/IStopUserCallback.aidl b/core/java/android/app/IStopUserCallback.aidl new file mode 100644 index 0000000000000..19ac1d5d4ecd3 --- /dev/null +++ b/core/java/android/app/IStopUserCallback.aidl @@ -0,0 +1,27 @@ +/* +** Copyright 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.app; + +/** + * Callback to find out when we have finished stopping a user. + * {@hide} + */ +interface IStopUserCallback +{ + void userStopped(int userId); + void userStopAborted(int userId); +} diff --git a/core/java/android/app/IUserSwitchObserver.aidl b/core/java/android/app/IUserSwitchObserver.aidl new file mode 100644 index 0000000000000..845897b7827e4 --- /dev/null +++ b/core/java/android/app/IUserSwitchObserver.aidl @@ -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 android.app; + +import android.os.IRemoteCallback; + +/** {@hide} */ +oneway interface IUserSwitchObserver { + void onUserSwitching(int newUserId, IRemoteCallback reply); + void onUserSwitchComplete(int newUserId); +} diff --git a/core/java/android/app/IWallpaperManager.aidl b/core/java/android/app/IWallpaperManager.aidl index 69f64a11fde3b..3efd3c0ede8ba 100644 --- a/core/java/android/app/IWallpaperManager.aidl +++ b/core/java/android/app/IWallpaperManager.aidl @@ -51,6 +51,11 @@ interface IWallpaperManager { */ void clearWallpaper(); + /** + * Return whether there is a wallpaper set with the given name. + */ + boolean hasNamedWallpaper(String name); + /** * Sets the dimension hint for the wallpaper. These hints indicate the desired * minimum width and height for the wallpaper. diff --git a/core/java/android/app/Instrumentation.java b/core/java/android/app/Instrumentation.java index cad4b0159fc3e..e0856aeaee035 100644 --- a/core/java/android/app/Instrumentation.java +++ b/core/java/android/app/Instrumentation.java @@ -33,6 +33,7 @@ import android.os.RemoteException; import android.os.ServiceManager; import android.os.SystemClock; +import android.os.UserHandle; import android.util.AndroidRuntimeException; import android.util.Log; import android.view.IWindowManager; @@ -1429,6 +1430,21 @@ public ActivityResult execStartActivity( */ public void execStartActivities(Context who, IBinder contextThread, IBinder token, Activity target, Intent[] intents, Bundle options) { + execStartActivitiesAsUser(who, contextThread, token, target, intents, options, + UserHandle.myUserId()); + } + + /** + * Like {@link #execStartActivity(Context, IBinder, IBinder, Activity, Intent, int)}, + * but accepts an array of activities to be started. Note that active + * {@link ActivityMonitor} objects only match against the first activity in + * the array. + * + * {@hide} + */ + public void execStartActivitiesAsUser(Context who, IBinder contextThread, + IBinder token, Activity target, Intent[] intents, Bundle options, + int userId) { IApplicationThread whoThread = (IApplicationThread) contextThread; if (mActivityMonitors != null) { synchronized (mSync) { @@ -1452,7 +1468,8 @@ public void execStartActivities(Context who, IBinder contextThread, resolvedTypes[i] = intents[i].resolveTypeIfNeeded(who.getContentResolver()); } int result = ActivityManagerNative.getDefault() - .startActivities(whoThread, intents, resolvedTypes, token, options); + .startActivities(whoThread, intents, resolvedTypes, token, options, + userId); checkStartActivityResult(result, intents[0]); } catch (RemoteException e) { } @@ -1518,6 +1535,66 @@ public ActivityResult execStartActivity( return null; } + /** + * Like {@link #execStartActivity(Context, IBinder, IBinder, Activity, Intent, int)}, + * but for starting as a particular user. + * + * @param who The Context from which the activity is being started. + * @param contextThread The main thread of the Context from which the activity + * is being started. + * @param token Internal token identifying to the system who is starting + * the activity; may be null. + * @param target Which fragment is performing the start (and thus receiving + * any result). + * @param intent The actual Intent to start. + * @param requestCode Identifier for this request's result; less than zero + * if the caller is not expecting a result. + * + * @return To force the return of a particular result, return an + * ActivityResult object containing the desired data; otherwise + * return null. The default implementation always returns null. + * + * @throws android.content.ActivityNotFoundException + * + * @see Activity#startActivity(Intent) + * @see Activity#startActivityForResult(Intent, int) + * @see Activity#startActivityFromChild + * + * {@hide} + */ + public ActivityResult execStartActivity( + Context who, IBinder contextThread, IBinder token, Activity target, + Intent intent, int requestCode, Bundle options, UserHandle user) { + IApplicationThread whoThread = (IApplicationThread) contextThread; + if (mActivityMonitors != null) { + synchronized (mSync) { + final int N = mActivityMonitors.size(); + for (int i=0; i= 0 ? am.getResult() : null; + } + break; + } + } + } + } + try { + intent.setAllowFds(false); + intent.migrateExtraStreamToClipData(); + int result = ActivityManagerNative.getDefault() + .startActivityAsUser(whoThread, intent, + intent.resolveTypeIfNeeded(who.getContentResolver()), + token, target != null ? target.mEmbeddedID : null, + requestCode, 0, null, null, options, user.getIdentifier()); + checkStartActivityResult(result, intent); + } catch (RemoteException e) { + } + return null; + } + /*package*/ final void init(ActivityThread thread, Context instrContext, Context appContext, ComponentName component, IInstrumentationWatcher watcher) { diff --git a/core/java/android/app/KeyguardManager.java b/core/java/android/app/KeyguardManager.java index ef61af715dfa4..22a21cdf829da 100644 --- a/core/java/android/app/KeyguardManager.java +++ b/core/java/android/app/KeyguardManager.java @@ -16,13 +16,12 @@ package android.app; -import android.content.Context; import android.os.Binder; import android.os.RemoteException; import android.os.IBinder; -import android.os.ServiceManager; import android.view.IWindowManager; import android.view.IOnKeyguardExitResult; +import android.view.WindowManagerGlobal; /** * Class that can be used to lock and unlock the keyboard. Get an instance of this @@ -111,7 +110,7 @@ public interface OnKeyguardExitResult { KeyguardManager() { - mWM = IWindowManager.Stub.asInterface(ServiceManager.getService(Context.WINDOW_SERVICE)); + mWM = WindowManagerGlobal.getWindowManagerService(); } /** diff --git a/core/java/android/app/LauncherActivity.java b/core/java/android/app/LauncherActivity.java index 8eb9ba48b98e2..96c7246acf3cd 100644 --- a/core/java/android/app/LauncherActivity.java +++ b/core/java/android/app/LauncherActivity.java @@ -439,14 +439,21 @@ protected Intent getTargetIntent() { protected List onQueryPackageManager(Intent queryIntent) { return mPackageManager.queryIntentActivities(queryIntent, /* no flags */ 0); } - + + /** + * @hide + */ + protected void onSortResultList(List results) { + Collections.sort(results, new ResolveInfo.DisplayNameComparator(mPackageManager)); + } + /** * Perform the query to determine which results to show and return a list of them. */ public List makeListItems() { // Load all matching activities and sort correctly List list = onQueryPackageManager(mIntent); - Collections.sort(list, new ResolveInfo.DisplayNameComparator(mPackageManager)); + onSortResultList(list); ArrayList result = new ArrayList(list.size()); int listSize = list.size(); diff --git a/core/java/android/app/LoadedApk.java b/core/java/android/app/LoadedApk.java index be4b2844c0b1d..0a9ed587ffd05 100644 --- a/core/java/android/app/LoadedApk.java +++ b/core/java/android/app/LoadedApk.java @@ -37,10 +37,11 @@ import android.os.RemoteException; import android.os.StrictMode; import android.os.Trace; -import android.os.UserId; +import android.os.UserHandle; import android.util.AndroidRuntimeException; import android.util.Slog; import android.view.CompatibilityInfoHolder; +import android.view.Display; import java.io.File; import java.io.IOException; @@ -120,8 +121,8 @@ public LoadedApk(ActivityThread activityThread, ApplicationInfo aInfo, final int myUid = Process.myUid(); mResDir = aInfo.uid == myUid ? aInfo.sourceDir : aInfo.publicSourceDir; - if (!UserId.isSameUser(aInfo.uid, myUid) && !Process.isIsolated()) { - aInfo.dataDir = PackageManager.getDataDirForUser(UserId.getUserId(myUid), + if (!UserHandle.isSameUser(aInfo.uid, myUid) && !Process.isIsolated()) { + aInfo.dataDir = PackageManager.getDataDirForUser(UserHandle.getUserId(myUid), mPackageName); } mSharedLibraries = aInfo.sharedLibraryFiles; @@ -139,7 +140,8 @@ public LoadedApk(ActivityThread activityThread, ApplicationInfo aInfo, ContextImpl.createSystemContext(mainThread); ActivityThread.mSystemContext.getResources().updateConfiguration( mainThread.getConfiguration(), - mainThread.getDisplayMetricsLocked(compatInfo, false), + mainThread.getDisplayMetricsLocked( + Display.DEFAULT_DISPLAY, compatInfo), compatInfo); //Slog.i(TAG, "Created system resources " // + mSystemContext.getResources() + ": " @@ -195,7 +197,7 @@ private static String[] getLibrariesFor(String packageName) { ApplicationInfo ai = null; try { ai = ActivityThread.getPackageManager().getApplicationInfo(packageName, - PackageManager.GET_SHARED_LIBRARY_FILES, UserId.myUserId()); + PackageManager.GET_SHARED_LIBRARY_FILES, UserHandle.myUserId()); } catch (RemoteException e) { throw new AssertionError(e); } @@ -358,7 +360,7 @@ private void initializeJavaContextClassLoader() { IPackageManager pm = ActivityThread.getPackageManager(); android.content.pm.PackageInfo pi; try { - pi = pm.getPackageInfo(mPackageName, 0, UserId.myUserId()); + pi = pm.getPackageInfo(mPackageName, 0, UserHandle.myUserId()); } catch (RemoteException e) { throw new AssertionError(e); } @@ -471,7 +473,8 @@ public AssetManager getAssets(ActivityThread mainThread) { public Resources getResources(ActivityThread mainThread) { if (mResources == null) { - mResources = mainThread.getTopLevelResources(mResDir, this); + mResources = mainThread.getTopLevelResources(mResDir, + Display.DEFAULT_DISPLAY, null, this); } return mResources; } @@ -667,8 +670,8 @@ final static class InnerReceiver extends IIntentReceiver.Stub { mDispatcher = new WeakReference(rd); mStrongRef = strong ? rd : null; } - public void performReceive(Intent intent, int resultCode, - String data, Bundle extras, boolean ordered, boolean sticky) { + public void performReceive(Intent intent, int resultCode, String data, + Bundle extras, boolean ordered, boolean sticky, int sendingUser) { LoadedApk.ReceiverDispatcher rd = mDispatcher.get(); if (ActivityThread.DEBUG_BROADCAST) { int seq = intent.getIntExtra("seq", -1); @@ -677,7 +680,7 @@ public void performReceive(Intent intent, int resultCode, } if (rd != null) { rd.performReceive(intent, resultCode, data, extras, - ordered, sticky); + ordered, sticky, sendingUser); } else { // The activity manager dispatched a broadcast to a registered // receiver in this process, but before it could be delivered the @@ -713,10 +716,10 @@ final class Args extends BroadcastReceiver.PendingResult implements Runnable { private final boolean mOrdered; public Args(Intent intent, int resultCode, String resultData, Bundle resultExtras, - boolean ordered, boolean sticky) { + boolean ordered, boolean sticky, int sendingUser) { super(resultCode, resultData, resultExtras, mRegistered ? TYPE_REGISTERED : TYPE_UNREGISTERED, - ordered, sticky, mIIntentReceiver.asBinder()); + ordered, sticky, mIIntentReceiver.asBinder(), sendingUser); mCurIntent = intent; mOrdered = ordered; } @@ -827,14 +830,15 @@ RuntimeException getUnregisterLocation() { return mUnregisterLocation; } - public void performReceive(Intent intent, int resultCode, - String data, Bundle extras, boolean ordered, boolean sticky) { + public void performReceive(Intent intent, int resultCode, String data, + Bundle extras, boolean ordered, boolean sticky, int sendingUser) { if (ActivityThread.DEBUG_BROADCAST) { int seq = intent.getIntExtra("seq", -1); Slog.i(ActivityThread.TAG, "Enqueueing broadcast " + intent.getAction() + " seq=" + seq + " to " + mReceiver); } - Args args = new Args(intent, resultCode, data, extras, ordered, sticky); + Args args = new Args(intent, resultCode, data, extras, ordered, + sticky, sendingUser); if (!mActivityThread.post(args)) { if (mRegistered && ordered) { IActivityManager mgr = ActivityManagerNative.getDefault(); diff --git a/core/java/android/app/LoaderManager.java b/core/java/android/app/LoaderManager.java index ff71ee77c1313..fd0f0bf6fd988 100644 --- a/core/java/android/app/LoaderManager.java +++ b/core/java/android/app/LoaderManager.java @@ -17,7 +17,6 @@ package android.app; import android.content.Loader; -import android.content.Loader.OnLoadCanceledListener; import android.os.Bundle; import android.util.DebugUtils; import android.util.Log; @@ -213,6 +212,8 @@ class LoaderManagerImpl extends LoaderManager { // previously run loader until the new loader's data is available. final SparseArray mInactiveLoaders = new SparseArray(); + final String mWho; + Activity mActivity; boolean mStarted; boolean mRetaining; @@ -529,7 +530,8 @@ public void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] } } - LoaderManagerImpl(Activity activity, boolean started) { + LoaderManagerImpl(String who, Activity activity, boolean started) { + mWho = who; mActivity = activity; mStarted = started; } diff --git a/core/java/android/app/MediaRouteActionProvider.java b/core/java/android/app/MediaRouteActionProvider.java index c2f5ac1d9fc95..63b641cb708e9 100644 --- a/core/java/android/app/MediaRouteActionProvider.java +++ b/core/java/android/app/MediaRouteActionProvider.java @@ -26,6 +26,7 @@ import android.view.ActionProvider; import android.view.MenuItem; import android.view.View; +import android.view.ViewGroup; import java.lang.ref.WeakReference; @@ -80,8 +81,11 @@ public View onCreateActionView(MenuItem item) { } mMenuItem = item; mView = new MediaRouteButton(mContext); + mView.setCheatSheetEnabled(true); mView.setRouteTypes(mRouteTypes); mView.setExtendedSettingsClickListener(mExtendedSettingsListener); + mView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, + ViewGroup.LayoutParams.MATCH_PARENT)); return mView; } diff --git a/core/java/android/app/MediaRouteButton.java b/core/java/android/app/MediaRouteButton.java index b0bfe743fd891..3ecafc3bc9b90 100644 --- a/core/java/android/app/MediaRouteButton.java +++ b/core/java/android/app/MediaRouteButton.java @@ -23,14 +23,19 @@ import android.content.ContextWrapper; import android.content.res.TypedArray; import android.graphics.Canvas; +import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.media.MediaRouter; import android.media.MediaRouter.RouteGroup; import android.media.MediaRouter.RouteInfo; +import android.text.TextUtils; import android.util.AttributeSet; import android.util.Log; +import android.view.Gravity; +import android.view.HapticFeedbackConstants; import android.view.SoundEffectConstants; import android.view.View; +import android.widget.Toast; public class MediaRouteButton extends View { private static final String TAG = "MediaRouteButton"; @@ -44,6 +49,8 @@ public class MediaRouteButton extends View { private Drawable mRemoteIndicator; private boolean mRemoteActive; private boolean mToggleMode; + private boolean mCheatSheetEnabled; + private boolean mIsConnecting; private int mMinWidth; private int mMinHeight; @@ -51,6 +58,10 @@ public class MediaRouteButton extends View { private OnClickListener mExtendedSettingsClickListener; private MediaRouteChooserDialogFragment mDialogFragment; + private static final int[] CHECKED_STATE_SET = { + R.attr.state_checked + }; + private static final int[] ACTIVATED_STATE_SET = { R.attr.state_activated }; @@ -82,6 +93,7 @@ public MediaRouteButton(Context context, AttributeSet attrs, int defStyleAttr) { a.recycle(); setClickable(true); + setLongClickable(true); setRouteTypes(routeTypes); } @@ -129,6 +141,52 @@ public boolean performClick() { return handled; } + void setCheatSheetEnabled(boolean enable) { + mCheatSheetEnabled = enable; + } + + @Override + public boolean performLongClick() { + if (super.performLongClick()) { + return true; + } + + if (!mCheatSheetEnabled) { + return false; + } + + final CharSequence contentDesc = getContentDescription(); + if (TextUtils.isEmpty(contentDesc)) { + // Don't show the cheat sheet if we have no description + return false; + } + + final int[] screenPos = new int[2]; + final Rect displayFrame = new Rect(); + getLocationOnScreen(screenPos); + getWindowVisibleDisplayFrame(displayFrame); + + final Context context = getContext(); + final int width = getWidth(); + final int height = getHeight(); + final int midy = screenPos[1] + height / 2; + final int screenWidth = context.getResources().getDisplayMetrics().widthPixels; + + Toast cheatSheet = Toast.makeText(context, contentDesc, Toast.LENGTH_SHORT); + if (midy < displayFrame.height()) { + // Show along the top; follow action buttons + cheatSheet.setGravity(Gravity.TOP | Gravity.END, + screenWidth - screenPos[0] - width / 2, height); + } else { + // Show along the bottom center + cheatSheet.setGravity(Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0, height); + } + cheatSheet.show(); + performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + + return true; + } + public void setRouteTypes(int types) { if (types == mRouteTypes) { // Already registered; nothing to do. @@ -157,10 +215,21 @@ public int getRouteTypes() { } void updateRemoteIndicator() { - final boolean isRemote = - mRouter.getSelectedRoute(mRouteTypes) != mRouter.getSystemAudioRoute(); + final RouteInfo selected = mRouter.getSelectedRoute(mRouteTypes); + final boolean isRemote = selected != mRouter.getSystemAudioRoute(); + final boolean isConnecting = selected.getStatusCode() == RouteInfo.STATUS_CONNECTING; + + boolean needsRefresh = false; if (mRemoteActive != isRemote) { mRemoteActive = isRemote; + needsRefresh = true; + } + if (mIsConnecting != isConnecting) { + mIsConnecting = isConnecting; + needsRefresh = true; + } + + if (needsRefresh) { refreshDrawableState(); } } @@ -168,27 +237,41 @@ void updateRemoteIndicator() { void updateRouteCount() { final int N = mRouter.getRouteCount(); int count = 0; + boolean hasVideoRoutes = false; for (int i = 0; i < N; i++) { final RouteInfo route = mRouter.getRouteAt(i); - if ((route.getSupportedTypes() & mRouteTypes) != 0) { + final int routeTypes = route.getSupportedTypes(); + if ((routeTypes & mRouteTypes) != 0) { if (route instanceof RouteGroup) { count += ((RouteGroup) route).getRouteCount(); } else { count++; } + if ((routeTypes & MediaRouter.ROUTE_TYPE_LIVE_VIDEO) != 0) { + hasVideoRoutes = true; + } } } setEnabled(count != 0); - // Only allow toggling if we have more than just user routes - mToggleMode = count == 2 && (mRouteTypes & MediaRouter.ROUTE_TYPE_LIVE_AUDIO) != 0; + // Only allow toggling if we have more than just user routes. + // Don't toggle if we support video routes, we may have to let the dialog scan. + mToggleMode = count == 2 && (mRouteTypes & MediaRouter.ROUTE_TYPE_LIVE_AUDIO) != 0 && + !hasVideoRoutes; } @Override protected int[] onCreateDrawableState(int extraSpace) { final int[] drawableState = super.onCreateDrawableState(extraSpace + 1); - if (mRemoteActive) { + + // Technically we should be handling this more completely, but these + // are implementation details here. Checked is used to express the connecting + // drawable state and it's mutually exclusive with activated for the purposes + // of state selection here. + if (mIsConnecting) { + mergeDrawableStates(drawableState, CHECKED_STATE_SET); + } else if (mRemoteActive) { mergeDrawableStates(drawableState, ACTIVATED_STATE_SET); } return drawableState; @@ -365,6 +448,11 @@ public void onRouteUnselected(MediaRouter router, int type, RouteInfo info) { updateRemoteIndicator(); } + @Override + public void onRouteChanged(MediaRouter router, RouteInfo info) { + updateRemoteIndicator(); + } + @Override public void onRouteAdded(MediaRouter router, RouteInfo info) { updateRouteCount(); diff --git a/core/java/android/app/NativeActivity.java b/core/java/android/app/NativeActivity.java index 35cc3248f4563..396f910e69543 100644 --- a/core/java/android/app/NativeActivity.java +++ b/core/java/android/app/NativeActivity.java @@ -1,6 +1,5 @@ package android.app; -import com.android.internal.view.IInputMethodCallback; import com.android.internal.view.IInputMethodSession; import android.content.Context; @@ -119,7 +118,7 @@ public NativeContentView(Context context, AttributeSet attrs) { } } - static class InputMethodCallback extends IInputMethodCallback.Stub { + static final class InputMethodCallback implements InputMethodManager.FinishedEventCallback { WeakReference mNa; InputMethodCallback(NativeActivity na) { @@ -133,11 +132,6 @@ public void finishedEvent(int seq, boolean handled) { na.finishPreDispatchKeyEventNative(na.mNativeHandle, seq, handled); } } - - @Override - public void sessionCreated(IInputMethodSession session) { - // Stub -- not for use in the client. - } } @Override diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java index cb83dc2cdcb50..238a63e138dc7 100644 --- a/core/java/android/app/Notification.java +++ b/core/java/android/app/Notification.java @@ -29,6 +29,7 @@ import android.os.Parcel; import android.os.Parcelable; import android.os.SystemClock; +import android.os.UserHandle; import android.text.TextUtils; import android.util.IntProperty; import android.util.Log; @@ -436,6 +437,15 @@ public class Notification implements Parcelable */ public static final String EXTRA_PEOPLE = "android.people"; + /** + * Bit to be bitwise-ored into the {@link #flags} field that should be + * set if this notification should force the led to pulse even if the + * screen has been shut off while the notification was active. + * + * @hide + */ + public static final int FLAG_FORCE_LED_SCREEN_OFF = 0x00000100; + private Bundle extras; /** @@ -893,6 +903,22 @@ public String toString() { return sb.toString(); } + /** {@hide} */ + public void setUser(UserHandle user) { + if (user.getIdentifier() == UserHandle.USER_ALL) { + user = UserHandle.OWNER; + } + if (tickerView != null) { + tickerView.setUser(user); + } + if (contentView != null) { + contentView.setUser(user); + } + if (bigContentView != null) { + bigContentView.setUser(user); + } + } + /** * Builder class for {@link Notification} objects. * @@ -951,6 +977,7 @@ public static class Builder { private ArrayList mActions = new ArrayList(MAX_ACTION_BUTTONS); private boolean mUseChronometer; private Style mStyle; + private boolean mShowWhen = true; /** * Constructs a new Builder with the defaults: @@ -982,8 +1009,9 @@ public Builder(Context context) { /** * Add a timestamp pertaining to the notification (usually the time the event occurred). + * It will be shown in the notification content view by default; use + * {@link Builder#setShowWhen(boolean) setShowWhen} to control this. * - * @see Notification#when */ public Builder setWhen(long when) { @@ -991,6 +1019,15 @@ public Builder setWhen(long when) { return this; } + /** + * Control whether the timestamp set with {@link Builder#setWhen(long) setWhen} is shown + * in the content view. + */ + public Builder setShowWhen(boolean show) { + mShowWhen = show; + return this; + } + /** * Show the {@link Notification#when} field as a stopwatch. * @@ -1467,7 +1504,7 @@ private RemoteViews applyStandardTemplate(int resId, boolean fitIn1U) { contentView.setViewPadding(R.id.line1, 0, 0, 0, 0); } - if (mWhen != 0) { + if (mWhen != 0 && mShowWhen) { if (mUseChronometer) { contentView.setViewVisibility(R.id.chronometer, View.VISIBLE); contentView.setLong(R.id.chronometer, "setBase", @@ -1477,7 +1514,10 @@ private RemoteViews applyStandardTemplate(int resId, boolean fitIn1U) { contentView.setViewVisibility(R.id.time, View.VISIBLE); contentView.setLong(R.id.time, "setTime", mWhen); } + } else { + contentView.setViewVisibility(R.id.time, View.GONE); } + contentView.setViewVisibility(R.id.line3, showLine3 ? View.VISIBLE : View.GONE); contentView.setViewVisibility(R.id.overflow_divider, showLine3 ? View.VISIBLE : View.GONE); return contentView; @@ -1777,7 +1817,7 @@ public Notification build() { * * This class is a "rebuilder": It consumes a Builder object and modifies its behavior, like so: *

    -     * Notification noti = new Notification.BigPictureStyle(
    +     * Notification noti = new Notification.BigTextStyle(
          *      new Notification.Builder()
          *         .setContentTitle("New mail from " + sender.toString())
          *         .setContentText(subject)
    @@ -1923,6 +1963,7 @@ private RemoteViews makeBigContentView() {
                     contentView.setViewVisibility(rowId, View.GONE);
                 }
     
    +
                 int i=0;
                 while (i < mTexts.size() && i < rowIds.length) {
                     CharSequence str = mTexts.get(i);
    @@ -1933,11 +1974,11 @@ private RemoteViews makeBigContentView() {
                     i++;
                 }
     
    -            if  (mTexts.size() > rowIds.length) {
    -                contentView.setViewVisibility(R.id.inbox_more, View.VISIBLE);
    -            } else {
    -                contentView.setViewVisibility(R.id.inbox_more, View.GONE);
    -            }
    +            contentView.setViewVisibility(R.id.inbox_end_pad,
    +                    mTexts.size() > 0 ? View.VISIBLE : View.GONE);
    +
    +            contentView.setViewVisibility(R.id.inbox_more,
    +                    mTexts.size() > rowIds.length ? View.VISIBLE : View.GONE);
     
                 return contentView;
             }
    diff --git a/core/java/android/app/NotificationGroup.aidl b/core/java/android/app/NotificationGroup.aidl
    new file mode 100644
    index 0000000000000..44b62907fb42a
    --- /dev/null
    +++ b/core/java/android/app/NotificationGroup.aidl
    @@ -0,0 +1,19 @@
    +/**
    + * Copyright (c) 2012, The CyanogenMod 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.app;
    +
    +parcelable NotificationGroup;
    diff --git a/core/java/android/app/NotificationGroup.java b/core/java/android/app/NotificationGroup.java
    new file mode 100644
    index 0000000000000..bcb70d31749e1
    --- /dev/null
    +++ b/core/java/android/app/NotificationGroup.java
    @@ -0,0 +1,201 @@
    +/*
    + * Copyright (C) 2011 The Android Open Source Project
    + *
    + * Licensed under the Apache License, Version 2.0 (the "License");
    + * you may not use this file except in compliance with the License.
    + * You may obtain a copy of the License at
    + *
    + *      http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package android.app;
    +
    +import org.xmlpull.v1.XmlPullParser;
    +import org.xmlpull.v1.XmlPullParserException;
    +
    +import android.content.Context;
    +import android.os.Parcel;
    +import android.os.Parcelable;
    +import android.os.ParcelUuid;
    +import android.os.RemoteException;
    +import android.text.TextUtils;
    +import android.util.Log;
    +
    +import java.io.IOException;
    +import java.util.Arrays;
    +import java.util.HashSet;
    +import java.util.Set;
    +import java.util.UUID;
    +
    +/** @hide */
    +public class NotificationGroup implements Parcelable {
    +    private static final String TAG = "NotificationGroup";
    +
    +    private String mName;
    +    private int mNameResId;
    +
    +    private UUID mUuid;
    +
    +    private Set mPackages = new HashSet();
    +
    +    private boolean mDirty;
    +
    +    public static final Parcelable.Creator CREATOR = new Parcelable.Creator() {
    +        public NotificationGroup createFromParcel(Parcel in) {
    +            return new NotificationGroup(in);
    +        }
    +
    +        @Override
    +        public NotificationGroup[] newArray(int size) {
    +            return new NotificationGroup[size];
    +        }
    +    };
    +
    +    public NotificationGroup(String name) {
    +        this(name, -1, null);
    +    }
    +
    +    public NotificationGroup(String name, int nameResId, UUID uuid) {
    +        mName = name;
    +        mNameResId = nameResId;
    +        mUuid = (uuid != null) ? uuid : UUID.randomUUID();
    +        mDirty = uuid == null;
    +    }
    +
    +    private NotificationGroup(Parcel in) {
    +        readFromParcel(in);
    +    }
    +
    +    @Override
    +    public String toString() {
    +        return getName();
    +    }
    +
    +    public String getName() {
    +        return mName;
    +    }
    +
    +    public void setName(String name) {
    +        mName = name;
    +        mNameResId = -1;
    +        mDirty = true;
    +    }
    +
    +    public UUID getUuid() {
    +        return mUuid;
    +    }
    +
    +    public void addPackage(String pkg) {
    +        mPackages.add(pkg);
    +        mDirty = true;
    +    }
    +
    +    public String[] getPackages() {
    +        return mPackages.toArray(new String[mPackages.size()]);
    +    }
    +
    +    public void removePackage(String pkg) {
    +        mPackages.remove(pkg);
    +        mDirty = true;
    +    }
    +
    +    public boolean hasPackage(String pkg) {
    +        return mPackages.contains(pkg);
    +    }
    +
    +    public boolean isDirty() {
    +        return mDirty;
    +    }
    +
    +    @Override
    +    public int describeContents() {
    +        return 0;
    +    }
    +
    +    @Override
    +    public void writeToParcel(Parcel dest, int flags) {
    +        dest.writeString(mName);
    +        dest.writeInt(mNameResId);
    +        dest.writeInt(mDirty ? 1 : 0);
    +        new ParcelUuid(mUuid).writeToParcel(dest, 0);
    +        dest.writeStringArray(getPackages());
    +    }
    +
    +    public void readFromParcel(Parcel in) {
    +        mName = in.readString();
    +        mNameResId = in.readInt();
    +        mDirty = in.readInt() != 0;
    +        mUuid = ParcelUuid.CREATOR.createFromParcel(in).getUuid();
    +        mPackages.addAll(Arrays.asList(in.readStringArray()));
    +    }
    +
    +    public void getXmlString(StringBuilder builder, Context context) {
    +        builder.append(" 0) {
    +            builder.append("nameres=\"");
    +            builder.append(context.getResources().getResourceEntryName(mNameResId));
    +        } else {
    +            builder.append("name=\"");
    +            builder.append(TextUtils.htmlEncode(getName()));
    +        }
    +        builder.append("\" uuid=\"");
    +        builder.append(TextUtils.htmlEncode(getUuid().toString()));
    +        builder.append("\">\n");
    +        for (String pkg : mPackages) {
    +            builder.append("" + TextUtils.htmlEncode(pkg) + "\n");
    +        }
    +        builder.append("\n");
    +        mDirty = false;
    +    }
    +
    +    public static NotificationGroup fromXml(XmlPullParser xpp, Context context)
    +            throws XmlPullParserException, IOException {
    +        String value = xpp.getAttributeValue(null, "nameres");
    +        int nameResId = -1;
    +        String name = null;
    +        UUID uuid = null;
    +
    +        if (value != null) {
    +            nameResId = context.getResources().getIdentifier(value, "string", "android");
    +            if (nameResId > 0) {
    +                name = context.getResources().getString(nameResId);
    +            }
    +        }
    +
    +        if (name == null) {
    +            name = xpp.getAttributeValue(null, "name");
    +        }
    +
    +        value = xpp.getAttributeValue(null, "uuid");
    +        if (value != null) {
    +            try {
    +                uuid = UUID.fromString(value);
    +            } catch (IllegalArgumentException e) {
    +                Log.w(TAG, "UUID not recognized for " + name + ", using new one.");
    +            }
    +        }
    +
    +        NotificationGroup notificationGroup = new NotificationGroup(name, nameResId, uuid);
    +        int event = xpp.next();
    +        while (event != XmlPullParser.END_TAG || !xpp.getName().equals("notificationGroup")) {
    +            if (event == XmlPullParser.START_TAG) {
    +                if (xpp.getName().equals("package")) {
    +                    String pkg = xpp.nextText();
    +                    notificationGroup.addPackage(pkg);
    +                }
    +            }
    +            event = xpp.next();
    +        }
    +
    +        /* we just loaded from XML, no need to save */
    +        notificationGroup.mDirty = false;
    +
    +        return notificationGroup;
    +    }
    +}
    diff --git a/core/java/android/app/NotificationManager.java b/core/java/android/app/NotificationManager.java
    index bf83f5edc1bcb..0acad759501fe 100644
    --- a/core/java/android/app/NotificationManager.java
    +++ b/core/java/android/app/NotificationManager.java
    @@ -17,11 +17,11 @@
     package android.app;
     
     import android.content.Context;
    -import android.os.Binder;
    -import android.os.RemoteException;
     import android.os.Handler;
     import android.os.IBinder;
    +import android.os.RemoteException;
     import android.os.ServiceManager;
    +import android.os.UserHandle;
     import android.util.Log;
     
     /**
    @@ -88,6 +88,11 @@ static public INotificationManager getService()
             mContext = context;
         }
     
    +    /** {@hide} */
    +    public static NotificationManager from(Context context) {
    +        return (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
    +    }
    +
         /**
          * Post a notification to be shown in the status bar. If a notification with
          * the same id has already been posted by your application and has not yet been canceled, it
    @@ -119,9 +124,35 @@ public void notify(String tag, int id, Notification notification)
             int[] idOut = new int[1];
             INotificationManager service = getService();
             String pkg = mContext.getPackageName();
    +        if (notification.sound != null) {
    +            notification.sound = notification.sound.getCanonicalUri();
    +        }
    +        if (localLOGV) Log.v(TAG, pkg + ": notify(" + id + ", " + notification + ")");
    +        try {
    +            service.enqueueNotificationWithTag(pkg, tag, id, notification, idOut,
    +                    UserHandle.myUserId());
    +            if (id != idOut[0]) {
    +                Log.w(TAG, "notify: id corrupted: sent " + id + ", got back " + idOut[0]);
    +            }
    +        } catch (RemoteException e) {
    +        }
    +    }
    +
    +    /**
    +     * @hide
    +     */
    +    public void notifyAsUser(String tag, int id, Notification notification, UserHandle user)
    +    {
    +        int[] idOut = new int[1];
    +        INotificationManager service = getService();
    +        String pkg = mContext.getPackageName();
    +        if (notification.sound != null) {
    +            notification.sound = notification.sound.getCanonicalUri();
    +        }
             if (localLOGV) Log.v(TAG, pkg + ": notify(" + id + ", " + notification + ")");
             try {
    -            service.enqueueNotificationWithTag(pkg, tag, id, notification, idOut);
    +            service.enqueueNotificationWithTag(pkg, tag, id, notification, idOut,
    +                    user.getIdentifier());
                 if (id != idOut[0]) {
                     Log.w(TAG, "notify: id corrupted: sent " + id + ", got back " + idOut[0]);
                 }
    @@ -150,7 +181,21 @@ public void cancel(String tag, int id)
             String pkg = mContext.getPackageName();
             if (localLOGV) Log.v(TAG, pkg + ": cancel(" + id + ")");
             try {
    -            service.cancelNotificationWithTag(pkg, tag, id);
    +            service.cancelNotificationWithTag(pkg, tag, id, UserHandle.myUserId());
    +        } catch (RemoteException e) {
    +        }
    +    }
    +
    +    /**
    +     * @hide
    +     */
    +    public void cancelAsUser(String tag, int id, UserHandle user)
    +    {
    +        INotificationManager service = getService();
    +        String pkg = mContext.getPackageName();
    +        if (localLOGV) Log.v(TAG, pkg + ": cancel(" + id + ")");
    +        try {
    +            service.cancelNotificationWithTag(pkg, tag, id, user.getIdentifier());
             } catch (RemoteException e) {
             }
         }
    @@ -165,7 +210,7 @@ public void cancelAll()
             String pkg = mContext.getPackageName();
             if (localLOGV) Log.v(TAG, pkg + ": cancelAll()");
             try {
    -            service.cancelAllNotifications(pkg);
    +            service.cancelAllNotifications(pkg, UserHandle.myUserId());
             } catch (RemoteException e) {
             }
         }
    diff --git a/core/java/android/app/PendingIntent.java b/core/java/android/app/PendingIntent.java
    index 8adc8a2625af6..d36d99deeb444 100644
    --- a/core/java/android/app/PendingIntent.java
    +++ b/core/java/android/app/PendingIntent.java
    @@ -27,12 +27,13 @@
     import android.os.IBinder;
     import android.os.Parcel;
     import android.os.Parcelable;
    +import android.os.UserHandle;
     import android.util.AndroidException;
     
     /**
      * A description of an Intent and target action to perform with it.  Instances
    - * of this class are created with {@link #getActivity},
    - * {@link #getBroadcast}, {@link #getService}; the returned object can be
    + * of this class are created with {@link #getActivity}, {@link #getActivities},
    + * {@link #getBroadcast}, and {@link #getService}; the returned object can be
      * handed to other applications so that they can perform the action you
      * described on your behalf at a later time.
      *
    @@ -53,6 +54,34 @@
      * categories, and components, and same flags), it will receive a PendingIntent
      * representing the same token if that is still valid, and can thus call
      * {@link #cancel} to remove it.
    + *
    + * 

    Because of this behavior, it is important to know when two Intents + * are considered to be the same for purposes of retrieving a PendingIntent. + * A common mistake people make is to create multiple PendingIntent objects + * with Intents that only vary in their "extra" contents, expecting to get + * a different PendingIntent each time. This does not happen. The + * parts of the Intent that are used for matching are the same ones defined + * by {@link Intent#filterEquals(Intent) Intent.filterEquals}. If you use two + * Intent objects that are equivalent as per + * {@link Intent#filterEquals(Intent) Intent.filterEquals}, then you will get + * the same PendingIntent for both of them. + * + *

    There are two typical ways to deal with this. + * + *

    If you truly need multiple distinct PendingIntent objects active at + * the same time (such as to use as two notifications that are both shown + * at the same time), then you will need to ensure there is something that + * is different about them to associate them with different PendingIntents. + * This may be any of the Intent attributes considered by + * {@link Intent#filterEquals(Intent) Intent.filterEquals}, or different + * request code integers supplied to {@link #getActivity}, {@link #getActivities}, + * {@link #getBroadcast}, or {@link #getService}. + * + *

    If you only need one PendingIntent active at a time for any of the + * Intents you will use, then you can alternatively use the flags + * {@link #FLAG_CANCEL_CURRENT} or {@link #FLAG_UPDATE_CURRENT} to either + * cancel or modify whatever current PendingIntent is associated with the + * Intent you are supplying. */ public final class PendingIntent implements Parcelable { private final IIntentSender mTarget; @@ -146,8 +175,8 @@ private static class FinishedDispatcher extends IIntentReceiver.Stub mWho = who; mHandler = handler; } - public void performReceive(Intent intent, int resultCode, - String data, Bundle extras, boolean serialized, boolean sticky) { + public void performReceive(Intent intent, int resultCode, String data, + Bundle extras, boolean serialized, boolean sticky, int sendingUser) { mIntent = intent; mResultCode = resultCode; mResultData = data; @@ -227,7 +256,31 @@ public static PendingIntent getActivity(Context context, int requestCode, ActivityManager.INTENT_SENDER_ACTIVITY, packageName, null, null, requestCode, new Intent[] { intent }, resolvedType != null ? new String[] { resolvedType } : null, - flags, options); + flags, options, UserHandle.myUserId()); + return target != null ? new PendingIntent(target) : null; + } catch (RemoteException e) { + } + return null; + } + + /** + * @hide + * Note that UserHandle.CURRENT will be interpreted at the time the + * activity is started, not when the pending intent is created. + */ + public static PendingIntent getActivityAsUser(Context context, int requestCode, + Intent intent, int flags, Bundle options, UserHandle user) { + String packageName = context.getPackageName(); + String resolvedType = intent != null ? intent.resolveTypeIfNeeded( + context.getContentResolver()) : null; + try { + intent.setAllowFds(false); + IIntentSender target = + ActivityManagerNative.getDefault().getIntentSender( + ActivityManager.INTENT_SENDER_ACTIVITY, packageName, + null, null, requestCode, new Intent[] { intent }, + resolvedType != null ? new String[] { resolvedType } : null, + flags, options, user.getIdentifier()); return target != null ? new PendingIntent(target) : null; } catch (RemoteException e) { } @@ -333,7 +386,33 @@ public static PendingIntent getActivities(Context context, int requestCode, IIntentSender target = ActivityManagerNative.getDefault().getIntentSender( ActivityManager.INTENT_SENDER_ACTIVITY, packageName, - null, null, requestCode, intents, resolvedTypes, flags, options); + null, null, requestCode, intents, resolvedTypes, flags, options, + UserHandle.myUserId()); + return target != null ? new PendingIntent(target) : null; + } catch (RemoteException e) { + } + return null; + } + + /** + * @hide + * Note that UserHandle.CURRENT will be interpreted at the time the + * activity is started, not when the pending intent is created. + */ + public static PendingIntent getActivitiesAsUser(Context context, int requestCode, + Intent[] intents, int flags, Bundle options, UserHandle user) { + String packageName = context.getPackageName(); + String[] resolvedTypes = new String[intents.length]; + for (int i=0; i 0 ? new UserHandle(UserHandle.getUserId(uid)) : null; + } catch (RemoteException e) { + // Should never happen. + return null; + } + } + /** * @hide * Check to verify that this PendingIntent targets a specific package. diff --git a/core/java/android/app/Presentation.java b/core/java/android/app/Presentation.java new file mode 100644 index 0000000000000..16a0c57e1eefb --- /dev/null +++ b/core/java/android/app/Presentation.java @@ -0,0 +1,353 @@ +/* + * 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.app; + +import android.content.Context; +import android.content.res.Resources; +import android.hardware.display.DisplayManager; +import android.hardware.display.DisplayManager.DisplayListener; +import android.view.ContextThemeWrapper; +import android.view.Display; +import android.view.Gravity; +import android.view.WindowManagerImpl; +import android.os.Handler; +import android.os.Message; +import android.util.DisplayMetrics; +import android.util.Log; +import android.util.TypedValue; + +/** + * Base class for presentations. + *

    + * A presentation is a special kind of dialog whose purpose is to present + * content on a secondary display. A {@link Presentation} is associated with + * the target {@link Display} at creation time and configures its context and + * resource configuration according to the display's metrics. + *

    + * Notably, the {@link Context} of a presentation is different from the context + * of its containing {@link Activity}. It is important to inflate the layout + * of a presentation and load other resources using the presentation's own context + * to ensure that assets of the correct size and density for the target display + * are loaded. + *

    + * A presentation is automatically canceled (see {@link Dialog#cancel()}) when + * the display to which it is attached is removed. An activity should take + * care of pausing and resuming whatever content is playing within the presentation + * whenever the activity itself is paused or resumed. + *

    + * + *

    Choosing a presentation display

    + *

    + * Before showing a {@link Presentation} it's important to choose the {@link Display} + * on which it will appear. Choosing a presentation display is sometimes difficult + * because there may be multiple displays attached. Rather than trying to guess + * which display is best, an application should let the system choose a suitable + * presentation display. + *

    + * There are two main ways to choose a {@link Display}. + *

    + * + *

    Using the media router to choose a presentation display

    + *

    + * The easiest way to choose a presentation display is to use the + * {@link android.media.MediaRouter MediaRouter} API. The media router service keeps + * track of which audio and video routes are available on the system. + * The media router sends notifications whenever routes are selected or unselected + * or when the preferred presentation display of a route changes. + * So an application can simply watch for these notifications and show or dismiss + * a presentation on the preferred presentation display automatically. + *

    + * The preferred presentation display is the display that the media router recommends + * that the application should use if it wants to show content on the secondary display. + * Sometimes there may not be a preferred presentation display in which + * case the application should show its content locally without using a presentation. + *

    + * Here's how to use the media router to create and show a presentation on the preferred + * presentation display using {@link android.media.MediaRouter.RouteInfo#getPresentationDisplay()}. + *

    + *
    + * MediaRouter mediaRouter = (MediaRouter) context.getSystemService(Context.MEDIA_ROUTER_SERVICE);
    + * MediaRouter.RouteInfo route = mediaRouter.getSelectedRoute();
    + * if (route != null) {
    + *     Display presentationDisplay = route.getPresentationDisplay();
    + *     if (presentationDisplay != null) {
    + *         Presentation presentation = new MyPresentation(context, presentationDisplay);
    + *         presentation.show();
    + *     }
    + * }
    + *

    + * The following sample code from ApiDemos demonstrates how to use the media + * router to automatically switch between showing content in the main activity and showing + * the content in a presentation when a presentation display is available. + *

    + * {@sample development/samples/ApiDemos/src/com/example/android/apis/app/PresentationWithMediaRouterActivity.java + * activity} + * + *

    Using the display manager to choose a presentation display

    + *

    + * Another way to choose a presentation display is to use the {@link DisplayManager} API + * directly. The display manager service provides functions to enumerate and describe all + * displays that are attached to the system including displays that may be used + * for presentations. + *

    + * The display manager keeps track of all displays in the system. However, not all + * displays are appropriate for showing presentations. For example, if an activity + * attempted to show a presentation on the main display it might obscure its own content + * (it's like opening a dialog on top of your activity). + *

    + * Here's how to identify suitable displays for showing presentations using + * {@link DisplayManager#getDisplays(String)} and the + * {@link DisplayManager#DISPLAY_CATEGORY_PRESENTATION} category. + *

    + *
    + * DisplayManager displayManager = (DisplayManager) context.getSystemService(Context.DISPLAY_SERVICE);
    + * Display[] presentationDisplays = displayManager.getDisplays(DisplayManager.DISPLAY_CATEGORY_PRESENTATION);
    + * if (presentationDisplays.length > 0) {
    + *     // If there is more than one suitable presentation display, then we could consider
    + *     // giving the user a choice.  For this example, we simply choose the first display
    + *     // which is the one the system recommends as the preferred presentation display.
    + *     Display display = presentationDisplays[0];
    + *     Presentation presentation = new MyPresentation(context, presentationDisplay);
    + *     presentation.show();
    + * }
    + *

    + * The following sample code from ApiDemos demonstrates how to use the display + * manager to enumerate displays and show content on multiple presentation displays + * simultaneously. + *

    + * {@sample development/samples/ApiDemos/src/com/example/android/apis/app/PresentationActivity.java + * activity} + * + * @see android.media.MediaRouter#ROUTE_TYPE_LIVE_VIDEO for information on about live + * video routes and how to obtain the preferred presentation display for the + * current media route. + * @see DisplayManager for information on how to enumerate displays and receive + * notifications when displays are added or removed. + */ +public class Presentation extends Dialog { + private static final String TAG = "Presentation"; + + private static final int MSG_CANCEL = 1; + + private final Display mDisplay; + private final DisplayManager mDisplayManager; + + /** + * Creates a new presentation that is attached to the specified display + * using the default theme. + * + * @param outerContext The context of the application that is showing the presentation. + * The presentation will create its own context (see {@link #getContext()}) based + * on this context and information about the associated display. + * @param display The display to which the presentation should be attached. + */ + public Presentation(Context outerContext, Display display) { + this(outerContext, display, 0); + } + + /** + * Creates a new presentation that is attached to the specified display + * using the optionally specified theme. + * + * @param outerContext The context of the application that is showing the presentation. + * The presentation will create its own context (see {@link #getContext()}) based + * on this context and information about the associated display. + * @param display The display to which the presentation should be attached. + * @param theme A style resource describing the theme to use for the window. + * See
    + * Style and Theme Resources for more information about defining and using + * styles. This theme is applied on top of the current theme in + * outerContext. If 0, the default presentation theme will be used. + */ + public Presentation(Context outerContext, Display display, int theme) { + super(createPresentationContext(outerContext, display, theme), theme, false); + + mDisplay = display; + mDisplayManager = (DisplayManager)getContext().getSystemService(Context.DISPLAY_SERVICE); + + getWindow().setGravity(Gravity.FILL); + setCanceledOnTouchOutside(false); + } + + /** + * Gets the {@link Display} that this presentation appears on. + * + * @return The display. + */ + public Display getDisplay() { + return mDisplay; + } + + /** + * Gets the {@link Resources} that should be used to inflate the layout of this presentation. + * This resources object has been configured according to the metrics of the + * display that the presentation appears on. + * + * @return The presentation resources object. + */ + public Resources getResources() { + return getContext().getResources(); + } + + @Override + protected void onStart() { + super.onStart(); + mDisplayManager.registerDisplayListener(mDisplayListener, mHandler); + + // Since we were not watching for display changes until just now, there is a + // chance that the display metrics have changed. If so, we will need to + // dismiss the presentation immediately. This case is expected + // to be rare but surprising, so we'll write a log message about it. + if (!isConfigurationStillValid()) { + Log.i(TAG, "Presentation is being immediately dismissed because the " + + "display metrics have changed since it was created."); + mHandler.sendEmptyMessage(MSG_CANCEL); + } + } + + @Override + protected void onStop() { + mDisplayManager.unregisterDisplayListener(mDisplayListener); + super.onStop(); + } + + /** + * Inherited from {@link Dialog#show}. Will throw + * {@link android.view.WindowManager.InvalidDisplayException} if the specified secondary + * {@link Display} can't be found. + */ + @Override + public void show() { + super.show(); + } + + /** + * Called by the system when the {@link Display} to which the presentation + * is attached has been removed. + * + * The system automatically calls {@link #cancel} to dismiss the presentation + * after sending this event. + * + * @see #getDisplay + */ + public void onDisplayRemoved() { + } + + /** + * Called by the system when the properties of the {@link Display} to which + * the presentation is attached have changed. + * + * If the display metrics have changed (for example, if the display has been + * resized or rotated), then the system automatically calls + * {@link #cancel} to dismiss the presentation. + * + * @see #getDisplay + */ + public void onDisplayChanged() { + } + + private void handleDisplayRemoved() { + onDisplayRemoved(); + cancel(); + } + + private void handleDisplayChanged() { + onDisplayChanged(); + + // We currently do not support configuration changes for presentations + // (although we could add that feature with a bit more work). + // If the display metrics have changed in any way then the current configuration + // is invalid and the application must recreate the presentation to get + // a new context. + if (!isConfigurationStillValid()) { + cancel(); + } + } + + private boolean isConfigurationStillValid() { + DisplayMetrics dm = new DisplayMetrics(); + mDisplay.getMetrics(dm); + return dm.equals(getResources().getDisplayMetrics()); + } + + private static Context createPresentationContext( + Context outerContext, Display display, int theme) { + if (outerContext == null) { + throw new IllegalArgumentException("outerContext must not be null"); + } + if (display == null) { + throw new IllegalArgumentException("display must not be null"); + } + + Context displayContext = outerContext.createDisplayContext(display); + if (theme == 0) { + TypedValue outValue = new TypedValue(); + displayContext.getTheme().resolveAttribute( + com.android.internal.R.attr.presentationTheme, outValue, true); + theme = outValue.resourceId; + } + + // Derive the display's window manager from the outer window manager. + // We do this because the outer window manager have some extra information + // such as the parent window, which is important if the presentation uses + // an application window type. + final WindowManagerImpl outerWindowManager = + (WindowManagerImpl)outerContext.getSystemService(Context.WINDOW_SERVICE); + final WindowManagerImpl displayWindowManager = + outerWindowManager.createPresentationWindowManager(display); + return new ContextThemeWrapper(displayContext, theme) { + @Override + public Object getSystemService(String name) { + if (Context.WINDOW_SERVICE.equals(name)) { + return displayWindowManager; + } + return super.getSystemService(name); + } + }; + } + + private final DisplayListener mDisplayListener = new DisplayListener() { + @Override + public void onDisplayAdded(int displayId) { + } + + @Override + public void onDisplayRemoved(int displayId) { + if (displayId == mDisplay.getDisplayId()) { + handleDisplayRemoved(); + } + } + + @Override + public void onDisplayChanged(int displayId) { + if (displayId == mDisplay.getDisplayId()) { + handleDisplayChanged(); + } + } + }; + + private final Handler mHandler = new Handler() { + @Override + public void handleMessage(Message msg) { + switch (msg.what) { + case MSG_CANCEL: + cancel(); + break; + } + } + }; +} diff --git a/core/java/android/app/Profile.aidl b/core/java/android/app/Profile.aidl new file mode 100644 index 0000000000000..d75bd76399859 --- /dev/null +++ b/core/java/android/app/Profile.aidl @@ -0,0 +1,19 @@ +/** + * 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. + */ + +package android.app; + +parcelable Profile; diff --git a/core/java/android/app/Profile.java b/core/java/android/app/Profile.java new file mode 100644 index 0000000000000..41250eb51d4c5 --- /dev/null +++ b/core/java/android/app/Profile.java @@ -0,0 +1,554 @@ +/* + * Copyright (C) 2011 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.app; + +import android.content.Context; +import android.media.AudioManager; +import android.os.Parcel; +import android.os.ParcelUuid; +import android.os.Parcelable; +import android.text.TextUtils; +import android.util.Log; + +import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +/** + * @hide + */ +public final class Profile implements Parcelable, Comparable { + + private String mName; + + private int mNameResId; + + private UUID mUuid; + + private ArrayList mSecondaryUuids = new ArrayList(); + + private Map profileGroups = new HashMap(); + + private ProfileGroup mDefaultGroup; + + private boolean mStatusBarIndicator = false; + + private boolean mDirty; + + private static final String TAG = "Profile"; + + private int mProfileType; + + private static final int CONDITIONAL_TYPE = 1; + + private static final int TOGGLE_TYPE = 0; + + private Map streams = new HashMap(); + + private Map connections = new HashMap(); + + private RingModeSettings mRingMode = new RingModeSettings(); + + private AirplaneModeSettings mAirplaneMode = new AirplaneModeSettings(); + + private int mScreenLockMode = LockMode.DEFAULT; + + /** @hide */ + public static class LockMode { + public static final int DEFAULT = 0; + public static final int INSECURE = 1; + public static final int DISABLE = 2; + } + + /** @hide */ + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + public Profile createFromParcel(Parcel in) { + return new Profile(in); + } + + @Override + public Profile[] newArray(int size) { + return new Profile[size]; + } + }; + + /** @hide */ + public Profile(String name) { + this(name, -1, UUID.randomUUID()); + } + + private Profile(String name, int nameResId, UUID uuid) { + mName = name; + mNameResId = nameResId; + mUuid = uuid; + mProfileType = TOGGLE_TYPE; //Default to toggle type + mDirty = false; + } + + private Profile(Parcel in) { + readFromParcel(in); + } + + public int compareTo(Object obj) + { + Profile tmp = (Profile) obj; + if (mName.compareTo(tmp.mName) < 0) { + return -1; + } else if (mName.compareTo(tmp.mName) > 0) { + return 1; + } + return 0; + } + + /** @hide */ + public void addProfileGroup(ProfileGroup value) { + if (value.isDefaultGroup()) { + /* we must not have more than one default group */ + if (mDefaultGroup != null) { + return; + } + mDefaultGroup = value; + } + profileGroups.put(value.getUuid(), value); + mDirty = true; + } + + /** @hide */ + public void removeProfileGroup(UUID uuid) { + if (!profileGroups.get(uuid).isDefaultGroup()) { + profileGroups.remove(uuid); + } else { + Log.e(TAG, "Cannot remove default group: " + uuid); + } + } + + public ProfileGroup[] getProfileGroups() { + return profileGroups.values().toArray(new ProfileGroup[profileGroups.size()]); + } + + public ProfileGroup getProfileGroup(UUID uuid) { + return profileGroups.get(uuid); + } + + public ProfileGroup getDefaultGroup() { + return mDefaultGroup; + } + + /** @hide */ + @Override + public int describeContents() { + return 0; + } + + /** @hide */ + @Override + public void writeToParcel(Parcel dest, int flags) { + dest.writeString(mName); + dest.writeInt(mNameResId); + new ParcelUuid(mUuid).writeToParcel(dest, 0); + ArrayList uuids = new ArrayList(mSecondaryUuids.size()); + for (UUID u : mSecondaryUuids) { + uuids.add(new ParcelUuid(u)); + } + dest.writeParcelableArray(uuids.toArray(new Parcelable[uuids.size()]), flags); + dest.writeInt(mStatusBarIndicator ? 1 : 0); + dest.writeInt(mProfileType); + dest.writeInt(mDirty ? 1 : 0); + dest.writeParcelableArray( + profileGroups.values().toArray(new Parcelable[profileGroups.size()]), flags); + dest.writeParcelableArray( + streams.values().toArray(new Parcelable[streams.size()]), flags); + dest.writeParcelableArray( + connections.values().toArray(new Parcelable[connections.size()]), flags); + dest.writeParcelable(mRingMode, flags); + dest.writeParcelable(mAirplaneMode, flags); + dest.writeInt(mScreenLockMode); + } + + /** @hide */ + public void readFromParcel(Parcel in) { + mName = in.readString(); + mNameResId = in.readInt(); + mUuid = ParcelUuid.CREATOR.createFromParcel(in).getUuid(); + for (Parcelable parcel : in.readParcelableArray(null)) { + ParcelUuid u = (ParcelUuid) parcel; + mSecondaryUuids.add(u.getUuid()); + } + mStatusBarIndicator = (in.readInt() == 1); + mProfileType = in.readInt(); + mDirty = (in.readInt() == 1); + for (Parcelable group : in.readParcelableArray(null)) { + ProfileGroup grp = (ProfileGroup) group; + profileGroups.put(grp.getUuid(), grp); + if (grp.isDefaultGroup()) { + mDefaultGroup = grp; + } + } + for (Parcelable parcel : in.readParcelableArray(null)) { + StreamSettings stream = (StreamSettings) parcel; + streams.put(stream.getStreamId(), stream); + } + for (Parcelable parcel : in.readParcelableArray(null)) { + ConnectionSettings connection = (ConnectionSettings) parcel; + connections.put(connection.getConnectionId(), connection); + } + mRingMode = (RingModeSettings) in.readParcelable(null); + mAirplaneMode = (AirplaneModeSettings) in.readParcelable(null); + mScreenLockMode = in.readInt(); + } + + public String getName() { + return mName; + } + + /** @hide */ + public void setName(String name) { + mName = name; + mNameResId = -1; + mDirty = true; + } + + public int getProfileType() { + return mProfileType; + } + + /** @hide */ + public void setProfileType(int type) { + mProfileType = type; + mDirty = true; + } + + public UUID getUuid() { + if (this.mUuid == null) this.mUuid = UUID.randomUUID(); + return this.mUuid; + } + + public UUID[] getSecondaryUuids() { + return mSecondaryUuids.toArray(new UUID[mSecondaryUuids.size()]); + } + + public void setSecondaryUuids(List uuids) { + mSecondaryUuids.clear(); + if (uuids != null) { + mSecondaryUuids.addAll(uuids); + mDirty = true; + } + } + + public void addSecondaryUuid(UUID uuid) { + if (uuid != null) { + mSecondaryUuids.add(uuid); + mDirty = true; + } + } + + public boolean getStatusBarIndicator() { + return mStatusBarIndicator; + } + + public void setStatusBarIndicator(boolean newStatusBarIndicator) { + mStatusBarIndicator = newStatusBarIndicator; + mDirty = true; + } + + public boolean isConditionalType() { + return(mProfileType == CONDITIONAL_TYPE ? true : false); + } + + public void setConditionalType() { + mProfileType = CONDITIONAL_TYPE; + mDirty = true; + } + + public RingModeSettings getRingMode() { + return mRingMode; + } + + public void setRingMode(RingModeSettings descriptor) { + mRingMode = descriptor; + mDirty = true; + } + + public int getScreenLockMode() { + return mScreenLockMode; + } + + public void setScreenLockMode(int screenLockMode) { + if (screenLockMode < LockMode.DEFAULT || screenLockMode > LockMode.DISABLE) { + mScreenLockMode = LockMode.DEFAULT; + } else { + mScreenLockMode = screenLockMode; + } + mDirty = true; + } + + public AirplaneModeSettings getAirplaneMode() { + return mAirplaneMode; + } + + public void setAirplaneMode(AirplaneModeSettings descriptor) { + mAirplaneMode = descriptor; + mDirty = true; + } + + /** @hide */ + public boolean isDirty() { + if (mDirty) { + return true; + } + for (ProfileGroup group : profileGroups.values()) { + if (group.isDirty()) { + return true; + } + } + for (StreamSettings stream : streams.values()) { + if (stream.isDirty()) { + return true; + } + } + for (ConnectionSettings conn : connections.values()) { + if (conn.isDirty()) { + return true; + } + } + if (mRingMode.isDirty()) { + return true; + } + if (mAirplaneMode.isDirty()) { + return true; + } + return false; + } + + /** @hide */ + public void getXmlString(StringBuilder builder, Context context) { + builder.append(" 0) { + builder.append("nameres=\""); + builder.append(context.getResources().getResourceEntryName(mNameResId)); + } else { + builder.append("name=\""); + builder.append(TextUtils.htmlEncode(getName())); + } + builder.append("\" uuid=\""); + builder.append(TextUtils.htmlEncode(getUuid().toString())); + builder.append("\">\n"); + + builder.append(""); + for (UUID u : mSecondaryUuids) { + builder.append(""); + builder.append(TextUtils.htmlEncode(u.toString())); + builder.append(""); + } + builder.append("\n"); + + builder.append(""); + builder.append(getProfileType() == TOGGLE_TYPE ? "toggle" : "conditional"); + builder.append("\n"); + + builder.append(""); + builder.append(getStatusBarIndicator() ? "yes" : "no"); + builder.append("\n"); + + builder.append(""); + builder.append(mScreenLockMode); + builder.append("\n"); + + mAirplaneMode.getXmlString(builder, context); + + mRingMode.getXmlString(builder, context); + + for (ProfileGroup pGroup : profileGroups.values()) { + pGroup.getXmlString(builder, context); + } + for (StreamSettings sd : streams.values()) { + sd.getXmlString(builder, context); + } + for (ConnectionSettings cs : connections.values()) { + cs.getXmlString(builder, context); + } + builder.append("\n"); + mDirty = false; + } + + private static List readSecondaryUuidsFromXml(XmlPullParser xpp, Context context) + throws XmlPullParserException, + IOException { + ArrayList uuids = new ArrayList(); + int event = xpp.next(); + while (event != XmlPullParser.END_TAG || !xpp.getName().equals("uuids")) { + if (event == XmlPullParser.START_TAG) { + String name = xpp.getName(); + if (name.equals("uuid")) { + try { + uuids.add(UUID.fromString(xpp.nextText())); + } catch (NullPointerException e) { + Log.w(TAG, "Null Pointer - invalid UUID"); + } catch (IllegalArgumentException e) { + Log.w(TAG, "UUID not recognized"); + } + } + } + event = xpp.next(); + } + return uuids; + } + + /** @hide */ + public static Profile fromXml(XmlPullParser xpp, Context context) + throws XmlPullParserException, IOException { + String value = xpp.getAttributeValue(null, "nameres"); + int profileNameResId = -1; + String profileName = null; + + if (value != null) { + profileNameResId = context.getResources().getIdentifier(value, "string", "android"); + if (profileNameResId > 0) { + profileName = context.getResources().getString(profileNameResId); + } + } + + if (profileName == null) { + profileName = xpp.getAttributeValue(null, "name"); + } + + UUID profileUuid = UUID.randomUUID(); + try { + profileUuid = UUID.fromString(xpp.getAttributeValue(null, "uuid")); + } catch (NullPointerException e) { + Log.w(TAG, + "Null Pointer - UUID not found for " + + profileName + + ". New UUID generated: " + + profileUuid.toString() + ); + } catch (IllegalArgumentException e) { + Log.w(TAG, + "UUID not recognized for " + + profileName + + ". New UUID generated: " + + profileUuid.toString() + ); + } + + Profile profile = new Profile(profileName, profileNameResId, profileUuid); + int event = xpp.next(); + while (event != XmlPullParser.END_TAG) { + if (event == XmlPullParser.START_TAG) { + String name = xpp.getName(); + if (name.equals("uuids")) { + profile.setSecondaryUuids(readSecondaryUuidsFromXml(xpp, context)); + } + if (name.equals("statusbar")) { + profile.setStatusBarIndicator(xpp.nextText().equals("yes")); + } + if (name.equals("profiletype")) { + profile.setProfileType(xpp.nextText().equals("toggle") ? TOGGLE_TYPE : CONDITIONAL_TYPE); + } + if (name.equals("ringModeDescriptor")) { + RingModeSettings smd = RingModeSettings.fromXml(xpp, context); + profile.setRingMode(smd); + } + if (name.equals("airplaneModeDescriptor")) { + AirplaneModeSettings amd = AirplaneModeSettings.fromXml(xpp, context); + profile.setAirplaneMode(amd); + } + if (name.equals("screen-lock-mode")) { + profile.setScreenLockMode(Integer.valueOf(xpp.nextText())); + } + if (name.equals("profileGroup")) { + ProfileGroup pg = ProfileGroup.fromXml(xpp, context); + profile.addProfileGroup(pg); + } + if (name.equals("streamDescriptor")) { + StreamSettings sd = StreamSettings.fromXml(xpp, context); + profile.setStreamSettings(sd); + } + if (name.equals("connectionDescriptor")) { + ConnectionSettings cs = ConnectionSettings.fromXml(xpp, context); + profile.connections.put(cs.getConnectionId(), cs); + } + } + event = xpp.next(); + } + + /* we just loaded from XML, so nothing needs saving */ + profile.mDirty = false; + + return profile; + } + + /** @hide */ + public void doSelect(Context context) { + // Set stream volumes + AudioManager am = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); + for (StreamSettings sd : streams.values()) { + if (sd.isOverride()) { + am.setStreamVolume(sd.getStreamId(), sd.getValue(), 0); + } + } + // Set connections + for (ConnectionSettings cs : connections.values()) { + if (cs.isOverride()) { + cs.processOverride(context); + } + } + // Set ring mode + mRingMode.processOverride(context); + // Set airplane mode + mAirplaneMode.processOverride(context); + } + + /** @hide */ + public StreamSettings getSettingsForStream(int streamId){ + return streams.get(streamId); + } + + /** @hide */ + public void setStreamSettings(StreamSettings descriptor){ + streams.put(descriptor.getStreamId(), descriptor); + mDirty = true; + } + + /** @hide */ + public Collection getStreamSettings(){ + return streams.values(); + } + + /** @hide */ + public ConnectionSettings getSettingsForConnection(int connectionId){ + return connections.get(connectionId); + } + + /** @hide */ + public void setConnectionSettings(ConnectionSettings descriptor){ + connections.put(descriptor.getConnectionId(), descriptor); + } + + /** @hide */ + public Collection getConnectionSettings(){ + return connections.values(); + } + +} diff --git a/core/java/android/app/ProfileGroup.java b/core/java/android/app/ProfileGroup.java new file mode 100644 index 0000000000000..b3b70d6db6a8d --- /dev/null +++ b/core/java/android/app/ProfileGroup.java @@ -0,0 +1,348 @@ +/* + * Copyright (C) 2011 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.app; + +import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; + +import android.content.Context; +import android.media.RingtoneManager; +import android.net.Uri; +import android.os.Parcel; +import android.os.Parcelable; +import android.os.ParcelUuid; +import android.text.TextUtils; +import android.util.Log; + +import java.io.IOException; +import java.util.UUID; + +/** + * @hide + */ +public final class ProfileGroup implements Parcelable { + private static final String TAG = "ProfileGroup"; + + private String mName; + private int mNameResId; + + private UUID mUuid; + + private Uri mSoundOverride = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); + private Uri mRingerOverride = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_RINGTONE); + + private Mode mSoundMode = Mode.DEFAULT; + private Mode mRingerMode = Mode.DEFAULT; + private Mode mVibrateMode = Mode.DEFAULT; + private Mode mLightsMode = Mode.DEFAULT; + + private boolean mDefaultGroup = false; + private boolean mDirty; + + /** @hide */ + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + public ProfileGroup createFromParcel(Parcel in) { + return new ProfileGroup(in); + } + + @Override + public ProfileGroup[] newArray(int size) { + return new ProfileGroup[size]; + } + }; + + /** @hide */ + public ProfileGroup(UUID uuid, boolean defaultGroup) { + this(null, uuid, defaultGroup); + } + + private ProfileGroup(String name, UUID uuid, boolean defaultGroup) { + mName = name; + mUuid = (uuid != null) ? uuid : UUID.randomUUID(); + mDefaultGroup = defaultGroup; + mDirty = uuid == null; + } + + /** @hide */ + private ProfileGroup(Parcel in) { + readFromParcel(in); + } + + /** @hide */ + public boolean matches(NotificationGroup group, boolean defaultGroup) { + if (mUuid.equals(group.getUuid())) { + return true; + } + + /* fallback matches for backwards compatibility */ + boolean matches = false; + + /* fallback attempt 1: match name */ + if (mName != null && mName.equals(group.getName())) { + matches = true; + /* fallback attempt 2: match for the 'defaultGroup' flag to match the wildcard group */ + } else if (mDefaultGroup && defaultGroup) { + matches = true; + } + + if (!matches) { + return false; + } + + mName = null; + mUuid = group.getUuid(); + mDirty = true; + + return true; + } + + public UUID getUuid() { + return mUuid; + } + + public boolean isDefaultGroup() { + return mDefaultGroup; + } + + /** @hide */ + public boolean isDirty() { + return mDirty; + } + + /** @hide */ + public void setSoundOverride(Uri sound) { + mSoundOverride = sound; + mDirty = true; + } + + public Uri getSoundOverride() { + return mSoundOverride; + } + + /** @hide */ + public void setRingerOverride(Uri ringer) { + mRingerOverride = ringer; + mDirty = true; + } + + public Uri getRingerOverride() { + return mRingerOverride; + } + + /** @hide */ + public void setSoundMode(Mode soundMode) { + mSoundMode = soundMode; + mDirty = true; + } + + public Mode getSoundMode() { + return mSoundMode; + } + + /** @hide */ + public void setRingerMode(Mode ringerMode) { + mRingerMode = ringerMode; + mDirty = true; + } + + public Mode getRingerMode() { + return mRingerMode; + } + + /** @hide */ + public void setVibrateMode(Mode vibrateMode) { + mVibrateMode = vibrateMode; + mDirty = true; + } + + public Mode getVibrateMode() { + return mVibrateMode; + } + + /** @hide */ + public void setLightsMode(Mode lightsMode) { + mLightsMode = lightsMode; + mDirty = true; + } + + public Mode getLightsMode() { + return mLightsMode; + } + + // TODO : add support for LEDs / screen etc. + + /** @hide */ + public Notification processNotification(Notification notification) { + + switch (mSoundMode) { + case OVERRIDE: + notification.sound = mSoundOverride; + break; + case SUPPRESS: + silenceNotification(notification); + break; + case DEFAULT: + } + switch (mVibrateMode) { + case OVERRIDE: + notification.defaults |= Notification.DEFAULT_VIBRATE; + break; + case SUPPRESS: + suppressVibrate(notification); + break; + case DEFAULT: + } + switch (mLightsMode) { + case OVERRIDE: + notification.defaults |= Notification.DEFAULT_LIGHTS; + break; + case SUPPRESS: + suppressLights(notification); + break; + case DEFAULT: + } + return notification; + } + + private void silenceNotification(Notification notification) { + notification.defaults &= (~Notification.DEFAULT_SOUND); + notification.sound = null; + } + + private void suppressVibrate(Notification notification) { + notification.defaults &= (~Notification.DEFAULT_VIBRATE); + notification.vibrate = null; + } + + private void suppressLights(Notification notification) { + notification.defaults &= (~Notification.DEFAULT_LIGHTS); + notification.flags &= (~Notification.FLAG_SHOW_LIGHTS); + } + + /** @hide */ + @Override + public int describeContents() { + return 0; + } + + /** @hide */ + @Override + public void writeToParcel(Parcel dest, int flags) { + dest.writeString(mName); + new ParcelUuid(mUuid).writeToParcel(dest, 0); + dest.writeInt(mDefaultGroup ? 1 : 0); + dest.writeInt(mDirty ? 1 : 0); + dest.writeParcelable(mSoundOverride, flags); + dest.writeParcelable(mRingerOverride, flags); + + dest.writeString(mSoundMode.name()); + dest.writeString(mRingerMode.name()); + dest.writeString(mVibrateMode.name()); + dest.writeString(mLightsMode.name()); + } + + /** @hide */ + public void readFromParcel(Parcel in) { + mName = in.readString(); + mUuid = ParcelUuid.CREATOR.createFromParcel(in).getUuid(); + mDefaultGroup = in.readInt() != 0; + mDirty = in.readInt() != 0; + mSoundOverride = in.readParcelable(null); + mRingerOverride = in.readParcelable(null); + + mSoundMode = Mode.valueOf(Mode.class, in.readString()); + mRingerMode = Mode.valueOf(Mode.class, in.readString()); + mVibrateMode = Mode.valueOf(Mode.class, in.readString()); + mLightsMode = Mode.valueOf(Mode.class, in.readString()); + } + + public enum Mode { + SUPPRESS, DEFAULT, OVERRIDE; + } + + /** @hide */ + public void getXmlString(StringBuilder builder, Context context) { + builder.append("\n"); + builder.append(TextUtils.htmlEncode(mSoundOverride.toString())); + builder.append("\n"); + builder.append(TextUtils.htmlEncode(mRingerOverride.toString())); + builder.append("\n"); + builder.append(mSoundMode); + builder.append("\n"); + builder.append(mRingerMode); + builder.append("\n"); + builder.append(mVibrateMode); + builder.append("\n"); + builder.append(mLightsMode); + builder.append("\n\n"); + mDirty = false; + } + + /** @hide */ + public static ProfileGroup fromXml(XmlPullParser xpp, Context context) + throws XmlPullParserException, IOException { + String name = xpp.getAttributeValue(null, "name"); + UUID uuid = null; + String value = xpp.getAttributeValue(null, "uuid"); + + if (value != null) { + try { + uuid = UUID.fromString(value); + } catch (IllegalArgumentException e) { + Log.w(TAG, "UUID not recognized for " + name + ", using new one."); + } + } + + value = xpp.getAttributeValue(null, "default"); + boolean defaultGroup = TextUtils.equals(value, "true"); + + ProfileGroup profileGroup = new ProfileGroup(name, uuid, defaultGroup); + int event = xpp.next(); + while (event != XmlPullParser.END_TAG || !xpp.getName().equals("profileGroup")) { + if (event == XmlPullParser.START_TAG) { + name = xpp.getName(); + if (name.equals("sound")) { + profileGroup.setSoundOverride(Uri.parse(xpp.nextText())); + } else if (name.equals("ringer")) { + profileGroup.setRingerOverride(Uri.parse(xpp.nextText())); + } else if (name.equals("soundMode")) { + profileGroup.setSoundMode(Mode.valueOf(xpp.nextText())); + } else if (name.equals("ringerMode")) { + profileGroup.setRingerMode(Mode.valueOf(xpp.nextText())); + } else if (name.equals("vibrateMode")) { + profileGroup.setVibrateMode(Mode.valueOf(xpp.nextText())); + } else if (name.equals("lightsMode")) { + profileGroup.setLightsMode(Mode.valueOf(xpp.nextText())); + } + } + event = xpp.next(); + } + + /* we just loaded from XML, no need to save */ + profileGroup.mDirty = false; + + return profileGroup; + } +} diff --git a/core/java/android/app/ProfileManager.java b/core/java/android/app/ProfileManager.java new file mode 100644 index 0000000000000..5ce52d563f414 --- /dev/null +++ b/core/java/android/app/ProfileManager.java @@ -0,0 +1,287 @@ +/* + * Copyright (C) 2011 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.app; + +import java.util.UUID; + +import android.content.Context; +import android.os.Handler; +import android.os.IBinder; +import android.os.ParcelUuid; +import android.os.RemoteException; +import android.os.ServiceManager; +import android.provider.Settings; +import android.util.Log; + +import com.android.internal.R; + + +/** + * @hide + */ +public class ProfileManager { + + private static IProfileManager sService; + + private Context mContext; + + private static final String TAG = "ProfileManager"; + + private static final String SYSTEM_PROFILES_ENABLED = "system_profiles_enabled"; + + // A blank profile that is created to be returned if profiles disabled + private static Profile mEmptyProfile; + + /** @hide */ + static public IProfileManager getService() { + if (sService != null) { + return sService; + } + IBinder b = ServiceManager.getService(Context.PROFILE_SERVICE); + sService = IProfileManager.Stub.asInterface(b); + return sService; + } + + /** @hide */ + ProfileManager(Context context, Handler handler) { + mContext = context; + mEmptyProfile = new Profile("EmptyProfile"); + } + + @Deprecated + public void setActiveProfile(String profileName) { + if (Settings.System.getInt(mContext.getContentResolver(), + SYSTEM_PROFILES_ENABLED, 1) == 1) { + // Profiles are enabled, return active profile + try { + getService().setActiveProfileByName(profileName); + } catch (RemoteException e) { + Log.e(TAG, e.getLocalizedMessage(), e); + } + } + } + + public void setActiveProfile(UUID profileUuid) { + if (Settings.System.getInt(mContext.getContentResolver(), + SYSTEM_PROFILES_ENABLED, 1) == 1) { + // Profiles are enabled, return active profile + try { + getService().setActiveProfile(new ParcelUuid(profileUuid)); + } catch (RemoteException e) { + Log.e(TAG, e.getLocalizedMessage(), e); + } + } + } + + public Profile getActiveProfile() { + if (Settings.System.getInt(mContext.getContentResolver(), + SYSTEM_PROFILES_ENABLED, 1) == 1) { + // Profiles are enabled, return active profile + try { + return getService().getActiveProfile(); + } catch (RemoteException e) { + Log.e(TAG, e.getLocalizedMessage(), e); + } + return null; + + } else { + // Profiles are not enabled, return the empty profile + return mEmptyProfile; + } + + } + + /** @hide */ + public void addProfile(Profile profile) { + try { + getService().addProfile(profile); + } catch (RemoteException e) { + Log.e(TAG, e.getLocalizedMessage(), e); + } + } + + /** @hide */ + public void removeProfile(Profile profile) { + try { + getService().removeProfile(profile); + } catch (RemoteException e) { + Log.e(TAG, e.getLocalizedMessage(), e); + } + } + + /** @hide */ + public void updateProfile(Profile profile) { + try { + getService().updateProfile(profile); + } catch (RemoteException e) { + Log.e(TAG, e.getLocalizedMessage(), e); + } + } + + @Deprecated + public Profile getProfile(String profileName) { + try { + return getService().getProfileByName(profileName); + } catch (RemoteException e) { + Log.e(TAG, e.getLocalizedMessage(), e); + } + return null; + } + + public Profile getProfile(UUID profileUuid) { + try { + return getService().getProfile(new ParcelUuid(profileUuid)); + } catch (RemoteException e) { + Log.e(TAG, e.getLocalizedMessage(), e); + } + return null; + } + + public String[] getProfileNames() { + try { + Profile[] profiles = getService().getProfiles(); + String[] names = new String[profiles.length]; + for (int i = 0; i < profiles.length; i++) { + names[i] = profiles[i].getName(); + } + return names; + } catch (RemoteException e) { + Log.e(TAG, e.getLocalizedMessage(), e); + } + return null; + } + + public Profile[] getProfiles() { + try { + return getService().getProfiles(); + } catch (RemoteException e) { + Log.e(TAG, e.getLocalizedMessage(), e); + } + return null; + } + + public boolean profileExists(String profileName) { + try { + return getService().profileExistsByName(profileName); + } catch (RemoteException e) { + Log.e(TAG, e.getLocalizedMessage(), e); + // To be on the safe side, we'll return "true", to prevent duplicate profiles + // from being created. + return true; + } + } + + public boolean profileExists(UUID profileUuid) { + try { + return getService().profileExists(new ParcelUuid(profileUuid)); + } catch (RemoteException e) { + Log.e(TAG, e.getLocalizedMessage(), e); + // To be on the safe side, we'll return "true", to prevent duplicate profiles + // from being created. + return true; + } + } + + public boolean notificationGroupExists(String notificationGroupName) { + try { + return getService().notificationGroupExistsByName(notificationGroupName); + } catch (RemoteException e) { + Log.e(TAG, e.getLocalizedMessage(), e); + // To be on the safe side, we'll return "true", to prevent duplicate notification + // groups from being created. + return true; + } + } + + /** @hide */ + public NotificationGroup[] getNotificationGroups() { + try { + return getService().getNotificationGroups(); + } catch (RemoteException e) { + Log.e(TAG, e.getLocalizedMessage(), e); + } + return null; + } + + /** @hide */ + public void addNotificationGroup(NotificationGroup group) { + try { + getService().addNotificationGroup(group); + } catch (RemoteException e) { + Log.e(TAG, e.getLocalizedMessage(), e); + } + } + + /** @hide */ + public void removeNotificationGroup(NotificationGroup group) { + try { + getService().removeNotificationGroup(group); + } catch (RemoteException e) { + Log.e(TAG, e.getLocalizedMessage(), e); + } + } + + /** @hide */ + public void updateNotificationGroup(NotificationGroup group) { + try { + getService().updateNotificationGroup(group); + } catch (RemoteException e) { + Log.e(TAG, e.getLocalizedMessage(), e); + } + } + + /** @hide */ + public NotificationGroup getNotificationGroupForPackage(String pkg) { + try { + return getService().getNotificationGroupForPackage(pkg); + } catch (RemoteException e) { + Log.e(TAG, e.getLocalizedMessage(), e); + } + return null; + } + + /** @hide */ + public NotificationGroup getNotificationGroup(UUID uuid) { + try { + return getService().getNotificationGroup(new ParcelUuid(uuid)); + } catch (RemoteException e) { + Log.e(TAG, e.getLocalizedMessage(), e); + } + return null; + } + + /** @hide */ + public ProfileGroup getActiveProfileGroup(String packageName) { + NotificationGroup notificationGroup = getNotificationGroupForPackage(packageName); + if(notificationGroup == null){ + ProfileGroup defaultGroup = getActiveProfile().getDefaultGroup(); + return defaultGroup; + } + return getActiveProfile().getProfileGroup(notificationGroup.getUuid()); + } + + /** @hide */ + public void resetAll() { + try { + getService().resetAll(); + } catch (RemoteException e) { + Log.e(TAG, e.getLocalizedMessage(), e); + } catch (SecurityException e) { + Log.e(TAG, e.getLocalizedMessage(), e); + } + } +} diff --git a/core/java/android/app/RingModeSettings.java b/core/java/android/app/RingModeSettings.java new file mode 100644 index 0000000000000..72714f24a5006 --- /dev/null +++ b/core/java/android/app/RingModeSettings.java @@ -0,0 +1,135 @@ +package android.app; + +import android.content.Context; +import android.media.AudioManager; +import android.os.Parcel; +import android.os.Parcelable; + +import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; + +import java.io.IOException; + +/** @hide */ +public final class RingModeSettings implements Parcelable { + private static final String RING_MODE_NORMAL = "normal"; + private static final String RING_MODE_VIBRATE = "vibrate"; + private static final String RING_MODE_MUTE = "mute"; + + private String mValue; + private boolean mOverride; + private boolean mDirty; + + /** @hide */ + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + public RingModeSettings createFromParcel(Parcel in) { + return new RingModeSettings(in); + } + + @Override + public RingModeSettings[] newArray(int size) { + return new RingModeSettings[size]; + } + }; + + + public RingModeSettings(Parcel parcel) { + readFromParcel(parcel); + } + + public RingModeSettings() { + this(RING_MODE_NORMAL, false); + } + + public RingModeSettings(String value, boolean override) { + mValue = value; + mOverride = override; + mDirty = false; + } + + public String getValue() { + return mValue; + } + + public void setValue(String value) { + mValue = value; + mDirty = true; + } + + public void setOverride(boolean override) { + mOverride = override; + mDirty = true; + } + + public boolean isOverride() { + return mOverride; + } + + /** @hide */ + public boolean isDirty() { + return mDirty; + } + + public void processOverride(Context context) { + if (isOverride()) { + int ringerMode = AudioManager.RINGER_MODE_NORMAL; + if (mValue.equals(RING_MODE_MUTE)) { + ringerMode = AudioManager.RINGER_MODE_SILENT; + } else if (mValue.equals(RING_MODE_VIBRATE)) { + ringerMode = AudioManager.RINGER_MODE_VIBRATE; + } + AudioManager amgr = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); + amgr.setRingerMode(ringerMode); + } + } + + /** @hide */ + public static RingModeSettings fromXml(XmlPullParser xpp, Context context) + throws XmlPullParserException, IOException { + int event = xpp.next(); + RingModeSettings connectionDescriptor = new RingModeSettings(); + while (event != XmlPullParser.END_TAG) { + if (event == XmlPullParser.START_TAG) { + String name = xpp.getName(); + if (name.equals("value")) { + connectionDescriptor.mValue = xpp.nextText(); + } else if (name.equals("override")) { + connectionDescriptor.mOverride = Boolean.parseBoolean(xpp.nextText()); + } + } + event = xpp.next(); + } + return connectionDescriptor; + } + + /** @hide */ + public void getXmlString(StringBuilder builder, Context context) { + builder.append("\n"); + builder.append(mValue); + builder.append("\n"); + builder.append(mOverride); + builder.append("\n\n"); + } + + @Override + public int describeContents() { + return 0; + } + + /** @hide */ + @Override + public void writeToParcel(Parcel dest, int flags) { + dest.writeInt(mOverride ? 1 : 0); + dest.writeString(mValue); + dest.writeInt(mDirty ? 1 : 0); + } + + /** @hide */ + public void readFromParcel(Parcel in) { + mOverride = in.readInt() != 0; + mValue = in.readString(); + mDirty = in.readInt() != 0; + } + + +} diff --git a/core/java/android/app/SearchManager.java b/core/java/android/app/SearchManager.java index d1d51310d6f8e..43a163dcf0672 100644 --- a/core/java/android/app/SearchManager.java +++ b/core/java/android/app/SearchManager.java @@ -31,6 +31,7 @@ import android.os.Handler; import android.os.RemoteException; import android.os.ServiceManager; +import android.os.UserHandle; import android.text.TextUtils; import android.util.Log; import android.util.Slog; @@ -845,14 +846,28 @@ public List getSearchablesInGlobalSearch() { * * @hide */ - public static final Intent getAssistIntent(Context context) { - PackageManager pm = context.getPackageManager(); - Intent intent = new Intent(Intent.ACTION_ASSIST); - ComponentName component = intent.resolveActivity(pm); - if (component != null) { - intent.setComponent(component); + public Intent getAssistIntent(Context context) { + return getAssistIntent(context, UserHandle.myUserId()); + } + + /** + * Gets an intent for launching installed assistant activity, or null if not available. + * @return The assist intent. + * + * @hide + */ + public Intent getAssistIntent(Context context, int userHandle) { + try { + ComponentName comp = mService.getAssistIntent(userHandle); + if (comp == null) { + return null; + } + Intent intent = new Intent(Intent.ACTION_ASSIST); + intent.setComponent(comp); return intent; + } catch (RemoteException re) { + Log.e(TAG, "getAssistIntent() failed: " + re); + return null; } - return null; } } diff --git a/core/java/android/app/SearchableInfo.java b/core/java/android/app/SearchableInfo.java index 5482f605ec8fc..922ebdd9cc470 100644 --- a/core/java/android/app/SearchableInfo.java +++ b/core/java/android/app/SearchableInfo.java @@ -24,10 +24,12 @@ import android.content.pm.ActivityInfo; import android.content.pm.PackageManager; import android.content.pm.ProviderInfo; +import android.content.pm.PackageManager.NameNotFoundException; import android.content.res.TypedArray; import android.content.res.XmlResourceParser; import android.os.Parcel; import android.os.Parcelable; +import android.os.UserHandle; import android.text.InputType; import android.util.AttributeSet; import android.util.Log; @@ -510,16 +512,25 @@ private void addActionKey(ActionKeyInfo keyInfo) { * * @hide For use by SearchManagerService. */ - public static SearchableInfo getActivityMetaData(Context context, ActivityInfo activityInfo) { + public static SearchableInfo getActivityMetaData(Context context, ActivityInfo activityInfo, + int userId) { + Context userContext = null; + try { + userContext = context.createPackageContextAsUser("system", 0, + new UserHandle(userId)); + } catch (NameNotFoundException nnfe) { + Log.e(LOG_TAG, "Couldn't create package context for user " + userId); + return null; + } // for each component, try to find metadata XmlResourceParser xml = - activityInfo.loadXmlMetaData(context.getPackageManager(), MD_LABEL_SEARCHABLE); + activityInfo.loadXmlMetaData(userContext.getPackageManager(), MD_LABEL_SEARCHABLE); if (xml == null) { return null; } ComponentName cName = new ComponentName(activityInfo.packageName, activityInfo.name); - SearchableInfo searchable = getActivityMetaData(context, xml, cName); + SearchableInfo searchable = getActivityMetaData(userContext, xml, cName); xml.close(); if (DBG) { diff --git a/core/java/android/app/SharedPreferencesImpl.java b/core/java/android/app/SharedPreferencesImpl.java index 615e8cea64c48..86fd7b977b1ad 100644 --- a/core/java/android/app/SharedPreferencesImpl.java +++ b/core/java/android/app/SharedPreferencesImpl.java @@ -17,7 +17,6 @@ package android.app; import android.content.SharedPreferences; -import android.os.FileUtils.FileStatus; import android.os.FileUtils; import android.os.Looper; import android.util.Log; @@ -45,6 +44,11 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutorService; +import libcore.io.ErrnoException; +import libcore.io.IoUtils; +import libcore.io.Libcore; +import libcore.io.StructStat; + final class SharedPreferencesImpl implements SharedPreferences { private static final String TAG = "SharedPreferencesImpl"; private static final boolean DEBUG = false; @@ -105,26 +109,32 @@ private void loadFromDiskLocked() { } Map map = null; - FileStatus stat = new FileStatus(); - if (FileUtils.getFileStatus(mFile.getPath(), stat) && mFile.canRead()) { - try { - BufferedInputStream str = new BufferedInputStream( - new FileInputStream(mFile), 16*1024); - map = XmlUtils.readMapXml(str); - str.close(); - } catch (XmlPullParserException e) { - Log.w(TAG, "getSharedPreferences", e); - } catch (FileNotFoundException e) { - Log.w(TAG, "getSharedPreferences", e); - } catch (IOException e) { - Log.w(TAG, "getSharedPreferences", e); + StructStat stat = null; + try { + stat = Libcore.os.stat(mFile.getPath()); + if (mFile.canRead()) { + BufferedInputStream str = null; + try { + str = new BufferedInputStream( + new FileInputStream(mFile), 16*1024); + map = XmlUtils.readMapXml(str); + } catch (XmlPullParserException e) { + Log.w(TAG, "getSharedPreferences", e); + } catch (FileNotFoundException e) { + Log.w(TAG, "getSharedPreferences", e); + } catch (IOException e) { + Log.w(TAG, "getSharedPreferences", e); + } finally { + IoUtils.closeQuietly(str); + } } + } catch (ErrnoException e) { } mLoaded = true; if (map != null) { mMap = map; - mStatTimestamp = stat.mtime; - mStatSize = stat.size; + mStatTimestamp = stat.st_mtime; + mStatSize = stat.st_size; } else { mMap = new HashMap(); } @@ -155,12 +165,21 @@ private boolean hasFileChangedUnexpectedly() { return false; } } - FileStatus stat = new FileStatus(); - if (!FileUtils.getFileStatus(mFile.getPath(), stat)) { + + final StructStat stat; + try { + /* + * Metadata operations don't usually count as a block guard + * violation, but we explicitly want this one. + */ + BlockGuard.getThreadPolicy().onReadFromDisk(); + stat = Libcore.os.stat(mFile.getPath()); + } catch (ErrnoException e) { return true; } + synchronized (this) { - return mStatTimestamp != stat.mtime || mStatSize != stat.size; + return mStatTimestamp != stat.st_mtime || mStatSize != stat.st_size; } } @@ -293,7 +312,8 @@ public Editor putString(String key, String value) { } public Editor putStringSet(String key, Set values) { synchronized (this) { - mModified.put(key, values); + mModified.put(key, + (values == null) ? null : new HashSet(values)); return this; } } @@ -577,12 +597,14 @@ private void writeToFile(MemoryCommitResult mcr) { FileUtils.sync(str); str.close(); ContextImpl.setFilePermissionsFromMode(mFile.getPath(), mMode, 0); - FileStatus stat = new FileStatus(); - if (FileUtils.getFileStatus(mFile.getPath(), stat)) { + try { + final StructStat stat = Libcore.os.stat(mFile.getPath()); synchronized (this) { - mStatTimestamp = stat.mtime; - mStatSize = stat.size; + mStatTimestamp = stat.st_mtime; + mStatSize = stat.st_size; } + } catch (ErrnoException e) { + // Do nothing } // Writing was successful, delete the backup file if there is one. mBackupFile.delete(); diff --git a/core/java/android/app/StatusBarManager.java b/core/java/android/app/StatusBarManager.java index dd9f3376d74ef..829b80ca7bc44 100644 --- a/core/java/android/app/StatusBarManager.java +++ b/core/java/android/app/StatusBarManager.java @@ -45,6 +45,7 @@ public class StatusBarManager { public static final int DISABLE_RECENT = View.STATUS_BAR_DISABLE_RECENT; public static final int DISABLE_BACK = View.STATUS_BAR_DISABLE_BACK; public static final int DISABLE_CLOCK = View.STATUS_BAR_DISABLE_CLOCK; + public static final int DISABLE_SEARCH = View.STATUS_BAR_DISABLE_SEARCH; @Deprecated public static final int DISABLE_NAVIGATION = @@ -54,7 +55,8 @@ public class StatusBarManager { public static final int DISABLE_MASK = DISABLE_EXPAND | DISABLE_NOTIFICATION_ICONS | DISABLE_NOTIFICATION_ALERTS | DISABLE_NOTIFICATION_TICKER - | DISABLE_SYSTEM_INFO | DISABLE_RECENT | DISABLE_HOME | DISABLE_BACK | DISABLE_CLOCK; + | DISABLE_SYSTEM_INFO | DISABLE_RECENT | DISABLE_HOME | DISABLE_BACK | DISABLE_CLOCK + | DISABLE_SEARCH; public static final int NAVIGATION_HINT_BACK_NOP = 1 << 0; public static final int NAVIGATION_HINT_HOME_NOP = 1 << 1; @@ -97,13 +99,13 @@ public void disable(int what) { } /** - * Expand the status bar. + * Expand the notifications panel. */ - public void expand() { + public void expandNotificationsPanel() { try { final IStatusBarService svc = getService(); if (svc != null) { - svc.expand(); + svc.expandNotificationsPanel(); } } catch (RemoteException ex) { // system process is dead anyway. @@ -112,13 +114,28 @@ public void expand() { } /** - * Collapse the status bar. + * Collapse the notifications and settings panels. */ - public void collapse() { + public void collapsePanels() { try { final IStatusBarService svc = getService(); if (svc != null) { - svc.collapse(); + svc.collapsePanels(); + } + } catch (RemoteException ex) { + // system process is dead anyway. + throw new RuntimeException(ex); + } + } + + /** + * Expand the settings panel. + */ + public void expandSettingsPanel() { + try { + final IStatusBarService svc = getService(); + if (svc != null) { + svc.expandSettingsPanel(); } } catch (RemoteException ex) { // system process is dead anyway. diff --git a/core/java/android/app/StreamSettings.java b/core/java/android/app/StreamSettings.java new file mode 100644 index 0000000000000..2f3bf27ee8f1a --- /dev/null +++ b/core/java/android/app/StreamSettings.java @@ -0,0 +1,130 @@ + +package android.app; + +import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; + +import android.content.Context; +import android.os.Parcel; +import android.os.Parcelable; + +import java.io.IOException; + +/** @hide */ +public final class StreamSettings implements Parcelable{ + + private int mStreamId; + private int mValue; + private boolean mOverride; + private boolean mDirty; + + /** @hide */ + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + public StreamSettings createFromParcel(Parcel in) { + return new StreamSettings(in); + } + + @Override + public StreamSettings[] newArray(int size) { + return new StreamSettings[size]; + } + }; + + + public StreamSettings(Parcel parcel) { + readFromParcel(parcel); + } + + public StreamSettings(int streamId) { + this(streamId, 0, false); + } + + public StreamSettings(int streamId, int value, boolean override) { + mStreamId = streamId; + mValue = value; + mOverride = override; + mDirty = false; + } + + public int getStreamId() { + return mStreamId; + } + + public int getValue() { + return mValue; + } + + public void setValue(int value) { + mValue = value; + mDirty = true; + } + + public void setOverride(boolean override) { + mOverride = override; + mDirty = true; + } + + public boolean isOverride() { + return mOverride; + } + + /** @hide */ + public boolean isDirty() { + return mDirty; + } + + /** @hide */ + public static StreamSettings fromXml(XmlPullParser xpp, Context context) + throws XmlPullParserException, IOException { + int event = xpp.next(); + StreamSettings streamDescriptor = new StreamSettings(0); + while (event != XmlPullParser.END_TAG || !xpp.getName().equals("streamDescriptor")) { + if (event == XmlPullParser.START_TAG) { + String name = xpp.getName(); + if (name.equals("streamId")) { + streamDescriptor.mStreamId = Integer.parseInt(xpp.nextText()); + } else if (name.equals("value")) { + streamDescriptor.mValue = Integer.parseInt(xpp.nextText()); + } else if (name.equals("override")) { + streamDescriptor.mOverride = Boolean.parseBoolean(xpp.nextText()); + } + } + event = xpp.next(); + } + return streamDescriptor; + } + + /** @hide */ + public void getXmlString(StringBuilder builder, Context context) { + builder.append("\n"); + builder.append(mStreamId); + builder.append("\n"); + builder.append(mValue); + builder.append("\n"); + builder.append(mOverride); + builder.append("\n\n"); + mDirty = false; + } + + @Override + public int describeContents() { + return 0; + } + + /** @hide */ + @Override + public void writeToParcel(Parcel dest, int flags) { + dest.writeInt(mStreamId); + dest.writeInt(mOverride ? 1 : 0); + dest.writeInt(mValue); + dest.writeInt(mDirty ? 1 : 0); + } + + /** @hide */ + public void readFromParcel(Parcel in) { + mStreamId = in.readInt(); + mOverride = in.readInt() != 0; + mValue = in.readInt(); + mDirty = in.readInt() != 0; + } +} diff --git a/core/java/android/app/TaskStackBuilder.java b/core/java/android/app/TaskStackBuilder.java index f21b3fdff5db9..3e0ac7ec47673 100644 --- a/core/java/android/app/TaskStackBuilder.java +++ b/core/java/android/app/TaskStackBuilder.java @@ -23,6 +23,7 @@ import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.os.Bundle; +import android.os.UserHandle; import android.util.Log; import java.util.ArrayList; @@ -124,24 +125,16 @@ public TaskStackBuilder addNextIntentWithParentStack(Intent nextIntent) { * @return This TaskStackBuilder for method chaining */ public TaskStackBuilder addParentStack(Activity sourceActivity) { - final int insertAt = mIntents.size(); - Intent parent = sourceActivity.getParentActivityIntent(); - PackageManager pm = sourceActivity.getPackageManager(); - while (parent != null) { - mIntents.add(insertAt, parent); - try { - ActivityInfo info = pm.getActivityInfo(parent.getComponent(), 0); - String parentActivity = info.parentActivityName; - if (parentActivity != null) { - parent = new Intent().setComponent( - new ComponentName(mSourceContext, parentActivity)); - } else { - parent = null; - } - } catch (NameNotFoundException e) { - Log.e(TAG, "Bad ComponentName while traversing activity parent metadata"); - throw new IllegalArgumentException(e); + final Intent parent = sourceActivity.getParentActivityIntent(); + if (parent != null) { + // We have the actual parent intent, build the rest from static metadata + // then add the direct parent intent to the end. + ComponentName target = parent.getComponent(); + if (target == null) { + target = parent.resolveActivity(mSourceContext.getPackageManager()); } + addParentStack(target); + addNextIntent(parent); } return this; } @@ -155,24 +148,7 @@ public TaskStackBuilder addParentStack(Activity sourceActivity) { * @return This TaskStackBuilder for method chaining */ public TaskStackBuilder addParentStack(Class sourceActivityClass) { - final int insertAt = mIntents.size(); - PackageManager pm = mSourceContext.getPackageManager(); - try { - ActivityInfo info = pm.getActivityInfo( - new ComponentName(mSourceContext, sourceActivityClass), 0); - String parentActivity = info.parentActivityName; - while (parentActivity != null) { - Intent parent = new Intent().setComponent( - new ComponentName(mSourceContext, parentActivity)); - mIntents.add(insertAt, parent); - info = pm.getActivityInfo(parent.getComponent(), 0); - parentActivity = info.parentActivityName; - } - } catch (NameNotFoundException e) { - Log.e(TAG, "Bad ComponentName while traversing activity parent metadata"); - throw new IllegalArgumentException(e); - } - return this; + return addParentStack(new ComponentName(mSourceContext, sourceActivityClass)); } /** @@ -191,11 +167,13 @@ public TaskStackBuilder addParentStack(ComponentName sourceActivityName) { ActivityInfo info = pm.getActivityInfo(sourceActivityName, 0); String parentActivity = info.parentActivityName; while (parentActivity != null) { - Intent parent = new Intent().setComponent( - new ComponentName(info.packageName, parentActivity)); - mIntents.add(insertAt, parent); - info = pm.getActivityInfo(parent.getComponent(), 0); + final ComponentName target = new ComponentName(info.packageName, parentActivity); + info = pm.getActivityInfo(target, 0); parentActivity = info.parentActivityName; + final Intent parent = parentActivity == null && insertAt == 0 + ? Intent.makeMainActivity(target) + : new Intent().setComponent(target); + mIntents.add(insertAt, parent); } } catch (NameNotFoundException e) { Log.e(TAG, "Bad ComponentName while traversing activity parent metadata"); @@ -232,22 +210,26 @@ public void startActivities() { /** * Start the task stack constructed by this builder. - * - * @param options Additional options for how the Activity should be started. - * See {@link android.content.Context#startActivity(Intent, Bundle) - * Context.startActivity(Intent, Bundle)} for more details. + * @hide */ - public void startActivities(Bundle options) { + public void startActivities(Bundle options, UserHandle userHandle) { if (mIntents.isEmpty()) { throw new IllegalStateException( "No intents added to TaskStackBuilder; cannot startActivities"); } - Intent[] intents = mIntents.toArray(new Intent[mIntents.size()]); - intents[0].addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | - Intent.FLAG_ACTIVITY_CLEAR_TASK | - Intent.FLAG_ACTIVITY_TASK_ON_HOME); - mSourceContext.startActivities(intents, options); + mSourceContext.startActivitiesAsUser(getIntents(), options, userHandle); + } + + /** + * Start the task stack constructed by this builder. + * + * @param options Additional options for how the Activity should be started. + * See {@link android.content.Context#startActivity(Intent, Bundle) + * Context.startActivity(Intent, Bundle)} for more details. + */ + public void startActivities(Bundle options) { + startActivities(options, new UserHandle(UserHandle.myUserId())); } /** @@ -287,11 +269,22 @@ public PendingIntent getPendingIntent(int requestCode, int flags, Bundle options "No intents added to TaskStackBuilder; cannot getPendingIntent"); } - Intent[] intents = mIntents.toArray(new Intent[mIntents.size()]); - intents[0].addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | - Intent.FLAG_ACTIVITY_CLEAR_TASK | - Intent.FLAG_ACTIVITY_TASK_ON_HOME); - return PendingIntent.getActivities(mSourceContext, requestCode, intents, flags, options); + return PendingIntent.getActivities(mSourceContext, requestCode, getIntents(), + flags, options); + } + + /** + * @hide + */ + public PendingIntent getPendingIntent(int requestCode, int flags, Bundle options, + UserHandle user) { + if (mIntents.isEmpty()) { + throw new IllegalStateException( + "No intents added to TaskStackBuilder; cannot getPendingIntent"); + } + + return PendingIntent.getActivitiesAsUser(mSourceContext, requestCode, getIntents(), flags, + options, user); } /** @@ -302,6 +295,15 @@ public PendingIntent getPendingIntent(int requestCode, int flags, Bundle options * @return An array containing the intents added to this builder. */ public Intent[] getIntents() { - return mIntents.toArray(new Intent[mIntents.size()]); + Intent[] intents = new Intent[mIntents.size()]; + if (intents.length == 0) return intents; + + intents[0] = new Intent(mIntents.get(0)).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | + Intent.FLAG_ACTIVITY_CLEAR_TASK | + Intent.FLAG_ACTIVITY_TASK_ON_HOME); + for (int i = 1; i < intents.length; i++) { + intents[i] = new Intent(mIntents.get(i)); + } + return intents; } } diff --git a/core/java/android/app/WallpaperManager.java b/core/java/android/app/WallpaperManager.java index c13154941ca5f..9c0064efe65eb 100644 --- a/core/java/android/app/WallpaperManager.java +++ b/core/java/android/app/WallpaperManager.java @@ -42,6 +42,8 @@ import android.util.DisplayMetrics; import android.util.Log; import android.view.ViewRootImpl; +import android.view.WindowManager; +import android.view.WindowManagerGlobal; import java.io.FileOutputStream; import java.io.IOException; @@ -241,7 +243,7 @@ public Bitmap peekWallpaperBitmap(Context context, boolean returnDefault) { } mWallpaper = null; try { - mWallpaper = getCurrentWallpaperLocked(); + mWallpaper = getCurrentWallpaperLocked(context); } catch (OutOfMemoryError e) { Log.w(TAG, "No memory load current wallpaper", e); } @@ -264,7 +266,7 @@ public void forgetLoadedWallpaper() { } } - private Bitmap getCurrentWallpaperLocked() { + private Bitmap getCurrentWallpaperLocked(Context context) { try { Bundle params = new Bundle(); ParcelFileDescriptor fd = mService.getWallpaper(this, params); @@ -276,7 +278,7 @@ private Bitmap getCurrentWallpaperLocked() { BitmapFactory.Options options = new BitmapFactory.Options(); Bitmap bm = BitmapFactory.decodeFileDescriptor( fd.getFileDescriptor(), null, options); - return generateBitmap(bm, width, height); + return generateBitmap(context, bm, width, height); } catch (OutOfMemoryError e) { Log.w(TAG, "Can't decode file", e); } finally { @@ -304,7 +306,7 @@ private Bitmap getDefaultWallpaperLocked(Context context) { try { BitmapFactory.Options options = new BitmapFactory.Options(); Bitmap bm = BitmapFactory.decodeStream(is, null, options); - return generateBitmap(bm, width, height); + return generateBitmap(context, bm, width, height); } catch (OutOfMemoryError e) { Log.w(TAG, "Can't decode stream", e); } finally { @@ -587,6 +589,25 @@ private void setWallpaper(InputStream data, FileOutputStream fos) } } + /** + * Return whether any users are currently set to use the wallpaper + * with the given resource ID. That is, their wallpaper has been + * set through {@link #setResource(int)} with the same resource id. + */ + public boolean hasResourceWallpaper(int resid) { + if (sGlobals.mService == null) { + Log.w(TAG, "WallpaperService not running"); + return false; + } + try { + Resources resources = mContext.getResources(); + String name = "res:" + resources.getResourceName(resid); + return sGlobals.mService.hasNamedWallpaper(name); + } catch (RemoteException e) { + return false; + } + } + /** * Returns the desired minimum width for the wallpaper. Callers of * {@link #setBitmap(android.graphics.Bitmap)} or @@ -688,7 +709,7 @@ public void suggestDesiredDimensions(int minimumWidth, int minimumHeight) { public void setWallpaperOffsets(IBinder windowToken, float xOffset, float yOffset) { try { //Log.v(TAG, "Sending new wallpaper offsets from app..."); - ViewRootImpl.getWindowSession(mContext.getMainLooper()).setWallpaperPosition( + WindowManagerGlobal.getWindowSession(mContext.getMainLooper()).setWallpaperPosition( windowToken, xOffset, yOffset, mWallpaperXStep, mWallpaperYStep); //Log.v(TAG, "...app returning after sending offsets!"); } catch (RemoteException e) { @@ -726,7 +747,7 @@ public void sendWallpaperCommand(IBinder windowToken, String action, int x, int y, int z, Bundle extras) { try { //Log.v(TAG, "Sending new wallpaper offsets from app..."); - ViewRootImpl.getWindowSession(mContext.getMainLooper()).sendWallpaperCommand( + WindowManagerGlobal.getWindowSession(mContext.getMainLooper()).sendWallpaperCommand( windowToken, action, x, y, z, extras, false); //Log.v(TAG, "...app returning after sending offsets!"); } catch (RemoteException e) { @@ -746,7 +767,7 @@ public void sendWallpaperCommand(IBinder windowToken, String action, */ public void clearWallpaperOffsets(IBinder windowToken) { try { - ViewRootImpl.getWindowSession(mContext.getMainLooper()).setWallpaperPosition( + WindowManagerGlobal.getWindowSession(mContext.getMainLooper()).setWallpaperPosition( windowToken, -1, -1, -1, -1); } catch (RemoteException e) { // Ignore. @@ -768,12 +789,15 @@ public void clear() throws IOException { setResource(com.android.internal.R.drawable.default_wallpaper); } - static Bitmap generateBitmap(Bitmap bm, int width, int height) { + static Bitmap generateBitmap(Context context, Bitmap bm, int width, int height) { if (bm == null) { return null; } - bm.setDensity(DisplayMetrics.DENSITY_DEVICE); + WindowManager wm = (WindowManager)context.getSystemService(Context.WINDOW_SERVICE); + DisplayMetrics metrics = new DisplayMetrics(); + wm.getDefaultDisplay().getMetrics(metrics); + bm.setDensity(metrics.noncompatDensityDpi); if (width <= 0 || height <= 0 || (bm.getWidth() == width && bm.getHeight() == height)) { @@ -783,7 +807,7 @@ static Bitmap generateBitmap(Bitmap bm, int width, int height) { // This is the final bitmap we want to return. try { Bitmap newbm = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); - newbm.setDensity(DisplayMetrics.DENSITY_DEVICE); + newbm.setDensity(metrics.noncompatDensityDpi); Canvas c = new Canvas(newbm); Rect targetRect = new Rect(); diff --git a/core/java/android/app/admin/DeviceAdminInfo.java b/core/java/android/app/admin/DeviceAdminInfo.java index 1c37414032a2e..b35181158df8f 100644 --- a/core/java/android/app/admin/DeviceAdminInfo.java +++ b/core/java/android/app/admin/DeviceAdminInfo.java @@ -50,23 +50,23 @@ */ public final class DeviceAdminInfo implements Parcelable { static final String TAG = "DeviceAdminInfo"; - + /** * A type of policy that this device admin can use: limit the passwords * that the user can select, via {@link DevicePolicyManager#setPasswordQuality} * and {@link DevicePolicyManager#setPasswordMinimumLength}. - * + * *

    To control this policy, the device admin must have a "limit-password" * tag in the "uses-policies" section of its meta-data. */ public static final int USES_POLICY_LIMIT_PASSWORD = 0; - + /** * A type of policy that this device admin can use: able to watch login * attempts from the user, via {@link DeviceAdminReceiver#ACTION_PASSWORD_FAILED}, * {@link DeviceAdminReceiver#ACTION_PASSWORD_SUCCEEDED}, and * {@link DevicePolicyManager#getCurrentFailedPasswordAttempts}. - * + * *

    To control this policy, the device admin must have a "watch-login" * tag in the "uses-policies" section of its meta-data. */ @@ -76,7 +76,7 @@ public final class DeviceAdminInfo implements Parcelable { * A type of policy that this device admin can use: able to reset the * user's password via * {@link DevicePolicyManager#resetPassword}. - * + * *

    To control this policy, the device admin must have a "reset-password" * tag in the "uses-policies" section of its meta-data. */ @@ -87,7 +87,7 @@ public final class DeviceAdminInfo implements Parcelable { * to lock via{@link DevicePolicyManager#lockNow} or limit the * maximum lock timeout for the device via * {@link DevicePolicyManager#setMaximumTimeToLock}. - * + * *

    To control this policy, the device admin must have a "force-lock" * tag in the "uses-policies" section of its meta-data. */ @@ -97,7 +97,7 @@ public final class DeviceAdminInfo implements Parcelable { * A type of policy that this device admin can use: able to factory * reset the device, erasing all of the user's data, via * {@link DevicePolicyManager#wipeData}. - * + * *

    To control this policy, the device admin must have a "wipe-data" * tag in the "uses-policies" section of its meta-data. */ @@ -138,13 +138,21 @@ public final class DeviceAdminInfo implements Parcelable { */ public static final int USES_POLICY_DISABLE_CAMERA = 8; + /** + * A type of policy that this device admin can use: disables use of keyguard widgets. + * + *

    To control this policy, the device admin must have a "disable-keyguard-widgets" + * tag in the "uses-policies" section of its meta-data. + */ + public static final int USES_POLICY_DISABLE_KEYGUARD_FEATURES = 9; + /** @hide */ public static class PolicyInfo { public final int ident; final public String tag; final public int label; final public int description; - + public PolicyInfo(int identIn, String tagIn, int labelIn, int descriptionIn) { ident = identIn; tag = tagIn; @@ -152,11 +160,11 @@ public PolicyInfo(int identIn, String tagIn, int labelIn, int descriptionIn) { description = descriptionIn; } } - + static ArrayList sPoliciesDisplayOrder = new ArrayList(); static HashMap sKnownPolicies = new HashMap(); static SparseArray sRevKnownPolicies = new SparseArray(); - + static { sPoliciesDisplayOrder.add(new PolicyInfo(USES_POLICY_WIPE_DATA, "wipe-data", com.android.internal.R.string.policylab_wipeData, @@ -185,6 +193,10 @@ public PolicyInfo(int identIn, String tagIn, int labelIn, int descriptionIn) { sPoliciesDisplayOrder.add(new PolicyInfo(USES_POLICY_DISABLE_CAMERA, "disable-camera", com.android.internal.R.string.policylab_disableCamera, com.android.internal.R.string.policydesc_disableCamera)); + sPoliciesDisplayOrder.add(new PolicyInfo( + USES_POLICY_DISABLE_KEYGUARD_FEATURES, "disable-keyguard-features", + com.android.internal.R.string.policylab_disableKeyguardFeatures, + com.android.internal.R.string.policydesc_disableKeyguardFeatures)); for (int i=0; i outerDepth)) { @@ -290,14 +302,14 @@ public DeviceAdminInfo(Context context, ResolveInfo receiver) mReceiver = ResolveInfo.CREATOR.createFromParcel(source); mUsesPolicies = source.readInt(); } - + /** * Return the .apk package that implements this device admin. */ public String getPackageName() { return mReceiver.activityInfo.packageName; } - + /** * Return the class name of the receiver component that implements * this device admin. @@ -321,20 +333,20 @@ public ComponentName getComponent() { return new ComponentName(mReceiver.activityInfo.packageName, mReceiver.activityInfo.name); } - + /** * Load the user-displayed label for this device admin. - * + * * @param pm Supply a PackageManager used to load the device admin's * resources. */ public CharSequence loadLabel(PackageManager pm) { return mReceiver.loadLabel(pm); } - + /** * Load user-visible description associated with this device admin. - * + * * @param pm Supply a PackageManager used to load the device admin's * resources. */ @@ -351,17 +363,17 @@ public CharSequence loadDescription(PackageManager pm) throws NotFoundException } throw new NotFoundException(); } - + /** * Load the user-displayed icon for this device admin. - * + * * @param pm Supply a PackageManager used to load the device admin's * resources. */ public Drawable loadIcon(PackageManager pm) { return mReceiver.loadIcon(pm); } - + /** * Returns whether this device admin would like to be visible to the * user, even when it is not enabled. @@ -369,7 +381,7 @@ public Drawable loadIcon(PackageManager pm) { public boolean isVisible() { return mVisible; } - + /** * Return true if the device admin has requested that it be able to use * the given policy control. The possible policy identifier inputs are: @@ -382,7 +394,7 @@ public boolean isVisible() { public boolean usesPolicy(int policyIdent) { return (mUsesPolicies & (1< getUsedPolicies() { ArrayList res = new ArrayList(); @@ -403,25 +415,25 @@ public ArrayList getUsedPolicies() { } return res; } - + /** @hide */ public void writePoliciesToXml(XmlSerializer out) throws IllegalArgumentException, IllegalStateException, IOException { out.attribute(null, "flags", Integer.toString(mUsesPolicies)); } - + /** @hide */ public void readPoliciesFromXml(XmlPullParser parser) throws XmlPullParserException, IOException { mUsesPolicies = Integer.parseInt( parser.getAttributeValue(null, "flags")); } - + public void dump(Printer pw, String prefix) { pw.println(prefix + "Receiver:"); mReceiver.dump(pw, prefix + " "); } - + @Override public String toString() { return "DeviceAdminInfo{" + mReceiver.activityInfo.name + "}"; @@ -429,7 +441,7 @@ public String toString() { /** * Used to package this object into a {@link Parcel}. - * + * * @param dest The {@link Parcel} to be written. * @param flags The flags used for parceling. */ diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java old mode 100644 new mode 100755 index 4ed07668160f7..4c0eba00e66c9 --- a/core/java/android/app/admin/DevicePolicyManager.java +++ b/core/java/android/app/admin/DevicePolicyManager.java @@ -29,6 +29,7 @@ import android.os.RemoteCallback; import android.os.RemoteException; import android.os.ServiceManager; +import android.os.UserHandle; import android.util.Log; import java.io.IOException; @@ -131,7 +132,7 @@ public static DevicePolicyManager create(Context context, Handler handler) { public boolean isAdminActive(ComponentName who) { if (mService != null) { try { - return mService.isAdminActive(who); + return mService.isAdminActive(who, UserHandle.myUserId()); } catch (RemoteException e) { Log.w(TAG, "Failed talking with device policy service", e); } @@ -147,7 +148,7 @@ public boolean isAdminActive(ComponentName who) { public List getActiveAdmins() { if (mService != null) { try { - return mService.getActiveAdmins(); + return mService.getActiveAdmins(UserHandle.myUserId()); } catch (RemoteException e) { Log.w(TAG, "Failed talking with device policy service", e); } @@ -156,12 +157,14 @@ public List getActiveAdmins() { } /** + * Used by package administration code to determine if a package can be stopped + * or uninstalled. * @hide */ public boolean packageHasActiveAdmins(String packageName) { if (mService != null) { try { - return mService.packageHasActiveAdmins(packageName); + return mService.packageHasActiveAdmins(packageName, UserHandle.myUserId()); } catch (RemoteException e) { Log.w(TAG, "Failed talking with device policy service", e); } @@ -178,7 +181,7 @@ public boolean packageHasActiveAdmins(String packageName) { public void removeActiveAdmin(ComponentName who) { if (mService != null) { try { - mService.removeActiveAdmin(who); + mService.removeActiveAdmin(who, UserHandle.myUserId()); } catch (RemoteException e) { Log.w(TAG, "Failed talking with device policy service", e); } @@ -197,7 +200,7 @@ public void removeActiveAdmin(ComponentName who) { public boolean hasGrantedPolicy(ComponentName admin, int usesPolicy) { if (mService != null) { try { - return mService.hasGrantedPolicy(admin, usesPolicy); + return mService.hasGrantedPolicy(admin, usesPolicy, UserHandle.myUserId()); } catch (RemoteException e) { Log.w(TAG, "Failed talking with device policy service", e); } @@ -289,7 +292,7 @@ public boolean hasGrantedPolicy(ComponentName admin, int usesPolicy) { public void setPasswordQuality(ComponentName admin, int quality) { if (mService != null) { try { - mService.setPasswordQuality(admin, quality); + mService.setPasswordQuality(admin, quality, UserHandle.myUserId()); } catch (RemoteException e) { Log.w(TAG, "Failed talking with device policy service", e); } @@ -303,9 +306,14 @@ public void setPasswordQuality(ComponentName admin, int quality) { * all admins. */ public int getPasswordQuality(ComponentName admin) { + return getPasswordQuality(admin, UserHandle.myUserId()); + } + + /** @hide per-user version */ + public int getPasswordQuality(ComponentName admin, int userHandle) { if (mService != null) { try { - return mService.getPasswordQuality(admin); + return mService.getPasswordQuality(admin, userHandle); } catch (RemoteException e) { Log.w(TAG, "Failed talking with device policy service", e); } @@ -337,7 +345,7 @@ public int getPasswordQuality(ComponentName admin) { public void setPasswordMinimumLength(ComponentName admin, int length) { if (mService != null) { try { - mService.setPasswordMinimumLength(admin, length); + mService.setPasswordMinimumLength(admin, length, UserHandle.myUserId()); } catch (RemoteException e) { Log.w(TAG, "Failed talking with device policy service", e); } @@ -351,9 +359,14 @@ public void setPasswordMinimumLength(ComponentName admin, int length) { * all admins. */ public int getPasswordMinimumLength(ComponentName admin) { + return getPasswordMinimumLength(admin, UserHandle.myUserId()); + } + + /** @hide per-user version */ + public int getPasswordMinimumLength(ComponentName admin, int userHandle) { if (mService != null) { try { - return mService.getPasswordMinimumLength(admin); + return mService.getPasswordMinimumLength(admin, userHandle); } catch (RemoteException e) { Log.w(TAG, "Failed talking with device policy service", e); } @@ -386,7 +399,7 @@ public int getPasswordMinimumLength(ComponentName admin) { public void setPasswordMinimumUpperCase(ComponentName admin, int length) { if (mService != null) { try { - mService.setPasswordMinimumUpperCase(admin, length); + mService.setPasswordMinimumUpperCase(admin, length, UserHandle.myUserId()); } catch (RemoteException e) { Log.w(TAG, "Failed talking with device policy service", e); } @@ -406,9 +419,14 @@ public void setPasswordMinimumUpperCase(ComponentName admin, int length) { * password. */ public int getPasswordMinimumUpperCase(ComponentName admin) { + return getPasswordMinimumUpperCase(admin, UserHandle.myUserId()); + } + + /** @hide per-user version */ + public int getPasswordMinimumUpperCase(ComponentName admin, int userHandle) { if (mService != null) { try { - return mService.getPasswordMinimumUpperCase(admin); + return mService.getPasswordMinimumUpperCase(admin, userHandle); } catch (RemoteException e) { Log.w(TAG, "Failed talking with device policy service", e); } @@ -441,7 +459,7 @@ public int getPasswordMinimumUpperCase(ComponentName admin) { public void setPasswordMinimumLowerCase(ComponentName admin, int length) { if (mService != null) { try { - mService.setPasswordMinimumLowerCase(admin, length); + mService.setPasswordMinimumLowerCase(admin, length, UserHandle.myUserId()); } catch (RemoteException e) { Log.w(TAG, "Failed talking with device policy service", e); } @@ -461,9 +479,14 @@ public void setPasswordMinimumLowerCase(ComponentName admin, int length) { * password. */ public int getPasswordMinimumLowerCase(ComponentName admin) { + return getPasswordMinimumLowerCase(admin, UserHandle.myUserId()); + } + + /** @hide per-user version */ + public int getPasswordMinimumLowerCase(ComponentName admin, int userHandle) { if (mService != null) { try { - return mService.getPasswordMinimumLowerCase(admin); + return mService.getPasswordMinimumLowerCase(admin, userHandle); } catch (RemoteException e) { Log.w(TAG, "Failed talking with device policy service", e); } @@ -495,7 +518,7 @@ public int getPasswordMinimumLowerCase(ComponentName admin) { public void setPasswordMinimumLetters(ComponentName admin, int length) { if (mService != null) { try { - mService.setPasswordMinimumLetters(admin, length); + mService.setPasswordMinimumLetters(admin, length, UserHandle.myUserId()); } catch (RemoteException e) { Log.w(TAG, "Failed talking with device policy service", e); } @@ -514,9 +537,14 @@ public void setPasswordMinimumLetters(ComponentName admin, int length) { * @return The minimum number of letters required in the password. */ public int getPasswordMinimumLetters(ComponentName admin) { + return getPasswordMinimumLetters(admin, UserHandle.myUserId()); + } + + /** @hide per-user version */ + public int getPasswordMinimumLetters(ComponentName admin, int userHandle) { if (mService != null) { try { - return mService.getPasswordMinimumLetters(admin); + return mService.getPasswordMinimumLetters(admin, userHandle); } catch (RemoteException e) { Log.w(TAG, "Failed talking with device policy service", e); } @@ -548,7 +576,7 @@ public int getPasswordMinimumLetters(ComponentName admin) { public void setPasswordMinimumNumeric(ComponentName admin, int length) { if (mService != null) { try { - mService.setPasswordMinimumNumeric(admin, length); + mService.setPasswordMinimumNumeric(admin, length, UserHandle.myUserId()); } catch (RemoteException e) { Log.w(TAG, "Failed talking with device policy service", e); } @@ -567,9 +595,14 @@ public void setPasswordMinimumNumeric(ComponentName admin, int length) { * @return The minimum number of numerical digits required in the password. */ public int getPasswordMinimumNumeric(ComponentName admin) { + return getPasswordMinimumNumeric(admin, UserHandle.myUserId()); + } + + /** @hide per-user version */ + public int getPasswordMinimumNumeric(ComponentName admin, int userHandle) { if (mService != null) { try { - return mService.getPasswordMinimumNumeric(admin); + return mService.getPasswordMinimumNumeric(admin, userHandle); } catch (RemoteException e) { Log.w(TAG, "Failed talking with device policy service", e); } @@ -601,7 +634,7 @@ public int getPasswordMinimumNumeric(ComponentName admin) { public void setPasswordMinimumSymbols(ComponentName admin, int length) { if (mService != null) { try { - mService.setPasswordMinimumSymbols(admin, length); + mService.setPasswordMinimumSymbols(admin, length, UserHandle.myUserId()); } catch (RemoteException e) { Log.w(TAG, "Failed talking with device policy service", e); } @@ -620,9 +653,14 @@ public void setPasswordMinimumSymbols(ComponentName admin, int length) { * @return The minimum number of symbols required in the password. */ public int getPasswordMinimumSymbols(ComponentName admin) { + return getPasswordMinimumSymbols(admin, UserHandle.myUserId()); + } + + /** @hide per-user version */ + public int getPasswordMinimumSymbols(ComponentName admin, int userHandle) { if (mService != null) { try { - return mService.getPasswordMinimumSymbols(admin); + return mService.getPasswordMinimumSymbols(admin, userHandle); } catch (RemoteException e) { Log.w(TAG, "Failed talking with device policy service", e); } @@ -654,7 +692,7 @@ public int getPasswordMinimumSymbols(ComponentName admin) { public void setPasswordMinimumNonLetter(ComponentName admin, int length) { if (mService != null) { try { - mService.setPasswordMinimumNonLetter(admin, length); + mService.setPasswordMinimumNonLetter(admin, length, UserHandle.myUserId()); } catch (RemoteException e) { Log.w(TAG, "Failed talking with device policy service", e); } @@ -673,9 +711,14 @@ public void setPasswordMinimumNonLetter(ComponentName admin, int length) { * @return The minimum number of letters required in the password. */ public int getPasswordMinimumNonLetter(ComponentName admin) { + return getPasswordMinimumNonLetter(admin, UserHandle.myUserId()); + } + + /** @hide per-user version */ + public int getPasswordMinimumNonLetter(ComponentName admin, int userHandle) { if (mService != null) { try { - return mService.getPasswordMinimumNonLetter(admin); + return mService.getPasswordMinimumNonLetter(admin, userHandle); } catch (RemoteException e) { Log.w(TAG, "Failed talking with device policy service", e); } @@ -708,7 +751,7 @@ public int getPasswordMinimumNonLetter(ComponentName admin) { public void setPasswordHistoryLength(ComponentName admin, int length) { if (mService != null) { try { - mService.setPasswordHistoryLength(admin, length); + mService.setPasswordHistoryLength(admin, length, UserHandle.myUserId()); } catch (RemoteException e) { Log.w(TAG, "Failed talking with device policy service", e); } @@ -737,7 +780,7 @@ public void setPasswordHistoryLength(ComponentName admin, int length) { public void setPasswordExpirationTimeout(ComponentName admin, long timeout) { if (mService != null) { try { - mService.setPasswordExpirationTimeout(admin, timeout); + mService.setPasswordExpirationTimeout(admin, timeout, UserHandle.myUserId()); } catch (RemoteException e) { Log.w(TAG, "Failed talking with device policy service", e); } @@ -756,7 +799,7 @@ public void setPasswordExpirationTimeout(ComponentName admin, long timeout) { public long getPasswordExpirationTimeout(ComponentName admin) { if (mService != null) { try { - return mService.getPasswordExpirationTimeout(admin); + return mService.getPasswordExpirationTimeout(admin, UserHandle.myUserId()); } catch (RemoteException e) { Log.w(TAG, "Failed talking with device policy service", e); } @@ -776,7 +819,7 @@ public long getPasswordExpirationTimeout(ComponentName admin) { public long getPasswordExpiration(ComponentName admin) { if (mService != null) { try { - return mService.getPasswordExpiration(admin); + return mService.getPasswordExpiration(admin, UserHandle.myUserId()); } catch (RemoteException e) { Log.w(TAG, "Failed talking with device policy service", e); } @@ -792,9 +835,14 @@ public long getPasswordExpiration(ComponentName admin) { * @return The length of the password history */ public int getPasswordHistoryLength(ComponentName admin) { + return getPasswordHistoryLength(admin, UserHandle.myUserId()); + } + + /** @hide per-user version */ + public int getPasswordHistoryLength(ComponentName admin, int userHandle) { if (mService != null) { try { - return mService.getPasswordHistoryLength(admin); + return mService.getPasswordHistoryLength(admin, userHandle); } catch (RemoteException e) { Log.w(TAG, "Failed talking with device policy service", e); } @@ -828,7 +876,7 @@ public int getPasswordMaximumLength(int quality) { public boolean isActivePasswordSufficient() { if (mService != null) { try { - return mService.isActivePasswordSufficient(); + return mService.isActivePasswordSufficient(UserHandle.myUserId()); } catch (RemoteException e) { Log.w(TAG, "Failed talking with device policy service", e); } @@ -847,7 +895,7 @@ public boolean isActivePasswordSufficient() { public int getCurrentFailedPasswordAttempts() { if (mService != null) { try { - return mService.getCurrentFailedPasswordAttempts(); + return mService.getCurrentFailedPasswordAttempts(UserHandle.myUserId()); } catch (RemoteException e) { Log.w(TAG, "Failed talking with device policy service", e); } @@ -877,7 +925,7 @@ public int getCurrentFailedPasswordAttempts() { public void setMaximumFailedPasswordsForWipe(ComponentName admin, int num) { if (mService != null) { try { - mService.setMaximumFailedPasswordsForWipe(admin, num); + mService.setMaximumFailedPasswordsForWipe(admin, num, UserHandle.myUserId()); } catch (RemoteException e) { Log.w(TAG, "Failed talking with device policy service", e); } @@ -892,9 +940,14 @@ public void setMaximumFailedPasswordsForWipe(ComponentName admin, int num) { * all admins. */ public int getMaximumFailedPasswordsForWipe(ComponentName admin) { + return getMaximumFailedPasswordsForWipe(admin, UserHandle.myUserId()); + } + + /** @hide per-user version */ + public int getMaximumFailedPasswordsForWipe(ComponentName admin, int userHandle) { if (mService != null) { try { - return mService.getMaximumFailedPasswordsForWipe(admin); + return mService.getMaximumFailedPasswordsForWipe(admin, userHandle); } catch (RemoteException e) { Log.w(TAG, "Failed talking with device policy service", e); } @@ -933,7 +986,7 @@ public int getMaximumFailedPasswordsForWipe(ComponentName admin) { public boolean resetPassword(String password, int flags) { if (mService != null) { try { - return mService.resetPassword(password, flags); + return mService.resetPassword(password, flags, UserHandle.myUserId()); } catch (RemoteException e) { Log.w(TAG, "Failed talking with device policy service", e); } @@ -957,7 +1010,7 @@ public boolean resetPassword(String password, int flags) { public void setMaximumTimeToLock(ComponentName admin, long timeMs) { if (mService != null) { try { - mService.setMaximumTimeToLock(admin, timeMs); + mService.setMaximumTimeToLock(admin, timeMs, UserHandle.myUserId()); } catch (RemoteException e) { Log.w(TAG, "Failed talking with device policy service", e); } @@ -971,9 +1024,14 @@ public void setMaximumTimeToLock(ComponentName admin, long timeMs) { * all admins. */ public long getMaximumTimeToLock(ComponentName admin) { + return getMaximumTimeToLock(admin, UserHandle.myUserId()); + } + + /** @hide per-user version */ + public long getMaximumTimeToLock(ComponentName admin, int userHandle) { if (mService != null) { try { - return mService.getMaximumTimeToLock(admin); + return mService.getMaximumTimeToLock(admin, userHandle); } catch (RemoteException e) { Log.w(TAG, "Failed talking with device policy service", e); } @@ -1008,18 +1066,20 @@ public void lockNow() { /** * Ask the user date be wiped. This will cause the device to reboot, * erasing all user data while next booting up. External storage such - * as SD cards will not be erased. + * as SD cards will be also erased if the flag {@link #WIPE_EXTERNAL_STORAGE} + * is set. * *

    The calling device admin must have requested * {@link DeviceAdminInfo#USES_POLICY_WIPE_DATA} to be able to call * this method; if it has not, a security exception will be thrown. * - * @param flags Bit mask of additional options: currently must be 0. + * @param flags Bit mask of additional options: currently 0 and + * {@link #WIPE_EXTERNAL_STORAGE} are supported. */ public void wipeData(int flags) { if (mService != null) { try { - mService.wipeData(flags); + mService.wipeData(flags, UserHandle.myUserId()); } catch (RemoteException e) { Log.w(TAG, "Failed talking with device policy service", e); } @@ -1088,7 +1148,7 @@ public ComponentName setGlobalProxy(ComponentName admin, Proxy proxySpec, } android.net.Proxy.validate(hostName, Integer.toString(port), exclSpec); } - return mService.setGlobalProxy(admin, hostSpec, exclSpec); + return mService.setGlobalProxy(admin, hostSpec, exclSpec, UserHandle.myUserId()); } catch (RemoteException e) { Log.w(TAG, "Failed talking with device policy service", e); } @@ -1105,7 +1165,7 @@ public ComponentName setGlobalProxy(ComponentName admin, Proxy proxySpec, public ComponentName getGlobalProxyAdmin() { if (mService != null) { try { - return mService.getGlobalProxyAdmin(); + return mService.getGlobalProxyAdmin(UserHandle.myUserId()); } catch (RemoteException e) { Log.w(TAG, "Failed talking with device policy service", e); } @@ -1152,6 +1212,26 @@ public ComponentName getGlobalProxyAdmin() { public static final String ACTION_START_ENCRYPTION = "android.app.action.START_ENCRYPTION"; + /** + * Widgets are enabled in keyguard + */ + public static final int KEYGUARD_DISABLE_FEATURES_NONE = 0; + + /** + * Disable all keyguard widgets + */ + public static final int KEYGUARD_DISABLE_WIDGETS_ALL = 1 << 0; + + /** + * Disable the camera on secure keyguard screens (e.g. PIN/Pattern/Password) + */ + public static final int KEYGUARD_DISABLE_SECURE_CAMERA = 1 << 1; + + /** + * Disable all current and future keyguard customizations. + */ + public static final int KEYGUARD_DISABLE_FEATURES_ALL = 0x7fffffff; + /** * Called by an application that is administering the device to * request that the storage system be encrypted. @@ -1187,7 +1267,7 @@ public ComponentName getGlobalProxyAdmin() { public int setStorageEncryption(ComponentName admin, boolean encrypt) { if (mService != null) { try { - return mService.setStorageEncryption(admin, encrypt); + return mService.setStorageEncryption(admin, encrypt, UserHandle.myUserId()); } catch (RemoteException e) { Log.w(TAG, "Failed talking with device policy service", e); } @@ -1207,7 +1287,7 @@ public int setStorageEncryption(ComponentName admin, boolean encrypt) { public boolean getStorageEncryption(ComponentName admin) { if (mService != null) { try { - return mService.getStorageEncryption(admin); + return mService.getStorageEncryption(admin, UserHandle.myUserId()); } catch (RemoteException e) { Log.w(TAG, "Failed talking with device policy service", e); } @@ -1232,9 +1312,14 @@ public boolean getStorageEncryption(ComponentName admin) { * {@link #ENCRYPTION_STATUS_ACTIVATING}, or{@link #ENCRYPTION_STATUS_ACTIVE}. */ public int getStorageEncryptionStatus() { + return getStorageEncryptionStatus(UserHandle.myUserId()); + } + + /** @hide per-user version */ + public int getStorageEncryptionStatus(int userHandle) { if (mService != null) { try { - return mService.getStorageEncryptionStatus(); + return mService.getStorageEncryptionStatus(userHandle); } catch (RemoteException e) { Log.w(TAG, "Failed talking with device policy service", e); } @@ -1257,7 +1342,7 @@ public int getStorageEncryptionStatus() { public void setCameraDisabled(ComponentName admin, boolean disabled) { if (mService != null) { try { - mService.setCameraDisabled(admin, disabled); + mService.setCameraDisabled(admin, disabled, UserHandle.myUserId()); } catch (RemoteException e) { Log.w(TAG, "Failed talking with device policy service", e); } @@ -1271,9 +1356,14 @@ public void setCameraDisabled(ComponentName admin, boolean disabled) { * have disabled the camera */ public boolean getCameraDisabled(ComponentName admin) { + return getCameraDisabled(admin, UserHandle.myUserId()); + } + + /** @hide per-user version */ + public boolean getCameraDisabled(ComponentName admin, int userHandle) { if (mService != null) { try { - return mService.getCameraDisabled(admin); + return mService.getCameraDisabled(admin, userHandle); } catch (RemoteException e) { Log.w(TAG, "Failed talking with device policy service", e); } @@ -1281,13 +1371,61 @@ public boolean getCameraDisabled(ComponentName admin) { return false; } + /** + * Called by an application that is administering the device to disable keyguard customizations, + * such as widgets. After setting this, keyguard features will be disabled according to the + * provided feature list. + * + *

    The calling device admin must have requested + * {@link DeviceAdminInfo#USES_POLICY_DISABLE_KEYGUARD_FEATURES} to be able to call + * this method; if it has not, a security exception will be thrown. + * + * @param admin Which {@link DeviceAdminReceiver} this request is associated with. + * @param which {@link #KEYGUARD_DISABLE_FEATURES_NONE} (default), + * {@link #KEYGUARD_DISABLE_WIDGETS_ALL}, {@link #KEYGUARD_DISABLE_SECURE_CAMERA}, + * {@link #KEYGUARD_DISABLE_FEATURES_ALL} + */ + public void setKeyguardDisabledFeatures(ComponentName admin, int which) { + if (mService != null) { + try { + mService.setKeyguardDisabledFeatures(admin, which, UserHandle.myUserId()); + } catch (RemoteException e) { + Log.w(TAG, "Failed talking with device policy service", e); + } + } + } + + /** + * Determine whether or not features have been disabled in keyguard either by the current + * admin, if specified, or all admins. + * @param admin The name of the admin component to check, or null to check if any admins + * have disabled features in keyguard. + * @return bitfield of flags. See {@link #setKeyguardDisabledFeatures(ComponentName, int)} + * for a list. + */ + public int getKeyguardDisabledFeatures(ComponentName admin) { + return getKeyguardDisabledFeatures(admin, UserHandle.myUserId()); + } + + /** @hide per-user version */ + public int getKeyguardDisabledFeatures(ComponentName admin, int userHandle) { + if (mService != null) { + try { + return mService.getKeyguardDisabledFeatures(admin, userHandle); + } catch (RemoteException e) { + Log.w(TAG, "Failed talking with device policy service", e); + } + } + return KEYGUARD_DISABLE_FEATURES_NONE; + } + /** * @hide */ public void setActiveAdmin(ComponentName policyReceiver, boolean refreshing) { if (mService != null) { try { - mService.setActiveAdmin(policyReceiver, refreshing); + mService.setActiveAdmin(policyReceiver, refreshing, UserHandle.myUserId()); } catch (RemoteException e) { Log.w(TAG, "Failed talking with device policy service", e); } @@ -1328,7 +1466,7 @@ public DeviceAdminInfo getAdminInfo(ComponentName cn) { public void getRemoveWarning(ComponentName admin, RemoteCallback result) { if (mService != null) { try { - mService.getRemoveWarning(admin, result); + mService.getRemoveWarning(admin, result, UserHandle.myUserId()); } catch (RemoteException e) { Log.w(TAG, "Failed talking with device policy service", e); } @@ -1339,11 +1477,11 @@ public void getRemoveWarning(ComponentName admin, RemoteCallback result) { * @hide */ public void setActivePasswordState(int quality, int length, int letters, int uppercase, - int lowercase, int numbers, int symbols, int nonletter) { + int lowercase, int numbers, int symbols, int nonletter, int userHandle) { if (mService != null) { try { mService.setActivePasswordState(quality, length, letters, uppercase, lowercase, - numbers, symbols, nonletter); + numbers, symbols, nonletter, userHandle); } catch (RemoteException e) { Log.w(TAG, "Failed talking with device policy service", e); } @@ -1353,10 +1491,10 @@ public void setActivePasswordState(int quality, int length, int letters, int upp /** * @hide */ - public void reportFailedPasswordAttempt() { + public void reportFailedPasswordAttempt(int userHandle) { if (mService != null) { try { - mService.reportFailedPasswordAttempt(); + mService.reportFailedPasswordAttempt(userHandle); } catch (RemoteException e) { Log.w(TAG, "Failed talking with device policy service", e); } @@ -1366,14 +1504,13 @@ public void reportFailedPasswordAttempt() { /** * @hide */ - public void reportSuccessfulPasswordAttempt() { + public void reportSuccessfulPasswordAttempt(int userHandle) { if (mService != null) { try { - mService.reportSuccessfulPasswordAttempt(); + mService.reportSuccessfulPasswordAttempt(userHandle); } catch (RemoteException e) { Log.w(TAG, "Failed talking with device policy service", e); } } } - } diff --git a/core/java/android/app/admin/IDevicePolicyManager.aidl b/core/java/android/app/admin/IDevicePolicyManager.aidl index 9419a62b7de88..e061ab354d733 100644 --- a/core/java/android/app/admin/IDevicePolicyManager.aidl +++ b/core/java/android/app/admin/IDevicePolicyManager.aidl @@ -25,73 +25,76 @@ import android.os.RemoteCallback; * {@hide} */ interface IDevicePolicyManager { - void setPasswordQuality(in ComponentName who, int quality); - int getPasswordQuality(in ComponentName who); + void setPasswordQuality(in ComponentName who, int quality, int userHandle); + int getPasswordQuality(in ComponentName who, int userHandle); - void setPasswordMinimumLength(in ComponentName who, int length); - int getPasswordMinimumLength(in ComponentName who); + void setPasswordMinimumLength(in ComponentName who, int length, int userHandle); + int getPasswordMinimumLength(in ComponentName who, int userHandle); - void setPasswordMinimumUpperCase(in ComponentName who, int length); - int getPasswordMinimumUpperCase(in ComponentName who); + void setPasswordMinimumUpperCase(in ComponentName who, int length, int userHandle); + int getPasswordMinimumUpperCase(in ComponentName who, int userHandle); - void setPasswordMinimumLowerCase(in ComponentName who, int length); - int getPasswordMinimumLowerCase(in ComponentName who); + void setPasswordMinimumLowerCase(in ComponentName who, int length, int userHandle); + int getPasswordMinimumLowerCase(in ComponentName who, int userHandle); - void setPasswordMinimumLetters(in ComponentName who, int length); - int getPasswordMinimumLetters(in ComponentName who); + void setPasswordMinimumLetters(in ComponentName who, int length, int userHandle); + int getPasswordMinimumLetters(in ComponentName who, int userHandle); - void setPasswordMinimumNumeric(in ComponentName who, int length); - int getPasswordMinimumNumeric(in ComponentName who); + void setPasswordMinimumNumeric(in ComponentName who, int length, int userHandle); + int getPasswordMinimumNumeric(in ComponentName who, int userHandle); - void setPasswordMinimumSymbols(in ComponentName who, int length); - int getPasswordMinimumSymbols(in ComponentName who); + void setPasswordMinimumSymbols(in ComponentName who, int length, int userHandle); + int getPasswordMinimumSymbols(in ComponentName who, int userHandle); - void setPasswordMinimumNonLetter(in ComponentName who, int length); - int getPasswordMinimumNonLetter(in ComponentName who); - - void setPasswordHistoryLength(in ComponentName who, int length); - int getPasswordHistoryLength(in ComponentName who); + void setPasswordMinimumNonLetter(in ComponentName who, int length, int userHandle); + int getPasswordMinimumNonLetter(in ComponentName who, int userHandle); - void setPasswordExpirationTimeout(in ComponentName who, long expiration); - long getPasswordExpirationTimeout(in ComponentName who); + void setPasswordHistoryLength(in ComponentName who, int length, int userHandle); + int getPasswordHistoryLength(in ComponentName who, int userHandle); - long getPasswordExpiration(in ComponentName who); + void setPasswordExpirationTimeout(in ComponentName who, long expiration, int userHandle); + long getPasswordExpirationTimeout(in ComponentName who, int userHandle); + + long getPasswordExpiration(in ComponentName who, int userHandle); + + boolean isActivePasswordSufficient(int userHandle); + int getCurrentFailedPasswordAttempts(int userHandle); + + void setMaximumFailedPasswordsForWipe(in ComponentName admin, int num, int userHandle); + int getMaximumFailedPasswordsForWipe(in ComponentName admin, int userHandle); + + boolean resetPassword(String password, int flags, int userHandle); + + void setMaximumTimeToLock(in ComponentName who, long timeMs, int userHandle); + long getMaximumTimeToLock(in ComponentName who, int userHandle); - boolean isActivePasswordSufficient(); - int getCurrentFailedPasswordAttempts(); - - void setMaximumFailedPasswordsForWipe(in ComponentName admin, int num); - int getMaximumFailedPasswordsForWipe(in ComponentName admin); - - boolean resetPassword(String password, int flags); - - void setMaximumTimeToLock(in ComponentName who, long timeMs); - long getMaximumTimeToLock(in ComponentName who); - void lockNow(); - - void wipeData(int flags); - - ComponentName setGlobalProxy(in ComponentName admin, String proxySpec, String exclusionList); - ComponentName getGlobalProxyAdmin(); - - int setStorageEncryption(in ComponentName who, boolean encrypt); - boolean getStorageEncryption(in ComponentName who); - int getStorageEncryptionStatus(); - - void setCameraDisabled(in ComponentName who, boolean disabled); - boolean getCameraDisabled(in ComponentName who); - - void setActiveAdmin(in ComponentName policyReceiver, boolean refreshing); - boolean isAdminActive(in ComponentName policyReceiver); - List getActiveAdmins(); - boolean packageHasActiveAdmins(String packageName); - void getRemoveWarning(in ComponentName policyReceiver, in RemoteCallback result); - void removeActiveAdmin(in ComponentName policyReceiver); - boolean hasGrantedPolicy(in ComponentName policyReceiver, int usesPolicy); - + + void wipeData(int flags, int userHandle); + + ComponentName setGlobalProxy(in ComponentName admin, String proxySpec, String exclusionList, int userHandle); + ComponentName getGlobalProxyAdmin(int userHandle); + + int setStorageEncryption(in ComponentName who, boolean encrypt, int userHandle); + boolean getStorageEncryption(in ComponentName who, int userHandle); + int getStorageEncryptionStatus(int userHandle); + + void setCameraDisabled(in ComponentName who, boolean disabled, int userHandle); + boolean getCameraDisabled(in ComponentName who, int userHandle); + + void setKeyguardDisabledFeatures(in ComponentName who, int which, int userHandle); + int getKeyguardDisabledFeatures(in ComponentName who, int userHandle); + + void setActiveAdmin(in ComponentName policyReceiver, boolean refreshing, int userHandle); + boolean isAdminActive(in ComponentName policyReceiver, int userHandle); + List getActiveAdmins(int userHandle); + boolean packageHasActiveAdmins(String packageName, int userHandle); + void getRemoveWarning(in ComponentName policyReceiver, in RemoteCallback result, int userHandle); + void removeActiveAdmin(in ComponentName policyReceiver, int userHandle); + boolean hasGrantedPolicy(in ComponentName policyReceiver, int usesPolicy, int userHandle); + void setActivePasswordState(int quality, int length, int letters, int uppercase, int lowercase, - int numbers, int symbols, int nonletter); - void reportFailedPasswordAttempt(); - void reportSuccessfulPasswordAttempt(); + int numbers, int symbols, int nonletter, int userHandle); + void reportFailedPasswordAttempt(int userHandle); + void reportSuccessfulPasswordAttempt(int userHandle); } diff --git a/core/java/android/app/backup/WallpaperBackupHelper.java b/core/java/android/app/backup/WallpaperBackupHelper.java index a74a2689c0be6..9e8ab2c5bfbbb 100644 --- a/core/java/android/app/backup/WallpaperBackupHelper.java +++ b/core/java/android/app/backup/WallpaperBackupHelper.java @@ -20,7 +20,9 @@ import android.content.Context; import android.graphics.BitmapFactory; import android.graphics.Point; +import android.os.Environment; import android.os.ParcelFileDescriptor; +import android.os.UserHandle; import android.util.Slog; import android.view.Display; import android.view.WindowManager; @@ -39,8 +41,12 @@ public class WallpaperBackupHelper extends FileBackupHelperBase implements Backu // This path must match what the WallpaperManagerService uses // TODO: Will need to change if backing up non-primary user's wallpaper - public static final String WALLPAPER_IMAGE = "/data/system/users/0/wallpaper"; - public static final String WALLPAPER_INFO = "/data/system/users/0/wallpaper_info.xml"; + public static final String WALLPAPER_IMAGE = + new File(Environment.getUserSystemDirectory(UserHandle.USER_OWNER), + "wallpaper").getAbsolutePath(); + public static final String WALLPAPER_INFO = + new File(Environment.getUserSystemDirectory(UserHandle.USER_OWNER), + "wallpaper_info.xml").getAbsolutePath(); // Use old keys to keep legacy data compatibility and avoid writing two wallpapers public static final String WALLPAPER_IMAGE_KEY = "/data/data/com.android.settings/files/wallpaper"; @@ -50,7 +56,9 @@ public class WallpaperBackupHelper extends FileBackupHelperBase implements Backu // will be saved to this file from the restore stream, then renamed to the proper // location if it's deemed suitable. // TODO: Will need to change if backing up non-primary user's wallpaper - private static final String STAGE_FILE = "/data/system/users/0/wallpaper-tmp"; + private static final String STAGE_FILE = + new File(Environment.getUserSystemDirectory(UserHandle.USER_OWNER), + "wallpaper-tmp").getAbsolutePath(); Context mContext; String[] mFiles; diff --git a/core/java/android/appwidget/AppWidgetHost.java b/core/java/android/appwidget/AppWidgetHost.java index 08bc0acb31ac8..cb61a71b147af 100644 --- a/core/java/android/appwidget/AppWidgetHost.java +++ b/core/java/android/appwidget/AppWidgetHost.java @@ -19,16 +19,21 @@ import java.util.ArrayList; import java.util.HashMap; +import android.app.ActivityThread; import android.content.Context; +import android.os.Binder; import android.os.Handler; import android.os.IBinder; import android.os.Looper; import android.os.Message; +import android.os.Process; import android.os.RemoteException; import android.os.ServiceManager; +import android.os.UserHandle; import android.util.DisplayMetrics; import android.util.TypedValue; import android.widget.RemoteViews; +import android.widget.RemoteViews.OnClickHandler; import com.android.internal.appwidget.IAppWidgetHost; import com.android.internal.appwidget.IAppWidgetService; @@ -41,7 +46,8 @@ public class AppWidgetHost { static final int HANDLE_UPDATE = 1; static final int HANDLE_PROVIDER_CHANGED = 2; - static final int HANDLE_VIEW_DATA_CHANGED = 3; + static final int HANDLE_PROVIDERS_CHANGED = 3; + static final int HANDLE_VIEW_DATA_CHANGED = 4; final static Object sServiceLock = new Object(); static IAppWidgetService sService; @@ -52,6 +58,9 @@ public class AppWidgetHost { class Callbacks extends IAppWidgetHost.Stub { public void updateAppWidget(int appWidgetId, RemoteViews views) { + if (isLocalBinder() && views != null) { + views = views.clone(); + } Message msg = mHandler.obtainMessage(HANDLE_UPDATE); msg.arg1 = appWidgetId; msg.obj = views; @@ -59,12 +68,20 @@ public void updateAppWidget(int appWidgetId, RemoteViews views) { } public void providerChanged(int appWidgetId, AppWidgetProviderInfo info) { + if (isLocalBinder() && info != null) { + info = info.clone(); + } Message msg = mHandler.obtainMessage(HANDLE_PROVIDER_CHANGED); msg.arg1 = appWidgetId; msg.obj = info; msg.sendToTarget(); } + public void providersChanged() { + Message msg = mHandler.obtainMessage(HANDLE_PROVIDERS_CHANGED); + msg.sendToTarget(); + } + public void viewDataChanged(int appWidgetId, int viewId) { Message msg = mHandler.obtainMessage(HANDLE_VIEW_DATA_CHANGED); msg.arg1 = appWidgetId; @@ -77,7 +94,7 @@ class UpdateHandler extends Handler { public UpdateHandler(Looper looper) { super(looper); } - + public void handleMessage(Message msg) { switch (msg.what) { case HANDLE_UPDATE: { @@ -88,6 +105,10 @@ public void handleMessage(Message msg) { onProviderChanged(msg.arg1, (AppWidgetProviderInfo)msg.obj); break; } + case HANDLE_PROVIDERS_CHANGED: { + onProvidersChanged(); + break; + } case HANDLE_VIEW_DATA_CHANGED: { viewDataChanged(msg.arg1, msg.arg2); break; @@ -95,18 +116,31 @@ public void handleMessage(Message msg) { } } } - + Handler mHandler; int mHostId; Callbacks mCallbacks = new Callbacks(); final HashMap mViews = new HashMap(); + private OnClickHandler mOnClickHandler; public AppWidgetHost(Context context, int hostId) { + this(context, hostId, null, context.getMainLooper()); + } + + /** + * @hide + */ + public AppWidgetHost(Context context, int hostId, OnClickHandler handler, Looper looper) { mContext = context; mHostId = hostId; - mHandler = new UpdateHandler(context.getMainLooper()); + mOnClickHandler = handler; + mHandler = new UpdateHandler(looper); mDisplayMetrics = context.getResources().getDisplayMetrics(); + bindService(); + } + + private static void bindService() { synchronized (sServiceLock) { if (sService == null) { IBinder b = ServiceManager.getService(Context.APPWIDGET_SERVICE); @@ -122,7 +156,7 @@ public AppWidgetHost(Context context, int hostId) { public void startListening() { int[] updatedIds; ArrayList updatedViews = new ArrayList(); - + try { if (mPackageName == null) { mPackageName = mContext.getPackageName(); @@ -170,7 +204,40 @@ public int allocateAppWidgetId() { } /** - * Stop listening to changes for this AppWidget. + * Get a appWidgetId for a host in the calling process. + * + * @return a appWidgetId + * @hide + */ + public static int allocateAppWidgetIdForSystem(int hostId) { + checkCallerIsSystem(); + try { + if (sService == null) { + bindService(); + } + Context systemContext = + (Context) ActivityThread.currentActivityThread().getSystemContext(); + String packageName = systemContext.getPackageName(); + return sService.allocateAppWidgetId(packageName, hostId); + } catch (RemoteException e) { + throw new RuntimeException("system server dead?", e); + } + } + + private static void checkCallerIsSystem() { + int uid = Process.myUid(); + if (UserHandle.getAppId(uid) == Process.SYSTEM_UID || uid == 0) { + return; + } + throw new SecurityException("Disallowed call for uid " + uid); + } + + private boolean isLocalBinder() { + return Process.myPid() == Binder.getCallingPid(); + } + + /** + * Stop listening to changes for this AppWidget. */ public void deleteAppWidgetId(int appWidgetId) { synchronized (mViews) { @@ -184,6 +251,22 @@ public void deleteAppWidgetId(int appWidgetId) { } } + /** + * Stop listening to changes for this AppWidget. + * @hide + */ + public static void deleteAppWidgetIdForSystem(int appWidgetId) { + checkCallerIsSystem(); + try { + if (sService == null) { + bindService(); + } + sService.deleteAppWidgetId(appWidgetId); + } catch (RemoteException e) { + throw new RuntimeException("system server dead?", e); + } + } + /** * Remove all records about this host from the AppWidget manager. *

      @@ -225,6 +308,7 @@ public static void deleteAllHosts() { public final AppWidgetHostView createView(Context context, int appWidgetId, AppWidgetProviderInfo appWidget) { AppWidgetHostView view = onCreateView(context, appWidgetId, appWidget); + view.setOnClickHandler(mOnClickHandler); view.setAppWidget(appWidgetId, appWidget); synchronized (mViews) { mViews.put(appWidgetId, view); @@ -236,6 +320,7 @@ public final AppWidgetHostView createView(Context context, int appWidgetId, throw new RuntimeException("system server dead?", e); } view.updateAppWidget(views); + return view; } @@ -245,7 +330,7 @@ public final AppWidgetHostView createView(Context context, int appWidgetId, */ protected AppWidgetHostView onCreateView(Context context, int appWidgetId, AppWidgetProviderInfo appWidget) { - return new AppWidgetHostView(context); + return new AppWidgetHostView(context, mOnClickHandler); } /** @@ -255,7 +340,7 @@ protected void onProviderChanged(int appWidgetId, AppWidgetProviderInfo appWidge AppWidgetHostView v; // Convert complex to dp -- we are getting the AppWidgetProviderInfo from the - // AppWidgetService, which doesn't have our context, hence we need to do the + // AppWidgetService, which doesn't have our context, hence we need to do the // conversion here. appWidget.minWidth = TypedValue.complexToDimensionPixelSize(appWidget.minWidth, mDisplayMetrics); @@ -274,6 +359,14 @@ protected void onProviderChanged(int appWidgetId, AppWidgetProviderInfo appWidge } } + /** + * Called when the set of available widgets changes (ie. widget containing packages + * are added, updated or removed, or widget components are enabled or disabled.) + */ + protected void onProvidersChanged() { + // Do nothing + } + void updateAppWidgetView(int appWidgetId, RemoteViews views) { AppWidgetHostView v; synchronized (mViews) { diff --git a/core/java/android/appwidget/AppWidgetHostView.java b/core/java/android/appwidget/AppWidgetHostView.java index ed95ae587de83..52771eebecbb9 100644 --- a/core/java/android/appwidget/AppWidgetHostView.java +++ b/core/java/android/appwidget/AppWidgetHostView.java @@ -44,6 +44,7 @@ import android.widget.BaseAdapter; import android.widget.FrameLayout; import android.widget.RemoteViews; +import android.widget.RemoteViews.OnClickHandler; import android.widget.RemoteViewsAdapter.RemoteAdapterConnectionCallback; import android.widget.TextView; @@ -83,7 +84,8 @@ public boolean onLoadClass(Class clazz) { long mFadeStartTime = -1; Bitmap mOld; Paint mOldPaint = new Paint(); - + private OnClickHandler mOnClickHandler; + /** * Create a host view. Uses default fade animations. */ @@ -91,10 +93,18 @@ public AppWidgetHostView(Context context) { this(context, android.R.anim.fade_in, android.R.anim.fade_out); } + /** + * @hide + */ + public AppWidgetHostView(Context context, OnClickHandler handler) { + this(context, android.R.anim.fade_in, android.R.anim.fade_out); + mOnClickHandler = handler; + } + /** * Create a host view. Uses specified animations when pushing * {@link #updateAppWidget(RemoteViews)}. - * + * * @param animationIn Resource ID of in animation to use * @param animationOut Resource ID of out animation to use */ @@ -108,6 +118,17 @@ public AppWidgetHostView(Context context, int animationIn, int animationOut) { setIsRootNamespace(true); } + /** + * Pass the given handler to RemoteViews when updating this widget. Unless this + * is done immediatly after construction, a call to {@link #updateAppWidget(RemoteViews)} + * should be made. + * @param handler + * @hide + */ + public void setOnClickHandler(OnClickHandler handler) { + mOnClickHandler = handler; + } + /** * Set the AppWidget that will be displayed by this view. This method also adds default padding * to widgets, as described in {@link #getDefaultPaddingForWidget(Context, ComponentName, Rect)} @@ -123,6 +144,7 @@ public void setAppWidget(int appWidgetId, AppWidgetProviderInfo info) { // We add padding to the AppWidgetHostView if necessary Rect padding = getDefaultPaddingForWidget(mContext, info.provider, null); setPadding(padding.left, padding.top, padding.right, padding.bottom); + setContentDescription(info.label); } } @@ -140,7 +162,7 @@ public void setAppWidget(int appWidgetId, AppWidgetProviderInfo info) { * @param component the component name of the widget * @param padding Rect in which to place the output, if null, a new Rect will be allocated and * returned - * @return default padding for this widget + * @return default padding for this widget, in pixels */ public static Rect getDefaultPaddingForWidget(Context context, ComponentName component, Rect padding) { @@ -177,7 +199,7 @@ public static Rect getDefaultPaddingForWidget(Context context, ComponentName com public int getAppWidgetId() { return mAppWidgetId; } - + public AppWidgetProviderInfo getAppWidgetInfo() { return mInfo; } @@ -205,7 +227,12 @@ protected void dispatchRestoreInstanceState(SparseArray container) { if (jail == null) jail = new ParcelableSparseArray(); - super.dispatchRestoreInstanceState(jail); + try { + super.dispatchRestoreInstanceState(jail); + } catch (Exception e) { + Log.e(TAG, "failed to restoreInstanceState for widget id: " + mAppWidgetId + ", " + + (mInfo == null ? "null" : mInfo.provider), e); + } } /** @@ -215,18 +242,26 @@ protected void dispatchRestoreInstanceState(SparseArray container) { * AppWidget options and causes a callback to the AppWidgetProvider. * @see AppWidgetProvider#onAppWidgetOptionsChanged(Context, AppWidgetManager, int, Bundle) * - * @param options The bundle of options, in addition to the size information, + * @param newOptions The bundle of options, in addition to the size information, * can be null. - * @param minWidth The minimum width that the widget will be displayed at. - * @param minHeight The maximum height that the widget will be displayed at. - * @param maxWidth The maximum width that the widget will be displayed at. - * @param maxHeight The maximum height that the widget will be displayed at. + * @param minWidth The minimum width in dips that the widget will be displayed at. + * @param minHeight The maximum height in dips that the widget will be displayed at. + * @param maxWidth The maximum width in dips that the widget will be displayed at. + * @param maxHeight The maximum height in dips that the widget will be displayed at. * */ - public void updateAppWidgetSize(Bundle options, int minWidth, int minHeight, int maxWidth, + public void updateAppWidgetSize(Bundle newOptions, int minWidth, int minHeight, int maxWidth, int maxHeight) { - if (options == null) { - options = new Bundle(); + updateAppWidgetSize(newOptions, minWidth, minHeight, maxWidth, maxHeight, false); + } + + /** + * @hide + */ + public void updateAppWidgetSize(Bundle newOptions, int minWidth, int minHeight, int maxWidth, + int maxHeight, boolean ignorePadding) { + if (newOptions == null) { + newOptions = new Bundle(); } Rect padding = new Rect(); @@ -238,11 +273,30 @@ public void updateAppWidgetSize(Bundle options, int minWidth, int minHeight, int int xPaddingDips = (int) ((padding.left + padding.right) / density); int yPaddingDips = (int) ((padding.top + padding.bottom) / density); - options.putInt(AppWidgetManager.OPTION_APPWIDGET_MIN_WIDTH, minWidth - xPaddingDips); - options.putInt(AppWidgetManager.OPTION_APPWIDGET_MIN_HEIGHT, minHeight - yPaddingDips); - options.putInt(AppWidgetManager.OPTION_APPWIDGET_MAX_WIDTH, maxWidth - xPaddingDips); - options.putInt(AppWidgetManager.OPTION_APPWIDGET_MAX_HEIGHT, maxHeight - yPaddingDips); - updateAppWidgetOptions(options); + int newMinWidth = minWidth - (ignorePadding ? 0 : xPaddingDips); + int newMinHeight = minHeight - (ignorePadding ? 0 : yPaddingDips); + int newMaxWidth = maxWidth - (ignorePadding ? 0 : xPaddingDips); + int newMaxHeight = maxHeight - (ignorePadding ? 0 : yPaddingDips); + + AppWidgetManager widgetManager = AppWidgetManager.getInstance(mContext); + + // We get the old options to see if the sizes have changed + Bundle oldOptions = widgetManager.getAppWidgetOptions(mAppWidgetId); + boolean needsUpdate = false; + if (newMinWidth != oldOptions.getInt(AppWidgetManager.OPTION_APPWIDGET_MIN_WIDTH) || + newMinHeight != oldOptions.getInt(AppWidgetManager.OPTION_APPWIDGET_MIN_HEIGHT) || + newMaxWidth != oldOptions.getInt(AppWidgetManager.OPTION_APPWIDGET_MAX_WIDTH) || + newMaxHeight != oldOptions.getInt(AppWidgetManager.OPTION_APPWIDGET_MAX_HEIGHT)) { + needsUpdate = true; + } + + if (needsUpdate) { + newOptions.putInt(AppWidgetManager.OPTION_APPWIDGET_MIN_WIDTH, newMinWidth); + newOptions.putInt(AppWidgetManager.OPTION_APPWIDGET_MIN_HEIGHT, newMinHeight); + newOptions.putInt(AppWidgetManager.OPTION_APPWIDGET_MAX_WIDTH, newMaxWidth); + newOptions.putInt(AppWidgetManager.OPTION_APPWIDGET_MAX_HEIGHT, newMaxHeight); + updateAppWidgetOptions(newOptions); + } } /** @@ -281,12 +335,13 @@ void resetAppWidget(AppWidgetProviderInfo info) { * AppWidget provider. Will animate into these new views as needed */ public void updateAppWidget(RemoteViews remoteViews) { + if (LOGD) Log.d(TAG, "updateAppWidget called mOld=" + mOld); boolean recycled = false; View content = null; Exception exception = null; - + // Capture the old view into a bitmap so we can do the crossfade. if (CROSSFADE) { if (mFadeStartTime < 0) { @@ -305,7 +360,7 @@ public void updateAppWidget(RemoteViews remoteViews) { } } } - + if (remoteViews == null) { if (mViewMode == VIEW_MODE_DEFAULT) { // We've already done this -- nothing to do. @@ -324,7 +379,7 @@ public void updateAppWidget(RemoteViews remoteViews) { // layout matches, try recycling it if (content == null && layoutId == mLayoutId) { try { - remoteViews.reapply(mContext, mView); + remoteViews.reapply(mContext, mView, mOnClickHandler); content = mView; recycled = true; if (LOGD) Log.d(TAG, "was able to recycled existing layout"); @@ -332,11 +387,11 @@ public void updateAppWidget(RemoteViews remoteViews) { exception = e; } } - + // Try normal RemoteView inflation if (content == null) { try { - content = remoteViews.apply(mContext, this); + content = remoteViews.apply(mContext, this, mOnClickHandler); if (LOGD) Log.d(TAG, "had to inflate new layout"); } catch (RuntimeException e) { exception = e; @@ -346,7 +401,7 @@ public void updateAppWidget(RemoteViews remoteViews) { mLayoutId = layoutId; mViewMode = VIEW_MODE_CONTENT; } - + if (content == null) { if (mViewMode == VIEW_MODE_ERROR) { // We've already done this -- nothing to do. @@ -356,7 +411,7 @@ public void updateAppWidget(RemoteViews remoteViews) { content = getErrorView(); mViewMode = VIEW_MODE_ERROR; } - + if (!recycled) { prepareView(content); addView(content); @@ -455,7 +510,7 @@ protected boolean drawChild(Canvas canvas, View child, long drawingTime) { return super.drawChild(canvas, child, drawingTime); } } - + /** * Prepare the given view to be shown. This might include adjusting * {@link FrameLayout.LayoutParams} before inserting. @@ -471,7 +526,7 @@ protected void prepareView(View view) { requested.gravity = Gravity.CENTER; view.setLayoutParams(requested); } - + /** * Inflate and return the default layout requested by AppWidget provider. */ @@ -481,7 +536,7 @@ protected View getDefaultView() { } View defaultView = null; Exception exception = null; - + try { if (mInfo != null) { Context theirContext = mContext.createPackageContext( @@ -491,7 +546,20 @@ protected View getDefaultView() { theirContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); inflater = inflater.cloneInContext(theirContext); inflater.setFilter(sInflaterFilter); - defaultView = inflater.inflate(mInfo.initialLayout, this, false); + AppWidgetManager manager = AppWidgetManager.getInstance(mContext); + Bundle options = manager.getAppWidgetOptions(mAppWidgetId); + + int layoutId = mInfo.initialLayout; + if (options.containsKey(AppWidgetManager.OPTION_APPWIDGET_HOST_CATEGORY)) { + int category = options.getInt(AppWidgetManager.OPTION_APPWIDGET_HOST_CATEGORY); + if (category == AppWidgetProviderInfo.WIDGET_CATEGORY_KEYGUARD) { + int kgLayoutId = mInfo.initialKeyguardLayout; + // If a default keyguard layout is not specified, use the standard + // default layout. + layoutId = kgLayoutId == 0 ? layoutId : kgLayoutId; + } + } + defaultView = inflater.inflate(layoutId, this, false); } else { Log.w(TAG, "can't inflate defaultView because mInfo is missing"); } @@ -500,19 +568,19 @@ protected View getDefaultView() { } catch (RuntimeException e) { exception = e; } - + if (exception != null) { Log.w(TAG, "Error inflating AppWidget " + mInfo + ": " + exception.toString()); } - + if (defaultView == null) { if (LOGD) Log.d(TAG, "getDefaultView couldn't find any view, so inflating error"); defaultView = getErrorView(); } - + return defaultView; } - + /** * Inflate and return a view that represents an error state. */ diff --git a/core/java/android/appwidget/AppWidgetManager.java b/core/java/android/appwidget/AppWidgetManager.java index 810e7909a66ae..3dd640c151bc2 100644 --- a/core/java/android/appwidget/AppWidgetManager.java +++ b/core/java/android/appwidget/AppWidgetManager.java @@ -79,6 +79,13 @@ public class AppWidgetManager { */ public static final String ACTION_APPWIDGET_PICK = "android.appwidget.action.APPWIDGET_PICK"; + /** + * Similar to ACTION_APPWIDGET_PICK, but used from keyguard + * @hide + */ + public static final String + ACTION_KEYGUARD_APPWIDGET_PICK = "android.appwidget.action.KEYGUARD_APPWIDGET_PICK"; + /** * Send this from your {@link AppWidgetHost} activity when you want to bind an AppWidget to * display and bindAppWidgetIdIfAllowed returns false. @@ -150,25 +157,33 @@ public class AppWidgetManager { public static final String EXTRA_APPWIDGET_ID = "appWidgetId"; /** - * An bundle extra that contains the lower bound on the current width, in dips, of a widget instance. + * A bundle extra that contains the lower bound on the current width, in dips, of a widget instance. */ public static final String OPTION_APPWIDGET_MIN_WIDTH = "appWidgetMinWidth"; /** - * An bundle extra that contains the lower bound on the current height, in dips, of a widget instance. + * A bundle extra that contains the lower bound on the current height, in dips, of a widget instance. */ public static final String OPTION_APPWIDGET_MIN_HEIGHT = "appWidgetMinHeight"; /** - * An bundle extra that contains the upper bound on the current width, in dips, of a widget instance. + * A bundle extra that contains the upper bound on the current width, in dips, of a widget instance. */ public static final String OPTION_APPWIDGET_MAX_WIDTH = "appWidgetMaxWidth"; /** - * An bundle extra that contains the upper bound on the current width, in dips, of a widget instance. + * A bundle extra that contains the upper bound on the current width, in dips, of a widget instance. */ public static final String OPTION_APPWIDGET_MAX_HEIGHT = "appWidgetMaxHeight"; + /** + * A bundle extra that hints to the AppWidgetProvider the category of host that owns this + * this widget. Can have the value {@link + * AppWidgetProviderInfo#WIDGET_CATEGORY_HOME_SCREEN} or {@link + * AppWidgetProviderInfo#WIDGET_CATEGORY_KEYGUARD}. + */ + public static final String OPTION_APPWIDGET_HOST_CATEGORY = "appWidgetCategory"; + /** * An intent extra which points to a bundle of extra information for a particular widget id. * In particular this bundle can contain EXTRA_APPWIDGET_WIDTH and EXTRA_APPWIDGET_HEIGHT. @@ -207,6 +222,21 @@ public class AppWidgetManager { */ public static final String EXTRA_CUSTOM_EXTRAS = "customExtras"; + /** + * An intent extra to pass to the AppWidget picker which allows the picker to filter + * the list based on the {@link AppWidgetProviderInfo#widgetCategory}. + * + * @hide + */ + public static final String EXTRA_CATEGORY_FILTER = "categoryFilter"; + + /** + * An intent extra to pass to the AppWidget picker to specify whether or not to sort + * the list of caller-specified extra AppWidgets along with the rest of the AppWidgets + * @hide + */ + public static final String EXTRA_CUSTOM_SORT = "customSort"; + /** * A sentiel value that the AppWidget manager will never return as a appWidgetId. */ @@ -237,8 +267,9 @@ public class AppWidgetManager { /** * Sent when the custom extras for an AppWidget change. * - * @see AppWidgetProvider#onAppWidgetExtrasChanged AppWidgetProvider#onAppWidgetExtrasChanged( - * Context context, AppWidgetManager appWidgetManager, int appWidgetId, Bundle newExtras) + * @see AppWidgetProvider#onAppWidgetOptionsChanged + * AppWidgetProvider.onAppWidgetOptionsChanged(Context context, + * AppWidgetManager appWidgetManager, int appWidgetId, Bundle newExtras) */ public static final String ACTION_APPWIDGET_OPTIONS_CHANGED = "android.appwidget.action.APPWIDGET_UPDATE_OPTIONS"; @@ -405,10 +436,9 @@ public void updateAppWidget(int appWidgetId, RemoteViews views) { * * This update differs from {@link #updateAppWidget(int[], RemoteViews)} in that the * RemoteViews object which is passed is understood to be an incomplete representation of the - * widget, and hence is not cached by the AppWidgetService. Note that because these updates are - * not cached, any state that they modify that is not restored by restoreInstanceState will not - * persist in the case that the widgets are restored using the cached version in - * AppWidgetService. + * widget, and hence does not replace the cached representation of the widget. As of API + * level 17, the new properties set within the views objects will be appended to the cached + * representation of the widget, and hence will persist. * * Use with {@link RemoteViews#showNext(int)}, {@link RemoteViews#showPrevious(int)}, * {@link RemoteViews#setScrollPosition(int, int)} and similar commands. @@ -418,6 +448,10 @@ public void updateAppWidget(int appWidgetId, RemoteViews views) { * and outside of the handler. * This method will only work when called from the uid that owns the AppWidget provider. * + *

      + * This method will be ignored if a widget has not received a full update via + * {@link #updateAppWidget(int[], RemoteViews)}. + * * @param appWidgetIds The AppWidget instances for which to set the RemoteViews. * @param views The RemoteViews object containing the incremental update / command. */ @@ -446,6 +480,10 @@ public void partiallyUpdateAppWidget(int[] appWidgetIds, RemoteViews views) { * and outside of the handler. * This method will only work when called from the uid that owns the AppWidget provider. * + *

      + * This method will be ignored if a widget has not received a full update via + * {@link #updateAppWidget(int[], RemoteViews)}. + * * @param appWidgetId The AppWidget instance for which to set the RemoteViews. * @param views The RemoteViews object containing the incremental update / command. */ @@ -567,7 +605,31 @@ public AppWidgetProviderInfo getAppWidgetInfo(int appWidgetId) { */ public void bindAppWidgetId(int appWidgetId, ComponentName provider) { try { - sService.bindAppWidgetId(appWidgetId, provider); + sService.bindAppWidgetId(appWidgetId, provider, null); + } + catch (RemoteException e) { + throw new RuntimeException("system server dead?", e); + } + } + + /** + * Set the component for a given appWidgetId. + * + *

      You need the BIND_APPWIDGET permission or the user must have enabled binding + * widgets always for your component. This method is used by the AppWidget picker and + * should not be used by other apps. + * + * @param appWidgetId The AppWidget instance for which to set the RemoteViews. + * @param provider The {@link android.content.BroadcastReceiver} that will be the AppWidget + * provider for this AppWidget. + * @param options Bundle containing options for the AppWidget. See also + * {@link #updateAppWidgetOptions(int, Bundle)} + * + * @hide + */ + public void bindAppWidgetId(int appWidgetId, ComponentName provider, Bundle options) { + try { + sService.bindAppWidgetId(appWidgetId, provider, options); } catch (RemoteException e) { throw new RuntimeException("system server dead?", e); @@ -593,7 +655,37 @@ public boolean bindAppWidgetIdIfAllowed(int appWidgetId, ComponentName provider) } try { return sService.bindAppWidgetIdIfAllowed( - mContext.getPackageName(), appWidgetId, provider); + mContext.getPackageName(), appWidgetId, provider, null); + } + catch (RemoteException e) { + throw new RuntimeException("system server dead?", e); + } + } + + /** + * Set the component for a given appWidgetId. + * + *

      You need the BIND_APPWIDGET permission or the user must have enabled binding + * widgets always for your component. Should be used by apps that host widgets; if this + * method returns false, call {@link #ACTION_APPWIDGET_BIND} to request permission to + * bind + * + * @param appWidgetId The AppWidget instance for which to set the RemoteViews. + * @param provider The {@link android.content.BroadcastReceiver} that will be the AppWidget + * provider for this AppWidget. + * @param options Bundle containing options for the AppWidget. See also + * {@link #updateAppWidgetOptions(int, Bundle)} + * + * @return true if this component has permission to bind the AppWidget + */ + public boolean bindAppWidgetIdIfAllowed(int appWidgetId, ComponentName provider, + Bundle options) { + if (mContext == null) { + return false; + } + try { + return sService.bindAppWidgetIdIfAllowed( + mContext.getPackageName(), appWidgetId, provider, options); } catch (RemoteException e) { throw new RuntimeException("system server dead?", e); diff --git a/core/java/android/appwidget/AppWidgetProviderInfo.java b/core/java/android/appwidget/AppWidgetProviderInfo.java index c33681d659417..7b8b286ab643a 100644 --- a/core/java/android/appwidget/AppWidgetProviderInfo.java +++ b/core/java/android/appwidget/AppWidgetProviderInfo.java @@ -43,6 +43,16 @@ public class AppWidgetProviderInfo implements Parcelable { */ public static final int RESIZE_BOTH = RESIZE_HORIZONTAL | RESIZE_VERTICAL; + /** + * Indicates that the widget can be displayed on the home screen. This is the default value. + */ + public static final int WIDGET_CATEGORY_HOME_SCREEN = 1; + + /** + * Indicates that the widget can be displayed on the keyguard. + */ + public static final int WIDGET_CATEGORY_KEYGUARD = 2; + /** * Identity of this AppWidget component. This component should be a {@link * android.content.BroadcastReceiver}, and it will be sent the AppWidget intents @@ -110,6 +120,16 @@ public class AppWidgetProviderInfo implements Parcelable { */ public int initialLayout; + /** + * The resource id of the initial layout for this AppWidget when it is displayed on keyguard. + * This parameter only needs to be provided if the widget can be displayed on the keyguard, + * see {@link #widgetCategory}. + * + *

      This field corresponds to the android:initialKeyguardLayout attribute in + * the AppWidget meta-data file. + */ + public int initialKeyguardLayout; + /** * The activity to launch that will configure the AppWidget. * @@ -164,6 +184,17 @@ public class AppWidgetProviderInfo implements Parcelable { */ public int resizeMode; + /** + * Determines whether this widget can be displayed on the home screen, the keyguard, or both. + * A widget which is displayed on both needs to ensure that it follows the design guidelines + * for both widget classes. This can be achieved by querying the AppWidget options in its + * widget provider's update method. + * + *

      This field corresponds to the widgetCategory attribute in + * the AppWidget meta-data file. + */ + public int widgetCategory; + public AppWidgetProviderInfo() { } @@ -180,6 +211,7 @@ public AppWidgetProviderInfo(Parcel in) { this.minResizeHeight = in.readInt(); this.updatePeriodMillis = in.readInt(); this.initialLayout = in.readInt(); + this.initialKeyguardLayout = in.readInt(); if (0 != in.readInt()) { this.configure = new ComponentName(in); } @@ -188,6 +220,7 @@ public AppWidgetProviderInfo(Parcel in) { this.previewImage = in.readInt(); this.autoAdvanceViewId = in.readInt(); this.resizeMode = in.readInt(); + this.widgetCategory = in.readInt(); } public void writeToParcel(android.os.Parcel out, int flags) { @@ -203,6 +236,7 @@ public void writeToParcel(android.os.Parcel out, int flags) { out.writeInt(this.minResizeHeight); out.writeInt(this.updatePeriodMillis); out.writeInt(this.initialLayout); + out.writeInt(this.initialKeyguardLayout); if (this.configure != null) { out.writeInt(1); this.configure.writeToParcel(out, flags); @@ -214,6 +248,28 @@ public void writeToParcel(android.os.Parcel out, int flags) { out.writeInt(this.previewImage); out.writeInt(this.autoAdvanceViewId); out.writeInt(this.resizeMode); + out.writeInt(this.widgetCategory); + } + + @Override + public AppWidgetProviderInfo clone() { + AppWidgetProviderInfo that = new AppWidgetProviderInfo(); + that.provider = this.provider == null ? null : this.provider.clone(); + that.minWidth = this.minWidth; + that.minHeight = this.minHeight; + that.minResizeWidth = this.minResizeHeight; + that.minResizeHeight = this.minResizeHeight; + that.updatePeriodMillis = this.updatePeriodMillis; + that.initialLayout = this.initialLayout; + that.initialKeyguardLayout = this.initialKeyguardLayout; + that.configure = this.configure == null ? null : this.configure.clone(); + that.label = this.label == null ? null : this.label.substring(0); + that.icon = this.icon; + that.previewImage = this.previewImage; + that.autoAdvanceViewId = this.autoAdvanceViewId; + that.resizeMode = this.resizeMode; + that.widgetCategory = this.widgetCategory; + return that; } public int describeContents() { diff --git a/core/java/android/bluetooth/AtCommandHandler.java b/core/java/android/bluetooth/AtCommandHandler.java deleted file mode 100644 index 6deab34ed483c..0000000000000 --- a/core/java/android/bluetooth/AtCommandHandler.java +++ /dev/null @@ -1,94 +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. - */ - -package android.bluetooth; - -import android.bluetooth.AtCommandResult; - -/** - * Handler Interface for {@link AtParser}.

      - * @hide - */ -public abstract class AtCommandHandler { - - /** - * Handle Basic commands "ATA".

      - * These are single letter commands such as ATA and ATD. Anything following - * the single letter command ('A' and 'D' respectively) will be passed as - * 'arg'.

      - * For example, "ATDT1234" would result in the call - * handleBasicCommand("T1234").

      - * @param arg Everything following the basic command character. - * @return The result of this command. - */ - public AtCommandResult handleBasicCommand(String arg) { - return new AtCommandResult(AtCommandResult.ERROR); - } - - /** - * Handle Actions command "AT+FOO".

      - * Action commands are part of the Extended command syntax, and are - * typically used to signal an action on "FOO".

      - * @return The result of this command. - */ - public AtCommandResult handleActionCommand() { - return new AtCommandResult(AtCommandResult.ERROR); - } - - /** - * Handle Read command "AT+FOO?".

      - * Read commands are part of the Extended command syntax, and are - * typically used to read the value of "FOO".

      - * @return The result of this command. - */ - public AtCommandResult handleReadCommand() { - return new AtCommandResult(AtCommandResult.ERROR); - } - - /** - * Handle Set command "AT+FOO=...".

      - * Set commands are part of the Extended command syntax, and are - * typically used to set the value of "FOO". Multiple arguments can be - * sent.

      - * AT+FOO=[[,[,...]]]

      - * Each argument will be either numeric (Integer) or String. - * handleSetCommand is passed a generic Object[] array in which each - * element will be an Integer (if it can be parsed with parseInt()) or - * String.

      - * Missing arguments ",," are set to empty Strings.

      - * @param args Array of String and/or Integer's. There will always be at - * least one element in this array. - * @return The result of this command. - */ - // Typically used to set this parameter - public AtCommandResult handleSetCommand(Object[] args) { - return new AtCommandResult(AtCommandResult.ERROR); - } - - /** - * Handle Test command "AT+FOO=?".

      - * Test commands are part of the Extended command syntax, and are typically - * used to request an indication of the range of legal values that "FOO" - * can take.

      - * By default we return an OK result, to indicate that this command is at - * least recognized.

      - * @return The result of this command. - */ - public AtCommandResult handleTestCommand() { - return new AtCommandResult(AtCommandResult.OK); - } - -} diff --git a/core/java/android/bluetooth/AtCommandResult.java b/core/java/android/bluetooth/AtCommandResult.java deleted file mode 100644 index 9675234dd076c..0000000000000 --- a/core/java/android/bluetooth/AtCommandResult.java +++ /dev/null @@ -1,115 +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. - */ - -package android.bluetooth; - -/** - * The result of execution of a single AT command.

      - * - * - * This class can represent the final response to an AT command line, and also - * intermediate responses to a single command within a chained AT command - * line.

      - * - * The actual responses that are intended to be send in reply to the AT command - * line are stored in a string array. The final response is stored as an - * int enum, converted to a string when toString() is called. Only a single - * final response is sent from multiple commands chained into a single command - * line.

      - * @hide - */ -public class AtCommandResult { - // Result code enumerations - public static final int OK = 0; - public static final int ERROR = 1; - public static final int UNSOLICITED = 2; - - private static final String OK_STRING = "OK"; - private static final String ERROR_STRING = "ERROR"; - - private int mResultCode; // Result code - private StringBuilder mResponse; // Response with CRLF line breaks - - /** - * Construct a new AtCommandResult with given result code, and an empty - * response array. - * @param resultCode One of OK, ERROR or UNSOLICITED. - */ - public AtCommandResult(int resultCode) { - mResultCode = resultCode; - mResponse = new StringBuilder(); - } - - /** - * Construct a new AtCommandResult with result code OK, and the specified - * single line response. - * @param response The single line response. - */ - public AtCommandResult(String response) { - this(OK); - addResponse(response); - } - - public int getResultCode() { - return mResultCode; - } - - /** - * Add another line to the response. - */ - public void addResponse(String response) { - appendWithCrlf(mResponse, response); - } - - /** - * Add the given result into this AtCommandResult object.

      - * Used to combine results from multiple commands in a single command line - * (command chaining). - * @param result The AtCommandResult to add to this result. - */ - public void addResult(AtCommandResult result) { - if (result != null) { - appendWithCrlf(mResponse, result.mResponse.toString()); - mResultCode = result.mResultCode; - } - } - - /** - * Generate the string response ready to send - */ - public String toString() { - StringBuilder result = new StringBuilder(mResponse.toString()); - switch (mResultCode) { - case OK: - appendWithCrlf(result, OK_STRING); - break; - case ERROR: - appendWithCrlf(result, ERROR_STRING); - break; - } - return result.toString(); - } - - /** Append a string to a string builder, joining with a double - * CRLF. Used to create multi-line AT command replies - */ - public static void appendWithCrlf(StringBuilder str1, String str2) { - if (str1.length() > 0 && str2.length() > 0) { - str1.append("\r\n\r\n"); - } - str1.append(str2); - } -}; diff --git a/core/java/android/bluetooth/AtParser.java b/core/java/android/bluetooth/AtParser.java deleted file mode 100644 index 328fb2bbd5964..0000000000000 --- a/core/java/android/bluetooth/AtParser.java +++ /dev/null @@ -1,367 +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. - */ - -package android.bluetooth; - -import java.util.*; - -/** - * An AT (Hayes command) Parser based on (a subset of) the ITU-T V.250 standard. - *

      - * - * Conformant with the subset of V.250 required for implementation of the - * Bluetooth Headset and Handsfree Profiles, as per Bluetooth SIP - * specifications. Also implements some V.250 features not required by - * Bluetooth - such as chained commands.

      - * - * Command handlers are registered with an AtParser object. These handlers are - * invoked when command lines are processed by AtParser's process() method.

      - * - * The AtParser object accepts a new command line to parse via its process() - * method. It breaks each command line into one or more commands. Each command - * is parsed for name, type, and (optional) arguments, and an appropriate - * external handler method is called through the AtCommandHandler interface. - * - * The command types are

        - *
      • Basic Command. For example "ATDT1234567890". Basic command names are a - * single character (e.g. "D"), and everything following this character is - * passed to the handler as a string argument (e.g. "T1234567890"). - *
      • Action Command. For example "AT+CIMI". The command name is "CIMI", and - * there are no arguments for action commands. - *
      • Read Command. For example "AT+VGM?". The command name is "VGM", and there - * are no arguments for get commands. - *
      • Set Command. For example "AT+VGM=14". The command name is "VGM", and - * there is a single integer argument in this case. In the general case then - * can be zero or more arguments (comma delimited) each of integer or string - * form. - *
      • Test Command. For example "AT+VGM=?. No arguments. - *
      - * - * In V.250 the last four command types are known as Extended Commands, and - * they are used heavily in Bluetooth.

      - * - * Basic commands cannot be chained in this implementation. For Bluetooth - * headset/handsfree use this is acceptable, because they only use the basic - * commands ATA and ATD, which are not allowed to be chained. For general V.250 - * use we would need to improve this class to allow Basic command chaining - - * however it's tricky to get right because there is no delimiter for Basic - * command chaining.

      - * - * Extended commands can be chained. For example:

      - * AT+VGM?;+VGM=14;+CIMI

      - * This is equivalent to:

      - * AT+VGM? - * AT+VGM=14 - * AT+CIMI - * Except that only one final result code is return (although several - * intermediate responses may be returned), and as soon as one command in the - * chain fails the rest are abandoned.

      - * - * Handlers are registered by there command name via register(Char c, ...) or - * register(String s, ...). Handlers for Basic command should be registered by - * the basic command character, and handlers for Extended commands should be - * registered by String.

      - * - * Refer to:

        - *
      • ITU-T Recommendation V.250 - *
      • ETSI TS 127.007 (AT Command set for User Equipment, 3GPP TS 27.007) - *
      • Bluetooth Headset Profile Spec (K6) - *
      • Bluetooth Handsfree Profile Spec (HFP 1.5) - *
      - * @hide - */ -public class AtParser { - - // Extended command type enumeration, only used internally - private static final int TYPE_ACTION = 0; // AT+FOO - private static final int TYPE_READ = 1; // AT+FOO? - private static final int TYPE_SET = 2; // AT+FOO= - private static final int TYPE_TEST = 3; // AT+FOO=? - - private HashMap mExtHandlers; - private HashMap mBasicHandlers; - - private String mLastInput; // for "A/" (repeat last command) support - - /** - * Create a new AtParser.

      - * No handlers are registered. - */ - public AtParser() { - mBasicHandlers = new HashMap(); - mExtHandlers = new HashMap(); - mLastInput = ""; - } - - /** - * Register a Basic command handler.

      - * Basic command handlers are later called via their - * handleBasicCommand(String args) method. - * @param command Command name - a single character - * @param handler Handler to register - */ - public void register(Character command, AtCommandHandler handler) { - mBasicHandlers.put(command, handler); - } - - /** - * Register an Extended command handler.

      - * Extended command handlers are later called via:

        - *
      • handleActionCommand() - *
      • handleGetCommand() - *
      • handleSetCommand() - *
      • handleTestCommand() - *
      - * Only one method will be called for each command processed. - * @param command Command name - can be multiple characters - * @param handler Handler to register - */ - public void register(String command, AtCommandHandler handler) { - mExtHandlers.put(command, handler); - } - - - /** - * Strip input of whitespace and force Uppercase - except sections inside - * quotes. Also fixes unmatched quotes (by appending a quote). Double - * quotes " are the only quotes allowed by V.250 - */ - static private String clean(String input) { - StringBuilder out = new StringBuilder(input.length()); - - for (int i = 0; i < input.length(); i++) { - char c = input.charAt(i); - if (c == '"') { - int j = input.indexOf('"', i + 1 ); // search for closing " - if (j == -1) { // unmatched ", insert one. - out.append(input.substring(i, input.length())); - out.append('"'); - break; - } - out.append(input.substring(i, j + 1)); - i = j; - } else if (c != ' ') { - out.append(Character.toUpperCase(c)); - } - } - - return out.toString(); - } - - static private boolean isAtoZ(char c) { - return (c >= 'A' && c <= 'Z'); - } - - /** - * Find a character ch, ignoring quoted sections. - * Return input.length() if not found. - */ - static private int findChar(char ch, String input, int fromIndex) { - for (int i = fromIndex; i < input.length(); i++) { - char c = input.charAt(i); - if (c == '"') { - i = input.indexOf('"', i + 1); - if (i == -1) { - return input.length(); - } - } else if (c == ch) { - return i; - } - } - return input.length(); - } - - /** - * Break an argument string into individual arguments (comma delimited). - * Integer arguments are turned into Integer objects. Otherwise a String - * object is used. - */ - static private Object[] generateArgs(String input) { - int i = 0; - int j; - ArrayList out = new ArrayList(); - while (i <= input.length()) { - j = findChar(',', input, i); - - String arg = input.substring(i, j); - try { - out.add(new Integer(arg)); - } catch (NumberFormatException e) { - out.add(arg); - } - - i = j + 1; // move past comma - } - return out.toArray(); - } - - /** - * Return the index of the end of character after the last character in - * the extended command name. Uses the V.250 spec for allowed command - * names. - */ - static private int findEndExtendedName(String input, int index) { - for (int i = index; i < input.length(); i++) { - char c = input.charAt(i); - - // V.250 defines the following chars as legal extended command - // names - if (isAtoZ(c)) continue; - if (c >= '0' && c <= '9') continue; - switch (c) { - case '!': - case '%': - case '-': - case '.': - case '/': - case ':': - case '_': - continue; - default: - return i; - } - } - return input.length(); - } - - /** - * Processes an incoming AT command line.

      - * This method will invoke zero or one command handler methods for each - * command in the command line.

      - * @param raw_input The AT input, without EOL delimiter (e.g. ). - * @return Result object for this command line. This can be - * converted to a String[] response with toStrings(). - */ - public AtCommandResult process(String raw_input) { - String input = clean(raw_input); - - // Handle "A/" (repeat previous line) - if (input.regionMatches(0, "A/", 0, 2)) { - input = new String(mLastInput); - } else { - mLastInput = new String(input); - } - - // Handle empty line - no response necessary - if (input.equals("")) { - // Return [] - return new AtCommandResult(AtCommandResult.UNSOLICITED); - } - - // Anything else deserves an error - if (!input.regionMatches(0, "AT", 0, 2)) { - // Return ["ERROR"] - return new AtCommandResult(AtCommandResult.ERROR); - } - - // Ok we have a command that starts with AT. Process it - int index = 2; - AtCommandResult result = - new AtCommandResult(AtCommandResult.UNSOLICITED); - while (index < input.length()) { - char c = input.charAt(index); - - if (isAtoZ(c)) { - // Option 1: Basic Command - // Pass the rest of the line as is to the handler. Do not - // look for any more commands on this line. - String args = input.substring(index + 1); - if (mBasicHandlers.containsKey((Character)c)) { - result.addResult(mBasicHandlers.get( - (Character)c).handleBasicCommand(args)); - return result; - } else { - // no handler - result.addResult( - new AtCommandResult(AtCommandResult.ERROR)); - return result; - } - // control never reaches here - } - - if (c == '+') { - // Option 2: Extended Command - // Search for first non-name character. Short-circuit if - // we don't handle this command name. - int i = findEndExtendedName(input, index + 1); - String commandName = input.substring(index, i); - if (!mExtHandlers.containsKey(commandName)) { - // no handler - result.addResult( - new AtCommandResult(AtCommandResult.ERROR)); - return result; - } - AtCommandHandler handler = mExtHandlers.get(commandName); - - // Search for end of this command - this is usually the end of - // line - int endIndex = findChar(';', input, index); - - // Determine what type of command this is. - // Default to TYPE_ACTION if we can't find anything else - // obvious. - int type; - - if (i >= endIndex) { - type = TYPE_ACTION; - } else if (input.charAt(i) == '?') { - type = TYPE_READ; - } else if (input.charAt(i) == '=') { - if (i + 1 < endIndex) { - if (input.charAt(i + 1) == '?') { - type = TYPE_TEST; - } else { - type = TYPE_SET; - } - } else { - type = TYPE_SET; - } - } else { - type = TYPE_ACTION; - } - - // Call this command. Short-circuit as soon as a command fails - switch (type) { - case TYPE_ACTION: - result.addResult(handler.handleActionCommand()); - break; - case TYPE_READ: - result.addResult(handler.handleReadCommand()); - break; - case TYPE_TEST: - result.addResult(handler.handleTestCommand()); - break; - case TYPE_SET: - Object[] args = - generateArgs(input.substring(i + 1, endIndex)); - result.addResult(handler.handleSetCommand(args)); - break; - } - if (result.getResultCode() != AtCommandResult.OK) { - return result; // short-circuit - } - - index = endIndex; - } else { - // Can't tell if this is a basic or extended command. - // Push forwards and hope we hit something. - index++; - } - } - // Finished processing (and all results were ok) - return result; - } -} diff --git a/core/java/android/bluetooth/BluetoothA2dp.java b/core/java/android/bluetooth/BluetoothA2dp.java old mode 100644 new mode 100755 index 7300107dd511d..6fdf3b47b85f8 --- a/core/java/android/bluetooth/BluetoothA2dp.java +++ b/core/java/android/bluetooth/BluetoothA2dp.java @@ -18,12 +18,13 @@ import android.annotation.SdkConstant; import android.annotation.SdkConstant.SdkConstantType; +import android.content.ComponentName; import android.content.Context; +import android.content.Intent; +import android.content.ServiceConnection; import android.os.IBinder; import android.os.ParcelUuid; import android.os.RemoteException; -import android.os.ServiceManager; -import android.server.BluetoothA2dpService; import android.util.Log; import java.util.ArrayList; @@ -43,7 +44,8 @@ */ public final class BluetoothA2dp implements BluetoothProfile { private static final String TAG = "BluetoothA2dp"; - private static final boolean DBG = false; + private static final boolean DBG = true; + private static final boolean VDBG = false; /** * Intent used to broadcast the change in connection state of the A2DP @@ -102,37 +104,90 @@ public final class BluetoothA2dp implements BluetoothProfile { */ public static final int STATE_NOT_PLAYING = 11; + private Context mContext; private ServiceListener mServiceListener; private IBluetoothA2dp mService; private BluetoothAdapter mAdapter; + final private IBluetoothStateChangeCallback mBluetoothStateChangeCallback = + new IBluetoothStateChangeCallback.Stub() { + public void onBluetoothStateChange(boolean up) { + if (DBG) Log.d(TAG, "onBluetoothStateChange: up=" + up); + if (!up) { + if (VDBG) Log.d(TAG,"Unbinding service..."); + synchronized (mConnection) { + try { + mService = null; + mContext.unbindService(mConnection); + } catch (Exception re) { + Log.e(TAG,"",re); + } + } + } else { + synchronized (mConnection) { + try { + if (mService == null) { + if (VDBG) Log.d(TAG,"Binding service..."); + if (!mContext.bindService(new Intent(IBluetoothA2dp.class.getName()), mConnection, 0)) { + Log.e(TAG, "Could not bind to Bluetooth A2DP Service"); + } + } + } catch (Exception re) { + Log.e(TAG,"",re); + } + } + } + } + }; /** * Create a BluetoothA2dp proxy object for interacting with the local * Bluetooth A2DP service. * */ - /*package*/ BluetoothA2dp(Context mContext, ServiceListener l) { - IBinder b = ServiceManager.getService(BluetoothA2dpService.BLUETOOTH_A2DP_SERVICE); + /*package*/ BluetoothA2dp(Context context, ServiceListener l) { + mContext = context; mServiceListener = l; mAdapter = BluetoothAdapter.getDefaultAdapter(); - if (b != null) { - mService = IBluetoothA2dp.Stub.asInterface(b); - if (mServiceListener != null) { - mServiceListener.onServiceConnected(BluetoothProfile.A2DP, this); + IBluetoothManager mgr = mAdapter.getBluetoothManager(); + if (mgr != null) { + try { + mgr.registerStateChangeCallback(mBluetoothStateChangeCallback); + } catch (RemoteException e) { + Log.e(TAG,"",e); } - } else { - Log.w(TAG, "Bluetooth A2DP service not available!"); + } - // Instead of throwing an exception which prevents people from going - // into Wireless settings in the emulator. Let it crash later when it is actually used. - mService = null; + if (!context.bindService(new Intent(IBluetoothA2dp.class.getName()), mConnection, 0)) { + Log.e(TAG, "Could not bind to Bluetooth A2DP Service"); } } /*package*/ void close() { mServiceListener = null; + IBluetoothManager mgr = mAdapter.getBluetoothManager(); + if (mgr != null) { + try { + mgr.unregisterStateChangeCallback(mBluetoothStateChangeCallback); + } catch (Exception e) { + Log.e(TAG,"",e); + } + } + + synchronized (mConnection) { + if (mService != null) { + try { + mService = null; + mContext.unbindService(mConnection); + } catch (Exception re) { + Log.e(TAG,"",re); + } + } + } } + public void finalize() { + close(); + } /** * Initiate connection to a profile of the remote bluetooth device. * @@ -215,7 +270,7 @@ public boolean disconnect(BluetoothDevice device) { * {@inheritDoc} */ public List getConnectedDevices() { - if (DBG) log("getConnectedDevices()"); + if (VDBG) log("getConnectedDevices()"); if (mService != null && isEnabled()) { try { return mService.getConnectedDevices(); @@ -232,7 +287,7 @@ public List getConnectedDevices() { * {@inheritDoc} */ public List getDevicesMatchingConnectionStates(int[] states) { - if (DBG) log("getDevicesMatchingStates()"); + if (VDBG) log("getDevicesMatchingStates()"); if (mService != null && isEnabled()) { try { return mService.getDevicesMatchingConnectionStates(states); @@ -249,7 +304,7 @@ public List getDevicesMatchingConnectionStates(int[] states) { * {@inheritDoc} */ public int getConnectionState(BluetoothDevice device) { - if (DBG) log("getState(" + device + ")"); + if (VDBG) log("getState(" + device + ")"); if (mService != null && isEnabled() && isValidDevice(device)) { try { @@ -267,7 +322,7 @@ && isValidDevice(device)) { * Set priority of the profile * *

      The device should already be paired. - * Priority can be one of {@link #PRIORITY_ON} or + * Priority can be one of {@link #PRIORITY_ON} orgetBluetoothManager * {@link #PRIORITY_OFF}, * *

      Requires {@link android.Manifest.permission#BLUETOOTH_ADMIN} @@ -283,7 +338,7 @@ public boolean setPriority(BluetoothDevice device, int priority) { if (mService != null && isEnabled() && isValidDevice(device)) { if (priority != BluetoothProfile.PRIORITY_OFF && - priority != BluetoothProfile.PRIORITY_ON) { + priority != BluetoothProfile.PRIORITY_ON){ return false; } try { @@ -311,7 +366,7 @@ && isValidDevice(device)) { * @hide */ public int getPriority(BluetoothDevice device) { - if (DBG) log("getPriority(" + device + ")"); + if (VDBG) log("getPriority(" + device + ")"); if (mService != null && isEnabled() && isValidDevice(device)) { try { @@ -346,67 +401,6 @@ && isValidDevice(device)) { return false; } - /** - * Initiate suspend from an A2DP sink. - * - *

      This API will return false in scenarios like the A2DP - * device is not in connected state etc. When this API returns, - * true, it is guaranteed that {@link #ACTION_CONNECTION_STATE_CHANGED} - * intent will be broadcasted with the state. Users can get the - * state of the A2DP device from this intent. - * - *

      Requires {@link android.Manifest.permission#BLUETOOTH_ADMIN} - * permission. - * - * @param device Remote A2DP sink - * @return false on immediate error, - * true otherwise - * @hide - */ - public boolean suspendSink(BluetoothDevice device) { - if (mService != null && isEnabled() - && isValidDevice(device)) { - try { - return mService.suspendSink(device); - } catch (RemoteException e) { - Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); - return false; - } - } - if (mService == null) Log.w(TAG, "Proxy not attached to service"); - return false; - } - - /** - * Initiate resume from a suspended A2DP sink. - * - *

      This API will return false in scenarios like the A2DP - * device is not in suspended state etc. When this API returns, - * true, it is guaranteed that {@link #ACTION_SINK_STATE_CHANGED} - * intent will be broadcasted with the state. Users can get the - * state of the A2DP device from this intent. - * - *

      Requires {@link android.Manifest.permission#BLUETOOTH_ADMIN} - * - * @param device Remote A2DP sink - * @return false on immediate error, - * true otherwise - * @hide - */ - public boolean resumeSink(BluetoothDevice device) { - if (mService != null && isEnabled() - && isValidDevice(device)) { - try { - return mService.resumeSink(device); - } catch (RemoteException e) { - Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); - return false; - } - } - if (mService == null) Log.w(TAG, "Proxy not attached to service"); - return false; - } - /** * This function checks if the remote device is an AVCRP * target and thus whether we should send volume keys @@ -427,23 +421,6 @@ public boolean shouldSendVolumeKeys(BluetoothDevice device) { return false; } - /** - * Allow or disallow incoming connection - * @param device Sink - * @param value True / False - * @return Success or Failure of the binder call. - * @hide - */ - public boolean allowIncomingConnect(BluetoothDevice device, boolean value) { - if (DBG) log("allowIncomingConnect(" + device + ":" + value + ")"); - try { - return mService.allowIncomingConnect(device, value); - } catch (RemoteException e) { - Log.e(TAG, "", e); - return false; - } - } - /** * Helper for converting a state to a string. * @@ -469,6 +446,24 @@ public static String stateToString(int state) { } } + private ServiceConnection mConnection = new ServiceConnection() { + public void onServiceConnected(ComponentName className, IBinder service) { + if (DBG) Log.d(TAG, "Proxy object connected"); + mService = IBluetoothA2dp.Stub.asInterface(service); + + if (mServiceListener != null) { + mServiceListener.onServiceConnected(BluetoothProfile.A2DP, BluetoothA2dp.this); + } + } + public void onServiceDisconnected(ComponentName className) { + if (DBG) Log.d(TAG, "Proxy object disconnected"); + mService = null; + if (mServiceListener != null) { + mServiceListener.onServiceDisconnected(BluetoothProfile.A2DP); + } + } + }; + private boolean isEnabled() { if (mAdapter.getState() == BluetoothAdapter.STATE_ON) return true; return false; diff --git a/core/java/android/bluetooth/BluetoothAdapter.java b/core/java/android/bluetooth/BluetoothAdapter.java old mode 100644 new mode 100755 index 8e3df472a3fec..f817fb48d2c7e --- a/core/java/android/bluetooth/BluetoothAdapter.java +++ b/core/java/android/bluetooth/BluetoothAdapter.java @@ -31,6 +31,7 @@ import android.util.Pair; import java.io.IOException; +import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashSet; @@ -73,7 +74,8 @@ */ public final class BluetoothAdapter { private static final String TAG = "BluetoothAdapter"; - private static final boolean DBG = false; + private static final boolean DBG = true; + private static final boolean VDBG = false; /** * Sentinel error value for this class. Guaranteed to not equal any other @@ -343,7 +345,7 @@ public final class BluetoothAdapter { public static final int STATE_DISCONNECTING = 3; /** @hide */ - public static final String BLUETOOTH_SERVICE = "bluetooth"; + public static final String BLUETOOTH_MANAGER_SERVICE = "bluetooth_manager"; private static final int ADDRESS_LENGTH = 17; @@ -353,7 +355,8 @@ public final class BluetoothAdapter { */ private static BluetoothAdapter sAdapter; - private final IBluetooth mService; + private final IBluetoothManager mManagerService; + private IBluetooth mService; private Handler mServiceRecordHandler; @@ -367,10 +370,12 @@ public final class BluetoothAdapter { */ public static synchronized BluetoothAdapter getDefaultAdapter() { if (sAdapter == null) { - IBinder b = ServiceManager.getService(BluetoothAdapter.BLUETOOTH_SERVICE); + IBinder b = ServiceManager.getService(BLUETOOTH_MANAGER_SERVICE); if (b != null) { - IBluetooth service = IBluetooth.Stub.asInterface(b); - sAdapter = new BluetoothAdapter(service); + IBluetoothManager managerService = IBluetoothManager.Stub.asInterface(b); + sAdapter = new BluetoothAdapter(managerService); + } else { + Log.e(TAG, "Bluetooth binder is null"); } } return sAdapter; @@ -378,13 +383,16 @@ public static synchronized BluetoothAdapter getDefaultAdapter() { /** * Use {@link #getDefaultAdapter} to get the BluetoothAdapter instance. - * @hide */ - public BluetoothAdapter(IBluetooth service) { - if (service == null) { - throw new IllegalArgumentException("service is null"); + BluetoothAdapter(IBluetoothManager managerService) { + + if (managerService == null) { + throw new IllegalArgumentException("bluetooth manager service is null"); } - mService = service; + try { + mService = managerService.registerAdapter(mManagerCallback); + } catch (RemoteException e) {Log.e(TAG, "", e);} + mManagerService = managerService; mServiceRecordHandler = null; } @@ -432,8 +440,11 @@ public BluetoothDevice getRemoteDevice(byte[] address) { * @return true if the local adapter is turned on */ public boolean isEnabled() { + try { - return mService.isEnabled(); + synchronized(mManagerCallback) { + if (mService != null) return mService.isEnabled(); + } } catch (RemoteException e) {Log.e(TAG, "", e);} return false; } @@ -451,8 +462,18 @@ public boolean isEnabled() { */ public int getState() { try { - return mService.getBluetoothState(); + synchronized(mManagerCallback) { + if (mService != null) + { + int state= mService.getState(); + if (VDBG) Log.d(TAG, "" + hashCode() + ": getState(). Returning " + state); + return state; + } + // TODO(BT) there might be a small gap during STATE_TURNING_ON that + // mService is null, handle that case + } } catch (RemoteException e) {Log.e(TAG, "", e);} + if (DBG) Log.d(TAG, "" + hashCode() + ": getState() : mService = null. Returning STATE_OFF"); return STATE_OFF; } @@ -484,8 +505,12 @@ public int getState() { * immediate error */ public boolean enable() { + if (isEnabled() == true){ + if (DBG) Log.d(TAG, "enable(): BT is already enabled..!"); + return true; + } try { - return mService.enable(); + return mManagerService.enable(); } catch (RemoteException e) {Log.e(TAG, "", e);} return false; } @@ -516,7 +541,25 @@ public boolean enable() { */ public boolean disable() { try { - return mService.disable(true); + return mManagerService.disable(true); + } catch (RemoteException e) {Log.e(TAG, "", e);} + return false; + } + + /** + * Turn off the local Bluetooth adapter and don't persist the setting. + * + *

      Requires the {@link android.Manifest.permission#BLUETOOTH_ADMIN} + * permission + * + * @return true to indicate adapter shutdown has begun, or false on + * immediate error + * @hide + */ + public boolean disable(boolean persist) { + + try { + return mManagerService.disable(persist); } catch (RemoteException e) {Log.e(TAG, "", e);} return false; } @@ -530,7 +573,7 @@ public boolean disable() { */ public String getAddress() { try { - return mService.getAddress(); + return mManagerService.getAddress(); } catch (RemoteException e) {Log.e(TAG, "", e);} return null; } @@ -544,7 +587,7 @@ public String getAddress() { */ public String getName() { try { - return mService.getName(); + return mManagerService.getName(); } catch (RemoteException e) {Log.e(TAG, "", e);} return null; } @@ -560,7 +603,9 @@ public String getName() { public ParcelUuid[] getUuids() { if (getState() != STATE_ON) return null; try { - return mService.getUuids(); + synchronized(mManagerCallback) { + if (mService != null) return mService.getUuids(); + } } catch (RemoteException e) {Log.e(TAG, "", e);} return null; } @@ -583,7 +628,9 @@ public ParcelUuid[] getUuids() { public boolean setName(String name) { if (getState() != STATE_ON) return false; try { - return mService.setName(name); + synchronized(mManagerCallback) { + if (mService != null) return mService.setName(name); + } } catch (RemoteException e) {Log.e(TAG, "", e);} return false; } @@ -607,7 +654,9 @@ public boolean setName(String name) { public int getScanMode() { if (getState() != STATE_ON) return SCAN_MODE_NONE; try { - return mService.getScanMode(); + synchronized(mManagerCallback) { + if (mService != null) return mService.getScanMode(); + } } catch (RemoteException e) {Log.e(TAG, "", e);} return SCAN_MODE_NONE; } @@ -643,7 +692,9 @@ public int getScanMode() { public boolean setScanMode(int mode, int duration) { if (getState() != STATE_ON) return false; try { - return mService.setScanMode(mode, duration); + synchronized(mManagerCallback) { + if (mService != null) return mService.setScanMode(mode, duration); + } } catch (RemoteException e) {Log.e(TAG, "", e);} return false; } @@ -651,14 +702,17 @@ public boolean setScanMode(int mode, int duration) { /** @hide */ public boolean setScanMode(int mode) { if (getState() != STATE_ON) return false; - return setScanMode(mode, 120); + /* getDiscoverableTimeout() to use the latest from NV than use 0 */ + return setScanMode(mode, getDiscoverableTimeout()); } /** @hide */ public int getDiscoverableTimeout() { if (getState() != STATE_ON) return -1; try { - return mService.getDiscoverableTimeout(); + synchronized(mManagerCallback) { + if (mService != null) return mService.getDiscoverableTimeout(); + } } catch (RemoteException e) {Log.e(TAG, "", e);} return -1; } @@ -667,7 +721,9 @@ public int getDiscoverableTimeout() { public void setDiscoverableTimeout(int timeout) { if (getState() != STATE_ON) return; try { - mService.setDiscoverableTimeout(timeout); + synchronized(mManagerCallback) { + if (mService != null) mService.setDiscoverableTimeout(timeout); + } } catch (RemoteException e) {Log.e(TAG, "", e);} } @@ -704,7 +760,9 @@ public void setDiscoverableTimeout(int timeout) { public boolean startDiscovery() { if (getState() != STATE_ON) return false; try { - return mService.startDiscovery(); + synchronized(mManagerCallback) { + if (mService != null) return mService.startDiscovery(); + } } catch (RemoteException e) {Log.e(TAG, "", e);} return false; } @@ -729,7 +787,9 @@ public boolean startDiscovery() { public boolean cancelDiscovery() { if (getState() != STATE_ON) return false; try { - return mService.cancelDiscovery(); + synchronized(mManagerCallback) { + if (mService != null) return mService.cancelDiscovery(); + } } catch (RemoteException e) {Log.e(TAG, "", e);} return false; } @@ -756,7 +816,9 @@ public boolean cancelDiscovery() { public boolean isDiscovering() { if (getState() != STATE_ON) return false; try { - return mService.isDiscovering(); + synchronized(mManagerCallback) { + if (mService != null ) return mService.isDiscovering(); + } } catch (RemoteException e) {Log.e(TAG, "", e);} return false; } @@ -774,10 +836,13 @@ public boolean isDiscovering() { */ public Set getBondedDevices() { if (getState() != STATE_ON) { - return toDeviceSet(new String[0]); + return toDeviceSet(new BluetoothDevice[0]); } try { - return toDeviceSet(mService.listBonds()); + synchronized(mManagerCallback) { + if (mService != null) return toDeviceSet(mService.getBondedDevices()); + } + return toDeviceSet(new BluetoothDevice[0]); } catch (RemoteException e) {Log.e(TAG, "", e);} return null; } @@ -798,7 +863,9 @@ public Set getBondedDevices() { public int getConnectionState() { if (getState() != STATE_ON) return BluetoothAdapter.STATE_DISCONNECTED; try { - return mService.getAdapterConnectionState(); + synchronized(mManagerCallback) { + if (mService != null) return mService.getAdapterConnectionState(); + } } catch (RemoteException e) {Log.e(TAG, "getConnectionState:", e);} return BluetoothAdapter.STATE_DISCONNECTED; } @@ -821,58 +888,15 @@ public int getConnectionState() { public int getProfileConnectionState(int profile) { if (getState() != STATE_ON) return BluetoothProfile.STATE_DISCONNECTED; try { - return mService.getProfileConnectionState(profile); + synchronized(mManagerCallback) { + if (mService != null) return mService.getProfileConnectionState(profile); + } } catch (RemoteException e) { Log.e(TAG, "getProfileConnectionState:", e); } return BluetoothProfile.STATE_DISCONNECTED; } - /** - /** - * Picks RFCOMM channels until none are left. - * Avoids reserved channels. - */ - private static class RfcommChannelPicker { - private static final int[] RESERVED_RFCOMM_CHANNELS = new int[] { - 10, // HFAG - 11, // HSAG - 12, // OPUSH - 19, // PBAP - }; - private static LinkedList sChannels; // master list of non-reserved channels - private static Random sRandom; - - private final LinkedList mChannels; // local list of channels left to try - - private final UUID mUuid; - - public RfcommChannelPicker(UUID uuid) { - synchronized (RfcommChannelPicker.class) { - if (sChannels == null) { - // lazy initialization of non-reserved rfcomm channels - sChannels = new LinkedList(); - for (int i = 1; i <= BluetoothSocket.MAX_RFCOMM_CHANNEL; i++) { - sChannels.addLast(new Integer(i)); - } - for (int reserved : RESERVED_RFCOMM_CHANNELS) { - sChannels.remove(new Integer(reserved)); - } - sRandom = new Random(); - } - mChannels = (LinkedList)sChannels.clone(); - } - mUuid = uuid; - } - /* Returns next random channel, or -1 if we're out */ - public int nextChannel() { - if (mChannels.size() == 0) { - return -1; - } - return mChannels.remove(sRandom.nextInt(mChannels.size())); - } - } - /** * Create a listening, secure RFCOMM Bluetooth socket. *

      A remote device connecting to this socket will be authenticated and @@ -892,10 +916,10 @@ public BluetoothServerSocket listenUsingRfcommOn(int channel) throws IOException BluetoothSocket.TYPE_RFCOMM, true, true, channel); int errno = socket.mSocket.bindListen(); if (errno != 0) { - try { - socket.close(); - } catch (IOException e) {} - socket.mSocket.throwErrnoNative(errno); + //TODO(BT): Throw the same exception error code + // that the previous code was using. + //socket.mSocket.throwErrnoNative(errno); + throw new IOException("Error: " + errno); } return socket; } @@ -996,70 +1020,23 @@ public BluetoothServerSocket listenUsingEncryptedRfcommWithServiceRecord( return createNewRfcommSocketAndRecord(name, uuid, false, true); } + private BluetoothServerSocket createNewRfcommSocketAndRecord(String name, UUID uuid, boolean auth, boolean encrypt) throws IOException { - RfcommChannelPicker picker = new RfcommChannelPicker(uuid); - BluetoothServerSocket socket; - int channel; - int errno; - while (true) { - channel = picker.nextChannel(); - - if (channel == -1) { - throw new IOException("No available channels"); - } - - socket = new BluetoothServerSocket( - BluetoothSocket.TYPE_RFCOMM, auth, encrypt, channel); - errno = socket.mSocket.bindListen(); - if (errno == 0) { - if (DBG) Log.d(TAG, "listening on RFCOMM channel " + channel); - break; // success - } else if (errno == BluetoothSocket.EADDRINUSE) { - if (DBG) Log.d(TAG, "RFCOMM channel " + channel + " in use"); - try { - socket.close(); - } catch (IOException e) {} - continue; // try another channel - } else { - try { - socket.close(); - } catch (IOException e) {} - socket.mSocket.throwErrnoNative(errno); // Exception as a result of bindListen() - } - } - - int handle = -1; - try { - handle = mService.addRfcommServiceRecord(name, new ParcelUuid(uuid), channel, - new Binder()); - } catch (RemoteException e) {Log.e(TAG, "", e);} - if (handle == -1) { - try { - socket.close(); - } catch (IOException e) {} - throw new IOException("Not able to register SDP record for " + name); - } - - if (mServiceRecordHandler == null) { - mServiceRecordHandler = new Handler(Looper.getMainLooper()) { - public void handleMessage(Message msg) { - /* handle socket closing */ - int handle = msg.what; - try { - if (DBG) Log.d(TAG, "Removing service record " + - Integer.toHexString(handle)); - mService.removeServiceRecord(handle); - } catch (RemoteException e) {Log.e(TAG, "", e);} - } - }; + socket = new BluetoothServerSocket(BluetoothSocket.TYPE_RFCOMM, auth, + encrypt, new ParcelUuid(uuid)); + socket.setServiceName(name); + int errno = socket.mSocket.bindListen(); + if (errno != 0) { + //TODO(BT): Throw the same exception error code + // that the previous code was using. + //socket.mSocket.throwErrnoNative(errno); + throw new IOException("Error: " + errno); } - socket.setCloseHandler(mServiceRecordHandler, handle); return socket; } - /** * Construct an unencrypted, unauthenticated, RFCOMM server socket. * Call #accept to retrieve connections to this socket. @@ -1073,10 +1050,10 @@ public BluetoothServerSocket listenUsingInsecureRfcommOn(int port) throws IOExce BluetoothSocket.TYPE_RFCOMM, false, false, port); int errno = socket.mSocket.bindListen(); if (errno != 0) { - try { - socket.close(); - } catch (IOException e) {} - socket.mSocket.throwErrnoNative(errno); + //TODO(BT): Throw the same exception error code + // that the previous code was using. + //socket.mSocket.throwErrnoNative(errno); + throw new IOException("Error: " + errno); } return socket; } @@ -1094,11 +1071,11 @@ public BluetoothServerSocket listenUsingEncryptedRfcommOn(int port) BluetoothServerSocket socket = new BluetoothServerSocket( BluetoothSocket.TYPE_RFCOMM, false, true, port); int errno = socket.mSocket.bindListen(); - if (errno != 0) { - try { - socket.close(); - } catch (IOException e) {} - socket.mSocket.throwErrnoNative(errno); + if (errno < 0) { + //TODO(BT): Throw the same exception error code + // that the previous code was using. + //socket.mSocket.throwErrnoNative(errno); + throw new IOException("Error: " + errno); } return socket; } @@ -1115,11 +1092,10 @@ public static BluetoothServerSocket listenUsingScoOn() throws IOException { BluetoothServerSocket socket = new BluetoothServerSocket( BluetoothSocket.TYPE_SCO, false, false, -1); int errno = socket.mSocket.bindListen(); - if (errno != 0) { - try { - socket.close(); - } catch (IOException e) {} - socket.mSocket.throwErrnoNative(errno); + if (errno < 0) { + //TODO(BT): Throw the same exception error code + // that the previous code was using. + //socket.mSocket.throwErrnoNative(errno); } return socket; } @@ -1134,6 +1110,8 @@ public static BluetoothServerSocket listenUsingScoOn() throws IOException { */ public Pair readOutOfBandData() { if (getState() != STATE_ON) return null; + //TODO(BT + /* try { byte[] hash; byte[] randomizer; @@ -1151,7 +1129,7 @@ public Pair readOutOfBandData() { } return new Pair(hash, randomizer); - } catch (RemoteException e) {Log.e(TAG, "", e);} + } catch (RemoteException e) {Log.e(TAG, "", e);}*/ return null; } @@ -1231,14 +1209,53 @@ public void closeProfileProxy(int profile, BluetoothProfile proxy) { } } + final private IBluetoothManagerCallback mManagerCallback = + new IBluetoothManagerCallback.Stub() { + public void onBluetoothServiceUp(IBluetooth bluetoothService) { + if (DBG) Log.d(TAG, "onBluetoothServiceUp: " + bluetoothService); + synchronized (mManagerCallback) { + mService = bluetoothService; + for (IBluetoothManagerCallback cb : mProxyServiceStateCallbacks ){ + try { + if (cb != null) { + cb.onBluetoothServiceUp(bluetoothService); + } else { + Log.d(TAG, "onBluetoothServiceUp: cb is null!!!"); + } + } catch (Exception e) { Log.e(TAG,"",e);} + } + } + } + + public void onBluetoothServiceDown() { + if (DBG) Log.d(TAG, "onBluetoothServiceDown: " + mService); + synchronized (mManagerCallback) { + mService = null; + for (IBluetoothManagerCallback cb : mProxyServiceStateCallbacks ){ + try { + if (cb != null) { + cb.onBluetoothServiceDown(); + } else { + Log.d(TAG, "onBluetoothServiceDown: cb is null!!!"); + } + } catch (Exception e) { Log.e(TAG,"",e);} + } + } + } + }; + /** * Enable the Bluetooth Adapter, but don't auto-connect devices * and don't persist state. Only for use by system applications. * @hide */ public boolean enableNoAutoConnect() { + if (isEnabled() == true){ + if (DBG) Log.d(TAG, "enableNoAutoConnect(): BT is already enabled..!"); + return true; + } try { - return mService.enableNoAutoConnect(); + return mManagerService.enableNoAutoConnect(); } catch (RemoteException e) {Log.e(TAG, "", e);} return false; } @@ -1276,12 +1293,14 @@ public boolean changeApplicationBluetoothState(boolean on, BluetoothStateChangeCallback callback) { if (callback == null) return false; + //TODO(BT) + /* try { return mService.changeApplicationBluetoothState(on, new StateChangeCallbackWrapper(callback), new Binder()); } catch (RemoteException e) { Log.e(TAG, "changeBluetoothState", e); - } + }*/ return false; } @@ -1309,14 +1328,22 @@ public void onBluetoothStateChange(boolean on) { } } - private Set toDeviceSet(String[] addresses) { - Set devices = new HashSet(addresses.length); - for (int i = 0; i < addresses.length; i++) { - devices.add(getRemoteDevice(addresses[i])); + private Set toDeviceSet(BluetoothDevice[] devices) { + Set deviceSet = new HashSet(Arrays.asList(devices)); + return Collections.unmodifiableSet(deviceSet); + } + + protected void finalize() throws Throwable { + try { + mManagerService.unregisterAdapter(mManagerCallback); + } catch (RemoteException e) { + Log.e(TAG, "", e); + } finally { + super.finalize(); } - return Collections.unmodifiableSet(devices); } + /** * Validate a String Bluetooth address, such as "00:43:A8:23:10:F0" *

      Alphabetic characters must be uppercase to be valid. @@ -1347,4 +1374,27 @@ public static boolean checkBluetoothAddress(String address) { } return true; } + + /*package*/ IBluetoothManager getBluetoothManager() { + return mManagerService; + } + + private ArrayList mProxyServiceStateCallbacks = new ArrayList(); + + /*package*/ IBluetooth getBluetoothService(IBluetoothManagerCallback cb) { + synchronized (mManagerCallback) { + if (cb == null) { + Log.w(TAG, "getBluetoothService() called with no BluetoothManagerCallback"); + } else if (!mProxyServiceStateCallbacks.contains(cb)) { + mProxyServiceStateCallbacks.add(cb); + } + } + return mService; + } + + /*package*/ void removeServiceStateCallback(IBluetoothManagerCallback cb) { + synchronized (mManagerCallback) { + mProxyServiceStateCallbacks.remove(cb); + } + } } diff --git a/core/java/android/bluetooth/BluetoothAudioGateway.java b/core/java/android/bluetooth/BluetoothAudioGateway.java deleted file mode 100644 index 9351393728599..0000000000000 --- a/core/java/android/bluetooth/BluetoothAudioGateway.java +++ /dev/null @@ -1,202 +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. - */ - -package android.bluetooth; - -import java.lang.Thread; - -import android.os.Message; -import android.os.Handler; -import android.util.Log; - -/** - * Listens for incoming RFCOMM connection for the headset / handsfree service. - * - * TODO: Use the new generic BluetoothSocket class instead of this legacy code - * - * @hide - */ -public final class BluetoothAudioGateway { - private static final String TAG = "BT Audio Gateway"; - private static final boolean DBG = false; - - private int mNativeData; - static { classInitNative(); } - - /* in */ - private int mHandsfreeAgRfcommChannel = -1; - private int mHeadsetAgRfcommChannel = -1; - - /* out - written by native code */ - private String mConnectingHeadsetAddress; - private int mConnectingHeadsetRfcommChannel; /* -1 when not connected */ - private int mConnectingHeadsetSocketFd; - private String mConnectingHandsfreeAddress; - private int mConnectingHandsfreeRfcommChannel; /* -1 when not connected */ - private int mConnectingHandsfreeSocketFd; - private int mTimeoutRemainingMs; /* in/out */ - - private final BluetoothAdapter mAdapter; - - public static final int DEFAULT_HF_AG_CHANNEL = 10; - public static final int DEFAULT_HS_AG_CHANNEL = 11; - - public BluetoothAudioGateway(BluetoothAdapter adapter) { - this(adapter, DEFAULT_HF_AG_CHANNEL, DEFAULT_HS_AG_CHANNEL); - } - - public BluetoothAudioGateway(BluetoothAdapter adapter, int handsfreeAgRfcommChannel, - int headsetAgRfcommChannel) { - mAdapter = adapter; - mHandsfreeAgRfcommChannel = handsfreeAgRfcommChannel; - mHeadsetAgRfcommChannel = headsetAgRfcommChannel; - initializeNativeDataNative(); - } - - private Thread mConnectThead; - private volatile boolean mInterrupted; - private static final int SELECT_WAIT_TIMEOUT = 1000; - - private Handler mCallback; - - public class IncomingConnectionInfo { - public BluetoothAdapter mAdapter; - public BluetoothDevice mRemoteDevice; - public int mSocketFd; - public int mRfcommChan; - IncomingConnectionInfo(BluetoothAdapter adapter, BluetoothDevice remoteDevice, - int socketFd, int rfcommChan) { - mAdapter = adapter; - mRemoteDevice = remoteDevice; - mSocketFd = socketFd; - mRfcommChan = rfcommChan; - } - } - - public static final int MSG_INCOMING_HEADSET_CONNECTION = 100; - public static final int MSG_INCOMING_HANDSFREE_CONNECTION = 101; - - public synchronized boolean start(Handler callback) { - - if (mConnectThead == null) { - mCallback = callback; - mConnectThead = new Thread(TAG) { - public void run() { - if (DBG) log("Connect Thread starting"); - while (!mInterrupted) { - //Log.i(TAG, "waiting for connect"); - mConnectingHeadsetRfcommChannel = -1; - mConnectingHandsfreeRfcommChannel = -1; - if (waitForHandsfreeConnectNative(SELECT_WAIT_TIMEOUT) == false) { - if (mTimeoutRemainingMs > 0) { - try { - Log.i(TAG, "select thread timed out, but " + - mTimeoutRemainingMs + "ms of waiting remain."); - Thread.sleep(mTimeoutRemainingMs); - } catch (InterruptedException e) { - Log.i(TAG, "select thread was interrupted (2), exiting"); - mInterrupted = true; - } - } - } - else { - Log.i(TAG, "connect notification!"); - /* A device connected (most likely just one, but - it is possible for two separate devices, one - a headset and one a handsfree, to connect - simultaneously. - */ - if (mConnectingHeadsetRfcommChannel >= 0) { - Log.i(TAG, "Incoming connection from headset " + - mConnectingHeadsetAddress + " on channel " + - mConnectingHeadsetRfcommChannel); - Message msg = Message.obtain(mCallback); - msg.what = MSG_INCOMING_HEADSET_CONNECTION; - msg.obj = new IncomingConnectionInfo( - mAdapter, - mAdapter.getRemoteDevice(mConnectingHeadsetAddress), - mConnectingHeadsetSocketFd, - mConnectingHeadsetRfcommChannel); - msg.sendToTarget(); - } - if (mConnectingHandsfreeRfcommChannel >= 0) { - Log.i(TAG, "Incoming connection from handsfree " + - mConnectingHandsfreeAddress + " on channel " + - mConnectingHandsfreeRfcommChannel); - Message msg = Message.obtain(); - msg.setTarget(mCallback); - msg.what = MSG_INCOMING_HANDSFREE_CONNECTION; - msg.obj = new IncomingConnectionInfo( - mAdapter, - mAdapter.getRemoteDevice(mConnectingHandsfreeAddress), - mConnectingHandsfreeSocketFd, - mConnectingHandsfreeRfcommChannel); - msg.sendToTarget(); - } - } - } - if (DBG) log("Connect Thread finished"); - } - }; - - if (setUpListeningSocketsNative() == false) { - Log.e(TAG, "Could not set up listening socket, exiting"); - return false; - } - - mInterrupted = false; - mConnectThead.start(); - } - - return true; - } - - public synchronized void stop() { - if (mConnectThead != null) { - if (DBG) log("stopping Connect Thread"); - mInterrupted = true; - try { - mConnectThead.interrupt(); - if (DBG) log("waiting for thread to terminate"); - mConnectThead.join(); - mConnectThead = null; - mCallback = null; - tearDownListeningSocketsNative(); - } catch (InterruptedException e) { - Log.w(TAG, "Interrupted waiting for Connect Thread to join"); - } - } - } - - protected void finalize() throws Throwable { - try { - cleanupNativeDataNative(); - } finally { - super.finalize(); - } - } - - private static native void classInitNative(); - private native void initializeNativeDataNative(); - private native void cleanupNativeDataNative(); - private native boolean waitForHandsfreeConnectNative(int timeoutMs); - private native boolean setUpListeningSocketsNative(); - private native void tearDownListeningSocketsNative(); - - private static void log(String msg) { - Log.d(TAG, msg); - } -} diff --git a/core/java/android/bluetooth/BluetoothDevice.java b/core/java/android/bluetooth/BluetoothDevice.java old mode 100644 new mode 100755 index 56e17354cca2e..4cc22b4ae909b --- a/core/java/android/bluetooth/BluetoothDevice.java +++ b/core/java/android/bluetooth/BluetoothDevice.java @@ -65,6 +65,7 @@ */ public final class BluetoothDevice implements Parcelable { private static final String TAG = "BluetoothDevice"; + private static final boolean DBG = false; /** * Sentinel error value for this class. Guaranteed to not equal any other @@ -483,16 +484,29 @@ public final class BluetoothDevice implements Parcelable { /*package*/ static IBluetooth getService() { synchronized (BluetoothDevice.class) { if (sService == null) { - IBinder b = ServiceManager.getService(BluetoothAdapter.BLUETOOTH_SERVICE); - if (b == null) { - throw new RuntimeException("Bluetooth service not available"); - } - sService = IBluetooth.Stub.asInterface(b); + BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter(); + sService = adapter.getBluetoothService(mStateChangeCallback); } } return sService; } + static IBluetoothManagerCallback mStateChangeCallback = new IBluetoothManagerCallback.Stub() { + + public void onBluetoothServiceUp(IBluetooth bluetoothService) + throws RemoteException { + synchronized (BluetoothDevice.class) { + sService = bluetoothService; + } + } + + public void onBluetoothServiceDown() + throws RemoteException { + synchronized (BluetoothDevice.class) { + sService = null; + } + } + }; /** * Create a new BluetoothDevice * Bluetooth MAC address must be upper case, such as "00:11:22:33:AA:BB", @@ -561,6 +575,7 @@ public void writeToParcel(Parcel out, int flags) { * @return Bluetooth hardware address as string */ public String getAddress() { + if (DBG) Log.d(TAG, "mAddress: " + mAddress); return mAddress; } @@ -575,8 +590,12 @@ public String getAddress() { * @return the Bluetooth name, or null if there was a problem. */ public String getName() { + if (sService == null) { + Log.e(TAG, "BT not enabled. Cannot get Remote Device name"); + return null; + } try { - return sService.getRemoteName(mAddress); + return sService.getRemoteName(this); } catch (RemoteException e) {Log.e(TAG, "", e);} return null; } @@ -589,8 +608,12 @@ public String getName() { * @hide */ public String getAlias() { + if (sService == null) { + Log.e(TAG, "BT not enabled. Cannot get Remote Device Alias"); + return null; + } try { - return sService.getRemoteAlias(mAddress); + return sService.getRemoteAlias(this); } catch (RemoteException e) {Log.e(TAG, "", e);} return null; } @@ -606,8 +629,12 @@ public String getAlias() { * @hide */ public boolean setAlias(String alias) { + if (sService == null) { + Log.e(TAG, "BT not enabled. Cannot set Remote Device name"); + return false; + } try { - return sService.setRemoteAlias(mAddress, alias); + return sService.setRemoteAlias(this, alias); } catch (RemoteException e) {Log.e(TAG, "", e);} return false; } @@ -642,8 +669,12 @@ public String getAliasName() { * @hide */ public boolean createBond() { + if (sService == null) { + Log.e(TAG, "BT not enabled. Cannot create bond to Remote Device"); + return false; + } try { - return sService.createBond(mAddress); + return sService.createBond(this); } catch (RemoteException e) {Log.e(TAG, "", e);} return false; } @@ -668,9 +699,11 @@ public boolean createBond() { * @hide */ public boolean createBondOutOfBand(byte[] hash, byte[] randomizer) { + //TODO(BT) + /* try { - return sService.createBondOutOfBand(mAddress, hash, randomizer); - } catch (RemoteException e) {Log.e(TAG, "", e);} + return sService.createBondOutOfBand(this, hash, randomizer); + } catch (RemoteException e) {Log.e(TAG, "", e);}*/ return false; } @@ -688,9 +721,11 @@ public boolean createBondOutOfBand(byte[] hash, byte[] randomizer) { * @hide */ public boolean setDeviceOutOfBandData(byte[] hash, byte[] randomizer) { + //TODO(BT) + /* try { - return sService.setDeviceOutOfBandData(mAddress, hash, randomizer); - } catch (RemoteException e) {Log.e(TAG, "", e);} + return sService.setDeviceOutOfBandData(this, hash, randomizer); + } catch (RemoteException e) {Log.e(TAG, "", e);} */ return false; } @@ -702,8 +737,12 @@ public boolean setDeviceOutOfBandData(byte[] hash, byte[] randomizer) { * @hide */ public boolean cancelBondProcess() { + if (sService == null) { + Log.e(TAG, "BT not enabled. Cannot cancel Remote Device bond"); + return false; + } try { - return sService.cancelBondProcess(mAddress); + return sService.cancelBondProcess(this); } catch (RemoteException e) {Log.e(TAG, "", e);} return false; } @@ -719,8 +758,12 @@ public boolean cancelBondProcess() { * @hide */ public boolean removeBond() { + if (sService == null) { + Log.e(TAG, "BT not enabled. Cannot remove Remote Device bond"); + return false; + } try { - return sService.removeBond(mAddress); + return sService.removeBond(this); } catch (RemoteException e) {Log.e(TAG, "", e);} return false; } @@ -736,9 +779,19 @@ public boolean removeBond() { * @return the bond state */ public int getBondState() { + if (sService == null) { + Log.e(TAG, "BT not enabled. Cannot get bond state"); + return BOND_NONE; + } try { - return sService.getBondState(mAddress); + 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; } @@ -749,8 +802,12 @@ public int getBondState() { * @return Bluetooth class object, or null on error */ public BluetoothClass getBluetoothClass() { + if (sService == null) { + Log.e(TAG, "BT not enabled. Cannot get Bluetooth Class"); + return null; + } try { - int classInt = sService.getRemoteClass(mAddress); + int classInt = sService.getRemoteClass(this); if (classInt == BluetoothClass.ERROR) return null; return new BluetoothClass(classInt); } catch (RemoteException e) {Log.e(TAG, "", e);} @@ -763,11 +820,13 @@ public BluetoothClass getBluetoothClass() { * @hide */ public boolean getTrustState() { + //TODO(BT) + /* try { - return sService.getTrustState(mAddress); + return sService.getTrustState(this); } catch (RemoteException e) { Log.e(TAG, "", e); - } + }*/ return false; } @@ -778,11 +837,13 @@ public boolean getTrustState() { * @hide */ public boolean setTrust(boolean value) { + //TODO(BT) + /* try { - return sService.setTrust(mAddress, value); + return sService.setTrust(this, value); } catch (RemoteException e) { Log.e(TAG, "", e); - } + }*/ return false; } @@ -799,8 +860,12 @@ public boolean setTrust(boolean value) { * or null on error */ public ParcelUuid[] getUuids() { + if (sService == null) { + Log.e(TAG, "BT not enabled. Cannot get remote device Uuids"); + return null; + } try { - return sService.getRemoteUuids(mAddress); + return sService.getRemoteUuids(this); } catch (RemoteException e) {Log.e(TAG, "", e);} return null; } @@ -822,64 +887,84 @@ public ParcelUuid[] getUuids() { */ public boolean fetchUuidsWithSdp() { try { - return sService.fetchRemoteUuids(mAddress, null, null); + return sService.fetchRemoteUuids(this); } catch (RemoteException e) {Log.e(TAG, "", e);} - return false; + return false; } /** @hide */ public int getServiceChannel(ParcelUuid uuid) { + //TODO(BT) + /* try { - return sService.getRemoteServiceChannel(mAddress, uuid); - } catch (RemoteException e) {Log.e(TAG, "", e);} + return sService.getRemoteServiceChannel(this, uuid); + } catch (RemoteException e) {Log.e(TAG, "", e);}*/ return BluetoothDevice.ERROR; } /** @hide */ public boolean setPin(byte[] pin) { + if (sService == null) { + Log.e(TAG, "BT not enabled. Cannot set Remote Device pin"); + return false; + } try { - return sService.setPin(mAddress, pin); + return sService.setPin(this, true, pin.length, pin); } catch (RemoteException e) {Log.e(TAG, "", e);} return false; } /** @hide */ public boolean setPasskey(int passkey) { + //TODO(BT) + /* try { - return sService.setPasskey(mAddress, passkey); - } catch (RemoteException e) {Log.e(TAG, "", e);} + return sService.setPasskey(this, true, 4, passkey); + } catch (RemoteException e) {Log.e(TAG, "", e);}*/ return false; } /** @hide */ public boolean setPairingConfirmation(boolean confirm) { + if (sService == null) { + Log.e(TAG, "BT not enabled. Cannot set pairing confirmation"); + return false; + } try { - return sService.setPairingConfirmation(mAddress, confirm); + return sService.setPairingConfirmation(this, confirm); } catch (RemoteException e) {Log.e(TAG, "", e);} return false; } /** @hide */ public boolean setRemoteOutOfBandData() { + // TODO(BT) + /* try { - return sService.setRemoteOutOfBandData(mAddress); - } catch (RemoteException e) {Log.e(TAG, "", e);} + return sService.setRemoteOutOfBandData(this); + } catch (RemoteException e) {Log.e(TAG, "", e);}*/ return false; } /** @hide */ public boolean cancelPairingUserInput() { + if (sService == null) { + Log.e(TAG, "BT not enabled. Cannot create pairing user input"); + return false; + } try { - return sService.cancelPairingUserInput(mAddress); + return sService.cancelBondProcess(this); } catch (RemoteException e) {Log.e(TAG, "", e);} return false; } /** @hide */ public boolean isBluetoothDock() { + // TODO(BT) + /* try { - return sService.isBluetoothDock(mAddress); - } catch (RemoteException e) {Log.e(TAG, "", e);} + return sService.isBluetoothDock(this); + } catch (RemoteException e) {Log.e(TAG, "", e);}*/ return false; } diff --git a/core/java/android/bluetooth/BluetoothDeviceProfileState.java b/core/java/android/bluetooth/BluetoothDeviceProfileState.java deleted file mode 100644 index c9603bf3ed552..0000000000000 --- a/core/java/android/bluetooth/BluetoothDeviceProfileState.java +++ /dev/null @@ -1,1349 +0,0 @@ -/* - * Copyright (C) 2010 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.bluetooth; - -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; -import android.content.IntentFilter; -import android.os.Message; -import android.bluetooth.BluetoothAdapter; -import android.os.PowerManager; -import android.server.BluetoothA2dpService; -import android.server.BluetoothService; -import android.util.Log; -import android.util.Pair; - -import com.android.internal.util.State; -import com.android.internal.util.StateMachine; - -import java.util.Set; - -/** - * This class is the Profile connection state machine associated with a remote - * device. When the device bonds an instance of this class is created. - * This tracks incoming and outgoing connections of all the profiles. Incoming - * connections are preferred over outgoing connections and HFP preferred over - * A2DP. When the device is unbonded, the instance is removed. - * - * States: - * {@link BondedDevice}: This state represents a bonded device. When in this - * state none of the profiles are in transition states. - * - * {@link OutgoingHandsfree}: Handsfree profile connection is in a transition - * state because of a outgoing Connect or Disconnect. - * - * {@link IncomingHandsfree}: Handsfree profile connection is in a transition - * state because of a incoming Connect or Disconnect. - * - * {@link IncomingA2dp}: A2dp profile connection is in a transition - * state because of a incoming Connect or Disconnect. - * - * {@link OutgoingA2dp}: A2dp profile connection is in a transition - * state because of a outgoing Connect or Disconnect. - * - * Todo(): Write tests for this class, when the Android Mock support is completed. - * @hide - */ -public final class BluetoothDeviceProfileState extends StateMachine { - private static final String TAG = "BluetoothDeviceProfileState"; - private static final boolean DBG = false; - - // TODO(): Restructure the state machine to make it scalable with regard to profiles. - public static final int CONNECT_HFP_OUTGOING = 1; - public static final int CONNECT_HFP_INCOMING = 2; - public static final int CONNECT_A2DP_OUTGOING = 3; - public static final int CONNECT_A2DP_INCOMING = 4; - public static final int CONNECT_HID_OUTGOING = 5; - public static final int CONNECT_HID_INCOMING = 6; - - public static final int DISCONNECT_HFP_OUTGOING = 50; - private static final int DISCONNECT_HFP_INCOMING = 51; - public static final int DISCONNECT_A2DP_OUTGOING = 52; - public static final int DISCONNECT_A2DP_INCOMING = 53; - public static final int DISCONNECT_HID_OUTGOING = 54; - public static final int DISCONNECT_HID_INCOMING = 55; - public static final int DISCONNECT_PBAP_OUTGOING = 56; - - public static final int UNPAIR = 100; - public static final int AUTO_CONNECT_PROFILES = 101; - public static final int TRANSITION_TO_STABLE = 102; - public static final int CONNECT_OTHER_PROFILES = 103; - private static final int CONNECTION_ACCESS_REQUEST_REPLY = 104; - private static final int CONNECTION_ACCESS_REQUEST_EXPIRY = 105; - - public static final int CONNECT_OTHER_PROFILES_DELAY = 4000; // 4 secs - private static final int CONNECTION_ACCESS_REQUEST_EXPIRY_TIMEOUT = 7000; // 7 secs - private static final int CONNECTION_ACCESS_UNDEFINED = -1; - private static final long INIT_INCOMING_REJECT_TIMER = 1000; // 1 sec - private static final long MAX_INCOMING_REJECT_TIMER = 3600 * 1000 * 4; // 4 hours - - private static final String ACCESS_AUTHORITY_PACKAGE = "com.android.settings"; - private static final String ACCESS_AUTHORITY_CLASS = - "com.android.settings.bluetooth.BluetoothPermissionRequest"; - - private BondedDevice mBondedDevice = new BondedDevice(); - private OutgoingHandsfree mOutgoingHandsfree = new OutgoingHandsfree(); - private IncomingHandsfree mIncomingHandsfree = new IncomingHandsfree(); - private IncomingA2dp mIncomingA2dp = new IncomingA2dp(); - private OutgoingA2dp mOutgoingA2dp = new OutgoingA2dp(); - private OutgoingHid mOutgoingHid = new OutgoingHid(); - private IncomingHid mIncomingHid = new IncomingHid(); - - private Context mContext; - private BluetoothService mService; - private BluetoothA2dpService mA2dpService; - private BluetoothHeadset mHeadsetService; - private BluetoothPbap mPbapService; - private PbapServiceListener mPbap; - private BluetoothAdapter mAdapter; - private boolean mPbapServiceConnected; - private boolean mAutoConnectionPending; - private static final String BLUETOOTH_ADMIN_PERM = android.Manifest.permission.BLUETOOTH_ADMIN; - - private BluetoothDevice mDevice; - private int mHeadsetState = BluetoothProfile.STATE_DISCONNECTED; - private int mA2dpState = BluetoothProfile.STATE_DISCONNECTED; - private long mIncomingRejectTimer; - private boolean mConnectionAccessReplyReceived = false; - private Pair mIncomingConnections; - private PowerManager.WakeLock mWakeLock; - private PowerManager mPowerManager; - private boolean mPairingRequestRcvd = false; - - private BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() { - @Override - public void onReceive(Context context, Intent intent) { - String action = intent.getAction(); - BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE); - if (device == null || !device.equals(mDevice)) return; - - if (action.equals(BluetoothA2dp.ACTION_CONNECTION_STATE_CHANGED)) { - int newState = intent.getIntExtra(BluetoothProfile.EXTRA_STATE, 0); - int oldState = intent.getIntExtra(BluetoothProfile.EXTRA_PREVIOUS_STATE, 0); - // We trust this device now - if (newState == BluetoothHeadset.STATE_CONNECTED) { - setTrust(BluetoothDevice.CONNECTION_ACCESS_YES); - } - mA2dpState = newState; - if (oldState == BluetoothA2dp.STATE_CONNECTED && - newState == BluetoothA2dp.STATE_DISCONNECTED) { - sendMessage(DISCONNECT_A2DP_INCOMING); - } - if (newState == BluetoothProfile.STATE_CONNECTED || - newState == BluetoothProfile.STATE_DISCONNECTED) { - sendMessage(TRANSITION_TO_STABLE); - } - } else if (action.equals(BluetoothHeadset.ACTION_CONNECTION_STATE_CHANGED)) { - int newState = intent.getIntExtra(BluetoothProfile.EXTRA_STATE, 0); - int oldState = intent.getIntExtra(BluetoothProfile.EXTRA_PREVIOUS_STATE, 0); - // We trust this device now - if (newState == BluetoothHeadset.STATE_CONNECTED) { - setTrust(BluetoothDevice.CONNECTION_ACCESS_YES); - } - mHeadsetState = newState; - if (oldState == BluetoothHeadset.STATE_CONNECTED && - newState == BluetoothHeadset.STATE_DISCONNECTED) { - sendMessage(DISCONNECT_HFP_INCOMING); - } - if (newState == BluetoothProfile.STATE_CONNECTED || - newState == BluetoothProfile.STATE_DISCONNECTED) { - sendMessage(TRANSITION_TO_STABLE); - } - } else if (action.equals(BluetoothInputDevice.ACTION_CONNECTION_STATE_CHANGED)) { - int newState = intent.getIntExtra(BluetoothProfile.EXTRA_STATE, 0); - int oldState = - intent.getIntExtra(BluetoothProfile.EXTRA_PREVIOUS_STATE, 0); - // We trust this device now - if (newState == BluetoothHeadset.STATE_CONNECTED) { - setTrust(BluetoothDevice.CONNECTION_ACCESS_YES); - } - if (oldState == BluetoothProfile.STATE_CONNECTED && - newState == BluetoothProfile.STATE_DISCONNECTED) { - sendMessage(DISCONNECT_HID_INCOMING); - } - if (newState == BluetoothProfile.STATE_CONNECTED || - newState == BluetoothProfile.STATE_DISCONNECTED) { - sendMessage(TRANSITION_TO_STABLE); - } - } else if (action.equals(BluetoothDevice.ACTION_ACL_DISCONNECTED)) { - // This is technically not needed, but we can get stuck sometimes. - // For example, if incoming A2DP fails, we are not informed by Bluez - sendMessage(TRANSITION_TO_STABLE); - } else if (action.equals(BluetoothDevice.ACTION_CONNECTION_ACCESS_REPLY)) { - mWakeLock.release(); - int val = intent.getIntExtra(BluetoothDevice.EXTRA_CONNECTION_ACCESS_RESULT, - BluetoothDevice.CONNECTION_ACCESS_NO); - Message msg = obtainMessage(CONNECTION_ACCESS_REQUEST_REPLY); - msg.arg1 = val; - sendMessage(msg); - } else if (action.equals(BluetoothDevice.ACTION_PAIRING_REQUEST)) { - mPairingRequestRcvd = true; - } else if (action.equals(BluetoothDevice.ACTION_BOND_STATE_CHANGED)) { - int state = intent.getIntExtra(BluetoothDevice.EXTRA_BOND_STATE, - BluetoothDevice.ERROR); - if (state == BluetoothDevice.BOND_BONDED && mPairingRequestRcvd) { - setTrust(BluetoothDevice.CONNECTION_ACCESS_YES); - mPairingRequestRcvd = false; - } else if (state == BluetoothDevice.BOND_NONE) { - mPairingRequestRcvd = false; - } - } - } - }; - - private boolean isPhoneDocked(BluetoothDevice autoConnectDevice) { - // This works only because these broadcast intents are "sticky" - Intent i = mContext.registerReceiver(null, new IntentFilter(Intent.ACTION_DOCK_EVENT)); - if (i != null) { - int state = i.getIntExtra(Intent.EXTRA_DOCK_STATE, Intent.EXTRA_DOCK_STATE_UNDOCKED); - if (state != Intent.EXTRA_DOCK_STATE_UNDOCKED) { - BluetoothDevice device = i.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE); - if (device != null && autoConnectDevice.equals(device)) { - return true; - } - } - } - return false; - } - - public BluetoothDeviceProfileState(Context context, String address, - BluetoothService service, BluetoothA2dpService a2dpService, boolean setTrust) { - super(address); - mContext = context; - mDevice = new BluetoothDevice(address); - mService = service; - mA2dpService = a2dpService; - - addState(mBondedDevice); - addState(mOutgoingHandsfree); - addState(mIncomingHandsfree); - addState(mIncomingA2dp); - addState(mOutgoingA2dp); - addState(mOutgoingHid); - addState(mIncomingHid); - setInitialState(mBondedDevice); - - IntentFilter filter = new IntentFilter(); - // Fine-grained state broadcasts - filter.addAction(BluetoothDevice.ACTION_ACL_CONNECTED); - filter.addAction(BluetoothHeadset.ACTION_CONNECTION_STATE_CHANGED); - filter.addAction(BluetoothA2dp.ACTION_CONNECTION_STATE_CHANGED); - filter.addAction(BluetoothInputDevice.ACTION_CONNECTION_STATE_CHANGED); - filter.addAction(BluetoothDevice.ACTION_ACL_DISCONNECTED); - filter.addAction(BluetoothDevice.ACTION_CONNECTION_ACCESS_REPLY); - filter.addAction(BluetoothDevice.ACTION_PAIRING_REQUEST); - filter.addAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED); - - mContext.registerReceiver(mBroadcastReceiver, filter); - - mAdapter = BluetoothAdapter.getDefaultAdapter(); - mAdapter.getProfileProxy(mContext, mBluetoothProfileServiceListener, - BluetoothProfile.HEADSET); - // TODO(): Convert PBAP to the new Profile APIs. - mPbap = new PbapServiceListener(); - - mIncomingConnections = mService.getIncomingState(address); - mIncomingRejectTimer = readTimerValue(); - mPowerManager = (PowerManager)mContext.getSystemService(Context.POWER_SERVICE); - mWakeLock = mPowerManager.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK | - PowerManager.ACQUIRE_CAUSES_WAKEUP | - PowerManager.ON_AFTER_RELEASE, TAG); - mWakeLock.setReferenceCounted(false); - - if (setTrust) { - setTrust(BluetoothDevice.CONNECTION_ACCESS_YES); - } - } - - private BluetoothProfile.ServiceListener mBluetoothProfileServiceListener = - new BluetoothProfile.ServiceListener() { - public void onServiceConnected(int profile, BluetoothProfile proxy) { - synchronized(BluetoothDeviceProfileState.this) { - mHeadsetService = (BluetoothHeadset) proxy; - if (mAutoConnectionPending) { - sendMessage(AUTO_CONNECT_PROFILES); - mAutoConnectionPending = false; - } - } - } - public void onServiceDisconnected(int profile) { - synchronized(BluetoothDeviceProfileState.this) { - mHeadsetService = null; - } - } - }; - - private class PbapServiceListener implements BluetoothPbap.ServiceListener { - public PbapServiceListener() { - mPbapService = new BluetoothPbap(mContext, this); - } - public void onServiceConnected() { - synchronized(BluetoothDeviceProfileState.this) { - mPbapServiceConnected = true; - } - } - public void onServiceDisconnected() { - synchronized(BluetoothDeviceProfileState.this) { - mPbapServiceConnected = false; - } - } - } - - private class BondedDevice extends State { - @Override - public void enter() { - Log.i(TAG, "Entering ACL Connected state with: " + getCurrentMessage().what); - Message m = new Message(); - m.copyFrom(getCurrentMessage()); - sendMessageAtFrontOfQueue(m); - } - @Override - public boolean processMessage(Message message) { - log("ACL Connected State -> Processing Message: " + message.what); - switch(message.what) { - case CONNECT_HFP_OUTGOING: - case DISCONNECT_HFP_OUTGOING: - transitionTo(mOutgoingHandsfree); - break; - case CONNECT_HFP_INCOMING: - transitionTo(mIncomingHandsfree); - break; - case DISCONNECT_HFP_INCOMING: - transitionTo(mIncomingHandsfree); - break; - case CONNECT_A2DP_OUTGOING: - case DISCONNECT_A2DP_OUTGOING: - transitionTo(mOutgoingA2dp); - break; - case CONNECT_A2DP_INCOMING: - case DISCONNECT_A2DP_INCOMING: - transitionTo(mIncomingA2dp); - break; - case CONNECT_HID_OUTGOING: - case DISCONNECT_HID_OUTGOING: - transitionTo(mOutgoingHid); - break; - case CONNECT_HID_INCOMING: - case DISCONNECT_HID_INCOMING: - transitionTo(mIncomingHid); - break; - case DISCONNECT_PBAP_OUTGOING: - processCommand(DISCONNECT_PBAP_OUTGOING); - break; - case UNPAIR: - if (mHeadsetState != BluetoothHeadset.STATE_DISCONNECTED) { - sendMessage(DISCONNECT_HFP_OUTGOING); - deferMessage(message); - break; - } else if (mA2dpState != BluetoothA2dp.STATE_DISCONNECTED) { - sendMessage(DISCONNECT_A2DP_OUTGOING); - deferMessage(message); - break; - } else if (mService.getInputDeviceConnectionState(mDevice) != - BluetoothInputDevice.STATE_DISCONNECTED) { - sendMessage(DISCONNECT_HID_OUTGOING); - deferMessage(message); - break; - } - processCommand(UNPAIR); - break; - case AUTO_CONNECT_PROFILES: - if (isPhoneDocked(mDevice)) { - // Don't auto connect to docks. - break; - } else { - if (mHeadsetService == null) { - mAutoConnectionPending = true; - } else if (mHeadsetService.getPriority(mDevice) == - BluetoothHeadset.PRIORITY_AUTO_CONNECT && - mHeadsetService.getDevicesMatchingConnectionStates( - new int[] {BluetoothProfile.STATE_CONNECTED, - BluetoothProfile.STATE_CONNECTING, - BluetoothProfile.STATE_DISCONNECTING}).size() == 0) { - mHeadsetService.connect(mDevice); - } - if (mA2dpService != null && - mA2dpService.getPriority(mDevice) == - BluetoothA2dp.PRIORITY_AUTO_CONNECT && - mA2dpService.getDevicesMatchingConnectionStates( - new int[] {BluetoothA2dp.STATE_CONNECTED, - BluetoothProfile.STATE_CONNECTING, - BluetoothProfile.STATE_DISCONNECTING}).size() == 0) { - mA2dpService.connect(mDevice); - } - if (mService.getInputDevicePriority(mDevice) == - BluetoothInputDevice.PRIORITY_AUTO_CONNECT) { - mService.connectInputDevice(mDevice); - } - } - break; - case CONNECT_OTHER_PROFILES: - if (isPhoneDocked(mDevice)) { - break; - } - if (message.arg1 == CONNECT_A2DP_OUTGOING) { - if (mA2dpService != null && - mA2dpService.getConnectedDevices().size() == 0) { - Log.i(TAG, "A2dp:Connect Other Profiles"); - mA2dpService.connect(mDevice); - } - } else if (message.arg1 == CONNECT_HFP_OUTGOING) { - if (mHeadsetService == null) { - deferMessage(message); - } else { - if (mHeadsetService.getConnectedDevices().size() == 0) { - Log.i(TAG, "Headset:Connect Other Profiles"); - mHeadsetService.connect(mDevice); - } - } - } - break; - case TRANSITION_TO_STABLE: - // ignore. - break; - case SM_QUIT_CMD: - mContext.unregisterReceiver(mBroadcastReceiver); - mBroadcastReceiver = null; - mAdapter.closeProfileProxy(BluetoothProfile.HEADSET, mHeadsetService); - mBluetoothProfileServiceListener = null; - mOutgoingHandsfree = null; - mPbap = null; - mPbapService.close(); - mPbapService = null; - mIncomingHid = null; - mOutgoingHid = null; - mIncomingHandsfree = null; - mOutgoingHandsfree = null; - mIncomingA2dp = null; - mOutgoingA2dp = null; - mBondedDevice = null; - // There is a problem in the State Machine code - // where things are not cleaned up properly, when quit message - // is handled so return NOT_HANDLED as a workaround. - return NOT_HANDLED; - default: - return NOT_HANDLED; - } - return HANDLED; - } - } - - private class OutgoingHandsfree extends State { - private boolean mStatus = false; - private int mCommand; - - @Override - public void enter() { - Log.i(TAG, "Entering OutgoingHandsfree state with: " + getCurrentMessage().what); - mCommand = getCurrentMessage().what; - if (mCommand != CONNECT_HFP_OUTGOING && - mCommand != DISCONNECT_HFP_OUTGOING) { - Log.e(TAG, "Error: OutgoingHandsfree state with command:" + mCommand); - } - mStatus = processCommand(mCommand); - if (!mStatus) { - sendMessage(TRANSITION_TO_STABLE); - mService.sendProfileStateMessage(BluetoothProfileState.HFP, - BluetoothProfileState.TRANSITION_TO_STABLE); - } - } - - @Override - public boolean processMessage(Message message) { - log("OutgoingHandsfree State -> Processing Message: " + message.what); - Message deferMsg = new Message(); - int command = message.what; - switch(command) { - case CONNECT_HFP_OUTGOING: - if (command != mCommand) { - // Disconnect followed by a connect - defer - deferMessage(message); - } - break; - case CONNECT_HFP_INCOMING: - if (mCommand == CONNECT_HFP_OUTGOING) { - // Cancel outgoing connect, accept incoming - cancelCommand(CONNECT_HFP_OUTGOING); - transitionTo(mIncomingHandsfree); - } else { - // We have done the disconnect but we are not - // sure which state we are in at this point. - deferMessage(message); - } - break; - case CONNECT_A2DP_INCOMING: - // accept incoming A2DP, retry HFP_OUTGOING - transitionTo(mIncomingA2dp); - - if (mStatus) { - deferMsg.what = mCommand; - deferMessage(deferMsg); - } - break; - case CONNECT_A2DP_OUTGOING: - deferMessage(message); - break; - case DISCONNECT_HFP_OUTGOING: - if (mCommand == CONNECT_HFP_OUTGOING) { - // Cancel outgoing connect - cancelCommand(CONNECT_HFP_OUTGOING); - processCommand(DISCONNECT_HFP_OUTGOING); - } - // else ignore - break; - case DISCONNECT_HFP_INCOMING: - // When this happens the socket would be closed and the headset - // state moved to DISCONNECTED, cancel the outgoing thread. - // if it still is in CONNECTING state - cancelCommand(CONNECT_HFP_OUTGOING); - break; - case DISCONNECT_A2DP_OUTGOING: - deferMessage(message); - break; - case DISCONNECT_A2DP_INCOMING: - // Bluez will handle the disconnect. If because of this the outgoing - // handsfree connection has failed, then retry. - if (mStatus) { - deferMsg.what = mCommand; - deferMessage(deferMsg); - } - break; - case CONNECT_HID_OUTGOING: - case DISCONNECT_HID_OUTGOING: - deferMessage(message); - break; - case CONNECT_HID_INCOMING: - transitionTo(mIncomingHid); - if (mStatus) { - deferMsg.what = mCommand; - deferMessage(deferMsg); - } - break; - case DISCONNECT_HID_INCOMING: - if (mStatus) { - deferMsg.what = mCommand; - deferMessage(deferMsg); - } - break; // ignore - case DISCONNECT_PBAP_OUTGOING: - case UNPAIR: - case AUTO_CONNECT_PROFILES: - case CONNECT_OTHER_PROFILES: - deferMessage(message); - break; - case TRANSITION_TO_STABLE: - transitionTo(mBondedDevice); - break; - default: - return NOT_HANDLED; - } - return HANDLED; - } - } - - private class IncomingHandsfree extends State { - private boolean mStatus = false; - private int mCommand; - - @Override - public void enter() { - Log.i(TAG, "Entering IncomingHandsfree state with: " + getCurrentMessage().what); - mCommand = getCurrentMessage().what; - if (mCommand != CONNECT_HFP_INCOMING && - mCommand != DISCONNECT_HFP_INCOMING) { - Log.e(TAG, "Error: IncomingHandsfree state with command:" + mCommand); - } - mStatus = processCommand(mCommand); - if (!mStatus) { - sendMessage(TRANSITION_TO_STABLE); - mService.sendProfileStateMessage(BluetoothProfileState.HFP, - BluetoothProfileState.TRANSITION_TO_STABLE); - } - } - - @Override - public boolean processMessage(Message message) { - log("IncomingHandsfree State -> Processing Message: " + message.what); - switch(message.what) { - case CONNECT_HFP_OUTGOING: - deferMessage(message); - break; - case CONNECT_HFP_INCOMING: - // Ignore - Log.e(TAG, "Error: Incoming connection with a pending incoming connection"); - break; - case CONNECTION_ACCESS_REQUEST_REPLY: - int val = message.arg1; - mConnectionAccessReplyReceived = true; - boolean value = false; - if (val == BluetoothDevice.CONNECTION_ACCESS_YES) { - value = true; - } - setTrust(val); - - handleIncomingConnection(CONNECT_HFP_INCOMING, value); - break; - case CONNECTION_ACCESS_REQUEST_EXPIRY: - if (!mConnectionAccessReplyReceived) { - handleIncomingConnection(CONNECT_HFP_INCOMING, false); - sendConnectionAccessRemovalIntent(); - sendMessage(TRANSITION_TO_STABLE); - } - break; - case CONNECT_A2DP_INCOMING: - // Serialize the commands. - deferMessage(message); - break; - case CONNECT_A2DP_OUTGOING: - deferMessage(message); - break; - case DISCONNECT_HFP_OUTGOING: - // We don't know at what state we are in the incoming HFP connection state. - // We can be changing from DISCONNECTED to CONNECTING, or - // from CONNECTING to CONNECTED, so serializing this command is - // the safest option. - deferMessage(message); - break; - case DISCONNECT_HFP_INCOMING: - // Nothing to do here, we will already be DISCONNECTED - // by this point. - break; - case DISCONNECT_A2DP_OUTGOING: - deferMessage(message); - break; - case DISCONNECT_A2DP_INCOMING: - // Bluez handles incoming A2DP disconnect. - // If this causes incoming HFP to fail, it is more of a headset problem - // since both connections are incoming ones. - break; - case CONNECT_HID_OUTGOING: - case DISCONNECT_HID_OUTGOING: - deferMessage(message); - break; - case CONNECT_HID_INCOMING: - case DISCONNECT_HID_INCOMING: - break; // ignore - case DISCONNECT_PBAP_OUTGOING: - case UNPAIR: - case AUTO_CONNECT_PROFILES: - case CONNECT_OTHER_PROFILES: - deferMessage(message); - break; - case TRANSITION_TO_STABLE: - transitionTo(mBondedDevice); - break; - default: - return NOT_HANDLED; - } - return HANDLED; - } - } - - private class OutgoingA2dp extends State { - private boolean mStatus = false; - private int mCommand; - - @Override - public void enter() { - Log.i(TAG, "Entering OutgoingA2dp state with: " + getCurrentMessage().what); - mCommand = getCurrentMessage().what; - if (mCommand != CONNECT_A2DP_OUTGOING && - mCommand != DISCONNECT_A2DP_OUTGOING) { - Log.e(TAG, "Error: OutgoingA2DP state with command:" + mCommand); - } - mStatus = processCommand(mCommand); - if (!mStatus) { - sendMessage(TRANSITION_TO_STABLE); - mService.sendProfileStateMessage(BluetoothProfileState.A2DP, - BluetoothProfileState.TRANSITION_TO_STABLE); - } - } - - @Override - public boolean processMessage(Message message) { - log("OutgoingA2dp State->Processing Message: " + message.what); - Message deferMsg = new Message(); - switch(message.what) { - case CONNECT_HFP_OUTGOING: - processCommand(CONNECT_HFP_OUTGOING); - - // Don't cancel A2DP outgoing as there is no guarantee it - // will get canceled. - // It might already be connected but we might not have got the - // A2DP_SINK_STATE_CHANGE. Hence, no point disconnecting here. - // The worst case, the connection will fail, retry. - // The same applies to Disconnecting an A2DP connection. - if (mStatus) { - deferMsg.what = mCommand; - deferMessage(deferMsg); - } - break; - case CONNECT_HFP_INCOMING: - processCommand(CONNECT_HFP_INCOMING); - - // Don't cancel A2DP outgoing as there is no guarantee - // it will get canceled. - // The worst case, the connection will fail, retry. - if (mStatus) { - deferMsg.what = mCommand; - deferMessage(deferMsg); - } - break; - case CONNECT_A2DP_INCOMING: - // Bluez will take care of conflicts between incoming and outgoing - // connections. - transitionTo(mIncomingA2dp); - break; - case CONNECT_A2DP_OUTGOING: - // Ignore - break; - case DISCONNECT_HFP_OUTGOING: - deferMessage(message); - break; - case DISCONNECT_HFP_INCOMING: - // At this point, we are already disconnected - // with HFP. Sometimes A2DP connection can - // fail due to the disconnection of HFP. So add a retry - // for the A2DP. - if (mStatus) { - deferMsg.what = mCommand; - deferMessage(deferMsg); - } - break; - case DISCONNECT_A2DP_OUTGOING: - deferMessage(message); - break; - case DISCONNECT_A2DP_INCOMING: - // Ignore, will be handled by Bluez - break; - case CONNECT_HID_OUTGOING: - case DISCONNECT_HID_OUTGOING: - deferMessage(message); - break; - case CONNECT_HID_INCOMING: - transitionTo(mIncomingHid); - if (mStatus) { - deferMsg.what = mCommand; - deferMessage(deferMsg); - } - break; - case DISCONNECT_HID_INCOMING: - if (mStatus) { - deferMsg.what = mCommand; - deferMessage(deferMsg); - } - break; // ignore - case DISCONNECT_PBAP_OUTGOING: - case UNPAIR: - case AUTO_CONNECT_PROFILES: - case CONNECT_OTHER_PROFILES: - deferMessage(message); - break; - case TRANSITION_TO_STABLE: - transitionTo(mBondedDevice); - break; - default: - return NOT_HANDLED; - } - return HANDLED; - } - } - - private class IncomingA2dp extends State { - private boolean mStatus = false; - private int mCommand; - - @Override - public void enter() { - Log.i(TAG, "Entering IncomingA2dp state with: " + getCurrentMessage().what); - mCommand = getCurrentMessage().what; - if (mCommand != CONNECT_A2DP_INCOMING && - mCommand != DISCONNECT_A2DP_INCOMING) { - Log.e(TAG, "Error: IncomingA2DP state with command:" + mCommand); - } - mStatus = processCommand(mCommand); - if (!mStatus) { - sendMessage(TRANSITION_TO_STABLE); - mService.sendProfileStateMessage(BluetoothProfileState.A2DP, - BluetoothProfileState.TRANSITION_TO_STABLE); - } - } - - @Override - public boolean processMessage(Message message) { - log("IncomingA2dp State->Processing Message: " + message.what); - switch(message.what) { - case CONNECT_HFP_OUTGOING: - deferMessage(message); - break; - case CONNECT_HFP_INCOMING: - // Shouldn't happen, but serialize the commands. - deferMessage(message); - break; - case CONNECT_A2DP_INCOMING: - // ignore - break; - case CONNECTION_ACCESS_REQUEST_REPLY: - int val = message.arg1; - mConnectionAccessReplyReceived = true; - boolean value = false; - if (val == BluetoothDevice.CONNECTION_ACCESS_YES) { - value = true; - } - setTrust(val); - handleIncomingConnection(CONNECT_A2DP_INCOMING, value); - break; - case CONNECTION_ACCESS_REQUEST_EXPIRY: - // The check protects the race condition between REQUEST_REPLY - // and the timer expiry. - if (!mConnectionAccessReplyReceived) { - handleIncomingConnection(CONNECT_A2DP_INCOMING, false); - sendConnectionAccessRemovalIntent(); - sendMessage(TRANSITION_TO_STABLE); - } - break; - case CONNECT_A2DP_OUTGOING: - // Defer message and retry - deferMessage(message); - break; - case DISCONNECT_HFP_OUTGOING: - deferMessage(message); - break; - case DISCONNECT_HFP_INCOMING: - // Shouldn't happen but if does, we can handle it. - // Depends if the headset can handle it. - // Incoming A2DP will be handled by Bluez, Disconnect HFP - // the socket would have already been closed. - // ignore - break; - case DISCONNECT_A2DP_OUTGOING: - deferMessage(message); - break; - case DISCONNECT_A2DP_INCOMING: - // Ignore, will be handled by Bluez - break; - case CONNECT_HID_OUTGOING: - case DISCONNECT_HID_OUTGOING: - deferMessage(message); - break; - case CONNECT_HID_INCOMING: - case DISCONNECT_HID_INCOMING: - break; // ignore - case DISCONNECT_PBAP_OUTGOING: - case UNPAIR: - case AUTO_CONNECT_PROFILES: - case CONNECT_OTHER_PROFILES: - deferMessage(message); - break; - case TRANSITION_TO_STABLE: - transitionTo(mBondedDevice); - break; - default: - return NOT_HANDLED; - } - return HANDLED; - } - } - - - private class OutgoingHid extends State { - private boolean mStatus = false; - private int mCommand; - - @Override - public void enter() { - log("Entering OutgoingHid state with: " + getCurrentMessage().what); - mCommand = getCurrentMessage().what; - if (mCommand != CONNECT_HID_OUTGOING && - mCommand != DISCONNECT_HID_OUTGOING) { - Log.e(TAG, "Error: OutgoingHid state with command:" + mCommand); - } - mStatus = processCommand(mCommand); - if (!mStatus) sendMessage(TRANSITION_TO_STABLE); - } - - @Override - public boolean processMessage(Message message) { - log("OutgoingHid State->Processing Message: " + message.what); - Message deferMsg = new Message(); - switch(message.what) { - // defer all outgoing messages - case CONNECT_HFP_OUTGOING: - case CONNECT_A2DP_OUTGOING: - case CONNECT_HID_OUTGOING: - case DISCONNECT_HFP_OUTGOING: - case DISCONNECT_A2DP_OUTGOING: - case DISCONNECT_HID_OUTGOING: - deferMessage(message); - break; - - case CONNECT_HFP_INCOMING: - transitionTo(mIncomingHandsfree); - break; - case CONNECT_A2DP_INCOMING: - transitionTo(mIncomingA2dp); - - // Don't cancel HID outgoing as there is no guarantee it - // will get canceled. - // It might already be connected but we might not have got the - // INPUT_DEVICE_STATE_CHANGE. Hence, no point disconnecting here. - // The worst case, the connection will fail, retry. - if (mStatus) { - deferMsg.what = mCommand; - deferMessage(deferMsg); - } - break; - case CONNECT_HID_INCOMING: - // Bluez will take care of the conflicts - transitionTo(mIncomingHid); - break; - - case DISCONNECT_HFP_INCOMING: - case DISCONNECT_A2DP_INCOMING: - // At this point, we are already disconnected - // with HFP. Sometimes HID connection can - // fail due to the disconnection of HFP. So add a retry - // for the HID. - if (mStatus) { - deferMsg.what = mCommand; - deferMessage(deferMsg); - } - break; - case DISCONNECT_HID_INCOMING: - // Ignore, will be handled by Bluez - break; - case DISCONNECT_PBAP_OUTGOING: - case UNPAIR: - case AUTO_CONNECT_PROFILES: - deferMessage(message); - break; - case TRANSITION_TO_STABLE: - transitionTo(mBondedDevice); - break; - default: - return NOT_HANDLED; - } - return HANDLED; - } - } - - private class IncomingHid extends State { - private boolean mStatus = false; - private int mCommand; - - @Override - public void enter() { - log("Entering IncomingHid state with: " + getCurrentMessage().what); - mCommand = getCurrentMessage().what; - if (mCommand != CONNECT_HID_INCOMING && - mCommand != DISCONNECT_HID_INCOMING) { - Log.e(TAG, "Error: IncomingHid state with command:" + mCommand); - } - mStatus = processCommand(mCommand); - if (!mStatus) sendMessage(TRANSITION_TO_STABLE); - } - - @Override - public boolean processMessage(Message message) { - log("IncomingHid State->Processing Message: " + message.what); - Message deferMsg = new Message(); - switch(message.what) { - case CONNECT_HFP_OUTGOING: - case CONNECT_HFP_INCOMING: - case DISCONNECT_HFP_OUTGOING: - case CONNECT_A2DP_INCOMING: - case CONNECT_A2DP_OUTGOING: - case DISCONNECT_A2DP_OUTGOING: - case CONNECT_HID_OUTGOING: - case CONNECT_HID_INCOMING: - case DISCONNECT_HID_OUTGOING: - deferMessage(message); - break; - case CONNECTION_ACCESS_REQUEST_REPLY: - mConnectionAccessReplyReceived = true; - int val = message.arg1; - setTrust(val); - handleIncomingConnection(CONNECT_HID_INCOMING, - val == BluetoothDevice.CONNECTION_ACCESS_YES); - break; - case CONNECTION_ACCESS_REQUEST_EXPIRY: - if (!mConnectionAccessReplyReceived) { - handleIncomingConnection(CONNECT_HID_INCOMING, false); - sendConnectionAccessRemovalIntent(); - sendMessage(TRANSITION_TO_STABLE); - } - break; - case DISCONNECT_HFP_INCOMING: - // Shouldn't happen but if does, we can handle it. - // Depends if the headset can handle it. - // Incoming HID will be handled by Bluez, Disconnect HFP - // the socket would have already been closed. - // ignore - break; - case DISCONNECT_HID_INCOMING: - case DISCONNECT_A2DP_INCOMING: - // Ignore, will be handled by Bluez - break; - case DISCONNECT_PBAP_OUTGOING: - case UNPAIR: - case AUTO_CONNECT_PROFILES: - deferMessage(message); - break; - case TRANSITION_TO_STABLE: - transitionTo(mBondedDevice); - break; - default: - return NOT_HANDLED; - } - return HANDLED; - } - } - - - synchronized void cancelCommand(int command) { - if (command == CONNECT_HFP_OUTGOING ) { - // Cancel the outgoing thread. - if (mHeadsetService != null) { - mHeadsetService.cancelConnectThread(); - } - // HeadsetService is down. Phone process most likely crashed. - // The thread would have got killed. - } - } - - synchronized void deferProfileServiceMessage(int command) { - Message msg = new Message(); - msg.what = command; - deferMessage(msg); - } - - private void updateIncomingAllowedTimer() { - // Not doing a perfect exponential backoff because - // we want two different rates. For all practical - // purposes, this is good enough. - if (mIncomingRejectTimer == 0) mIncomingRejectTimer = INIT_INCOMING_REJECT_TIMER; - - mIncomingRejectTimer *= 5; - if (mIncomingRejectTimer > MAX_INCOMING_REJECT_TIMER) { - mIncomingRejectTimer = MAX_INCOMING_REJECT_TIMER; - } - writeTimerValue(mIncomingRejectTimer); - } - - private boolean handleIncomingConnection(int command, boolean accept) { - boolean ret = false; - Log.i(TAG, "handleIncomingConnection:" + command + ":" + accept); - switch (command) { - case CONNECT_HFP_INCOMING: - if (!accept) { - ret = mHeadsetService.rejectIncomingConnect(mDevice); - sendMessage(TRANSITION_TO_STABLE); - updateIncomingAllowedTimer(); - } else if (mHeadsetState == BluetoothHeadset.STATE_CONNECTING) { - writeTimerValue(0); - ret = mHeadsetService.acceptIncomingConnect(mDevice); - } else if (mHeadsetState == BluetoothHeadset.STATE_DISCONNECTED) { - writeTimerValue(0); - handleConnectionOfOtherProfiles(command); - ret = mHeadsetService.createIncomingConnect(mDevice); - } - break; - case CONNECT_A2DP_INCOMING: - if (!accept) { - ret = mA2dpService.allowIncomingConnect(mDevice, false); - sendMessage(TRANSITION_TO_STABLE); - updateIncomingAllowedTimer(); - } else { - writeTimerValue(0); - ret = mA2dpService.allowIncomingConnect(mDevice, true); - handleConnectionOfOtherProfiles(command); - } - break; - case CONNECT_HID_INCOMING: - if (!accept) { - ret = mService.allowIncomingProfileConnect(mDevice, false); - sendMessage(TRANSITION_TO_STABLE); - updateIncomingAllowedTimer(); - } else { - writeTimerValue(0); - ret = mService.allowIncomingProfileConnect(mDevice, true); - } - break; - default: - Log.e(TAG, "Waiting for incoming connection but state changed to:" + command); - break; - } - return ret; - } - - private void sendConnectionAccessIntent() { - mConnectionAccessReplyReceived = false; - - if (!mPowerManager.isScreenOn()) mWakeLock.acquire(); - - Intent intent = new Intent(BluetoothDevice.ACTION_CONNECTION_ACCESS_REQUEST); - intent.setClassName(ACCESS_AUTHORITY_PACKAGE, ACCESS_AUTHORITY_CLASS); - intent.putExtra(BluetoothDevice.EXTRA_ACCESS_REQUEST_TYPE, - BluetoothDevice.REQUEST_TYPE_PROFILE_CONNECTION); - intent.putExtra(BluetoothDevice.EXTRA_DEVICE, mDevice); - mContext.sendBroadcast(intent, BLUETOOTH_ADMIN_PERM); - } - - private void sendConnectionAccessRemovalIntent() { - mWakeLock.release(); - Intent intent = new Intent(BluetoothDevice.ACTION_CONNECTION_ACCESS_CANCEL); - intent.putExtra(BluetoothDevice.EXTRA_DEVICE, mDevice); - mContext.sendBroadcast(intent, BLUETOOTH_ADMIN_PERM); - } - - private int getTrust() { - String address = mDevice.getAddress(); - if (mIncomingConnections != null) return mIncomingConnections.first; - return CONNECTION_ACCESS_UNDEFINED; - } - - - private String getStringValue(long value) { - StringBuilder sbr = new StringBuilder(); - sbr.append(Long.toString(System.currentTimeMillis())); - sbr.append("-"); - sbr.append(Long.toString(value)); - return sbr.toString(); - } - - private void setTrust(int value) { - String second; - if (mIncomingConnections == null) { - second = getStringValue(INIT_INCOMING_REJECT_TIMER); - } else { - second = mIncomingConnections.second; - } - - mIncomingConnections = new Pair(value, second); - mService.writeIncomingConnectionState(mDevice.getAddress(), mIncomingConnections); - } - - private void writeTimerValue(long value) { - Integer first; - if (mIncomingConnections == null) { - first = CONNECTION_ACCESS_UNDEFINED; - } else { - first = mIncomingConnections.first; - } - mIncomingConnections = new Pair(first, getStringValue(value)); - mService.writeIncomingConnectionState(mDevice.getAddress(), mIncomingConnections); - } - - private long readTimerValue() { - if (mIncomingConnections == null) - return 0; - String value = mIncomingConnections.second; - String[] splits = value.split("-"); - if (splits != null && splits.length == 2) { - return Long.parseLong(splits[1]); - } - return 0; - } - - private boolean readIncomingAllowedValue() { - if (readTimerValue() == 0) return true; - String value = mIncomingConnections.second; - String[] splits = value.split("-"); - if (splits != null && splits.length == 2) { - long val1 = Long.parseLong(splits[0]); - long val2 = Long.parseLong(splits[1]); - if (val1 + val2 <= System.currentTimeMillis()) { - return true; - } - } - return false; - } - - synchronized boolean processCommand(int command) { - log("Processing command:" + command); - switch(command) { - case CONNECT_HFP_OUTGOING: - if (mHeadsetService == null) { - deferProfileServiceMessage(command); - } else { - return mHeadsetService.connectHeadsetInternal(mDevice); - } - break; - case CONNECT_HFP_INCOMING: - if (mHeadsetService == null) { - deferProfileServiceMessage(command); - } else { - processIncomingConnectCommand(command); - return true; - } - break; - case CONNECT_A2DP_OUTGOING: - if (mA2dpService != null) { - return mA2dpService.connectSinkInternal(mDevice); - } - break; - case CONNECT_A2DP_INCOMING: - processIncomingConnectCommand(command); - return true; - case CONNECT_HID_OUTGOING: - return mService.connectInputDeviceInternal(mDevice); - case CONNECT_HID_INCOMING: - processIncomingConnectCommand(command); - return true; - case DISCONNECT_HFP_OUTGOING: - if (mHeadsetService == null) { - deferProfileServiceMessage(command); - } else { - // Disconnect PBAP - // TODO(): Add PBAP to the state machine. - Message m = new Message(); - m.what = DISCONNECT_PBAP_OUTGOING; - deferMessage(m); - if (mHeadsetService.getPriority(mDevice) == - BluetoothHeadset.PRIORITY_AUTO_CONNECT) { - mHeadsetService.setPriority(mDevice, BluetoothHeadset.PRIORITY_ON); - } - return mHeadsetService.disconnectHeadsetInternal(mDevice); - } - break; - case DISCONNECT_HFP_INCOMING: - // ignore - return true; - case DISCONNECT_A2DP_INCOMING: - // ignore - return true; - case DISCONNECT_A2DP_OUTGOING: - if (mA2dpService != null) { - if (mA2dpService.getPriority(mDevice) == - BluetoothA2dp.PRIORITY_AUTO_CONNECT) { - mA2dpService.setPriority(mDevice, BluetoothHeadset.PRIORITY_ON); - } - return mA2dpService.disconnectSinkInternal(mDevice); - } - break; - case DISCONNECT_HID_INCOMING: - // ignore - return true; - case DISCONNECT_HID_OUTGOING: - if (mService.getInputDevicePriority(mDevice) == - BluetoothInputDevice.PRIORITY_AUTO_CONNECT) { - mService.setInputDevicePriority(mDevice, BluetoothInputDevice.PRIORITY_ON); - } - return mService.disconnectInputDeviceInternal(mDevice); - case DISCONNECT_PBAP_OUTGOING: - if (!mPbapServiceConnected) { - deferProfileServiceMessage(command); - } else { - return mPbapService.disconnect(); - } - break; - case UNPAIR: - writeTimerValue(INIT_INCOMING_REJECT_TIMER); - setTrust(CONNECTION_ACCESS_UNDEFINED); - return mService.removeBondInternal(mDevice.getAddress()); - default: - Log.e(TAG, "Error: Unknown Command"); - } - return false; - } - - private void processIncomingConnectCommand(int command) { - // Check if device is already trusted - int access = getTrust(); - if (access == BluetoothDevice.CONNECTION_ACCESS_YES) { - handleIncomingConnection(command, true); - } else if (access == BluetoothDevice.CONNECTION_ACCESS_NO && - !readIncomingAllowedValue()) { - handleIncomingConnection(command, false); - } else { - sendConnectionAccessIntent(); - Message msg = obtainMessage(CONNECTION_ACCESS_REQUEST_EXPIRY); - sendMessageDelayed(msg, - CONNECTION_ACCESS_REQUEST_EXPIRY_TIMEOUT); - } - } - - private void handleConnectionOfOtherProfiles(int command) { - // The white paper recommendations mentions that when there is a - // link loss, it is the responsibility of the remote device to connect. - // Many connect only 1 profile - and they connect the second profile on - // some user action (like play being pressed) and so we need this code. - // Auto Connect code only connects to the last connected device - which - // is useful in cases like when the phone reboots. But consider the - // following case: - // User is connected to the car's phone and A2DP profile. - // User comes to the desk and places the phone in the dock - // (or any speaker or music system or even another headset) and thus - // gets connected to the A2DP profile. User goes back to the car. - // Ideally the car's system is supposed to send incoming connections - // from both Handsfree and A2DP profile. But they don't. The Auto - // connect code, will not work here because we only auto connect to the - // last connected device for that profile which in this case is the dock. - // Now suppose a user is using 2 headsets simultaneously, one for the - // phone profile one for the A2DP profile. If this is the use case, we - // expect the user to use the preference to turn off the A2DP profile in - // the Settings screen for the first headset. Else, after link loss, - // there can be an incoming connection from the first headset which - // might result in the connection of the A2DP profile (if the second - // headset is slower) and thus the A2DP profile on the second headset - // will never get connected. - // - // TODO(): Handle other profiles here. - switch (command) { - case CONNECT_HFP_INCOMING: - // Connect A2DP if there is no incoming connection - // If the priority is OFF - don't auto connect. - if (mA2dpService.getPriority(mDevice) == BluetoothProfile.PRIORITY_ON || - mA2dpService.getPriority(mDevice) == - BluetoothProfile.PRIORITY_AUTO_CONNECT) { - Message msg = new Message(); - msg.what = CONNECT_OTHER_PROFILES; - msg.arg1 = CONNECT_A2DP_OUTGOING; - sendMessageDelayed(msg, CONNECT_OTHER_PROFILES_DELAY); - } - break; - case CONNECT_A2DP_INCOMING: - // This is again against spec. HFP incoming connections should be made - // before A2DP, so we should not hit this case. But many devices - // don't follow this. - if (mHeadsetService != null && - (mHeadsetService.getPriority(mDevice) == BluetoothProfile.PRIORITY_ON || - mHeadsetService.getPriority(mDevice) == - BluetoothProfile.PRIORITY_AUTO_CONNECT)) { - Message msg = new Message(); - msg.what = CONNECT_OTHER_PROFILES; - msg.arg1 = CONNECT_HFP_OUTGOING; - sendMessageDelayed(msg, CONNECT_OTHER_PROFILES_DELAY); - } - break; - default: - break; - } - - } - - /*package*/ BluetoothDevice getDevice() { - return mDevice; - } - - private void log(String message) { - if (DBG) { - Log.i(TAG, "Device:" + mDevice + " Message:" + message); - } - } -} diff --git a/core/java/android/bluetooth/BluetoothHeadset.java b/core/java/android/bluetooth/BluetoothHeadset.java old mode 100644 new mode 100755 index 2bbf008a76942..793d79858c6c0 --- a/core/java/android/bluetooth/BluetoothHeadset.java +++ b/core/java/android/bluetooth/BluetoothHeadset.java @@ -45,7 +45,8 @@ */ public final class BluetoothHeadset implements BluetoothProfile { private static final String TAG = "BluetoothHeadset"; - private static final boolean DBG = false; + private static final boolean DBG = true; + private static final boolean VDBG = false; /** * Intent used to broadcast the change in connection state of the Headset @@ -219,7 +220,38 @@ public final class BluetoothHeadset implements BluetoothProfile { private Context mContext; private ServiceListener mServiceListener; private IBluetoothHeadset mService; - BluetoothAdapter mAdapter; + private BluetoothAdapter mAdapter; + + final private IBluetoothStateChangeCallback mBluetoothStateChangeCallback = + new IBluetoothStateChangeCallback.Stub() { + public void onBluetoothStateChange(boolean up) { + if (DBG) Log.d(TAG, "onBluetoothStateChange: up=" + up); + if (!up) { + if (VDBG) Log.d(TAG,"Unbinding service..."); + synchronized (mConnection) { + try { + mService = null; + mContext.unbindService(mConnection); + } catch (Exception re) { + Log.e(TAG,"",re); + } + } + } else { + synchronized (mConnection) { + try { + if (mService == null) { + if (VDBG) Log.d(TAG,"Binding service..."); + if (!mContext.bindService(new Intent(IBluetoothHeadset.class.getName()), mConnection, 0)) { + Log.e(TAG, "Could not bind to Bluetooth Headset Service"); + } + } + } catch (Exception re) { + Log.e(TAG,"",re); + } + } + } + } + }; /** * Create a BluetoothHeadset proxy object. @@ -228,6 +260,16 @@ public final class BluetoothHeadset implements BluetoothProfile { mContext = context; mServiceListener = l; mAdapter = BluetoothAdapter.getDefaultAdapter(); + + IBluetoothManager mgr = mAdapter.getBluetoothManager(); + if (mgr != null) { + try { + mgr.registerStateChangeCallback(mBluetoothStateChangeCallback); + } catch (RemoteException e) { + Log.e(TAG,"",e); + } + } + if (!context.bindService(new Intent(IBluetoothHeadset.class.getName()), mConnection, 0)) { Log.e(TAG, "Could not bind to Bluetooth Headset Service"); } @@ -239,11 +281,27 @@ public final class BluetoothHeadset implements BluetoothProfile { * results once close() has been called. Multiple invocations of close() * are ok. */ - /*package*/ synchronized void close() { - if (DBG) log("close()"); - if (mConnection != null) { - mContext.unbindService(mConnection); - mConnection = null; + /*package*/ void close() { + if (VDBG) log("close()"); + + IBluetoothManager mgr = mAdapter.getBluetoothManager(); + if (mgr != null) { + try { + mgr.unregisterStateChangeCallback(mBluetoothStateChangeCallback); + } catch (Exception e) { + Log.e(TAG,"",e); + } + } + + synchronized (mConnection) { + if (mService != null) { + try { + mService = null; + mContext.unbindService(mConnection); + } catch (Exception re) { + Log.e(TAG,"",re); + } + } } mServiceListener = null; } @@ -330,7 +388,7 @@ public boolean disconnect(BluetoothDevice device) { * {@inheritDoc} */ public List getConnectedDevices() { - if (DBG) log("getConnectedDevices()"); + if (VDBG) log("getConnectedDevices()"); if (mService != null && isEnabled()) { try { return mService.getConnectedDevices(); @@ -347,7 +405,7 @@ public List getConnectedDevices() { * {@inheritDoc} */ public List getDevicesMatchingConnectionStates(int[] states) { - if (DBG) log("getDevicesMatchingStates()"); + if (VDBG) log("getDevicesMatchingStates()"); if (mService != null && isEnabled()) { try { return mService.getDevicesMatchingConnectionStates(states); @@ -364,7 +422,7 @@ public List getDevicesMatchingConnectionStates(int[] states) { * {@inheritDoc} */ public int getConnectionState(BluetoothDevice device) { - if (DBG) log("getConnectionState(" + device + ")"); + if (VDBG) log("getConnectionState(" + device + ")"); if (mService != null && isEnabled() && isValidDevice(device)) { try { @@ -426,7 +484,7 @@ public boolean setPriority(BluetoothDevice device, int priority) { * @hide */ public int getPriority(BluetoothDevice device) { - if (DBG) log("getPriority(" + device + ")"); + if (VDBG) log("getPriority(" + device + ")"); if (mService != null && isEnabled() && isValidDevice(device)) { try { @@ -509,7 +567,7 @@ public boolean stopVoiceRecognition(BluetoothDevice device) { * false otherwise or on error */ public boolean isAudioConnected(BluetoothDevice device) { - if (DBG) log("isAudioConnected()"); + if (VDBG) log("isAudioConnected()"); if (mService != null && isEnabled() && isValidDevice(device)) { try { @@ -537,7 +595,7 @@ public boolean isAudioConnected(BluetoothDevice device) { * @hide */ public int getBatteryUsageHint(BluetoothDevice device) { - if (DBG) log("getBatteryUsageHint()"); + if (VDBG) log("getBatteryUsageHint()"); if (mService != null && isEnabled() && isValidDevice(device)) { try { @@ -561,25 +619,6 @@ public static boolean isBluetoothVoiceDialingEnabled(Context context) { com.android.internal.R.bool.config_bluetooth_sco_off_call); } - /** - * Cancel the outgoing connection. - * Note: This is an internal function and shouldn't be exposed - * - * @hide - */ - public boolean cancelConnectThread() { - if (DBG) log("cancelConnectThread"); - if (mService != null && isEnabled()) { - try { - return mService.cancelConnectThread(); - } catch (RemoteException e) {Log.e(TAG, e.toString());} - } else { - Log.w(TAG, "Proxy not attached to service"); - if (DBG) Log.d(TAG, Log.getStackTraceString(new Throwable())); - } - return false; - } - /** * Accept the incoming connection. * Note: This is an internal function and shouldn't be exposed @@ -599,25 +638,6 @@ public boolean acceptIncomingConnect(BluetoothDevice device) { return false; } - /** - * Create the connect thread for the incoming connection. - * Note: This is an internal function and shouldn't be exposed - * - * @hide - */ - public boolean createIncomingConnect(BluetoothDevice device) { - if (DBG) log("createIncomingConnect"); - if (mService != null && isEnabled()) { - try { - return mService.createIncomingConnect(device); - } catch (RemoteException e) {Log.e(TAG, e.toString());} - } else { - Log.w(TAG, "Proxy not attached to service"); - if (DBG) Log.d(TAG, Log.getStackTraceString(new Throwable())); - } - return false; - } - /** * Reject the incoming connection. * @hide @@ -636,55 +656,63 @@ public boolean rejectIncomingConnect(BluetoothDevice device) { } /** - * Connect to a Bluetooth Headset. + * Get the current audio state of the Headset. * Note: This is an internal function and shouldn't be exposed * * @hide */ - public boolean connectHeadsetInternal(BluetoothDevice device) { - if (DBG) log("connectHeadsetInternal"); - if (mService != null && isEnabled()) { + public int getAudioState(BluetoothDevice device) { + if (VDBG) log("getAudioState"); + if (mService != null && !isDisabled()) { try { - return mService.connectHeadsetInternal(device); + return mService.getAudioState(device); } catch (RemoteException e) {Log.e(TAG, e.toString());} } else { Log.w(TAG, "Proxy not attached to service"); if (DBG) Log.d(TAG, Log.getStackTraceString(new Throwable())); } - return false; + return BluetoothHeadset.STATE_AUDIO_DISCONNECTED; } /** - * Disconnect a Bluetooth Headset. - * Note: This is an internal function and shouldn't be exposed + * Check if Bluetooth SCO audio is connected. + * + *

      Requires {@link android.Manifest.permission#BLUETOOTH} permission. * + * @return true if SCO is connected, + * false otherwise or on error * @hide */ - public boolean disconnectHeadsetInternal(BluetoothDevice device) { - if (DBG) log("disconnectHeadsetInternal"); - if (mService != null && !isDisabled()) { + public boolean isAudioOn() { + if (VDBG) log("isAudioOn()"); + if (mService != null && isEnabled()) { try { - return mService.disconnectHeadsetInternal(device); - } catch (RemoteException e) {Log.e(TAG, e.toString());} - } else { - Log.w(TAG, "Proxy not attached to service"); - if (DBG) Log.d(TAG, Log.getStackTraceString(new Throwable())); + return mService.isAudioOn(); + } catch (RemoteException e) { + Log.e(TAG, Log.getStackTraceString(new Throwable())); + } } + if (mService == null) Log.w(TAG, "Proxy not attached to service"); return false; + } /** - * Set the audio state of the Headset. - * Note: This is an internal function and shouldn't be exposed + * Initiates a connection of headset audio. + * It setup SCO channel with remote connected headset device. * + * @return true if successful + * false if there was some error such as + * there is no connected headset * @hide */ - public boolean setAudioState(BluetoothDevice device, int state) { - if (DBG) log("setAudioState"); - if (mService != null && !isDisabled()) { + public boolean connectAudio() { + if (mService != null && isEnabled()) { try { - return mService.setAudioState(device, state); - } catch (RemoteException e) {Log.e(TAG, e.toString());} + return mService.connectAudio(); + } catch (RemoteException e) { + Log.e(TAG, e.toString()); + } } else { Log.w(TAG, "Proxy not attached to service"); if (DBG) Log.d(TAG, Log.getStackTraceString(new Throwable())); @@ -693,22 +721,26 @@ public boolean setAudioState(BluetoothDevice device, int state) { } /** - * Get the current audio state of the Headset. - * Note: This is an internal function and shouldn't be exposed + * Initiates a disconnection of headset audio. + * It tears down the SCO channel from remote headset device. * + * @return true if successful + * false if there was some error such as + * there is no connected SCO channel * @hide */ - public int getAudioState(BluetoothDevice device) { - if (DBG) log("getAudioState"); - if (mService != null && !isDisabled()) { + public boolean disconnectAudio() { + if (mService != null && isEnabled()) { try { - return mService.getAudioState(device); - } catch (RemoteException e) {Log.e(TAG, e.toString());} + return mService.disconnectAudio(); + } catch (RemoteException e) { + Log.e(TAG, e.toString()); + } } else { Log.w(TAG, "Proxy not attached to service"); if (DBG) Log.d(TAG, Log.getStackTraceString(new Throwable())); } - return BluetoothHeadset.STATE_AUDIO_DISCONNECTED; + return false; } /** @@ -760,6 +792,68 @@ public boolean stopScoUsingVirtualVoiceCall(BluetoothDevice device) { return false; } + /** + * Notify Headset of phone state change. + * This is a backdoor for phone app to call BluetoothHeadset since + * there is currently not a good way to get precise call state change outside + * of phone app. + * + * @hide + */ + public void phoneStateChanged(int numActive, int numHeld, int callState, String number, + int type) { + if (mService != null && isEnabled()) { + try { + mService.phoneStateChanged(numActive, numHeld, callState, number, type); + } catch (RemoteException e) { + Log.e(TAG, e.toString()); + } + } else { + Log.w(TAG, "Proxy not attached to service"); + if (DBG) Log.d(TAG, Log.getStackTraceString(new Throwable())); + } + } + + /** + * Notify Headset of phone roam state change. + * This is a backdoor for phone app to call BluetoothHeadset since + * there is currently not a good way to get roaming state change outside + * of phone app. + * + * @hide + */ + public void roamChanged(boolean roaming) { + if (mService != null && isEnabled()) { + try { + mService.roamChanged(roaming); + } catch (RemoteException e) { + Log.e(TAG, e.toString()); + } + } else { + Log.w(TAG, "Proxy not attached to service"); + if (DBG) Log.d(TAG, Log.getStackTraceString(new Throwable())); + } + } + + /** + * Send Headset of CLCC response + * + * @hide + */ + public void clccResponse(int index, int direction, int status, int mode, boolean mpty, + String number, int type) { + if (mService != null && isEnabled()) { + try { + mService.clccResponse(index, direction, status, mode, mpty, number, type); + } catch (RemoteException e) { + Log.e(TAG, e.toString()); + } + } else { + Log.w(TAG, "Proxy not attached to service"); + if (DBG) Log.d(TAG, Log.getStackTraceString(new Throwable())); + } + } + private ServiceConnection mConnection = new ServiceConnection() { public void onServiceConnected(ComponentName className, IBinder service) { if (DBG) Log.d(TAG, "Proxy object connected"); diff --git a/core/java/android/bluetooth/BluetoothHealth.java b/core/java/android/bluetooth/BluetoothHealth.java index f850c0224a500..cb23662f6c111 100644 --- a/core/java/android/bluetooth/BluetoothHealth.java +++ b/core/java/android/bluetooth/BluetoothHealth.java @@ -16,7 +16,10 @@ package android.bluetooth; +import android.content.ComponentName; import android.content.Context; +import android.content.Intent; +import android.content.ServiceConnection; import android.os.IBinder; import android.os.ParcelFileDescriptor; import android.os.RemoteException; @@ -54,7 +57,8 @@ */ public final class BluetoothHealth implements BluetoothProfile { private static final String TAG = "BluetoothHealth"; - private static final boolean DBG = false; + private static final boolean DBG = true; + private static final boolean VDBG = false; /** * Health Profile Source Role - the health device. @@ -94,6 +98,37 @@ public final class BluetoothHealth implements BluetoothProfile { /** @hide */ public static final int HEALTH_OPERATION_NOT_ALLOWED = 6005; + final private IBluetoothStateChangeCallback mBluetoothStateChangeCallback = + new IBluetoothStateChangeCallback.Stub() { + public void onBluetoothStateChange(boolean up) { + if (DBG) Log.d(TAG, "onBluetoothStateChange: up=" + up); + if (!up) { + if (VDBG) Log.d(TAG,"Unbinding service..."); + synchronized (mConnection) { + try { + mService = null; + mContext.unbindService(mConnection); + } catch (Exception re) { + Log.e(TAG,"",re); + } + } + } else { + synchronized (mConnection) { + try { + if (mService == null) { + if (VDBG) Log.d(TAG,"Binding service..."); + if (!mContext.bindService(new Intent(IBluetoothHealth.class.getName()), mConnection, 0)) { + Log.e(TAG, "Could not bind to Bluetooth Health Service"); + } + } + } catch (Exception re) { + Log.e(TAG,"",re); + } + } + } + } + }; + /** * Register an application configuration that acts as a Health SINK. @@ -114,7 +149,7 @@ public boolean registerSinkAppConfiguration(String name, int dataType, BluetoothHealthCallback callback) { if (!isEnabled() || name == null) return false; - if (DBG) log("registerSinkApplication(" + name + ":" + dataType + ")"); + if (VDBG) log("registerSinkApplication(" + name + ":" + dataType + ")"); return registerAppConfiguration(name, dataType, SINK_ROLE, CHANNEL_TYPE_ANY, callback); } @@ -140,7 +175,7 @@ public boolean registerAppConfiguration(String name, int dataType, int role, boolean result = false; if (!isEnabled() || !checkAppParam(name, role, channelType, callback)) return result; - if (DBG) log("registerApplication(" + name + ":" + dataType + ")"); + if (VDBG) log("registerApplication(" + name + ":" + dataType + ")"); BluetoothHealthCallbackWrapper wrapper = new BluetoothHealthCallbackWrapper(callback); BluetoothHealthAppConfiguration config = new BluetoothHealthAppConfiguration(name, dataType, role, channelType); @@ -427,35 +462,74 @@ public void onHealthChannelStateChange(BluetoothHealthAppConfiguration config, /** Health App Configuration un-registration failure */ public static final int APP_CONFIG_UNREGISTRATION_FAILURE = 3; + private Context mContext; private ServiceListener mServiceListener; - private IBluetooth mService; + private IBluetoothHealth mService; BluetoothAdapter mAdapter; /** * Create a BluetoothHealth proxy object. */ - /*package*/ BluetoothHealth(Context mContext, ServiceListener l) { - IBinder b = ServiceManager.getService(BluetoothAdapter.BLUETOOTH_SERVICE); + /*package*/ BluetoothHealth(Context context, ServiceListener l) { + mContext = context; mServiceListener = l; mAdapter = BluetoothAdapter.getDefaultAdapter(); - if (b != null) { - mService = IBluetooth.Stub.asInterface(b); - if (mServiceListener != null) { - mServiceListener.onServiceConnected(BluetoothProfile.HEALTH, this); + IBluetoothManager mgr = mAdapter.getBluetoothManager(); + if (mgr != null) { + try { + mgr.registerStateChangeCallback(mBluetoothStateChangeCallback); + } catch (RemoteException e) { + Log.e(TAG,"",e); } - } else { - Log.w(TAG, "Bluetooth Service not available!"); + } - // Instead of throwing an exception which prevents people from going - // into Wireless settings in the emulator. Let it crash later when it is actually used. - mService = null; + if (!context.bindService(new Intent(IBluetoothHealth.class.getName()), mConnection, 0)) { + Log.e(TAG, "Could not bind to Bluetooth Health Service"); } } /*package*/ void close() { + if (VDBG) log("close()"); + IBluetoothManager mgr = mAdapter.getBluetoothManager(); + if (mgr != null) { + try { + mgr.unregisterStateChangeCallback(mBluetoothStateChangeCallback); + } catch (Exception e) { + Log.e(TAG,"",e); + } + } + + synchronized (mConnection) { + if (mService != null) { + try { + mService = null; + mContext.unbindService(mConnection); + } catch (Exception re) { + Log.e(TAG,"",re); + } + } + } mServiceListener = null; } + private ServiceConnection mConnection = new ServiceConnection() { + public void onServiceConnected(ComponentName className, IBinder service) { + if (DBG) Log.d(TAG, "Proxy object connected"); + mService = IBluetoothHealth.Stub.asInterface(service); + + if (mServiceListener != null) { + mServiceListener.onServiceConnected(BluetoothProfile.HEALTH, BluetoothHealth.this); + } + } + public void onServiceDisconnected(ComponentName className) { + if (DBG) Log.d(TAG, "Proxy object disconnected"); + mService = null; + if (mServiceListener != null) { + mServiceListener.onServiceDisconnected(BluetoothProfile.HEALTH); + } + } + }; + private boolean isEnabled() { BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter(); diff --git a/core/java/android/bluetooth/BluetoothInputDevice.java b/core/java/android/bluetooth/BluetoothInputDevice.java old mode 100644 new mode 100755 index 1a9e011ad7fe1..db7e424d40ee2 --- a/core/java/android/bluetooth/BluetoothInputDevice.java +++ b/core/java/android/bluetooth/BluetoothInputDevice.java @@ -18,7 +18,10 @@ import android.annotation.SdkConstant; import android.annotation.SdkConstant.SdkConstantType; +import android.content.ComponentName; import android.content.Context; +import android.content.Intent; +import android.content.ServiceConnection; import android.os.IBinder; import android.os.RemoteException; import android.os.ServiceManager; @@ -41,7 +44,8 @@ */ public final class BluetoothInputDevice implements BluetoothProfile { private static final String TAG = "BluetoothInputDevice"; - private static final boolean DBG = false; + private static final boolean DBG = true; + private static final boolean VDBG = false; /** * Intent used to broadcast the change in connection state of the Input @@ -65,6 +69,22 @@ public final class BluetoothInputDevice implements BluetoothProfile { public static final String ACTION_CONNECTION_STATE_CHANGED = "android.bluetooth.input.profile.action.CONNECTION_STATE_CHANGED"; + /** + * @hide + */ + @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) + public static final String ACTION_PROTOCOL_MODE_CHANGED = + "android.bluetooth.input.profile.action.PROTOCOL_MODE_CHANGED"; + + + /** + * @hide + */ + @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) + public static final String ACTION_VIRTUAL_UNPLUG_STATUS = + "android.bluetooth.input.profile.action.VIRTUAL_UNPLUG_STATUS"; + + /** * Return codes for the connect and disconnect Bluez / Dbus calls. * @hide @@ -91,34 +111,159 @@ public final class BluetoothInputDevice implements BluetoothProfile { */ public static final int INPUT_OPERATION_SUCCESS = 5004; + /** + * @hide + */ + public static final int PROTOCOL_REPORT_MODE = 0; + + /** + * @hide + */ + public static final int PROTOCOL_BOOT_MODE = 1; + + /** + * @hide + */ + public static final int PROTOCOL_UNSUPPORTED_MODE = 255; + + /* int reportType, int reportType, int bufferSize */ + /** + * @hide + */ + public static final byte REPORT_TYPE_INPUT = 0; + + /** + * @hide + */ + public static final byte REPORT_TYPE_OUTPUT = 1; + + /** + * @hide + */ + public static final byte REPORT_TYPE_FEATURE = 2; + + /** + * @hide + */ + public static final int VIRTUAL_UNPLUG_STATUS_SUCCESS = 0; + + /** + * @hide + */ + public static final int VIRTUAL_UNPLUG_STATUS_FAIL = 1; + + /** + * @hide + */ + public static final String EXTRA_PROTOCOL_MODE = "android.bluetooth.BluetoothInputDevice.extra.PROTOCOL_MODE"; + + /** + * @hide + */ + public static final String EXTRA_REPORT_TYPE = "android.bluetooth.BluetoothInputDevice.extra.REPORT_TYPE"; + + /** + * @hide + */ + public static final String EXTRA_REPORT_ID = "android.bluetooth.BluetoothInputDevice.extra.REPORT_ID"; + + /** + * @hide + */ + public static final String EXTRA_REPORT_BUFFER_SIZE = "android.bluetooth.BluetoothInputDevice.extra.REPORT_BUFFER_SIZE"; + + /** + * @hide + */ + public static final String EXTRA_REPORT = "android.bluetooth.BluetoothInputDevice.extra.REPORT"; + + /** + * @hide + */ + public static final String EXTRA_VIRTUAL_UNPLUG_STATUS = "android.bluetooth.BluetoothInputDevice.extra.VIRTUAL_UNPLUG_STATUS"; + + private Context mContext; private ServiceListener mServiceListener; private BluetoothAdapter mAdapter; - private IBluetooth mService; + private IBluetoothInputDevice mService; + + final private IBluetoothStateChangeCallback mBluetoothStateChangeCallback = + new IBluetoothStateChangeCallback.Stub() { + public void onBluetoothStateChange(boolean up) { + if (DBG) Log.d(TAG, "onBluetoothStateChange: up=" + up); + if (!up) { + if (VDBG) Log.d(TAG,"Unbinding service..."); + synchronized (mConnection) { + try { + mService = null; + mContext.unbindService(mConnection); + } catch (Exception re) { + Log.e(TAG,"",re); + } + } + } else { + synchronized (mConnection) { + try { + if (mService == null) { + if (VDBG) Log.d(TAG,"Binding service..."); + if (!mContext.bindService(new Intent(IBluetoothInputDevice.class.getName()), mConnection, 0)) { + Log.e(TAG, "Could not bind to Bluetooth HID Service"); + } + } + } catch (Exception re) { + Log.e(TAG,"",re); + } + } + } + } + }; /** * Create a BluetoothInputDevice proxy object for interacting with the local * Bluetooth Service which handles the InputDevice profile * */ - /*package*/ BluetoothInputDevice(Context mContext, ServiceListener l) { - IBinder b = ServiceManager.getService(BluetoothAdapter.BLUETOOTH_SERVICE); + /*package*/ BluetoothInputDevice(Context context, ServiceListener l) { + mContext = context; mServiceListener = l; mAdapter = BluetoothAdapter.getDefaultAdapter(); - if (b != null) { - mService = IBluetooth.Stub.asInterface(b); - if (mServiceListener != null) { - mServiceListener.onServiceConnected(BluetoothProfile.INPUT_DEVICE, this); + + IBluetoothManager mgr = mAdapter.getBluetoothManager(); + if (mgr != null) { + try { + mgr.registerStateChangeCallback(mBluetoothStateChangeCallback); + } catch (RemoteException e) { + Log.e(TAG,"",e); } - } else { - Log.w(TAG, "Bluetooth Service not available!"); + } - // Instead of throwing an exception which prevents people from going - // into Wireless settings in the emulator. Let it crash later when it is actually used. - mService = null; + if (!context.bindService(new Intent(IBluetoothInputDevice.class.getName()), + mConnection, 0)) { + Log.e(TAG, "Could not bind to Bluetooth HID Service"); } } /*package*/ void close() { + if (VDBG) log("close()"); + IBluetoothManager mgr = mAdapter.getBluetoothManager(); + if (mgr != null) { + try { + mgr.unregisterStateChangeCallback(mBluetoothStateChangeCallback); + } catch (Exception e) { + Log.e(TAG,"",e); + } + } + + synchronized (mConnection) { + if (mService != null) { + try { + mService = null; + mContext.unbindService(mConnection); + } catch (Exception re) { + Log.e(TAG,"",re); + } + } + } mServiceListener = null; } @@ -144,10 +289,9 @@ public final class BluetoothInputDevice implements BluetoothProfile { */ public boolean connect(BluetoothDevice device) { if (DBG) log("connect(" + device + ")"); - if (mService != null && isEnabled() && - isValidDevice(device)) { + if (mService != null && isEnabled() && isValidDevice(device)) { try { - return mService.connectInputDevice(device); + return mService.connect(device); } catch (RemoteException e) { Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); return false; @@ -185,10 +329,9 @@ public boolean connect(BluetoothDevice device) { */ public boolean disconnect(BluetoothDevice device) { if (DBG) log("disconnect(" + device + ")"); - if (mService != null && isEnabled() && - isValidDevice(device)) { + if (mService != null && isEnabled() && isValidDevice(device)) { try { - return mService.disconnectInputDevice(device); + return mService.disconnect(device); } catch (RemoteException e) { Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); return false; @@ -202,10 +345,10 @@ public boolean disconnect(BluetoothDevice device) { * {@inheritDoc} */ public List getConnectedDevices() { - if (DBG) log("getConnectedDevices()"); + if (VDBG) log("getConnectedDevices()"); if (mService != null && isEnabled()) { try { - return mService.getConnectedInputDevices(); + return mService.getConnectedDevices(); } catch (RemoteException e) { Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); return new ArrayList(); @@ -219,10 +362,10 @@ public List getConnectedDevices() { * {@inheritDoc} */ public List getDevicesMatchingConnectionStates(int[] states) { - if (DBG) log("getDevicesMatchingStates()"); + if (VDBG) log("getDevicesMatchingStates()"); if (mService != null && isEnabled()) { try { - return mService.getInputDevicesMatchingConnectionStates(states); + return mService.getDevicesMatchingConnectionStates(states); } catch (RemoteException e) { Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); return new ArrayList(); @@ -236,11 +379,10 @@ public List getDevicesMatchingConnectionStates(int[] states) { * {@inheritDoc} */ public int getConnectionState(BluetoothDevice device) { - if (DBG) log("getState(" + device + ")"); - if (mService != null && isEnabled() - && isValidDevice(device)) { + if (VDBG) log("getState(" + device + ")"); + if (mService != null && isEnabled() && isValidDevice(device)) { try { - return mService.getInputDeviceConnectionState(device); + return mService.getConnectionState(device); } catch (RemoteException e) { Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); return BluetoothProfile.STATE_DISCONNECTED; @@ -267,14 +409,13 @@ && isValidDevice(device)) { */ public boolean setPriority(BluetoothDevice device, int priority) { if (DBG) log("setPriority(" + device + ", " + priority + ")"); - if (mService != null && isEnabled() - && isValidDevice(device)) { + if (mService != null && isEnabled() && isValidDevice(device)) { if (priority != BluetoothProfile.PRIORITY_OFF && priority != BluetoothProfile.PRIORITY_ON) { return false; } try { - return mService.setInputDevicePriority(device, priority); + return mService.setPriority(device, priority); } catch (RemoteException e) { Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); return false; @@ -298,11 +439,10 @@ && isValidDevice(device)) { * @hide */ public int getPriority(BluetoothDevice device) { - if (DBG) log("getPriority(" + device + ")"); - if (mService != null && isEnabled() - && isValidDevice(device)) { + if (VDBG) log("getPriority(" + device + ")"); + if (mService != null && isEnabled() && isValidDevice(device)) { try { - return mService.getInputDevicePriority(device); + return mService.getPriority(device); } catch (RemoteException e) { Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); return BluetoothProfile.PRIORITY_OFF; @@ -312,6 +452,24 @@ && isValidDevice(device)) { return BluetoothProfile.PRIORITY_OFF; } + private ServiceConnection mConnection = new ServiceConnection() { + public void onServiceConnected(ComponentName className, IBinder service) { + if (DBG) Log.d(TAG, "Proxy object connected"); + mService = IBluetoothInputDevice.Stub.asInterface(service); + + if (mServiceListener != null) { + mServiceListener.onServiceConnected(BluetoothProfile.INPUT_DEVICE, BluetoothInputDevice.this); + } + } + public void onServiceDisconnected(ComponentName className) { + if (DBG) Log.d(TAG, "Proxy object disconnected"); + mService = null; + if (mServiceListener != null) { + mServiceListener.onServiceDisconnected(BluetoothProfile.INPUT_DEVICE); + } + } + }; + private boolean isEnabled() { if (mAdapter.getState() == BluetoothAdapter.STATE_ON) return true; return false; @@ -324,6 +482,158 @@ private boolean isValidDevice(BluetoothDevice device) { return false; } + + /** + * Initiate virtual unplug for a HID input device. + * + *

      Requires {@link android.Manifest.permission#BLUETOOTH_ADMIN} permission. + * + * @param device Remote Bluetooth Device + * @return false on immediate error, + * true otherwise + * @hide + */ + public boolean virtualUnplug(BluetoothDevice device) { + if (DBG) log("virtualUnplug(" + device + ")"); + if (mService != null && isEnabled() && isValidDevice(device)) { + try { + return mService.virtualUnplug(device); + } catch (RemoteException e) { + Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); + return false; + } + } + + if (mService == null) Log.w(TAG, "Proxy not attached to service"); + return false; + + } + + /** + * Send Get_Protocol_Mode command to the connected HID input device. + * + *

      Requires {@link android.Manifest.permission#BLUETOOTH_ADMIN} permission. + * + * @param device Remote Bluetooth Device + * @return false on immediate error, + *true otherwise + * @hide + */ + public boolean getProtocolMode(BluetoothDevice device) { + if (VDBG) log("getProtocolMode(" + device + ")"); + if (mService != null && isEnabled() && isValidDevice(device)) { + try { + return mService.getProtocolMode(device); + } catch (RemoteException e) { + Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); + return false; + } + } + if (mService == null) Log.w(TAG, "Proxy not attached to service"); + return false; + } + + /** + * Send Set_Protocol_Mode command to the connected HID input device. + * + *

      Requires {@link android.Manifest.permission#BLUETOOTH_ADMIN} permission. + * + * @param device Remote Bluetooth Device + * @return false on immediate error, + * true otherwise + * @hide + */ + public boolean setProtocolMode(BluetoothDevice device, int protocolMode) { + if (DBG) log("setProtocolMode(" + device + ")"); + if (mService != null && isEnabled() && isValidDevice(device)) { + try { + return mService.setProtocolMode(device, protocolMode); + } catch (RemoteException e) { + Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); + return false; + } + } + if (mService == null) Log.w(TAG, "Proxy not attached to service"); + return false; + } + + /** + * Send Get_Report command to the connected HID input device. + * + *

      Requires {@link android.Manifest.permission#BLUETOOTH_ADMIN} permission. + * + * @param device Remote Bluetooth Device + * @param reportType Report type + * @param reportId Report ID + * @param bufferSize Report receiving buffer size + * @return false on immediate error, + * true otherwise + * @hide + */ + public boolean getReport(BluetoothDevice device, byte reportType, byte reportId, int bufferSize) { + if (VDBG) log("getReport(" + device + "), reportType=" + reportType + " reportId=" + reportId + "bufferSize=" + bufferSize); + if (mService != null && isEnabled() && isValidDevice(device)) { + try { + return mService.getReport(device, reportType, reportId, bufferSize); + } catch (RemoteException e) { + Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); + return false; + } + } + if (mService == null) Log.w(TAG, "Proxy not attached to service"); + return false; + } + + /** + * Send Set_Report command to the connected HID input device. + * + *

      Requires {@link android.Manifest.permission#BLUETOOTH_ADMIN} permission. + * + * @param device Remote Bluetooth Device + * @param reportType Report type + * @param report Report receiving buffer size + * @return false on immediate error, + * true otherwise + * @hide + */ + public boolean setReport(BluetoothDevice device, byte reportType, String report) { + if (DBG) log("setReport(" + device + "), reportType=" + reportType + " report=" + report); + if (mService != null && isEnabled() && isValidDevice(device)) { + try { + return mService.setReport(device, reportType, report); + } catch (RemoteException e) { + Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); + return false; + } + } + if (mService == null) Log.w(TAG, "Proxy not attached to service"); + return false; + } + + /** + * Send Send_Data command to the connected HID input device. + * + *

      Requires {@link android.Manifest.permission#BLUETOOTH_ADMIN} permission. + * + * @param device Remote Bluetooth Device + * @param data Data to send + * @return false on immediate error, + * true otherwise + * @hide + */ + public boolean sendData(BluetoothDevice device, String report) { + if (DBG) log("sendData(" + device + "), report=" + report); + if (mService != null && isEnabled() && isValidDevice(device)) { + try { + return mService.sendData(device, report); + } catch (RemoteException e) { + Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); + return false; + } + } + if (mService == null) Log.w(TAG, "Proxy not attached to service"); + return false; + } private static void log(String msg) { Log.d(TAG, msg); } diff --git a/core/java/android/bluetooth/BluetoothPan.java b/core/java/android/bluetooth/BluetoothPan.java index 5d9d8bea8e0c5..e25ec86a8667b 100644 --- a/core/java/android/bluetooth/BluetoothPan.java +++ b/core/java/android/bluetooth/BluetoothPan.java @@ -18,7 +18,10 @@ import android.annotation.SdkConstant; import android.annotation.SdkConstant.SdkConstantType; +import android.content.ComponentName; import android.content.Context; +import android.content.Intent; +import android.content.ServiceConnection; import android.os.IBinder; import android.os.RemoteException; import android.os.ServiceManager; @@ -27,7 +30,6 @@ import java.util.ArrayList; import java.util.List; - /** * This class provides the APIs to control the Bluetooth Pan * Profile. @@ -41,7 +43,8 @@ */ public final class BluetoothPan implements BluetoothProfile { private static final String TAG = "BluetoothPan"; - private static final boolean DBG = false; + private static final boolean DBG = true; + private static final boolean VDBG = false; /** * Intent used to broadcast the change in connection state of the Pan @@ -76,15 +79,18 @@ public final class BluetoothPan implements BluetoothProfile { */ public static final String EXTRA_LOCAL_ROLE = "android.bluetooth.pan.extra.LOCAL_ROLE"; + public static final int PAN_ROLE_NONE = 0; /** * The local device is acting as a Network Access Point. */ public static final int LOCAL_NAP_ROLE = 1; + public static final int REMOTE_NAP_ROLE = 1; /** * The local device is acting as a PAN User. */ public static final int LOCAL_PANU_ROLE = 2; + public static final int REMOTE_PANU_ROLE = 2; /** * Return codes for the connect and disconnect Bluez / Dbus calls. @@ -112,37 +118,77 @@ public final class BluetoothPan implements BluetoothProfile { */ public static final int PAN_OPERATION_SUCCESS = 1004; + private Context mContext; private ServiceListener mServiceListener; private BluetoothAdapter mAdapter; - private IBluetooth mService; + private IBluetoothPan mPanService; /** * Create a BluetoothPan proxy object for interacting with the local * Bluetooth Service which handles the Pan profile * */ - /*package*/ BluetoothPan(Context mContext, ServiceListener l) { - IBinder b = ServiceManager.getService(BluetoothAdapter.BLUETOOTH_SERVICE); + /*package*/ BluetoothPan(Context context, ServiceListener l) { + mContext = context; mServiceListener = l; mAdapter = BluetoothAdapter.getDefaultAdapter(); - if (b != null) { - mService = IBluetooth.Stub.asInterface(b); - if (mServiceListener != null) { - mServiceListener.onServiceConnected(BluetoothProfile.PAN, this); - } - } else { - Log.w(TAG, "Bluetooth Service not available!"); - - // Instead of throwing an exception which prevents people from going - // into Wireless settings in the emulator. Let it crash later when it is actually used. - mService = null; + try { + mAdapter.getBluetoothManager().registerStateChangeCallback(mStateChangeCallback); + } catch (RemoteException re) { + Log.w(TAG,"Unable to register BluetoothStateChangeCallback",re); + } + Log.d(TAG, "BluetoothPan() call bindService"); + if (!context.bindService(new Intent(IBluetoothPan.class.getName()), + mConnection, 0)) { + Log.e(TAG, "Could not bind to Bluetooth HID Service"); } + Log.d(TAG, "BluetoothPan(), bindService called"); } /*package*/ void close() { + if (VDBG) log("close()"); + if (mConnection != null) { + mContext.unbindService(mConnection); + mConnection = null; + } mServiceListener = null; + try { + mAdapter.getBluetoothManager().unregisterStateChangeCallback(mStateChangeCallback); + } catch (RemoteException re) { + Log.w(TAG,"Unable to register BluetoothStateChangeCallback",re); + } } + protected void finalize() { + close(); + } + + private IBluetoothStateChangeCallback mStateChangeCallback = new IBluetoothStateChangeCallback.Stub() { + + @Override + public void onBluetoothStateChange(boolean on) throws RemoteException { + //Handle enable request to bind again. + if (on) { + Log.d(TAG, "onBluetoothStateChange(on) call bindService"); + if (!mContext.bindService(new Intent(IBluetoothPan.class.getName()), + mConnection, 0)) { + Log.e(TAG, "Could not bind to Bluetooth HID Service"); + } + Log.d(TAG, "BluetoothPan(), bindService called"); + } else { + if (VDBG) Log.d(TAG,"Unbinding service..."); + synchronized (mConnection) { + try { + mPanService = null; + mContext.unbindService(mConnection); + } catch (Exception re) { + Log.e(TAG,"",re); + } + } + } + } + }; + /** * Initiate connection to a profile of the remote bluetooth device. * @@ -163,16 +209,16 @@ public final class BluetoothPan implements BluetoothProfile { */ public boolean connect(BluetoothDevice device) { if (DBG) log("connect(" + device + ")"); - if (mService != null && isEnabled() && + if (mPanService != null && isEnabled() && isValidDevice(device)) { try { - return mService.connectPanDevice(device); + return mPanService.connect(device); } catch (RemoteException e) { Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); return false; } } - if (mService == null) Log.w(TAG, "Proxy not attached to service"); + if (mPanService == null) Log.w(TAG, "Proxy not attached to service"); return false; } @@ -204,16 +250,16 @@ public boolean connect(BluetoothDevice device) { */ public boolean disconnect(BluetoothDevice device) { if (DBG) log("disconnect(" + device + ")"); - if (mService != null && isEnabled() && + if (mPanService != null && isEnabled() && isValidDevice(device)) { try { - return mService.disconnectPanDevice(device); + return mPanService.disconnect(device); } catch (RemoteException e) { Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); return false; } } - if (mService == null) Log.w(TAG, "Proxy not attached to service"); + if (mPanService == null) Log.w(TAG, "Proxy not attached to service"); return false; } @@ -221,16 +267,16 @@ public boolean disconnect(BluetoothDevice device) { * {@inheritDoc} */ public List getConnectedDevices() { - if (DBG) log("getConnectedDevices()"); - if (mService != null && isEnabled()) { + if (VDBG) log("getConnectedDevices()"); + if (mPanService != null && isEnabled()) { try { - return mService.getConnectedPanDevices(); + return mPanService.getConnectedDevices(); } catch (RemoteException e) { Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); return new ArrayList(); } } - if (mService == null) Log.w(TAG, "Proxy not attached to service"); + if (mPanService == null) Log.w(TAG, "Proxy not attached to service"); return new ArrayList(); } @@ -238,16 +284,16 @@ public List getConnectedDevices() { * {@inheritDoc} */ public List getDevicesMatchingConnectionStates(int[] states) { - if (DBG) log("getDevicesMatchingStates()"); - if (mService != null && isEnabled()) { + if (VDBG) log("getDevicesMatchingStates()"); + if (mPanService != null && isEnabled()) { try { - return mService.getPanDevicesMatchingConnectionStates(states); + return mPanService.getDevicesMatchingConnectionStates(states); } catch (RemoteException e) { Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); return new ArrayList(); } } - if (mService == null) Log.w(TAG, "Proxy not attached to service"); + if (mPanService == null) Log.w(TAG, "Proxy not attached to service"); return new ArrayList(); } @@ -255,39 +301,58 @@ public List getDevicesMatchingConnectionStates(int[] states) { * {@inheritDoc} */ public int getConnectionState(BluetoothDevice device) { - if (DBG) log("getState(" + device + ")"); - if (mService != null && isEnabled() + if (VDBG) log("getState(" + device + ")"); + if (mPanService != null && isEnabled() && isValidDevice(device)) { try { - return mService.getPanDeviceConnectionState(device); + return mPanService.getConnectionState(device); } catch (RemoteException e) { Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); return BluetoothProfile.STATE_DISCONNECTED; } } - if (mService == null) Log.w(TAG, "Proxy not attached to service"); + if (mPanService == null) Log.w(TAG, "Proxy not attached to service"); return BluetoothProfile.STATE_DISCONNECTED; } public void setBluetoothTethering(boolean value) { if (DBG) log("setBluetoothTethering(" + value + ")"); try { - mService.setBluetoothTethering(value); + mPanService.setBluetoothTethering(value); } catch (RemoteException e) { Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); } } public boolean isTetheringOn() { - if (DBG) log("isTetheringOn()"); + if (VDBG) log("isTetheringOn()"); try { - return mService.isTetheringOn(); + return mPanService.isTetheringOn(); } catch (RemoteException e) { Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); - return false; } + return false; } + private ServiceConnection mConnection = new ServiceConnection() { + public void onServiceConnected(ComponentName className, IBinder service) { + if (DBG) Log.d(TAG, "BluetoothPAN Proxy object connected"); + mPanService = IBluetoothPan.Stub.asInterface(service); + + if (mServiceListener != null) { + mServiceListener.onServiceConnected(BluetoothProfile.PAN, + BluetoothPan.this); + } + } + public void onServiceDisconnected(ComponentName className) { + if (DBG) Log.d(TAG, "BluetoothPAN Proxy object disconnected"); + mPanService = null; + if (mServiceListener != null) { + mServiceListener.onServiceDisconnected(BluetoothProfile.PAN); + } + } + }; + private boolean isEnabled() { if (mAdapter.getState() == BluetoothAdapter.STATE_ON) return true; return false; diff --git a/core/java/android/bluetooth/BluetoothPbap.java b/core/java/android/bluetooth/BluetoothPbap.java old mode 100644 new mode 100755 index 639ae1a96d59c..b5280e5337783 --- a/core/java/android/bluetooth/BluetoothPbap.java +++ b/core/java/android/bluetooth/BluetoothPbap.java @@ -51,7 +51,8 @@ public class BluetoothPbap { private static final String TAG = "BluetoothPbap"; - private static final boolean DBG = false; + private static final boolean DBG = true; + private static final boolean VDBG = false; /** int extra for PBAP_STATE_CHANGED_ACTION */ public static final String PBAP_STATE = @@ -70,6 +71,7 @@ public class BluetoothPbap { private IBluetoothPbap mService; private final Context mContext; private ServiceListener mServiceListener; + private BluetoothAdapter mAdapter; /** There was an error trying to obtain the state */ public static final int STATE_ERROR = -1; @@ -96,7 +98,7 @@ public interface ServiceListener { * this callback before making IPC calls on the BluetoothPbap * service. */ - public void onServiceConnected(); + public void onServiceConnected(BluetoothPbap proxy); /** * Called to notify the client that this proxy object has been @@ -108,12 +110,54 @@ public interface ServiceListener { public void onServiceDisconnected(); } + final private IBluetoothStateChangeCallback mBluetoothStateChangeCallback = + new IBluetoothStateChangeCallback.Stub() { + public void onBluetoothStateChange(boolean up) { + if (DBG) Log.d(TAG, "onBluetoothStateChange: up=" + up); + if (!up) { + if (VDBG) Log.d(TAG,"Unbinding service..."); + synchronized (mConnection) { + try { + mService = null; + mContext.unbindService(mConnection); + } catch (Exception re) { + Log.e(TAG,"",re); + } + } + } else { + synchronized (mConnection) { + try { + if (mService == null) { + if (VDBG) Log.d(TAG,"Binding service..."); + if (!mContext.bindService( + new Intent(IBluetoothPbap.class.getName()), + mConnection, 0)) { + Log.e(TAG, "Could not bind to Bluetooth PBAP Service"); + } + } + } catch (Exception re) { + Log.e(TAG,"",re); + } + } + } + } + }; + /** * Create a BluetoothPbap proxy object. */ public BluetoothPbap(Context context, ServiceListener l) { mContext = context; mServiceListener = l; + mAdapter = BluetoothAdapter.getDefaultAdapter(); + IBluetoothManager mgr = mAdapter.getBluetoothManager(); + if (mgr != null) { + try { + mgr.registerStateChangeCallback(mBluetoothStateChangeCallback); + } catch (RemoteException e) { + Log.e(TAG,"",e); + } + } if (!context.bindService(new Intent(IBluetoothPbap.class.getName()), mConnection, 0)) { Log.e(TAG, "Could not bind to Bluetooth Pbap Service"); } @@ -134,9 +178,25 @@ protected void finalize() throws Throwable { * are ok. */ public synchronized void close() { - if (mConnection != null) { - mContext.unbindService(mConnection); - mConnection = null; + IBluetoothManager mgr = mAdapter.getBluetoothManager(); + if (mgr != null) { + try { + mgr.unregisterStateChangeCallback(mBluetoothStateChangeCallback); + } catch (Exception e) { + Log.e(TAG,"",e); + } + } + + synchronized (mConnection) { + if (mService != null) { + try { + mService = null; + mContext.unbindService(mConnection); + mConnection = null; + } catch (Exception re) { + Log.e(TAG,"",re); + } + } } mServiceListener = null; } @@ -147,7 +207,7 @@ public synchronized void close() { * object is currently not connected to the Pbap service. */ public int getState() { - if (DBG) log("getState()"); + if (VDBG) log("getState()"); if (mService != null) { try { return mService.getState(); @@ -166,7 +226,7 @@ public int getState() { * the Pbap service. */ public BluetoothDevice getClient() { - if (DBG) log("getClient()"); + if (VDBG) log("getClient()"); if (mService != null) { try { return mService.getClient(); @@ -184,7 +244,7 @@ public BluetoothDevice getClient() { * object is not currently connected to the Pbap service. */ public boolean isConnected(BluetoothDevice device) { - if (DBG) log("isConnected(" + device + ")"); + if (VDBG) log("isConnected(" + device + ")"); if (mService != null) { try { return mService.isConnected(device); @@ -240,7 +300,7 @@ public void onServiceConnected(ComponentName className, IBinder service) { if (DBG) log("Proxy object connected"); mService = IBluetoothPbap.Stub.asInterface(service); if (mServiceListener != null) { - mServiceListener.onServiceConnected(); + mServiceListener.onServiceConnected(BluetoothPbap.this); } } public void onServiceDisconnected(ComponentName className) { diff --git a/core/java/android/bluetooth/BluetoothProfile.java b/core/java/android/bluetooth/BluetoothProfile.java old mode 100644 new mode 100755 diff --git a/core/java/android/bluetooth/BluetoothProfileState.java b/core/java/android/bluetooth/BluetoothProfileState.java deleted file mode 100644 index b0c0a0bc46390..0000000000000 --- a/core/java/android/bluetooth/BluetoothProfileState.java +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Copyright (C) 2010 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package android.bluetooth; - -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; -import android.content.IntentFilter; -import android.os.Message; -import android.util.Log; - -import com.android.internal.util.State; -import com.android.internal.util.StateMachine; - -/** - * This state machine is used to serialize the connections - * to a particular profile. Currently, we only allow one device - * to be connected to a particular profile. - * States: - * {@link StableState} : No pending commands. Send the - * command to the appropriate remote device specific state machine. - * - * {@link PendingCommandState} : A profile connection / disconnection - * command is being executed. This will result in a profile state - * change. Defer all commands. - * @hide - */ - -public class BluetoothProfileState extends StateMachine { - private static final boolean DBG = true; - private static final String TAG = "BluetoothProfileState"; - - public static final int HFP = 0; - public static final int A2DP = 1; - public static final int HID = 2; - - static final int TRANSITION_TO_STABLE = 100; - - private int mProfile; - private BluetoothDevice mPendingDevice; - private PendingCommandState mPendingCommandState = new PendingCommandState(); - private StableState mStableState = new StableState(); - - private BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() { - @Override - public void onReceive(Context context, Intent intent) { - String action = intent.getAction(); - BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE); - if (device == null) { - return; - } - if (action.equals(BluetoothHeadset.ACTION_CONNECTION_STATE_CHANGED)) { - int newState = intent.getIntExtra(BluetoothProfile.EXTRA_STATE, 0); - if (mProfile == HFP && (newState == BluetoothProfile.STATE_CONNECTED || - newState == BluetoothProfile.STATE_DISCONNECTED)) { - sendMessage(TRANSITION_TO_STABLE); - } - } else if (action.equals(BluetoothA2dp.ACTION_CONNECTION_STATE_CHANGED)) { - int newState = intent.getIntExtra(BluetoothProfile.EXTRA_STATE, 0); - if (mProfile == A2DP && (newState == BluetoothProfile.STATE_CONNECTED || - newState == BluetoothProfile.STATE_DISCONNECTED)) { - sendMessage(TRANSITION_TO_STABLE); - } - } else if (action.equals(BluetoothInputDevice.ACTION_CONNECTION_STATE_CHANGED)) { - int newState = intent.getIntExtra(BluetoothProfile.EXTRA_STATE, 0); - if (mProfile == HID && (newState == BluetoothProfile.STATE_CONNECTED || - newState == BluetoothProfile.STATE_DISCONNECTED)) { - sendMessage(TRANSITION_TO_STABLE); - } - } else if (action.equals(BluetoothDevice.ACTION_ACL_DISCONNECTED)) { - if (device.equals(mPendingDevice)) { - sendMessage(TRANSITION_TO_STABLE); - } - } - } - }; - - public BluetoothProfileState(Context context, int profile) { - super("BluetoothProfileState:" + profile); - mProfile = profile; - addState(mStableState); - addState(mPendingCommandState); - setInitialState(mStableState); - - IntentFilter filter = new IntentFilter(); - filter.addAction(BluetoothA2dp.ACTION_CONNECTION_STATE_CHANGED); - filter.addAction(BluetoothHeadset.ACTION_CONNECTION_STATE_CHANGED); - filter.addAction(BluetoothInputDevice.ACTION_CONNECTION_STATE_CHANGED); - filter.addAction(BluetoothDevice.ACTION_ACL_DISCONNECTED); - context.registerReceiver(mBroadcastReceiver, filter); - } - - private class StableState extends State { - @Override - public void enter() { - log("Entering Stable State"); - mPendingDevice = null; - } - - @Override - public boolean processMessage(Message msg) { - if (msg.what != TRANSITION_TO_STABLE) { - transitionTo(mPendingCommandState); - } - return true; - } - } - - private class PendingCommandState extends State { - @Override - public void enter() { - log("Entering PendingCommandState State"); - dispatchMessage(getCurrentMessage()); - } - - @Override - public boolean processMessage(Message msg) { - if (msg.what == TRANSITION_TO_STABLE) { - transitionTo(mStableState); - } else { - dispatchMessage(msg); - } - return true; - } - - private void dispatchMessage(Message msg) { - BluetoothDeviceProfileState deviceProfileMgr = - (BluetoothDeviceProfileState)msg.obj; - int cmd = msg.arg1; - if (mPendingDevice == null || mPendingDevice.equals(deviceProfileMgr.getDevice())) { - mPendingDevice = deviceProfileMgr.getDevice(); - deviceProfileMgr.sendMessage(cmd); - } else { - Message deferMsg = new Message(); - deferMsg.arg1 = cmd; - deferMsg.obj = deviceProfileMgr; - deferMessage(deferMsg); - } - } - } - - private void log(String message) { - if (DBG) { - Log.i(TAG, "Message:" + message); - } - } -} diff --git a/core/java/android/bluetooth/BluetoothServerSocket.java b/core/java/android/bluetooth/BluetoothServerSocket.java index 4021f7b61affc..96be8a2fb679e 100644 --- a/core/java/android/bluetooth/BluetoothServerSocket.java +++ b/core/java/android/bluetooth/BluetoothServerSocket.java @@ -17,6 +17,8 @@ package android.bluetooth; import android.os.Handler; +import android.os.Message; +import android.os.ParcelUuid; import java.io.Closeable; import java.io.IOException; @@ -85,6 +87,22 @@ public final class BluetoothServerSocket implements Closeable { mSocket = new BluetoothSocket(type, -1, auth, encrypt, null, port, null); } + /** + * Construct a socket for incoming connections. + * @param type type of socket + * @param auth require the remote device to be authenticated + * @param encrypt require the connection to be encrypted + * @param uuid uuid + * @throws IOException On error, for example Bluetooth not available, or + * insufficient privileges + */ + /*package*/ BluetoothServerSocket(int type, boolean auth, boolean encrypt, ParcelUuid uuid) + throws IOException { + mSocket = new BluetoothSocket(type, -1, auth, encrypt, null, -1, uuid); + mChannel = mSocket.getPort(); + } + + /** * Block until a connection is established. *

      Returns a connected {@link BluetoothSocket} on successful connection. @@ -133,7 +151,9 @@ public void close() throws IOException { mHandler = handler; mMessage = message; } - + /*package*/ void setServiceName(String ServiceName) { + mSocket.setServiceName(ServiceName); + } /** * Returns the channel on which this socket is bound. * @hide diff --git a/core/java/android/bluetooth/BluetoothSocket.java b/core/java/android/bluetooth/BluetoothSocket.java index 19d13ef345522..26bde197acdfa 100644 --- a/core/java/android/bluetooth/BluetoothSocket.java +++ b/core/java/android/bluetooth/BluetoothSocket.java @@ -1,5 +1,5 @@ /* - * 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. @@ -16,17 +16,25 @@ package android.bluetooth; -import android.bluetooth.IBluetoothCallback; +import android.os.IBinder; import android.os.ParcelUuid; +import android.os.ParcelFileDescriptor; import android.os.RemoteException; +import android.os.ServiceManager; import android.util.Log; import java.io.Closeable; +import java.io.FileDescriptor; +import java.io.FileInputStream; +import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; -import java.util.concurrent.locks.ReentrantReadWriteLock; - +import java.util.List; +import java.util.UUID; +import android.net.LocalSocket; +import java.nio.ByteOrder; +import java.nio.ByteBuffer; /** * A connected or connecting Bluetooth socket. * @@ -77,6 +85,8 @@ */ public final class BluetoothSocket implements Closeable { private static final String TAG = "BluetoothSocket"; + private static final boolean DBG = true; + private static final boolean VDBG = false; /** @hide */ public static final int MAX_RFCOMM_CHANNEL = 30; @@ -89,31 +99,40 @@ public final class BluetoothSocket implements Closeable { /*package*/ static final int EBADFD = 77; /*package*/ static final int EADDRINUSE = 98; + /*package*/ static final int SEC_FLAG_ENCRYPT = 1; + /*package*/ static final int SEC_FLAG_AUTH = 1 << 1; + private final int mType; /* one of TYPE_RFCOMM etc */ - private final BluetoothDevice mDevice; /* remote device */ - private final String mAddress; /* remote address */ + private BluetoothDevice mDevice; /* remote device */ + private String mAddress; /* remote address */ private final boolean mAuth; private final boolean mEncrypt; private final BluetoothInputStream mInputStream; private final BluetoothOutputStream mOutputStream; - private final SdpHelper mSdp; - + private final ParcelUuid mUuid; + private ParcelFileDescriptor mPfd; + private LocalSocket mSocket; + private InputStream mSocketIS; + private OutputStream mSocketOS; private int mPort; /* RFCOMM channel or L2CAP psm */ + private int mFd; + private String mServiceName; + private static int PROXY_CONNECTION_TIMEOUT = 5000; + + private static int SOCK_SIGNAL_SIZE = 16; private enum SocketState { INIT, CONNECTED, - CLOSED + LISTENING, + CLOSED, } /** prevents all native calls after destroyNative() */ - private SocketState mSocketState; + private volatile SocketState mSocketState; /** protects mSocketState */ - private final ReentrantReadWriteLock mLock; - - /** used by native code only */ - private int mSocketData; + //private final ReentrantReadWriteLock mLock; /** * Construct a BluetoothSocket. @@ -134,33 +153,54 @@ private enum SocketState { throw new IOException("Invalid RFCOMM channel: " + port); } } - if (uuid == null) { - mPort = port; - mSdp = null; - } else { - mSdp = new SdpHelper(device, uuid); - mPort = -1; - } + if(uuid != null) + mUuid = uuid; + else mUuid = new ParcelUuid(new UUID(0, 0)); mType = type; mAuth = auth; mEncrypt = encrypt; mDevice = device; + mPort = port; + mFd = fd; + + mSocketState = SocketState.INIT; + if (device == null) { - mAddress = null; + // Server socket + mAddress = BluetoothAdapter.getDefaultAdapter().getAddress(); } else { + // Remote socket mAddress = device.getAddress(); } - if (fd == -1) { - initSocketNative(); - } else { - initSocketFromFdNative(fd); - } mInputStream = new BluetoothInputStream(this); mOutputStream = new BluetoothOutputStream(this); - mSocketState = SocketState.INIT; - mLock = new ReentrantReadWriteLock(); } - + private BluetoothSocket(BluetoothSocket s) { + mUuid = s.mUuid; + mType = s.mType; + mAuth = s.mAuth; + mEncrypt = s.mEncrypt; + mPort = s.mPort; + mInputStream = new BluetoothInputStream(this); + mOutputStream = new BluetoothOutputStream(this); + mServiceName = s.mServiceName; + } + private BluetoothSocket acceptSocket(String RemoteAddr) throws IOException { + BluetoothSocket as = new BluetoothSocket(this); + as.mSocketState = SocketState.CONNECTED; + FileDescriptor[] fds = mSocket.getAncillaryFileDescriptors(); + if (VDBG) Log.d(TAG, "socket fd passed by stack fds: " + fds); + if(fds == null || fds.length != 1) { + Log.e(TAG, "socket fd passed from stack failed, fds: " + fds); + throw new IOException("bt socket acept failed"); + } + as.mSocket = new LocalSocket(fds[0]); + as.mSocketIS = as.mSocket.getInputStream(); + as.mSocketOS = as.mSocket.getOutputStream(); + as.mAddress = RemoteAddr; + as.mDevice = BluetoothAdapter.getDefaultAdapter().getRemoteDevice(RemoteAddr); + return as; + } /** * Construct a BluetoothSocket from address. Used by native code. * @param type type of socket @@ -186,67 +226,13 @@ protected void finalize() throws Throwable { super.finalize(); } } - - /** - * Attempt to connect to a remote device. - *

      This method will block until a connection is made or the connection - * fails. If this method returns without an exception then this socket - * is now connected. - *

      Creating new connections to - * remote Bluetooth devices should not be attempted while device discovery - * is in progress. Device discovery is a heavyweight procedure on the - * Bluetooth adapter and will significantly slow a device connection. - * Use {@link BluetoothAdapter#cancelDiscovery()} to cancel an ongoing - * discovery. Discovery is not managed by the Activity, - * but is run as a system service, so an application should always call - * {@link BluetoothAdapter#cancelDiscovery()} even if it - * did not directly request a discovery, just to be sure. - *

      {@link #close} can be used to abort this call from another thread. - * @throws IOException on error, for example connection failure - */ - public void connect() throws IOException { - mLock.readLock().lock(); - try { - if (mSocketState == SocketState.CLOSED) throw new IOException("socket closed"); - - if (mSdp != null) { - mPort = mSdp.doSdp(); // blocks - } - - connectNative(); // blocks - mSocketState = SocketState.CONNECTED; - } finally { - mLock.readLock().unlock(); - } - } - - /** - * Immediately close this socket, and release all associated resources. - *

      Causes blocked calls on this socket in other threads to immediately - * throw an IOException. - */ - public void close() throws IOException { - // abort blocking operations on the socket - mLock.readLock().lock(); - try { - if (mSocketState == SocketState.CLOSED) return; - if (mSdp != null) { - mSdp.cancel(); - } - abortNative(); - } finally { - mLock.readLock().unlock(); - } - - // all native calls are guaranteed to immediately return after - // abortNative(), so this lock should immediately acquire - mLock.writeLock().lock(); - try { - mSocketState = SocketState.CLOSED; - destroyNative(); - } finally { - mLock.writeLock().unlock(); - } + private int getSecurityFlags() { + int flags = 0; + if(mAuth) + flags |= SEC_FLAG_AUTH; + if(mEncrypt) + flags |= SEC_FLAG_ENCRYPT; + return flags; } /** @@ -286,137 +272,236 @@ public OutputStream getOutputStream() throws IOException { * false if not connected */ public boolean isConnected() { - return (mSocketState == SocketState.CONNECTED); + return mSocketState == SocketState.CONNECTED; + } + + /*package*/ void setServiceName(String name) { + mServiceName = name; } /** - * Currently returns unix errno instead of throwing IOException, - * so that BluetoothAdapter can check the error code for EADDRINUSE + * Attempt to connect to a remote device. + *

      This method will block until a connection is made or the connection + * fails. If this method returns without an exception then this socket + * is now connected. + *

      Creating new connections to + * remote Bluetooth devices should not be attempted while device discovery + * is in progress. Device discovery is a heavyweight procedure on the + * Bluetooth adapter and will significantly slow a device connection. + * Use {@link BluetoothAdapter#cancelDiscovery()} to cancel an ongoing + * discovery. Discovery is not managed by the Activity, + * but is run as a system service, so an application should always call + * {@link BluetoothAdapter#cancelDiscovery()} even if it + * did not directly request a discovery, just to be sure. + *

      {@link #close} can be used to abort this call from another thread. + * @throws IOException on error, for example connection failure */ - /*package*/ int bindListen() { - mLock.readLock().lock(); - try { - if (mSocketState == SocketState.CLOSED) return EBADFD; - return bindListenNative(); - } finally { - mLock.readLock().unlock(); - } - } + public void connect() throws IOException { + if (mDevice == null) throw new IOException("Connect is called on null device"); - /*package*/ BluetoothSocket accept(int timeout) throws IOException { - mLock.readLock().lock(); try { + // TODO(BT) derive flag from auth and encrypt if (mSocketState == SocketState.CLOSED) throw new IOException("socket closed"); - - BluetoothSocket acceptedSocket = acceptNative(timeout); - mSocketState = SocketState.CONNECTED; - return acceptedSocket; - } finally { - mLock.readLock().unlock(); + IBluetooth bluetoothProxy = BluetoothAdapter.getDefaultAdapter().getBluetoothService(null); + if (bluetoothProxy == null) throw new IOException("Bluetooth is off"); + mPfd = bluetoothProxy.connectSocket(mDevice, mType, + mUuid, mPort, getSecurityFlags()); + synchronized(this) + { + if (DBG) Log.d(TAG, "connect(), SocketState: " + mSocketState + ", mPfd: " + mPfd); + if (mSocketState == SocketState.CLOSED) throw new IOException("socket closed"); + if (mPfd == null) throw new IOException("bt socket connect failed"); + FileDescriptor fd = mPfd.getFileDescriptor(); + mSocket = new LocalSocket(fd); + mSocketIS = mSocket.getInputStream(); + mSocketOS = mSocket.getOutputStream(); + } + int channel = readInt(mSocketIS); + if (channel <= 0) + throw new IOException("bt socket connect failed"); + mPort = channel; + waitSocketSignal(mSocketIS); + synchronized(this) + { + if (mSocketState == SocketState.CLOSED) + throw new IOException("bt socket closed"); + mSocketState = SocketState.CONNECTED; + } + } catch (RemoteException e) { + Log.e(TAG, Log.getStackTraceString(new Throwable())); } } - /*package*/ int available() throws IOException { - mLock.readLock().lock(); + /** + * Currently returns unix errno instead of throwing IOException, + * so that BluetoothAdapter can check the error code for EADDRINUSE + */ + /*package*/ int bindListen() { + int ret; + if (mSocketState == SocketState.CLOSED) return EBADFD; + IBluetooth bluetoothProxy = BluetoothAdapter.getDefaultAdapter().getBluetoothService(null); + if (bluetoothProxy == null) { + Log.e(TAG, "bindListen fail, reason: bluetooth is off"); + return -1; + } try { - if (mSocketState == SocketState.CLOSED) throw new IOException("socket closed"); - return availableNative(); - } finally { - mLock.readLock().unlock(); + mPfd = bluetoothProxy.createSocketChannel(mType, mServiceName, + mUuid, mPort, getSecurityFlags()); + } catch (RemoteException e) { + Log.e(TAG, Log.getStackTraceString(new Throwable())); + // TODO(BT) right error code? + return -1; } - } - /*package*/ int read(byte[] b, int offset, int length) throws IOException { - mLock.readLock().lock(); + // read out port number try { - if (mSocketState == SocketState.CLOSED) throw new IOException("socket closed"); - return readNative(b, offset, length); - } finally { - mLock.readLock().unlock(); + synchronized(this) { + if (VDBG) Log.d(TAG, "bindListen(), SocketState: " + mSocketState + ", mPfd: " + + mPfd); + if(mSocketState != SocketState.INIT) return EBADFD; + if(mPfd == null) return -1; + FileDescriptor fd = mPfd.getFileDescriptor(); + if (VDBG) Log.d(TAG, "bindListen(), new LocalSocket "); + mSocket = new LocalSocket(fd); + if (VDBG) Log.d(TAG, "bindListen(), new LocalSocket.getInputStream() "); + mSocketIS = mSocket.getInputStream(); + mSocketOS = mSocket.getOutputStream(); + } + if (VDBG) Log.d(TAG, "bindListen(), readInt mSocketIS: " + mSocketIS); + int channel = readInt(mSocketIS); + synchronized(this) { + if(mSocketState == SocketState.INIT) + mSocketState = SocketState.LISTENING; + } + if (VDBG) Log.d(TAG, "channel: " + channel); + if (mPort == -1) { + mPort = channel; + } // else ASSERT(mPort == channel) + ret = 0; + } catch (IOException e) { + Log.e(TAG, "bindListen, fail to get port number, exception: " + e); + return -1; } + return ret; } - /*package*/ int write(byte[] b, int offset, int length) throws IOException { - mLock.readLock().lock(); - try { - if (mSocketState == SocketState.CLOSED) throw new IOException("socket closed"); - return writeNative(b, offset, length); - } finally { - mLock.readLock().unlock(); + /*package*/ BluetoothSocket accept(int timeout) throws IOException { + BluetoothSocket acceptedSocket; + if (mSocketState != SocketState.LISTENING) throw new IOException("bt socket is not in listen state"); + // TODO(BT) wait on an incoming connection + String RemoteAddr = waitSocketSignal(mSocketIS); + synchronized(this) + { + if (mSocketState != SocketState.LISTENING) + throw new IOException("bt socket is not in listen state"); + acceptedSocket = acceptSocket(RemoteAddr); + //quick drop the reference of the file handle } + // TODO(BT) rfcomm socket only supports one connection, return this? + // return this; + return acceptedSocket; } - private native void initSocketNative() throws IOException; - private native void initSocketFromFdNative(int fd) throws IOException; - private native void connectNative() throws IOException; - private native int bindListenNative(); - private native BluetoothSocket acceptNative(int timeout) throws IOException; - private native int availableNative() throws IOException; - private native int readNative(byte[] b, int offset, int length) throws IOException; - private native int writeNative(byte[] b, int offset, int length) throws IOException; - private native void abortNative() throws IOException; - private native void destroyNative() throws IOException; - /** - * Throws an IOException for given posix errno. Done natively so we can - * use strerr to convert to string error. - */ - /*package*/ native void throwErrnoNative(int errno) throws IOException; + /*package*/ int available() throws IOException { + if (VDBG) Log.d(TAG, "available: " + mSocketIS); + return mSocketIS.available(); + } - /** - * Helper to perform blocking SDP lookup. - */ - private static class SdpHelper extends IBluetoothCallback.Stub { - private final IBluetooth service; - private final ParcelUuid uuid; - private final BluetoothDevice device; - private int channel; - private boolean canceled; - public SdpHelper(BluetoothDevice device, ParcelUuid uuid) { - service = BluetoothDevice.getService(); - this.device = device; - this.uuid = uuid; - canceled = false; - } - /** - * Returns the RFCOMM channel for the UUID, or throws IOException - * on failure. - */ - public synchronized int doSdp() throws IOException { - if (canceled) throw new IOException("Service discovery canceled"); - channel = -1; + /*package*/ int read(byte[] b, int offset, int length) throws IOException { - boolean inProgress = false; - try { - inProgress = service.fetchRemoteUuids(device.getAddress(), uuid, this); - } catch (RemoteException e) {Log.e(TAG, "", e);} + if (VDBG) Log.d(TAG, "read in: " + mSocketIS + " len: " + length); + int ret = mSocketIS.read(b, offset, length); + if(ret < 0) + throw new IOException("bt socket closed, read return: " + ret); + if (VDBG) Log.d(TAG, "read out: " + mSocketIS + " ret: " + ret); + return ret; + } - if (!inProgress) throw new IOException("Unable to start Service Discovery"); + /*package*/ int write(byte[] b, int offset, int length) throws IOException { - try { - /* 12 second timeout as a precaution - onRfcommChannelFound - * should always occur before the timeout */ - wait(12000); // block + if (VDBG) Log.d(TAG, "write: " + mSocketOS + " length: " + length); + mSocketOS.write(b, offset, length); + // There is no good way to confirm since the entire process is asynchronous anyway + if (VDBG) Log.d(TAG, "write out: " + mSocketOS + " length: " + length); + return length; + } - } catch (InterruptedException e) {} + @Override + public void close() throws IOException { + Log.d(TAG, "close() in, this: " + this + ", channel: " + mPort + ", state: " + mSocketState); + if(mSocketState == SocketState.CLOSED) + return; + else + { + synchronized(this) + { + if(mSocketState == SocketState.CLOSED) + return; + mSocketState = SocketState.CLOSED; + if (VDBG) Log.d(TAG, "close() this: " + this + ", channel: " + mPort + ", mSocketIS: " + mSocketIS + + ", mSocketOS: " + mSocketOS + "mSocket: " + mSocket); + if(mSocket != null) { + if (VDBG) Log.d(TAG, "Closing mSocket: " + mSocket); + mSocket.shutdownInput(); + mSocket.shutdownOutput(); + mSocket.close(); + mSocket = null; + } + if(mPfd != null) + mPfd.detachFd(); + } + } + // TODO(BT) unbind proxy, + } - if (canceled) throw new IOException("Service discovery canceled"); - if (channel < 1) throw new IOException("Service discovery failed"); + /*package */ void removeChannel() { + } - return channel; - } - /** Object cannot be re-used after calling cancel() */ - public synchronized void cancel() { - if (!canceled) { - canceled = true; - channel = -1; - notifyAll(); // unblock - } - } - public synchronized void onRfcommChannelFound(int channel) { - if (!canceled) { - this.channel = channel; - notifyAll(); // unblock - } + /*package */ int getPort() { + return mPort; + } + private String convertAddr(final byte[] addr) { + return String.format("%02X:%02X:%02X:%02X:%02X:%02X", + addr[0] , addr[1], addr[2], addr[3] , addr[4], addr[5]); + } + private String waitSocketSignal(InputStream is) throws IOException { + byte [] sig = new byte[SOCK_SIGNAL_SIZE]; + int ret = readAll(is, sig); + if (VDBG) Log.d(TAG, "waitSocketSignal read 16 bytes signal ret: " + ret); + ByteBuffer bb = ByteBuffer.wrap(sig); + bb.order(ByteOrder.nativeOrder()); + int size = bb.getShort(); + byte [] addr = new byte[6]; + bb.get(addr); + int channel = bb.getInt(); + int status = bb.getInt(); + String RemoteAddr = convertAddr(addr); + if (VDBG) Log.d(TAG, "waitSocketSignal: sig size: " + size + ", remote addr: " + + RemoteAddr + ", channel: " + channel + ", status: " + status); + if(status != 0) + throw new IOException("Connection failure, status: " + status); + return RemoteAddr; + } + private int readAll(InputStream is, byte[] b) throws IOException { + int left = b.length; + while(left > 0) { + int ret = is.read(b, b.length - left, left); + if(ret <= 0) + throw new IOException("read failed, socket might closed, read ret: " + ret); + left -= ret; + if(left != 0) + Log.w(TAG, "readAll() looping, read partial size: " + (b.length - left) + + ", expect size: " + b.length); } + return b.length; + } + + private int readInt(InputStream is) throws IOException { + byte[] ibytes = new byte[4]; + int ret = readAll(is, ibytes); + if (VDBG) Log.d(TAG, "inputStream.read ret: " + ret); + ByteBuffer bb = ByteBuffer.wrap(ibytes); + bb.order(ByteOrder.nativeOrder()); + return bb.getInt(); } } diff --git a/core/java/android/bluetooth/BluetoothTetheringDataTracker.java b/core/java/android/bluetooth/BluetoothTetheringDataTracker.java index 83d1bda82100f..063e5a8a46672 100644 --- a/core/java/android/bluetooth/BluetoothTetheringDataTracker.java +++ b/core/java/android/bluetooth/BluetoothTetheringDataTracker.java @@ -16,6 +16,9 @@ package android.bluetooth; +import android.os.IBinder; +import android.os.ServiceManager; +import android.os.INetworkManagementService; import android.content.Context; import android.net.ConnectivityManager; import android.net.DhcpInfoInternal; @@ -28,6 +31,11 @@ import android.os.Handler; import android.os.Message; import android.util.Log; +import java.net.InterfaceAddress; +import android.net.LinkAddress; +import android.net.RouteInfo; +import java.net.Inet4Address; +import android.os.SystemProperties; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; @@ -43,6 +51,8 @@ public class BluetoothTetheringDataTracker implements NetworkStateTracker { private static final String NETWORKTYPE = "BLUETOOTH_TETHER"; private static final String TAG = "BluetoothTethering"; + private static final boolean DBG = true; + private static final boolean VDBG = false; private AtomicBoolean mTeardownRequested = new AtomicBoolean(false); private AtomicBoolean mPrivateDnsRouteSet = new AtomicBoolean(false); @@ -54,9 +64,8 @@ public class BluetoothTetheringDataTracker implements NetworkStateTracker { private NetworkInfo mNetworkInfo; private BluetoothPan mBluetoothPan; - private BluetoothDevice mDevice; private static String mIface; - + private Thread mDhcpThread; /* For sending events to connectivity service handler */ private Handler mCsHandler; private Context mContext; @@ -92,8 +101,10 @@ public boolean isTeardownRequested() { * Begin monitoring connectivity */ public void startMonitoring(Context context, Handler target) { + if (DBG) Log.d(TAG, "startMonitoring: target: " + target); mContext = context; mCsHandler = target; + if (VDBG) Log.d(TAG, "startMonitoring: mCsHandler: " + mCsHandler); BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter(); if (adapter != null) { adapter.getProfileProxy(mContext, mProfileServiceListener, BluetoothProfile.PAN); @@ -124,6 +135,11 @@ public boolean teardown() { return true; } + @Override + public void captivePortalCheckComplete() { + // not implemented + } + /** * Re-enable connectivity to a network after a {@link #teardown()}. */ @@ -259,38 +275,91 @@ public String getTcpBufferSizesPropName() { return "net.tcp.buffersize.wifi"; } + private static short countPrefixLength(byte [] mask) { + short count = 0; + for (byte b : mask) { + for (int i = 0; i < 8; ++i) { + if ((b & (1 << i)) != 0) { + ++count; + } + } + } + return count; + } + - public synchronized void startReverseTether(String iface, BluetoothDevice device) { + private boolean readLinkProperty(String iface) { + String DhcpPrefix = "dhcp." + iface + "."; + String ip = SystemProperties.get(DhcpPrefix + "ipaddress"); + String dns1 = SystemProperties.get(DhcpPrefix + "dns1"); + String dns2 = SystemProperties.get(DhcpPrefix + "dns2"); + String gateway = SystemProperties.get(DhcpPrefix + "gateway"); + String mask = SystemProperties.get(DhcpPrefix + "mask"); + if(ip.isEmpty() || gateway.isEmpty()) { + Log.e(TAG, "readLinkProperty, ip: " + ip + ", gateway: " + gateway + ", can not be empty"); + return false; + } + int PrefixLen = countPrefixLength(NetworkUtils.numericToInetAddress(mask).getAddress()); + mLinkProperties.addLinkAddress(new LinkAddress(NetworkUtils.numericToInetAddress(ip), PrefixLen)); + RouteInfo ri = new RouteInfo(NetworkUtils.numericToInetAddress(gateway)); + mLinkProperties.addRoute(ri); + if(!dns1.isEmpty()) + mLinkProperties.addDns(NetworkUtils.numericToInetAddress(dns1)); + if(!dns2.isEmpty()) + mLinkProperties.addDns(NetworkUtils.numericToInetAddress(dns2)); + mLinkProperties.setInterfaceName(iface); + return true; + } + public synchronized void startReverseTether(String iface) { mIface = iface; - mDevice = device; - Thread dhcpThread = new Thread(new Runnable() { + if (DBG) Log.d(TAG, "startReverseTether mCsHandler: " + mCsHandler); + mDhcpThread = new Thread(new Runnable() { public void run() { //TODO(): Add callbacks for failure and success case. //Currently this thread runs independently. - DhcpInfoInternal dhcpInfoInternal = new DhcpInfoInternal(); - if (!NetworkUtils.runDhcp(mIface, dhcpInfoInternal)) { - Log.e(TAG, "DHCP request error:" + NetworkUtils.getDhcpError()); - return; + if (DBG) Log.d(TAG, "startReverseTether mCsHandler: " + mCsHandler); + String DhcpResultName = "dhcp." + mIface + ".result";; + String result = ""; + if (VDBG) Log.d(TAG, "waiting for change of sys prop dhcp result: " + DhcpResultName); + for(int i = 0; i < 30*5; i++) { + try { Thread.sleep(200); } catch (InterruptedException ie) { return;} + result = SystemProperties.get(DhcpResultName); + if (VDBG) Log.d(TAG, "read " + DhcpResultName + ": " + result); + if(result.equals("failed")) { + Log.e(TAG, "startReverseTether, failed to start dhcp service"); + return; + } + if(result.equals("ok")) { + if (VDBG) Log.d(TAG, "startReverseTether, dhcp resut: " + result); + if(readLinkProperty(mIface)) { + + mNetworkInfo.setIsAvailable(true); + mNetworkInfo.setDetailedState(DetailedState.CONNECTED, null, null); + + if (VDBG) Log.d(TAG, "startReverseTether mCsHandler: " + mCsHandler); + if(mCsHandler != null) { + Message msg = mCsHandler.obtainMessage(EVENT_CONFIGURATION_CHANGED, mNetworkInfo); + msg.sendToTarget(); + + msg = mCsHandler.obtainMessage(EVENT_STATE_CHANGED, mNetworkInfo); + msg.sendToTarget(); + } + } + return; + } } - mLinkProperties = dhcpInfoInternal.makeLinkProperties(); - mLinkProperties.setInterfaceName(mIface); - - mNetworkInfo.setIsAvailable(true); - mNetworkInfo.setDetailedState(DetailedState.CONNECTED, null, null); - - Message msg = mCsHandler.obtainMessage(EVENT_CONFIGURATION_CHANGED, mNetworkInfo); - msg.sendToTarget(); - - msg = mCsHandler.obtainMessage(EVENT_STATE_CHANGED, mNetworkInfo); - msg.sendToTarget(); + Log.e(TAG, "startReverseTether, dhcp failed, resut: " + result); } }); - dhcpThread.start(); + mDhcpThread.start(); } - public synchronized void stopReverseTether(String iface) { - NetworkUtils.stopDhcp(iface); - + public synchronized void stopReverseTether() { + //NetworkUtils.stopDhcp(iface); + if(mDhcpThread != null && mDhcpThread.isAlive()) { + mDhcpThread.interrupt(); + try { mDhcpThread.join(); } catch (InterruptedException ie) { return; } + } mLinkProperties.clear(); mNetworkInfo.setIsAvailable(false); mNetworkInfo.setDetailedState(DetailedState.DISCONNECTED, null, null); diff --git a/core/java/android/bluetooth/BluetoothUuid.java b/core/java/android/bluetooth/BluetoothUuid.java index 596223518146e..1a0bd0202b12a 100644 --- a/core/java/android/bluetooth/BluetoothUuid.java +++ b/core/java/android/bluetooth/BluetoothUuid.java @@ -56,6 +56,10 @@ public final class BluetoothUuid { ParcelUuid.fromString("00001105-0000-1000-8000-00805f9b34fb"); public static final ParcelUuid Hid = ParcelUuid.fromString("00001124-0000-1000-8000-00805f9b34fb"); + public static final ParcelUuid MessageAccessServer = + ParcelUuid.fromString("00001132-0000-1000-8000-00805f9b34fb"); + public static final ParcelUuid MessageNotificationServer = + ParcelUuid.fromString("00001133-0000-1000-8000-00805f9b34fb"); public static final ParcelUuid PANU = ParcelUuid.fromString("00001115-0000-1000-8000-00805F9B34FB"); public static final ParcelUuid NAP = @@ -67,7 +71,7 @@ public final class BluetoothUuid { public static final ParcelUuid[] RESERVED_UUIDS = { AudioSink, AudioSource, AdvAudioDist, HSP, Handsfree, AvrcpController, AvrcpTarget, - ObexObjectPush, PANU, NAP}; + ObexObjectPush, MessageAccessServer, MessageNotificationServer, PANU, NAP}; public static boolean isAudioSource(ParcelUuid uuid) { return uuid.equals(AudioSource); @@ -131,6 +135,14 @@ public static boolean isUuidPresent(ParcelUuid[] uuidArray, ParcelUuid uuid) { return false; } + public static boolean isMessageAccessServer(ParcelUuid uuid) { + return uuid.equals(MessageAccessServer); + } + + public static boolean isMessageNotificationServer(ParcelUuid uuid) { + return uuid.equals(MessageNotificationServer); + } + /** * Returns true if there any common ParcelUuids in uuidA and uuidB. * diff --git a/core/java/android/bluetooth/HeadsetBase.java b/core/java/android/bluetooth/HeadsetBase.java deleted file mode 100644 index 9ef2eb5f3cec8..0000000000000 --- a/core/java/android/bluetooth/HeadsetBase.java +++ /dev/null @@ -1,298 +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. - */ - -package android.bluetooth; - -import android.os.Handler; -import android.os.PowerManager; -import android.os.PowerManager.WakeLock; -import android.util.Log; - -/** - * The Android Bluetooth API is not finalized, and *will* change. Use at your - * own risk. - * - * The base RFCOMM (service) connection for a headset or handsfree device. - * - * In the future this class will be removed. - * - * @hide - */ -public final class HeadsetBase { - private static final String TAG = "Bluetooth HeadsetBase"; - private static final boolean DBG = false; - - public static final int RFCOMM_DISCONNECTED = 1; - - public static final int DIRECTION_INCOMING = 1; - public static final int DIRECTION_OUTGOING = 2; - - private static int sAtInputCount = 0; /* TODO: Consider not using a static variable */ - - private final BluetoothAdapter mAdapter; - private final BluetoothDevice mRemoteDevice; - private final String mAddress; // for native code - private final int mRfcommChannel; - private int mNativeData; - private Thread mEventThread; - private volatile boolean mEventThreadInterrupted; - private Handler mEventThreadHandler; - private int mTimeoutRemainingMs; - private final int mDirection; - private final long mConnectTimestamp; - - protected AtParser mAtParser; - - private WakeLock mWakeLock; // held while processing an AT command - - private native static void classInitNative(); - static { - classInitNative(); - } - - protected void finalize() throws Throwable { - try { - cleanupNativeDataNative(); - releaseWakeLock(); - } finally { - super.finalize(); - } - } - - private native void cleanupNativeDataNative(); - - public HeadsetBase(PowerManager pm, BluetoothAdapter adapter, - BluetoothDevice device, int rfcommChannel) { - mDirection = DIRECTION_OUTGOING; - mConnectTimestamp = System.currentTimeMillis(); - mAdapter = adapter; - mRemoteDevice = device; - mAddress = device.getAddress(); - mRfcommChannel = rfcommChannel; - mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "HeadsetBase"); - mWakeLock.setReferenceCounted(false); - initializeAtParser(); - // Must be called after this.mAddress is set. - initializeNativeDataNative(-1); - } - - /* Create from an existing rfcomm connection */ - public HeadsetBase(PowerManager pm, BluetoothAdapter adapter, - BluetoothDevice device, - int socketFd, int rfcommChannel, Handler handler) { - mDirection = DIRECTION_INCOMING; - mConnectTimestamp = System.currentTimeMillis(); - mAdapter = adapter; - mRemoteDevice = device; - mAddress = device.getAddress(); - mRfcommChannel = rfcommChannel; - mEventThreadHandler = handler; - mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "HeadsetBase"); - mWakeLock.setReferenceCounted(false); - initializeAtParser(); - // Must be called after this.mAddress is set. - initializeNativeDataNative(socketFd); - } - - private native void initializeNativeDataNative(int socketFd); - - /* Process an incoming AT command line - */ - protected void handleInput(String input) { - acquireWakeLock(); - long timestamp; - - synchronized(HeadsetBase.class) { - if (sAtInputCount == Integer.MAX_VALUE) { - sAtInputCount = 0; - } else { - sAtInputCount++; - } - } - - if (DBG) timestamp = System.currentTimeMillis(); - AtCommandResult result = mAtParser.process(input); - if (DBG) Log.d(TAG, "Processing " + input + " took " + - (System.currentTimeMillis() - timestamp) + " ms"); - - if (result.getResultCode() == AtCommandResult.ERROR) { - Log.i(TAG, "Error processing <" + input + ">"); - } - - sendURC(result.toString()); - - releaseWakeLock(); - } - - /** - * Register AT commands that are common to all Headset / Handsets. This - * function is called by the HeadsetBase constructor. - */ - protected void initializeAtParser() { - mAtParser = new AtParser(); - - //TODO(): Get rid of this as there are no parsers registered. But because of dependencies - // it needs to be done as part of refactoring HeadsetBase and BluetoothHandsfree - } - - public AtParser getAtParser() { - return mAtParser; - } - - public void startEventThread() { - mEventThread = - new Thread("HeadsetBase Event Thread") { - public void run() { - int last_read_error; - while (!mEventThreadInterrupted) { - String input = readNative(500); - if (input != null) { - handleInput(input); - } else { - last_read_error = getLastReadStatusNative(); - if (last_read_error != 0) { - Log.i(TAG, "headset read error " + last_read_error); - if (mEventThreadHandler != null) { - mEventThreadHandler.obtainMessage(RFCOMM_DISCONNECTED) - .sendToTarget(); - } - disconnectNative(); - break; - } - } - } - } - }; - mEventThreadInterrupted = false; - mEventThread.start(); - } - - private native String readNative(int timeout_ms); - private native int getLastReadStatusNative(); - - private void stopEventThread() { - mEventThreadInterrupted = true; - mEventThread.interrupt(); - try { - mEventThread.join(); - } catch (java.lang.InterruptedException e) { - // FIXME: handle this, - } - mEventThread = null; - } - - public boolean connect(Handler handler) { - if (mEventThread == null) { - if (!connectNative()) return false; - mEventThreadHandler = handler; - } - return true; - } - private native boolean connectNative(); - - /* - * Returns true when either the asynchronous connect is in progress, or - * the connect is complete. Call waitForAsyncConnect() to find out whether - * the connect is actually complete, or disconnect() to cancel. - */ - - public boolean connectAsync() { - int ret = connectAsyncNative(); - return (ret == 0) ? true : false; - } - private native int connectAsyncNative(); - - public int getRemainingAsyncConnectWaitingTimeMs() { - return mTimeoutRemainingMs; - } - - /* - * Returns 1 when an async connect is complete, 0 on timeout, and -1 on - * error. On error, handler will be called, and you need to re-initiate - * the async connect. - */ - public int waitForAsyncConnect(int timeout_ms, Handler handler) { - int res = waitForAsyncConnectNative(timeout_ms); - if (res > 0) { - mEventThreadHandler = handler; - } - return res; - } - private native int waitForAsyncConnectNative(int timeout_ms); - - public void disconnect() { - if (mEventThread != null) { - stopEventThread(); - } - disconnectNative(); - } - private native void disconnectNative(); - - - /* - * Note that if a remote side disconnects, this method will still return - * true until disconnect() is called. You know when a remote side - * disconnects because you will receive the intent - * IBluetoothService.REMOTE_DEVICE_DISCONNECTED_ACTION. If, when you get - * this intent, method isConnected() returns true, you know that the - * disconnect was initiated by the remote device. - */ - - public boolean isConnected() { - return mEventThread != null; - } - - public BluetoothDevice getRemoteDevice() { - return mRemoteDevice; - } - - public int getDirection() { - return mDirection; - } - - public long getConnectTimestamp() { - return mConnectTimestamp; - } - - public synchronized boolean sendURC(String urc) { - if (urc.length() > 0) { - boolean ret = sendURCNative(urc); - return ret; - } - return true; - } - private native boolean sendURCNative(String urc); - - private synchronized void acquireWakeLock() { - if (!mWakeLock.isHeld()) { - mWakeLock.acquire(); - } - } - - private synchronized void releaseWakeLock() { - if (mWakeLock.isHeld()) { - mWakeLock.release(); - } - } - - public static int getAtInputCount() { - return sAtInputCount; - } - - private static void log(String msg) { - Log.d(TAG, msg); - } -} diff --git a/core/java/android/bluetooth/IBluetooth.aidl b/core/java/android/bluetooth/IBluetooth.aidl index 6075363e51b43..d016c2623be3c 100644 --- a/core/java/android/bluetooth/IBluetooth.aidl +++ b/core/java/android/bluetooth/IBluetooth.aidl @@ -18,9 +18,7 @@ package android.bluetooth; import android.bluetooth.IBluetoothCallback; import android.bluetooth.IBluetoothStateChangeCallback; -import android.bluetooth.IBluetoothHealthCallback; import android.bluetooth.BluetoothDevice; -import android.bluetooth.BluetoothHealthAppConfiguration; import android.os.ParcelUuid; import android.os.ParcelFileDescriptor; @@ -32,15 +30,15 @@ import android.os.ParcelFileDescriptor; interface IBluetooth { boolean isEnabled(); - int getBluetoothState(); + int getState(); boolean enable(); boolean enableNoAutoConnect(); - boolean disable(boolean persistSetting); + boolean disable(); String getAddress(); - String getName(); - boolean setName(in String name); ParcelUuid[] getUuids(); + boolean setName(in String name); + String getName(); int getScanMode(); boolean setScanMode(int mode, int duration); @@ -51,77 +49,34 @@ interface IBluetooth boolean startDiscovery(); boolean cancelDiscovery(); boolean isDiscovering(); - byte[] readOutOfBandData(); int getAdapterConnectionState(); int getProfileConnectionState(int profile); - boolean changeApplicationBluetoothState(boolean on, - in IBluetoothStateChangeCallback callback, in - IBinder b); - - boolean createBond(in String address); - boolean createBondOutOfBand(in String address, in byte[] hash, in byte[] randomizer); - boolean cancelBondProcess(in String address); - boolean removeBond(in String address); - String[] listBonds(); - int getBondState(in String address); - boolean setDeviceOutOfBandData(in String address, in byte[] hash, in byte[] randomizer); - String getRemoteName(in String address); - String getRemoteAlias(in String address); - boolean setRemoteAlias(in String address, in String name); - int getRemoteClass(in String address); - ParcelUuid[] getRemoteUuids(in String address); - boolean fetchRemoteUuids(in String address, in ParcelUuid uuid, in IBluetoothCallback callback); - int getRemoteServiceChannel(in String address, in ParcelUuid uuid); + BluetoothDevice[] getBondedDevices(); + boolean createBond(in BluetoothDevice device); + boolean cancelBondProcess(in BluetoothDevice device); + boolean removeBond(in BluetoothDevice device); + int getBondState(in BluetoothDevice device); - boolean setPin(in String address, in byte[] pin); - boolean setPasskey(in String address, int passkey); - boolean setPairingConfirmation(in String address, boolean confirm); - boolean setRemoteOutOfBandData(in String addres); - boolean cancelPairingUserInput(in String address); + String getRemoteName(in BluetoothDevice device); + String getRemoteAlias(in BluetoothDevice device); + boolean setRemoteAlias(in BluetoothDevice device, in String name); + int getRemoteClass(in BluetoothDevice device); + ParcelUuid[] getRemoteUuids(in BluetoothDevice device); + boolean fetchRemoteUuids(in BluetoothDevice device); - boolean setTrust(in String address, in boolean value); - boolean getTrustState(in String address); - boolean isBluetoothDock(in String address); + boolean setPin(in BluetoothDevice device, boolean accept, int len, in byte[] pinCode); + boolean setPasskey(in BluetoothDevice device, boolean accept, int len, in byte[] + passkey); + boolean setPairingConfirmation(in BluetoothDevice device, boolean accept); - int addRfcommServiceRecord(in String serviceName, in ParcelUuid uuid, int channel, IBinder b); - void removeServiceRecord(int handle); - boolean allowIncomingProfileConnect(in BluetoothDevice device, boolean value); - - boolean connectHeadset(String address); - boolean disconnectHeadset(String address); - boolean notifyIncomingConnection(String address, boolean rejected); - - // HID profile APIs - boolean connectInputDevice(in BluetoothDevice device); - boolean disconnectInputDevice(in BluetoothDevice device); - List getConnectedInputDevices(); - List getInputDevicesMatchingConnectionStates(in int[] states); - int getInputDeviceConnectionState(in BluetoothDevice device); - boolean setInputDevicePriority(in BluetoothDevice device, int priority); - int getInputDevicePriority(in BluetoothDevice device); - - boolean isTetheringOn(); - void setBluetoothTethering(boolean value); - int getPanDeviceConnectionState(in BluetoothDevice device); - List getConnectedPanDevices(); - List getPanDevicesMatchingConnectionStates(in int[] states); - boolean connectPanDevice(in BluetoothDevice device); - boolean disconnectPanDevice(in BluetoothDevice device); + void sendConnectionStateChange(in BluetoothDevice device, int profile, int state, int prevState); - // HDP profile APIs - boolean registerAppConfiguration(in BluetoothHealthAppConfiguration config, - in IBluetoothHealthCallback callback); - boolean unregisterAppConfiguration(in BluetoothHealthAppConfiguration config); - boolean connectChannelToSource(in BluetoothDevice device, in BluetoothHealthAppConfiguration config); - boolean connectChannelToSink(in BluetoothDevice device, in BluetoothHealthAppConfiguration config, - int channelType); - boolean disconnectChannel(in BluetoothDevice device, in BluetoothHealthAppConfiguration config, int id); - ParcelFileDescriptor getMainChannelFd(in BluetoothDevice device, in BluetoothHealthAppConfiguration config); - List getConnectedHealthDevices(); - List getHealthDevicesMatchingConnectionStates(in int[] states); - int getHealthDeviceConnectionState(in BluetoothDevice device); + void registerCallback(in IBluetoothCallback callback); + void unregisterCallback(in IBluetoothCallback callback); - void sendConnectionStateChange(in BluetoothDevice device, int profile, int state, int prevState); + // For Socket + ParcelFileDescriptor connectSocket(in BluetoothDevice device, int type, in ParcelUuid uuid, int port, int flag); + ParcelFileDescriptor createSocketChannel(int type, in String serviceName, in ParcelUuid uuid, int port, int flag); } diff --git a/core/java/android/bluetooth/IBluetoothA2dp.aidl b/core/java/android/bluetooth/IBluetoothA2dp.aidl index 444dd1e95bc72..1f1099868e6e9 100644 --- a/core/java/android/bluetooth/IBluetoothA2dp.aidl +++ b/core/java/android/bluetooth/IBluetoothA2dp.aidl @@ -33,12 +33,4 @@ interface IBluetoothA2dp { boolean setPriority(in BluetoothDevice device, int priority); int getPriority(in BluetoothDevice device); boolean isA2dpPlaying(in BluetoothDevice device); - - // Internal APIs - boolean suspendSink(in BluetoothDevice device); - boolean resumeSink(in BluetoothDevice device); - boolean connectSinkInternal(in BluetoothDevice device); - boolean disconnectSinkInternal(in BluetoothDevice device); - boolean allowIncomingConnect(in BluetoothDevice device, boolean value); - } diff --git a/core/java/android/bluetooth/IBluetoothCallback.aidl b/core/java/android/bluetooth/IBluetoothCallback.aidl index 8edb3f4c4139b..e2809788d67a3 100644 --- a/core/java/android/bluetooth/IBluetoothCallback.aidl +++ b/core/java/android/bluetooth/IBluetoothCallback.aidl @@ -23,5 +23,6 @@ package android.bluetooth; */ interface IBluetoothCallback { - void onRfcommChannelFound(int channel); + //void onRfcommChannelFound(int channel); + void onBluetoothStateChange(int prevState, int newState); } diff --git a/core/java/android/bluetooth/IBluetoothHeadset.aidl b/core/java/android/bluetooth/IBluetoothHeadset.aidl index ec005275bbc52..fc7627ae5c83c 100644 --- a/core/java/android/bluetooth/IBluetoothHeadset.aidl +++ b/core/java/android/bluetooth/IBluetoothHeadset.aidl @@ -40,15 +40,17 @@ interface IBluetoothHeadset { int getBatteryUsageHint(in BluetoothDevice device); // Internal functions, not be made public - boolean createIncomingConnect(in BluetoothDevice device); boolean acceptIncomingConnect(in BluetoothDevice device); boolean rejectIncomingConnect(in BluetoothDevice device); - boolean cancelConnectThread(); - boolean connectHeadsetInternal(in BluetoothDevice device); - boolean disconnectHeadsetInternal(in BluetoothDevice device); - boolean setAudioState(in BluetoothDevice device, int state); int getAudioState(in BluetoothDevice device); + boolean isAudioOn(); + boolean connectAudio(); + boolean disconnectAudio(); boolean startScoUsingVirtualVoiceCall(in BluetoothDevice device); boolean stopScoUsingVirtualVoiceCall(in BluetoothDevice device); + void phoneStateChanged(int numActive, int numHeld, int callState, String number, int type); + void roamChanged(boolean roam); + void clccResponse(int index, int direction, int status, int mode, boolean mpty, + String number, int type); } diff --git a/core/java/android/bluetooth/IBluetoothHeadsetPhone.aidl b/core/java/android/bluetooth/IBluetoothHeadsetPhone.aidl new file mode 100644 index 0000000000000..d5e64f6faeccc --- /dev/null +++ b/core/java/android/bluetooth/IBluetoothHeadsetPhone.aidl @@ -0,0 +1,39 @@ +/* + * 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.bluetooth; + +/** + * API for Bluetooth Headset Phone Service in phone app + * + * {@hide} + */ +interface IBluetoothHeadsetPhone { + // Internal functions, not be made public + boolean answerCall(); + boolean hangupCall(); + boolean sendDtmf(int dtmf); + boolean processChld(int chld); + String getNetworkOperator(); + String getSubscriberNumber(); + boolean listCurrentCalls(); + boolean queryPhoneState(); + + // Internal for phone app to call + void updateBtHandsfreeAfterRadioTechnologyChange(); + void cdmaSwapSecondCallState(); + void cdmaSetSecondCallState(boolean state); +} diff --git a/core/java/android/bluetooth/IBluetoothHealth.aidl b/core/java/android/bluetooth/IBluetoothHealth.aidl new file mode 100644 index 0000000000000..a84a42cb9ce3c --- /dev/null +++ b/core/java/android/bluetooth/IBluetoothHealth.aidl @@ -0,0 +1,42 @@ +/* + * 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.bluetooth; + +import android.bluetooth.BluetoothDevice; +import android.bluetooth.BluetoothHealthAppConfiguration; +import android.bluetooth.IBluetoothHealthCallback; +import android.os.ParcelFileDescriptor; + +/** + * API for Bluetooth Health service + * + * {@hide} + */ +interface IBluetoothHealth +{ + boolean registerAppConfiguration(in BluetoothHealthAppConfiguration config, + in IBluetoothHealthCallback callback); + boolean unregisterAppConfiguration(in BluetoothHealthAppConfiguration config); + boolean connectChannelToSource(in BluetoothDevice device, in BluetoothHealthAppConfiguration config); + boolean connectChannelToSink(in BluetoothDevice device, in BluetoothHealthAppConfiguration config, + int channelType); + boolean disconnectChannel(in BluetoothDevice device, in BluetoothHealthAppConfiguration config, int id); + ParcelFileDescriptor getMainChannelFd(in BluetoothDevice device, in BluetoothHealthAppConfiguration config); + List getConnectedHealthDevices(); + List getHealthDevicesMatchingConnectionStates(in int[] states); + int getHealthDeviceConnectionState(in BluetoothDevice device); +} diff --git a/core/java/android/bluetooth/IBluetoothInputDevice.aidl b/core/java/android/bluetooth/IBluetoothInputDevice.aidl new file mode 100755 index 0000000000000..1ebb9ca6eb12d --- /dev/null +++ b/core/java/android/bluetooth/IBluetoothInputDevice.aidl @@ -0,0 +1,59 @@ +/* + * 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.bluetooth; + +import android.bluetooth.BluetoothDevice; + +/** + * API for Bluetooth HID service + * + * {@hide} + */ +interface IBluetoothInputDevice { + // Public API + boolean connect(in BluetoothDevice device); + boolean disconnect(in BluetoothDevice device); + List getConnectedDevices(); + List getDevicesMatchingConnectionStates(in int[] states); + int getConnectionState(in BluetoothDevice device); + boolean setPriority(in BluetoothDevice device, int priority); + int getPriority(in BluetoothDevice device); + /** + * @hide + */ + boolean getProtocolMode(in BluetoothDevice device); + /** + * @hide + */ + boolean virtualUnplug(in BluetoothDevice device); + /** + * @hide + */ + boolean setProtocolMode(in BluetoothDevice device, int protocolMode); + /** + * @hide + */ + boolean getReport(in BluetoothDevice device, byte reportType, byte reportId, int bufferSize); + /** + * @hide + */ + boolean setReport(in BluetoothDevice device, byte reportType, String report); + /** + * @hide + */ + boolean sendData(in BluetoothDevice device, String report); +} diff --git a/core/java/android/bluetooth/IBluetoothManager.aidl b/core/java/android/bluetooth/IBluetoothManager.aidl new file mode 100755 index 0000000000000..ed8777c51526c --- /dev/null +++ b/core/java/android/bluetooth/IBluetoothManager.aidl @@ -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 android.bluetooth; + +import android.bluetooth.IBluetooth; +import android.bluetooth.IBluetoothManagerCallback; +import android.bluetooth.IBluetoothStateChangeCallback; + +/** + * System private API for talking with the Bluetooth service. + * + * {@hide} + */ +interface IBluetoothManager +{ + IBluetooth registerAdapter(in IBluetoothManagerCallback callback); + void unregisterAdapter(in IBluetoothManagerCallback callback); + void registerStateChangeCallback(in IBluetoothStateChangeCallback callback); + void unregisterStateChangeCallback(in IBluetoothStateChangeCallback callback); + boolean isEnabled(); + boolean enable(); + boolean enableNoAutoConnect(); + boolean disable(boolean persist); + + String getAddress(); + String getName(); +} diff --git a/core/java/android/bluetooth/IBluetoothManagerCallback.aidl b/core/java/android/bluetooth/IBluetoothManagerCallback.aidl new file mode 100644 index 0000000000000..9551086a1de7a --- /dev/null +++ b/core/java/android/bluetooth/IBluetoothManagerCallback.aidl @@ -0,0 +1,29 @@ +/* + * 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.bluetooth; + +import android.bluetooth.IBluetooth; + +/** + * API for Communication between BluetoothAdapter and BluetoothManager + * + * {@hide} + */ +interface IBluetoothManagerCallback { + void onBluetoothServiceUp(in IBluetooth bluetoothService); + void onBluetoothServiceDown(); +} \ No newline at end of file diff --git a/core/java/android/bluetooth/IBluetoothPan.aidl b/core/java/android/bluetooth/IBluetoothPan.aidl new file mode 100644 index 0000000000000..5a323477704f0 --- /dev/null +++ b/core/java/android/bluetooth/IBluetoothPan.aidl @@ -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 android.bluetooth; + +import android.bluetooth.BluetoothDevice; + +/** + * API for Bluetooth Pan service + * + * {@hide} + */ +interface IBluetoothPan { + // Public API + boolean isTetheringOn(); + void setBluetoothTethering(boolean value); + boolean connect(in BluetoothDevice device); + boolean disconnect(in BluetoothDevice device); + List getConnectedDevices(); + List getDevicesMatchingConnectionStates(in int[] states); + int getConnectionState(in BluetoothDevice device); +} diff --git a/core/java/android/content/BroadcastReceiver.java b/core/java/android/content/BroadcastReceiver.java index 446f1af411776..1500b009a3069 100644 --- a/core/java/android/content/BroadcastReceiver.java +++ b/core/java/android/content/BroadcastReceiver.java @@ -237,16 +237,17 @@ public static class PendingResult { final boolean mOrderedHint; final boolean mInitialStickyHint; final IBinder mToken; + final int mSendingUser; int mResultCode; String mResultData; Bundle mResultExtras; boolean mAbortBroadcast; boolean mFinished; - + /** @hide */ public PendingResult(int resultCode, String resultData, Bundle resultExtras, - int type, boolean ordered, boolean sticky, IBinder token) { + int type, boolean ordered, boolean sticky, IBinder token, int userId) { mResultCode = resultCode; mResultData = resultData; mResultExtras = resultExtras; @@ -254,6 +255,7 @@ public PendingResult(int resultCode, String resultData, Bundle resultExtras, mOrderedHint = ordered; mInitialStickyHint = sticky; mToken = token; + mSendingUser = userId; } /** @@ -425,7 +427,12 @@ public void sendFinished(IActivityManager am) { } } } - + + /** @hide */ + public int getSendingUserId() { + return mSendingUser; + } + void checkSynchronousHint() { // Note that we don't assert when receiving the initial sticky value, // since that may have come from an ordered broadcast. We'll catch @@ -733,6 +740,11 @@ public final PendingResult getPendingResult() { return mPendingResult; } + /** @hide */ + public int getSendingUserId() { + return mPendingResult.mSendingUser; + } + /** * Control inclusion of debugging help for mismatched * calls to {@link Context#registerReceiver(BroadcastReceiver, IntentFilter) diff --git a/core/java/android/content/ClipData.java b/core/java/android/content/ClipData.java index 186683091817c..88f1a3d5b4fdd 100644 --- a/core/java/android/content/ClipData.java +++ b/core/java/android/content/ClipData.java @@ -563,7 +563,7 @@ private CharSequence coerceToHtmlOrStyledText(Context context, boolean styled) { private String uriToHtml(String uri) { StringBuilder builder = new StringBuilder(256); builder.append(""); builder.append(Html.escapeHtml(uri)); builder.append(""); diff --git a/core/java/android/content/ContentProvider.java b/core/java/android/content/ContentProvider.java index b22179e718435..23d8f46029db4 100644 --- a/core/java/android/content/ContentProvider.java +++ b/core/java/android/content/ContentProvider.java @@ -35,7 +35,7 @@ import android.os.ParcelFileDescriptor; import android.os.Process; import android.os.RemoteException; -import android.os.UserId; +import android.os.UserHandle; import android.util.Log; import java.io.File; @@ -279,7 +279,7 @@ private void enforceReadPermission(Uri uri) throws SecurityException { final int uid = Binder.getCallingUid(); String missingPerm = null; - if (uid == mMyUid) { + if (UserHandle.isSameApp(uid, mMyUid)) { return; } @@ -340,7 +340,7 @@ private void enforceWritePermission(Uri uri) throws SecurityException { final int uid = Binder.getCallingUid(); String missingPerm = null; - if (uid == mMyUid) { + if (UserHandle.isSameApp(uid, mMyUid)) { return; } diff --git a/core/java/android/content/ContentProviderClient.java b/core/java/android/content/ContentProviderClient.java index 5c315ce324271..204f963ba358e 100644 --- a/core/java/android/content/ContentProviderClient.java +++ b/core/java/android/content/ContentProviderClient.java @@ -231,6 +231,19 @@ public ContentProviderResult[] applyBatch(ArrayList op } } + /** See {@link ContentProvider#call(String, String, Bundle)} */ + public Bundle call(String method, String arg, Bundle extras) + throws RemoteException { + try { + return mContentProvider.call(method, arg, extras); + } catch (DeadObjectException e) { + if (!mStable) { + mContentResolver.unstableProviderDied(mContentProvider); + } + throw e; + } + } + /** * Call this to indicate to the system that the associated {@link ContentProvider} is no * longer needed by this {@link ContentProviderClient}. diff --git a/core/java/android/content/ContentResolver.java b/core/java/android/content/ContentResolver.java index 0a5a26a979d6c..9e406d452fa4b 100644 --- a/core/java/android/content/ContentResolver.java +++ b/core/java/android/content/ContentResolver.java @@ -39,6 +39,7 @@ import android.os.RemoteException; import android.os.ServiceManager; import android.os.SystemClock; +import android.os.UserHandle; import android.text.TextUtils; import android.util.EventLog; import android.util.Log; @@ -230,7 +231,8 @@ public final String getType(Uri url) { } try { - String type = ActivityManagerNative.getDefault().getProviderMimeType(url); + String type = ActivityManagerNative.getDefault().getProviderMimeType( + url, UserHandle.myUserId()); return type; } catch (RemoteException e) { // Arbitrary and not worth documenting, as Activity @@ -1216,10 +1218,17 @@ public final ContentProviderClient acquireUnstableContentProviderClient(String n */ public final void registerContentObserver(Uri uri, boolean notifyForDescendents, ContentObserver observer) + { + registerContentObserver(uri, notifyForDescendents, observer, UserHandle.myUserId()); + } + + /** @hide - designated user version */ + public final void registerContentObserver(Uri uri, boolean notifyForDescendents, + ContentObserver observer, int userHandle) { try { getContentService().registerContentObserver(uri, notifyForDescendents, - observer.getContentObserver()); + observer.getContentObserver(), userHandle); } catch (RemoteException e) { } } @@ -1274,10 +1283,21 @@ public void notifyChange(Uri uri, ContentObserver observer) { * @see #requestSync(android.accounts.Account, String, android.os.Bundle) */ public void notifyChange(Uri uri, ContentObserver observer, boolean syncToNetwork) { + notifyChange(uri, observer, syncToNetwork, UserHandle.getCallingUserId()); + } + + /** + * Notify registered observers within the designated user(s) that a row was updated. + * + * @hide + */ + public void notifyChange(Uri uri, ContentObserver observer, boolean syncToNetwork, + int userHandle) { try { getContentService().notifyChange( uri, observer == null ? null : observer.getContentObserver(), - observer != null && observer.deliverSelfNotifications(), syncToNetwork); + observer != null && observer.deliverSelfNotifications(), syncToNetwork, + userHandle); } catch (RemoteException e) { } } diff --git a/core/java/android/content/ContentService.java b/core/java/android/content/ContentService.java index 1a07504f2fbe7..4512e82f78da0 100644 --- a/core/java/android/content/ContentService.java +++ b/core/java/android/content/ContentService.java @@ -17,6 +17,7 @@ package android.content; import android.accounts.Account; +import android.app.ActivityManager; import android.database.IContentObserver; import android.database.sqlite.SQLiteException; import android.net.Uri; @@ -26,13 +27,14 @@ import android.os.Parcel; import android.os.RemoteException; import android.os.ServiceManager; -import android.os.UserId; +import android.os.UserHandle; import android.util.Log; import android.util.SparseIntArray; import android.Manifest; import java.io.FileDescriptor; import java.io.PrintWriter; +import java.security.InvalidParameterException; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; @@ -138,19 +140,49 @@ public void systemReady() { getSyncManager(); } - public void registerContentObserver(Uri uri, boolean notifyForDescendents, - IContentObserver observer) { + /** + * Register a content observer tied to a specific user's view of the provider. + * @param userHandle the user whose view of the provider is to be observed. May be + * the calling user without requiring any permission, otherwise the caller needs to + * hold the INTERACT_ACROSS_USERS_FULL permission. Pseudousers USER_ALL and + * USER_CURRENT are properly handled; all other pseudousers are forbidden. + */ + @Override + public void registerContentObserver(Uri uri, boolean notifyForDescendants, + IContentObserver observer, int userHandle) { if (observer == null || uri == null) { throw new IllegalArgumentException("You must pass a valid uri and observer"); } + + final int callingUser = UserHandle.getCallingUserId(); + if (callingUser != userHandle) { + mContext.enforceCallingOrSelfPermission(Manifest.permission.INTERACT_ACROSS_USERS_FULL, + "no permission to observe other users' provider view"); + } + + if (userHandle < 0) { + if (userHandle == UserHandle.USER_CURRENT) { + userHandle = ActivityManager.getCurrentUser(); + } else if (userHandle != UserHandle.USER_ALL) { + throw new InvalidParameterException("Bad user handle for registerContentObserver: " + + userHandle); + } + } + synchronized (mRootNode) { - mRootNode.addObserverLocked(uri, observer, notifyForDescendents, mRootNode, - Binder.getCallingUid(), Binder.getCallingPid()); + mRootNode.addObserverLocked(uri, observer, notifyForDescendants, mRootNode, + Binder.getCallingUid(), Binder.getCallingPid(), userHandle); if (false) Log.v(TAG, "Registered observer " + observer + " at " + uri + - " with notifyForDescendents " + notifyForDescendents); + " with notifyForDescendants " + notifyForDescendants); } } + public void registerContentObserver(Uri uri, boolean notifyForDescendants, + IContentObserver observer) { + registerContentObserver(uri, notifyForDescendants, observer, + UserHandle.getCallingUserId()); + } + public void unregisterContentObserver(IContentObserver observer) { if (observer == null) { throw new IllegalArgumentException("You must pass a valid observer"); @@ -161,14 +193,39 @@ public void unregisterContentObserver(IContentObserver observer) { } } + /** + * Notify observers of a particular user's view of the provider. + * @param userHandle the user whose view of the provider is to be notified. May be + * the calling user without requiring any permission, otherwise the caller needs to + * hold the INTERACT_ACROSS_USERS_FULL permission. Pseudousers USER_ALL and + * USER_CURRENT are properly interpreted; no other pseudousers are allowed. + */ + @Override public void notifyChange(Uri uri, IContentObserver observer, - boolean observerWantsSelfNotifications, boolean syncToNetwork) { + boolean observerWantsSelfNotifications, boolean syncToNetwork, + int userHandle) { if (Log.isLoggable(TAG, Log.VERBOSE)) { - Log.v(TAG, "Notifying update of " + uri + " from observer " + observer - + ", syncToNetwork " + syncToNetwork); + Log.v(TAG, "Notifying update of " + uri + " for user " + userHandle + + " from observer " + observer + ", syncToNetwork " + syncToNetwork); + } + + // Notify for any user other than the caller's own requires permission. + final int callingUserHandle = UserHandle.getCallingUserId(); + if (userHandle != callingUserHandle) { + mContext.enforceCallingOrSelfPermission(Manifest.permission.INTERACT_ACROSS_USERS_FULL, + "no permission to notify other users"); + } + + // We passed the permission check; resolve pseudouser targets as appropriate + if (userHandle < 0) { + if (userHandle == UserHandle.USER_CURRENT) { + userHandle = ActivityManager.getCurrentUser(); + } else if (userHandle != UserHandle.USER_ALL) { + throw new InvalidParameterException("Bad user handle for notifyChange: " + + userHandle); + } } - int userId = UserId.getCallingUserId(); // This makes it so that future permission checks will be in the context of this // process rather than the caller's process. We will restore this before returning. long identityToken = clearCallingIdentity(); @@ -176,7 +233,7 @@ public void notifyChange(Uri uri, IContentObserver observer, ArrayList calls = new ArrayList(); synchronized (mRootNode) { mRootNode.collectObserversLocked(uri, 0, observer, observerWantsSelfNotifications, - calls); + userHandle, calls); } final int numCalls = calls.size(); for (int i=0; i getPeriodicSyncs(Account account, String providerName) { mContext.enforceCallingOrSelfPermission(Manifest.permission.READ_SYNC_SETTINGS, "no permission to read the sync settings"); - int userId = UserId.getCallingUserId(); + int userId = UserHandle.getCallingUserId(); long identityToken = clearCallingIdentity(); try { @@ -372,7 +436,7 @@ public List getPeriodicSyncs(Account account, String providerName) public int getIsSyncable(Account account, String providerName) { mContext.enforceCallingOrSelfPermission(Manifest.permission.READ_SYNC_SETTINGS, "no permission to read the sync settings"); - int userId = UserId.getCallingUserId(); + int userId = UserHandle.getCallingUserId(); long identityToken = clearCallingIdentity(); try { @@ -390,7 +454,7 @@ public int getIsSyncable(Account account, String providerName) { public void setIsSyncable(Account account, String providerName, int syncable) { mContext.enforceCallingOrSelfPermission(Manifest.permission.WRITE_SYNC_SETTINGS, "no permission to write the sync settings"); - int userId = UserId.getCallingUserId(); + int userId = UserHandle.getCallingUserId(); long identityToken = clearCallingIdentity(); try { @@ -407,7 +471,7 @@ public void setIsSyncable(Account account, String providerName, int syncable) { public boolean getMasterSyncAutomatically() { mContext.enforceCallingOrSelfPermission(Manifest.permission.READ_SYNC_SETTINGS, "no permission to read the sync settings"); - int userId = UserId.getCallingUserId(); + int userId = UserHandle.getCallingUserId(); long identityToken = clearCallingIdentity(); try { @@ -424,7 +488,7 @@ public boolean getMasterSyncAutomatically() { public void setMasterSyncAutomatically(boolean flag) { mContext.enforceCallingOrSelfPermission(Manifest.permission.WRITE_SYNC_SETTINGS, "no permission to write the sync settings"); - int userId = UserId.getCallingUserId(); + int userId = UserHandle.getCallingUserId(); long identityToken = clearCallingIdentity(); try { @@ -440,7 +504,7 @@ public void setMasterSyncAutomatically(boolean flag) { public boolean isSyncActive(Account account, String authority) { mContext.enforceCallingOrSelfPermission(Manifest.permission.READ_SYNC_STATS, "no permission to read the sync stats"); - int userId = UserId.getCallingUserId(); + int userId = UserHandle.getCallingUserId(); long identityToken = clearCallingIdentity(); try { @@ -458,7 +522,7 @@ public boolean isSyncActive(Account account, String authority) { public List getCurrentSyncs() { mContext.enforceCallingOrSelfPermission(Manifest.permission.READ_SYNC_STATS, "no permission to read the sync stats"); - int userId = UserId.getCallingUserId(); + int userId = UserHandle.getCallingUserId(); long identityToken = clearCallingIdentity(); try { @@ -471,7 +535,7 @@ public List getCurrentSyncs() { public SyncStatusInfo getSyncStatus(Account account, String authority) { mContext.enforceCallingOrSelfPermission(Manifest.permission.READ_SYNC_STATS, "no permission to read the sync stats"); - int userId = UserId.getCallingUserId(); + int userId = UserHandle.getCallingUserId(); long identityToken = clearCallingIdentity(); try { @@ -489,7 +553,7 @@ public SyncStatusInfo getSyncStatus(Account account, String authority) { public boolean isSyncPending(Account account, String authority) { mContext.enforceCallingOrSelfPermission(Manifest.permission.READ_SYNC_STATS, "no permission to read the sync stats"); - int userId = UserId.getCallingUserId(); + int userId = UserHandle.getCallingUserId(); long identityToken = clearCallingIdentity(); try { @@ -543,16 +607,18 @@ private class ObserverEntry implements IBinder.DeathRecipient { public final IContentObserver observer; public final int uid; public final int pid; - public final boolean notifyForDescendents; + public final boolean notifyForDescendants; + private final int userHandle; private final Object observersLock; public ObserverEntry(IContentObserver o, boolean n, Object observersLock, - int _uid, int _pid) { + int _uid, int _pid, int _userHandle) { this.observersLock = observersLock; observer = o; uid = _uid; pid = _pid; - notifyForDescendents = n; + userHandle = _userHandle; + notifyForDescendants = n; try { observer.asBinder().linkToDeath(this, 0); } catch (RemoteException e) { @@ -571,7 +637,8 @@ public void dumpLocked(FileDescriptor fd, PrintWriter pw, String[] args, pidCounts.put(pid, pidCounts.get(pid)+1); pw.print(prefix); pw.print(name); pw.print(": pid="); pw.print(pid); pw.print(" uid="); - pw.print(uid); pw.print(" target="); + pw.print(uid); pw.print(" user="); + pw.print(userHandle); pw.print(" target="); pw.println(Integer.toHexString(System.identityHashCode( observer != null ? observer.asBinder() : null))); } @@ -639,17 +706,21 @@ private int countUriSegments(Uri uri) { return uri.getPathSegments().size() + 1; } + // Invariant: userHandle is either a hard user number or is USER_ALL public void addObserverLocked(Uri uri, IContentObserver observer, - boolean notifyForDescendents, Object observersLock, int uid, int pid) { - addObserverLocked(uri, 0, observer, notifyForDescendents, observersLock, uid, pid); + boolean notifyForDescendants, Object observersLock, + int uid, int pid, int userHandle) { + addObserverLocked(uri, 0, observer, notifyForDescendants, observersLock, + uid, pid, userHandle); } private void addObserverLocked(Uri uri, int index, IContentObserver observer, - boolean notifyForDescendents, Object observersLock, int uid, int pid) { + boolean notifyForDescendants, Object observersLock, + int uid, int pid, int userHandle) { // If this is the leaf node add the observer if (index == countUriSegments(uri)) { - mObservers.add(new ObserverEntry(observer, notifyForDescendents, observersLock, - uid, pid)); + mObservers.add(new ObserverEntry(observer, notifyForDescendants, observersLock, + uid, pid, userHandle)); return; } @@ -662,8 +733,8 @@ private void addObserverLocked(Uri uri, int index, IContentObserver observer, for (int i = 0; i < N; i++) { ObserverNode node = mChildren.get(i); if (node.mName.equals(segment)) { - node.addObserverLocked(uri, index + 1, observer, notifyForDescendents, - observersLock, uid, pid); + node.addObserverLocked(uri, index + 1, observer, notifyForDescendants, + observersLock, uid, pid, userHandle); return; } } @@ -671,8 +742,8 @@ private void addObserverLocked(Uri uri, int index, IContentObserver observer, // No child found, create one ObserverNode node = new ObserverNode(segment); mChildren.add(node); - node.addObserverLocked(uri, index + 1, observer, notifyForDescendents, - observersLock, uid, pid); + node.addObserverLocked(uri, index + 1, observer, notifyForDescendants, + observersLock, uid, pid, userHandle); } public boolean removeObserverLocked(IContentObserver observer) { @@ -705,37 +776,49 @@ public boolean removeObserverLocked(IContentObserver observer) { } private void collectMyObserversLocked(boolean leaf, IContentObserver observer, - boolean observerWantsSelfNotifications, ArrayList calls) { + boolean observerWantsSelfNotifications, int targetUserHandle, + ArrayList calls) { int N = mObservers.size(); IBinder observerBinder = observer == null ? null : observer.asBinder(); for (int i = 0; i < N; i++) { ObserverEntry entry = mObservers.get(i); - // Don't notify the observer if it sent the notification and isn't interesed + // Don't notify the observer if it sent the notification and isn't interested // in self notifications boolean selfChange = (entry.observer.asBinder() == observerBinder); if (selfChange && !observerWantsSelfNotifications) { continue; } - // Make sure the observer is interested in the notification - if (leaf || (!leaf && entry.notifyForDescendents)) { - calls.add(new ObserverCall(this, entry.observer, selfChange)); + // Does this observer match the target user? + if (targetUserHandle == UserHandle.USER_ALL + || entry.userHandle == UserHandle.USER_ALL + || targetUserHandle == entry.userHandle) { + // Make sure the observer is interested in the notification + if (leaf || (!leaf && entry.notifyForDescendants)) { + calls.add(new ObserverCall(this, entry.observer, selfChange)); + } } } } + /** + * targetUserHandle is either a hard user handle or is USER_ALL + */ public void collectObserversLocked(Uri uri, int index, IContentObserver observer, - boolean observerWantsSelfNotifications, ArrayList calls) { + boolean observerWantsSelfNotifications, int targetUserHandle, + ArrayList calls) { String segment = null; int segmentCount = countUriSegments(uri); if (index >= segmentCount) { // This is the leaf node, notify all observers - collectMyObserversLocked(true, observer, observerWantsSelfNotifications, calls); + collectMyObserversLocked(true, observer, observerWantsSelfNotifications, + targetUserHandle, calls); } else if (index < segmentCount){ segment = getUriSegment(uri, index); - // Notify any observers at this level who are interested in descendents - collectMyObserversLocked(false, observer, observerWantsSelfNotifications, calls); + // Notify any observers at this level who are interested in descendants + collectMyObserversLocked(false, observer, observerWantsSelfNotifications, + targetUserHandle, calls); } int N = mChildren.size(); @@ -744,7 +827,7 @@ public void collectObserversLocked(Uri uri, int index, IContentObserver observer if (segment == null || node.mName.equals(segment)) { // We found the child, node.collectObserversLocked(uri, index + 1, - observer, observerWantsSelfNotifications, calls); + observer, observerWantsSelfNotifications, targetUserHandle, calls); if (segment != null) { break; } diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java index ffff9bea92a24..f0c6ce8091efd 100644 --- a/core/java/android/content/Context.java +++ b/core/java/android/content/Context.java @@ -19,6 +19,7 @@ import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.content.res.AssetManager; +import android.content.res.Configuration; import android.content.res.Resources; import android.content.res.TypedArray; import android.database.DatabaseErrorHandler; @@ -31,7 +32,12 @@ import android.os.Bundle; import android.os.Handler; import android.os.Looper; +import android.os.UserHandle; +import android.os.UserManager; import android.util.AttributeSet; +import android.view.CompatibilityInfoHolder; +import android.view.Display; +import android.view.WindowManager; import java.io.File; import java.io.FileInputStream; @@ -58,18 +64,34 @@ public abstract class Context { */ public static final int MODE_PRIVATE = 0x0000; /** + * @deprecated Creating world-readable files is very dangerous, and likely + * to cause security holes in applications. It is strongly discouraged; + * instead, applications should use more formal mechanism for interactions + * such as {@link ContentProvider}, {@link BroadcastReceiver}, and + * {@link android.app.Service}. There are no guarantees that this + * access mode will remain on a file, such as when it goes through a + * backup and restore. * File creation mode: allow all other applications to have read access * to the created file. * @see #MODE_PRIVATE * @see #MODE_WORLD_WRITEABLE */ + @Deprecated public static final int MODE_WORLD_READABLE = 0x0001; /** + * @deprecated Creating world-writable files is very dangerous, and likely + * to cause security holes in applications. It is strongly discouraged; + * instead, applications should use more formal mechanism for interactions + * such as {@link ContentProvider}, {@link BroadcastReceiver}, and + * {@link android.app.Service}. There are no guarantees that this + * access mode will remain on a file, such as when it goes through a + * backup and restore. * File creation mode: allow all other applications to have write access * to the created file. * @see #MODE_PRIVATE * @see #MODE_WORLD_READABLE */ + @Deprecated public static final int MODE_WORLD_WRITEABLE = 0x0002; /** * File creation mode: for use with {@link #openFileOutput}, if the file @@ -157,7 +179,7 @@ public abstract class Context { * Flag for {@link #bindService}: indicates that the client application * binding to this service considers the service to be more important than * the app itself. When set, the platform will try to have the out of - * memory kill the app before it kills the service it is bound to, though + * memory killer kill the app before it kills the service it is bound to, though * this is not guaranteed to be the case. */ public static final int BIND_ABOVE_CLIENT = 0x0008; @@ -197,6 +219,19 @@ public abstract class Context { */ public static final int BIND_ADJUST_WITH_ACTIVITY = 0x0080; + /** + * @hide An idea that is not yet implemented. + * Flag for {@link #bindService}: If binding from an activity, consider + * this service to be visible like the binding activity is. That is, + * it will be treated as something more important to keep around than + * invisible background activities. This will impact the number of + * recent activities the user can switch between without having them + * restart. There is no guarantee this will be respected, as the system + * tries to balance such requests from one app vs. the importantance of + * keeping other apps around. + */ + public static final int BIND_VISIBLE = 0x0100; + /** * Flag for {@link #bindService}: Don't consider the bound service to be * visible, even if the caller is visible. @@ -553,6 +588,10 @@ public abstract FileOutputStream openFileOutput(String name, int mode) * can read and write files placed here. * * + *

      On devices with multiple users (as described by {@link UserManager}), + * each user has their own isolated external storage. Applications only + * have access to the external storage for the user they're running as.

      + * *

      Here is an example of typical code to manipulate a file in * an application's private storage:

      * @@ -582,6 +621,9 @@ public abstract FileOutputStream openFileOutput(String name, int mode) * {@sample development/samples/ApiDemos/src/com/example/android/apis/content/ExternalStorage.java * private_picture} * + *

      Writing to this path requires the + * {@link android.Manifest.permission#WRITE_EXTERNAL_STORAGE} permission.

      + * * @param type The type of files directory to return. May be null for * the root of the files directory or one of * the following Environment constants for a subdirectory: @@ -607,6 +649,11 @@ public abstract FileOutputStream openFileOutput(String name, int mode) * Return the directory where this application's OBB files (if there * are any) can be found. Note if the application does not have any OBB * files, this directory may not exist. + * + *

      On devices with multiple users (as described by {@link UserManager}), + * multiple users may share the same OBB storage location. Applications + * should ensure that multiple instances running under different users + * don't interfere with each other.

      */ public abstract File getObbDir(); @@ -640,8 +687,12 @@ public abstract FileOutputStream openFileOutput(String name, int mode) * are some important differences: * *
        - *
      • The platform does not monitor the space available in external storage, - * and thus will not automatically delete these files. Note that you should + *
      • The platform does not always monitor the space available in external + * storage, and thus may not automatically delete these files. Currently + * the only time files here will be deleted by the platform is when running + * on {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} or later and + * {@link android.os.Environment#isExternalStorageEmulated() + * Environment.isExternalStorageEmulated()} returns true. Note that you should * be managing the maximum space you will use for these anyway, just like * with {@link #getCacheDir()}. *
      • External files are not always available: they will disappear if the @@ -651,6 +702,13 @@ public abstract FileOutputStream openFileOutput(String name, int mode) * can read and write files placed here. *
      * + *

      On devices with multiple users (as described by {@link UserManager}), + * each user has their own isolated external storage. Applications only + * have access to the external storage for the user they're running as.

      + * + *

      Writing to this path requires the + * {@link android.Manifest.permission#WRITE_EXTERNAL_STORAGE} permission.

      + * * @return Returns the path of the directory holding application cache files * on external storage. Returns null if external storage is not currently * mounted so it could not ensure the path exists; you will need to call @@ -850,6 +908,20 @@ public abstract SQLiteDatabase openOrCreateDatabase(String name, */ public abstract void startActivity(Intent intent); + /** + * Version of {@link #startActivity(Intent)} that allows you to specify the + * user the activity will be started for. This is not available to applications + * that are not pre-installed on the system image. Using it requires holding + * the INTERACT_ACROSS_USERS_FULL permission. + * @param intent The description of the activity to start. + * @param user The UserHandle of the user to start this activity for. + * @throws ActivityNotFoundException + * @hide + */ + public void startActivityAsUser(Intent intent, UserHandle user) { + throw new RuntimeException("Not implemented. Must override in a subclass."); + } + /** * Launch a new activity. You will not receive any information about when * the activity exits. @@ -877,6 +949,24 @@ public abstract SQLiteDatabase openOrCreateDatabase(String name, */ public abstract void startActivity(Intent intent, Bundle options); + /** + * Version of {@link #startActivity(Intent, Bundle)} that allows you to specify the + * user the activity will be started for. This is not available to applications + * that are not pre-installed on the system image. Using it requires holding + * the INTERACT_ACROSS_USERS_FULL permission. + * @param intent The description of the activity to start. + * @param options Additional options for how the Activity should be started. + * May be null if there are no options. See {@link android.app.ActivityOptions} + * for how to build the Bundle supplied here; there are no supported definitions + * for building it manually. + * @param user The UserHandle of the user to start this activity for. + * @throws ActivityNotFoundException + * @hide + */ + public void startActivityAsUser(Intent intent, Bundle options, UserHandle userId) { + throw new RuntimeException("Not implemented. Must override in a subclass."); + } + /** * Same as {@link #startActivities(Intent[], Bundle)} with no options * specified. @@ -916,6 +1006,36 @@ public abstract SQLiteDatabase openOrCreateDatabase(String name, */ public abstract void startActivities(Intent[] intents, Bundle options); + /** + * @hide + * Launch multiple new activities. This is generally the same as calling + * {@link #startActivity(Intent)} for the first Intent in the array, + * that activity during its creation calling {@link #startActivity(Intent)} + * for the second entry, etc. Note that unlike that approach, generally + * none of the activities except the last in the array will be created + * at this point, but rather will be created when the user first visits + * them (due to pressing back from the activity on top). + * + *

      This method throws {@link ActivityNotFoundException} + * if there was no Activity found for any given Intent. In this + * case the state of the activity stack is undefined (some Intents in the + * list may be on it, some not), so you probably want to avoid such situations. + * + * @param intents An array of Intents to be started. + * @param options Additional options for how the Activity should be started. + * @param userHandle The user for whom to launch the activities + * See {@link android.content.Context#startActivity(Intent, Bundle) + * Context.startActivity(Intent, Bundle)} for more details. + * + * @throws ActivityNotFoundException + * + * @see {@link #startActivities(Intent[])} + * @see PackageManager#resolveActivity + */ + public void startActivitiesAsUser(Intent[] intents, Bundle options, UserHandle userHandle) { + throw new RuntimeException("Not implemented. Must override in a subclass."); + } + /** * Same as {@link #startIntentSender(IntentSender, Intent, int, int, int, Bundle)} * with no options specified. @@ -987,16 +1107,6 @@ public abstract void startIntentSender(IntentSender intent, */ public abstract void sendBroadcast(Intent intent); - /** - * Same as #sendBroadcast(Intent intent), but for a specific user. Used by the system only. - * @param intent the intent to broadcast - * @param userId user to send the intent to - * @hide - */ - public void sendBroadcast(Intent intent, int userId) { - throw new RuntimeException("Not implemented. Must override in a subclass."); - } - /** * Broadcast the given intent to all interested BroadcastReceivers, allowing * an optional required permission to be enforced. This @@ -1094,6 +1204,69 @@ public abstract void sendOrderedBroadcast(Intent intent, Handler scheduler, int initialCode, String initialData, Bundle initialExtras); + /** + * Version of {@link #sendBroadcast(Intent)} that allows you to specify the + * user the broadcast will be sent to. This is not available to applications + * that are not pre-installed on the system image. Using it requires holding + * the INTERACT_ACROSS_USERS permission. + * @param intent The intent to broadcast + * @param user UserHandle to send the intent to. + * @see #sendBroadcast(Intent) + */ + public abstract void sendBroadcastAsUser(Intent intent, UserHandle user); + + /** + * Version of {@link #sendBroadcast(Intent, String)} that allows you to specify the + * user the broadcast will be sent to. This is not available to applications + * that are not pre-installed on the system image. Using it requires holding + * the INTERACT_ACROSS_USERS permission. + * + * @param intent The Intent to broadcast; all receivers matching this + * Intent will receive the broadcast. + * @param user UserHandle to send the intent to. + * @param receiverPermission (optional) String naming a permission that + * a receiver must hold in order to receive your broadcast. + * If null, no permission is required. + * + * @see #sendBroadcast(Intent, String) + */ + public abstract void sendBroadcastAsUser(Intent intent, UserHandle user, + String receiverPermission); + + /** + * Version of + * {@link #sendOrderedBroadcast(Intent, String, BroadcastReceiver, Handler, int, String, Bundle)} + * that allows you to specify the + * user the broadcast will be sent to. This is not available to applications + * that are not pre-installed on the system image. Using it requires holding + * the INTERACT_ACROSS_USERS permission. + * + *

      See {@link BroadcastReceiver} for more information on Intent broadcasts. + * + * @param intent The Intent to broadcast; all receivers matching this + * Intent will receive the broadcast. + * @param user UserHandle to send the intent to. + * @param receiverPermission String naming a permissions that + * a receiver must hold in order to receive your broadcast. + * If null, no permission is required. + * @param resultReceiver Your own BroadcastReceiver to treat as the final + * receiver of the broadcast. + * @param scheduler A custom Handler with which to schedule the + * resultReceiver callback; if null it will be + * scheduled in the Context's main thread. + * @param initialCode An initial value for the result code. Often + * Activity.RESULT_OK. + * @param initialData An initial value for the result data. Often + * null. + * @param initialExtras An initial value for the result extras. Often + * null. + * + * @see #sendOrderedBroadcast(Intent, String, BroadcastReceiver, Handler, int, String, Bundle) + */ + public abstract void sendOrderedBroadcastAsUser(Intent intent, UserHandle user, + String receiverPermission, BroadcastReceiver resultReceiver, Handler scheduler, + int initialCode, String initialData, Bundle initialExtras); + /** * Perform a {@link #sendBroadcast(Intent)} that is "sticky," meaning the * Intent you are sending stays around after the broadcast is complete, @@ -1160,7 +1333,6 @@ public abstract void sendStickyOrderedBroadcast(Intent intent, Handler scheduler, int initialCode, String initialData, Bundle initialExtras); - /** * Remove the data previously sent with {@link #sendStickyBroadcast}, * so that it is as if the sticky broadcast had never happened. @@ -1175,6 +1347,70 @@ public abstract void sendStickyOrderedBroadcast(Intent intent, */ public abstract void removeStickyBroadcast(Intent intent); + /** + * Version of {@link #sendStickyBroadcast(Intent)} that allows you to specify the + * user the broadcast will be sent to. This is not available to applications + * that are not pre-installed on the system image. Using it requires holding + * the INTERACT_ACROSS_USERS permission. + * + * @param intent The Intent to broadcast; all receivers matching this + * Intent will receive the broadcast, and the Intent will be held to + * be re-broadcast to future receivers. + * @param user UserHandle to send the intent to. + * + * @see #sendBroadcast(Intent) + */ + public abstract void sendStickyBroadcastAsUser(Intent intent, UserHandle user); + + /** + * Version of + * {@link #sendStickyOrderedBroadcast(Intent, BroadcastReceiver, Handler, int, String, Bundle)} + * that allows you to specify the + * user the broadcast will be sent to. This is not available to applications + * that are not pre-installed on the system image. Using it requires holding + * the INTERACT_ACROSS_USERS permission. + * + *

      See {@link BroadcastReceiver} for more information on Intent broadcasts. + * + * @param intent The Intent to broadcast; all receivers matching this + * Intent will receive the broadcast. + * @param user UserHandle to send the intent to. + * @param resultReceiver Your own BroadcastReceiver to treat as the final + * receiver of the broadcast. + * @param scheduler A custom Handler with which to schedule the + * resultReceiver callback; if null it will be + * scheduled in the Context's main thread. + * @param initialCode An initial value for the result code. Often + * Activity.RESULT_OK. + * @param initialData An initial value for the result data. Often + * null. + * @param initialExtras An initial value for the result extras. Often + * null. + * + * @see #sendStickyOrderedBroadcast(Intent, BroadcastReceiver, Handler, int, String, Bundle) + */ + public abstract void sendStickyOrderedBroadcastAsUser(Intent intent, + UserHandle user, BroadcastReceiver resultReceiver, + Handler scheduler, int initialCode, String initialData, + Bundle initialExtras); + + /** + * Version of {@link #removeStickyBroadcast(Intent)} that allows you to specify the + * user the broadcast will be sent to. This is not available to applications + * that are not pre-installed on the system image. Using it requires holding + * the INTERACT_ACROSS_USERS permission. + * + *

      You must hold the {@link android.Manifest.permission#BROADCAST_STICKY} + * permission in order to use this API. If you do not hold that + * permission, {@link SecurityException} will be thrown. + * + * @param intent The Intent that was previously broadcast. + * @param user UserHandle to remove the sticky broadcast from. + * + * @see #sendStickyBroadcastAsUser + */ + public abstract void removeStickyBroadcastAsUser(Intent intent, UserHandle user); + /** * Register a BroadcastReceiver to be run in the main activity thread. The * receiver will be called with any broadcast Intent that @@ -1258,9 +1494,35 @@ public abstract Intent registerReceiver(BroadcastReceiver receiver, * @see #unregisterReceiver */ public abstract Intent registerReceiver(BroadcastReceiver receiver, - IntentFilter filter, - String broadcastPermission, - Handler scheduler); + IntentFilter filter, String broadcastPermission, Handler scheduler); + + /** + * @hide + * Same as {@link #registerReceiver(BroadcastReceiver, IntentFilter, String, Handler) + * but for a specific user. This receiver will receiver broadcasts that + * are sent to the requested user. It + * requires holding the {@link android.Manifest.permission#INTERACT_ACROSS_USERS_FULL} + * permission. + * + * @param receiver The BroadcastReceiver to handle the broadcast. + * @param user UserHandle to send the intent to. + * @param filter Selects the Intent broadcasts to be received. + * @param broadcastPermission String naming a permissions that a + * broadcaster must hold in order to send an Intent to you. If null, + * no permission is required. + * @param scheduler Handler identifying the thread that will receive + * the Intent. If null, the main thread of the process will be used. + * + * @return The first sticky intent found that matches filter, + * or null if there are none. + * + * @see #registerReceiver(BroadcastReceiver, IntentFilter, String, Handler + * @see #sendBroadcast + * @see #unregisterReceiver + */ + public abstract Intent registerReceiverAsUser(BroadcastReceiver receiver, + UserHandle user, IntentFilter filter, String broadcastPermission, + Handler scheduler); /** * Unregister a previously registered BroadcastReceiver. All @@ -1350,6 +1612,16 @@ public abstract Intent registerReceiver(BroadcastReceiver receiver, */ public abstract boolean stopService(Intent service); + /** + * @hide like {@link #startService(Intent)} but for a specific user. + */ + public abstract ComponentName startServiceAsUser(Intent service, UserHandle user); + + /** + * @hide like {@link #stopService(Intent)} but for a specific user. + */ + public abstract boolean stopServiceAsUser(Intent service, UserHandle user); + /** * Connect to an application service, creating it if needed. This defines * a dependency between your application and the service. The given @@ -1379,6 +1651,7 @@ public abstract Intent registerReceiver(BroadcastReceiver receiver, * description (action, category, etc) to match an * {@link IntentFilter} published by a service. * @param conn Receives information as the service is started and stopped. + * This must be a valid ServiceConnection object; it must not be null. * @param flags Operation options for the binding. May be 0, * {@link #BIND_AUTO_CREATE}, {@link #BIND_DEBUG_UNBIND}, * {@link #BIND_NOT_FOREGROUND}, {@link #BIND_ABOVE_CLIENT}, @@ -1400,11 +1673,11 @@ public abstract boolean bindService(Intent service, ServiceConnection conn, int flags); /** - * Same as {@link #bindService(Intent, ServiceConnection, int)}, but with an explicit userId + * Same as {@link #bindService(Intent, ServiceConnection, int)}, but with an explicit userHandle * argument for use by system server and other multi-user aware code. * @hide */ - public boolean bindService(Intent service, ServiceConnection conn, int flags, int userId) { + public boolean bindService(Intent service, ServiceConnection conn, int flags, int userHandle) { throw new RuntimeException("Not implemented. Must override in a subclass."); } @@ -1414,7 +1687,7 @@ public boolean bindService(Intent service, ServiceConnection conn, int flags, in * stop at any time. * * @param conn The connection interface previously supplied to - * bindService(). + * bindService(). This parameter must not be null. * * @see #bindService */ @@ -1615,6 +1888,18 @@ public abstract boolean startInstrumentation(ComponentName className, */ public static final String NOTIFICATION_SERVICE = "notification"; + /** + * Use with {@link #getSystemService} to retrieve a + * {@link android.app.ProfileManager} for setting + * notification profiles. + * + * @see #getSystemService + * @see android.app.ProfileManager + * + * @hide + */ + public static final String PROFILE_SERVICE = "profile"; + /** * Use with {@link #getSystemService} to retrieve a * {@link android.view.accessibility.AccessibilityManager} for giving the user @@ -1904,6 +2189,15 @@ public abstract boolean startInstrumentation(ComponentName className, */ public static final String NFC_SERVICE = "nfc"; + /** + * Use with {@link #getSystemService} to retrieve a + * {@link android.bluetooth.BluetoothAdapter} for using Bluetooth. + * + * @see #getSystemService + * @hide + */ + public static final String BLUETOOTH_SERVICE = "bluetooth"; + /** * Use with {@link #getSystemService} to retrieve a * {@link android.net.sip.SipManager} for accessing the SIP related service. @@ -1943,6 +2237,15 @@ public abstract boolean startInstrumentation(ComponentName className, */ public static final String INPUT_SERVICE = "input"; + /** + * 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. @@ -1954,6 +2257,15 @@ public abstract boolean startInstrumentation(ComponentName className, */ public static final String SCHEDULING_POLICY_SERVICE = "scheduling_policy"; + /** + * Use with {@link #getSystemService} to retrieve a + * {@link android.os.UserManager} for managing users on devices that support multiple users. + * + * @see #getSystemService + * @see android.os.UserManager + */ + public static final String USER_SERVICE = "user"; + /** * Determine whether the given permission is allowed for a particular * process and user ID running in the system. @@ -2356,6 +2668,65 @@ public abstract void enforceUriPermission( public abstract Context createPackageContext(String packageName, int flags) throws PackageManager.NameNotFoundException; + /** + * Similar to {@link #createPackageContext(String, int)}, but with a + * different {@link UserHandle}. For example, {@link #getContentResolver()} + * will open any {@link Uri} as the given user. + * + * @hide + */ + public abstract Context createPackageContextAsUser( + String packageName, int flags, UserHandle user) + throws PackageManager.NameNotFoundException; + + /** + * Return a new Context object for the current Context but whose resources + * are adjusted to match the given Configuration. Each call to this method + * returns a new instance of a Context object; Context objects are not + * shared, however common state (ClassLoader, other Resources for the + * same configuration) may be so the Context itself can be fairly lightweight. + * + * @param overrideConfiguration A {@link Configuration} specifying what + * values to modify in the base Configuration of the original Context's + * resources. If the base configuration changes (such as due to an + * orientation change), the resources of this context will also change except + * for those that have been explicitly overridden with a value here. + * + * @return A Context with the given configuration override. + */ + public abstract Context createConfigurationContext(Configuration overrideConfiguration); + + /** + * Return a new Context object for the current Context but whose resources + * are adjusted to match the metrics of the given Display. Each call to this method + * returns a new instance of a Context object; Context objects are not + * shared, however common state (ClassLoader, other Resources for the + * same configuration) may be so the Context itself can be fairly lightweight. + * + * The returned display Context provides a {@link WindowManager} + * (see {@link #getSystemService(String)}) that is configured to show windows + * on the given display. The WindowManager's {@link WindowManager#getDefaultDisplay} + * method can be used to retrieve the Display from the returned Context. + * + * @param display A {@link Display} object specifying the display + * for whose metrics the Context's resources should be tailored and upon which + * new windows should be shown. + * + * @return A Context for the display. + */ + public abstract Context createDisplayContext(Display display); + + /** + * Gets the compatibility info holder for this context. This information + * is provided on a per-application basis and is used to simulate lower density + * display metrics for legacy applications. + * + * @param displayId The display id for which to get compatibility info. + * @return The compatibility info holder, or null if not required by the application. + * @hide + */ + public abstract CompatibilityInfoHolder getCompatibilityInfo(int displayId); + /** * Indicates whether this Context is restricted. * diff --git a/core/java/android/content/ContextWrapper.java b/core/java/android/content/ContextWrapper.java index 6b950e0eaa396..84ad6674309da 100644 --- a/core/java/android/content/ContextWrapper.java +++ b/core/java/android/content/ContextWrapper.java @@ -16,9 +16,13 @@ package android.content; +import android.app.Activity; +import android.app.ActivityManagerNative; +import android.app.LoadedApk; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.content.res.AssetManager; +import android.content.res.Configuration; import android.content.res.Resources; import android.database.DatabaseErrorHandler; import android.database.sqlite.SQLiteDatabase; @@ -29,6 +33,10 @@ import android.os.Bundle; import android.os.Handler; import android.os.Looper; +import android.os.RemoteException; +import android.os.UserHandle; +import android.view.CompatibilityInfoHolder; +import android.view.Display; import java.io.File; import java.io.FileInputStream; @@ -276,11 +284,23 @@ public void startActivity(Intent intent) { mBase.startActivity(intent); } + /** @hide */ + @Override + public void startActivityAsUser(Intent intent, UserHandle user) { + mBase.startActivityAsUser(intent, user); + } + @Override public void startActivity(Intent intent, Bundle options) { mBase.startActivity(intent, options); } + /** @hide */ + @Override + public void startActivityAsUser(Intent intent, Bundle options, UserHandle user) { + mBase.startActivityAsUser(intent, options, user); + } + @Override public void startActivities(Intent[] intents) { mBase.startActivities(intents); @@ -291,6 +311,12 @@ public void startActivities(Intent[] intents, Bundle options) { mBase.startActivities(intents, options); } + /** @hide */ + @Override + public void startActivitiesAsUser(Intent[] intents, Bundle options, UserHandle userHandle) { + mBase.startActivitiesAsUser(intents, options, userHandle); + } + @Override public void startIntentSender(IntentSender intent, Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags) @@ -312,12 +338,6 @@ public void sendBroadcast(Intent intent) { mBase.sendBroadcast(intent); } - /** @hide */ - @Override - public void sendBroadcast(Intent intent, int userId) { - mBase.sendBroadcast(intent, userId); - } - @Override public void sendBroadcast(Intent intent, String receiverPermission) { mBase.sendBroadcast(intent, receiverPermission); @@ -339,6 +359,25 @@ public void sendOrderedBroadcast( initialData, initialExtras); } + @Override + public void sendBroadcastAsUser(Intent intent, UserHandle user) { + mBase.sendBroadcastAsUser(intent, user); + } + + @Override + public void sendBroadcastAsUser(Intent intent, UserHandle user, + String receiverPermission) { + mBase.sendBroadcastAsUser(intent, user, receiverPermission); + } + + @Override + public void sendOrderedBroadcastAsUser(Intent intent, UserHandle user, + String receiverPermission, BroadcastReceiver resultReceiver, Handler scheduler, + int initialCode, String initialData, Bundle initialExtras) { + mBase.sendOrderedBroadcastAsUser(intent, user, receiverPermission, resultReceiver, + scheduler, initialCode, initialData, initialExtras); + } + @Override public void sendStickyBroadcast(Intent intent) { mBase.sendStickyBroadcast(intent); @@ -359,6 +398,25 @@ public void removeStickyBroadcast(Intent intent) { mBase.removeStickyBroadcast(intent); } + @Override + public void sendStickyBroadcastAsUser(Intent intent, UserHandle user) { + mBase.sendStickyBroadcastAsUser(intent, user); + } + + @Override + public void sendStickyOrderedBroadcastAsUser(Intent intent, + UserHandle user, BroadcastReceiver resultReceiver, + Handler scheduler, int initialCode, String initialData, + Bundle initialExtras) { + mBase.sendStickyOrderedBroadcastAsUser(intent, user, resultReceiver, + scheduler, initialCode, initialData, initialExtras); + } + + @Override + public void removeStickyBroadcastAsUser(Intent intent, UserHandle user) { + mBase.removeStickyBroadcastAsUser(intent, user); + } + @Override public Intent registerReceiver( BroadcastReceiver receiver, IntentFilter filter) { @@ -373,6 +431,15 @@ public Intent registerReceiver( scheduler); } + /** @hide */ + @Override + public Intent registerReceiverAsUser( + BroadcastReceiver receiver, UserHandle user, IntentFilter filter, + String broadcastPermission, Handler scheduler) { + return mBase.registerReceiverAsUser(receiver, user, filter, broadcastPermission, + scheduler); + } + @Override public void unregisterReceiver(BroadcastReceiver receiver) { mBase.unregisterReceiver(receiver); @@ -388,6 +455,18 @@ public boolean stopService(Intent name) { return mBase.stopService(name); } + /** @hide */ + @Override + public ComponentName startServiceAsUser(Intent service, UserHandle user) { + return mBase.startServiceAsUser(service, user); + } + + /** @hide */ + @Override + public boolean stopServiceAsUser(Intent name, UserHandle user) { + return mBase.stopServiceAsUser(name, user); + } + @Override public boolean bindService(Intent service, ServiceConnection conn, int flags) { @@ -396,8 +475,8 @@ public boolean bindService(Intent service, ServiceConnection conn, /** @hide */ @Override - public boolean bindService(Intent service, ServiceConnection conn, int flags, int userId) { - return mBase.bindService(service, conn, flags, userId); + public boolean bindService(Intent service, ServiceConnection conn, int flags, int userHandle) { + return mBase.bindService(service, conn, flags, userHandle); } @Override @@ -513,8 +592,31 @@ public Context createPackageContext(String packageName, int flags) return mBase.createPackageContext(packageName, flags); } + /** @hide */ + @Override + public Context createPackageContextAsUser(String packageName, int flags, UserHandle user) + throws PackageManager.NameNotFoundException { + return mBase.createPackageContextAsUser(packageName, flags, user); + } + + @Override + public Context createConfigurationContext(Configuration overrideConfiguration) { + return mBase.createConfigurationContext(overrideConfiguration); + } + + @Override + public Context createDisplayContext(Display display) { + return mBase.createDisplayContext(display); + } + @Override public boolean isRestricted() { return mBase.isRestricted(); } + + /** @hide */ + @Override + public CompatibilityInfoHolder getCompatibilityInfo(int displayId) { + return mBase.getCompatibilityInfo(displayId); + } } diff --git a/core/java/android/content/IContentService.aidl b/core/java/android/content/IContentService.aidl index 86a93925de3bb..f956bcfe25976 100644 --- a/core/java/android/content/IContentService.aidl +++ b/core/java/android/content/IContentService.aidl @@ -30,12 +30,28 @@ import android.database.IContentObserver; * @hide */ interface IContentService { - void registerContentObserver(in Uri uri, boolean notifyForDescendentsn, - IContentObserver observer); void unregisterContentObserver(IContentObserver observer); + /** + * Register a content observer tied to a specific user's view of the provider. + * @param userHandle the user whose view of the provider is to be observed. May be + * the calling user without requiring any permission, otherwise the caller needs to + * hold the INTERACT_ACROSS_USERS_FULL permission. Pseudousers USER_ALL and + * USER_CURRENT are properly handled. + */ + void registerContentObserver(in Uri uri, boolean notifyForDescendants, + IContentObserver observer, int userHandle); + + /** + * Notify observers of a particular user's view of the provider. + * @param userHandle the user whose view of the provider is to be notified. May be + * the calling user without requiring any permission, otherwise the caller needs to + * hold the INTERACT_ACROSS_USERS_FULL permission. Pseudousers USER_ALL + * USER_CURRENT are properly interpreted. + */ void notifyChange(in Uri uri, IContentObserver observer, - boolean observerWantsSelfNotifications, boolean syncToNetwork); + boolean observerWantsSelfNotifications, boolean syncToNetwork, + int userHandle); void requestSync(in Account account, String authority, in Bundle extras); void cancelSync(in Account account, String authority); diff --git a/core/java/android/content/IIntentReceiver.aidl b/core/java/android/content/IIntentReceiver.aidl index 6f2f7c4053b48..3d9272388e030 100755 --- a/core/java/android/content/IIntentReceiver.aidl +++ b/core/java/android/content/IIntentReceiver.aidl @@ -27,7 +27,7 @@ import android.os.Bundle; * {@hide} */ oneway interface IIntentReceiver { - void performReceive(in Intent intent, int resultCode, - String data, in Bundle extras, boolean ordered, boolean sticky); + void performReceive(in Intent intent, int resultCode, String data, + in Bundle extras, boolean ordered, boolean sticky, int sendingUser); } diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java index 3fdf451dcff68..519eb36533dfa 100644 --- a/core/java/android/content/Intent.java +++ b/core/java/android/content/Intent.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2006 The Android Open Source Project + * This code has been modified. Portions copyright (C) 2010, T-Mobile USA, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,7 +28,6 @@ import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.Rect; -import android.media.RemoteControlClient; import android.net.Uri; import android.os.Bundle; import android.os.IBinder; @@ -571,7 +571,9 @@ *

    • {@link #EXTRA_INITIAL_INTENTS} *
    • {@link #EXTRA_INTENT} *
    • {@link #EXTRA_KEY_EVENT} + *
    • {@link #EXTRA_ORIGINATING_URI} *
    • {@link #EXTRA_PHONE_NUMBER} + *
    • {@link #EXTRA_REFERRER} *
    • {@link #EXTRA_REMOTE_INTENT_TOKEN} *
    • {@link #EXTRA_REPLACING} *
    • {@link #EXTRA_SHORTCUT_ICON} @@ -1253,7 +1255,9 @@ public static Intent createChooser(Intent target, CharSequence title) { * Activity Action: Launch application installer. *

      * Input: The data must be a content: or file: URI at which the application - * can be retrieved. You can optionally supply + * can be retrieved. As of {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1}, + * you can also use "package:" to install an application for the + * current user that is already installed for another user. You can optionally supply * {@link #EXTRA_INSTALLER_PACKAGE_NAME}, {@link #EXTRA_NOT_UNKNOWN_SOURCE}, * {@link #EXTRA_ALLOW_REPLACE}, and {@link #EXTRA_RETURN_RESULT}. *

      @@ -1285,6 +1289,30 @@ public static Intent createChooser(Intent target, CharSequence title) { public static final String EXTRA_NOT_UNKNOWN_SOURCE = "android.intent.extra.NOT_UNKNOWN_SOURCE"; + /** + * Used as a URI extra field with {@link #ACTION_INSTALL_PACKAGE} and + * {@link #ACTION_VIEW} to indicate the URI from which the local APK in the Intent + * data field originated from. + */ + public static final String EXTRA_ORIGINATING_URI + = "android.intent.extra.ORIGINATING_URI"; + + /** + * Used as a URI extra field with {@link #ACTION_INSTALL_PACKAGE} and + * {@link #ACTION_VIEW} to indicate the HTTP referrer URI associated with the Intent + * data field or {@link #EXTRA_ORIGINATING_URI}. + */ + public static final String EXTRA_REFERRER + = "android.intent.extra.REFERRER"; + + /** + * Used as an int extra field with {@link #ACTION_INSTALL_PACKAGE} and + * {@link} #ACTION_VIEW} to indicate the uid of the package that initiated the install + * @hide + */ + public static final String EXTRA_ORIGINATING_UID + = "android.intent.extra.ORIGINATING_UID"; + /** * Used as a boolean extra field with {@link #ACTION_INSTALL_PACKAGE} to install a * package. Tells the installer UI to skip the confirmation with the user @@ -1327,6 +1355,13 @@ public static Intent createChooser(Intent target, CharSequence title) { @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) public static final String ACTION_UNINSTALL_PACKAGE = "android.intent.action.UNINSTALL_PACKAGE"; + /** + * Specify whether the package should be uninstalled for all users. + * @hide because these should not be part of normal application flow. + */ + public static final String EXTRA_UNINSTALL_ALL_USERS + = "android.intent.extra.UNINSTALL_ALL_USERS"; + /** * A string associated with a {@link #ACTION_UPGRADE_SETUP} activity * describing the last run version of the platform that was setup. @@ -1355,6 +1390,24 @@ public static Intent createChooser(Intent target, CharSequence title) { @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) public static final String ACTION_SCREEN_ON = "android.intent.action.SCREEN_ON"; + /** + * Broadcast Action: Sent after the system stops dreaming. + * + *

      This is a protected intent that can only be sent by the system. + * It is only sent to registered receivers.

      + */ + @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) + public static final String ACTION_DREAMING_STOPPED = "android.intent.action.DREAMING_STOPPED"; + + /** + * Broadcast Action: Sent after the system starts dreaming. + * + *

      This is a protected intent that can only be sent by the system. + * It is only sent to registered receivers.

      + */ + @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) + public static final String ACTION_DREAMING_STARTED = "android.intent.action.DREAMING_STARTED"; + /** * Broadcast Action: Sent when the user is present after device wakes up (e.g when the * keyguard is gone). @@ -1456,7 +1509,7 @@ public static Intent createChooser(Intent target, CharSequence title) { * Broadcast Action: A new application package has been installed on the * device. The data contains the name of the package. Note that the * newly installed package does not receive this broadcast. - *

      My include the following extras: + *

      May include the following extras: *

        *
      • {@link #EXTRA_UID} containing the integer uid assigned to the new package. *
      • {@link #EXTRA_REPLACING} is set to true if this is following @@ -1472,7 +1525,7 @@ public static Intent createChooser(Intent target, CharSequence title) { * Broadcast Action: A new version of an application package has been * installed, replacing an existing version that was previously installed. * The data contains the name of the package. - *

        My include the following extras: + *

        May include the following extras: *

          *
        • {@link #EXTRA_UID} containing the integer uid assigned to the new package. *
        @@ -1623,6 +1676,15 @@ public static Intent createChooser(Intent target, CharSequence title) { @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) public static final String ACTION_PACKAGE_NEEDS_VERIFICATION = "android.intent.action.PACKAGE_NEEDS_VERIFICATION"; + /** + * Broadcast Action: Sent to the system package verifier when a package is + * verified. The data contains the package URI. + *

        + * This is a protected intent that can only be sent by the system. + */ + @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) + public static final String ACTION_PACKAGE_VERIFIED = "android.intent.action.PACKAGE_VERIFIED"; + /** * Broadcast Action: Resources for a set of packages (which were * previously unavailable) are currently @@ -2075,6 +2137,31 @@ public static Intent createChooser(Intent target, CharSequence title) { public static final String ACTION_HEADSET_PLUG = "android.intent.action.HEADSET_PLUG"; + /** + * Broadcast Action: WiFi Display audio is enabled or disabled + * + *

        The intent will have the following extra values: + *

          + *
        • state - 0 for disabled, 1 for enabled.
        • + *
        + * @hide + */ + public static final String ACTION_WIFI_DISPLAY_AUDIO = + "qualcomm.intent.action.WIFI_DISPLAY_AUDIO"; + + /** + * Broadcast Action: WiFi Display video is enabled or disabled + * + *

        The intent will have the following extra values: + *

          + *
        • state - 0 for disabled, 1 for enabled.
        • + *
        + * @hide + */ + + public static final String ACTION_WIFI_DISPLAY_VIDEO = + "qualcomm.intent.action.WIFI_DISPLAY_VIDEO"; + /** * Broadcast Action: An analog audio speaker/headset plugged in or unplugged. * @@ -2261,29 +2348,162 @@ public static Intent createChooser(Intent target, CharSequence title) { "android.intent.action.PRE_BOOT_COMPLETED"; /** - * Broadcast sent to the system when a user is added. Carries an extra EXTRA_USERID that has the - * userid of the new user. + * Sent the first time a user is starting, to allow system apps to + * perform one time initialization. (This will not be seen by third + * party applications because a newly initialized user does not have any + * third party applications installed for it.) This is sent early in + * starting the user, around the time the home app is started, before + * {@link #ACTION_BOOT_COMPLETED} is sent. This is sent as a foreground + * broadcast, since it is part of a visible user interaction; be as quick + * as possible when handling it. + */ + public static final String ACTION_USER_INITIALIZE = + "android.intent.action.USER_INITIALIZE"; + + /** + * Sent when a user switch is happening, causing the process's user to be + * brought to the foreground. This is only sent to receivers registered + * through {@link Context#registerReceiver(BroadcastReceiver, IntentFilter) + * Context.registerReceiver}. It is sent to the user that is going to the + * foreground. This is sent as a foreground + * broadcast, since it is part of a visible user interaction; be as quick + * as possible when handling it. + */ + public static final String ACTION_USER_FOREGROUND = + "android.intent.action.USER_FOREGROUND"; + + /** + * Sent when a user switch is happening, causing the process's user to be + * sent to the background. This is only sent to receivers registered + * through {@link Context#registerReceiver(BroadcastReceiver, IntentFilter) + * Context.registerReceiver}. It is sent to the user that is going to the + * background. This is sent as a foreground + * broadcast, since it is part of a visible user interaction; be as quick + * as possible when handling it. + */ + public static final String ACTION_USER_BACKGROUND = + "android.intent.action.USER_BACKGROUND"; + + /** + * Broadcast sent to the system when a user is added. Carries an extra + * EXTRA_USER_HANDLE that has the userHandle of the new user. It is sent to + * all running users. You must hold + * {@link android.Manifest.permission#MANAGE_USERS} to receive this broadcast. * @hide */ public static final String ACTION_USER_ADDED = "android.intent.action.USER_ADDED"; /** - * Broadcast sent to the system when a user is removed. Carries an extra EXTRA_USERID that has - * the userid of the user. + * Broadcast sent by the system when a user is started. Carries an extra + * EXTRA_USER_HANDLE that has the userHandle of the user. This is only sent to + * registered receivers, not manifest receivers. It is sent to the user + * that has been started. This is sent as a foreground + * broadcast, since it is part of a visible user interaction; be as quick + * as possible when handling it. + * @hide + */ + public static final String ACTION_USER_STARTED = + "android.intent.action.USER_STARTED"; + + /** + * Broadcast sent when a user is in the process of starting. Carries an extra + * EXTRA_USER_HANDLE that has the userHandle of the user. This is only + * sent to registered receivers, not manifest receivers. It is sent to all + * users (including the one that is being started). You must hold + * {@link android.Manifest.permission#INTERACT_ACROSS_USERS} to receive + * this broadcast. This is sent as a background broadcast, since + * its result is not part of the primary UX flow; to safely keep track of + * started/stopped state of a user you can use this in conjunction with + * {@link #ACTION_USER_STOPPING}. It is not generally safe to use with + * other user state broadcasts since those are foreground broadcasts so can + * execute in a different order. + * @hide + */ + public static final String ACTION_USER_STARTING = + "android.intent.action.USER_STARTING"; + + /** + * Broadcast sent when a user is going to be stopped. Carries an extra + * EXTRA_USER_HANDLE that has the userHandle of the user. This is only + * sent to registered receivers, not manifest receivers. It is sent to all + * users (including the one that is being stopped). You must hold + * {@link android.Manifest.permission#INTERACT_ACROSS_USERS} to receive + * this broadcast. The user will not stop until all receivers have + * handled the broadcast. This is sent as a background broadcast, since + * its result is not part of the primary UX flow; to safely keep track of + * started/stopped state of a user you can use this in conjunction with + * {@link #ACTION_USER_STARTING}. It is not generally safe to use with + * other user state broadcasts since those are foreground broadcasts so can + * execute in a different order. + * @hide + */ + public static final String ACTION_USER_STOPPING = + "android.intent.action.USER_STOPPING"; + + /** + * Broadcast sent to the system when a user is stopped. Carries an extra + * EXTRA_USER_HANDLE that has the userHandle of the user. This is similar to + * {@link #ACTION_PACKAGE_RESTARTED}, but for an entire user instead of a + * specific package. This is only sent to registered receivers, not manifest + * receivers. It is sent to all running users except the one that + * has just been stopped (which is no longer running). + * @hide + */ + public static final String ACTION_USER_STOPPED = + "android.intent.action.USER_STOPPED"; + + /** + * Broadcast sent to the system when a user is removed. Carries an extra EXTRA_USER_HANDLE that has + * the userHandle of the user. It is sent to all running users except the + * one that has been removed. The user will not be completely removed until all receivers have + * handled the broadcast. You must hold + * {@link android.Manifest.permission#MANAGE_USERS} to receive this broadcast. * @hide */ public static final String ACTION_USER_REMOVED = "android.intent.action.USER_REMOVED"; /** - * Broadcast sent to the system when the user switches. Carries an extra EXTRA_USERID that has - * the userid of the user to become the current one. + * Broadcast sent to the system when the user switches. Carries an extra EXTRA_USER_HANDLE that has + * the userHandle of the user to become the current one. This is only sent to + * registered receivers, not manifest receivers. It is sent to all running users. + * You must hold + * {@link android.Manifest.permission#MANAGE_USERS} to receive this broadcast. * @hide */ public static final String ACTION_USER_SWITCHED = "android.intent.action.USER_SWITCHED"; + /** + * Broadcast sent to the system when a user's information changes. Carries an extra + * {@link #EXTRA_USER_HANDLE} to indicate which user's information changed. + * This is only sent to registered receivers, not manifest receivers. It is sent to the user + * whose information has changed. + * @hide + */ + public static final String ACTION_USER_INFO_CHANGED = + "android.intent.action.USER_INFO_CHANGED"; + + /** + * Sent when the user taps on the clock widget in the system's "quick settings" area. + */ + public static final String ACTION_QUICK_CLOCK = + "android.intent.action.QUICK_CLOCK"; + + /** + * Broadcast Action: Indicate that unrecoverable error happened during app launch. + * Could indicate that curently applied theme is malicious. + * @hide + */ + public static final String ACTION_APP_LAUNCH_FAILURE = "com.tmobile.intent.action.APP_LAUNCH_FAILURE"; + + /** + * Broadcast Action: Request to reset the unrecoverable errors count to 0. + * @hide + */ + public static final String ACTION_APP_LAUNCH_FAILURE_RESET = "com.tmobile.intent.action.APP_LAUNCH_FAILURE_RESET"; + // --------------------------------------------------------------------- // --------------------------------------------------------------------- // Standard intent categories (see addCategory()). @@ -2416,6 +2636,7 @@ public static Intent createChooser(Intent target, CharSequence title) { */ public static final String CATEGORY_FRAMEWORK_INSTRUMENTATION_TEST = "android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST"; + /** * An activity to run when device is inserted into a car dock. * Used with {@link #ACTION_MAIN} to launch an activity. For more @@ -2452,6 +2673,14 @@ public static Intent createChooser(Intent target, CharSequence title) { @SdkConstant(SdkConstantType.INTENT_CATEGORY) public static final String CATEGORY_CAR_MODE = "android.intent.category.CAR_MODE"; + /** + * Used to indicate that a theme package has been installed or un-installed. + * + * @hide + */ + public static final String CATEGORY_THEME_PACKAGE_INSTALLED_STATE_CHANGE = + "com.tmobile.intent.category.THEME_PACKAGE_INSTALL_STATE_CHANGE"; + // --------------------------------------------------------------------- // --------------------------------------------------------------------- // Application launch intent categories (see addCategory()). @@ -2692,6 +2921,15 @@ public static Intent createChooser(Intent target, CharSequence title) { */ public static final String EXTRA_DATA_REMOVED = "android.intent.extra.DATA_REMOVED"; + /** + * @hide + * Used as a boolean extra field in {@link android.content.Intent#ACTION_PACKAGE_REMOVED} + * intents to indicate that at this point the package has been removed for + * all users on the device. + */ + public static final String EXTRA_REMOVED_FOR_ALL_USERS + = "android.intent.extra.REMOVED_FOR_ALL_USERS"; + /** * Used as a boolean extra field in {@link android.content.Intent#ACTION_PACKAGE_REMOVED} * intents to indicate that this is a replacement of the package, so this @@ -2834,12 +3072,12 @@ public static Intent createChooser(Intent target, CharSequence title) { "android.intent.extra.LOCAL_ONLY"; /** - * The userid carried with broadcast intents related to addition, removal and switching of users + * The userHandle carried with broadcast intents related to addition, removal and switching of users * - {@link #ACTION_USER_ADDED}, {@link #ACTION_USER_REMOVED} and {@link #ACTION_USER_SWITCHED}. * @hide */ - public static final String EXTRA_USERID = - "android.intent.extra.user_id"; + public static final String EXTRA_USER_HANDLE = + "android.intent.extra.user_handle"; // --------------------------------------------------------------------- // --------------------------------------------------------------------- diff --git a/core/java/android/content/IntentSender.java b/core/java/android/content/IntentSender.java index 4db4bdca3657f..166495ba94223 100644 --- a/core/java/android/content/IntentSender.java +++ b/core/java/android/content/IntentSender.java @@ -27,6 +27,7 @@ import android.os.IBinder; import android.os.Parcel; import android.os.Parcelable; +import android.os.UserHandle; import android.util.AndroidException; @@ -113,8 +114,8 @@ private static class FinishedDispatcher extends IIntentReceiver.Stub mWho = who; mHandler = handler; } - public void performReceive(Intent intent, int resultCode, - String data, Bundle extras, boolean serialized, boolean sticky) { + public void performReceive(Intent intent, int resultCode, String data, + Bundle extras, boolean serialized, boolean sticky, int sendingUser) { mIntent = intent; mResultCode = resultCode; mResultData = data; @@ -203,6 +204,20 @@ public void sendIntent(Context context, int code, Intent intent, } } + /** + * @deprecated Renamed to {@link #getCreatorPackage()}. + */ + @Deprecated + public String getTargetPackage() { + try { + return ActivityManagerNative.getDefault() + .getPackageForIntentSender(mTarget); + } catch (RemoteException e) { + // Should never happen. + return null; + } + } + /** * Return the package name of the application that created this * IntentSender, that is the identity under which you will actually be @@ -212,7 +227,7 @@ public void sendIntent(Context context, int code, Intent intent, * @return The package name of the PendingIntent, or null if there is * none associated with it. */ - public String getTargetPackage() { + public String getCreatorPackage() { try { return ActivityManagerNative.getDefault() .getPackageForIntentSender(mTarget); @@ -222,6 +237,47 @@ public String getTargetPackage() { } } + /** + * Return the uid of the application that created this + * PendingIntent, that is the identity under which you will actually be + * sending the Intent. The returned integer is supplied by the system, so + * that an application can not spoof its uid. + * + * @return The uid of the PendingIntent, or -1 if there is + * none associated with it. + */ + public int getCreatorUid() { + try { + return ActivityManagerNative.getDefault() + .getUidForIntentSender(mTarget); + } catch (RemoteException e) { + // Should never happen. + return -1; + } + } + + /** + * Return the user handle of the application that created this + * PendingIntent, that is the user under which you will actually be + * sending the Intent. The returned UserHandle is supplied by the system, so + * that an application can not spoof its user. See + * {@link android.os.Process#myUserHandle() Process.myUserHandle()} for + * more explanation of user handles. + * + * @return The user handle of the PendingIntent, or null if there is + * none associated with it. + */ + public UserHandle getCreatorUserHandle() { + try { + int uid = ActivityManagerNative.getDefault() + .getUidForIntentSender(mTarget); + return uid > 0 ? new UserHandle(UserHandle.getUserId(uid)) : null; + } catch (RemoteException e) { + // Should never happen. + return null; + } + } + /** * Comparison operator on two IntentSender objects, such that true * is returned then they both represent the same operation from the diff --git a/core/java/android/content/SharedPreferences.java b/core/java/android/content/SharedPreferences.java index bdc38d649a539..da5480e4bdf53 100644 --- a/core/java/android/content/SharedPreferences.java +++ b/core/java/android/content/SharedPreferences.java @@ -25,7 +25,8 @@ * there is a single instance of this class that all clients share. * Modifications to the preferences must go through an {@link Editor} object * to ensure the preference values remain in a consistent state and control - * when they are committed to storage. + * when they are committed to storage. Objects that are returned from the + * various get methods must be treated as immutable by the application. * *

        Note: currently this class does not support use across multiple * processes. This will be added later. @@ -226,6 +227,10 @@ public interface Editor { /** * Retrieve all values from the preferences. * + *

        Note that you must not modify the collection returned + * by this method, or alter any of its contents. The consistency of your + * stored data is not guaranteed if you do. + * * @return Returns a map containing a list of pairs key/value representing * the preferences. * @@ -250,6 +255,10 @@ public interface Editor { /** * Retrieve a set of String values from the preferences. * + *

        Note that you must not modify the set instance returned + * by this call. The consistency of the stored data is not guaranteed + * if you do, nor is your ability to modify the instance at all. + * * @param key The name of the preference to retrieve. * @param defValues Values to return if this preference does not exist. * diff --git a/core/java/android/content/SyncManager.java b/core/java/android/content/SyncManager.java index badcb03a0e4a7..bc8f18b856ef2 100644 --- a/core/java/android/content/SyncManager.java +++ b/core/java/android/content/SyncManager.java @@ -16,18 +16,13 @@ package android.content; -import com.android.internal.R; -import com.google.android.collect.Lists; -import com.google.android.collect.Maps; - +import com.android.internal.app.ThemeUtils; import android.accounts.Account; import android.accounts.AccountAndUser; import android.accounts.AccountManager; import android.accounts.AccountManagerService; -import android.accounts.OnAccountsUpdateListener; import android.app.ActivityManager; import android.app.AlarmManager; -import android.app.AppGlobals; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; @@ -52,7 +47,8 @@ import android.os.RemoteException; import android.os.SystemClock; import android.os.SystemProperties; -import android.os.UserId; +import android.os.UserHandle; +import android.os.UserManager; import android.os.WorkSource; import android.provider.Settings; import android.text.format.DateUtils; @@ -60,6 +56,13 @@ import android.util.EventLog; import android.util.Log; import android.util.Pair; +import android.util.Slog; + +import com.android.internal.R; +import com.android.internal.util.IndentingPrintWriter; +import com.google.android.collect.Lists; +import com.google.android.collect.Maps; +import com.google.android.collect.Sets; import java.io.FileDescriptor; import java.io.PrintWriter; @@ -74,12 +77,13 @@ import java.util.List; import java.util.Map; import java.util.Random; +import java.util.Set; import java.util.concurrent.CountDownLatch; /** * @hide */ -public class SyncManager implements OnAccountsUpdateListener { +public class SyncManager { private static final String TAG = "SyncManager"; /** Delay a sync due to local changes this long. In milliseconds */ @@ -136,10 +140,12 @@ public class SyncManager implements OnAccountsUpdateListener { private static final int MAX_SIMULTANEOUS_INITIALIZATION_SYNCS; private Context mContext; + private Context mUiContext; private static final AccountAndUser[] INITIAL_ACCOUNTS_ARRAY = new AccountAndUser[0]; - private volatile AccountAndUser[] mAccounts = INITIAL_ACCOUNTS_ARRAY; + // TODO: add better locking around mRunningAccounts + private volatile AccountAndUser[] mRunningAccounts = INITIAL_ACCOUNTS_ARRAY; volatile private PowerManager.WakeLock mHandleAlarmWakeLock; volatile private PowerManager.WakeLock mSyncManagerWakeLock; @@ -150,7 +156,9 @@ public class SyncManager implements OnAccountsUpdateListener { private AlarmManager mAlarmService = null; private SyncStorageEngine mSyncStorageEngine; - public SyncQueue mSyncQueue; + + // @GuardedBy("mSyncQueue") + private final SyncQueue mSyncQueue; protected final ArrayList mActiveSyncContexts = Lists.newArrayList(); @@ -173,7 +181,7 @@ public void onReceive(Context context, Intent intent) { Log.v(TAG, "Internal storage is low."); } mStorageIsLow = true; - cancelActiveSync(null /* any account */, UserId.USER_ALL, + cancelActiveSync(null /* any account */, UserHandle.USER_ALL, null /* any authority */); } else if (Intent.ACTION_DEVICE_STORAGE_OK.equals(action)) { if (Log.isLoggable(TAG, Log.VERBOSE)) { @@ -191,31 +199,43 @@ public void onReceive(Context context, Intent intent) { } }; + private BroadcastReceiver mThemeChangeReceiver = new BroadcastReceiver() { + public void onReceive(Context context, Intent intent) { + mUiContext = null; + } + }; + private BroadcastReceiver mBackgroundDataSettingChanged = new BroadcastReceiver() { public void onReceive(Context context, Intent intent) { if (getConnectivityManager().getBackgroundDataSetting()) { - scheduleSync(null /* account */, UserId.USER_ALL, null /* authority */, + scheduleSync(null /* account */, UserHandle.USER_ALL, null /* authority */, new Bundle(), 0 /* delay */, false /* onlyThoseWithUnknownSyncableState */); } } }; + private BroadcastReceiver mAccountsUpdatedReceiver = new BroadcastReceiver() { + public void onReceive(Context context, Intent intent) { + updateRunningAccounts(); + + // Kick off sync for everyone, since this was a radical account change + scheduleSync(null, UserHandle.USER_ALL, null, null, 0 /* no delay */, false); + } + }; + private final PowerManager mPowerManager; // Use this as a random offset to seed all periodic syncs private int mSyncRandomOffsetMillis; + private final UserManager mUserManager; + private static final long SYNC_ALARM_TIMEOUT_MIN = 30 * 1000; // 30 seconds private static final long SYNC_ALARM_TIMEOUT_MAX = 2 * 60 * 60 * 1000; // two hours private List getAllUsers() { - try { - return AppGlobals.getPackageManager().getUsers(); - } catch (RemoteException re) { - // Local to system process, shouldn't happen - } - return null; + return mUserManager.getUsers(); } private boolean containsAccountAndUser(AccountAndUser[] accounts, Account account, int userId) { @@ -230,33 +250,18 @@ private boolean containsAccountAndUser(AccountAndUser[] accounts, Account accoun return found; } - public void onAccountsUpdated(Account[] accounts) { - // remember if this was the first time this was called after an update - final boolean justBootedUp = mAccounts == INITIAL_ACCOUNTS_ARRAY; - - List users = getAllUsers(); - if (users == null) return; - - int count = 0; + public void updateRunningAccounts() { + mRunningAccounts = AccountManagerService.getSingleton().getRunningAccounts(); - // Get accounts from AccountManager for all the users on the system - // TODO: Limit this to active users, when such a concept exists. - AccountAndUser[] allAccounts = AccountManagerService.getSingleton().getAllAccounts(); - for (UserInfo user : users) { - if (mBootCompleted) { - Account[] accountsForUser = - AccountManagerService.getSingleton().getAccounts(user.id); - mSyncStorageEngine.doDatabaseCleanup(accountsForUser, user.id); - } + if (mBootCompleted) { + doDatabaseCleanup(); } - mAccounts = allAccounts; - for (ActiveSyncContext currentSyncContext : mActiveSyncContexts) { - if (!containsAccountAndUser(allAccounts, + if (!containsAccountAndUser(mRunningAccounts, currentSyncContext.mSyncOperation.account, currentSyncContext.mSyncOperation.userId)) { - Log.d(TAG, "canceling sync since the account has been removed"); + Log.d(TAG, "canceling sync since the account is no longer running"); sendSyncFinishedOrCanceledMessage(currentSyncContext, null /* no result since this is a cancel */); } @@ -265,25 +270,14 @@ public void onAccountsUpdated(Account[] accounts) { // we must do this since we don't bother scheduling alarms when // the accounts are not set yet sendCheckAlarmsMessage(); + } - if (allAccounts.length > 0) { - // If this is the first time this was called after a bootup then - // the accounts haven't really changed, instead they were just loaded - // from the AccountManager. Otherwise at least one of the accounts - // has a change. - // - // If there was a real account change then force a sync of all accounts. - // This is a bit of overkill, but at least it will end up retrying syncs - // that failed due to an authentication failure and thus will recover if the - // account change was a password update. - // - // If this was the bootup case then don't sync everything, instead only - // sync those that have an unknown syncable state, which will give them - // a chance to set their syncable state. - - boolean onlyThoseWithUnkownSyncableState = justBootedUp; - scheduleSync(null, UserId.USER_ALL, null, null, 0 /* no delay */, - onlyThoseWithUnkownSyncableState); + private void doDatabaseCleanup() { + for (UserInfo user : mUserManager.getUsers(true)) { + // Skip any partially created/removed users + if (user.partial) continue; + Account[] accountsForUser = AccountManagerService.getSingleton().getAccounts(user.id); + mSyncStorageEngine.doDatabaseCleanup(accountsForUser, user.id); } } @@ -323,7 +317,17 @@ public void onReceive(Context context, Intent intent) { private BroadcastReceiver mUserIntentReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { - onUserRemoved(intent); + String action = intent.getAction(); + final int userId = intent.getIntExtra(Intent.EXTRA_USER_HANDLE, UserHandle.USER_NULL); + if (userId == UserHandle.USER_NULL) return; + + if (Intent.ACTION_USER_REMOVED.equals(action)) { + onUserRemoved(userId); + } else if (Intent.ACTION_USER_STARTING.equals(action)) { + onUserStarting(userId); + } else if (Intent.ACTION_USER_STOPPING.equals(action)) { + onUserStopping(userId); + } } }; @@ -342,10 +346,15 @@ private ConnectivityManager getConnectivityManager() { } } + /** + * Should only be created after {@link ContentService#systemReady()} so that + * {@link PackageManager} is ready to query. + */ public SyncManager(Context context, boolean factoryTest) { // Initialize the SyncStorageEngine first, before registering observers // and creating threads and so on; it may fail if the disk is full. mContext = context; + SyncStorageEngine.init(context); mSyncStorageEngine = SyncStorageEngine.getSingleton(); mSyncStorageEngine.setOnSyncRequestListener(new OnSyncRequestListener() { @@ -364,9 +373,10 @@ public void onSyncRequest(Account account, int userId, String authority, mSyncHandler = new SyncHandler(syncThread.getLooper()); mSyncAdapters.setListener(new RegisteredServicesCacheListener() { - public void onServiceChanged(SyncAdapterType type, boolean removed) { + @Override + public void onServiceChanged(SyncAdapterType type, int userId, boolean removed) { if (!removed) { - scheduleSync(null, UserId.USER_ALL, type.authority, null, 0 /* no delay */, + scheduleSync(null, UserHandle.USER_ALL, type.authority, null, 0 /* no delay */, false /* onlyThoseWithUnkownSyncableState */); } } @@ -396,7 +406,12 @@ public void onServiceChanged(SyncAdapterType type, boolean removed) { intentFilter = new IntentFilter(); intentFilter.addAction(Intent.ACTION_USER_REMOVED); - mContext.registerReceiver(mUserIntentReceiver, intentFilter); + intentFilter.addAction(Intent.ACTION_USER_STARTING); + intentFilter.addAction(Intent.ACTION_USER_STOPPING); + mContext.registerReceiverAsUser( + mUserIntentReceiver, UserHandle.ALL, intentFilter, null, null); + + ThemeUtils.registerThemeChangeReceiver(mContext, mThemeChangeReceiver); if (!factoryTest) { mNotificationMgr = (NotificationManager) @@ -407,6 +422,7 @@ public void onServiceChanged(SyncAdapterType type, boolean removed) { mNotificationMgr = null; } mPowerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE); + mUserManager = (UserManager) mContext.getSystemService(Context.USER_SERVICE); // This WakeLock is used to ensure that we stay awake between the time that we receive // a sync alarm notification and when we finish processing it. We need to do this @@ -434,10 +450,11 @@ public void onStatusChanged(int which) { }); if (!factoryTest) { - AccountManager.get(mContext).addOnAccountsUpdatedListener(SyncManager.this, - mSyncHandler, false /* updateImmediately */); - // do this synchronously to ensure we have the accounts before this call returns - onAccountsUpdated(null); + // Register for account list updates for all users + mContext.registerReceiverAsUser(mAccountsUpdatedReceiver, + UserHandle.ALL, + new IntentFilter(AccountManager.LOGIN_ACCOUNTS_CHANGED_ACTION), + null, null); } // Pick a random second in a day to seed all periodic syncs @@ -512,12 +529,12 @@ public void scheduleSync(Account requestedAccount, int userId, String requestedA } AccountAndUser[] accounts; - if (requestedAccount != null && userId != UserId.USER_ALL) { + if (requestedAccount != null && userId != UserHandle.USER_ALL) { accounts = new AccountAndUser[] { new AccountAndUser(requestedAccount, userId) }; } else { // if the accounts aren't configured yet then we can't support an account-less // sync request - accounts = mAccounts; + accounts = mRunningAccounts; if (accounts.length == 0) { if (isLoggable) { Log.v(TAG, "scheduleSync: no accounts configured, dropping"); @@ -548,32 +565,33 @@ public void scheduleSync(Account requestedAccount, int userId, String requestedA source = SyncStorageEngine.SOURCE_SERVER; } - // Compile a list of authorities that have sync adapters. - // For each authority sync each account that matches a sync adapter. - final HashSet syncableAuthorities = new HashSet(); - for (RegisteredServicesCache.ServiceInfo syncAdapter : - mSyncAdapters.getAllServices()) { - syncableAuthorities.add(syncAdapter.type.authority); - } + for (AccountAndUser account : accounts) { + // Compile a list of authorities that have sync adapters. + // For each authority sync each account that matches a sync adapter. + final HashSet syncableAuthorities = new HashSet(); + for (RegisteredServicesCache.ServiceInfo syncAdapter : + mSyncAdapters.getAllServices(account.userId)) { + syncableAuthorities.add(syncAdapter.type.authority); + } - // if the url was specified then replace the list of authorities with just this authority - // or clear it if this authority isn't syncable - if (requestedAuthority != null) { - final boolean hasSyncAdapter = syncableAuthorities.contains(requestedAuthority); - syncableAuthorities.clear(); - if (hasSyncAdapter) syncableAuthorities.add(requestedAuthority); - } + // if the url was specified then replace the list of authorities + // with just this authority or clear it if this authority isn't + // syncable + if (requestedAuthority != null) { + final boolean hasSyncAdapter = syncableAuthorities.contains(requestedAuthority); + syncableAuthorities.clear(); + if (hasSyncAdapter) syncableAuthorities.add(requestedAuthority); + } - for (String authority : syncableAuthorities) { - for (AccountAndUser account : accounts) { + for (String authority : syncableAuthorities) { int isSyncable = mSyncStorageEngine.getIsSyncable(account.account, account.userId, authority); if (isSyncable == 0) { continue; } - final RegisteredServicesCache.ServiceInfo syncAdapterInfo = - mSyncAdapters.getServiceInfo( - SyncAdapterType.newKey(authority, account.account.type)); + final RegisteredServicesCache.ServiceInfo syncAdapterInfo; + syncAdapterInfo = mSyncAdapters.getServiceInfo( + SyncAdapterType.newKey(authority, account.account.type), account.userId); if (syncAdapterInfo == null) { continue; } @@ -650,10 +668,9 @@ public void scheduleLocalSync(Account account, int userId, String authority) { false /* onlyThoseWithUnkownSyncableState */); } - public SyncAdapterType[] getSyncAdapterTypes() { - final Collection> - serviceInfos = - mSyncAdapters.getAllServices(); + public SyncAdapterType[] getSyncAdapterTypes(int userId) { + final Collection> serviceInfos; + serviceInfos = mSyncAdapters.getAllServices(userId); SyncAdapterType[] types = new SyncAdapterType[serviceInfos.size()]; int i = 0; for (RegisteredServicesCache.ServiceInfo serviceInfo : serviceInfos) { @@ -746,8 +763,8 @@ private void increaseBackoffSetting(SyncOperation op) { } // Cap the delay - long maxSyncRetryTimeInSeconds = Settings.Secure.getLong(mContext.getContentResolver(), - Settings.Secure.SYNC_MAX_RETRY_DELAY_IN_SECONDS, + long maxSyncRetryTimeInSeconds = Settings.Global.getLong(mContext.getContentResolver(), + Settings.Global.SYNC_MAX_RETRY_DELAY_IN_SECONDS, DEFAULT_MAX_SYNC_RETRY_TIME_IN_SECONDS); if (newDelayInMs > maxSyncRetryTimeInSeconds * 1000) { newDelayInMs = maxSyncRetryTimeInSeconds * 1000; @@ -889,18 +906,54 @@ void maybeRescheduleSync(SyncResult syncResult, SyncOperation operation) { } } - private void onUserRemoved(Intent intent) { - int userId = intent.getIntExtra(Intent.EXTRA_USERID, -1); - if (userId == -1) return; + private void onUserStarting(int userId) { + // Make sure that accounts we're about to use are valid + AccountManagerService.getSingleton().validateAccounts(userId); + + mSyncAdapters.invalidateCache(userId); + + updateRunningAccounts(); + + synchronized (mSyncQueue) { + mSyncQueue.addPendingOperations(userId); + } + + // Schedule sync for any accounts under started user + final Account[] accounts = AccountManagerService.getSingleton().getAccounts(userId); + for (Account account : accounts) { + scheduleSync(account, userId, null, null, 0 /* no delay */, + true /* onlyThoseWithUnknownSyncableState */); + } + + sendCheckAlarmsMessage(); + } + + private void onUserStopping(int userId) { + updateRunningAccounts(); + + cancelActiveSync( + null /* any account */, + userId, + null /* any authority */); + } + + private void onUserRemoved(int userId) { + updateRunningAccounts(); // Clean up the storage engine database mSyncStorageEngine.doDatabaseCleanup(new Account[0], userId); - onAccountsUpdated(null); synchronized (mSyncQueue) { mSyncQueue.removeUser(userId); } } + private Context getUiContext() { + if (mUiContext == null) { + mUiContext = ThemeUtils.createUiContext(mContext); + } + return mUiContext != null ? mUiContext : mContext; + } + /** * @hide */ @@ -975,7 +1028,7 @@ public void onServiceDisconnected(ComponentName name) { mSyncHandler.sendMessage(msg); } - boolean bindToSyncAdapter(RegisteredServicesCache.ServiceInfo info) { + boolean bindToSyncAdapter(RegisteredServicesCache.ServiceInfo info, int userId) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.d(TAG, "bindToSyncAdapter: " + info.componentName + ", connection " + this); } @@ -984,8 +1037,9 @@ boolean bindToSyncAdapter(RegisteredServicesCache.ServiceInfo info) { intent.setComponent(info.componentName); intent.putExtra(Intent.EXTRA_CLIENT_LABEL, com.android.internal.R.string.sync_binding_label); - intent.putExtra(Intent.EXTRA_CLIENT_INTENT, PendingIntent.getActivity( - mContext, 0, new Intent(Settings.ACTION_SYNC_SETTINGS), 0)); + intent.putExtra(Intent.EXTRA_CLIENT_INTENT, PendingIntent.getActivityAsUser( + mContext, 0, new Intent(Settings.ACTION_SYNC_SETTINGS), 0, + null, new UserHandle(userId))); mBound = true; final boolean bindResult = mContext.bindService(intent, this, Context.BIND_AUTO_CREATE | Context.BIND_NOT_FOREGROUND @@ -1027,14 +1081,10 @@ public void binderDied() { } protected void dump(FileDescriptor fd, PrintWriter pw) { - dumpSyncState(pw); - dumpSyncHistory(pw); - - pw.println(); - pw.println("SyncAdapters:"); - for (RegisteredServicesCache.ServiceInfo info : mSyncAdapters.getAllServices()) { - pw.println(" " + info); - } + final IndentingPrintWriter ipw = new IndentingPrintWriter(pw, " "); + dumpSyncState(ipw); + dumpSyncHistory(ipw); + dumpSyncAdapters(ipw); } static String formatTime(long time) { @@ -1050,13 +1100,13 @@ protected void dumpSyncState(PrintWriter pw) { if (users != null) { for (UserInfo user : users) { pw.print("u" + user.id + "=" - + mSyncStorageEngine.getMasterSyncAutomatically(user.id)); + + mSyncStorageEngine.getMasterSyncAutomatically(user.id) + " "); } pw.println(); } pw.print("memory low: "); pw.println(mStorageIsLow); - final AccountAndUser[] accounts = mAccounts; + final AccountAndUser[] accounts = AccountManagerService.getSingleton().getAllAccounts(); pw.print("accounts: "); if (accounts != INITIAL_ACCOUNTS_ARRAY) { @@ -1118,7 +1168,7 @@ protected void dumpSyncState(PrintWriter pw) { pw.print(" "); pw.print(account.account.type); pw.println(":"); for (RegisteredServicesCache.ServiceInfo syncAdapterType : - mSyncAdapters.getAllServices()) { + mSyncAdapters.getAllServices(account.userId)) { if (!syncAdapterType.type.accountType.equals(account.account.type)) { continue; } @@ -1261,7 +1311,8 @@ private void dumpRecentHistory(PrintWriter pw) { final String accountKey; if (authority != null) { authorityName = authority.authority; - accountKey = authority.account.name + "/" + authority.account.type; + accountKey = authority.account.name + "/" + authority.account.type + + " u" + authority.userId; } else { authorityName = "Unknown"; accountKey = "Unknown"; @@ -1388,7 +1439,8 @@ public int compare(AccountSyncStats lhs, AccountSyncStats rhs) { final String accountKey; if (authority != null) { authorityName = authority.authority; - accountKey = authority.account.name + "/" + authority.account.type; + accountKey = authority.account.name + "/" + authority.account.type + + " u" + authority.userId; } else { authorityName = "Unknown"; accountKey = "Unknown"; @@ -1493,6 +1545,23 @@ private void dumpDayStatistics(PrintWriter pw) { } } + private void dumpSyncAdapters(IndentingPrintWriter pw) { + pw.println(); + final List users = getAllUsers(); + if (users != null) { + for (UserInfo user : users) { + pw.println("Sync adapters for " + user + ":"); + pw.increaseIndent(); + for (RegisteredServicesCache.ServiceInfo info : + mSyncAdapters.getAllServices(user.id)) { + pw.println(info); + } + pw.decreaseIndent(); + pw.println(); + } + } + } + private static class AuthoritySyncStats { String name; long elapsedTime; @@ -1576,18 +1645,12 @@ class SyncHandler extends Handler { Maps.newHashMap(); private volatile CountDownLatch mReadyToRunLatch = new CountDownLatch(1); + public void onBootCompleted() { mBootCompleted = true; - // TODO: Handle bootcompleted event for specific user. Now let's just iterate through - // all the users. - List users = getAllUsers(); - if (users != null) { - for (UserInfo user : users) { - mSyncStorageEngine.doDatabaseCleanup( - AccountManagerService.getSingleton().getAccounts(user.id), - user.id); - } - } + + doDatabaseCleanup(); + if (mReadyToRunLatch != null) { mReadyToRunLatch.countDown(); } @@ -1777,7 +1840,7 @@ private long scheduleReadyPeriodicSyncs() { return earliestFuturePollTime; } - AccountAndUser[] accounts = mAccounts; + AccountAndUser[] accounts = mRunningAccounts; final long nowAbsolute = System.currentTimeMillis(); final long shiftedNowAbsolute = (0 < nowAbsolute - mSyncRandomOffsetMillis) @@ -1832,9 +1895,10 @@ private long scheduleReadyPeriodicSyncs() { // Sync now final Pair backoff = mSyncStorageEngine.getBackoff( info.account, info.userId, info.authority); - final RegisteredServicesCache.ServiceInfo syncAdapterInfo = - mSyncAdapters.getServiceInfo( - SyncAdapterType.newKey(info.authority, info.account.type)); + final RegisteredServicesCache.ServiceInfo syncAdapterInfo; + syncAdapterInfo = mSyncAdapters.getServiceInfo( + SyncAdapterType.newKey(info.authority, info.account.type), + info.userId); if (syncAdapterInfo == null) { continue; } @@ -1890,7 +1954,7 @@ private long maybeStartNextSyncLocked() { // If the accounts aren't known yet then we aren't ready to run. We will be kicked // when the account lookup request does complete. - AccountAndUser[] accounts = mAccounts; + AccountAndUser[] accounts = mRunningAccounts; if (accounts == INITIAL_ACCOUNTS_ARRAY) { if (isLoggable) { Log.v(TAG, "maybeStartNextSync: accounts not known, skipping"); @@ -1914,10 +1978,14 @@ private long maybeStartNextSyncLocked() { synchronized (mSyncQueue) { if (isLoggable) { Log.v(TAG, "build the operation array, syncQueue size is " - + mSyncQueue.mOperationsMap.size()); + + mSyncQueue.getOperations().size()); } - Iterator operationIterator = - mSyncQueue.mOperationsMap.values().iterator(); + final Iterator operationIterator = mSyncQueue.getOperations() + .iterator(); + + final ActivityManager activityManager + = (ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE); + final Set removedUsers = Sets.newHashSet(); while (operationIterator.hasNext()) { final SyncOperation op = operationIterator.next(); @@ -1937,6 +2005,15 @@ private long maybeStartNextSyncLocked() { continue; } + // if the user in not running, drop the request + if (!activityManager.isUserRunning(op.userId)) { + final UserInfo userInfo = mUserManager.getUserInfo(op.userId); + if (userInfo == null) { + removedUsers.add(op.userId); + } + continue; + } + // if the next run time is in the future, meaning there are no syncs ready // to run, return the time if (op.effectiveRunTime > now) { @@ -1948,7 +2025,7 @@ private long maybeStartNextSyncLocked() { final RegisteredServicesCache.ServiceInfo syncAdapterInfo; syncAdapterInfo = mSyncAdapters.getServiceInfo( - SyncAdapterType.newKey(op.authority, op.account.type)); + SyncAdapterType.newKey(op.authority, op.account.type), op.userId); // only proceed if network is connected for requesting UID final boolean uidNetworkConnected; @@ -1977,6 +2054,12 @@ private long maybeStartNextSyncLocked() { operations.add(op); } + for (Integer user : removedUsers) { + // if it's still removed + if (mUserManager.getUserInfo(user) == null) { + onUserRemoved(user); + } + } } // find the next operation to dispatch, if one is ready @@ -2091,7 +2174,7 @@ private long maybeStartNextSyncLocked() { runSyncFinishedOrCanceledLocked(null, toReschedule); scheduleSyncOperation(toReschedule.mSyncOperation); } - synchronized (mSyncQueue){ + synchronized (mSyncQueue) { mSyncQueue.remove(candidate); } dispatchSyncOperation(candidate); @@ -2111,8 +2194,8 @@ private boolean dispatchSyncOperation(SyncOperation op) { // connect to the sync adapter SyncAdapterType syncAdapterType = SyncAdapterType.newKey(op.authority, op.account.type); - RegisteredServicesCache.ServiceInfo syncAdapterInfo = - mSyncAdapters.getServiceInfo(syncAdapterType); + final RegisteredServicesCache.ServiceInfo syncAdapterInfo; + syncAdapterInfo = mSyncAdapters.getServiceInfo(syncAdapterType, op.userId); if (syncAdapterInfo == null) { Log.d(TAG, "can't find a sync adapter for " + syncAdapterType + ", removing settings for it"); @@ -2127,7 +2210,7 @@ private boolean dispatchSyncOperation(SyncOperation op) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "dispatchSyncOperation: starting " + activeSyncContext); } - if (!activeSyncContext.bindToSyncAdapter(syncAdapterInfo)) { + if (!activeSyncContext.bindToSyncAdapter(syncAdapterInfo, op.userId)) { Log.e(TAG, "Bind attempt failed to " + syncAdapterInfo); closeActiveSyncContext(activeSyncContext); return false; @@ -2162,20 +2245,20 @@ private void cancelActiveSyncLocked(Account account, int userId, String authorit new ArrayList(mActiveSyncContexts); for (ActiveSyncContext activeSyncContext : activeSyncs) { if (activeSyncContext != null) { - // if an authority was specified then only cancel the sync if it matches + // if an account was specified then only cancel the sync if it matches if (account != null) { if (!account.equals(activeSyncContext.mSyncOperation.account)) { continue; } } - // if an account was specified then only cancel the sync if it matches + // if an authority was specified then only cancel the sync if it matches if (authority != null) { if (!authority.equals(activeSyncContext.mSyncOperation.authority)) { continue; } } // check if the userid matches - if (userId != UserId.USER_ALL + if (userId != UserHandle.USER_ALL && userId != activeSyncContext.mSyncOperation.userId) { continue; } @@ -2250,10 +2333,12 @@ private void runSyncFinishedOrCanceledLocked(SyncResult syncResult, if (syncResult != null && syncResult.tooManyDeletions) { installHandleTooManyDeletesNotification(syncOperation.account, - syncOperation.authority, syncResult.stats.numDeletes); + syncOperation.authority, syncResult.stats.numDeletes, + syncOperation.userId); } else { - mNotificationMgr.cancel( - syncOperation.account.hashCode() ^ syncOperation.authority.hashCode()); + mNotificationMgr.cancelAsUser(null, + syncOperation.account.hashCode() ^ syncOperation.authority.hashCode(), + new UserHandle(syncOperation.userId)); } if (syncResult != null && syncResult.fullSyncRequested) { @@ -2462,11 +2547,11 @@ private void sendSyncStateIntent() { syncStateIntent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT); syncStateIntent.putExtra("active", mNeedSyncActiveNotification); syncStateIntent.putExtra("failing", false); - mContext.sendBroadcast(syncStateIntent); + mContext.sendBroadcastAsUser(syncStateIntent, UserHandle.OWNER); } private void installHandleTooManyDeletesNotification(Account account, String authority, - long numDeletes) { + long numDeletes, int userId) { if (mNotificationMgr == null) return; final ProviderInfo providerInfo = mContext.getPackageManager().resolveContentProvider( @@ -2488,7 +2573,8 @@ private void installHandleTooManyDeletesNotification(Account account, String aut } final PendingIntent pendingIntent = PendingIntent - .getActivity(mContext, 0, clickIntent, PendingIntent.FLAG_CANCEL_CURRENT); + .getActivityAsUser(mContext, 0, clickIntent, + PendingIntent.FLAG_CANCEL_CURRENT, null, new UserHandle(userId)); CharSequence tooManyDeletesDescFormat = mContext.getResources().getText( R.string.contentServiceTooManyDeletesNotificationDesc); @@ -2497,12 +2583,13 @@ private void installHandleTooManyDeletesNotification(Account account, String aut new Notification(R.drawable.stat_notify_sync_error, mContext.getString(R.string.contentServiceSync), System.currentTimeMillis()); - notification.setLatestEventInfo(mContext, + notification.setLatestEventInfo(getUiContext(), mContext.getString(R.string.contentServiceSyncNotificationTitle), String.format(tooManyDeletesDescFormat.toString(), authorityName), pendingIntent); notification.flags |= Notification.FLAG_ONGOING_EVENT; - mNotificationMgr.notify(account.hashCode() ^ authority.hashCode(), notification); + mNotificationMgr.notifyAsUser(null, account.hashCode() ^ authority.hashCode(), + notification, new UserHandle(userId)); } /** diff --git a/core/java/android/content/SyncOperation.java b/core/java/android/content/SyncOperation.java index 9fcc22d3f9428..6611fcd9da765 100644 --- a/core/java/android/content/SyncOperation.java +++ b/core/java/android/content/SyncOperation.java @@ -95,13 +95,18 @@ public String toString() { } public String dump(boolean useOneLine) { - StringBuilder sb = new StringBuilder(); - sb.append(account.name); - sb.append(" (" + account.type + ")"); - sb.append(", " + authority); - sb.append(", "); - sb.append(SyncStorageEngine.SOURCES[syncSource]); - sb.append(", earliestRunTime " + earliestRunTime); + StringBuilder sb = new StringBuilder() + .append(account.name) + .append(" u") + .append(userId).append(" (") + .append(account.type) + .append(")") + .append(", ") + .append(authority) + .append(", ") + .append(SyncStorageEngine.SOURCES[syncSource]) + .append(", earliestRunTime ") + .append(earliestRunTime); if (expedited) { sb.append(", EXPEDITED"); } diff --git a/core/java/android/content/SyncQueue.java b/core/java/android/content/SyncQueue.java index c18c86bfe1391..c9a325e2d05a0 100644 --- a/core/java/android/content/SyncQueue.java +++ b/core/java/android/content/SyncQueue.java @@ -16,51 +16,60 @@ package android.content; -import com.google.android.collect.Maps; - -import android.content.pm.RegisteredServicesCache; +import android.accounts.Account; +import android.content.pm.RegisteredServicesCache.ServiceInfo; import android.os.SystemClock; +import android.os.UserHandle; import android.text.format.DateUtils; -import android.util.Pair; import android.util.Log; -import android.accounts.Account; +import android.util.Pair; + +import com.google.android.collect.Maps; import java.util.ArrayList; +import java.util.Collection; import java.util.HashMap; import java.util.Iterator; import java.util.Map; /** + * Queue of pending sync operations. Not inherently thread safe, external + * callers are responsible for locking. * * @hide */ public class SyncQueue { private static final String TAG = "SyncManager"; - private SyncStorageEngine mSyncStorageEngine; + + private final SyncStorageEngine mSyncStorageEngine; + private final SyncAdaptersCache mSyncAdapters; // A Map of SyncOperations operationKey -> SyncOperation that is designed for // quick lookup of an enqueued SyncOperation. - public final HashMap mOperationsMap = Maps.newHashMap(); + private final HashMap mOperationsMap = Maps.newHashMap(); public SyncQueue(SyncStorageEngine syncStorageEngine, final SyncAdaptersCache syncAdapters) { mSyncStorageEngine = syncStorageEngine; - ArrayList ops - = mSyncStorageEngine.getPendingOperations(); - final int N = ops.size(); - for (int i=0; i backoff = - syncStorageEngine.getBackoff(op.account, op.userId, op.authority); - final RegisteredServicesCache.ServiceInfo syncAdapterInfo = - syncAdapters.getServiceInfo( - SyncAdapterType.newKey(op.authority, op.account.type)); + mSyncAdapters = syncAdapters; + } + + public void addPendingOperations(int userId) { + for (SyncStorageEngine.PendingOperation op : mSyncStorageEngine.getPendingOperations()) { + if (op.userId != userId) continue; + + final Pair backoff = mSyncStorageEngine.getBackoff( + op.account, op.userId, op.authority); + final ServiceInfo syncAdapterInfo = mSyncAdapters.getServiceInfo( + SyncAdapterType.newKey(op.authority, op.account.type), op.userId); if (syncAdapterInfo == null) { + Log.w(TAG, "Missing sync adapter info for authority " + op.authority + ", userId " + + op.userId); continue; } SyncOperation syncOperation = new SyncOperation( op.account, op.userId, op.syncSource, op.authority, op.extras, 0 /* delay */, backoff != null ? backoff.first : 0, - syncStorageEngine.getDelayUntilTime(op.account, op.userId, op.authority), + mSyncStorageEngine.getDelayUntilTime(op.account, op.userId, op.authority), syncAdapterInfo.type.allowParallelSyncs()); syncOperation.expedited = op.expedited; syncOperation.pendingOperation = op; @@ -190,6 +199,10 @@ public void remove(Account account, int userId, String authority) { } } + public Collection getOperations() { + return mOperationsMap.values(); + } + public void dump(StringBuilder sb) { final long now = SystemClock.elapsedRealtime(); sb.append("SyncQueue: ").append(mOperationsMap.size()).append(" operation(s)\n"); diff --git a/core/java/android/content/SyncStorageEngine.java b/core/java/android/content/SyncStorageEngine.java index 226e107fbd34c..10e7bff785d4d 100644 --- a/core/java/android/content/SyncStorageEngine.java +++ b/core/java/android/content/SyncStorageEngine.java @@ -16,7 +16,6 @@ package android.content; -import com.android.internal.os.AtomicFile; import com.android.internal.util.ArrayUtils; import com.android.internal.util.FastXmlSerializer; @@ -26,6 +25,7 @@ import android.accounts.Account; import android.accounts.AccountAndUser; +import android.content.res.Resources; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteException; @@ -37,7 +37,7 @@ import android.os.Parcel; import android.os.RemoteCallbackList; import android.os.RemoteException; -import android.os.SystemClock; +import android.util.AtomicFile; import android.util.Log; import android.util.SparseArray; import android.util.Xml; @@ -337,6 +337,7 @@ interface OnSyncRequestListener { private int mNextHistoryId = 0; private SparseArray mMasterSyncAutomatically = new SparseArray(); + private boolean mDefaultMasterSyncAutomatically; private OnSyncRequestListener mSyncRequestListener; @@ -346,6 +347,9 @@ private SyncStorageEngine(Context context, File dataDir) { mCal = Calendar.getInstance(TimeZone.getTimeZone("GMT+0")); + mDefaultMasterSyncAutomatically = mContext.getResources().getBoolean( + com.android.internal.R.bool.config_syncstorageengine_masterSyncAutomatically); + File systemDir = new File(dataDir, "system"); File syncDir = new File(systemDir, "sync"); syncDir.mkdirs(); @@ -605,23 +609,25 @@ public void setBackoff(Account account, int userId, String providerName, public void clearAllBackoffs(SyncQueue syncQueue) { boolean changed = false; synchronized (mAuthorities) { - for (AccountInfo accountInfo : mAccounts.values()) { - for (AuthorityInfo authorityInfo : accountInfo.authorities.values()) { - if (authorityInfo.backoffTime != NOT_IN_BACKOFF_MODE - || authorityInfo.backoffDelay != NOT_IN_BACKOFF_MODE) { - if (Log.isLoggable(TAG, Log.VERBOSE)) { - Log.v(TAG, "clearAllBackoffs:" - + " authority:" + authorityInfo.authority - + " account:" + accountInfo.accountAndUser.account.name - + " user:" + accountInfo.accountAndUser.userId - + " backoffTime was: " + authorityInfo.backoffTime - + " backoffDelay was: " + authorityInfo.backoffDelay); + synchronized (syncQueue) { + for (AccountInfo accountInfo : mAccounts.values()) { + for (AuthorityInfo authorityInfo : accountInfo.authorities.values()) { + if (authorityInfo.backoffTime != NOT_IN_BACKOFF_MODE + || authorityInfo.backoffDelay != NOT_IN_BACKOFF_MODE) { + if (Log.isLoggable(TAG, Log.VERBOSE)) { + Log.v(TAG, "clearAllBackoffs:" + + " authority:" + authorityInfo.authority + + " account:" + accountInfo.accountAndUser.account.name + + " user:" + accountInfo.accountAndUser.userId + + " backoffTime was: " + authorityInfo.backoffTime + + " backoffDelay was: " + authorityInfo.backoffDelay); + } + authorityInfo.backoffTime = NOT_IN_BACKOFF_MODE; + authorityInfo.backoffDelay = NOT_IN_BACKOFF_MODE; + syncQueue.onBackoffChanged(accountInfo.accountAndUser.account, + accountInfo.accountAndUser.userId, authorityInfo.authority, 0); + changed = true; } - authorityInfo.backoffTime = NOT_IN_BACKOFF_MODE; - authorityInfo.backoffDelay = NOT_IN_BACKOFF_MODE; - syncQueue.onBackoffChanged(accountInfo.accountAndUser.account, - accountInfo.accountAndUser.userId, authorityInfo.authority, 0); - changed = true; } } } @@ -781,7 +787,7 @@ public void setMasterSyncAutomatically(boolean flag, int userId) { public boolean getMasterSyncAutomatically(int userId) { synchronized (mAuthorities) { Boolean auto = mMasterSyncAutomatically.get(userId); - return auto == null ? true : auto; + return auto == null ? mDefaultMasterSyncAutomatically : auto; } } diff --git a/core/java/android/content/pm/ActivityInfo.java b/core/java/android/content/pm/ActivityInfo.java index 6b16e7487fe0f..f1d678c662562 100644 --- a/core/java/android/content/pm/ActivityInfo.java +++ b/core/java/android/content/pm/ActivityInfo.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2007 The Android Open Source Project + * This code has been modified. Portions copyright (C) 2010, T-Mobile USA, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -154,6 +155,12 @@ public class ActivityInfo extends ComponentInfo * be hardware accelerated. */ public static final int FLAG_HARDWARE_ACCELERATED = 0x0200; + /** + * Value for {@link #flags}: true when the application can be displayed over the lockscreen + * and consequently over all users' windows. + * @hide + */ + public static final int FLAG_SHOW_ON_LOCK_SCREEN = 0x0400; /** * @hide * Bit in {@link #flags} corresponding to an immersive activity @@ -170,7 +177,21 @@ public class ActivityInfo extends ComponentInfo * "toast" window). * {@see android.app.Notification#FLAG_HIGH_PRIORITY} */ - public static final int FLAG_IMMERSIVE = 0x0400; + public static final int FLAG_IMMERSIVE = 0x0800; + /** + * @hide Bit in {@link #flags}: If set, this component will only be seen + * by the primary user. Only works with broadcast receivers. Set from the + * {@link android.R.attr#primaryUserOnly} attribute. + */ + public static final int FLAG_PRIMARY_USER_ONLY = 0x20000000; + /** + * Bit in {@link #flags}: If set, a single instance of the receiver will + * run for all users on the device. Set from the + * {@link android.R.attr#singleUser} attribute. Note that this flag is + * only relevant for ActivityInfo structures that are describing receiver + * components; it is not applied to activities. + */ + public static final int FLAG_SINGLE_USER = 0x40000000; /** * Options that have been set in the activity declaration in the * manifest. @@ -181,7 +202,7 @@ public class ActivityInfo extends ComponentInfo * {@link #FLAG_STATE_NOT_NEEDED}, {@link #FLAG_EXCLUDE_FROM_RECENTS}, * {@link #FLAG_ALLOW_TASK_REPARENTING}, {@link #FLAG_NO_HISTORY}, * {@link #FLAG_FINISH_ON_CLOSE_SYSTEM_DIALOGS}, - * {@link #FLAG_HARDWARE_ACCELERATED} + * {@link #FLAG_HARDWARE_ACCELERATED}, {@link #FLAG_SINGLE_USER}. */ public int flags; @@ -320,6 +341,10 @@ public class ActivityInfo extends ComponentInfo * {@link android.R.attr#configChanges} attribute. */ public static final int CONFIG_ORIENTATION = 0x0080; + /** + * @hide + */ + public static final int CONFIG_THEME_RESOURCE = 0x008000; /** * Bit in {@link #configChanges} that indicates that the activity * can itself handle changes to the screen layout. Set from the @@ -356,6 +381,18 @@ public class ActivityInfo extends ComponentInfo * they are interested in. Please don't do that, thanks. */ public static final int CONFIG_SMALLEST_SCREEN_SIZE = 0x0800; + /** + * Bit in {@link #configChanges} that indicates that the activity + * can itself handle density changes. Set from the + * {@link android.R.attr#configChanges} attribute. + */ + public static final int CONFIG_DENSITY = 0x1000; + /** + * Bit in {@link #configChanges} that indicates that the activity + * can itself handle the change to layout direction. Set from the + * {@link android.R.attr#configChanges} attribute. + */ + public static final int CONFIG_LAYOUT_DIRECTION = 0x2000; /** * Bit in {@link #configChanges} that indicates that the activity * can itself handle changes to the font scaling factor. Set from the @@ -383,6 +420,8 @@ public class ActivityInfo extends ComponentInfo 0x1000, // UI MODE 0x0200, // SCREEN SIZE 0x2000, // SMALLEST SCREEN SIZE + 0x0100, // DENSITY + 0x4000, // LAYOUT DIRECTION }; /** @hide * Convert Java change bits to native. @@ -419,8 +458,9 @@ public int getRealConfigChanged() { * {@link #CONFIG_MCC}, {@link #CONFIG_MNC}, * {@link #CONFIG_LOCALE}, {@link #CONFIG_TOUCHSCREEN}, * {@link #CONFIG_KEYBOARD}, {@link #CONFIG_NAVIGATION}, - * {@link #CONFIG_ORIENTATION}, and {@link #CONFIG_SCREEN_LAYOUT}. Set from the - * {@link android.R.attr#configChanges} attribute. + * {@link #CONFIG_ORIENTATION}, {@link #CONFIG_SCREEN_LAYOUT} and + * {@link #CONFIG_LAYOUT_DIRECTION}. Set from the {@link android.R.attr#configChanges} + * attribute. */ public int configChanges; diff --git a/core/java/android/content/pm/ApplicationInfo.java b/core/java/android/content/pm/ApplicationInfo.java index e1434b3bad67a..fa85145a942fa 100644 --- a/core/java/android/content/pm/ApplicationInfo.java +++ b/core/java/android/content/pm/ApplicationInfo.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2007 The Android Open Source Project + * This code has been modified. Portions copyright (C) 2010, T-Mobile USA, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -298,10 +299,22 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable { * activity's manifest. * * Default value is false (no support for RTL). - * @hide */ public static final int FLAG_SUPPORTS_RTL = 1<<22; + /** + * Value for {@link #flags}: true if the application is currently + * installed for the calling user. + */ + public static final int FLAG_INSTALLED = 1<<23; + + /** + * Value for {@link #flags}: true if the application only has its + * data installed; the application package itself does not currently + * exist on the device. + */ + public static final int FLAG_IS_DATA_ONLY = 1<<24; + /** * Value for {@link #flags}: Set to true if the application has been * installed using the forward lock option. @@ -335,7 +348,8 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable { * {@link #FLAG_SUPPORTS_NORMAL_SCREENS}, * {@link #FLAG_SUPPORTS_LARGE_SCREENS}, {@link #FLAG_SUPPORTS_XLARGE_SCREENS}, * {@link #FLAG_RESIZEABLE_FOR_SCREENS}, - * {@link #FLAG_SUPPORTS_SCREEN_DENSITIES}, {@link #FLAG_VM_SAFE_MODE} + * {@link #FLAG_SUPPORTS_SCREEN_DENSITIES}, {@link #FLAG_VM_SAFE_MODE}, + * {@link #FLAG_INSTALLED}. */ public int flags = 0; @@ -431,6 +445,30 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable { * @hide */ public int enabledSetting = PackageManager.COMPONENT_ENABLED_STATE_DEFAULT; + /** + * Is given application theme agnostic, i.e. behaves properly when default theme is changed. + * {@hide} + */ + public boolean isThemeable = false; + + private static final String PLUTO_SCHEMA = "http://www.w3.org/2001/pluto.html"; + + /** + * @hide + */ + public static final String PLUTO_ISTHEMEABLE_ATTRIBUTE_NAME = "isThemeable"; + + /** + * @hide + */ + public static final String PLUTO_HANDLE_THEME_CONFIG_CHANGES_ATTRIBUTE_NAME = "handleThemeConfigChanges"; + + /** + * @hide + */ + public static boolean isPlutoNamespace(String namespace) { + return namespace != null && namespace.equalsIgnoreCase(PLUTO_SCHEMA); + } /** * For convenient access to package's install location. @@ -541,6 +579,8 @@ public ApplicationInfo(ApplicationInfo orig) { manageSpaceActivityName = orig.manageSpaceActivityName; descriptionRes = orig.descriptionRes; uiOptions = orig.uiOptions; + backupAgentName = orig.backupAgentName; + isThemeable = orig.isThemeable; } @@ -580,6 +620,7 @@ public void writeToParcel(Parcel dest, int parcelableFlags) { dest.writeString(backupAgentName); dest.writeInt(descriptionRes); dest.writeInt(uiOptions); + dest.writeInt(isThemeable? 1 : 0); } public static final Parcelable.Creator CREATOR @@ -618,6 +659,7 @@ private ApplicationInfo(Parcel source) { backupAgentName = source.readString(); descriptionRes = source.readInt(); uiOptions = source.readInt(); + isThemeable = source.readInt() != 0; } /** diff --git a/core/java/android/content/pm/BaseThemeInfo.java b/core/java/android/content/pm/BaseThemeInfo.java new file mode 100644 index 0000000000000..0171137bac17c --- /dev/null +++ b/core/java/android/content/pm/BaseThemeInfo.java @@ -0,0 +1,244 @@ +/* + * Copyright (C) 2010, T-Mobile USA, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.content.pm; + +import android.os.Parcelable; +import android.os.Parcel; +import android.util.Log; +import android.util.AttributeSet; +import android.content.res.Resources; + +/** + * @hide + */ +public class BaseThemeInfo implements Parcelable { + + /** + * Wallpaper drawable. + * + * @see wallpaperImage attribute + */ + public int wallpaperResourceId; + + /** + * The resource id of theme thumbnail. + * Specifies a theme thumbnail image resource as @drawable/foo. + * + * @see thumbnail attribute + * + */ + public int thumbnailResourceId; + + /** + * The theme id, which does not change when the theme is modified. + * Specifies an Android UI Style using style name. + * + * @see themeId attribute + * + */ + public String themeId; + + /** + * The style resource id of Android UI Style, supplied by the resource commpiler. + * Specifies an Android UI Style id. + * + * @see styleId attribute + * + */ + public int styleResourceId = 0; + + /** + * The name of the theme (as displayed by UI). + * + * @see name attribute + * + */ + public String name; + + /** + * The name of the call ringtone audio file. + * Specifies a relative path in assets subfolder. + * If the parent's name is "locked" - DRM protected. + * + * @see ringtoneFileName attribute + * + */ + public String ringtoneFileName; + + /** + * The name of the call ringtone as shown to user. + * + * @see ringtoneName attribute + * + */ + public String ringtoneName; + + /** + * The name of the notification ringtone audio file. + * Specifies a relative path in assets subfolder. + * If the parent's name is "locked" - DRM protected. + * + * @see notificationRingtoneFileName attribute + * + */ + public String notificationRingtoneFileName; + + /** + * The name of the notification ringtone as shown to user. + * + * @see notificationRingtoneName attribute + * + */ + public String notificationRingtoneName; + + /** + * The author name of the theme package. + * + * @see author attribute + * + */ + public String author; + + /** + * The copyright text. + * + * @see copyright attribute + * + */ + public String copyright; + + /** + * {@hide} + */ + // There is no corresposponding flag in manifest file + // This flag is set to true iff any media resource is DRM protected + public boolean isDrmProtected = false; + + /** + * The name of the "main" theme style (as displayed by UI). + * + * @see themeStyleName attribute + * + */ + public String themeStyleName; + + /** + * Preview image drawable. + * + * @see preview attribute + */ + public int previewResourceId; + + /** + * The name of a sound pack. + * + * @see soundpack attribute + * + */ + public String soundPackName; + + + private static final String LOCKED_NAME = "locked/"; + + /* + * Describe the kinds of special objects contained in this Parcelable's + * marshalled representation. + * + * @return a bitmask indicating the set of special object types marshalled + * by the Parcelable. + * + * @see android.os.Parcelable#describeContents() + */ + public int describeContents() { + return 0; + } + + /* + * Flatten this object in to a Parcel. + * + * @param dest The Parcel in which the object should be written. + * @param flags Additional flags about how the object should be written. + * May be 0 or {@link #PARCELABLE_WRITE_RETURN_VALUE}. + * + * @see android.os.Parcelable#writeToParcel(android.os.Parcel, int) + */ + public void writeToParcel(Parcel dest, int flags) { + dest.writeInt(wallpaperResourceId); + dest.writeInt(thumbnailResourceId); + dest.writeString(themeId); + dest.writeInt(styleResourceId); + dest.writeString(name); + dest.writeString(ringtoneFileName); + dest.writeString(notificationRingtoneFileName); + dest.writeString(ringtoneName); + dest.writeString(notificationRingtoneName); + dest.writeString(author); + dest.writeString(copyright); + dest.writeInt(isDrmProtected? 1 : 0); + dest.writeString(soundPackName); + dest.writeString(themeStyleName); + dest.writeInt(previewResourceId); + } + + /** @hide */ + public static final Parcelable.Creator CREATOR + = new Parcelable.Creator() { + public BaseThemeInfo createFromParcel(Parcel source) { + return new BaseThemeInfo(source); + } + + public BaseThemeInfo[] newArray(int size) { + return new BaseThemeInfo[size]; + } + }; + + /** @hide */ + public final String getResolvedString(Resources res, AttributeSet attrs, int index) { + int resId = attrs.getAttributeResourceValue(index, 0); + if (resId !=0 ) { + return res.getString(resId); + } + return attrs.getAttributeValue(index); + } + + protected BaseThemeInfo() { + } + + protected BaseThemeInfo(Parcel source) { + wallpaperResourceId = source.readInt(); + thumbnailResourceId = source.readInt(); + themeId = source.readString(); + styleResourceId = source.readInt(); + name = source.readString(); + ringtoneFileName = source.readString(); + notificationRingtoneFileName = source.readString(); + ringtoneName = source.readString(); + notificationRingtoneName = source.readString(); + author = source.readString(); + copyright = source.readString(); + isDrmProtected = (source.readInt() != 0); + soundPackName = source.readString(); + themeStyleName = source.readString(); + previewResourceId = source.readInt(); + } + + protected void changeDrmFlagIfNeeded(String resourcePath) { + if (resourcePath != null && resourcePath.contains(LOCKED_NAME)) { + isDrmProtected = true; + } + } +} diff --git a/core/java/android/content/pm/IPackageManager.aidl b/core/java/android/content/pm/IPackageManager.aidl index 90b42472481eb..ab27c8acffffa 100644 --- a/core/java/android/content/pm/IPackageManager.aidl +++ b/core/java/android/content/pm/IPackageManager.aidl @@ -32,6 +32,7 @@ import android.content.pm.IPackageStatsObserver; import android.content.pm.InstrumentationInfo; import android.content.pm.PackageInfo; import android.content.pm.ManifestDigest; +import android.content.pm.PackageCleanItem; import android.content.pm.ParceledListSlice; import android.content.pm.ProviderInfo; import android.content.pm.PermissionGroupInfo; @@ -39,8 +40,11 @@ import android.content.pm.PermissionInfo; import android.content.pm.ResolveInfo; import android.content.pm.ServiceInfo; import android.content.pm.UserInfo; +import android.content.pm.VerificationParams; import android.content.pm.VerifierDeviceIdentity; +import android.content.pm.ThemeInfo; import android.net.Uri; +import android.os.ParcelFileDescriptor; import android.content.IntentSender; /** @@ -124,7 +128,9 @@ interface IPackageManager { * limit that kicks in when flags are included that bloat up the data * returned. */ - ParceledListSlice getInstalledPackages(int flags, in String lastRead); + ParceledListSlice getInstalledPackages(int flags, in String lastRead, in int userId); + + List getInstalledThemePackages(); /** * This implements getInstalledApplications via a "last returned row" @@ -199,7 +205,7 @@ interface IPackageManager { List getPreferredPackages(int flags); void addPreferredActivity(in IntentFilter filter, int match, - in ComponentName[] set, in ComponentName activity); + in ComponentName[] set, in ComponentName activity, int userId); void replacePreferredActivity(in IntentFilter filter, int match, in ComponentName[] set, in ComponentName activity); @@ -303,10 +309,11 @@ interface IPackageManager { * Get package statistics including the code, data and cache size for * an already installed package * @param packageName The package name of the application + * @param userHandle Which user the size should be retrieved for * @param observer a callback to use to notify when the asynchronous * retrieval of information is complete. */ - void getPackageSizeInfo(in String packageName, IPackageStatsObserver observer); + void getPackageSizeInfo(in String packageName, int userHandle, IPackageStatsObserver observer); /** * Get a list of shared libraries that are available on the @@ -348,7 +355,7 @@ interface IPackageManager { */ void updateExternalMediaStatus(boolean mounted, boolean reportStatus); - String nextPackageToClean(String lastPackage); + PackageCleanItem nextPackageToClean(in PackageCleanItem lastPackage); void movePackage(String packageName, IPackageMoveObserver observer, int flags); @@ -357,23 +364,24 @@ interface IPackageManager { boolean setInstallLocation(int loc); int getInstallLocation(); - UserInfo createUser(in String name, int flags); - boolean removeUser(int userId); - void updateUserName(int userId, String name); - void installPackageWithVerification(in Uri packageURI, in IPackageInstallObserver observer, int flags, in String installerPackageName, in Uri verificationURI, in ManifestDigest manifestDigest, in ContainerEncryptionParams encryptionParams); + void installPackageWithVerificationAndEncryption(in Uri packageURI, + in IPackageInstallObserver observer, int flags, in String installerPackageName, + in VerificationParams verificationParams, + in ContainerEncryptionParams encryptionParams); + + int installExistingPackage(String packageName); + void verifyPendingInstall(int id, int verificationCode); + void extendVerificationTimeout(int id, int verificationCodeAtTimeout, long millisecondsToDelay); VerifierDeviceIdentity getVerifierDeviceIdentity(); boolean isFirstBoot(); - List getUsers(); - UserInfo getUser(int userId); - void setPermissionEnforced(String permission, boolean enforced); boolean isPermissionEnforced(String permission); diff --git a/core/java/android/content/pm/InstrumentationInfo.java b/core/java/android/content/pm/InstrumentationInfo.java index ea47e8e6e0d56..a977e41c3d69b 100644 --- a/core/java/android/content/pm/InstrumentationInfo.java +++ b/core/java/android/content/pm/InstrumentationInfo.java @@ -18,10 +18,6 @@ import android.os.Parcel; import android.os.Parcelable; -import android.text.TextUtils; - -import java.text.Collator; -import java.util.Comparator; /** * Information you can retrieve about a particular piece of test diff --git a/core/java/android/content/pm/ManifestDigest.java b/core/java/android/content/pm/ManifestDigest.java index f5e72e0cf3806..75505bcb1b88f 100644 --- a/core/java/android/content/pm/ManifestDigest.java +++ b/core/java/android/content/pm/ManifestDigest.java @@ -1,3 +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.content.pm; import android.os.Parcel; diff --git a/core/java/android/content/pm/PackageCleanItem.aidl b/core/java/android/content/pm/PackageCleanItem.aidl new file mode 100644 index 0000000000000..9bb203eed6919 --- /dev/null +++ b/core/java/android/content/pm/PackageCleanItem.aidl @@ -0,0 +1,18 @@ +/* Copyright 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.content.pm; + +parcelable PackageCleanItem; diff --git a/core/java/android/content/pm/PackageCleanItem.java b/core/java/android/content/pm/PackageCleanItem.java new file mode 100644 index 0000000000000..b1896aaa365e0 --- /dev/null +++ b/core/java/android/content/pm/PackageCleanItem.java @@ -0,0 +1,85 @@ +/* + * 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.content.pm; + +import android.os.Parcel; +import android.os.Parcelable; + +/** @hide */ +public class PackageCleanItem { + public final int userId; + public final String packageName; + public final boolean andCode; + + public PackageCleanItem(int userId, String packageName, boolean andCode) { + this.userId = userId; + this.packageName = packageName; + this.andCode = andCode; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + try { + if (obj != null) { + PackageCleanItem other = (PackageCleanItem)obj; + return userId == other.userId && packageName.equals(other.packageName) + && andCode == other.andCode; + } + } catch (ClassCastException e) { + } + return false; + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + userId; + result = 31 * result + packageName.hashCode(); + result = 31 * result + (andCode ? 1 : 0); + return result; + } + + public int describeContents() { + return 0; + } + + public void writeToParcel(Parcel dest, int parcelableFlags) { + dest.writeInt(userId); + dest.writeString(packageName); + dest.writeInt(andCode ? 1 : 0); + } + + public static final Parcelable.Creator CREATOR + = new Parcelable.Creator() { + public PackageCleanItem createFromParcel(Parcel source) { + return new PackageCleanItem(source); + } + + public PackageCleanItem[] newArray(int size) { + return new PackageCleanItem[size]; + } + }; + + private PackageCleanItem(Parcel source) { + userId = source.readInt(); + packageName = source.readString(); + andCode = source.readInt() != 0; + } +} diff --git a/core/java/android/content/pm/PackageInfo.java b/core/java/android/content/pm/PackageInfo.java index 85f7aa5113a24..79cc52878a6ed 100644 --- a/core/java/android/content/pm/PackageInfo.java +++ b/core/java/android/content/pm/PackageInfo.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2007 The Android Open Source Project + * This code has been modified. Portions copyright (C) 2010, T-Mobile USA, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -218,9 +219,69 @@ public class PackageInfo implements Parcelable { */ public int installLocation = INSTALL_LOCATION_INTERNAL_ONLY; + // Is Theme Apk + /** + * {@hide} + */ + public boolean isThemeApk = false; + + // ThemeInfo + /** + * {@hide} + */ + public ThemeInfo [] themeInfos; + public PackageInfo() { } + /* + * Is Theme Apk is DRM protected (contains DRM-protected resources) + * + */ + private boolean drmProtectedThemeApk = false; + + /** + * @hide + * + * @return Is Theme Apk is DRM protected (contains DRM-protected resources) + */ + public boolean isDrmProtectedThemeApk() { + return drmProtectedThemeApk; + } + + /** + * @hide + * + * @param value if Theme Apk is DRM protected (contains DRM-protected resources) + */ + public void setDrmProtectedThemeApk(boolean value) { + drmProtectedThemeApk = value; + } + + /* + * If isThemeApk and isDrmProtectedThemeApk are true - path to hidden locked zip file + * + */ + private String lockedZipFilePath; + + /** + * @hide + * + * @return path for hidden locked zip file + */ + public String getLockedZipFilePath() { + return lockedZipFilePath; + } + + /** + * @hide + * + * @param value path for hidden locked zip file + */ + public void setLockedZipFilePath(String value) { + lockedZipFilePath = value; + } + public String toString() { return "PackageInfo{" + Integer.toHexString(System.identityHashCode(this)) @@ -258,6 +319,12 @@ public void writeToParcel(Parcel dest, int parcelableFlags) { dest.writeTypedArray(configPreferences, parcelableFlags); dest.writeTypedArray(reqFeatures, parcelableFlags); dest.writeInt(installLocation); + + /* Theme-specific. */ + dest.writeInt((isThemeApk)? 1 : 0); + dest.writeInt((drmProtectedThemeApk)? 1 : 0); + dest.writeTypedArray(themeInfos, parcelableFlags); + dest.writeString(lockedZipFilePath); } public static final Parcelable.Creator CREATOR @@ -296,5 +363,11 @@ private PackageInfo(Parcel source) { configPreferences = source.createTypedArray(ConfigurationInfo.CREATOR); reqFeatures = source.createTypedArray(FeatureInfo.CREATOR); installLocation = source.readInt(); + + /* Theme-specific. */ + isThemeApk = (source.readInt() != 0); + drmProtectedThemeApk = (source.readInt() != 0); + themeInfos = source.createTypedArray(ThemeInfo.CREATOR); + lockedZipFilePath = source.readString(); } } diff --git a/core/java/android/content/pm/PackageInfoLite.java b/core/java/android/content/pm/PackageInfoLite.java index 962594440e8fb..a1566dadbadd1 100644 --- a/core/java/android/content/pm/PackageInfoLite.java +++ b/core/java/android/content/pm/PackageInfoLite.java @@ -31,6 +31,11 @@ public class PackageInfoLite implements Parcelable { */ public String packageName; + /** + * The android:versionCode of the package. + */ + public int versionCode; + /** * Specifies the recommended install location. Can be one of * {@link #PackageHelper.RECOMMEND_INSTALL_INTERNAL} to install on internal storage @@ -58,6 +63,7 @@ public int describeContents() { public void writeToParcel(Parcel dest, int parcelableFlags) { dest.writeString(packageName); + dest.writeInt(versionCode); dest.writeInt(recommendedInstallLocation); dest.writeInt(installLocation); @@ -82,6 +88,7 @@ public PackageInfoLite[] newArray(int size) { private PackageInfoLite(Parcel source) { packageName = source.readString(); + versionCode = source.readInt(); recommendedInstallLocation = source.readInt(); installLocation = source.readInt(); diff --git a/core/java/android/content/pm/PackageItemInfo.java b/core/java/android/content/pm/PackageItemInfo.java index d73aaf6a2e989..a67326eafb0c7 100644 --- a/core/java/android/content/pm/PackageItemInfo.java +++ b/core/java/android/content/pm/PackageItemInfo.java @@ -218,7 +218,7 @@ public XmlResourceParser loadXmlMetaData(PackageManager pm, String name) { } return null; } - + protected void dumpFront(Printer pw, String prefix) { if (name != null) { pw.println(prefix + "name=" + name); diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java index 7e96ae6e7a8fd..ba85efeb7f0a3 100644 --- a/core/java/android/content/pm/PackageManager.java +++ b/core/java/android/content/pm/PackageManager.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2006 The Android Open Source Project + * This code has been modified. Portions copyright (C) 2010, T-Mobile USA, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,6 +29,7 @@ import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Environment; +import android.os.UserHandle; import android.util.AndroidException; import android.util.DisplayMetrics; @@ -308,6 +310,23 @@ public NameNotFoundException(String name) { */ public static final int INSTALL_FROM_ADB = 0x00000020; + /** + * Flag parameter for {@link #installPackage} to indicate that this install + * should immediately be visible to all users. + * + * @hide + */ + public static final int INSTALL_ALL_USERS = 0x00000040; + + /** + * Flag parameter for {@link #installPackage} to indicate that it is okay + * to install an update to an app where the newly installed app has a lower + * version code than the currently installed app. + * + * @hide + */ + public static final int INSTALL_ALLOW_DOWNGRADE = 0x00000080; + /** * Flag parameter for * {@link #setComponentEnabledSetting(android.content.ComponentName, int, int)} to indicate @@ -527,6 +546,14 @@ public NameNotFoundException(String name) { */ public static final int INSTALL_FAILED_UID_CHANGED = -24; + /** + * Installation return code: this is passed to the {@link IPackageInstallObserver} by + * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if + * the new package has an older version code than the currently installed package. + * @hide + */ + public static final int INSTALL_FAILED_VERSION_DOWNGRADE = -25; + /** * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} @@ -624,7 +651,15 @@ public NameNotFoundException(String name) { * * @hide */ - public static final int DONT_DELETE_DATA = 0x00000001; + public static final int DELETE_KEEP_DATA = 0x00000001; + + /** + * Flag parameter for {@link #deletePackage} to indicate that you want the + * package deleted for all users. + * + * @hide + */ + public static final int DELETE_ALL_USERS = 0x00000002; /** * Return code for when package deletion succeeds. This is passed to the @@ -760,6 +795,14 @@ public NameNotFoundException(String name) { */ public static final int VERIFICATION_REJECT = -1; + /** + * Can be used as the {@code millisecondsToDelay} argument for + * {@link PackageManager#extendVerificationTimeout}. This is the + * maximum time {@code PackageManager} waits for the verification + * agent to return (in milliseconds). + */ + public static final long MAXIMUM_VERIFICATION_TIMEOUT = 60*60*1000; + /** * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: The device's * audio pipeline is low-latency, more suitable for audio applications sensitive to delays or @@ -791,6 +834,14 @@ public NameNotFoundException(String name) { @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_CAMERA_AUTOFOCUS = "android.hardware.camera.autofocus"; + /** + * Feature for {@link #getSystemAvailableFeatures} and + * {@link #hasSystemFeature}: The device has at least one camera pointing in + * some direction. + */ + @SdkConstant(SdkConstantType.FEATURE) + public static final String FEATURE_CAMERA_ANY = "android.hardware.camera.any"; + /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device's camera supports flash. @@ -1108,6 +1159,38 @@ public NameNotFoundException(String name) { public static final String EXTRA_VERIFICATION_INSTALL_FLAGS = "android.content.pm.extra.VERIFICATION_INSTALL_FLAGS"; + /** + * Extra field name for the uid of who is requesting to install + * the package. + * + * @hide + */ + public static final String EXTRA_VERIFICATION_INSTALLER_UID + = "android.content.pm.extra.VERIFICATION_INSTALLER_UID"; + + /** + * Extra field name for the package name of a package pending verification. + * + * @hide + */ + public static final String EXTRA_VERIFICATION_PACKAGE_NAME + = "android.content.pm.extra.VERIFICATION_PACKAGE_NAME"; + /** + * Extra field name for the result of a verification, either + * {@link #VERIFICATION_ALLOW}, or {@link #VERIFICATION_REJECT}. + * Passed to package verifiers after a package is verified. + */ + public static final String EXTRA_VERIFICATION_RESULT + = "android.content.pm.extra.VERIFICATION_RESULT"; + + /** + * Extra field name for the version code of a package pending verification. + * + * @hide + */ + public static final String EXTRA_VERIFICATION_VERSION_CODE + = "android.content.pm.extra.VERIFICATION_VERSION_CODE"; + /** * Retrieve overall information about an application package that is * installed on the system. @@ -1418,6 +1501,56 @@ public abstract ProviderInfo getProviderInfo(ComponentName component, */ public abstract List getInstalledPackages(int flags); + /** + * Return a List of all packages that are installed on the device, for a specific user. + * Requesting a list of installed packages for another user + * will require the permission INTERACT_ACROSS_USERS_FULL. + * @param flags Additional option flags. Use any combination of + * {@link #GET_ACTIVITIES}, + * {@link #GET_GIDS}, + * {@link #GET_CONFIGURATIONS}, + * {@link #GET_INSTRUMENTATION}, + * {@link #GET_PERMISSIONS}, + * {@link #GET_PROVIDERS}, + * {@link #GET_RECEIVERS}, + * {@link #GET_SERVICES}, + * {@link #GET_SIGNATURES}, + * {@link #GET_UNINSTALLED_PACKAGES} to modify the data returned. + * @param userId The user for whom the installed packages are to be listed + * + * @return A List of PackageInfo objects, one for each package that is + * installed on the device. In the unlikely case of there being no + * installed packages, an empty list is returned. + * If flag GET_UNINSTALLED_PACKAGES is set, a list of all + * applications including those deleted with DONT_DELETE_DATA + * (partially installed apps with data directory) will be returned. + * + * @see #GET_ACTIVITIES + * @see #GET_GIDS + * @see #GET_CONFIGURATIONS + * @see #GET_INSTRUMENTATION + * @see #GET_PERMISSIONS + * @see #GET_PROVIDERS + * @see #GET_RECEIVERS + * @see #GET_SERVICES + * @see #GET_SIGNATURES + * @see #GET_UNINSTALLED_PACKAGES + * + * @hide + */ + public abstract List getInstalledPackages(int flags, int userId); + + /** + * Return a List of all theme packages that are installed + * on the device. + * + * @return A List of PackageInfo objects, one for each theme package + * that is installed on the device. + * + * @hide + */ + public abstract List getInstalledThemePackages(); + /** * Check whether a particular package has been granted a particular * permission. @@ -1683,6 +1816,39 @@ public abstract int getUidForSharedUser(String sharedUserName) */ public abstract ResolveInfo resolveActivity(Intent intent, int flags); + /** + * Determine the best action to perform for a given Intent for a given user. This + * is how {@link Intent#resolveActivity} finds an activity if a class has not + * been explicitly specified. + * + *

        Note: if using an implicit Intent (without an explicit ComponentName + * specified), be sure to consider whether to set the {@link #MATCH_DEFAULT_ONLY} + * only flag. You need to do so to resolve the activity in the same way + * that {@link android.content.Context#startActivity(Intent)} and + * {@link android.content.Intent#resolveActivity(PackageManager) + * Intent.resolveActivity(PackageManager)} do.

        + * + * @param intent An intent containing all of the desired specification + * (action, data, type, category, and/or component). + * @param flags Additional option flags. The most important is + * {@link #MATCH_DEFAULT_ONLY}, to limit the resolution to only + * those activities that support the {@link android.content.Intent#CATEGORY_DEFAULT}. + * @param userId The user id. + * + * @return Returns a ResolveInfo containing the final activity intent that + * was determined to be the best action. Returns null if no + * matching activity was found. If multiple matching activities are + * found and there is no default set, returns a ResolveInfo + * containing something else, such as the activity resolver. + * + * @see #MATCH_DEFAULT_ONLY + * @see #GET_INTENT_FILTERS + * @see #GET_RESOLVED_FILTER + * + * @hide + */ + public abstract ResolveInfo resolveActivityAsUser(Intent intent, int flags, int userId); + /** * Retrieve all activities that can be performed for the given intent. * @@ -1704,6 +1870,29 @@ public abstract int getUidForSharedUser(String sharedUserName) public abstract List queryIntentActivities(Intent intent, int flags); + /** + * Retrieve all activities that can be performed for the given intent, for a specific user. + * + * @param intent The desired intent as per resolveActivity(). + * @param flags Additional option flags. The most important is + * {@link #MATCH_DEFAULT_ONLY}, to limit the resolution to only + * those activities that support the {@link android.content.Intent#CATEGORY_DEFAULT}. + * + * @return A List<ResolveInfo> containing one entry for each matching + * Activity. These are ordered from best to worst match -- that + * is, the first item in the list is what is returned by + * {@link #resolveActivity}. If there are no matching activities, an empty + * list is returned. + * + * @see #MATCH_DEFAULT_ONLY + * @see #GET_INTENT_FILTERS + * @see #GET_RESOLVED_FILTER + * @hide + */ + public abstract List queryIntentActivitiesAsUser(Intent intent, + int flags, int userId); + + /** * Retrieve a set of activities that should be presented to the user as * similar options. This is like {@link #queryIntentActivities}, except it @@ -1753,6 +1942,26 @@ public abstract List queryIntentActivityOptions( public abstract List queryBroadcastReceivers(Intent intent, int flags); + /** + * Retrieve all receivers that can handle a broadcast of the given intent, for a specific + * user. + * + * @param intent The desired intent as per resolveActivity(). + * @param flags Additional option flags. + * @param userId The userId of the user being queried. + * + * @return A List<ResolveInfo> containing one entry for each matching + * Receiver. These are ordered from first to last in priority. If + * there are no matching receivers, an empty list is returned. + * + * @see #MATCH_DEFAULT_ONLY + * @see #GET_INTENT_FILTERS + * @see #GET_RESOLVED_FILTER + * @hide + */ + public abstract List queryBroadcastReceivers(Intent intent, + int flags, int userId); + /** * Determine the best service to handle for a given Intent. * @@ -1787,6 +1996,27 @@ public abstract List queryBroadcastReceivers(Intent intent, public abstract List queryIntentServices(Intent intent, int flags); + /** + * Retrieve all services that can match the given intent for a given user. + * + * @param intent The desired intent as per resolveService(). + * @param flags Additional option flags. + * @param userId The user id. + * + * @return A List<ResolveInfo> containing one entry for each matching + * ServiceInfo. These are ordered from best to worst match -- that + * is, the first item in the list is what is returned by + * resolveService(). If there are no matching services, an empty + * list is returned. + * + * @see #GET_INTENT_FILTERS + * @see #GET_RESOLVED_FILTER + * + * @hide + */ + public abstract List queryIntentServicesAsUser(Intent intent, + int flags, int userId); + /** * Find a single content provider by its base path name. * @@ -2123,6 +2353,10 @@ public abstract Resources getResourcesForApplication(ApplicationInfo app) public abstract Resources getResourcesForApplication(String appPackageName) throws NameNotFoundException; + /** @hide */ + public abstract Resources getResourcesForApplicationAsUser(String appPackageName, int userId) + throws NameNotFoundException; + /** * Retrieve overall information about an application package defined * in a package archive file @@ -2166,8 +2400,8 @@ public PackageInfo getPackageArchiveInfo(String archiveFilePath, int flags) { if ((flags & GET_SIGNATURES) != 0) { packageParser.collectCertificates(pkg, 0); } - return PackageParser.generatePackageInfo(pkg, null, flags, 0, 0, null, false, - COMPONENT_ENABLED_STATE_DEFAULT); + PackageUserState state = new PackageUserState(); + return PackageParser.generatePackageInfo(pkg, null, flags, 0, 0, null, state); } /** @@ -2226,6 +2460,45 @@ public abstract void installPackageWithVerification(Uri packageURI, Uri verificationURI, ManifestDigest manifestDigest, ContainerEncryptionParams encryptionParams); + /** + * Similar to + * {@link #installPackage(Uri, IPackageInstallObserver, int, String)} but + * with an extra verification information provided. + * + * @param packageURI The location of the package file to install. This can + * be a 'file:' or a 'content:' URI. + * @param observer An observer callback to get notified when the package + * installation is complete. + * {@link IPackageInstallObserver#packageInstalled(String, int)} + * will be called when that happens. observer may be null to + * indicate that no callback is desired. + * @param flags - possible values: {@link #INSTALL_FORWARD_LOCK}, + * {@link #INSTALL_REPLACE_EXISTING}, {@link #INSTALL_ALLOW_TEST} + * . + * @param installerPackageName Optional package name of the application that + * is performing the installation. This identifies which market + * the package came from. + * @param verificationParams an object that holds signal information to + * assist verification. May be {@code null}. + * @param encryptionParams if the package to be installed is encrypted, + * these parameters describing the encryption and authentication + * used. May be {@code null}. + * + * @hide + */ + public abstract void installPackageWithVerificationAndEncryption(Uri packageURI, + IPackageInstallObserver observer, int flags, String installerPackageName, + VerificationParams verificationParams, + ContainerEncryptionParams encryptionParams); + + /** + * If there is already an application with the given package name installed + * on the system for other users, also install it for the calling user. + * @hide + */ + public abstract int installExistingPackage(String packageName) + throws NameNotFoundException; + /** * Allows a package listening to the * {@link Intent#ACTION_PACKAGE_NEEDS_VERIFICATION package verification @@ -2238,9 +2511,46 @@ public abstract void installPackageWithVerification(Uri packageURI, * {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra * @param verificationCode either {@link PackageManager#VERIFICATION_ALLOW} * or {@link PackageManager#VERIFICATION_REJECT}. + * @throws SecurityException if the caller does not have the + * PACKAGE_VERIFICATION_AGENT permission. */ public abstract void verifyPendingInstall(int id, int verificationCode); + /** + * Allows a package listening to the + * {@link Intent#ACTION_PACKAGE_NEEDS_VERIFICATION package verification + * broadcast} to extend the default timeout for a response and declare what + * action to perform after the timeout occurs. The response must include + * the {@code verificationCodeAtTimeout} which is one of + * {@link PackageManager#VERIFICATION_ALLOW} or + * {@link PackageManager#VERIFICATION_REJECT}. + * + * This method may only be called once per package id. Additional calls + * will have no effect. + * + * @param id pending package identifier as passed via the + * {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra + * @param verificationCodeAtTimeout either + * {@link PackageManager#VERIFICATION_ALLOW} or + * {@link PackageManager#VERIFICATION_REJECT}. If + * {@code verificationCodeAtTimeout} is neither + * {@link PackageManager#VERIFICATION_ALLOW} or + * {@link PackageManager#VERIFICATION_REJECT}, then + * {@code verificationCodeAtTimeout} will default to + * {@link PackageManager#VERIFICATION_REJECT}. + * @param millisecondsToDelay the amount of time requested for the timeout. + * Must be positive and less than + * {@link PackageManager#MAXIMUM_VERIFICATION_TIMEOUT}. If + * {@code millisecondsToDelay} is out of bounds, + * {@code millisecondsToDelay} will be set to the closest in + * bounds value; namely, 0 or + * {@link PackageManager#MAXIMUM_VERIFICATION_TIMEOUT}. + * @throws SecurityException if the caller does not have the + * PACKAGE_VERIFICATION_AGENT permission. + */ + public abstract void extendVerificationTimeout(int id, + int verificationCodeAtTimeout, long millisecondsToDelay); + /** * Change the installer associated with a given package. There are limitations * on how the installer package can be changed; in particular: @@ -2270,7 +2580,8 @@ public abstract void setInstallerPackageName(String targetPackage, * @param observer An observer callback to get notified when the package deletion is * complete. {@link android.content.pm.IPackageDeleteObserver#packageDeleted(boolean)} will be * called when that happens. observer may be null to indicate that no callback is desired. - * @param flags - possible values: {@link #DONT_DELETE_DATA} + * @param flags - possible values: {@link #DELETE_KEEP_DATA}, + * {@link #DELETE_ALL_USERS}. * * @hide */ @@ -2376,6 +2687,7 @@ public abstract void deleteApplicationCacheFiles(String packageName, * should have the {@link android.Manifest.permission#GET_PACKAGE_SIZE} permission. * * @param packageName The name of the package whose size information is to be retrieved + * @param userHandle The user whose size information should be retrieved. * @param observer An observer callback to get notified when the operation * is complete. * {@link android.content.pm.IPackageStatsObserver#onGetStatsCompleted(PackageStats, boolean)} @@ -2386,9 +2698,19 @@ public abstract void deleteApplicationCacheFiles(String packageName, * * @hide */ - public abstract void getPackageSizeInfo(String packageName, + public abstract void getPackageSizeInfo(String packageName, int userHandle, IPackageStatsObserver observer); + /** + * Like {@link #getPackageSizeInfo(String, int, IPackageStatsObserver)}, but + * returns the size for the calling user. + * + * @hide + */ + public void getPackageSizeInfo(String packageName, IPackageStatsObserver observer) { + getPackageSizeInfo(packageName, UserHandle.myUserId(), observer); + } + /** * @deprecated This function no longer does anything; it was an old * approach to managing preferred activities, which has been superceeded @@ -2459,6 +2781,17 @@ public abstract void getPackageSizeInfo(String packageName, public abstract void addPreferredActivity(IntentFilter filter, int match, ComponentName[] set, ComponentName activity); + /** + * Same as {@link #addPreferredActivity(IntentFilter, int, + ComponentName[], ComponentName)}, but with a specific userId to apply the preference + to. + * @hide + */ + public void addPreferredActivity(IntentFilter filter, int match, + ComponentName[] set, ComponentName activity, int userId) { + throw new RuntimeException("Not implemented. Must override in a subclass."); + } + /** * @deprecated This is a protected API that should not have been available * to third party applications. It is the platform's responsibility for @@ -2615,56 +2948,6 @@ public abstract void setApplicationEnabledSetting(String packageName, public abstract void movePackage( String packageName, IPackageMoveObserver observer, int flags); - /** - * Creates a user with the specified name and options. - * - * @param name the user's name - * @param flags flags that identify the type of user and other properties. - * @see UserInfo - * - * @return the UserInfo object for the created user, or null if the user could not be created. - * @hide - */ - public abstract UserInfo createUser(String name, int flags); - - /** - * @return the list of users that were created - * @hide - */ - public abstract List getUsers(); - - /** - * @param id the ID of the user, where 0 is the primary user. - * @hide - */ - public abstract boolean removeUser(int id); - - /** - * Updates the user's name. - * - * @param id the user's id - * @param name the new name for the user - * @hide - */ - public abstract void updateUserName(int id, String name); - - /** - * Changes the user's properties specified by the flags. - * - * @param id the user's id - * @param flags the new flags for the user - * @hide - */ - public abstract void updateUserFlags(int id, int flags); - - /** - * Returns the details for the user specified by userId. - * @param userId the user id of the user - * @return UserInfo for the specified user, or null if no such user exists. - * @hide - */ - public abstract UserInfo getUser(int userId); - /** * Returns the device identity that verifiers can use to associate their scheme to a particular * device. This should not be used by anything other than a package verifier. diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java index f8898c14add14..452a74de10f65 100644 --- a/core/java/android/content/pm/PackageParser.java +++ b/core/java/android/content/pm/PackageParser.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2007 The Android Open Source Project + * This code has been modified. Portions copyright (C) 2010, T-Mobile USA, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,7 +29,7 @@ import android.os.Build; import android.os.Bundle; import android.os.PatternMatcher; -import android.os.UserId; +import android.os.UserHandle; import android.util.AttributeSet; import android.util.Base64; import android.util.DisplayMetrics; @@ -203,11 +204,14 @@ static class ParseComponentArgs extends ParsePackageItemArgs { */ public static class PackageLite { public final String packageName; + public final int versionCode; public final int installLocation; public final VerifierInfo[] verifiers; - public PackageLite(String packageName, int installLocation, List verifiers) { + public PackageLite(String packageName, int versionCode, + int installLocation, List verifiers) { this.packageName = packageName; + this.versionCode = versionCode; this.installLocation = installLocation; this.verifiers = verifiers.toArray(new VerifierInfo[verifiers.size()]); } @@ -243,13 +247,25 @@ private static final boolean isPackageFilename(String name) { return name.endsWith(".apk"); } + /* public static PackageInfo generatePackageInfo(PackageParser.Package p, int gids[], int flags, long firstInstallTime, long lastUpdateTime, HashSet grantedPermissions) { - + PackageUserState state = new PackageUserState(); return generatePackageInfo(p, gids, flags, firstInstallTime, lastUpdateTime, - grantedPermissions, false, PackageManager.COMPONENT_ENABLED_STATE_DEFAULT, - UserId.getCallingUserId()); + grantedPermissions, state, UserHandle.getCallingUserId()); + } + */ + + public static String getLockedZipFilePath(String path) { + if (path == null) { + return null; + } + if (isPackageFilename(path)) { + return path.substring(0, path.length() - 4) + ".locked.zip"; + } else { + return path + ".locked.zip"; + } } /** @@ -260,23 +276,45 @@ public static PackageInfo generatePackageInfo(PackageParser.Package p, */ public static PackageInfo generatePackageInfo(PackageParser.Package p, int gids[], int flags, long firstInstallTime, long lastUpdateTime, - HashSet grantedPermissions, boolean stopped, int enabledState) { + HashSet grantedPermissions, PackageUserState state) { return generatePackageInfo(p, gids, flags, firstInstallTime, lastUpdateTime, - grantedPermissions, stopped, enabledState, UserId.getCallingUserId()); + grantedPermissions, state, UserHandle.getCallingUserId()); + } + + private static boolean checkUseInstalled(int flags, PackageUserState state) { + return state.installed || ((flags & PackageManager.GET_UNINSTALLED_PACKAGES) != 0); } public static PackageInfo generatePackageInfo(PackageParser.Package p, int gids[], int flags, long firstInstallTime, long lastUpdateTime, - HashSet grantedPermissions, boolean stopped, int enabledState, int userId) { + HashSet grantedPermissions, PackageUserState state, int userId) { + if (!checkUseInstalled(flags, state)) { + return null; + } PackageInfo pi = new PackageInfo(); pi.packageName = p.packageName; pi.versionCode = p.mVersionCode; pi.versionName = p.mVersionName; pi.sharedUserId = p.mSharedUserId; pi.sharedUserLabel = p.mSharedUserLabel; - pi.applicationInfo = generateApplicationInfo(p, flags, stopped, enabledState, userId); + pi.isThemeApk = p.mIsThemeApk; + pi.setDrmProtectedThemeApk(false); + if (pi.isThemeApk) { + int N = p.mThemeInfos.size(); + if (N > 0) { + pi.themeInfos = new ThemeInfo[N]; + for (int i = 0; i < N; i++) { + pi.themeInfos[i] = p.mThemeInfos.get(i); + pi.setDrmProtectedThemeApk(pi.isDrmProtectedThemeApk() || pi.themeInfos[i].isDrmProtected); + } + if (pi.isDrmProtectedThemeApk()) { + pi.setLockedZipFilePath(PackageParser.getLockedZipFilePath(p.mPath)); + } + } + } + pi.applicationInfo = generateApplicationInfo(p, flags, state, userId); pi.installLocation = p.installLocation; pi.firstInstallTime = firstInstallTime; pi.lastUpdateTime = lastUpdateTime; @@ -312,7 +350,7 @@ public static PackageInfo generatePackageInfo(PackageParser.Package p, if (activity.info.enabled || (flags&PackageManager.GET_DISABLED_COMPONENTS) != 0) { pi.activities[j++] = generateActivityInfo(p.activities.get(i), flags, - stopped, enabledState, userId); + state, userId); } } } @@ -334,7 +372,7 @@ public static PackageInfo generatePackageInfo(PackageParser.Package p, if (activity.info.enabled || (flags&PackageManager.GET_DISABLED_COMPONENTS) != 0) { pi.receivers[j++] = generateActivityInfo(p.receivers.get(i), flags, - stopped, enabledState, userId); + state, userId); } } } @@ -355,8 +393,8 @@ public static PackageInfo generatePackageInfo(PackageParser.Package p, final Service service = p.services.get(i); if (service.info.enabled || (flags&PackageManager.GET_DISABLED_COMPONENTS) != 0) { - pi.services[j++] = generateServiceInfo(p.services.get(i), flags, stopped, - enabledState, userId); + pi.services[j++] = generateServiceInfo(p.services.get(i), flags, + state, userId); } } } @@ -377,8 +415,8 @@ public static PackageInfo generatePackageInfo(PackageParser.Package p, final Provider provider = p.providers.get(i); if (provider.info.enabled || (flags&PackageManager.GET_DISABLED_COMPONENTS) != 0) { - pi.providers[j++] = generateProviderInfo(p.providers.get(i), flags, stopped, - enabledState, userId); + pi.providers[j++] = generateProviderInfo(p.providers.get(i), flags, + state, userId); } } } @@ -840,11 +878,19 @@ private static PackageLite parsePackageLite(Resources res, XmlPullParser parser, return null; } int installLocation = PARSE_DEFAULT_INSTALL_LOCATION; + int versionCode = 0; + int numFound = 0; for (int i = 0; i < attrs.getAttributeCount(); i++) { String attr = attrs.getAttributeName(i); if (attr.equals("installLocation")) { installLocation = attrs.getAttributeIntValue(i, PARSE_DEFAULT_INSTALL_LOCATION); + numFound++; + } else if (attr.equals("versionCode")) { + versionCode = attrs.getAttributeIntValue(i, 0); + numFound++; + } + if (numFound >= 2) { break; } } @@ -867,7 +913,7 @@ private static PackageLite parsePackageLite(Resources res, XmlPullParser parser, } } - return new PackageLite(pkgName.intern(), installLocation, verifiers); + return new PackageLite(pkgName.intern(), versionCode, installLocation, verifiers); } /** @@ -1268,7 +1314,10 @@ private Package parsePackage( // Just skip this tag XmlUtils.skipCurrentTag(parser); continue; - + } else if (tagName.equals("theme")) { + // this is a theme apk. + pkg.mIsThemeApk = true; + pkg.mThemeInfos.add(new ThemeInfo(parser, res, attrs)); } else if (RIGID_PARSER) { outError[0] = "Bad element under : " + parser.getName(); @@ -1359,6 +1408,9 @@ private Package parsePackage( >= android.os.Build.VERSION_CODES.DONUT)) { pkg.applicationInfo.flags |= ApplicationInfo.FLAG_SUPPORTS_SCREEN_DENSITIES; } + if (pkg.mIsThemeApk) { + pkg.applicationInfo.isThemeable = false; + } return pkg; } @@ -1468,7 +1520,8 @@ private PermissionGroup parsePermissionGroup(Package owner, int flags, Resources perm.info.descriptionRes = sa.getResourceId( com.android.internal.R.styleable.AndroidManifestPermissionGroup_description, 0); - perm.info.flags = 0; + perm.info.flags = sa.getInt( + com.android.internal.R.styleable.AndroidManifestPermissionGroup_permissionGroupFlags, 0); perm.info.priority = sa.getInt( com.android.internal.R.styleable.AndroidManifestPermissionGroup_priority, 0); if (perm.info.priority > 0 && (flags&PARSE_IS_SYSTEM) == 0) { @@ -1523,6 +1576,9 @@ private Permission parsePermission(Package owner, Resources res, com.android.internal.R.styleable.AndroidManifestPermission_protectionLevel, PermissionInfo.PROTECTION_NORMAL); + perm.info.flags = sa.getInt( + com.android.internal.R.styleable.AndroidManifestPermission_permissionFlags, 0); + sa.recycle(); if (perm.info.protectionLevel == -1) { @@ -1660,12 +1716,43 @@ private Instrumentation parseInstrumentation(Package owner, Resources res, return a; } + private void parseApplicationThemeAttributes(XmlPullParser parser, AttributeSet attrs, + ApplicationInfo appInfo) { + for (int i = 0; i < attrs.getAttributeCount(); i++) { + if (!ApplicationInfo.isPlutoNamespace(parser.getAttributeNamespace(i))) { + continue; + } + String attrName = attrs.getAttributeName(i); + if (attrName.equalsIgnoreCase(ApplicationInfo.PLUTO_ISTHEMEABLE_ATTRIBUTE_NAME)) { + appInfo.isThemeable = attrs.getAttributeBooleanValue(i, false); + return; + } + } + } + + private void parseActivityThemeAttributes(XmlPullParser parser, AttributeSet attrs, + ActivityInfo ai) { + for (int i = 0; i < attrs.getAttributeCount(); i++) { + if (!ApplicationInfo.isPlutoNamespace(parser.getAttributeNamespace(i))) { + continue; + } + String attrName = attrs.getAttributeName(i); + if (attrName.equalsIgnoreCase(ApplicationInfo.PLUTO_HANDLE_THEME_CONFIG_CHANGES_ATTRIBUTE_NAME)) { + ai.configChanges |= ActivityInfo.CONFIG_THEME_RESOURCE; + } + } + } + private boolean parseApplication(Package owner, Resources res, XmlPullParser parser, AttributeSet attrs, int flags, String[] outError) throws XmlPullParserException, IOException { final ApplicationInfo ai = owner.applicationInfo; final String pkgName = owner.applicationInfo.packageName; + // assume that this package is themeable unless explicitly set to false. + ai.isThemeable = true; + parseApplicationThemeAttributes(parser, attrs, ai); + TypedArray sa = res.obtainAttributes(attrs, com.android.internal.R.styleable.AndroidManifestApplication); @@ -2040,7 +2127,7 @@ private Activity parseActivity(Package owner, Resources res, return null; } - final boolean setExported = sa.hasValue( + boolean setExported = sa.hasValue( com.android.internal.R.styleable.AndroidManifestActivity_exported); if (setExported) { a.info.exported = sa.getBoolean( @@ -2136,12 +2223,18 @@ private Activity parseActivity(Package owner, Resources res, a.info.flags |= ActivityInfo.FLAG_FINISH_ON_CLOSE_SYSTEM_DIALOGS; } + if (sa.getBoolean( + com.android.internal.R.styleable.AndroidManifestActivity_showOnLockScreen, + false)) { + a.info.flags |= ActivityInfo.FLAG_SHOW_ON_LOCK_SCREEN; + } + if (sa.getBoolean( com.android.internal.R.styleable.AndroidManifestActivity_immersive, false)) { a.info.flags |= ActivityInfo.FLAG_IMMERSIVE; } - + if (!receiver) { if (sa.getBoolean( com.android.internal.R.styleable.AndroidManifestActivity_hardwareAccelerated, @@ -2166,6 +2259,26 @@ private Activity parseActivity(Package owner, Resources res, a.info.configChanges = 0; } + if (receiver) { + if (sa.getBoolean( + com.android.internal.R.styleable.AndroidManifestActivity_singleUser, + false)) { + a.info.flags |= ActivityInfo.FLAG_SINGLE_USER; + if (a.info.exported) { + Slog.w(TAG, "Activity exported request ignored due to singleUser: " + + a.className + " at " + mArchiveSourcePath + " " + + parser.getPositionDescription()); + a.info.exported = false; + } + setExported = true; + } + if (sa.getBoolean( + com.android.internal.R.styleable.AndroidManifestActivity_primaryUserOnly, + false)) { + a.info.flags |= ActivityInfo.FLAG_PRIMARY_USER_ONLY; + } + } + sa.recycle(); if (receiver && (owner.applicationInfo.flags&ApplicationInfo.FLAG_CANT_SAVE_STATE) != 0) { @@ -2180,6 +2293,8 @@ private Activity parseActivity(Package owner, Resources res, return null; } + parseActivityThemeAttributes(parser, attrs, a.info); + int outerDepth = parser.getDepth(); int type; while ((type=parser.next()) != XmlPullParser.END_DOCUMENT @@ -2428,8 +2543,18 @@ private Provider parseProvider(Package owner, Resources res, return null; } + boolean providerExportedDefault = false; + + if (owner.applicationInfo.targetSdkVersion < Build.VERSION_CODES.JELLY_BEAN_MR1) { + // For compatibility, applications targeting API level 16 or lower + // should have their content providers exported by default, unless they + // specify otherwise. + providerExportedDefault = true; + } + p.info.exported = sa.getBoolean( - com.android.internal.R.styleable.AndroidManifestProvider_exported, true); + com.android.internal.R.styleable.AndroidManifestProvider_exported, + providerExportedDefault); String cpname = sa.getNonConfigurationString( com.android.internal.R.styleable.AndroidManifestProvider_authorities, 0); @@ -2475,6 +2600,20 @@ private Provider parseProvider(Package owner, Resources res, com.android.internal.R.styleable.AndroidManifestProvider_initOrder, 0); + p.info.flags = 0; + + if (sa.getBoolean( + com.android.internal.R.styleable.AndroidManifestProvider_singleUser, + false)) { + p.info.flags |= ProviderInfo.FLAG_SINGLE_USER; + if (p.info.exported) { + Slog.w(TAG, "Provider exported request ignored due to singleUser: " + + p.className + " at " + mArchiveSourcePath + " " + + parser.getPositionDescription()); + p.info.exported = false; + } + } + sa.recycle(); if ((owner.applicationInfo.flags&ApplicationInfo.FLAG_CANT_SAVE_STATE) != 0) { @@ -2487,7 +2626,7 @@ private Provider parseProvider(Package owner, Resources res, } if (cpname == null) { - outError[0] = " does not incude authorities attribute"; + outError[0] = " does not include authorities attribute"; return null; } p.info.authority = cpname.intern(); @@ -2703,7 +2842,7 @@ private Service parseService(Package owner, Resources res, return null; } - final boolean setExported = sa.hasValue( + boolean setExported = sa.hasValue( com.android.internal.R.styleable.AndroidManifestService_exported); if (setExported) { s.info.exported = sa.getBoolean( @@ -2729,6 +2868,18 @@ private Service parseService(Package owner, Resources res, false)) { s.info.flags |= ServiceInfo.FLAG_ISOLATED_PROCESS; } + if (sa.getBoolean( + com.android.internal.R.styleable.AndroidManifestService_singleUser, + false)) { + s.info.flags |= ServiceInfo.FLAG_SINGLE_USER; + if (s.info.exported) { + Slog.w(TAG, "Service exported request ignored due to singleUser: " + + s.className + " at " + mArchiveSourcePath + " " + + parser.getPositionDescription()); + s.info.exported = false; + } + setExported = true; + } sa.recycle(); @@ -3137,6 +3288,12 @@ public final static class Package { // For use by package manager to keep track of where it has done dexopt. public boolean mDidDexOpt; + + // Is Theme Apk + public boolean mIsThemeApk = false; + + // Theme info + public final ArrayList mThemeInfos = new ArrayList(0); // // User set enabled state. // public int mSetEnabled = PackageManager.COMPONENT_ENABLED_STATE_DEFAULT; @@ -3407,13 +3564,25 @@ public String toString() { } } - private static boolean copyNeeded(int flags, Package p, int enabledState, Bundle metaData) { - if (enabledState != PackageManager.COMPONENT_ENABLED_STATE_DEFAULT) { - boolean enabled = enabledState == PackageManager.COMPONENT_ENABLED_STATE_ENABLED; + private static boolean copyNeeded(int flags, Package p, + PackageUserState state, Bundle metaData, int userId) { + if (userId != 0) { + // We always need to copy for other users, since we need + // to fix up the uid. + return true; + } + if (state.enabled != PackageManager.COMPONENT_ENABLED_STATE_DEFAULT) { + boolean enabled = state.enabled == PackageManager.COMPONENT_ENABLED_STATE_ENABLED; if (p.applicationInfo.enabled != enabled) { return true; } } + if (!state.installed) { + return true; + } + if (state.stopped) { + return true; + } if ((flags & PackageManager.GET_META_DATA) != 0 && (metaData != null || p.mAppMetaData != null)) { return true; @@ -3425,39 +3594,41 @@ private static boolean copyNeeded(int flags, Package p, int enabledState, Bundle return false; } - public static ApplicationInfo generateApplicationInfo(Package p, int flags, boolean stopped, - int enabledState) { - return generateApplicationInfo(p, flags, stopped, enabledState, UserId.getCallingUserId()); + public static ApplicationInfo generateApplicationInfo(Package p, int flags, + PackageUserState state) { + return generateApplicationInfo(p, flags, state, UserHandle.getCallingUserId()); } public static ApplicationInfo generateApplicationInfo(Package p, int flags, - boolean stopped, int enabledState, int userId) { + PackageUserState state, int userId) { if (p == null) return null; - if (!copyNeeded(flags, p, enabledState, null) && userId == 0) { + if (!checkUseInstalled(flags, state)) { + return null; + } + if (!copyNeeded(flags, p, state, null, userId)) { // CompatibilityMode is global state. It's safe to modify the instance // of the package. if (!sCompatibilityModeEnabled) { p.applicationInfo.disableCompatibilityMode(); } - if (stopped) { - p.applicationInfo.flags |= ApplicationInfo.FLAG_STOPPED; - } else { - p.applicationInfo.flags &= ~ApplicationInfo.FLAG_STOPPED; - } - if (enabledState == PackageManager.COMPONENT_ENABLED_STATE_ENABLED) { + // Make sure we report as installed. Also safe to do, since the + // default state should be installed (we will always copy if we + // need to report it is not installed). + p.applicationInfo.flags |= ApplicationInfo.FLAG_INSTALLED; + if (state.enabled == PackageManager.COMPONENT_ENABLED_STATE_ENABLED) { p.applicationInfo.enabled = true; - } else if (enabledState == PackageManager.COMPONENT_ENABLED_STATE_DISABLED - || enabledState == PackageManager.COMPONENT_ENABLED_STATE_DISABLED_USER) { + } else if (state.enabled == PackageManager.COMPONENT_ENABLED_STATE_DISABLED + || state.enabled == PackageManager.COMPONENT_ENABLED_STATE_DISABLED_USER) { p.applicationInfo.enabled = false; } - p.applicationInfo.enabledSetting = enabledState; + p.applicationInfo.enabledSetting = state.enabled; return p.applicationInfo; } // Make shallow copy so we can store the metadata/libraries safely ApplicationInfo ai = new ApplicationInfo(p.applicationInfo); if (userId != 0) { - ai.uid = UserId.getUid(userId, ai.uid); + ai.uid = UserHandle.getUid(userId, ai.uid); ai.dataDir = PackageManager.getDataDirForUser(userId, ai.packageName); } if ((flags & PackageManager.GET_META_DATA) != 0) { @@ -3469,18 +3640,23 @@ public static ApplicationInfo generateApplicationInfo(Package p, int flags, if (!sCompatibilityModeEnabled) { ai.disableCompatibilityMode(); } - if (stopped) { + if (state.stopped) { ai.flags |= ApplicationInfo.FLAG_STOPPED; } else { ai.flags &= ~ApplicationInfo.FLAG_STOPPED; } - if (enabledState == PackageManager.COMPONENT_ENABLED_STATE_ENABLED) { + if (state.installed) { + ai.flags |= ApplicationInfo.FLAG_INSTALLED; + } else { + ai.flags &= ~ApplicationInfo.FLAG_INSTALLED; + } + if (state.enabled == PackageManager.COMPONENT_ENABLED_STATE_ENABLED) { ai.enabled = true; - } else if (enabledState == PackageManager.COMPONENT_ENABLED_STATE_DISABLED - || enabledState == PackageManager.COMPONENT_ENABLED_STATE_DISABLED_USER) { + } else if (state.enabled == PackageManager.COMPONENT_ENABLED_STATE_DISABLED + || state.enabled == PackageManager.COMPONENT_ENABLED_STATE_DISABLED_USER) { ai.enabled = false; } - ai.enabledSetting = enabledState; + ai.enabledSetting = state.enabled; return ai; } @@ -3527,16 +3703,19 @@ public String toString() { } } - public static final ActivityInfo generateActivityInfo(Activity a, int flags, boolean stopped, - int enabledState, int userId) { + public static final ActivityInfo generateActivityInfo(Activity a, int flags, + PackageUserState state, int userId) { if (a == null) return null; - if (!copyNeeded(flags, a.owner, enabledState, a.metaData) && userId == 0) { + if (!checkUseInstalled(flags, state)) { + return null; + } + if (!copyNeeded(flags, a.owner, state, a.metaData, userId)) { return a.info; } // Make shallow copies so we can store the metadata safely ActivityInfo ai = new ActivityInfo(a.info); ai.metaData = a.metaData; - ai.applicationInfo = generateApplicationInfo(a.owner, flags, stopped, enabledState, userId); + ai.applicationInfo = generateApplicationInfo(a.owner, flags, state, userId); return ai; } @@ -3561,17 +3740,19 @@ public String toString() { } } - public static final ServiceInfo generateServiceInfo(Service s, int flags, boolean stopped, - int enabledState, int userId) { + public static final ServiceInfo generateServiceInfo(Service s, int flags, + PackageUserState state, int userId) { if (s == null) return null; - if (!copyNeeded(flags, s.owner, enabledState, s.metaData) - && userId == UserId.getUserId(s.info.applicationInfo.uid)) { + if (!checkUseInstalled(flags, state)) { + return null; + } + if (!copyNeeded(flags, s.owner, state, s.metaData, userId)) { return s.info; } // Make shallow copies so we can store the metadata safely ServiceInfo si = new ServiceInfo(s.info); si.metaData = s.metaData; - si.applicationInfo = generateApplicationInfo(s.owner, flags, stopped, enabledState, userId); + si.applicationInfo = generateApplicationInfo(s.owner, flags, state, userId); return si; } @@ -3604,13 +3785,15 @@ public String toString() { } } - public static final ProviderInfo generateProviderInfo(Provider p, int flags, boolean stopped, - int enabledState, int userId) { + public static final ProviderInfo generateProviderInfo(Provider p, int flags, + PackageUserState state, int userId) { if (p == null) return null; - if (!copyNeeded(flags, p.owner, enabledState, p.metaData) + if (!checkUseInstalled(flags, state)) { + return null; + } + if (!copyNeeded(flags, p.owner, state, p.metaData, userId) && ((flags & PackageManager.GET_URI_PERMISSION_PATTERNS) != 0 - || p.info.uriPermissionPatterns == null) - && userId == 0) { + || p.info.uriPermissionPatterns == null)) { return p.info; } // Make shallow copies so we can store the metadata safely @@ -3619,7 +3802,7 @@ public static final ProviderInfo generateProviderInfo(Provider p, int flags, boo if ((flags & PackageManager.GET_URI_PERMISSION_PATTERNS) == 0) { pi.uriPermissionPatterns = null; } - pi.applicationInfo = generateApplicationInfo(p.owner, flags, stopped, enabledState, userId); + pi.applicationInfo = generateApplicationInfo(p.owner, flags, state, userId); return pi; } diff --git a/core/java/android/content/pm/PackageStats.java b/core/java/android/content/pm/PackageStats.java index 1205da7cdcc65..cb9039b046ee5 100644 --- a/core/java/android/content/pm/PackageStats.java +++ b/core/java/android/content/pm/PackageStats.java @@ -18,6 +18,7 @@ import android.os.Parcel; import android.os.Parcelable; +import android.os.UserHandle; /** * implementation of PackageStats associated with a @@ -27,6 +28,9 @@ public class PackageStats implements Parcelable { /** Name of the package to which this stats applies. */ public String packageName; + /** @hide */ + public int userHandle; + /** Size of the code (e.g., APK) */ public long codeSize; @@ -78,33 +82,58 @@ public PackageStats[] newArray(int size) { public String toString() { final StringBuilder sb = new StringBuilder("PackageStats{"); sb.append(Integer.toHexString(System.identityHashCode(this))); - sb.append(" packageName="); + sb.append(" "); sb.append(packageName); - sb.append(",codeSize="); - sb.append(codeSize); - sb.append(",dataSize="); - sb.append(dataSize); - sb.append(",cacheSize="); - sb.append(cacheSize); - sb.append(",externalCodeSize="); - sb.append(externalCodeSize); - sb.append(",externalDataSize="); - sb.append(externalDataSize); - sb.append(",externalCacheSize="); - sb.append(externalCacheSize); - sb.append(",externalMediaSize="); - sb.append(externalMediaSize); - sb.append(",externalObbSize="); - sb.append(externalObbSize); + if (codeSize != 0) { + sb.append(" code="); + sb.append(codeSize); + } + if (dataSize != 0) { + sb.append(" data="); + sb.append(dataSize); + } + if (cacheSize != 0) { + sb.append(" cache="); + sb.append(cacheSize); + } + if (externalCodeSize != 0) { + sb.append(" extCode="); + sb.append(externalCodeSize); + } + if (externalDataSize != 0) { + sb.append(" extData="); + sb.append(externalDataSize); + } + if (externalCacheSize != 0) { + sb.append(" extCache="); + sb.append(externalCacheSize); + } + if (externalMediaSize != 0) { + sb.append(" media="); + sb.append(externalMediaSize); + } + if (externalObbSize != 0) { + sb.append(" obb="); + sb.append(externalObbSize); + } + sb.append("}"); return sb.toString(); } public PackageStats(String pkgName) { packageName = pkgName; + userHandle = UserHandle.myUserId(); + } + + /** @hide */ + public PackageStats(String pkgName, int userHandle) { + this.packageName = pkgName; + this.userHandle = userHandle; } public PackageStats(Parcel source) { packageName = source.readString(); + userHandle = source.readInt(); codeSize = source.readLong(); dataSize = source.readLong(); cacheSize = source.readLong(); @@ -117,6 +146,7 @@ public PackageStats(Parcel source) { public PackageStats(PackageStats pStats) { packageName = pStats.packageName; + userHandle = pStats.userHandle; codeSize = pStats.codeSize; dataSize = pStats.dataSize; cacheSize = pStats.cacheSize; @@ -133,6 +163,7 @@ public int describeContents() { public void writeToParcel(Parcel dest, int parcelableFlags){ dest.writeString(packageName); + dest.writeInt(userHandle); dest.writeLong(codeSize); dest.writeLong(dataSize); dest.writeLong(cacheSize); diff --git a/core/java/android/content/pm/PackageUserState.java b/core/java/android/content/pm/PackageUserState.java new file mode 100644 index 0000000000000..357997781eda0 --- /dev/null +++ b/core/java/android/content/pm/PackageUserState.java @@ -0,0 +1,51 @@ +/* + * 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.content.pm; + +import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_DEFAULT; + +import java.util.HashSet; + +/** + * Per-user state information about a package. + * @hide + */ +public class PackageUserState { + public boolean stopped; + public boolean notLaunched; + public boolean installed; + public int enabled; + + public HashSet disabledComponents; + public HashSet enabledComponents; + + public PackageUserState() { + installed = true; + enabled = COMPONENT_ENABLED_STATE_DEFAULT; + } + + public PackageUserState(PackageUserState o) { + installed = o.installed; + stopped = o.stopped; + notLaunched = o.notLaunched; + enabled = o.enabled; + disabledComponents = o.disabledComponents != null + ? new HashSet(o.disabledComponents) : null; + enabledComponents = o.enabledComponents != null + ? new HashSet(o.enabledComponents) : null; + } +} \ No newline at end of file diff --git a/core/java/android/content/pm/PermissionGroupInfo.java b/core/java/android/content/pm/PermissionGroupInfo.java index 96d30d4113b1e..452bf0d2b6a10 100644 --- a/core/java/android/content/pm/PermissionGroupInfo.java +++ b/core/java/android/content/pm/PermissionGroupInfo.java @@ -44,20 +44,17 @@ public class PermissionGroupInfo extends PackageItemInfo implements Parcelable { /** * Flag for {@link #flags}, corresponding to personalInfo * value of {@link android.R.attr#permissionGroupFlags}. - * @hide */ public static final int FLAG_PERSONAL_INFO = 1<<0; /** * Additional flags about this group as given by * {@link android.R.attr#permissionGroupFlags}. - * @hide */ public int flags; /** * Prioritization of this group, for visually sorting with other groups. - * @hide */ public int priority; diff --git a/core/java/android/content/pm/PermissionInfo.java b/core/java/android/content/pm/PermissionInfo.java index 69b812ca89aa9..5a63e5f656f53 100644 --- a/core/java/android/content/pm/PermissionInfo.java +++ b/core/java/android/content/pm/PermissionInfo.java @@ -78,12 +78,35 @@ public class PermissionInfo extends PackageItemInfo implements Parcelable { */ public static final int PROTECTION_MASK_FLAGS = 0xf0; + /** + * The level of access this permission is protecting, as per + * {@link android.R.attr#protectionLevel}. Values may be + * {@link #PROTECTION_NORMAL}, {@link #PROTECTION_DANGEROUS}, or + * {@link #PROTECTION_SIGNATURE}. May also include the additional + * flags {@link #PROTECTION_FLAG_SYSTEM} or {@link #PROTECTION_FLAG_DEVELOPMENT} + * (which only make sense in combination with the base + * {@link #PROTECTION_SIGNATURE}. + */ + public int protectionLevel; + /** * The group this permission is a part of, as per * {@link android.R.attr#permissionGroup}. */ public String group; - + + /** + * Flag for {@link #flags}, corresponding to costsMoney + * value of {@link android.R.attr#permissionFlags}. + */ + public static final int FLAG_COSTS_MONEY = 1<<0; + + /** + * Additional flags about this permission as given by + * {@link android.R.attr#permissionFlags}. + */ + public int flags; + /** * A string resource identifier (in the package's resources) of this * permission's description. From the "description" attribute or, @@ -99,17 +122,6 @@ public class PermissionInfo extends PackageItemInfo implements Parcelable { */ public CharSequence nonLocalizedDescription; - /** - * The level of access this permission is protecting, as per - * {@link android.R.attr#protectionLevel}. Values may be - * {@link #PROTECTION_NORMAL}, {@link #PROTECTION_DANGEROUS}, or - * {@link #PROTECTION_SIGNATURE}. May also include the additional - * flags {@link #PROTECTION_FLAG_SYSTEM} or {@link #PROTECTION_FLAG_DEVELOPMENT} - * (which only make sense in combination with the base - * {@link #PROTECTION_SIGNATURE}. - */ - public int protectionLevel; - /** @hide */ public static int fixProtectionLevel(int level) { if (level == PROTECTION_SIGNATURE_OR_SYSTEM) { @@ -149,9 +161,10 @@ public PermissionInfo() { public PermissionInfo(PermissionInfo orig) { super(orig); + protectionLevel = orig.protectionLevel; + flags = orig.flags; group = orig.group; descriptionRes = orig.descriptionRes; - protectionLevel = orig.protectionLevel; nonLocalizedDescription = orig.nonLocalizedDescription; } @@ -191,9 +204,10 @@ public int describeContents() { public void writeToParcel(Parcel dest, int parcelableFlags) { super.writeToParcel(dest, parcelableFlags); + dest.writeInt(protectionLevel); + dest.writeInt(flags); dest.writeString(group); dest.writeInt(descriptionRes); - dest.writeInt(protectionLevel); TextUtils.writeToParcel(nonLocalizedDescription, dest, parcelableFlags); } @@ -209,9 +223,10 @@ public PermissionInfo[] newArray(int size) { private PermissionInfo(Parcel source) { super(source); + protectionLevel = source.readInt(); + flags = source.readInt(); group = source.readString(); descriptionRes = source.readInt(); - protectionLevel = source.readInt(); nonLocalizedDescription = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(source); } } diff --git a/core/java/android/content/pm/ProviderInfo.java b/core/java/android/content/pm/ProviderInfo.java index ec017754fc106..a53417620cc08 100644 --- a/core/java/android/content/pm/ProviderInfo.java +++ b/core/java/android/content/pm/ProviderInfo.java @@ -73,7 +73,21 @@ public final class ProviderInfo extends ComponentInfo /** Used to control initialization order of single-process providers * running in the same process. Higher goes first. */ public int initOrder = 0; - + + /** + * Bit in {@link #flags}: If set, a single instance of the provider will + * run for all users on the device. Set from the + * {@link android.R.attr#singleUser} attribute. + */ + public static final int FLAG_SINGLE_USER = 0x40000000; + + /** + * Options that have been set in the provider declaration in the + * manifest. + * These include: {@link #FLAG_SINGLE_USER}. + */ + public int flags = 0; + /** * Whether or not this provider is syncable. * @deprecated This flag is now being ignored. The current way to make a provider @@ -95,6 +109,7 @@ public ProviderInfo(ProviderInfo orig) { pathPermissions = orig.pathPermissions; multiprocess = orig.multiprocess; initOrder = orig.initOrder; + flags = orig.flags; isSyncable = orig.isSyncable; } @@ -112,6 +127,7 @@ public int describeContents() { out.writeTypedArray(pathPermissions, parcelableFlags); out.writeInt(multiprocess ? 1 : 0); out.writeInt(initOrder); + out.writeInt(flags); out.writeInt(isSyncable ? 1 : 0); } @@ -127,8 +143,7 @@ public ProviderInfo[] newArray(int size) { }; public String toString() { - return "ContentProviderInfo{name=" + authority + " className=" + name - + " isSyncable=" + (isSyncable ? "true" : "false") + "}"; + return "ContentProviderInfo{name=" + authority + " className=" + name + "}"; } private ProviderInfo(Parcel in) { @@ -141,6 +156,7 @@ private ProviderInfo(Parcel in) { pathPermissions = in.createTypedArray(PathPermission.CREATOR); multiprocess = in.readInt() != 0; initOrder = in.readInt(); + flags = in.readInt(); isSyncable = in.readInt() != 0; } } diff --git a/core/java/android/content/pm/RegisteredServicesCache.java b/core/java/android/content/pm/RegisteredServicesCache.java index d8f920478aa66..6def4a1697030 100644 --- a/core/java/android/content/pm/RegisteredServicesCache.java +++ b/core/java/android/content/pm/RegisteredServicesCache.java @@ -16,49 +16,54 @@ package android.content.pm; -import android.content.Context; import android.content.BroadcastReceiver; +import android.content.ComponentName; +import android.content.Context; import android.content.Intent; import android.content.IntentFilter; -import android.content.ComponentName; import android.content.pm.PackageManager.NameNotFoundException; import android.content.res.Resources; import android.content.res.XmlResourceParser; import android.os.Environment; import android.os.Handler; -import android.util.Log; +import android.os.UserHandle; +import android.util.AtomicFile; import android.util.AttributeSet; +import android.util.Log; +import android.util.Slog; +import android.util.SparseArray; import android.util.Xml; -import java.util.Map; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.ArrayList; -import java.util.concurrent.atomic.AtomicReference; -import java.io.File; -import java.io.FileOutputStream; -import java.io.FileDescriptor; -import java.io.PrintWriter; -import java.io.IOException; -import java.io.FileInputStream; - -import com.android.internal.os.AtomicFile; import com.android.internal.util.FastXmlSerializer; - -import com.google.android.collect.Maps; import com.google.android.collect.Lists; +import com.google.android.collect.Maps; -import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlSerializer; +import java.io.File; +import java.io.FileDescriptor; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.PrintWriter; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.Map; + /** - * A cache of registered services. This cache - * is built by interrogating the {@link PackageManager} and is updated as packages are added, - * removed and changed. The services are referred to by type V and - * are made available via the {@link #getServiceInfo} method. + * Cache of registered services. This cache is lazily built by interrogating + * {@link PackageManager} on a per-user basis. It's updated as packages are + * added, removed and changed. Users are responsible for calling + * {@link #invalidateCache(int)} when a user is started, since + * {@link PackageManager} broadcasts aren't sent for stopped users. + *

        + * The services are referred to by type V and are made available via the + * {@link #getServiceInfo} method. + * * @hide */ public abstract class RegisteredServicesCache { @@ -69,15 +74,29 @@ public abstract class RegisteredServicesCache { private final String mMetaDataName; private final String mAttributesName; private final XmlSerializerAndParser mSerializerAndParser; - private final AtomicReference mReceiver; private final Object mServicesLock = new Object(); - // synchronized on mServicesLock - private HashMap mPersistentServices; - // synchronized on mServicesLock - private Map> mServices; - // synchronized on mServicesLock + + // @GuardedBy("mServicesLock") private boolean mPersistentServicesFileDidNotExist; + // @GuardedBy("mServicesLock") + private final SparseArray> mUserServices = new SparseArray>(); + + private static class UserServices { + // @GuardedBy("mServicesLock") + public final Map persistentServices = Maps.newHashMap(); + // @GuardedBy("mServicesLock") + public Map> services = null; + } + + private UserServices findOrCreateUserLocked(int userId) { + UserServices services = mUserServices.get(userId); + if (services == null) { + services = new UserServices(); + mUserServices.put(userId, services); + } + return services; + } /** * This file contains the list of known services. We would like to maintain this forever @@ -102,36 +121,59 @@ public RegisteredServicesCache(Context context, String interfaceName, String met File syncDir = new File(systemDir, "registered_services"); mPersistentServicesFile = new AtomicFile(new File(syncDir, interfaceName + ".xml")); - generateServicesMap(); + // Load persisted services from disk + readPersistentServicesLocked(); - final BroadcastReceiver receiver = new BroadcastReceiver() { - @Override - public void onReceive(Context context1, Intent intent) { - generateServicesMap(); - } - }; - mReceiver = new AtomicReference(receiver); IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(Intent.ACTION_PACKAGE_ADDED); intentFilter.addAction(Intent.ACTION_PACKAGE_CHANGED); intentFilter.addAction(Intent.ACTION_PACKAGE_REMOVED); intentFilter.addDataScheme("package"); - mContext.registerReceiver(receiver, intentFilter); + mContext.registerReceiverAsUser(mPackageReceiver, UserHandle.ALL, intentFilter, null, null); + // Register for events related to sdcard installation. IntentFilter sdFilter = new IntentFilter(); sdFilter.addAction(Intent.ACTION_EXTERNAL_APPLICATIONS_AVAILABLE); sdFilter.addAction(Intent.ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE); - mContext.registerReceiver(receiver, sdFilter); + mContext.registerReceiver(mExternalReceiver, sdFilter); } - public void dump(FileDescriptor fd, PrintWriter fout, String[] args) { - Map> services; + private final BroadcastReceiver mPackageReceiver = new BroadcastReceiver() { + @Override + public void onReceive(Context context, Intent intent) { + final int uid = intent.getIntExtra(Intent.EXTRA_UID, -1); + if (uid != -1) { + generateServicesMap(UserHandle.getUserId(uid)); + } + } + }; + + private final BroadcastReceiver mExternalReceiver = new BroadcastReceiver() { + @Override + public void onReceive(Context context, Intent intent) { + // External apps can't coexist with multi-user, so scan owner + generateServicesMap(UserHandle.USER_OWNER); + } + }; + + public void invalidateCache(int userId) { synchronized (mServicesLock) { - services = mServices; + final UserServices user = findOrCreateUserLocked(userId); + user.services = null; } - fout.println("RegisteredServicesCache: " + services.size() + " services"); - for (ServiceInfo info : services.values()) { - fout.println(" " + info); + } + + public void dump(FileDescriptor fd, PrintWriter fout, String[] args, int userId) { + synchronized (mServicesLock) { + final UserServices user = findOrCreateUserLocked(userId); + if (user.services != null) { + fout.println("RegisteredServicesCache: " + user.services.size() + " services"); + for (ServiceInfo info : user.services.values()) { + fout.println(" " + info); + } + } else { + fout.println("RegisteredServicesCache: services not loaded"); + } } } @@ -151,7 +193,7 @@ public void setListener(RegisteredServicesCacheListener listener, Handler han } } - private void notifyListener(final V type, final boolean removed) { + private void notifyListener(final V type, final int userId, final boolean removed) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.d(TAG, "notifyListener: " + type + " is " + (removed ? "removed" : "added")); } @@ -168,7 +210,7 @@ private void notifyListener(final V type, final boolean removed) { final RegisteredServicesCacheListener listener2 = listener; handler.post(new Runnable() { public void run() { - listener2.onServiceChanged(type, removed); + listener2.onServiceChanged(type, userId, removed); } }); } @@ -200,9 +242,14 @@ public String toString() { * @param type the account type of the authenticator * @return the AuthenticatorInfo that matches the account type or null if none is present */ - public ServiceInfo getServiceInfo(V type) { + public ServiceInfo getServiceInfo(V type, int userId) { synchronized (mServicesLock) { - return mServices.get(type); + // Find user and lazily populate cache + final UserServices user = findOrCreateUserLocked(userId); + if (user.services == null) { + generateServicesMap(userId); + } + return user.services.get(type); } } @@ -210,29 +257,16 @@ public ServiceInfo getServiceInfo(V type) { * @return a collection of {@link RegisteredServicesCache.ServiceInfo} objects for all * registered authenticators. */ - public Collection> getAllServices() { + public Collection> getAllServices(int userId) { synchronized (mServicesLock) { - return Collections.unmodifiableCollection(mServices.values()); - } - } - - /** - * Stops the monitoring of package additions, removals and changes. - */ - public void close() { - final BroadcastReceiver receiver = mReceiver.getAndSet(null); - if (receiver != null) { - mContext.unregisterReceiver(receiver); - } - } - - @Override - protected void finalize() throws Throwable { - if (mReceiver.get() != null) { - Log.e(TAG, "RegisteredServicesCache finalized without being closed"); + // Find user and lazily populate cache + final UserServices user = findOrCreateUserLocked(userId); + if (user.services == null) { + generateServicesMap(userId); + } + return Collections.unmodifiableCollection( + new ArrayList>(user.services.values())); } - close(); - super.finalize(); } private boolean inSystemImage(int callerUid) { @@ -251,11 +285,17 @@ private boolean inSystemImage(int callerUid) { return false; } - public void generateServicesMap() { - PackageManager pm = mContext.getPackageManager(); - ArrayList> serviceInfos = new ArrayList>(); - List resolveInfos = pm.queryIntentServices(new Intent(mInterfaceName), - PackageManager.GET_META_DATA); + /** + * Populate {@link UserServices#services} by scanning installed packages for + * given {@link UserHandle}. + */ + private void generateServicesMap(int userId) { + Slog.d(TAG, "generateServicesMap() for " + userId); + + final PackageManager pm = mContext.getPackageManager(); + final ArrayList> serviceInfos = new ArrayList>(); + final List resolveInfos = pm.queryIntentServicesAsUser( + new Intent(mInterfaceName), PackageManager.GET_META_DATA, userId); for (ResolveInfo resolveInfo : resolveInfos) { try { ServiceInfo info = parseServiceInfo(resolveInfo); @@ -272,10 +312,14 @@ public void generateServicesMap() { } synchronized (mServicesLock) { - if (mPersistentServices == null) { - readPersistentServicesLocked(); + final UserServices user = findOrCreateUserLocked(userId); + final boolean firstScan = user.services == null; + if (firstScan) { + user.services = Maps.newHashMap(); + } else { + user.services.clear(); } - mServices = Maps.newHashMap(); + StringBuilder changes = new StringBuilder(); for (ServiceInfo info : serviceInfos) { // four cases: @@ -287,19 +331,19 @@ public void generateServicesMap() { // - ignore // - exists, the UID is different, and the new one is a system package // - add, notify user that it was added - Integer previousUid = mPersistentServices.get(info.type); + Integer previousUid = user.persistentServices.get(info.type); if (previousUid == null) { changes.append(" New service added: ").append(info).append("\n"); - mServices.put(info.type, info); - mPersistentServices.put(info.type, info.uid); - if (!mPersistentServicesFileDidNotExist) { - notifyListener(info.type, false /* removed */); + user.services.put(info.type, info); + user.persistentServices.put(info.type, info.uid); + if (!(mPersistentServicesFileDidNotExist && firstScan)) { + notifyListener(info.type, userId, false /* removed */); } } else if (previousUid == info.uid) { if (Log.isLoggable(TAG, Log.VERBOSE)) { changes.append(" Existing service (nop): ").append(info).append("\n"); } - mServices.put(info.type, info); + user.services.put(info.type, info); } else if (inSystemImage(info.uid) || !containsTypeAndUid(serviceInfos, info.type, previousUid)) { if (inSystemImage(info.uid)) { @@ -309,9 +353,9 @@ public void generateServicesMap() { changes.append(" Existing service replacing a removed service: ") .append(info).append("\n"); } - mServices.put(info.type, info); - mPersistentServices.put(info.type, info.uid); - notifyListener(info.type, false /* removed */); + user.services.put(info.type, info); + user.persistentServices.put(info.type, info.uid); + notifyListener(info.type, userId, false /* removed */); } else { // ignore changes.append(" Existing service with new uid ignored: ").append(info) @@ -320,25 +364,28 @@ public void generateServicesMap() { } ArrayList toBeRemoved = Lists.newArrayList(); - for (V v1 : mPersistentServices.keySet()) { + for (V v1 : user.persistentServices.keySet()) { if (!containsType(serviceInfos, v1)) { toBeRemoved.add(v1); } } for (V v1 : toBeRemoved) { - mPersistentServices.remove(v1); + user.persistentServices.remove(v1); changes.append(" Service removed: ").append(v1).append("\n"); - notifyListener(v1, true /* removed */); + notifyListener(v1, userId, true /* removed */); } if (changes.length() > 0) { - Log.d(TAG, "generateServicesMap(" + mInterfaceName + "): " + - serviceInfos.size() + " services:\n" + changes); + if (Log.isLoggable(TAG, Log.VERBOSE)) { + Log.d(TAG, "generateServicesMap(" + mInterfaceName + "): " + + serviceInfos.size() + " services:\n" + changes); + } writePersistentServicesLocked(); } else { - Log.d(TAG, "generateServicesMap(" + mInterfaceName + "): " + - serviceInfos.size() + " services unchanged"); + if (Log.isLoggable(TAG, Log.VERBOSE)) { + Log.d(TAG, "generateServicesMap(" + mInterfaceName + "): " + + serviceInfos.size() + " services unchanged"); + } } - mPersistentServicesFileDidNotExist = false; } } @@ -411,7 +458,7 @@ private ServiceInfo parseServiceInfo(ResolveInfo service) * Read all sync status back in to the initial engine state. */ private void readPersistentServicesLocked() { - mPersistentServices = Maps.newHashMap(); + mUserServices.clear(); if (mSerializerAndParser == null) { return; } @@ -440,8 +487,10 @@ private void readPersistentServicesLocked() { break; } String uidString = parser.getAttributeValue(null, "uid"); - int uid = Integer.parseInt(uidString); - mPersistentServices.put(service, uid); + final int uid = Integer.parseInt(uidString); + final int userId = UserHandle.getUserId(uid); + final UserServices user = findOrCreateUserLocked(userId); + user.persistentServices.put(service, uid); } } eventType = parser.next(); @@ -474,11 +523,14 @@ private void writePersistentServicesLocked() { out.startDocument(null, true); out.setFeature("http://xmlpull.org/v1/doc/features.html#indent-output", true); out.startTag(null, "services"); - for (Map.Entry service : mPersistentServices.entrySet()) { - out.startTag(null, "service"); - out.attribute(null, "uid", Integer.toString(service.getValue())); - mSerializerAndParser.writeAsXml(service.getKey(), out); - out.endTag(null, "service"); + for (int i = 0; i < mUserServices.size(); i++) { + final UserServices user = mUserServices.valueAt(i); + for (Map.Entry service : user.persistentServices.entrySet()) { + out.startTag(null, "service"); + out.attribute(null, "uid", Integer.toString(service.getValue())); + mSerializerAndParser.writeAsXml(service.getKey(), out); + out.endTag(null, "service"); + } } out.endTag(null, "services"); out.endDocument(); diff --git a/core/java/android/content/pm/RegisteredServicesCacheListener.java b/core/java/android/content/pm/RegisteredServicesCacheListener.java index 7095229f1984c..df795445e0e61 100644 --- a/core/java/android/content/pm/RegisteredServicesCacheListener.java +++ b/core/java/android/content/pm/RegisteredServicesCacheListener.java @@ -16,8 +16,6 @@ package android.content.pm; -import android.os.Parcelable; - /** * Listener for changes to the set of registered services managed by a RegisteredServicesCache. * @hide @@ -28,5 +26,5 @@ public interface RegisteredServicesCacheListener { * @param type the type of registered service * @param removed true if the service was removed */ - void onServiceChanged(V type, boolean removed); + void onServiceChanged(V type, int userId, boolean removed); } diff --git a/core/java/android/content/pm/ResolveInfo.java b/core/java/android/content/pm/ResolveInfo.java index e3749b4410166..07117fe0754e8 100644 --- a/core/java/android/content/pm/ResolveInfo.java +++ b/core/java/android/content/pm/ResolveInfo.java @@ -230,6 +230,21 @@ public void dump(Printer pw, String prefix) { public ResolveInfo() { } + public ResolveInfo(ResolveInfo orig) { + activityInfo = orig.activityInfo; + serviceInfo = orig.serviceInfo; + filter = orig.filter; + priority = orig.priority; + preferredOrder = orig.preferredOrder; + match = orig.match; + specificIndex = orig.specificIndex; + labelRes = orig.labelRes; + nonLocalizedLabel = orig.nonLocalizedLabel; + icon = orig.icon; + resolvePackageName = orig.resolvePackageName; + system = orig.system; + } + public String toString() { ComponentInfo ci = activityInfo != null ? activityInfo : serviceInfo; return "ResolveInfo{" diff --git a/core/java/android/content/pm/ServiceInfo.java b/core/java/android/content/pm/ServiceInfo.java index 7ee84ab734b95..796c2a422921b 100644 --- a/core/java/android/content/pm/ServiceInfo.java +++ b/core/java/android/content/pm/ServiceInfo.java @@ -48,11 +48,19 @@ public class ServiceInfo extends ComponentInfo */ public static final int FLAG_ISOLATED_PROCESS = 0x0002; + /** + * Bit in {@link #flags}: If set, a single instance of the service will + * run for all users on the device. Set from the + * {@link android.R.attr#singleUser} attribute. + */ + public static final int FLAG_SINGLE_USER = 0x40000000; + /** * Options that have been set in the service declaration in the * manifest. * These include: - * {@link #FLAG_STOP_WITH_TASK}, {@link #FLAG_ISOLATED_PROCESS}. + * {@link #FLAG_STOP_WITH_TASK}, {@link #FLAG_ISOLATED_PROCESS}, + * {@link #FLAG_SINGLE_USER}. */ public int flags; diff --git a/core/java/android/content/pm/ThemeInfo.aidl b/core/java/android/content/pm/ThemeInfo.aidl new file mode 100755 index 0000000000000..acbc85e9c8b98 --- /dev/null +++ b/core/java/android/content/pm/ThemeInfo.aidl @@ -0,0 +1,3 @@ +package android.content.pm; + +parcelable ThemeInfo; diff --git a/core/java/android/content/pm/ThemeInfo.java b/core/java/android/content/pm/ThemeInfo.java new file mode 100644 index 0000000000000..e51dbb6ae8cd7 --- /dev/null +++ b/core/java/android/content/pm/ThemeInfo.java @@ -0,0 +1,205 @@ +/* + * Copyright (C) 2010, T-Mobile USA, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.content.pm; + +import java.util.HashMap; +import java.util.Map; + +import org.xmlpull.v1.XmlPullParserException; +import org.xmlpull.v1.XmlPullParser; + +import android.os.Parcel; +import android.os.Parcelable; +import android.util.AttributeSet; +import android.content.res.Resources; + +/** + * Overall information about "theme" package. This corresponds + * to the information collected from AndroidManifest.xml (theme tag). + * + * Below is an example of theme tag + * + * + * @hide + */ +public final class ThemeInfo extends BaseThemeInfo { + private enum AttributeIndex { + THEME_PACKAGE_INDEX, + PREVIEW_INDEX, + AUTHOR_INDEX, + THEME_INDEX, + THEME_STYLE_NAME_INDEX, + THUMBNAIL_INDEX, + RINGTONE_FILE_NAME_INDEX, + NOTIFICATION_RINGTONE_FILE_NAME_INDEX, + WALLPAPER_IMAGE_INDEX, + COPYRIGHT_INDEX, + RINGTONE_NAME_INDEX, + NOTIFICATION_RINGTONE_NAME_INDEX, + STYLE_INDEX; + + public static AttributeIndex get(int ordinal) { + return values()[ordinal]; + } + }; + + private static final String [] compulsoryAttributes = new String [] { + "name", + "preview", + "author", + "themeId", + "styleName", + }; + + private static final String [] optionalAttributes = new String [] { + "thumbnail", + "ringtoneFileName", + "notificationRingtoneFileName", + "wallpaperImage", + "copyright", + "ringtoneName", + "notificationRingtoneName", + "styleId", + }; + + private static final Map sAttributesLookupTable; + + static { + sAttributesLookupTable = new HashMap(); + for (int i = 0; i < compulsoryAttributes.length; i++) { + sAttributesLookupTable.put(compulsoryAttributes[i], AttributeIndex.get(i)); + } + + for (int i = 0; i < optionalAttributes.length; i++) { + sAttributesLookupTable.put(optionalAttributes[i], + AttributeIndex.get(compulsoryAttributes.length + i)); + } + } + + public ThemeInfo(XmlPullParser parser, Resources res, AttributeSet attrs) throws XmlPullParserException { + super(); + + Map tempMap = + new HashMap(sAttributesLookupTable); + int numberOfCompulsoryAttributes = 0; + for (int i = 0; i < attrs.getAttributeCount(); i++) { + if (!ApplicationInfo.isPlutoNamespace(parser.getAttributeNamespace(i))) { + continue; + } + String key = attrs.getAttributeName(i); + if (tempMap.containsKey(key)) { + AttributeIndex index = tempMap.get(key); + tempMap.remove(key); + + if (index.ordinal() < compulsoryAttributes.length) { + numberOfCompulsoryAttributes++; + } + switch (index) { + case THEME_PACKAGE_INDEX: + // theme name + name = getResolvedString(res, attrs, i); + break; + + case THUMBNAIL_INDEX: + // theme thumbprint + thumbnailResourceId = attrs.getAttributeResourceValue(i, 0); + break; + + case AUTHOR_INDEX: + // theme author + author = getResolvedString(res, attrs, i); + break; + + case THEME_INDEX: + // androidUiStyle attribute + themeId = attrs.getAttributeValue(i); + break; + + case THEME_STYLE_NAME_INDEX: + themeStyleName = getResolvedString(res, attrs, i); + break; + + case RINGTONE_FILE_NAME_INDEX: + // ringtone + ringtoneFileName = attrs.getAttributeValue(i); + changeDrmFlagIfNeeded(ringtoneFileName); + break; + + case NOTIFICATION_RINGTONE_FILE_NAME_INDEX: + // notification ringtone + notificationRingtoneFileName = attrs.getAttributeValue(i); + changeDrmFlagIfNeeded(notificationRingtoneFileName); + break; + + case WALLPAPER_IMAGE_INDEX: + // wallpaperImage attribute + wallpaperResourceId = attrs.getAttributeResourceValue(i, 0); + break; + + case COPYRIGHT_INDEX: + // themeCopyright attribute + copyright = getResolvedString(res, attrs, i); + break; + + case RINGTONE_NAME_INDEX: + // ringtone UI name + ringtoneName = attrs.getAttributeValue(i); + break; + + case NOTIFICATION_RINGTONE_NAME_INDEX: + // notification ringtone UI name + notificationRingtoneName = attrs.getAttributeValue(i); + break; + + case STYLE_INDEX: + styleResourceId = attrs.getAttributeResourceValue(i, 0); + break; + + case PREVIEW_INDEX: + // theme thumbprint + previewResourceId = attrs.getAttributeResourceValue(i, 0); + break; + } + } + } + if (numberOfCompulsoryAttributes < compulsoryAttributes.length) { + throw new XmlPullParserException("Not all compulsory attributes are specified in "); + } + } + + public static final Parcelable.Creator CREATOR + = new Parcelable.Creator() { + public ThemeInfo createFromParcel(Parcel source) { + return new ThemeInfo(source); + } + + public ThemeInfo[] newArray(int size) { + return new ThemeInfo[size]; + } + }; + + private ThemeInfo(Parcel source) { + super(source); + } +} diff --git a/core/java/android/content/pm/UserInfo.java b/core/java/android/content/pm/UserInfo.java index ba5331c774877..593f8263b70a9 100644 --- a/core/java/android/content/pm/UserInfo.java +++ b/core/java/android/content/pm/UserInfo.java @@ -18,12 +18,23 @@ import android.os.Parcel; import android.os.Parcelable; +import android.os.UserHandle; /** * Per-user information. * @hide */ public class UserInfo implements Parcelable { + + /** 6 bits for user type */ + public static final int FLAG_MASK_USER_TYPE = 0x0000003F; + + /** + * *************************** NOTE *************************** + * These flag values CAN NOT CHANGE because they are written + * directly to storage. + */ + /** * Primary user. Only one user can have this flag set. Meaning of this * flag TBD. @@ -41,14 +52,37 @@ public class UserInfo implements Parcelable { */ public static final int FLAG_GUEST = 0x00000004; + /** + * Indicates the user has restrictions in privileges, in addition to those for normal users. + * Exact meaning TBD. For instance, maybe they can't install apps or administer WiFi access pts. + */ + public static final int FLAG_RESTRICTED = 0x00000008; + + /** + * Indicates that this user has gone through its first-time initialization. + */ + public static final int FLAG_INITIALIZED = 0x00000010; + public int id; + public int serialNumber; public String name; + public String iconPath; public int flags; + public long creationTime; + public long lastLoggedInTime; + + /** User is only partially created. */ + public boolean partial; public UserInfo(int id, String name, int flags) { + this(id, name, null, flags); + } + + public UserInfo(int id, String name, String iconPath, int flags) { this.id = id; this.name = name; this.flags = flags; + this.iconPath = iconPath; } public boolean isPrimary() { @@ -68,8 +102,17 @@ public UserInfo() { public UserInfo(UserInfo orig) { name = orig.name; + iconPath = orig.iconPath; id = orig.id; flags = orig.flags; + serialNumber = orig.serialNumber; + creationTime = orig.creationTime; + lastLoggedInTime = orig.lastLoggedInTime; + partial = orig.partial; + } + + public UserHandle getUserHandle() { + return new UserHandle(id); } @Override @@ -84,7 +127,12 @@ public int describeContents() { public void writeToParcel(Parcel dest, int parcelableFlags) { dest.writeInt(id); dest.writeString(name); + dest.writeString(iconPath); dest.writeInt(flags); + dest.writeInt(serialNumber); + dest.writeLong(creationTime); + dest.writeLong(lastLoggedInTime); + dest.writeInt(partial ? 1 : 0); } public static final Parcelable.Creator CREATOR @@ -100,6 +148,11 @@ public UserInfo[] newArray(int size) { private UserInfo(Parcel source) { id = source.readInt(); name = source.readString(); + iconPath = source.readString(); flags = source.readInt(); + serialNumber = source.readInt(); + creationTime = source.readLong(); + lastLoggedInTime = source.readLong(); + partial = source.readInt() != 0; } } diff --git a/core/java/android/content/pm/VerificationParams.aidl b/core/java/android/content/pm/VerificationParams.aidl new file mode 100644 index 0000000000000..5bb7f6962fe82 --- /dev/null +++ b/core/java/android/content/pm/VerificationParams.aidl @@ -0,0 +1,19 @@ +/* + * Copyright 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.content.pm; + +parcelable VerificationParams; diff --git a/core/java/android/content/pm/VerificationParams.java b/core/java/android/content/pm/VerificationParams.java new file mode 100644 index 0000000000000..22e1a859f8102 --- /dev/null +++ b/core/java/android/content/pm/VerificationParams.java @@ -0,0 +1,236 @@ +/* + * 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.content.pm; + +import android.content.pm.ManifestDigest; +import android.net.Uri; +import android.os.Parcel; +import android.os.Parcelable; + +/** + * Represents verification parameters used to verify packages to be installed. + * + * @hide + */ +public class VerificationParams implements Parcelable { + /** A constant used to indicate that a uid value is not present. */ + public static final int NO_UID = -1; + + /** What we print out first when toString() is called. */ + private static final String TO_STRING_PREFIX = "VerificationParams{"; + + /** The location of the supplementary verification file. */ + private final Uri mVerificationURI; + + /** URI referencing where the package was downloaded from. */ + private final Uri mOriginatingURI; + + /** HTTP referrer URI associated with the originatingURI. */ + private final Uri mReferrer; + + /** UID of the application that the install request originated from. */ + private final int mOriginatingUid; + + /** UID of application requesting the install */ + private int mInstallerUid; + + /** + * An object that holds the digest of the package which can be used to + * verify ownership. + */ + private final ManifestDigest mManifestDigest; + + /** + * Creates verification specifications for installing with application verification. + * + * @param verificationURI The location of the supplementary verification + * file. This can be a 'file:' or a 'content:' URI. May be {@code null}. + * @param originatingURI URI referencing where the package was downloaded + * from. May be {@code null}. + * @param referrer HTTP referrer URI associated with the originatingURI. + * May be {@code null}. + * @param originatingUid UID of the application that the install request originated + * from, or NO_UID if not present + * @param manifestDigest an object that holds the digest of the package + * which can be used to verify ownership. May be {@code null}. + */ + public VerificationParams(Uri verificationURI, Uri originatingURI, Uri referrer, + int originatingUid, ManifestDigest manifestDigest) { + mVerificationURI = verificationURI; + mOriginatingURI = originatingURI; + mReferrer = referrer; + mOriginatingUid = originatingUid; + mManifestDigest = manifestDigest; + mInstallerUid = NO_UID; + } + + public Uri getVerificationURI() { + return mVerificationURI; + } + + public Uri getOriginatingURI() { + return mOriginatingURI; + } + + public Uri getReferrer() { + return mReferrer; + } + + /** return NO_UID if not available */ + public int getOriginatingUid() { + return mOriginatingUid; + } + + public ManifestDigest getManifestDigest() { + return mManifestDigest; + } + + /** @return NO_UID when not set */ + public int getInstallerUid() { + return mInstallerUid; + } + + public void setInstallerUid(int uid) { + mInstallerUid = uid; + } + + @Override + public int describeContents() { + return 0; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + + if (!(o instanceof VerificationParams)) { + return false; + } + + final VerificationParams other = (VerificationParams) o; + + if (mVerificationURI == null) { + if (other.mVerificationURI != null) { + return false; + } + } else if (!mVerificationURI.equals(other.mVerificationURI)) { + return false; + } + + if (mOriginatingURI == null) { + if (other.mOriginatingURI != null) { + return false; + } + } else if (!mOriginatingURI.equals(other.mOriginatingURI)) { + return false; + } + + if (mReferrer == null) { + if (other.mReferrer != null) { + return false; + } + } else if (!mReferrer.equals(other.mReferrer)) { + return false; + } + + if (mOriginatingUid != other.mOriginatingUid) { + return false; + } + + if (mManifestDigest == null) { + if (other.mManifestDigest != null) { + return false; + } + } else if (!mManifestDigest.equals(other.mManifestDigest)) { + return false; + } + + if (mInstallerUid != other.mInstallerUid) { + return false; + } + + return true; + } + + @Override + public int hashCode() { + int hash = 3; + + hash += 5 * (mVerificationURI == null ? 1 : mVerificationURI.hashCode()); + hash += 7 * (mOriginatingURI == null ? 1 : mOriginatingURI.hashCode()); + hash += 11 * (mReferrer == null ? 1 : mReferrer.hashCode()); + hash += 13 * mOriginatingUid; + hash += 17 * (mManifestDigest == null ? 1 : mManifestDigest.hashCode()); + hash += 19 * mInstallerUid; + + return hash; + } + + @Override + public String toString() { + final StringBuilder sb = new StringBuilder(TO_STRING_PREFIX); + + sb.append("mVerificationURI="); + sb.append(mVerificationURI.toString()); + sb.append(",mOriginatingURI="); + sb.append(mOriginatingURI.toString()); + sb.append(",mReferrer="); + sb.append(mReferrer.toString()); + sb.append(",mOriginatingUid="); + sb.append(mOriginatingUid); + sb.append(",mManifestDigest="); + sb.append(mManifestDigest.toString()); + sb.append(",mInstallerUid="); + sb.append(mInstallerUid); + sb.append('}'); + + return sb.toString(); + } + + @Override + public void writeToParcel(Parcel dest, int flags) { + dest.writeParcelable(mVerificationURI, 0); + dest.writeParcelable(mOriginatingURI, 0); + dest.writeParcelable(mReferrer, 0); + dest.writeInt(mOriginatingUid); + dest.writeParcelable(mManifestDigest, 0); + dest.writeInt(mInstallerUid); + } + + + private VerificationParams(Parcel source) { + mVerificationURI = source.readParcelable(Uri.class.getClassLoader()); + mOriginatingURI = source.readParcelable(Uri.class.getClassLoader()); + mReferrer = source.readParcelable(Uri.class.getClassLoader()); + mOriginatingUid = source.readInt(); + mManifestDigest = source.readParcelable(ManifestDigest.class.getClassLoader()); + mInstallerUid = source.readInt(); + } + + public static final Parcelable.Creator CREATOR = + new Parcelable.Creator() { + public VerificationParams createFromParcel(Parcel source) { + return new VerificationParams(source); + } + + public VerificationParams[] newArray(int size) { + return new VerificationParams[size]; + } + }; +} diff --git a/core/java/android/content/res/AssetManager.java b/core/java/android/content/res/AssetManager.java index ffefaa27a8520..80d09466af171 100644 --- a/core/java/android/content/res/AssetManager.java +++ b/core/java/android/content/res/AssetManager.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2006 The Android Open Source Project + * This code has been modified. Portions copyright (C) 2010, T-Mobile USA, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +19,7 @@ import android.os.ParcelFileDescriptor; import android.util.Log; +import android.util.SparseArray; import android.util.TypedValue; import java.io.FileNotFoundException; @@ -77,6 +79,20 @@ public final class AssetManager { private boolean mOpen = true; private HashMap mRefStacks; + private String mAssetDir; + private String mAppName; + + private boolean mThemeSupport; + private String mThemePackageName; + private int mThemeCookie; + + /** + * Organize all added redirection maps using Java strong references to keep + * the native layer cleanup simple (that is, finalize() in Java will be + * responsible for delete in C++). + */ + private SparseArray mRedirections; + /** * Create a new AssetManager containing only the basic system assets. * Applications will not generally use this method, instead retrieving the @@ -252,6 +268,12 @@ public void close() { } } + /*package*/ final void recreateStringBlocks() { + synchronized (this) { + makeStringBlocks(true); + } + } + /*package*/ final void makeStringBlocks(boolean copyFromSystem) { final int sysNum = copyFromSystem ? sSystem.mStringBlocks.length : 0; final int num = getStringBlockCount(); @@ -458,6 +480,18 @@ public final XmlResourceParser openXmlResourceParser(int cookie, return rp; } + /** + * {@hide} + * Split a theme package with DRM-protected resources into two files. + * + * @param packageFileName Original theme package file name. + * @param lockedFileName Name of the new "locked" file with DRM resources. + * @param drmProtectedresources Array of names of DRM-protected assets. + */ + public final int splitDrmProtectedThemePackage(String packageFileName, String lockedFileName, String [] drmProtectedresources) { + return splitThemePackage(packageFileName, lockedFileName, drmProtectedresources); + } + /** * {@hide} * Retrieve a non-asset as a compiled XML file. Not for use by @@ -624,6 +658,110 @@ public final int[] addAssetPaths(String[] paths) { return cookies; } + /** + * Delete a set of theme assets from the asset manager. Not for use by + * applications. Returns true if succeeded or false on failure. + * + * @hide + */ + public native final boolean detachThemePath(String packageName, int cookie); + + /** + * Attach a set of theme assets to the asset manager. If necessary, this + * method will forcefully update the internal ResTable data structure. + * + * @return Cookie of the added asset or 0 on failure. + * @hide + */ + public native final int attachThemePath(String path); + + /** + * Sets a flag indicating that this AssetManager should have themes + * attached, according to the initial request to create it by the + * ApplicationContext. + * + * {@hide} + */ + public final void setThemeSupport(boolean themeSupport) { + mThemeSupport = themeSupport; + } + + /** + * Should this AssetManager have themes attached, according to the initial + * request to create it by the ApplicationContext? + * + * {@hide} + */ + public final boolean hasThemeSupport() { + return mThemeSupport; + } + + /** + * Apply a heuristic to match-up all attributes from the source style with + * attributes in the destination style. For each match, an entry in the + * package redirection map will be inserted. + * + * {@hide} + */ + public native final boolean generateStyleRedirections(int resMapNative, int sourceStyle, + int destStyle); + + /** + * Get package name of current theme (may return null). + * {@hide} + */ + public String getThemePackageName() { + return mThemePackageName; + } + + /** + * Sets package name and highest level style id for current theme (null, 0 is allowed). + * {@hide} + */ + public void setThemePackageName(String packageName) { + mThemePackageName = packageName; + } + + /** + * Get asset cookie for current theme (may return 0). + * {@hide} + */ + public int getThemeCookie() { + return mThemeCookie; + } + + /** + * Sets asset cookie for current theme (0 if not a themed asset manager). + * {@hide} + */ + public void setThemeCookie(int cookie) { + mThemeCookie = cookie; + } + + /** + * Add a redirection map to the asset manager. All future resource lookups + * will consult this map. + * {@hide} + */ + public void addRedirections(PackageRedirectionMap map) { + if (mRedirections == null) { + mRedirections = new SparseArray(2); + } + mRedirections.append(map.getPackageId(), map); + addRedirectionsNative(map.getNativePointer()); + } + + /** + * Clear redirection map for the asset manager. + * {@hide} + */ + public void clearRedirections() { + if (mRedirections != null) { + mRedirections.clear(); + } + clearRedirectionsNative(); + } + /** * Determine whether the state in this asset manager is up-to-date with * the files on the filesystem. If false is returned, you need to @@ -741,6 +879,26 @@ private native final int loadResourceBagValue(int ident, int bagEntryId, TypedVa private native final int[] getArrayStringInfo(int arrayRes); /*package*/ native final int[] getArrayIntResource(int arrayRes); + private native final int splitThemePackage(String srcFileName, String dstFileName, String [] drmProtectedAssetNames); + + /** + * {@hide} + */ + public native final int getBasePackageCount(); + + /** + * {@hide} + */ + public native final String getBasePackageName(int index); + + /** + * {@hide} + */ + public native final int getBasePackageId(int index); + + private native final void addRedirectionsNative(int redirectionMapNativePointer); + private native final void clearRedirectionsNative(); + private native final void init(); private native final void destroy(); diff --git a/core/java/android/content/res/CompatibilityInfo.java b/core/java/android/content/res/CompatibilityInfo.java index 1c9285e7a9ac5..789d25e914c66 100644 --- a/core/java/android/content/res/CompatibilityInfo.java +++ b/core/java/android/content/res/CompatibilityInfo.java @@ -92,9 +92,15 @@ public class CompatibilityInfo implements Parcelable { */ public final float applicationInvertedScale; + /** + * Whether the application supports third-party theming. + */ + public final boolean isThemeable; + public CompatibilityInfo(ApplicationInfo appInfo, int screenLayout, int sw, boolean forceCompat) { int compatFlags = 0; + isThemeable = appInfo.isThemeable; if (appInfo.requiresSmallestWidthDp != 0 || appInfo.compatibleWidthLimitDp != 0 || appInfo.largestWidthLimitDp != 0) { @@ -242,17 +248,19 @@ public CompatibilityInfo(ApplicationInfo appInfo, int screenLayout, int sw, } private CompatibilityInfo(int compFlags, - int dens, float scale, float invertedScale) { + int dens, float scale, float invertedScale, boolean isThemeable) { mCompatibilityFlags = compFlags; applicationDensity = dens; applicationScale = scale; applicationInvertedScale = invertedScale; + this.isThemeable = isThemeable; } private CompatibilityInfo() { this(NEVER_NEEDS_COMPAT, DisplayMetrics.DENSITY_DEVICE, 1.0f, - 1.0f); + 1.0f, + true); } /** @@ -439,7 +447,7 @@ public void applyToDisplayMetrics(DisplayMetrics inoutDm) { if (isScalingRequired()) { float invertedRatio = applicationInvertedScale; inoutDm.density = inoutDm.noncompatDensity * invertedRatio; - inoutDm.densityDpi = (int)((inoutDm.density*DisplayMetrics.DENSITY_DEFAULT)+.5f); + inoutDm.densityDpi = (int)((inoutDm.noncompatDensityDpi * invertedRatio) + .5f); inoutDm.scaledDensity = inoutDm.noncompatScaledDensity * invertedRatio; inoutDm.xdpi = inoutDm.noncompatXdpi * invertedRatio; inoutDm.ydpi = inoutDm.noncompatYdpi * invertedRatio; @@ -448,7 +456,7 @@ public void applyToDisplayMetrics(DisplayMetrics inoutDm) { } } - public void applyToConfiguration(Configuration inoutConfig) { + public void applyToConfiguration(int displayDensity, Configuration inoutConfig) { if (!supportsScreen()) { // This is a larger screen device and the app is not // compatible with large screens, so we are forcing it to @@ -460,6 +468,11 @@ public void applyToConfiguration(Configuration inoutConfig) { inoutConfig.screenHeightDp = inoutConfig.compatScreenHeightDp; inoutConfig.smallestScreenWidthDp = inoutConfig.compatSmallestScreenWidthDp; } + inoutConfig.densityDpi = displayDensity; + if (isScalingRequired()) { + float invertedRatio = applicationInvertedScale; + inoutConfig.densityDpi = (int)((inoutConfig.densityDpi * invertedRatio) + .5f); + } } /** @@ -519,6 +532,7 @@ public boolean equals(Object o) { if (applicationDensity != oc.applicationDensity) return false; if (applicationScale != oc.applicationScale) return false; if (applicationInvertedScale != oc.applicationInvertedScale) return false; + if (isThemeable != oc.isThemeable) return false; return true; } catch (ClassCastException e) { return false; @@ -556,6 +570,7 @@ public int hashCode() { result = 31 * result + applicationDensity; result = 31 * result + Float.floatToIntBits(applicationScale); result = 31 * result + Float.floatToIntBits(applicationInvertedScale); + result = 31 * result + (isThemeable ? 1 : 0); return result; } @@ -570,6 +585,7 @@ public void writeToParcel(Parcel dest, int flags) { dest.writeInt(applicationDensity); dest.writeFloat(applicationScale); dest.writeFloat(applicationInvertedScale); + dest.writeInt(isThemeable ? 1 : 0); } public static final Parcelable.Creator CREATOR @@ -588,5 +604,6 @@ private CompatibilityInfo(Parcel source) { applicationDensity = source.readInt(); applicationScale = source.readFloat(); applicationInvertedScale = source.readFloat(); + isThemeable = source.readInt() == 1 ? true : false; } } diff --git a/core/java/android/content/res/Configuration.java b/core/java/android/content/res/Configuration.java index 423b9afa45a9f..3a6d30799aebf 100644 --- a/core/java/android/content/res/Configuration.java +++ b/core/java/android/content/res/Configuration.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2008 The Android Open Source Project + * This code has been modified. Portions copyright (C) 2010, T-Mobile USA, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,8 +20,11 @@ import android.content.pm.ActivityInfo; import android.os.Parcel; import android.os.Parcelable; -import android.util.LocaleUtil; +import android.text.TextUtils; import android.view.View; +import android.util.Log; +import android.os.SystemProperties; +import android.text.TextUtils; import java.util.Locale; @@ -35,6 +39,9 @@ *

        Configuration config = getResources().getConfiguration();
        */ public final class Configuration implements Parcelable, Comparable { + /** @hide */ + public static final Configuration EMPTY = new Configuration(); + /** * Current user preference for the scaling factor for fonts, relative * to the base density scaling. @@ -62,6 +69,11 @@ public final class Configuration implements Parcelable, Comparable
      */ public static final int JELLY_BEAN = 16; + + /** + * Android 4.2: Moar jelly beans! + * + *

      Applications targeting this or a later release will get these + * new changes in behavior:

      + *
        + *
      • Content Providers: The default value of {@code android:exported} is now + * {@code false}. See + * + * the android:exported section in the provider documentation for more details.
      • + *
      • {@link android.view.View#getLayoutDirection() View.getLayoutDirection()} + * can return different values than {@link android.view.View#LAYOUT_DIRECTION_LTR} + * based on the locale etc. + *
      • {@link android.webkit.WebView#addJavascriptInterface(Object, String) + * WebView.addJavascriptInterface} requires explicit annotations on methods + * for them to be accessible from Javascript. + *
      + */ + public static final int JELLY_BEAN_MR1 = 17; } /** The type of build, like "user" or "eng". */ diff --git a/core/java/android/os/Debug.java b/core/java/android/os/Debug.java index 591cd0efbecd7..e50c94813a74b 100644 --- a/core/java/android/os/Debug.java +++ b/core/java/android/os/Debug.java @@ -95,7 +95,7 @@ private Debug() {} * Default trace file path and file */ private static final String DEFAULT_TRACE_PATH_PREFIX = - Environment.getExternalStorageDirectory().getPath() + "/"; + Environment.getLegacyExternalStorageDirectory().getPath() + "/"; private static final String DEFAULT_TRACE_BODY = "dmtrace"; private static final String DEFAULT_TRACE_EXTENSION = ".trace"; private static final String DEFAULT_TRACE_FILE_PATH = @@ -1362,6 +1362,23 @@ public static String getCallers(final int depth) { return sb.toString(); } + /** + * Like {@link #getCallers(int)}, but each location is append to the string + * as a new line with linePrefix in front of it. + * @param depth the number of levels to return, starting with the immediate caller. + * @param linePrefix prefix to put in front of each location. + * @return a string describing the call stack. + * {@hide} + */ + public static String getCallers(final int depth, String linePrefix) { + final StackTraceElement[] callStack = Thread.currentThread().getStackTrace(); + StringBuffer sb = new StringBuffer(); + for (int i = 0; i < depth; i++) { + sb.append(linePrefix).append(getCaller(callStack, i)).append("\n"); + } + return sb.toString(); + } + /** * @return a String describing the immediate caller of the calling function. * {@hide} diff --git a/core/java/android/os/Environment.java b/core/java/android/os/Environment.java index 679cf1aaef37c..88529f8924e94 100644 --- a/core/java/android/os/Environment.java +++ b/core/java/android/os/Environment.java @@ -16,9 +16,10 @@ package android.os; -import android.content.res.Resources; import android.os.storage.IMountService; +import android.os.storage.StorageManager; import android.os.storage.StorageVolume; +import android.text.TextUtils; import android.util.Log; import java.io.File; @@ -29,31 +30,146 @@ public class Environment { private static final String TAG = "Environment"; + private static final String ENV_EXTERNAL_STORAGE = "EXTERNAL_STORAGE"; + private static final String ENV_EMULATED_STORAGE_SOURCE = "EMULATED_STORAGE_SOURCE"; + private static final String ENV_EMULATED_STORAGE_TARGET = "EMULATED_STORAGE_TARGET"; + private static final String ENV_MEDIA_STORAGE = "MEDIA_STORAGE"; + + /** {@hide} */ + public static String DIRECTORY_ANDROID = "Android"; + private static final File ROOT_DIRECTORY = getDirectory("ANDROID_ROOT", "/system"); private static final String SYSTEM_PROPERTY_EFS_ENABLED = "persist.security.efs.enabled"; - private static final Object mLock = new Object(); + private static UserEnvironment sCurrentUser; + + private static final Object sLock = new Object(); - private volatile static StorageVolume mPrimaryVolume = null; + // @GuardedBy("sLock") + private static volatile StorageVolume sPrimaryVolume; private static StorageVolume getPrimaryVolume() { - if (mPrimaryVolume == null) { - synchronized (mLock) { - if (mPrimaryVolume == null) { + if (sPrimaryVolume == null) { + synchronized (sLock) { + if (sPrimaryVolume == null) { try { IMountService mountService = IMountService.Stub.asInterface(ServiceManager .getService("mount")); - Parcelable[] volumes = mountService.getVolumeList(); - mPrimaryVolume = (StorageVolume)volumes[0]; + final StorageVolume[] volumes = mountService.getVolumeList(); + sPrimaryVolume = StorageManager.getPrimaryVolume(volumes); } catch (Exception e) { Log.e(TAG, "couldn't talk to MountService", e); } } } } - return mPrimaryVolume; + return sPrimaryVolume; + } + + static { + initForCurrentUser(); + } + + /** {@hide} */ + public static void initForCurrentUser() { + final int userId = UserHandle.myUserId(); + sCurrentUser = new UserEnvironment(userId); + + synchronized (sLock) { + sPrimaryVolume = null; + } + } + + /** {@hide} */ + public static class UserEnvironment { + // TODO: generalize further to create package-specific environment + + private final File mExternalStorage; + private final File mExternalStorageAndroidData; + private final File mExternalStorageAndroidMedia; + private final File mExternalStorageAndroidObb; + private final File mMediaStorage; + + public UserEnvironment(int userId) { + // See storage config details at http://source.android.com/tech/storage/ + String rawExternalStorage = System.getenv(ENV_EXTERNAL_STORAGE); + String rawEmulatedStorageTarget = System.getenv(ENV_EMULATED_STORAGE_TARGET); + String rawMediaStorage = System.getenv(ENV_MEDIA_STORAGE); + if (TextUtils.isEmpty(rawMediaStorage)) { + rawMediaStorage = "/data/media"; + } + + if (!TextUtils.isEmpty(rawEmulatedStorageTarget)) { + // Device has emulated storage; external storage paths should have + // userId burned into them. + final String rawUserId = Integer.toString(userId); + final File emulatedBase = new File(rawEmulatedStorageTarget); + final File mediaBase = new File(rawMediaStorage); + + // /storage/emulated/0 + mExternalStorage = buildPath(emulatedBase, rawUserId); + // /data/media/0 + mMediaStorage = buildPath(mediaBase, rawUserId); + + } else { + // Device has physical external storage; use plain paths. + if (TextUtils.isEmpty(rawExternalStorage)) { + Log.w(TAG, "EXTERNAL_STORAGE undefined; falling back to default"); + rawExternalStorage = "/storage/sdcard0"; + } + + // /storage/sdcard0 + mExternalStorage = new File(rawExternalStorage); + // /data/media + mMediaStorage = new File(rawMediaStorage); + } + + mExternalStorageAndroidObb = buildPath(mExternalStorage, DIRECTORY_ANDROID, "obb"); + mExternalStorageAndroidData = buildPath(mExternalStorage, DIRECTORY_ANDROID, "data"); + mExternalStorageAndroidMedia = buildPath(mExternalStorage, DIRECTORY_ANDROID, "media"); + } + + public File getExternalStorageDirectory() { + return mExternalStorage; + } + + public File getExternalStorageObbDirectory() { + return mExternalStorageAndroidObb; + } + + public File getExternalStoragePublicDirectory(String type) { + return new File(mExternalStorage, type); + } + + public File getExternalStorageAndroidDataDir() { + return mExternalStorageAndroidData; + } + + public File getExternalStorageAppDataDirectory(String packageName) { + return new File(mExternalStorageAndroidData, packageName); + } + + public File getExternalStorageAppMediaDirectory(String packageName) { + return new File(mExternalStorageAndroidMedia, packageName); + } + + public File getExternalStorageAppObbDirectory(String packageName) { + return new File(mExternalStorageAndroidObb, packageName); + } + + public File getExternalStorageAppFilesDirectory(String packageName) { + return new File(new File(mExternalStorageAndroidData, packageName), "files"); + } + + public File getExternalStorageAppCacheDirectory(String packageName) { + return new File(new File(mExternalStorageAndroidData, packageName), "cache"); + } + + public File getMediaStorageDirectory() { + return mMediaStorage; + } } /** @@ -100,7 +216,19 @@ public static File getSecureDataDirectory() { * @hide */ public static File getMediaStorageDirectory() { - return MEDIA_STORAGE_DIRECTORY; + throwIfSystem(); + return sCurrentUser.getMediaStorageDirectory(); + } + + /** + * Return the system directory for a user. This is for use by system services to store + * files relating to the user. This directory will be automatically deleted when the user + * is removed. + * + * @hide + */ + public static File getUserSystemDirectory(int userId) { + return new File(new File(getSystemSecureDirectory(), "users"), Integer.toString(userId)); } /** @@ -122,24 +250,7 @@ public static boolean isEncryptedFilesystemEnabled() { private static final File SECURE_DATA_DIRECTORY = getDirectory("ANDROID_SECURE_DATA", "/data/secure"); - /** @hide */ - private static final File MEDIA_STORAGE_DIRECTORY - = getDirectory("MEDIA_STORAGE", "/data/media"); - - private static final File EXTERNAL_STORAGE_DIRECTORY - = getDirectory("EXTERNAL_STORAGE", "/storage/sdcard0"); - - private static final File EXTERNAL_STORAGE_ANDROID_DATA_DIRECTORY = new File(new File( - getDirectory("EXTERNAL_STORAGE", "/storage/sdcard0"), "Android"), "data"); - - private static final File EXTERNAL_STORAGE_ANDROID_MEDIA_DIRECTORY = new File(new File( - getDirectory("EXTERNAL_STORAGE", "/storage/sdcard0"), "Android"), "media"); - - private static final File EXTERNAL_STORAGE_ANDROID_OBB_DIRECTORY = new File(new File( - getDirectory("EXTERNAL_STORAGE", "/storage/sdcard0"), "Android"), "obb"); - - private static final File DOWNLOAD_CACHE_DIRECTORY - = getDirectory("DOWNLOAD_CACHE", "/cache"); + private static final File DOWNLOAD_CACHE_DIRECTORY = getDirectory("DOWNLOAD_CACHE", "/cache"); /** * Gets the Android data directory. @@ -163,6 +274,10 @@ public static File getDataDirectory() { * built-in storage in a device that is distinct from the protected * internal storage and can be mounted as a filesystem on a computer.

      * + *

      On devices with multiple users (as described by {@link UserManager}), + * each user has their own isolated external storage. Applications only + * have access to the external storage for the user they're running as.

      + * *

      In devices with multiple "external" storage directories (such as * both secure app storage and mountable shared storage), this directory * represents the "primary" external storage that the user will interact @@ -175,7 +290,16 @@ public static File getDataDirectory() { * Context.getExternalFilesDir}, which the system will take care of deleting * if the application is uninstalled. Other shared files should be placed * in one of the directories returned by - * {@link #getExternalStoragePublicDirectory}. + * {@link #getExternalStoragePublicDirectory}.

      + * + *

      Writing to this path requires the + * {@link android.Manifest.permission#WRITE_EXTERNAL_STORAGE} permission. In + * a future platform release, access to this path will require the + * {@link android.Manifest.permission#READ_EXTERNAL_STORAGE} permission, + * which is automatically granted if you hold the write permission.

      + * + *

      This path may change between platform versions, so applications + * should only persist relative paths.

      * *

      Here is an example of typical code to monitor the state of * external storage:

      @@ -187,7 +311,30 @@ public static File getDataDirectory() { * @see #isExternalStorageRemovable() */ public static File getExternalStorageDirectory() { - return EXTERNAL_STORAGE_DIRECTORY; + throwIfSystem(); + return sCurrentUser.getExternalStorageDirectory(); + } + + /** {@hide} */ + public static File getLegacyExternalStorageDirectory() { + return new File(System.getenv(ENV_EXTERNAL_STORAGE)); + } + + /** {@hide} */ + public static File getLegacyExternalStorageObbDirectory() { + return buildPath(getLegacyExternalStorageDirectory(), DIRECTORY_ANDROID, "obb"); + } + + /** {@hide} */ + public static File getEmulatedStorageSource(int userId) { + // /mnt/shell/emulated/0 + return new File(System.getenv(ENV_EMULATED_STORAGE_SOURCE), String.valueOf(userId)); + } + + /** {@hide} */ + public static File getEmulatedStorageObbSource() { + // /mnt/shell/emulated/obb + return new File(System.getenv(ENV_EMULATED_STORAGE_SOURCE), "obb"); } /** @@ -289,6 +436,10 @@ public static File getExternalStorageDirectory() { * to ensure you don't erase their files or get in the way of their own * organization. * + *

      On devices with multiple users (as described by {@link UserManager}), + * each user has their own isolated external storage. Applications only + * have access to the external storage for the user they're running as.

      + * *

      Here is an example of typical code to manipulate a picture on * the public external storage:

      * @@ -307,7 +458,8 @@ public static File getExternalStorageDirectory() { * using it such as with {@link File#mkdirs File.mkdirs()}. */ public static File getExternalStoragePublicDirectory(String type) { - return new File(getExternalStorageDirectory(), type); + throwIfSystem(); + return sCurrentUser.getExternalStoragePublicDirectory(type); } /** @@ -315,7 +467,8 @@ public static File getExternalStoragePublicDirectory(String type) { * @hide */ public static File getExternalStorageAndroidDataDir() { - return EXTERNAL_STORAGE_ANDROID_DATA_DIRECTORY; + throwIfSystem(); + return sCurrentUser.getExternalStorageAndroidDataDir(); } /** @@ -323,7 +476,8 @@ public static File getExternalStorageAndroidDataDir() { * @hide */ public static File getExternalStorageAppDataDirectory(String packageName) { - return new File(EXTERNAL_STORAGE_ANDROID_DATA_DIRECTORY, packageName); + throwIfSystem(); + return sCurrentUser.getExternalStorageAppDataDirectory(packageName); } /** @@ -331,7 +485,8 @@ public static File getExternalStorageAppDataDirectory(String packageName) { * @hide */ public static File getExternalStorageAppMediaDirectory(String packageName) { - return new File(EXTERNAL_STORAGE_ANDROID_MEDIA_DIRECTORY, packageName); + throwIfSystem(); + return sCurrentUser.getExternalStorageAppMediaDirectory(packageName); } /** @@ -339,7 +494,8 @@ public static File getExternalStorageAppMediaDirectory(String packageName) { * @hide */ public static File getExternalStorageAppObbDirectory(String packageName) { - return new File(EXTERNAL_STORAGE_ANDROID_OBB_DIRECTORY, packageName); + throwIfSystem(); + return sCurrentUser.getExternalStorageAppObbDirectory(packageName); } /** @@ -347,21 +503,21 @@ public static File getExternalStorageAppObbDirectory(String packageName) { * @hide */ public static File getExternalStorageAppFilesDirectory(String packageName) { - return new File(new File(EXTERNAL_STORAGE_ANDROID_DATA_DIRECTORY, - packageName), "files"); + throwIfSystem(); + return sCurrentUser.getExternalStorageAppFilesDirectory(packageName); } - + /** * Generates the path to an application's cache. * @hide */ public static File getExternalStorageAppCacheDirectory(String packageName) { - return new File(new File(EXTERNAL_STORAGE_ANDROID_DATA_DIRECTORY, - packageName), "cache"); + throwIfSystem(); + return sCurrentUser.getExternalStorageAppCacheDirectory(packageName); } /** - * Gets the Android Download/Cache content directory. + * Gets the Android download/cache content directory. */ public static File getDownloadCacheDirectory() { return DOWNLOAD_CACHE_DIRECTORY; @@ -424,15 +580,16 @@ public static File getDownloadCacheDirectory() { /** * Gets the current state of the primary "external" storage device. * - *

      See {@link #getExternalStorageDirectory()} for more information. + * @see #getExternalStorageDirectory() */ public static String getExternalStorageState() { try { IMountService mountService = IMountService.Stub.asInterface(ServiceManager .getService("mount")); - return mountService.getVolumeState(getExternalStorageDirectory() - .toString()); - } catch (Exception rex) { + final StorageVolume primary = getPrimaryVolume(); + return mountService.getVolumeState(primary.getPath()); + } catch (RemoteException rex) { + Log.w(TAG, "Failed to read external storage state; assuming REMOVED: " + rex); return Environment.MEDIA_REMOVED; } } @@ -446,8 +603,8 @@ public static String getExternalStorageState() { *

      See {@link #getExternalStorageDirectory()} for more information. */ public static boolean isExternalStorageRemovable() { - StorageVolume volume = getPrimaryVolume(); - return (volume != null && volume.isRemovable()); + final StorageVolume primary = getPrimaryVolume(); + return (primary != null && primary.isRemovable()); } /** @@ -464,12 +621,30 @@ public static boolean isExternalStorageRemovable() { * android.content.ComponentName, boolean)} for additional details. */ public static boolean isExternalStorageEmulated() { - StorageVolume volume = getPrimaryVolume(); - return (volume != null && volume.isEmulated()); + final StorageVolume primary = getPrimaryVolume(); + return (primary != null && primary.isEmulated()); } static File getDirectory(String variableName, String defaultPath) { String path = System.getenv(variableName); return path == null ? new File(defaultPath) : new File(path); } + + private static void throwIfSystem() { + if (Process.myUid() == Process.SYSTEM_UID) { + Log.wtf(TAG, "Static storage paths aren't available from AID_SYSTEM", new Throwable()); + } + } + + private static File buildPath(File base, String... segments) { + File cur = base; + for (String segment : segments) { + if (cur == null) { + cur = new File(segment); + } else { + cur = new File(cur, segment); + } + } + return cur; + } } diff --git a/core/java/android/os/FactoryTest.java b/core/java/android/os/FactoryTest.java new file mode 100644 index 0000000000000..ec996973fdb03 --- /dev/null +++ b/core/java/android/os/FactoryTest.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 android.os; + +/** + * Provides support for in-place factory test functions. + * + * This class provides a few properties that alter the normal operation of the system + * during factory testing. + * + * {@hide} + */ +public final class FactoryTest { + /** + * When true, long-press on power should immediately cause the device to + * shut down, without prompting the user. + */ + public static boolean isLongPressOnPowerOffEnabled() { + return SystemProperties.getInt("factory.long_press_power_off", 0) != 0; + } +} diff --git a/core/java/android/os/FileUtils.java b/core/java/android/os/FileUtils.java index 6c1445df74a0d..2bec1c176905b 100644 --- a/core/java/android/os/FileUtils.java +++ b/core/java/android/os/FileUtils.java @@ -16,6 +16,7 @@ package android.os; +import java.io.BufferedInputStream; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; @@ -28,9 +29,6 @@ import java.util.zip.CRC32; import java.util.zip.CheckedInputStream; -import libcore.io.Os; -import libcore.io.StructStat; - /** * Tools for managing files. Not for public consumption. * @hide @@ -50,60 +48,12 @@ public class FileUtils { public static final int S_IROTH = 00004; public static final int S_IWOTH = 00002; public static final int S_IXOTH = 00001; - - - /** - * File status information. This class maps directly to the POSIX stat structure. - * @deprecated use {@link StructStat} instead. - * @hide - */ - @Deprecated - public static final class FileStatus { - public int dev; - public int ino; - public int mode; - public int nlink; - public int uid; - public int gid; - public int rdev; - public long size; - public int blksize; - public long blocks; - public long atime; - public long mtime; - public long ctime; - } - - /** - * Get the status for the given path. This is equivalent to the POSIX stat(2) system call. - * @param path The path of the file to be stat'd. - * @param status Optional argument to fill in. It will only fill in the status if the file - * exists. - * @return true if the file exists and false if it does not exist. If you do not have - * permission to stat the file, then this method will return false. - * @deprecated use {@link Os#stat(String)} instead. - */ - @Deprecated - public static boolean getFileStatus(String path, FileStatus status) { - StrictMode.noteDiskRead(); - return getFileStatusNative(path, status); - } - - private static native boolean getFileStatusNative(String path, FileStatus status); /** Regular expression for safe filenames: no spaces or metacharacters */ private static final Pattern SAFE_FILENAME_PATTERN = Pattern.compile("[\\w%+,./=_-]+"); public static native int setPermissions(String file, int mode, int uid, int gid); - /** - * @deprecated use {@link Os#stat(String)} instead. - */ - @Deprecated - public static native int getPermissions(String file, int[] outPermissions); - - public static native int setUMask(int mask); - /** returns the FAT file system volume ID for the volume mounted * at the given mount point, or -1 for failure * @param mountPoint point for FAT volume @@ -142,7 +92,7 @@ public static boolean copyFile(File srcFile, File destFile) { } return result; } - + /** * Copy data from a source stream to destFile. * Return true if succeed, return false if failed. @@ -194,12 +144,16 @@ public static boolean isFilenameSafe(File file) { */ public static String readTextFile(File file, int max, String ellipsis) throws IOException { InputStream input = new FileInputStream(file); + // wrapping a BufferedInputStream around it because when reading /proc with unbuffered + // input stream, bytes read not equal to buffer size is not necessarily the correct + // indication for EOF; but it is true for BufferedInputStream due to its implementation. + BufferedInputStream bis = new BufferedInputStream(input); try { long size = file.length(); if (max > 0 || (size > 0 && max == 0)) { // "head" mode: read the first N bytes if (size > 0 && (max == 0 || size < max)) max = (int) size; byte[] data = new byte[max + 1]; - int length = input.read(data); + int length = bis.read(data); if (length <= 0) return ""; if (length <= max) return new String(data, 0, length); if (ellipsis == null) return new String(data, 0, max); @@ -212,7 +166,7 @@ public static String readTextFile(File file, int max, String ellipsis) throws IO if (last != null) rolled = true; byte[] tmp = last; last = data; data = tmp; if (data == null) data = new byte[-max]; - len = input.read(data); + len = bis.read(data); } while (len == data.length); if (last == null && len <= 0) return ""; @@ -229,12 +183,13 @@ public static String readTextFile(File file, int max, String ellipsis) throws IO int len; byte[] data = new byte[1024]; do { - len = input.read(data); + len = bis.read(data); if (len > 0) contents.write(data, 0, len); } while (len == data.length); return contents.toString(); } } finally { + bis.close(); input.close(); } } diff --git a/core/java/android/os/Handler.java b/core/java/android/os/Handler.java index b892c8128cddf..94de4487b645c 100644 --- a/core/java/android/os/Handler.java +++ b/core/java/android/os/Handler.java @@ -101,36 +101,88 @@ public void dispatchMessage(Message msg) { } /** - * Default constructor associates this handler with the queue for the + * Default constructor associates this handler with the {@link Looper} for the * current thread. * - * If there isn't one, this handler won't be able to receive messages. + * If this thread does not have a looper, this handler won't be able to receive messages + * so an exception is thrown. */ public Handler() { - if (FIND_POTENTIAL_LEAKS) { - final Class klass = getClass(); - if ((klass.isAnonymousClass() || klass.isMemberClass() || klass.isLocalClass()) && - (klass.getModifiers() & Modifier.STATIC) == 0) { - Log.w(TAG, "The following Handler class should be static or leaks might occur: " + - klass.getCanonicalName()); - } - } - - mLooper = Looper.myLooper(); - if (mLooper == null) { - throw new RuntimeException( - "Can't create handler inside thread that has not called Looper.prepare()"); - } - mQueue = mLooper.mQueue; - mCallback = null; + this(null, false); } /** - * Constructor associates this handler with the queue for the + * Constructor associates this handler with the {@link Looper} for the * current thread and takes a callback interface in which you can handle * messages. + * + * If this thread does not have a looper, this handler won't be able to receive messages + * so an exception is thrown. + * + * @param callback The callback interface in which to handle messages, or null. */ public Handler(Callback callback) { + this(callback, false); + } + + /** + * Use the provided {@link Looper} instead of the default one. + * + * @param looper The looper, must not be null. + */ + public Handler(Looper looper) { + this(looper, null, false); + } + + /** + * Use the provided {@link Looper} instead of the default one and take a callback + * interface in which to handle messages. + * + * @param looper The looper, must not be null. + * @param callback The callback interface in which to handle messages, or null. + */ + public Handler(Looper looper, Callback callback) { + this(looper, callback, false); + } + + /** + * Use the {@link Looper} for the current thread + * and set whether the handler should be asynchronous. + * + * Handlers are synchronous by default unless this constructor is used to make + * one that is strictly asynchronous. + * + * Asynchronous messages represent interrupts or events that do not require global ordering + * with represent to synchronous messages. Asynchronous messages are not subject to + * the synchronization barriers introduced by {@link MessageQueue#enqueueSyncBarrier(long)}. + * + * @param async If true, the handler calls {@link Message#setAsynchronous(boolean)} for + * each {@link Message} that is sent to it or {@link Runnable} that is posted to it. + * + * @hide + */ + public Handler(boolean async) { + this(null, async); + } + + /** + * Use the {@link Looper} for the current thread with the specified callback interface + * and set whether the handler should be asynchronous. + * + * Handlers are synchronous by default unless this constructor is used to make + * one that is strictly asynchronous. + * + * Asynchronous messages represent interrupts or events that do not require global ordering + * with represent to synchronous messages. Asynchronous messages are not subject to + * the synchronization barriers introduced by {@link MessageQueue#enqueueSyncBarrier(long)}. + * + * @param callback The callback interface in which to handle messages, or null. + * @param async If true, the handler calls {@link Message#setAsynchronous(boolean)} for + * each {@link Message} that is sent to it or {@link Runnable} that is posted to it. + * + * @hide + */ + public Handler(Callback callback, boolean async) { if (FIND_POTENTIAL_LEAKS) { final Class klass = getClass(); if ((klass.isAnonymousClass() || klass.isMemberClass() || klass.isLocalClass()) && @@ -147,25 +199,33 @@ public Handler(Callback callback) { } mQueue = mLooper.mQueue; mCallback = callback; + mAsynchronous = async; } /** - * Use the provided queue instead of the default one. - */ - public Handler(Looper looper) { - mLooper = looper; - mQueue = looper.mQueue; - mCallback = null; - } - - /** - * Use the provided queue instead of the default one and take a callback - * interface in which to handle messages. + * Use the provided {@link Looper} instead of the default one and take a callback + * interface in which to handle messages. Also set whether the handler + * should be asynchronous. + * + * Handlers are synchronous by default unless this constructor is used to make + * one that is strictly asynchronous. + * + * Asynchronous messages represent interrupts or events that do not require global ordering + * with represent to synchronous messages. Asynchronous messages are not subject to + * the synchronization barriers introduced by {@link MessageQueue#enqueueSyncBarrier(long)}. + * + * @param looper The looper, must not be null. + * @param callback The callback interface in which to handle messages, or null. + * @param async If true, the handler calls {@link Message#setAsynchronous(boolean)} for + * each {@link Message} that is sent to it or {@link Runnable} that is posted to it. + * + * @hide */ - public Handler(Looper looper, Callback callback) { + public Handler(Looper looper, Callback callback, boolean async) { mLooper = looper; mQueue = looper.mQueue; mCallback = callback; + mAsynchronous = async; } /** @@ -351,6 +411,58 @@ public final boolean postAtFrontOfQueue(Runnable r) return sendMessageAtFrontOfQueue(getPostMessage(r)); } + /** + * Runs the specified task synchronously. + * + * If the current thread is the same as the handler thread, then the runnable + * runs immediately without being enqueued. Otherwise, posts the runnable + * to the handler and waits for it to complete before returning. + * + * This method is dangerous! Improper use can result in deadlocks. + * Never call this method while any locks are held or use it in a + * possibly re-entrant manner. + * + * This method is occasionally useful in situations where a background thread + * must synchronously await completion of a task that must run on the + * handler's thread. However, this problem is often a symptom of bad design. + * Consider improving the design (if possible) before resorting to this method. + * + * One example of where you might want to use this method is when you just + * set up a Handler thread and need to perform some initialization steps on + * it before continuing execution. + * + * If timeout occurs then this method returns false but the runnable + * will remain posted on the handler and may already be in progress or + * complete at a later time. + * + * @param r The Runnable that will be executed synchronously. + * @param timeout The timeout in milliseconds, or 0 to wait indefinitely. + * + * @return Returns true if the Runnable was successfully executed. + * Returns false on failure, usually because the + * looper processing the message queue is exiting. + * + * @hide This method is prone to abuse and should probably not be in the API. + * If we ever do make it part of the API, we might want to rename it to something + * less funny like runUnsafe(). + */ + public final boolean runWithScissors(final Runnable r, long timeout) { + if (r == null) { + throw new IllegalArgumentException("runnable must not be null"); + } + if (timeout < 0) { + throw new IllegalArgumentException("timeout must be non-negative"); + } + + if (Looper.myLooper() == mLooper) { + r.run(); + return true; + } + + BlockingRunnable br = new BlockingRunnable(r); + return br.postAndWait(this, timeout); + } + /** * Remove any pending posts of Runnable r that are in the message queue. */ @@ -464,20 +576,15 @@ public final boolean sendMessageDelayed(Message msg, long delayMillis) * the looper is quit before the delivery time of the message * occurs then the message will be dropped. */ - public boolean sendMessageAtTime(Message msg, long uptimeMillis) - { - boolean sent = false; + public boolean sendMessageAtTime(Message msg, long uptimeMillis) { MessageQueue queue = mQueue; - if (queue != null) { - msg.target = this; - sent = queue.enqueueMessage(msg, uptimeMillis); - } - else { + if (queue == null) { RuntimeException e = new RuntimeException( - this + " sendMessageAtTime() called with no mQueue"); + this + " sendMessageAtTime() called with no mQueue"); Log.w("Looper", e.getMessage(), e); + return false; } - return sent; + return enqueueMessage(queue, msg, uptimeMillis); } /** @@ -492,20 +599,23 @@ public boolean sendMessageAtTime(Message msg, long uptimeMillis) * message queue. Returns false on failure, usually because the * looper processing the message queue is exiting. */ - public final boolean sendMessageAtFrontOfQueue(Message msg) - { - boolean sent = false; + public final boolean sendMessageAtFrontOfQueue(Message msg) { MessageQueue queue = mQueue; - if (queue != null) { - msg.target = this; - sent = queue.enqueueMessage(msg, 0); - } - else { + if (queue == null) { RuntimeException e = new RuntimeException( this + " sendMessageAtTime() called with no mQueue"); Log.w("Looper", e.getMessage(), e); + return false; + } + return enqueueMessage(queue, msg, 0); + } + + private boolean enqueueMessage(MessageQueue queue, Message msg, long uptimeMillis) { + msg.target = this; + if (mAsynchronous) { + msg.setAsynchronous(true); } - return sent; + return queue.enqueueMessage(msg, uptimeMillis); } /** @@ -618,5 +728,57 @@ private static void handleCallback(Message message) { final MessageQueue mQueue; final Looper mLooper; final Callback mCallback; + final boolean mAsynchronous; IMessenger mMessenger; + + private static final class BlockingRunnable implements Runnable { + private final Runnable mTask; + private boolean mDone; + + public BlockingRunnable(Runnable task) { + mTask = task; + } + + @Override + public void run() { + try { + mTask.run(); + } finally { + synchronized (this) { + mDone = true; + notifyAll(); + } + } + } + + public boolean postAndWait(Handler handler, long timeout) { + if (!handler.post(this)) { + return false; + } + + synchronized (this) { + if (timeout > 0) { + final long expirationTime = SystemClock.uptimeMillis() + timeout; + while (!mDone) { + long delay = expirationTime - SystemClock.uptimeMillis(); + if (delay <= 0) { + return false; // timeout + } + try { + wait(delay); + } catch (InterruptedException ex) { + } + } + } else { + while (!mDone) { + try { + wait(); + } catch (InterruptedException ex) { + } + } + } + } + return true; + } + } } diff --git a/core/java/android/os/INetworkManagementService.aidl b/core/java/android/os/INetworkManagementService.aidl index e7ea3558dae1a..2179fa163e96a 100644 --- a/core/java/android/os/INetworkManagementService.aidl +++ b/core/java/android/os/INetworkManagementService.aidl @@ -151,6 +151,16 @@ interface INetworkManagementService */ boolean isTetheringStarted(); + /** + * Start bluetooth reverse tethering services + */ + void startReverseTethering(in String iface); + + /** + * Stop currently running bluetooth reserse tethering services + */ + void stopReverseTethering(); + /** * Tethers the specified interface */ @@ -218,17 +228,17 @@ interface INetworkManagementService /** * Start Wifi Access Point */ - void startAccessPoint(in WifiConfiguration wifiConfig, String wlanIface, String softapIface); + void startAccessPoint(in WifiConfiguration wifiConfig, String iface); /** * Stop Wifi Access Point */ - void stopAccessPoint(String wlanIface); + void stopAccessPoint(String iface); /** * Set Access Point config */ - void setAccessPoint(in WifiConfiguration wifiConfig, String wlanIface, String softapIface); + void setAccessPoint(in WifiConfiguration wifiConfig, String iface); /** ** DATA USAGE RELATED @@ -312,6 +322,27 @@ interface INetworkManagementService */ int getInterfaceTxThrottle(String iface); + /** + * Sets idletimer for an interface. + * + * This either initializes a new idletimer or increases its + * reference-counting if an idletimer already exists for given + * {@code iface}. + * + * {@code label} usually represents the network type of {@code iface}. + * Caller should ensure that {@code label} for an {@code iface} remains the + * same for all calls to addIdleTimer. + * + * Every {@code addIdleTimer} should be paired with a + * {@link removeIdleTimer} to cleanup when the network disconnects. + */ + void addIdleTimer(String iface, int timeout, String label); + + /** + * Removes idletimer for an interface. + */ + void removeIdleTimer(String iface); + /** * Sets the name of the default interface in the DNS resolver. */ @@ -331,4 +362,11 @@ interface INetworkManagementService * Flush the DNS cache associated with the specified interface. */ void flushInterfaceDnsCache(String iface); + + void setFirewallEnabled(boolean enabled); + boolean isFirewallEnabled(); + void setFirewallInterfaceRule(String iface, boolean allow); + void setFirewallEgressSourceRule(String addr, boolean allow); + void setFirewallEgressDestRule(String addr, int port, boolean allow); + void setFirewallUidRule(int uid, boolean allow); } diff --git a/core/java/android/os/IPowerManager.aidl b/core/java/android/os/IPowerManager.aidl index 270e9be1da67b..6d6d147b8a5e4 100644 --- a/core/java/android/os/IPowerManager.aidl +++ b/core/java/android/os/IPowerManager.aidl @@ -23,27 +23,32 @@ import android.os.WorkSource; interface IPowerManager { - // WARNING: changes in acquireWakeLock() signature must be reflected in IPowerManager.cpp/h - void acquireWakeLock(int flags, IBinder lock, String tag, in WorkSource ws); - void updateWakeLockWorkSource(IBinder lock, in WorkSource ws); - void goToSleep(long time); - void goToSleepWithReason(long time, int reason); - // WARNING: changes in releaseWakeLock() signature must be reflected in IPowerManager.cpp/h + // WARNING: The first two methods must remain the first two methods because their + // transaction numbers must not change unless IPowerManager.cpp is also updated. + void acquireWakeLock(IBinder lock, int flags, String tag, in WorkSource ws); void releaseWakeLock(IBinder lock, int flags); - void userActivity(long when, boolean noChangeLights); - void userActivityWithForce(long when, boolean noChangeLights, boolean force); - void clearUserActivityTimeout(long now, long timeout); - void setPokeLock(int pokey, IBinder lock, String tag); - int getSupportedWakeLockFlags(); - void setStayOnSetting(int val); - void setMaximumScreenOffTimeount(int timeMs); - void preventScreenOn(boolean prevent); + + void updateWakeLockWorkSource(IBinder lock, in WorkSource ws); + boolean isWakeLockLevelSupported(int level); + + void userActivity(long time, int event, int flags); + void wakeUp(long time); + void goToSleep(long time, int reason); + void nap(long time); + boolean isScreenOn(); - void reboot(String reason); + void reboot(boolean confirm, String reason, boolean wait); + void shutdown(boolean confirm, boolean wait); void crash(String message); - // sets the brightness of the backlights (screen, keyboard, button) 0-255 - void setBacklightBrightness(int brightness); + void setStayOnSetting(int val); + void setMaximumScreenOffTimeoutFromDeviceAdmin(int timeMs); + + // temporarily overrides the screen brightness settings to allow the user to + // see the effect of a settings change without applying it immediately + void setTemporaryScreenBrightnessSettingOverride(int brightness); + void setTemporaryScreenAutoBrightnessAdjustmentSettingOverride(float adj); + + // sets the attention light (used by phone app only) void setAttentionLight(boolean on, int color); - void setAutoBrightnessAdjustment(float adj); } diff --git a/core/java/android/os/IUserManager.aidl b/core/java/android/os/IUserManager.aidl new file mode 100644 index 0000000000000..ec02ae06c2e8a --- /dev/null +++ b/core/java/android/os/IUserManager.aidl @@ -0,0 +1,40 @@ +/* +** +** Copyright 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.os; + +import android.os.ParcelFileDescriptor; +import android.content.pm.UserInfo; +import android.graphics.Bitmap; + +/** + * {@hide} + */ +interface IUserManager { + UserInfo createUser(in String name, int flags); + boolean removeUser(int userHandle); + void setUserName(int userHandle, String name); + void setUserIcon(int userHandle, in Bitmap icon); + Bitmap getUserIcon(int userHandle); + List getUsers(boolean excludeDying); + UserInfo getUserInfo(int userHandle); + void setGuestEnabled(boolean enable); + boolean isGuestEnabled(); + void wipeUser(int userHandle); + int getUserSerialNumber(int userHandle); + int getUserHandle(int userSerialNumber); +} diff --git a/core/java/android/os/LocalPowerManager.java b/core/java/android/os/LocalPowerManager.java deleted file mode 100644 index 52df1f8f91df1..0000000000000 --- a/core/java/android/os/LocalPowerManager.java +++ /dev/null @@ -1,48 +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. - */ - -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; - public static final int POKE_LOCK_MEDIUM_TIMEOUT = 0x4; - public static final int POKE_LOCK_TIMEOUT_MASK = 0x6; - - void goToSleep(long time); - - // notify power manager when keyboard is opened/closed - void setKeyboardVisibility(boolean visible); - - // when the keyguard is up, it manages the power state, and userActivity doesn't do anything. - void enableUserActivity(boolean enabled); - - // the same as the method on PowerManager - void userActivity(long time, boolean noChangeLights, int eventType); - - boolean isScreenOn(); - - void setScreenBrightnessOverride(int brightness); - void setButtonBrightnessOverride(int brightness); -} diff --git a/core/java/android/os/PowerManager.java b/core/java/android/os/PowerManager.java index 903c8b3cde12b..4a011135aeaca 100644 --- a/core/java/android/os/PowerManager.java +++ b/core/java/android/os/PowerManager.java @@ -16,22 +16,25 @@ package android.os; +import android.content.Context; import android.util.Log; /** - * This class gives you control of the power state of the device. - * - *

      Device battery life will be significantly affected by the use of this API. Do not - * acquire WakeLocks unless you really need them, use the minimum levels possible, and be sure - * to release it as soon as you can. - * - *

      You can obtain an instance of this class by calling + * This class gives you control of the power state of the device. + * + *

      + * Device battery life will be significantly affected by the use of this API. + * Do not acquire {@link WakeLock}s unless you really need them, use the minimum levels + * possible, and be sure to release them as soon as possible. + *

      + * You can obtain an instance of this class by calling * {@link android.content.Context#getSystemService(java.lang.String) Context.getSystemService()}. - * - *

      The primary API you'll use is {@link #newWakeLock(int, String) newWakeLock()}. This will - * create a {@link PowerManager.WakeLock} object. You can then use methods on this object to - * control the power state of the device. In practice it's quite simple: - * + *

      + * The primary API you'll use is {@link #newWakeLock(int, String) newWakeLock()}. + * This will create a {@link PowerManager.WakeLock} object. You can then use methods + * on the wake lock object to control the power state of the device. + *

      + * In practice it's quite simple: * {@samplecode * PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); * PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, "My Tag"); @@ -39,49 +42,43 @@ * ..screen will stay on during this section.. * wl.release(); * } - * - *

      The following flags are defined, with varying effects on system power. These flags are - * mutually exclusive - you may only specify one of them. - * + *

      + * The following wake lock levels are defined, with varying effects on system power. + * These levels are mutually exclusive - you may only specify one of them. * - *

      + *
      * * - * * - * - * + * * * * - * + * * * * - * + * * * * - * + * * * - * *
      Flag ValueCPU Screen Keyboard
      {@link #PARTIAL_WAKE_LOCK}
      {@link #PARTIAL_WAKE_LOCK}On* Off Off
      {@link #SCREEN_DIM_WAKE_LOCK}
      {@link #SCREEN_DIM_WAKE_LOCK}On Dim Off
      {@link #SCREEN_BRIGHT_WAKE_LOCK}
      {@link #SCREEN_BRIGHT_WAKE_LOCK}On Bright Off
      {@link #FULL_WAKE_LOCK}
      {@link #FULL_WAKE_LOCK}On Bright Bright
      - * - *

      *If you hold a partial wakelock, the CPU will continue to run, irrespective of any timers - * and even after the user presses the power button. In all other wakelocks, the CPU will run, but - * the user can still put the device to sleep using the power button. - * - *

      In addition, you can add two more flags, which affect behavior of the screen only. These - * flags have no effect when combined with a {@link #PARTIAL_WAKE_LOCK}. - * + *

      + * *If you hold a partial wake lock, the CPU will continue to run, regardless of any + * display timeouts or the state of the screen and even after the user presses the power button. + * In all other wake locks, the CPU will run, but the user can still put the device to sleep + * using the power button. + *

      + * In addition, you can add two more flags, which affect behavior of the screen only. + * These flags have no effect when combined with a {@link #PARTIAL_WAKE_LOCK}.

      * - * + *
      * - * * - * - * + * * * * - * + * * * - * *
      Flag Value Description
      {@link #ACQUIRE_CAUSES_WAKEUP}
      {@link #ACQUIRE_CAUSES_WAKEUP}Normal wake locks don't actually turn on the illumination. Instead, they cause * the illumination to remain on once it turns on (e.g. from user activity). This flag * will force the screen and/or keyboard to turn on immediately, when the WakeLock is @@ -89,120 +86,148 @@ * see immediately.
      {@link #ON_AFTER_RELEASE}
      {@link #ON_AFTER_RELEASE}If this flag is set, the user activity timer will be reset when the WakeLock is * released, causing the illumination to remain on a bit longer. This can be used to * reduce flicker if you are cycling between wake lock conditions.
      - * + *

      * Any application using a WakeLock must request the {@code android.permission.WAKE_LOCK} * permission in an {@code <uses-permission>} element of the application's manifest. + *

      */ -public class PowerManager -{ +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; - private static final int WAKE_BIT_CPU_WEAK = 2; - private static final int WAKE_BIT_SCREEN_DIM = 4; - private static final int WAKE_BIT_SCREEN_BRIGHT = 8; - private static final int WAKE_BIT_KEYBOARD_BRIGHT = 16; - private static final int WAKE_BIT_PROXIMITY_SCREEN_OFF = 32; - - 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 that ensures that the CPU is running. The screen might - * not be on. + * Wake lock level: Ensures that the CPU is running; the screen and keyboard + * backlight will be allowed to go off. + *

      + * 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. + *

      */ - public static final int PARTIAL_WAKE_LOCK = WAKE_BIT_CPU_STRONG; + public static final int PARTIAL_WAKE_LOCK = 0x00000001; /** - * Wake lock that ensures that the screen and keyboard 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. + *

      + * 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}. + *

      * - *

      Most applications should strongly consider using - * {@link android.view.WindowManager.LayoutParams#FLAG_KEEP_SCREEN_ON}. - * This window flag will be correctly managed by the platform - * as the user moves between applications and doesn't require a special permission.

      + * @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 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. + *

      + * 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}. + *

      + * * @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. - * - * Wake lock that ensures that the screen is on at full brightness; - * the keyboard backlight will be allowed to go off. */ @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 that 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. + *

      + * 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}. + *

      + * + * @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 that turns the screen off when the proximity sensor activates. - * Since not all devices have proximity sensors, use - * {@link #getSupportedWakeLockFlags() getSupportedWakeLockFlags()} to determine if - * this wake lock mode is supported. + * Wake lock level: Turns the screen off when the proximity sensor activates. + *

      + * If the proximity sensor detects that an object is nearby, the screen turns off + * immediately. Shortly after the object moves away, the screen turns on again. + *

      + * A proximity wake lock does not prevent the device from falling asleep + * unlike {@link #FULL_WAKE_LOCK}, {@link #SCREEN_BRIGHT_WAKE_LOCK} and + * {@link #SCREEN_DIM_WAKE_LOCK}. If there is no user activity and no other + * wake locks are held, then the device will fall asleep (and lock) as usual. + * However, the device will not fall asleep while the screen has been turned off + * by the proximity sensor because it effectively counts as ongoing user activity. + *

      + * Since not all devices have proximity sensors, use {@link #isWakeLockLevelSupported} + * to determine whether this wake lock level is supported. + *

      * * {@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} wakelock 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. + *

      * Normally wake locks don't actually wake the device, they just cause - * it to remain on once it's already on. Think of the video player - * app as the normal behavior. Notifications that pop up and want + * the screen to remain on once it's already on. Think of the video player + * application as the normal behavior. Notifications that pop up and want * the device to be on are the exception; use this flag to be like them. - *

      - * Does not work with PARTIAL_WAKE_LOCKs. + *

      + * Cannot be used with {@link #PARTIAL_WAKE_LOCK}. + *

      */ public static final int ACQUIRE_CAUSES_WAKEUP = 0x10000000; /** - * When this wake lock is released, poke the user activity timer + * Wake lock flag: When this wake lock is released, poke the user activity timer * so the screen stays on for a little longer. *

      - * Will not turn the screen on if it is not already on. See {@link #ACQUIRE_CAUSES_WAKEUP} - * if you want that. - *

      - * Does not work with PARTIAL_WAKE_LOCKs. + * Will not turn the screen on if it is not already on. + * See {@link #ACQUIRE_CAUSES_WAKEUP} if you want that. + *

      + * Cannot be used with {@link #PARTIAL_WAKE_LOCK}. + *

      */ public static final int ON_AFTER_RELEASE = 0x20000000; /** - * Brightness value to use when battery is low. - * @hide + * 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 BRIGHTNESS_LOW_BATTERY = 10; + public static final int WAIT_FOR_PROXIMITY_NEGATIVE = 1; /** * Brightness value for fully on. @@ -211,46 +236,181 @@ public class PowerManager public static final int BRIGHTNESS_ON = 255; /** - * Brightness value for dim backlight. + * Brightness value for fully off. * @hide */ - public static final int BRIGHTNESS_DIM = 20; + 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. /** - * Brightness value for fully off. + * User activity event type: Unspecified event type. * @hide */ - public static final int BRIGHTNESS_OFF = 0; + public static final int USER_ACTIVITY_EVENT_OTHER = 0; /** - * Class lets you say that you need to have the device on. - *

      - * Call release when you are done and don't need the lock anymore. + * 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; + + /** + * User activity flag: Do not restart the user activity timeout or brighten + * the display in response to user activity if it is already dimmed. + * @hide + */ + public static final int USER_ACTIVITY_FLAG_NO_CHANGE_LIGHTS = 1 << 0; + + /** + * Go to sleep reason code: Going to sleep due by user request. + * @hide + */ + public static final int GO_TO_SLEEP_REASON_USER = 0; + + /** + * Go to sleep reason code: Going to sleep due by request of the + * device administration policy. + * @hide + */ + public static final int GO_TO_SLEEP_REASON_DEVICE_ADMIN = 1; + + /** + * Go to sleep reason code: Going to sleep due to a screen timeout. + * @hide + */ + public static final int GO_TO_SLEEP_REASON_TIMEOUT = 2; + + final Context mContext; + final IPowerManager mService; + final Handler mHandler; + + /** + * {@hide} + */ + public PowerManager(Context context, IPowerManager service, Handler handler) { + mContext = context; + mService = service; + mHandler = handler; + } + + /** + * Gets the minimum supported screen brightness setting. + * The screen may be allowed to become dimmer than this value but + * this is the minimum value that can be set by the user. + * @hide + */ + public int getMinimumScreenBrightnessSetting() { + return mContext.getResources().getInteger( + com.android.internal.R.integer.config_screenBrightnessSettingMinimum); + } + + /** + * Gets the maximum supported screen brightness setting. + * The screen may be allowed to become dimmer than this value but + * this is the maximum value that can be set by the user. + * @hide + */ + public int getMaximumScreenBrightnessSetting() { + return mContext.getResources().getInteger( + com.android.internal.R.integer.config_screenBrightnessSettingMaximum); + } + + /** + * Gets the default screen brightness setting. + * @hide + */ + public int getDefaultScreenBrightnessSetting() { + return mContext.getResources().getInteger( + com.android.internal.R.integer.config_screenBrightnessSettingDefault); + } + + /** + * Returns true if the screen auto-brightness adjustment setting should + * be available in the UI. This setting is experimental and disabled by default. + * @hide + */ + public static boolean useScreenAutoBrightnessAdjustmentFeature() { + return SystemProperties.getBoolean("persist.power.useautobrightadj", false); + } + + /** + * Returns true if the twilight service should be used to adjust screen brightness + * policy. This setting is experimental and disabled by default. + * @hide + */ + public static boolean useTwilightAdjustmentFeature() { + return SystemProperties.getBoolean("persist.power.usetwilightadj", false); + } + + /** + * Creates a new wake lock with the specified level and flags. *

      - * Any application using a WakeLock must request the {@code android.permission.WAKE_LOCK} - * permission in an {@code <uses-permission>} element of the application's manifest. + * The {@code levelAndFlags} parameter specifies a wake lock level and optional flags + * combined using the logical OR operator. + *

      + * The wake lock levels are: {@link #PARTIAL_WAKE_LOCK}, + * {@link #FULL_WAKE_LOCK}, {@link #SCREEN_DIM_WAKE_LOCK} + * and {@link #SCREEN_BRIGHT_WAKE_LOCK}. Exactly one wake lock level must be + * specified as part of the {@code levelAndFlags} parameter. + *

      + * The wake lock flags are: {@link #ACQUIRE_CAUSES_WAKEUP} + * and {@link #ON_AFTER_RELEASE}. Multiple flags can be combined as part of the + * {@code levelAndFlags} parameters. + *

      + * Call {@link WakeLock#acquire() acquire()} on the object to acquire the + * wake lock, and {@link WakeLock#release release()} when you are done. + *

      + * {@samplecode + * PowerManager pm = (PowerManager)mContext.getSystemService( + * Context.POWER_SERVICE); + * PowerManager.WakeLock wl = pm.newWakeLock( + * PowerManager.SCREEN_DIM_WAKE_LOCK + * | PowerManager.ON_AFTER_RELEASE, + * TAG); + * wl.acquire(); + * // ... do work... + * wl.release(); + * } + *

      + * Although a wake lock can be created without special permissions, + * the {@link android.Manifest.permission#WAKE_LOCK} permission is + * required to actually acquire or release the wake lock that is returned. + *

      + * If using this to keep the screen on, you should strongly consider using + * {@link android.view.WindowManager.LayoutParams#FLAG_KEEP_SCREEN_ON} instead. + * This window flag will be correctly managed by the platform + * as the user moves between applications and doesn't require a special permission. + *

      + * + * @param levelAndFlags Combination of wake lock level and flag values defining + * the requested behavior of the WakeLock. + * @param tag Your class name (or other tag) for debugging purposes. + * + * @see WakeLock#acquire() + * @see WakeLock#release() + * @see #PARTIAL_WAKE_LOCK + * @see #FULL_WAKE_LOCK + * @see #SCREEN_DIM_WAKE_LOCK + * @see #SCREEN_BRIGHT_WAKE_LOCK + * @see #ACQUIRE_CAUSES_WAKEUP + * @see #ON_AFTER_RELEASE */ - public class WakeLock - { - static final int RELEASE_WAKE_LOCK = 1; + public WakeLock newWakeLock(int levelAndFlags, String tag) { + validateWakeLockParameters(levelAndFlags, tag); + return new WakeLock(levelAndFlags, tag); + } - Runnable mReleaser = new Runnable() { - public void run() { - release(); - } - }; - - int mFlags; - String mTag; - IBinder mToken; - int mCount = 0; - boolean mRefCounted = true; - boolean mHeld = false; - WorkSource mWorkSource; - - WakeLock(int flags, String tag) - { - switch (flags & LOCK_MASK) { + /** @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: @@ -258,42 +418,282 @@ public void run() { case PROXIMITY_SCREEN_OFF_WAKE_LOCK: break; default: - throw new IllegalArgumentException(); + throw new IllegalArgumentException("Must specify a valid wake lock level."); + } + if (tag == null) { + throw new IllegalArgumentException("The tag must not be null."); + } + } + + /** + * Notifies the power manager that user activity happened. + *

      + * Resets the auto-off timer and brightens the screen if the device + * is not asleep. This is what happens normally when a key or the touch + * screen is pressed or when some other user activity occurs. + * This method does not wake up the device if it has been put to sleep. + *

      + * Requires the {@link android.Manifest.permission#DEVICE_POWER} permission. + *

      + * + * @param when The time of the user activity, in the {@link SystemClock#uptimeMillis()} + * time base. This timestamp is used to correctly order the user activity request with + * other power management functions. It should be set + * to the timestamp of the input event that caused the user activity. + * @param noChangeLights If true, does not cause the keyboard backlight to turn on + * because of this event. This is set when the power key is pressed. + * We want the device to stay on while the button is down, but we're about + * to turn off the screen so we don't want the keyboard backlight to turn on again. + * Otherwise the lights flash on and then off and it looks weird. + * + * @see #wakeUp + * @see #goToSleep + */ + public void userActivity(long when, boolean noChangeLights) { + try { + mService.userActivity(when, USER_ACTIVITY_EVENT_OTHER, + noChangeLights ? USER_ACTIVITY_FLAG_NO_CHANGE_LIGHTS : 0); + } catch (RemoteException e) { + } + } + + /** + * Forces the device to go to sleep. + *

      + * Overrides all the wake locks that are held. + * This is what happens when the power key is pressed to turn off the screen. + *

      + * Requires the {@link android.Manifest.permission#DEVICE_POWER} permission. + *

      + * + * @param time The time when the request to go to sleep was issued, in the + * {@link SystemClock#uptimeMillis()} time base. This timestamp is used to correctly + * order the go to sleep request with other power management functions. It should be set + * to the timestamp of the input event that caused the request to go to sleep. + * + * @see #userActivity + * @see #wakeUp + */ + public void goToSleep(long time) { + try { + mService.goToSleep(time, GO_TO_SLEEP_REASON_USER); + } catch (RemoteException e) { + } + } + + /** + * Forces the device to wake up from sleep. + *

      + * If the device is currently asleep, wakes it up, otherwise does nothing. + * This is what happens when the power key is pressed to turn on the screen. + *

      + * Requires the {@link android.Manifest.permission#DEVICE_POWER} permission. + *

      + * + * @param time The time when the request to wake up was issued, in the + * {@link SystemClock#uptimeMillis()} time base. This timestamp is used to correctly + * order the wake up request with other power management functions. It should be set + * to the timestamp of the input event that caused the request to wake up. + * + * @see #userActivity + * @see #goToSleep + */ + public void wakeUp(long time) { + try { + mService.wakeUp(time); + } catch (RemoteException e) { + } + } + + /** + * Forces the device to start napping. + *

      + * If the device is currently awake, starts dreaming, otherwise does nothing. + * When the dream ends or if the dream cannot be started, the device will + * either wake up or go to sleep depending on whether there has been recent + * user activity. + *

      + * Requires the {@link android.Manifest.permission#DEVICE_POWER} permission. + *

      + * + * @param time The time when the request to nap was issued, in the + * {@link SystemClock#uptimeMillis()} time base. This timestamp is used to correctly + * order the nap request with other power management functions. It should be set + * to the timestamp of the input event that caused the request to nap. + * + * @see #wakeUp + * @see #goToSleep + * + * @hide + */ + public void nap(long time) { + try { + mService.nap(time); + } catch (RemoteException e) { + } + } + + /** + * Sets the brightness of the backlights (screen, keyboard, button). + *

      + * Requires the {@link android.Manifest.permission#DEVICE_POWER} permission. + *

      + * + * @param brightness The brightness value from 0 to 255. + * + * {@hide} + */ + public void setBacklightBrightness(int brightness) { + try { + mService.setTemporaryScreenBrightnessSettingOverride(brightness); + } catch (RemoteException e) { + } + } + + /** + * Returns true if the specified wake lock level is supported. + * + * @param level The wake lock level to check. + * @return True if the specified wake lock level is supported. + * + * {@hide} + */ + public boolean isWakeLockLevelSupported(int level) { + try { + return mService.isWakeLockLevelSupported(level); + } catch (RemoteException e) { + return false; + } + } + + /** + * Returns whether the screen is currently on. + *

      + * Only indicates whether the screen is on. The screen could be either bright or dim. + *

      + * {@samplecode + * PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); + * boolean isScreenOn = pm.isScreenOn(); + * } + *

      + * + * @return whether the screen is on (bright or dim). + */ + public boolean isScreenOn() { + try { + return mService.isScreenOn(); + } catch (RemoteException e) { + return false; + } + } + + /** + * Reboot the device. Will not return if the reboot is successful. + *

      + * Requires the {@link android.Manifest.permission#REBOOT} permission. + *

      + * + * @param reason code to pass to the kernel (e.g., "recovery") to + * request special boot modes, or null. + */ + public void reboot(String reason) { + try { + mService.reboot(false, reason, true); + } catch (RemoteException e) { + } + } + + /** + * A wake lock is a mechanism to indicate that your application needs + * to have the device stay on. + *

      + * Any application using a WakeLock must request the {@code android.permission.WAKE_LOCK} + * permission in an {@code <uses-permission>} element of the application's manifest. + * Obtain a wake lock by calling {@link PowerManager#newWakeLock(int, String)}. + *

      + * Call {@link #acquire()} to acquire the wake lock and force the device to stay + * on at the level that was requested when the wake lock was created. + *

      + * Call {@link #release()} when you are done and don't need the lock anymore. + * It is very important to do this as soon as possible to avoid running down the + * device's battery excessively. + *

      + */ + public final class WakeLock { + private final int mFlags; + private final String mTag; + private final IBinder mToken; + private int mCount; + private boolean mRefCounted = true; + private boolean mHeld; + private WorkSource mWorkSource; + + private final Runnable mReleaser = new Runnable() { + public void run() { + release(); } + }; + WakeLock(int flags, String tag) { mFlags = flags; mTag = tag; mToken = new Binder(); } + @Override + protected void finalize() throws Throwable { + synchronized (mToken) { + if (mHeld) { + Log.wtf(TAG, "WakeLock finalized while still held: " + mTag); + try { + mService.releaseWakeLock(mToken, 0); + } catch (RemoteException e) { + } + } + } + } + /** - * Sets whether this WakeLock is ref counted. - * - *

      Wake locks are reference counted by default. + * Sets whether this WakeLock is reference counted. + *

      + * Wake locks are reference counted by default. If a wake lock is + * reference counted, then each call to {@link #acquire()} must be + * balanced by an equal number of calls to {@link #release()}. If a wake + * lock is not reference counted, then one call to {@link #release()} is + * sufficient to undo the effect of all previous calls to {@link #acquire()}. + *

      * - * @param value true for ref counted, false for not ref counted. + * @param value True to make the wake lock reference counted, false to + * make the wake lock non-reference counted. */ - public void setReferenceCounted(boolean value) - { - mRefCounted = value; + public void setReferenceCounted(boolean value) { + synchronized (mToken) { + mRefCounted = value; + } } /** - * Makes sure the device is on at the level you asked when you created - * the wake lock. + * Acquires the wake lock. + *

      + * Ensures that the device is on at the level requested when + * the wake lock was created. + *

      */ - public void acquire() - { + public void acquire() { synchronized (mToken) { acquireLocked(); } } /** - * Makes sure the device is on at the level you asked when you created - * the wake lock. The lock will be released after the given timeout. - * - * @param timeout Release the lock after the give timeout in milliseconds. + * Acquires the wake lock with a timeout. + *

      + * Ensures that the device is on at the level requested when + * the wake lock was created. The lock will be released after the given timeout + * expires. + *

      + * + * @param timeout The timeout after which to release the wake lock, in milliseconds. */ public void acquire(long timeout) { synchronized (mToken) { @@ -301,12 +701,18 @@ public void acquire(long timeout) { mHandler.postDelayed(mReleaser, timeout); } } - + private void acquireLocked() { if (!mRefCounted || mCount++ == 0) { + // Do this even if the wake lock is already thought to be held (mHeld == true) + // because non-reference counted wake locks are not always properly released. + // For example, the keyguard's wake lock might be forcibly released by the + // power manager without the keyguard knowing. A subsequent call to acquire + // should immediately acquire the wake lock once again despite never having + // been explicitly released by the keyguard. mHandler.removeCallbacks(mReleaser); try { - mService.acquireWakeLock(mFlags, mToken, mTag, mWorkSource); + mService.acquireWakeLock(mToken, mFlags, mTag, mWorkSource); } catch (RemoteException e) { } mHeld = true; @@ -314,24 +720,27 @@ private void acquireLocked() { } /** - * Release your claim to the CPU or screen being on. - * + * Releases the wake lock. *

      - * It may turn off shortly after you release it, or it may not if there - * are other wake locks held. + * This method releases your claim to the CPU or screen being on. + * The screen may turn off shortly after you release the wake lock, or it may + * not if there are other wake locks still held. + *

      */ public void release() { release(0); } /** - * Release your claim to the CPU or screen being on. - * @param flags Combination of flag values to modify the release behavior. - * Currently only {@link #WAIT_FOR_PROXIMITY_NEGATIVE} is supported. - * + * Releases the wake lock with flags to modify the release behavior. *

      - * It may turn off shortly after you release it, or it may not if there - * are other wake locks held. + * This method releases your claim to the CPU or screen being on. + * The screen may turn off shortly after you release the wake lock, or it may + * not if there are other wake locks still held. + *

      + * + * @param flags Combination of flag values to modify the release behavior. + * Currently only {@link #WAIT_FOR_PROXIMITY_NEGATIVE} is supported. * * {@hide} */ @@ -339,11 +748,13 @@ public void release(int flags) { synchronized (mToken) { if (!mRefCounted || --mCount == 0) { mHandler.removeCallbacks(mReleaser); - try { - mService.releaseWakeLock(mToken, flags); - } catch (RemoteException e) { + if (mHeld) { + try { + mService.releaseWakeLock(mToken, flags); + } catch (RemoteException e) { + } + mHeld = false; } - mHeld = false; } if (mCount < 0) { throw new RuntimeException("WakeLock under-locked " + mTag); @@ -351,23 +762,40 @@ public void release(int flags) { } } - public boolean isHeld() - { + /** + * Returns true if the wake lock has been acquired but not yet released. + * + * @return True if the wake lock is held. + */ + public boolean isHeld() { synchronized (mToken) { return mHeld; } } + /** + * Sets the work source associated with the wake lock. + *

      + * The work source is used to determine on behalf of which application + * the wake lock is being held. This is useful in the case where a + * service is performing work on behalf of an application so that the + * cost of that work can be accounted to the application. + *

      + * + * @param ws The work source, or null if none. + */ public void setWorkSource(WorkSource ws) { synchronized (mToken) { if (ws != null && ws.size() == 0) { ws = null; } - boolean changed = true; + + final boolean changed; if (ws == null) { + changed = mWorkSource != null; mWorkSource = null; } else if (mWorkSource == null) { - changed = mWorkSource != null; + changed = true; mWorkSource = new WorkSource(ws); } else { changed = mWorkSource.diff(ws); @@ -375,6 +803,7 @@ public void setWorkSource(WorkSource ws) { mWorkSource.set(ws); } } + if (changed && mHeld) { try { mService.updateWakeLockWorkSource(mToken, mWorkSource); @@ -384,6 +813,7 @@ public void setWorkSource(WorkSource ws) { } } + @Override public String toString() { synchronized (mToken) { return "WakeLock{" @@ -391,194 +821,5 @@ public String toString() { + " held=" + mHeld + ", refCount=" + mCount + "}"; } } - - @Override - protected void finalize() throws Throwable - { - synchronized (mToken) { - if (mHeld) { - Log.wtf(TAG, "WakeLock finalized while still held: " + mTag); - try { - mService.releaseWakeLock(mToken, 0); - } catch (RemoteException e) { - } - } - } - } - } - - /** - * Get a wake lock at the level of the flags parameter. Call - * {@link WakeLock#acquire() acquire()} on the object to acquire the - * wake lock, and {@link WakeLock#release release()} when you are done. - * - * {@samplecode - *PowerManager pm = (PowerManager)mContext.getSystemService( - * Context.POWER_SERVICE); - *PowerManager.WakeLock wl = pm.newWakeLock( - * PowerManager.SCREEN_DIM_WAKE_LOCK - * | PowerManager.ON_AFTER_RELEASE, - * TAG); - *wl.acquire(); - * // ... - *wl.release(); - * } - * - *

      If using this to keep the screen on, you should strongly consider using - * {@link android.view.WindowManager.LayoutParams#FLAG_KEEP_SCREEN_ON} instead. - * This window flag will be correctly managed by the platform - * as the user moves between applications and doesn't require a special permission.

      - * - * @param flags Combination of flag values defining the requested behavior of the WakeLock. - * @param tag Your class name (or other tag) for debugging purposes. - * - * @see WakeLock#acquire() - * @see WakeLock#release() - */ - public WakeLock newWakeLock(int flags, String tag) - { - if (tag == null) { - throw new NullPointerException("tag is null in PowerManager.newWakeLock"); - } - return new WakeLock(flags, tag); - } - - /** - * User activity happened. - *

      - * Turns the device from whatever state it's in to full on, and resets - * the auto-off timer. - * - * @param when is used to order this correctly with the wake lock calls. - * This time should be in the {@link SystemClock#uptimeMillis - * SystemClock.uptimeMillis()} time base. - * @param noChangeLights should be true if you don't want the lights to - * turn on because of this event. This is set when the power - * key goes down. We want the device to stay on while the button - * is down, but we're about to turn off. Otherwise the lights - * flash on and then off and it looks weird. - */ - public void userActivity(long when, boolean noChangeLights) - { - try { - mService.userActivity(when, noChangeLights); - } catch (RemoteException e) { - } - } - - /** - * Force the device to go to sleep. Overrides all the wake locks that are - * held. - * - * @param time is used to order this correctly with the wake lock calls. - * The time should be in the {@link SystemClock#uptimeMillis - * SystemClock.uptimeMillis()} time base. - */ - public void goToSleep(long time) - { - try { - mService.goToSleep(time); - } catch (RemoteException e) { - } - } - - /** - * sets the brightness of the backlights (screen, keyboard, button). - * - * @param brightness value from 0 to 255 - * - * {@hide} - */ - public void setBacklightBrightness(int brightness) - { - try { - mService.setBacklightBrightness(brightness); - } catch (RemoteException e) { - } - } - - /** - * Returns the set of flags for {@link #newWakeLock(int, String) newWakeLock()} - * that are supported on the device. - * For example, to test to see if the {@link #PROXIMITY_SCREEN_OFF_WAKE_LOCK} - * is supported: - * - * {@samplecode - * PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); - * int supportedFlags = pm.getSupportedWakeLockFlags(); - * boolean proximitySupported = ((supportedFlags & PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK) - * == PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK); - * } - * - * @return the set of supported WakeLock flags. - * - * {@hide} - */ - public int getSupportedWakeLockFlags() - { - try { - return mService.getSupportedWakeLockFlags(); - } catch (RemoteException e) { - return 0; - } } - - /** - * Returns whether the screen is currently on. The screen could be bright - * or dim. - * - * {@samplecode - * PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); - * boolean isScreenOn = pm.isScreenOn(); - * } - * - * @return whether the screen is on (bright or dim). - */ - public boolean isScreenOn() - { - try { - return mService.isScreenOn(); - } catch (RemoteException e) { - return false; - } - } - - /** - * Reboot the device. Will not return if the reboot is - * successful. Requires the {@link android.Manifest.permission#REBOOT} - * permission. - * - * @param reason code to pass to the kernel (e.g., "recovery") to - * request special boot modes, or null. - */ - public void reboot(String reason) - { - try { - mService.reboot(reason); - } catch (RemoteException e) { - } - } - - private PowerManager() - { - } - - /** - * {@hide} - */ - public PowerManager(IPowerManager service, Handler handler) - { - mService = service; - mHandler = handler; - } - - /** - * TODO: It would be nice to be able to set the poke lock here, - * but I'm not sure what would be acceptable as an interface - - * either a PokeLock object (like WakeLock) or, possibly just a - * method call to set the poke lock. - */ - - IPowerManager mService; - Handler mHandler; } diff --git a/core/java/android/os/Process.java b/core/java/android/os/Process.java index 8eaeb1d5f9d04..05099fba14d5e 100644 --- a/core/java/android/os/Process.java +++ b/core/java/android/os/Process.java @@ -115,6 +115,12 @@ public class Process { */ public static final int NFC_UID = 1027; + /** + * Defines the UID/GID for the Bluetooth service process. + * @hide + */ + public static final int BLUETOOTH_UID = 1002; + /** * Defines the GID for the group that allows write access to the internal media storage. * @hide @@ -145,11 +151,25 @@ public class Process { */ public static final int LAST_ISOLATED_UID = 99999; + /** + * First gid for applications to share resources. Used when forward-locking + * is enabled but all UserHandles need to be able to read the resources. + * @hide + */ + public static final int FIRST_SHARED_APPLICATION_GID = 50000; + + /** + * Last gid for applications to share resources. Used when forward-locking + * is enabled but all UserHandles need to be able to read the resources. + * @hide + */ + public static final int LAST_SHARED_APPLICATION_GID = 59999; + /** * Defines a secondary group id for access to the bluetooth hardware. */ public static final int BLUETOOTH_GID = 2000; - + /** * Standard priority of application threads. * Use with {@link #setThreadPriority(int)} and @@ -359,6 +379,7 @@ public class Process { * @param gids Additional group-ids associated with the process. * @param debugFlags Additional flags. * @param targetSdkVersion The target SDK version for the app. + * @param seInfo null-ok SE Android information for the new process. * @param zygoteArgs Additional arguments to supply to the zygote process. * * @return An object that describes the result of the attempt to start the process. @@ -369,11 +390,13 @@ public class Process { public static final ProcessStartResult start(final String processClass, final String niceName, int uid, int gid, int[] gids, - int debugFlags, int targetSdkVersion, + int debugFlags, int mountExternal, + int targetSdkVersion, + String seInfo, String[] zygoteArgs) { try { return startViaZygote(processClass, niceName, uid, gid, gids, - debugFlags, targetSdkVersion, zygoteArgs); + debugFlags, mountExternal, targetSdkVersion, seInfo, zygoteArgs); } catch (ZygoteStartFailedEx ex) { Log.e(LOG_TAG, "Starting VM process through Zygote failed"); @@ -536,6 +559,7 @@ private static ProcessStartResult zygoteSendArgsAndGetResult(ArrayList a * new process should setgroup() to. * @param debugFlags Additional flags. * @param targetSdkVersion The target SDK version for the app. + * @param seInfo null-ok SE Android information for the new process. * @param extraArgs Additional arguments to supply to the zygote process. * @return An object that describes the result of the attempt to start the process. * @throws ZygoteStartFailedEx if process start failed for any reason @@ -544,7 +568,9 @@ private static ProcessStartResult startViaZygote(final String processClass, final String niceName, final int uid, final int gid, final int[] gids, - int debugFlags, int targetSdkVersion, + int debugFlags, int mountExternal, + int targetSdkVersion, + String seInfo, String[] extraArgs) throws ZygoteStartFailedEx { synchronized(Process.class) { @@ -570,6 +596,11 @@ private static ProcessStartResult startViaZygote(final String processClass, if ((debugFlags & Zygote.DEBUG_ENABLE_ASSERT) != 0) { argsForZygote.add("--enable-assert"); } + if (mountExternal == Zygote.MOUNT_EXTERNAL_MULTIUSER) { + argsForZygote.add("--mount-external-multiuser"); + } else if (mountExternal == Zygote.MOUNT_EXTERNAL_MULTIUSER_ALL) { + argsForZygote.add("--mount-external-multiuser-all"); + } argsForZygote.add("--target-sdk-version=" + targetSdkVersion); //TODO optionally enable debuger @@ -595,6 +626,10 @@ private static ProcessStartResult startViaZygote(final String processClass, argsForZygote.add("--nice-name=" + niceName); } + if (seInfo != null) { + argsForZygote.add("--seinfo=" + seInfo); + } + argsForZygote.add(processClass); if (extraArgs != null) { @@ -626,16 +661,29 @@ private static ProcessStartResult startViaZygote(final String processClass, public static final native int myTid(); /** - * Returns the identifier of this process's user. + * Returns the identifier of this process's uid. This is the kernel uid + * that the process is running under, which is the identity of its + * app-specific sandbox. It is different from {@link #myUserHandle} in that + * a uid identifies a specific app sandbox in a specific user. */ public static final native int myUid(); + /** + * Returns this process's user handle. This is the + * user the process is running under. It is distinct from + * {@link #myUid()} in that a particular user will have multiple + * distinct apps running under it each with their own uid. + */ + public static final UserHandle myUserHandle() { + return new UserHandle(UserHandle.getUserId(myUid())); + } + /** * Returns whether the current process is in an isolated sandbox. * @hide */ public static final boolean isIsolated() { - int uid = UserId.getAppId(myUid()); + int uid = UserHandle.getAppId(myUid()); return uid >= FIRST_ISOLATED_UID && uid <= LAST_ISOLATED_UID; } diff --git a/core/java/android/os/RecoverySystem.java b/core/java/android/os/RecoverySystem.java index 43cf74eab7e95..480fe7d56964a 100644 --- a/core/java/android/os/RecoverySystem.java +++ b/core/java/android/os/RecoverySystem.java @@ -40,6 +40,7 @@ import java.util.HashSet; import java.util.Iterator; import java.util.List; +import java.util.Locale; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; @@ -326,7 +327,8 @@ public static void installPackage(Context context, File packageFile) throws IOException { String filename = packageFile.getCanonicalPath(); Log.w(TAG, "!!! REBOOTING TO INSTALL " + filename + " !!!"); - String arg = "--update_package=" + filename; + String arg = "--update_package=" + filename + + "\n--locale=" + Locale.getDefault().toString(); bootCommand(context, arg); } @@ -346,7 +348,8 @@ public static void rebootWipeUserData(Context context) throws IOException { final ConditionVariable condition = new ConditionVariable(); Intent intent = new Intent("android.intent.action.MASTER_CLEAR_NOTIFICATION"); - context.sendOrderedBroadcast(intent, android.Manifest.permission.MASTER_CLEAR, + context.sendOrderedBroadcastAsUser(intent, UserHandle.OWNER, + android.Manifest.permission.MASTER_CLEAR, new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { @@ -357,7 +360,7 @@ public void onReceive(Context context, Intent intent) { // Block until the ordered broadcast has completed. condition.block(); - bootCommand(context, "--wipe_data"); + bootCommand(context, "--wipe_data\n--locale=" + Locale.getDefault().toString()); } /** @@ -365,7 +368,7 @@ public void onReceive(Context context, Intent intent) { * @throws IOException if something goes wrong. */ public static void rebootWipeCache(Context context) throws IOException { - bootCommand(context, "--wipe_cache"); + bootCommand(context, "--wipe_cache\n--locale=" + Locale.getDefault().toString()); } /** diff --git a/core/java/android/os/RemoteCallbackList.java b/core/java/android/os/RemoteCallbackList.java index b74af1616fb47..d02a3203e9ac3 100644 --- a/core/java/android/os/RemoteCallbackList.java +++ b/core/java/android/os/RemoteCallbackList.java @@ -304,4 +304,25 @@ public void finishBroadcast() { mBroadcastCount = -1; } + + /** + * Returns the number of registered callbacks. Note that the number of registered + * callbacks may differ from the value returned by {@link #beginBroadcast()} since + * the former returns the number of callbacks registered at the time of the call + * and the second the number of callback to which the broadcast will be delivered. + *

      + * This function is useful to decide whether to schedule a broadcast if this + * requires doing some work which otherwise would not be performed. + *

      + * + * @return The size. + */ + public int getRegisteredCallbackCount() { + synchronized (mCallbacks) { + if (mKilled) { + return 0; + } + return mCallbacks.size(); + } + } } diff --git a/core/java/android/os/SELinux.java b/core/java/android/os/SELinux.java new file mode 100644 index 0000000000000..c05a9747ba6d7 --- /dev/null +++ b/core/java/android/os/SELinux.java @@ -0,0 +1,176 @@ +/* + * 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.os; + +import android.util.Slog; + +import java.io.IOException; +import java.io.File; +import java.io.FileDescriptor; + +/** + * This class provides access to the centralized jni bindings for + * SELinux interaction. + * {@hide} + */ +public class SELinux { + + private static final String TAG = "SELinux"; + + /** + * Determine whether SELinux is disabled or enabled. + * @return a boolean indicating whether SELinux is enabled. + */ + public static final native boolean isSELinuxEnabled(); + + /** + * Determine whether SELinux is permissive or enforcing. + * @return a boolean indicating whether SELinux is enforcing. + */ + public static final native boolean isSELinuxEnforced(); + + /** + * Set whether SELinux is permissive or enforcing. + * @param boolean representing whether to set SELinux to enforcing + * @return a boolean representing whether the desired mode was set + */ + public static final native boolean setSELinuxEnforce(boolean value); + + /** + * Sets the security context for newly created file objects. + * @param context a security context given as a String. + * @return a boolean indicating whether the operation succeeded. + */ + public static final native boolean setFSCreateContext(String context); + + /** + * Change the security context of an existing file object. + * @param path representing the path of file object to relabel. + * @param con new security context given as a String. + * @return a boolean indicating whether the operation succeeded. + */ + public static final native boolean setFileContext(String path, String context); + + /** + * Get the security context of a file object. + * @param path the pathname of the file object. + * @return a security context given as a String. + */ + public static final native String getFileContext(String path); + + /** + * Get the security context of a peer socket. + * @param fd FileDescriptor class of the peer socket. + * @return a String representing the peer socket security context. + */ + public static final native String getPeerContext(FileDescriptor fd); + + /** + * Gets the security context of the current process. + * @return a String representing the security context of the current process. + */ + public static final native String getContext(); + + /** + * Gets the security context of a given process id. + * Use of this function is discouraged for Binder transactions. + * Use Binder.getCallingSecctx() instead. + * @param pid an int representing the process id to check. + * @return a String representing the security context of the given pid. + */ + public static final native String getPidContext(int pid); + + /** + * Gets a list of the SELinux boolean names. + * @return an array of strings containing the SELinux boolean names. + */ + public static final native String[] getBooleanNames(); + + /** + * Gets the value for the given SELinux boolean name. + * @param String The name of the SELinux boolean. + * @return a boolean indicating whether the SELinux boolean is set. + */ + public static final native boolean getBooleanValue(String name); + + /** + * Sets the value for the given SELinux boolean name. + * @param String The name of the SELinux boolean. + * @param Boolean The new value of the SELinux boolean. + * @return a boolean indicating whether or not the operation succeeded. + */ + public static final native boolean setBooleanValue(String name, boolean value); + + /** + * Check permissions between two security contexts. + * @param scon The source or subject security context. + * @param tcon The target or object security context. + * @param tclass The object security class name. + * @param perm The permission name. + * @return a boolean indicating whether permission was granted. + */ + public static final native boolean checkSELinuxAccess(String scon, String tcon, String tclass, String perm); + + /** + * Restores a file to its default SELinux security context. + * If the system is not compiled with SELinux, then {@code true} + * is automatically returned. + * If SELinux is compiled in, but disabled, then {@code true} is + * returned. + * + * @param pathname The pathname of the file to be relabeled. + * @return a boolean indicating whether the relabeling succeeded. + * @exception NullPointerException if the pathname is a null object. + */ + public static boolean restorecon(String pathname) throws NullPointerException { + if (pathname == null) { throw new NullPointerException(); } + return native_restorecon(pathname); + } + + /** + * Restores a file to its default SELinux security context. + * If the system is not compiled with SELinux, then {@code true} + * is automatically returned. + * If SELinux is compiled in, but disabled, then {@code true} is + * returned. + * + * @param pathname The pathname of the file to be relabeled. + * @return a boolean indicating whether the relabeling succeeded. + */ + private static native boolean native_restorecon(String pathname); + + /** + * Restores a file to its default SELinux security context. + * If the system is not compiled with SELinux, then {@code true} + * is automatically returned. + * If SELinux is compiled in, but disabled, then {@code true} is + * returned. + * + * @param file The File object representing the path to be relabeled. + * @return a boolean indicating whether the relabeling succeeded. + * @exception NullPointerException if the file is a null object. + */ + public static boolean restorecon(File file) throws NullPointerException { + try { + return native_restorecon(file.getCanonicalPath()); + } catch (IOException e) { + Slog.e(TAG, "Error getting canonical path. Restorecon failed for " + + file.getPath(), e); + return false; + } + } +} diff --git a/core/java/android/os/SchedulingPolicyService.java b/core/java/android/os/SchedulingPolicyService.java index 94f907b248646..a3fede6810855 100644 --- a/core/java/android/os/SchedulingPolicyService.java +++ b/core/java/android/os/SchedulingPolicyService.java @@ -33,7 +33,7 @@ public class SchedulingPolicyService extends ISchedulingPolicyService.Stub { // Minimum and maximum values allowed for requestPriority parameter prio private static final int PRIORITY_MIN = 1; - private static final int PRIORITY_MAX = 2; + private static final int PRIORITY_MAX = 3; public SchedulingPolicyService() { } diff --git a/core/java/android/os/StatFs.java b/core/java/android/os/StatFs.java index 912bfdf4302b8..ca7fdbade808b 100644 --- a/core/java/android/os/StatFs.java +++ b/core/java/android/os/StatFs.java @@ -16,59 +16,77 @@ package android.os; +import libcore.io.ErrnoException; +import libcore.io.Libcore; +import libcore.io.StructStatFs; + /** - * Retrieve overall information about the space on a filesystem. This is a - * Wrapper for Unix statfs(). + * Retrieve overall information about the space on a filesystem. This is a + * wrapper for Unix statfs(). */ public class StatFs { + private StructStatFs mStat; + /** - * Construct a new StatFs for looking at the stats of the - * filesystem at path. Upon construction, the stat of - * the file system will be performed, and the values retrieved available - * from the methods on this class. - * - * @param path A path in the desired file system to state. + * Construct a new StatFs for looking at the stats of the filesystem at + * {@code path}. Upon construction, the stat of the file system will be + * performed, and the values retrieved available from the methods on this + * class. + * + * @param path path in the desired file system to stat. */ - public StatFs(String path) { native_setup(path); } - + public StatFs(String path) { + mStat = doStat(path); + } + + private static StructStatFs doStat(String path) { + try { + return Libcore.os.statfs(path); + } catch (ErrnoException e) { + throw new IllegalArgumentException("Invalid path: " + path, e); + } + } + /** - * Perform a restat of the file system referenced by this object. This - * is the same as re-constructing the object with the same file system - * path, and the new stat values are available upon return. + * Perform a restat of the file system referenced by this object. This is + * the same as re-constructing the object with the same file system path, + * and the new stat values are available upon return. */ - public void restat(String path) { native_restat(path); } - - @Override - protected void finalize() { native_finalize(); } + public void restat(String path) { + mStat = doStat(path); + } /** - * The size, in bytes, of a block on the file system. This corresponds - * to the Unix statfs.f_bsize field. + * The size, in bytes, of a block on the file system. This corresponds to + * the Unix {@code statfs.f_bsize} field. */ - public native int getBlockSize(); + public int getBlockSize() { + return (int) mStat.f_bsize; + } /** - * The total number of blocks on the file system. This corresponds - * to the Unix statfs.f_blocks field. + * The total number of blocks on the file system. This corresponds to the + * Unix {@code statfs.f_blocks} field. */ - public native int getBlockCount(); + public int getBlockCount() { + return (int) mStat.f_blocks; + } /** * The total number of blocks that are free on the file system, including - * reserved blocks (that are not available to normal applications). This - * corresponds to the Unix statfs.f_bfree field. Most applications will - * want to use {@link #getAvailableBlocks()} instead. + * reserved blocks (that are not available to normal applications). This + * corresponds to the Unix {@code statfs.f_bfree} field. Most applications + * will want to use {@link #getAvailableBlocks()} instead. */ - public native int getFreeBlocks(); + public int getFreeBlocks() { + return (int) mStat.f_bfree; + } /** * The number of blocks that are free on the file system and available to - * applications. This corresponds to the Unix statfs.f_bavail field. + * applications. This corresponds to the Unix {@code statfs.f_bavail} field. */ - public native int getAvailableBlocks(); - - private int mNativeContext; - private native void native_restat(String path); - private native void native_setup(String path); - private native void native_finalize(); + public int getAvailableBlocks() { + return (int) mStat.f_bavail; + } } diff --git a/core/java/android/os/StrictMode.java b/core/java/android/os/StrictMode.java index ce213fb0ef071..f682abefcab27 100644 --- a/core/java/android/os/StrictMode.java +++ b/core/java/android/os/StrictMode.java @@ -407,17 +407,17 @@ public Builder permitDiskReads() { } /** - * Enable detection of disk reads. + * Enable detection of slow calls. */ public Builder detectCustomSlowCalls() { return enable(DETECT_CUSTOM); } /** - * Enable detection of disk reads. + * Disable detection of slow calls. */ public Builder permitCustomSlowCalls() { - return enable(DETECT_CUSTOM); + return disable(DETECT_CUSTOM); } /** diff --git a/core/java/android/os/SystemClock.java b/core/java/android/os/SystemClock.java index 72917394139dc..c9adf4529f0e4 100644 --- a/core/java/android/os/SystemClock.java +++ b/core/java/android/os/SystemClock.java @@ -46,15 +46,16 @@ * such as {@link Thread#sleep(long) Thread.sleep(millls)}, * {@link Object#wait(long) Object.wait(millis)}, and * {@link System#nanoTime System.nanoTime()}. This clock is guaranteed - * to be monotonic, and is the recommended basis for the general purpose - * interval timing of user interface events, performance measurements, - * and anything else that does not need to measure elapsed time during - * device sleep. Most methods that accept a timestamp value expect the - * {@link #uptimeMillis} clock. + * to be monotonic, and is suitable for interval timing when the + * interval does not span device sleep. Most methods that accept a + * timestamp value currently expect the {@link #uptimeMillis} clock. + * + *
    • {@link #elapsedRealtime} and {@link #elapsedRealtimeNanos} + * return the time since the system was booted, and include deep sleep. + * This clock is guaranteed to be monotonic, and continues to tick even + * when the CPU is in power saving modes, so is the recommend basis + * for general purpose interval timing. * - *

    • {@link #elapsedRealtime} is counted in milliseconds since the - * system was booted, including deep sleep. This clock should be used - * when measuring time intervals that may span periods of system sleep. * * * There are several mechanisms for controlling the timing of events: @@ -150,7 +151,14 @@ public static void sleep(long ms) * @return elapsed milliseconds since boot. */ native public static long elapsedRealtime(); - + + /** + * Returns nanoseconds since boot, including time spent in sleep. + * + * @return elapsed nanoseconds since boot. + */ + public static native long elapsedRealtimeNanos(); + /** * Returns milliseconds running in the current thread. * diff --git a/core/java/android/os/SystemProperties.java b/core/java/android/os/SystemProperties.java index 156600e378ed1..a9584d05ba13d 100644 --- a/core/java/android/os/SystemProperties.java +++ b/core/java/android/os/SystemProperties.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2006 The Android Open Source Project + * This code has been modified. Portions copyright (C) 2010, T-Mobile USA, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,6 +33,8 @@ public class SystemProperties public static final int PROP_NAME_MAX = 31; public static final int PROP_VALUE_MAX = 91; + public static final boolean QCOM_HARDWARE = native_get_boolean("com.qc.hardware", false); + private static final ArrayList sChangeCallbacks = new ArrayList(); private static native String native_get(String key); @@ -153,4 +156,49 @@ static void callChangeCallbacks() { } } } + + /** + * Get the value for the given key. + * @return def string if the key isn't found + */ + public static String getLongString(String key, String def) { + if (key.length() + 1 > PROP_NAME_MAX) { + throw new IllegalArgumentException("key.length > " + PROP_NAME_MAX); + } + int chunks = getInt(key + '0', 0); + if (chunks == 0) { + return def; + } + StringBuffer sb = new StringBuffer(); + for (int i = 1; i <= chunks; i++) { + sb.append(native_get(key + Integer.toString(i))); + } + return sb.toString(); + } + + /** + * Set the value for the given key. + * @throws IllegalArgumentException if the key exceeds 32 characters + */ + public static void setLongString(String key, String val) { + if (key.length() + 1 > PROP_NAME_MAX) { + throw new IllegalArgumentException("key.length > " + PROP_NAME_MAX); + } + int chunks = 0; + if (val != null && val.length() > 0) { + chunks = 1 + val.length() / (PROP_VALUE_MAX + 1); + } + native_set(key + '0', Integer.toString(chunks)); + if (chunks > 0) { + for (int i = 1, start = 0; i <= chunks; i++) { + int end = start + PROP_VALUE_MAX; + if (end > val.length()) { + end = val.length(); + } + native_set(key + Integer.toString(i), val.substring(start, end)); + start = end; + } + } + } + } diff --git a/core/java/android/os/SystemService.java b/core/java/android/os/SystemService.java index da27db55c49a8..f34527166687d 100644 --- a/core/java/android/os/SystemService.java +++ b/core/java/android/os/SystemService.java @@ -16,15 +16,55 @@ package android.os; -/** @hide */ -public class SystemService -{ - /** Request that the init daemon start a named service. */ +import android.util.Slog; + +import com.google.android.collect.Maps; + +import java.util.HashMap; +import java.util.concurrent.TimeoutException; + +/** + * Controls and utilities for low-level {@code init} services. + * + * @hide + */ +public class SystemService { + + private static HashMap sStates = Maps.newHashMap(); + + /** + * State of a known {@code init} service. + */ + public enum State { + RUNNING("running"), + STOPPING("stopping"), + STOPPED("stopped"), + RESTARTING("restarting"); + + State(String state) { + sStates.put(state, this); + } + } + + private static Object sPropertyLock = new Object(); + + static { + SystemProperties.addChangeCallback(new Runnable() { + @Override + public void run() { + synchronized (sPropertyLock) { + sPropertyLock.notifyAll(); + } + } + }); + } + + /** Request that the init daemon start a named service. */ public static void start(String name) { SystemProperties.set("ctl.start", name); } - - /** Request that the init daemon stop a named service. */ + + /** Request that the init daemon stop a named service. */ public static void stop(String name) { SystemProperties.set("ctl.stop", name); } @@ -33,4 +73,77 @@ public static void stop(String name) { public static void restart(String name) { SystemProperties.set("ctl.restart", name); } + + /** + * Return current state of given service. + */ + public static State getState(String service) { + final String rawState = SystemProperties.get("init.svc." + service); + final State state = sStates.get(rawState); + if (state != null) { + return state; + } else { + return State.STOPPED; + } + } + + /** + * Check if given service is {@link State#STOPPED}. + */ + public static boolean isStopped(String service) { + return State.STOPPED.equals(getState(service)); + } + + /** + * Check if given service is {@link State#RUNNING}. + */ + public static boolean isRunning(String service) { + return State.RUNNING.equals(getState(service)); + } + + /** + * Wait until given service has entered specific state. + */ + public static void waitForState(String service, State state, long timeoutMillis) + throws TimeoutException { + final long endMillis = SystemClock.elapsedRealtime() + timeoutMillis; + while (true) { + synchronized (sPropertyLock) { + final State currentState = getState(service); + if (state.equals(currentState)) { + return; + } + + if (SystemClock.elapsedRealtime() >= endMillis) { + throw new TimeoutException("Service " + service + " currently " + currentState + + "; waited " + timeoutMillis + "ms for " + state); + } + + try { + sPropertyLock.wait(timeoutMillis); + } catch (InterruptedException e) { + } + } + } + } + + /** + * Wait until any of given services enters {@link State#STOPPED}. + */ + public static void waitForAnyStopped(String... services) { + while (true) { + synchronized (sPropertyLock) { + for (String service : services) { + if (State.STOPPED.equals(getState(service))) { + return; + } + } + + try { + sPropertyLock.wait(); + } catch (InterruptedException e) { + } + } + } + } } diff --git a/core/java/android/os/Trace.java b/core/java/android/os/Trace.java index d2050b76075e7..f4565947e4874 100644 --- a/core/java/android/os/Trace.java +++ b/core/java/android/os/Trace.java @@ -16,6 +16,8 @@ package android.os; +import android.util.Log; + /** * Writes trace events to the kernel trace buffer. These trace events can be * collected using the "atrace" program for offline analysis. @@ -27,6 +29,8 @@ * @hide */ public final class Trace { + private static final String TAG = "Trace"; + // These tags must be kept in sync with frameworks/native/include/utils/Trace.h. public static final long TRACE_TAG_NEVER = 0; public static final long TRACE_TAG_ALWAYS = 1L << 0; @@ -39,16 +43,21 @@ public final class Trace { public static final long TRACE_TAG_SYNC_MANAGER = 1L << 7; public static final long TRACE_TAG_AUDIO = 1L << 8; public static final long TRACE_TAG_VIDEO = 1L << 9; + public static final long TRACE_TAG_CAMERA = 1L << 10; public static final int TRACE_FLAGS_START_BIT = 1; public static final String[] TRACE_TAGS = { "Graphics", "Input", "View", "WebView", "Window Manager", - "Activity Manager", "Sync Manager", "Audio", "Video", + "Activity Manager", "Sync Manager", "Audio", "Video", "Camera", }; public static final String PROPERTY_TRACE_TAG_ENABLEFLAGS = "debug.atrace.tags.enableflags"; - private static long sEnabledTags = nativeGetEnabledTags(); + // This works as a "not ready" flag because TRACE_TAG_ALWAYS is always set. + private static final long TRACE_FLAGS_NOT_READY = 0; + + // Must be volatile to avoid word tearing. + private static volatile long sEnabledTags = TRACE_FLAGS_NOT_READY; private static native long nativeGetEnabledTags(); private static native void nativeTraceCounter(long tag, String name, int value); @@ -56,9 +65,17 @@ public final class Trace { private static native void nativeTraceEnd(long tag); static { + // We configure two separate change callbacks, one in Trace.cpp and one here. The + // native callback reads the tags from the system property, and this callback + // reads the value that the native code retrieved. It's essential that the native + // callback executes first. + // + // The system provides ordering through a priority level. Callbacks made through + // SystemProperties.addChangeCallback currently have a negative priority, while + // our native code is using a priority of zero. SystemProperties.addChangeCallback(new Runnable() { @Override public void run() { - sEnabledTags = nativeGetEnabledTags(); + cacheEnabledTags(); } }); } @@ -66,6 +83,30 @@ public final class Trace { private Trace() { } + /** + * Caches a copy of the enabled-tag bits. The "master" copy is held by the native code, + * and comes from the PROPERTY_TRACE_TAG_ENABLEFLAGS property. + *

      + * If the native code hasn't yet read the property, we will cause it to do one-time + * initialization. We don't want to do this during class init, because this class is + * preloaded, so all apps would be stuck with whatever the zygote saw. (The zygote + * doesn't see the system-property update broadcasts.) + *

      + * We want to defer initialization until the first use by an app, post-zygote. + *

      + * We're okay if multiple threads call here simultaneously -- the native state is + * synchronized, and sEnabledTags is volatile (prevents word tearing). + */ + private static long cacheEnabledTags() { + long tags = nativeGetEnabledTags(); + if (tags == TRACE_FLAGS_NOT_READY) { + //Log.w(TAG, "Unexpected value from nativeGetEnabledTags: " + tags); + // keep going + } + sEnabledTags = tags; + return tags; + } + /** * Returns true if a trace tag is enabled. * @@ -73,7 +114,11 @@ private Trace() { * @return True if the trace tag is valid. */ public static boolean isTagEnabled(long traceTag) { - return (sEnabledTags & traceTag) != 0; + long tags = sEnabledTags; + if (tags == TRACE_FLAGS_NOT_READY) { + tags = cacheEnabledTags(); + } + return (tags & traceTag) != 0; } /** @@ -84,7 +129,7 @@ public static boolean isTagEnabled(long traceTag) { * @param counterValue The counter value. */ public static void traceCounter(long traceTag, String counterName, int counterValue) { - if ((sEnabledTags & traceTag) != 0) { + if (isTagEnabled(traceTag)) { nativeTraceCounter(traceTag, counterName, counterValue); } } @@ -97,7 +142,7 @@ public static void traceCounter(long traceTag, String counterName, int counterVa * @param methodName The method name to appear in the trace. */ public static void traceBegin(long traceTag, String methodName) { - if ((sEnabledTags & traceTag) != 0) { + if (isTagEnabled(traceTag)) { nativeTraceBegin(traceTag, methodName); } } @@ -109,7 +154,7 @@ public static void traceBegin(long traceTag, String methodName) { * @param traceTag The trace tag. */ public static void traceEnd(long traceTag) { - if ((sEnabledTags & traceTag) != 0) { + if (isTagEnabled(traceTag)) { nativeTraceEnd(traceTag); } } diff --git a/core/java/android/os/UEventObserver.java b/core/java/android/os/UEventObserver.java index b924e84958544..9dbfd50744a28 100644 --- a/core/java/android/os/UEventObserver.java +++ b/core/java/android/os/UEventObserver.java @@ -16,6 +16,8 @@ package android.os; +import android.util.Log; + import java.util.ArrayList; import java.util.HashMap; @@ -37,14 +39,93 @@ * @hide */ public abstract class UEventObserver { - private static final String TAG = UEventObserver.class.getSimpleName(); + private static final String TAG = "UEventObserver"; + private static final boolean DEBUG = false; + + private static UEventThread sThread; + + private static native void nativeSetup(); + private static native String nativeWaitForNextEvent(); + private static native void nativeAddMatch(String match); + private static native void nativeRemoveMatch(String match); + + public UEventObserver() { + } + + @Override + protected void finalize() throws Throwable { + try { + stopObserving(); + } finally { + super.finalize(); + } + } + + private static UEventThread getThread() { + synchronized (UEventObserver.class) { + if (sThread == null) { + sThread = new UEventThread(); + sThread.start(); + } + return sThread; + } + } + + private static UEventThread peekThread() { + synchronized (UEventObserver.class) { + return sThread; + } + } + + /** + * Begin observation of UEvent's.

      + * This method will cause the UEvent thread to start if this is the first + * invocation of startObserving in this process.

      + * Once called, the UEvent thread will call onUEvent() when an incoming + * UEvent matches the specified string.

      + * This method can be called multiple times to register multiple matches. + * Only one call to stopObserving is required even with multiple registered + * matches. + * + * @param match A substring of the UEvent to match. Try to be as specific + * as possible to avoid incurring unintended additional cost from processing + * irrelevant messages. Netlink messages can be moderately high bandwidth and + * are expensive to parse. For example, some devices may send one netlink message + * for each vsync period. + */ + public final void startObserving(String match) { + if (match == null || match.isEmpty()) { + throw new IllegalArgumentException("match substring must be non-empty"); + } + + final UEventThread t = getThread(); + t.addObserver(match, this); + } + + /** + * End observation of UEvent's.

      + * This process's UEvent thread will never call onUEvent() on this + * UEventObserver after this call. Repeated calls have no effect. + */ + public final void stopObserving() { + final UEventThread t = getThread(); + if (t != null) { + t.removeObserver(this); + } + } + + /** + * Subclasses of UEventObserver should override this method to handle + * UEvents. + */ + public abstract void onUEvent(UEvent event); /** * Representation of a UEvent. */ - static public class UEvent { + public static final class UEvent { // collection of key=value pairs parsed from the uevent message - public HashMap mMap = new HashMap(); + private final HashMap mMap = new HashMap(); public UEvent(String message) { int offset = 0; @@ -52,7 +133,7 @@ public UEvent(String message) { while (offset < length) { int equals = message.indexOf('=', offset); - int at = message.indexOf(0, offset); + int at = message.indexOf('\0', offset); if (at < 0) break; if (equals > offset && equals < at) { @@ -79,113 +160,80 @@ public String toString() { } } - private static UEventThread sThread; - private static boolean sThreadStarted = false; - - private static class UEventThread extends Thread { + private static final class UEventThread extends Thread { /** Many to many mapping of string match to observer. * Multimap would be better, but not available in android, so use * an ArrayList where even elements are the String match and odd * elements the corresponding UEventObserver observer */ - private ArrayList mObservers = new ArrayList(); - - UEventThread() { + private final ArrayList mKeysAndObservers = new ArrayList(); + + private final ArrayList mTempObserversToSignal = + new ArrayList(); + + public UEventThread() { super("UEventObserver"); } - + + @Override public void run() { - native_setup(); + nativeSetup(); - byte[] buffer = new byte[1024]; - int len; while (true) { - len = next_event(buffer); - if (len > 0) { - String bufferStr = new String(buffer, 0, len); // easier to search a String - synchronized (mObservers) { - for (int i = 0; i < mObservers.size(); i += 2) { - if (bufferStr.indexOf((String)mObservers.get(i)) != -1) { - ((UEventObserver)mObservers.get(i+1)) - .onUEvent(new UEvent(bufferStr)); - } - } + String message = nativeWaitForNextEvent(); + if (message != null) { + if (DEBUG) { + Log.d(TAG, message); } + sendEvent(message); } } } + + private void sendEvent(String message) { + synchronized (mKeysAndObservers) { + final int N = mKeysAndObservers.size(); + for (int i = 0; i < N; i += 2) { + final String key = (String)mKeysAndObservers.get(i); + if (message.contains(key)) { + final UEventObserver observer = + (UEventObserver)mKeysAndObservers.get(i + 1); + mTempObserversToSignal.add(observer); + } + } + } + + if (!mTempObserversToSignal.isEmpty()) { + final UEvent event = new UEvent(message); + final int N = mTempObserversToSignal.size(); + for (int i = 0; i < N; i++) { + final UEventObserver observer = mTempObserversToSignal.get(i); + observer.onUEvent(event); + } + mTempObserversToSignal.clear(); + } + } + public void addObserver(String match, UEventObserver observer) { - synchronized(mObservers) { - mObservers.add(match); - mObservers.add(observer); + synchronized (mKeysAndObservers) { + mKeysAndObservers.add(match); + mKeysAndObservers.add(observer); + nativeAddMatch(match); } } + /** Removes every key/value pair where value=observer from mObservers */ public void removeObserver(UEventObserver observer) { - synchronized(mObservers) { - boolean found = true; - while (found) { - found = false; - for (int i = 0; i < mObservers.size(); i += 2) { - if (mObservers.get(i+1) == observer) { - mObservers.remove(i+1); - mObservers.remove(i); - found = true; - break; - } + synchronized (mKeysAndObservers) { + for (int i = 0; i < mKeysAndObservers.size(); ) { + if (mKeysAndObservers.get(i + 1) == observer) { + mKeysAndObservers.remove(i + 1); + final String match = (String)mKeysAndObservers.remove(i); + nativeRemoveMatch(match); + } else { + i += 2; } } } } } - - private static native void native_setup(); - private static native int next_event(byte[] buffer); - - private static final synchronized void ensureThreadStarted() { - if (sThreadStarted == false) { - sThread = new UEventThread(); - sThread.start(); - sThreadStarted = true; - } - } - - /** - * Begin observation of UEvent's.

      - * This method will cause the UEvent thread to start if this is the first - * invocation of startObserving in this process.

      - * Once called, the UEvent thread will call onUEvent() when an incoming - * UEvent matches the specified string.

      - * This method can be called multiple times to register multiple matches. - * Only one call to stopObserving is required even with multiple registered - * matches. - * @param match A substring of the UEvent to match. Use "" to match all - * UEvent's - */ - public final synchronized void startObserving(String match) { - ensureThreadStarted(); - sThread.addObserver(match, this); - } - - /** - * End observation of UEvent's.

      - * This process's UEvent thread will never call onUEvent() on this - * UEventObserver after this call. Repeated calls have no effect. - */ - public final synchronized void stopObserving() { - sThread.removeObserver(this); - } - - /** - * Subclasses of UEventObserver should override this method to handle - * UEvents. - */ - public abstract void onUEvent(UEvent event); - - protected void finalize() throws Throwable { - try { - stopObserving(); - } finally { - super.finalize(); - } - } } diff --git a/core/java/android/os/UserHandle.aidl b/core/java/android/os/UserHandle.aidl new file mode 100644 index 0000000000000..4892d322b2d66 --- /dev/null +++ b/core/java/android/os/UserHandle.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.os; + +parcelable UserHandle; diff --git a/core/java/android/os/UserHandle.java b/core/java/android/os/UserHandle.java new file mode 100644 index 0000000000000..cc9615260a0c6 --- /dev/null +++ b/core/java/android/os/UserHandle.java @@ -0,0 +1,260 @@ +/* + * Copyright (C) 2011 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.os; + +/** + * Representation of a user on the device. + */ +public final class UserHandle implements Parcelable { + /** + * @hide Range of uids allocated for a user. + */ + public static final int PER_USER_RANGE = 100000; + + /** @hide A user id to indicate all users on the device */ + public static final int USER_ALL = -1; + + /** @hide A user handle to indicate all users on the device */ + public static final UserHandle ALL = new UserHandle(USER_ALL); + + /** @hide A user id to indicate the currently active user */ + public static final int USER_CURRENT = -2; + + /** @hide A user handle to indicate the current user of the device */ + public static final UserHandle CURRENT = new UserHandle(USER_CURRENT); + + /** @hide A user id to indicate that we would like to send to the current + * user, but if this is calling from a user process then we will send it + * to the caller's user instead of failing wiht a security exception */ + public static final int USER_CURRENT_OR_SELF = -3; + + /** @hide A user handle to indicate that we would like to send to the current + * user, but if this is calling from a user process then we will send it + * to the caller's user instead of failing wiht a security exception */ + public static final UserHandle CURRENT_OR_SELF = new UserHandle(USER_CURRENT_OR_SELF); + + /** @hide An undefined user id */ + public static final int USER_NULL = -10000; + + /** @hide A user id constant to indicate the "owner" user of the device */ + public static final int USER_OWNER = 0; + + /** @hide A user handle to indicate the primary/owner user of the device */ + public static final UserHandle OWNER = new UserHandle(USER_OWNER); + + /** + * @hide Enable multi-user related side effects. Set this to false if + * there are problems with single user use-cases. + */ + public static final boolean MU_ENABLED = true; + + final int mHandle; + + /** + * Checks to see if the user id is the same for the two uids, i.e., they belong to the same + * user. + * @hide + */ + public static final boolean isSameUser(int uid1, int uid2) { + return getUserId(uid1) == getUserId(uid2); + } + + /** + * Checks to see if both uids are referring to the same app id, ignoring the user id part of the + * uids. + * @param uid1 uid to compare + * @param uid2 other uid to compare + * @return whether the appId is the same for both uids + * @hide + */ + public static final boolean isSameApp(int uid1, int uid2) { + return getAppId(uid1) == getAppId(uid2); + } + + /** @hide */ + public static final boolean isIsolated(int uid) { + if (uid > 0) { + final int appId = getAppId(uid); + return appId >= Process.FIRST_ISOLATED_UID && appId <= Process.LAST_ISOLATED_UID; + } else { + return false; + } + } + + /** @hide */ + public static boolean isApp(int uid) { + if (uid > 0) { + final int appId = getAppId(uid); + return appId >= Process.FIRST_APPLICATION_UID && appId <= Process.LAST_APPLICATION_UID; + } else { + return false; + } + } + + /** + * Returns the user id for a given uid. + * @hide + */ + public static final int getUserId(int uid) { + if (MU_ENABLED) { + return uid / PER_USER_RANGE; + } else { + return 0; + } + } + + /** @hide */ + public static final int getCallingUserId() { + return getUserId(Binder.getCallingUid()); + } + + /** + * Returns the uid that is composed from the userId and the appId. + * @hide + */ + public static final int getUid(int userId, int appId) { + if (MU_ENABLED) { + return userId * PER_USER_RANGE + (appId % PER_USER_RANGE); + } else { + return appId; + } + } + + /** + * Returns the app id (or base uid) for a given uid, stripping out the user id from it. + * @hide + */ + public static final int getAppId(int uid) { + return uid % PER_USER_RANGE; + } + + /** + * Returns the shared app gid for a given uid or appId. + * @hide + */ + public static final int getSharedAppGid(int id) { + return Process.FIRST_SHARED_APPLICATION_GID + (id % PER_USER_RANGE) + - Process.FIRST_APPLICATION_UID; + } + + /** + * Returns the user id of the current process + * @return user id of the current process + * @hide + */ + public static final int myUserId() { + return getUserId(Process.myUid()); + } + + /** @hide */ + public UserHandle(int h) { + mHandle = h; + } + + /** @hide */ + public int getIdentifier() { + return mHandle; + } + + @Override + public String toString() { + return "UserHandle{" + mHandle + "}"; + } + + @Override + public boolean equals(Object obj) { + try { + if (obj != null) { + UserHandle other = (UserHandle)obj; + return mHandle == other.mHandle; + } + } catch (ClassCastException e) { + } + return false; + } + + @Override + public int hashCode() { + return mHandle; + } + + public int describeContents() { + return 0; + } + + public void writeToParcel(Parcel out, int flags) { + out.writeInt(mHandle); + } + + /** + * Write a UserHandle to a Parcel, handling null pointers. Must be + * read with {@link #readFromParcel(Parcel)}. + * + * @param h The UserHandle to be written. + * @param out The Parcel in which the UserHandle will be placed. + * + * @see #readFromParcel(Parcel) + */ + public static void writeToParcel(UserHandle h, Parcel out) { + if (h != null) { + h.writeToParcel(out, 0); + } else { + out.writeInt(USER_NULL); + } + } + + /** + * Read a UserHandle from a Parcel that was previously written + * with {@link #writeToParcel(UserHandle, Parcel)}, returning either + * a null or new object as appropriate. + * + * @param in The Parcel from which to read the UserHandle + * @return Returns a new UserHandle matching the previously written + * object, or null if a null had been written. + * + * @see #writeToParcel(UserHandle, Parcel) + */ + public static UserHandle readFromParcel(Parcel in) { + int h = in.readInt(); + return h != USER_NULL ? new UserHandle(h) : null; + } + + public static final Parcelable.Creator CREATOR + = new Parcelable.Creator() { + public UserHandle createFromParcel(Parcel in) { + return new UserHandle(in); + } + + public UserHandle[] newArray(int size) { + return new UserHandle[size]; + } + }; + + /** + * Instantiate a new UserHandle from the data in a Parcel that was + * previously written with {@link #writeToParcel(Parcel, int)}. Note that you + * must not use this with data written by + * {@link #writeToParcel(UserHandle, Parcel)} since it is not possible + * to handle a null UserHandle here. + * + * @param in The Parcel containing the previously written UserHandle, + * positioned at the location in the buffer where it was written. + */ + public UserHandle(Parcel in) { + mHandle = in.readInt(); + } +} diff --git a/core/java/android/os/UserId.java b/core/java/android/os/UserId.java deleted file mode 100644 index 8bf6c6eb534c1..0000000000000 --- a/core/java/android/os/UserId.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.os; - -/** - * @hide - */ -public final class UserId { - /** - * Range of IDs allocated for a user. - * - * @hide - */ - public static final int PER_USER_RANGE = 100000; - - public static final int USER_ALL = -1; - - /** - * Enable multi-user related side effects. Set this to false if there are problems with single - * user usecases. - * */ - public static final boolean MU_ENABLED = true; - - /** - * Checks to see if the user id is the same for the two uids, i.e., they belong to the same - * user. - * @hide - */ - public static final boolean isSameUser(int uid1, int uid2) { - return getUserId(uid1) == getUserId(uid2); - } - - /** - * Checks to see if both uids are referring to the same app id, ignoring the user id part of the - * uids. - * @param uid1 uid to compare - * @param uid2 other uid to compare - * @return whether the appId is the same for both uids - * @hide - */ - public static final boolean isSameApp(int uid1, int uid2) { - return getAppId(uid1) == getAppId(uid2); - } - - public static final boolean isIsolated(int uid) { - uid = getAppId(uid); - return uid >= Process.FIRST_ISOLATED_UID && uid <= Process.LAST_ISOLATED_UID; - } - - public static boolean isApp(int uid) { - if (uid > 0) { - uid = UserId.getAppId(uid); - return uid >= Process.FIRST_APPLICATION_UID && uid <= Process.LAST_APPLICATION_UID; - } else { - return false; - } - } - - /** - * Returns the user id for a given uid. - * @hide - */ - public static final int getUserId(int uid) { - if (MU_ENABLED) { - return uid / PER_USER_RANGE; - } else { - return 0; - } - } - - public static final int getCallingUserId() { - return getUserId(Binder.getCallingUid()); - } - - /** - * Returns the uid that is composed from the userId and the appId. - * @hide - */ - public static final int getUid(int userId, int appId) { - if (MU_ENABLED) { - return userId * PER_USER_RANGE + (appId % PER_USER_RANGE); - } else { - return appId; - } - } - - /** - * Returns the app id (or base uid) for a given uid, stripping out the user id from it. - * @hide - */ - public static final int getAppId(int uid) { - return uid % PER_USER_RANGE; - } - - /** - * Returns the user id of the current process - * @return user id of the current process - */ - public static final int myUserId() { - return getUserId(Process.myUid()); - } -} diff --git a/core/java/android/os/UserManager.java b/core/java/android/os/UserManager.java new file mode 100644 index 0000000000000..d73f99ab67925 --- /dev/null +++ b/core/java/android/os/UserManager.java @@ -0,0 +1,371 @@ +/* + * 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.os; + +import com.android.internal.R; + +import android.app.ActivityManagerNative; +import android.content.Context; +import android.content.pm.UserInfo; +import android.graphics.Bitmap; +import android.content.res.Resources; +import android.util.Log; + +import java.util.List; + +/** + * Manages users and user details on a multi-user system. + */ +public class UserManager { + + private static String TAG = "UserManager"; + private final IUserManager mService; + private final Context mContext; + + /** @hide */ + public UserManager(Context context, IUserManager service) { + mService = service; + mContext = context; + } + + /** + * Returns whether the system supports multiple users. + * @return true if multiple users can be created, false if it is a single user device. + * @hide + */ + public static boolean supportsMultipleUsers() { + return getMaxSupportedUsers() > 1; + } + + /** + * Returns the user handle for the user that this application is running for. + * @return the user handle of the user making this call. + * @hide + * */ + public int getUserHandle() { + return UserHandle.myUserId(); + } + + /** + * Returns the user name of the user making this call. This call is only + * available to applications on the system image; it requires the + * MANAGE_USERS permission. + * @return the user name + */ + public String getUserName() { + try { + return mService.getUserInfo(getUserHandle()).name; + } catch (RemoteException re) { + Log.w(TAG, "Could not get user name", re); + return ""; + } + } + + /** + * Used to determine whether the user making this call is subject to + * teleportations. + * @return whether the user making this call is a goat + */ + public boolean isUserAGoat() { + return false; + } + + /** + * Return whether the given user is actively running. This means that + * the user is in the "started" state, not "stopped" -- it is currently + * allowed to run code through scheduled alarms, receiving broadcasts, + * etc. A started user may be either the current foreground user or a + * background user; the result here does not distinguish between the two. + * @param user The user to retrieve the running state for. + */ + public boolean isUserRunning(UserHandle user) { + try { + return ActivityManagerNative.getDefault().isUserRunning( + user.getIdentifier(), false); + } catch (RemoteException e) { + return false; + } + } + + /** + * Return whether the given user is actively running or stopping. + * This is like {@link #isUserRunning(UserHandle)}, but will also return + * true if the user had been running but is in the process of being stopped + * (but is not yet fully stopped, and still running some code). + * @param user The user to retrieve the running state for. + */ + public boolean isUserRunningOrStopping(UserHandle user) { + try { + return ActivityManagerNative.getDefault().isUserRunning( + user.getIdentifier(), true); + } catch (RemoteException e) { + return false; + } + } + + /** + * Returns the UserInfo object describing a specific user. + * Requires {@link android.Manifest.permission#MANAGE_USERS} permission. + * @param userHandle the user handle of the user whose information is being requested. + * @return the UserInfo object for a specific user. + * @hide + */ + public UserInfo getUserInfo(int userHandle) { + try { + return mService.getUserInfo(userHandle); + } catch (RemoteException re) { + Log.w(TAG, "Could not get user info", re); + return null; + } + } + + /** + * Return the serial number for a user. This is a device-unique + * number assigned to that user; if the user is deleted and then a new + * user created, the new users will not be given the same serial number. + * @param user The user whose serial number is to be retrieved. + * @return The serial number of the given user; returns -1 if the + * given UserHandle does not exist. + * @see #getUserForSerialNumber(long) + */ + public long getSerialNumberForUser(UserHandle user) { + return getUserSerialNumber(user.getIdentifier()); + } + + /** + * Return the user associated with a serial number previously + * returned by {@link #getSerialNumberForUser(UserHandle)}. + * @param serialNumber The serial number of the user that is being + * retrieved. + * @return Return the user associated with the serial number, or null + * if there is not one. + * @see #getSerialNumberForUser(UserHandle) + */ + public UserHandle getUserForSerialNumber(long serialNumber) { + int ident = getUserHandle((int)serialNumber); + return ident >= 0 ? new UserHandle(ident) : null; + } + + /** + * Creates a user with the specified name and options. + * Requires {@link android.Manifest.permission#MANAGE_USERS} permission. + * + * @param name the user's name + * @param flags flags that identify the type of user and other properties. + * @see UserInfo + * + * @return the UserInfo object for the created user, or null if the user could not be created. + * @hide + */ + public UserInfo createUser(String name, int flags) { + try { + return mService.createUser(name, flags); + } catch (RemoteException re) { + Log.w(TAG, "Could not create a user", re); + return null; + } + } + + /** + * Return the number of users currently created on the device. + */ + public int getUserCount() { + List users = getUsers(); + return users != null ? users.size() : 1; + } + + /** + * Returns information for all users on this device. + * Requires {@link android.Manifest.permission#MANAGE_USERS} permission. + * @return the list of users that were created. + * @hide + */ + public List getUsers() { + try { + return mService.getUsers(false); + } catch (RemoteException re) { + Log.w(TAG, "Could not get user list", re); + return null; + } + } + + /** + * Returns information for all users on this device. + * Requires {@link android.Manifest.permission#MANAGE_USERS} permission. + * @param excludeDying specify if the list should exclude users being removed. + * @return the list of users that were created. + * @hide + */ + public List getUsers(boolean excludeDying) { + try { + return mService.getUsers(excludeDying); + } catch (RemoteException re) { + Log.w(TAG, "Could not get user list", re); + return null; + } + } + + /** + * Removes a user and all associated data. + * Requires {@link android.Manifest.permission#MANAGE_USERS} permission. + * @param userHandle the integer handle of the user, where 0 is the primary user. + * @hide + */ + public boolean removeUser(int userHandle) { + try { + return mService.removeUser(userHandle); + } catch (RemoteException re) { + Log.w(TAG, "Could not remove user ", re); + return false; + } + } + + /** + * Updates the user's name. + * Requires {@link android.Manifest.permission#MANAGE_USERS} permission. + * + * @param userHandle the user's integer handle + * @param name the new name for the user + * @hide + */ + public void setUserName(int userHandle, String name) { + try { + mService.setUserName(userHandle, name); + } catch (RemoteException re) { + Log.w(TAG, "Could not set the user name ", re); + } + } + + /** + * Sets the user's photo. + * @param userHandle the user for whom to change the photo. + * @param icon the bitmap to set as the photo. + * @hide + */ + public void setUserIcon(int userHandle, Bitmap icon) { + try { + mService.setUserIcon(userHandle, icon); + } catch (RemoteException re) { + Log.w(TAG, "Could not set the user icon ", re); + } + } + + /** + * Returns a file descriptor for the user's photo. PNG data can be read from this file. + * @param userHandle the user whose photo we want to read. + * @return a {@link Bitmap} of the user's photo, or null if there's no photo. + * @hide + */ + public Bitmap getUserIcon(int userHandle) { + try { + return mService.getUserIcon(userHandle); + } catch (RemoteException re) { + Log.w(TAG, "Could not get the user icon ", re); + return null; + } + } + + /** + * Enable or disable the use of a guest account. If disabled, the existing guest account + * will be wiped. + * Requires {@link android.Manifest.permission#MANAGE_USERS} permission. + * @param enable whether to enable a guest account. + * @hide + */ + public void setGuestEnabled(boolean enable) { + try { + mService.setGuestEnabled(enable); + } catch (RemoteException re) { + Log.w(TAG, "Could not change guest account availability to " + enable); + } + } + + /** + * Checks if a guest user is enabled for this device. + * Requires {@link android.Manifest.permission#MANAGE_USERS} permission. + * @return whether a guest user is enabled + * @hide + */ + public boolean isGuestEnabled() { + try { + return mService.isGuestEnabled(); + } catch (RemoteException re) { + Log.w(TAG, "Could not retrieve guest enabled state"); + return false; + } + } + + /** + * Wipes all the data for a user, but doesn't remove the user. + * Requires {@link android.Manifest.permission#MANAGE_USERS} permission. + * @param userHandle + * @hide + */ + public void wipeUser(int userHandle) { + try { + mService.wipeUser(userHandle); + } catch (RemoteException re) { + Log.w(TAG, "Could not wipe user " + userHandle); + } + } + + /** + * Returns the maximum number of users that can be created on this device. A return value + * of 1 means that it is a single user device. + * @hide + * @return a value greater than or equal to 1 + */ + public static int getMaxSupportedUsers() { + // Don't allow multiple users on certain builds + if (android.os.Build.ID.startsWith("JVP")) return 1; + return SystemProperties.getInt("fw.max_users", + Resources.getSystem().getInteger(R.integer.config_multiuserMaximumUsers)); + } + + /** + * Returns a serial number on this device for a given userHandle. User handles can be recycled + * when deleting and creating users, but serial numbers are not reused until the device is wiped. + * @param userHandle + * @return a serial number associated with that user, or -1 if the userHandle is not valid. + * @hide + */ + public int getUserSerialNumber(int userHandle) { + try { + return mService.getUserSerialNumber(userHandle); + } catch (RemoteException re) { + Log.w(TAG, "Could not get serial number for user " + userHandle); + } + return -1; + } + + /** + * Returns a userHandle on this device for a given user serial number. User handles can be + * recycled when deleting and creating users, but serial numbers are not reused until the device + * is wiped. + * @param userSerialNumber + * @return the userHandle associated with that user serial number, or -1 if the serial number + * is not valid. + * @hide + */ + public int getUserHandle(int userSerialNumber) { + try { + return mService.getUserHandle(userSerialNumber); + } catch (RemoteException re) { + Log.w(TAG, "Could not get userHandle for user " + userSerialNumber); + } + return -1; + } +} diff --git a/core/java/android/os/WorkSource.java b/core/java/android/os/WorkSource.java index 287c136c63d1a..ba77df70eccf1 100644 --- a/core/java/android/os/WorkSource.java +++ b/core/java/android/os/WorkSource.java @@ -1,5 +1,9 @@ package android.os; +import com.android.internal.util.ArrayUtils; + +import java.util.Arrays; + /** * Describes the source of some work that may be done by someone else. * Currently the public representation of what a work source is is not @@ -76,6 +80,20 @@ public void clear() { 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. @@ -299,6 +317,20 @@ public void writeToParcel(Parcel dest, int flags) { dest.writeIntArray(mUids); } + @Override + public String toString() { + StringBuilder result = new StringBuilder(); + result.append("{WorkSource: uids=["); + for (int i = 0; i < mNum; i++) { + if (i != 0) { + result.append(", "); + } + result.append(mUids[i]); + } + result.append("]}"); + return result.toString(); + } + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { public WorkSource createFromParcel(Parcel in) { diff --git a/core/java/android/os/storage/IMountService.java b/core/java/android/os/storage/IMountService.java index ab64866fc30e6..fc186177ae18c 100644 --- a/core/java/android/os/storage/IMountService.java +++ b/core/java/android/os/storage/IMountService.java @@ -489,13 +489,14 @@ public void finishMediaUpdate() throws RemoteException { * IObbActionListener to inform it of the terminal state of the * call. */ - public void mountObb(String filename, String key, IObbActionListener token, int nonce) - throws RemoteException { + public void mountObb(String rawPath, String canonicalPath, String key, + IObbActionListener token, int nonce) throws RemoteException { Parcel _data = Parcel.obtain(); Parcel _reply = Parcel.obtain(); try { _data.writeInterfaceToken(DESCRIPTOR); - _data.writeString(filename); + _data.writeString(rawPath); + _data.writeString(canonicalPath); _data.writeString(key); _data.writeStrongBinder((token != null ? token.asBinder() : null)); _data.writeInt(nonce); @@ -514,13 +515,14 @@ public void mountObb(String filename, String key, IObbActionListener token, int * IObbActionListener to inform it of the terminal state of the * call. */ - public void unmountObb(String filename, boolean force, IObbActionListener token, - int nonce) throws RemoteException { + public void unmountObb( + String rawPath, boolean force, IObbActionListener token, int nonce) + throws RemoteException { Parcel _data = Parcel.obtain(); Parcel _reply = Parcel.obtain(); try { _data.writeInterfaceToken(DESCRIPTOR); - _data.writeString(filename); + _data.writeString(rawPath); _data.writeInt((force ? 1 : 0)); _data.writeStrongBinder((token != null ? token.asBinder() : null)); _data.writeInt(nonce); @@ -536,13 +538,13 @@ public void unmountObb(String filename, boolean force, IObbActionListener token, * Checks whether the specified Opaque Binary Blob (OBB) is mounted * somewhere. */ - public boolean isObbMounted(String filename) throws RemoteException { + public boolean isObbMounted(String rawPath) throws RemoteException { Parcel _data = Parcel.obtain(); Parcel _reply = Parcel.obtain(); boolean _result; try { _data.writeInterfaceToken(DESCRIPTOR); - _data.writeString(filename); + _data.writeString(rawPath); mRemote.transact(Stub.TRANSACTION_isObbMounted, _data, _reply, 0); _reply.readException(); _result = 0 != _reply.readInt(); @@ -556,13 +558,13 @@ public boolean isObbMounted(String filename) throws RemoteException { /** * Gets the path to the mounted Opaque Binary Blob (OBB). */ - public String getMountedObbPath(String filename) throws RemoteException { + public String getMountedObbPath(String rawPath) throws RemoteException { Parcel _data = Parcel.obtain(); Parcel _reply = Parcel.obtain(); String _result; try { _data.writeInterfaceToken(DESCRIPTOR); - _data.writeString(filename); + _data.writeString(rawPath); mRemote.transact(Stub.TRANSACTION_getMountedObbPath, _data, _reply, 0); _reply.readException(); _result = _reply.readString(); @@ -677,15 +679,15 @@ public int verifyEncryptionPassword(String password) throws RemoteException { return _result; } - public Parcelable[] getVolumeList() throws RemoteException { + public StorageVolume[] getVolumeList() throws RemoteException { Parcel _data = Parcel.obtain(); Parcel _reply = Parcel.obtain(); - Parcelable[] _result; + StorageVolume[] _result; try { _data.writeInterfaceToken(DESCRIPTOR); mRemote.transact(Stub.TRANSACTION_getVolumeList, _data, _reply, 0); _reply.readException(); - _result = _reply.readParcelableArray(StorageVolume.class.getClassLoader()); + _result = _reply.createTypedArray(StorageVolume.CREATOR); } finally { _reply.recycle(); _data.recycle(); @@ -1042,15 +1044,14 @@ public boolean onTransact(int code, Parcel data, Parcel reply, } case TRANSACTION_mountObb: { data.enforceInterface(DESCRIPTOR); - String filename; - filename = data.readString(); - String key; - key = data.readString(); + final String rawPath = data.readString(); + final String canonicalPath = data.readString(); + final String key = data.readString(); IObbActionListener observer; observer = IObbActionListener.Stub.asInterface(data.readStrongBinder()); int nonce; nonce = data.readInt(); - mountObb(filename, key, observer, nonce); + mountObb(rawPath, canonicalPath, key, observer, nonce); reply.writeNoException(); return true; } @@ -1119,9 +1120,9 @@ public boolean onTransact(int code, Parcel data, Parcel reply, } case TRANSACTION_getVolumeList: { data.enforceInterface(DESCRIPTOR); - Parcelable[] result = getVolumeList(); + StorageVolume[] result = getVolumeList(); reply.writeNoException(); - reply.writeParcelableArray(result, 0); + reply.writeTypedArray(result, android.os.Parcelable.PARCELABLE_WRITE_RETURN_VALUE); return true; } case TRANSACTION_getSecureContainerFilesystemPath: { @@ -1194,7 +1195,7 @@ public int createSecureContainer(String id, int sizeMb, String fstype, String ke /** * Gets the path to the mounted Opaque Binary Blob (OBB). */ - public String getMountedObbPath(String filename) throws RemoteException; + public String getMountedObbPath(String rawPath) throws RemoteException; /** * Gets an Array of currently known secure container IDs @@ -1220,7 +1221,7 @@ public int createSecureContainer(String id, int sizeMb, String fstype, String ke * Checks whether the specified Opaque Binary Blob (OBB) is mounted * somewhere. */ - public boolean isObbMounted(String filename) throws RemoteException; + public boolean isObbMounted(String rawPath) throws RemoteException; /* * Returns true if the specified container is mounted @@ -1243,8 +1244,8 @@ public int createSecureContainer(String id, int sizeMb, String fstype, String ke * MountService will call back to the supplied IObbActionListener to inform * it of the terminal state of the call. */ - public void mountObb(String filename, String key, IObbActionListener token, int nonce) - throws RemoteException; + public void mountObb(String rawPath, String canonicalPath, String key, + IObbActionListener token, int nonce) throws RemoteException; /* * Mount a secure container with the specified key and owner UID. Returns an @@ -1287,7 +1288,7 @@ public void mountObb(String filename, String key, IObbActionListener token, int * MountService will call back to the supplied IObbActionListener to inform * it of the terminal state of the call. */ - public void unmountObb(String filename, boolean force, IObbActionListener token, int nonce) + public void unmountObb(String rawPath, boolean force, IObbActionListener token, int nonce) throws RemoteException; /* @@ -1358,7 +1359,7 @@ public void unmountVolume(String mountPoint, boolean force, boolean removeEncryp /** * Returns list of all mountable volumes. */ - public Parcelable[] getVolumeList() throws RemoteException; + public StorageVolume[] getVolumeList() throws RemoteException; /** * Gets the path on the filesystem for the ASEC container itself. diff --git a/core/java/android/os/storage/StorageManager.java b/core/java/android/os/storage/StorageManager.java index cb6c1dc4cf97f..862a95cb9d139 100644 --- a/core/java/android/os/storage/StorageManager.java +++ b/core/java/android/os/storage/StorageManager.java @@ -16,6 +16,8 @@ package android.os.storage; +import android.app.NotificationManager; +import android.content.Context; import android.os.Environment; import android.os.Handler; import android.os.Looper; @@ -26,6 +28,10 @@ import android.util.Log; import android.util.SparseArray; +import com.android.internal.util.Preconditions; + +import java.io.File; +import java.io.IOException; import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.List; @@ -56,7 +62,7 @@ public class StorageManager /* * Our internal MountService binder reference */ - private IMountService mMountService; + final private IMountService mMountService; /* * The looper target for callbacks @@ -285,6 +291,11 @@ void sendStorageStateChanged(String path, String oldState, String newState) { } } + /** {@hide} */ + public static StorageManager from(Context context) { + return (StorageManager) context.getSystemService(Context.STORAGE_SERVICE); + } + /** * Constructs a StorageManager object through which an application can * can communicate with the systems mount service. @@ -304,8 +315,6 @@ public StorageManager(Looper tgtLooper) throws RemoteException { return; } mTgtLooper = tgtLooper; - mBinderListener = new MountServiceBinderListener(); - mMountService.registerListener(mBinderListener); } @@ -322,6 +331,15 @@ public void registerListener(StorageEventListener listener) { } synchronized (mListeners) { + if (mBinderListener == null ) { + try { + mBinderListener = new MountServiceBinderListener(); + mMountService.registerListener(mBinderListener); + } catch (RemoteException rex) { + Log.e(TAG, "Register mBinderListener failed"); + return; + } + } mListeners.add(new ListenerDelegate(listener)); } } @@ -347,7 +365,15 @@ public void unregisterListener(StorageEventListener listener) { break; } } - } + if (mListeners.size() == 0 && mBinderListener != null) { + try { + mMountService.unregisterListener(mBinderListener); + } catch (RemoteException rex) { + Log.e(TAG, "Unregister mBinderListener failed"); + return; + } + } + } } /** @@ -421,25 +447,23 @@ public boolean isUsbMassStorageEnabled() { * That is, shared UID applications can attempt to mount any other * application's OBB that shares its UID. * - * @param filename the path to the OBB file + * @param rawPath the path to the OBB file * @param key secret used to encrypt the OBB; may be null if no * encryption was used on the OBB. * @param listener will receive the success or failure of the operation * @return whether the mount call was successfully queued or not */ - public boolean mountObb(String filename, String key, OnObbStateChangeListener listener) { - if (filename == null) { - throw new IllegalArgumentException("filename cannot be null"); - } - - if (listener == null) { - throw new IllegalArgumentException("listener cannot be null"); - } + public boolean mountObb(String rawPath, String key, OnObbStateChangeListener listener) { + Preconditions.checkNotNull(rawPath, "rawPath cannot be null"); + Preconditions.checkNotNull(listener, "listener cannot be null"); try { + final String canonicalPath = new File(rawPath).getCanonicalPath(); final int nonce = mObbActionListener.addListener(listener); - mMountService.mountObb(filename, key, mObbActionListener, nonce); + mMountService.mountObb(rawPath, canonicalPath, key, mObbActionListener, nonce); return true; + } catch (IOException e) { + throw new IllegalArgumentException("Failed to resolve path: " + rawPath, e); } catch (RemoteException e) { Log.e(TAG, "Failed to mount OBB", e); } @@ -461,24 +485,19 @@ public boolean mountObb(String filename, String key, OnObbStateChangeListener li * application's OBB that shares its UID. *

      * - * @param filename path to the OBB file + * @param rawPath path to the OBB file * @param force whether to kill any programs using this in order to unmount * it * @param listener will receive the success or failure of the operation * @return whether the unmount call was successfully queued or not */ - public boolean unmountObb(String filename, boolean force, OnObbStateChangeListener listener) { - if (filename == null) { - throw new IllegalArgumentException("filename cannot be null"); - } - - if (listener == null) { - throw new IllegalArgumentException("listener cannot be null"); - } + public boolean unmountObb(String rawPath, boolean force, OnObbStateChangeListener listener) { + Preconditions.checkNotNull(rawPath, "rawPath cannot be null"); + Preconditions.checkNotNull(listener, "listener cannot be null"); try { final int nonce = mObbActionListener.addListener(listener); - mMountService.unmountObb(filename, force, mObbActionListener, nonce); + mMountService.unmountObb(rawPath, force, mObbActionListener, nonce); return true; } catch (RemoteException e) { Log.e(TAG, "Failed to mount OBB", e); @@ -490,16 +509,14 @@ public boolean unmountObb(String filename, boolean force, OnObbStateChangeListen /** * Check whether an Opaque Binary Blob (OBB) is mounted or not. * - * @param filename path to OBB image + * @param rawPath path to OBB image * @return true if OBB is mounted; false if not mounted or on error */ - public boolean isObbMounted(String filename) { - if (filename == null) { - throw new IllegalArgumentException("filename cannot be null"); - } + public boolean isObbMounted(String rawPath) { + Preconditions.checkNotNull(rawPath, "rawPath cannot be null"); try { - return mMountService.isObbMounted(filename); + return mMountService.isObbMounted(rawPath); } catch (RemoteException e) { Log.e(TAG, "Failed to check if OBB is mounted", e); } @@ -512,17 +529,15 @@ public boolean isObbMounted(String filename) { * give you the path to where you can obtain access to the internals of the * OBB. * - * @param filename path to OBB image + * @param rawPath path to OBB image * @return absolute path to mounted OBB image data or null if * not mounted or exception encountered trying to read status */ - public String getMountedObbPath(String filename) { - if (filename == null) { - throw new IllegalArgumentException("filename cannot be null"); - } + public String getMountedObbPath(String rawPath) { + Preconditions.checkNotNull(rawPath, "rawPath cannot be null"); try { - return mMountService.getMountedObbPath(filename); + return mMountService.getMountedObbPath(rawPath); } catch (RemoteException e) { Log.e(TAG, "Failed to find mounted path for OBB", e); } @@ -579,4 +594,20 @@ public String[] getVolumePaths() { } return paths; } + + /** {@hide} */ + public StorageVolume getPrimaryVolume() { + return getPrimaryVolume(getVolumeList()); + } + + /** {@hide} */ + public static StorageVolume getPrimaryVolume(StorageVolume[] volumes) { + for (StorageVolume volume : volumes) { + if (volume.isPrimary()) { + return volume; + } + } + Log.w(TAG, "No primary storage defined"); + return null; + } } diff --git a/core/java/android/os/storage/StorageVolume.java b/core/java/android/os/storage/StorageVolume.java index 79c8f3bbf0126..177a9554191aa 100644 --- a/core/java/android/os/storage/StorageVolume.java +++ b/core/java/android/os/storage/StorageVolume.java @@ -19,53 +19,69 @@ import android.content.Context; import android.os.Parcel; import android.os.Parcelable; +import android.os.UserHandle; + +import java.io.File; /** - * A class representing a storage volume + * Description of a storage volume and its capabilities, including the + * filesystem path where it may be mounted. + * * @hide */ public class StorageVolume implements Parcelable { - //private static final String TAG = "StorageVolume"; + // TODO: switch to more durable token + private int mStorageId; - private final String mPath; + private final File mPath; private final int mDescriptionId; + private final boolean mPrimary; private final boolean mRemovable; private final boolean mEmulated; private final int mMtpReserveSpace; private final boolean mAllowMassStorage; - private int mStorageId; - // maximum file size for the storage, or zero for no limit + /** Maximum file size for the storage, or zero for no limit */ private final long mMaxFileSize; + /** When set, indicates exclusive ownership of this volume */ + private final UserHandle mOwner; // StorageVolume extra for ACTION_MEDIA_REMOVED, ACTION_MEDIA_UNMOUNTED, ACTION_MEDIA_CHECKING, // ACTION_MEDIA_NOFS, ACTION_MEDIA_MOUNTED, ACTION_MEDIA_SHARED, ACTION_MEDIA_UNSHARED, // ACTION_MEDIA_BAD_REMOVAL, ACTION_MEDIA_UNMOUNTABLE and ACTION_MEDIA_EJECT broadcasts. public static final String EXTRA_STORAGE_VOLUME = "storage_volume"; - public StorageVolume(String path, int descriptionId, boolean removable, - boolean emulated, int mtpReserveSpace, boolean allowMassStorage, long maxFileSize) { + public StorageVolume(File path, int descriptionId, boolean primary, boolean removable, + boolean emulated, int mtpReserveSpace, boolean allowMassStorage, long maxFileSize, + UserHandle owner) { mPath = path; mDescriptionId = descriptionId; + mPrimary = primary; mRemovable = removable; mEmulated = emulated; mMtpReserveSpace = mtpReserveSpace; mAllowMassStorage = allowMassStorage; mMaxFileSize = maxFileSize; + mOwner = owner; } - // for parcelling only - private StorageVolume(String path, int descriptionId, boolean removable, - boolean emulated, int mtpReserveSpace, int storageId, - boolean allowMassStorage, long maxFileSize) { - mPath = path; - mDescriptionId = descriptionId; - mRemovable = removable; - mEmulated = emulated; - mMtpReserveSpace = mtpReserveSpace; - mAllowMassStorage = allowMassStorage; - mStorageId = storageId; - mMaxFileSize = maxFileSize; + private StorageVolume(Parcel in) { + mStorageId = in.readInt(); + mPath = new File(in.readString()); + mDescriptionId = in.readInt(); + mPrimary = in.readInt() != 0; + mRemovable = in.readInt() != 0; + mEmulated = in.readInt() != 0; + mMtpReserveSpace = in.readInt(); + mAllowMassStorage = in.readInt() != 0; + mMaxFileSize = in.readLong(); + mOwner = in.readParcelable(null); + } + + public static StorageVolume fromTemplate(StorageVolume template, File path, UserHandle owner) { + return new StorageVolume(path, template.mDescriptionId, template.mPrimary, + template.mRemovable, template.mEmulated, template.mMtpReserveSpace, + template.mAllowMassStorage, template.mMaxFileSize, owner); } /** @@ -74,6 +90,10 @@ private StorageVolume(String path, int descriptionId, boolean removable, * @return the mount path */ public String getPath() { + return mPath.toString(); + } + + public File getPathFile() { return mPath; } @@ -90,6 +110,10 @@ public int getDescriptionId() { return mDescriptionId; } + public boolean isPrimary() { + return mPrimary; + } + /** * Returns true if the volume is removable. * @@ -161,6 +185,10 @@ public long getMaxFileSize() { return mMaxFileSize; } + public UserHandle getOwner() { + return mOwner; + } + @Override public boolean equals(Object obj) { if (obj instanceof StorageVolume && mPath != null) { @@ -177,45 +205,49 @@ public int hashCode() { @Override public String toString() { - return "StorageVolume [mAllowMassStorage=" + mAllowMassStorage + ", mDescriptionId=" - + mDescriptionId + ", mEmulated=" + mEmulated + ", mMaxFileSize=" + mMaxFileSize - + ", mMtpReserveSpace=" + mMtpReserveSpace + ", mPath=" + mPath + ", mRemovable=" - + mRemovable + ", mStorageId=" + mStorageId + "]"; - } - - public static final Parcelable.Creator CREATOR = - new Parcelable.Creator() { + final StringBuilder builder = new StringBuilder("StorageVolume ["); + builder.append("mStorageId=").append(mStorageId); + builder.append(" mPath=").append(mPath); + builder.append(" mDescriptionId=").append(mDescriptionId); + builder.append(" mPrimary=").append(mPrimary); + builder.append(" mRemovable=").append(mRemovable); + builder.append(" mEmulated=").append(mEmulated); + builder.append(" mMtpReserveSpace=").append(mMtpReserveSpace); + builder.append(" mAllowMassStorage=").append(mAllowMassStorage); + builder.append(" mMaxFileSize=").append(mMaxFileSize); + builder.append(" mOwner=").append(mOwner); + builder.append("]"); + return builder.toString(); + } + + public static final Creator CREATOR = new Creator() { + @Override public StorageVolume createFromParcel(Parcel in) { - String path = in.readString(); - int descriptionId = in.readInt(); - int removable = in.readInt(); - int emulated = in.readInt(); - int storageId = in.readInt(); - int mtpReserveSpace = in.readInt(); - int allowMassStorage = in.readInt(); - long maxFileSize = in.readLong(); - return new StorageVolume(path, descriptionId, - removable == 1, emulated == 1, mtpReserveSpace, - storageId, allowMassStorage == 1, maxFileSize); + return new StorageVolume(in); } + @Override public StorageVolume[] newArray(int size) { return new StorageVolume[size]; } }; + @Override public int describeContents() { return 0; } + @Override public void writeToParcel(Parcel parcel, int flags) { - parcel.writeString(mPath); + parcel.writeInt(mStorageId); + parcel.writeString(mPath.toString()); parcel.writeInt(mDescriptionId); + parcel.writeInt(mPrimary ? 1 : 0); parcel.writeInt(mRemovable ? 1 : 0); parcel.writeInt(mEmulated ? 1 : 0); - parcel.writeInt(mStorageId); parcel.writeInt(mMtpReserveSpace); parcel.writeInt(mAllowMassStorage ? 1 : 0); parcel.writeLong(mMaxFileSize); + parcel.writeParcelable(mOwner, flags); } } diff --git a/core/java/android/preference/PreferenceActivity.java b/core/java/android/preference/PreferenceActivity.java index 9bfa8c078817b..09ff7bec739be 100644 --- a/core/java/android/preference/PreferenceActivity.java +++ b/core/java/android/preference/PreferenceActivity.java @@ -1083,6 +1083,12 @@ public void showBreadCrumbs(CharSequence title, CharSequence shortTitle) { } return; } + if (mSinglePane) { + mFragmentBreadCrumbs.setVisibility(View.GONE); + // Hide the breadcrumb section completely for single-pane + View bcSection = findViewById(com.android.internal.R.id.breadcrumb_section); + if (bcSection != null) bcSection.setVisibility(View.GONE); + } mFragmentBreadCrumbs.setMaxVisible(2); mFragmentBreadCrumbs.setActivity(this); } diff --git a/core/java/android/preference/TwoStatePreference.java b/core/java/android/preference/TwoStatePreference.java index d186b203a156f..c6498791997cd 100644 --- a/core/java/android/preference/TwoStatePreference.java +++ b/core/java/android/preference/TwoStatePreference.java @@ -37,6 +37,7 @@ public abstract class TwoStatePreference extends Preference { private CharSequence mSummaryOn; private CharSequence mSummaryOff; boolean mChecked; + private boolean mCheckedSet; private boolean mSendClickAccessibilityEvent; private boolean mDisableDependentsState; @@ -74,11 +75,16 @@ protected void onClick() { * @param checked The checked state. */ public void setChecked(boolean checked) { - if (mChecked != checked) { + // Always persist/notify the first time; don't assume the field's default of false. + final boolean changed = mChecked != checked; + if (changed || !mCheckedSet) { mChecked = checked; + mCheckedSet = true; persistBoolean(checked); - notifyDependencyChange(shouldDisableDependents()); - notifyChanged(); + if (changed) { + notifyDependencyChange(shouldDisableDependents()); + notifyChanged(); + } } } diff --git a/core/java/android/preference/VolumePreference.java b/core/java/android/preference/VolumePreference.java index caf55d70226ef..b7630225c1823 100644 --- a/core/java/android/preference/VolumePreference.java +++ b/core/java/android/preference/VolumePreference.java @@ -146,6 +146,11 @@ protected void onSampleStarting(SeekBarVolumizer volumizer) { } } + /** @hide */ + protected boolean onVolumeChange(SeekBarVolumizer volumizer, int value) { + return true; + } + @Override protected Parcelable onSaveInstanceState() { final Parcelable superState = super.onSaveInstanceState(); @@ -305,10 +310,14 @@ public void onProgressChanged(SeekBar seekBar, int progress, } void postSetVolume(int progress) { - // Do the volume changing separately to give responsive UI - mLastProgress = progress; - mHandler.removeCallbacks(this); - mHandler.post(this); + if (onVolumeChange(this, progress)) { + // Do the volume changing separately to give responsive UI + mLastProgress = progress; + mHandler.removeCallbacks(this); + mHandler.post(this); + } else { + mSeekBar.setProgress(mLastProgress); + } } public void onStartTrackingTouch(SeekBar seekBar) { diff --git a/core/java/android/provider/CalendarContract.java b/core/java/android/provider/CalendarContract.java index a28585cb3aa18..af6e88e99bcab 100644 --- a/core/java/android/provider/CalendarContract.java +++ b/core/java/android/provider/CalendarContract.java @@ -467,6 +467,13 @@ protected interface CalendarColumns { * */ public static final String ALLOWED_ATTENDEE_TYPES = "allowedAttendeeTypes"; + + /** + * Is this the primary calendar for this account. If this column is not explicitly set, the + * provider will return 1 if {@link Calendars#ACCOUNT_NAME} is equal to + * {@link Calendars#OWNER_ACCOUNT}. + */ + public static final String IS_PRIMARY = "isPrimary"; } /** @@ -1205,6 +1212,14 @@ protected interface EventsColumns { */ public static final String ORGANIZER = "organizer"; + /** + * Are we the organizer of this event. If this column is not explicitly set, the provider + * will return 1 if {@link #ORGANIZER} is equal to {@link Calendars#OWNER_ACCOUNT}. + * Column name. + *

      Type: STRING

      + */ + public static final String IS_ORGANIZER = "isOrganizer"; + /** * Whether the user can invite others to the event. The * GUESTS_CAN_INVITE_OTHERS is a setting that applies to an arbitrary @@ -1230,6 +1245,12 @@ protected interface EventsColumns { */ public static final String CUSTOM_APP_URI = "customAppUri"; + /** + * The UID for events added from the RFC 2445 iCalendar format. + * Column name. + *

      Type: TEXT

      + */ + public static final String UID_2445 = "uid2445"; } /** @@ -1367,7 +1388,9 @@ public Entity getEntityAndIncrementCursor(Cursor cursor) throws RemoteException DatabaseUtils.cursorIntToContentValuesIfPresent(cursor, cv, GUESTS_CAN_SEE_GUESTS); DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, CUSTOM_APP_PACKAGE); DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, CUSTOM_APP_URI); + DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, UID_2445); DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, ORGANIZER); + DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, IS_ORGANIZER); DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, _SYNC_ID); DatabaseUtils.cursorLongToContentValuesIfPresent(cursor, cv, DIRTY); DatabaseUtils.cursorLongToContentValuesIfPresent(cursor, cv, LAST_SYNCED); @@ -1571,6 +1594,7 @@ public Entity getEntityAndIncrementCursor(Cursor cursor) throws RemoteException *
    • {@link #GUESTS_CAN_SEE_GUESTS}
    • *
    • {@link #CUSTOM_APP_PACKAGE}
    • *
    • {@link #CUSTOM_APP_URI}
    • + *
    • {@link #UID_2445}
    • * * The following Events columns are writable only by a sync adapter *
        diff --git a/core/java/android/provider/CallLog.java b/core/java/android/provider/CallLog.java index 7824724c32149..5dca67ff6f989 100644 --- a/core/java/android/provider/CallLog.java +++ b/core/java/android/provider/CallLog.java @@ -17,9 +17,6 @@ package android.provider; -import com.android.internal.telephony.CallerInfo; -import com.android.internal.telephony.Connection; - import android.content.ContentResolver; import android.content.ContentValues; import android.content.Context; @@ -30,6 +27,9 @@ import android.provider.ContactsContract.DataUsageFeedback; import android.text.TextUtils; +import com.android.internal.telephony.CallerInfo; +import com.android.internal.telephony.PhoneConstants; + /** * The CallLog provider contains information about placed and received calls. */ @@ -58,6 +58,20 @@ public static class Calls implements BaseColumns { public static final Uri CONTENT_FILTER_URI = Uri.parse("content://call_log/calls/filter"); + /** + * Query parameter used to limit the number of call logs returned. + *

        + * TYPE: integer + */ + public static final String LIMIT_PARAM_KEY = "limit"; + + /** + * Query parameter used to specify the starting record to return. + *

        + * TYPE: integer + */ + public static final String OFFSET_PARAM_KEY = "offset"; + /** * An optional URI parameter which instructs the provider to allow the operation to be * applied to voicemail records as well. @@ -267,14 +281,14 @@ public static Uri addCall(CallerInfo ci, Context context, String number, // If this is a private number then set the number to Private, otherwise check // if the number field is empty and set the number to Unavailable - if (presentation == Connection.PRESENTATION_RESTRICTED) { + if (presentation == PhoneConstants.PRESENTATION_RESTRICTED) { number = CallerInfo.PRIVATE_NUMBER; if (ci != null) ci.name = ""; - } else if (presentation == Connection.PRESENTATION_PAYPHONE) { + } else if (presentation == PhoneConstants.PRESENTATION_PAYPHONE) { number = CallerInfo.PAYPHONE_NUMBER; if (ci != null) ci.name = ""; } else if (TextUtils.isEmpty(number) - || presentation == Connection.PRESENTATION_UNKNOWN) { + || presentation == PhoneConstants.PRESENTATION_UNKNOWN) { number = CallerInfo.UNKNOWN_NUMBER; if (ci != null) ci.name = ""; } diff --git a/core/java/android/provider/ContactsContract.java b/core/java/android/provider/ContactsContract.java old mode 100644 new mode 100755 index 8e123ac63f0ad..5b49ba344e257 --- a/core/java/android/provider/ContactsContract.java +++ b/core/java/android/provider/ContactsContract.java @@ -37,6 +37,7 @@ import android.net.Uri; import android.os.Bundle; import android.os.RemoteException; +import android.os.UserHandle; import android.text.TextUtils; import android.util.DisplayMetrics; import android.util.Pair; @@ -345,10 +346,10 @@ public static final class Preferences { * directory provider URIs by themselves. This level of indirection allows * Contacts Provider to implement additional system-level features and * optimizations. Access to Contacts Provider is protected by the - * READ_CONTACTS permission, but access to the directory provider is not. - * Therefore directory providers must reject requests coming from clients - * other than the Contacts Provider itself. An easy way to prevent such - * unauthorized access is to check the name of the calling package: + * READ_CONTACTS permission, but access to the directory provider is protected by + * BIND_DIRECTORY_SEARCH. This permission was introduced at the API level 17, for previous + * platform versions the provider should perform the following check to make sure the call + * is coming from the ContactsProvider: *

              * private boolean isCallerAllowed() {
              *   PackageManager pm = getContext().getPackageManager();
        @@ -7657,6 +7658,54 @@ public static final class QuickContact {
                  */
                 public static final int MODE_LARGE = 3;
         
        +        /**
        +         * Constructs the QuickContacts intent with a view's rect.
        +         * @hide
        +         */
        +        public static Intent composeQuickContactsIntent(Context context, View target, Uri lookupUri,
        +                int mode, String[] excludeMimes) {
        +            // Find location and bounds of target view, adjusting based on the
        +            // assumed local density.
        +            final float appScale = context.getResources().getCompatibilityInfo().applicationScale;
        +            final int[] pos = new int[2];
        +            target.getLocationOnScreen(pos);
        +
        +            final Rect rect = new Rect();
        +            rect.left = (int) (pos[0] * appScale + 0.5f);
        +            rect.top = (int) (pos[1] * appScale + 0.5f);
        +            rect.right = (int) ((pos[0] + target.getWidth()) * appScale + 0.5f);
        +            rect.bottom = (int) ((pos[1] + target.getHeight()) * appScale + 0.5f);
        +
        +            return composeQuickContactsIntent(context, rect, lookupUri, mode, excludeMimes);
        +        }
        +
        +        /**
        +         * Constructs the QuickContacts intent.
        +         * @hide
        +         */
        +        public static Intent composeQuickContactsIntent(Context context, Rect target,
        +                Uri lookupUri, int mode, String[] excludeMimes) {
        +            // When launching from an Activiy, we don't want to start a new task, but otherwise
        +            // we *must* start a new task.  (Otherwise startActivity() would crash.)
        +            Context actualContext = context;
        +            while ((actualContext instanceof ContextWrapper)
        +                    && !(actualContext instanceof Activity)) {
        +                actualContext = ((ContextWrapper) actualContext).getBaseContext();
        +            }
        +            final int intentFlags = (actualContext instanceof Activity)
        +                    ? Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET
        +                    : Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK;
        +
        +            // Launch pivot dialog through intent for now
        +            final Intent intent = new Intent(ACTION_QUICK_CONTACT).addFlags(intentFlags);
        +
        +            intent.setData(lookupUri);
        +            intent.setSourceBounds(target);
        +            intent.putExtra(EXTRA_MODE, mode);
        +            intent.putExtra(EXTRA_EXCLUDE_MIMES, excludeMimes);
        +            return intent;
        +        }
        +
                 /**
                  * Trigger a dialog that lists the various methods of interacting with
                  * the requested {@link Contacts} entry. This may be based on available
        @@ -7682,20 +7731,10 @@ public static final class QuickContact {
                  */
                 public static void showQuickContact(Context context, View target, Uri lookupUri, int mode,
                         String[] excludeMimes) {
        -            // Find location and bounds of target view, adjusting based on the
        -            // assumed local density.
        -            final float appScale = context.getResources().getCompatibilityInfo().applicationScale;
        -            final int[] pos = new int[2];
        -            target.getLocationOnScreen(pos);
        -
        -            final Rect rect = new Rect();
        -            rect.left = (int) (pos[0] * appScale + 0.5f);
        -            rect.top = (int) (pos[1] * appScale + 0.5f);
        -            rect.right = (int) ((pos[0] + target.getWidth()) * appScale + 0.5f);
        -            rect.bottom = (int) ((pos[1] + target.getHeight()) * appScale + 0.5f);
        -
                     // Trigger with obtained rectangle
        -            showQuickContact(context, rect, lookupUri, mode, excludeMimes);
        +            Intent intent = composeQuickContactsIntent(context, target, lookupUri, mode,
        +                    excludeMimes);
        +            context.startActivity(intent);
                 }
         
                 /**
        @@ -7726,24 +7765,8 @@ public static void showQuickContact(Context context, View target, Uri lookupUri,
                  */
                 public static void showQuickContact(Context context, Rect target, Uri lookupUri, int mode,
                         String[] excludeMimes) {
        -            // When launching from an Activiy, we don't want to start a new task, but otherwise
        -            // we *must* start a new task.  (Otherwise startActivity() would crash.)
        -            Context actualContext = context;
        -            while ((actualContext instanceof ContextWrapper)
        -                    && !(actualContext instanceof Activity)) {
        -                actualContext = ((ContextWrapper) actualContext).getBaseContext();
        -            }
        -            final int intentFlags = (actualContext instanceof Activity)
        -                    ? Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET
        -                    : Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK;
        -
        -            // Launch pivot dialog through intent for now
        -            final Intent intent = new Intent(ACTION_QUICK_CONTACT).addFlags(intentFlags);
        -
        -            intent.setData(lookupUri);
        -            intent.setSourceBounds(target);
        -            intent.putExtra(EXTRA_MODE, mode);
        -            intent.putExtra(EXTRA_EXCLUDE_MIMES, excludeMimes);
        +            Intent intent = composeQuickContactsIntent(context, target, lookupUri, mode,
        +                    excludeMimes);
                     context.startActivity(intent);
                 }
             }
        @@ -7899,6 +7922,16 @@ public static final class Intents {
                 public static final String ACTION_GET_MULTIPLE_PHONES =
                         "com.android.contacts.action.GET_MULTIPLE_PHONES";
         
        +        /**
        +         * A broadcast action which is sent when any change has been made to the profile, such
        +         * as the profile name or the picture.  A receiver must have
        +         * the android.permission.READ_PROFILE permission.
        +         *
        +         * @hide
        +         */
        +        public static final String ACTION_PROFILE_CHANGED =
        +                "android.provider.Contacts.PROFILE_CHANGED";
        +
                 /**
                  * Used with {@link #SHOW_OR_CREATE_CONTACT} to force creating a new
                  * contact if no matching contact found. Otherwise, default behavior is
        @@ -8362,7 +8395,7 @@ public static String snippetize(String content, String displayName, String query
                         // Line contains the query string - now search for it at the start of tokens.
                         List lineTokens = new ArrayList();
                         List tokenOffsets = new ArrayList();
        -                split(contentLine.trim(), lineTokens, tokenOffsets);
        +                split(contentLine, lineTokens, tokenOffsets);
         
                         // As we find matches against the query, we'll populate this list with the marked
                         // (or unchanged) tokens.
        diff --git a/core/java/android/provider/MediaStore.java b/core/java/android/provider/MediaStore.java
        index 79d014410e954..0e7ab525bc910 100644
        --- a/core/java/android/provider/MediaStore.java
        +++ b/core/java/android/provider/MediaStore.java
        @@ -120,7 +120,39 @@ public final class MediaStore {
              */
             public static final String INTENT_ACTION_MEDIA_PLAY_FROM_SEARCH =
                     "android.media.action.MEDIA_PLAY_FROM_SEARCH";
        -    
        +
        +    /**
        +     * An intent to perform a search for readable media and automatically play content from the
        +     * result when possible. This can be fired, for example, by the result of a voice recognition
        +     * command to read a book or magazine.
        +     * 

        + * Contains the {@link android.app.SearchManager#QUERY} extra, which is a string that can + * contain any type of unstructured text search, like the name of a book or magazine, an author + * a genre, a publisher, or any combination of these. + *

        + * Because this intent includes an open-ended unstructured search string, it makes the most + * sense for apps that can support large-scale search of text media, such as services connected + * to an online database of books and/or magazines which can be read on the device. + */ + public static final String INTENT_ACTION_TEXT_OPEN_FROM_SEARCH = + "android.media.action.TEXT_OPEN_FROM_SEARCH"; + + /** + * An intent to perform a search for video media and automatically play content from the + * result when possible. This can be fired, for example, by the result of a voice recognition + * command to play movies. + *

        + * Contains the {@link android.app.SearchManager#QUERY} extra, which is a string that can + * contain any type of unstructured video search, like the name of a movie, one or more actors, + * a genre, or any combination of these. + *

        + * Because this intent includes an open-ended unstructured search string, it makes the most + * sense for apps that can support large-scale search of video, such as services connected to an + * online database of videos which can be streamed and played on the device. + */ + public static final String INTENT_ACTION_VIDEO_PLAY_FROM_SEARCH = + "android.media.action.VIDEO_PLAY_FROM_SEARCH"; + /** * The name of the Intent-extra used to define the artist */ @@ -172,6 +204,21 @@ public final class MediaStore { */ public static final String INTENT_ACTION_STILL_IMAGE_CAMERA = "android.media.action.STILL_IMAGE_CAMERA"; + /** + * The name of the Intent action used to launch a camera in still image mode + * for use when the device is secured (e.g. with a pin, password, pattern, + * or face unlock). Applications responding to this intent must not expose + * any personal content like existing photos or videos on the device. The + * applications should be careful not to share any photo or video with other + * applications or internet. The activity should use {@link + * android.view.WindowManager.LayoutParams#FLAG_SHOW_WHEN_LOCKED} to display + * on top of the lock screen while secured. There is no activity stack when + * this flag is used, so launching more than one activity is strongly + * discouraged. + */ + public static final String INTENT_ACTION_STILL_IMAGE_CAMERA_SECURE = + "android.media.action.STILL_IMAGE_CAMERA_SECURE"; + /** * The name of the Intent action used to launch a camera in video mode. */ @@ -190,6 +237,28 @@ public final class MediaStore { */ public final static String ACTION_IMAGE_CAPTURE = "android.media.action.IMAGE_CAPTURE"; + /** + * Intent action that can be sent to have the camera application capture an image and return + * it when the device is secured (e.g. with a pin, password, pattern, or face unlock). + * Applications responding to this intent must not expose any personal content like existing + * photos or videos on the device. The applications should be careful not to share any photo + * or video with other applications or internet. The activity should use {@link + * android.view.WindowManager.LayoutParams#FLAG_SHOW_WHEN_LOCKED} to display on top of the + * lock screen while secured. There is no activity stack when this flag is used, so + * launching more than one activity is strongly discouraged. + *

        + * The caller may pass an extra EXTRA_OUTPUT to control where this image will be written. + * If the EXTRA_OUTPUT is not present, then a small sized image is returned as a Bitmap + * object in the extra field. This is useful for applications that only need a small image. + * If the EXTRA_OUTPUT is present, then the full-sized image will be written to the Uri + * value of EXTRA_OUTPUT. + * + * @see #ACTION_IMAGE_CAPTURE + * @see #EXTRA_OUTPUT + */ + public static final String ACTION_IMAGE_CAPTURE_SECURE = + "android.media.action.IMAGE_CAPTURE_SECURE"; + /** * Standard Intent action that can be sent to have the camera application * capture a video and return it. diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 74c0a97ab8b60..7d4756c3430eb 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -19,6 +19,7 @@ import android.annotation.SdkConstant; import android.annotation.SdkConstant.SdkConstantType; import android.app.SearchManager; +import android.app.WallpaperManager; import android.content.ComponentName; import android.content.ContentResolver; import android.content.ContentValues; @@ -32,16 +33,19 @@ import android.content.res.Resources; import android.database.Cursor; import android.database.SQLException; +import android.net.ConnectivityManager; import android.net.Uri; import android.net.wifi.WifiManager; import android.os.BatteryManager; import android.os.Bundle; +import android.os.DropBoxManager; import android.os.IBinder; import android.os.Process; import android.os.RemoteException; import android.os.ServiceManager; import android.os.SystemProperties; -import android.os.UserId; +import android.os.UserHandle; +import android.os.Build.VERSION_CODES; import android.speech.tts.TextToSpeech; import android.text.TextUtils; import android.util.AndroidException; @@ -213,6 +217,21 @@ public final class Settings { public static final String ACTION_BLUETOOTH_SETTINGS = "android.settings.BLUETOOTH_SETTINGS"; + /** + * Activity Action: Show settings to allow configuration of Wifi Displays. + *

        + * In some cases, a matching Activity may not exist, so ensure you + * safeguard against this. + *

        + * Input: Nothing. + *

        + * Output: Nothing. + * @hide + */ + @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) + public static final String ACTION_WIFI_DISPLAY_SETTINGS = + "android.settings.WIFI_DISPLAY_SETTINGS"; + /** * Activity Action: Show settings to allow configuration of date and time. *

        @@ -367,10 +386,9 @@ public final class Settings { /** * Activity Action: Show settings to allow configuration of application - * development-related settings. - *

        - * In some cases, a matching Activity may not exist, so ensure you safeguard - * against this. + * development-related settings. As of + * {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} this action is + * a required part of the platform. *

        * Input: Nothing. *

        @@ -620,6 +638,25 @@ public final class Settings { */ public static final String CALL_METHOD_GET_SECURE = "GET_secure"; + /** + * @hide - Private call() method on SettingsProvider to read from 'global' table. + */ + public static final String CALL_METHOD_GET_GLOBAL = "GET_global"; + + /** + * @hide - User handle argument extra to the fast-path call()-based requests + */ + public static final String CALL_METHOD_USER_KEY = "_user"; + + /** @hide - Private call() method to write to 'system' table */ + public static final String CALL_METHOD_PUT_SYSTEM = "PUT_system"; + + /** @hide - Private call() method to write to 'secure' table */ + public static final String CALL_METHOD_PUT_SECURE = "PUT_secure"; + + /** @hide - Private call() method to write to 'global' table */ + public static final String CALL_METHOD_PUT_GLOBAL= "PUT_global"; + /** * Activity Extra: Limit available options in launched activity based on the given authority. *

        @@ -640,7 +677,7 @@ public final class Settings { public static final String AUTHORITY = "settings"; private static final String TAG = "Settings"; - private static final boolean LOCAL_LOGV = false || false; + private static final boolean LOCAL_LOGV = false; public static class SettingNotFoundException extends AndroidException { public SettingNotFoundException(String msg) { @@ -693,33 +730,18 @@ private static class NameValueCache { // The method we'll call (or null, to not use) on the provider // for the fast path of retrieving settings. - private final String mCallCommand; + private final String mCallGetCommand; + private final String mCallSetCommand; - public NameValueCache(String versionSystemProperty, Uri uri, String callCommand) { + public NameValueCache(String versionSystemProperty, Uri uri, + String getCommand, String setCommand) { mVersionSystemProperty = versionSystemProperty; mUri = uri; - mCallCommand = callCommand; + mCallGetCommand = getCommand; + mCallSetCommand = setCommand; } - public String getString(ContentResolver cr, String name) { - long newValuesVersion = SystemProperties.getLong(mVersionSystemProperty, 0); - - synchronized (this) { - if (mValuesVersion != newValuesVersion) { - if (LOCAL_LOGV) { - Log.v(TAG, "invalidate [" + mUri.getLastPathSegment() + "]: current " + - newValuesVersion + " != cached " + mValuesVersion); - } - - mValues.clear(); - mValuesVersion = newValuesVersion; - } - - if (mValues.containsKey(name)) { - return mValues.get(name); // Could be null, that's OK -- negative caching - } - } - + private IContentProvider lazyGetProvider(ContentResolver cr) { IContentProvider cp = null; synchronized (this) { cp = mContentProvider; @@ -727,18 +749,75 @@ public String getString(ContentResolver cr, String name) { cp = mContentProvider = cr.acquireProvider(mUri.getAuthority()); } } + return cp; + } + + public boolean putStringForUser(ContentResolver cr, String name, String value, + final int userHandle) { + try { + Bundle arg = new Bundle(); + arg.putString(Settings.NameValueTable.VALUE, value); + arg.putInt(CALL_METHOD_USER_KEY, userHandle); + IContentProvider cp = lazyGetProvider(cr); + cp.call(mCallSetCommand, name, arg); + } catch (RemoteException e) { + Log.w(TAG, "Can't set key " + name + " in " + mUri, e); + return false; + } + return true; + } + + public String getStringForUser(ContentResolver cr, String name, final int userHandle) { + final boolean isSelf = (userHandle == UserHandle.myUserId()); + if (isSelf) { + long newValuesVersion = SystemProperties.getLong(mVersionSystemProperty, 0); + + // Our own user's settings data uses a client-side cache + synchronized (this) { + if (mValuesVersion != newValuesVersion) { + if (LOCAL_LOGV || false) { + Log.v(TAG, "invalidate [" + mUri.getLastPathSegment() + "]: current " + + newValuesVersion + " != cached " + mValuesVersion); + } + + mValues.clear(); + mValuesVersion = newValuesVersion; + } + + if (mValues.containsKey(name)) { + return mValues.get(name); // Could be null, that's OK -- negative caching + } + } + } else { + if (LOCAL_LOGV) Log.v(TAG, "get setting for user " + userHandle + + " by user " + UserHandle.myUserId() + " so skipping cache"); + } + + IContentProvider cp = lazyGetProvider(cr); // Try the fast path first, not using query(). If this // fails (alternate Settings provider that doesn't support // this interface?) then we fall back to the query/table // interface. - if (mCallCommand != null) { + if (mCallGetCommand != null) { try { - Bundle b = cp.call(mCallCommand, name, null); + Bundle args = null; + if (!isSelf) { + args = new Bundle(); + args.putInt(CALL_METHOD_USER_KEY, userHandle); + } + Bundle b = cp.call(mCallGetCommand, name, args); if (b != null) { String value = b.getPairValue(); - synchronized (this) { - mValues.put(name, value); + // Don't update our cache for reads of other users' data + if (isSelf) { + synchronized (this) { + mValues.put(name, value); + } + } else { + if (LOCAL_LOGV) Log.i(TAG, "call-query of user " + userHandle + + " by " + UserHandle.myUserId() + + " so not updating cache"); } return value; } @@ -785,19 +864,23 @@ public String getString(ContentResolver cr, String name) { public static final class System extends NameValueTable { public static final String SYS_PROP_SETTING_VERSION = "sys.settings_system_version"; - // Populated lazily, guarded by class object: - private static NameValueCache sNameValueCache = null; + /** + * The content:// style URL for this table + */ + public static final Uri CONTENT_URI = + Uri.parse("content://" + AUTHORITY + "/system"); + + private static final NameValueCache sNameValueCache = new NameValueCache( + SYS_PROP_SETTING_VERSION, + CONTENT_URI, + CALL_METHOD_GET_SYSTEM, + CALL_METHOD_PUT_SYSTEM); private static final HashSet MOVED_TO_SECURE; static { MOVED_TO_SECURE = new HashSet(30); - MOVED_TO_SECURE.add(Secure.ADB_ENABLED); MOVED_TO_SECURE.add(Secure.ANDROID_ID); - MOVED_TO_SECURE.add(Secure.BLUETOOTH_ON); - MOVED_TO_SECURE.add(Secure.DATA_ROAMING); - MOVED_TO_SECURE.add(Secure.DEVICE_PROVISIONED); MOVED_TO_SECURE.add(Secure.HTTP_PROXY); - MOVED_TO_SECURE.add(Secure.INSTALL_NON_MARKET_APPS); MOVED_TO_SECURE.add(Secure.LOCATION_PROVIDERS_ALLOWED); MOVED_TO_SECURE.add(Secure.LOCK_BIOMETRIC_WEAK_FLAGS); MOVED_TO_SECURE.add(Secure.LOCK_PATTERN_ENABLED); @@ -808,7 +891,6 @@ public static final class System extends NameValueTable { MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_LAST_UPDATE); MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_REDIRECT_URL); MOVED_TO_SECURE.add(Secure.SETTINGS_CLASSNAME); - MOVED_TO_SECURE.add(Secure.USB_MASS_STORAGE_ENABLED); MOVED_TO_SECURE.add(Secure.USE_GOOGLE_MAIL); MOVED_TO_SECURE.add(Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON); MOVED_TO_SECURE.add(Secure.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY); @@ -827,23 +909,88 @@ public static final class System extends NameValueTable { MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_TIMEOUT_MS); } + private static final HashSet MOVED_TO_GLOBAL; + private static final HashSet MOVED_TO_SECURE_THEN_GLOBAL; + static { + MOVED_TO_GLOBAL = new HashSet(); + MOVED_TO_SECURE_THEN_GLOBAL = new HashSet(); + + // these were originally in system but migrated to secure in the past, + // so are duplicated in the Secure.* namespace + MOVED_TO_SECURE_THEN_GLOBAL.add(Global.ADB_ENABLED); + MOVED_TO_SECURE_THEN_GLOBAL.add(Global.BLUETOOTH_ON); + MOVED_TO_SECURE_THEN_GLOBAL.add(Global.DATA_ROAMING); + MOVED_TO_SECURE_THEN_GLOBAL.add(Global.DEVICE_PROVISIONED); + MOVED_TO_SECURE_THEN_GLOBAL.add(Global.INSTALL_NON_MARKET_APPS); + MOVED_TO_SECURE_THEN_GLOBAL.add(Global.USB_MASS_STORAGE_ENABLED); + MOVED_TO_SECURE_THEN_GLOBAL.add(Global.HTTP_PROXY); + + // these are moving directly from system to global + MOVED_TO_GLOBAL.add(Settings.Global.AIRPLANE_MODE_ON); + MOVED_TO_GLOBAL.add(Settings.Global.AIRPLANE_MODE_RADIOS); + MOVED_TO_GLOBAL.add(Settings.Global.AIRPLANE_MODE_TOGGLEABLE_RADIOS); + MOVED_TO_GLOBAL.add(Settings.Global.AUTO_TIME); + MOVED_TO_GLOBAL.add(Settings.Global.AUTO_TIME_ZONE); + MOVED_TO_GLOBAL.add(Settings.Global.CAR_DOCK_SOUND); + MOVED_TO_GLOBAL.add(Settings.Global.CAR_UNDOCK_SOUND); + MOVED_TO_GLOBAL.add(Settings.Global.DESK_DOCK_SOUND); + MOVED_TO_GLOBAL.add(Settings.Global.DESK_UNDOCK_SOUND); + MOVED_TO_GLOBAL.add(Settings.Global.DOCK_SOUNDS_ENABLED); + MOVED_TO_GLOBAL.add(Settings.Global.LOCK_SOUND); + MOVED_TO_GLOBAL.add(Settings.Global.UNLOCK_SOUND); + MOVED_TO_GLOBAL.add(Settings.Global.LOW_BATTERY_SOUND); + MOVED_TO_GLOBAL.add(Settings.Global.POWER_SOUNDS_ENABLED); + MOVED_TO_GLOBAL.add(Settings.Global.STAY_ON_WHILE_PLUGGED_IN); + MOVED_TO_GLOBAL.add(Settings.Global.WIFI_SLEEP_POLICY); + MOVED_TO_GLOBAL.add(Settings.Global.MODE_RINGER); + MOVED_TO_GLOBAL.add(Settings.Global.WINDOW_ANIMATION_SCALE); + MOVED_TO_GLOBAL.add(Settings.Global.TRANSITION_ANIMATION_SCALE); + MOVED_TO_GLOBAL.add(Settings.Global.ANIMATOR_DURATION_SCALE); + MOVED_TO_GLOBAL.add(Settings.Global.FANCY_IME_ANIMATIONS); + MOVED_TO_GLOBAL.add(Settings.Global.COMPATIBILITY_MODE); + MOVED_TO_GLOBAL.add(Settings.Global.EMERGENCY_TONE); + MOVED_TO_GLOBAL.add(Settings.Global.CALL_AUTO_RETRY); + MOVED_TO_GLOBAL.add(Settings.Global.DEBUG_APP); + MOVED_TO_GLOBAL.add(Settings.Global.WAIT_FOR_DEBUGGER); + MOVED_TO_GLOBAL.add(Settings.Global.SHOW_PROCESSES); + MOVED_TO_GLOBAL.add(Settings.Global.ALWAYS_FINISH_ACTIVITIES); + } + + /** @hide */ + public static void getMovedKeys(HashSet outKeySet) { + outKeySet.addAll(MOVED_TO_GLOBAL); + outKeySet.addAll(MOVED_TO_SECURE_THEN_GLOBAL); + } + + /** @hide */ + public static void getNonLegacyMovedKeys(HashSet outKeySet) { + outKeySet.addAll(MOVED_TO_GLOBAL); + } + /** * Look up a name in the database. * @param resolver to access the database with * @param name to look up in the table * @return the corresponding value, or null if not present */ - public synchronized static String getString(ContentResolver resolver, String name) { + public static String getString(ContentResolver resolver, String name) { + return getStringForUser(resolver, name, UserHandle.myUserId()); + } + + /** @hide */ + public static String getStringForUser(ContentResolver resolver, String name, + int userHandle) { if (MOVED_TO_SECURE.contains(name)) { Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System" + " to android.provider.Settings.Secure, returning read-only value."); - return Secure.getString(resolver, name); + return Secure.getStringForUser(resolver, name, userHandle); } - if (sNameValueCache == null) { - sNameValueCache = new NameValueCache(SYS_PROP_SETTING_VERSION, CONTENT_URI, - CALL_METHOD_GET_SYSTEM); + if (MOVED_TO_GLOBAL.contains(name) || MOVED_TO_SECURE_THEN_GLOBAL.contains(name)) { + Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System" + + " to android.provider.Settings.Global, returning read-only value."); + return Global.getStringForUser(resolver, name, userHandle); } - return sNameValueCache.getString(resolver, name); + return sNameValueCache.getStringForUser(resolver, name, userHandle); } /** @@ -854,12 +1001,23 @@ public synchronized static String getString(ContentResolver resolver, String nam * @return true if the value was set, false on database errors */ public static boolean putString(ContentResolver resolver, String name, String value) { + return putStringForUser(resolver, name, value, UserHandle.myUserId()); + } + + /** @hide */ + public static boolean putStringForUser(ContentResolver resolver, String name, String value, + int userHandle) { if (MOVED_TO_SECURE.contains(name)) { Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System" + " to android.provider.Settings.Secure, value is unchanged."); return false; } - return putString(resolver, CONTENT_URI, name, value); + if (MOVED_TO_GLOBAL.contains(name) || MOVED_TO_SECURE_THEN_GLOBAL.contains(name)) { + Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System" + + " to android.provider.Settings.Global, value is unchanged."); + return false; + } + return sNameValueCache.putStringForUser(resolver, name, value, userHandle); } /** @@ -874,6 +1032,11 @@ public static Uri getUriFor(String name) { + " to android.provider.Settings.Secure, returning Secure URI."); return Secure.getUriFor(Secure.CONTENT_URI, name); } + if (MOVED_TO_GLOBAL.contains(name) || MOVED_TO_SECURE_THEN_GLOBAL.contains(name)) { + Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System" + + " to android.provider.Settings.Global, returning read-only global URI."); + return Global.getUriFor(Global.CONTENT_URI, name); + } return getUriFor(CONTENT_URI, name); } @@ -892,7 +1055,12 @@ public static Uri getUriFor(String name) { * or not a valid integer. */ public static int getInt(ContentResolver cr, String name, int def) { - String v = getString(cr, name); + return getIntForUser(cr, name, def, UserHandle.myUserId()); + } + + /** @hide */ + public static int getIntForUser(ContentResolver cr, String name, int def, int userHandle) { + String v = getStringForUser(cr, name, userHandle); try { return v != null ? Integer.parseInt(v) : def; } catch (NumberFormatException e) { @@ -920,7 +1088,13 @@ public static int getInt(ContentResolver cr, String name, int def) { */ public static int getInt(ContentResolver cr, String name) throws SettingNotFoundException { - String v = getString(cr, name); + return getIntForUser(cr, name, UserHandle.myUserId()); + } + + /** @hide */ + public static int getIntForUser(ContentResolver cr, String name, int userHandle) + throws SettingNotFoundException { + String v = getStringForUser(cr, name, userHandle); try { return Integer.parseInt(v); } catch (NumberFormatException e) { @@ -942,7 +1116,13 @@ public static int getInt(ContentResolver cr, String name) * @return true if the value was set, false on database errors */ public static boolean putInt(ContentResolver cr, String name, int value) { - return putString(cr, name, Integer.toString(value)); + return putIntForUser(cr, name, value, UserHandle.myUserId()); + } + + /** @hide */ + public static boolean putIntForUser(ContentResolver cr, String name, int value, + int userHandle) { + return putStringForUser(cr, name, Integer.toString(value), userHandle); } /** @@ -960,7 +1140,13 @@ public static boolean putInt(ContentResolver cr, String name, int value) { * or not a valid {@code long}. */ public static long getLong(ContentResolver cr, String name, long def) { - String valString = getString(cr, name); + return getLongForUser(cr, name, def, UserHandle.myUserId()); + } + + /** @hide */ + public static long getLongForUser(ContentResolver cr, String name, long def, + int userHandle) { + String valString = getStringForUser(cr, name, userHandle); long value; try { value = valString != null ? Long.parseLong(valString) : def; @@ -989,7 +1175,13 @@ public static long getLong(ContentResolver cr, String name, long def) { */ public static long getLong(ContentResolver cr, String name) throws SettingNotFoundException { - String valString = getString(cr, name); + return getLongForUser(cr, name, UserHandle.myUserId()); + } + + /** @hide */ + public static long getLongForUser(ContentResolver cr, String name, int userHandle) + throws SettingNotFoundException { + String valString = getStringForUser(cr, name, userHandle); try { return Long.parseLong(valString); } catch (NumberFormatException e) { @@ -1011,7 +1203,13 @@ public static long getLong(ContentResolver cr, String name) * @return true if the value was set, false on database errors */ public static boolean putLong(ContentResolver cr, String name, long value) { - return putString(cr, name, Long.toString(value)); + return putLongForUser(cr, name, value, UserHandle.myUserId()); + } + + /** @hide */ + public static boolean putLongForUser(ContentResolver cr, String name, long value, + int userHandle) { + return putStringForUser(cr, name, Long.toString(value), userHandle); } /** @@ -1029,7 +1227,13 @@ public static boolean putLong(ContentResolver cr, String name, long value) { * or not a valid float. */ public static float getFloat(ContentResolver cr, String name, float def) { - String v = getString(cr, name); + return getFloatForUser(cr, name, def, UserHandle.myUserId()); + } + + /** @hide */ + public static float getFloatForUser(ContentResolver cr, String name, float def, + int userHandle) { + String v = getStringForUser(cr, name, userHandle); try { return v != null ? Float.parseFloat(v) : def; } catch (NumberFormatException e) { @@ -1057,7 +1261,13 @@ public static float getFloat(ContentResolver cr, String name, float def) { */ public static float getFloat(ContentResolver cr, String name) throws SettingNotFoundException { - String v = getString(cr, name); + return getFloatForUser(cr, name, UserHandle.myUserId()); + } + + /** @hide */ + public static float getFloatForUser(ContentResolver cr, String name, int userHandle) + throws SettingNotFoundException { + String v = getStringForUser(cr, name, userHandle); if (v == null) { throw new SettingNotFoundException(name); } @@ -1082,7 +1292,13 @@ public static float getFloat(ContentResolver cr, String name) * @return true if the value was set, false on database errors */ public static boolean putFloat(ContentResolver cr, String name, float value) { - return putString(cr, name, Float.toString(value)); + return putFloatForUser(cr, name, value, UserHandle.myUserId()); + } + + /** @hide */ + public static boolean putFloatForUser(ContentResolver cr, String name, float value, + int userHandle) { + return putStringForUser(cr, name, Float.toString(value), userHandle); } /** @@ -1094,8 +1310,14 @@ public static boolean putFloat(ContentResolver cr, String name, float value) { * @param outConfig Where to place the configuration settings. */ public static void getConfiguration(ContentResolver cr, Configuration outConfig) { - outConfig.fontScale = Settings.System.getFloat( - cr, FONT_SCALE, outConfig.fontScale); + getConfigurationForUser(cr, outConfig, UserHandle.myUserId()); + } + + /** @hide */ + public static void getConfigurationForUser(ContentResolver cr, Configuration outConfig, + int userHandle) { + outConfig.fontScale = Settings.System.getFloatForUser( + cr, FONT_SCALE, outConfig.fontScale, userHandle); if (outConfig.fontScale < 0) { outConfig.fontScale = 1; } @@ -1118,7 +1340,13 @@ public static void clearConfiguration(Configuration inoutConfig) { * @return true if the values were set, false on database errors */ public static boolean putConfiguration(ContentResolver cr, Configuration config) { - return Settings.System.putFloat(cr, FONT_SCALE, config.fontScale); + return putConfigurationForUser(cr, config, UserHandle.myUserId()); + } + + /** @hide */ + public static boolean putConfigurationForUser(ContentResolver cr, Configuration config, + int userHandle) { + return Settings.System.putFloatForUser(cr, FONT_SCALE, config.fontScale, userHandle); } /** @hide */ @@ -1126,31 +1354,42 @@ public static boolean hasInterestingConfigurationChanges(int changes) { return (changes&ActivityInfo.CONFIG_FONT_SCALE) != 0; } + /** @deprecated - Do not use */ + @Deprecated public static boolean getShowGTalkServiceStatus(ContentResolver cr) { - return getInt(cr, SHOW_GTALK_SERVICE_STATUS, 0) != 0; + return getShowGTalkServiceStatusForUser(cr, UserHandle.myUserId()); + } + + /** + * @hide + * @deprecated - Do not use + */ + public static boolean getShowGTalkServiceStatusForUser(ContentResolver cr, + int userHandle) { + return getIntForUser(cr, SHOW_GTALK_SERVICE_STATUS, 0, userHandle) != 0; } + /** @deprecated - Do not use */ + @Deprecated public static void setShowGTalkServiceStatus(ContentResolver cr, boolean flag) { - putInt(cr, SHOW_GTALK_SERVICE_STATUS, flag ? 1 : 0); + setShowGTalkServiceStatusForUser(cr, flag, UserHandle.myUserId()); } /** - * The content:// style URL for this table + * @hide + * @deprecated - Do not use */ - public static final Uri CONTENT_URI = - Uri.parse("content://" + AUTHORITY + "/system"); + @Deprecated + public static void setShowGTalkServiceStatusForUser(ContentResolver cr, boolean flag, + int userHandle) { + putIntForUser(cr, SHOW_GTALK_SERVICE_STATUS, flag ? 1 : 0, userHandle); + } /** - * Whether we keep the device on while the device is plugged in. - * Supported values are: - *

          - *
        • {@code 0} to never stay on while plugged in
        • - *
        • {@link BatteryManager#BATTERY_PLUGGED_AC} to stay on for AC charger
        • - *
        • {@link BatteryManager#BATTERY_PLUGGED_USB} to stay on for USB charger
        • - *
        - * These values can be OR-ed together. + * @deprecated Use {@link android.provider.Settings.Global#STAY_ON_WHILE_PLUGGED_IN} instead */ - public static final String STAY_ON_WHILE_PLUGGED_IN = "stay_on_while_plugged_in"; + @Deprecated + public static final String STAY_ON_WHILE_PLUGGED_IN = Global.STAY_ON_WHILE_PLUGGED_IN; /** * What happens when the user presses the end call button if they're not @@ -1195,122 +1434,146 @@ public static void setShowGTalkServiceStatus(ContentResolver cr, boolean flag) { public static final int ADVANCED_SETTINGS_DEFAULT = 0; /** - * Whether Airplane Mode is on. + * @deprecated Use {@link android.provider.Settings.Global#AIRPLANE_MODE_ON} instead */ - public static final String AIRPLANE_MODE_ON = "airplane_mode_on"; + @Deprecated + public static final String AIRPLANE_MODE_ON = Global.AIRPLANE_MODE_ON; /** - * Constant for use in AIRPLANE_MODE_RADIOS to specify Bluetooth radio. + * @deprecated Use {@link android.provider.Settings.Global#RADIO_BLUETOOTH} instead */ - public static final String RADIO_BLUETOOTH = "bluetooth"; + @Deprecated + public static final String RADIO_BLUETOOTH = Global.RADIO_BLUETOOTH; /** - * Constant for use in AIRPLANE_MODE_RADIOS to specify Wi-Fi radio. + * @deprecated Use {@link android.provider.Settings.Global#RADIO_WIFI} instead */ - public static final String RADIO_WIFI = "wifi"; + @Deprecated + public static final String RADIO_WIFI = Global.RADIO_WIFI; /** + * @deprecated Use {@link android.provider.Settings.Global#RADIO_WIMAX} instead * {@hide} */ - public static final String RADIO_WIMAX = "wimax"; + @Deprecated + public static final String RADIO_WIMAX = Global.RADIO_WIMAX; + /** - * Constant for use in AIRPLANE_MODE_RADIOS to specify Cellular radio. + * @deprecated Use {@link android.provider.Settings.Global#RADIO_CELL} instead */ - public static final String RADIO_CELL = "cell"; + @Deprecated + public static final String RADIO_CELL = Global.RADIO_CELL; /** - * Constant for use in AIRPLANE_MODE_RADIOS to specify NFC radio. + * @deprecated Use {@link android.provider.Settings.Global#RADIO_NFC} instead */ - public static final String RADIO_NFC = "nfc"; + @Deprecated + public static final String RADIO_NFC = Global.RADIO_NFC; /** - * A comma separated list of radios that need to be disabled when airplane mode - * is on. This overrides WIFI_ON and BLUETOOTH_ON, if Wi-Fi and bluetooth are - * included in the comma separated list. + * @deprecated Use {@link android.provider.Settings.Global#AIRPLANE_MODE_RADIOS} instead */ - public static final String AIRPLANE_MODE_RADIOS = "airplane_mode_radios"; + @Deprecated + public static final String AIRPLANE_MODE_RADIOS = Global.AIRPLANE_MODE_RADIOS; /** - * A comma separated list of radios that should to be disabled when airplane mode - * is on, but can be manually reenabled by the user. For example, if RADIO_WIFI is - * added to both AIRPLANE_MODE_RADIOS and AIRPLANE_MODE_TOGGLEABLE_RADIOS, then Wifi - * will be turned off when entering airplane mode, but the user will be able to reenable - * Wifi in the Settings app. + * @deprecated Use {@link android.provider.Settings.Global#AIRPLANE_MODE_TOGGLEABLE_RADIOS} instead * * {@hide} */ - public static final String AIRPLANE_MODE_TOGGLEABLE_RADIOS = "airplane_mode_toggleable_radios"; + @Deprecated + public static final String AIRPLANE_MODE_TOGGLEABLE_RADIOS = + Global.AIRPLANE_MODE_TOGGLEABLE_RADIOS; /** - * The policy for deciding when Wi-Fi should go to sleep (which will in - * turn switch to using the mobile data as an Internet connection). - *

        - * Set to one of {@link #WIFI_SLEEP_POLICY_DEFAULT}, - * {@link #WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED}, or - * {@link #WIFI_SLEEP_POLICY_NEVER}. + * @deprecated Use {@link android.provider.Settings.Global#WIFI_SLEEP_POLICY} instead */ - public static final String WIFI_SLEEP_POLICY = "wifi_sleep_policy"; + @Deprecated + public static final String WIFI_SLEEP_POLICY = Global.WIFI_SLEEP_POLICY; /** - * Value for {@link #WIFI_SLEEP_POLICY} to use the default Wi-Fi sleep - * policy, which is to sleep shortly after the turning off - * according to the {@link #STAY_ON_WHILE_PLUGGED_IN} setting. + * @deprecated Use {@link android.provider.Settings.Global#WIFI_SLEEP_POLICY_DEFAULT} instead */ - public static final int WIFI_SLEEP_POLICY_DEFAULT = 0; + @Deprecated + public static final int WIFI_SLEEP_POLICY_DEFAULT = Global.WIFI_SLEEP_POLICY_DEFAULT; /** - * Value for {@link #WIFI_SLEEP_POLICY} to use the default policy when - * the device is on battery, and never go to sleep when the device is - * plugged in. + * @deprecated Use {@link android.provider.Settings.Global#WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED} instead */ - public static final int WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED = 1; + @Deprecated + public static final int WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED = + Global.WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED; /** - * Value for {@link #WIFI_SLEEP_POLICY} to never go to sleep. + * @deprecated Use {@link android.provider.Settings.Global#WIFI_SLEEP_POLICY_NEVER} instead */ - public static final int WIFI_SLEEP_POLICY_NEVER = 2; + @Deprecated + public static final int WIFI_SLEEP_POLICY_NEVER = Global.WIFI_SLEEP_POLICY_NEVER; + + /** + * @deprecated Use {@link android.provider.Settings.Global#MODE_RINGER} instead + */ + @Deprecated + public static final String MODE_RINGER = Global.MODE_RINGER; - //TODO: deprecate static IP constants /** * Whether to use static IP and other static network attributes. *

        * Set to 1 for true and 0 for false. + * + * @deprecated Use {@link WifiManager} instead */ + @Deprecated public static final String WIFI_USE_STATIC_IP = "wifi_use_static_ip"; /** * The static IP address. *

        * Example: "192.168.1.51" + * + * @deprecated Use {@link WifiManager} instead */ + @Deprecated public static final String WIFI_STATIC_IP = "wifi_static_ip"; /** * If using static IP, the gateway's IP address. *

        * Example: "192.168.1.1" + * + * @deprecated Use {@link WifiManager} instead */ + @Deprecated public static final String WIFI_STATIC_GATEWAY = "wifi_static_gateway"; /** * If using static IP, the net mask. *

        * Example: "255.255.255.0" + * + * @deprecated Use {@link WifiManager} instead */ + @Deprecated public static final String WIFI_STATIC_NETMASK = "wifi_static_netmask"; /** * If using static IP, the primary DNS's IP address. *

        * Example: "192.168.1.1" + * + * @deprecated Use {@link WifiManager} instead */ + @Deprecated public static final String WIFI_STATIC_DNS1 = "wifi_static_dns1"; /** * If using static IP, the secondary DNS's IP address. *

        * Example: "192.168.1.2" + * + * @deprecated Use {@link WifiManager} instead */ + @Deprecated public static final String WIFI_STATIC_DNS2 = "wifi_static_dns2"; @@ -1370,18 +1633,26 @@ public static void setShowGTalkServiceStatus(ContentResolver cr, boolean flag) { /** * Name of an application package to be debugged. + * + * @deprecated Use {@link Global#DEBUG_APP} instead */ - public static final String DEBUG_APP = "debug_app"; + @Deprecated + public static final String DEBUG_APP = Global.DEBUG_APP; /** * If 1, when launching DEBUG_APP it will wait for the debugger before * starting user code. If 0, it will run normally. + * + * @deprecated Use {@link Global#WAIT_FOR_DEBUGGER} instead */ - public static final String WAIT_FOR_DEBUGGER = "wait_for_debugger"; + @Deprecated + public static final String WAIT_FOR_DEBUGGER = Global.WAIT_FOR_DEBUGGER; /** * Whether or not to dim the screen. 0=no 1=yes + * @deprecated This setting is no longer used. */ + @Deprecated public static final String DIM_SCREEN = "dim_screen"; /** @@ -1389,14 +1660,6 @@ public static void setShowGTalkServiceStatus(ContentResolver cr, boolean flag) { */ public static final String SCREEN_OFF_TIMEOUT = "screen_off_timeout"; - /** - * If 0, the compatibility mode is off for all applications. - * If 1, older applications run under compatibility mode. - * TODO: remove this settings before code freeze (bug/1907571) - * @hide - */ - public static final String COMPATIBILITY_MODE = "compatibility_mode"; - /** * The screen backlight brightness between 0 and 255. */ @@ -1425,33 +1688,189 @@ public static void setShowGTalkServiceStatus(ContentResolver cr, boolean flag) { public static final int SCREEN_BRIGHTNESS_MODE_AUTOMATIC = 1; /** - * Control whether the process CPU usage meter should be shown. + * Indicates that custom light sensor settings has changed. + * The value is random and changes reloads light settings. + * + * @hide */ - public static final String SHOW_PROCESSES = "show_processes"; + public static final String LIGHTS_CHANGED = "lights_changed"; /** - * If 1, the activity manager will aggressively finish activities and - * processes as soon as they are no longer needed. If 0, the normal - * extended lifetime is used. + * Whether custom light sensor levels & values are enabled. The value is + * boolean (1 or 0). + * + * @hide */ - public static final String ALWAYS_FINISH_ACTIVITIES = - "always_finish_activities"; + public static final String LIGHT_SENSOR_CUSTOM = "light_sensor_custom"; + /** + * Screen dim value to use if LIGHT_SENSOR_CUSTOM is set. The value is int. + * Default is android.os.BRIGHTNESS_DIM. + * + * @hide + */ + public static final String LIGHT_SCREEN_DIM = "light_screen_dim"; /** - * Ringer mode. This is used internally, changing this value will not - * change the ringer mode. See AudioManager. + * Custom light sensor levels. The value is a comma separated int array + * with length N. + * Example: "100,300,3000". + * + * @hide */ - public static final String MODE_RINGER = "mode_ringer"; + public static final String LIGHT_SENSOR_LEVELS = "light_sensor_levels"; /** - * Determines which streams are affected by ringer mode changes. The - * stream type's bit should be set to 1 if it should be muted when going - * into an inaudible ringer mode. + * Custom light sensor lcd values. The value is a comma separated int array + * with length N+1. + * Example: "10,50,100,255". + * + * @hide */ - public static final String MODE_RINGER_STREAMS_AFFECTED = "mode_ringer_streams_affected"; + public static final String LIGHT_SENSOR_LCD_VALUES = "light_sensor_lcd_values"; - /** + /** + * Custom light sensor lcd values. The value is a comma separated int array + * with length N+1. + * Example: "10,50,100,255". + * + * @hide + */ + public static final String LIGHT_SENSOR_BUTTON_VALUES = "light_sensor_button_values"; + + /** + * Custom light sensor lcd values. The value is a comma separated int array + * with length N+1. + * Example: "10,50,100,255". + * + * @hide + */ + public static final String LIGHT_SENSOR_KEYBOARD_VALUES = "light_sensor_keyboard_values"; + + /** + * Whether light sensor is allowed to decrease when calculating automatic + * backlight. The value is boolean (1 or 0). + * + * @hide + */ + public static final String LIGHT_DECREASE = "light_decrease"; + + /** + * Light sensor hysteresis for decreasing backlight. The value is + * int (0-99) representing % (0-0.99 as float). Example: + * + * Levels Output + * 0 - 100 50 + * 100 - 200 100 + * 200 - Inf 255 + * + * Current sensor value is 150 which gives light value 100. Hysteresis is 50. + * Current level lower bound is 100 and previous lower bound is 0. + * Sensor value must drop below 100-(100-0)*(50/100)=50 for output to become 50 + * (corresponding to the 0 - 100 level). + * @hide + */ + public static final String LIGHT_HYSTERESIS = "light_hysteresis"; + + /** + * Whether light sensor used when calculating automatic backlight should + * be filtered through an moving average filter. + * The value is boolean (1 or 0). + * + * @hide + */ + public static final String LIGHT_FILTER = "light_filter"; + + /** + * Window length of filter used when calculating automatic backlight. + * One minute means that the average sensor value last minute is used. + * The value is integer (milliseconds) + * + * @hide + */ + public static final String LIGHT_FILTER_WINDOW = "light_filter_window"; + + /** + * Reset threshold of filter used when calculating automatic backlight. + * Sudden large jumps in sensor value resets the filter. This is used + * to make the filter respond quickly to large enough changes in input + * while still filtering small changes. Example: + * + * Current filter value (average) is 100 and sensor value is changing to + * 10, 150, 100, 30, 50. The filter is continously taking the average of + * the samples. Now the user goes outside and the value jumps over 1000. + * The difference between current average and new sample is larger than + * the reset threshold and filter is reset. It begins calculating a new + * average on samples around 1000 (say, 800, 1200, 1000, 1100 etc.) + * + * The value is integer (lux) + * + * @hide + */ + public static final String LIGHT_FILTER_RESET = "light_filter_reset"; + + /** + * Sample interval of filter used when calculating automatic backlight. + * The value is integer (milliseconds) + * + * @hide + */ + public static final String LIGHT_FILTER_INTERVAL = "light_filter_interval"; + + /** + * Whether to enable the electron beam animation when turning screen on + * + * @hide */ + public static final String ELECTRON_BEAM_ANIMATION_ON = "electron_beam_animation_on"; + + /** + * Whether to enable the electron beam animation when turning screen off + * + * @hide */ + public static final String ELECTRON_BEAM_ANIMATION_OFF = "electron_beam_animation_off"; + + /** + * Control whether the process CPU usage meter should be shown. + * + * @deprecated Use {@link Global#SHOW_PROCESSES} instead + */ + @Deprecated + public static final String SHOW_PROCESSES = Global.SHOW_PROCESSES; + + /** + * If 1, the activity manager will aggressively finish activities and + * processes as soon as they are no longer needed. If 0, the normal + * extended lifetime is used. + * + * @deprecated Use {@link Global#ALWAYS_FINISH_ACTIVITIES} instead + */ + @Deprecated + public static final String ALWAYS_FINISH_ACTIVITIES = Global.ALWAYS_FINISH_ACTIVITIES; + + /** + * Volume Overlay Mode, This is behaviour of the volume overlay panel + * Defaults to 0 - which is simple + * @hide + */ + public static final String MODE_VOLUME_OVERLAY = "mode_volume_overlay"; + + /** @hide */ + public static final int VOLUME_OVERLAY_SINGLE = 0; + /** @hide */ + public static final int VOLUME_OVERLAY_EXPANDABLE = 1; + /** @hide */ + public static final int VOLUME_OVERLAY_EXPANDED = 2; + /** @hide */ + public static final int VOLUME_OVERLAY_NONE = 3; + + /** + * Determines which streams are affected by ringer mode changes. The + * stream type's bit should be set to 1 if it should be muted when going + * into an inaudible ringer mode. + */ + public static final String MODE_RINGER_STREAMS_AFFECTED = "mode_ringer_streams_affected"; + + /** * Determines which streams are affected by mute. The * stream type's bit should be set to 1 if it should be muted when a mute request * is received. @@ -1520,6 +1939,12 @@ public static void setShowGTalkServiceStatus(ContentResolver cr, boolean flag) { */ public static final String VOLUME_BLUETOOTH_SCO = "volume_bluetooth_sco"; + /** + * Whether to prevent loud volume levels when headset is first plugged in. + * @hide + */ + public static final String SAFE_HEADSET_VOLUME_RESTORE = "safe_headset_volume_restore"; + /** * Master volume (float in the range 0.0f to 1.0f). * @hide @@ -1551,6 +1976,24 @@ public static void setShowGTalkServiceStatus(ContentResolver cr, boolean flag) { public static final String NOTIFICATIONS_USE_RING_VOLUME = "notifications_use_ring_volume"; + /** + * Whether the phone ringtone should be played in an increasing manner + * @hide + */ + public static final String INCREASING_RING = "increasing_ring"; + + /** + * Minimum volume index for increasing ring volume + * @hide + */ + public static final String INCREASING_RING_MIN_VOLUME = "increasing_ring_min_vol"; + + /** + * Time (in ms) between ringtone volume increases + * @hide + */ + public static final String INCREASING_RING_INTERVAL = "increasing_ring_interval"; + /** * Whether silent mode should allow vibration feedback. This is used * internally in AudioService and the Sound settings activity to @@ -1666,20 +2109,25 @@ public static void setShowGTalkServiceStatus(ContentResolver cr, boolean flag) { /** * Name of activity to use for wallpaper on the home screen. + * + * @deprecated Use {@link WallpaperManager} instead. */ + @Deprecated public static final String WALLPAPER_ACTIVITY = "wallpaper_activity"; /** - * Value to specify if the user prefers the date, time and time zone - * to be automatically fetched from the network (NITZ). 1=yes, 0=no + * @deprecated Use {@link android.provider.Settings.Global#AUTO_TIME} + * instead */ - public static final String AUTO_TIME = "auto_time"; + @Deprecated + public static final String AUTO_TIME = Global.AUTO_TIME; /** - * Value to specify if the user prefers the time zone - * to be automatically fetched from the network (NITZ). 1=yes, 0=no + * @deprecated Use {@link android.provider.Settings.Global#AUTO_TIME_ZONE} + * instead */ - public static final String AUTO_TIME_ZONE = "auto_time_zone"; + @Deprecated + public static final String AUTO_TIME_ZONE = Global.AUTO_TIME_ZONE; /** * Display times as 12 or 24 hours @@ -1708,28 +2156,30 @@ public static void setShowGTalkServiceStatus(ContentResolver cr, boolean flag) { /** * Scaling factor for normal window animations. Setting to 0 will disable window * animations. + * + * @deprecated Use {@link Global#WINDOW_ANIMATION_SCALE} instead */ - public static final String WINDOW_ANIMATION_SCALE = "window_animation_scale"; + @Deprecated + public static final String WINDOW_ANIMATION_SCALE = Global.WINDOW_ANIMATION_SCALE; /** * Scaling factor for activity transition animations. Setting to 0 will disable window * animations. + * + * @deprecated Use {@link Global#TRANSITION_ANIMATION_SCALE} instead */ - public static final String TRANSITION_ANIMATION_SCALE = "transition_animation_scale"; + @Deprecated + public static final String TRANSITION_ANIMATION_SCALE = Global.TRANSITION_ANIMATION_SCALE; /** * Scaling factor for Animator-based animations. This affects both the start delay and * duration of all such animations. Setting to 0 will cause animations to end immediately. * The default value is 1. + * + * @deprecated Use {@link Global#ANIMATOR_DURATION_SCALE} instead */ - public static final String ANIMATOR_DURATION_SCALE = "animator_duration_scale"; - - /** - * Scaling factor for normal window animations. Setting to 0 will disable window - * animations. - * @hide - */ - public static final String FANCY_IME_ANIMATIONS = "fancy_ime_animations"; + @Deprecated + public static final String ANIMATOR_DURATION_SCALE = Global.ANIMATOR_DURATION_SCALE; /** * Control whether the accelerometer will be used to change screen @@ -1739,6 +2189,19 @@ public static void setShowGTalkServiceStatus(ContentResolver cr, boolean flag) { */ public static final String ACCELEROMETER_ROTATION = "accelerometer_rotation"; + /** + * Control the type of rotation which can be performed using the accelerometer + * if ACCELEROMETER_ROTATION is enabled. + * Value is a bitwise combination of + * 1 = 0 degrees (portrait) + * 2 = 90 degrees (left) + * 4 = 180 degrees (inverted portrait) + * 8 = 270 degrees (right) + * Setting to 0 is effectively orientation lock + * @hide + */ + public static final String ACCELEROMETER_ROTATION_ANGLES = "accelerometer_rotation_angles"; + /** * Default screen rotation when no other policy applies. * When {@link #ACCELEROMETER_ROTATION} is zero and no on-screen Activity expresses a @@ -1792,23 +2255,6 @@ public static void setShowGTalkServiceStatus(ContentResolver cr, boolean flag) { */ public static final String DTMF_TONE_TYPE_WHEN_DIALING = "dtmf_tone_type"; - /** - * CDMA only settings - * Emergency Tone 0 = Off - * 1 = Alert - * 2 = Vibrate - * @hide - */ - public static final String EMERGENCY_TONE = "emergency_tone"; - - /** - * CDMA only settings - * Whether the auto retry is enabled. The value is - * boolean (1 or 0). - * @hide - */ - public static final String CALL_AUTO_RETRY = "call_auto_retry"; - /** * Whether the hearing aid is enabled. The value is * boolean (1 or 0). @@ -1827,6 +2273,13 @@ public static void setShowGTalkServiceStatus(ContentResolver cr, boolean flag) { */ public static final String TTY_MODE = "tty_mode"; + /** + * Whether noise suppression is enabled. The value is + * boolean (1 or 0). + * @hide + */ + public static final String NOISE_SUPPRESSION = "noise_suppression"; + /** * Whether the sounds effects (key clicks, lid open ...) are enabled. The value is * boolean (1 or 0). @@ -1854,2016 +2307,2295 @@ public static void setShowGTalkServiceStatus(ContentResolver cr, boolean flag) { public static final String NOTIFICATION_LIGHT_PULSE = "notification_light_pulse"; /** - * Show pointer location on screen? - * 0 = no - * 1 = yes + * What color to use for the notification LED by default * @hide */ - public static final String POINTER_LOCATION = "pointer_location"; + public static final String NOTIFICATION_LIGHT_PULSE_DEFAULT_COLOR = "notification_light_pulse_default_color"; /** - * Show touch positions on screen? - * 0 = no - * 1 = yes + * How long to flash the notification LED by default * @hide */ - public static final String SHOW_TOUCHES = "show_touches"; + public static final String NOTIFICATION_LIGHT_PULSE_DEFAULT_LED_ON = "notification_light_pulse_default_led_on"; /** - * Log raw orientation data from {@link WindowOrientationListener} for use with the - * orientationplot.py tool. - * 0 = no - * 1 = yes + * How long to wait between flashes for the notification LED by default * @hide */ - public static final String WINDOW_ORIENTATION_LISTENER_LOG = - "window_orientation_listener_log"; + public static final String NOTIFICATION_LIGHT_PULSE_DEFAULT_LED_OFF = "notification_light_pulse_default_led_off"; /** - * Whether to play a sound for low-battery alerts. + * What color to use for the missed call notification LED * @hide */ - public static final String POWER_SOUNDS_ENABLED = "power_sounds_enabled"; + public static final String NOTIFICATION_LIGHT_PULSE_CALL_COLOR = "notification_light_pulse_call_color"; /** - * Whether to play a sound for dock events. + * How long to flash the missed call notification LED * @hide */ - public static final String DOCK_SOUNDS_ENABLED = "dock_sounds_enabled"; + public static final String NOTIFICATION_LIGHT_PULSE_CALL_LED_ON = "notification_light_pulse_call_led_on"; /** - * Whether to play sounds when the keyguard is shown and dismissed. + * How long to wait between flashes for the missed call notification LED * @hide */ - public static final String LOCKSCREEN_SOUNDS_ENABLED = "lockscreen_sounds_enabled"; + public static final String NOTIFICATION_LIGHT_PULSE_CALL_LED_OFF = "notification_light_pulse_call_led_off"; /** - * Whether the lockscreen should be completely disabled. + * What color to use for the voicemail notification LED * @hide */ - public static final String LOCKSCREEN_DISABLED = "lockscreen.disabled"; + public static final String NOTIFICATION_LIGHT_PULSE_VMAIL_COLOR = "notification_light_pulse_vmail_color"; /** - * URI for the low battery sound file. + * How long to flash the voicemail notification LED * @hide */ - public static final String LOW_BATTERY_SOUND = "low_battery_sound"; + public static final String NOTIFICATION_LIGHT_PULSE_VMAIL_LED_ON = "notification_light_pulse_vmail_led_on"; /** - * URI for the desk dock "in" event sound. + * How long to wait between flashes for the voicemail notification LED * @hide */ - public static final String DESK_DOCK_SOUND = "desk_dock_sound"; + public static final String NOTIFICATION_LIGHT_PULSE_VMAIL_LED_OFF = "notification_light_pulse_vmail_led_off"; /** - * URI for the desk dock "out" event sound. + * Whether to use the custom LED values for the notification pulse LED. * @hide */ - public static final String DESK_UNDOCK_SOUND = "desk_undock_sound"; + public static final String NOTIFICATION_LIGHT_PULSE_CUSTOM_ENABLE = "notification_light_pulse_custom_enable"; /** - * URI for the car dock "in" event sound. + * Which custom LED values to use for the notification pulse LED. * @hide */ - public static final String CAR_DOCK_SOUND = "car_dock_sound"; + public static final String NOTIFICATION_LIGHT_PULSE_CUSTOM_VALUES = "notification_light_pulse_custom_values"; /** - * URI for the car dock "out" event sound. + * Whether the battery light should be enabled (if hardware supports it) + * The value is boolean (1 or 0). * @hide */ - public static final String CAR_UNDOCK_SOUND = "car_undock_sound"; + public static final String BATTERY_LIGHT_ENABLED = "battery_light_enabled"; /** - * URI for the "device locked" (keyguard shown) sound. + * Whether the battery LED should repeatedly flash when the battery is low + * on charge. The value is boolean (1 or 0). * @hide */ - public static final String LOCK_SOUND = "lock_sound"; + public static final String BATTERY_LIGHT_PULSE = "battery_light_pulse"; /** - * URI for the "device unlocked" (keyguard dismissed) sound. + * What color to use for the battery LED while charging - low * @hide */ - public static final String UNLOCK_SOUND = "unlock_sound"; + public static final String BATTERY_LIGHT_LOW_COLOR = "battery_light_low_color"; /** - * Receive incoming SIP calls? + * What color to use for the battery LED while charging - medium + * @hide + */ + public static final String BATTERY_LIGHT_MEDIUM_COLOR = "battery_light_medium_color"; + + /** + * What color to use for the battery LED while charging - full + * @hide + */ + public static final String BATTERY_LIGHT_FULL_COLOR = "battery_light_full_color"; + + /** Sprint MWI Quirk: Show message wait indicator notifications + * @hide + */ + public static final String ENABLE_MWI_NOTIFICATION = "enable_mwi_notification"; + + /** + * Show pointer location on screen? * 0 = no * 1 = yes * @hide */ - public static final String SIP_RECEIVE_CALLS = "sip_receive_calls"; + public static final String POINTER_LOCATION = "pointer_location"; /** - * Call Preference String. - * "SIP_ALWAYS" : Always use SIP with network access - * "SIP_ADDRESS_ONLY" : Only if destination is a SIP address - * "SIP_ASK_ME_EACH_TIME" : Always ask me each time + * Show touch positions on screen? + * 0 = no + * 1 = yes * @hide */ - public static final String SIP_CALL_OPTIONS = "sip_call_options"; + public static final String SHOW_TOUCHES = "show_touches"; /** - * One of the sip call options: Always use SIP with network access. + * Log raw orientation data from {@link WindowOrientationListener} for use with the + * orientationplot.py tool. + * 0 = no + * 1 = yes * @hide */ - public static final String SIP_ALWAYS = "SIP_ALWAYS"; + public static final String WINDOW_ORIENTATION_LISTENER_LOG = + "window_orientation_listener_log"; /** - * One of the sip call options: Only if destination is a SIP address. + * @deprecated Use {@link android.provider.Settings.Global#POWER_SOUNDS_ENABLED} + * instead * @hide */ - public static final String SIP_ADDRESS_ONLY = "SIP_ADDRESS_ONLY"; + @Deprecated + public static final String POWER_SOUNDS_ENABLED = Global.POWER_SOUNDS_ENABLED; /** - * One of the sip call options: Always ask me each time. + * @deprecated Use {@link android.provider.Settings.Global#DOCK_SOUNDS_ENABLED} + * instead * @hide */ - public static final String SIP_ASK_ME_EACH_TIME = "SIP_ASK_ME_EACH_TIME"; + @Deprecated + public static final String DOCK_SOUNDS_ENABLED = Global.DOCK_SOUNDS_ENABLED; /** - * Pointer speed setting. - * This is an integer value in a range between -7 and +7, so there are 15 possible values. - * -7 = slowest - * 0 = default speed - * +7 = fastest + * Whether to play sounds when the keyguard is shown and dismissed. * @hide */ - public static final String POINTER_SPEED = "pointer_speed"; + public static final String LOCKSCREEN_SOUNDS_ENABLED = "lockscreen_sounds_enabled"; /** - * Settings to backup. This is here so that it's in the same place as the settings - * keys and easy to update. - * - * NOTE: Settings are backed up and restored in the order they appear - * in this array. If you have one setting depending on another, - * make sure that they are ordered appropriately. - * + * Whether the lockscreen should be completely disabled. * @hide */ - public static final String[] SETTINGS_TO_BACKUP = { - STAY_ON_WHILE_PLUGGED_IN, - WIFI_USE_STATIC_IP, - WIFI_STATIC_IP, - WIFI_STATIC_GATEWAY, - WIFI_STATIC_NETMASK, - WIFI_STATIC_DNS1, - WIFI_STATIC_DNS2, - BLUETOOTH_DISCOVERABILITY, - BLUETOOTH_DISCOVERABILITY_TIMEOUT, - DIM_SCREEN, - SCREEN_OFF_TIMEOUT, - SCREEN_BRIGHTNESS, - SCREEN_BRIGHTNESS_MODE, - SCREEN_AUTO_BRIGHTNESS_ADJ, - VIBRATE_INPUT_DEVICES, - MODE_RINGER, - MODE_RINGER_STREAMS_AFFECTED, - MUTE_STREAMS_AFFECTED, - VOLUME_VOICE, - VOLUME_SYSTEM, - VOLUME_RING, - VOLUME_MUSIC, - VOLUME_ALARM, - VOLUME_NOTIFICATION, - VOLUME_BLUETOOTH_SCO, - VOLUME_VOICE + APPEND_FOR_LAST_AUDIBLE, - VOLUME_SYSTEM + APPEND_FOR_LAST_AUDIBLE, - VOLUME_RING + APPEND_FOR_LAST_AUDIBLE, - VOLUME_MUSIC + APPEND_FOR_LAST_AUDIBLE, - VOLUME_ALARM + APPEND_FOR_LAST_AUDIBLE, - VOLUME_NOTIFICATION + APPEND_FOR_LAST_AUDIBLE, - VOLUME_BLUETOOTH_SCO + APPEND_FOR_LAST_AUDIBLE, - TEXT_AUTO_REPLACE, - TEXT_AUTO_CAPS, - TEXT_AUTO_PUNCTUATE, - TEXT_SHOW_PASSWORD, - AUTO_TIME, - AUTO_TIME_ZONE, - TIME_12_24, - DATE_FORMAT, - DTMF_TONE_WHEN_DIALING, - DTMF_TONE_TYPE_WHEN_DIALING, - EMERGENCY_TONE, - CALL_AUTO_RETRY, - HEARING_AID, - TTY_MODE, - SOUND_EFFECTS_ENABLED, - HAPTIC_FEEDBACK_ENABLED, - POWER_SOUNDS_ENABLED, - DOCK_SOUNDS_ENABLED, - LOCKSCREEN_SOUNDS_ENABLED, - SHOW_WEB_SUGGESTIONS, - NOTIFICATION_LIGHT_PULSE, - SIP_CALL_OPTIONS, - SIP_RECEIVE_CALLS, - POINTER_SPEED, - VIBRATE_WHEN_RINGING - }; - - // Settings moved to Settings.Secure + public static final String LOCKSCREEN_DISABLED = "lockscreen.disabled"; /** - * @deprecated Use {@link android.provider.Settings.Secure#ADB_ENABLED} - * instead + * Stores values for custom lockscreen targets + * @hide */ - @Deprecated - public static final String ADB_ENABLED = Secure.ADB_ENABLED; + public static final String LOCKSCREEN_TARGETS = "lockscreen_targets"; /** - * @deprecated Use {@link android.provider.Settings.Secure#ANDROID_ID} instead + * @deprecated Use {@link android.provider.Settings.Global#LOW_BATTERY_SOUND} + * instead + * @hide */ @Deprecated - public static final String ANDROID_ID = Secure.ANDROID_ID; + public static final String LOW_BATTERY_SOUND = Global.LOW_BATTERY_SOUND; /** - * @deprecated Use {@link android.provider.Settings.Secure#BLUETOOTH_ON} instead + * @deprecated Use {@link android.provider.Settings.Global#DESK_DOCK_SOUND} + * instead + * @hide */ @Deprecated - public static final String BLUETOOTH_ON = Secure.BLUETOOTH_ON; + public static final String DESK_DOCK_SOUND = Global.DESK_DOCK_SOUND; /** - * @deprecated Use {@link android.provider.Settings.Secure#DATA_ROAMING} instead + * @deprecated Use {@link android.provider.Settings.Global#DESK_UNDOCK_SOUND} + * instead + * @hide */ @Deprecated - public static final String DATA_ROAMING = Secure.DATA_ROAMING; + public static final String DESK_UNDOCK_SOUND = Global.DESK_UNDOCK_SOUND; /** - * @deprecated Use {@link android.provider.Settings.Secure#DEVICE_PROVISIONED} instead + * @deprecated Use {@link android.provider.Settings.Global#CAR_DOCK_SOUND} + * instead + * @hide */ @Deprecated - public static final String DEVICE_PROVISIONED = Secure.DEVICE_PROVISIONED; + public static final String CAR_DOCK_SOUND = Global.CAR_DOCK_SOUND; /** - * @deprecated Use {@link android.provider.Settings.Secure#HTTP_PROXY} instead + * @deprecated Use {@link android.provider.Settings.Global#CAR_UNDOCK_SOUND} + * instead + * @hide */ @Deprecated - public static final String HTTP_PROXY = Secure.HTTP_PROXY; + public static final String CAR_UNDOCK_SOUND = Global.CAR_UNDOCK_SOUND; /** - * @deprecated Use {@link android.provider.Settings.Secure#INSTALL_NON_MARKET_APPS} instead + * @deprecated Use {@link android.provider.Settings.Global#LOCK_SOUND} + * instead + * @hide */ @Deprecated - public static final String INSTALL_NON_MARKET_APPS = Secure.INSTALL_NON_MARKET_APPS; + public static final String LOCK_SOUND = Global.LOCK_SOUND; /** - * @deprecated Use {@link android.provider.Settings.Secure#LOCATION_PROVIDERS_ALLOWED} + * @deprecated Use {@link android.provider.Settings.Global#UNLOCK_SOUND} * instead + * @hide */ @Deprecated - public static final String LOCATION_PROVIDERS_ALLOWED = Secure.LOCATION_PROVIDERS_ALLOWED; + public static final String UNLOCK_SOUND = Global.UNLOCK_SOUND; /** - * @deprecated Use {@link android.provider.Settings.Secure#LOGGING_ID} instead + * Receive incoming SIP calls? + * 0 = no + * 1 = yes + * @hide */ - @Deprecated - public static final String LOGGING_ID = Secure.LOGGING_ID; + public static final String SIP_RECEIVE_CALLS = "sip_receive_calls"; /** - * @deprecated Use {@link android.provider.Settings.Secure#NETWORK_PREFERENCE} instead + * Call Preference String. + * "SIP_ALWAYS" : Always use SIP with network access + * "SIP_ADDRESS_ONLY" : Only if destination is a SIP address + * "SIP_ASK_ME_EACH_TIME" : Always ask me each time + * @hide */ - @Deprecated - public static final String NETWORK_PREFERENCE = Secure.NETWORK_PREFERENCE; + public static final String SIP_CALL_OPTIONS = "sip_call_options"; /** - * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_ENABLED} - * instead + * One of the sip call options: Always use SIP with network access. + * @hide */ - @Deprecated - public static final String PARENTAL_CONTROL_ENABLED = Secure.PARENTAL_CONTROL_ENABLED; + public static final String SIP_ALWAYS = "SIP_ALWAYS"; /** - * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_LAST_UPDATE} - * instead + * One of the sip call options: Only if destination is a SIP address. + * @hide */ - @Deprecated - public static final String PARENTAL_CONTROL_LAST_UPDATE = Secure.PARENTAL_CONTROL_LAST_UPDATE; + public static final String SIP_ADDRESS_ONLY = "SIP_ADDRESS_ONLY"; /** - * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_REDIRECT_URL} - * instead + * One of the sip call options: Always ask me each time. + * @hide */ - @Deprecated - public static final String PARENTAL_CONTROL_REDIRECT_URL = - Secure.PARENTAL_CONTROL_REDIRECT_URL; + public static final String SIP_ASK_ME_EACH_TIME = "SIP_ASK_ME_EACH_TIME"; /** - * @deprecated Use {@link android.provider.Settings.Secure#SETTINGS_CLASSNAME} instead + * Torch state (flashlight) + * @hide */ - @Deprecated - public static final String SETTINGS_CLASSNAME = Secure.SETTINGS_CLASSNAME; - + public static final String TORCH_STATE = "torch_state"; /** - * @deprecated Use {@link android.provider.Settings.Secure#USB_MASS_STORAGE_ENABLED} instead + * Pointer speed setting. + * This is an integer value in a range between -7 and +7, so there are 15 possible values. + * -7 = slowest + * 0 = default speed + * +7 = fastest + * @hide */ - @Deprecated - public static final String USB_MASS_STORAGE_ENABLED = Secure.USB_MASS_STORAGE_ENABLED; + public static final String POINTER_SPEED = "pointer_speed"; /** - * @deprecated Use {@link android.provider.Settings.Secure#USE_GOOGLE_MAIL} instead - */ - @Deprecated - public static final String USE_GOOGLE_MAIL = Secure.USE_GOOGLE_MAIL; - - /** - * @deprecated Use - * {@link android.provider.Settings.Secure#WIFI_MAX_DHCP_RETRY_COUNT} instead + * Quick Settings Panel Tiles to Use + * + * @hide */ - @Deprecated - public static final String WIFI_MAX_DHCP_RETRY_COUNT = Secure.WIFI_MAX_DHCP_RETRY_COUNT; + public static final String QUICK_SETTINGS_TILES = "quick_settings_tiles"; /** - * @deprecated Use - * {@link android.provider.Settings.Secure#WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS} instead + * Quick Settings Panel Dynamic Tiles + * + * @hide */ - @Deprecated - public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS = - Secure.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS; + public static final String QS_DYNAMIC_ALARM = "qs_dyanmic_alarm"; /** - * @deprecated Use - * {@link android.provider.Settings.Secure#WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON} instead + * Quick Settings Panel Dynamic Tiles + * + * @hide */ - @Deprecated - public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON = - Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON; + public static final String QS_DYNAMIC_BUGREPORT = "qs_dyanmic_bugreport"; /** - * @deprecated Use - * {@link android.provider.Settings.Secure#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} instead + * Quick Settings Panel Dynamic Tiles + * + * @hide */ - @Deprecated - public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY = - Secure.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY; + public static final String QS_DYNAMIC_IME = "qs_dyanmic_ime"; /** - * @deprecated Use {@link android.provider.Settings.Secure#WIFI_NUM_OPEN_NETWORKS_KEPT} - * instead + * Quick Settings Panel Dynamic Tiles + * + * @hide */ - @Deprecated - public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = Secure.WIFI_NUM_OPEN_NETWORKS_KEPT; + public static final String QS_DYNAMIC_WIFI = "qs_dyanmic_wifi"; /** - * @deprecated Use {@link android.provider.Settings.Secure#WIFI_ON} instead + * Quick Settings Quick Pulldown + * + * @hide */ - @Deprecated - public static final String WIFI_ON = Secure.WIFI_ON; + public static final String QS_QUICK_PULLDOWN = "qs_quick_pulldown"; /** - * @deprecated Use - * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE} - * instead + * Quick Settings Collapse Pane + * + * @hide */ - @Deprecated - public static final String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE = - Secure.WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE; + public static final String QS_COLLAPSE_PANEL = "qs_collapse_panel"; /** - * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_AP_COUNT} instead + * Use the Notification Power Widget? (Who wouldn't!) + * + * @hide */ - @Deprecated - public static final String WIFI_WATCHDOG_AP_COUNT = Secure.WIFI_WATCHDOG_AP_COUNT; + public static final String EXPANDED_VIEW_WIDGET = "expanded_view_widget"; /** - * @deprecated Use - * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS} instead + * Whether to hide the notification screen after clicking on a widget + * button + * + * @hide */ - @Deprecated - public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS = - Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS; + public static final String EXPANDED_HIDE_ONCHANGE = "expanded_hide_onchange"; /** - * @deprecated Use - * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED} instead + * Hide scroll bar in power widget + * + * @hide */ - @Deprecated - public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED = - Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED; + public static final String EXPANDED_HIDE_SCROLLBAR = "expanded_hide_scrollbar"; /** - * @deprecated Use - * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS} - * instead + * Haptic feedback in power widget + * + * @hide */ - @Deprecated - public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS = - Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS; + public static final String EXPANDED_HAPTIC_FEEDBACK = "expanded_haptic_feedback"; /** - * @deprecated Use - * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT} instead + * Widget Buttons to Use + * + * @hide */ - @Deprecated - public static final String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT = - Secure.WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT; + public static final String WIDGET_BUTTONS = "expanded_widget_buttons"; /** - * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_MAX_AP_CHECKS} - * instead + * Widget Buttons to Use - Tablet + * + * @hide */ - @Deprecated - public static final String WIFI_WATCHDOG_MAX_AP_CHECKS = Secure.WIFI_WATCHDOG_MAX_AP_CHECKS; + public static final String WIDGET_BUTTONS_TABLET = "expanded_widget_buttons_tablet"; /** - * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_ON} instead + * Navigation controls to Use + * + * @hide */ - @Deprecated - public static final String WIFI_WATCHDOG_ON = Secure.WIFI_WATCHDOG_ON; + public static final String NAV_BUTTONS = "nav_buttons"; /** - * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_COUNT} instead - */ - @Deprecated - public static final String WIFI_WATCHDOG_PING_COUNT = Secure.WIFI_WATCHDOG_PING_COUNT; + * Notification Power Widget - Custom Brightness Mode + * @hide + */ + public static final String EXPANDED_BRIGHTNESS_MODE = "expanded_brightness_mode"; /** - * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_DELAY_MS} - * instead - */ - @Deprecated - public static final String WIFI_WATCHDOG_PING_DELAY_MS = Secure.WIFI_WATCHDOG_PING_DELAY_MS; + * Notification Power Widget - Custom Network Mode + * @hide + */ + public static final String EXPANDED_NETWORK_MODE = "expanded_network_mode"; /** - * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_TIMEOUT_MS} - * instead - */ - @Deprecated - public static final String WIFI_WATCHDOG_PING_TIMEOUT_MS = - Secure.WIFI_WATCHDOG_PING_TIMEOUT_MS; - } - - /** - * Secure system settings, containing system preferences that applications - * can read but are not allowed to write. These are for preferences that - * the user must explicitly modify through the system UI or specialized - * APIs for those values, not modified directly by applications. - */ - public static final class Secure extends NameValueTable { - public static final String SYS_PROP_SETTING_VERSION = "sys.settings_secure_version"; + * Notification Power Widget - Custom Screen Timeout + * @hide + */ + public static final String EXPANDED_SCREENTIMEOUT_MODE = "expanded_screentimeout_mode"; - // Populated lazily, guarded by class object: - private static NameValueCache sNameValueCache = null; + /** + * Notification Power Widget - Custom Ring Mode + * @hide + */ + public static final String EXPANDED_RING_MODE = "expanded_ring_mode"; - private static ILockSettings sLockSettings = null; + /** + * Notification Power Widget - Custom Torch Mode + * @hide + */ + public static final String EXPANDED_FLASH_MODE = "expanded_flash_mode"; - private static boolean sIsSystemProcess; - private static final HashSet MOVED_TO_LOCK_SETTINGS; - static { - MOVED_TO_LOCK_SETTINGS = new HashSet(3); - MOVED_TO_LOCK_SETTINGS.add(Secure.LOCK_PATTERN_ENABLED); - MOVED_TO_LOCK_SETTINGS.add(Secure.LOCK_PATTERN_VISIBLE); - MOVED_TO_LOCK_SETTINGS.add(Secure.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED); - } + /** + * AutoHide CombinedBar on tablets. + * @hide + */ + public static final String COMBINED_BAR_AUTO_HIDE = "combined_bar_auto_hide"; /** - * Look up a name in the database. - * @param resolver to access the database with - * @param name to look up in the table - * @return the corresponding value, or null if not present + * Display style of AM/PM next to clock in status bar + * 0: Normal display (Eclair stock) + * 1: Small display (Froyo stock) + * 2: No display (Gingerbread/ICS stock) + * default: 2 + * @hide */ - public synchronized static String getString(ContentResolver resolver, String name) { - if (sNameValueCache == null) { - sNameValueCache = new NameValueCache(SYS_PROP_SETTING_VERSION, CONTENT_URI, - CALL_METHOD_GET_SECURE); - } + public static final String STATUS_BAR_AM_PM = "status_bar_am_pm"; - if (sLockSettings == null) { - sLockSettings = ILockSettings.Stub.asInterface( - (IBinder) ServiceManager.getService("lock_settings")); - sIsSystemProcess = Process.myUid() == Process.SYSTEM_UID; - } - if (sLockSettings != null && !sIsSystemProcess - && MOVED_TO_LOCK_SETTINGS.contains(name)) { - try { - return sLockSettings.getString(name, "0", UserId.getCallingUserId()); - } catch (RemoteException re) { - // Fall through - } - } + /** + * Display style of the status bar battery information + * 0: Display the stock battery information + * 1: Display cm battery percentage implementation / dont show stock icon + * 2: Display cm circle battery implementation without percentage + * 3: Display cm circle battery implementation with percentage + * 4: Hide the battery information + * default: 0 + * @hide + */ + public static final String STATUS_BAR_BATTERY = "status_bar_battery"; - return sNameValueCache.getString(resolver, name); - } + /** + * Whether to show the clock in status bar + * of the stock battery icon + * 0: don't show the clock + * 1: show the clock + * default: 1 + * @hide + */ + public static final String STATUS_BAR_CLOCK = "status_bar_clock"; /** - * Store a name/value pair into the database. - * @param resolver to access the database with - * @param name to store - * @param value to associate with the name - * @return true if the value was set, false on database errors + * Whether to show the signal text or signal bars. + * default: 0 + * 0: show signal bars + * 1: show signal text numbers + * 2: show signal text numbers w/small dBm appended + * @hide */ - public static boolean putString(ContentResolver resolver, - String name, String value) { - return putString(resolver, CONTENT_URI, name, value); - } + public static final String STATUS_BAR_SIGNAL_TEXT = "status_bar_signal"; - /** - * Construct the content URI for a particular name/value pair, - * useful for monitoring changes with a ContentObserver. - * @param name to look up in the table - * @return the corresponding content URI, or null if not present + /** + * Whether to control brightness from status bar + * + * @hide */ - public static Uri getUriFor(String name) { - return getUriFor(CONTENT_URI, name); - } + public static final String STATUS_BAR_BRIGHTNESS_CONTROL = "status_bar_brightness_control"; /** - * Convenience function for retrieving a single secure settings value - * as an integer. Note that internally setting values are always - * stored as strings; this function converts the string to an integer - * for you. The default value will be returned if the setting is - * not defined or not an integer. - * - * @param cr The ContentResolver to access. - * @param name The name of the setting to retrieve. - * @param def Value to return if the setting is not defined. - * - * @return The setting's current value, or 'def' if it is not defined - * or not a valid integer. + * Whether to show the IME switcher in the status bar + * @hide */ - public static int getInt(ContentResolver cr, String name, int def) { - String v = getString(cr, name); - try { - return v != null ? Integer.parseInt(v) : def; - } catch (NumberFormatException e) { - return def; - } - } + public static final String STATUS_BAR_IME_SWITCHER = "status_bar_ime_switcher"; - /** - * Convenience function for retrieving a single secure settings value - * as an integer. Note that internally setting values are always - * stored as strings; this function converts the string to an integer - * for you. - *

        - * This version does not take a default value. If the setting has not - * been set, or the string value is not a number, - * it throws {@link SettingNotFoundException}. - * - * @param cr The ContentResolver to access. - * @param name The name of the setting to retrieve. - * - * @throws SettingNotFoundException Thrown if a setting by the given - * name can't be found or the setting value is not an integer. - * - * @return The setting's current value. + /** + * Statusbar State + * @hide */ - public static int getInt(ContentResolver cr, String name) - throws SettingNotFoundException { - String v = getString(cr, name); - try { - return Integer.parseInt(v); - } catch (NumberFormatException e) { - throw new SettingNotFoundException(name); - } - } + public static final String EXPANDED_DESKTOP_STATE = "expanded_desktop_state"; /** - * Convenience function for updating a single settings value as an - * integer. This will either create a new entry in the table if the - * given name does not exist, or modify the value of the existing row - * with that name. Note that internally setting values are always - * stored as strings, so this function converts the given value to a - * string before storing it. - * - * @param cr The ContentResolver to access. - * @param name The name of the setting to modify. - * @param value The new value for the setting. - * @return true if the value was set, false on database errors + * Whether to use a separate delay for "slide to unlock" and security + * lock + * @hide */ - public static boolean putInt(ContentResolver cr, String name, int value) { - return putString(cr, name, Integer.toString(value)); - } + public static final String SCREEN_LOCK_SLIDE_DELAY_TOGGLE = "screen_lock_slide_delay_toggle"; /** - * Convenience function for retrieving a single secure settings value - * as a {@code long}. Note that internally setting values are always - * stored as strings; this function converts the string to a {@code long} - * for you. The default value will be returned if the setting is - * not defined or not a {@code long}. - * - * @param cr The ContentResolver to access. - * @param name The name of the setting to retrieve. - * @param def Value to return if the setting is not defined. - * - * @return The setting's current value, or 'def' if it is not defined - * or not a valid {@code long}. + * How many ms to delay before enabling the "slide to unlock" screen + * lock when the screen goes off due to timeout + * @hide */ - public static long getLong(ContentResolver cr, String name, long def) { - String valString = getString(cr, name); - long value; - try { - value = valString != null ? Long.parseLong(valString) : def; - } catch (NumberFormatException e) { - value = def; - } - return value; - } + public static final String SCREEN_LOCK_SLIDE_TIMEOUT_DELAY = "screen_lock_slide_timeout_delay"; /** - * Convenience function for retrieving a single secure settings value - * as a {@code long}. Note that internally setting values are always - * stored as strings; this function converts the string to a {@code long} - * for you. - *

        - * This version does not take a default value. If the setting has not - * been set, or the string value is not a number, - * it throws {@link SettingNotFoundException}. - * - * @param cr The ContentResolver to access. - * @param name The name of the setting to retrieve. - * - * @return The setting's current value. - * @throws SettingNotFoundException Thrown if a setting by the given - * name can't be found or the setting value is not an integer. + * How many ms to delay before enabling the "slide to unlock" screen + * lock when the screen is turned off by the user + * @hide */ - public static long getLong(ContentResolver cr, String name) - throws SettingNotFoundException { - String valString = getString(cr, name); - try { - return Long.parseLong(valString); - } catch (NumberFormatException e) { - throw new SettingNotFoundException(name); - } - } + public static final String SCREEN_LOCK_SLIDE_SCREENOFF_DELAY = "screen_lock_slide_screenoff_delay"; /** - * Convenience function for updating a secure settings value as a long - * integer. This will either create a new entry in the table if the - * given name does not exist, or modify the value of the existing row - * with that name. Note that internally setting values are always - * stored as strings, so this function converts the given value to a - * string before storing it. - * - * @param cr The ContentResolver to access. - * @param name The name of the setting to modify. - * @param value The new value for the setting. - * @return true if the value was set, false on database errors + * Whether to use the custom quick unlock screen control + * @hide */ - public static boolean putLong(ContentResolver cr, String name, long value) { - return putString(cr, name, Long.toString(value)); - } + public static final String LOCKSCREEN_QUICK_UNLOCK_CONTROL = "lockscreen_quick_unlock_control"; /** - * Convenience function for retrieving a single secure settings value - * as a floating point number. Note that internally setting values are - * always stored as strings; this function converts the string to an - * float for you. The default value will be returned if the setting - * is not defined or not a valid float. - * - * @param cr The ContentResolver to access. - * @param name The name of the setting to retrieve. - * @param def Value to return if the setting is not defined. + * Boolean value whether to link ringtone and notification volumes * - * @return The setting's current value, or 'def' if it is not defined - * or not a valid float. + * @hide */ - public static float getFloat(ContentResolver cr, String name, float def) { - String v = getString(cr, name); - try { - return v != null ? Float.parseFloat(v) : def; - } catch (NumberFormatException e) { - return def; - } - } + public static final String VOLUME_LINK_NOTIFICATION = "volume_link_notification"; /** - * Convenience function for retrieving a single secure settings value - * as a float. Note that internally setting values are always - * stored as strings; this function converts the string to a float - * for you. - *

        - * This version does not take a default value. If the setting has not - * been set, or the string value is not a number, - * it throws {@link SettingNotFoundException}. - * - * @param cr The ContentResolver to access. - * @param name The name of the setting to retrieve. - * - * @throws SettingNotFoundException Thrown if a setting by the given - * name can't be found or the setting value is not a float. - * - * @return The setting's current value. + * Whether to unlock the menu key. The value is boolean (1 or 0). + * @hide */ - public static float getFloat(ContentResolver cr, String name) - throws SettingNotFoundException { - String v = getString(cr, name); - if (v == null) { - throw new SettingNotFoundException(name); - } - try { - return Float.parseFloat(v); - } catch (NumberFormatException e) { - throw new SettingNotFoundException(name); - } - } + public static final String MENU_UNLOCK_SCREEN = "menu_unlock_screen"; /** - * Convenience function for updating a single settings value as a - * floating point number. This will either create a new entry in the - * table if the given name does not exist, or modify the value of the - * existing row with that name. Note that internally setting values - * are always stored as strings, so this function converts the given - * value to a string before storing it. - * - * @param cr The ContentResolver to access. - * @param name The name of the setting to modify. - * @param value The new value for the setting. - * @return true if the value was set, false on database errors + * Whether to wake the screen with the volume keys, the value is boolean. + * @hide */ - public static boolean putFloat(ContentResolver cr, String name, float value) { - return putString(cr, name, Float.toString(value)); - } + public static final String VOLUME_WAKE_SCREEN = "volume_wake_screen"; /** - * The content:// style URL for this table + * Whether or not volume button music controls should be enabled to seek media tracks + * @hide */ - public static final Uri CONTENT_URI = - Uri.parse("content://" + AUTHORITY + "/secure"); + public static final String VOLBTN_MUSIC_CONTROLS = "volbtn_music_controls"; /** - * Whether user has enabled development settings. + * Whether national data roaming should be used. + * @hide */ - public static final String DEVELOPMENT_SETTINGS_ENABLED = "development_settings_enabled"; + public static final String MVNO_ROAMING = "mvno_roaming"; /** - * Whether ADB is enabled. + * Whether to enable quiet hours. + * @hide */ - public static final String ADB_ENABLED = "adb_enabled"; + public static final String QUIET_HOURS_ENABLED = "quiet_hours_enabled"; /** - * Setting to allow mock locations and location provider status to be injected into the - * LocationManager service for testing purposes during application development. These - * locations and status values override actual location and status information generated - * by network, gps, or other location providers. + * Sets when quiet hours starts. This is stored in minutes from the start of the day. + * @hide */ - public static final String ALLOW_MOCK_LOCATION = "mock_location"; + public static final String QUIET_HOURS_START = "quiet_hours_start"; /** - * A 64-bit number (as a hex string) that is randomly - * generated on the device's first boot and should remain - * constant for the lifetime of the device. (The value may - * change if a factory reset is performed on the device.) + * Sets when quiet hours end. This is stored in minutes from the start of the day. + * @hide */ - public static final String ANDROID_ID = "android_id"; + public static final String QUIET_HOURS_END = "quiet_hours_end"; /** - * Whether bluetooth is enabled/disabled - * 0=disabled. 1=enabled. + * Whether to remove the sound from outgoing notifications during quiet hours. + * @hide */ - public static final String BLUETOOTH_ON = "bluetooth_on"; + public static final String QUIET_HOURS_MUTE = "quiet_hours_mute"; /** - * Get the key that retrieves a bluetooth headset's priority. + * Whether to disable haptic feedback during quiet hours. * @hide */ - public static final String getBluetoothHeadsetPriorityKey(String address) { - return ("bluetooth_headset_priority_" + address.toUpperCase()); - } + public static final String QUIET_HOURS_HAPTIC = "quiet_hours_haptic"; /** - * Get the key that retrieves a bluetooth a2dp sink's priority. + * Whether to remove the vibration from outgoing notifications during quiet hours. * @hide */ - public static final String getBluetoothA2dpSinkPriorityKey(String address) { - return ("bluetooth_a2dp_sink_priority_" + address.toUpperCase()); - } + public static final String QUIET_HOURS_STILL = "quiet_hours_still"; /** - * Get the key that retrieves a bluetooth Input Device's priority. + * Whether to attempt to dim the LED color during quiet hours. * @hide */ - public static final String getBluetoothInputDevicePriorityKey(String address) { - return ("bluetooth_input_device_priority_" + address.toUpperCase()); - } + public static final String QUIET_HOURS_DIM = "quiet_hours_dim"; /** - * Whether or not data roaming is enabled. (0 = false, 1 = true) + * Sets the lockscreen background style + * @hide */ - public static final String DATA_ROAMING = "data_roaming"; + public static final String LOCKSCREEN_BACKGROUND = "lockscreen_background"; - /** - * Setting to record the input method used by default, holding the ID - * of the desired method. + /** + * Action for long-pressing back button on lock screen + * @hide */ - public static final String DEFAULT_INPUT_METHOD = "default_input_method"; + public static final String LOCKSCREEN_LONG_BACK_ACTION = "lockscreen_long_back_action"; /** - * Setting to record the input method subtype used by default, holding the ID - * of the desired method. + * Action for long-pressing home button on lock screen + * @hide */ - public static final String SELECTED_INPUT_METHOD_SUBTYPE = - "selected_input_method_subtype"; + public static final String LOCKSCREEN_LONG_HOME_ACTION = "lockscreen_long_home_action"; /** - * Setting to record the history of input method subtype, holding the pair of ID of IME - * and its last used subtype. + * Action for long-pressing menu button on lock screen * @hide */ - public static final String INPUT_METHODS_SUBTYPE_HISTORY = - "input_methods_subtype_history"; + public static final String LOCKSCREEN_LONG_MENU_ACTION = "lockscreen_long_menu_action"; + + /** + * Always show the battery status on the lockscreen + * @hide + */ + public static final String LOCKSCREEN_ALWAYS_SHOW_BATTERY = "lockscreen_always_show_battery"; /** - * Setting to record the visibility of input method selector + * Show the pending notification counts as overlays on the status bar + * @hide */ - public static final String INPUT_METHOD_SELECTOR_VISIBILITY = - "input_method_selector_visibility"; + public static final String STATUS_BAR_NOTIF_COUNT = "status_bar_notif_count"; /** - * Whether the device has been provisioned (0 = false, 1 = true) + * Show the pending notification counts as overlays on the status bar + * @hide */ - public static final String DEVICE_PROVISIONED = "device_provisioned"; + public static final String SYSTEM_PROFILES_ENABLED = "system_profiles_enabled"; /** - * List of input methods that are currently enabled. This is a string - * containing the IDs of all enabled input methods, each ID separated - * by ':'. + * Whether the power menu reboot menu is enabled + * @hide */ - public static final String ENABLED_INPUT_METHODS = "enabled_input_methods"; + public static final String POWER_MENU_REBOOT_ENABLED = "power_menu_reboot_enabled"; /** - * List of system input methods that are currently disabled. This is a string - * containing the IDs of all disabled input methods, each ID separated - * by ':'. + * Whether power menu screenshot is enabled * @hide */ - public static final String DISABLED_SYSTEM_INPUT_METHODS = "disabled_system_input_methods"; + public static final String POWER_MENU_SCREENSHOT_ENABLED = "power_menu_screenshot_enabled"; /** - * Host name and port for global http proxy. Uses ':' seperator for between host and port - * TODO - deprecate in favor of global_http_proxy_host, etc + * Whether power menu expanded desktop is enabled + * @hide */ - public static final String HTTP_PROXY = "http_proxy"; + public static final String POWER_MENU_EXPANDED_DESKTOP_ENABLED = "power_menu_expanded_desktop_enabled"; /** - * Host name for global http proxy. Set via ConnectivityManager. + * Whether power menu profiles switcher is enabled * @hide */ - public static final String GLOBAL_HTTP_PROXY_HOST = "global_http_proxy_host"; + public static final String POWER_MENU_PROFILES_ENABLED = "power_menu_profiles_enabled"; /** - * Integer host port for global http proxy. Set via ConnectivityManager. + * Whether power menu airplane toggle is enabled * @hide */ - public static final String GLOBAL_HTTP_PROXY_PORT = "global_http_proxy_port"; + public static final String POWER_MENU_AIRPLANE_ENABLED = "power_menu_airplane_enabled"; /** - * Exclusion list for global proxy. This string contains a list of comma-separated - * domains where the global proxy does not apply. Domains should be listed in a comma- - * separated list. Example of acceptable formats: ".domain1.com,my.domain2.com" - * Use ConnectivityManager to set/get. + * Whether power menu user switcher is enabled * @hide */ - public static final String GLOBAL_HTTP_PROXY_EXCLUSION_LIST = - "global_http_proxy_exclusion_list"; + public static final String POWER_MENU_USER_ENABLED = "power_menu_user_enabled"; /** - * Enables the UI setting to allow the user to specify the global HTTP proxy - * and associated exclusion list. + * Whether power menu silent mode is enabled * @hide */ - public static final String SET_GLOBAL_HTTP_PROXY = "set_global_http_proxy"; + public static final String POWER_MENU_SOUND_ENABLED = "power_menu_silent_enabled"; /** - * Setting for default DNS in case nobody suggests one + * Whether to unlock the screen with the home key. The value is boolean (1 or 0). * @hide */ - public static final String DEFAULT_DNS_SERVER = "default_dns_server"; + public static final String HOME_UNLOCK_SCREEN = "home_unlock_screen"; /** - * Whether the package installer should allow installation of apps downloaded from - * sources other than Google Play. - * - * 1 = allow installing from other sources - * 0 = only allow installing from Google Play + * Whether the lockscreen vibrate should be enabled. + * @hide */ - public static final String INSTALL_NON_MARKET_APPS = "install_non_market_apps"; + public static final String LOCKSCREEN_VIBRATE_ENABLED = "lockscreen.vibrate_enabled"; /** - * Comma-separated list of location providers that activities may access. + * Show the pending notification counts as overlays on the status bar + * Whether to enable custom rebindings of the actions performed on + * certain key press events. + * @hide */ - public static final String LOCATION_PROVIDERS_ALLOWED = "location_providers_allowed"; + public static final String HARDWARE_KEY_REBINDING = "hardware_key_rebinding"; + + /** + * Action to perform when the home key is long-pressed. (Default is 2) + * 0 - Nothing + * 1 - Menu + * 2 - App-switch + * 3 - Search + * 4 - Voice search + * 5 - In-app search + * @hide + */ + public static final String KEY_HOME_LONG_PRESS_ACTION = "key_home_long_press_action"; + + /** + * Action to perform when the menu key is pressed. (Default is 1) + * (See KEY_HOME_LONG_PRESS_ACTION for valid values) + * @hide + */ + public static final String KEY_MENU_ACTION = "key_menu_action"; + + /** + * Action to perform when the menu key is long-pressed. + * (Default is 0 on devices with a search key, 3 on devices without) + * (See KEY_HOME_LONG_PRESS_ACTION for valid values) + * @hide + */ + public static final String KEY_MENU_LONG_PRESS_ACTION = "key_menu_long_press_action"; + + /** + * Action to perform when the assistant (search) key is pressed. (Default is 3) + * (See KEY_HOME_LONG_PRESS_ACTION for valid values) + * @hide + */ + public static final String KEY_ASSIST_ACTION = "key_assist_action"; + + /** + * Action to perform when the assistant (search) key is long-pressed. (Default is 4) + * (See KEY_HOME_LONG_PRESS_ACTION for valid values) + * @hide + */ + public static final String KEY_ASSIST_LONG_PRESS_ACTION = "key_assist_long_press_action"; + + /** + * Action to perform when the app switch key is pressed. (Default is 2) + * (See KEY_HOME_LONG_PRESS_ACTION for valid values) + * @hide + */ + public static final String KEY_APP_SWITCH_ACTION = "key_app_switch_action"; + + /** + * Action to perform when the app switch key is long-pressed. (Default is 0) + * (See KEY_HOME_LONG_PRESS_ACTION for valid values) + * @hide + */ + public static final String KEY_APP_SWITCH_LONG_PRESS_ACTION = "key_app_switch_long_press_action"; /** - * A flag containing settings used for biometric weak + * Control the display of the action overflow button within app UI. + * 0 = use system default + * 1 = force on * @hide */ - public static final String LOCK_BIOMETRIC_WEAK_FLAGS = - "lock_biometric_weak_flags"; + public static final String UI_FORCE_OVERFLOW_BUTTON = "ui_force_overflow_button"; + + /** + * Volume keys control cursor in text fields (default is 0) + * 0 - Disabled + * 1 - Volume up/down moves cursor left/right + * 2 - Volume up/down moves cursor right/left + * @hide + */ + public static final String VOLUME_KEY_CURSOR_CONTROL = "volume_key_cursor_control"; /** - * Whether autolock is enabled (0 = false, 1 = true) + * Settings to backup. This is here so that it's in the same place as the settings + * keys and easy to update. + * + * NOTE: Settings are backed up and restored in the order they appear + * in this array. If you have one setting depending on another, + * make sure that they are ordered appropriately. + * + * @hide */ - public static final String LOCK_PATTERN_ENABLED = "lock_pattern_autolock"; + public static final String[] SETTINGS_TO_BACKUP = { + STAY_ON_WHILE_PLUGGED_IN, // moved to global + WIFI_USE_STATIC_IP, + WIFI_STATIC_IP, + WIFI_STATIC_GATEWAY, + WIFI_STATIC_NETMASK, + WIFI_STATIC_DNS1, + WIFI_STATIC_DNS2, + BLUETOOTH_DISCOVERABILITY, + BLUETOOTH_DISCOVERABILITY_TIMEOUT, + DIM_SCREEN, + SCREEN_OFF_TIMEOUT, + SCREEN_BRIGHTNESS, + SCREEN_BRIGHTNESS_MODE, + SCREEN_AUTO_BRIGHTNESS_ADJ, + VIBRATE_INPUT_DEVICES, + MODE_RINGER, // moved to global + MODE_RINGER_STREAMS_AFFECTED, + MUTE_STREAMS_AFFECTED, + VOLUME_VOICE, + VOLUME_SYSTEM, + VOLUME_RING, + VOLUME_MUSIC, + VOLUME_ALARM, + VOLUME_NOTIFICATION, + VOLUME_BLUETOOTH_SCO, + VOLUME_VOICE + APPEND_FOR_LAST_AUDIBLE, + VOLUME_SYSTEM + APPEND_FOR_LAST_AUDIBLE, + VOLUME_RING + APPEND_FOR_LAST_AUDIBLE, + VOLUME_MUSIC + APPEND_FOR_LAST_AUDIBLE, + VOLUME_ALARM + APPEND_FOR_LAST_AUDIBLE, + VOLUME_NOTIFICATION + APPEND_FOR_LAST_AUDIBLE, + VOLUME_BLUETOOTH_SCO + APPEND_FOR_LAST_AUDIBLE, + TEXT_AUTO_REPLACE, + TEXT_AUTO_CAPS, + TEXT_AUTO_PUNCTUATE, + TEXT_SHOW_PASSWORD, + AUTO_TIME, // moved to global + AUTO_TIME_ZONE, // moved to global + TIME_12_24, + DATE_FORMAT, + ACCELEROMETER_ROTATION, + USER_ROTATION, + DTMF_TONE_WHEN_DIALING, + DTMF_TONE_TYPE_WHEN_DIALING, + HEARING_AID, + TTY_MODE, + NOISE_SUPPRESSION, + SOUND_EFFECTS_ENABLED, + HAPTIC_FEEDBACK_ENABLED, + POWER_SOUNDS_ENABLED, // moved to global + DOCK_SOUNDS_ENABLED, // moved to global + LOCKSCREEN_SOUNDS_ENABLED, + SHOW_WEB_SUGGESTIONS, + NOTIFICATION_LIGHT_PULSE, + NOTIFICATION_LIGHT_PULSE_DEFAULT_COLOR, + NOTIFICATION_LIGHT_PULSE_DEFAULT_LED_ON, + NOTIFICATION_LIGHT_PULSE_DEFAULT_LED_OFF, + SIP_CALL_OPTIONS, + SIP_RECEIVE_CALLS, + POINTER_SPEED, + QUIET_HOURS_ENABLED, + QUIET_HOURS_START, + QUIET_HOURS_END, + QUIET_HOURS_MUTE, + QUIET_HOURS_STILL, + QUIET_HOURS_DIM, + SYSTEM_PROFILES_ENABLED, + POWER_MENU_SCREENSHOT_ENABLED, + POWER_MENU_REBOOT_ENABLED, + POWER_MENU_PROFILES_ENABLED, + POWER_MENU_AIRPLANE_ENABLED, + POWER_MENU_SOUND_ENABLED, + POWER_MENU_USER_ENABLED, + LOCKSCREEN_VIBRATE_ENABLED, + LOCKSCREEN_ALWAYS_SHOW_BATTERY, + }; + + // Settings moved to Settings.Secure /** - * Whether lock pattern is visible as user enters (0 = false, 1 = true) + * @deprecated Use {@link android.provider.Settings.Global#ADB_ENABLED} + * instead */ - public static final String LOCK_PATTERN_VISIBLE = "lock_pattern_visible_pattern"; + @Deprecated + public static final String ADB_ENABLED = Global.ADB_ENABLED; /** - * Whether lock pattern will vibrate as user enters (0 = false, 1 = true) + * @deprecated Use {@link android.provider.Settings.Secure#ANDROID_ID} instead */ - public static final String LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED = - "lock_pattern_tactile_feedback_enabled"; + @Deprecated + public static final String ANDROID_ID = Secure.ANDROID_ID; /** - * This preference allows the device to be locked given time after screen goes off, - * subject to current DeviceAdmin policy limits. - * @hide + * @deprecated Use {@link android.provider.Settings.Global#BLUETOOTH_ON} instead */ - public static final String LOCK_SCREEN_LOCK_AFTER_TIMEOUT = "lock_screen_lock_after_timeout"; - + @Deprecated + public static final String BLUETOOTH_ON = Global.BLUETOOTH_ON; /** - * This preference contains the string that shows for owner info on LockScren. - * @hide + * @deprecated Use {@link android.provider.Settings.Global#DATA_ROAMING} instead */ - public static final String LOCK_SCREEN_OWNER_INFO = "lock_screen_owner_info"; + @Deprecated + public static final String DATA_ROAMING = Global.DATA_ROAMING; /** - * This preference enables showing the owner info on LockScren. - * @hide + * @deprecated Use {@link android.provider.Settings.Global#DEVICE_PROVISIONED} instead */ - public static final String LOCK_SCREEN_OWNER_INFO_ENABLED = - "lock_screen_owner_info_enabled"; + @Deprecated + public static final String DEVICE_PROVISIONED = Global.DEVICE_PROVISIONED; /** - * The saved value for WindowManagerService.setForcedDisplaySize(). - * Two integers separated by a comma. If unset, then use the real display size. - * @hide + * @deprecated Use {@link android.provider.Settings.Global#HTTP_PROXY} instead */ - public static final String DISPLAY_SIZE_FORCED = "display_size_forced"; + @Deprecated + public static final String HTTP_PROXY = Global.HTTP_PROXY; /** - * Whether assisted GPS should be enabled or not. - * @hide + * @deprecated Use {@link android.provider.Settings.Global#INSTALL_NON_MARKET_APPS} instead */ - public static final String ASSISTED_GPS_ENABLED = "assisted_gps_enabled"; + @Deprecated + public static final String INSTALL_NON_MARKET_APPS = Global.INSTALL_NON_MARKET_APPS; /** - * The Logging ID (a unique 64-bit value) as a hex string. - * Used as a pseudonymous identifier for logging. - * @deprecated This identifier is poorly initialized and has - * many collisions. It should not be used. + * @deprecated Use {@link android.provider.Settings.Secure#LOCATION_PROVIDERS_ALLOWED} + * instead */ @Deprecated - public static final String LOGGING_ID = "logging_id"; + public static final String LOCATION_PROVIDERS_ALLOWED = Secure.LOCATION_PROVIDERS_ALLOWED; /** - * User preference for which network(s) should be used. Only the - * connectivity service should touch this. + * @deprecated Use {@link android.provider.Settings.Secure#LOGGING_ID} instead */ - public static final String NETWORK_PREFERENCE = "network_preference"; + @Deprecated + public static final String LOGGING_ID = Secure.LOGGING_ID; /** - * Used to disable Tethering on a device - defaults to true - * @hide + * @deprecated Use {@link android.provider.Settings.Global#NETWORK_PREFERENCE} instead */ - public static final String TETHER_SUPPORTED = "tether_supported"; + @Deprecated + public static final String NETWORK_PREFERENCE = Global.NETWORK_PREFERENCE; /** - * Used to require DUN APN on the device or not - defaults to a build config value - * which defaults to false - * @hide + * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_ENABLED} + * instead */ - public static final String TETHER_DUN_REQUIRED = "tether_dun_required"; + @Deprecated + public static final String PARENTAL_CONTROL_ENABLED = Secure.PARENTAL_CONTROL_ENABLED; /** - * Used to hold a gservices-provisioned apn value for DUN. If set, or the - * corresponding build config values are set it will override the APN DB - * values. - * Consists of a comma seperated list 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" - * @hide + * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_LAST_UPDATE} + * instead */ - public static final String TETHER_DUN_APN = "tether_dun_apn"; + @Deprecated + public static final String PARENTAL_CONTROL_LAST_UPDATE = Secure.PARENTAL_CONTROL_LAST_UPDATE; /** - * No longer supported. + * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_REDIRECT_URL} + * instead */ - public static final String PARENTAL_CONTROL_ENABLED = "parental_control_enabled"; + @Deprecated + public static final String PARENTAL_CONTROL_REDIRECT_URL = + Secure.PARENTAL_CONTROL_REDIRECT_URL; /** - * No longer supported. + * @deprecated Use {@link android.provider.Settings.Secure#SETTINGS_CLASSNAME} instead */ - public static final String PARENTAL_CONTROL_LAST_UPDATE = "parental_control_last_update"; + @Deprecated + public static final String SETTINGS_CLASSNAME = Secure.SETTINGS_CLASSNAME; /** - * No longer supported. + * @deprecated Use {@link android.provider.Settings.Global#USB_MASS_STORAGE_ENABLED} instead */ - public static final String PARENTAL_CONTROL_REDIRECT_URL = "parental_control_redirect_url"; + @Deprecated + public static final String USB_MASS_STORAGE_ENABLED = Global.USB_MASS_STORAGE_ENABLED; /** - * A positive value indicates how often the SamplingProfiler - * should take snapshots. Zero value means SamplingProfiler - * is disabled. - * - * @hide + * @deprecated Use {@link android.provider.Settings.Global#USE_GOOGLE_MAIL} instead + */ + @Deprecated + public static final String USE_GOOGLE_MAIL = Global.USE_GOOGLE_MAIL; + + /** + * @deprecated Use + * {@link android.provider.Settings.Global#WIFI_MAX_DHCP_RETRY_COUNT} instead */ - public static final String SAMPLING_PROFILER_MS = "sampling_profiler_ms"; + @Deprecated + public static final String WIFI_MAX_DHCP_RETRY_COUNT = Global.WIFI_MAX_DHCP_RETRY_COUNT; /** - * Settings classname to launch when Settings is clicked from All - * Applications. Needed because of user testing between the old - * and new Settings apps. + * @deprecated Use + * {@link android.provider.Settings.Global#WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS} instead */ - // TODO: 881807 - public static final String SETTINGS_CLASSNAME = "settings_classname"; + @Deprecated + public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS = + Global.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS; /** - * USB Mass Storage Enabled + * @deprecated Use + * {@link android.provider.Settings.Global#WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON} instead */ - public static final String USB_MASS_STORAGE_ENABLED = "usb_mass_storage_enabled"; + @Deprecated + public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON = + Global.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON; /** - * If this setting is set (to anything), then all references - * to Gmail on the device must change to Google Mail. + * @deprecated Use + * {@link android.provider.Settings.Global#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} instead */ - public static final String USE_GOOGLE_MAIL = "use_google_mail"; + @Deprecated + public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY = + Global.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY; /** - * If accessibility is enabled. + * @deprecated Use {@link android.provider.Settings.Global#WIFI_NUM_OPEN_NETWORKS_KEPT} + * instead */ - public static final String ACCESSIBILITY_ENABLED = "accessibility_enabled"; + @Deprecated + public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = Global.WIFI_NUM_OPEN_NETWORKS_KEPT; /** - * If touch exploration is enabled. + * @deprecated Use {@link android.provider.Settings.Global#WIFI_ON} instead */ - public static final String TOUCH_EXPLORATION_ENABLED = "touch_exploration_enabled"; + @Deprecated + public static final String WIFI_ON = Global.WIFI_ON; /** - * List of the enabled accessibility providers. + * @deprecated Use + * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE} + * instead */ - public static final String ENABLED_ACCESSIBILITY_SERVICES = - "enabled_accessibility_services"; + @Deprecated + public static final String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE = + Secure.WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE; /** - * List of the accessibility services to which the user has graned - * permission to put the device into touch exploration mode. - * - * @hide + * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_AP_COUNT} instead */ - public static final String TOUCH_EXPLORATION_GRANTED_ACCESSIBILITY_SERVICES = - "touch_exploration_granted_accessibility_services"; + @Deprecated + public static final String WIFI_WATCHDOG_AP_COUNT = Secure.WIFI_WATCHDOG_AP_COUNT; /** - * Whether to speak passwords while in accessibility mode. + * @deprecated Use + * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS} instead */ - public static final String ACCESSIBILITY_SPEAK_PASSWORD = "speak_password"; + @Deprecated + public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS = + Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS; /** - * If injection of accessibility enhancing JavaScript screen-reader - * is enabled. - *

        - * Note: The JavaScript based screen-reader is served by the - * Google infrastructure and enable users with disabilities to - * efficiantly navigate in and explore web content. - *

        - *

        - * This property represents a boolean value. - *

        - * @hide + * @deprecated Use + * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED} instead */ - public static final String ACCESSIBILITY_SCRIPT_INJECTION = - "accessibility_script_injection"; + @Deprecated + public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED = + Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED; /** - * The URL for the injected JavaScript based screen-reader used - * for providing accessiblity of content in WebView. - *

        - * Note: The JavaScript based screen-reader is served by the - * Google infrastructure and enable users with disabilities to - * efficiently navigate in and explore web content. - *

        - *

        - * This property represents a string value. - *

        - * @hide - */ - public static final String ACCESSIBILITY_SCREEN_READER_URL = - "accessibility_script_injection_url"; - - /** - * Key bindings for navigation in built-in accessibility support for web content. - *

        - * Note: These key bindings are for the built-in accessibility navigation for - * web content which is used as a fall back solution if JavaScript in a WebView - * is not enabled or the user has not opted-in script injection from Google. - *

        - *

        - * The bindings are separated by semi-colon. A binding is a mapping from - * a key to a sequence of actions (for more details look at - * android.webkit.AccessibilityInjector). A key is represented as the hexademical - * string representation of an integer obtained from a meta state (optional) shifted - * sixteen times left and bitwise ored with a key code. An action is represented - * as a hexademical string representation of an integer where the first two digits - * are navigation action index, the second, the third, and the fourth digit pairs - * represent the action arguments. The separate actions in a binding are colon - * separated. The key and the action sequence it maps to are separated by equals. - *

        - *

        - * For example, the binding below maps the DPAD right button to traverse the - * current navigation axis once without firing an accessibility event and to - * perform the same traversal again but to fire an event: - * - * 0x16=0x01000100:0x01000101; - * - *

        - *

        - * The goal of this binding is to enable dynamic rebinding of keys to - * navigation actions for web content without requiring a framework change. - *

        - *

        - * This property represents a string value. - *

        - * @hide - */ - public static final String ACCESSIBILITY_WEB_CONTENT_KEY_BINDINGS = - "accessibility_web_content_key_bindings"; - - /** - * The timout for considering a press to be a long press in milliseconds. - * @hide - */ - public static final String LONG_PRESS_TIMEOUT = "long_press_timeout"; - - /** - * Setting to always use the default text-to-speech settings regardless - * of the application settings. - * 1 = override application settings, - * 0 = use application settings (if specified). - * - * @deprecated The value of this setting is no longer respected by - * the framework text to speech APIs as of the Ice Cream Sandwich release. + * @deprecated Use + * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS} + * instead */ @Deprecated - public static final String TTS_USE_DEFAULTS = "tts_use_defaults"; + public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS = + Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS; /** - * Default text-to-speech engine speech rate. 100 = 1x + * @deprecated Use + * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT} instead */ - public static final String TTS_DEFAULT_RATE = "tts_default_rate"; + @Deprecated + public static final String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT = + Secure.WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT; /** - * Default text-to-speech engine pitch. 100 = 1x + * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_MAX_AP_CHECKS} + * instead */ - public static final String TTS_DEFAULT_PITCH = "tts_default_pitch"; + @Deprecated + public static final String WIFI_WATCHDOG_MAX_AP_CHECKS = Secure.WIFI_WATCHDOG_MAX_AP_CHECKS; /** - * Default text-to-speech engine. + * @deprecated Use {@link android.provider.Settings.Global#WIFI_WATCHDOG_ON} instead */ - public static final String TTS_DEFAULT_SYNTH = "tts_default_synth"; + @Deprecated + public static final String WIFI_WATCHDOG_ON = Global.WIFI_WATCHDOG_ON; /** - * Default text-to-speech language. - * - * @deprecated this setting is no longer in use, as of the Ice Cream - * Sandwich release. Apps should never need to read this setting directly, - * instead can query the TextToSpeech framework classes for the default - * locale. {@link TextToSpeech#getLanguage()}. + * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_COUNT} instead */ @Deprecated - public static final String TTS_DEFAULT_LANG = "tts_default_lang"; + public static final String WIFI_WATCHDOG_PING_COUNT = Secure.WIFI_WATCHDOG_PING_COUNT; /** - * Default text-to-speech country. - * - * @deprecated this setting is no longer in use, as of the Ice Cream - * Sandwich release. Apps should never need to read this setting directly, - * instead can query the TextToSpeech framework classes for the default - * locale. {@link TextToSpeech#getLanguage()}. + * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_DELAY_MS} + * instead */ @Deprecated - public static final String TTS_DEFAULT_COUNTRY = "tts_default_country"; + public static final String WIFI_WATCHDOG_PING_DELAY_MS = Secure.WIFI_WATCHDOG_PING_DELAY_MS; /** - * Default text-to-speech locale variant. - * - * @deprecated this setting is no longer in use, as of the Ice Cream - * Sandwich release. Apps should never need to read this setting directly, - * instead can query the TextToSpeech framework classes for the - * locale that is in use {@link TextToSpeech#getLanguage()}. + * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_TIMEOUT_MS} + * instead */ @Deprecated - public static final String TTS_DEFAULT_VARIANT = "tts_default_variant"; + public static final String WIFI_WATCHDOG_PING_TIMEOUT_MS = + Secure.WIFI_WATCHDOG_PING_TIMEOUT_MS; + } - /** - * Stores the default tts locales on a per engine basis. Stored as - * a comma seperated list of values, each value being of the form - * {@code engine_name:locale} for example, - * {@code com.foo.ttsengine:eng-USA,com.bar.ttsengine:esp-ESP}. This - * supersedes {@link #TTS_DEFAULT_LANG}, {@link #TTS_DEFAULT_COUNTRY} and - * {@link #TTS_DEFAULT_VARIANT}. Apps should never need to read this - * setting directly, and can query the TextToSpeech framework classes - * for the locale that is in use. - * - * @hide - */ - public static final String TTS_DEFAULT_LOCALE = "tts_default_locale"; + /** + * Secure system settings, containing system preferences that applications + * can read but are not allowed to write. These are for preferences that + * the user must explicitly modify through the system UI or specialized + * APIs for those values, not modified directly by applications. + */ + public static final class Secure extends NameValueTable { + public static final String SYS_PROP_SETTING_VERSION = "sys.settings_secure_version"; /** - * Space delimited list of plugin packages that are enabled. + * The content:// style URL for this table */ - public static final String TTS_ENABLED_PLUGINS = "tts_enabled_plugins"; + public static final Uri CONTENT_URI = + Uri.parse("content://" + AUTHORITY + "/secure"); - /** - * Whether to notify the user of open networks. - *

        - * If not connected and the scan results have an open network, we will - * put this notification up. If we attempt to connect to a network or - * the open network(s) disappear, we remove the notification. When we - * show the notification, we will not show it again for - * {@link android.provider.Settings.Secure#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} time. - */ - public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON = - "wifi_networks_available_notification_on"; - /** - * {@hide} - */ - public static final String WIMAX_NETWORKS_AVAILABLE_NOTIFICATION_ON = - "wimax_networks_available_notification_on"; + // Populated lazily, guarded by class object: + private static final NameValueCache sNameValueCache = new NameValueCache( + SYS_PROP_SETTING_VERSION, + CONTENT_URI, + CALL_METHOD_GET_SECURE, + CALL_METHOD_PUT_SECURE); - /** - * Delay (in seconds) before repeating the Wi-Fi networks available notification. - * Connecting to a network will reset the timer. - */ - public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY = - "wifi_networks_available_repeat_delay"; + private static ILockSettings sLockSettings = null; - /** - * 802.11 country code in ISO 3166 format - * @hide - */ - public static final String WIFI_COUNTRY_CODE = "wifi_country_code"; + private static boolean sIsSystemProcess; + private static final HashSet MOVED_TO_LOCK_SETTINGS; + private static final HashSet MOVED_TO_GLOBAL; + static { + MOVED_TO_LOCK_SETTINGS = new HashSet(3); + MOVED_TO_LOCK_SETTINGS.add(Secure.LOCK_PATTERN_ENABLED); + MOVED_TO_LOCK_SETTINGS.add(Secure.LOCK_PATTERN_VISIBLE); + MOVED_TO_LOCK_SETTINGS.add(Secure.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED); + MOVED_TO_GLOBAL = new HashSet(); + MOVED_TO_GLOBAL.add(Settings.Global.ADB_ENABLED); + MOVED_TO_GLOBAL.add(Settings.Global.ASSISTED_GPS_ENABLED); + MOVED_TO_GLOBAL.add(Settings.Global.BLUETOOTH_ON); + MOVED_TO_GLOBAL.add(Settings.Global.CDMA_CELL_BROADCAST_SMS); + MOVED_TO_GLOBAL.add(Settings.Global.CDMA_ROAMING_MODE); + MOVED_TO_GLOBAL.add(Settings.Global.CDMA_SUBSCRIPTION_MODE); + MOVED_TO_GLOBAL.add(Settings.Global.DATA_ACTIVITY_TIMEOUT_MOBILE); + MOVED_TO_GLOBAL.add(Settings.Global.DATA_ACTIVITY_TIMEOUT_WIFI); + MOVED_TO_GLOBAL.add(Settings.Global.DATA_ROAMING); + MOVED_TO_GLOBAL.add(Settings.Global.DEVELOPMENT_SETTINGS_ENABLED); + MOVED_TO_GLOBAL.add(Settings.Global.DEVICE_PROVISIONED); + MOVED_TO_GLOBAL.add(Settings.Global.DISPLAY_DENSITY_FORCED); + MOVED_TO_GLOBAL.add(Settings.Global.DISPLAY_SIZE_FORCED); + MOVED_TO_GLOBAL.add(Settings.Global.DOWNLOAD_MAX_BYTES_OVER_MOBILE); + MOVED_TO_GLOBAL.add(Settings.Global.DOWNLOAD_RECOMMENDED_MAX_BYTES_OVER_MOBILE); + MOVED_TO_GLOBAL.add(Settings.Global.INSTALL_NON_MARKET_APPS); + MOVED_TO_GLOBAL.add(Settings.Global.MOBILE_DATA); + MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_DEV_BUCKET_DURATION); + MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_DEV_DELETE_AGE); + MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_DEV_PERSIST_BYTES); + MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_DEV_ROTATE_AGE); + MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_ENABLED); + MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_GLOBAL_ALERT_BYTES); + MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_POLL_INTERVAL); + MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_REPORT_XT_OVER_DEV); + MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_SAMPLE_ENABLED); + MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_TIME_CACHE_MAX_AGE); + MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_BUCKET_DURATION); + MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_DELETE_AGE); + MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_PERSIST_BYTES); + MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_ROTATE_AGE); + MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_TAG_BUCKET_DURATION); + MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_TAG_DELETE_AGE); + MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_TAG_PERSIST_BYTES); + MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_TAG_ROTATE_AGE); + MOVED_TO_GLOBAL.add(Settings.Global.NETWORK_PREFERENCE); + MOVED_TO_GLOBAL.add(Settings.Global.NITZ_UPDATE_DIFF); + MOVED_TO_GLOBAL.add(Settings.Global.NITZ_UPDATE_SPACING); + MOVED_TO_GLOBAL.add(Settings.Global.NTP_SERVER); + MOVED_TO_GLOBAL.add(Settings.Global.NTP_TIMEOUT); + MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_ERROR_POLL_COUNT); + MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_LONG_POLL_INTERVAL_MS); + MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_MAX_PDP_RESET_FAIL_COUNT); + MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_POLL_INTERVAL_MS); + MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_TRIGGER_PACKET_COUNT); + MOVED_TO_GLOBAL.add(Settings.Global.SAMPLING_PROFILER_MS); + MOVED_TO_GLOBAL.add(Settings.Global.SETUP_PREPAID_DATA_SERVICE_URL); + MOVED_TO_GLOBAL.add(Settings.Global.SETUP_PREPAID_DETECTION_REDIR_HOST); + MOVED_TO_GLOBAL.add(Settings.Global.SETUP_PREPAID_DETECTION_TARGET_URL); + MOVED_TO_GLOBAL.add(Settings.Global.TETHER_DUN_APN); + MOVED_TO_GLOBAL.add(Settings.Global.TETHER_DUN_REQUIRED); + MOVED_TO_GLOBAL.add(Settings.Global.TETHER_SUPPORTED); + MOVED_TO_GLOBAL.add(Settings.Global.THROTTLE_HELP_URI); + MOVED_TO_GLOBAL.add(Settings.Global.THROTTLE_MAX_NTP_CACHE_AGE_SEC); + MOVED_TO_GLOBAL.add(Settings.Global.THROTTLE_NOTIFICATION_TYPE); + MOVED_TO_GLOBAL.add(Settings.Global.THROTTLE_POLLING_SEC); + MOVED_TO_GLOBAL.add(Settings.Global.THROTTLE_RESET_DAY); + MOVED_TO_GLOBAL.add(Settings.Global.THROTTLE_THRESHOLD_BYTES); + MOVED_TO_GLOBAL.add(Settings.Global.THROTTLE_VALUE_KBITSPS); + MOVED_TO_GLOBAL.add(Settings.Global.USB_MASS_STORAGE_ENABLED); + MOVED_TO_GLOBAL.add(Settings.Global.USE_GOOGLE_MAIL); + MOVED_TO_GLOBAL.add(Settings.Global.WEB_AUTOFILL_QUERY_URL); + MOVED_TO_GLOBAL.add(Settings.Global.WIFI_COUNTRY_CODE); + MOVED_TO_GLOBAL.add(Settings.Global.WIFI_FRAMEWORK_SCAN_INTERVAL_MS); + MOVED_TO_GLOBAL.add(Settings.Global.WIFI_FREQUENCY_BAND); + MOVED_TO_GLOBAL.add(Settings.Global.WIFI_IDLE_MS); + MOVED_TO_GLOBAL.add(Settings.Global.WIFI_MAX_DHCP_RETRY_COUNT); + MOVED_TO_GLOBAL.add(Settings.Global.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS); + MOVED_TO_GLOBAL.add(Settings.Global.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON); + MOVED_TO_GLOBAL.add(Settings.Global.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY); + MOVED_TO_GLOBAL.add(Settings.Global.WIFI_NUM_OPEN_NETWORKS_KEPT); + MOVED_TO_GLOBAL.add(Settings.Global.WIFI_ON); + MOVED_TO_GLOBAL.add(Settings.Global.WIFI_P2P_DEVICE_NAME); + MOVED_TO_GLOBAL.add(Settings.Global.WIFI_SAVED_STATE); + MOVED_TO_GLOBAL.add(Settings.Global.WIFI_SUPPLICANT_SCAN_INTERVAL_MS); + MOVED_TO_GLOBAL.add(Settings.Global.WIFI_SUSPEND_OPTIMIZATIONS_ENABLED); + MOVED_TO_GLOBAL.add(Settings.Global.WIFI_WATCHDOG_ON); + MOVED_TO_GLOBAL.add(Settings.Global.WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED); + MOVED_TO_GLOBAL.add(Settings.Global.WIMAX_NETWORKS_AVAILABLE_NOTIFICATION_ON); + MOVED_TO_GLOBAL.add(Settings.Global.PACKAGE_VERIFIER_ENABLE); + MOVED_TO_GLOBAL.add(Settings.Global.PACKAGE_VERIFIER_TIMEOUT); + MOVED_TO_GLOBAL.add(Settings.Global.PACKAGE_VERIFIER_DEFAULT_RESPONSE); + MOVED_TO_GLOBAL.add(Settings.Global.DATA_STALL_ALARM_NON_AGGRESSIVE_DELAY_IN_MS); + MOVED_TO_GLOBAL.add(Settings.Global.DATA_STALL_ALARM_AGGRESSIVE_DELAY_IN_MS); + MOVED_TO_GLOBAL.add(Settings.Global.GPRS_REGISTER_CHECK_PERIOD_MS); + MOVED_TO_GLOBAL.add(Settings.Global.WTF_IS_FATAL); + MOVED_TO_GLOBAL.add(Settings.Global.BATTERY_DISCHARGE_DURATION_THRESHOLD); + MOVED_TO_GLOBAL.add(Settings.Global.BATTERY_DISCHARGE_THRESHOLD); + MOVED_TO_GLOBAL.add(Settings.Global.SEND_ACTION_APP_ERROR); + MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_AGE_SECONDS); + MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_MAX_FILES); + MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_QUOTA_KB); + MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_QUOTA_PERCENT); + MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_RESERVE_PERCENT); + MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_TAG_PREFIX); + MOVED_TO_GLOBAL.add(Settings.Global.ERROR_LOGCAT_PREFIX); + MOVED_TO_GLOBAL.add(Settings.Global.SYS_FREE_STORAGE_LOG_INTERVAL); + MOVED_TO_GLOBAL.add(Settings.Global.DISK_FREE_CHANGE_REPORTING_THRESHOLD); + MOVED_TO_GLOBAL.add(Settings.Global.SYS_STORAGE_THRESHOLD_PERCENTAGE); + MOVED_TO_GLOBAL.add(Settings.Global.SYS_STORAGE_THRESHOLD_MAX_BYTES); + MOVED_TO_GLOBAL.add(Settings.Global.SYS_STORAGE_FULL_THRESHOLD_BYTES); + MOVED_TO_GLOBAL.add(Settings.Global.SYNC_MAX_RETRY_DELAY_IN_SECONDS); + MOVED_TO_GLOBAL.add(Settings.Global.CONNECTIVITY_CHANGE_DELAY); + MOVED_TO_GLOBAL.add(Settings.Global.CAPTIVE_PORTAL_DETECTION_ENABLED); + MOVED_TO_GLOBAL.add(Settings.Global.CAPTIVE_PORTAL_SERVER); + MOVED_TO_GLOBAL.add(Settings.Global.NSD_ON); + MOVED_TO_GLOBAL.add(Settings.Global.SET_INSTALL_LOCATION); + MOVED_TO_GLOBAL.add(Settings.Global.DEFAULT_INSTALL_LOCATION); + MOVED_TO_GLOBAL.add(Settings.Global.INET_CONDITION_DEBOUNCE_UP_DELAY); + MOVED_TO_GLOBAL.add(Settings.Global.INET_CONDITION_DEBOUNCE_DOWN_DELAY); + MOVED_TO_GLOBAL.add(Settings.Global.READ_EXTERNAL_STORAGE_ENFORCED_DEFAULT); + MOVED_TO_GLOBAL.add(Settings.Global.HTTP_PROXY); + MOVED_TO_GLOBAL.add(Settings.Global.GLOBAL_HTTP_PROXY_HOST); + MOVED_TO_GLOBAL.add(Settings.Global.GLOBAL_HTTP_PROXY_PORT); + MOVED_TO_GLOBAL.add(Settings.Global.GLOBAL_HTTP_PROXY_EXCLUSION_LIST); + MOVED_TO_GLOBAL.add(Settings.Global.SET_GLOBAL_HTTP_PROXY); + MOVED_TO_GLOBAL.add(Settings.Global.DEFAULT_DNS_SERVER); + MOVED_TO_GLOBAL.add(Settings.Global.PREFERRED_NETWORK_MODE); + MOVED_TO_GLOBAL.add(Settings.Global.PREFERRED_CDMA_SUBSCRIPTION); + } - /** - * When the number of open networks exceeds this number, the - * least-recently-used excess networks will be removed. - */ - public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = "wifi_num_open_networks_kept"; + /** @hide */ + public static void getMovedKeys(HashSet outKeySet) { + outKeySet.addAll(MOVED_TO_GLOBAL); + } /** - * Whether the Wi-Fi should be on. Only the Wi-Fi service should touch this. + * Look up a name in the database. + * @param resolver to access the database with + * @param name to look up in the table + * @return the corresponding value, or null if not present */ - public static final String WIFI_ON = "wifi_on"; + public static String getString(ContentResolver resolver, String name) { + return getStringForUser(resolver, name, UserHandle.myUserId()); + } - /** - * Used to save the Wifi_ON state prior to tethering. - * This state will be checked to restore Wifi after - * the user turns off tethering. - * - * @hide - */ - public static final String WIFI_SAVED_STATE = "wifi_saved_state"; + /** @hide */ + public static String getStringForUser(ContentResolver resolver, String name, + int userHandle) { + if (MOVED_TO_GLOBAL.contains(name)) { + Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Secure" + + " to android.provider.Settings.Global."); + return Global.getStringForUser(resolver, name, userHandle); + } - /** - * AP SSID - * - * @hide - */ - public static final String WIFI_AP_SSID = "wifi_ap_ssid"; + if (MOVED_TO_LOCK_SETTINGS.contains(name)) { + synchronized (Secure.class) { + if (sLockSettings == null) { + sLockSettings = ILockSettings.Stub.asInterface( + (IBinder) ServiceManager.getService("lock_settings")); + sIsSystemProcess = Process.myUid() == Process.SYSTEM_UID; + } + } + if (sLockSettings != null && !sIsSystemProcess) { + try { + return sLockSettings.getString(name, "0", userHandle); + } catch (RemoteException re) { + // Fall through + } + } + } - /** - * AP security - * - * @hide - */ - public static final String WIFI_AP_SECURITY = "wifi_ap_security"; + return sNameValueCache.getStringForUser(resolver, name, userHandle); + } /** - * AP passphrase - * - * @hide + * Store a name/value pair into the database. + * @param resolver to access the database with + * @param name to store + * @param value to associate with the name + * @return true if the value was set, false on database errors */ - public static final String WIFI_AP_PASSWD = "wifi_ap_passwd"; + public static boolean putString(ContentResolver resolver, String name, String value) { + return putStringForUser(resolver, name, value, UserHandle.myUserId()); + } - /** - * The acceptable packet loss percentage (range 0 - 100) before trying - * another AP on the same network. - */ - @Deprecated - public static final String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE = - "wifi_watchdog_acceptable_packet_loss_percentage"; + /** @hide */ + public static boolean putStringForUser(ContentResolver resolver, String name, String value, + int userHandle) { + if (MOVED_TO_GLOBAL.contains(name)) { + Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System" + + " to android.provider.Settings.Global"); + return Global.putStringForUser(resolver, name, value, userHandle); + } + return sNameValueCache.putStringForUser(resolver, name, value, userHandle); + } /** - * The number of access points required for a network in order for the - * watchdog to monitor it. + * Construct the content URI for a particular name/value pair, + * useful for monitoring changes with a ContentObserver. + * @param name to look up in the table + * @return the corresponding content URI, or null if not present */ - @Deprecated - public static final String WIFI_WATCHDOG_AP_COUNT = "wifi_watchdog_ap_count"; + public static Uri getUriFor(String name) { + if (MOVED_TO_GLOBAL.contains(name)) { + Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Secure" + + " to android.provider.Settings.Global, returning global URI."); + return Global.getUriFor(Global.CONTENT_URI, name); + } + return getUriFor(CONTENT_URI, name); + } /** - * The delay between background checks. + * Convenience function for retrieving a single secure settings value + * as an integer. Note that internally setting values are always + * stored as strings; this function converts the string to an integer + * for you. The default value will be returned if the setting is + * not defined or not an integer. + * + * @param cr The ContentResolver to access. + * @param name The name of the setting to retrieve. + * @param def Value to return if the setting is not defined. + * + * @return The setting's current value, or 'def' if it is not defined + * or not a valid integer. */ - @Deprecated - public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS = - "wifi_watchdog_background_check_delay_ms"; + public static int getInt(ContentResolver cr, String name, int def) { + return getIntForUser(cr, name, def, UserHandle.myUserId()); + } + + /** @hide */ + public static int getIntForUser(ContentResolver cr, String name, int def, int userHandle) { + String v = getStringForUser(cr, name, userHandle); + try { + return v != null ? Integer.parseInt(v) : def; + } catch (NumberFormatException e) { + return def; + } + } /** - * Whether the Wi-Fi watchdog is enabled for background checking even - * after it thinks the user has connected to a good access point. + * Convenience function for retrieving a single secure settings value + * as an integer. Note that internally setting values are always + * stored as strings; this function converts the string to an integer + * for you. + *

        + * This version does not take a default value. If the setting has not + * been set, or the string value is not a number, + * it throws {@link SettingNotFoundException}. + * + * @param cr The ContentResolver to access. + * @param name The name of the setting to retrieve. + * + * @throws SettingNotFoundException Thrown if a setting by the given + * name can't be found or the setting value is not an integer. + * + * @return The setting's current value. */ - @Deprecated - public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED = - "wifi_watchdog_background_check_enabled"; + public static int getInt(ContentResolver cr, String name) + throws SettingNotFoundException { + return getIntForUser(cr, name, UserHandle.myUserId()); + } + + /** @hide */ + public static int getIntForUser(ContentResolver cr, String name, int userHandle) + throws SettingNotFoundException { + String v = getStringForUser(cr, name, userHandle); + try { + return Integer.parseInt(v); + } catch (NumberFormatException e) { + throw new SettingNotFoundException(name); + } + } /** - * The timeout for a background ping + * Convenience function for updating a single settings value as an + * integer. This will either create a new entry in the table if the + * given name does not exist, or modify the value of the existing row + * with that name. Note that internally setting values are always + * stored as strings, so this function converts the given value to a + * string before storing it. + * + * @param cr The ContentResolver to access. + * @param name The name of the setting to modify. + * @param value The new value for the setting. + * @return true if the value was set, false on database errors */ - @Deprecated - public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS = - "wifi_watchdog_background_check_timeout_ms"; + public static boolean putInt(ContentResolver cr, String name, int value) { + return putIntForUser(cr, name, value, UserHandle.myUserId()); + } + + /** @hide */ + public static boolean putIntForUser(ContentResolver cr, String name, int value, + int userHandle) { + return putStringForUser(cr, name, Integer.toString(value), userHandle); + } /** - * The number of initial pings to perform that *may* be ignored if they - * fail. Again, if these fail, they will *not* be used in packet loss - * calculation. For example, one network always seemed to time out for - * the first couple pings, so this is set to 3 by default. + * Convenience function for retrieving a single secure settings value + * as a {@code long}. Note that internally setting values are always + * stored as strings; this function converts the string to a {@code long} + * for you. The default value will be returned if the setting is + * not defined or not a {@code long}. + * + * @param cr The ContentResolver to access. + * @param name The name of the setting to retrieve. + * @param def Value to return if the setting is not defined. + * + * @return The setting's current value, or 'def' if it is not defined + * or not a valid {@code long}. */ - @Deprecated - public static final String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT = - "wifi_watchdog_initial_ignored_ping_count"; + public static long getLong(ContentResolver cr, String name, long def) { + return getLongForUser(cr, name, def, UserHandle.myUserId()); + } + + /** @hide */ + public static long getLongForUser(ContentResolver cr, String name, long def, + int userHandle) { + String valString = getStringForUser(cr, name, userHandle); + long value; + try { + value = valString != null ? Long.parseLong(valString) : def; + } catch (NumberFormatException e) { + value = def; + } + return value; + } /** - * The maximum number of access points (per network) to attempt to test. - * If this number is reached, the watchdog will no longer monitor the - * initial connection state for the network. This is a safeguard for - * networks containing multiple APs whose DNS does not respond to pings. + * Convenience function for retrieving a single secure settings value + * as a {@code long}. Note that internally setting values are always + * stored as strings; this function converts the string to a {@code long} + * for you. + *

        + * This version does not take a default value. If the setting has not + * been set, or the string value is not a number, + * it throws {@link SettingNotFoundException}. + * + * @param cr The ContentResolver to access. + * @param name The name of the setting to retrieve. + * + * @return The setting's current value. + * @throws SettingNotFoundException Thrown if a setting by the given + * name can't be found or the setting value is not an integer. */ - @Deprecated - public static final String WIFI_WATCHDOG_MAX_AP_CHECKS = "wifi_watchdog_max_ap_checks"; + public static long getLong(ContentResolver cr, String name) + throws SettingNotFoundException { + return getLongForUser(cr, name, UserHandle.myUserId()); + } + + /** @hide */ + public static long getLongForUser(ContentResolver cr, String name, int userHandle) + throws SettingNotFoundException { + String valString = getStringForUser(cr, name, userHandle); + try { + return Long.parseLong(valString); + } catch (NumberFormatException e) { + throw new SettingNotFoundException(name); + } + } /** - * Whether the Wi-Fi watchdog is enabled. + * Convenience function for updating a secure settings value as a long + * integer. This will either create a new entry in the table if the + * given name does not exist, or modify the value of the existing row + * with that name. Note that internally setting values are always + * stored as strings, so this function converts the given value to a + * string before storing it. + * + * @param cr The ContentResolver to access. + * @param name The name of the setting to modify. + * @param value The new value for the setting. + * @return true if the value was set, false on database errors */ - public static final String WIFI_WATCHDOG_ON = "wifi_watchdog_on"; + public static boolean putLong(ContentResolver cr, String name, long value) { + return putLongForUser(cr, name, value, UserHandle.myUserId()); + } + + /** @hide */ + public static boolean putLongForUser(ContentResolver cr, String name, long value, + int userHandle) { + return putStringForUser(cr, name, Long.toString(value), userHandle); + } /** - * A comma-separated list of SSIDs for which the Wi-Fi watchdog should be enabled. + * Convenience function for retrieving a single secure settings value + * as a floating point number. Note that internally setting values are + * always stored as strings; this function converts the string to an + * float for you. The default value will be returned if the setting + * is not defined or not a valid float. + * + * @param cr The ContentResolver to access. + * @param name The name of the setting to retrieve. + * @param def Value to return if the setting is not defined. + * + * @return The setting's current value, or 'def' if it is not defined + * or not a valid float. */ - @Deprecated - public static final String WIFI_WATCHDOG_WATCH_LIST = "wifi_watchdog_watch_list"; + public static float getFloat(ContentResolver cr, String name, float def) { + return getFloatForUser(cr, name, def, UserHandle.myUserId()); + } + + /** @hide */ + public static float getFloatForUser(ContentResolver cr, String name, float def, + int userHandle) { + String v = getStringForUser(cr, name, userHandle); + try { + return v != null ? Float.parseFloat(v) : def; + } catch (NumberFormatException e) { + return def; + } + } /** - * The number of pings to test if an access point is a good connection. + * Convenience function for retrieving a single secure settings value + * as a float. Note that internally setting values are always + * stored as strings; this function converts the string to a float + * for you. + *

        + * This version does not take a default value. If the setting has not + * been set, or the string value is not a number, + * it throws {@link SettingNotFoundException}. + * + * @param cr The ContentResolver to access. + * @param name The name of the setting to retrieve. + * + * @throws SettingNotFoundException Thrown if a setting by the given + * name can't be found or the setting value is not a float. + * + * @return The setting's current value. */ - @Deprecated - public static final String WIFI_WATCHDOG_PING_COUNT = "wifi_watchdog_ping_count"; + public static float getFloat(ContentResolver cr, String name) + throws SettingNotFoundException { + return getFloatForUser(cr, name, UserHandle.myUserId()); + } + + /** @hide */ + public static float getFloatForUser(ContentResolver cr, String name, int userHandle) + throws SettingNotFoundException { + String v = getStringForUser(cr, name, userHandle); + if (v == null) { + throw new SettingNotFoundException(name); + } + try { + return Float.parseFloat(v); + } catch (NumberFormatException e) { + throw new SettingNotFoundException(name); + } + } /** - * The delay between pings. + * Convenience function for updating a single settings value as a + * floating point number. This will either create a new entry in the + * table if the given name does not exist, or modify the value of the + * existing row with that name. Note that internally setting values + * are always stored as strings, so this function converts the given + * value to a string before storing it. + * + * @param cr The ContentResolver to access. + * @param name The name of the setting to modify. + * @param value The new value for the setting. + * @return true if the value was set, false on database errors */ - @Deprecated - public static final String WIFI_WATCHDOG_PING_DELAY_MS = "wifi_watchdog_ping_delay_ms"; + public static boolean putFloat(ContentResolver cr, String name, float value) { + return putFloatForUser(cr, name, value, UserHandle.myUserId()); + } + + /** @hide */ + public static boolean putFloatForUser(ContentResolver cr, String name, float value, + int userHandle) { + return putStringForUser(cr, name, Float.toString(value), userHandle); + } /** - * The timeout per ping. + * @deprecated Use {@link android.provider.Settings.Global#DEVELOPMENT_SETTINGS_ENABLED} + * instead */ @Deprecated - public static final String WIFI_WATCHDOG_PING_TIMEOUT_MS = "wifi_watchdog_ping_timeout_ms"; + public static final String DEVELOPMENT_SETTINGS_ENABLED = + Global.DEVELOPMENT_SETTINGS_ENABLED; /** - * ms delay before rechecking an 'online' wifi connection when it is thought to be unstable. + * When the user has enable the option to have a "bug report" command + * in the power menu. * @hide */ - public static final String WIFI_WATCHDOG_ARP_CHECK_INTERVAL_MS = - "wifi_watchdog_arp_interval_ms"; + public static final String BUGREPORT_IN_POWER_MENU = "bugreport_in_power_menu"; /** - * ms delay interval between rssi polling when the signal is known to be weak - * @hide + * @deprecated Use {@link android.provider.Settings.Global#ADB_ENABLED} instead */ - public static final String WIFI_WATCHDOG_RSSI_FETCH_INTERVAL_MS = - "wifi_watchdog_rssi_fetch_interval_ms"; - + @Deprecated + public static final String ADB_ENABLED = Global.ADB_ENABLED; /** - * ms delay before rechecking a connect SSID for walled garden with a http download. + * The TCP/IP port to run ADB on, or -1 for USB * @hide */ - public static final String WIFI_WATCHDOG_WALLED_GARDEN_INTERVAL_MS = - "wifi_watchdog_walled_garden_interval_ms"; + public static final String ADB_PORT = "adb_port"; /** - * Number of ARP pings per check. + * Whether to display the ADB notification. * @hide */ - public static final String WIFI_WATCHDOG_NUM_ARP_PINGS = "wifi_watchdog_num_arp_pings"; + public static final String ADB_NOTIFY = "adb_notify"; /** - * Minimum number of responses to the arp pings to consider the test 'successful'. + * The hostname for this device * @hide */ - public static final String WIFI_WATCHDOG_MIN_ARP_RESPONSES = - "wifi_watchdog_min_arp_responses"; + public static final String DEVICE_HOSTNAME = "device_hostname"; /** - * Timeout on ARP pings - * @hide + * Setting to allow mock locations and location provider status to be injected into the + * LocationManager service for testing purposes during application development. These + * locations and status values override actual location and status information generated + * by network, gps, or other location providers. */ - public static final String WIFI_WATCHDOG_ARP_PING_TIMEOUT_MS = - "wifi_watchdog_arp_ping_timeout_ms"; + public static final String ALLOW_MOCK_LOCATION = "mock_location"; /** - * Setting to turn off poor network avoidance on Wi-Fi. Feature is enabled by default and - * the setting needs to be set to 0 to disable it. - * @hide + * A 64-bit number (as a hex string) that is randomly + * generated on the device's first boot and should remain + * constant for the lifetime of the device. (The value may + * change if a factory reset is performed on the device.) */ - public static final String WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED = - "wifi_watchdog_poor_network_test_enabled"; + public static final String ANDROID_ID = "android_id"; /** - * Setting to turn off walled garden test on Wi-Fi. Feature is enabled by default and - * the setting needs to be set to 0 to disable it. - * @hide + * @deprecated Use {@link android.provider.Settings.Global#BLUETOOTH_ON} instead */ - public static final String WIFI_WATCHDOG_WALLED_GARDEN_TEST_ENABLED = - "wifi_watchdog_walled_garden_test_enabled"; + @Deprecated + public static final String BLUETOOTH_ON = Global.BLUETOOTH_ON; /** - * The URL used for walled garden check upon a new conection. WifiWatchdogService - * fetches the URL and checks to see if {@link #WIFI_WATCHDOG_WALLED_GARDEN_PATTERN} - * is not part of the title string to notify the user on the presence of a walled garden. - * @hide + * @deprecated Use {@link android.provider.Settings.Global#DATA_ROAMING} instead */ - public static final String WIFI_WATCHDOG_WALLED_GARDEN_URL = - "wifi_watchdog_walled_garden_url"; + @Deprecated + public static final String DATA_ROAMING = Global.DATA_ROAMING; /** - * The maximum number of times we will retry a connection to an access - * point for which we have failed in acquiring an IP address from DHCP. - * A value of N means that we will make N+1 connection attempts in all. + * Setting to record the input method used by default, holding the ID + * of the desired method. */ - public static final String WIFI_MAX_DHCP_RETRY_COUNT = "wifi_max_dhcp_retry_count"; + public static final String DEFAULT_INPUT_METHOD = "default_input_method"; /** - * The operational wifi frequency band - * Set to one of {@link WifiManager#WIFI_FREQUENCY_BAND_AUTO}, - * {@link WifiManager#WIFI_FREQUENCY_BAND_5GHZ} or - * {@link WifiManager#WIFI_FREQUENCY_BAND_2GHZ} - * - * @hide + * Setting to record the input method subtype used by default, holding the ID + * of the desired method. */ - public static final String WIFI_FREQUENCY_BAND = "wifi_frequency_band"; + public static final String SELECTED_INPUT_METHOD_SUBTYPE = + "selected_input_method_subtype"; /** - * The Wi-Fi peer-to-peer device name + * Setting to record the history of input method subtype, holding the pair of ID of IME + * and its last used subtype. * @hide */ - public static final String WIFI_P2P_DEVICE_NAME = "wifi_p2p_device_name"; + public static final String INPUT_METHODS_SUBTYPE_HISTORY = + "input_methods_subtype_history"; /** - * Maximum amount of time in milliseconds to hold a wakelock while waiting for mobile - * data connectivity to be established after a disconnect from Wi-Fi. + * Setting to record the visibility of input method selector */ - public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS = - "wifi_mobile_data_transition_wakelock_timeout_ms"; + public static final String INPUT_METHOD_SELECTOR_VISIBILITY = + "input_method_selector_visibility"; /** - * Whether network service discovery is enabled. - * @hide + * @deprecated Use {@link android.provider.Settings.Global#DEVICE_PROVISIONED} instead */ - public static final String NSD_ON = "nsd_on"; + @Deprecated + public static final String DEVICE_PROVISIONED = Global.DEVICE_PROVISIONED; /** - * Whether background data usage is allowed by the user. See - * ConnectivityManager for more info. + * Whether the current user has been set up via setup wizard (0 = false, 1 = true) + * @hide */ - @Deprecated - public static final String BACKGROUND_DATA = "background_data"; + public static final String USER_SETUP_COMPLETE = "user_setup_complete"; /** - * Origins for which browsers should allow geolocation by default. - * The value is a space-separated list of origins. + * List of input methods that are currently enabled. This is a string + * containing the IDs of all enabled input methods, each ID separated + * by ':'. */ - public static final String ALLOWED_GEOLOCATION_ORIGINS - = "allowed_geolocation_origins"; + public static final String ENABLED_INPUT_METHODS = "enabled_input_methods"; /** - * Whether mobile data connections are allowed by the user. See - * ConnectivityManager for more info. + * List of system input methods that are currently disabled. This is a string + * containing the IDs of all disabled input methods, each ID separated + * by ':'. * @hide */ - public static final String MOBILE_DATA = "mobile_data"; + public static final String DISABLED_SYSTEM_INPUT_METHODS = "disabled_system_input_methods"; /** - * The CDMA roaming mode 0 = Home Networks, CDMA default - * 1 = Roaming on Affiliated networks - * 2 = Roaming on any networks - * @hide + * Host name and port for global http proxy. Uses ':' seperator for + * between host and port. + * + * @deprecated Use {@link Global#HTTP_PROXY} */ - public static final String CDMA_ROAMING_MODE = "roaming_settings"; + @Deprecated + public static final String HTTP_PROXY = Global.HTTP_PROXY; /** - * The CDMA subscription mode 0 = RUIM/SIM (default) - * 1 = NV - * @hide + * @deprecated Use {@link android.provider.Settings.Global#INSTALL_NON_MARKET_APPS} instead */ - public static final String CDMA_SUBSCRIPTION_MODE = "subscription_mode"; + @Deprecated + public static final String INSTALL_NON_MARKET_APPS = Global.INSTALL_NON_MARKET_APPS; /** - * The preferred network mode 7 = Global - * 6 = EvDo only - * 5 = CDMA w/o EvDo - * 4 = CDMA / EvDo auto - * 3 = GSM / WCDMA auto - * 2 = WCDMA only - * 1 = GSM only - * 0 = GSM / WCDMA preferred - * @hide + * Comma-separated list of location providers that activities may access. */ - public static final String PREFERRED_NETWORK_MODE = - "preferred_network_mode"; + public static final String LOCATION_PROVIDERS_ALLOWED = "location_providers_allowed"; /** - * The preferred TTY mode 0 = TTy Off, CDMA default - * 1 = TTY Full - * 2 = TTY HCO - * 3 = TTY VCO + * A flag containing settings used for biometric weak * @hide */ - public static final String PREFERRED_TTY_MODE = - "preferred_tty_mode"; - + public static final String LOCK_BIOMETRIC_WEAK_FLAGS = + "lock_biometric_weak_flags"; /** - * CDMA Cell Broadcast SMS - * 0 = CDMA Cell Broadcast SMS disabled - * 1 = CDMA Cell Broadcast SMS enabled - * @hide + * Whether autolock is enabled (0 = false, 1 = true) */ - public static final String CDMA_CELL_BROADCAST_SMS = - "cdma_cell_broadcast_sms"; + public static final String LOCK_PATTERN_ENABLED = "lock_pattern_autolock"; /** - * The cdma subscription 0 = Subscription from RUIM, when available - * 1 = Subscription from NV - * @hide + * Whether lock pattern is visible as user enters (0 = false, 1 = true) */ - public static final String PREFERRED_CDMA_SUBSCRIPTION = - "preferred_cdma_subscription"; + public static final String LOCK_PATTERN_VISIBLE = "lock_pattern_visible_pattern"; /** - * Whether the enhanced voice privacy mode is enabled. - * 0 = normal voice privacy - * 1 = enhanced voice privacy - * @hide + * Whether lock pattern will vibrate as user enters (0 = false, 1 = + * true) + * + * @deprecated Starting in {@link VERSION_CODES#JELLY_BEAN_MR1} the + * lockscreen uses + * {@link Settings.System#HAPTIC_FEEDBACK_ENABLED}. */ - public static final String ENHANCED_VOICE_PRIVACY_ENABLED = "enhanced_voice_privacy_enabled"; + @Deprecated + public static final String + LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED = "lock_pattern_tactile_feedback_enabled"; /** - * Whether the TTY mode mode is enabled. - * 0 = disabled - * 1 = enabled + * This preference allows the device to be locked given time after screen goes off, + * subject to current DeviceAdmin policy limits. * @hide */ - public static final String TTY_MODE_ENABLED = "tty_mode_enabled"; + public static final String LOCK_SCREEN_LOCK_AFTER_TIMEOUT = "lock_screen_lock_after_timeout"; - /** - * The number of milliseconds to delay before sending out Connectivyt Change broadcasts - * @hide - */ - public static final String CONNECTIVITY_CHANGE_DELAY = "connectivity_change_delay"; /** - * Default value for CONNECTIVITY_CHANGE_DELAY in milliseconds. + * This preference contains the string that shows for owner info on LockScreen. * @hide */ - public static final int CONNECTIVITY_CHANGE_DELAY_DEFAULT = 3000; + public static final String LOCK_SCREEN_OWNER_INFO = "lock_screen_owner_info"; /** - * Controls whether settings backup is enabled. - * Type: int ( 0 = disabled, 1 = enabled ) + * Ids of the user-selected appwidgets on the lockscreen (comma-delimited). * @hide */ - public static final String BACKUP_ENABLED = "backup_enabled"; + public static final String LOCK_SCREEN_APPWIDGET_IDS = + "lock_screen_appwidget_ids"; /** - * Controls whether application data is automatically restored from backup - * at install time. - * Type: int ( 0 = disabled, 1 = enabled ) + * Id of the appwidget shown on the lock screen when appwidgets are disabled. * @hide */ - public static final String BACKUP_AUTO_RESTORE = "backup_auto_restore"; + public static final String LOCK_SCREEN_FALLBACK_APPWIDGET_ID = + "lock_screen_fallback_appwidget_id"; /** - * Indicates whether settings backup has been fully provisioned. - * Type: int ( 0 = unprovisioned, 1 = fully provisioned ) + * Index of the lockscreen appwidget to restore, -1 if none. * @hide */ - public static final String BACKUP_PROVISIONED = "backup_provisioned"; + public static final String LOCK_SCREEN_STICKY_APPWIDGET = + "lock_screen_sticky_appwidget"; /** - * Component of the transport to use for backup/restore. + * This preference enables showing the owner info on LockScreen. * @hide */ - public static final String BACKUP_TRANSPORT = "backup_transport"; + public static final String LOCK_SCREEN_OWNER_INFO_ENABLED = + "lock_screen_owner_info_enabled"; /** - * Version for which the setup wizard was last shown. Bumped for - * each release when there is new setup information to show. + * Whether the unsecure widget screen will be shown before a secure + * lock screen * @hide */ - public static final String LAST_SETUP_SHOWN = "last_setup_shown"; - + public static final String LOCK_BEFORE_UNLOCK = + "lock_before_unlock"; /** - * How frequently (in seconds) to check the memory status of the - * device. - * @hide + * The Logging ID (a unique 64-bit value) as a hex string. + * Used as a pseudonymous identifier for logging. + * @deprecated This identifier is poorly initialized and has + * many collisions. It should not be used. */ - public static final String MEMCHECK_INTERVAL = "memcheck_interval"; + @Deprecated + public static final String LOGGING_ID = "logging_id"; /** - * Max frequency (in seconds) to log memory check stats, in realtime - * seconds. This allows for throttling of logs when the device is - * running for large amounts of time. - * @hide + * @deprecated Use {@link android.provider.Settings.Global#NETWORK_PREFERENCE} instead */ - public static final String MEMCHECK_LOG_REALTIME_INTERVAL = - "memcheck_log_realtime_interval"; + @Deprecated + public static final String NETWORK_PREFERENCE = Global.NETWORK_PREFERENCE; /** - * Boolean indicating whether rebooting due to system memory checks - * is enabled. - * @hide + * No longer supported. */ - public static final String MEMCHECK_SYSTEM_ENABLED = "memcheck_system_enabled"; + public static final String PARENTAL_CONTROL_ENABLED = "parental_control_enabled"; /** - * How many bytes the system process must be below to avoid scheduling - * a soft reboot. This reboot will happen when it is next determined - * to be a good time. - * @hide + * No longer supported. */ - public static final String MEMCHECK_SYSTEM_SOFT_THRESHOLD = "memcheck_system_soft"; + public static final String PARENTAL_CONTROL_LAST_UPDATE = "parental_control_last_update"; /** - * How many bytes the system process must be below to avoid scheduling - * a hard reboot. This reboot will happen immediately. - * @hide + * No longer supported. */ - public static final String MEMCHECK_SYSTEM_HARD_THRESHOLD = "memcheck_system_hard"; + public static final String PARENTAL_CONTROL_REDIRECT_URL = "parental_control_redirect_url"; /** - * How many bytes the phone process must be below to avoid scheduling - * a soft restart. This restart will happen when it is next determined - * to be a good time. - * @hide + * Settings classname to launch when Settings is clicked from All + * Applications. Needed because of user testing between the old + * and new Settings apps. */ - public static final String MEMCHECK_PHONE_SOFT_THRESHOLD = "memcheck_phone_soft"; + // TODO: 881807 + public static final String SETTINGS_CLASSNAME = "settings_classname"; /** - * How many bytes the phone process must be below to avoid scheduling - * a hard restart. This restart will happen immediately. - * @hide + * @deprecated Use {@link android.provider.Settings.Global#USB_MASS_STORAGE_ENABLED} instead */ - public static final String MEMCHECK_PHONE_HARD_THRESHOLD = "memcheck_phone_hard"; + @Deprecated + public static final String USB_MASS_STORAGE_ENABLED = Global.USB_MASS_STORAGE_ENABLED; /** - * Boolean indicating whether restarting the phone process due to - * memory checks is enabled. - * @hide + * @deprecated Use {@link android.provider.Settings.Global#USE_GOOGLE_MAIL} instead */ - public static final String MEMCHECK_PHONE_ENABLED = "memcheck_phone_enabled"; + @Deprecated + public static final String USE_GOOGLE_MAIL = Global.USE_GOOGLE_MAIL; /** - * First time during the day it is okay to kill processes - * or reboot the device due to low memory situations. This number is - * in seconds since midnight. - * @hide + * If accessibility is enabled. */ - public static final String MEMCHECK_EXEC_START_TIME = "memcheck_exec_start_time"; + public static final String ACCESSIBILITY_ENABLED = "accessibility_enabled"; /** - * Last time during the day it is okay to kill processes - * or reboot the device due to low memory situations. This number is - * in seconds since midnight. - * @hide + * If touch exploration is enabled. */ - public static final String MEMCHECK_EXEC_END_TIME = "memcheck_exec_end_time"; + public static final String TOUCH_EXPLORATION_ENABLED = "touch_exploration_enabled"; /** - * How long the screen must have been off in order to kill processes - * or reboot. This number is in seconds. A value of -1 means to - * entirely disregard whether the screen is on. - * @hide + * List of the enabled accessibility providers. */ - public static final String MEMCHECK_MIN_SCREEN_OFF = "memcheck_min_screen_off"; + public static final String ENABLED_ACCESSIBILITY_SERVICES = + "enabled_accessibility_services"; /** - * How much time there must be until the next alarm in order to kill processes - * or reboot. This number is in seconds. Note: this value must be - * smaller than {@link #MEMCHECK_RECHECK_INTERVAL} or else it will - * always see an alarm scheduled within its time. + * List of the accessibility services to which the user has granted + * permission to put the device into touch exploration mode. + * * @hide */ - public static final String MEMCHECK_MIN_ALARM = "memcheck_min_alarm"; + public static final String TOUCH_EXPLORATION_GRANTED_ACCESSIBILITY_SERVICES = + "touch_exploration_granted_accessibility_services"; /** - * How frequently to check whether it is a good time to restart things, - * if the device is in a bad state. This number is in seconds. Note: - * this value must be larger than {@link #MEMCHECK_MIN_ALARM} or else - * the alarm to schedule the recheck will always appear within the - * minimum "do not execute now" time. - * @hide + * Whether to speak passwords while in accessibility mode. */ - public static final String MEMCHECK_RECHECK_INTERVAL = "memcheck_recheck_interval"; + public static final String ACCESSIBILITY_SPEAK_PASSWORD = "speak_password"; /** - * How frequently (in DAYS) to reboot the device. If 0, no reboots - * will occur. + * If injection of accessibility enhancing JavaScript screen-reader + * is enabled. + *

        + * Note: The JavaScript based screen-reader is served by the + * Google infrastructure and enable users with disabilities to + * efficiently navigate in and explore web content. + *

        + *

        + * This property represents a boolean value. + *

        * @hide */ - public static final String REBOOT_INTERVAL = "reboot_interval"; + public static final String ACCESSIBILITY_SCRIPT_INJECTION = + "accessibility_script_injection"; /** - * First time during the day it is okay to force a reboot of the - * device (if REBOOT_INTERVAL is set). This number is - * in seconds since midnight. + * The URL for the injected JavaScript based screen-reader used + * for providing accessibility of content in WebView. + *

        + * Note: The JavaScript based screen-reader is served by the + * Google infrastructure and enable users with disabilities to + * efficiently navigate in and explore web content. + *

        + *

        + * This property represents a string value. + *

        * @hide */ - public static final String REBOOT_START_TIME = "reboot_start_time"; + public static final String ACCESSIBILITY_SCREEN_READER_URL = + "accessibility_script_injection_url"; /** - * The window of time (in seconds) after each REBOOT_INTERVAL in which - * a reboot can be executed. If 0, a reboot will always be executed at - * exactly the given time. Otherwise, it will only be executed if - * the device is idle within the window. + * Key bindings for navigation in built-in accessibility support for web content. + *

        + * Note: These key bindings are for the built-in accessibility navigation for + * web content which is used as a fall back solution if JavaScript in a WebView + * is not enabled or the user has not opted-in script injection from Google. + *

        + *

        + * The bindings are separated by semi-colon. A binding is a mapping from + * a key to a sequence of actions (for more details look at + * android.webkit.AccessibilityInjector). A key is represented as the hexademical + * string representation of an integer obtained from a meta state (optional) shifted + * sixteen times left and bitwise ored with a key code. An action is represented + * as a hexademical string representation of an integer where the first two digits + * are navigation action index, the second, the third, and the fourth digit pairs + * represent the action arguments. The separate actions in a binding are colon + * separated. The key and the action sequence it maps to are separated by equals. + *

        + *

        + * For example, the binding below maps the DPAD right button to traverse the + * current navigation axis once without firing an accessibility event and to + * perform the same traversal again but to fire an event: + * + * 0x16=0x01000100:0x01000101; + * + *

        + *

        + * The goal of this binding is to enable dynamic rebinding of keys to + * navigation actions for web content without requiring a framework change. + *

        + *

        + * This property represents a string value. + *

        * @hide */ - public static final String REBOOT_WINDOW = "reboot_window"; + public static final String ACCESSIBILITY_WEB_CONTENT_KEY_BINDINGS = + "accessibility_web_content_key_bindings"; /** - * Threshold values for the duration and level of a discharge cycle, under - * which we log discharge cycle info. + * Setting that specifies whether the display magnification is enabled. + * Display magnifications allows the user to zoom in the display content + * and is targeted to low vision users. The current magnification scale + * is controlled by {@link #ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE}. + * * @hide */ - public static final String BATTERY_DISCHARGE_DURATION_THRESHOLD = - "battery_discharge_duration_threshold"; - /** @hide */ - public static final String BATTERY_DISCHARGE_THRESHOLD = "battery_discharge_threshold"; + public static final String ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED = + "accessibility_display_magnification_enabled"; /** - * Flag for allowing ActivityManagerService to send ACTION_APP_ERROR intents - * on application crashes and ANRs. If this is disabled, the crash/ANR dialog - * will never display the "Report" button. - * Type: int ( 0 = disallow, 1 = allow ) + * Setting that specifies what the display magnification scale is. + * Display magnifications allows the user to zoom in the display + * content and is targeted to low vision users. Whether a display + * magnification is performed is controlled by + * {@link #ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED} + * * @hide */ - public static final String SEND_ACTION_APP_ERROR = "send_action_app_error"; + public static final String ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE = + "accessibility_display_magnification_scale"; /** - * Nonzero causes Log.wtf() to crash. + * Setting that specifies whether the display magnification should be + * automatically updated. If this fearture is enabled the system will + * exit magnification mode or pan the viewport when a context change + * occurs. For example, on staring a new activity or rotating the screen, + * the system may zoom out so the user can see the new context he is in. + * Another example is on showing a window that is not visible in the + * magnified viewport the system may pan the viewport to make the window + * the has popped up so the user knows that the context has changed. + * Whether a screen magnification is performed is controlled by + * {@link #ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED} + * * @hide */ - public static final String WTF_IS_FATAL = "wtf_is_fatal"; + public static final String ACCESSIBILITY_DISPLAY_MAGNIFICATION_AUTO_UPDATE = + "accessibility_display_magnification_auto_update"; /** - * Maximum age of entries kept by {@link com.android.internal.os.IDropBoxManagerService}. - * @hide - */ - public static final String DROPBOX_AGE_SECONDS = - "dropbox_age_seconds"; - /** - * Maximum number of entry files which {@link com.android.internal.os.IDropBoxManagerService} will keep around. - * @hide - */ - public static final String DROPBOX_MAX_FILES = - "dropbox_max_files"; - /** - * Maximum amount of disk space used by {@link com.android.internal.os.IDropBoxManagerService} no matter what. - * @hide - */ - public static final String DROPBOX_QUOTA_KB = - "dropbox_quota_kb"; - /** - * Percent of free disk (excluding reserve) which {@link com.android.internal.os.IDropBoxManagerService} will use. - * @hide - */ - public static final String DROPBOX_QUOTA_PERCENT = - "dropbox_quota_percent"; - /** - * Percent of total disk which {@link com.android.internal.os.IDropBoxManagerService} will never dip into. - * @hide - */ - public static final String DROPBOX_RESERVE_PERCENT = - "dropbox_reserve_percent"; - /** - * Prefix for per-tag dropbox disable/enable settings. - * @hide - */ - public static final String DROPBOX_TAG_PREFIX = - "dropbox:"; - /** - * Lines of logcat to include with system crash/ANR/etc. reports, - * as a prefix of the dropbox tag of the report type. - * For example, "logcat_for_system_server_anr" controls the lines - * of logcat captured with system server ANR reports. 0 to disable. + * The timout for considering a press to be a long press in milliseconds. * @hide */ - public static final String ERROR_LOGCAT_PREFIX = - "logcat_for_"; - + public static final String LONG_PRESS_TIMEOUT = "long_press_timeout"; /** - * Screen timeout in milliseconds corresponding to the - * PowerManager's POKE_LOCK_SHORT_TIMEOUT flag (i.e. the fastest - * possible screen timeout behavior.) - * @hide + * Setting to always use the default text-to-speech settings regardless + * of the application settings. + * 1 = override application settings, + * 0 = use application settings (if specified). + * + * @deprecated The value of this setting is no longer respected by + * the framework text to speech APIs as of the Ice Cream Sandwich release. */ - public static final String SHORT_KEYLIGHT_DELAY_MS = - "short_keylight_delay_ms"; + @Deprecated + public static final String TTS_USE_DEFAULTS = "tts_use_defaults"; /** - * The interval in minutes after which the amount of free storage left on the - * device is logged to the event log - * @hide + * Default text-to-speech engine speech rate. 100 = 1x */ - public static final String SYS_FREE_STORAGE_LOG_INTERVAL = - "sys_free_storage_log_interval"; + public static final String TTS_DEFAULT_RATE = "tts_default_rate"; /** - * Threshold for the amount of change in disk free space required to report the amount of - * free space. Used to prevent spamming the logs when the disk free space isn't changing - * frequently. - * @hide + * Default text-to-speech engine pitch. 100 = 1x */ - public static final String DISK_FREE_CHANGE_REPORTING_THRESHOLD = - "disk_free_change_reporting_threshold"; - + public static final String TTS_DEFAULT_PITCH = "tts_default_pitch"; /** - * Minimum percentage of free storage on the device that is used to determine if - * the device is running low on storage. The default is 10. - *

        Say this value is set to 10, the device is considered running low on storage - * if 90% or more of the device storage is filled up. - * @hide + * Default text-to-speech engine. */ - public static final String SYS_STORAGE_THRESHOLD_PERCENTAGE = - "sys_storage_threshold_percentage"; + public static final String TTS_DEFAULT_SYNTH = "tts_default_synth"; /** - * Maximum byte size of the low storage threshold. This is to ensure - * that {@link #SYS_STORAGE_THRESHOLD_PERCENTAGE} does not result in - * an overly large threshold for large storage devices. Currently this - * must be less than 2GB. This default is 500MB. - * @hide - */ - public static final String SYS_STORAGE_THRESHOLD_MAX_BYTES = - "sys_storage_threshold_max_bytes"; - + * Default text-to-speech language. + * + * @deprecated this setting is no longer in use, as of the Ice Cream + * Sandwich release. Apps should never need to read this setting directly, + * instead can query the TextToSpeech framework classes for the default + * locale. {@link TextToSpeech#getLanguage()}. + */ + @Deprecated + public static final String TTS_DEFAULT_LANG = "tts_default_lang"; + /** - * Minimum bytes of free storage on the device before the data - * partition is considered full. By default, 1 MB is reserved - * to avoid system-wide SQLite disk full exceptions. - * @hide + * Default text-to-speech country. + * + * @deprecated this setting is no longer in use, as of the Ice Cream + * Sandwich release. Apps should never need to read this setting directly, + * instead can query the TextToSpeech framework classes for the default + * locale. {@link TextToSpeech#getLanguage()}. */ - public static final String SYS_STORAGE_FULL_THRESHOLD_BYTES = - "sys_storage_full_threshold_bytes"; + @Deprecated + public static final String TTS_DEFAULT_COUNTRY = "tts_default_country"; /** - * The interval in milliseconds after which Wi-Fi is considered idle. - * When idle, it is possible for the device to be switched from Wi-Fi to - * the mobile data network. - * @hide + * Default text-to-speech locale variant. + * + * @deprecated this setting is no longer in use, as of the Ice Cream + * Sandwich release. Apps should never need to read this setting directly, + * instead can query the TextToSpeech framework classes for the + * locale that is in use {@link TextToSpeech#getLanguage()}. */ - public static final String WIFI_IDLE_MS = "wifi_idle_ms"; + @Deprecated + public static final String TTS_DEFAULT_VARIANT = "tts_default_variant"; /** - * The interval in milliseconds to issue wake up scans when wifi needs - * to connect. This is necessary to connect to an access point when - * device is on the move and the screen is off. + * Stores the default tts locales on a per engine basis. Stored as + * a comma seperated list of values, each value being of the form + * {@code engine_name:locale} for example, + * {@code com.foo.ttsengine:eng-USA,com.bar.ttsengine:esp-ESP}. This + * supersedes {@link #TTS_DEFAULT_LANG}, {@link #TTS_DEFAULT_COUNTRY} and + * {@link #TTS_DEFAULT_VARIANT}. Apps should never need to read this + * setting directly, and can query the TextToSpeech framework classes + * for the locale that is in use. + * * @hide */ - public static final String WIFI_FRAMEWORK_SCAN_INTERVAL_MS = - "wifi_framework_scan_interval_ms"; + public static final String TTS_DEFAULT_LOCALE = "tts_default_locale"; /** - * The interval in milliseconds to scan as used by the wifi supplicant - * @hide + * Space delimited list of plugin packages that are enabled. */ - public static final String WIFI_SUPPLICANT_SCAN_INTERVAL_MS = - "wifi_supplicant_scan_interval_ms"; + public static final String TTS_ENABLED_PLUGINS = "tts_enabled_plugins"; /** - * The interval in milliseconds at which to check packet counts on the - * mobile data interface when screen is on, to detect possible data - * connection problems. - * @hide + * @deprecated Use {@link android.provider.Settings.Global#WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON} + * instead. */ - public static final String PDP_WATCHDOG_POLL_INTERVAL_MS = - "pdp_watchdog_poll_interval_ms"; + @Deprecated + public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON = + Global.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON; /** - * The interval in milliseconds at which to check packet counts on the - * mobile data interface when screen is off, to detect possible data - * connection problems. - * @hide + * @deprecated Use {@link android.provider.Settings.Global#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} + * instead. */ - public static final String PDP_WATCHDOG_LONG_POLL_INTERVAL_MS = - "pdp_watchdog_long_poll_interval_ms"; + @Deprecated + public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY = + Global.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY; /** - * The interval in milliseconds at which to check packet counts on the - * mobile data interface after {@link #PDP_WATCHDOG_TRIGGER_PACKET_COUNT} - * outgoing packets has been reached without incoming packets. - * @hide + * @deprecated Use {@link android.provider.Settings.Global#WIFI_NUM_OPEN_NETWORKS_KEPT} + * instead. */ - public static final String PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS = - "pdp_watchdog_error_poll_interval_ms"; + @Deprecated + public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = + Global.WIFI_NUM_OPEN_NETWORKS_KEPT; /** - * The number of outgoing packets sent without seeing an incoming packet - * that triggers a countdown (of {@link #PDP_WATCHDOG_ERROR_POLL_COUNT} - * device is logged to the event log - * @hide + * @deprecated Use {@link android.provider.Settings.Global#WIFI_ON} + * instead. + */ + @Deprecated + public static final String WIFI_ON = Global.WIFI_ON; + + /** + * The acceptable packet loss percentage (range 0 - 100) before trying + * another AP on the same network. + * @deprecated This setting is not used. + */ + @Deprecated + public static final String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE = + "wifi_watchdog_acceptable_packet_loss_percentage"; + + /** + * The number of access points required for a network in order for the + * watchdog to monitor it. + * @deprecated This setting is not used. + */ + @Deprecated + public static final String WIFI_WATCHDOG_AP_COUNT = "wifi_watchdog_ap_count"; + + /** + * The delay between background checks. + * @deprecated This setting is not used. + */ + @Deprecated + public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS = + "wifi_watchdog_background_check_delay_ms"; + + /** + * Whether the Wi-Fi watchdog is enabled for background checking even + * after it thinks the user has connected to a good access point. + * @deprecated This setting is not used. + */ + @Deprecated + public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED = + "wifi_watchdog_background_check_enabled"; + + /** + * The timeout for a background ping + * @deprecated This setting is not used. + */ + @Deprecated + public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS = + "wifi_watchdog_background_check_timeout_ms"; + + /** + * The number of initial pings to perform that *may* be ignored if they + * fail. Again, if these fail, they will *not* be used in packet loss + * calculation. For example, one network always seemed to time out for + * the first couple pings, so this is set to 3 by default. + * @deprecated This setting is not used. + */ + @Deprecated + public static final String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT = + "wifi_watchdog_initial_ignored_ping_count"; + + /** + * The maximum number of access points (per network) to attempt to test. + * If this number is reached, the watchdog will no longer monitor the + * initial connection state for the network. This is a safeguard for + * networks containing multiple APs whose DNS does not respond to pings. + * @deprecated This setting is not used. + */ + @Deprecated + public static final String WIFI_WATCHDOG_MAX_AP_CHECKS = "wifi_watchdog_max_ap_checks"; + + /** + * @deprecated Use {@link android.provider.Settings.Global#WIFI_WATCHDOG_ON} instead + */ + @Deprecated + public static final String WIFI_WATCHDOG_ON = "wifi_watchdog_on"; + + /** + * A comma-separated list of SSIDs for which the Wi-Fi watchdog should be enabled. + * @deprecated This setting is not used. + */ + @Deprecated + public static final String WIFI_WATCHDOG_WATCH_LIST = "wifi_watchdog_watch_list"; + + /** + * The number of pings to test if an access point is a good connection. + * @deprecated This setting is not used. + */ + @Deprecated + public static final String WIFI_WATCHDOG_PING_COUNT = "wifi_watchdog_ping_count"; + + /** + * The delay between pings. + * @deprecated This setting is not used. + */ + @Deprecated + public static final String WIFI_WATCHDOG_PING_DELAY_MS = "wifi_watchdog_ping_delay_ms"; + + /** + * The timeout per ping. + * @deprecated This setting is not used. + */ + @Deprecated + public static final String WIFI_WATCHDOG_PING_TIMEOUT_MS = "wifi_watchdog_ping_timeout_ms"; + + /** + * @deprecated Use + * {@link android.provider.Settings.Global#WIFI_MAX_DHCP_RETRY_COUNT} instead + */ + @Deprecated + public static final String WIFI_MAX_DHCP_RETRY_COUNT = Global.WIFI_MAX_DHCP_RETRY_COUNT; + + /** + * @deprecated Use + * {@link android.provider.Settings.Global#WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS} instead */ - public static final String PDP_WATCHDOG_TRIGGER_PACKET_COUNT = - "pdp_watchdog_trigger_packet_count"; + @Deprecated + public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS = + Global.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS; /** - * The number of polls to perform (at {@link #PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS}) - * after hitting {@link #PDP_WATCHDOG_TRIGGER_PACKET_COUNT} before - * attempting data connection recovery. + * Whether the Wimax should be on. Only the WiMAX service should touch this. * @hide */ - public static final String PDP_WATCHDOG_ERROR_POLL_COUNT = - "pdp_watchdog_error_poll_count"; + public static final String WIMAX_ON = "wimax_on"; + + /** + * Whether background data usage is allowed. + * + * @deprecated As of {@link VERSION_CODES#ICE_CREAM_SANDWICH}, + * availability of background data depends on several + * combined factors. When background data is unavailable, + * {@link ConnectivityManager#getActiveNetworkInfo()} will + * now appear disconnected. + */ + @Deprecated + public static final String BACKGROUND_DATA = "background_data"; + + /** + * Origins for which browsers should allow geolocation by default. + * The value is a space-separated list of origins. + */ + public static final String ALLOWED_GEOLOCATION_ORIGINS + = "allowed_geolocation_origins"; /** - * The number of failed PDP reset attempts before moving to something more - * drastic: re-registering to the network. + * The preferred TTY mode 0 = TTy Off, CDMA default + * 1 = TTY Full + * 2 = TTY HCO + * 3 = TTY VCO * @hide */ - public static final String PDP_WATCHDOG_MAX_PDP_RESET_FAIL_COUNT = - "pdp_watchdog_max_pdp_reset_fail_count"; + public static final String PREFERRED_TTY_MODE = + "preferred_tty_mode"; /** - * The number of milliseconds to delay when checking for data stalls during - * non-aggressive detection. (screen is turned off.) + * Whether the enhanced voice privacy mode is enabled. + * 0 = normal voice privacy + * 1 = enhanced voice privacy * @hide */ - public static final String DATA_STALL_ALARM_NON_AGGRESSIVE_DELAY_IN_MS = - "data_stall_alarm_non_aggressive_delay_in_ms"; + public static final String ENHANCED_VOICE_PRIVACY_ENABLED = "enhanced_voice_privacy_enabled"; /** - * The number of milliseconds to delay when checking for data stalls during - * aggressive detection. (screen on or suspected data stall) + * Whether the TTY mode mode is enabled. + * 0 = disabled + * 1 = enabled * @hide */ - public static final String DATA_STALL_ALARM_AGGRESSIVE_DELAY_IN_MS = - "data_stall_alarm_aggressive_delay_in_ms"; + public static final String TTY_MODE_ENABLED = "tty_mode_enabled"; /** - * The interval in milliseconds at which to check gprs registration - * after the first registration mismatch of gprs and voice service, - * to detect possible data network registration problems. - * + * Controls whether settings backup is enabled. + * Type: int ( 0 = disabled, 1 = enabled ) * @hide */ - public static final String GPRS_REGISTER_CHECK_PERIOD_MS = - "gprs_register_check_period_ms"; + public static final String BACKUP_ENABLED = "backup_enabled"; /** - * The length of time in milli-seconds that automatic small adjustments to - * SystemClock are ignored if NITZ_UPDATE_DIFF is not exceeded. + * Controls whether application data is automatically restored from backup + * at install time. + * Type: int ( 0 = disabled, 1 = enabled ) * @hide */ - public static final String NITZ_UPDATE_SPACING = "nitz_update_spacing"; + public static final String BACKUP_AUTO_RESTORE = "backup_auto_restore"; /** - * If the NITZ_UPDATE_DIFF time is exceeded then an automatic adjustment - * to SystemClock will be allowed even if NITZ_UPDATE_SPACING has not been - * exceeded. + * Indicates whether settings backup has been fully provisioned. + * Type: int ( 0 = unprovisioned, 1 = fully provisioned ) * @hide */ - public static final String NITZ_UPDATE_DIFF = "nitz_update_diff"; + public static final String BACKUP_PROVISIONED = "backup_provisioned"; /** - * The maximum reconnect delay for short network outages or when the network is suspended - * due to phone use. + * Component of the transport to use for backup/restore. * @hide */ - public static final String SYNC_MAX_RETRY_DELAY_IN_SECONDS = - "sync_max_retry_delay_in_seconds"; + public static final String BACKUP_TRANSPORT = "backup_transport"; /** - * The interval in milliseconds at which to check the number of SMS sent - * out without asking for use permit, to limit the un-authorized SMS - * usage. + * Version for which the setup wizard was last shown. Bumped for + * each release when there is new setup information to show. * @hide */ - public static final String SMS_OUTGOING_CHECK_INTERVAL_MS = - "sms_outgoing_check_interval_ms"; + public static final String LAST_SETUP_SHOWN = "last_setup_shown"; /** - * The number of outgoing SMS sent without asking for user permit - * (of {@link #SMS_OUTGOING_CHECK_INTERVAL_MS} + * The interval in milliseconds after which Wi-Fi is considered idle. + * When idle, it is possible for the device to be switched from Wi-Fi to + * the mobile data network. * @hide + * @deprecated Use {@link android.provider.Settings.Global#WIFI_IDLE_MS} + * instead. */ - public static final String SMS_OUTGOING_CHECK_MAX_COUNT = - "sms_outgoing_check_max_count"; + @Deprecated + public static final String WIFI_IDLE_MS = Global.WIFI_IDLE_MS; /** * The global search provider chosen by the user (if multiple global @@ -4085,286 +4817,1643 @@ public static final String getBluetoothInputDevicePriorityKey(String address) { public static final String UI_NIGHT_MODE = "ui_night_mode"; /** - * Let user pick default install location. + * Whether screensavers are enabled. * @hide */ - public static final String SET_INSTALL_LOCATION = "set_install_location"; + public static final String SCREENSAVER_ENABLED = "screensaver_enabled"; /** - * Default install location value. - * 0 = auto, let system decide - * 1 = internal - * 2 = sdcard + * The user's chosen screensaver components. + * + * These will be launched by the PhoneWindowManager after a timeout when not on + * battery, or upon dock insertion (if SCREENSAVER_ACTIVATE_ON_DOCK is set to 1). * @hide */ - public static final String DEFAULT_INSTALL_LOCATION = "default_install_location"; + public static final String SCREENSAVER_COMPONENTS = "screensaver_components"; /** - * The bandwidth throttle polling freqency in seconds + * If screensavers are enabled, whether the screensaver should be automatically launched + * when the device is inserted into a (desk) dock. * @hide */ - public static final String THROTTLE_POLLING_SEC = "throttle_polling_sec"; + public static final String SCREENSAVER_ACTIVATE_ON_DOCK = "screensaver_activate_on_dock"; /** - * The bandwidth throttle threshold (long) + * If screensavers are enabled, whether the screensaver should be automatically launched + * when the screen times out when not on battery. * @hide */ - public static final String THROTTLE_THRESHOLD_BYTES = "throttle_threshold_bytes"; + public static final String SCREENSAVER_ACTIVATE_ON_SLEEP = "screensaver_activate_on_sleep"; /** - * The bandwidth throttle value (kbps) + * If screensavers are enabled, the default screensaver component. * @hide */ - public static final String THROTTLE_VALUE_KBITSPS = "throttle_value_kbitsps"; + public static final String SCREENSAVER_DEFAULT_COMPONENT = "screensaver_default_component"; /** - * The bandwidth throttle reset calendar day (1-28) + * Whether to allow killing of the foreground app by long-pressing the Back button * @hide */ - public static final String THROTTLE_RESET_DAY = "throttle_reset_day"; + public static final String KILL_APP_LONGPRESS_BACK = "kill_app_longpress_back"; /** - * The throttling notifications we should send + * This are the settings to be backed up. + * + * NOTE: Settings are backed up and restored in the order they appear + * in this array. If you have one setting depending on another, + * make sure that they are ordered appropriately. + * * @hide */ - public static final String THROTTLE_NOTIFICATION_TYPE = "throttle_notification_type"; + public static final String[] SETTINGS_TO_BACKUP = { + BUGREPORT_IN_POWER_MENU, + ALLOW_MOCK_LOCATION, + PARENTAL_CONTROL_ENABLED, + PARENTAL_CONTROL_REDIRECT_URL, + USB_MASS_STORAGE_ENABLED, // moved to global + ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED, + ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE, + ACCESSIBILITY_DISPLAY_MAGNIFICATION_AUTO_UPDATE, + ACCESSIBILITY_SCRIPT_INJECTION, + BACKUP_AUTO_RESTORE, + ENABLED_ACCESSIBILITY_SERVICES, + TOUCH_EXPLORATION_GRANTED_ACCESSIBILITY_SERVICES, + TOUCH_EXPLORATION_ENABLED, + ACCESSIBILITY_ENABLED, + ACCESSIBILITY_SPEAK_PASSWORD, + TTS_USE_DEFAULTS, + TTS_DEFAULT_RATE, + TTS_DEFAULT_PITCH, + TTS_DEFAULT_SYNTH, + TTS_DEFAULT_LANG, + TTS_DEFAULT_COUNTRY, + TTS_ENABLED_PLUGINS, + TTS_DEFAULT_LOCALE, + WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON, // moved to global + WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY, // moved to global + WIFI_NUM_OPEN_NETWORKS_KEPT, // moved to global + MOUNT_PLAY_NOTIFICATION_SND, + MOUNT_UMS_AUTOSTART, + MOUNT_UMS_PROMPT, + MOUNT_UMS_NOTIFY_ENABLED, + UI_NIGHT_MODE, + LOCK_SCREEN_OWNER_INFO, + LOCK_SCREEN_OWNER_INFO_ENABLED + }; /** - * Help URI for data throttling policy - * @hide + * Helper method for determining if a location provider is enabled. + * @param cr the content resolver to use + * @param provider the location provider to query + * @return true if the provider is enabled */ - public static final String THROTTLE_HELP_URI = "throttle_help_uri"; + public static final boolean isLocationProviderEnabled(ContentResolver cr, String provider) { + return isLocationProviderEnabledForUser(cr, provider, UserHandle.myUserId()); + } /** - * The length of time in Sec that we allow our notion of NTP time - * to be cached before we refresh it + * Helper method for determining if a location provider is enabled. + * @param cr the content resolver to use + * @param provider the location provider to query + * @param userId the userId to query + * @return true if the provider is enabled * @hide */ - public static final String THROTTLE_MAX_NTP_CACHE_AGE_SEC = - "throttle_max_ntp_cache_age_sec"; + public static final boolean isLocationProviderEnabledForUser(ContentResolver cr, String provider, int userId) { + String allowedProviders = Settings.Secure.getStringForUser(cr, + LOCATION_PROVIDERS_ALLOWED, userId); + return TextUtils.delimitedStringContains(allowedProviders, ',', provider); + } /** - * The maximum size, in bytes, of a download that the download manager will transfer over - * a non-wifi connection. - * @hide - */ - public static final String DOWNLOAD_MAX_BYTES_OVER_MOBILE = - "download_manager_max_bytes_over_mobile"; + * Thread-safe method for enabling or disabling a single location provider. + * @param cr the content resolver to use + * @param provider the location provider to enable or disable + * @param enabled true if the provider should be enabled + */ + public static final void setLocationProviderEnabled(ContentResolver cr, + String provider, boolean enabled) { + setLocationProviderEnabledForUser(cr, provider, enabled, UserHandle.myUserId()); + } /** - * The recommended maximum size, in bytes, of a download that the download manager should - * transfer over a non-wifi connection. Over this size, the use will be warned, but will - * have the option to start the download over the mobile connection anyway. + * Thread-safe method for enabling or disabling a single location provider. + * @param cr the content resolver to use + * @param provider the location provider to enable or disable + * @param enabled true if the provider should be enabled + * @param userId the userId for which to enable/disable providers * @hide */ - public static final String DOWNLOAD_RECOMMENDED_MAX_BYTES_OVER_MOBILE = - "download_manager_recommended_max_bytes_over_mobile"; + public static final void setLocationProviderEnabledForUser(ContentResolver cr, + String provider, boolean enabled, int userId) { + // to ensure thread safety, we write the provider name with a '+' or '-' + // and let the SettingsProvider handle it rather than reading and modifying + // the list of enabled providers. + if (enabled) { + provider = "+" + provider; + } else { + provider = "-" + provider; + } + putStringForUser(cr, Settings.Secure.LOCATION_PROVIDERS_ALLOWED, provider, + userId); + } + } + + /** + * Global system settings, containing preferences that always apply identically + * to all defined users. Applications can read these but are not allowed to write; + * like the "Secure" settings, these are for preferences that the user must + * explicitly modify through the system UI or specialized APIs for those values. + */ + public static final class Global extends NameValueTable { + public static final String SYS_PROP_SETTING_VERSION = "sys.settings_global_version"; /** - * ms during which to consume extra events related to Inet connection condition - * after a transtion to fully-connected - * @hide + * The content:// style URL for global secure settings items. Not public. */ - public static final String INET_CONDITION_DEBOUNCE_UP_DELAY = - "inet_condition_debounce_up_delay"; + public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/global"); /** - * ms during which to consume extra events related to Inet connection condtion - * after a transtion to partly-connected + * Setting whether the global gesture for enabling accessibility is enabled. + * If this gesture is enabled the user will be able to perfrom it to enable + * the accessibility state without visiting the settings app. * @hide */ - public static final String INET_CONDITION_DEBOUNCE_DOWN_DELAY = - "inet_condition_debounce_down_delay"; + public static final String ENABLE_ACCESSIBILITY_GLOBAL_GESTURE_ENABLED = + "enable_accessibility_global_gesture_enabled"; /** - * URL to open browser on to allow user to manage a prepay account - * @hide + * Whether Airplane Mode is on. */ - public static final String SETUP_PREPAID_DATA_SERVICE_URL = - "setup_prepaid_data_service_url"; + public static final String AIRPLANE_MODE_ON = "airplane_mode_on"; /** - * URL to attempt a GET on to see if this is a prepay device - * @hide + * Constant for use in AIRPLANE_MODE_RADIOS to specify Bluetooth radio. + */ + public static final String RADIO_BLUETOOTH = "bluetooth"; + + /** + * Constant for use in AIRPLANE_MODE_RADIOS to specify Wi-Fi radio. */ - public static final String SETUP_PREPAID_DETECTION_TARGET_URL = - "setup_prepaid_detection_target_url"; + public static final String RADIO_WIFI = "wifi"; /** - * Host to check for a redirect to after an attempt to GET - * SETUP_PREPAID_DETECTION_TARGET_URL. (If we redirected there, - * this is a prepaid device with zero balance.) - * @hide + * {@hide} + */ + public static final String RADIO_WIMAX = "wimax"; + /** + * Constant for use in AIRPLANE_MODE_RADIOS to specify Cellular radio. */ - public static final String SETUP_PREPAID_DETECTION_REDIR_HOST = - "setup_prepaid_detection_redir_host"; + public static final String RADIO_CELL = "cell"; /** - * Whether the screensaver is enabled. - * @hide + * Constant for use in AIRPLANE_MODE_RADIOS to specify NFC radio. */ - public static final String SCREENSAVER_ENABLED = "screensaver_enabled"; + public static final String RADIO_NFC = "nfc"; /** - * The user's chosen screensaver component. + * A comma separated list of radios that need to be disabled when airplane mode + * is on. This overrides WIFI_ON and BLUETOOTH_ON, if Wi-Fi and bluetooth are + * included in the comma separated list. + */ + public static final String AIRPLANE_MODE_RADIOS = "airplane_mode_radios"; + + /** + * A comma separated list of radios that should to be disabled when airplane mode + * is on, but can be manually reenabled by the user. For example, if RADIO_WIFI is + * added to both AIRPLANE_MODE_RADIOS and AIRPLANE_MODE_TOGGLEABLE_RADIOS, then Wifi + * will be turned off when entering airplane mode, but the user will be able to reenable + * Wifi in the Settings app. * - * This component will be launched by the PhoneWindowManager after a timeout when not on - * battery, or upon dock insertion (if SCREENSAVER_ACTIVATE_ON_DOCK is set to 1). + * {@hide} + */ + public static final String AIRPLANE_MODE_TOGGLEABLE_RADIOS = "airplane_mode_toggleable_radios"; + + /** + * The policy for deciding when Wi-Fi should go to sleep (which will in + * turn switch to using the mobile data as an Internet connection). + *

        + * Set to one of {@link #WIFI_SLEEP_POLICY_DEFAULT}, + * {@link #WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED}, or + * {@link #WIFI_SLEEP_POLICY_NEVER}. + */ + public static final String WIFI_SLEEP_POLICY = "wifi_sleep_policy"; + + /** + * Value for {@link #WIFI_SLEEP_POLICY} to use the default Wi-Fi sleep + * policy, which is to sleep shortly after the turning off + * according to the {@link #STAY_ON_WHILE_PLUGGED_IN} setting. + */ + public static final int WIFI_SLEEP_POLICY_DEFAULT = 0; + + /** + * Value for {@link #WIFI_SLEEP_POLICY} to use the default policy when + * the device is on battery, and never go to sleep when the device is + * plugged in. + */ + public static final int WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED = 1; + + /** + * Value for {@link #WIFI_SLEEP_POLICY} to never go to sleep. + */ + public static final int WIFI_SLEEP_POLICY_NEVER = 2; + + /** + * Value to specify if the user prefers the date, time and time zone + * to be automatically fetched from the network (NITZ). 1=yes, 0=no + */ + public static final String AUTO_TIME = "auto_time"; + + /** + * Value to specify if the user prefers the time zone + * to be automatically fetched from the network (NITZ). 1=yes, 0=no + */ + public static final String AUTO_TIME_ZONE = "auto_time_zone"; + + /** + * URI for the car dock "in" event sound. * @hide */ - public static final String SCREENSAVER_COMPONENT = "screensaver_component"; + public static final String CAR_DOCK_SOUND = "car_dock_sound"; /** - * Whether the screensaver should be automatically launched when the device is inserted - * into a (desk) dock. + * URI for the car dock "out" event sound. * @hide */ - public static final String SCREENSAVER_ACTIVATE_ON_DOCK = "screensaver_activate_on_dock"; + public static final String CAR_UNDOCK_SOUND = "car_undock_sound"; - /** {@hide} */ - public static final String NETSTATS_ENABLED = "netstats_enabled"; - /** {@hide} */ - public static final String NETSTATS_POLL_INTERVAL = "netstats_poll_interval"; - /** {@hide} */ - public static final String NETSTATS_TIME_CACHE_MAX_AGE = "netstats_time_cache_max_age"; - /** {@hide} */ - public static final String NETSTATS_GLOBAL_ALERT_BYTES = "netstats_global_alert_bytes"; - /** {@hide} */ - public static final String NETSTATS_SAMPLE_ENABLED = "netstats_sample_enabled"; - /** {@hide} */ - public static final String NETSTATS_REPORT_XT_OVER_DEV = "netstats_report_xt_over_dev"; + /** + * URI for the desk dock "in" event sound. + * @hide + */ + public static final String DESK_DOCK_SOUND = "desk_dock_sound"; - /** {@hide} */ - public static final String NETSTATS_DEV_BUCKET_DURATION = "netstats_dev_bucket_duration"; - /** {@hide} */ - public static final String NETSTATS_DEV_PERSIST_BYTES = "netstats_dev_persist_bytes"; - /** {@hide} */ - public static final String NETSTATS_DEV_ROTATE_AGE = "netstats_dev_rotate_age"; - /** {@hide} */ - public static final String NETSTATS_DEV_DELETE_AGE = "netstats_dev_delete_age"; + /** + * URI for the desk dock "out" event sound. + * @hide + */ + public static final String DESK_UNDOCK_SOUND = "desk_undock_sound"; - /** {@hide} */ - public static final String NETSTATS_UID_BUCKET_DURATION = "netstats_uid_bucket_duration"; - /** {@hide} */ - public static final String NETSTATS_UID_PERSIST_BYTES = "netstats_uid_persist_bytes"; - /** {@hide} */ - public static final String NETSTATS_UID_ROTATE_AGE = "netstats_uid_rotate_age"; - /** {@hide} */ - public static final String NETSTATS_UID_DELETE_AGE = "netstats_uid_delete_age"; + /** + * Whether to play a sound for dock events. + * @hide + */ + public static final String DOCK_SOUNDS_ENABLED = "dock_sounds_enabled"; - /** {@hide} */ - public static final String NETSTATS_UID_TAG_BUCKET_DURATION = "netstats_uid_tag_bucket_duration"; - /** {@hide} */ - public static final String NETSTATS_UID_TAG_PERSIST_BYTES = "netstats_uid_tag_persist_bytes"; - /** {@hide} */ - public static final String NETSTATS_UID_TAG_ROTATE_AGE = "netstats_uid_tag_rotate_age"; - /** {@hide} */ - public static final String NETSTATS_UID_TAG_DELETE_AGE = "netstats_uid_tag_delete_age"; + /** + * URI for the "device locked" (keyguard shown) sound. + * @hide + */ + public static final String LOCK_SOUND = "lock_sound"; - /** Preferred NTP server. {@hide} */ - public static final String NTP_SERVER = "ntp_server"; - /** Timeout in milliseconds to wait for NTP server. {@hide} */ - public static final String NTP_TIMEOUT = "ntp_timeout"; + /** + * URI for the "device unlocked" sound. + * @hide + */ + public static final String UNLOCK_SOUND = "unlock_sound"; - /** Autofill server address (Used in WebView/browser). {@hide} */ - public static final String WEB_AUTOFILL_QUERY_URL = - "web_autofill_query_url"; + /** + * URI for the low battery sound file. + * @hide + */ + public static final String LOW_BATTERY_SOUND = "low_battery_sound"; - /** Whether package verification is enabled. {@hide} */ - public static final String PACKAGE_VERIFIER_ENABLE = "verifier_enable"; + /** + * Whether to play a sound for low-battery alerts. + * @hide + */ + public static final String POWER_SOUNDS_ENABLED = "power_sounds_enabled"; - /** Timeout for package verification. {@hide} */ - public static final String PACKAGE_VERIFIER_TIMEOUT = "verifier_timeout"; + /** + * Whether we keep the device on while the device is plugged in. + * Supported values are: + *

          + *
        • {@code 0} to never stay on while plugged in
        • + *
        • {@link BatteryManager#BATTERY_PLUGGED_AC} to stay on for AC charger
        • + *
        • {@link BatteryManager#BATTERY_PLUGGED_USB} to stay on for USB charger
        • + *
        • {@link BatteryManager#BATTERY_PLUGGED_WIRELESS} to stay on for wireless charger
        • + *
        + * These values can be OR-ed together. + */ + public static final String STAY_ON_WHILE_PLUGGED_IN = "stay_on_while_plugged_in"; - /** {@hide} */ - public static final String - READ_EXTERNAL_STORAGE_ENFORCED_DEFAULT = "read_external_storage_enforced_default"; + /** + * Whether ADB is enabled. + */ + public static final String ADB_ENABLED = "adb_enabled"; /** - * Duration in milliseconds before pre-authorized URIs for the contacts - * provider should expire. + * Whether assisted GPS should be enabled or not. * @hide */ - public static final String CONTACTS_PREAUTH_URI_EXPIRATION = - "contacts_preauth_uri_expiration"; + public static final String ASSISTED_GPS_ENABLED = "assisted_gps_enabled"; /** - * Prefix for SMS short code regex patterns (country code is appended). - * @see com.android.internal.telephony.SmsUsageMonitor - * @hide + * Whether bluetooth is enabled/disabled + * 0=disabled. 1=enabled. */ - public static final String SMS_SHORT_CODES_PREFIX = "sms_short_codes_"; + public static final String BLUETOOTH_ON = "bluetooth_on"; /** - * This are the settings to be backed up. - * - * NOTE: Settings are backed up and restored in the order they appear - * in this array. If you have one setting depending on another, - * make sure that they are ordered appropriately. - * + * CDMA Cell Broadcast SMS + * 0 = CDMA Cell Broadcast SMS disabled + * 1 = CDMA Cell Broadcast SMS enabled * @hide */ - public static final String[] SETTINGS_TO_BACKUP = { - ADB_ENABLED, - ALLOW_MOCK_LOCATION, - PARENTAL_CONTROL_ENABLED, - PARENTAL_CONTROL_REDIRECT_URL, - USB_MASS_STORAGE_ENABLED, - ACCESSIBILITY_SCRIPT_INJECTION, - BACKUP_AUTO_RESTORE, - ENABLED_ACCESSIBILITY_SERVICES, - TOUCH_EXPLORATION_GRANTED_ACCESSIBILITY_SERVICES, - TOUCH_EXPLORATION_ENABLED, - ACCESSIBILITY_ENABLED, - ACCESSIBILITY_SPEAK_PASSWORD, - TTS_USE_DEFAULTS, - TTS_DEFAULT_RATE, - TTS_DEFAULT_PITCH, - TTS_DEFAULT_SYNTH, - TTS_DEFAULT_LANG, - TTS_DEFAULT_COUNTRY, - TTS_ENABLED_PLUGINS, - TTS_DEFAULT_LOCALE, - WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON, - WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY, - WIFI_NUM_OPEN_NETWORKS_KEPT, - MOUNT_PLAY_NOTIFICATION_SND, - MOUNT_UMS_AUTOSTART, - MOUNT_UMS_PROMPT, - MOUNT_UMS_NOTIFY_ENABLED, - UI_NIGHT_MODE, - LOCK_SCREEN_OWNER_INFO, - LOCK_SCREEN_OWNER_INFO_ENABLED - }; + public static final String CDMA_CELL_BROADCAST_SMS = + "cdma_cell_broadcast_sms"; /** - * Helper method for determining if a location provider is enabled. - * @param cr the content resolver to use - * @param provider the location provider to query - * @return true if the provider is enabled + * The CDMA roaming mode 0 = Home Networks, CDMA default + * 1 = Roaming on Affiliated networks + * 2 = Roaming on any networks + * @hide */ - public static final boolean isLocationProviderEnabled(ContentResolver cr, String provider) { - String allowedProviders = Settings.Secure.getString(cr, LOCATION_PROVIDERS_ALLOWED); - return TextUtils.delimitedStringContains(allowedProviders, ',', provider); - } + public static final String CDMA_ROAMING_MODE = "roaming_settings"; /** - * Thread-safe method for enabling or disabling a single location provider. - * @param cr the content resolver to use - * @param provider the location provider to enable or disable - * @param enabled true if the provider should be enabled + * The CDMA subscription mode 0 = RUIM/SIM (default) + * 1 = NV + * @hide */ - public static final void setLocationProviderEnabled(ContentResolver cr, - String provider, boolean enabled) { - // to ensure thread safety, we write the provider name with a '+' or '-' - // and let the SettingsProvider handle it rather than reading and modifying - // the list of enabled providers. - if (enabled) { - provider = "+" + provider; - } else { - provider = "-" + provider; + public static final String CDMA_SUBSCRIPTION_MODE = "subscription_mode"; + + /** Inactivity timeout to track mobile data activity. + * + * If set to a positive integer, it indicates the inactivity timeout value in seconds to + * infer the data activity of mobile network. After a period of no activity on mobile + * networks with length specified by the timeout, an {@code ACTION_DATA_ACTIVITY_CHANGE} + * intent is fired to indicate a transition of network status from "active" to "idle". Any + * subsequent activity on mobile networks triggers the firing of {@code + * ACTION_DATA_ACTIVITY_CHANGE} intent indicating transition from "idle" to "active". + * + * Network activity refers to transmitting or receiving data on the network interfaces. + * + * Tracking is disabled if set to zero or negative value. + * + * @hide + */ + public static final String DATA_ACTIVITY_TIMEOUT_MOBILE = "data_activity_timeout_mobile"; + + /** Timeout to tracking Wifi data activity. Same as {@code DATA_ACTIVITY_TIMEOUT_MOBILE} + * but for Wifi network. + * @hide + */ + public static final String DATA_ACTIVITY_TIMEOUT_WIFI = "data_activity_timeout_wifi"; + + /** + * Whether or not data roaming is enabled. (0 = false, 1 = true) + */ + public static final String DATA_ROAMING = "data_roaming"; + + /** + * Whether user has enabled development settings. + */ + public static final String DEVELOPMENT_SETTINGS_ENABLED = "development_settings_enabled"; + + /** + * Whether the device has been provisioned (0 = false, 1 = true) + */ + public static final String DEVICE_PROVISIONED = "device_provisioned"; + + /** + * The saved value for WindowManagerService.setForcedDisplayDensity(). + * One integer in dpi. If unset, then use the real display density. + * @hide + */ + public static final String DISPLAY_DENSITY_FORCED = "display_density_forced"; + + /** + * The saved value for WindowManagerService.setForcedDisplaySize(). + * Two integers separated by a comma. If unset, then use the real display size. + * @hide + */ + public static final String DISPLAY_SIZE_FORCED = "display_size_forced"; + + /** + * The maximum size, in bytes, of a download that the download manager will transfer over + * a non-wifi connection. + * @hide + */ + public static final String DOWNLOAD_MAX_BYTES_OVER_MOBILE = + "download_manager_max_bytes_over_mobile"; + + /** + * The recommended maximum size, in bytes, of a download that the download manager should + * transfer over a non-wifi connection. Over this size, the use will be warned, but will + * have the option to start the download over the mobile connection anyway. + * @hide + */ + public static final String DOWNLOAD_RECOMMENDED_MAX_BYTES_OVER_MOBILE = + "download_manager_recommended_max_bytes_over_mobile"; + + /** + * Whether the package installer should allow installation of apps downloaded from + * sources other than Google Play. + * + * 1 = allow installing from other sources + * 0 = only allow installing from Google Play + */ + public static final String INSTALL_NON_MARKET_APPS = "install_non_market_apps"; + + /** + * Whether mobile data connections are allowed by the user. See + * ConnectivityManager for more info. + * @hide + */ + public static final String MOBILE_DATA = "mobile_data"; + + /** {@hide} */ + public static final String NETSTATS_ENABLED = "netstats_enabled"; + /** {@hide} */ + public static final String NETSTATS_POLL_INTERVAL = "netstats_poll_interval"; + /** {@hide} */ + public static final String NETSTATS_TIME_CACHE_MAX_AGE = "netstats_time_cache_max_age"; + /** {@hide} */ + public static final String NETSTATS_GLOBAL_ALERT_BYTES = "netstats_global_alert_bytes"; + /** {@hide} */ + public static final String NETSTATS_SAMPLE_ENABLED = "netstats_sample_enabled"; + /** {@hide} */ + public static final String NETSTATS_REPORT_XT_OVER_DEV = "netstats_report_xt_over_dev"; + + /** {@hide} */ + public static final String NETSTATS_DEV_BUCKET_DURATION = "netstats_dev_bucket_duration"; + /** {@hide} */ + public static final String NETSTATS_DEV_PERSIST_BYTES = "netstats_dev_persist_bytes"; + /** {@hide} */ + public static final String NETSTATS_DEV_ROTATE_AGE = "netstats_dev_rotate_age"; + /** {@hide} */ + public static final String NETSTATS_DEV_DELETE_AGE = "netstats_dev_delete_age"; + + /** {@hide} */ + public static final String NETSTATS_UID_BUCKET_DURATION = "netstats_uid_bucket_duration"; + /** {@hide} */ + public static final String NETSTATS_UID_PERSIST_BYTES = "netstats_uid_persist_bytes"; + /** {@hide} */ + public static final String NETSTATS_UID_ROTATE_AGE = "netstats_uid_rotate_age"; + /** {@hide} */ + public static final String NETSTATS_UID_DELETE_AGE = "netstats_uid_delete_age"; + + /** {@hide} */ + public static final String NETSTATS_UID_TAG_BUCKET_DURATION = "netstats_uid_tag_bucket_duration"; + /** {@hide} */ + public static final String NETSTATS_UID_TAG_PERSIST_BYTES = "netstats_uid_tag_persist_bytes"; + /** {@hide} */ + public static final String NETSTATS_UID_TAG_ROTATE_AGE = "netstats_uid_tag_rotate_age"; + /** {@hide} */ + public static final String NETSTATS_UID_TAG_DELETE_AGE = "netstats_uid_tag_delete_age"; + + /** + * User preference for which network(s) should be used. Only the + * connectivity service should touch this. + */ + public static final String NETWORK_PREFERENCE = "network_preference"; + + /** + * If the NITZ_UPDATE_DIFF time is exceeded then an automatic adjustment + * to SystemClock will be allowed even if NITZ_UPDATE_SPACING has not been + * exceeded. + * @hide + */ + public static final String NITZ_UPDATE_DIFF = "nitz_update_diff"; + + /** + * The length of time in milli-seconds that automatic small adjustments to + * SystemClock are ignored if NITZ_UPDATE_DIFF is not exceeded. + * @hide + */ + public static final String NITZ_UPDATE_SPACING = "nitz_update_spacing"; + + /** Preferred NTP server. {@hide} */ + public static final String NTP_SERVER = "ntp_server"; + /** Timeout in milliseconds to wait for NTP server. {@hide} */ + public static final String NTP_TIMEOUT = "ntp_timeout"; + + /** + * Whether the package manager should send package verification broadcasts for verifiers to + * review apps prior to installation. + * 1 = request apps to be verified prior to installation, if a verifier exists. + * 0 = do not verify apps before installation + * @hide + */ + public static final String PACKAGE_VERIFIER_ENABLE = "package_verifier_enable"; + + /** Timeout for package verification. + * @hide */ + public static final String PACKAGE_VERIFIER_TIMEOUT = "verifier_timeout"; + + /** Default response code for package verification. + * @hide */ + public static final String PACKAGE_VERIFIER_DEFAULT_RESPONSE = "verifier_default_response"; + + /** + * Show package verification setting in the Settings app. + * 1 = show (default) + * 0 = hide + * @hide + */ + public static final String PACKAGE_VERIFIER_SETTING_VISIBLE = "verifier_setting_visible"; + + /** + * Run package verificaiton on apps installed through ADB/ADT/USB + * 1 = perform package verification on ADB installs (default) + * 0 = bypass package verification on ADB installs + * @hide + */ + public static final String PACKAGE_VERIFIER_INCLUDE_ADB = "verifier_verify_adb_installs"; + + /** + * The interval in milliseconds at which to check packet counts on the + * mobile data interface when screen is on, to detect possible data + * connection problems. + * @hide + */ + public static final String PDP_WATCHDOG_POLL_INTERVAL_MS = + "pdp_watchdog_poll_interval_ms"; + + /** + * The interval in milliseconds at which to check packet counts on the + * mobile data interface when screen is off, to detect possible data + * connection problems. + * @hide + */ + public static final String PDP_WATCHDOG_LONG_POLL_INTERVAL_MS = + "pdp_watchdog_long_poll_interval_ms"; + + /** + * The interval in milliseconds at which to check packet counts on the + * mobile data interface after {@link #PDP_WATCHDOG_TRIGGER_PACKET_COUNT} + * outgoing packets has been reached without incoming packets. + * @hide + */ + public static final String PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS = + "pdp_watchdog_error_poll_interval_ms"; + + /** + * The number of outgoing packets sent without seeing an incoming packet + * that triggers a countdown (of {@link #PDP_WATCHDOG_ERROR_POLL_COUNT} + * device is logged to the event log + * @hide + */ + public static final String PDP_WATCHDOG_TRIGGER_PACKET_COUNT = + "pdp_watchdog_trigger_packet_count"; + + /** + * The number of polls to perform (at {@link #PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS}) + * after hitting {@link #PDP_WATCHDOG_TRIGGER_PACKET_COUNT} before + * attempting data connection recovery. + * @hide + */ + public static final String PDP_WATCHDOG_ERROR_POLL_COUNT = + "pdp_watchdog_error_poll_count"; + + /** + * The number of failed PDP reset attempts before moving to something more + * drastic: re-registering to the network. + * @hide + */ + public static final String PDP_WATCHDOG_MAX_PDP_RESET_FAIL_COUNT = + "pdp_watchdog_max_pdp_reset_fail_count"; + + /** + * A positive value indicates how often the SamplingProfiler + * should take snapshots. Zero value means SamplingProfiler + * is disabled. + * + * @hide + */ + public static final String SAMPLING_PROFILER_MS = "sampling_profiler_ms"; + + /** + * URL to open browser on to allow user to manage a prepay account + * @hide + */ + public static final String SETUP_PREPAID_DATA_SERVICE_URL = + "setup_prepaid_data_service_url"; + + /** + * URL to attempt a GET on to see if this is a prepay device + * @hide + */ + public static final String SETUP_PREPAID_DETECTION_TARGET_URL = + "setup_prepaid_detection_target_url"; + + /** + * Host to check for a redirect to after an attempt to GET + * SETUP_PREPAID_DETECTION_TARGET_URL. (If we redirected there, + * this is a prepaid device with zero balance.) + * @hide + */ + public static final String SETUP_PREPAID_DETECTION_REDIR_HOST = + "setup_prepaid_detection_redir_host"; + + /** + * The interval in milliseconds at which to check the number of SMS sent out without asking + * for use permit, to limit the un-authorized SMS usage. + * + * @hide + */ + public static final String SMS_OUTGOING_CHECK_INTERVAL_MS = + "sms_outgoing_check_interval_ms"; + + /** + * The number of outgoing SMS sent without asking for user permit (of {@link + * #SMS_OUTGOING_CHECK_INTERVAL_MS} + * + * @hide + */ + public static final String SMS_OUTGOING_CHECK_MAX_COUNT = + "sms_outgoing_check_max_count"; + + /** + * Used to disable SMS short code confirmation - defaults to true. + * True indcates we will do the check, etc. Set to false to disable. + * @see com.android.internal.telephony.SmsUsageMonitor + * @hide + */ + public static final String SMS_SHORT_CODE_CONFIRMATION = "sms_short_code_confirmation"; + + /** + * Used to select which country we use to determine premium sms codes. + * One of com.android.internal.telephony.SMSDispatcher.PREMIUM_RULE_USE_SIM, + * com.android.internal.telephony.SMSDispatcher.PREMIUM_RULE_USE_NETWORK, + * or com.android.internal.telephony.SMSDispatcher.PREMIUM_RULE_USE_BOTH. + * @hide + */ + public static final String SMS_SHORT_CODE_RULE = "sms_short_code_rule"; + + /** + * Used to disable Tethering on a device - defaults to true + * @hide + */ + public static final String TETHER_SUPPORTED = "tether_supported"; + + /** + * Used to require DUN APN on the device or not - defaults to a build config value + * which defaults to false + * @hide + */ + public static final String TETHER_DUN_REQUIRED = "tether_dun_required"; + + /** + * Used to hold a gservices-provisioned apn value for DUN. If set, or the + * corresponding build config values are set it will override the APN DB + * values. + * Consists of a comma seperated list 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" + * @hide + */ + public static final String TETHER_DUN_APN = "tether_dun_apn"; + + /** + * The bandwidth throttle polling freqency in seconds + * @hide + */ + public static final String THROTTLE_POLLING_SEC = "throttle_polling_sec"; + + /** + * The bandwidth throttle threshold (long) + * @hide + */ + public static final String THROTTLE_THRESHOLD_BYTES = "throttle_threshold_bytes"; + + /** + * The bandwidth throttle value (kbps) + * @hide + */ + public static final String THROTTLE_VALUE_KBITSPS = "throttle_value_kbitsps"; + + /** + * The bandwidth throttle reset calendar day (1-28) + * @hide + */ + public static final String THROTTLE_RESET_DAY = "throttle_reset_day"; + + /** + * The throttling notifications we should send + * @hide + */ + public static final String THROTTLE_NOTIFICATION_TYPE = "throttle_notification_type"; + + /** + * Help URI for data throttling policy + * @hide + */ + public static final String THROTTLE_HELP_URI = "throttle_help_uri"; + + /** + * The length of time in Sec that we allow our notion of NTP time + * to be cached before we refresh it + * @hide + */ + public static final String THROTTLE_MAX_NTP_CACHE_AGE_SEC = + "throttle_max_ntp_cache_age_sec"; + + /** + * USB Mass Storage Enabled + */ + public static final String USB_MASS_STORAGE_ENABLED = "usb_mass_storage_enabled"; + + /** + * If this setting is set (to anything), then all references + * to Gmail on the device must change to Google Mail. + */ + public static final String USE_GOOGLE_MAIL = "use_google_mail"; + + /** Autofill server address (Used in WebView/browser). + * {@hide} */ + public static final String WEB_AUTOFILL_QUERY_URL = + "web_autofill_query_url"; + + /** + * Whether Wifi display is enabled/disabled + * 0=disabled. 1=enabled. + * @hide + */ + public static final String WIFI_DISPLAY_ON = "wifi_display_on"; + + /** + * Whether to notify the user of open networks. + *

        + * If not connected and the scan results have an open network, we will + * put this notification up. If we attempt to connect to a network or + * the open network(s) disappear, we remove the notification. When we + * show the notification, we will not show it again for + * {@link android.provider.Settings.Secure#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} time. + */ + public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON = + "wifi_networks_available_notification_on"; + /** + * {@hide} + */ + public static final String WIMAX_NETWORKS_AVAILABLE_NOTIFICATION_ON = + "wimax_networks_available_notification_on"; + + /** + * Delay (in seconds) before repeating the Wi-Fi networks available notification. + * Connecting to a network will reset the timer. + */ + public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY = + "wifi_networks_available_repeat_delay"; + + /** + * 802.11 country code in ISO 3166 format + * @hide + */ + public static final String WIFI_COUNTRY_CODE = "wifi_country_code"; + + /** + * The interval in milliseconds to issue wake up scans when wifi needs + * to connect. This is necessary to connect to an access point when + * device is on the move and the screen is off. + * @hide + */ + public static final String WIFI_FRAMEWORK_SCAN_INTERVAL_MS = + "wifi_framework_scan_interval_ms"; + + /** + * The interval in milliseconds after which Wi-Fi is considered idle. + * When idle, it is possible for the device to be switched from Wi-Fi to + * the mobile data network. + * @hide + */ + public static final String WIFI_IDLE_MS = "wifi_idle_ms"; + + /** + * When the number of open networks exceeds this number, the + * least-recently-used excess networks will be removed. + */ + public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = "wifi_num_open_networks_kept"; + + /** + * Whether the Wi-Fi should be on. Only the Wi-Fi service should touch this. + */ + public static final String WIFI_ON = "wifi_on"; + + /** + * Used to save the Wifi_ON state prior to tethering. + * This state will be checked to restore Wifi after + * the user turns off tethering. + * + * @hide + */ + public static final String WIFI_SAVED_STATE = "wifi_saved_state"; + + /** + * The interval in milliseconds to scan as used by the wifi supplicant + * @hide + */ + public static final String WIFI_SUPPLICANT_SCAN_INTERVAL_MS = + "wifi_supplicant_scan_interval_ms"; + + /** + * The interval in milliseconds to scan at supplicant when p2p is connected + * @hide + */ + public static final String WIFI_SCAN_INTERVAL_WHEN_P2P_CONNECTED_MS = + "wifi_scan_interval_p2p_connected_ms"; + + /** + * Whether the Wi-Fi watchdog is enabled. + */ + public static final String WIFI_WATCHDOG_ON = "wifi_watchdog_on"; + + /** + * Setting to turn off poor network avoidance on Wi-Fi. Feature is enabled by default and + * the setting needs to be set to 0 to disable it. + * @hide + */ + public static final String WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED = + "wifi_watchdog_poor_network_test_enabled"; + + /** + * Setting to turn on suspend optimizations at screen off on Wi-Fi. Enabled by default and + * needs to be set to 0 to disable it. + * @hide + */ + public static final String WIFI_SUSPEND_OPTIMIZATIONS_ENABLED = + "wifi_suspend_optimizations_enabled"; + + /** + * The maximum number of times we will retry a connection to an access + * point for which we have failed in acquiring an IP address from DHCP. + * A value of N means that we will make N+1 connection attempts in all. + */ + public static final String WIFI_MAX_DHCP_RETRY_COUNT = "wifi_max_dhcp_retry_count"; + + /** + * Maximum amount of time in milliseconds to hold a wakelock while waiting for mobile + * data connectivity to be established after a disconnect from Wi-Fi. + */ + public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS = + "wifi_mobile_data_transition_wakelock_timeout_ms"; + + /** + * The operational wifi frequency band + * Set to one of {@link WifiManager#WIFI_FREQUENCY_BAND_AUTO}, + * {@link WifiManager#WIFI_FREQUENCY_BAND_5GHZ} or + * {@link WifiManager#WIFI_FREQUENCY_BAND_2GHZ} + * + * @hide + */ + public static final String WIFI_FREQUENCY_BAND = "wifi_frequency_band"; + + /** + * The Wi-Fi peer-to-peer device name + * @hide + */ + public static final String WIFI_P2P_DEVICE_NAME = "wifi_p2p_device_name"; + + /** + * The number of milliseconds to delay when checking for data stalls during + * non-aggressive detection. (screen is turned off.) + * @hide + */ + public static final String DATA_STALL_ALARM_NON_AGGRESSIVE_DELAY_IN_MS = + "data_stall_alarm_non_aggressive_delay_in_ms"; + + /** + * The number of milliseconds to delay when checking for data stalls during + * aggressive detection. (screen on or suspected data stall) + * @hide + */ + public static final String DATA_STALL_ALARM_AGGRESSIVE_DELAY_IN_MS = + "data_stall_alarm_aggressive_delay_in_ms"; + + /** + * The interval in milliseconds at which to check gprs registration + * after the first registration mismatch of gprs and voice service, + * to detect possible data network registration problems. + * + * @hide + */ + public static final String GPRS_REGISTER_CHECK_PERIOD_MS = + "gprs_register_check_period_ms"; + + /** + * Nonzero causes Log.wtf() to crash. + * @hide + */ + public static final String WTF_IS_FATAL = "wtf_is_fatal"; + + /** + * Ringer mode. This is used internally, changing this value will not + * change the ringer mode. See AudioManager. + */ + public static final String MODE_RINGER = "mode_ringer"; + + /** + * Overlay display devices setting. + * The associated value is a specially formatted string that describes the + * size and density of simulated secondary display devices. + *

        + * Format: {width}x{height}/{dpi};... + *

        + * Example: + *

          + *
        • 1280x720/213: make one overlay that is 1280x720 at 213dpi.
        • + *
        • 1920x1080/320;1280x720/213: make two overlays, the first + * at 1080p and the second at 720p.
        • + *
        • If the value is empty, then no overlay display devices are created.
        • + *

        + * + * @hide + */ + public static final String OVERLAY_DISPLAY_DEVICES = "overlay_display_devices"; + + /** + * Threshold values for the duration and level of a discharge cycle, + * under which we log discharge cycle info. + * + * @hide + */ + public static final String + BATTERY_DISCHARGE_DURATION_THRESHOLD = "battery_discharge_duration_threshold"; + + /** @hide */ + public static final String BATTERY_DISCHARGE_THRESHOLD = "battery_discharge_threshold"; + + /** + * Flag for allowing ActivityManagerService to send ACTION_APP_ERROR + * intents on application crashes and ANRs. If this is disabled, the + * crash/ANR dialog will never display the "Report" button. + *

        + * Type: int (0 = disallow, 1 = allow) + * + * @hide + */ + public static final String SEND_ACTION_APP_ERROR = "send_action_app_error"; + + /** + * Maximum age of entries kept by {@link DropBoxManager}. + * + * @hide + */ + public static final String DROPBOX_AGE_SECONDS = "dropbox_age_seconds"; + + /** + * Maximum number of entry files which {@link DropBoxManager} will keep + * around. + * + * @hide + */ + public static final String DROPBOX_MAX_FILES = "dropbox_max_files"; + + /** + * Maximum amount of disk space used by {@link DropBoxManager} no matter + * what. + * + * @hide + */ + public static final String DROPBOX_QUOTA_KB = "dropbox_quota_kb"; + + /** + * Percent of free disk (excluding reserve) which {@link DropBoxManager} + * will use. + * + * @hide + */ + public static final String DROPBOX_QUOTA_PERCENT = "dropbox_quota_percent"; + + /** + * Percent of total disk which {@link DropBoxManager} will never dip + * into. + * + * @hide + */ + public static final String DROPBOX_RESERVE_PERCENT = "dropbox_reserve_percent"; + + /** + * Prefix for per-tag dropbox disable/enable settings. + * + * @hide + */ + public static final String DROPBOX_TAG_PREFIX = "dropbox:"; + + /** + * Lines of logcat to include with system crash/ANR/etc. reports, as a + * prefix of the dropbox tag of the report type. For example, + * "logcat_for_system_server_anr" controls the lines of logcat captured + * with system server ANR reports. 0 to disable. + * + * @hide + */ + public static final String ERROR_LOGCAT_PREFIX = "logcat_for_"; + + /** + * The interval in minutes after which the amount of free storage left + * on the device is logged to the event log + * + * @hide + */ + public static final String SYS_FREE_STORAGE_LOG_INTERVAL = "sys_free_storage_log_interval"; + + /** + * Threshold for the amount of change in disk free space required to + * report the amount of free space. Used to prevent spamming the logs + * when the disk free space isn't changing frequently. + * + * @hide + */ + public static final String + DISK_FREE_CHANGE_REPORTING_THRESHOLD = "disk_free_change_reporting_threshold"; + + /** + * Minimum percentage of free storage on the device that is used to + * determine if the device is running low on storage. The default is 10. + *

        + * Say this value is set to 10, the device is considered running low on + * storage if 90% or more of the device storage is filled up. + * + * @hide + */ + public static final String + SYS_STORAGE_THRESHOLD_PERCENTAGE = "sys_storage_threshold_percentage"; + + /** + * Maximum byte size of the low storage threshold. This is to ensure + * that {@link #SYS_STORAGE_THRESHOLD_PERCENTAGE} does not result in an + * overly large threshold for large storage devices. Currently this must + * be less than 2GB. This default is 500MB. + * + * @hide + */ + public static final String + SYS_STORAGE_THRESHOLD_MAX_BYTES = "sys_storage_threshold_max_bytes"; + + /** + * Minimum bytes of free storage on the device before the data partition + * is considered full. By default, 1 MB is reserved to avoid system-wide + * SQLite disk full exceptions. + * + * @hide + */ + public static final String + SYS_STORAGE_FULL_THRESHOLD_BYTES = "sys_storage_full_threshold_bytes"; + + /** + * The maximum reconnect delay for short network outages or when the + * network is suspended due to phone use. + * + * @hide + */ + public static final String + SYNC_MAX_RETRY_DELAY_IN_SECONDS = "sync_max_retry_delay_in_seconds"; + + /** + * The number of milliseconds to delay before sending out + * {@link ConnectivityManager#CONNECTIVITY_ACTION} broadcasts. + * + * @hide + */ + public static final String CONNECTIVITY_CHANGE_DELAY = "connectivity_change_delay"; + + /** + * Setting to turn off captive portal detection. Feature is enabled by + * default and the setting needs to be set to 0 to disable it. + * + * @hide + */ + public static final String + CAPTIVE_PORTAL_DETECTION_ENABLED = "captive_portal_detection_enabled"; + + /** + * The server used for captive portal detection upon a new conection. A + * 204 response code from the server is used for validation. + * + * @hide + */ + public static final String CAPTIVE_PORTAL_SERVER = "captive_portal_server"; + + /** + * Whether network service discovery is enabled. + * + * @hide + */ + public static final String NSD_ON = "nsd_on"; + + /** + * Let user pick default install location. + * + * @hide + */ + public static final String SET_INSTALL_LOCATION = "set_install_location"; + + /** + * Default install location value. + * 0 = auto, let system decide + * 1 = internal + * 2 = sdcard + * @hide + */ + public static final String DEFAULT_INSTALL_LOCATION = "default_install_location"; + + /** + * ms during which to consume extra events related to Inet connection + * condition after a transtion to fully-connected + * + * @hide + */ + public static final String + INET_CONDITION_DEBOUNCE_UP_DELAY = "inet_condition_debounce_up_delay"; + + /** + * ms during which to consume extra events related to Inet connection + * condtion after a transtion to partly-connected + * + * @hide + */ + public static final String + INET_CONDITION_DEBOUNCE_DOWN_DELAY = "inet_condition_debounce_down_delay"; + + /** {@hide} */ + public static final String + READ_EXTERNAL_STORAGE_ENFORCED_DEFAULT = "read_external_storage_enforced_default"; + + /** + * Host name and port for global http proxy. Uses ':' seperator for + * between host and port. + */ + public static final String HTTP_PROXY = "http_proxy"; + + /** + * Host name for global http proxy. Set via ConnectivityManager. + * + * @hide + */ + public static final String GLOBAL_HTTP_PROXY_HOST = "global_http_proxy_host"; + + /** + * Integer host port for global http proxy. Set via ConnectivityManager. + * + * @hide + */ + public static final String GLOBAL_HTTP_PROXY_PORT = "global_http_proxy_port"; + + /** + * Exclusion list for global proxy. This string contains a list of + * comma-separated domains where the global proxy does not apply. + * Domains should be listed in a comma- separated list. Example of + * acceptable formats: ".domain1.com,my.domain2.com" Use + * ConnectivityManager to set/get. + * + * @hide + */ + public static final String + GLOBAL_HTTP_PROXY_EXCLUSION_LIST = "global_http_proxy_exclusion_list"; + + /** + * Enables the UI setting to allow the user to specify the global HTTP + * proxy and associated exclusion list. + * + * @hide + */ + public static final String SET_GLOBAL_HTTP_PROXY = "set_global_http_proxy"; + + /** + * Setting for default DNS in case nobody suggests one + * + * @hide + */ + public static final String DEFAULT_DNS_SERVER = "default_dns_server"; + + /** {@hide} */ + public static final String + BLUETOOTH_HEADSET_PRIORITY_PREFIX = "bluetooth_headset_priority_"; + /** {@hide} */ + public static final String + BLUETOOTH_A2DP_SINK_PRIORITY_PREFIX = "bluetooth_a2dp_sink_priority_"; + /** {@hide} */ + public static final String + BLUETOOTH_INPUT_DEVICE_PRIORITY_PREFIX = "bluetooth_input_device_priority_"; + + /** + * Get the key that retrieves a bluetooth headset's priority. + * @hide + */ + public static final String getBluetoothHeadsetPriorityKey(String address) { + return BLUETOOTH_HEADSET_PRIORITY_PREFIX + address.toUpperCase(); + } + + /** + * Get the key that retrieves a bluetooth a2dp sink's priority. + * @hide + */ + public static final String getBluetoothA2dpSinkPriorityKey(String address) { + return BLUETOOTH_A2DP_SINK_PRIORITY_PREFIX + address.toUpperCase(); + } + + /** + * Get the key that retrieves a bluetooth Input Device's priority. + * @hide + */ + public static final String getBluetoothInputDevicePriorityKey(String address) { + return BLUETOOTH_INPUT_DEVICE_PRIORITY_PREFIX + address.toUpperCase(); + } + + /** + * Scaling factor for normal window animations. Setting to 0 will + * disable window animations. + */ + public static final String WINDOW_ANIMATION_SCALE = "window_animation_scale"; + + /** + * Scaling factor for activity transition animations. Setting to 0 will + * disable window animations. + */ + public static final String TRANSITION_ANIMATION_SCALE = "transition_animation_scale"; + + /** + * Scaling factor for Animator-based animations. This affects both the + * start delay and duration of all such animations. Setting to 0 will + * cause animations to end immediately. The default value is 1. + */ + public static final String ANIMATOR_DURATION_SCALE = "animator_duration_scale"; + + /** + * Scaling factor for normal window animations. Setting to 0 will + * disable window animations. + * + * @hide + */ + public static final String FANCY_IME_ANIMATIONS = "fancy_ime_animations"; + + /** + * If 0, the compatibility mode is off for all applications. + * If 1, older applications run under compatibility mode. + * TODO: remove this settings before code freeze (bug/1907571) + * @hide + */ + public static final String COMPATIBILITY_MODE = "compatibility_mode"; + + /** + * CDMA only settings + * Emergency Tone 0 = Off + * 1 = Alert + * 2 = Vibrate + * @hide + */ + public static final String EMERGENCY_TONE = "emergency_tone"; + + /** + * CDMA only settings + * Whether the auto retry is enabled. The value is + * boolean (1 or 0). + * @hide + */ + public static final String CALL_AUTO_RETRY = "call_auto_retry"; + + /** + * The preferred network mode 7 = Global + * 6 = EvDo only + * 5 = CDMA w/o EvDo + * 4 = CDMA / EvDo auto + * 3 = GSM / WCDMA auto + * 2 = WCDMA only + * 1 = GSM only + * 0 = GSM / WCDMA preferred + * @hide + */ + public static final String PREFERRED_NETWORK_MODE = + "preferred_network_mode"; + + /** + * The cdma subscription 0 = Subscription from RUIM, when available + * 1 = Subscription from NV + * @hide + */ + public static final String PREFERRED_CDMA_SUBSCRIPTION = + "preferred_cdma_subscription"; + + /** + * Name of an application package to be debugged. + */ + public static final String DEBUG_APP = "debug_app"; + + /** + * If 1, when launching DEBUG_APP it will wait for the debugger before + * starting user code. If 0, it will run normally. + */ + public static final String WAIT_FOR_DEBUGGER = "wait_for_debugger"; + + /** + * Control whether the process CPU usage meter should be shown. + */ + public static final String SHOW_PROCESSES = "show_processes"; + + /** + * If 1, the activity manager will aggressively finish activities and + * processes as soon as they are no longer needed. If 0, the normal + * extended lifetime is used. + */ + public static final String ALWAYS_FINISH_ACTIVITIES = + "always_finish_activities"; + + /** + * Use Dock audio output for media: + * 0 = disabled + * 1 = enabled + * @hide + */ + public static final String DOCK_AUDIO_MEDIA_ENABLED = "dock_audio_media_enabled"; + + /** + * Settings to backup. This is here so that it's in the same place as the settings + * keys and easy to update. + * + * These keys may be mentioned in the SETTINGS_TO_BACKUP arrays in System + * and Secure as well. This is because those tables drive both backup and + * restore, and restore needs to properly whitelist keys that used to live + * in those namespaces. The keys will only actually be backed up / restored + * if they are also mentioned in this table (Global.SETTINGS_TO_BACKUP). + * + * NOTE: Settings are backed up and restored in the order they appear + * in this array. If you have one setting depending on another, + * make sure that they are ordered appropriately. + * + * @hide + */ + public static final String[] SETTINGS_TO_BACKUP = { + STAY_ON_WHILE_PLUGGED_IN, + MODE_RINGER, + AUTO_TIME, + AUTO_TIME_ZONE, + POWER_SOUNDS_ENABLED, + DOCK_SOUNDS_ENABLED, + USB_MASS_STORAGE_ENABLED, + ENABLE_ACCESSIBILITY_GLOBAL_GESTURE_ENABLED, + WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON, + WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY, + WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED, + WIFI_NUM_OPEN_NETWORKS_KEPT, + EMERGENCY_TONE, + CALL_AUTO_RETRY, + DOCK_AUDIO_MEDIA_ENABLED + }; + + // Populated lazily, guarded by class object: + private static NameValueCache sNameValueCache = new NameValueCache( + SYS_PROP_SETTING_VERSION, + CONTENT_URI, + CALL_METHOD_GET_GLOBAL, + CALL_METHOD_PUT_GLOBAL); + + /** + * Look up a name in the database. + * @param resolver to access the database with + * @param name to look up in the table + * @return the corresponding value, or null if not present + */ + public static String getString(ContentResolver resolver, String name) { + return getStringForUser(resolver, name, UserHandle.myUserId()); + } + + /** @hide */ + public static String getStringForUser(ContentResolver resolver, String name, + int userHandle) { + return sNameValueCache.getStringForUser(resolver, name, userHandle); + } + + /** + * Store a name/value pair into the database. + * @param resolver to access the database with + * @param name to store + * @param value to associate with the name + * @return true if the value was set, false on database errors + */ + public static boolean putString(ContentResolver resolver, + String name, String value) { + return putStringForUser(resolver, name, value, UserHandle.myUserId()); + } + + /** @hide */ + public static boolean putStringForUser(ContentResolver resolver, + String name, String value, int userHandle) { + if (LOCAL_LOGV) { + Log.v(TAG, "Global.putString(name=" + name + ", value=" + value + + " for " + userHandle); + } + return sNameValueCache.putStringForUser(resolver, name, value, userHandle); + } + + /** + * Construct the content URI for a particular name/value pair, + * useful for monitoring changes with a ContentObserver. + * @param name to look up in the table + * @return the corresponding content URI, or null if not present + */ + public static Uri getUriFor(String name) { + return getUriFor(CONTENT_URI, name); + } + + /** + * Convenience function for retrieving a single secure settings value + * as an integer. Note that internally setting values are always + * stored as strings; this function converts the string to an integer + * for you. The default value will be returned if the setting is + * not defined or not an integer. + * + * @param cr The ContentResolver to access. + * @param name The name of the setting to retrieve. + * @param def Value to return if the setting is not defined. + * + * @return The setting's current value, or 'def' if it is not defined + * or not a valid integer. + */ + public static int getInt(ContentResolver cr, String name, int def) { + String v = getString(cr, name); + try { + return v != null ? Integer.parseInt(v) : def; + } catch (NumberFormatException e) { + return def; + } + } + + /** + * Convenience function for retrieving a single secure settings value + * as an integer. Note that internally setting values are always + * stored as strings; this function converts the string to an integer + * for you. + *

        + * This version does not take a default value. If the setting has not + * been set, or the string value is not a number, + * it throws {@link SettingNotFoundException}. + * + * @param cr The ContentResolver to access. + * @param name The name of the setting to retrieve. + * + * @throws SettingNotFoundException Thrown if a setting by the given + * name can't be found or the setting value is not an integer. + * + * @return The setting's current value. + */ + public static int getInt(ContentResolver cr, String name) + throws SettingNotFoundException { + String v = getString(cr, name); + try { + return Integer.parseInt(v); + } catch (NumberFormatException e) { + throw new SettingNotFoundException(name); + } + } + + /** + * Convenience function for updating a single settings value as an + * integer. This will either create a new entry in the table if the + * given name does not exist, or modify the value of the existing row + * with that name. Note that internally setting values are always + * stored as strings, so this function converts the given value to a + * string before storing it. + * + * @param cr The ContentResolver to access. + * @param name The name of the setting to modify. + * @param value The new value for the setting. + * @return true if the value was set, false on database errors + */ + public static boolean putInt(ContentResolver cr, String name, int value) { + return putString(cr, name, Integer.toString(value)); + } + + /** + * Convenience function for retrieving a single secure settings value + * as a {@code long}. Note that internally setting values are always + * stored as strings; this function converts the string to a {@code long} + * for you. The default value will be returned if the setting is + * not defined or not a {@code long}. + * + * @param cr The ContentResolver to access. + * @param name The name of the setting to retrieve. + * @param def Value to return if the setting is not defined. + * + * @return The setting's current value, or 'def' if it is not defined + * or not a valid {@code long}. + */ + public static long getLong(ContentResolver cr, String name, long def) { + String valString = getString(cr, name); + long value; + try { + value = valString != null ? Long.parseLong(valString) : def; + } catch (NumberFormatException e) { + value = def; + } + return value; + } + + /** + * Convenience function for retrieving a single secure settings value + * as a {@code long}. Note that internally setting values are always + * stored as strings; this function converts the string to a {@code long} + * for you. + *

        + * This version does not take a default value. If the setting has not + * been set, or the string value is not a number, + * it throws {@link SettingNotFoundException}. + * + * @param cr The ContentResolver to access. + * @param name The name of the setting to retrieve. + * + * @return The setting's current value. + * @throws SettingNotFoundException Thrown if a setting by the given + * name can't be found or the setting value is not an integer. + */ + public static long getLong(ContentResolver cr, String name) + throws SettingNotFoundException { + String valString = getString(cr, name); + try { + return Long.parseLong(valString); + } catch (NumberFormatException e) { + throw new SettingNotFoundException(name); + } + } + + /** + * Convenience function for updating a secure settings value as a long + * integer. This will either create a new entry in the table if the + * given name does not exist, or modify the value of the existing row + * with that name. Note that internally setting values are always + * stored as strings, so this function converts the given value to a + * string before storing it. + * + * @param cr The ContentResolver to access. + * @param name The name of the setting to modify. + * @param value The new value for the setting. + * @return true if the value was set, false on database errors + */ + public static boolean putLong(ContentResolver cr, String name, long value) { + return putString(cr, name, Long.toString(value)); + } + + /** + * Convenience function for retrieving a single secure settings value + * as a floating point number. Note that internally setting values are + * always stored as strings; this function converts the string to an + * float for you. The default value will be returned if the setting + * is not defined or not a valid float. + * + * @param cr The ContentResolver to access. + * @param name The name of the setting to retrieve. + * @param def Value to return if the setting is not defined. + * + * @return The setting's current value, or 'def' if it is not defined + * or not a valid float. + */ + public static float getFloat(ContentResolver cr, String name, float def) { + String v = getString(cr, name); + try { + return v != null ? Float.parseFloat(v) : def; + } catch (NumberFormatException e) { + return def; + } + } + + /** + * Convenience function for retrieving a single secure settings value + * as a float. Note that internally setting values are always + * stored as strings; this function converts the string to a float + * for you. + *

        + * This version does not take a default value. If the setting has not + * been set, or the string value is not a number, + * it throws {@link SettingNotFoundException}. + * + * @param cr The ContentResolver to access. + * @param name The name of the setting to retrieve. + * + * @throws SettingNotFoundException Thrown if a setting by the given + * name can't be found or the setting value is not a float. + * + * @return The setting's current value. + */ + public static float getFloat(ContentResolver cr, String name) + throws SettingNotFoundException { + String v = getString(cr, name); + if (v == null) { + throw new SettingNotFoundException(name); + } + try { + return Float.parseFloat(v); + } catch (NumberFormatException e) { + throw new SettingNotFoundException(name); } - putString(cr, Settings.Secure.LOCATION_PROVIDERS_ALLOWED, provider); + } + + /** + * Convenience function for updating a single settings value as a + * floating point number. This will either create a new entry in the + * table if the given name does not exist, or modify the value of the + * existing row with that name. Note that internally setting values + * are always stored as strings, so this function converts the given + * value to a string before storing it. + * + * @param cr The ContentResolver to access. + * @param name The name of the setting to modify. + * @param value The new value for the setting. + * @return true if the value was set, false on database errors + */ + public static boolean putFloat(ContentResolver cr, String name, float value) { + return putString(cr, name, Float.toString(value)); } } diff --git a/core/java/android/provider/Telephony.java b/core/java/android/provider/Telephony.java deleted file mode 100755 index 19d8d5c9a5091..0000000000000 --- a/core/java/android/provider/Telephony.java +++ /dev/null @@ -1,2037 +0,0 @@ -/* - * Copyright (C) 2006 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.provider; - -import android.annotation.SdkConstant; -import android.annotation.SdkConstant.SdkConstantType; -import android.content.ContentResolver; -import android.content.ContentValues; -import android.content.Context; -import android.content.Intent; -import android.database.Cursor; -import android.database.sqlite.SqliteWrapper; -import android.net.Uri; -import android.os.Environment; -import android.telephony.SmsMessage; -import android.text.TextUtils; -import android.util.Log; -import android.util.Patterns; - - -import java.util.HashSet; -import java.util.Set; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -/** - * The Telephony provider contains data related to phone operation. - * - * @hide - */ -public final class Telephony { - private static final String TAG = "Telephony"; - private static final boolean DEBUG = true; - private static final boolean LOCAL_LOGV = false; - - // Constructor - public Telephony() { - } - - /** - * Base columns for tables that contain text based SMSs. - */ - public interface TextBasedSmsColumns { - /** - * The type of the message - *

        Type: INTEGER

        - */ - public static final String TYPE = "type"; - - public static final int MESSAGE_TYPE_ALL = 0; - public static final int MESSAGE_TYPE_INBOX = 1; - public static final int MESSAGE_TYPE_SENT = 2; - public static final int MESSAGE_TYPE_DRAFT = 3; - public static final int MESSAGE_TYPE_OUTBOX = 4; - public static final int MESSAGE_TYPE_FAILED = 5; // for failed outgoing messages - public static final int MESSAGE_TYPE_QUEUED = 6; // for messages to send later - - - /** - * The thread ID of the message - *

        Type: INTEGER

        - */ - public static final String THREAD_ID = "thread_id"; - - /** - * The address of the other party - *

        Type: TEXT

        - */ - public static final String ADDRESS = "address"; - - /** - * The person ID of the sender - *

        Type: INTEGER (long)

        - */ - public static final String PERSON_ID = "person"; - - /** - * The date the message was received - *

        Type: INTEGER (long)

        - */ - public static final String DATE = "date"; - - /** - * The date the message was sent - *

        Type: INTEGER (long)

        - */ - public static final String DATE_SENT = "date_sent"; - - /** - * Has the message been read - *

        Type: INTEGER (boolean)

        - */ - public static final String READ = "read"; - - /** - * Indicates whether this message has been seen by the user. The "seen" flag will be - * used to figure out whether we need to throw up a statusbar notification or not. - */ - public static final String SEEN = "seen"; - - /** - * The TP-Status value for the message, or -1 if no status has - * been received - */ - public static final String STATUS = "status"; - - public static final int STATUS_NONE = -1; - public static final int STATUS_COMPLETE = 0; - public static final int STATUS_PENDING = 32; - public static final int STATUS_FAILED = 64; - - /** - * The subject of the message, if present - *

        Type: TEXT

        - */ - public static final String SUBJECT = "subject"; - - /** - * The body of the message - *

        Type: TEXT

        - */ - public static final String BODY = "body"; - - /** - * The id of the sender of the conversation, if present - *

        Type: INTEGER (reference to item in content://contacts/people)

        - */ - public static final String PERSON = "person"; - - /** - * The protocol identifier code - *

        Type: INTEGER

        - */ - public static final String PROTOCOL = "protocol"; - - /** - * Whether the TP-Reply-Path bit was set on this message - *

        Type: BOOLEAN

        - */ - public static final String REPLY_PATH_PRESENT = "reply_path_present"; - - /** - * The service center (SC) through which to send the message, if present - *

        Type: TEXT

        - */ - public static final String SERVICE_CENTER = "service_center"; - - /** - * Has the message been locked? - *

        Type: INTEGER (boolean)

        - */ - public static final String LOCKED = "locked"; - - /** - * Error code associated with sending or receiving this message - *

        Type: INTEGER

        - */ - public static final String ERROR_CODE = "error_code"; - - /** - * Meta data used externally. - *

        Type: TEXT

        - */ - public static final String META_DATA = "meta_data"; -} - - /** - * Contains all text based SMS messages. - */ - public static final class Sms implements BaseColumns, TextBasedSmsColumns { - public static final Cursor query(ContentResolver cr, String[] projection) { - return cr.query(CONTENT_URI, projection, null, null, DEFAULT_SORT_ORDER); - } - - public static final Cursor query(ContentResolver cr, String[] projection, - String where, String orderBy) { - return cr.query(CONTENT_URI, projection, where, - null, orderBy == null ? DEFAULT_SORT_ORDER : orderBy); - } - - /** - * The content:// style URL for this table - */ - public static final Uri CONTENT_URI = - Uri.parse("content://sms"); - - /** - * The default sort order for this table - */ - public static final String DEFAULT_SORT_ORDER = "date DESC"; - - /** - * Add an SMS to the given URI. - * - * @param resolver the content resolver to use - * @param uri the URI to add the message to - * @param address the address of the sender - * @param body the body of the message - * @param subject the psuedo-subject of the message - * @param date the timestamp for the message - * @param read true if the message has been read, false if not - * @param deliveryReport true if a delivery report was requested, false if not - * @return the URI for the new message - */ - public static Uri addMessageToUri(ContentResolver resolver, - Uri uri, String address, String body, String subject, - Long date, boolean read, boolean deliveryReport) { - return addMessageToUri(resolver, uri, address, body, subject, - date, read, deliveryReport, -1L); - } - - /** - * Add an SMS to the given URI with thread_id specified. - * - * @param resolver the content resolver to use - * @param uri the URI to add the message to - * @param address the address of the sender - * @param body the body of the message - * @param subject the psuedo-subject of the message - * @param date the timestamp for the message - * @param read true if the message has been read, false if not - * @param deliveryReport true if a delivery report was requested, false if not - * @param threadId the thread_id of the message - * @return the URI for the new message - */ - public static Uri addMessageToUri(ContentResolver resolver, - Uri uri, String address, String body, String subject, - Long date, boolean read, boolean deliveryReport, long threadId) { - ContentValues values = new ContentValues(7); - - values.put(ADDRESS, address); - if (date != null) { - values.put(DATE, date); - } - values.put(READ, read ? Integer.valueOf(1) : Integer.valueOf(0)); - values.put(SUBJECT, subject); - values.put(BODY, body); - if (deliveryReport) { - values.put(STATUS, STATUS_PENDING); - } - if (threadId != -1L) { - values.put(THREAD_ID, threadId); - } - return resolver.insert(uri, values); - } - - /** - * Move a message to the given folder. - * - * @param context the context to use - * @param uri the message to move - * @param folder the folder to move to - * @return true if the operation succeeded - */ - public static boolean moveMessageToFolder(Context context, - Uri uri, int folder, int error) { - if (uri == null) { - return false; - } - - boolean markAsUnread = false; - boolean markAsRead = false; - switch(folder) { - case MESSAGE_TYPE_INBOX: - case MESSAGE_TYPE_DRAFT: - break; - case MESSAGE_TYPE_OUTBOX: - case MESSAGE_TYPE_SENT: - markAsRead = true; - break; - case MESSAGE_TYPE_FAILED: - case MESSAGE_TYPE_QUEUED: - markAsUnread = true; - break; - default: - return false; - } - - ContentValues values = new ContentValues(3); - - values.put(TYPE, folder); - if (markAsUnread) { - values.put(READ, Integer.valueOf(0)); - } else if (markAsRead) { - values.put(READ, Integer.valueOf(1)); - } - values.put(ERROR_CODE, error); - - return 1 == SqliteWrapper.update(context, context.getContentResolver(), - uri, values, null, null); - } - - /** - * Returns true iff the folder (message type) identifies an - * outgoing message. - */ - public static boolean isOutgoingFolder(int messageType) { - return (messageType == MESSAGE_TYPE_FAILED) - || (messageType == MESSAGE_TYPE_OUTBOX) - || (messageType == MESSAGE_TYPE_SENT) - || (messageType == MESSAGE_TYPE_QUEUED); - } - - /** - * Contains all text based SMS messages in the SMS app's inbox. - */ - public static final class Inbox implements BaseColumns, TextBasedSmsColumns { - /** - * The content:// style URL for this table - */ - public static final Uri CONTENT_URI = - Uri.parse("content://sms/inbox"); - - /** - * The default sort order for this table - */ - public static final String DEFAULT_SORT_ORDER = "date DESC"; - - /** - * Add an SMS to the Draft box. - * - * @param resolver the content resolver to use - * @param address the address of the sender - * @param body the body of the message - * @param subject the psuedo-subject of the message - * @param date the timestamp for the message - * @param read true if the message has been read, false if not - * @return the URI for the new message - */ - public static Uri addMessage(ContentResolver resolver, - String address, String body, String subject, Long date, - boolean read) { - return addMessageToUri(resolver, CONTENT_URI, address, body, - subject, date, read, false); - } - } - - /** - * Contains all sent text based SMS messages in the SMS app's. - */ - public static final class Sent implements BaseColumns, TextBasedSmsColumns { - /** - * The content:// style URL for this table - */ - public static final Uri CONTENT_URI = - Uri.parse("content://sms/sent"); - - /** - * The default sort order for this table - */ - public static final String DEFAULT_SORT_ORDER = "date DESC"; - - /** - * Add an SMS to the Draft box. - * - * @param resolver the content resolver to use - * @param address the address of the sender - * @param body the body of the message - * @param subject the psuedo-subject of the message - * @param date the timestamp for the message - * @return the URI for the new message - */ - public static Uri addMessage(ContentResolver resolver, - String address, String body, String subject, Long date) { - return addMessageToUri(resolver, CONTENT_URI, address, body, - subject, date, true, false); - } - } - - /** - * Contains all sent text based SMS messages in the SMS app's. - */ - public static final class Draft implements BaseColumns, TextBasedSmsColumns { - /** - * The content:// style URL for this table - */ - public static final Uri CONTENT_URI = - Uri.parse("content://sms/draft"); - - /** - * The default sort order for this table - */ - public static final String DEFAULT_SORT_ORDER = "date DESC"; - - /** - * Add an SMS to the Draft box. - * - * @param resolver the content resolver to use - * @param address the address of the sender - * @param body the body of the message - * @param subject the psuedo-subject of the message - * @param date the timestamp for the message - * @return the URI for the new message - */ - public static Uri addMessage(ContentResolver resolver, - String address, String body, String subject, Long date) { - return addMessageToUri(resolver, CONTENT_URI, address, body, - subject, date, true, false); - } - - /** - * Save over an existing draft message. - * - * @param resolver the content resolver to use - * @param uri of existing message - * @param body the new body for the draft message - * @return true is successful, false otherwise - */ - public static boolean saveMessage(ContentResolver resolver, - Uri uri, String body) { - ContentValues values = new ContentValues(2); - values.put(BODY, body); - values.put(DATE, System.currentTimeMillis()); - return resolver.update(uri, values, null, null) == 1; - } - } - - /** - * Contains all pending outgoing text based SMS messages. - */ - public static final class Outbox implements BaseColumns, TextBasedSmsColumns { - /** - * The content:// style URL for this table - */ - public static final Uri CONTENT_URI = - Uri.parse("content://sms/outbox"); - - /** - * The default sort order for this table - */ - public static final String DEFAULT_SORT_ORDER = "date DESC"; - - /** - * Add an SMS to the Out box. - * - * @param resolver the content resolver to use - * @param address the address of the sender - * @param body the body of the message - * @param subject the psuedo-subject of the message - * @param date the timestamp for the message - * @param deliveryReport whether a delivery report was requested for the message - * @return the URI for the new message - */ - public static Uri addMessage(ContentResolver resolver, - String address, String body, String subject, Long date, - boolean deliveryReport, long threadId) { - return addMessageToUri(resolver, CONTENT_URI, address, body, - subject, date, true, deliveryReport, threadId); - } - } - - /** - * Contains all sent text-based SMS messages in the SMS app's. - */ - public static final class Conversations - implements BaseColumns, TextBasedSmsColumns { - /** - * The content:// style URL for this table - */ - public static final Uri CONTENT_URI = - Uri.parse("content://sms/conversations"); - - /** - * The default sort order for this table - */ - public static final String DEFAULT_SORT_ORDER = "date DESC"; - - /** - * The first 45 characters of the body of the message - *

        Type: TEXT

        - */ - public static final String SNIPPET = "snippet"; - - /** - * The number of messages in the conversation - *

        Type: INTEGER

        - */ - public static final String MESSAGE_COUNT = "msg_count"; - } - - /** - * Contains info about SMS related Intents that are broadcast. - */ - public static final class Intents { - /** - * Set by BroadcastReceiver. Indicates the message was handled - * successfully. - */ - public static final int RESULT_SMS_HANDLED = 1; - - /** - * Set by BroadcastReceiver. Indicates a generic error while - * processing the message. - */ - public static final int RESULT_SMS_GENERIC_ERROR = 2; - - /** - * Set by BroadcastReceiver. Indicates insufficient memory to store - * the message. - */ - public static final int RESULT_SMS_OUT_OF_MEMORY = 3; - - /** - * Set by BroadcastReceiver. Indicates the message, while - * possibly valid, is of a format or encoding that is not - * supported. - */ - public static final int RESULT_SMS_UNSUPPORTED = 4; - - /** - * Broadcast Action: A new text based SMS message has been received - * by the device. The intent will have the following extra - * values:

        - * - *
          - *
        • pdus - An Object[] od byte[]s containing the PDUs - * that make up the message.
        • - *
        - * - *

        The extra values can be extracted using - * {@link #getMessagesFromIntent(Intent)}.

        - * - *

        If a BroadcastReceiver encounters an error while processing - * this intent it should set the result code appropriately.

        - */ - @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) - public static final String SMS_RECEIVED_ACTION = - "android.provider.Telephony.SMS_RECEIVED"; - - /** - * Broadcast Action: A new data based SMS message has been received - * by the device. The intent will have the following extra - * values:

        - * - *
          - *
        • pdus - An Object[] of byte[]s containing the PDUs - * that make up the message.
        • - *
        - * - *

        The extra values can be extracted using - * {@link #getMessagesFromIntent(Intent)}.

        - * - *

        If a BroadcastReceiver encounters an error while processing - * this intent it should set the result code appropriately.

        - */ - @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) - public static final String DATA_SMS_RECEIVED_ACTION = - "android.intent.action.DATA_SMS_RECEIVED"; - - /** - * Broadcast Action: A new WAP PUSH message has been received by the - * device. The intent will have the following extra - * values:

        - * - *
          - *
        • transactionId (Integer) - The WAP transaction ID
        • - *
        • pduType (Integer) - The WAP PDU type
        • - *
        • header (byte[]) - The header of the message
        • - *
        • data (byte[]) - The data payload of the message
        • - *
        • contentTypeParameters (HashMap<String,String>) - * - Any parameters associated with the content type - * (decoded from the WSP Content-Type header)
        • - *
        - * - *

        If a BroadcastReceiver encounters an error while processing - * this intent it should set the result code appropriately.

        - * - *

        The contentTypeParameters extra value is map of content parameters keyed by - * their names.

        - * - *

        If any unassigned well-known parameters are encountered, the key of the map will - * be 'unassigned/0x...', where '...' is the hex value of the unassigned parameter. If - * a parameter has No-Value the value in the map will be null.

        - */ - @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) - public static final String WAP_PUSH_RECEIVED_ACTION = - "android.provider.Telephony.WAP_PUSH_RECEIVED"; - - /** - * Broadcast Action: A new Cell Broadcast message has been received - * by the device. The intent will have the following extra - * values:

        - * - *
          - *
        • message - An SmsCbMessage object containing the broadcast message - * data. This is not an emergency alert, so ETWS and CMAS data will be null.
        • - *
        - * - *

        The extra values can be extracted using - * {@link #getMessagesFromIntent(Intent)}.

        - * - *

        If a BroadcastReceiver encounters an error while processing - * this intent it should set the result code appropriately.

        - */ - @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) - public static final String SMS_CB_RECEIVED_ACTION = - "android.provider.Telephony.SMS_CB_RECEIVED"; - - /** - * Broadcast Action: A new Emergency Broadcast message has been received - * by the device. The intent will have the following extra - * values:

        - * - *
          - *
        • message - An SmsCbMessage object containing the broadcast message - * data, including ETWS or CMAS warning notification info if present.
        • - *
        - * - *

        The extra values can be extracted using - * {@link #getMessagesFromIntent(Intent)}.

        - * - *

        If a BroadcastReceiver encounters an error while processing - * this intent it should set the result code appropriately.

        - */ - @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) - public static final String SMS_EMERGENCY_CB_RECEIVED_ACTION = - "android.provider.Telephony.SMS_EMERGENCY_CB_RECEIVED"; - - /** - * Broadcast Action: A new CDMA SMS has been received containing Service Category - * Program Data (updates the list of enabled broadcast channels). The intent will - * have the following extra values:

        - * - *
          - *
        • operations - An array of CdmaSmsCbProgramData objects containing - * the service category operations (add/delete/clear) to perform.
        • - *
        - * - *

        The extra values can be extracted using - * {@link #getMessagesFromIntent(Intent)}.

        - * - *

        If a BroadcastReceiver encounters an error while processing - * this intent it should set the result code appropriately.

        - */ - @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) - public static final String SMS_SERVICE_CATEGORY_PROGRAM_DATA_RECEIVED_ACTION = - "android.provider.Telephony.SMS_SERVICE_CATEGORY_PROGRAM_DATA_RECEIVED"; - - /** - * Broadcast Action: The SIM storage for SMS messages is full. If - * space is not freed, messages targeted for the SIM (class 2) may - * not be saved. - */ - @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) - public static final String SIM_FULL_ACTION = - "android.provider.Telephony.SIM_FULL"; - - /** - * Broadcast Action: An incoming SMS has been rejected by the - * telephony framework. This intent is sent in lieu of any - * of the RECEIVED_ACTION intents. The intent will have the - * following extra value:

        - * - *
          - *
        • result - An int result code, eg, - * {@link #RESULT_SMS_OUT_OF_MEMORY}, - * indicating the error returned to the network.
        • - *
        - - */ - @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) - public static final String SMS_REJECTED_ACTION = - "android.provider.Telephony.SMS_REJECTED"; - - /** - * Read the PDUs out of an {@link #SMS_RECEIVED_ACTION} or a - * {@link #DATA_SMS_RECEIVED_ACTION} intent. - * - * @param intent the intent to read from - * @return an array of SmsMessages for the PDUs - */ - public static SmsMessage[] getMessagesFromIntent( - Intent intent) { - Object[] messages = (Object[]) intent.getSerializableExtra("pdus"); - String format = intent.getStringExtra("format"); - byte[][] pduObjs = new byte[messages.length][]; - - for (int i = 0; i < messages.length; i++) { - pduObjs[i] = (byte[]) messages[i]; - } - byte[][] pdus = new byte[pduObjs.length][]; - int pduCount = pdus.length; - SmsMessage[] msgs = new SmsMessage[pduCount]; - for (int i = 0; i < pduCount; i++) { - pdus[i] = pduObjs[i]; - msgs[i] = SmsMessage.createFromPdu(pdus[i], format); - } - return msgs; - } - } - } - - /** - * Base columns for tables that contain MMSs. - */ - public interface BaseMmsColumns extends BaseColumns { - - public static final int MESSAGE_BOX_ALL = 0; - public static final int MESSAGE_BOX_INBOX = 1; - public static final int MESSAGE_BOX_SENT = 2; - public static final int MESSAGE_BOX_DRAFTS = 3; - public static final int MESSAGE_BOX_OUTBOX = 4; - - /** - * The date the message was received. - *

        Type: INTEGER (long)

        - */ - public static final String DATE = "date"; - - /** - * The date the message was sent. - *

        Type: INTEGER (long)

        - */ - public static final String DATE_SENT = "date_sent"; - - /** - * The box which the message belong to, for example, MESSAGE_BOX_INBOX. - *

        Type: INTEGER

        - */ - public static final String MESSAGE_BOX = "msg_box"; - - /** - * Has the message been read. - *

        Type: INTEGER (boolean)

        - */ - public static final String READ = "read"; - - /** - * Indicates whether this message has been seen by the user. The "seen" flag will be - * used to figure out whether we need to throw up a statusbar notification or not. - */ - public static final String SEEN = "seen"; - - /** - * The Message-ID of the message. - *

        Type: TEXT

        - */ - public static final String MESSAGE_ID = "m_id"; - - /** - * The subject of the message, if present. - *

        Type: TEXT

        - */ - public static final String SUBJECT = "sub"; - - /** - * The character set of the subject, if present. - *

        Type: INTEGER

        - */ - public static final String SUBJECT_CHARSET = "sub_cs"; - - /** - * The Content-Type of the message. - *

        Type: TEXT

        - */ - public static final String CONTENT_TYPE = "ct_t"; - - /** - * The Content-Location of the message. - *

        Type: TEXT

        - */ - public static final String CONTENT_LOCATION = "ct_l"; - - /** - * The address of the sender. - *

        Type: TEXT

        - */ - public static final String FROM = "from"; - - /** - * The address of the recipients. - *

        Type: TEXT

        - */ - public static final String TO = "to"; - - /** - * The address of the cc. recipients. - *

        Type: TEXT

        - */ - public static final String CC = "cc"; - - /** - * The address of the bcc. recipients. - *

        Type: TEXT

        - */ - public static final String BCC = "bcc"; - - /** - * The expiry time of the message. - *

        Type: INTEGER

        - */ - public static final String EXPIRY = "exp"; - - /** - * The class of the message. - *

        Type: TEXT

        - */ - public static final String MESSAGE_CLASS = "m_cls"; - - /** - * The type of the message defined by MMS spec. - *

        Type: INTEGER

        - */ - public static final String MESSAGE_TYPE = "m_type"; - - /** - * The version of specification that this message conform. - *

        Type: INTEGER

        - */ - public static final String MMS_VERSION = "v"; - - /** - * The size of the message. - *

        Type: INTEGER

        - */ - public static final String MESSAGE_SIZE = "m_size"; - - /** - * The priority of the message. - *

        Type: TEXT

        - */ - public static final String PRIORITY = "pri"; - - /** - * The read-report of the message. - *

        Type: TEXT

        - */ - public static final String READ_REPORT = "rr"; - - /** - * Whether the report is allowed. - *

        Type: TEXT

        - */ - public static final String REPORT_ALLOWED = "rpt_a"; - - /** - * The response-status of the message. - *

        Type: INTEGER

        - */ - public static final String RESPONSE_STATUS = "resp_st"; - - /** - * The status of the message. - *

        Type: INTEGER

        - */ - public static final String STATUS = "st"; - - /** - * The transaction-id of the message. - *

        Type: TEXT

        - */ - public static final String TRANSACTION_ID = "tr_id"; - - /** - * The retrieve-status of the message. - *

        Type: INTEGER

        - */ - public static final String RETRIEVE_STATUS = "retr_st"; - - /** - * The retrieve-text of the message. - *

        Type: TEXT

        - */ - public static final String RETRIEVE_TEXT = "retr_txt"; - - /** - * The character set of the retrieve-text. - *

        Type: TEXT

        - */ - public static final String RETRIEVE_TEXT_CHARSET = "retr_txt_cs"; - - /** - * The read-status of the message. - *

        Type: INTEGER

        - */ - public static final String READ_STATUS = "read_status"; - - /** - * The content-class of the message. - *

        Type: INTEGER

        - */ - public static final String CONTENT_CLASS = "ct_cls"; - - /** - * The delivery-report of the message. - *

        Type: INTEGER

        - */ - public static final String DELIVERY_REPORT = "d_rpt"; - - /** - * The delivery-time-token of the message. - *

        Type: INTEGER

        - */ - public static final String DELIVERY_TIME_TOKEN = "d_tm_tok"; - - /** - * The delivery-time of the message. - *

        Type: INTEGER

        - */ - public static final String DELIVERY_TIME = "d_tm"; - - /** - * The response-text of the message. - *

        Type: TEXT

        - */ - public static final String RESPONSE_TEXT = "resp_txt"; - - /** - * The sender-visibility of the message. - *

        Type: TEXT

        - */ - public static final String SENDER_VISIBILITY = "s_vis"; - - /** - * The reply-charging of the message. - *

        Type: INTEGER

        - */ - public static final String REPLY_CHARGING = "r_chg"; - - /** - * The reply-charging-deadline-token of the message. - *

        Type: INTEGER

        - */ - public static final String REPLY_CHARGING_DEADLINE_TOKEN = "r_chg_dl_tok"; - - /** - * The reply-charging-deadline of the message. - *

        Type: INTEGER

        - */ - public static final String REPLY_CHARGING_DEADLINE = "r_chg_dl"; - - /** - * The reply-charging-id of the message. - *

        Type: TEXT

        - */ - public static final String REPLY_CHARGING_ID = "r_chg_id"; - - /** - * The reply-charging-size of the message. - *

        Type: INTEGER

        - */ - public static final String REPLY_CHARGING_SIZE = "r_chg_sz"; - - /** - * The previously-sent-by of the message. - *

        Type: TEXT

        - */ - public static final String PREVIOUSLY_SENT_BY = "p_s_by"; - - /** - * The previously-sent-date of the message. - *

        Type: INTEGER

        - */ - public static final String PREVIOUSLY_SENT_DATE = "p_s_d"; - - /** - * The store of the message. - *

        Type: TEXT

        - */ - public static final String STORE = "store"; - - /** - * The mm-state of the message. - *

        Type: INTEGER

        - */ - public static final String MM_STATE = "mm_st"; - - /** - * The mm-flags-token of the message. - *

        Type: INTEGER

        - */ - public static final String MM_FLAGS_TOKEN = "mm_flg_tok"; - - /** - * The mm-flags of the message. - *

        Type: TEXT

        - */ - public static final String MM_FLAGS = "mm_flg"; - - /** - * The store-status of the message. - *

        Type: TEXT

        - */ - public static final String STORE_STATUS = "store_st"; - - /** - * The store-status-text of the message. - *

        Type: TEXT

        - */ - public static final String STORE_STATUS_TEXT = "store_st_txt"; - - /** - * The stored of the message. - *

        Type: TEXT

        - */ - public static final String STORED = "stored"; - - /** - * The totals of the message. - *

        Type: TEXT

        - */ - public static final String TOTALS = "totals"; - - /** - * The mbox-totals of the message. - *

        Type: TEXT

        - */ - public static final String MBOX_TOTALS = "mb_t"; - - /** - * The mbox-totals-token of the message. - *

        Type: INTEGER

        - */ - public static final String MBOX_TOTALS_TOKEN = "mb_t_tok"; - - /** - * The quotas of the message. - *

        Type: TEXT

        - */ - public static final String QUOTAS = "qt"; - - /** - * The mbox-quotas of the message. - *

        Type: TEXT

        - */ - public static final String MBOX_QUOTAS = "mb_qt"; - - /** - * The mbox-quotas-token of the message. - *

        Type: INTEGER

        - */ - public static final String MBOX_QUOTAS_TOKEN = "mb_qt_tok"; - - /** - * The message-count of the message. - *

        Type: INTEGER

        - */ - public static final String MESSAGE_COUNT = "m_cnt"; - - /** - * The start of the message. - *

        Type: INTEGER

        - */ - public static final String START = "start"; - - /** - * The distribution-indicator of the message. - *

        Type: TEXT

        - */ - public static final String DISTRIBUTION_INDICATOR = "d_ind"; - - /** - * The element-descriptor of the message. - *

        Type: TEXT

        - */ - public static final String ELEMENT_DESCRIPTOR = "e_des"; - - /** - * The limit of the message. - *

        Type: INTEGER

        - */ - public static final String LIMIT = "limit"; - - /** - * The recommended-retrieval-mode of the message. - *

        Type: INTEGER

        - */ - public static final String RECOMMENDED_RETRIEVAL_MODE = "r_r_mod"; - - /** - * The recommended-retrieval-mode-text of the message. - *

        Type: TEXT

        - */ - public static final String RECOMMENDED_RETRIEVAL_MODE_TEXT = "r_r_mod_txt"; - - /** - * The status-text of the message. - *

        Type: TEXT

        - */ - public static final String STATUS_TEXT = "st_txt"; - - /** - * The applic-id of the message. - *

        Type: TEXT

        - */ - public static final String APPLIC_ID = "apl_id"; - - /** - * The reply-applic-id of the message. - *

        Type: TEXT

        - */ - public static final String REPLY_APPLIC_ID = "r_apl_id"; - - /** - * The aux-applic-id of the message. - *

        Type: TEXT

        - */ - public static final String AUX_APPLIC_ID = "aux_apl_id"; - - /** - * The drm-content of the message. - *

        Type: TEXT

        - */ - public static final String DRM_CONTENT = "drm_c"; - - /** - * The adaptation-allowed of the message. - *

        Type: TEXT

        - */ - public static final String ADAPTATION_ALLOWED = "adp_a"; - - /** - * The replace-id of the message. - *

        Type: TEXT

        - */ - public static final String REPLACE_ID = "repl_id"; - - /** - * The cancel-id of the message. - *

        Type: TEXT

        - */ - public static final String CANCEL_ID = "cl_id"; - - /** - * The cancel-status of the message. - *

        Type: INTEGER

        - */ - public static final String CANCEL_STATUS = "cl_st"; - - /** - * The thread ID of the message - *

        Type: INTEGER

        - */ - public static final String THREAD_ID = "thread_id"; - - /** - * Has the message been locked? - *

        Type: INTEGER (boolean)

        - */ - public static final String LOCKED = "locked"; - - /** - * Meta data used externally. - *

        Type: TEXT

        - */ - public static final String META_DATA = "meta_data"; - } - - /** - * Columns for the "canonical_addresses" table used by MMS and - * SMS." - */ - public interface CanonicalAddressesColumns extends BaseColumns { - /** - * An address used in MMS or SMS. Email addresses are - * converted to lower case and are compared by string - * equality. Other addresses are compared using - * PHONE_NUMBERS_EQUAL. - *

        Type: TEXT

        - */ - public static final String ADDRESS = "address"; - } - - /** - * Columns for the "threads" table used by MMS and SMS. - */ - public interface ThreadsColumns extends BaseColumns { - /** - * The date at which the thread was created. - * - *

        Type: INTEGER (long)

        - */ - public static final String DATE = "date"; - - /** - * A string encoding of the recipient IDs of the recipients of - * the message, in numerical order and separated by spaces. - *

        Type: TEXT

        - */ - public static final String RECIPIENT_IDS = "recipient_ids"; - - /** - * The message count of the thread. - *

        Type: INTEGER

        - */ - public static final String MESSAGE_COUNT = "message_count"; - /** - * Indicates whether all messages of the thread have been read. - *

        Type: INTEGER

        - */ - public static final String READ = "read"; - - /** - * The snippet of the latest message in the thread. - *

        Type: TEXT

        - */ - public static final String SNIPPET = "snippet"; - /** - * The charset of the snippet. - *

        Type: INTEGER

        - */ - public static final String SNIPPET_CHARSET = "snippet_cs"; - /** - * Type of the thread, either Threads.COMMON_THREAD or - * Threads.BROADCAST_THREAD. - *

        Type: INTEGER

        - */ - public static final String TYPE = "type"; - /** - * Indicates whether there is a transmission error in the thread. - *

        Type: INTEGER

        - */ - public static final String ERROR = "error"; - /** - * Indicates whether this thread contains any attachments. - *

        Type: INTEGER

        - */ - public static final String HAS_ATTACHMENT = "has_attachment"; - } - - /** - * Helper functions for the "threads" table used by MMS and SMS. - */ - public static final class Threads implements ThreadsColumns { - private static final String[] ID_PROJECTION = { BaseColumns._ID }; - private static final String STANDARD_ENCODING = "UTF-8"; - private static final Uri THREAD_ID_CONTENT_URI = Uri.parse( - "content://mms-sms/threadID"); - public static final Uri CONTENT_URI = Uri.withAppendedPath( - MmsSms.CONTENT_URI, "conversations"); - public static final Uri OBSOLETE_THREADS_URI = Uri.withAppendedPath( - CONTENT_URI, "obsolete"); - - public static final int COMMON_THREAD = 0; - public static final int BROADCAST_THREAD = 1; - - // No one should construct an instance of this class. - private Threads() { - } - - /** - * This is a single-recipient version of - * getOrCreateThreadId. It's convenient for use with SMS - * messages. - */ - public static long getOrCreateThreadId(Context context, String recipient) { - Set recipients = new HashSet(); - - recipients.add(recipient); - return getOrCreateThreadId(context, recipients); - } - - /** - * Given the recipients list and subject of an unsaved message, - * return its thread ID. If the message starts a new thread, - * allocate a new thread ID. Otherwise, use the appropriate - * existing thread ID. - * - * Find the thread ID of the same set of recipients (in - * any order, without any additions). If one - * is found, return it. Otherwise, return a unique thread ID. - */ - public static long getOrCreateThreadId( - Context context, Set recipients) { - Uri.Builder uriBuilder = THREAD_ID_CONTENT_URI.buildUpon(); - - for (String recipient : recipients) { - if (Mms.isEmailAddress(recipient)) { - recipient = Mms.extractAddrSpec(recipient); - } - - uriBuilder.appendQueryParameter("recipient", recipient); - } - - Uri uri = uriBuilder.build(); - //if (DEBUG) Log.v(TAG, "getOrCreateThreadId uri: " + uri); - - Cursor cursor = SqliteWrapper.query(context, context.getContentResolver(), - uri, ID_PROJECTION, null, null, null); - if (cursor != null) { - try { - if (cursor.moveToFirst()) { - return cursor.getLong(0); - } else { - Log.e(TAG, "getOrCreateThreadId returned no rows!"); - } - } finally { - cursor.close(); - } - } - - Log.e(TAG, "getOrCreateThreadId failed with uri " + uri.toString()); - throw new IllegalArgumentException("Unable to find or allocate a thread ID."); - } - } - - /** - * Contains all MMS messages. - */ - public static final class Mms implements BaseMmsColumns { - /** - * The content:// style URL for this table - */ - public static final Uri CONTENT_URI = Uri.parse("content://mms"); - - public static final Uri REPORT_REQUEST_URI = Uri.withAppendedPath( - CONTENT_URI, "report-request"); - - public static final Uri REPORT_STATUS_URI = Uri.withAppendedPath( - CONTENT_URI, "report-status"); - - /** - * The default sort order for this table - */ - public static final String DEFAULT_SORT_ORDER = "date DESC"; - - /** - * mailbox = name-addr - * name-addr = [display-name] angle-addr - * angle-addr = [CFWS] "<" addr-spec ">" [CFWS] - */ - public static final Pattern NAME_ADDR_EMAIL_PATTERN = - Pattern.compile("\\s*(\"[^\"]*\"|[^<>\"]+)\\s*<([^<>]+)>\\s*"); - - /** - * quoted-string = [CFWS] - * DQUOTE *([FWS] qcontent) [FWS] DQUOTE - * [CFWS] - */ - public static final Pattern QUOTED_STRING_PATTERN = - Pattern.compile("\\s*\"([^\"]*)\"\\s*"); - - public static final Cursor query( - ContentResolver cr, String[] projection) { - return cr.query(CONTENT_URI, projection, null, null, DEFAULT_SORT_ORDER); - } - - public static final Cursor query( - ContentResolver cr, String[] projection, - String where, String orderBy) { - return cr.query(CONTENT_URI, projection, - where, null, orderBy == null ? DEFAULT_SORT_ORDER : orderBy); - } - - public static final String getMessageBoxName(int msgBox) { - switch (msgBox) { - case MESSAGE_BOX_ALL: - return "all"; - case MESSAGE_BOX_INBOX: - return "inbox"; - case MESSAGE_BOX_SENT: - return "sent"; - case MESSAGE_BOX_DRAFTS: - return "drafts"; - case MESSAGE_BOX_OUTBOX: - return "outbox"; - default: - throw new IllegalArgumentException("Invalid message box: " + msgBox); - } - } - - public static String extractAddrSpec(String address) { - Matcher match = NAME_ADDR_EMAIL_PATTERN.matcher(address); - - if (match.matches()) { - return match.group(2); - } - return address; - } - - /** - * Returns true if the address is an email address - * - * @param address the input address to be tested - * @return true if address is an email address - */ - public static boolean isEmailAddress(String address) { - if (TextUtils.isEmpty(address)) { - return false; - } - - String s = extractAddrSpec(address); - Matcher match = Patterns.EMAIL_ADDRESS.matcher(s); - return match.matches(); - } - - /** - * Returns true if the number is a Phone number - * - * @param number the input number to be tested - * @return true if number is a Phone number - */ - public static boolean isPhoneNumber(String number) { - if (TextUtils.isEmpty(number)) { - return false; - } - - Matcher match = Patterns.PHONE.matcher(number); - return match.matches(); - } - - /** - * Contains all MMS messages in the MMS app's inbox. - */ - public static final class Inbox implements BaseMmsColumns { - /** - * The content:// style URL for this table - */ - public static final Uri - CONTENT_URI = Uri.parse("content://mms/inbox"); - - /** - * The default sort order for this table - */ - public static final String DEFAULT_SORT_ORDER = "date DESC"; - } - - /** - * Contains all MMS messages in the MMS app's sent box. - */ - public static final class Sent implements BaseMmsColumns { - /** - * The content:// style URL for this table - */ - public static final Uri - CONTENT_URI = Uri.parse("content://mms/sent"); - - /** - * The default sort order for this table - */ - public static final String DEFAULT_SORT_ORDER = "date DESC"; - } - - /** - * Contains all MMS messages in the MMS app's drafts box. - */ - public static final class Draft implements BaseMmsColumns { - /** - * The content:// style URL for this table - */ - public static final Uri - CONTENT_URI = Uri.parse("content://mms/drafts"); - - /** - * The default sort order for this table - */ - public static final String DEFAULT_SORT_ORDER = "date DESC"; - } - - /** - * Contains all MMS messages in the MMS app's outbox. - */ - public static final class Outbox implements BaseMmsColumns { - /** - * The content:// style URL for this table - */ - public static final Uri - CONTENT_URI = Uri.parse("content://mms/outbox"); - - /** - * The default sort order for this table - */ - public static final String DEFAULT_SORT_ORDER = "date DESC"; - } - - public static final class Addr implements BaseColumns { - /** - * The ID of MM which this address entry belongs to. - */ - public static final String MSG_ID = "msg_id"; - - /** - * The ID of contact entry in Phone Book. - */ - public static final String CONTACT_ID = "contact_id"; - - /** - * The address text. - */ - public static final String ADDRESS = "address"; - - /** - * Type of address, must be one of PduHeaders.BCC, - * PduHeaders.CC, PduHeaders.FROM, PduHeaders.TO. - */ - public static final String TYPE = "type"; - - /** - * Character set of this entry. - */ - public static final String CHARSET = "charset"; - } - - public static final class Part implements BaseColumns { - /** - * The identifier of the message which this part belongs to. - *

        Type: INTEGER

        - */ - public static final String MSG_ID = "mid"; - - /** - * The order of the part. - *

        Type: INTEGER

        - */ - public static final String SEQ = "seq"; - - /** - * The content type of the part. - *

        Type: TEXT

        - */ - public static final String CONTENT_TYPE = "ct"; - - /** - * The name of the part. - *

        Type: TEXT

        - */ - public static final String NAME = "name"; - - /** - * The charset of the part. - *

        Type: TEXT

        - */ - public static final String CHARSET = "chset"; - - /** - * The file name of the part. - *

        Type: TEXT

        - */ - public static final String FILENAME = "fn"; - - /** - * The content disposition of the part. - *

        Type: TEXT

        - */ - public static final String CONTENT_DISPOSITION = "cd"; - - /** - * The content ID of the part. - *

        Type: INTEGER

        - */ - public static final String CONTENT_ID = "cid"; - - /** - * The content location of the part. - *

        Type: INTEGER

        - */ - public static final String CONTENT_LOCATION = "cl"; - - /** - * The start of content-type of the message. - *

        Type: INTEGER

        - */ - public static final String CT_START = "ctt_s"; - - /** - * The type of content-type of the message. - *

        Type: TEXT

        - */ - public static final String CT_TYPE = "ctt_t"; - - /** - * The location(on filesystem) of the binary data of the part. - *

        Type: INTEGER

        - */ - public static final String _DATA = "_data"; - - public static final String TEXT = "text"; - - } - - public static final class Rate { - public static final Uri CONTENT_URI = Uri.withAppendedPath( - Mms.CONTENT_URI, "rate"); - /** - * When a message was successfully sent. - *

        Type: INTEGER

        - */ - public static final String SENT_TIME = "sent_time"; - } - - public static final class Intents { - private Intents() { - // Non-instantiatable. - } - - /** - * The extra field to store the contents of the Intent, - * which should be an array of Uri. - */ - public static final String EXTRA_CONTENTS = "contents"; - /** - * The extra field to store the type of the contents, - * which should be an array of String. - */ - public static final String EXTRA_TYPES = "types"; - /** - * The extra field to store the 'Cc' addresses. - */ - public static final String EXTRA_CC = "cc"; - /** - * The extra field to store the 'Bcc' addresses; - */ - public static final String EXTRA_BCC = "bcc"; - /** - * The extra field to store the 'Subject'. - */ - public static final String EXTRA_SUBJECT = "subject"; - /** - * Indicates that the contents of specified URIs were changed. - * The application which is showing or caching these contents - * should be updated. - */ - public static final String - CONTENT_CHANGED_ACTION = "android.intent.action.CONTENT_CHANGED"; - /** - * An extra field which stores the URI of deleted contents. - */ - public static final String DELETED_CONTENTS = "deleted_contents"; - } - } - - /** - * Contains all MMS and SMS messages. - */ - public static final class MmsSms implements BaseColumns { - /** - * The column to distinguish SMS & MMS messages in query results. - */ - public static final String TYPE_DISCRIMINATOR_COLUMN = - "transport_type"; - - public static final Uri CONTENT_URI = Uri.parse("content://mms-sms/"); - - public static final Uri CONTENT_CONVERSATIONS_URI = Uri.parse( - "content://mms-sms/conversations"); - - public static final Uri CONTENT_FILTER_BYPHONE_URI = Uri.parse( - "content://mms-sms/messages/byphone"); - - public static final Uri CONTENT_UNDELIVERED_URI = Uri.parse( - "content://mms-sms/undelivered"); - - public static final Uri CONTENT_DRAFT_URI = Uri.parse( - "content://mms-sms/draft"); - - public static final Uri CONTENT_LOCKED_URI = Uri.parse( - "content://mms-sms/locked"); - - /*** - * Pass in a query parameter called "pattern" which is the text - * to search for. - * The sort order is fixed to be thread_id ASC,date DESC. - */ - public static final Uri SEARCH_URI = Uri.parse( - "content://mms-sms/search"); - - // Constants for message protocol types. - public static final int SMS_PROTO = 0; - public static final int MMS_PROTO = 1; - - // Constants for error types of pending messages. - public static final int NO_ERROR = 0; - public static final int ERR_TYPE_GENERIC = 1; - public static final int ERR_TYPE_SMS_PROTO_TRANSIENT = 2; - public static final int ERR_TYPE_MMS_PROTO_TRANSIENT = 3; - public static final int ERR_TYPE_TRANSPORT_FAILURE = 4; - public static final int ERR_TYPE_GENERIC_PERMANENT = 10; - public static final int ERR_TYPE_SMS_PROTO_PERMANENT = 11; - public static final int ERR_TYPE_MMS_PROTO_PERMANENT = 12; - - public static final class PendingMessages implements BaseColumns { - public static final Uri CONTENT_URI = Uri.withAppendedPath( - MmsSms.CONTENT_URI, "pending"); - /** - * The type of transport protocol(MMS or SMS). - *

        Type: INTEGER

        - */ - public static final String PROTO_TYPE = "proto_type"; - /** - * The ID of the message to be sent or downloaded. - *

        Type: INTEGER

        - */ - public static final String MSG_ID = "msg_id"; - /** - * The type of the message to be sent or downloaded. - * This field is only valid for MM. For SM, its value is always - * set to 0. - */ - public static final String MSG_TYPE = "msg_type"; - /** - * The type of the error code. - *

        Type: INTEGER

        - */ - public static final String ERROR_TYPE = "err_type"; - /** - * The error code of sending/retrieving process. - *

        Type: INTEGER

        - */ - public static final String ERROR_CODE = "err_code"; - /** - * How many times we tried to send or download the message. - *

        Type: INTEGER

        - */ - public static final String RETRY_INDEX = "retry_index"; - /** - * The time to do next retry. - */ - public static final String DUE_TIME = "due_time"; - /** - * The time we last tried to send or download the message. - */ - public static final String LAST_TRY = "last_try"; - } - - public static final class WordsTable { - public static final String ID = "_id"; - public static final String SOURCE_ROW_ID = "source_id"; - public static final String TABLE_ID = "table_to_use"; - public static final String INDEXED_TEXT = "index_text"; - } - } - - public static final class Carriers implements BaseColumns { - /** - * The content:// style URL for this table - */ - public static final Uri CONTENT_URI = - Uri.parse("content://telephony/carriers"); - - /** - * The default sort order for this table - */ - public static final String DEFAULT_SORT_ORDER = "name ASC"; - - public static final String NAME = "name"; - - public static final String APN = "apn"; - - public static final String PROXY = "proxy"; - - public static final String PORT = "port"; - - public static final String MMSPROXY = "mmsproxy"; - - public static final String MMSPORT = "mmsport"; - - public static final String SERVER = "server"; - - public static final String USER = "user"; - - public static final String PASSWORD = "password"; - - public static final String MMSC = "mmsc"; - - public static final String MCC = "mcc"; - - public static final String MNC = "mnc"; - - public static final String NUMERIC = "numeric"; - - public static final String AUTH_TYPE = "authtype"; - - public static final String TYPE = "type"; - - public static final String INACTIVE_TIMER = "inactivetimer"; - - // Only if enabled try Data Connection. - public static final String ENABLED = "enabled"; - - // Rules apply based on class. - public static final String CLASS = "class"; - - /** - * The protocol to be used to connect to this APN. - * - * One of the PDP_type values in TS 27.007 section 10.1.1. - * For example, "IP", "IPV6", "IPV4V6", or "PPP". - */ - public static final String PROTOCOL = "protocol"; - - /** - * The protocol to be used to connect to this APN when roaming. - * - * The syntax is the same as protocol. - */ - public static final String ROAMING_PROTOCOL = "roaming_protocol"; - - public static final String CURRENT = "current"; - - /** - * Current status of APN - * true : enabled APN, false : disabled APN. - */ - public static final String CARRIER_ENABLED = "carrier_enabled"; - - /** - * Radio Access Technology info - * To check what values can hold, refer to ServiceState.java. - * This should be spread to other technologies, - * but currently only used for LTE(14) and EHRPD(13). - */ - public static final String BEARER = "bearer"; - } - - /** - * Contains received SMS cell broadcast messages. - */ - public static final class CellBroadcasts implements BaseColumns { - - /** Not instantiable. */ - private CellBroadcasts() {} - - /** - * The content:// style URL for this table - */ - public static final Uri CONTENT_URI = - Uri.parse("content://cellbroadcasts"); - - /** - * Message geographical scope. - *

        Type: INTEGER

        - */ - public static final String GEOGRAPHICAL_SCOPE = "geo_scope"; - - /** - * Message serial number. - *

        Type: INTEGER

        - */ - public static final String SERIAL_NUMBER = "serial_number"; - - /** - * PLMN of broadcast sender. (SERIAL_NUMBER + PLMN + LAC + CID) uniquely identifies a - * broadcast for duplicate detection purposes. - *

        Type: TEXT

        - */ - public static final String PLMN = "plmn"; - - /** - * Location Area (GSM) or Service Area (UMTS) of broadcast sender. Unused for CDMA. - * Only included if Geographical Scope of message is not PLMN wide (01). - *

        Type: INTEGER

        - */ - public static final String LAC = "lac"; - - /** - * Cell ID of message sender (GSM/UMTS). Unused for CDMA. Only included when the - * Geographical Scope of message is cell wide (00 or 11). - *

        Type: INTEGER

        - */ - public static final String CID = "cid"; - - /** - * Message code (OBSOLETE: merged into SERIAL_NUMBER). - *

        Type: INTEGER

        - */ - public static final String V1_MESSAGE_CODE = "message_code"; - - /** - * Message identifier (OBSOLETE: renamed to SERVICE_CATEGORY). - *

        Type: INTEGER

        - */ - public static final String V1_MESSAGE_IDENTIFIER = "message_id"; - - /** - * Service category (GSM/UMTS message identifier, CDMA service category). - *

        Type: INTEGER

        - */ - public static final String SERVICE_CATEGORY = "service_category"; - - /** - * Message language code. - *

        Type: TEXT

        - */ - public static final String LANGUAGE_CODE = "language"; - - /** - * Message body. - *

        Type: TEXT

        - */ - public static final String MESSAGE_BODY = "body"; - - /** - * Message delivery time. - *

        Type: INTEGER (long)

        - */ - public static final String DELIVERY_TIME = "date"; - - /** - * Has the message been viewed? - *

        Type: INTEGER (boolean)

        - */ - public static final String MESSAGE_READ = "read"; - - /** - * Message format (3GPP or 3GPP2). - *

        Type: INTEGER

        - */ - public static final String MESSAGE_FORMAT = "format"; - - /** - * Message priority (including emergency). - *

        Type: INTEGER

        - */ - public static final String MESSAGE_PRIORITY = "priority"; - - /** - * ETWS warning type (ETWS alerts only). - *

        Type: INTEGER

        - */ - public static final String ETWS_WARNING_TYPE = "etws_warning_type"; - - /** - * CMAS message class (CMAS alerts only). - *

        Type: INTEGER

        - */ - public static final String CMAS_MESSAGE_CLASS = "cmas_message_class"; - - /** - * CMAS category (CMAS alerts only). - *

        Type: INTEGER

        - */ - public static final String CMAS_CATEGORY = "cmas_category"; - - /** - * CMAS response type (CMAS alerts only). - *

        Type: INTEGER

        - */ - public static final String CMAS_RESPONSE_TYPE = "cmas_response_type"; - - /** - * CMAS severity (CMAS alerts only). - *

        Type: INTEGER

        - */ - public static final String CMAS_SEVERITY = "cmas_severity"; - - /** - * CMAS urgency (CMAS alerts only). - *

        Type: INTEGER

        - */ - public static final String CMAS_URGENCY = "cmas_urgency"; - - /** - * CMAS certainty (CMAS alerts only). - *

        Type: INTEGER

        - */ - public static final String CMAS_CERTAINTY = "cmas_certainty"; - - /** - * The default sort order for this table - */ - public static final String DEFAULT_SORT_ORDER = DELIVERY_TIME + " DESC"; - - /** - * Query columns for instantiating {@link android.telephony.CellBroadcastMessage} objects. - */ - public static final String[] QUERY_COLUMNS = { - _ID, - GEOGRAPHICAL_SCOPE, - PLMN, - LAC, - CID, - SERIAL_NUMBER, - SERVICE_CATEGORY, - LANGUAGE_CODE, - MESSAGE_BODY, - DELIVERY_TIME, - MESSAGE_READ, - MESSAGE_FORMAT, - MESSAGE_PRIORITY, - ETWS_WARNING_TYPE, - CMAS_MESSAGE_CLASS, - CMAS_CATEGORY, - CMAS_RESPONSE_TYPE, - CMAS_SEVERITY, - CMAS_URGENCY, - CMAS_CERTAINTY - }; - } - - public static final class Intents { - private Intents() { - // Not instantiable - } - - /** - * Broadcast Action: A "secret code" has been entered in the dialer. Secret codes are - * of the form *#*##*#*. The intent will have the data URI:

        - * - *

        android_secret_code://<code>

        - */ - public static final String SECRET_CODE_ACTION = - "android.provider.Telephony.SECRET_CODE"; - - /** - * Broadcast Action: The Service Provider string(s) have been updated. Activities or - * services that use these strings should update their display. - * The intent will have the following extra values:

        - *
          - *
        • showPlmn - Boolean that indicates whether the PLMN should be shown.
        • - *
        • plmn - The operator name of the registered network, as a string.
        • - *
        • showSpn - Boolean that indicates whether the SPN should be shown.
        • - *
        • spn - The service provider name, as a string.
        • - *
        - * Note that showPlmn may indicate that plmn should be displayed, even - * though the value for plmn is null. This can happen, for example, if the phone - * has not registered to a network yet. In this case the receiver may substitute an - * appropriate placeholder string (eg, "No service"). - * - * It is recommended to display plmn before / above spn if - * both are displayed. - * - *

        Note this is a protected intent that can only be sent - * by the system. - */ - public static final String SPN_STRINGS_UPDATED_ACTION = - "android.provider.Telephony.SPN_STRINGS_UPDATED"; - - public static final String EXTRA_SHOW_PLMN = "showPlmn"; - public static final String EXTRA_PLMN = "plmn"; - public static final String EXTRA_SHOW_SPN = "showSpn"; - public static final String EXTRA_SPN = "spn"; - } -} diff --git a/core/java/android/server/BluetoothA2dpService.java b/core/java/android/server/BluetoothA2dpService.java deleted file mode 100644 index 08a99d2fb9e68..0000000000000 --- a/core/java/android/server/BluetoothA2dpService.java +++ /dev/null @@ -1,653 +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. - */ - -/** - * TODO: Move this to services.jar - * and make the constructor package private again. - * @hide - */ - -package android.server; - -import android.bluetooth.BluetoothA2dp; -import android.bluetooth.BluetoothAdapter; -import android.bluetooth.BluetoothDevice; -import android.bluetooth.BluetoothProfile; -import android.bluetooth.BluetoothUuid; -import android.bluetooth.IBluetoothA2dp; -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; -import android.content.IntentFilter; -import android.media.AudioManager; -import android.os.Handler; -import android.os.Message; -import android.os.ParcelUuid; -import android.os.PowerManager; -import android.os.PowerManager.WakeLock; -import android.provider.Settings; -import android.util.Log; - -import java.io.FileDescriptor; -import java.io.PrintWriter; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - - -public class BluetoothA2dpService extends IBluetoothA2dp.Stub { - private static final String TAG = "BluetoothA2dpService"; - private static final boolean DBG = true; - - public static final String BLUETOOTH_A2DP_SERVICE = "bluetooth_a2dp"; - - private static final String BLUETOOTH_ADMIN_PERM = android.Manifest.permission.BLUETOOTH_ADMIN; - private static final String BLUETOOTH_PERM = android.Manifest.permission.BLUETOOTH; - - private static final String BLUETOOTH_ENABLED = "bluetooth_enabled"; - - private static final String PROPERTY_STATE = "State"; - - private final Context mContext; - private final IntentFilter mIntentFilter; - private HashMap mAudioDevices; - private final AudioManager mAudioManager; - private final BluetoothService mBluetoothService; - private final BluetoothAdapter mAdapter; - private int mTargetA2dpState; - private BluetoothDevice mPlayingA2dpDevice; - private IntentBroadcastHandler mIntentBroadcastHandler; - private final WakeLock mWakeLock; - - private static final int MSG_CONNECTION_STATE_CHANGED = 0; - - private final BroadcastReceiver mReceiver = new BroadcastReceiver() { - @Override - public void onReceive(Context context, Intent intent) { - String action = intent.getAction(); - BluetoothDevice device = - intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE); - if (action.equals(BluetoothAdapter.ACTION_STATE_CHANGED)) { - int state = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, - BluetoothAdapter.ERROR); - switch (state) { - case BluetoothAdapter.STATE_ON: - onBluetoothEnable(); - break; - case BluetoothAdapter.STATE_TURNING_OFF: - onBluetoothDisable(); - break; - } - } else if (action.equals(BluetoothDevice.ACTION_ACL_DISCONNECTED)) { - synchronized (this) { - if (mAudioDevices.containsKey(device)) { - int state = mAudioDevices.get(device); - handleSinkStateChange(device, state, BluetoothA2dp.STATE_DISCONNECTED); - } - } - } else if (action.equals(AudioManager.VOLUME_CHANGED_ACTION)) { - int streamType = intent.getIntExtra(AudioManager.EXTRA_VOLUME_STREAM_TYPE, -1); - if (streamType == AudioManager.STREAM_MUSIC) { - List sinks = getConnectedDevices(); - - if (sinks.size() != 0 && isPhoneDocked(sinks.get(0))) { - String address = sinks.get(0).getAddress(); - int newVolLevel = - intent.getIntExtra(AudioManager.EXTRA_VOLUME_STREAM_VALUE, 0); - int oldVolLevel = - intent.getIntExtra(AudioManager.EXTRA_PREV_VOLUME_STREAM_VALUE, 0); - String path = mBluetoothService.getObjectPathFromAddress(address); - if (newVolLevel > oldVolLevel) { - avrcpVolumeUpNative(path); - } else if (newVolLevel < oldVolLevel) { - avrcpVolumeDownNative(path); - } - } - } - } - } - }; - - private boolean isPhoneDocked(BluetoothDevice device) { - // This works only because these broadcast intents are "sticky" - Intent i = mContext.registerReceiver(null, new IntentFilter(Intent.ACTION_DOCK_EVENT)); - if (i != null) { - int state = i.getIntExtra(Intent.EXTRA_DOCK_STATE, Intent.EXTRA_DOCK_STATE_UNDOCKED); - if (state != Intent.EXTRA_DOCK_STATE_UNDOCKED) { - BluetoothDevice dockDevice = i.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE); - if (dockDevice != null && device.equals(dockDevice)) { - return true; - } - } - } - return false; - } - - public BluetoothA2dpService(Context context, BluetoothService bluetoothService) { - mContext = context; - - PowerManager pm = (PowerManager)context.getSystemService(Context.POWER_SERVICE); - mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "BluetoothA2dpService"); - - mIntentBroadcastHandler = new IntentBroadcastHandler(); - - mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); - - mBluetoothService = bluetoothService; - if (mBluetoothService == null) { - throw new RuntimeException("Platform does not support Bluetooth"); - } - - if (!initNative()) { - throw new RuntimeException("Could not init BluetoothA2dpService"); - } - - mAdapter = BluetoothAdapter.getDefaultAdapter(); - - mIntentFilter = new IntentFilter(BluetoothAdapter.ACTION_STATE_CHANGED); - mIntentFilter.addAction(BluetoothDevice.ACTION_ACL_CONNECTED); - mIntentFilter.addAction(BluetoothDevice.ACTION_ACL_DISCONNECTED); - mIntentFilter.addAction(AudioManager.VOLUME_CHANGED_ACTION); - mContext.registerReceiver(mReceiver, mIntentFilter); - - mAudioDevices = new HashMap(); - - if (mBluetoothService.isEnabled()) - onBluetoothEnable(); - mTargetA2dpState = -1; - mBluetoothService.setA2dpService(this); - } - - @Override - protected void finalize() throws Throwable { - try { - cleanupNative(); - } finally { - super.finalize(); - } - } - - private int convertBluezSinkStringToState(String value) { - if (value.equalsIgnoreCase("disconnected")) - return BluetoothA2dp.STATE_DISCONNECTED; - if (value.equalsIgnoreCase("connecting")) - return BluetoothA2dp.STATE_CONNECTING; - if (value.equalsIgnoreCase("connected")) - return BluetoothA2dp.STATE_CONNECTED; - if (value.equalsIgnoreCase("playing")) - return BluetoothA2dp.STATE_PLAYING; - return -1; - } - - private boolean isSinkDevice(BluetoothDevice device) { - ParcelUuid[] uuids = mBluetoothService.getRemoteUuids(device.getAddress()); - if (uuids != null && BluetoothUuid.isUuidPresent(uuids, BluetoothUuid.AudioSink)) { - return true; - } - return false; - } - - private synchronized void addAudioSink(BluetoothDevice device) { - if (mAudioDevices.get(device) == null) { - mAudioDevices.put(device, BluetoothA2dp.STATE_DISCONNECTED); - } - } - - private synchronized void onBluetoothEnable() { - String devices = mBluetoothService.getProperty("Devices", true); - if (devices != null) { - String [] paths = devices.split(","); - for (String path: paths) { - String address = mBluetoothService.getAddressFromObjectPath(path); - BluetoothDevice device = mAdapter.getRemoteDevice(address); - ParcelUuid[] remoteUuids = mBluetoothService.getRemoteUuids(address); - if (remoteUuids != null) - if (BluetoothUuid.containsAnyUuid(remoteUuids, - new ParcelUuid[] {BluetoothUuid.AudioSink, - BluetoothUuid.AdvAudioDist})) { - addAudioSink(device); - } - } - } - mAudioManager.setParameters(BLUETOOTH_ENABLED+"=true"); - mAudioManager.setParameters("A2dpSuspended=false"); - } - - private synchronized void onBluetoothDisable() { - if (!mAudioDevices.isEmpty()) { - BluetoothDevice[] devices = new BluetoothDevice[mAudioDevices.size()]; - devices = mAudioDevices.keySet().toArray(devices); - for (BluetoothDevice device : devices) { - int state = getConnectionState(device); - switch (state) { - case BluetoothA2dp.STATE_CONNECTING: - case BluetoothA2dp.STATE_CONNECTED: - case BluetoothA2dp.STATE_PLAYING: - disconnectSinkNative(mBluetoothService.getObjectPathFromAddress( - device.getAddress())); - handleSinkStateChange(device, state, BluetoothA2dp.STATE_DISCONNECTED); - break; - case BluetoothA2dp.STATE_DISCONNECTING: - handleSinkStateChange(device, BluetoothA2dp.STATE_DISCONNECTING, - BluetoothA2dp.STATE_DISCONNECTED); - break; - } - } - mAudioDevices.clear(); - } - - mAudioManager.setParameters(BLUETOOTH_ENABLED + "=false"); - } - - private synchronized boolean isConnectSinkFeasible(BluetoothDevice device) { - if (!mBluetoothService.isEnabled() || !isSinkDevice(device) || - getPriority(device) == BluetoothA2dp.PRIORITY_OFF) { - return false; - } - - addAudioSink(device); - - String path = mBluetoothService.getObjectPathFromAddress(device.getAddress()); - if (path == null) { - return false; - } - return true; - } - - public synchronized boolean isA2dpPlaying(BluetoothDevice device) { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, - "Need BLUETOOTH_ADMIN permission"); - if (DBG) log("isA2dpPlaying(" + device + ")"); - if (device.equals(mPlayingA2dpDevice)) return true; - return false; - } - - public synchronized boolean connect(BluetoothDevice device) { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, - "Need BLUETOOTH_ADMIN permission"); - if (DBG) log("connectSink(" + device + ")"); - if (!isConnectSinkFeasible(device)) return false; - - for (BluetoothDevice sinkDevice : mAudioDevices.keySet()) { - if (getConnectionState(sinkDevice) != BluetoothProfile.STATE_DISCONNECTED) { - disconnect(sinkDevice); - } - } - - return mBluetoothService.connectSink(device.getAddress()); - } - - public synchronized boolean connectSinkInternal(BluetoothDevice device) { - if (!mBluetoothService.isEnabled()) return false; - - int state = mAudioDevices.get(device); - - // ignore if there are any active sinks - if (getDevicesMatchingConnectionStates(new int[] { - BluetoothA2dp.STATE_CONNECTING, - BluetoothA2dp.STATE_CONNECTED, - BluetoothA2dp.STATE_DISCONNECTING}).size() != 0) { - return false; - } - - switch (state) { - case BluetoothA2dp.STATE_CONNECTED: - case BluetoothA2dp.STATE_DISCONNECTING: - return false; - case BluetoothA2dp.STATE_CONNECTING: - return true; - } - - String path = mBluetoothService.getObjectPathFromAddress(device.getAddress()); - - // State is DISCONNECTED and we are connecting. - if (getPriority(device) < BluetoothA2dp.PRIORITY_AUTO_CONNECT) { - setPriority(device, BluetoothA2dp.PRIORITY_AUTO_CONNECT); - } - handleSinkStateChange(device, state, BluetoothA2dp.STATE_CONNECTING); - - if (!connectSinkNative(path)) { - // Restore previous state - handleSinkStateChange(device, mAudioDevices.get(device), state); - return false; - } - return true; - } - - private synchronized boolean isDisconnectSinkFeasible(BluetoothDevice device) { - String path = mBluetoothService.getObjectPathFromAddress(device.getAddress()); - if (path == null) { - return false; - } - - int state = getConnectionState(device); - switch (state) { - case BluetoothA2dp.STATE_DISCONNECTED: - case BluetoothA2dp.STATE_DISCONNECTING: - return false; - } - return true; - } - - public synchronized boolean disconnect(BluetoothDevice device) { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, - "Need BLUETOOTH_ADMIN permission"); - if (DBG) log("disconnectSink(" + device + ")"); - if (!isDisconnectSinkFeasible(device)) return false; - return mBluetoothService.disconnectSink(device.getAddress()); - } - - public synchronized boolean disconnectSinkInternal(BluetoothDevice device) { - int state = getConnectionState(device); - String path = mBluetoothService.getObjectPathFromAddress(device.getAddress()); - - switch (state) { - case BluetoothA2dp.STATE_DISCONNECTED: - case BluetoothA2dp.STATE_DISCONNECTING: - return false; - } - // State is CONNECTING or CONNECTED or PLAYING - handleSinkStateChange(device, state, BluetoothA2dp.STATE_DISCONNECTING); - if (!disconnectSinkNative(path)) { - // Restore previous state - handleSinkStateChange(device, mAudioDevices.get(device), state); - return false; - } - return true; - } - - public synchronized boolean suspendSink(BluetoothDevice device) { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, - "Need BLUETOOTH_ADMIN permission"); - if (DBG) log("suspendSink(" + device + "), mTargetA2dpState: "+mTargetA2dpState); - if (device == null || mAudioDevices == null) { - return false; - } - String path = mBluetoothService.getObjectPathFromAddress(device.getAddress()); - Integer state = mAudioDevices.get(device); - if (path == null || state == null) { - return false; - } - - mTargetA2dpState = BluetoothA2dp.STATE_CONNECTED; - return checkSinkSuspendState(state.intValue()); - } - - public synchronized boolean resumeSink(BluetoothDevice device) { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, - "Need BLUETOOTH_ADMIN permission"); - if (DBG) log("resumeSink(" + device + "), mTargetA2dpState: "+mTargetA2dpState); - if (device == null || mAudioDevices == null) { - return false; - } - String path = mBluetoothService.getObjectPathFromAddress(device.getAddress()); - Integer state = mAudioDevices.get(device); - if (path == null || state == null) { - return false; - } - mTargetA2dpState = BluetoothA2dp.STATE_PLAYING; - return checkSinkSuspendState(state.intValue()); - } - - public synchronized int getConnectionState(BluetoothDevice device) { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); - Integer state = mAudioDevices.get(device); - if (state == null) - return BluetoothA2dp.STATE_DISCONNECTED; - return state; - } - - public synchronized List getConnectedDevices() { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); - List sinks = getDevicesMatchingConnectionStates( - new int[] {BluetoothA2dp.STATE_CONNECTED}); - return sinks; - } - - public synchronized List getDevicesMatchingConnectionStates(int[] states) { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); - ArrayList sinks = new ArrayList(); - for (BluetoothDevice device: mAudioDevices.keySet()) { - int sinkState = getConnectionState(device); - for (int state : states) { - if (state == sinkState) { - sinks.add(device); - break; - } - } - } - return sinks; - } - - public synchronized int getPriority(BluetoothDevice device) { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); - return Settings.Secure.getInt(mContext.getContentResolver(), - Settings.Secure.getBluetoothA2dpSinkPriorityKey(device.getAddress()), - BluetoothA2dp.PRIORITY_UNDEFINED); - } - - public synchronized boolean setPriority(BluetoothDevice device, int priority) { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, - "Need BLUETOOTH_ADMIN permission"); - return Settings.Secure.putInt(mContext.getContentResolver(), - Settings.Secure.getBluetoothA2dpSinkPriorityKey(device.getAddress()), priority); - } - - public synchronized boolean allowIncomingConnect(BluetoothDevice device, boolean value) { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, - "Need BLUETOOTH_ADMIN permission"); - String address = device.getAddress(); - if (!BluetoothAdapter.checkBluetoothAddress(address)) { - return false; - } - Integer data = mBluetoothService.getAuthorizationAgentRequestData(address); - if (data == null) { - Log.w(TAG, "allowIncomingConnect(" + device + ") called but no native data available"); - return false; - } - log("allowIncomingConnect: A2DP: " + device + ":" + value); - return mBluetoothService.setAuthorizationNative(address, value, data.intValue()); - } - - /** - * Called by native code on a PropertyChanged signal from - * org.bluez.AudioSink. - * - * @param path the object path for the changed device - * @param propValues a string array containing the key and one or more - * values. - */ - private synchronized void onSinkPropertyChanged(String path, String[] propValues) { - if (!mBluetoothService.isEnabled()) { - return; - } - - String name = propValues[0]; - String address = mBluetoothService.getAddressFromObjectPath(path); - if (address == null) { - Log.e(TAG, "onSinkPropertyChanged: Address of the remote device in null"); - return; - } - - BluetoothDevice device = mAdapter.getRemoteDevice(address); - - if (name.equals(PROPERTY_STATE)) { - int state = convertBluezSinkStringToState(propValues[1]); - log("A2DP: onSinkPropertyChanged newState is: " + state + "mPlayingA2dpDevice: " + mPlayingA2dpDevice); - - if (mAudioDevices.get(device) == null) { - // This is for an incoming connection for a device not known to us. - // We have authorized it and bluez state has changed. - addAudioSink(device); - handleSinkStateChange(device, BluetoothA2dp.STATE_DISCONNECTED, state); - } else { - if (state == BluetoothA2dp.STATE_PLAYING && mPlayingA2dpDevice == null) { - mPlayingA2dpDevice = device; - handleSinkPlayingStateChange(device, state, BluetoothA2dp.STATE_NOT_PLAYING); - } else if (state == BluetoothA2dp.STATE_CONNECTED && mPlayingA2dpDevice != null) { - mPlayingA2dpDevice = null; - handleSinkPlayingStateChange(device, BluetoothA2dp.STATE_NOT_PLAYING, - BluetoothA2dp.STATE_PLAYING); - } else { - mPlayingA2dpDevice = null; - int prevState = mAudioDevices.get(device); - handleSinkStateChange(device, prevState, state); - } - } - } - } - - private void handleSinkStateChange(BluetoothDevice device, int prevState, int state) { - if (state != prevState) { - mAudioDevices.put(device, state); - - checkSinkSuspendState(state); - mTargetA2dpState = -1; - - if (getPriority(device) > BluetoothA2dp.PRIORITY_OFF && - state == BluetoothA2dp.STATE_CONNECTED) { - // We have connected or attempting to connect. - // Bump priority - setPriority(device, BluetoothA2dp.PRIORITY_AUTO_CONNECT); - // We will only have 1 device with AUTO_CONNECT priority - // To be backward compatible set everyone else to have PRIORITY_ON - adjustOtherSinkPriorities(device); - } - - int delay = mAudioManager.setBluetoothA2dpDeviceConnectionState(device, state); - - mWakeLock.acquire(); - mIntentBroadcastHandler.sendMessageDelayed(mIntentBroadcastHandler.obtainMessage( - MSG_CONNECTION_STATE_CHANGED, - prevState, - state, - device), - delay); - } - } - - private void handleSinkPlayingStateChange(BluetoothDevice device, int state, int prevState) { - Intent intent = new Intent(BluetoothA2dp.ACTION_PLAYING_STATE_CHANGED); - intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device); - intent.putExtra(BluetoothProfile.EXTRA_PREVIOUS_STATE, prevState); - intent.putExtra(BluetoothProfile.EXTRA_STATE, state); - intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT); - mContext.sendBroadcast(intent, BLUETOOTH_PERM); - - if (DBG) log("A2DP Playing state : device: " + device + " State:" + prevState + "->" + state); - } - - private void adjustOtherSinkPriorities(BluetoothDevice connectedDevice) { - for (BluetoothDevice device : mAdapter.getBondedDevices()) { - if (getPriority(device) >= BluetoothA2dp.PRIORITY_AUTO_CONNECT && - !device.equals(connectedDevice)) { - setPriority(device, BluetoothA2dp.PRIORITY_ON); - } - } - } - - private boolean checkSinkSuspendState(int state) { - boolean result = true; - - if (state != mTargetA2dpState) { - if (state == BluetoothA2dp.STATE_PLAYING && - mTargetA2dpState == BluetoothA2dp.STATE_CONNECTED) { - mAudioManager.setParameters("A2dpSuspended=true"); - } else if (state == BluetoothA2dp.STATE_CONNECTED && - mTargetA2dpState == BluetoothA2dp.STATE_PLAYING) { - mAudioManager.setParameters("A2dpSuspended=false"); - } else { - result = false; - } - } - return result; - } - - /** - * Called by native code for the async response to a Connect - * method call to org.bluez.AudioSink. - * - * @param deviceObjectPath the object path for the connecting device - * @param result true on success; false on error - */ - private void onConnectSinkResult(String deviceObjectPath, boolean result) { - // If the call was a success, ignore we will update the state - // when we a Sink Property Change - if (!result) { - if (deviceObjectPath != null) { - String address = mBluetoothService.getAddressFromObjectPath(deviceObjectPath); - if (address == null) return; - BluetoothDevice device = mAdapter.getRemoteDevice(address); - int state = getConnectionState(device); - handleSinkStateChange(device, state, BluetoothA2dp.STATE_DISCONNECTED); - } - } - } - - /** Handles A2DP connection state change intent broadcasts. */ - private class IntentBroadcastHandler extends Handler { - - private void onConnectionStateChanged(BluetoothDevice device, int prevState, int state) { - Intent intent = new Intent(BluetoothA2dp.ACTION_CONNECTION_STATE_CHANGED); - intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device); - intent.putExtra(BluetoothProfile.EXTRA_PREVIOUS_STATE, prevState); - intent.putExtra(BluetoothProfile.EXTRA_STATE, state); - intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT); - mContext.sendBroadcast(intent, BLUETOOTH_PERM); - - if (DBG) log("A2DP state : device: " + device + " State:" + prevState + "->" + state); - - mBluetoothService.sendConnectionStateChange(device, BluetoothProfile.A2DP, state, - prevState); - } - - @Override - public void handleMessage(Message msg) { - switch (msg.what) { - case MSG_CONNECTION_STATE_CHANGED: - onConnectionStateChanged((BluetoothDevice) msg.obj, msg.arg1, msg.arg2); - mWakeLock.release(); - break; - } - } - } - - @Override - protected synchronized void dump(FileDescriptor fd, PrintWriter pw, String[] args) { - mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DUMP, TAG); - - if (mAudioDevices.isEmpty()) return; - pw.println("Cached audio devices:"); - for (BluetoothDevice device : mAudioDevices.keySet()) { - int state = mAudioDevices.get(device); - pw.println(device + " " + BluetoothA2dp.stateToString(state)); - } - } - - private static void log(String msg) { - Log.d(TAG, msg); - } - - private native boolean initNative(); - private native void cleanupNative(); - private synchronized native boolean connectSinkNative(String path); - private synchronized native boolean disconnectSinkNative(String path); - private synchronized native boolean suspendSinkNative(String path); - private synchronized native boolean resumeSinkNative(String path); - private synchronized native Object []getSinkPropertiesNative(String path); - private synchronized native boolean avrcpVolumeUpNative(String path); - private synchronized native boolean avrcpVolumeDownNative(String path); -} diff --git a/core/java/android/server/BluetoothAdapterProperties.java b/core/java/android/server/BluetoothAdapterProperties.java deleted file mode 100644 index 9723f60243fd3..0000000000000 --- a/core/java/android/server/BluetoothAdapterProperties.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (C) 2010 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.server; - -import android.content.Context; -import android.util.Log; - -import java.util.HashMap; -import java.util.Map; - -class BluetoothAdapterProperties { - - private static final String TAG = "BluetoothAdapterProperties"; - - private final Map mPropertiesMap; - private final Context mContext; - private final BluetoothService mService; - - BluetoothAdapterProperties(Context context, BluetoothService service) { - mPropertiesMap = new HashMap(); - mContext = context; - mService = service; - } - - synchronized String getProperty(String name) { - if (mPropertiesMap.isEmpty()) { - getAllProperties(); - } - return mPropertiesMap.get(name); - } - - String getObjectPath() { - return getProperty("ObjectPath"); - } - - synchronized void clear() { - mPropertiesMap.clear(); - } - - synchronized boolean isEmpty() { - return mPropertiesMap.isEmpty(); - } - - synchronized void setProperty(String name, String value) { - mPropertiesMap.put(name, value); - } - - synchronized void getAllProperties() { - mContext.enforceCallingOrSelfPermission( - BluetoothService.BLUETOOTH_PERM, - "Need BLUETOOTH permission"); - mPropertiesMap.clear(); - - String properties[] = (String[]) mService - .getAdapterPropertiesNative(); - // The String Array consists of key-value pairs. - if (properties == null) { - Log.e(TAG, "*Error*: GetAdapterProperties returned NULL"); - return; - } - - for (int i = 0; i < properties.length; i++) { - String name = properties[i]; - String newValue = null; - if (name == null) { - Log.e(TAG, "Error:Adapter Property at index " + i + " is null"); - continue; - } - if (name.equals("Devices") || name.equals("UUIDs")) { - StringBuilder str = new StringBuilder(); - int len = Integer.valueOf(properties[++i]); - for (int j = 0; j < len; j++) { - str.append(properties[++i]); - str.append(","); - } - if (len > 0) { - newValue = str.toString(); - } - } else { - newValue = properties[++i]; - } - mPropertiesMap.put(name, newValue); - } - - // Add adapter object path property. - String adapterPath = mService.getAdapterPathNative(); - if (adapterPath != null) { - mPropertiesMap.put("ObjectPath", adapterPath + "/dev_"); - } - } -} diff --git a/core/java/android/server/BluetoothAdapterStateMachine.java b/core/java/android/server/BluetoothAdapterStateMachine.java deleted file mode 100644 index 1de1839c1cc7c..0000000000000 --- a/core/java/android/server/BluetoothAdapterStateMachine.java +++ /dev/null @@ -1,822 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.server; - -import android.bluetooth.BluetoothAdapter; -import android.bluetooth.IBluetoothStateChangeCallback; -import android.content.ContentResolver; -import android.content.Context; -import android.content.Intent; -import android.os.Binder; -import android.os.Message; -import android.os.RemoteException; -import android.provider.Settings; -import android.util.Log; - -import com.android.internal.util.IState; -import com.android.internal.util.State; -import com.android.internal.util.StateMachine; - -import java.io.PrintWriter; - -/** - * Bluetooth Adapter StateMachine - * All the states are at the same level, ie, no hierarchy. - * (BluetootOn)<----------------------<- - * | ^ -------------------->- | - * | | | | - * USER_TURN_OFF | | SCAN_MODE_CHANGED m1 | | USER_TURN_ON - * AIRPLANE_MODE_ON | | | | - * V | | | - * (Switching) (PerProcessState) - * | ^ | | - * POWER_STATE_CHANGED & | | TURN_ON(_CONTINUE) | | - * ALL_DEVICES_DISCONNECTED | | m2 | | - * V |------------------------< | SCAN_MODE_CHANGED - * (HotOff)-------------------------->- PER_PROCESS_TURN_ON - * / ^ - * / | SERVICE_RECORD_LOADED - * | | - * TURN_COLD | (Warmup) - * \ ^ - * \ | TURN_HOT/TURN_ON - * | | AIRPLANE_MODE_OFF(when Bluetooth was on before) - * V | - * (PowerOff) <----- initial state - * - * Legend: - * m1 = TURN_HOT - * m2 = Transition to HotOff when number of process wanting BT on is 0. - * POWER_STATE_CHANGED will make the transition. - * Note: - * The diagram above shows all the states and messages that trigger normal state changes. - * The diagram above does not capture everything: - * The diagram does not capture following messages. - * - messages that do not trigger state changes - * For example, PER_PROCESS_TURN_ON received in BluetoothOn state - * - unhandled messages - * For example, USER_TURN_ON received in BluetoothOn state - * - timeout messages - * The diagram does not capture error conditions and state recoveries. - * - For example POWER_STATE_CHANGED received in BluetoothOn state - */ -final class BluetoothAdapterStateMachine extends StateMachine { - private static final String TAG = "BluetoothAdapterStateMachine"; - private static final boolean DBG = false; - - // Message(what) to take an action - // - // We get this message when user tries to turn on BT - static final int USER_TURN_ON = 1; - // We get this message when user tries to turn off BT - static final int USER_TURN_OFF = 2; - // Per process enable / disable messages - static final int PER_PROCESS_TURN_ON = 3; - static final int PER_PROCESS_TURN_OFF = 4; - - // Turn on Bluetooth Module, Load firmware, and do all the preparation - // needed to get the Bluetooth Module ready but keep it not discoverable - // and not connectable. This way the Bluetooth Module can be quickly - // switched on if needed - static final int TURN_HOT = 5; - - // Message(what) to report a event that the state machine need to respond to - // - // Event indicates sevice records have been loaded - static final int SERVICE_RECORD_LOADED = 51; - // Event indicates all the remote Bluetooth devices has been disconnected - static final int ALL_DEVICES_DISCONNECTED = 52; - // Event indicates the Bluetooth scan mode has changed - static final int SCAN_MODE_CHANGED = 53; - // Event indicates the powered state has changed - static final int POWER_STATE_CHANGED = 54; - // Event indicates airplane mode is turned on - static final int AIRPLANE_MODE_ON = 55; - // Event indicates airplane mode is turned off - static final int AIRPLANE_MODE_OFF = 56; - - // private internal messages - // - // USER_TURN_ON is changed to TURN_ON_CONTINUE after we broadcast the - // state change intent so that we will not broadcast the intent again in - // other state - private static final int TURN_ON_CONTINUE = 101; - // Unload firmware, turning off Bluetooth module power - private static final int TURN_COLD = 102; - // Device disconnecting timeout happens - private static final int DEVICES_DISCONNECT_TIMEOUT = 103; - // Prepare Bluetooth timeout happens - private static final int PREPARE_BLUETOOTH_TIMEOUT = 104; - // Bluetooth turn off wait timeout happens - private static final int TURN_OFF_TIMEOUT = 105; - // Bluetooth device power off wait timeout happens - private static final int POWER_DOWN_TIMEOUT = 106; - - private Context mContext; - private BluetoothService mBluetoothService; - private BluetoothEventLoop mEventLoop; - - private BluetoothOn mBluetoothOn; - private Switching mSwitching; - private HotOff mHotOff; - private WarmUp mWarmUp; - private PowerOff mPowerOff; - private PerProcessState mPerProcessState; - - // this is the BluetoothAdapter state that reported externally - private int mPublicState; - // When turning off, broadcast STATE_OFF in the last HotOff state - // This is because we do HotOff -> PowerOff -> HotOff for USER_TURN_OFF - private boolean mDelayBroadcastStateOff; - - // timeout value waiting for all the devices to be disconnected - private static final int DEVICES_DISCONNECT_TIMEOUT_TIME = 3000; - - private static final int PREPARE_BLUETOOTH_TIMEOUT_TIME = 10000; - - private static final int TURN_OFF_TIMEOUT_TIME = 5000; - private static final int POWER_DOWN_TIMEOUT_TIME = 20; - - BluetoothAdapterStateMachine(Context context, BluetoothService bluetoothService, - BluetoothAdapter bluetoothAdapter) { - super(TAG); - mContext = context; - mBluetoothService = bluetoothService; - mEventLoop = new BluetoothEventLoop(context, bluetoothAdapter, bluetoothService, this); - - mBluetoothOn = new BluetoothOn(); - mSwitching = new Switching(); - mHotOff = new HotOff(); - mWarmUp = new WarmUp(); - mPowerOff = new PowerOff(); - mPerProcessState = new PerProcessState(); - - addState(mBluetoothOn); - addState(mSwitching); - addState(mHotOff); - addState(mWarmUp); - addState(mPowerOff); - addState(mPerProcessState); - - setInitialState(mPowerOff); - mPublicState = BluetoothAdapter.STATE_OFF; - mDelayBroadcastStateOff = false; - } - - /** - * Bluetooth module's power is off, firmware is not loaded. - */ - private class PowerOff extends State { - @Override - public void enter() { - if (DBG) log("Enter PowerOff: " + getCurrentMessage().what); - } - @Override - public boolean processMessage(Message message) { - log("PowerOff process message: " + message.what); - - boolean retValue = HANDLED; - switch(message.what) { - case USER_TURN_ON: - // starts turning on BT module, broadcast this out - broadcastState(BluetoothAdapter.STATE_TURNING_ON); - transitionTo(mWarmUp); - if (prepareBluetooth()) { - // this is user request, save the setting - if ((Boolean) message.obj) { - persistSwitchSetting(true); - } - // We will continue turn the BT on all the way to the BluetoothOn state - deferMessage(obtainMessage(TURN_ON_CONTINUE)); - } else { - Log.e(TAG, "failed to prepare bluetooth, abort turning on"); - transitionTo(mPowerOff); - broadcastState(BluetoothAdapter.STATE_OFF); - } - break; - case TURN_HOT: - if (prepareBluetooth()) { - transitionTo(mWarmUp); - } - break; - case AIRPLANE_MODE_OFF: - if (getBluetoothPersistedSetting()) { - // starts turning on BT module, broadcast this out - broadcastState(BluetoothAdapter.STATE_TURNING_ON); - transitionTo(mWarmUp); - if (prepareBluetooth()) { - // We will continue turn the BT on all the way to the BluetoothOn state - deferMessage(obtainMessage(TURN_ON_CONTINUE)); - transitionTo(mWarmUp); - } else { - Log.e(TAG, "failed to prepare bluetooth, abort turning on"); - transitionTo(mPowerOff); - broadcastState(BluetoothAdapter.STATE_OFF); - } - } else if (mContext.getResources().getBoolean - (com.android.internal.R.bool.config_bluetooth_adapter_quick_switch)) { - sendMessage(TURN_HOT); - } - break; - case PER_PROCESS_TURN_ON: - if (prepareBluetooth()) { - transitionTo(mWarmUp); - } - deferMessage(obtainMessage(PER_PROCESS_TURN_ON)); - break; - case PER_PROCESS_TURN_OFF: - perProcessCallback(false, (IBluetoothStateChangeCallback) message.obj); - break; - case USER_TURN_OFF: - Log.w(TAG, "PowerOff received: " + message.what); - case AIRPLANE_MODE_ON: // ignore - break; - default: - return NOT_HANDLED; - } - return retValue; - } - - /** - * Turn on Bluetooth Module, Load firmware, and do all the preparation - * needed to get the Bluetooth Module ready but keep it not discoverable - * and not connectable. - * The last step of this method sets up the local service record DB. - * There will be a event reporting the status of the SDP setup. - */ - private boolean prepareBluetooth() { - if (mBluetoothService.enableNative() != 0) { - return false; - } - - // try to start event loop, give 2 attempts - int retryCount = 2; - boolean eventLoopStarted = false; - while ((retryCount-- > 0) && !eventLoopStarted) { - mEventLoop.start(); - // it may take a moment for the other thread to do its - // thing. Check periodically for a while. - int pollCount = 5; - while ((pollCount-- > 0) && !eventLoopStarted) { - if (mEventLoop.isEventLoopRunning()) { - eventLoopStarted = true; - break; - } - try { - Thread.sleep(100); - } catch (InterruptedException e) { - log("prepareBluetooth sleep interrupted: " + pollCount); - break; - } - } - } - - if (!eventLoopStarted) { - mBluetoothService.disableNative(); - return false; - } - - // get BluetoothService ready - if (!mBluetoothService.prepareBluetooth()) { - mEventLoop.stop(); - mBluetoothService.disableNative(); - return false; - } - - sendMessageDelayed(PREPARE_BLUETOOTH_TIMEOUT, PREPARE_BLUETOOTH_TIMEOUT_TIME); - return true; - } - } - - /** - * Turning on Bluetooth module's power, loading firmware, starting - * event loop thread to listen on Bluetooth module event changes. - */ - private class WarmUp extends State { - - @Override - public void enter() { - if (DBG) log("Enter WarmUp: " + getCurrentMessage().what); - } - - @Override - public boolean processMessage(Message message) { - log("WarmUp process message: " + message.what); - - boolean retValue = HANDLED; - switch(message.what) { - case SERVICE_RECORD_LOADED: - removeMessages(PREPARE_BLUETOOTH_TIMEOUT); - transitionTo(mHotOff); - if (mDelayBroadcastStateOff) { - broadcastState(BluetoothAdapter.STATE_OFF); - mDelayBroadcastStateOff = false; - } - break; - case PREPARE_BLUETOOTH_TIMEOUT: - Log.e(TAG, "Bluetooth adapter SDP failed to load"); - shutoffBluetooth(); - transitionTo(mPowerOff); - broadcastState(BluetoothAdapter.STATE_OFF); - break; - case USER_TURN_ON: // handle this at HotOff state - case TURN_ON_CONTINUE: // Once in HotOff state, continue turn bluetooth - // on to the BluetoothOn state - case AIRPLANE_MODE_ON: - case AIRPLANE_MODE_OFF: - case PER_PROCESS_TURN_ON: - case PER_PROCESS_TURN_OFF: - deferMessage(message); - break; - case USER_TURN_OFF: - Log.w(TAG, "WarmUp received: " + message.what); - break; - default: - return NOT_HANDLED; - } - return retValue; - } - - } - - /** - * Bluetooth Module has powered, firmware loaded, event loop started, - * SDP loaded, but the modules stays non-discoverable and - * non-connectable. - */ - private class HotOff extends State { - @Override - public void enter() { - if (DBG) log("Enter HotOff: " + getCurrentMessage().what); - } - - @Override - public boolean processMessage(Message message) { - log("HotOff process message: " + message.what); - - boolean retValue = HANDLED; - switch(message.what) { - case USER_TURN_ON: - broadcastState(BluetoothAdapter.STATE_TURNING_ON); - if ((Boolean) message.obj) { - persistSwitchSetting(true); - } - // let it fall to TURN_ON_CONTINUE: - //$FALL-THROUGH$ - case TURN_ON_CONTINUE: - mBluetoothService.switchConnectable(true); - transitionTo(mSwitching); - break; - case AIRPLANE_MODE_ON: - case TURN_COLD: - shutoffBluetooth(); - // we cannot go to power off state yet, we need wait for the Bluetooth - // device power off. Unfortunately the stack does not give a event back - // so we wait a little bit here - sendMessageDelayed(POWER_DOWN_TIMEOUT, - POWER_DOWN_TIMEOUT_TIME); - break; - case POWER_DOWN_TIMEOUT: - transitionTo(mPowerOff); - if (!mDelayBroadcastStateOff) { - broadcastState(BluetoothAdapter.STATE_OFF); - } - break; - case AIRPLANE_MODE_OFF: - if (getBluetoothPersistedSetting()) { - broadcastState(BluetoothAdapter.STATE_TURNING_ON); - transitionTo(mSwitching); - mBluetoothService.switchConnectable(true); - } - break; - case PER_PROCESS_TURN_ON: - transitionTo(mPerProcessState); - - // Resend the PER_PROCESS_TURN_ON message so that the callback - // can be sent through. - deferMessage(message); - - mBluetoothService.switchConnectable(true); - break; - case PER_PROCESS_TURN_OFF: - perProcessCallback(false, (IBluetoothStateChangeCallback)message.obj); - break; - case USER_TURN_OFF: // ignore - break; - case POWER_STATE_CHANGED: - if ((Boolean) message.obj) { - recoverStateMachine(TURN_HOT, null); - } - break; - case TURN_HOT: - deferMessage(message); - break; - default: - return NOT_HANDLED; - } - return retValue; - } - - } - - private class Switching extends State { - - @Override - public void enter() { - if (DBG) log("Enter Switching: " + getCurrentMessage().what); - } - @Override - public boolean processMessage(Message message) { - log("Switching process message: " + message.what); - - boolean retValue = HANDLED; - switch(message.what) { - case SCAN_MODE_CHANGED: - // This event matches mBluetoothService.switchConnectable action - if (mPublicState == BluetoothAdapter.STATE_TURNING_ON) { - // set pairable if it's not - mBluetoothService.setPairable(); - mBluetoothService.initBluetoothAfterTurningOn(); - transitionTo(mBluetoothOn); - broadcastState(BluetoothAdapter.STATE_ON); - // run bluetooth now that it's turned on - // Note runBluetooth should be called only in adapter STATE_ON - mBluetoothService.runBluetooth(); - } - break; - case POWER_STATE_CHANGED: - removeMessages(TURN_OFF_TIMEOUT); - if (!((Boolean) message.obj)) { - if (mPublicState == BluetoothAdapter.STATE_TURNING_OFF) { - transitionTo(mHotOff); - mBluetoothService.finishDisable(); - mBluetoothService.cleanupAfterFinishDisable(); - deferMessage(obtainMessage(TURN_COLD)); - if (mContext.getResources().getBoolean - (com.android.internal.R.bool.config_bluetooth_adapter_quick_switch) && - !mBluetoothService.isAirplaneModeOn()) { - deferMessage(obtainMessage(TURN_HOT)); - mDelayBroadcastStateOff = true; - } - } - } else { - if (mPublicState != BluetoothAdapter.STATE_TURNING_ON) { - if (mContext.getResources().getBoolean - (com.android.internal.R.bool.config_bluetooth_adapter_quick_switch)) { - recoverStateMachine(TURN_HOT, null); - } else { - recoverStateMachine(TURN_COLD, null); - } - } - } - break; - case ALL_DEVICES_DISCONNECTED: - removeMessages(DEVICES_DISCONNECT_TIMEOUT); - mBluetoothService.switchConnectable(false); - sendMessageDelayed(TURN_OFF_TIMEOUT, TURN_OFF_TIMEOUT_TIME); - break; - case DEVICES_DISCONNECT_TIMEOUT: - sendMessage(ALL_DEVICES_DISCONNECTED); - // reset the hardware for error recovery - Log.e(TAG, "Devices failed to disconnect, reseting..."); - deferMessage(obtainMessage(TURN_COLD)); - if (mContext.getResources().getBoolean - (com.android.internal.R.bool.config_bluetooth_adapter_quick_switch)) { - deferMessage(obtainMessage(TURN_HOT)); - } - break; - case TURN_OFF_TIMEOUT: - transitionTo(mHotOff); - finishSwitchingOff(); - // reset the hardware for error recovery - Log.e(TAG, "Devices failed to power down, reseting..."); - deferMessage(obtainMessage(TURN_COLD)); - if (mContext.getResources().getBoolean - (com.android.internal.R.bool.config_bluetooth_adapter_quick_switch)) { - deferMessage(obtainMessage(TURN_HOT)); - } - break; - case USER_TURN_ON: - case AIRPLANE_MODE_OFF: - case AIRPLANE_MODE_ON: - case PER_PROCESS_TURN_ON: - case PER_PROCESS_TURN_OFF: - case USER_TURN_OFF: - deferMessage(message); - break; - - default: - return NOT_HANDLED; - } - return retValue; - } - } - - private class BluetoothOn extends State { - - @Override - public void enter() { - if (DBG) log("Enter BluetoothOn: " + getCurrentMessage().what); - } - @Override - public boolean processMessage(Message message) { - log("BluetoothOn process message: " + message.what); - - boolean retValue = HANDLED; - switch(message.what) { - case USER_TURN_OFF: - if ((Boolean) message.obj) { - persistSwitchSetting(false); - } - - if (mBluetoothService.isDiscovering()) { - mBluetoothService.cancelDiscovery(); - } - if (!mBluetoothService.isApplicationStateChangeTrackerEmpty()) { - transitionTo(mPerProcessState); - deferMessage(obtainMessage(TURN_HOT)); - break; - } - //$FALL-THROUGH$ to AIRPLANE_MODE_ON - case AIRPLANE_MODE_ON: - broadcastState(BluetoothAdapter.STATE_TURNING_OFF); - transitionTo(mSwitching); - if (mBluetoothService.getAdapterConnectionState() != - BluetoothAdapter.STATE_DISCONNECTED) { - mBluetoothService.disconnectDevices(); - sendMessageDelayed(DEVICES_DISCONNECT_TIMEOUT, - DEVICES_DISCONNECT_TIMEOUT_TIME); - } else { - mBluetoothService.switchConnectable(false); - sendMessageDelayed(TURN_OFF_TIMEOUT, TURN_OFF_TIMEOUT_TIME); - } - - if (message.what == AIRPLANE_MODE_ON || mBluetoothService.isAirplaneModeOn()) { - // We inform all the per process callbacks - allProcessesCallback(false); - } - break; - case AIRPLANE_MODE_OFF: - case USER_TURN_ON: - Log.w(TAG, "BluetoothOn received: " + message.what); - break; - case PER_PROCESS_TURN_ON: - perProcessCallback(true, (IBluetoothStateChangeCallback)message.obj); - break; - case PER_PROCESS_TURN_OFF: - perProcessCallback(false, (IBluetoothStateChangeCallback)message.obj); - break; - case POWER_STATE_CHANGED: - if ((Boolean) message.obj) { - // reset the state machine and send it TURN_ON_CONTINUE message - recoverStateMachine(USER_TURN_ON, false); - } - break; - default: - return NOT_HANDLED; - } - return retValue; - } - - } - - - private class PerProcessState extends State { - IBluetoothStateChangeCallback mCallback = null; - boolean isTurningOn = false; - - @Override - public void enter() { - int what = getCurrentMessage().what; - if (DBG) log("Enter PerProcessState: " + what); - - if (what == PER_PROCESS_TURN_ON) { - isTurningOn = true; - } else if (what == USER_TURN_OFF) { - isTurningOn = false; - } else { - Log.e(TAG, "enter PerProcessState: wrong msg: " + what); - } - } - - @Override - public boolean processMessage(Message message) { - log("PerProcessState process message: " + message.what); - - boolean retValue = HANDLED; - switch (message.what) { - case PER_PROCESS_TURN_ON: - mCallback = (IBluetoothStateChangeCallback)getCurrentMessage().obj; - - // If this is not the first application call the callback. - if (mBluetoothService.getNumberOfApplicationStateChangeTrackers() > 1) { - perProcessCallback(true, mCallback); - } - break; - case SCAN_MODE_CHANGED: - if (isTurningOn) { - perProcessCallback(true, mCallback); - isTurningOn = false; - } - break; - case POWER_STATE_CHANGED: - removeMessages(TURN_OFF_TIMEOUT); - if (!((Boolean) message.obj)) { - transitionTo(mHotOff); - if (!mContext.getResources().getBoolean - (com.android.internal.R.bool.config_bluetooth_adapter_quick_switch)) { - deferMessage(obtainMessage(TURN_COLD)); - } - } else { - if (!isTurningOn) { - recoverStateMachine(TURN_COLD, null); - for (IBluetoothStateChangeCallback c: - mBluetoothService.getApplicationStateChangeCallbacks()) { - perProcessCallback(false, c); - deferMessage(obtainMessage(PER_PROCESS_TURN_ON, c)); - } - } - } - break; - case TURN_OFF_TIMEOUT: - transitionTo(mHotOff); - Log.e(TAG, "Power-down timed out, resetting..."); - deferMessage(obtainMessage(TURN_COLD)); - if (mContext.getResources().getBoolean - (com.android.internal.R.bool.config_bluetooth_adapter_quick_switch)) { - deferMessage(obtainMessage(TURN_HOT)); - } - break; - case USER_TURN_ON: - broadcastState(BluetoothAdapter.STATE_TURNING_ON); - persistSwitchSetting(true); - mBluetoothService.initBluetoothAfterTurningOn(); - transitionTo(mBluetoothOn); - broadcastState(BluetoothAdapter.STATE_ON); - // run bluetooth now that it's turned on - mBluetoothService.runBluetooth(); - break; - case TURN_HOT: - broadcastState(BluetoothAdapter.STATE_TURNING_OFF); - if (mBluetoothService.getAdapterConnectionState() != - BluetoothAdapter.STATE_DISCONNECTED) { - mBluetoothService.disconnectDevices(); - sendMessageDelayed(DEVICES_DISCONNECT_TIMEOUT, - DEVICES_DISCONNECT_TIMEOUT_TIME); - break; - } - //$FALL-THROUGH$ all devices are already disconnected - case ALL_DEVICES_DISCONNECTED: - removeMessages(DEVICES_DISCONNECT_TIMEOUT); - finishSwitchingOff(); - break; - case DEVICES_DISCONNECT_TIMEOUT: - finishSwitchingOff(); - Log.e(TAG, "Devices fail to disconnect, reseting..."); - transitionTo(mHotOff); - deferMessage(obtainMessage(TURN_COLD)); - for (IBluetoothStateChangeCallback c: - mBluetoothService.getApplicationStateChangeCallbacks()) { - perProcessCallback(false, c); - deferMessage(obtainMessage(PER_PROCESS_TURN_ON, c)); - } - break; - case PER_PROCESS_TURN_OFF: - perProcessCallback(false, (IBluetoothStateChangeCallback)message.obj); - if (mBluetoothService.isApplicationStateChangeTrackerEmpty()) { - mBluetoothService.switchConnectable(false); - sendMessageDelayed(TURN_OFF_TIMEOUT, TURN_OFF_TIMEOUT_TIME); - } - break; - case AIRPLANE_MODE_ON: - mBluetoothService.switchConnectable(false); - sendMessageDelayed(TURN_OFF_TIMEOUT, TURN_OFF_TIMEOUT_TIME); - allProcessesCallback(false); - break; - case USER_TURN_OFF: - Log.w(TAG, "PerProcessState received: " + message.what); - break; - default: - return NOT_HANDLED; - } - return retValue; - } - } - - private void finishSwitchingOff() { - mBluetoothService.finishDisable(); - broadcastState(BluetoothAdapter.STATE_OFF); - mBluetoothService.cleanupAfterFinishDisable(); - } - - private void shutoffBluetooth() { - mBluetoothService.shutoffBluetooth(); - mEventLoop.stop(); - mBluetoothService.cleanNativeAfterShutoffBluetooth(); - } - - private void perProcessCallback(boolean on, IBluetoothStateChangeCallback c) { - if (c == null) return; - - try { - c.onBluetoothStateChange(on); - } catch (RemoteException e) {} - } - - private void allProcessesCallback(boolean on) { - for (IBluetoothStateChangeCallback c: - mBluetoothService.getApplicationStateChangeCallbacks()) { - perProcessCallback(on, c); - } - if (!on) { - mBluetoothService.clearApplicationStateChangeTracker(); - } - } - - /** - * Return the public BluetoothAdapter state - */ - int getBluetoothAdapterState() { - return mPublicState; - } - - BluetoothEventLoop getBluetoothEventLoop() { - return mEventLoop; - } - - private void persistSwitchSetting(boolean setOn) { - long origCallerIdentityToken = Binder.clearCallingIdentity(); - Settings.Secure.putInt(mContext.getContentResolver(), - Settings.Secure.BLUETOOTH_ON, - setOn ? 1 : 0); - Binder.restoreCallingIdentity(origCallerIdentityToken); - } - - private boolean getBluetoothPersistedSetting() { - ContentResolver contentResolver = mContext.getContentResolver(); - return (Settings.Secure.getInt(contentResolver, - Settings.Secure.BLUETOOTH_ON, 0) > 0); - } - - private void broadcastState(int newState) { - - log("Bluetooth state " + mPublicState + " -> " + newState); - if (mPublicState == newState) { - return; - } - - Intent intent = new Intent(BluetoothAdapter.ACTION_STATE_CHANGED); - intent.putExtra(BluetoothAdapter.EXTRA_PREVIOUS_STATE, mPublicState); - intent.putExtra(BluetoothAdapter.EXTRA_STATE, newState); - intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT); - mPublicState = newState; - - mContext.sendBroadcast(intent, BluetoothService.BLUETOOTH_PERM); - } - - /** - * bluetoothd has crashed and recovered, the adapter state machine has to - * reset itself and try to return to previous state - */ - private void recoverStateMachine(int what, Object obj) { - Log.e(TAG, "Get unexpected power on event, reset with: " + what); - transitionTo(mHotOff); - deferMessage(obtainMessage(TURN_COLD)); - deferMessage(obtainMessage(what, obj)); - } - - private void dump(PrintWriter pw) { - IState currentState = getCurrentState(); - if (currentState == mPowerOff) { - pw.println("Bluetooth OFF - power down\n"); - } else if (currentState == mWarmUp) { - pw.println("Bluetooth OFF - warm up\n"); - } else if (currentState == mHotOff) { - pw.println("Bluetooth OFF - hot but off\n"); - } else if (currentState == mSwitching) { - pw.println("Bluetooth Switching\n"); - } else if (currentState == mBluetoothOn) { - pw.println("Bluetooth ON\n"); - } else { - pw.println("ERROR: Bluetooth UNKNOWN STATE "); - } - } - - private static void log(String msg) { - Log.d(TAG, msg); - } -} diff --git a/core/java/android/server/BluetoothBondState.java b/core/java/android/server/BluetoothBondState.java deleted file mode 100644 index 0446f0262596d..0000000000000 --- a/core/java/android/server/BluetoothBondState.java +++ /dev/null @@ -1,497 +0,0 @@ -/* - * Copyright (C) 2010 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.server; - -import android.bluetooth.BluetoothAdapter; -import android.bluetooth.BluetoothDevice; -import android.bluetooth.BluetoothProfile; -import android.bluetooth.BluetoothA2dp; -import android.bluetooth.BluetoothHeadset; -import android.content.BroadcastReceiver; -import android.content.ContentResolver; -import android.content.Context; -import android.content.Intent; -import android.content.IntentFilter; -import android.content.SharedPreferences; -import android.provider.Settings; -import android.util.Log; - -import java.io.BufferedReader; -import java.io.BufferedWriter; -import java.io.DataInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.FileWriter; -import java.io.IOException; -import java.io.InputStreamReader; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; - -/** - * Local cache of bonding state. - * We keep our own state to track the intermediate state BONDING, which - * bluez does not track. - * All addresses must be passed in upper case. - */ -class BluetoothBondState { - private static final String TAG = "BluetoothBondState"; - private static final boolean DBG = true; - - private final HashMap mState = new HashMap(); - private final HashMap mPinAttempt = new HashMap(); - - private static final String AUTO_PAIRING_BLACKLIST = - "/etc/bluetooth/auto_pairing.conf"; - private static final String DYNAMIC_AUTO_PAIRING_BLACKLIST = - "/data/misc/bluetooth/dynamic_auto_pairing.conf"; - private ArrayList mAutoPairingAddressBlacklist; - private ArrayList mAutoPairingExactNameBlacklist; - private ArrayList mAutoPairingPartialNameBlacklist; - private ArrayList mAutoPairingFixedPinZerosKeyboardList; - // Addresses added to blacklist dynamically based on usage. - private ArrayList mAutoPairingDynamicAddressBlacklist; - - // If this is an outgoing connection, store the address. - // There can be only 1 pending outgoing connection at a time, - private String mPendingOutgoingBonding; - - private final Context mContext; - private final BluetoothService mService; - private final BluetoothInputProfileHandler mBluetoothInputProfileHandler; - private BluetoothA2dp mA2dpProxy; - private BluetoothHeadset mHeadsetProxy; - - private ArrayList mPairingRequestRcvd = new ArrayList(); - - BluetoothBondState(Context context, BluetoothService service) { - mContext = context; - mService = service; - mBluetoothInputProfileHandler = - BluetoothInputProfileHandler.getInstance(mContext, mService); - - IntentFilter filter = new IntentFilter(); - filter.addAction(BluetoothDevice.ACTION_PAIRING_REQUEST); - mContext.registerReceiver(mReceiver, filter); - readAutoPairingData(); - } - - synchronized void setPendingOutgoingBonding(String address) { - mPendingOutgoingBonding = address; - } - - public synchronized String getPendingOutgoingBonding() { - return mPendingOutgoingBonding; - } - - public synchronized void initBondState() { - getProfileProxy(); - loadBondState(); - } - - private void loadBondState() { - if (mService.getBluetoothStateInternal() != - BluetoothAdapter.STATE_TURNING_ON) { - return; - } - String val = mService.getAdapterProperties().getProperty("Devices"); - if (val == null) { - return; - } - String[] bonds = val.split(","); - if (bonds == null) { - return; - } - mState.clear(); - if (DBG) Log.d(TAG, "found " + bonds.length + " bonded devices"); - for (String device : bonds) { - mState.put(mService.getAddressFromObjectPath(device).toUpperCase(), - BluetoothDevice.BOND_BONDED); - } - } - - public synchronized void setBondState(String address, int state) { - setBondState(address, state, 0); - } - - /** reason is ignored unless state == BOND_NOT_BONDED */ - public synchronized void setBondState(String address, int state, int reason) { - if (DBG) Log.d(TAG, "setBondState " + "address" + " " + state + "reason: " + reason); - - int oldState = getBondState(address); - if (oldState == state) { - return; - } - - // Check if this was a pending outgoing bonding. - // If yes, reset the state. - if (oldState == BluetoothDevice.BOND_BONDING) { - if (address.equals(mPendingOutgoingBonding)) { - mPendingOutgoingBonding = null; - } - } - - if (state == BluetoothDevice.BOND_BONDED) { - boolean setTrust = false; - if (mPairingRequestRcvd.contains(address)) setTrust = true; - - mService.addProfileState(address, setTrust); - mPairingRequestRcvd.remove(address); - - } else if (state == BluetoothDevice.BOND_BONDING) { - if (mA2dpProxy == null || mHeadsetProxy == null) { - getProfileProxy(); - } - } else if (state == BluetoothDevice.BOND_NONE) { - mPairingRequestRcvd.remove(address); - } - - setProfilePriorities(address, state); - - if (DBG) { - Log.d(TAG, address + " bond state " + oldState + " -> " + state - + " (" + reason + ")"); - } - Intent intent = new Intent(BluetoothDevice.ACTION_BOND_STATE_CHANGED); - intent.putExtra(BluetoothDevice.EXTRA_DEVICE, mService.getRemoteDevice(address)); - intent.putExtra(BluetoothDevice.EXTRA_BOND_STATE, state); - intent.putExtra(BluetoothDevice.EXTRA_PREVIOUS_BOND_STATE, oldState); - if (state == BluetoothDevice.BOND_NONE) { - if (reason <= 0) { - Log.w(TAG, "setBondState() called to unbond device, but reason code is " + - "invalid. Overriding reason code with BOND_RESULT_REMOVED"); - reason = BluetoothDevice.UNBOND_REASON_REMOVED; - } - intent.putExtra(BluetoothDevice.EXTRA_REASON, reason); - mState.remove(address); - } else { - mState.put(address, state); - } - - mContext.sendBroadcast(intent, BluetoothService.BLUETOOTH_PERM); - } - - public boolean isAutoPairingBlacklisted(String address) { - if (mAutoPairingAddressBlacklist != null) { - for (String blacklistAddress : mAutoPairingAddressBlacklist) { - if (address.startsWith(blacklistAddress)) return true; - } - } - - if (mAutoPairingDynamicAddressBlacklist != null) { - for (String blacklistAddress: mAutoPairingDynamicAddressBlacklist) { - if (address.equals(blacklistAddress)) return true; - } - } - - String name = mService.getRemoteName(address); - if (name != null) { - if (mAutoPairingExactNameBlacklist != null) { - for (String blacklistName : mAutoPairingExactNameBlacklist) { - if (name.equals(blacklistName)) return true; - } - } - - if (mAutoPairingPartialNameBlacklist != null) { - for (String blacklistName : mAutoPairingPartialNameBlacklist) { - if (name.startsWith(blacklistName)) return true; - } - } - } - return false; - } - - public boolean isFixedPinZerosAutoPairKeyboard(String address) { - // Note: the meaning of blacklist is reversed in this case. - // If its in the list, we can go ahead and auto pair since - // by default keyboard should have a variable PIN that we don't - // auto pair using 0000. - if (mAutoPairingFixedPinZerosKeyboardList != null) { - for (String blacklistAddress : mAutoPairingFixedPinZerosKeyboardList) { - if (address.startsWith(blacklistAddress)) return true; - } - } - return false; - } - - public synchronized int getBondState(String address) { - Integer state = mState.get(address); - if (state == null) { - return BluetoothDevice.BOND_NONE; - } - return state.intValue(); - } - - /*package*/ synchronized String[] listInState(int state) { - ArrayList result = new ArrayList(mState.size()); - for (Map.Entry e : mState.entrySet()) { - if (e.getValue().intValue() == state) { - result.add(e.getKey()); - } - } - return result.toArray(new String[result.size()]); - } - - public synchronized void addAutoPairingFailure(String address) { - if (mAutoPairingDynamicAddressBlacklist == null) { - mAutoPairingDynamicAddressBlacklist = new ArrayList(); - } - - updateAutoPairingData(address); - mAutoPairingDynamicAddressBlacklist.add(address); - } - - public synchronized boolean isAutoPairingAttemptsInProgress(String address) { - return getAttempt(address) != 0; - } - - public synchronized void clearPinAttempts(String address) { - if (DBG) Log.d(TAG, "clearPinAttempts: " + address); - - mPinAttempt.remove(address); - } - - public synchronized boolean hasAutoPairingFailed(String address) { - if (mAutoPairingDynamicAddressBlacklist == null) return false; - - return mAutoPairingDynamicAddressBlacklist.contains(address); - } - - public synchronized int getAttempt(String address) { - Integer attempt = mPinAttempt.get(address); - if (attempt == null) { - return 0; - } - return attempt.intValue(); - } - - public synchronized void attempt(String address) { - Integer attempt = mPinAttempt.get(address); - int newAttempt; - if (attempt == null) { - newAttempt = 1; - } else { - newAttempt = attempt.intValue() + 1; - } - if (DBG) Log.d(TAG, "attemp newAttempt: " + newAttempt); - - mPinAttempt.put(address, new Integer(newAttempt)); - } - - private void getProfileProxy() { - BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); - - if (mA2dpProxy == null) { - bluetoothAdapter.getProfileProxy(mContext, mProfileServiceListener, - BluetoothProfile.A2DP); - } - - if (mHeadsetProxy == null) { - bluetoothAdapter.getProfileProxy(mContext, mProfileServiceListener, - BluetoothProfile.HEADSET); - } - } - - private void closeProfileProxy() { - BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); - - if (mA2dpProxy != null) { - bluetoothAdapter.closeProfileProxy(BluetoothProfile.A2DP, mA2dpProxy); - } - - if (mHeadsetProxy != null) { - bluetoothAdapter.closeProfileProxy(BluetoothProfile.HEADSET, mHeadsetProxy); - } - } - - private BluetoothProfile.ServiceListener mProfileServiceListener = - new BluetoothProfile.ServiceListener() { - - public void onServiceConnected(int profile, BluetoothProfile proxy) { - if (profile == BluetoothProfile.A2DP) { - mA2dpProxy = (BluetoothA2dp) proxy; - } else if (profile == BluetoothProfile.HEADSET) { - mHeadsetProxy = (BluetoothHeadset) proxy; - } - } - - public void onServiceDisconnected(int profile) { - if (profile == BluetoothProfile.A2DP) { - mA2dpProxy = null; - } else if (profile == BluetoothProfile.HEADSET) { - mHeadsetProxy = null; - } - } - }; - - private void copyAutoPairingData() { - FileInputStream in = null; - FileOutputStream out = null; - try { - File file = new File(DYNAMIC_AUTO_PAIRING_BLACKLIST); - if (file.exists()) return; - - in = new FileInputStream(AUTO_PAIRING_BLACKLIST); - out= new FileOutputStream(DYNAMIC_AUTO_PAIRING_BLACKLIST); - - byte[] buf = new byte[1024]; - int len; - while ((len = in.read(buf)) > 0) { - out.write(buf, 0, len); - } - } catch (FileNotFoundException e) { - Log.e(TAG, "FileNotFoundException: copyAutoPairingData " + e); - } catch (IOException e) { - Log.e(TAG, "IOException: copyAutoPairingData " + e); - } finally { - try { - if (in != null) in.close(); - if (out != null) out.close(); - } catch (IOException e) {} - } - } - - synchronized public void readAutoPairingData() { - if (mAutoPairingAddressBlacklist != null) return; - copyAutoPairingData(); - FileInputStream fstream = null; - try { - fstream = new FileInputStream(DYNAMIC_AUTO_PAIRING_BLACKLIST); - DataInputStream in = new DataInputStream(fstream); - BufferedReader file = new BufferedReader(new InputStreamReader(in)); - String line; - while((line = file.readLine()) != null) { - line = line.trim(); - if (line.length() == 0 || line.startsWith("//")) continue; - String[] value = line.split("="); - if (value != null && value.length == 2) { - String[] val = value[1].split(","); - if (value[0].equalsIgnoreCase("AddressBlacklist")) { - mAutoPairingAddressBlacklist = - new ArrayList(Arrays.asList(val)); - } else if (value[0].equalsIgnoreCase("ExactNameBlacklist")) { - mAutoPairingExactNameBlacklist = - new ArrayList(Arrays.asList(val)); - } else if (value[0].equalsIgnoreCase("PartialNameBlacklist")) { - mAutoPairingPartialNameBlacklist = - new ArrayList(Arrays.asList(val)); - } else if (value[0].equalsIgnoreCase("FixedPinZerosKeyboardBlacklist")) { - mAutoPairingFixedPinZerosKeyboardList = - new ArrayList(Arrays.asList(val)); - } else if (value[0].equalsIgnoreCase("DynamicAddressBlacklist")) { - mAutoPairingDynamicAddressBlacklist = - new ArrayList(Arrays.asList(val)); - } else { - Log.e(TAG, "Error parsing Auto pairing blacklist file"); - } - } - } - } catch (FileNotFoundException e) { - Log.e(TAG, "FileNotFoundException: readAutoPairingData " + e); - } catch (IOException e) { - Log.e(TAG, "IOException: readAutoPairingData " + e); - } finally { - if (fstream != null) { - try { - fstream.close(); - } catch (IOException e) { - // Ignore - } - } - } - } - - // This function adds a bluetooth address to the auto pairing blacklist - // file. These addresses are added to DynamicAddressBlacklistSection - private void updateAutoPairingData(String address) { - BufferedWriter out = null; - try { - out = new BufferedWriter(new FileWriter(DYNAMIC_AUTO_PAIRING_BLACKLIST, true)); - StringBuilder str = new StringBuilder(); - if (mAutoPairingDynamicAddressBlacklist.size() == 0) { - str.append("DynamicAddressBlacklist="); - } - str.append(address); - str.append(","); - out.write(str.toString()); - } catch (FileNotFoundException e) { - Log.e(TAG, "FileNotFoundException: updateAutoPairingData " + e); - } catch (IOException e) { - Log.e(TAG, "IOException: updateAutoPairingData " + e); - } finally { - if (out != null) { - try { - out.close(); - } catch (IOException e) { - // Ignore - } - } - } - } - - // Set service priority of Hid, A2DP and Headset profiles depending on - // the bond state change - private void setProfilePriorities(String address, int state) { - BluetoothDevice remoteDevice = mService.getRemoteDevice(address); - // HID is handled by BluetoothService - mBluetoothInputProfileHandler.setInitialInputDevicePriority(remoteDevice, state); - - // Set service priority of A2DP and Headset - // We used to do the priority change in the 2 services after the broadcast - // intent reach them. But that left a small time gap that could reject - // incoming connection due to undefined priorities. - if (state == BluetoothDevice.BOND_BONDED) { - if (mA2dpProxy != null && - mA2dpProxy.getPriority(remoteDevice) == BluetoothProfile.PRIORITY_UNDEFINED) { - mA2dpProxy.setPriority(remoteDevice, BluetoothProfile.PRIORITY_ON); - } - - if (mHeadsetProxy != null && - mHeadsetProxy.getPriority(remoteDevice) == BluetoothProfile.PRIORITY_UNDEFINED) { - mHeadsetProxy.setPriority(remoteDevice, BluetoothProfile.PRIORITY_ON); - } - } else if (state == BluetoothDevice.BOND_NONE) { - if (mA2dpProxy != null) { - mA2dpProxy.setPriority(remoteDevice, BluetoothProfile.PRIORITY_UNDEFINED); - } - if (mHeadsetProxy != null) { - mHeadsetProxy.setPriority(remoteDevice, BluetoothProfile.PRIORITY_UNDEFINED); - } - } - - if (mA2dpProxy == null || mHeadsetProxy == null) { - Log.e(TAG, "Proxy is null:" + mA2dpProxy + ":" + mHeadsetProxy); - } - } - - private final BroadcastReceiver mReceiver = new BroadcastReceiver() { - @Override - public void onReceive(Context context, Intent intent) { - if (intent == null) return; - - String action = intent.getAction(); - if (action.equals(BluetoothDevice.ACTION_PAIRING_REQUEST)) { - BluetoothDevice dev = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE); - String address = dev.getAddress(); - mPairingRequestRcvd.add(address); - } - } - }; -} diff --git a/core/java/android/server/BluetoothDeviceProperties.java b/core/java/android/server/BluetoothDeviceProperties.java deleted file mode 100644 index fe3ef793e8cdf..0000000000000 --- a/core/java/android/server/BluetoothDeviceProperties.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (C) 2010 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.server; - -import android.os.ParcelUuid; -import android.util.Log; - -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - -class BluetoothDeviceProperties { - - private static final String TAG = "BluetoothDeviceProperties"; - - private final HashMap> mPropertiesMap; - private final BluetoothService mService; - - BluetoothDeviceProperties(BluetoothService service) { - mPropertiesMap = new HashMap>(); - mService = service; - } - - Map addProperties(String address, String[] properties) { - /* - * We get a DeviceFound signal every time RSSI changes or name changes. - * Don't create a new Map object every time. - */ - Map propertyValues; - synchronized(mPropertiesMap) { - propertyValues = mPropertiesMap.get(address); - if (propertyValues == null) { - propertyValues = new HashMap(); - } - - for (int i = 0; i < properties.length; i++) { - String name = properties[i]; - String newValue = null; - int len; - if (name == null) { - Log.e(TAG, "Error: Remote Device Property at index " - + i + " is null"); - continue; - } - if (name.equals("UUIDs") || name.equals("Nodes")) { - StringBuilder str = new StringBuilder(); - len = Integer.valueOf(properties[++i]); - for (int j = 0; j < len; j++) { - str.append(properties[++i]); - str.append(","); - } - if (len > 0) { - newValue = str.toString(); - } - } else { - newValue = properties[++i]; - } - - propertyValues.put(name, newValue); - } - mPropertiesMap.put(address, propertyValues); - } - - // We have added a new remote device or updated its properties. - // Also update the serviceChannel cache. - mService.updateDeviceServiceChannelCache(address); - return propertyValues; - } - - void setProperty(String address, String name, String value) { - synchronized(mPropertiesMap) { - Map propVal = mPropertiesMap.get(address); - if (propVal != null) { - propVal.put(name, value); - mPropertiesMap.put(address, propVal); - } else { - Log.e(TAG, "setRemoteDeviceProperty for a device not in cache:" + address); - } - } - } - - boolean isInCache(String address) { - synchronized (mPropertiesMap) { - return (mPropertiesMap.get(address) != null); - } - } - - boolean isEmpty() { - synchronized (mPropertiesMap) { - return mPropertiesMap.isEmpty(); - } - } - - Set keySet() { - synchronized (mPropertiesMap) { - return mPropertiesMap.keySet(); - } - } - - String getProperty(String address, String property) { - synchronized(mPropertiesMap) { - Map properties = mPropertiesMap.get(address); - if (properties != null) { - return properties.get(property); - } else { - // Query for remote device properties, again. - // We will need to reload the cache when we switch Bluetooth on / off - // or if we crash. - properties = updateCache(address); - if (properties != null) { - return properties.get(property); - } - } - } - Log.e(TAG, "getRemoteDeviceProperty: " + property + " not present: " + address); - return null; - } - - Map updateCache(String address) { - String[] propValues = mService.getRemoteDeviceProperties(address); - if (propValues != null) { - return addProperties(address, propValues); - } - return null; - } -} diff --git a/core/java/android/server/BluetoothEventLoop.java b/core/java/android/server/BluetoothEventLoop.java deleted file mode 100644 index b758e7fa08865..0000000000000 --- a/core/java/android/server/BluetoothEventLoop.java +++ /dev/null @@ -1,1067 +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.server; - -import android.bluetooth.BluetoothA2dp; -import android.bluetooth.BluetoothAdapter; -import android.bluetooth.BluetoothClass; -import android.bluetooth.BluetoothDevice; -import android.bluetooth.BluetoothHealth; -import android.bluetooth.BluetoothInputDevice; -import android.bluetooth.BluetoothPan; -import android.bluetooth.BluetoothProfile; -import android.bluetooth.BluetoothUuid; -import android.content.Context; -import android.content.Intent; -import android.os.Handler; -import android.os.Message; -import android.os.ParcelUuid; -import android.os.PowerManager; -import android.util.Log; - -import java.util.HashMap; -import java.util.List; - - -/** - * @hide - */ -class BluetoothEventLoop { - private static final String TAG = "BluetoothEventLoop"; - private static final boolean DBG = false; - - private int mNativeData; - private Thread mThread; - private boolean mStarted; - private boolean mInterrupted; - - private final HashMap mPasskeyAgentRequestData; - private final HashMap mAuthorizationAgentRequestData; - private final BluetoothService mBluetoothService; - private final BluetoothAdapter mAdapter; - private final BluetoothAdapterStateMachine mBluetoothState; - private BluetoothA2dp mA2dp; - private final Context mContext; - // The WakeLock is used for bringing up the LCD during a pairing request - // from remote device when Android is in Suspend state. - private PowerManager.WakeLock mWakeLock; - - private static final int EVENT_PAIRING_CONSENT_DELAYED_ACCEPT = 1; - private static final int EVENT_AGENT_CANCEL = 2; - - private static final int CREATE_DEVICE_ALREADY_EXISTS = 1; - private static final int CREATE_DEVICE_SUCCESS = 0; - private static final int CREATE_DEVICE_FAILED = -1; - - private static final String BLUETOOTH_ADMIN_PERM = android.Manifest.permission.BLUETOOTH_ADMIN; - private static final String BLUETOOTH_PERM = android.Manifest.permission.BLUETOOTH; - - private final Handler mHandler = new Handler() { - @Override - public void handleMessage(Message msg) { - String address = null; - switch (msg.what) { - case EVENT_PAIRING_CONSENT_DELAYED_ACCEPT: - address = (String)msg.obj; - if (address != null) { - mBluetoothService.setPairingConfirmation(address, true); - } - break; - case EVENT_AGENT_CANCEL: - // Set the Bond State to BOND_NONE. - // We always have only 1 device in BONDING state. - String[] devices = mBluetoothService.listInState(BluetoothDevice.BOND_BONDING); - if (devices.length == 0) { - break; - } else if (devices.length > 1) { - Log.e(TAG, " There is more than one device in the Bonding State"); - break; - } - address = devices[0]; - mBluetoothService.setBondState(address, - BluetoothDevice.BOND_NONE, - BluetoothDevice.UNBOND_REASON_REMOTE_AUTH_CANCELED); - break; - } - } - }; - - static { classInitNative(); } - private static native void classInitNative(); - - /* package */ BluetoothEventLoop(Context context, BluetoothAdapter adapter, - BluetoothService bluetoothService, - BluetoothAdapterStateMachine bluetoothState) { - mBluetoothService = bluetoothService; - mContext = context; - mBluetoothState = bluetoothState; - mPasskeyAgentRequestData = new HashMap(); - mAuthorizationAgentRequestData = new HashMap(); - mAdapter = adapter; - //WakeLock instantiation in BluetoothEventLoop class - PowerManager pm = (PowerManager)context.getSystemService(Context.POWER_SERVICE); - mWakeLock = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP - | PowerManager.ON_AFTER_RELEASE, TAG); - mWakeLock.setReferenceCounted(false); - initializeNativeDataNative(); - } - - /*package*/ void getProfileProxy() { - mAdapter.getProfileProxy(mContext, mProfileServiceListener, BluetoothProfile.A2DP); - mAdapter.getProfileProxy(mContext, mProfileServiceListener, BluetoothProfile.INPUT_DEVICE); - } - - private BluetoothProfile.ServiceListener mProfileServiceListener = - new BluetoothProfile.ServiceListener() { - public void onServiceConnected(int profile, BluetoothProfile proxy) { - if (profile == BluetoothProfile.A2DP) { - mA2dp = (BluetoothA2dp) proxy; - } - } - public void onServiceDisconnected(int profile) { - if (profile == BluetoothProfile.A2DP) { - mA2dp = null; - } - } - }; - - - protected void finalize() throws Throwable { - try { - cleanupNativeDataNative(); - } finally { - super.finalize(); - } - } - - /* package */ HashMap getPasskeyAgentRequestData() { - return mPasskeyAgentRequestData; - } - - /* package */ HashMap getAuthorizationAgentRequestData() { - return mAuthorizationAgentRequestData; - } - - /* package */ void start() { - - if (!isEventLoopRunningNative()) { - if (DBG) log("Starting Event Loop thread"); - startEventLoopNative(); - } - } - - public void stop() { - if (isEventLoopRunningNative()) { - if (DBG) log("Stopping Event Loop thread"); - stopEventLoopNative(); - } - } - - public boolean isEventLoopRunning() { - return isEventLoopRunningNative(); - } - - private void addDevice(String address, String[] properties) { - BluetoothDeviceProperties deviceProperties = - mBluetoothService.getDeviceProperties(); - deviceProperties.addProperties(address, properties); - String rssi = deviceProperties.getProperty(address, "RSSI"); - String classValue = deviceProperties.getProperty(address, "Class"); - String name = deviceProperties.getProperty(address, "Name"); - short rssiValue; - // For incoming connections, we don't get the RSSI value. Use a default of MIN_VALUE. - // If we accept the pairing, we will automatically show it at the top of the list. - if (rssi != null) { - rssiValue = (short)Integer.valueOf(rssi).intValue(); - } else { - rssiValue = Short.MIN_VALUE; - } - if (classValue != null) { - Intent intent = new Intent(BluetoothDevice.ACTION_FOUND); - intent.putExtra(BluetoothDevice.EXTRA_DEVICE, mAdapter.getRemoteDevice(address)); - intent.putExtra(BluetoothDevice.EXTRA_CLASS, - new BluetoothClass(Integer.valueOf(classValue))); - intent.putExtra(BluetoothDevice.EXTRA_RSSI, rssiValue); - intent.putExtra(BluetoothDevice.EXTRA_NAME, name); - - mContext.sendBroadcast(intent, BLUETOOTH_PERM); - } else { - log ("ClassValue: " + classValue + " for remote device: " + address + " is null"); - } - } - - /** - * Called by native code on a DeviceFound signal from org.bluez.Adapter. - * - * @param address the MAC address of the new device - * @param properties an array of property keys and value strings - * - * @see BluetoothDeviceProperties#addProperties(String, String[]) - */ - private void onDeviceFound(String address, String[] properties) { - if (properties == null) { - Log.e(TAG, "ERROR: Remote device properties are null"); - return; - } - addDevice(address, properties); - } - - /** - * Called by native code on a DeviceDisappeared signal from - * org.bluez.Adapter. - * - * @param address the MAC address of the disappeared device - */ - private void onDeviceDisappeared(String address) { - Intent intent = new Intent(BluetoothDevice.ACTION_DISAPPEARED); - intent.putExtra(BluetoothDevice.EXTRA_DEVICE, mAdapter.getRemoteDevice(address)); - mContext.sendBroadcast(intent, BLUETOOTH_PERM); - } - - /** - * Called by native code on a DisconnectRequested signal from - * org.bluez.Device. - * - * @param deviceObjectPath the object path for the disconnecting device - */ - private void onDeviceDisconnectRequested(String deviceObjectPath) { - String address = mBluetoothService.getAddressFromObjectPath(deviceObjectPath); - if (address == null) { - Log.e(TAG, "onDeviceDisconnectRequested: Address of the remote device in null"); - return; - } - Intent intent = new Intent(BluetoothDevice.ACTION_ACL_DISCONNECT_REQUESTED); - intent.putExtra(BluetoothDevice.EXTRA_DEVICE, mAdapter.getRemoteDevice(address)); - mContext.sendBroadcast(intent, BLUETOOTH_PERM); - } - - /** - * Called by native code for the async response to a CreatePairedDevice - * method call to org.bluez.Adapter. - * - * @param address the MAC address of the device to pair - * @param result success or error result for the pairing operation - */ - private void onCreatePairedDeviceResult(String address, int result) { - address = address.toUpperCase(); - mBluetoothService.onCreatePairedDeviceResult(address, result); - } - - /** - * Called by native code on a DeviceCreated signal from org.bluez.Adapter. - * - * @param deviceObjectPath the object path for the created device - */ - private void onDeviceCreated(String deviceObjectPath) { - String address = mBluetoothService.getAddressFromObjectPath(deviceObjectPath); - if (address == null) { - Log.e(TAG, "onDeviceCreated: device address null!" + " deviceObjectPath: " + - deviceObjectPath); - return; - } - if (!mBluetoothService.isRemoteDeviceInCache(address)) { - // Incoming connection, we haven't seen this device, add to cache. - String[] properties = mBluetoothService.getRemoteDeviceProperties(address); - if (properties != null) { - addDevice(address, properties); - } - } - } - - /** - * Called by native code on a DeviceRemoved signal from org.bluez.Adapter. - * - * @param deviceObjectPath the object path for the removed device - */ - private void onDeviceRemoved(String deviceObjectPath) { - String address = mBluetoothService.getAddressFromObjectPath(deviceObjectPath); - if (address != null) { - mBluetoothService.setBondState(address.toUpperCase(), BluetoothDevice.BOND_NONE, - BluetoothDevice.UNBOND_REASON_REMOVED); - mBluetoothService.setRemoteDeviceProperty(address, "UUIDs", null); - } - } - - /** - * Called by native code on a PropertyChanged signal from - * org.bluez.Adapter. This method is also called from - * {@link BluetoothAdapterStateMachine} to set the "Pairable" - * property when Bluetooth is enabled. - * - * @param propValues a string array containing the key and one or more - * values. - */ - /*package*/ void onPropertyChanged(String[] propValues) { - BluetoothAdapterProperties adapterProperties = - mBluetoothService.getAdapterProperties(); - - if (adapterProperties.isEmpty()) { - // We have got a property change before - // we filled up our cache. - adapterProperties.getAllProperties(); - } - log("Property Changed: " + propValues[0] + " : " + propValues[1]); - String name = propValues[0]; - if (name.equals("Name")) { - adapterProperties.setProperty(name, propValues[1]); - Intent intent = new Intent(BluetoothAdapter.ACTION_LOCAL_NAME_CHANGED); - intent.putExtra(BluetoothAdapter.EXTRA_LOCAL_NAME, propValues[1]); - intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT); - mContext.sendBroadcast(intent, BLUETOOTH_PERM); - } else if (name.equals("Pairable") || name.equals("Discoverable")) { - adapterProperties.setProperty(name, propValues[1]); - - if (name.equals("Discoverable")) { - mBluetoothState.sendMessage(BluetoothAdapterStateMachine.SCAN_MODE_CHANGED); - } - - String pairable = name.equals("Pairable") ? propValues[1] : - adapterProperties.getProperty("Pairable"); - String discoverable = name.equals("Discoverable") ? propValues[1] : - adapterProperties.getProperty("Discoverable"); - - // This shouldn't happen, unless Adapter Properties are null. - if (pairable == null || discoverable == null) - return; - - int mode = BluetoothService.bluezStringToScanMode( - pairable.equals("true"), - discoverable.equals("true")); - if (mode >= 0) { - Intent intent = new Intent(BluetoothAdapter.ACTION_SCAN_MODE_CHANGED); - intent.putExtra(BluetoothAdapter.EXTRA_SCAN_MODE, mode); - intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT); - mContext.sendBroadcast(intent, BLUETOOTH_PERM); - } - } else if (name.equals("Discovering")) { - Intent intent; - adapterProperties.setProperty(name, propValues[1]); - if (propValues[1].equals("true")) { - intent = new Intent(BluetoothAdapter.ACTION_DISCOVERY_STARTED); - } else { - // Stop the discovery. - mBluetoothService.cancelDiscovery(); - intent = new Intent(BluetoothAdapter.ACTION_DISCOVERY_FINISHED); - } - mContext.sendBroadcast(intent, BLUETOOTH_PERM); - } else if (name.equals("Devices") || name.equals("UUIDs")) { - String value = null; - int len = Integer.valueOf(propValues[1]); - if (len > 0) { - StringBuilder str = new StringBuilder(); - for (int i = 2; i < propValues.length; i++) { - str.append(propValues[i]); - str.append(","); - } - value = str.toString(); - } - adapterProperties.setProperty(name, value); - if (name.equals("UUIDs")) { - mBluetoothService.updateBluetoothState(value); - } - } else if (name.equals("Powered")) { - mBluetoothState.sendMessage(BluetoothAdapterStateMachine.POWER_STATE_CHANGED, - propValues[1].equals("true") ? new Boolean(true) : new Boolean(false)); - } else if (name.equals("DiscoverableTimeout")) { - adapterProperties.setProperty(name, propValues[1]); - } - } - - /** - * Called by native code on a PropertyChanged signal from - * org.bluez.Device. - * - * @param deviceObjectPath the object path for the changed device - * @param propValues a string array containing the key and one or more - * values. - */ - private void onDevicePropertyChanged(String deviceObjectPath, String[] propValues) { - String name = propValues[0]; - String address = mBluetoothService.getAddressFromObjectPath(deviceObjectPath); - if (address == null) { - Log.e(TAG, "onDevicePropertyChanged: Address of the remote device in null"); - return; - } - log("Device property changed: " + address + " property: " - + name + " value: " + propValues[1]); - - BluetoothDevice device = mAdapter.getRemoteDevice(address); - if (name.equals("Name")) { - mBluetoothService.setRemoteDeviceProperty(address, name, propValues[1]); - Intent intent = new Intent(BluetoothDevice.ACTION_NAME_CHANGED); - intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device); - intent.putExtra(BluetoothDevice.EXTRA_NAME, propValues[1]); - intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT); - mContext.sendBroadcast(intent, BLUETOOTH_PERM); - } else if (name.equals("Alias")) { - mBluetoothService.setRemoteDeviceProperty(address, name, propValues[1]); - Intent intent = new Intent(BluetoothDevice.ACTION_ALIAS_CHANGED); - intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device); - intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT); - mContext.sendBroadcast(intent, BLUETOOTH_PERM); - } else if (name.equals("Class")) { - mBluetoothService.setRemoteDeviceProperty(address, name, propValues[1]); - Intent intent = new Intent(BluetoothDevice.ACTION_CLASS_CHANGED); - intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device); - intent.putExtra(BluetoothDevice.EXTRA_CLASS, - new BluetoothClass(Integer.valueOf(propValues[1]))); - intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT); - mContext.sendBroadcast(intent, BLUETOOTH_PERM); - } else if (name.equals("Connected")) { - mBluetoothService.setRemoteDeviceProperty(address, name, propValues[1]); - Intent intent = null; - if (propValues[1].equals("true")) { - intent = new Intent(BluetoothDevice.ACTION_ACL_CONNECTED); - // Set the link timeout to 8000 slots (5 sec timeout) - // for bluetooth docks. - if (mBluetoothService.isBluetoothDock(address)) { - mBluetoothService.setLinkTimeout(address, 8000); - } - } else { - intent = new Intent(BluetoothDevice.ACTION_ACL_DISCONNECTED); - } - intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device); - intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT); - mContext.sendBroadcast(intent, BLUETOOTH_PERM); - } else if (name.equals("UUIDs")) { - String uuid = null; - int len = Integer.valueOf(propValues[1]); - if (len > 0) { - StringBuilder str = new StringBuilder(); - for (int i = 2; i < propValues.length; i++) { - str.append(propValues[i]); - str.append(","); - } - uuid = str.toString(); - } - mBluetoothService.setRemoteDeviceProperty(address, name, uuid); - - // UUIDs have changed, query remote service channel and update cache. - mBluetoothService.updateDeviceServiceChannelCache(address); - - mBluetoothService.sendUuidIntent(address); - } else if (name.equals("Paired")) { - if (propValues[1].equals("true")) { - // If locally initiated pairing, we will - // not go to BOND_BONDED state until we have received a - // successful return value in onCreatePairedDeviceResult - if (null == mBluetoothService.getPendingOutgoingBonding()) { - mBluetoothService.setBondState(address, BluetoothDevice.BOND_BONDED); - } - } else { - mBluetoothService.setBondState(address, BluetoothDevice.BOND_NONE); - mBluetoothService.setRemoteDeviceProperty(address, "Trusted", "false"); - } - } else if (name.equals("Trusted")) { - if (DBG) - log("set trust state succeeded, value is: " + propValues[1]); - mBluetoothService.setRemoteDeviceProperty(address, name, propValues[1]); - } - } - - /** - * Called by native code on a PropertyChanged signal from - * org.bluez.Input. - * - * @param path the object path for the changed input device - * @param propValues a string array containing the key and one or more - * values. - */ - private void onInputDevicePropertyChanged(String path, String[] propValues) { - String address = mBluetoothService.getAddressFromObjectPath(path); - if (address == null) { - Log.e(TAG, "onInputDevicePropertyChanged: Address of the remote device is null"); - return; - } - log("Input Device : Name of Property is: " + propValues[0]); - boolean state = false; - if (propValues[1].equals("true")) { - state = true; - } - mBluetoothService.handleInputDevicePropertyChange(address, state); - } - - /** - * Called by native code on a PropertyChanged signal from - * org.bluez.Network. - * - * @param deviceObjectPath the object path for the changed PAN device - * @param propValues a string array containing the key and one or more - * values. - */ - private void onPanDevicePropertyChanged(String deviceObjectPath, String[] propValues) { - String name = propValues[0]; - String address = mBluetoothService.getAddressFromObjectPath(deviceObjectPath); - if (address == null) { - Log.e(TAG, "onPanDevicePropertyChanged: Address of the remote device in null"); - return; - } - if (DBG) { - log("Pan Device property changed: " + address + " property: " - + name + " value: "+ propValues[1]); - } - BluetoothDevice device = mAdapter.getRemoteDevice(address); - if (name.equals("Connected")) { - if (propValues[1].equals("false")) { - mBluetoothService.handlePanDeviceStateChange(device, - BluetoothPan.STATE_DISCONNECTED, - BluetoothPan.LOCAL_PANU_ROLE); - } - } else if (name.equals("Interface")) { - String iface = propValues[1]; - if (!iface.equals("")) { - mBluetoothService.handlePanDeviceStateChange(device, iface, - BluetoothPan.STATE_CONNECTED, - BluetoothPan.LOCAL_PANU_ROLE); - } - } - } - - private String checkPairingRequestAndGetAddress(String objectPath, int nativeData) { - String address = mBluetoothService.getAddressFromObjectPath(objectPath); - if (address == null) { - Log.e(TAG, "Unable to get device address in checkPairingRequestAndGetAddress, " + - "returning null"); - return null; - } - address = address.toUpperCase(); - mPasskeyAgentRequestData.put(address, new Integer(nativeData)); - - if (mBluetoothService.getBluetoothState() == BluetoothAdapter.STATE_TURNING_OFF) { - // shutdown path - mBluetoothService.cancelPairingUserInput(address); - return null; - } - // Set state to BONDING. For incoming connections it will be set here. - // For outgoing connections, it gets set when we call createBond. - // Also set it only when the state is not already Bonded, we can sometimes - // get an authorization request from the remote end if it doesn't have the link key - // while we still have it. - if (mBluetoothService.getBondState(address) != BluetoothDevice.BOND_BONDED) - mBluetoothService.setBondState(address, BluetoothDevice.BOND_BONDING); - return address; - } - - /** - * Called by native code on a RequestPairingConsent method call to - * org.bluez.Agent. - * - * @param objectPath the path of the device to request pairing consent for - * @param nativeData a native pointer to the original D-Bus message - */ - private void onRequestPairingConsent(String objectPath, int nativeData) { - String address = checkPairingRequestAndGetAddress(objectPath, nativeData); - if (address == null) return; - - /* The link key will not be stored if the incoming request has MITM - * protection switched on. Unfortunately, some devices have MITM - * switched on even though their capabilities are NoInputNoOutput, - * so we may get this request many times. Also if we respond immediately, - * the other end is unable to handle it. Delay sending the message. - */ - if (mBluetoothService.getBondState(address) == BluetoothDevice.BOND_BONDED) { - Message message = mHandler.obtainMessage(EVENT_PAIRING_CONSENT_DELAYED_ACCEPT); - message.obj = address; - mHandler.sendMessageDelayed(message, 1500); - return; - } - // Acquire wakelock during PIN code request to bring up LCD display - mWakeLock.acquire(); - Intent intent = new Intent(BluetoothDevice.ACTION_PAIRING_REQUEST); - intent.putExtra(BluetoothDevice.EXTRA_DEVICE, mAdapter.getRemoteDevice(address)); - intent.putExtra(BluetoothDevice.EXTRA_PAIRING_VARIANT, - BluetoothDevice.PAIRING_VARIANT_CONSENT); - mContext.sendBroadcast(intent, BLUETOOTH_ADMIN_PERM); - // Release wakelock to allow the LCD to go off after the PIN popup notification. - mWakeLock.release(); - return; - } - - /** - * Called by native code on a RequestConfirmation method call to - * org.bluez.Agent. - * - * @param objectPath the path of the device to confirm the passkey for - * @param passkey an integer containing the 6-digit passkey to confirm - * @param nativeData a native pointer to the original D-Bus message - */ - private void onRequestPasskeyConfirmation(String objectPath, int passkey, int nativeData) { - String address = checkPairingRequestAndGetAddress(objectPath, nativeData); - if (address == null) return; - // Acquire wakelock during PIN code request to bring up LCD display - mWakeLock.acquire(); - Intent intent = new Intent(BluetoothDevice.ACTION_PAIRING_REQUEST); - intent.putExtra(BluetoothDevice.EXTRA_DEVICE, mAdapter.getRemoteDevice(address)); - intent.putExtra(BluetoothDevice.EXTRA_PAIRING_KEY, passkey); - intent.putExtra(BluetoothDevice.EXTRA_PAIRING_VARIANT, - BluetoothDevice.PAIRING_VARIANT_PASSKEY_CONFIRMATION); - mContext.sendBroadcast(intent, BLUETOOTH_ADMIN_PERM); - // Release wakelock to allow the LCD to go off after the PIN popup notification. - mWakeLock.release(); - return; - } - - /** - * Called by native code on a RequestPasskey method call to - * org.bluez.Agent. - * - * @param objectPath the path of the device requesting a passkey - * @param nativeData a native pointer to the original D-Bus message - */ - private void onRequestPasskey(String objectPath, int nativeData) { - String address = checkPairingRequestAndGetAddress(objectPath, nativeData); - if (address == null) return; - // Acquire wakelock during PIN code request to bring up LCD display - mWakeLock.acquire(); - Intent intent = new Intent(BluetoothDevice.ACTION_PAIRING_REQUEST); - intent.putExtra(BluetoothDevice.EXTRA_DEVICE, mAdapter.getRemoteDevice(address)); - intent.putExtra(BluetoothDevice.EXTRA_PAIRING_VARIANT, - BluetoothDevice.PAIRING_VARIANT_PASSKEY); - mContext.sendBroadcast(intent, BLUETOOTH_ADMIN_PERM); - // Release wakelock to allow the LCD to go off after the PIN popup notification. - mWakeLock.release(); - return; - } - - /** - * Called by native code on a RequestPinCode method call to - * org.bluez.Agent. - * - * @param objectPath the path of the device requesting a PIN code - * @param nativeData a native pointer to the original D-Bus message - */ - private void onRequestPinCode(String objectPath, int nativeData) { - String address = checkPairingRequestAndGetAddress(objectPath, nativeData); - if (address == null) return; - - String pendingOutgoingAddress = - mBluetoothService.getPendingOutgoingBonding(); - BluetoothClass btClass = new BluetoothClass(mBluetoothService.getRemoteClass(address)); - int btDeviceClass = btClass.getDeviceClass(); - - if (address.equals(pendingOutgoingAddress)) { - // we initiated the bonding - - // Check if its a dock - if (mBluetoothService.isBluetoothDock(address)) { - String pin = mBluetoothService.getDockPin(); - mBluetoothService.setPin(address, BluetoothDevice.convertPinToBytes(pin)); - return; - } - - // try 0000 once if the device looks dumb - switch (btDeviceClass) { - case BluetoothClass.Device.AUDIO_VIDEO_WEARABLE_HEADSET: - case BluetoothClass.Device.AUDIO_VIDEO_HANDSFREE: - case BluetoothClass.Device.AUDIO_VIDEO_HEADPHONES: - case BluetoothClass.Device.AUDIO_VIDEO_PORTABLE_AUDIO: - case BluetoothClass.Device.AUDIO_VIDEO_HIFI_AUDIO: - if (mBluetoothService.attemptAutoPair(address)) return; - } - } - - if (btDeviceClass == BluetoothClass.Device.PERIPHERAL_KEYBOARD || - btDeviceClass == BluetoothClass.Device.PERIPHERAL_KEYBOARD_POINTING) { - // Its a keyboard. Follow the HID spec recommendation of creating the - // passkey and displaying it to the user. If the keyboard doesn't follow - // the spec recommendation, check if the keyboard has a fixed PIN zero - // and pair. - if (mBluetoothService.isFixedPinZerosAutoPairKeyboard(address)) { - mBluetoothService.setPin(address, BluetoothDevice.convertPinToBytes("0000")); - return; - } - - // Generate a variable PIN. This is not truly random but good enough. - int pin = (int) Math.floor(Math.random() * 10000); - sendDisplayPinIntent(address, pin); - return; - } - // Acquire wakelock during PIN code request to bring up LCD display - mWakeLock.acquire(); - Intent intent = new Intent(BluetoothDevice.ACTION_PAIRING_REQUEST); - intent.putExtra(BluetoothDevice.EXTRA_DEVICE, mAdapter.getRemoteDevice(address)); - intent.putExtra(BluetoothDevice.EXTRA_PAIRING_VARIANT, BluetoothDevice.PAIRING_VARIANT_PIN); - mContext.sendBroadcast(intent, BLUETOOTH_ADMIN_PERM); - // Release wakelock to allow the LCD to go off after the PIN popup notification. - mWakeLock.release(); - return; - } - - /** - * Called by native code on a DisplayPasskey method call to - * org.bluez.Agent. - * - * @param objectPath the path of the device to display the passkey for - * @param passkey an integer containing the 6-digit passkey - * @param nativeData a native pointer to the original D-Bus message - */ - private void onDisplayPasskey(String objectPath, int passkey, int nativeData) { - String address = checkPairingRequestAndGetAddress(objectPath, nativeData); - if (address == null) return; - - // Acquire wakelock during PIN code request to bring up LCD display - mWakeLock.acquire(); - Intent intent = new Intent(BluetoothDevice.ACTION_PAIRING_REQUEST); - intent.putExtra(BluetoothDevice.EXTRA_DEVICE, mAdapter.getRemoteDevice(address)); - intent.putExtra(BluetoothDevice.EXTRA_PAIRING_KEY, passkey); - intent.putExtra(BluetoothDevice.EXTRA_PAIRING_VARIANT, - BluetoothDevice.PAIRING_VARIANT_DISPLAY_PASSKEY); - mContext.sendBroadcast(intent, BLUETOOTH_ADMIN_PERM); - //Release wakelock to allow the LCD to go off after the PIN popup notification. - mWakeLock.release(); - } - - private void sendDisplayPinIntent(String address, int pin) { - // Acquire wakelock during PIN code request to bring up LCD display - mWakeLock.acquire(); - Intent intent = new Intent(BluetoothDevice.ACTION_PAIRING_REQUEST); - intent.putExtra(BluetoothDevice.EXTRA_DEVICE, mAdapter.getRemoteDevice(address)); - intent.putExtra(BluetoothDevice.EXTRA_PAIRING_KEY, pin); - intent.putExtra(BluetoothDevice.EXTRA_PAIRING_VARIANT, - BluetoothDevice.PAIRING_VARIANT_DISPLAY_PIN); - mContext.sendBroadcast(intent, BLUETOOTH_ADMIN_PERM); - //Release wakelock to allow the LCD to go off after the PIN popup notifcation. - mWakeLock.release(); - } - - /** - * Called by native code on a RequestOobData method call to - * org.bluez.Agent. - * - * @param objectPath the path of the device requesting OOB data - * @param nativeData a native pointer to the original D-Bus message - */ - private void onRequestOobData(String objectPath, int nativeData) { - String address = checkPairingRequestAndGetAddress(objectPath, nativeData); - if (address == null) return; - - Intent intent = new Intent(BluetoothDevice.ACTION_PAIRING_REQUEST); - intent.putExtra(BluetoothDevice.EXTRA_DEVICE, mAdapter.getRemoteDevice(address)); - intent.putExtra(BluetoothDevice.EXTRA_PAIRING_VARIANT, - BluetoothDevice.PAIRING_VARIANT_OOB_CONSENT); - mContext.sendBroadcast(intent, BLUETOOTH_ADMIN_PERM); - } - - /** - * Called by native code on an Authorize method call to org.bluez.Agent. - * - * @param objectPath the path of the device requesting to be authorized - * @param deviceUuid the UUID of the requesting device - * @param nativeData reference for native data - */ - private void onAgentAuthorize(String objectPath, String deviceUuid, int nativeData) { - if (!mBluetoothService.isEnabled()) return; - - String address = mBluetoothService.getAddressFromObjectPath(objectPath); - if (address == null) { - Log.e(TAG, "Unable to get device address in onAuthAgentAuthorize"); - return; - } - - boolean authorized = false; - ParcelUuid uuid = ParcelUuid.fromString(deviceUuid); - - BluetoothDevice device = mAdapter.getRemoteDevice(address); - mAuthorizationAgentRequestData.put(address, new Integer(nativeData)); - - // Bluez sends the UUID of the local service being accessed, _not_ the - // remote service - if (mA2dp != null && - (BluetoothUuid.isAudioSource(uuid) || BluetoothUuid.isAvrcpTarget(uuid) - || BluetoothUuid.isAdvAudioDist(uuid)) && - !isOtherSinkInNonDisconnectedState(address)) { - authorized = mA2dp.getPriority(device) > BluetoothProfile.PRIORITY_OFF; - if (authorized && !BluetoothUuid.isAvrcpTarget(uuid)) { - Log.i(TAG, "First check pass for incoming A2DP / AVRCP connection from " + address); - // Some headsets try to connect AVCTP before AVDTP - against the recommendation - // If AVCTP connection fails, we get stuck in IncomingA2DP state in the state - // machine. We don't handle AVCTP signals currently. We only send - // intents for AVDTP state changes. We need to handle both of them in - // some cases. For now, just don't move to incoming state in this case. - mBluetoothService.notifyIncomingA2dpConnection(address, false); - } else { - Log.i(TAG, "" + authorized + - "Incoming A2DP / AVRCP connection from " + address); - mA2dp.allowIncomingConnect(device, authorized); - mBluetoothService.notifyIncomingA2dpConnection(address, true); - } - } else if (BluetoothUuid.isInputDevice(uuid)) { - // We can have more than 1 input device connected. - authorized = mBluetoothService.getInputDevicePriority(device) > - BluetoothInputDevice.PRIORITY_OFF; - if (authorized) { - Log.i(TAG, "First check pass for incoming HID connection from " + address); - // notify profile state change - mBluetoothService.notifyIncomingHidConnection(address); - } else { - Log.i(TAG, "Rejecting incoming HID connection from " + address); - mBluetoothService.allowIncomingProfileConnect(device, authorized); - } - } else if (BluetoothUuid.isBnep(uuid)) { - // PAN doesn't go to the state machine, accept or reject from here - authorized = mBluetoothService.allowIncomingTethering(); - mBluetoothService.allowIncomingProfileConnect(device, authorized); - } else { - Log.i(TAG, "Rejecting incoming " + deviceUuid + " connection from " + address); - mBluetoothService.allowIncomingProfileConnect(device, authorized); - } - log("onAgentAuthorize(" + objectPath + ", " + deviceUuid + ") = " + authorized); - } - - private boolean onAgentOutOfBandDataAvailable(String objectPath) { - if (!mBluetoothService.isEnabled()) return false; - - String address = mBluetoothService.getAddressFromObjectPath(objectPath); - if (address == null) return false; - - if (mBluetoothService.getDeviceOutOfBandData( - mAdapter.getRemoteDevice(address)) != null) { - return true; - } - return false; - } - - private boolean isOtherSinkInNonDisconnectedState(String address) { - List devices = - mA2dp.getDevicesMatchingConnectionStates(new int[] {BluetoothA2dp.STATE_CONNECTED, - BluetoothA2dp.STATE_CONNECTING, - BluetoothA2dp.STATE_DISCONNECTING}); - - if (devices.size() == 0) return false; - for (BluetoothDevice dev: devices) { - if (!dev.getAddress().equals(address)) return true; - } - return false; - } - - /** - * Called by native code on a Cancel method call to org.bluez.Agent. - */ - private void onAgentCancel() { - Intent intent = new Intent(BluetoothDevice.ACTION_PAIRING_CANCEL); - mContext.sendBroadcast(intent, BLUETOOTH_ADMIN_PERM); - - mHandler.sendMessageDelayed(mHandler.obtainMessage(EVENT_AGENT_CANCEL), - 1500); - - return; - } - - /** - * Called by native code for the async response to a DiscoverServices - * method call to org.bluez.Adapter. - * - * @param deviceObjectPath the path for the specified device - * @param result true for success; false on error - */ - private void onDiscoverServicesResult(String deviceObjectPath, boolean result) { - String address = mBluetoothService.getAddressFromObjectPath(deviceObjectPath); - if (address == null) return; - - // We don't parse the xml here, instead just query Bluez for the properties. - if (result) { - mBluetoothService.updateRemoteDevicePropertiesCache(address); - } - mBluetoothService.sendUuidIntent(address); - mBluetoothService.makeServiceChannelCallbacks(address); - } - - /** - * Called by native code for the async response to a CreateDevice - * method call to org.bluez.Adapter. - * - * @param address the MAC address of the device to create - * @param result {@link #CREATE_DEVICE_SUCCESS}, - * {@link #CREATE_DEVICE_ALREADY_EXISTS} or {@link #CREATE_DEVICE_FAILED}} - */ - private void onCreateDeviceResult(String address, int result) { - if (DBG) log("Result of onCreateDeviceResult:" + result); - - switch (result) { - case CREATE_DEVICE_ALREADY_EXISTS: - String path = mBluetoothService.getObjectPathFromAddress(address); - if (path != null) { - mBluetoothService.discoverServicesNative(path, ""); - break; - } - Log.w(TAG, "Device exists, but we don't have the bluez path, failing"); - // fall-through - case CREATE_DEVICE_FAILED: - mBluetoothService.sendUuidIntent(address); - mBluetoothService.makeServiceChannelCallbacks(address); - break; - case CREATE_DEVICE_SUCCESS: - // nothing to do, UUID intent's will be sent via property changed - } - } - - /** - * Called by native code for the async response to a Connect - * method call to org.bluez.Input. - * - * @param path the path of the specified input device - * @param result Result code of the operation. - */ - private void onInputDeviceConnectionResult(String path, int result) { - // Success case gets handled by Property Change signal - if (result != BluetoothInputDevice.INPUT_OPERATION_SUCCESS) { - String address = mBluetoothService.getAddressFromObjectPath(path); - if (address == null) return; - - boolean connected = false; - BluetoothDevice device = mAdapter.getRemoteDevice(address); - int state = mBluetoothService.getInputDeviceConnectionState(device); - if (state == BluetoothInputDevice.STATE_CONNECTING) { - if (result == BluetoothInputDevice.INPUT_CONNECT_FAILED_ALREADY_CONNECTED) { - connected = true; - } else { - connected = false; - } - } else if (state == BluetoothInputDevice.STATE_DISCONNECTING) { - if (result == BluetoothInputDevice.INPUT_DISCONNECT_FAILED_NOT_CONNECTED) { - connected = false; - } else { - // There is no better way to handle this, this shouldn't happen - connected = true; - } - } else { - Log.e(TAG, "Error onInputDeviceConnectionResult. State is:" + state); - } - mBluetoothService.handleInputDevicePropertyChange(address, connected); - } - } - - /** - * Called by native code for the async response to a Connect - * method call to org.bluez.Network. - * - * @param path the path of the specified PAN device - * @param result Result code of the operation. - */ - private void onPanDeviceConnectionResult(String path, int result) { - log ("onPanDeviceConnectionResult " + path + " " + result); - // Success case gets handled by Property Change signal - if (result != BluetoothPan.PAN_OPERATION_SUCCESS) { - String address = mBluetoothService.getAddressFromObjectPath(path); - if (address == null) return; - - boolean connected = false; - BluetoothDevice device = mAdapter.getRemoteDevice(address); - int state = mBluetoothService.getPanDeviceConnectionState(device); - if (state == BluetoothPan.STATE_CONNECTING) { - if (result == BluetoothPan.PAN_CONNECT_FAILED_ALREADY_CONNECTED) { - connected = true; - } else { - connected = false; - } - } else if (state == BluetoothPan.STATE_DISCONNECTING) { - if (result == BluetoothPan.PAN_DISCONNECT_FAILED_NOT_CONNECTED) { - connected = false; - } else { - // There is no better way to handle this, this shouldn't happen - connected = true; - } - } else { - Log.e(TAG, "Error onPanDeviceConnectionResult. State is: " - + state + " result: "+ result); - } - int newState = connected? BluetoothPan.STATE_CONNECTED : - BluetoothPan.STATE_DISCONNECTED; - mBluetoothService.handlePanDeviceStateChange(device, newState, - BluetoothPan.LOCAL_PANU_ROLE); - } - } - - /** - * Called by native code for the async response to a Connect - * method call to org.bluez.Health - * - * @param chanCode The internal id of the channel - * @param result Result code of the operation. - */ - private void onHealthDeviceConnectionResult(int chanCode, int result) { - log ("onHealthDeviceConnectionResult " + chanCode + " " + result); - // Success case gets handled by Property Change signal - if (result != BluetoothHealth.HEALTH_OPERATION_SUCCESS) { - mBluetoothService.onHealthDeviceChannelConnectionError(chanCode, - BluetoothHealth.STATE_CHANNEL_DISCONNECTED); - } - } - - /** - * Called by native code on a DeviceDisconnected signal from - * org.bluez.NetworkServer. - * - * @param address the MAC address of the disconnected device - */ - private void onNetworkDeviceDisconnected(String address) { - BluetoothDevice device = mAdapter.getRemoteDevice(address); - mBluetoothService.handlePanDeviceStateChange(device, BluetoothPan.STATE_DISCONNECTED, - BluetoothPan.LOCAL_NAP_ROLE); - } - - /** - * Called by native code on a DeviceConnected signal from - * org.bluez.NetworkServer. - * - * @param address the MAC address of the connected device - * @param iface interface of remote network - * @param destUuid unused UUID parameter - */ - private void onNetworkDeviceConnected(String address, String iface, int destUuid) { - BluetoothDevice device = mAdapter.getRemoteDevice(address); - mBluetoothService.handlePanDeviceStateChange(device, iface, BluetoothPan.STATE_CONNECTED, - BluetoothPan.LOCAL_NAP_ROLE); - } - - /** - * Called by native code on a PropertyChanged signal from - * org.bluez.HealthDevice. - * - * @param devicePath the object path of the remote device - * @param propValues Properties (Name-Value) of the Health Device. - */ - private void onHealthDevicePropertyChanged(String devicePath, String[] propValues) { - log("Health Device : Name of Property is: " + propValues[0] + " Value:" + propValues[1]); - mBluetoothService.onHealthDevicePropertyChanged(devicePath, propValues[1]); - } - - /** - * Called by native code on a ChannelCreated/Deleted signal from - * org.bluez.HealthDevice. - * - * @param devicePath the object path of the remote device - * @param channelPath the path of the health channel. - * @param exists Boolean to indicate if the channel was created or deleted. - */ - private void onHealthDeviceChannelChanged(String devicePath, String channelPath, - boolean exists) { - log("Health Device : devicePath: " + devicePath + ":channelPath:" + channelPath + - ":exists" + exists); - mBluetoothService.onHealthDeviceChannelChanged(devicePath, channelPath, exists); - } - - private static void log(String msg) { - Log.d(TAG, msg); - } - - private native void initializeNativeDataNative(); - private native void startEventLoopNative(); - private native void stopEventLoopNative(); - private native boolean isEventLoopRunningNative(); - private native void cleanupNativeDataNative(); -} diff --git a/core/java/android/server/BluetoothHealthProfileHandler.java b/core/java/android/server/BluetoothHealthProfileHandler.java deleted file mode 100644 index 5e93b81ffe100..0000000000000 --- a/core/java/android/server/BluetoothHealthProfileHandler.java +++ /dev/null @@ -1,671 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.server; - -import android.bluetooth.BluetoothAdapter; -import android.bluetooth.BluetoothDevice; -import android.bluetooth.BluetoothHealth; -import android.bluetooth.BluetoothHealthAppConfiguration; -import android.bluetooth.BluetoothProfile; -import android.bluetooth.IBluetoothHealthCallback; -import android.content.Context; -import android.os.Handler; -import android.os.Message; -import android.os.ParcelFileDescriptor; -import android.os.RemoteException; -import android.util.Log; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map.Entry; -import java.util.concurrent.atomic.AtomicInteger; - -/** - * This handles all the operations on the Bluetooth Health profile. - * All functions are called by BluetoothService, as Bluetooth Service - * is the Service handler for the HDP profile. - * - * @hide - */ -final class BluetoothHealthProfileHandler { - private static final String TAG = "BluetoothHealthProfileHandler"; - private static final boolean DBG = false; - - private static BluetoothHealthProfileHandler sInstance; - private BluetoothService mBluetoothService; - private ArrayList mHealthChannels; - private HashMap mHealthAppConfigs; - private HashMap mHealthDevices; - private HashMap mCallbacks; - - private static final int MESSAGE_REGISTER_APPLICATION = 0; - private static final int MESSAGE_UNREGISTER_APPLICATION = 1; - private static final int MESSAGE_CONNECT_CHANNEL = 2; - private static final AtomicInteger sChannelId = new AtomicInteger(); - - class HealthChannel { - private ParcelFileDescriptor mChannelFd; - private boolean mMainChannel; - private String mChannelPath; - private BluetoothDevice mDevice; - private BluetoothHealthAppConfiguration mConfig; - private int mState; - private int mChannelType; - private int mId; - - HealthChannel(BluetoothDevice device, BluetoothHealthAppConfiguration config, - ParcelFileDescriptor fd, boolean mainChannel, String channelPath) { - mChannelFd = fd; - mMainChannel = mainChannel; - mChannelPath = channelPath; - mDevice = device; - mConfig = config; - mState = BluetoothHealth.STATE_CHANNEL_DISCONNECTED; - mId = getChannelId(); - } - } - - private final Handler mHandler = new Handler() { - @Override - public void handleMessage(Message msg) { - switch (msg.what) { - case MESSAGE_REGISTER_APPLICATION: - BluetoothHealthAppConfiguration registerApp = - (BluetoothHealthAppConfiguration) msg.obj; - int role = registerApp.getRole(); - String path = null; - - if (role == BluetoothHealth.SINK_ROLE) { - path = mBluetoothService.registerHealthApplicationNative( - registerApp.getDataType(), getStringRole(role), registerApp.getName()); - } else { - path = mBluetoothService.registerHealthApplicationNative( - registerApp.getDataType(), getStringRole(role), registerApp.getName(), - getStringChannelType(registerApp.getChannelType())); - } - - if (path == null) { - callHealthApplicationStatusCallback(registerApp, - BluetoothHealth.APP_CONFIG_REGISTRATION_FAILURE); - mCallbacks.remove(registerApp); - } else { - mHealthAppConfigs.put(registerApp, path); - callHealthApplicationStatusCallback(registerApp, - BluetoothHealth.APP_CONFIG_REGISTRATION_SUCCESS); - } - - break; - case MESSAGE_UNREGISTER_APPLICATION: - BluetoothHealthAppConfiguration unregisterApp = - (BluetoothHealthAppConfiguration) msg.obj; - - // Disconnect all the channels - for (HealthChannel chan : mHealthChannels) { - if (chan.mConfig.equals(unregisterApp) && - chan.mState != BluetoothHealth.STATE_CHANNEL_DISCONNECTED) { - disconnectChannel(chan.mDevice, unregisterApp, chan.mId); - } - } - - boolean result = mBluetoothService.unregisterHealthApplicationNative( - mHealthAppConfigs.get(unregisterApp)); - if (result) { - callHealthApplicationStatusCallback(unregisterApp, - BluetoothHealth.APP_CONFIG_UNREGISTRATION_SUCCESS); - mCallbacks.remove(unregisterApp); - mHealthAppConfigs.remove(unregisterApp); - } else { - callHealthApplicationStatusCallback(unregisterApp, - BluetoothHealth.APP_CONFIG_UNREGISTRATION_FAILURE); - } - break; - case MESSAGE_CONNECT_CHANNEL: - HealthChannel chan = (HealthChannel)msg.obj; - String deviceObjectPath = - mBluetoothService.getObjectPathFromAddress(chan.mDevice.getAddress()); - String configPath = mHealthAppConfigs.get(chan.mConfig); - String channelType = getStringChannelType(chan.mChannelType); - - if (!mBluetoothService.createChannelNative(deviceObjectPath, configPath, - channelType, chan.mId)) { - int prevState = chan.mState; - int state = BluetoothHealth.STATE_CHANNEL_DISCONNECTED; - callHealthChannelCallback(chan.mConfig, chan.mDevice, prevState, state, null, - chan.mId); - mHealthChannels.remove(chan); - } - } - } - }; - - private BluetoothHealthProfileHandler(Context context, BluetoothService service) { - mBluetoothService = service; - mHealthAppConfigs = new HashMap(); - mHealthChannels = new ArrayList(); - mHealthDevices = new HashMap(); - mCallbacks = new HashMap(); - } - - static synchronized BluetoothHealthProfileHandler getInstance(Context context, - BluetoothService service) { - if (sInstance == null) sInstance = new BluetoothHealthProfileHandler(context, service); - return sInstance; - } - - boolean registerAppConfiguration(BluetoothHealthAppConfiguration config, - IBluetoothHealthCallback callback) { - Message msg = mHandler.obtainMessage(MESSAGE_REGISTER_APPLICATION); - msg.obj = config; - mHandler.sendMessage(msg); - mCallbacks.put(config, callback); - return true; - } - - boolean unregisterAppConfiguration(BluetoothHealthAppConfiguration config) { - String path = mHealthAppConfigs.get(config); - if (path == null) return false; - - Message msg = mHandler.obtainMessage(MESSAGE_UNREGISTER_APPLICATION); - msg.obj = config; - mHandler.sendMessage(msg); - return true; - } - - boolean connectChannelToSource(BluetoothDevice device, - BluetoothHealthAppConfiguration config) { - return connectChannel(device, config, BluetoothHealth.CHANNEL_TYPE_ANY); - } - - private HealthChannel getMainChannel(BluetoothDevice device, - BluetoothHealthAppConfiguration config) { - for (HealthChannel chan: mHealthChannels) { - if (chan.mDevice.equals(device) && chan.mConfig.equals(config)) { - if (chan.mMainChannel) return chan; - } - } - return null; - } - - boolean connectChannel(BluetoothDevice device, - BluetoothHealthAppConfiguration config, int channelType) { - String deviceObjectPath = - mBluetoothService.getObjectPathFromAddress(device.getAddress()); - if (deviceObjectPath == null) return false; - - String configPath = mHealthAppConfigs.get(config); - if (configPath == null) return false; - - HealthChannel chan = new HealthChannel(device, config, null, false, null); - chan.mState = BluetoothHealth.STATE_CHANNEL_CONNECTING; - chan.mChannelType = channelType; - mHealthChannels.add(chan); - - int prevState = BluetoothHealth.STATE_CHANNEL_DISCONNECTED; - int state = BluetoothHealth.STATE_CHANNEL_CONNECTING; - callHealthChannelCallback(config, device, prevState, state, null, chan.mId); - - Message msg = mHandler.obtainMessage(MESSAGE_CONNECT_CHANNEL); - msg.obj = chan; - mHandler.sendMessage(msg); - - return true; - } - - private String getStringChannelType(int type) { - if (type == BluetoothHealth.CHANNEL_TYPE_RELIABLE) { - return "Reliable"; - } else if (type == BluetoothHealth.CHANNEL_TYPE_STREAMING) { - return "Streaming"; - } else { - return "Any"; - } - } - - private String getStringRole(int role) { - if (role == BluetoothHealth.SINK_ROLE) { - return "Sink"; - } else if (role == BluetoothHealth.SOURCE_ROLE) { - return "Streaming"; - } else { - return null; - } - } - - private int getChannelId() { - // The function doesn't need to be synchronized, as the health profile handler - // will only allow one health channel object creation at a time. - // In the worst case the while loop will have to break out at some point of - // time, because only a limited number of L2CAP channels are possible. - int id; - boolean found; - do { - id = sChannelId.incrementAndGet(); - found = false; - for (HealthChannel chan: mHealthChannels) { - if (chan.mId == id) found = true; - } - } while (found); - return id; - } - - boolean disconnectChannel(BluetoothDevice device, - BluetoothHealthAppConfiguration config, int id) { - HealthChannel chan = findChannelById(id); - if (chan == null) { - return false; - } - - String deviceObjectPath = - mBluetoothService.getObjectPathFromAddress(device.getAddress()); - - mBluetoothService.releaseChannelFdNative(chan.mChannelPath); - - int prevState = chan.mState; - chan.mState = BluetoothHealth.STATE_CHANNEL_DISCONNECTING; - callHealthChannelCallback(config, device, prevState, chan.mState, - null, chan.mId); - - if (!mBluetoothService.destroyChannelNative(deviceObjectPath, chan.mChannelPath, - chan.mId)) { - prevState = chan.mState; - chan.mState = BluetoothHealth.STATE_CHANNEL_CONNECTED; - callHealthChannelCallback(config, device, prevState, chan.mState, - chan.mChannelFd, chan.mId); - return false; - } else { - return true; - } - } - - private HealthChannel findChannelById(int id) { - for (HealthChannel chan : mHealthChannels) { - if (chan.mId == id) return chan; - } - return null; - } - - private HealthChannel findChannelByPath(BluetoothDevice device, String path) { - for (HealthChannel chan : mHealthChannels) { - if (path.equals(chan.mChannelPath) && device.equals(chan.mDevice)) return chan; - } - return null; - } - - private List findChannelByStates(BluetoothDevice device, int[] states) { - List channels = new ArrayList(); - for (HealthChannel chan: mHealthChannels) { - if (chan.mDevice.equals(device)) { - for (int state : states) { - if (chan.mState == state) { - channels.add(chan); - } - } - } - } - return channels; - } - - private HealthChannel findConnectingChannel(BluetoothDevice device, - BluetoothHealthAppConfiguration config) { - for (HealthChannel chan : mHealthChannels) { - if (chan.mDevice.equals(device) && chan.mConfig.equals(config) && - chan.mState == BluetoothHealth.STATE_CHANNEL_CONNECTING) return chan; - } - return null; - } - - ParcelFileDescriptor getMainChannelFd(BluetoothDevice device, - BluetoothHealthAppConfiguration config) { - HealthChannel chan = getMainChannel(device, config); - if (chan != null) { - ParcelFileDescriptor pfd = null; - try { - pfd = chan.mChannelFd.dup(); - return pfd; - } catch (IOException e) { - return null; - } - } - - String objectPath = - mBluetoothService.getObjectPathFromAddress(device.getAddress()); - if (objectPath == null) return null; - - String mainChannelPath = mBluetoothService.getMainChannelNative(objectPath); - if (mainChannelPath == null) return null; - - // We had no record of the main channel but querying Bluez we got a - // main channel. We might not have received the PropertyChanged yet for - // the main channel creation so update our data structure here. - chan = findChannelByPath(device, mainChannelPath); - if (chan == null) { - errorLog("Main Channel present but we don't have any account of it:" + - device +":" + config); - return null; - } - chan.mMainChannel = true; - try { - return chan.mChannelFd.dup(); - } catch (IOException e) { - return null; - } - } - - /*package*/ void onHealthDevicePropertyChanged(String devicePath, - String channelPath) { - BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter(); - String address = mBluetoothService.getAddressFromObjectPath(devicePath); - if (address == null) return; - - //TODO: Fix this in Bluez - if (channelPath.equals("/")) { - // This means that the main channel is being destroyed. - return; - } - - BluetoothDevice device = adapter.getRemoteDevice(address); - BluetoothHealthAppConfiguration config = findHealthApplication(device, - channelPath); - if (config != null) { - HealthChannel chan = findChannelByPath(device, channelPath); - if (chan == null) { - errorLog("Health Channel is not present:" + channelPath); - } else { - chan.mMainChannel = true; - } - } - } - - /*package*/ void onHealthDeviceChannelConnectionError(int chanCode, - int state) { - HealthChannel channel = findChannelById(chanCode); - if (channel == null) errorLog("No record of this channel:" + chanCode); - - callHealthChannelCallback(channel.mConfig, channel.mDevice, channel.mState, state, null, - chanCode); - } - - private BluetoothHealthAppConfiguration findHealthApplication( - BluetoothDevice device, String channelPath) { - BluetoothHealthAppConfiguration config = null; - HealthChannel chan = findChannelByPath(device, channelPath); - - if (chan != null) { - config = chan.mConfig; - } else { - String configPath = mBluetoothService.getChannelApplicationNative(channelPath); - if (configPath == null) { - errorLog("Config path is null for application"); - } else { - for (Entry e : - mHealthAppConfigs.entrySet()) { - if (e.getValue().equals(configPath)) { - config = e.getKey(); - } - } - if (config == null) errorLog("No associated application for path:" + configPath); - } - } - return config; - } - - /*package*/ void onHealthDeviceChannelChanged(String devicePath, - String channelPath, boolean exists) { - debugLog("onHealthDeviceChannelChanged: devicePath: " + devicePath + - "ChannelPath: " + channelPath + "Exists: " + exists); - BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter(); - String address = mBluetoothService.getAddressFromObjectPath(devicePath); - if (address == null) return; - - BluetoothDevice device = adapter.getRemoteDevice(address); - BluetoothHealthAppConfiguration config; - int state, prevState = BluetoothHealth.STATE_CHANNEL_DISCONNECTED; - ParcelFileDescriptor fd; - HealthChannel channel; - config = findHealthApplication(device, channelPath); - - if (exists) { - channel = findConnectingChannel(device, config); - if (channel == null) { - channel = new HealthChannel(device, config, null, false, - channelPath); - channel.mState = BluetoothHealth.STATE_CHANNEL_DISCONNECTED; - mHealthChannels.add(channel); - } - channel.mChannelPath = channelPath; - - fd = mBluetoothService.getChannelFdNative(channelPath); - if (fd == null) { - errorLog("Error obtaining fd for channel:" + channelPath); - disconnectChannel(device, config, channel.mId); - return; - } - boolean mainChannel = - getMainChannel(device, config) == null ? false : true; - if (!mainChannel) { - String mainChannelPath = - mBluetoothService.getMainChannelNative(devicePath); - if (mainChannelPath == null) { - errorLog("Main Channel Path is null for devicePath:" + devicePath); - return; - } - if (mainChannelPath.equals(channelPath)) mainChannel = true; - } - - channel.mChannelFd = fd; - channel.mMainChannel = mainChannel; - prevState = channel.mState; - state = BluetoothHealth.STATE_CHANNEL_CONNECTED; - } else { - channel = findChannelByPath(device, channelPath); - if (channel == null) { - errorLog("Channel not found:" + config + ":" + channelPath); - return; - } - mHealthChannels.remove(channel); - - channel.mChannelFd = null; - prevState = channel.mState; - state = BluetoothHealth.STATE_CHANNEL_DISCONNECTED; - } - channel.mState = state; - callHealthChannelCallback(config, device, prevState, state, channel.mChannelFd, - channel.mId); - } - - private void callHealthChannelCallback(BluetoothHealthAppConfiguration config, - BluetoothDevice device, int prevState, int state, ParcelFileDescriptor fd, int id) { - broadcastHealthDeviceStateChange(device, prevState, state); - - debugLog("Health Device Callback: " + device + " State Change: " - + prevState + "->" + state); - - ParcelFileDescriptor dupedFd = null; - if (fd != null) { - try { - dupedFd = fd.dup(); - } catch (IOException e) { - dupedFd = null; - errorLog("Exception while duping: " + e); - } - } - - IBluetoothHealthCallback callback = mCallbacks.get(config); - if (callback != null) { - try { - callback.onHealthChannelStateChange(config, device, prevState, state, dupedFd, id); - } catch (RemoteException e) { - errorLog("Remote Exception:" + e); - } - } - } - - private void callHealthApplicationStatusCallback( - BluetoothHealthAppConfiguration config, int status) { - debugLog("Health Device Application: " + config + " State Change: status:" - + status); - IBluetoothHealthCallback callback = mCallbacks.get(config); - if (callback != null) { - try { - callback.onHealthAppConfigurationStatusChange(config, status); - } catch (RemoteException e) { - errorLog("Remote Exception:" + e); - } - } - } - - int getHealthDeviceConnectionState(BluetoothDevice device) { - if (mHealthDevices.get(device) == null) { - return BluetoothHealth.STATE_DISCONNECTED; - } - return mHealthDevices.get(device); - } - - List getConnectedHealthDevices() { - List devices = lookupHealthDevicesMatchingStates( - new int[] {BluetoothHealth.STATE_CONNECTED}); - return devices; - } - - List getHealthDevicesMatchingConnectionStates(int[] states) { - List devices = lookupHealthDevicesMatchingStates(states); - return devices; - } - - List lookupHealthDevicesMatchingStates(int[] states) { - List healthDevices = new ArrayList(); - - for (BluetoothDevice device: mHealthDevices.keySet()) { - int healthDeviceState = getHealthDeviceConnectionState(device); - for (int state : states) { - if (state == healthDeviceState) { - healthDevices.add(device); - break; - } - } - } - return healthDevices; - } - - /** - * This function sends the intent for the updates on the connection status to the remote device. - * Note that multiple channels can be connected to the remote device by multiple applications. - * This sends an intent for the update to the device connection status and not the channel - * connection status. Only the following state transitions are possible: - * - * {@link BluetoothHealth#STATE_DISCONNECTED} to {@link BluetoothHealth#STATE_CONNECTING} - * {@link BluetoothHealth#STATE_CONNECTING} to {@link BluetoothHealth#STATE_CONNECTED} - * {@link BluetoothHealth#STATE_CONNECTED} to {@link BluetoothHealth#STATE_DISCONNECTING} - * {@link BluetoothHealth#STATE_DISCONNECTING} to {@link BluetoothHealth#STATE_DISCONNECTED} - * {@link BluetoothHealth#STATE_DISCONNECTED} to {@link BluetoothHealth#STATE_CONNECTED} - * {@link BluetoothHealth#STATE_CONNECTED} to {@link BluetoothHealth#STATE_DISCONNECTED} - * {@link BluetoothHealth#STATE_CONNECTING} to {{@link BluetoothHealth#STATE_DISCONNECTED} - * - * @param device - * @param prevChannelState - * @param newChannelState - * @hide - */ - private void broadcastHealthDeviceStateChange(BluetoothDevice device, int prevChannelState, - int newChannelState) { - if (mHealthDevices.get(device) == null) { - mHealthDevices.put(device, BluetoothHealth.STATE_DISCONNECTED); - } - - int currDeviceState = mHealthDevices.get(device); - int newDeviceState = convertState(newChannelState); - - if (currDeviceState != newDeviceState) { - List chan; - switch (currDeviceState) { - case BluetoothHealth.STATE_DISCONNECTED: - updateAndSendIntent(device, currDeviceState, newDeviceState); - break; - case BluetoothHealth.STATE_CONNECTING: - // Channel got connected. - if (newDeviceState == BluetoothHealth.STATE_CONNECTED) { - updateAndSendIntent(device, currDeviceState, newDeviceState); - } else { - // Channel got disconnected - chan = findChannelByStates(device, new int [] { - BluetoothHealth.STATE_CHANNEL_CONNECTING, - BluetoothHealth.STATE_CHANNEL_DISCONNECTING}); - if (chan.isEmpty()) { - updateAndSendIntent(device, currDeviceState, newDeviceState); - } - } - break; - case BluetoothHealth.STATE_CONNECTED: - // Channel got disconnected or is in disconnecting state. - chan = findChannelByStates(device, new int [] { - BluetoothHealth.STATE_CHANNEL_CONNECTING, - BluetoothHealth.STATE_CHANNEL_CONNECTED}); - if (chan.isEmpty()) { - updateAndSendIntent(device, currDeviceState, newDeviceState); - } - break; - case BluetoothHealth.STATE_DISCONNECTING: - // Channel got disconnected. - chan = findChannelByStates(device, new int [] { - BluetoothHealth.STATE_CHANNEL_CONNECTING, - BluetoothHealth.STATE_CHANNEL_DISCONNECTING}); - if (chan.isEmpty()) { - updateAndSendIntent(device, currDeviceState, newDeviceState); - } - break; - } - } - } - - private void updateAndSendIntent(BluetoothDevice device, int prevDeviceState, - int newDeviceState) { - mHealthDevices.put(device, newDeviceState); - mBluetoothService.sendConnectionStateChange(device, BluetoothProfile.HEALTH, - newDeviceState, prevDeviceState); - } - - /** - * This function converts the channel connection state to device connection state. - * - * @param state - * @return - */ - private int convertState(int state) { - switch (state) { - case BluetoothHealth.STATE_CHANNEL_CONNECTED: - return BluetoothHealth.STATE_CONNECTED; - case BluetoothHealth.STATE_CHANNEL_CONNECTING: - return BluetoothHealth.STATE_CONNECTING; - case BluetoothHealth.STATE_CHANNEL_DISCONNECTING: - return BluetoothHealth.STATE_DISCONNECTING; - case BluetoothHealth.STATE_CHANNEL_DISCONNECTED: - return BluetoothHealth.STATE_DISCONNECTED; - } - errorLog("Mismatch in Channel and Health Device State"); - return -1; - } - - private static void debugLog(String msg) { - if (DBG) Log.d(TAG, msg); - } - - private static void errorLog(String msg) { - Log.e(TAG, msg); - } -} diff --git a/core/java/android/server/BluetoothInputProfileHandler.java b/core/java/android/server/BluetoothInputProfileHandler.java deleted file mode 100644 index 31764b063ecf0..0000000000000 --- a/core/java/android/server/BluetoothInputProfileHandler.java +++ /dev/null @@ -1,227 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.server; - -import android.bluetooth.BluetoothAdapter; -import android.bluetooth.BluetoothDevice; -import android.bluetooth.BluetoothDeviceProfileState; -import android.bluetooth.BluetoothInputDevice; -import android.bluetooth.BluetoothProfile; -import android.bluetooth.BluetoothProfileState; -import android.content.Context; -import android.content.Intent; -import android.os.Message; -import android.provider.Settings; -import android.util.Log; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - -/** - * This handles all the operations on the HID profile. - * All functions are called by BluetoothService, as Bluetooth Service - * is the Service handler for the HID profile. - */ -final class BluetoothInputProfileHandler { - private static final String TAG = "BluetoothInputProfileHandler"; - private static final boolean DBG = true; - - public static BluetoothInputProfileHandler sInstance; - private Context mContext; - private BluetoothService mBluetoothService; - private final HashMap mInputDevices; - private final BluetoothProfileState mHidProfileState; - - private BluetoothInputProfileHandler(Context context, BluetoothService service) { - mContext = context; - mBluetoothService = service; - mInputDevices = new HashMap(); - mHidProfileState = new BluetoothProfileState(mContext, BluetoothProfileState.HID); - mHidProfileState.start(); - } - - static synchronized BluetoothInputProfileHandler getInstance(Context context, - BluetoothService service) { - if (sInstance == null) sInstance = new BluetoothInputProfileHandler(context, service); - return sInstance; - } - - boolean connectInputDevice(BluetoothDevice device, - BluetoothDeviceProfileState state) { - String objectPath = mBluetoothService.getObjectPathFromAddress(device.getAddress()); - if (objectPath == null || - getInputDeviceConnectionState(device) != BluetoothInputDevice.STATE_DISCONNECTED || - getInputDevicePriority(device) == BluetoothInputDevice.PRIORITY_OFF) { - return false; - } - if (state != null) { - Message msg = new Message(); - msg.arg1 = BluetoothDeviceProfileState.CONNECT_HID_OUTGOING; - msg.obj = state; - mHidProfileState.sendMessage(msg); - return true; - } - return false; - } - - boolean connectInputDeviceInternal(BluetoothDevice device) { - String objectPath = mBluetoothService.getObjectPathFromAddress(device.getAddress()); - handleInputDeviceStateChange(device, BluetoothInputDevice.STATE_CONNECTING); - if (!mBluetoothService.connectInputDeviceNative(objectPath)) { - handleInputDeviceStateChange(device, BluetoothInputDevice.STATE_DISCONNECTED); - return false; - } - return true; - } - - boolean disconnectInputDevice(BluetoothDevice device, - BluetoothDeviceProfileState state) { - String objectPath = mBluetoothService.getObjectPathFromAddress(device.getAddress()); - if (objectPath == null || - getInputDeviceConnectionState(device) == BluetoothInputDevice.STATE_DISCONNECTED) { - return false; - } - if (state != null) { - Message msg = new Message(); - msg.arg1 = BluetoothDeviceProfileState.DISCONNECT_HID_OUTGOING; - msg.obj = state; - mHidProfileState.sendMessage(msg); - return true; - } - return false; - } - - boolean disconnectInputDeviceInternal(BluetoothDevice device) { - String objectPath = mBluetoothService.getObjectPathFromAddress(device.getAddress()); - handleInputDeviceStateChange(device, BluetoothInputDevice.STATE_DISCONNECTING); - if (!mBluetoothService.disconnectInputDeviceNative(objectPath)) { - handleInputDeviceStateChange(device, BluetoothInputDevice.STATE_CONNECTED); - return false; - } - return true; - } - - int getInputDeviceConnectionState(BluetoothDevice device) { - if (mInputDevices.get(device) == null) { - return BluetoothInputDevice.STATE_DISCONNECTED; - } - return mInputDevices.get(device); - } - - List getConnectedInputDevices() { - List devices = lookupInputDevicesMatchingStates( - new int[] {BluetoothInputDevice.STATE_CONNECTED}); - return devices; - } - - List getInputDevicesMatchingConnectionStates(int[] states) { - List devices = lookupInputDevicesMatchingStates(states); - return devices; - } - - int getInputDevicePriority(BluetoothDevice device) { - return Settings.Secure.getInt(mContext.getContentResolver(), - Settings.Secure.getBluetoothInputDevicePriorityKey(device.getAddress()), - BluetoothInputDevice.PRIORITY_UNDEFINED); - } - - boolean setInputDevicePriority(BluetoothDevice device, int priority) { - if (!BluetoothAdapter.checkBluetoothAddress(device.getAddress())) { - return false; - } - return Settings.Secure.putInt(mContext.getContentResolver(), - Settings.Secure.getBluetoothInputDevicePriorityKey(device.getAddress()), - priority); - } - - List lookupInputDevicesMatchingStates(int[] states) { - List inputDevices = new ArrayList(); - - for (BluetoothDevice device: mInputDevices.keySet()) { - int inputDeviceState = getInputDeviceConnectionState(device); - for (int state : states) { - if (state == inputDeviceState) { - inputDevices.add(device); - break; - } - } - } - return inputDevices; - } - - private void handleInputDeviceStateChange(BluetoothDevice device, int state) { - int prevState; - if (mInputDevices.get(device) == null) { - prevState = BluetoothInputDevice.STATE_DISCONNECTED; - } else { - prevState = mInputDevices.get(device); - } - if (prevState == state) return; - - mInputDevices.put(device, state); - - if (getInputDevicePriority(device) > - BluetoothInputDevice.PRIORITY_OFF && - state == BluetoothInputDevice.STATE_CONNECTING || - state == BluetoothInputDevice.STATE_CONNECTED) { - // We have connected or attempting to connect. - // Bump priority - setInputDevicePriority(device, BluetoothInputDevice.PRIORITY_AUTO_CONNECT); - } - - Intent intent = new Intent(BluetoothInputDevice.ACTION_CONNECTION_STATE_CHANGED); - intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device); - intent.putExtra(BluetoothInputDevice.EXTRA_PREVIOUS_STATE, prevState); - intent.putExtra(BluetoothInputDevice.EXTRA_STATE, state); - intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT); - mContext.sendBroadcast(intent, BluetoothService.BLUETOOTH_PERM); - - debugLog("InputDevice state : device: " + device + " State:" + prevState + "->" + state); - mBluetoothService.sendConnectionStateChange(device, BluetoothProfile.INPUT_DEVICE, state, - prevState); - } - - void handleInputDevicePropertyChange(String address, boolean connected) { - int state = connected ? BluetoothInputDevice.STATE_CONNECTED : - BluetoothInputDevice.STATE_DISCONNECTED; - BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter(); - BluetoothDevice device = adapter.getRemoteDevice(address); - handleInputDeviceStateChange(device, state); - } - - void setInitialInputDevicePriority(BluetoothDevice device, int state) { - switch (state) { - case BluetoothDevice.BOND_BONDED: - if (getInputDevicePriority(device) == BluetoothInputDevice.PRIORITY_UNDEFINED) { - setInputDevicePriority(device, BluetoothInputDevice.PRIORITY_ON); - } - break; - case BluetoothDevice.BOND_NONE: - setInputDevicePriority(device, BluetoothInputDevice.PRIORITY_UNDEFINED); - break; - } - } - - private static void debugLog(String msg) { - if (DBG) Log.d(TAG, msg); - } - - private static void errorLog(String msg) { - Log.e(TAG, msg); - } -} diff --git a/core/java/android/server/BluetoothPanProfileHandler.java b/core/java/android/server/BluetoothPanProfileHandler.java deleted file mode 100644 index 41bb87fab8380..0000000000000 --- a/core/java/android/server/BluetoothPanProfileHandler.java +++ /dev/null @@ -1,409 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.server; - -import android.bluetooth.BluetoothAdapter; -import android.bluetooth.BluetoothDevice; -import android.bluetooth.BluetoothPan; -import android.bluetooth.BluetoothProfile; -import android.bluetooth.BluetoothTetheringDataTracker; -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; -import android.content.IntentFilter; -import android.content.res.Resources.NotFoundException; -import android.net.ConnectivityManager; -import android.net.InterfaceConfiguration; -import android.net.LinkAddress; -import android.net.NetworkUtils; -import android.os.IBinder; -import android.os.INetworkManagementService; -import android.os.ServiceManager; -import android.util.Log; - -import java.net.InetAddress; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - -/** - * This handles the PAN profile. All calls into this are made - * from Bluetooth Service. - */ -final class BluetoothPanProfileHandler { - private static final String TAG = "BluetoothPanProfileHandler"; - private static final boolean DBG = true; - - private ArrayList mBluetoothIfaceAddresses; - private int mMaxPanDevices; - - private static final String BLUETOOTH_IFACE_ADDR_START= "192.168.44.1"; - private static final int BLUETOOTH_MAX_PAN_CONNECTIONS = 5; - private static final int BLUETOOTH_PREFIX_LENGTH = 24; - public static BluetoothPanProfileHandler sInstance; - private final HashMap mPanDevices; - private boolean mTetheringOn; - private Context mContext; - private BluetoothService mBluetoothService; - - static final String NAP_ROLE = "nap"; - static final String NAP_BRIDGE = "pan1"; - - private BluetoothPanProfileHandler(Context context, BluetoothService service) { - mContext = context; - mPanDevices = new HashMap(); - mBluetoothService = service; - mTetheringOn = false; - mBluetoothIfaceAddresses = new ArrayList(); - try { - mMaxPanDevices = context.getResources().getInteger( - com.android.internal.R.integer.config_max_pan_devices); - } catch (NotFoundException e) { - mMaxPanDevices = BLUETOOTH_MAX_PAN_CONNECTIONS; - } - } - - static BluetoothPanProfileHandler getInstance(Context context, - BluetoothService service) { - if (sInstance == null) sInstance = new BluetoothPanProfileHandler(context, service); - return sInstance; - } - - boolean isTetheringOn() { - return mTetheringOn; - } - - boolean allowIncomingTethering() { - if (isTetheringOn() && getConnectedPanDevices().size() < mMaxPanDevices) - return true; - return false; - } - - private BroadcastReceiver mTetheringReceiver = null; - - void setBluetoothTethering(boolean value) { - if (!value) { - disconnectPanServerDevices(); - } - - if (mBluetoothService.getBluetoothState() != BluetoothAdapter.STATE_ON && value) { - IntentFilter filter = new IntentFilter(); - filter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED); - mTetheringReceiver = new BroadcastReceiver() { - @Override - public void onReceive(Context context, Intent intent) { - if (intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, BluetoothAdapter.STATE_OFF) - == BluetoothAdapter.STATE_ON) { - mTetheringOn = true; - mContext.unregisterReceiver(mTetheringReceiver); - } - } - }; - mContext.registerReceiver(mTetheringReceiver, filter); - } else { - mTetheringOn = value; - } - } - - int getPanDeviceConnectionState(BluetoothDevice device) { - BluetoothPanDevice panDevice = mPanDevices.get(device); - if (panDevice == null) { - return BluetoothPan.STATE_DISCONNECTED; - } - return panDevice.mState; - } - - boolean connectPanDevice(BluetoothDevice device) { - String objectPath = mBluetoothService.getObjectPathFromAddress(device.getAddress()); - if (DBG) Log.d(TAG, "connect PAN(" + objectPath + ")"); - if (getPanDeviceConnectionState(device) != BluetoothPan.STATE_DISCONNECTED) { - errorLog(device + " already connected to PAN"); - } - - int connectedCount = 0; - for (BluetoothDevice panDevice: mPanDevices.keySet()) { - if (getPanDeviceConnectionState(panDevice) == BluetoothPan.STATE_CONNECTED) { - connectedCount ++; - } - } - if (connectedCount > 8) { - debugLog(device + " could not connect to PAN because 8 other devices are" - + "already connected"); - return false; - } - - // Send interface as null as it is not known - handlePanDeviceStateChange(device, null, BluetoothPan.STATE_CONNECTING, - BluetoothPan.LOCAL_PANU_ROLE); - if (mBluetoothService.connectPanDeviceNative(objectPath, "nap")) { - debugLog("connecting to PAN"); - return true; - } else { - handlePanDeviceStateChange(device, null, BluetoothPan.STATE_DISCONNECTED, - BluetoothPan.LOCAL_PANU_ROLE); - errorLog("could not connect to PAN"); - return false; - } - } - - private boolean disconnectPanServerDevices() { - debugLog("disconnect all PAN devices"); - - for (BluetoothDevice device: mPanDevices.keySet()) { - BluetoothPanDevice panDevice = mPanDevices.get(device); - int state = panDevice.mState; - if (state == BluetoothPan.STATE_CONNECTED && - panDevice.mLocalRole == BluetoothPan.LOCAL_NAP_ROLE) { - String objectPath = mBluetoothService.getObjectPathFromAddress(device.getAddress()); - - handlePanDeviceStateChange(device, panDevice.mIface, - BluetoothPan.STATE_DISCONNECTING, panDevice.mLocalRole); - - if (!mBluetoothService.disconnectPanServerDeviceNative(objectPath, - device.getAddress(), - panDevice.mIface)) { - errorLog("could not disconnect Pan Server Device "+device.getAddress()); - - // Restore prev state - handlePanDeviceStateChange(device, panDevice.mIface, state, - panDevice.mLocalRole); - - return false; - } - } - } - return true; - } - - List getConnectedPanDevices() { - List devices = new ArrayList(); - - for (BluetoothDevice device: mPanDevices.keySet()) { - if (getPanDeviceConnectionState(device) == BluetoothPan.STATE_CONNECTED) { - devices.add(device); - } - } - return devices; - } - - List getPanDevicesMatchingConnectionStates(int[] states) { - List devices = new ArrayList(); - - for (BluetoothDevice device: mPanDevices.keySet()) { - int panDeviceState = getPanDeviceConnectionState(device); - for (int state : states) { - if (state == panDeviceState) { - devices.add(device); - break; - } - } - } - return devices; - } - - boolean disconnectPanDevice(BluetoothDevice device) { - String objectPath = mBluetoothService.getObjectPathFromAddress(device.getAddress()); - debugLog("disconnect PAN(" + objectPath + ")"); - - int state = getPanDeviceConnectionState(device); - if (state != BluetoothPan.STATE_CONNECTED) { - debugLog(device + " already disconnected from PAN"); - return false; - } - - BluetoothPanDevice panDevice = mPanDevices.get(device); - - if (panDevice == null) { - errorLog("No record for this Pan device:" + device); - return false; - } - - handlePanDeviceStateChange(device, panDevice.mIface, BluetoothPan.STATE_DISCONNECTING, - panDevice.mLocalRole); - if (panDevice.mLocalRole == BluetoothPan.LOCAL_NAP_ROLE) { - if (!mBluetoothService.disconnectPanServerDeviceNative(objectPath, device.getAddress(), - panDevice.mIface)) { - // Restore prev state, this shouldn't happen - handlePanDeviceStateChange(device, panDevice.mIface, state, panDevice.mLocalRole); - return false; - } - } else { - if (!mBluetoothService.disconnectPanDeviceNative(objectPath)) { - // Restore prev state, this shouldn't happen - handlePanDeviceStateChange(device, panDevice.mIface, state, panDevice.mLocalRole); - return false; - } - } - return true; - } - - void handlePanDeviceStateChange(BluetoothDevice device, - String iface, int state, int role) { - int prevState; - String ifaceAddr = null; - BluetoothPanDevice panDevice = mPanDevices.get(device); - - if (panDevice == null) { - prevState = BluetoothPan.STATE_DISCONNECTED; - } else { - prevState = panDevice.mState; - ifaceAddr = panDevice.mIfaceAddr; - } - if (prevState == state) return; - - if (role == BluetoothPan.LOCAL_NAP_ROLE) { - if (state == BluetoothPan.STATE_CONNECTED) { - ifaceAddr = enableTethering(iface); - if (ifaceAddr == null) Log.e(TAG, "Error seting up tether interface"); - } else if (state == BluetoothPan.STATE_DISCONNECTED) { - if (ifaceAddr != null) { - mBluetoothIfaceAddresses.remove(ifaceAddr); - ifaceAddr = null; - } - } - } else { - // PANU Role = reverse Tether - if (state == BluetoothPan.STATE_CONNECTED) { - BluetoothTetheringDataTracker.getInstance().startReverseTether(iface, device); - } else if (state == BluetoothPan.STATE_DISCONNECTED && - (prevState == BluetoothPan.STATE_CONNECTED || - prevState == BluetoothPan.STATE_DISCONNECTING)) { - BluetoothTetheringDataTracker.getInstance().stopReverseTether(panDevice.mIface); - } - } - - if (panDevice == null) { - panDevice = new BluetoothPanDevice(state, ifaceAddr, iface, role); - mPanDevices.put(device, panDevice); - } else { - panDevice.mState = state; - panDevice.mIfaceAddr = ifaceAddr; - panDevice.mLocalRole = role; - panDevice.mIface = iface; - } - - Intent intent = new Intent(BluetoothPan.ACTION_CONNECTION_STATE_CHANGED); - intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device); - intent.putExtra(BluetoothPan.EXTRA_PREVIOUS_STATE, prevState); - intent.putExtra(BluetoothPan.EXTRA_STATE, state); - intent.putExtra(BluetoothPan.EXTRA_LOCAL_ROLE, role); - mContext.sendBroadcast(intent, BluetoothService.BLUETOOTH_PERM); - - debugLog("Pan Device state : device: " + device + " State:" + prevState + "->" + state); - mBluetoothService.sendConnectionStateChange(device, BluetoothProfile.PAN, state, - prevState); - } - - private class BluetoothPanDevice { - private int mState; - private String mIfaceAddr; - private String mIface; - private int mLocalRole; // Which local role is this PAN device bound to - - BluetoothPanDevice(int state, String ifaceAddr, String iface, int localRole) { - mState = state; - mIfaceAddr = ifaceAddr; - mIface = iface; - mLocalRole = localRole; - } - } - - private String createNewTetheringAddressLocked() { - if (getConnectedPanDevices().size() == mMaxPanDevices) { - debugLog ("Max PAN device connections reached"); - return null; - } - String address = BLUETOOTH_IFACE_ADDR_START; - while (true) { - if (mBluetoothIfaceAddresses.contains(address)) { - String[] addr = address.split("\\."); - Integer newIp = Integer.parseInt(addr[2]) + 1; - address = address.replace(addr[2], newIp.toString()); - } else { - break; - } - } - mBluetoothIfaceAddresses.add(address); - return address; - } - - // configured when we start tethering - private String enableTethering(String iface) { - debugLog("updateTetherState:" + iface); - - IBinder b = ServiceManager.getService(Context.NETWORKMANAGEMENT_SERVICE); - INetworkManagementService service = INetworkManagementService.Stub.asInterface(b); - ConnectivityManager cm = - (ConnectivityManager)mContext.getSystemService(Context.CONNECTIVITY_SERVICE); - String[] bluetoothRegexs = cm.getTetherableBluetoothRegexs(); - - // bring toggle the interfaces - String[] currentIfaces = new String[0]; - try { - currentIfaces = service.listInterfaces(); - } catch (Exception e) { - Log.e(TAG, "Error listing Interfaces :" + e); - return null; - } - - boolean found = false; - for (String currIface: currentIfaces) { - if (currIface.equals(iface)) { - found = true; - break; - } - } - - if (!found) return null; - - String address = createNewTetheringAddressLocked(); - if (address == null) return null; - - InterfaceConfiguration ifcg = null; - try { - ifcg = service.getInterfaceConfig(iface); - if (ifcg != null) { - final LinkAddress linkAddr = ifcg.getLinkAddress(); - InetAddress addr = null; - if (linkAddr == null || (addr = linkAddr.getAddress()) == null || - addr.equals(NetworkUtils.numericToInetAddress("0.0.0.0")) || - addr.equals(NetworkUtils.numericToInetAddress("::0"))) { - addr = NetworkUtils.numericToInetAddress(address); - } - ifcg.setInterfaceUp(); - ifcg.clearFlag("running"); - ifcg.setLinkAddress(new LinkAddress(addr, BLUETOOTH_PREFIX_LENGTH)); - service.setInterfaceConfig(iface, ifcg); - if (cm.tether(iface) != ConnectivityManager.TETHER_ERROR_NO_ERROR) { - Log.e(TAG, "Error tethering "+iface); - } - } - } catch (Exception e) { - Log.e(TAG, "Error configuring interface " + iface + ", :" + e); - return null; - } - return address; - } - - private static void debugLog(String msg) { - if (DBG) Log.d(TAG, msg); - } - - private static void errorLog(String msg) { - Log.e(TAG, msg); - } -} diff --git a/core/java/android/server/BluetoothService.java b/core/java/android/server/BluetoothService.java deleted file mode 100755 index 97c0209850caf..0000000000000 --- a/core/java/android/server/BluetoothService.java +++ /dev/null @@ -1,2924 +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. - */ - -/** - * TODO: Move this to - * java/services/com/android/server/BluetoothService.java - * and make the contructor package private again. - * - * @hide - */ - -package android.server; - -import android.bluetooth.BluetoothAdapter; -import android.bluetooth.BluetoothClass; -import android.bluetooth.BluetoothDevice; -import android.bluetooth.BluetoothDeviceProfileState; -import android.bluetooth.BluetoothHeadset; -import android.bluetooth.BluetoothHealthAppConfiguration; -import android.bluetooth.BluetoothInputDevice; -import android.bluetooth.BluetoothPan; -import android.bluetooth.BluetoothProfile; -import android.bluetooth.BluetoothProfileState; -import android.bluetooth.BluetoothSocket; -import android.bluetooth.BluetoothUuid; -import android.bluetooth.IBluetooth; -import android.bluetooth.IBluetoothCallback; -import android.bluetooth.IBluetoothHealthCallback; -import android.bluetooth.IBluetoothStateChangeCallback; -import android.content.BroadcastReceiver; -import android.content.ContentResolver; -import android.content.Context; -import android.content.Intent; -import android.content.IntentFilter; -import android.content.SharedPreferences; -import android.content.res.Resources; -import android.os.Binder; -import android.os.Handler; -import android.os.IBinder; -import android.os.Message; -import android.os.ParcelFileDescriptor; -import android.os.ParcelUuid; -import android.os.RemoteException; -import android.os.ServiceManager; -import android.provider.Settings; -import android.util.Log; -import android.util.Pair; - -import com.android.internal.app.IBatteryStats; - -import java.io.BufferedInputStream; -import java.io.BufferedReader; -import java.io.BufferedWriter; -import java.io.DataInputStream; -import java.io.File; -import java.io.FileDescriptor; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileWriter; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.PrintWriter; -import java.io.RandomAccessFile; -import java.io.UnsupportedEncodingException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -public class BluetoothService extends IBluetooth.Stub { - private static final String TAG = "BluetoothService"; - private static final boolean DBG = true; - - private int mNativeData; - private BluetoothEventLoop mEventLoop; - private BluetoothHeadset mHeadsetProxy; - private BluetoothInputDevice mInputDevice; - private BluetoothPan mPan; - private boolean mIsAirplaneSensitive; - private boolean mIsAirplaneToggleable; - private BluetoothAdapterStateMachine mBluetoothState; - private int[] mAdapterSdpHandles; - private ParcelUuid[] mAdapterUuids; - - private BluetoothAdapter mAdapter; // constant after init() - private final BluetoothBondState mBondState; // local cache of bondings - private final IBatteryStats mBatteryStats; - private final Context mContext; - private Map mStateChangeTracker = - Collections.synchronizedMap(new HashMap()); - - private static final String BLUETOOTH_ADMIN_PERM = android.Manifest.permission.BLUETOOTH_ADMIN; - static final String BLUETOOTH_PERM = android.Manifest.permission.BLUETOOTH; - - private static final String DOCK_ADDRESS_PATH = "/sys/class/switch/dock/bt_addr"; - private static final String DOCK_PIN_PATH = "/sys/class/switch/dock/bt_pin"; - - private static final String SHARED_PREFERENCE_DOCK_ADDRESS = "dock_bluetooth_address"; - private static final String SHARED_PREFERENCES_NAME = "bluetooth_service_settings"; - - private static final int MESSAGE_UUID_INTENT = 1; - private static final int MESSAGE_AUTO_PAIRING_FAILURE_ATTEMPT_DELAY = 2; - private static final int MESSAGE_REMOVE_SERVICE_RECORD = 3; - - private static final int RFCOMM_RECORD_REAPER = 10; - private static final int STATE_CHANGE_REAPER = 11; - - // The time (in millisecs) to delay the pairing attempt after the first - // auto pairing attempt fails. We use an exponential delay with - // INIT_AUTO_PAIRING_FAILURE_ATTEMPT_DELAY as the initial value and - // MAX_AUTO_PAIRING_FAILURE_ATTEMPT_DELAY as the max value. - private static final long INIT_AUTO_PAIRING_FAILURE_ATTEMPT_DELAY = 3000; - private static final long MAX_AUTO_PAIRING_FAILURE_ATTEMPT_DELAY = 12000; - - // The timeout used to sent the UUIDs Intent - // This timeout should be greater than the page timeout - private static final int UUID_INTENT_DELAY = 6000; - - /** Always retrieve RFCOMM channel for these SDP UUIDs */ - private static final ParcelUuid[] RFCOMM_UUIDS = { - BluetoothUuid.Handsfree, - BluetoothUuid.HSP, - BluetoothUuid.ObexObjectPush }; - - private final BluetoothAdapterProperties mAdapterProperties; - private final BluetoothDeviceProperties mDeviceProperties; - - private final HashMap> mDeviceServiceChannelCache; - private final ArrayList mUuidIntentTracker; - private final HashMap mUuidCallbackTracker; - - private static class ServiceRecordClient { - int pid; - IBinder binder; - IBinder.DeathRecipient death; - } - private final HashMap mServiceRecordToPid; - - private final HashMap mDeviceProfileState; - private final BluetoothProfileState mA2dpProfileState; - private final BluetoothProfileState mHfpProfileState; - - private BluetoothA2dpService mA2dpService; - private final HashMap> mDeviceOobData; - - private int mProfilesConnected = 0, mProfilesConnecting = 0, mProfilesDisconnecting = 0; - - private static String mDockAddress; - private String mDockPin; - - private boolean mAllowConnect = true; - - private int mAdapterConnectionState = BluetoothAdapter.STATE_DISCONNECTED; - private BluetoothPanProfileHandler mBluetoothPanProfileHandler; - private BluetoothInputProfileHandler mBluetoothInputProfileHandler; - private BluetoothHealthProfileHandler mBluetoothHealthProfileHandler; - private static final String INCOMING_CONNECTION_FILE = - "/data/misc/bluetooth/incoming_connection.conf"; - private HashMap> mIncomingConnections; - private HashMap> mProfileConnectionState; - - private static class RemoteService { - public String address; - public ParcelUuid uuid; - public RemoteService(String address, ParcelUuid uuid) { - this.address = address; - this.uuid = uuid; - } - @Override - public boolean equals(Object o) { - if (o instanceof RemoteService) { - RemoteService service = (RemoteService)o; - return address.equals(service.address) && uuid.equals(service.uuid); - } - return false; - } - - @Override - public int hashCode() { - int hash = 1; - hash = hash * 31 + (address == null ? 0 : address.hashCode()); - hash = hash * 31 + (uuid == null ? 0 : uuid.hashCode()); - return hash; - } - } - - static { - classInitNative(); - } - - public BluetoothService(Context context) { - mContext = context; - - // Need to do this in place of: - // mBatteryStats = BatteryStatsService.getService(); - // Since we can not import BatteryStatsService from here. This class really needs to be - // moved to java/services/com/android/server/ - mBatteryStats = IBatteryStats.Stub.asInterface(ServiceManager.getService("batteryinfo")); - - initializeNativeDataNative(); - - if (isEnabledNative() == 1) { - Log.w(TAG, "Bluetooth daemons already running - runtime restart? "); - disableNative(); - } - - mBondState = new BluetoothBondState(context, this); - mAdapterProperties = new BluetoothAdapterProperties(context, this); - mDeviceProperties = new BluetoothDeviceProperties(this); - - mDeviceServiceChannelCache = new HashMap>(); - mDeviceOobData = new HashMap>(); - mUuidIntentTracker = new ArrayList(); - mUuidCallbackTracker = new HashMap(); - mServiceRecordToPid = new HashMap(); - mDeviceProfileState = new HashMap(); - mA2dpProfileState = new BluetoothProfileState(mContext, BluetoothProfileState.A2DP); - mHfpProfileState = new BluetoothProfileState(mContext, BluetoothProfileState.HFP); - - mHfpProfileState.start(); - mA2dpProfileState.start(); - - IntentFilter filter = new IntentFilter(); - registerForAirplaneMode(filter); - - filter.addAction(Intent.ACTION_DOCK_EVENT); - mContext.registerReceiver(mReceiver, filter); - mBluetoothInputProfileHandler = BluetoothInputProfileHandler.getInstance(mContext, this); - mBluetoothPanProfileHandler = BluetoothPanProfileHandler.getInstance(mContext, this); - mBluetoothHealthProfileHandler = BluetoothHealthProfileHandler.getInstance(mContext, this); - mIncomingConnections = new HashMap>(); - mProfileConnectionState = new HashMap>(); - } - - public static synchronized String readDockBluetoothAddress() { - if (mDockAddress != null) return mDockAddress; - - BufferedInputStream file = null; - String dockAddress; - try { - file = new BufferedInputStream(new FileInputStream(DOCK_ADDRESS_PATH)); - byte[] address = new byte[17]; - file.read(address); - dockAddress = new String(address); - dockAddress = dockAddress.toUpperCase(); - if (BluetoothAdapter.checkBluetoothAddress(dockAddress)) { - mDockAddress = dockAddress; - return mDockAddress; - } else { - Log.e(TAG, "CheckBluetoothAddress failed for car dock address: " - + dockAddress); - } - } catch (FileNotFoundException e) { - Log.e(TAG, "FileNotFoundException while trying to read dock address"); - } catch (IOException e) { - Log.e(TAG, "IOException while trying to read dock address"); - } finally { - if (file != null) { - try { - file.close(); - } catch (IOException e) { - // Ignore - } - } - } - mDockAddress = null; - return null; - } - - private synchronized boolean writeDockPin() { - BufferedWriter out = null; - try { - out = new BufferedWriter(new FileWriter(DOCK_PIN_PATH)); - - // Generate a random 4 digit pin between 0000 and 9999 - // This is not truly random but good enough for our purposes. - int pin = (int) Math.floor(Math.random() * 10000); - - mDockPin = String.format("%04d", pin); - out.write(mDockPin); - return true; - } catch (FileNotFoundException e) { - Log.e(TAG, "FileNotFoundException while trying to write dock pairing pin"); - } catch (IOException e) { - Log.e(TAG, "IOException while while trying to write dock pairing pin"); - } finally { - if (out != null) { - try { - out.close(); - } catch (IOException e) { - // Ignore - } - } - } - mDockPin = null; - return false; - } - - /*package*/ synchronized String getDockPin() { - return mDockPin; - } - - public synchronized void initAfterRegistration() { - mAdapter = BluetoothAdapter.getDefaultAdapter(); - mBluetoothState = new BluetoothAdapterStateMachine(mContext, this, mAdapter); - mBluetoothState.start(); - if (mContext.getResources().getBoolean - (com.android.internal.R.bool.config_bluetooth_adapter_quick_switch)) { - mBluetoothState.sendMessage(BluetoothAdapterStateMachine.TURN_HOT); - } - mEventLoop = mBluetoothState.getBluetoothEventLoop(); - } - - public synchronized void initAfterA2dpRegistration() { - mEventLoop.getProfileProxy(); - } - - @Override - protected void finalize() throws Throwable { - mContext.unregisterReceiver(mReceiver); - try { - cleanupNativeDataNative(); - } finally { - super.finalize(); - } - } - - public boolean isEnabled() { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); - return isEnabledInternal(); - } - - private boolean isEnabledInternal() { - return (getBluetoothStateInternal() == BluetoothAdapter.STATE_ON); - } - - public int getBluetoothState() { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); - return getBluetoothStateInternal(); - } - - int getBluetoothStateInternal() { - return mBluetoothState.getBluetoothAdapterState(); - } - - /** - * Bring down bluetooth and disable BT in settings. Returns true on success. - */ - public boolean disable() { - return disable(true); - } - - /** - * Bring down bluetooth. Returns true on success. - * - * @param saveSetting If true, persist the new setting - */ - public synchronized boolean disable(boolean saveSetting) { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, "Need BLUETOOTH_ADMIN permission"); - - int adapterState = getBluetoothStateInternal(); - - switch (adapterState) { - case BluetoothAdapter.STATE_OFF: - return true; - case BluetoothAdapter.STATE_ON: - break; - default: - return false; - } - - mBluetoothState.sendMessage(BluetoothAdapterStateMachine.USER_TURN_OFF, saveSetting); - return true; - } - - synchronized void disconnectDevices() { - // Disconnect devices handled by BluetoothService. - for (BluetoothDevice device: getConnectedInputDevices()) { - disconnectInputDevice(device); - } - - for (BluetoothDevice device: getConnectedPanDevices()) { - disconnectPanDevice(device); - } - } - - /** - * The Bluetooth has been turned off, but hot. Do bonding, profile cleanup - */ - synchronized void finishDisable() { - // mark in progress bondings as cancelled - for (String address : mBondState.listInState(BluetoothDevice.BOND_BONDING)) { - mBondState.setBondState(address, BluetoothDevice.BOND_NONE, - BluetoothDevice.UNBOND_REASON_AUTH_CANCELED); - } - - // Stop the profile state machine for bonded devices. - for (String address : mBondState.listInState(BluetoothDevice.BOND_BONDED)) { - removeProfileState(address); - } - - // update mode - Intent intent = new Intent(BluetoothAdapter.ACTION_SCAN_MODE_CHANGED); - intent.putExtra(BluetoothAdapter.EXTRA_SCAN_MODE, BluetoothAdapter.SCAN_MODE_NONE); - mContext.sendBroadcast(intent, BLUETOOTH_PERM); - } - - /** - * Local clean up after broadcasting STATE_OFF intent - */ - synchronized void cleanupAfterFinishDisable() { - mAdapterProperties.clear(); - - for (Integer srHandle : mServiceRecordToPid.keySet()) { - removeServiceRecordNative(srHandle); - } - mServiceRecordToPid.clear(); - - mProfilesConnected = 0; - mProfilesConnecting = 0; - mProfilesDisconnecting = 0; - mAdapterConnectionState = BluetoothAdapter.STATE_DISCONNECTED; - mAdapterUuids = null; - mAdapterSdpHandles = null; - - // Log bluetooth off to battery stats. - long ident = Binder.clearCallingIdentity(); - try { - mBatteryStats.noteBluetoothOff(); - } catch (RemoteException e) { - } finally { - Binder.restoreCallingIdentity(ident); - } - } - - /** - * power off Bluetooth - */ - synchronized void shutoffBluetooth() { - if (mAdapterSdpHandles != null) removeReservedServiceRecordsNative(mAdapterSdpHandles); - setBluetoothTetheringNative(false, BluetoothPanProfileHandler.NAP_ROLE, - BluetoothPanProfileHandler.NAP_BRIDGE); - tearDownNativeDataNative(); - } - - /** - * Data clean up after Bluetooth shutoff - */ - synchronized void cleanNativeAfterShutoffBluetooth() { - // Ths method is called after shutdown of event loop in the Bluetooth shut down - // procedure - - // the adapter property could be changed before event loop is stoped, clear it again - mAdapterProperties.clear(); - disableNative(); - } - - /** Bring up BT and persist BT on in settings */ - public boolean enable() { - return enable(true, true); - } - - /** - * Enable this Bluetooth device, asynchronously. - * This turns on/off the underlying hardware. - * - * @param saveSetting If true, persist the new state of BT in settings - * @param allowConnect If true, auto-connects device when BT is turned on - * and allows incoming A2DP/HSP connections - * @return True on success (so far) - */ - public synchronized boolean enable(boolean saveSetting, boolean allowConnect) { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, - "Need BLUETOOTH_ADMIN permission"); - - // Airplane mode can prevent Bluetooth radio from being turned on. - if (mIsAirplaneSensitive && isAirplaneModeOn() && !mIsAirplaneToggleable) { - return false; - } - mAllowConnect = allowConnect; - mBluetoothState.sendMessage(BluetoothAdapterStateMachine.USER_TURN_ON, saveSetting); - return true; - } - - /** - * Enable this Bluetooth device, asynchronously, but does not - * auto-connect devices. In this state the Bluetooth adapter - * also does not allow incoming A2DP/HSP connections (that - * must go through this service), but does allow communication - * on RFCOMM sockets implemented outside of this service (ie BTOPP). - * This method is used to temporarily enable Bluetooth - * for data transfer, without changing - * - * This turns on/off the underlying hardware. - * - * @return True on success (so far) - */ - public boolean enableNoAutoConnect() { - return enable(false, false); - } - - /** - * Turn on Bluetooth Module, Load firmware, and do all the preparation - * needed to get the Bluetooth Module ready but keep it not discoverable - * and not connectable. - */ - /* package */ synchronized boolean prepareBluetooth() { - if (!setupNativeDataNative()) { - return false; - } - switchConnectable(false); - - // Bluetooth stack needs a small delay here before adding - // SDP records, otherwise dbus stalls for over 30 seconds 1 out of 50 runs - try { - Thread.sleep(50); - } catch (InterruptedException e) {} - updateSdpRecords(); - return true; - } - - private final Handler mHandler = new Handler() { - @Override - public void handleMessage(Message msg) { - switch (msg.what) { - case MESSAGE_UUID_INTENT: - String address = (String)msg.obj; - if (address != null) { - sendUuidIntent(address); - makeServiceChannelCallbacks(address); - } - break; - case MESSAGE_AUTO_PAIRING_FAILURE_ATTEMPT_DELAY: - address = (String)msg.obj; - if (address == null) return; - int attempt = mBondState.getAttempt(address); - - // Try only if attemps are in progress and cap it 2 attempts - // The 2 attempts cap is a fail safe if the stack returns - // an incorrect error code for bonding failures and if the pin - // is entered wrongly twice we should abort. - if (attempt > 0 && attempt <= 2) { - mBondState.attempt(address); - createBond(address); - return; - } - if (attempt > 0) mBondState.clearPinAttempts(address); - break; - case MESSAGE_REMOVE_SERVICE_RECORD: - Pair pair = (Pair) msg.obj; - checkAndRemoveRecord(pair.first, pair.second); - break; - } - } - }; - - private synchronized void addReservedSdpRecords(final ArrayList uuids) { - //Register SDP records. - int[] svcIdentifiers = new int[uuids.size()]; - for (int i = 0; i < uuids.size(); i++) { - svcIdentifiers[i] = BluetoothUuid.getServiceIdentifierFromParcelUuid(uuids.get(i)); - } - mAdapterSdpHandles = addReservedServiceRecordsNative(svcIdentifiers); - } - - private synchronized void updateSdpRecords() { - ArrayList uuids = new ArrayList(); - - Resources R = mContext.getResources(); - - // Add the default records - if (R.getBoolean(com.android.internal.R.bool.config_bluetooth_default_profiles)) { - uuids.add(BluetoothUuid.HSP_AG); - uuids.add(BluetoothUuid.ObexObjectPush); - } - - if (R.getBoolean(com.android.internal.R.bool.config_voice_capable)) { - uuids.add(BluetoothUuid.Handsfree_AG); - uuids.add(BluetoothUuid.PBAP_PSE); - } - - // Add SDP records for profiles maintained by Android userspace - addReservedSdpRecords(uuids); - - // Bluetooth stack need some a small delay here before adding more - // SDP records, otherwise dbus stalls for over 30 seconds 1 out of 50 runs - try { - Thread.sleep(50); - } catch (InterruptedException e) {} - - if (R.getBoolean(com.android.internal.R.bool.config_bluetooth_default_profiles)) { - // Enable profiles maintained by Bluez userspace. - setBluetoothTetheringNative(true, BluetoothPanProfileHandler.NAP_ROLE, - BluetoothPanProfileHandler.NAP_BRIDGE); - - // Add SDP records for profiles maintained by Bluez userspace - uuids.add(BluetoothUuid.AudioSource); - uuids.add(BluetoothUuid.AvrcpTarget); - uuids.add(BluetoothUuid.NAP); - } - - // Cannot cast uuids.toArray directly since ParcelUuid is parcelable - mAdapterUuids = new ParcelUuid[uuids.size()]; - for (int i = 0; i < uuids.size(); i++) { - mAdapterUuids[i] = uuids.get(i); - } - } - - /** - * This function is called from Bluetooth Event Loop when onPropertyChanged - * for adapter comes in with UUID property. - * @param uuidsThe uuids of adapter as reported by Bluez. - */ - /*package*/ synchronized void updateBluetoothState(String uuids) { - ParcelUuid[] adapterUuids = convertStringToParcelUuid(uuids); - - if (mAdapterUuids != null && - BluetoothUuid.containsAllUuids(adapterUuids, mAdapterUuids)) { - mBluetoothState.sendMessage(BluetoothAdapterStateMachine.SERVICE_RECORD_LOADED); - } - } - - /** - * This method is called immediately before Bluetooth module is turned on after - * the adapter became pariable. - * It inits bond state and profile state before STATE_ON intent is broadcasted. - */ - /*package*/ void initBluetoothAfterTurningOn() { - String discoverable = getProperty("Discoverable", false); - String timeout = getProperty("DiscoverableTimeout", false); - if (timeout == null) { - Log.w(TAG, "Null DiscoverableTimeout property"); - // assign a number, anything not 0 - timeout = "1"; - } - if (discoverable.equals("true") && Integer.valueOf(timeout) != 0) { - setAdapterPropertyBooleanNative("Discoverable", 0); - } - mBondState.initBondState(); - initProfileState(); - getProfileProxy(); - } - - /** - * This method is called immediately after Bluetooth module is turned on. - * It starts auto-connection and places bluetooth on sign onto the battery - * stats - */ - /*package*/ void runBluetooth() { - autoConnect(); - - // Log bluetooth on to battery stats. - long ident = Binder.clearCallingIdentity(); - try { - mBatteryStats.noteBluetoothOn(); - } catch (RemoteException e) { - Log.e(TAG, "", e); - } finally { - Binder.restoreCallingIdentity(ident); - } - } - - /*package*/ synchronized boolean attemptAutoPair(String address) { - if (!mBondState.hasAutoPairingFailed(address) && - !mBondState.isAutoPairingBlacklisted(address)) { - mBondState.attempt(address); - setPin(address, BluetoothDevice.convertPinToBytes("0000")); - return true; - } - return false; - } - - /*package*/ synchronized boolean isFixedPinZerosAutoPairKeyboard(String address) { - // Check for keyboards which have fixed PIN 0000 as the pairing pin - return mBondState.isFixedPinZerosAutoPairKeyboard(address); - } - - /*package*/ synchronized void onCreatePairedDeviceResult(String address, int result) { - if (result == BluetoothDevice.BOND_SUCCESS) { - setBondState(address, BluetoothDevice.BOND_BONDED); - if (mBondState.isAutoPairingAttemptsInProgress(address)) { - mBondState.clearPinAttempts(address); - } - } else if (result == BluetoothDevice.UNBOND_REASON_AUTH_FAILED && - mBondState.getAttempt(address) == 1) { - mBondState.addAutoPairingFailure(address); - pairingAttempt(address, result); - } else if (result == BluetoothDevice.UNBOND_REASON_REMOTE_DEVICE_DOWN && - mBondState.isAutoPairingAttemptsInProgress(address)) { - pairingAttempt(address, result); - } else { - setBondState(address, BluetoothDevice.BOND_NONE, result); - if (mBondState.isAutoPairingAttemptsInProgress(address)) { - mBondState.clearPinAttempts(address); - } - } - } - - /*package*/ synchronized String getPendingOutgoingBonding() { - return mBondState.getPendingOutgoingBonding(); - } - - private void pairingAttempt(String address, int result) { - // This happens when our initial guess of "0000" as the pass key - // fails. Try to create the bond again and display the pin dialog - // to the user. Use back-off while posting the delayed - // message. The initial value is - // INIT_AUTO_PAIRING_FAILURE_ATTEMPT_DELAY and the max value is - // MAX_AUTO_PAIRING_FAILURE_ATTEMPT_DELAY. If the max value is - // reached, display an error to the user. - int attempt = mBondState.getAttempt(address); - if (attempt * INIT_AUTO_PAIRING_FAILURE_ATTEMPT_DELAY > - MAX_AUTO_PAIRING_FAILURE_ATTEMPT_DELAY) { - mBondState.clearPinAttempts(address); - setBondState(address, BluetoothDevice.BOND_NONE, result); - return; - } - - Message message = mHandler.obtainMessage(MESSAGE_AUTO_PAIRING_FAILURE_ATTEMPT_DELAY); - message.obj = address; - boolean postResult = mHandler.sendMessageDelayed(message, - attempt * INIT_AUTO_PAIRING_FAILURE_ATTEMPT_DELAY); - if (!postResult) { - mBondState.clearPinAttempts(address); - setBondState(address, - BluetoothDevice.BOND_NONE, result); - return; - } - } - - /*package*/ BluetoothDevice getRemoteDevice(String address) { - return mAdapter.getRemoteDevice(address); - } - - private static String toBondStateString(int bondState) { - switch (bondState) { - case BluetoothDevice.BOND_NONE: - return "not bonded"; - case BluetoothDevice.BOND_BONDING: - return "bonding"; - case BluetoothDevice.BOND_BONDED: - return "bonded"; - default: - return "??????"; - } - } - - public synchronized boolean setName(String name) { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, - "Need BLUETOOTH_ADMIN permission"); - if (name == null) { - return false; - } - return setPropertyString("Name", name); - } - - //TODO(): setPropertyString, setPropertyInteger, setPropertyBoolean - // Either have a single property function with Object as the parameter - // or have a function for each property and then obfuscate in the JNI layer. - // The following looks dirty. - private boolean setPropertyString(String key, String value) { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); - if (!isEnabledInternal()) return false; - return setAdapterPropertyStringNative(key, value); - } - - private boolean setPropertyInteger(String key, int value) { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); - if (!isEnabledInternal()) return false; - return setAdapterPropertyIntegerNative(key, value); - } - - private boolean setPropertyBoolean(String key, boolean value) { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); - if (!isEnabledInternal()) return false; - return setAdapterPropertyBooleanNative(key, value ? 1 : 0); - } - - /** - * Set the discoverability window for the device. A timeout of zero - * makes the device permanently discoverable (if the device is - * discoverable). Setting the timeout to a nonzero value does not make - * a device discoverable; you need to call setMode() to make the device - * explicitly discoverable. - * - * @param timeout The discoverable timeout in seconds. - */ - public synchronized boolean setDiscoverableTimeout(int timeout) { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, - "Need BLUETOOTH_ADMIN permission"); - return setPropertyInteger("DiscoverableTimeout", timeout); - } - - public synchronized boolean setScanMode(int mode, int duration) { - mContext.enforceCallingOrSelfPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS, - "Need WRITE_SECURE_SETTINGS permission"); - boolean pairable; - boolean discoverable; - - switch (mode) { - case BluetoothAdapter.SCAN_MODE_NONE: - pairable = false; - discoverable = false; - break; - case BluetoothAdapter.SCAN_MODE_CONNECTABLE: - pairable = true; - discoverable = false; - break; - case BluetoothAdapter.SCAN_MODE_CONNECTABLE_DISCOVERABLE: - pairable = true; - discoverable = true; - if (DBG) Log.d(TAG, "BT Discoverable for " + duration + " seconds"); - break; - default: - Log.w(TAG, "Requested invalid scan mode " + mode); - return false; - } - - setPropertyBoolean("Discoverable", discoverable); - setPropertyBoolean("Pairable", pairable); - return true; - } - - /** - * @param on true set the local Bluetooth module to be connectable - * The dicoverability is recovered to what it was before - * switchConnectable(false) call - * false set the local Bluetooth module to be not connectable - * and not dicoverable - */ - /*package*/ synchronized void switchConnectable(boolean on) { - setAdapterPropertyBooleanNative("Powered", on ? 1 : 0); - } - - /*package*/ synchronized void setPairable() { - String pairableString = getProperty("Pairable", false); - if (pairableString == null) { - Log.e(TAG, "null pairableString"); - return; - } - if (pairableString.equals("false")) { - setAdapterPropertyBooleanNative("Pairable", 1); - } - } - - /*package*/ String getProperty(String name, boolean checkState) { - // If checkState is false, check if the event loop is running. - // before making the call to Bluez - if (checkState) { - if (!isEnabledInternal()) return null; - } else if (!mEventLoop.isEventLoopRunning()) { - return null; - } - - return mAdapterProperties.getProperty(name); - } - - BluetoothAdapterProperties getAdapterProperties() { - return mAdapterProperties; - } - - BluetoothDeviceProperties getDeviceProperties() { - return mDeviceProperties; - } - - boolean isRemoteDeviceInCache(String address) { - return mDeviceProperties.isInCache(address); - } - - void setRemoteDeviceProperty(String address, String name, String value) { - mDeviceProperties.setProperty(address, name, value); - } - - void updateRemoteDevicePropertiesCache(String address) { - mDeviceProperties.updateCache(address); - } - - public synchronized String getAddress() { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); - // Don't check state since we want to provide address, even if BT is off - return getProperty("Address", false); - } - - public synchronized String getName() { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); - // Don't check state since we want to provide name, even if BT is off - return getProperty("Name", false); - } - - public ParcelUuid[] getUuids() { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); - String value = getProperty("UUIDs", true); - if (value == null) return null; - return convertStringToParcelUuid(value); - } - - private ParcelUuid[] convertStringToParcelUuid(String value) { - String[] uuidStrings = null; - // The UUIDs are stored as a "," separated string. - uuidStrings = value.split(","); - ParcelUuid[] uuids = new ParcelUuid[uuidStrings.length]; - - for (int i = 0; i < uuidStrings.length; i++) { - uuids[i] = ParcelUuid.fromString(uuidStrings[i]); - } - return uuids; - } - - /** - * Returns the user-friendly name of a remote device. This value is - * returned from our local cache, which is updated when onPropertyChange - * event is received. - * Do not expect to retrieve the updated remote name immediately after - * changing the name on the remote device. - * - * @param address Bluetooth address of remote device. - * - * @return The user-friendly name of the specified remote device. - */ - public synchronized String getRemoteName(String address) { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); - if (!BluetoothAdapter.checkBluetoothAddress(address)) { - return null; - } - return mDeviceProperties.getProperty(address, "Name"); - } - - /** - * Returns alias of a remote device. This value is returned from our - * local cache, which is updated when onPropertyChange event is received. - * - * @param address Bluetooth address of remote device. - * - * @return The alias of the specified remote device. - */ - public synchronized String getRemoteAlias(String address) { - - mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); - if (!BluetoothAdapter.checkBluetoothAddress(address)) { - return null; - } - return mDeviceProperties.getProperty(address, "Alias"); - } - - /** - * Set the alias of a remote device. - * - * @param address Bluetooth address of remote device. - * @param alias new alias to change to - * @return true on success, false on error - */ - public synchronized boolean setRemoteAlias(String address, String alias) { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); - if (!BluetoothAdapter.checkBluetoothAddress(address)) { - return false; - } - - return setDevicePropertyStringNative(getObjectPathFromAddress(address), - "Alias", alias); - } - - /** - * Get the discoverability window for the device. A timeout of zero - * means that the device is permanently discoverable (if the device is - * in the discoverable mode). - * - * @return The discoverability window of the device, in seconds. A negative - * value indicates an error. - */ - public int getDiscoverableTimeout() { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); - String timeout = getProperty("DiscoverableTimeout", true); - if (timeout != null) - return Integer.valueOf(timeout); - else - return -1; - } - - public int getScanMode() { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); - if (!isEnabledInternal()) - return BluetoothAdapter.SCAN_MODE_NONE; - - boolean pairable = getProperty("Pairable", true).equals("true"); - boolean discoverable = getProperty("Discoverable", true).equals("true"); - return bluezStringToScanMode (pairable, discoverable); - } - - public synchronized boolean startDiscovery() { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, - "Need BLUETOOTH_ADMIN permission"); - if (!isEnabledInternal()) return false; - - return startDiscoveryNative(); - } - - public synchronized boolean cancelDiscovery() { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, - "Need BLUETOOTH_ADMIN permission"); - if (!isEnabledInternal()) return false; - - return stopDiscoveryNative(); - } - - public boolean isDiscovering() { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); - - String discoveringProperty = getProperty("Discovering", false); - if (discoveringProperty == null) { - return false; - } - - return discoveringProperty.equals("true"); - } - - private boolean isBondingFeasible(String address) { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, - "Need BLUETOOTH_ADMIN permission"); - if (!isEnabledInternal()) return false; - - if (!BluetoothAdapter.checkBluetoothAddress(address)) { - return false; - } - address = address.toUpperCase(); - - if (mBondState.getPendingOutgoingBonding() != null) { - Log.d(TAG, "Ignoring createBond(): another device is bonding"); - // a different device is currently bonding, fail - return false; - } - - // Check for bond state only if we are not performing auto - // pairing exponential back-off attempts. - if (!mBondState.isAutoPairingAttemptsInProgress(address) && - mBondState.getBondState(address) != BluetoothDevice.BOND_NONE) { - Log.d(TAG, "Ignoring createBond(): this device is already bonding or bonded"); - return false; - } - - if (address.equals(mDockAddress)) { - if (!writeDockPin()) { - Log.e(TAG, "Error while writing Pin for the dock"); - return false; - } - } - return true; - } - - public synchronized boolean createBond(String address) { - if (!isBondingFeasible(address)) return false; - - if (!createPairedDeviceNative(address, 60000 /*1 minute*/ )) { - return false; - } - - mBondState.setPendingOutgoingBonding(address); - mBondState.setBondState(address, BluetoothDevice.BOND_BONDING); - - return true; - } - - public synchronized boolean createBondOutOfBand(String address, byte[] hash, - byte[] randomizer) { - if (!isBondingFeasible(address)) return false; - - if (!createPairedDeviceOutOfBandNative(address, 60000 /* 1 minute */)) { - return false; - } - - setDeviceOutOfBandData(address, hash, randomizer); - mBondState.setPendingOutgoingBonding(address); - mBondState.setBondState(address, BluetoothDevice.BOND_BONDING); - - return true; - } - - public synchronized boolean setDeviceOutOfBandData(String address, byte[] hash, - byte[] randomizer) { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, - "Need BLUETOOTH_ADMIN permission"); - if (!isEnabledInternal()) return false; - - Pair value = new Pair(hash, randomizer); - - if (DBG) { - Log.d(TAG, "Setting out of band data for: " + address + ":" + - Arrays.toString(hash) + ":" + Arrays.toString(randomizer)); - } - - mDeviceOobData.put(address, value); - return true; - } - - Pair getDeviceOutOfBandData(BluetoothDevice device) { - return mDeviceOobData.get(device.getAddress()); - } - - - public synchronized byte[] readOutOfBandData() { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, - "Need BLUETOOTH permission"); - if (!isEnabledInternal()) return null; - - return readAdapterOutOfBandDataNative(); - } - - public synchronized boolean cancelBondProcess(String address) { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, - "Need BLUETOOTH_ADMIN permission"); - if (!isEnabledInternal()) return false; - - if (!BluetoothAdapter.checkBluetoothAddress(address)) { - return false; - } - address = address.toUpperCase(); - if (mBondState.getBondState(address) != BluetoothDevice.BOND_BONDING) { - return false; - } - - mBondState.setBondState(address, BluetoothDevice.BOND_NONE, - BluetoothDevice.UNBOND_REASON_AUTH_CANCELED); - cancelDeviceCreationNative(address); - return true; - } - - public synchronized boolean removeBond(String address) { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, - "Need BLUETOOTH_ADMIN permission"); - if (!isEnabledInternal()) return false; - - if (!BluetoothAdapter.checkBluetoothAddress(address)) { - return false; - } - BluetoothDeviceProfileState state = mDeviceProfileState.get(address); - if (state != null) { - state.sendMessage(BluetoothDeviceProfileState.UNPAIR); - return true; - } else { - return false; - } - } - - public synchronized boolean removeBondInternal(String address) { - // Unset the trusted device state and then unpair - setTrust(address, false); - return removeDeviceNative(getObjectPathFromAddress(address)); - } - - public synchronized String[] listBonds() { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); - return mBondState.listInState(BluetoothDevice.BOND_BONDED); - } - - /*package*/ synchronized String[] listInState(int state) { - return mBondState.listInState(state); - } - - public synchronized int getBondState(String address) { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); - if (!BluetoothAdapter.checkBluetoothAddress(address)) { - return BluetoothDevice.ERROR; - } - return mBondState.getBondState(address.toUpperCase()); - } - - /*package*/ synchronized boolean setBondState(String address, int state) { - return setBondState(address, state, 0); - } - - /*package*/ synchronized boolean setBondState(String address, int state, int reason) { - mBondState.setBondState(address.toUpperCase(), state, reason); - return true; - } - - public synchronized boolean isBluetoothDock(String address) { - SharedPreferences sp = mContext.getSharedPreferences(SHARED_PREFERENCES_NAME, - Context.MODE_PRIVATE); - - return sp.contains(SHARED_PREFERENCE_DOCK_ADDRESS + address); - } - - /*package*/ String[] getRemoteDeviceProperties(String address) { - if (!isEnabledInternal()) return null; - - String objectPath = getObjectPathFromAddress(address); - return (String [])getDevicePropertiesNative(objectPath); - } - - /** - * Sets the remote device trust state. - * - * @return boolean to indicate operation success or fail - */ - public synchronized boolean setTrust(String address, boolean value) { - if (!BluetoothAdapter.checkBluetoothAddress(address)) { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, - "Need BLUETOOTH_ADMIN permission"); - return false; - } - - if (!isEnabledInternal()) return false; - - return setDevicePropertyBooleanNative( - getObjectPathFromAddress(address), "Trusted", value ? 1 : 0); - } - - /** - * Gets the remote device trust state as boolean. - * Note: this value may be - * retrieved from cache if we retrieved the data before * - * - * @return boolean to indicate trusted or untrusted state - */ - public synchronized boolean getTrustState(String address) { - if (!BluetoothAdapter.checkBluetoothAddress(address)) { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); - return false; - } - - String val = mDeviceProperties.getProperty(address, "Trusted"); - if (val == null) { - return false; - } else { - return val.equals("true"); - } - } - - /** - * Gets the remote major, minor classes encoded as a 32-bit - * integer. - * - * Note: this value is retrieved from cache, because we get it during - * remote-device discovery. - * - * @return 32-bit integer encoding the remote major, minor, and service - * classes. - */ - public synchronized int getRemoteClass(String address) { - if (!BluetoothAdapter.checkBluetoothAddress(address)) { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); - return BluetoothClass.ERROR; - } - String val = mDeviceProperties.getProperty(address, "Class"); - if (val == null) - return BluetoothClass.ERROR; - else { - return Integer.valueOf(val); - } - } - - - /** - * Gets the UUIDs supported by the remote device - * - * @return array of 128bit ParcelUuids - */ - public synchronized ParcelUuid[] getRemoteUuids(String address) { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); - if (!BluetoothAdapter.checkBluetoothAddress(address)) { - return null; - } - return getUuidFromCache(address); - } - - ParcelUuid[] getUuidFromCache(String address) { - String value = mDeviceProperties.getProperty(address, "UUIDs"); - if (value == null) return null; - - String[] uuidStrings = null; - // The UUIDs are stored as a "," separated string. - uuidStrings = value.split(","); - ParcelUuid[] uuids = new ParcelUuid[uuidStrings.length]; - - for (int i = 0; i < uuidStrings.length; i++) { - uuids[i] = ParcelUuid.fromString(uuidStrings[i]); - } - return uuids; - } - - /** - * Connect and fetch new UUID's using SDP. - * The UUID's found are broadcast as intents. - * Optionally takes a uuid and callback to fetch the RFCOMM channel for the - * a given uuid. - * TODO: Don't wait UUID_INTENT_DELAY to broadcast UUID intents on success - * TODO: Don't wait UUID_INTENT_DELAY to handle the failure case for - * callback and broadcast intents. - */ - public synchronized boolean fetchRemoteUuids(String address, ParcelUuid uuid, - IBluetoothCallback callback) { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); - if (!isEnabledInternal()) return false; - - if (!BluetoothAdapter.checkBluetoothAddress(address)) { - return false; - } - - RemoteService service = new RemoteService(address, uuid); - if (uuid != null && mUuidCallbackTracker.get(service) != null) { - // An SDP query for this address & uuid is already in progress - // Do not add this callback for the uuid - return false; - } - - if (mUuidIntentTracker.contains(address)) { - // An SDP query for this address is already in progress - // Add this uuid onto the in-progress SDP query - if (uuid != null) { - mUuidCallbackTracker.put(new RemoteService(address, uuid), callback); - } - return true; - } - - // If the device is already created, we will - // do the SDP on the callback of createDeviceNative. - boolean ret= createDeviceNative(address); - - mUuidIntentTracker.add(address); - if (uuid != null) { - mUuidCallbackTracker.put(new RemoteService(address, uuid), callback); - } - - Message message = mHandler.obtainMessage(MESSAGE_UUID_INTENT); - message.obj = address; - mHandler.sendMessageDelayed(message, UUID_INTENT_DELAY); - return ret; - } - - /** - * Gets the rfcomm channel associated with the UUID. - * Pulls records from the cache only. - * - * @param address Address of the remote device - * @param uuid ParcelUuid of the service attribute - * - * @return rfcomm channel associated with the service attribute - * -1 on error - */ - public int getRemoteServiceChannel(String address, ParcelUuid uuid) { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); - if (!isEnabledInternal()) return -1; - - if (!BluetoothAdapter.checkBluetoothAddress(address)) { - return BluetoothDevice.ERROR; - } - // Check if we are recovering from a crash. - if (mDeviceProperties.isEmpty()) { - if (mDeviceProperties.updateCache(address) == null) - return -1; - } - - Map value = mDeviceServiceChannelCache.get(address); - if (value != null && value.containsKey(uuid)) - return value.get(uuid); - return -1; - } - - public synchronized boolean setPin(String address, byte[] pin) { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, - "Need BLUETOOTH_ADMIN permission"); - if (!isEnabledInternal()) return false; - - if (pin == null || pin.length <= 0 || pin.length > 16 || - !BluetoothAdapter.checkBluetoothAddress(address)) { - return false; - } - address = address.toUpperCase(); - Integer data = mEventLoop.getPasskeyAgentRequestData().remove(address); - if (data == null) { - Log.w(TAG, "setPin(" + address + ") called but no native data available, " + - "ignoring. Maybe the PasskeyAgent Request was cancelled by the remote device" + - " or by bluez.\n"); - return false; - } - // bluez API wants pin as a string - String pinString; - try { - pinString = new String(pin, "UTF8"); - } catch (UnsupportedEncodingException uee) { - Log.e(TAG, "UTF8 not supported?!?"); - return false; - } - return setPinNative(address, pinString, data.intValue()); - } - - public synchronized boolean setPasskey(String address, int passkey) { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, - "Need BLUETOOTH_ADMIN permission"); - if (!isEnabledInternal()) return false; - - if (passkey < 0 || passkey > 999999 || !BluetoothAdapter.checkBluetoothAddress(address)) { - return false; - } - address = address.toUpperCase(); - Integer data = mEventLoop.getPasskeyAgentRequestData().remove(address); - if (data == null) { - Log.w(TAG, "setPasskey(" + address + ") called but no native data available, " + - "ignoring. Maybe the PasskeyAgent Request was cancelled by the remote device" + - " or by bluez.\n"); - return false; - } - return setPasskeyNative(address, passkey, data.intValue()); - } - - public synchronized boolean setPairingConfirmation(String address, boolean confirm) { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, - "Need BLUETOOTH_ADMIN permission"); - if (!isEnabledInternal()) return false; - - address = address.toUpperCase(); - Integer data = mEventLoop.getPasskeyAgentRequestData().remove(address); - if (data == null) { - Log.w(TAG, "setPasskey(" + address + ") called but no native data available, " + - "ignoring. Maybe the PasskeyAgent Request was cancelled by the remote device" + - " or by bluez.\n"); - return false; - } - return setPairingConfirmationNative(address, confirm, data.intValue()); - } - - public synchronized boolean setRemoteOutOfBandData(String address) { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, - "Need BLUETOOTH_ADMIN permission"); - if (!isEnabledInternal()) return false; - address = address.toUpperCase(); - Integer data = mEventLoop.getPasskeyAgentRequestData().remove(address); - if (data == null) { - Log.w(TAG, "setRemoteOobData(" + address + ") called but no native data available, " + - "ignoring. Maybe the PasskeyAgent Request was cancelled by the remote device" + - " or by bluez.\n"); - return false; - } - - Pair val = mDeviceOobData.get(address); - byte[] hash, randomizer; - if (val == null) { - // TODO: check what should be passed in this case. - hash = new byte[16]; - randomizer = new byte[16]; - } else { - hash = val.first; - randomizer = val.second; - } - return setRemoteOutOfBandDataNative(address, hash, randomizer, data.intValue()); - } - - public synchronized boolean cancelPairingUserInput(String address) { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, - "Need BLUETOOTH_ADMIN permission"); - if (!isEnabledInternal()) return false; - - if (!BluetoothAdapter.checkBluetoothAddress(address)) { - return false; - } - mBondState.setBondState(address, BluetoothDevice.BOND_NONE, - BluetoothDevice.UNBOND_REASON_AUTH_CANCELED); - address = address.toUpperCase(); - Integer data = mEventLoop.getPasskeyAgentRequestData().remove(address); - if (data == null) { - Log.w(TAG, "cancelUserInputNative(" + address + ") called but no native data " + - "available, ignoring. Maybe the PasskeyAgent Request was already cancelled " + - "by the remote or by bluez.\n"); - return false; - } - return cancelPairingUserInputNative(address, data.intValue()); - } - - /*package*/ void updateDeviceServiceChannelCache(String address) { - if (DBG) Log.d(TAG, "updateDeviceServiceChannelCache(" + address + ")"); - - // We are storing the rfcomm channel numbers only for the uuids - // we are interested in. - ParcelUuid[] deviceUuids = getRemoteUuids(address); - - ArrayList applicationUuids = new ArrayList(); - - synchronized (this) { - for (RemoteService service : mUuidCallbackTracker.keySet()) { - if (service.address.equals(address)) { - applicationUuids.add(service.uuid); - } - } - } - - Map uuidToChannelMap = new HashMap(); - - // Retrieve RFCOMM channel for default uuids - for (ParcelUuid uuid : RFCOMM_UUIDS) { - if (BluetoothUuid.isUuidPresent(deviceUuids, uuid)) { - int channel = getDeviceServiceChannelForUuid(address, uuid); - uuidToChannelMap.put(uuid, channel); - if (DBG) Log.d(TAG, "\tuuid(system): " + uuid + " " + channel); - } - } - // Retrieve RFCOMM channel for application requested uuids - for (ParcelUuid uuid : applicationUuids) { - if (BluetoothUuid.isUuidPresent(deviceUuids, uuid)) { - int channel = getDeviceServiceChannelForUuid(address, uuid); - uuidToChannelMap.put(uuid, channel); - if (DBG) Log.d(TAG, "\tuuid(application): " + uuid + " " + channel); - } - } - - synchronized (this) { - // Make application callbacks - for (Iterator iter = mUuidCallbackTracker.keySet().iterator(); - iter.hasNext();) { - RemoteService service = iter.next(); - if (service.address.equals(address)) { - if (uuidToChannelMap.containsKey(service.uuid)) { - int channel = uuidToChannelMap.get(service.uuid); - - if (DBG) Log.d(TAG, "Making callback for " + service.uuid + - " with result " + channel); - IBluetoothCallback callback = mUuidCallbackTracker.get(service); - if (callback != null) { - try { - callback.onRfcommChannelFound(channel); - } catch (RemoteException e) {Log.e(TAG, "", e);} - } - - iter.remove(); - } - } - } - - // Update cache - mDeviceServiceChannelCache.put(address, uuidToChannelMap); - } - } - - private int getDeviceServiceChannelForUuid(String address, - ParcelUuid uuid) { - return getDeviceServiceChannelNative(getObjectPathFromAddress(address), - uuid.toString(), 0x0004); - } - - /** - * b is a handle to a Binder instance, so that this service can be notified - * for Applications that terminate unexpectedly, to clean there service - * records - */ - public synchronized int addRfcommServiceRecord(String serviceName, ParcelUuid uuid, - int channel, IBinder b) { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); - if (!isEnabledInternal()) return -1; - - if (serviceName == null || uuid == null || channel < 1 || - channel > BluetoothSocket.MAX_RFCOMM_CHANNEL) { - return -1; - } - if (BluetoothUuid.isUuidPresent(BluetoothUuid.RESERVED_UUIDS, uuid)) { - Log.w(TAG, "Attempted to register a reserved UUID: " + uuid); - return -1; - } - int handle = addRfcommServiceRecordNative(serviceName, - uuid.getUuid().getMostSignificantBits(), uuid.getUuid().getLeastSignificantBits(), - (short)channel); - if (DBG) Log.d(TAG, "new handle " + Integer.toHexString(handle)); - if (handle == -1) { - return -1; - } - - ServiceRecordClient client = new ServiceRecordClient(); - client.pid = Binder.getCallingPid(); - client.binder = b; - client.death = new Reaper(handle, client.pid, RFCOMM_RECORD_REAPER); - mServiceRecordToPid.put(new Integer(handle), client); - try { - b.linkToDeath(client.death, 0); - } catch (RemoteException e) { - Log.e(TAG, "", e); - client.death = null; - } - return handle; - } - - public void removeServiceRecord(int handle) { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, - "Need BLUETOOTH permission"); - // Since this is a binder call check if Bluetooth is off - if (getBluetoothStateInternal() == BluetoothAdapter.STATE_OFF) return; - Message message = mHandler.obtainMessage(MESSAGE_REMOVE_SERVICE_RECORD); - message.obj = new Pair(handle, Binder.getCallingPid()); - mHandler.sendMessage(message); - } - - private synchronized void checkAndRemoveRecord(int handle, int pid) { - ServiceRecordClient client = mServiceRecordToPid.get(handle); - if (client != null && pid == client.pid) { - if (DBG) Log.d(TAG, "Removing service record " + - Integer.toHexString(handle) + " for pid " + pid); - - if (client.death != null) { - client.binder.unlinkToDeath(client.death, 0); - } - - mServiceRecordToPid.remove(handle); - removeServiceRecordNative(handle); - } - } - - private class Reaper implements IBinder.DeathRecipient { - int mPid; - int mHandle; - int mType; - - Reaper(int handle, int pid, int type) { - mPid = pid; - mHandle = handle; - mType = type; - } - - Reaper(int pid, int type) { - mPid = pid; - mType = type; - } - - @Override - public void binderDied() { - synchronized (BluetoothService.this) { - if (DBG) Log.d(TAG, "Tracked app " + mPid + " died" + "Type:" + mType); - if (mType == RFCOMM_RECORD_REAPER) { - checkAndRemoveRecord(mHandle, mPid); - } else if (mType == STATE_CHANGE_REAPER) { - mStateChangeTracker.remove(mPid); - } - } - } - } - - - @Override - public boolean changeApplicationBluetoothState(boolean on, - IBluetoothStateChangeCallback callback, IBinder binder) { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); - - int pid = Binder.getCallingPid(); - //mStateChangeTracker is a synchronized map - if (!mStateChangeTracker.containsKey(pid)) { - if (on) { - mStateChangeTracker.put(pid, callback); - } else { - return false; - } - } else if (!on) { - mStateChangeTracker.remove(pid); - } - - if (binder != null) { - try { - binder.linkToDeath(new Reaper(pid, STATE_CHANGE_REAPER), 0); - } catch (RemoteException e) { - Log.e(TAG, "", e); - return false; - } - } - - int type; - if (on) { - type = BluetoothAdapterStateMachine.PER_PROCESS_TURN_ON; - } else { - type = BluetoothAdapterStateMachine.PER_PROCESS_TURN_OFF; - } - - mBluetoothState.sendMessage(type, callback); - return true; - } - - boolean isApplicationStateChangeTrackerEmpty() { - return mStateChangeTracker.isEmpty(); - } - - void clearApplicationStateChangeTracker() { - mStateChangeTracker.clear(); - } - - Collection getApplicationStateChangeCallbacks() { - return mStateChangeTracker.values(); - } - - int getNumberOfApplicationStateChangeTrackers() { - return mStateChangeTracker.size(); - } - - private final BroadcastReceiver mReceiver = new BroadcastReceiver() { - @Override - public void onReceive(Context context, Intent intent) { - if (intent == null) return; - - String action = intent.getAction(); - if (action.equals(Intent.ACTION_AIRPLANE_MODE_CHANGED)) { - ContentResolver resolver = context.getContentResolver(); - // Query the airplane mode from Settings.System just to make sure that - // some random app is not sending this intent and disabling bluetooth - if (isAirplaneModeOn()) { - mBluetoothState.sendMessage(BluetoothAdapterStateMachine.AIRPLANE_MODE_ON); - } else { - mBluetoothState.sendMessage(BluetoothAdapterStateMachine.AIRPLANE_MODE_OFF); - } - } else if (Intent.ACTION_DOCK_EVENT.equals(action)) { - int state = intent.getIntExtra(Intent.EXTRA_DOCK_STATE, - Intent.EXTRA_DOCK_STATE_UNDOCKED); - if (DBG) Log.v(TAG, "Received ACTION_DOCK_EVENT with State:" + state); - if (state == Intent.EXTRA_DOCK_STATE_UNDOCKED) { - mDockAddress = null; - mDockPin = null; - } else { - SharedPreferences.Editor editor = - mContext.getSharedPreferences(SHARED_PREFERENCES_NAME, - mContext.MODE_PRIVATE).edit(); - editor.putBoolean(SHARED_PREFERENCE_DOCK_ADDRESS + mDockAddress, true); - editor.apply(); - } - } - } - }; - - private void registerForAirplaneMode(IntentFilter filter) { - final ContentResolver resolver = mContext.getContentResolver(); - final String airplaneModeRadios = Settings.System.getString(resolver, - Settings.System.AIRPLANE_MODE_RADIOS); - final String toggleableRadios = Settings.System.getString(resolver, - Settings.System.AIRPLANE_MODE_TOGGLEABLE_RADIOS); - - mIsAirplaneSensitive = airplaneModeRadios == null ? true : - airplaneModeRadios.contains(Settings.System.RADIO_BLUETOOTH); - mIsAirplaneToggleable = toggleableRadios == null ? false : - toggleableRadios.contains(Settings.System.RADIO_BLUETOOTH); - - if (mIsAirplaneSensitive) { - filter.addAction(Intent.ACTION_AIRPLANE_MODE_CHANGED); - } - } - - /* Returns true if airplane mode is currently on */ - /*package*/ final boolean isAirplaneModeOn() { - return Settings.System.getInt(mContext.getContentResolver(), - Settings.System.AIRPLANE_MODE_ON, 0) == 1; - } - - /* Broadcast the Uuid intent */ - /*package*/ synchronized void sendUuidIntent(String address) { - ParcelUuid[] uuid = getUuidFromCache(address); - Intent intent = new Intent(BluetoothDevice.ACTION_UUID); - intent.putExtra(BluetoothDevice.EXTRA_DEVICE, mAdapter.getRemoteDevice(address)); - intent.putExtra(BluetoothDevice.EXTRA_UUID, uuid); - mContext.sendBroadcast(intent, BLUETOOTH_ADMIN_PERM); - mUuidIntentTracker.remove(address); - } - - /*package*/ synchronized void makeServiceChannelCallbacks(String address) { - for (Iterator iter = mUuidCallbackTracker.keySet().iterator(); - iter.hasNext();) { - RemoteService service = iter.next(); - if (service.address.equals(address)) { - if (DBG) Log.d(TAG, "Cleaning up failed UUID channel lookup: " - + service.address + " " + service.uuid); - IBluetoothCallback callback = mUuidCallbackTracker.get(service); - if (callback != null) { - try { - callback.onRfcommChannelFound(-1); - } catch (RemoteException e) {Log.e(TAG, "", e);} - } - - iter.remove(); - } - } - } - - @Override - protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) { - mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DUMP, TAG); - - if (getBluetoothStateInternal() != BluetoothAdapter.STATE_ON) { - return; - } - - pw.println("mIsAirplaneSensitive = " + mIsAirplaneSensitive); - pw.println("mIsAirplaneToggleable = " + mIsAirplaneToggleable); - - pw.println("Local address = " + getAddress()); - pw.println("Local name = " + getName()); - pw.println("isDiscovering() = " + isDiscovering()); - - mAdapter.getProfileProxy(mContext, - mBluetoothProfileServiceListener, BluetoothProfile.HEADSET); - mAdapter.getProfileProxy(mContext, - mBluetoothProfileServiceListener, BluetoothProfile.INPUT_DEVICE); - mAdapter.getProfileProxy(mContext, - mBluetoothProfileServiceListener, BluetoothProfile.PAN); - - dumpKnownDevices(pw); - dumpAclConnectedDevices(pw); - dumpHeadsetService(pw); - dumpInputDeviceProfile(pw); - dumpPanProfile(pw); - dumpApplicationServiceRecords(pw); - dumpProfileState(pw); - } - - private void dumpProfileState(PrintWriter pw) { - pw.println("\n--Profile State dump--"); - pw.println("\n Headset profile state:" + - mAdapter.getProfileConnectionState(BluetoothProfile.HEADSET)); - pw.println("\n A2dp profile state:" + - mAdapter.getProfileConnectionState(BluetoothProfile.A2DP)); - pw.println("\n HID profile state:" + - mAdapter.getProfileConnectionState(BluetoothProfile.INPUT_DEVICE)); - pw.println("\n PAN profile state:" + - mAdapter.getProfileConnectionState(BluetoothProfile.PAN)); - } - - private void dumpHeadsetService(PrintWriter pw) { - pw.println("\n--Headset Service--"); - if (mHeadsetProxy != null) { - List deviceList = mHeadsetProxy.getConnectedDevices(); - if (deviceList.size() == 0) { - pw.println("No headsets connected"); - } else { - BluetoothDevice device = deviceList.get(0); - pw.println("\ngetConnectedDevices[0] = " + device); - dumpHeadsetConnectionState(pw, device); - pw.println("getBatteryUsageHint() = " + - mHeadsetProxy.getBatteryUsageHint(device)); - } - - deviceList.clear(); - deviceList = mHeadsetProxy.getDevicesMatchingConnectionStates(new int[] { - BluetoothProfile.STATE_CONNECTED, BluetoothProfile.STATE_DISCONNECTED}); - pw.println("--Connected and Disconnected Headsets"); - for (BluetoothDevice device: deviceList) { - pw.println(device); - if (mHeadsetProxy.isAudioConnected(device)) { - pw.println("SCO audio connected to device:" + device); - } - } - } - } - - private void dumpInputDeviceProfile(PrintWriter pw) { - pw.println("\n--Bluetooth Service- Input Device Profile"); - if (mInputDevice != null) { - List deviceList = mInputDevice.getConnectedDevices(); - if (deviceList.size() == 0) { - pw.println("No input devices connected"); - } else { - pw.println("Number of connected devices:" + deviceList.size()); - BluetoothDevice device = deviceList.get(0); - pw.println("getConnectedDevices[0] = " + device); - pw.println("Priority of Connected device = " + mInputDevice.getPriority(device)); - - switch (mInputDevice.getConnectionState(device)) { - case BluetoothInputDevice.STATE_CONNECTING: - pw.println("getConnectionState() = STATE_CONNECTING"); - break; - case BluetoothInputDevice.STATE_CONNECTED: - pw.println("getConnectionState() = STATE_CONNECTED"); - break; - case BluetoothInputDevice.STATE_DISCONNECTING: - pw.println("getConnectionState() = STATE_DISCONNECTING"); - break; - } - } - deviceList.clear(); - deviceList = mInputDevice.getDevicesMatchingConnectionStates(new int[] { - BluetoothProfile.STATE_CONNECTED, BluetoothProfile.STATE_DISCONNECTED}); - pw.println("--Connected and Disconnected input devices"); - for (BluetoothDevice device: deviceList) { - pw.println(device); - } - } - } - - private void dumpPanProfile(PrintWriter pw) { - pw.println("\n--Bluetooth Service- Pan Profile"); - if (mPan != null) { - List deviceList = mPan.getConnectedDevices(); - if (deviceList.size() == 0) { - pw.println("No Pan devices connected"); - } else { - pw.println("Number of connected devices:" + deviceList.size()); - BluetoothDevice device = deviceList.get(0); - pw.println("getConnectedDevices[0] = " + device); - - switch (mPan.getConnectionState(device)) { - case BluetoothInputDevice.STATE_CONNECTING: - pw.println("getConnectionState() = STATE_CONNECTING"); - break; - case BluetoothInputDevice.STATE_CONNECTED: - pw.println("getConnectionState() = STATE_CONNECTED"); - break; - case BluetoothInputDevice.STATE_DISCONNECTING: - pw.println("getConnectionState() = STATE_DISCONNECTING"); - break; - } - } - deviceList.clear(); - deviceList = mPan.getDevicesMatchingConnectionStates(new int[] { - BluetoothProfile.STATE_CONNECTED, BluetoothProfile.STATE_DISCONNECTED}); - pw.println("--Connected and Disconnected Pan devices"); - for (BluetoothDevice device: deviceList) { - pw.println(device); - } - } - } - - private void dumpHeadsetConnectionState(PrintWriter pw, - BluetoothDevice device) { - switch (mHeadsetProxy.getConnectionState(device)) { - case BluetoothHeadset.STATE_CONNECTING: - pw.println("getConnectionState() = STATE_CONNECTING"); - break; - case BluetoothHeadset.STATE_CONNECTED: - pw.println("getConnectionState() = STATE_CONNECTED"); - break; - case BluetoothHeadset.STATE_DISCONNECTING: - pw.println("getConnectionState() = STATE_DISCONNECTING"); - break; - case BluetoothHeadset.STATE_AUDIO_CONNECTED: - pw.println("getConnectionState() = STATE_AUDIO_CONNECTED"); - break; - } - } - - private void dumpApplicationServiceRecords(PrintWriter pw) { - pw.println("\n--Application Service Records--"); - for (Integer handle : mServiceRecordToPid.keySet()) { - Integer pid = mServiceRecordToPid.get(handle).pid; - pw.println("\tpid " + pid + " handle " + Integer.toHexString(handle)); - } - } - - private void dumpAclConnectedDevices(PrintWriter pw) { - String[] devicesObjectPath = getKnownDevices(); - pw.println("\n--ACL connected devices--"); - if (devicesObjectPath != null) { - for (String device : devicesObjectPath) { - pw.println(getAddressFromObjectPath(device)); - } - } - } - - private void dumpKnownDevices(PrintWriter pw) { - pw.println("\n--Known devices--"); - for (String address : mDeviceProperties.keySet()) { - int bondState = mBondState.getBondState(address); - pw.printf("%s %10s (%d) %s\n", address, - toBondStateString(bondState), - mBondState.getAttempt(address), - getRemoteName(address)); - - Map uuidChannels = mDeviceServiceChannelCache.get(address); - if (uuidChannels == null) { - pw.println("\tuuids = null"); - } else { - for (ParcelUuid uuid : uuidChannels.keySet()) { - Integer channel = uuidChannels.get(uuid); - if (channel == null) { - pw.println("\t" + uuid); - } else { - pw.println("\t" + uuid + " RFCOMM channel = " + channel); - } - } - } - for (RemoteService service : mUuidCallbackTracker.keySet()) { - if (service.address.equals(address)) { - pw.println("\tPENDING CALLBACK: " + service.uuid); - } - } - } - } - - private void getProfileProxy() { - mAdapter.getProfileProxy(mContext, - mBluetoothProfileServiceListener, BluetoothProfile.HEADSET); - } - - private BluetoothProfile.ServiceListener mBluetoothProfileServiceListener = - new BluetoothProfile.ServiceListener() { - public void onServiceConnected(int profile, BluetoothProfile proxy) { - if (profile == BluetoothProfile.HEADSET) { - mHeadsetProxy = (BluetoothHeadset) proxy; - } else if (profile == BluetoothProfile.INPUT_DEVICE) { - mInputDevice = (BluetoothInputDevice) proxy; - } else if (profile == BluetoothProfile.PAN) { - mPan = (BluetoothPan) proxy; - } - } - public void onServiceDisconnected(int profile) { - if (profile == BluetoothProfile.HEADSET) { - mHeadsetProxy = null; - } else if (profile == BluetoothProfile.INPUT_DEVICE) { - mInputDevice = null; - } else if (profile == BluetoothProfile.PAN) { - mPan = null; - } - } - }; - - /* package */ static int bluezStringToScanMode(boolean pairable, boolean discoverable) { - if (pairable && discoverable) - return BluetoothAdapter.SCAN_MODE_CONNECTABLE_DISCOVERABLE; - else if (pairable && !discoverable) - return BluetoothAdapter.SCAN_MODE_CONNECTABLE; - else - return BluetoothAdapter.SCAN_MODE_NONE; - } - - /* package */ static String scanModeToBluezString(int mode) { - switch (mode) { - case BluetoothAdapter.SCAN_MODE_NONE: - return "off"; - case BluetoothAdapter.SCAN_MODE_CONNECTABLE: - return "connectable"; - case BluetoothAdapter.SCAN_MODE_CONNECTABLE_DISCOVERABLE: - return "discoverable"; - } - return null; - } - - /*package*/ String getAddressFromObjectPath(String objectPath) { - String adapterObjectPath = mAdapterProperties.getObjectPath(); - if (adapterObjectPath == null || objectPath == null) { - Log.e(TAG, "getAddressFromObjectPath: AdapterObjectPath:" + adapterObjectPath + - " or deviceObjectPath:" + objectPath + " is null"); - return null; - } - if (!objectPath.startsWith(adapterObjectPath)) { - Log.e(TAG, "getAddressFromObjectPath: AdapterObjectPath:" + adapterObjectPath + - " is not a prefix of deviceObjectPath:" + objectPath + - "bluetoothd crashed ?"); - return null; - } - String address = objectPath.substring(adapterObjectPath.length()); - if (address != null) return address.replace('_', ':'); - - Log.e(TAG, "getAddressFromObjectPath: Address being returned is null"); - return null; - } - - /*package*/ String getObjectPathFromAddress(String address) { - String path = mAdapterProperties.getObjectPath(); - if (path == null) { - Log.e(TAG, "Error: Object Path is null"); - return null; - } - path = path + address.replace(":", "_"); - return path; - } - - /*package */ void setLinkTimeout(String address, int num_slots) { - String path = getObjectPathFromAddress(address); - boolean result = setLinkTimeoutNative(path, num_slots); - - if (!result) Log.d(TAG, "Set Link Timeout to " + num_slots + " slots failed"); - } - - /**** Handlers for PAN Profile ****/ - // TODO: This needs to be converted to a state machine. - - public boolean isTetheringOn() { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); - synchronized (mBluetoothPanProfileHandler) { - return mBluetoothPanProfileHandler.isTetheringOn(); - } - } - - /*package*/boolean allowIncomingTethering() { - synchronized (mBluetoothPanProfileHandler) { - return mBluetoothPanProfileHandler.allowIncomingTethering(); - } - } - - public void setBluetoothTethering(boolean value) { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); - synchronized (mBluetoothPanProfileHandler) { - mBluetoothPanProfileHandler.setBluetoothTethering(value); - } - } - - public int getPanDeviceConnectionState(BluetoothDevice device) { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); - synchronized (mBluetoothPanProfileHandler) { - return mBluetoothPanProfileHandler.getPanDeviceConnectionState(device); - } - } - - public boolean connectPanDevice(BluetoothDevice device) { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, - "Need BLUETOOTH_ADMIN permission"); - synchronized (mBluetoothPanProfileHandler) { - return mBluetoothPanProfileHandler.connectPanDevice(device); - } - } - - public List getConnectedPanDevices() { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); - synchronized (mBluetoothPanProfileHandler) { - return mBluetoothPanProfileHandler.getConnectedPanDevices(); - } - } - - public List getPanDevicesMatchingConnectionStates( - int[] states) { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); - synchronized (mBluetoothPanProfileHandler) { - return mBluetoothPanProfileHandler.getPanDevicesMatchingConnectionStates(states); - } - } - - public boolean disconnectPanDevice(BluetoothDevice device) { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, - "Need BLUETOOTH_ADMIN permission"); - synchronized (mBluetoothPanProfileHandler) { - return mBluetoothPanProfileHandler.disconnectPanDevice(device); - } - } - - /*package*/void handlePanDeviceStateChange(BluetoothDevice device, - String iface, - int state, - int role) { - synchronized (mBluetoothPanProfileHandler) { - mBluetoothPanProfileHandler.handlePanDeviceStateChange(device, iface, state, role); - } - } - - /*package*/void handlePanDeviceStateChange(BluetoothDevice device, - int state, int role) { - synchronized (mBluetoothPanProfileHandler) { - mBluetoothPanProfileHandler.handlePanDeviceStateChange(device, null, state, role); - } - } - - /**** Handlers for Input Device Profile ****/ - // This needs to be converted to state machine - - public boolean connectInputDevice(BluetoothDevice device) { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, - "Need BLUETOOTH_ADMIN permission"); - BluetoothDeviceProfileState state = mDeviceProfileState.get(device.getAddress()); - synchronized (mBluetoothInputProfileHandler) { - return mBluetoothInputProfileHandler.connectInputDevice(device, state); - } - } - - public boolean connectInputDeviceInternal(BluetoothDevice device) { - synchronized (mBluetoothInputProfileHandler) { - return mBluetoothInputProfileHandler.connectInputDeviceInternal(device); - } - } - - public boolean disconnectInputDevice(BluetoothDevice device) { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, - "Need BLUETOOTH_ADMIN permission"); - BluetoothDeviceProfileState state = mDeviceProfileState.get(device.getAddress()); - synchronized (mBluetoothInputProfileHandler) { - return mBluetoothInputProfileHandler.disconnectInputDevice(device, state); - } - } - - public boolean disconnectInputDeviceInternal(BluetoothDevice device) { - synchronized (mBluetoothInputProfileHandler) { - return mBluetoothInputProfileHandler.disconnectInputDeviceInternal(device); - } - } - - public int getInputDeviceConnectionState(BluetoothDevice device) { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); - synchronized (mBluetoothInputProfileHandler) { - return mBluetoothInputProfileHandler.getInputDeviceConnectionState(device); - } - } - - public List getConnectedInputDevices() { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); - synchronized (mBluetoothInputProfileHandler) { - return mBluetoothInputProfileHandler.getConnectedInputDevices(); - } - } - - public List getInputDevicesMatchingConnectionStates( - int[] states) { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); - synchronized (mBluetoothInputProfileHandler) { - return mBluetoothInputProfileHandler.getInputDevicesMatchingConnectionStates(states); - } - } - - - public int getInputDevicePriority(BluetoothDevice device) { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); - synchronized (mBluetoothInputProfileHandler) { - return mBluetoothInputProfileHandler.getInputDevicePriority(device); - } - } - - public boolean setInputDevicePriority(BluetoothDevice device, int priority) { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, - "Need BLUETOOTH_ADMIN permission"); - synchronized (mBluetoothInputProfileHandler) { - return mBluetoothInputProfileHandler.setInputDevicePriority(device, priority); - } - } - - /** - * Handle incoming profile acceptance for profiles handled by Bluetooth Service, - * currently PAN and HID. This also is the catch all for all rejections for profiles - * that is not supported. - * - * @param device - Bluetooth Device - * @param allow - true / false - * @return - */ - public boolean allowIncomingProfileConnect(BluetoothDevice device, boolean allow) { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, - "Need BLUETOOTH_ADMIN permission"); - String address = device.getAddress(); - if (!BluetoothAdapter.checkBluetoothAddress(address)) { - return false; - } - - Integer data = getAuthorizationAgentRequestData(address); - if (data == null) { - Log.w(TAG, "allowIncomingProfileConnect(" + device + - ") called but no native data available"); - return false; - } - if (DBG) log("allowIncomingProfileConnect: " + device + " : " + allow + " : " + data); - return setAuthorizationNative(address, allow, data.intValue()); - } - - /*package*/List lookupInputDevicesMatchingStates(int[] states) { - synchronized (mBluetoothInputProfileHandler) { - return mBluetoothInputProfileHandler.lookupInputDevicesMatchingStates(states); - } - } - - /*package*/void handleInputDevicePropertyChange(String address, boolean connected) { - synchronized (mBluetoothInputProfileHandler) { - mBluetoothInputProfileHandler.handleInputDevicePropertyChange(address, connected); - } - } - - /**** Handlers for Health Device Profile ****/ - // TODO: All these need to be converted to a state machine. - - public boolean registerAppConfiguration(BluetoothHealthAppConfiguration config, - IBluetoothHealthCallback callback) { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, - "Need BLUETOOTH permission"); - synchronized (mBluetoothHealthProfileHandler) { - return mBluetoothHealthProfileHandler.registerAppConfiguration(config, callback); - } - } - - public boolean unregisterAppConfiguration(BluetoothHealthAppConfiguration config) { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, - "Need BLUETOOTH permission"); - synchronized (mBluetoothHealthProfileHandler) { - return mBluetoothHealthProfileHandler.unregisterAppConfiguration(config); - } - } - - - public boolean connectChannelToSource(BluetoothDevice device, - BluetoothHealthAppConfiguration config) { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, - "Need BLUETOOTH permission"); - synchronized (mBluetoothHealthProfileHandler) { - return mBluetoothHealthProfileHandler.connectChannelToSource(device, - config); - } - } - - public boolean connectChannelToSink(BluetoothDevice device, - BluetoothHealthAppConfiguration config, int channelType) { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, - "Need BLUETOOTH permission"); - synchronized (mBluetoothHealthProfileHandler) { - return mBluetoothHealthProfileHandler.connectChannel(device, config, - channelType); - } - } - - public boolean disconnectChannel(BluetoothDevice device, - BluetoothHealthAppConfiguration config, int id) { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, - "Need BLUETOOTH permission"); - synchronized (mBluetoothHealthProfileHandler) { - return mBluetoothHealthProfileHandler.disconnectChannel(device, config, id); - } - } - - public ParcelFileDescriptor getMainChannelFd(BluetoothDevice device, - BluetoothHealthAppConfiguration config) { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, - "Need BLUETOOTH permission"); - synchronized (mBluetoothHealthProfileHandler) { - return mBluetoothHealthProfileHandler.getMainChannelFd(device, config); - } - } - - /*package*/ void onHealthDevicePropertyChanged(String devicePath, - String channelPath) { - synchronized (mBluetoothHealthProfileHandler) { - mBluetoothHealthProfileHandler.onHealthDevicePropertyChanged(devicePath, - channelPath); - } - } - - /*package*/ void onHealthDeviceChannelChanged(String devicePath, - String channelPath, boolean exists) { - synchronized(mBluetoothHealthProfileHandler) { - mBluetoothHealthProfileHandler.onHealthDeviceChannelChanged(devicePath, - channelPath, exists); - } - } - - /*package*/ void onHealthDeviceChannelConnectionError(int channelCode, - int newState) { - synchronized(mBluetoothHealthProfileHandler) { - mBluetoothHealthProfileHandler.onHealthDeviceChannelConnectionError(channelCode, - newState); - } - } - - public int getHealthDeviceConnectionState(BluetoothDevice device) { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, - "Need BLUETOOTH permission"); - synchronized (mBluetoothHealthProfileHandler) { - return mBluetoothHealthProfileHandler.getHealthDeviceConnectionState(device); - } - } - - public List getConnectedHealthDevices() { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, - "Need BLUETOOTH permission"); - synchronized (mBluetoothHealthProfileHandler) { - return mBluetoothHealthProfileHandler.getConnectedHealthDevices(); - } - } - - public List getHealthDevicesMatchingConnectionStates( - int[] states) { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, - "Need BLUETOOTH permission"); - synchronized (mBluetoothHealthProfileHandler) { - return mBluetoothHealthProfileHandler. - getHealthDevicesMatchingConnectionStates(states); - } - } - - /*package*/boolean notifyIncomingHidConnection(String address) { - BluetoothDeviceProfileState state = mDeviceProfileState.get(address); - if (state == null) { - return false; - } - Message msg = new Message(); - msg.what = BluetoothDeviceProfileState.CONNECT_HID_INCOMING; - state.sendMessage(msg); - return true; - } - - public boolean connectHeadset(String address) { - if (getBondState(address) != BluetoothDevice.BOND_BONDED) return false; - - BluetoothDeviceProfileState state = mDeviceProfileState.get(address); - if (state != null) { - Message msg = new Message(); - msg.arg1 = BluetoothDeviceProfileState.CONNECT_HFP_OUTGOING; - msg.obj = state; - mHfpProfileState.sendMessage(msg); - return true; - } - return false; - } - - public boolean disconnectHeadset(String address) { - if (getBondState(address) != BluetoothDevice.BOND_BONDED) return false; - - BluetoothDeviceProfileState state = mDeviceProfileState.get(address); - if (state != null) { - Message msg = new Message(); - msg.arg1 = BluetoothDeviceProfileState.DISCONNECT_HFP_OUTGOING; - msg.obj = state; - mHfpProfileState.sendMessage(msg); - return true; - } - return false; - } - - public boolean connectSink(String address) { - if (getBondState(address) != BluetoothDevice.BOND_BONDED) return false; - - BluetoothDeviceProfileState state = mDeviceProfileState.get(address); - if (state != null) { - Message msg = new Message(); - msg.arg1 = BluetoothDeviceProfileState.CONNECT_A2DP_OUTGOING; - msg.obj = state; - mA2dpProfileState.sendMessage(msg); - return true; - } - return false; - } - - public boolean disconnectSink(String address) { - if (getBondState(address) != BluetoothDevice.BOND_BONDED) return false; - - BluetoothDeviceProfileState state = mDeviceProfileState.get(address); - if (state != null) { - Message msg = new Message(); - msg.arg1 = BluetoothDeviceProfileState.DISCONNECT_A2DP_OUTGOING; - msg.obj = state; - mA2dpProfileState.sendMessage(msg); - return true; - } - return false; - } - - BluetoothDeviceProfileState addProfileState(String address, boolean setTrust) { - BluetoothDeviceProfileState state = - new BluetoothDeviceProfileState(mContext, address, this, mA2dpService, setTrust); - mDeviceProfileState.put(address, state); - state.start(); - return state; - } - - void removeProfileState(String address) { - BluetoothDeviceProfileState state = mDeviceProfileState.get(address); - if (state == null) return; - - state.quit(); - mDeviceProfileState.remove(address); - } - - String[] getKnownDevices() { - String[] bonds = null; - String val = getProperty("Devices", true); - if (val != null) { - bonds = val.split(","); - } - return bonds; - } - - private void initProfileState() { - String[] bonds = null; - String val = getProperty("Devices", false); - if (val != null) { - bonds = val.split(","); - } - if (bonds == null) { - return; - } - for (String path : bonds) { - String address = getAddressFromObjectPath(path); - BluetoothDeviceProfileState state = addProfileState(address, false); - } - } - - private void autoConnect() { - synchronized (this) { - if (!mAllowConnect) { - Log.d(TAG, "Not auto-connecting devices because of temporary BT on state."); - return; - } - } - - String[] bonds = getKnownDevices(); - if (bonds == null) { - return; - } - for (String path : bonds) { - String address = getAddressFromObjectPath(path); - BluetoothDeviceProfileState state = mDeviceProfileState.get(address); - if (state != null) { - Message msg = new Message(); - msg.what = BluetoothDeviceProfileState.AUTO_CONNECT_PROFILES; - state.sendMessage(msg); - } - } - } - - public boolean notifyIncomingConnection(String address, boolean rejected) { - synchronized (this) { - if (!mAllowConnect) { - Log.d(TAG, "Not allowing incoming connection because of temporary BT on state."); - return false; - } - } - BluetoothDeviceProfileState state = mDeviceProfileState.get(address); - if (state != null) { - Message msg = new Message(); - if (rejected) { - if (mA2dpService.getPriority(getRemoteDevice(address)) >= - BluetoothProfile.PRIORITY_ON) { - msg.what = BluetoothDeviceProfileState.CONNECT_OTHER_PROFILES; - msg.arg1 = BluetoothDeviceProfileState.CONNECT_A2DP_OUTGOING; - state.sendMessageDelayed(msg, - BluetoothDeviceProfileState.CONNECT_OTHER_PROFILES_DELAY); - } - } else { - msg.what = BluetoothDeviceProfileState.CONNECT_HFP_INCOMING; - state.sendMessage(msg); - } - return true; - } - return false; - } - - /*package*/ boolean notifyIncomingA2dpConnection(String address, boolean rejected) { - synchronized (this) { - if (!mAllowConnect) { - Log.d(TAG, "Not allowing a2dp connection because of temporary BT on state."); - return false; - } - } - - BluetoothDeviceProfileState state = mDeviceProfileState.get(address); - if (state != null) { - Message msg = new Message(); - if (rejected) { - if (mHeadsetProxy.getPriority(getRemoteDevice(address)) >= - BluetoothProfile.PRIORITY_ON) { - msg.what = BluetoothDeviceProfileState.CONNECT_OTHER_PROFILES; - msg.arg1 = BluetoothDeviceProfileState.CONNECT_HFP_OUTGOING; - state.sendMessageDelayed(msg, - BluetoothDeviceProfileState.CONNECT_OTHER_PROFILES_DELAY); - } - } else { - msg.what = BluetoothDeviceProfileState.CONNECT_A2DP_INCOMING; - state.sendMessage(msg); - } - return true; - } - return false; - } - - /*package*/ void setA2dpService(BluetoothA2dpService a2dpService) { - mA2dpService = a2dpService; - } - - /*package*/ Integer getAuthorizationAgentRequestData(String address) { - Integer data = mEventLoop.getAuthorizationAgentRequestData().remove(address); - return data; - } - - public void sendProfileStateMessage(int profile, int cmd) { - Message msg = new Message(); - msg.what = cmd; - if (profile == BluetoothProfileState.HFP) { - mHfpProfileState.sendMessage(msg); - } else if (profile == BluetoothProfileState.A2DP) { - mA2dpProfileState.sendMessage(msg); - } - } - - public int getAdapterConnectionState() { - return mAdapterConnectionState; - } - - public int getProfileConnectionState(int profile) { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); - - Pair state = mProfileConnectionState.get(profile); - if (state == null) return BluetoothProfile.STATE_DISCONNECTED; - - return state.first; - } - - private void updateProfileConnectionState(int profile, int newState, int oldState) { - // mProfileConnectionState is a hashmap - - // > - // The key is the profile, the value is a pair. first element - // is the state and the second element is the number of devices - // in that state. - int numDev = 1; - int newHashState = newState; - boolean update = true; - - // The following conditions are considered in this function: - // 1. If there is no record of profile and state - update - // 2. If a new device's state is current hash state - increment - // number of devices in the state. - // 3. If a state change has happened to Connected or Connecting - // (if current state is not connected), update. - // 4. If numDevices is 1 and that device state is being updated, update - // 5. If numDevices is > 1 and one of the devices is changing state, - // decrement numDevices but maintain oldState if it is Connected or - // Connecting - Pair stateNumDev = mProfileConnectionState.get(profile); - if (stateNumDev != null) { - int currHashState = stateNumDev.first; - numDev = stateNumDev.second; - - if (newState == currHashState) { - numDev ++; - } else if (newState == BluetoothProfile.STATE_CONNECTED || - (newState == BluetoothProfile.STATE_CONNECTING && - currHashState != BluetoothProfile.STATE_CONNECTED)) { - numDev = 1; - } else if (numDev == 1 && oldState == currHashState) { - update = true; - } else if (numDev > 1 && oldState == currHashState) { - numDev --; - - if (currHashState == BluetoothProfile.STATE_CONNECTED || - currHashState == BluetoothProfile.STATE_CONNECTING) { - newHashState = currHashState; - } - } else { - update = false; - } - } - - if (update) { - mProfileConnectionState.put(profile, new Pair(newHashState, - numDev)); - } - } - - public synchronized void sendConnectionStateChange(BluetoothDevice - device, int profile, int state, int prevState) { - // Since this is a binder call check if Bluetooth is on still - if (getBluetoothStateInternal() == BluetoothAdapter.STATE_OFF) return; - - if (!validateProfileConnectionState(state) || - !validateProfileConnectionState(prevState)) { - // Previously, an invalid state was broadcast anyway, - // with the invalid state converted to -1 in the intent. - // Better to log an error and not send an intent with - // invalid contents or set mAdapterConnectionState to -1. - Log.e(TAG, "Error in sendConnectionStateChange: " - + "prevState " + prevState + " state " + state); - return; - } - - updateProfileConnectionState(profile, state, prevState); - - if (updateCountersAndCheckForConnectionStateChange(state, prevState)) { - mAdapterConnectionState = state; - - if (state == BluetoothProfile.STATE_DISCONNECTED) { - mBluetoothState.sendMessage(BluetoothAdapterStateMachine.ALL_DEVICES_DISCONNECTED); - } - - Intent intent = new Intent(BluetoothAdapter.ACTION_CONNECTION_STATE_CHANGED); - intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device); - intent.putExtra(BluetoothAdapter.EXTRA_CONNECTION_STATE, - convertToAdapterState(state)); - intent.putExtra(BluetoothAdapter.EXTRA_PREVIOUS_CONNECTION_STATE, - convertToAdapterState(prevState)); - intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT); - mContext.sendBroadcast(intent, BLUETOOTH_PERM); - Log.d(TAG, "CONNECTION_STATE_CHANGE: " + device + ": " - + prevState + " -> " + state); - } - } - - private boolean validateProfileConnectionState(int state) { - return (state == BluetoothProfile.STATE_DISCONNECTED || - state == BluetoothProfile.STATE_CONNECTING || - state == BluetoothProfile.STATE_CONNECTED || - state == BluetoothProfile.STATE_DISCONNECTING); - } - - private int convertToAdapterState(int state) { - switch (state) { - case BluetoothProfile.STATE_DISCONNECTED: - return BluetoothAdapter.STATE_DISCONNECTED; - case BluetoothProfile.STATE_DISCONNECTING: - return BluetoothAdapter.STATE_DISCONNECTING; - case BluetoothProfile.STATE_CONNECTED: - return BluetoothAdapter.STATE_CONNECTED; - case BluetoothProfile.STATE_CONNECTING: - return BluetoothAdapter.STATE_CONNECTING; - } - Log.e(TAG, "Error in convertToAdapterState"); - return -1; - } - - private boolean updateCountersAndCheckForConnectionStateChange(int state, int prevState) { - switch (prevState) { - case BluetoothProfile.STATE_CONNECTING: - mProfilesConnecting--; - break; - - case BluetoothProfile.STATE_CONNECTED: - mProfilesConnected--; - break; - - case BluetoothProfile.STATE_DISCONNECTING: - mProfilesDisconnecting--; - break; - } - - switch (state) { - case BluetoothProfile.STATE_CONNECTING: - mProfilesConnecting++; - return (mProfilesConnected == 0 && mProfilesConnecting == 1); - - case BluetoothProfile.STATE_CONNECTED: - mProfilesConnected++; - return (mProfilesConnected == 1); - - case BluetoothProfile.STATE_DISCONNECTING: - mProfilesDisconnecting++; - return (mProfilesConnected == 0 && mProfilesDisconnecting == 1); - - case BluetoothProfile.STATE_DISCONNECTED: - return (mProfilesConnected == 0 && mProfilesConnecting == 0); - - default: - return true; - } - } - - private void createIncomingConnectionStateFile() { - File f = new File(INCOMING_CONNECTION_FILE); - if (!f.exists()) { - try { - f.createNewFile(); - } catch (IOException e) { - Log.e(TAG, "IOException: cannot create file"); - } - } - } - - /** @hide */ - public Pair getIncomingState(String address) { - if (mIncomingConnections.isEmpty()) { - createIncomingConnectionStateFile(); - readIncomingConnectionState(); - } - return mIncomingConnections.get(address); - } - - private void readIncomingConnectionState() { - synchronized(mIncomingConnections) { - FileInputStream fstream = null; - try { - fstream = new FileInputStream(INCOMING_CONNECTION_FILE); - DataInputStream in = new DataInputStream(fstream); - BufferedReader file = new BufferedReader(new InputStreamReader(in)); - String line; - while((line = file.readLine()) != null) { - line = line.trim(); - if (line.length() == 0) continue; - String[] value = line.split(","); - if (value != null && value.length == 3) { - Integer val1 = Integer.parseInt(value[1]); - Pair val = new Pair(val1, value[2]); - mIncomingConnections.put(value[0], val); - } - } - } catch (FileNotFoundException e) { - log("FileNotFoundException: readIncomingConnectionState" + e.toString()); - } catch (IOException e) { - log("IOException: readIncomingConnectionState" + e.toString()); - } finally { - if (fstream != null) { - try { - fstream.close(); - } catch (IOException e) { - // Ignore - } - } - } - } - } - - private void truncateIncomingConnectionFile() { - RandomAccessFile r = null; - try { - r = new RandomAccessFile(INCOMING_CONNECTION_FILE, "rw"); - r.setLength(0); - } catch (FileNotFoundException e) { - log("FileNotFoundException: truncateIncomingConnectionState" + e.toString()); - } catch (IOException e) { - log("IOException: truncateIncomingConnectionState" + e.toString()); - } finally { - if (r != null) { - try { - r.close(); - } catch (IOException e) { - // ignore - } - } - } - } - - /** @hide */ - public void writeIncomingConnectionState(String address, Pair data) { - synchronized(mIncomingConnections) { - mIncomingConnections.put(address, data); - - truncateIncomingConnectionFile(); - BufferedWriter out = null; - StringBuilder value = new StringBuilder(); - try { - out = new BufferedWriter(new FileWriter(INCOMING_CONNECTION_FILE, true)); - for (String devAddress: mIncomingConnections.keySet()) { - Pair val = mIncomingConnections.get(devAddress); - value.append(devAddress); - value.append(","); - value.append(val.first.toString()); - value.append(","); - value.append(val.second); - value.append("\n"); - } - out.write(value.toString()); - } catch (FileNotFoundException e) { - log("FileNotFoundException: writeIncomingConnectionState" + e.toString()); - } catch (IOException e) { - log("IOException: writeIncomingConnectionState" + e.toString()); - } finally { - if (out != null) { - try { - out.close(); - } catch (IOException e) { - // Ignore - } - } - } - } - } - - private static void log(String msg) { - Log.d(TAG, msg); - } - - private native static void classInitNative(); - private native void initializeNativeDataNative(); - private native boolean setupNativeDataNative(); - private native boolean tearDownNativeDataNative(); - private native void cleanupNativeDataNative(); - /*package*/ native String getAdapterPathNative(); - - private native int isEnabledNative(); - /*package*/ native int enableNative(); - /*package*/ native int disableNative(); - - /*package*/ native Object[] getAdapterPropertiesNative(); - private native Object[] getDevicePropertiesNative(String objectPath); - private native boolean setAdapterPropertyStringNative(String key, String value); - private native boolean setAdapterPropertyIntegerNative(String key, int value); - private native boolean setAdapterPropertyBooleanNative(String key, int value); - - private native boolean startDiscoveryNative(); - private native boolean stopDiscoveryNative(); - - private native boolean createPairedDeviceNative(String address, int timeout_ms); - private native boolean createPairedDeviceOutOfBandNative(String address, int timeout_ms); - private native byte[] readAdapterOutOfBandDataNative(); - - private native boolean cancelDeviceCreationNative(String address); - private native boolean removeDeviceNative(String objectPath); - private native int getDeviceServiceChannelNative(String objectPath, String uuid, - int attributeId); - - private native boolean cancelPairingUserInputNative(String address, int nativeData); - private native boolean setPinNative(String address, String pin, int nativeData); - private native boolean setPasskeyNative(String address, int passkey, int nativeData); - private native boolean setPairingConfirmationNative(String address, boolean confirm, - int nativeData); - private native boolean setRemoteOutOfBandDataNative(String address, byte[] hash, - byte[] randomizer, int nativeData); - - private native boolean setDevicePropertyBooleanNative(String objectPath, String key, - int value); - private native boolean setDevicePropertyStringNative(String objectPath, String key, - String value); - private native boolean createDeviceNative(String address); - /*package*/ native boolean discoverServicesNative(String objectPath, String pattern); - - private native int addRfcommServiceRecordNative(String name, long uuidMsb, long uuidLsb, - short channel); - private native boolean removeServiceRecordNative(int handle); - private native boolean setLinkTimeoutNative(String path, int num_slots); - - native boolean connectInputDeviceNative(String path); - native boolean disconnectInputDeviceNative(String path); - - native boolean setBluetoothTetheringNative(boolean value, String nap, String bridge); - native boolean connectPanDeviceNative(String path, String dstRole); - native boolean disconnectPanDeviceNative(String path); - native boolean disconnectPanServerDeviceNative(String path, - String address, String iface); - - private native int[] addReservedServiceRecordsNative(int[] uuuids); - private native boolean removeReservedServiceRecordsNative(int[] handles); - - // Health API - native String registerHealthApplicationNative(int dataType, String role, String name, - String channelType); - native String registerHealthApplicationNative(int dataType, String role, String name); - native boolean unregisterHealthApplicationNative(String path); - native boolean createChannelNative(String devicePath, String appPath, String channelType, - int code); - native boolean destroyChannelNative(String devicePath, String channelpath, int code); - native String getMainChannelNative(String path); - native String getChannelApplicationNative(String channelPath); - native ParcelFileDescriptor getChannelFdNative(String channelPath); - native boolean releaseChannelFdNative(String channelPath); - native boolean setAuthorizationNative(String address, boolean value, int data); -} diff --git a/core/java/android/server/search/SearchManagerService.java b/core/java/android/server/search/SearchManagerService.java index c783e6a0b45ba..4a2137461801a 100644 --- a/core/java/android/server/search/SearchManagerService.java +++ b/core/java/android/server/search/SearchManagerService.java @@ -17,7 +17,11 @@ package android.server.search; import com.android.internal.content.PackageMonitor; +import com.android.internal.util.IndentingPrintWriter; +import android.app.ActivityManager; +import android.app.ActivityManagerNative; +import android.app.AppGlobals; import android.app.ISearchManager; import android.app.SearchManager; import android.app.SearchableInfo; @@ -27,12 +31,22 @@ import android.content.Context; import android.content.Intent; import android.content.IntentFilter; +import android.content.pm.IPackageManager; +import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.database.ContentObserver; +import android.os.Binder; import android.os.Process; +import android.os.RemoteException; +import android.os.UserHandle; +import android.os.UserManager; import android.provider.Settings; import android.util.Log; +import android.util.Slog; +import android.util.SparseArray; +import java.io.FileDescriptor; +import java.io.PrintWriter; import java.util.List; /** @@ -48,9 +62,7 @@ public class SearchManagerService extends ISearchManager.Stub { private final Context mContext; // This field is initialized lazily in getSearchables(), and then never modified. - private Searchables mSearchables; - - private ContentObserver mGlobalSearchObserver; + private final SparseArray mSearchables = new SparseArray(); /** * Initializes the Search Manager service in the provided system context. @@ -62,18 +74,39 @@ public SearchManagerService(Context context) { mContext = context; mContext.registerReceiver(new BootCompletedReceiver(), new IntentFilter(Intent.ACTION_BOOT_COMPLETED)); - mGlobalSearchObserver = new GlobalSearchProviderObserver( - mContext.getContentResolver()); + mContext.registerReceiver(new UserReceiver(), + new IntentFilter(Intent.ACTION_USER_REMOVED)); + new MyPackageMonitor().register(context, null, UserHandle.ALL, true); + } + + private Searchables getSearchables(int userId) { + long origId = Binder.clearCallingIdentity(); + try { + boolean userExists = ((UserManager) mContext.getSystemService(Context.USER_SERVICE)) + .getUserInfo(userId) != null; + if (!userExists) return null; + } finally { + Binder.restoreCallingIdentity(origId); + } + synchronized (mSearchables) { + Searchables searchables = mSearchables.get(userId); + + if (searchables == null) { + Log.i(TAG, "Building list of searchable activities for userId=" + userId); + searchables = new Searchables(mContext, userId); + searchables.buildSearchableList(); + mSearchables.append(userId, searchables); + } + return searchables; + } } - private synchronized Searchables getSearchables() { - if (mSearchables == null) { - Log.i(TAG, "Building list of searchable activities"); - new MyPackageMonitor().register(mContext, null, true); - mSearchables = new Searchables(mContext); - mSearchables.buildSearchableList(); + private void onUserRemoved(int userId) { + if (userId != UserHandle.USER_OWNER) { + synchronized (mSearchables) { + mSearchables.remove(userId); + } } - return mSearchables; } /** @@ -87,12 +120,19 @@ public void onReceive(Context context, Intent intent) { public void run() { Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND); mContext.unregisterReceiver(BootCompletedReceiver.this); - getSearchables(); + getSearchables(0); } }.start(); } } + private final class UserReceiver extends BroadcastReceiver { + @Override + public void onReceive(Context context, Intent intent) { + onUserRemoved(intent.getIntExtra(Intent.EXTRA_USER_HANDLE, UserHandle.USER_OWNER)); + } + } + /** * Refreshes the "searchables" list when packages are added/removed. */ @@ -109,12 +149,21 @@ public void onPackageModified(String pkg) { } private void updateSearchables() { - // Update list of searchable activities - getSearchables().buildSearchableList(); + final int changingUserId = getChangingUserId(); + synchronized (mSearchables) { + // Update list of searchable activities + for (int i = 0; i < mSearchables.size(); i++) { + if (changingUserId == mSearchables.keyAt(i)) { + getSearchables(mSearchables.keyAt(i)).buildSearchableList(); + break; + } + } + } // Inform all listeners that the list of searchables has been updated. Intent intent = new Intent(SearchManager.INTENT_ACTION_SEARCHABLES_CHANGED); - intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING); - mContext.sendBroadcast(intent); + intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING + | Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT); + mContext.sendBroadcastAsUser(intent, new UserHandle(changingUserId)); } } @@ -132,10 +181,14 @@ public GlobalSearchProviderObserver(ContentResolver resolver) { @Override public void onChange(boolean selfChange) { - getSearchables().buildSearchableList(); + synchronized (mSearchables) { + for (int i = 0; i < mSearchables.size(); i++) { + getSearchables(mSearchables.keyAt(i)).buildSearchableList(); + } + } Intent intent = new Intent(SearchManager.INTENT_GLOBAL_SEARCH_ACTIVITY_CHANGED); intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING); - mContext.sendBroadcast(intent); + mContext.sendBroadcastAsUser(intent, UserHandle.ALL); } } @@ -156,32 +209,91 @@ public SearchableInfo getSearchableInfo(final ComponentName launchActivity) { Log.e(TAG, "getSearchableInfo(), activity == null"); return null; } - return getSearchables().getSearchableInfo(launchActivity); + return getSearchables(UserHandle.getCallingUserId()).getSearchableInfo(launchActivity); } /** * Returns a list of the searchable activities that can be included in global search. */ public List getSearchablesInGlobalSearch() { - return getSearchables().getSearchablesInGlobalSearchList(); + return getSearchables(UserHandle.getCallingUserId()).getSearchablesInGlobalSearchList(); } public List getGlobalSearchActivities() { - return getSearchables().getGlobalSearchActivities(); + return getSearchables(UserHandle.getCallingUserId()).getGlobalSearchActivities(); } /** * Gets the name of the global search activity. */ public ComponentName getGlobalSearchActivity() { - return getSearchables().getGlobalSearchActivity(); + return getSearchables(UserHandle.getCallingUserId()).getGlobalSearchActivity(); } /** * Gets the name of the web search activity. */ public ComponentName getWebSearchActivity() { - return getSearchables().getWebSearchActivity(); + return getSearchables(UserHandle.getCallingUserId()).getWebSearchActivity(); + } + + @Override + public ComponentName getAssistIntent(int userHandle) { + try { + if (userHandle != UserHandle.getCallingUserId()) { + // Requesting a different user, make sure that they have the permission + if (ActivityManager.checkComponentPermission( + android.Manifest.permission.INTERACT_ACROSS_USERS_FULL, + Binder.getCallingUid(), -1, true) + == PackageManager.PERMISSION_GRANTED) { + // Translate to the current user id, if caller wasn't aware + if (userHandle == UserHandle.USER_CURRENT) { + long identity = Binder.clearCallingIdentity(); + userHandle = ActivityManagerNative.getDefault().getCurrentUser().id; + Binder.restoreCallingIdentity(identity); + } + } else { + String msg = "Permission Denial: " + + "Request to getAssistIntent for " + userHandle + + " but is calling from user " + UserHandle.getCallingUserId() + + "; this requires " + + android.Manifest.permission.INTERACT_ACROSS_USERS_FULL; + Slog.w(TAG, msg); + return null; + } + } + IPackageManager pm = AppGlobals.getPackageManager(); + Intent assistIntent = new Intent(Intent.ACTION_ASSIST); + ResolveInfo info = + pm.resolveIntent(assistIntent, + assistIntent.resolveTypeIfNeeded(mContext.getContentResolver()), + PackageManager.MATCH_DEFAULT_ONLY, userHandle); + if (info != null) { + return new ComponentName( + info.activityInfo.applicationInfo.packageName, + info.activityInfo.name); + } + } catch (RemoteException re) { + // Local call + Log.e(TAG, "RemoteException in getAssistIntent: " + re); + } catch (Exception e) { + Log.e(TAG, "Exception in getAssistIntent: " + e); + } + return null; } + @Override + public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { + mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DUMP, TAG); + + IndentingPrintWriter ipw = new IndentingPrintWriter(pw, " "); + synchronized (mSearchables) { + for (int i = 0; i < mSearchables.size(); i++) { + ipw.print("\nUser: "); ipw.println(mSearchables.keyAt(i)); + ipw.increaseIndent(); + mSearchables.valueAt(i).dump(fd, ipw, args); + ipw.decreaseIndent(); + } + } + } } diff --git a/core/java/android/server/search/Searchables.java b/core/java/android/server/search/Searchables.java index f24d52f9ffede..a0095d6287bca 100644 --- a/core/java/android/server/search/Searchables.java +++ b/core/java/android/server/search/Searchables.java @@ -16,6 +16,7 @@ package android.server.search; +import android.app.AppGlobals; import android.app.SearchManager; import android.app.SearchableInfo; import android.content.ComponentName; @@ -23,13 +24,18 @@ import android.content.Intent; import android.content.pm.ActivityInfo; import android.content.pm.ApplicationInfo; +import android.content.pm.IPackageManager; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; +import android.os.Binder; import android.os.Bundle; +import android.os.RemoteException; import android.provider.Settings; import android.text.TextUtils; import android.util.Log; +import java.io.FileDescriptor; +import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; @@ -38,6 +44,7 @@ /** * This class maintains the information about all searchable activities. + * This is a hidden class. */ public class Searchables { @@ -65,12 +72,19 @@ public class Searchables { public static String ENHANCED_GOOGLE_SEARCH_COMPONENT_NAME = "com.google.android.providers.enhancedgooglesearch/.Launcher"; + // Cache the package manager instance + final private IPackageManager mPm; + // User for which this Searchables caches information + private int mUserId; + /** * * @param context Context to use for looking up activities etc. */ - public Searchables (Context context) { + public Searchables (Context context, int userId) { mContext = context; + mUserId = userId; + mPm = AppGlobals.getPackageManager(); } /** @@ -115,50 +129,50 @@ public SearchableInfo getSearchableInfo(ComponentName activity) { ActivityInfo ai = null; try { - ai = mContext.getPackageManager(). - getActivityInfo(activity, PackageManager.GET_META_DATA ); - String refActivityName = null; + ai = mPm.getActivityInfo(activity, PackageManager.GET_META_DATA, mUserId); + } catch (RemoteException re) { + Log.e(LOG_TAG, "Error getting activity info " + re); + return null; + } + String refActivityName = null; - // First look for activity-specific reference - Bundle md = ai.metaData; + // First look for activity-specific reference + Bundle md = ai.metaData; + if (md != null) { + refActivityName = md.getString(MD_LABEL_DEFAULT_SEARCHABLE); + } + // If not found, try for app-wide reference + if (refActivityName == null) { + md = ai.applicationInfo.metaData; if (md != null) { refActivityName = md.getString(MD_LABEL_DEFAULT_SEARCHABLE); } - // If not found, try for app-wide reference - if (refActivityName == null) { - md = ai.applicationInfo.metaData; - if (md != null) { - refActivityName = md.getString(MD_LABEL_DEFAULT_SEARCHABLE); - } - } + } - // Irrespective of source, if a reference was found, follow it. - if (refActivityName != null) - { - // This value is deprecated, return null - if (refActivityName.equals(MD_SEARCHABLE_SYSTEM_SEARCH)) { - return null; - } - String pkg = activity.getPackageName(); - ComponentName referredActivity; - if (refActivityName.charAt(0) == '.') { - referredActivity = new ComponentName(pkg, pkg + refActivityName); - } else { - referredActivity = new ComponentName(pkg, refActivityName); - } + // Irrespective of source, if a reference was found, follow it. + if (refActivityName != null) + { + // This value is deprecated, return null + if (refActivityName.equals(MD_SEARCHABLE_SYSTEM_SEARCH)) { + return null; + } + String pkg = activity.getPackageName(); + ComponentName referredActivity; + if (refActivityName.charAt(0) == '.') { + referredActivity = new ComponentName(pkg, pkg + refActivityName); + } else { + referredActivity = new ComponentName(pkg, refActivityName); + } - // Now try the referred activity, and if found, cache - // it against the original name so we can skip the check - synchronized (this) { - result = mSearchablesMap.get(referredActivity); - if (result != null) { - mSearchablesMap.put(activity, result); - return result; - } + // Now try the referred activity, and if found, cache + // it against the original name so we can skip the check + synchronized (this) { + result = mSearchablesMap.get(referredActivity); + if (result != null) { + mSearchablesMap.put(activity, result); + return result; } } - } catch (PackageManager.NameNotFoundException e) { - // case 3: no metadata } // Step 3. None found. Return null. @@ -195,61 +209,67 @@ public void buildSearchableList() { ArrayList newSearchablesInGlobalSearchList = new ArrayList(); - final PackageManager pm = mContext.getPackageManager(); - // Use intent resolver to generate list of ACTION_SEARCH & ACTION_WEB_SEARCH receivers. List searchList; final Intent intent = new Intent(Intent.ACTION_SEARCH); - searchList = pm.queryIntentActivities(intent, PackageManager.GET_META_DATA); - - List webSearchInfoList; - final Intent webSearchIntent = new Intent(Intent.ACTION_WEB_SEARCH); - webSearchInfoList = pm.queryIntentActivities(webSearchIntent, PackageManager.GET_META_DATA); - - // analyze each one, generate a Searchables record, and record - if (searchList != null || webSearchInfoList != null) { - int search_count = (searchList == null ? 0 : searchList.size()); - int web_search_count = (webSearchInfoList == null ? 0 : webSearchInfoList.size()); - int count = search_count + web_search_count; - for (int ii = 0; ii < count; ii++) { - // for each component, try to find metadata - ResolveInfo info = (ii < search_count) - ? searchList.get(ii) - : webSearchInfoList.get(ii - search_count); - ActivityInfo ai = info.activityInfo; - // Check first to avoid duplicate entries. - if (newSearchablesMap.get(new ComponentName(ai.packageName, ai.name)) == null) { - SearchableInfo searchable = SearchableInfo.getActivityMetaData(mContext, ai); - if (searchable != null) { - newSearchablesList.add(searchable); - newSearchablesMap.put(searchable.getSearchActivity(), searchable); - if (searchable.shouldIncludeInGlobalSearch()) { - newSearchablesInGlobalSearchList.add(searchable); + + long ident = Binder.clearCallingIdentity(); + try { + searchList = queryIntentActivities(intent, PackageManager.GET_META_DATA); + + List webSearchInfoList; + final Intent webSearchIntent = new Intent(Intent.ACTION_WEB_SEARCH); + webSearchInfoList = queryIntentActivities(webSearchIntent, PackageManager.GET_META_DATA); + + // analyze each one, generate a Searchables record, and record + if (searchList != null || webSearchInfoList != null) { + int search_count = (searchList == null ? 0 : searchList.size()); + int web_search_count = (webSearchInfoList == null ? 0 : webSearchInfoList.size()); + int count = search_count + web_search_count; + for (int ii = 0; ii < count; ii++) { + // for each component, try to find metadata + ResolveInfo info = (ii < search_count) + ? searchList.get(ii) + : webSearchInfoList.get(ii - search_count); + ActivityInfo ai = info.activityInfo; + // Check first to avoid duplicate entries. + if (newSearchablesMap.get(new ComponentName(ai.packageName, ai.name)) == null) { + SearchableInfo searchable = SearchableInfo.getActivityMetaData(mContext, ai, + mUserId); + if (searchable != null) { + newSearchablesList.add(searchable); + newSearchablesMap.put(searchable.getSearchActivity(), searchable); + if (searchable.shouldIncludeInGlobalSearch()) { + newSearchablesInGlobalSearchList.add(searchable); + } } } } } - } - List newGlobalSearchActivities = findGlobalSearchActivities(); + List newGlobalSearchActivities = findGlobalSearchActivities(); - // Find the global search activity - ComponentName newGlobalSearchActivity = findGlobalSearchActivity( - newGlobalSearchActivities); + // Find the global search activity + ComponentName newGlobalSearchActivity = findGlobalSearchActivity( + newGlobalSearchActivities); - // Find the web search activity - ComponentName newWebSearchActivity = findWebSearchActivity(newGlobalSearchActivity); + // Find the web search activity + ComponentName newWebSearchActivity = findWebSearchActivity(newGlobalSearchActivity); - // Store a consistent set of new values - synchronized (this) { - mSearchablesMap = newSearchablesMap; - mSearchablesList = newSearchablesList; - mSearchablesInGlobalSearchList = newSearchablesInGlobalSearchList; - mGlobalSearchActivities = newGlobalSearchActivities; - mCurrentGlobalSearchActivity = newGlobalSearchActivity; - mWebSearchActivity = newWebSearchActivity; + // Store a consistent set of new values + synchronized (this) { + mSearchablesMap = newSearchablesMap; + mSearchablesList = newSearchablesList; + mSearchablesInGlobalSearchList = newSearchablesInGlobalSearchList; + mGlobalSearchActivities = newGlobalSearchActivities; + mCurrentGlobalSearchActivity = newGlobalSearchActivity; + mWebSearchActivity = newWebSearchActivity; + } + } finally { + Binder.restoreCallingIdentity(ident); } } + /** * Returns a sorted list of installed search providers as per * the following heuristics: @@ -262,10 +282,8 @@ private List findGlobalSearchActivities() { // Step 1 : Query the package manager for a list // of activities that can handle the GLOBAL_SEARCH intent. Intent intent = new Intent(SearchManager.INTENT_ACTION_GLOBAL_SEARCH); - PackageManager pm = mContext.getPackageManager(); List activities = - pm.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY); - + queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY); if (activities != null && !activities.isEmpty()) { // Step 2: Rank matching activities according to our heuristics. Collections.sort(activities, GLOBAL_SEARCH_RANKER); @@ -301,10 +319,8 @@ private boolean isInstalled(ComponentName globalSearch) { Intent intent = new Intent(SearchManager.INTENT_ACTION_GLOBAL_SEARCH); intent.setComponent(globalSearch); - PackageManager pm = mContext.getPackageManager(); - List activities = - pm.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY); - + List activities = queryIntentActivities(intent, + PackageManager.MATCH_DEFAULT_ONLY); if (activities != null && !activities.isEmpty()) { return true; } @@ -374,9 +390,8 @@ private ComponentName findWebSearchActivity(ComponentName globalSearchActivity) } Intent intent = new Intent(Intent.ACTION_WEB_SEARCH); intent.setPackage(globalSearchActivity.getPackageName()); - PackageManager pm = mContext.getPackageManager(); List activities = - pm.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY); + queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY); if (activities != null && !activities.isEmpty()) { ActivityInfo ai = activities.get(0).activityInfo; @@ -387,6 +402,19 @@ private ComponentName findWebSearchActivity(ComponentName globalSearchActivity) return null; } + private List queryIntentActivities(Intent intent, int flags) { + List activities = null; + try { + activities = + mPm.queryIntentActivities(intent, + intent.resolveTypeIfNeeded(mContext.getContentResolver()), + flags, mUserId); + } catch (RemoteException re) { + // Local call + } + return activities; + } + /** * Returns the list of searchable activities. */ @@ -422,4 +450,15 @@ public synchronized ComponentName getGlobalSearchActivity() { public synchronized ComponentName getWebSearchActivity() { return mWebSearchActivity; } + + void dump(FileDescriptor fd, PrintWriter pw, String[] args) { + pw.println("Searchable authorities:"); + synchronized (this) { + if (mSearchablesList != null) { + for (SearchableInfo info: mSearchablesList) { + pw.print(" "); pw.println(info.getSuggestAuthority()); + } + } + } + } } diff --git a/core/java/android/service/dreams/Dream.java b/core/java/android/service/dreams/Dream.java deleted file mode 100644 index 83464c936d818..0000000000000 --- a/core/java/android/service/dreams/Dream.java +++ /dev/null @@ -1,392 +0,0 @@ -/** - * - */ -package android.service.dreams; - -import com.android.internal.policy.PolicyManager; - -import android.annotation.SdkConstant; -import android.annotation.SdkConstant.SdkConstantType; -import android.app.Service; -import android.content.Context; -import android.content.Intent; -import android.content.pm.ActivityInfo; -import android.graphics.drawable.ColorDrawable; -import android.os.Binder; -import android.os.Handler; -import android.os.IBinder; -import android.os.Looper; -import android.os.RemoteException; -import android.os.ServiceManager; -import android.util.Slog; -import android.view.ActionMode; -import android.view.IWindowManager; -import android.view.KeyEvent; -import android.view.Menu; -import android.view.MenuItem; -import android.view.MotionEvent; -import android.view.View; -import android.view.ViewGroup; -import android.view.Window; -import android.view.WindowManager.LayoutParams; -import android.view.accessibility.AccessibilityEvent; -import android.view.WindowManager; -import android.view.WindowManagerImpl; - -/** - * @hide - * - */ -public class Dream extends Service implements Window.Callback { - private final static boolean DEBUG = true; - private final static String TAG = "Dream"; - - /** - * The {@link Intent} that must be declared as handled by the service. - * To be supported, the service must also require the - * {@link android.Manifest.permission#BIND_WALLPAPER} permission so - * that other applications can not abuse it. - */ - @SdkConstant(SdkConstantType.SERVICE_ACTION) - public static final String SERVICE_INTERFACE = - "android.service.dreams.Dream"; - - private Window mWindow; - - private WindowManager mWindowManager; - private IDreamManager mSandman; - - private boolean mInteractive; - - final Handler mHandler = new Handler(); - - boolean mFinished = false; - - // begin Window.Callback methods - @Override - public boolean dispatchKeyEvent(KeyEvent event) { - if (!mInteractive) { - finish(); - return true; - } - return mWindow.superDispatchKeyEvent(event); - } - - @Override - public boolean dispatchKeyShortcutEvent(KeyEvent event) { - if (!mInteractive) { - finish(); - return true; - } - return mWindow.superDispatchKeyShortcutEvent(event); - } - - @Override - public boolean dispatchTouchEvent(MotionEvent event) { - if (!mInteractive) { - finish(); - return true; - } - return mWindow.superDispatchTouchEvent(event); - } - - @Override - public boolean dispatchTrackballEvent(MotionEvent event) { - if (!mInteractive) { - finish(); - return true; - } - return mWindow.superDispatchTrackballEvent(event); - } - - @Override - public boolean dispatchGenericMotionEvent(MotionEvent event) { - if (!mInteractive) { - finish(); - return true; - } - return mWindow.superDispatchGenericMotionEvent(event); - } - - @Override - public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) { - return false; - } - - @Override - public View onCreatePanelView(int featureId) { - return null; - } - - @Override - public boolean onCreatePanelMenu(int featureId, Menu menu) { - return false; - } - - @Override - public boolean onPreparePanel(int featureId, View view, Menu menu) { - return false; - } - - @Override - public boolean onMenuOpened(int featureId, Menu menu) { - return false; - } - - @Override - public boolean onMenuItemSelected(int featureId, MenuItem item) { - return false; - } - - @Override - public void onWindowAttributesChanged(LayoutParams attrs) { - - } - - @Override - public void onContentChanged() { - - } - - @Override - public void onWindowFocusChanged(boolean hasFocus) { - - } - - @Override - public void onAttachedToWindow() { - mWindow.addFlags( - WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON - | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED - ); - lightsOut(); - } - - @Override - public void onDetachedFromWindow() { - } - - @Override - public void onPanelClosed(int featureId, Menu menu) { - } - - @Override - public boolean onSearchRequested() { - return false; - } - - @Override - public ActionMode onWindowStartingActionMode(android.view.ActionMode.Callback callback) { - return null; - } - - @Override - public void onActionModeStarted(ActionMode mode) { - } - - @Override - public void onActionModeFinished(ActionMode mode) { - } - // end Window.Callback methods - - public WindowManager getWindowManager() { - return mWindowManager; - } - - public Window getWindow() { - return mWindow; - } - - /** - * Called when this Dream is constructed. Place your initialization here. - * - * Subclasses must call through to the superclass implementation. - */ - @Override - public void onCreate() { - super.onCreate(); - - if (DEBUG) Slog.v(TAG, "Dream created on thread " + Thread.currentThread().getId()); - - mSandman = IDreamManager.Stub.asInterface(ServiceManager.getService("dreams")); - } - - /** - * Called when this Dream is started. Place your initialization here. - * - * Subclasses must call through to the superclass implementation. - * - * XXX(dsandler) Might want to make this final and have a different method for clients to override - */ - @Override - public int onStartCommand(Intent intent, int flags, int startId) { - return super.onStartCommand(intent, flags, startId); - } - - /** - * Inflate a layout resource and set it to be the content view for this Dream. - * Behaves similarly to {@link android.app.Activity#setContentView(int)}. - * - * @param layoutResID Resource ID to be inflated. - * - * @see #setContentView(android.view.View) - * @see #setContentView(android.view.View, android.view.ViewGroup.LayoutParams) - */ - public void setContentView(int layoutResID) { - getWindow().setContentView(layoutResID); - } - - /** - * Set a view to be the content view for this Dream. - * Behaves similarly to {@link android.app.Activity#setContentView(android.view.View)}, - * including using {@link ViewGroup.LayoutParams#MATCH_PARENT} as the layout height and width of the view. - * - * @param view The desired content to display. - * - * @see #setContentView(int) - * @see #setContentView(android.view.View, android.view.ViewGroup.LayoutParams) - */ - public void setContentView(View view) { - getWindow().setContentView(view); - } - - /** - * Set a view to be the content view for this Dream. - * Behaves similarly to - * {@link android.app.Activity#setContentView(android.view.View, android.view.ViewGroup.LayoutParams)}. - * - * @param view The desired content to display. - * @param params Layout parameters for the view. - * - * @see #setContentView(android.view.View) - * @see #setContentView(int) - */ - public void setContentView(View view, ViewGroup.LayoutParams params) { - getWindow().setContentView(view, params); - } - - /** - * Add a view to the Dream's window, leaving other content views in place. - * - * @param view The desired content to display. - * @param params Layout parameters for the view. - */ - public void addContentView(View view, ViewGroup.LayoutParams params) { - getWindow().addContentView(view, params); - } - - /** - * @param mInteractive the mInteractive to set - */ - public void setInteractive(boolean mInteractive) { - this.mInteractive = mInteractive; - } - - /** - * @return the mInteractive - */ - public boolean isInteractive() { - return mInteractive; - } - - /** Convenience method for setting View.SYSTEM_UI_FLAG_LOW_PROFILE on the content view. */ - protected void lightsOut() { - // turn the lights down low - final View v = mWindow.getDecorView(); - if (v != null) { - v.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE); - } - } - - /** - * Finds a view that was identified by the id attribute from the XML that - * was processed in {@link #onCreate}. - * - * @return The view if found or null otherwise. - */ - public View findViewById(int id) { - return getWindow().findViewById(id); - } - - /** - * Called when this Dream is being removed from the screen and stopped. - */ - @Override - public void onDestroy() { - super.onDestroy(); - mWindowManager.removeView(mWindow.getDecorView()); - } - - /** - * Creates a new dream window, attaches the current content view, and shows it. - * - * @param windowToken Binder to attach to the window to allow access to the correct window type. - * @hide - */ - final /*package*/ void attach(IBinder windowToken) { - if (DEBUG) Slog.v(TAG, "Dream attached on thread " + Thread.currentThread().getId()); - - mWindow = PolicyManager.makeNewWindow(this); - mWindow.setCallback(this); - mWindow.requestFeature(Window.FEATURE_NO_TITLE); - mWindow.setBackgroundDrawable(new ColorDrawable(0xFF000000)); - - if (DEBUG) Slog.v(TAG, "attaching window token: " + windowToken - + " to window of type " + WindowManager.LayoutParams.TYPE_DREAM); - - WindowManager.LayoutParams lp = mWindow.getAttributes(); - lp.type = WindowManager.LayoutParams.TYPE_DREAM; - lp.token = windowToken; - lp.windowAnimations = com.android.internal.R.style.Animation_Dream; - - //WindowManagerImpl.getDefault().addView(mWindow.getDecorView(), lp); - - if (DEBUG) Slog.v(TAG, "created and attached window: " + mWindow); - - mWindow.setWindowManager(null, windowToken, "dream", true); - mWindowManager = mWindow.getWindowManager(); - - // now make it visible - mHandler.post(new Runnable(){ - @Override - public void run() { - if (DEBUG) Slog.v(TAG, "Dream window added on thread " + Thread.currentThread().getId()); - - getWindowManager().addView(mWindow.getDecorView(), mWindow.getAttributes()); - }}); - } - - /** - * Stop the dream and wake up. - * - * After this method is called, the service will be stopped. - */ - public void finish() { - if (mFinished) return; - try { - mSandman.awaken(); // assuming we were started by the DreamManager - stopSelf(); // if launched via any other means - mFinished = true; - } catch (RemoteException ex) { - // sigh - } - } - - class IDreamServiceWrapper extends IDreamService.Stub { - public IDreamServiceWrapper() { - } - - public void attach(IBinder windowToken) { - Dream.this.attach(windowToken); - } - } - - /** - * Implement to return the implementation of the internal accessibility - * service interface. Subclasses should not override. - */ - @Override - public final IBinder onBind(Intent intent) { - return new IDreamServiceWrapper(); - } -} diff --git a/core/java/android/service/dreams/DreamManagerService.java b/core/java/android/service/dreams/DreamManagerService.java deleted file mode 100644 index 4a14cedbf9b39..0000000000000 --- a/core/java/android/service/dreams/DreamManagerService.java +++ /dev/null @@ -1,184 +0,0 @@ -package android.service.dreams; - -import static android.provider.Settings.Secure.SCREENSAVER_COMPONENT; - -import java.io.FileDescriptor; -import java.io.PrintWriter; - -import com.android.internal.view.IInputMethod; - -import android.content.ComponentName; -import android.content.Context; -import android.content.Intent; -import android.content.ServiceConnection; -import android.content.pm.PackageManager; -import android.os.Binder; -import android.os.IBinder; -import android.os.RemoteException; -import android.os.ServiceManager; -import android.os.SystemClock; -import android.provider.Settings; -import android.util.Log; -import android.util.Slog; -import android.view.IWindowManager; -import android.view.WindowManager; - -/** - * - * @hide - * - */ - -public class DreamManagerService - extends IDreamManager.Stub - implements ServiceConnection -{ - private static final boolean DEBUG = true; - private static final String TAG = "DreamManagerService"; - - final Object mLock = new Object[0]; - - private Context mContext; - private IWindowManager mIWindowManager; - - private ComponentName mCurrentDreamComponent; - private IDreamService mCurrentDream; - private Binder mCurrentDreamToken; - - public DreamManagerService(Context context) { - if (DEBUG) Slog.v(TAG, "DreamManagerService startup"); - mContext = context; - mIWindowManager = IWindowManager.Stub.asInterface( - ServiceManager.getService(Context.WINDOW_SERVICE)); - } - - private void checkPermission(String permission) { - if (PackageManager.PERMISSION_GRANTED != mContext.checkCallingOrSelfPermission(permission)) { - throw new SecurityException("Access denied to process: " + Binder.getCallingPid() - + ", must have permission " + permission); - } - } - - // IDreamManager method - public void dream() { - ComponentName name = getDreamComponent(); - if (name != null) { - synchronized (mLock) { - final long ident = Binder.clearCallingIdentity(); - try { - bindDreamComponentL(name, false); - } finally { - Binder.restoreCallingIdentity(ident); - } - } - } - } - - // IDreamManager method - public void setDreamComponent(ComponentName name) { - Settings.Secure.putString(mContext.getContentResolver(), SCREENSAVER_COMPONENT, name.flattenToString()); - } - - // IDreamManager method - public ComponentName getDreamComponent() { - // TODO(dsandler) don't load this every time, watch the value - String component = Settings.Secure.getString(mContext.getContentResolver(), SCREENSAVER_COMPONENT); - if (component == null) { - component = mContext.getResources().getString( - com.android.internal.R.string.config_defaultDreamComponent); - } - if (component != null) { - return ComponentName.unflattenFromString(component); - } else { - return null; - } - } - - // IDreamManager method - public void testDream(ComponentName name) { - if (DEBUG) Slog.v(TAG, "startDream name=" + name - + " pid=" + Binder.getCallingPid() + ", uid=" + Binder.getCallingUid()); -// checkPermission(android.Manifest.permission.SET_WALLPAPER_COMPONENT); - synchronized (mLock) { - final long ident = Binder.clearCallingIdentity(); - try { - bindDreamComponentL(name, true); - } finally { - Binder.restoreCallingIdentity(ident); - } - } - } - - // IDreamManager method - public void awaken() { - if (DEBUG) Slog.v(TAG, "awaken()"); - synchronized (mLock) { - if (mCurrentDream != null) { - mContext.unbindService(this); - } - } - } - - public void bindDreamComponentL(ComponentName componentName, boolean test) { - if (DEBUG) Slog.v(TAG, "bindDreamComponent: componentName=" + componentName - + " pid=" + Binder.getCallingPid() + ", uid=" + Binder.getCallingUid()); - - Intent intent = new Intent(Intent.ACTION_MAIN) - .setComponent(componentName) - .addFlags( - Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS - ) - .putExtra("android.dreams.TEST", test); - - if (!mContext.bindService(intent, this, Context.BIND_AUTO_CREATE)) { - Slog.w(TAG, "unable to bind service: " + componentName); - return; - } - mCurrentDreamComponent = componentName; - mCurrentDreamToken = new Binder(); - try { - if (DEBUG) Slog.v(TAG, "Adding window token: " + mCurrentDreamToken - + " for window type: " + WindowManager.LayoutParams.TYPE_DREAM); - mIWindowManager.addWindowToken(mCurrentDreamToken, - WindowManager.LayoutParams.TYPE_DREAM); - } catch (RemoteException e) { - Slog.w(TAG, "Unable to add window token. Proceed at your own risk."); - } - - } - - @Override - public void onServiceConnected(ComponentName name, IBinder service) { - if (DEBUG) Slog.v(TAG, "connected to dream: " + name + " binder=" + service + " thread=" + Thread.currentThread().getId()); - - mCurrentDream = IDreamService.Stub.asInterface(service); - try { - if (DEBUG) Slog.v(TAG, "attaching with token:" + mCurrentDreamToken); - mCurrentDream.attach(mCurrentDreamToken); - } catch (RemoteException ex) { - Slog.w(TAG, "Unable to send window token to dream:" + ex); - } - } - - @Override - public void onServiceDisconnected(ComponentName name) { - if (DEBUG) Slog.v(TAG, "disconnected: " + name + " service: " + mCurrentDream); - mCurrentDream = null; - mCurrentDreamToken = null; - } - - @Override - protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) { - mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DUMP, TAG); - - pw.println("Dreamland:"); - pw.print(" component="); pw.println(mCurrentDreamComponent); - pw.print(" token="); pw.println(mCurrentDreamToken); - pw.print(" dream="); pw.println(mCurrentDream); - } - - public void systemReady() { - if (DEBUG) Slog.v(TAG, "ready to dream!"); - } - -} diff --git a/core/java/android/service/dreams/DreamService.java b/core/java/android/service/dreams/DreamService.java new file mode 100644 index 0000000000000..6c9290bf99ffc --- /dev/null +++ b/core/java/android/service/dreams/DreamService.java @@ -0,0 +1,770 @@ +/** + * 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.service.dreams; + +import java.io.FileDescriptor; +import java.io.PrintWriter; + +import android.annotation.SdkConstant; +import android.annotation.SdkConstant.SdkConstantType; +import android.app.Service; +import android.content.Intent; +import android.graphics.PixelFormat; +import android.graphics.drawable.ColorDrawable; +import android.os.Handler; +import android.os.IBinder; +import android.os.ServiceManager; +import android.util.Slog; +import android.view.ActionMode; +import android.view.KeyEvent; +import android.view.Menu; +import android.view.MenuItem; +import android.view.MotionEvent; +import android.view.View; +import android.view.ViewGroup; +import android.view.Window; +import android.view.WindowManager; +import android.view.WindowManagerGlobal; +import android.view.WindowManager.LayoutParams; +import android.view.accessibility.AccessibilityEvent; + +import com.android.internal.policy.PolicyManager; + +/** + * Extend this class to implement a custom Dream (displayed to the user as a "Sleep Mode"). + * + *

        Dreams are interactive screensavers launched when a charging device is idle, or docked in a + * desk dock. Dreams provide another modality for apps to express themselves, tailored for + * an exhibition/lean-back experience.

        + * + *

        The Dream lifecycle is as follows:

        + *
          + *
        1. {@link #onAttachedToWindow} + *

          Use this for initial setup, such as calling {@link #setContentView setContentView()}.

        2. + *
        3. {@link #onDreamingStarted} + *

          Your dream has started, so you should begin animations or other behaviors here.

        4. + *
        5. {@link #onDreamingStopped} + *

          Use this to stop the things you started in {@link #onDreamingStarted}.

        6. + *
        7. {@link #onDetachedFromWindow} + *

          Use this to dismantle resources your dream set up. For example, detach from handlers + * and listeners.

        8. + *
        + * + *

        In addition, onCreate and onDestroy (from the Service interface) will also be called, but + * initialization and teardown should be done by overriding the hooks above.

        + * + *

        To be available to the system, Dreams should be declared in the manifest as follows:

        + *
        + * <service
        + *     android:name=".MyDream"
        + *     android:exported="true"
        + *     android:icon="@drawable/my_icon"
        + *     android:label="@string/my_dream_label" >
        + *
        + *     <intent-filter>
        + *         <action android:name="android.service.dreams.DreamService" />
        + *         <category android:name="android.intent.category.DEFAULT" />
        + *     </intent-filter>
        + *
        + *     <!-- Point to additional information for this dream (optional) -->
        + *     <meta-data
        + *         android:name="android.service.dream"
        + *         android:resource="@xml/my_dream" />
        + * </service>
        + * 
        + * + *

        If specified with the {@code <meta-data>} element, + * additional information for the dream is defined using the + * {@link android.R.styleable#Dream <dream>} element in a separate XML file. + * Currently, the only addtional + * information you can provide is for a settings activity that allows the user to configure + * the dream behavior. For example:

        + *

        res/xml/my_dream.xml

        + *
        + * <dream xmlns:android="http://schemas.android.com/apk/res/android"
        + *     android:settingsActivity="com.example.app/.MyDreamSettingsActivity" />
        + * 
        + *

        This makes a Settings button available alongside your dream's listing in the + * system settings, which when pressed opens the specified activity.

        + * + * + *

        To specify your dream layout, call {@link #setContentView}, typically during the + * {@link #onAttachedToWindow} callback. For example:

        + *
        + * public class MyDream extends DreamService {
        + *
        + *     @Override
        + *     public void onAttachedToWindow() {
        + *         super.onAttachedToWindow();
        + *
        + *         // Exit dream upon user touch
        + *         setInteractive(false);
        + *         // Hide system UI
        + *         setFullscreen(true);
        + *         // Set the dream layout
        + *         setContentView(R.layout.dream);
        + *     }
        + * }
        + * 
        + */ +public class DreamService extends Service implements Window.Callback { + private final String TAG = DreamService.class.getSimpleName() + "[" + getClass().getSimpleName() + "]"; + + /** + * The name of the dream manager service. + * @hide + */ + public static final String DREAM_SERVICE = "dreams"; + + /** + * The {@link Intent} that must be declared as handled by the service. + */ + @SdkConstant(SdkConstantType.SERVICE_ACTION) + public static final String SERVICE_INTERFACE = + "android.service.dreams.DreamService"; + + /** + * Name under which a Dream publishes information about itself. + * This meta-data must reference an XML resource containing + * a <{@link android.R.styleable#Dream dream}> + * tag. + */ + public static final String DREAM_META_DATA = "android.service.dream"; + + private final Handler mHandler = new Handler(); + private IBinder mWindowToken; + private Window mWindow; + private WindowManager mWindowManager; + private IDreamManager mSandman; + private boolean mInteractive = false; + private boolean mLowProfile = true; + private boolean mFullscreen = false; + private boolean mScreenBright = true; + private boolean mFinished; + + private boolean mDebug = false; + + /** + * @hide + */ + public void setDebug(boolean dbg) { + mDebug = dbg; + } + + // begin Window.Callback methods + /** {@inheritDoc} */ + @Override + public boolean dispatchKeyEvent(KeyEvent event) { + // TODO: create more flexible version of mInteractive that allows use of KEYCODE_BACK + if (!mInteractive) { + if (mDebug) Slog.v(TAG, "Finishing on keyEvent"); + safelyFinish(); + return true; + } else if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) { + if (mDebug) Slog.v(TAG, "Finishing on back key"); + safelyFinish(); + return true; + } + return mWindow.superDispatchKeyEvent(event); + } + + /** {@inheritDoc} */ + @Override + public boolean dispatchKeyShortcutEvent(KeyEvent event) { + if (!mInteractive) { + if (mDebug) Slog.v(TAG, "Finishing on keyShortcutEvent"); + safelyFinish(); + return true; + } + return mWindow.superDispatchKeyShortcutEvent(event); + } + + /** {@inheritDoc} */ + @Override + public boolean dispatchTouchEvent(MotionEvent event) { + // TODO: create more flexible version of mInteractive that allows clicks + // but finish()es on any other kind of activity + if (!mInteractive) { + if (mDebug) Slog.v(TAG, "Finishing on touchEvent"); + safelyFinish(); + return true; + } + return mWindow.superDispatchTouchEvent(event); + } + + /** {@inheritDoc} */ + @Override + public boolean dispatchTrackballEvent(MotionEvent event) { + if (!mInteractive) { + if (mDebug) Slog.v(TAG, "Finishing on trackballEvent"); + safelyFinish(); + return true; + } + return mWindow.superDispatchTrackballEvent(event); + } + + /** {@inheritDoc} */ + @Override + public boolean dispatchGenericMotionEvent(MotionEvent event) { + if (!mInteractive) { + if (mDebug) Slog.v(TAG, "Finishing on genericMotionEvent"); + safelyFinish(); + return true; + } + return mWindow.superDispatchGenericMotionEvent(event); + } + + /** {@inheritDoc} */ + @Override + public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) { + return false; + } + + /** {@inheritDoc} */ + @Override + public View onCreatePanelView(int featureId) { + return null; + } + + /** {@inheritDoc} */ + @Override + public boolean onCreatePanelMenu(int featureId, Menu menu) { + return false; + } + + /** {@inheritDoc} */ + @Override + public boolean onPreparePanel(int featureId, View view, Menu menu) { + return false; + } + + /** {@inheritDoc} */ + @Override + public boolean onMenuOpened(int featureId, Menu menu) { + return false; + } + + /** {@inheritDoc} */ + @Override + public boolean onMenuItemSelected(int featureId, MenuItem item) { + return false; + } + + /** {@inheritDoc} */ + @Override + public void onWindowAttributesChanged(LayoutParams attrs) { + } + + /** {@inheritDoc} */ + @Override + public void onContentChanged() { + } + + /** {@inheritDoc} */ + @Override + public void onWindowFocusChanged(boolean hasFocus) { + } + + /** {@inheritDoc} */ + @Override + public void onAttachedToWindow() { + } + + /** {@inheritDoc} */ + @Override + public void onDetachedFromWindow() { + } + + /** {@inheritDoc} */ + @Override + public void onPanelClosed(int featureId, Menu menu) { + } + + /** {@inheritDoc} */ + @Override + public boolean onSearchRequested() { + return false; + } + + /** {@inheritDoc} */ + @Override + public ActionMode onWindowStartingActionMode(android.view.ActionMode.Callback callback) { + return null; + } + + /** {@inheritDoc} */ + @Override + public void onActionModeStarted(ActionMode mode) { + } + + /** {@inheritDoc} */ + @Override + public void onActionModeFinished(ActionMode mode) { + } + // end Window.Callback methods + + // begin public api + /** + * Retrieves the current {@link android.view.WindowManager} for the dream. + * Behaves similarly to {@link android.app.Activity#getWindowManager()}. + * + * @return The current window manager, or null if the dream is not started. + */ + public WindowManager getWindowManager() { + return mWindowManager; + } + + /** + * Retrieves the current {@link android.view.Window} for the dream. + * Behaves similarly to {@link android.app.Activity#getWindow()}. + * + * @return The current window, or null if the dream is not started. + */ + public Window getWindow() { + return mWindow; + } + + /** + * Inflates a layout resource and set it to be the content view for this Dream. + * Behaves similarly to {@link android.app.Activity#setContentView(int)}. + * + *

        Note: Requires a window, do not call before {@link #onAttachedToWindow()}

        + * + * @param layoutResID Resource ID to be inflated. + * + * @see #setContentView(android.view.View) + * @see #setContentView(android.view.View, android.view.ViewGroup.LayoutParams) + */ + public void setContentView(int layoutResID) { + getWindow().setContentView(layoutResID); + } + + /** + * Sets a view to be the content view for this Dream. + * Behaves similarly to {@link android.app.Activity#setContentView(android.view.View)} in an activity, + * including using {@link ViewGroup.LayoutParams#MATCH_PARENT} as the layout height and width of the view. + * + *

        Note: This requires a window, so you should usually call it during + * {@link #onAttachedToWindow()} and never earlier (you cannot call it + * during {@link #onCreate}).

        + * + * @see #setContentView(int) + * @see #setContentView(android.view.View, android.view.ViewGroup.LayoutParams) + */ + public void setContentView(View view) { + getWindow().setContentView(view); + } + + /** + * Sets a view to be the content view for this Dream. + * Behaves similarly to + * {@link android.app.Activity#setContentView(android.view.View, android.view.ViewGroup.LayoutParams)} + * in an activity. + * + *

        Note: This requires a window, so you should usually call it during + * {@link #onAttachedToWindow()} and never earlier (you cannot call it + * during {@link #onCreate}).

        + * + * @param view The desired content to display. + * @param params Layout parameters for the view. + * + * @see #setContentView(android.view.View) + * @see #setContentView(int) + */ + public void setContentView(View view, ViewGroup.LayoutParams params) { + getWindow().setContentView(view, params); + } + + /** + * Adds a view to the Dream's window, leaving other content views in place. + * + *

        Note: Requires a window, do not call before {@link #onAttachedToWindow()}

        + * + * @param view The desired content to display. + * @param params Layout parameters for the view. + */ + public void addContentView(View view, ViewGroup.LayoutParams params) { + getWindow().addContentView(view, params); + } + + /** + * Finds a view that was identified by the id attribute from the XML that + * was processed in {@link #onCreate}. + * + *

        Note: Requires a window, do not call before {@link #onAttachedToWindow()}

        + * + * @return The view if found or null otherwise. + */ + public View findViewById(int id) { + return getWindow().findViewById(id); + } + + /** + * Marks this dream as interactive to receive input events. + * + *

        Non-interactive dreams (default) will dismiss on the first input event.

        + * + *

        Interactive dreams should call {@link #finish()} to dismiss themselves.

        + * + * @param interactive True if this dream will handle input events. + */ + public void setInteractive(boolean interactive) { + mInteractive = interactive; + } + + /** + * Returns whether or not this dream is interactive. Defaults to false. + * + * @see #setInteractive(boolean) + */ + public boolean isInteractive() { + return mInteractive; + } + + /** + * Sets View.SYSTEM_UI_FLAG_LOW_PROFILE on the content view. + * + * @param lowProfile True to set View.SYSTEM_UI_FLAG_LOW_PROFILE + * @hide There is no reason to have this -- dreams can set this flag + * on their own content view, and from there can actually do the + * correct interactions with it (seeing when it is cleared etc). + */ + public void setLowProfile(boolean lowProfile) { + mLowProfile = lowProfile; + int flag = View.SYSTEM_UI_FLAG_LOW_PROFILE; + applySystemUiVisibilityFlags(mLowProfile ? flag : 0, flag); + } + + /** + * Returns whether or not this dream is in low profile mode. Defaults to true. + * + * @see #setLowProfile(boolean) + * @hide + */ + public boolean isLowProfile() { + return getSystemUiVisibilityFlagValue(View.SYSTEM_UI_FLAG_LOW_PROFILE, mLowProfile); + } + + /** + * Controls {@link android.view.WindowManager.LayoutParams#FLAG_FULLSCREEN} + * on the dream's window. + * + * @param fullscreen If true, the fullscreen flag will be set; else it + * will be cleared. + */ + public void setFullscreen(boolean fullscreen) { + mFullscreen = fullscreen; + int flag = WindowManager.LayoutParams.FLAG_FULLSCREEN; + applyWindowFlags(mFullscreen ? flag : 0, flag); + } + + /** + * Returns whether or not this dream is in fullscreen mode. Defaults to false. + * + * @see #setFullscreen(boolean) + */ + public boolean isFullscreen() { + return mFullscreen; + } + + /** + * Marks this dream as keeping the screen bright while dreaming. + * + * @param screenBright True to keep the screen bright while dreaming. + */ + public void setScreenBright(boolean screenBright) { + mScreenBright = screenBright; + int flag = WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON; + applyWindowFlags(mScreenBright ? flag : 0, flag); + } + + /** + * Returns whether or not this dream keeps the screen bright while dreaming. Defaults to false, + * allowing the screen to dim if necessary. + * + * @see #setScreenBright(boolean) + */ + public boolean isScreenBright() { + return getWindowFlagValue(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON, mScreenBright); + } + + /** + * Called when this Dream is constructed. + */ + @Override + public void onCreate() { + if (mDebug) Slog.v(TAG, "onCreate() on thread " + Thread.currentThread().getId()); + super.onCreate(); + } + + /** + * Called when the dream's window has been created and is visible and animation may now begin. + */ + public void onDreamingStarted() { + if (mDebug) Slog.v(TAG, "onDreamingStarted()"); + // hook for subclasses + } + + /** + * Called when this Dream is stopped, either by external request or by calling finish(), + * before the window has been removed. + */ + public void onDreamingStopped() { + if (mDebug) Slog.v(TAG, "onDreamingStopped()"); + // hook for subclasses + } + + /** {@inheritDoc} */ + @Override + public final IBinder onBind(Intent intent) { + if (mDebug) Slog.v(TAG, "onBind() intent = " + intent); + return new DreamServiceWrapper(); + } + + /** + * Stops the dream, detaches from the window, and wakes up. + */ + public final void finish() { + if (mDebug) Slog.v(TAG, "finish()"); + finishInternal(); + } + + /** {@inheritDoc} */ + @Override + public void onDestroy() { + if (mDebug) Slog.v(TAG, "onDestroy()"); + // hook for subclasses + + // Just in case destroy came in before detach, let's take care of that now + detach(); + + super.onDestroy(); + } + + // end public api + + private void loadSandman() { + mSandman = IDreamManager.Stub.asInterface(ServiceManager.getService(DREAM_SERVICE)); + } + + /** + * Called by DreamController.stopDream() when the Dream is about to be unbound and destroyed. + * + * Must run on mHandler. + */ + private final void detach() { + if (mWindow == null) { + // already detached! + return; + } + + try { + onDreamingStopped(); + } catch (Throwable t) { + Slog.w(TAG, "Crashed in onDreamingStopped()", t); + // we were going to stop anyway + } + + if (mDebug) Slog.v(TAG, "detach(): Removing window from window manager"); + try { + // force our window to be removed synchronously + mWindowManager.removeViewImmediate(mWindow.getDecorView()); + // the following will print a log message if it finds any other leaked windows + WindowManagerGlobal.getInstance().closeAll(mWindowToken, + this.getClass().getName(), "Dream"); + } catch (Throwable t) { + Slog.w(TAG, "Crashed removing window view", t); + } + + mWindow = null; + mWindowToken = null; + } + + /** + * Called when the Dream is ready to be shown. + * + * Must run on mHandler. + * + * @param windowToken A window token that will allow a window to be created in the correct layer. + */ + private final void attach(IBinder windowToken) { + if (mWindowToken != null) { + Slog.e(TAG, "attach() called when already attached with token=" + mWindowToken); + return; + } + + if (mDebug) Slog.v(TAG, "Attached on thread " + Thread.currentThread().getId()); + + if (mSandman == null) { + loadSandman(); + } + mWindowToken = windowToken; + mWindow = PolicyManager.makeNewWindow(this); + mWindow.setCallback(this); + mWindow.requestFeature(Window.FEATURE_NO_TITLE); + mWindow.setBackgroundDrawable(new ColorDrawable(0xFF000000)); + mWindow.setFormat(PixelFormat.OPAQUE); + + if (mDebug) Slog.v(TAG, String.format("Attaching window token: %s to window of type %s", + windowToken, WindowManager.LayoutParams.TYPE_DREAM)); + + WindowManager.LayoutParams lp = mWindow.getAttributes(); + lp.type = WindowManager.LayoutParams.TYPE_DREAM; + lp.token = windowToken; + lp.windowAnimations = com.android.internal.R.style.Animation_Dream; + lp.flags |= ( WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN + | WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR + | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED + | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD + | WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON + | (mFullscreen ? WindowManager.LayoutParams.FLAG_FULLSCREEN : 0) + | (mScreenBright ? WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON : 0) + ); + mWindow.setAttributes(lp); + + if (mDebug) Slog.v(TAG, "Created and attached window: " + mWindow); + + mWindow.setWindowManager(null, windowToken, "dream", true); + mWindowManager = mWindow.getWindowManager(); + + if (mDebug) Slog.v(TAG, "Window added on thread " + Thread.currentThread().getId()); + try { + applySystemUiVisibilityFlags( + (mLowProfile ? View.SYSTEM_UI_FLAG_LOW_PROFILE : 0), + View.SYSTEM_UI_FLAG_LOW_PROFILE); + getWindowManager().addView(mWindow.getDecorView(), mWindow.getAttributes()); + } catch (Throwable t) { + Slog.w(TAG, "Crashed adding window view", t); + safelyFinish(); + return; + } + + // start it up + mHandler.post(new Runnable() { + @Override + public void run() { + try { + onDreamingStarted(); + } catch (Throwable t) { + Slog.w(TAG, "Crashed in onDreamingStarted()", t); + safelyFinish(); + } + } + }); + } + + private void safelyFinish() { + if (mDebug) Slog.v(TAG, "safelyFinish()"); + try { + finish(); + } catch (Throwable t) { + Slog.w(TAG, "Crashed in safelyFinish()", t); + finishInternal(); + return; + } + + if (!mFinished) { + Slog.w(TAG, "Bad dream, did not call super.finish()"); + finishInternal(); + } + } + + private void finishInternal() { + if (mDebug) Slog.v(TAG, "finishInternal() mFinished = " + mFinished); + if (mFinished) return; + try { + mFinished = true; + + if (mSandman != null) { + mSandman.finishSelf(mWindowToken); + } else { + Slog.w(TAG, "No dream manager found"); + } + stopSelf(); // if launched via any other means + + } catch (Throwable t) { + Slog.w(TAG, "Crashed in finishInternal()", t); + } + } + + private boolean getWindowFlagValue(int flag, boolean defaultValue) { + return mWindow == null ? defaultValue : (mWindow.getAttributes().flags & flag) != 0; + } + + private void applyWindowFlags(int flags, int mask) { + if (mWindow != null) { + WindowManager.LayoutParams lp = mWindow.getAttributes(); + lp.flags = applyFlags(lp.flags, flags, mask); + mWindow.setAttributes(lp); + mWindowManager.updateViewLayout(mWindow.getDecorView(), lp); + } + } + + private boolean getSystemUiVisibilityFlagValue(int flag, boolean defaultValue) { + View v = mWindow == null ? null : mWindow.getDecorView(); + return v == null ? defaultValue : (v.getSystemUiVisibility() & flag) != 0; + } + + private void applySystemUiVisibilityFlags(int flags, int mask) { + View v = mWindow == null ? null : mWindow.getDecorView(); + if (v != null) { + v.setSystemUiVisibility(applyFlags(v.getSystemUiVisibility(), flags, mask)); + } + } + + private int applyFlags(int oldFlags, int flags, int mask) { + return (oldFlags&~mask) | (flags&mask); + } + + @Override + protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) { + super.dump(fd, pw, args); + + pw.print(TAG + ": "); + if (mWindowToken == null) { + pw.println("stopped"); + } else { + pw.println("running (token=" + mWindowToken + ")"); + } + pw.println(" window: " + mWindow); + pw.print(" flags:"); + if (isInteractive()) pw.print(" interactive"); + if (isLowProfile()) pw.print(" lowprofile"); + if (isFullscreen()) pw.print(" fullscreen"); + if (isScreenBright()) pw.print(" bright"); + pw.println(); + } + + private class DreamServiceWrapper extends IDreamService.Stub { + public void attach(final IBinder windowToken) { + mHandler.post(new Runnable() { + @Override + public void run() { + DreamService.this.attach(windowToken); + } + }); + } + public void detach() { + mHandler.post(new Runnable() { + @Override + public void run() { + DreamService.this.detach(); + } + }); + } + } + +} diff --git a/core/java/android/service/dreams/IDreamManager.aidl b/core/java/android/service/dreams/IDreamManager.aidl index 722501391f0da..1c1b390947765 100644 --- a/core/java/android/service/dreams/IDreamManager.aidl +++ b/core/java/android/service/dreams/IDreamManager.aidl @@ -19,12 +19,16 @@ package android.service.dreams; import android.os.Bundle; import android.os.ParcelFileDescriptor; import android.content.ComponentName; +import android.os.IBinder; /** @hide */ interface IDreamManager { void dream(); void awaken(); - void setDreamComponent(in ComponentName componentName); - ComponentName getDreamComponent(); + void setDreamComponents(in ComponentName[] componentNames); + ComponentName[] getDreamComponents(); + ComponentName getDefaultDreamComponent(); void testDream(in ComponentName componentName); + boolean isDreaming(); + void finishSelf(in IBinder token); } \ No newline at end of file diff --git a/core/java/android/service/dreams/IDreamService.aidl b/core/java/android/service/dreams/IDreamService.aidl index 1bb241a3f5db2..99dc0b77d2083 100644 --- a/core/java/android/service/dreams/IDreamService.aidl +++ b/core/java/android/service/dreams/IDreamService.aidl @@ -21,4 +21,5 @@ package android.service.dreams; */ oneway interface IDreamService { void attach(IBinder windowToken); + void detach(); } diff --git a/core/java/android/service/dreams/Sandman.java b/core/java/android/service/dreams/Sandman.java new file mode 100644 index 0000000000000..5f5b07953156c --- /dev/null +++ b/core/java/android/service/dreams/Sandman.java @@ -0,0 +1,123 @@ +/* + * 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.service.dreams; + +import android.content.ComponentName; +import android.content.Context; +import android.content.Intent; +import android.os.PowerManager; +import android.os.RemoteException; +import android.os.ServiceManager; +import android.os.SystemClock; +import android.os.UserHandle; +import android.provider.Settings; +import android.util.Slog; + +/** + * Internal helper for launching dreams to ensure consistency between the + * UiModeManagerService system service and the Somnambulator activity. + * + * @hide + */ +public final class Sandman { + private static final String TAG = "Sandman"; + + // The component name of a special dock app that merely launches a dream. + // We don't want to launch this app when docked because it causes an unnecessary + // activity transition. We just want to start the dream. + private static final ComponentName SOMNAMBULATOR_COMPONENT = + new ComponentName("com.android.systemui", "com.android.systemui.Somnambulator"); + + + // The sandman is eternal. No one instantiates him. + private Sandman() { + } + + /** + * Returns true if the specified dock app intent should be started. + * False if we should dream instead, if appropriate. + */ + public static boolean shouldStartDockApp(Context context, Intent intent) { + ComponentName name = intent.resolveActivity(context.getPackageManager()); + return name != null && !name.equals(SOMNAMBULATOR_COMPONENT); + } + + /** + * Starts a dream manually. + */ + public static void startDreamByUserRequest(Context context) { + startDream(context, false); + } + + /** + * Starts a dream when docked if the system has been configured to do so, + * otherwise does nothing. + */ + public static void startDreamWhenDockedIfAppropriate(Context context) { + if (!isScreenSaverEnabled(context) + || !isScreenSaverActivatedOnDock(context)) { + Slog.i(TAG, "Dreams currently disabled for docks."); + return; + } + + startDream(context, true); + } + + private static void startDream(Context context, boolean docked) { + try { + IDreamManager dreamManagerService = IDreamManager.Stub.asInterface( + ServiceManager.getService(DreamService.DREAM_SERVICE)); + if (dreamManagerService != null && !dreamManagerService.isDreaming()) { + if (docked) { + Slog.i(TAG, "Activating dream while docked."); + + // Wake up. + // The power manager will wake up the system automatically when it starts + // receiving power from a dock but there is a race between that happening + // and the UI mode manager starting a dream. We want the system to already + // be awake by the time this happens. Otherwise the dream may not start. + PowerManager powerManager = + (PowerManager)context.getSystemService(Context.POWER_SERVICE); + powerManager.wakeUp(SystemClock.uptimeMillis()); + } else { + Slog.i(TAG, "Activating dream by user request."); + } + + // Dream. + dreamManagerService.dream(); + } + } catch (RemoteException ex) { + Slog.e(TAG, "Could not start dream when docked.", ex); + } + } + + private static boolean isScreenSaverEnabled(Context context) { + int def = context.getResources().getBoolean( + com.android.internal.R.bool.config_dreamsEnabledByDefault) ? 1 : 0; + return Settings.Secure.getIntForUser(context.getContentResolver(), + Settings.Secure.SCREENSAVER_ENABLED, def, + UserHandle.USER_CURRENT) != 0; + } + + private static boolean isScreenSaverActivatedOnDock(Context context) { + int def = context.getResources().getBoolean( + com.android.internal.R.bool.config_dreamsActivatedOnDockByDefault) ? 1 : 0; + return Settings.Secure.getIntForUser(context.getContentResolver(), + Settings.Secure.SCREENSAVER_ACTIVATE_ON_DOCK, def, + UserHandle.USER_CURRENT) != 0; + } +} diff --git a/core/java/android/service/wallpaper/IWallpaperConnection.aidl b/core/java/android/service/wallpaper/IWallpaperConnection.aidl index b09ccabe26b9c..f9c5aaa97612f 100644 --- a/core/java/android/service/wallpaper/IWallpaperConnection.aidl +++ b/core/java/android/service/wallpaper/IWallpaperConnection.aidl @@ -24,5 +24,6 @@ import android.service.wallpaper.IWallpaperEngine; */ interface IWallpaperConnection { void attachEngine(IWallpaperEngine engine); + void engineShown(IWallpaperEngine engine); ParcelFileDescriptor setWallpaper(String name); } diff --git a/core/java/android/service/wallpaper/WallpaperService.java b/core/java/android/service/wallpaper/WallpaperService.java index 3e0942c5c6e78..6d5705d00ce61 100644 --- a/core/java/android/service/wallpaper/WallpaperService.java +++ b/core/java/android/service/wallpaper/WallpaperService.java @@ -36,10 +36,10 @@ import android.os.Looper; import android.os.Message; import android.os.PowerManager; -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; @@ -50,9 +50,8 @@ import android.view.SurfaceHolder; import android.view.View; import android.view.ViewGroup; -import android.view.ViewRootImpl; import android.view.WindowManager; -import android.view.WindowManagerImpl; +import android.view.WindowManagerGlobal; import java.io.FileDescriptor; import java.io.PrintWriter; @@ -98,6 +97,7 @@ public abstract class WallpaperService extends Service { private static final int MSG_WALLPAPER_OFFSETS = 10020; private static final int MSG_WALLPAPER_COMMAND = 10025; private static final int MSG_WINDOW_RESIZED = 10030; + private static final int MSG_WINDOW_MOVED = 10035; private static final int MSG_TOUCH_EVENT = 10040; private Looper mCallbackLooper; @@ -253,13 +253,19 @@ public void onInputEvent(InputEvent event) { final BaseIWindow mWindow = new BaseIWindow() { @Override - public void resized(int w, int h, Rect contentInsets, + public void resized(Rect frame, Rect contentInsets, Rect visibleInsets, boolean reportDraw, Configuration newConfig) { Message msg = mCaller.obtainMessageI(MSG_WINDOW_RESIZED, reportDraw ? 1 : 0); mCaller.sendMessage(msg); } - + + @Override + public void moved(int newX, int newY) { + Message msg = mCaller.obtainMessageII(MSG_WINDOW_MOVED, newX, newY); + mCaller.sendMessage(msg); + } + @Override public void dispatchAppVisibility(boolean visible) { // We don't do this in preview mode; we'll let the preview @@ -290,7 +296,8 @@ public void dispatchWallpaperOffsets(float x, float y, float xStep, float yStep, } } } - + + @Override public void dispatchWallpaperCommand(String action, int x, int y, int z, Bundle extras, boolean sync) { synchronized (mLock) { @@ -567,7 +574,8 @@ void updateSurface(boolean forceRelayout, boolean forceReport, boolean redrawNee final boolean flagsChanged = mCurWindowFlags != mWindowFlags || mCurWindowPrivateFlags != mWindowPrivateFlags; if (forceRelayout || creating || surfaceCreating || formatChanged || sizeChanged - || typeChanged || flagsChanged || redrawNeeded) { + || typeChanged || flagsChanged || redrawNeeded + || !mIWallpaperEngine.mShownReported) { if (DEBUG) Log.v(TAG, "Changes: creating=" + creating + " format=" + formatChanged + " size=" + sizeChanged); @@ -599,13 +607,13 @@ void updateSurface(boolean forceRelayout, boolean forceReport, boolean redrawNee if (!mCreated) { mLayout.type = mIWallpaperEngine.mWindowType; - mLayout.gravity = Gravity.LEFT|Gravity.TOP; + mLayout.gravity = Gravity.START|Gravity.TOP; mLayout.setTitle(WallpaperService.this.getClass().getName()); 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; } @@ -665,8 +673,8 @@ void updateSurface(boolean forceRelayout, boolean forceReport, boolean redrawNee } } - redrawNeeded |= creating - || (relayoutResult&WindowManagerImpl.RELAYOUT_RES_FIRST_TIME) != 0; + redrawNeeded |= creating || (relayoutResult + & WindowManagerGlobal.RELAYOUT_RES_FIRST_TIME) != 0; if (forceReport || creating || surfaceCreating || formatChanged || sizeChanged) { @@ -732,6 +740,7 @@ void updateSurface(boolean forceRelayout, boolean forceReport, boolean redrawNee if (redrawNeeded) { mSession.finishDrawing(mWindow); } + mIWallpaperEngine.reportShown(); } } catch (RemoteException ex) { } @@ -753,7 +762,7 @@ void attach(IWallpaperEngineWrapper wrapper) { mWindowToken = wrapper.mWindowToken; mSurfaceHolder.setSizeFromLayout(); mInitializing = true; - mSession = ViewRootImpl.getWindowSession(getMainLooper()); + mSession = WindowManagerGlobal.getWindowSession(getMainLooper()); mWindow.setSession(mSession); @@ -943,6 +952,7 @@ class IWallpaperEngineWrapper extends IWallpaperEngine.Stub final IBinder mWindowToken; final int mWindowType; final boolean mIsPreview; + boolean mShownReported; int mReqWidth; int mReqHeight; @@ -995,6 +1005,18 @@ public void dispatchWallpaperCommand(String action, int x, int y, } } + public void reportShown() { + if (!mShownReported) { + mShownReported = true; + try { + mConnection.engineShown(this); + } catch (RemoteException e) { + Log.w(TAG, "Wallpaper host disappeared", e); + return; + } + } + } + public void destroy() { Message msg = mCaller.obtainMessage(DO_DETACH); mCaller.sendMessage(msg); @@ -1044,6 +1066,9 @@ public void executeMessage(Message message) { mEngine.updateSurface(true, false, reportDraw); mEngine.doOffsetsChanged(true); } break; + case MSG_WINDOW_MOVED: { + // Do nothing. What does it mean for a Wallpaper to move? + } break; case MSG_TOUCH_EVENT: { boolean skip = false; MotionEvent ev = (MotionEvent)message.obj; diff --git a/core/java/android/speech/tts/BlockingAudioTrack.java b/core/java/android/speech/tts/BlockingAudioTrack.java index fcadad7dfbe8a..186cb493b1332 100644 --- a/core/java/android/speech/tts/BlockingAudioTrack.java +++ b/core/java/android/speech/tts/BlockingAudioTrack.java @@ -67,12 +67,11 @@ class BlockingAudioTrack { private int mAudioBufferSize; private int mBytesWritten = 0; + // Need to be seen by stop() which can be called from another thread. mAudioTrack will be + // set to null only after waitAndRelease(). + private Object mAudioTrackLock = new Object(); private AudioTrack mAudioTrack; private volatile boolean mStopped; - // Locks the initialization / uninitialization of the audio track. - // This is required because stop() will throw an illegal state exception - // if called before init() or after mAudioTrack.release(). - private final Object mAudioTrackLock = new Object(); BlockingAudioTrack(int streamType, int sampleRate, int audioFormat, int channelCount, @@ -93,12 +92,17 @@ class BlockingAudioTrack { mStopped = false; } - public void init() { + public boolean init() { AudioTrack track = createStreamingAudioTrack(); - synchronized (mAudioTrackLock) { mAudioTrack = track; } + + if (track == null) { + return false; + } else { + return true; + } } public void stop() { @@ -106,20 +110,35 @@ public void stop() { if (mAudioTrack != null) { mAudioTrack.stop(); } + mStopped = true; } - mStopped = true; } public int write(byte[] data) { - if (mAudioTrack == null || mStopped) { + AudioTrack track = null; + synchronized (mAudioTrackLock) { + track = mAudioTrack; + } + + if (track == null || mStopped) { return -1; } - final int bytesWritten = writeToAudioTrack(mAudioTrack, data); + final int bytesWritten = writeToAudioTrack(track, data); + mBytesWritten += bytesWritten; return bytesWritten; } public void waitAndRelease() { + AudioTrack track = null; + synchronized (mAudioTrackLock) { + track = mAudioTrack; + } + if (track == null) { + if (DBG) Log.d(TAG, "Audio track null [duplicate call to waitAndRelease ?]"); + return; + } + // For "small" audio tracks, we have to stop() them to make them mixable, // else the audio subsystem will wait indefinitely for us to fill the buffer // before rendering the track mixable. @@ -129,11 +148,11 @@ public void waitAndRelease() { if (mBytesWritten < mAudioBufferSize && !mStopped) { if (DBG) { Log.d(TAG, "Stopping audio track to flush audio, state was : " + - mAudioTrack.getPlayState() + ",stopped= " + mStopped); + track.getPlayState() + ",stopped= " + mStopped); } mIsShortUtterance = true; - mAudioTrack.stop(); + track.stop(); } // Block until the audio track is done only if we haven't stopped yet. @@ -145,11 +164,11 @@ public void waitAndRelease() { // The last call to AudioTrack.write( ) will return only after // all data from the audioTrack has been sent to the mixer, so // it's safe to release at this point. - if (DBG) Log.d(TAG, "Releasing audio track [" + mAudioTrack.hashCode() + "]"); - synchronized (mAudioTrackLock) { - mAudioTrack.release(); + if (DBG) Log.d(TAG, "Releasing audio track [" + track.hashCode() + "]"); + synchronized(mAudioTrackLock) { mAudioTrack = null; } + track.release(); } diff --git a/core/java/android/speech/tts/FileSynthesisCallback.java b/core/java/android/speech/tts/FileSynthesisCallback.java index 04c33775d5c1b..3e33e8e4b5270 100644 --- a/core/java/android/speech/tts/FileSynthesisCallback.java +++ b/core/java/android/speech/tts/FileSynthesisCallback.java @@ -95,6 +95,22 @@ private void closeFileAndWidenPermissions() { } } + /** + * Checks whether a given file exists, and deletes it if it does. + */ + private boolean maybeCleanupExistingFile(File file) { + if (file.exists()) { + Log.v(TAG, "File " + file + " exists, deleting."); + if (!file.delete()) { + Log.e(TAG, "Failed to delete " + file); + return false; + } + } + + return true; + } + + @Override public int getMaxBufferSize() { return MAX_AUDIO_BUFFER_SIZE; @@ -120,6 +136,11 @@ public int start(int sampleRateInHz, int audioFormat, int channelCount) { cleanUp(); throw new IllegalArgumentException("FileSynthesisRequest.start() called twice"); } + + if (!maybeCleanupExistingFile(mFileName)) { + return TextToSpeech.ERROR; + } + mSampleRateInHz = sampleRateInHz; mAudioFormat = audioFormat; mChannelCount = channelCount; @@ -166,6 +187,12 @@ public int audioAvailable(byte[] buffer, int offset, int length) { public int done() { if (DBG) Log.d(TAG, "FileSynthesisRequest.done()"); synchronized (mStateLock) { + if (mDone) { + if (DBG) Log.d(TAG, "Duplicate call to done()"); + // This preserves existing behaviour. Earlier, if done was called twice + // we'd return ERROR because mFile == null and we'd add to logspam. + return TextToSpeech.ERROR; + } if (mStopped) { if (DBG) Log.d(TAG, "Request has been aborted."); return TextToSpeech.ERROR; diff --git a/core/java/android/speech/tts/SynthesisPlaybackQueueItem.java b/core/java/android/speech/tts/SynthesisPlaybackQueueItem.java index d299d70421f5f..e853c9e36379d 100644 --- a/core/java/android/speech/tts/SynthesisPlaybackQueueItem.java +++ b/core/java/android/speech/tts/SynthesisPlaybackQueueItem.java @@ -87,7 +87,10 @@ public void run() { dispatcher.dispatchOnStart(); - mAudioTrack.init(); + if (!mAudioTrack.init()) { + dispatcher.dispatchOnError(); + return; + } try { byte[] buffer = null; @@ -242,4 +245,3 @@ static final class ListEntry { } } } - diff --git a/core/java/android/speech/tts/TextToSpeech.java b/core/java/android/speech/tts/TextToSpeech.java index 7a174af1562a2..5e367cb56aa13 100755 --- a/core/java/android/speech/tts/TextToSpeech.java +++ b/core/java/android/speech/tts/TextToSpeech.java @@ -1282,6 +1282,7 @@ public void onStart(String utteranceId) { } }; + @Override public void onServiceConnected(ComponentName name, IBinder service) { Log.i(TAG, "Connected to " + name); synchronized(mStartLock) { @@ -1305,6 +1306,7 @@ public IBinder getCallerIdentity() { return mCallback; } + @Override public void onServiceDisconnected(ComponentName name) { synchronized(mStartLock) { mService = null; @@ -1317,24 +1319,33 @@ public void onServiceDisconnected(ComponentName name) { public void disconnect() { mContext.unbindService(this); + + synchronized (mStartLock) { + mService = null; + // If this is the active connection, clear it + if (mServiceConnection == this) { + mServiceConnection = null; + } + + } } public R runAction(Action action, R errorResult, String method, boolean reconnect) { - try { - synchronized (mStartLock) { + synchronized (mStartLock) { + try { if (mService == null) { Log.w(TAG, method + " failed: not connected to TTS engine"); return errorResult; } return action.run(mService); + } catch (RemoteException ex) { + Log.e(TAG, method + " failed", ex); + if (reconnect) { + disconnect(); + initTts(); + } + return errorResult; } - } catch (RemoteException ex) { - Log.e(TAG, method + " failed", ex); - if (reconnect) { - disconnect(); - initTts(); - } - return errorResult; } } } diff --git a/core/java/android/speech/tts/TextToSpeechService.java b/core/java/android/speech/tts/TextToSpeechService.java index 4c1a0afcdf1d6..d124e68a253e6 100644 --- a/core/java/android/speech/tts/TextToSpeechService.java +++ b/core/java/android/speech/tts/TextToSpeechService.java @@ -549,7 +549,7 @@ public String getText() { @Override public boolean isValid() { if (mText == null) { - Log.wtf(TAG, "Got null text"); + Log.e(TAG, "null synthesis text"); return false; } if (mText.length() >= MAX_SPEECH_ITEM_CHAR_LENGTH) { @@ -640,14 +640,6 @@ public SynthesisToFileSpeechItem(Object callerIdentity, int callerUid, int calle mFile = file; } - @Override - public boolean isValid() { - if (!super.isValid()) { - return false; - } - return checkFile(mFile); - } - @Override protected AbstractSynthesisCallback createSynthesisCallback() { return new FileSynthesisCallback(mFile); @@ -664,33 +656,6 @@ protected int playImpl() { } return status; } - - /** - * Checks that the given file can be used for synthesis output. - */ - private boolean checkFile(File file) { - try { - if (file.exists()) { - Log.v(TAG, "File " + file + " exists, deleting."); - if (!file.delete()) { - Log.e(TAG, "Failed to delete " + file); - return false; - } - } - if (!file.createNewFile()) { - Log.e(TAG, "Can't create file " + file); - return false; - } - if (!file.delete()) { - Log.e(TAG, "Failed to delete " + file); - return false; - } - return true; - } catch (IOException e) { - Log.e(TAG, "Can't use " + file + " due to exception " + e); - return false; - } - } } private class AudioSpeechItem extends SpeechItem { diff --git a/core/java/android/test/AndroidTestCase.java b/core/java/android/test/AndroidTestCase.java index 1015506ba227a..0c8cbe639615c 100644 --- a/core/java/android/test/AndroidTestCase.java +++ b/core/java/android/test/AndroidTestCase.java @@ -135,7 +135,8 @@ public void assertWritingContentUriRequiresPermission(Uri uri, String permission fail("expected SecurityException requiring " + permission); } catch (SecurityException expected) { assertNotNull("security exception's error message.", expected.getMessage()); - assertTrue("error message should contain " + permission + ".", + assertTrue("error message should contain \"" + permission + "\". Got: \"" + + expected.getMessage() + "\".", expected.getMessage().contains(permission)); } } diff --git a/core/java/android/text/Html.java b/core/java/android/text/Html.java index 35e2e4adcb4ac..1aab9114db851 100644 --- a/core/java/android/text/Html.java +++ b/core/java/android/text/Html.java @@ -221,10 +221,10 @@ private static String getOpenParaTagWithDirection(Spanned text, int start, int e false /* no info */); switch(paraDir) { case Layout.DIR_RIGHT_TO_LEFT: - return "

        "; + return "

        "; case Layout.DIR_LEFT_TO_RIGHT: default: - return "

        "; + return "

        "; } } diff --git a/core/java/android/text/Layout.java b/core/java/android/text/Layout.java index d2bed489e23dd..123accae4f6e3 100644 --- a/core/java/android/text/Layout.java +++ b/core/java/android/text/Layout.java @@ -475,10 +475,14 @@ private int getLineStartPos(int line, int left, int right) { Alignment align = getParagraphAlignment(line); int dir = getParagraphDirection(line); - int x; if (align == Alignment.ALIGN_LEFT) { - x = left; - } else if (align == Alignment.ALIGN_NORMAL) { + align = (dir == DIR_LEFT_TO_RIGHT) ? Alignment.ALIGN_NORMAL : Alignment.ALIGN_OPPOSITE; + } else if (align == Alignment.ALIGN_RIGHT) { + align = (dir == DIR_LEFT_TO_RIGHT) ? Alignment.ALIGN_OPPOSITE : Alignment.ALIGN_NORMAL; + } + + int x; + if (align == Alignment.ALIGN_NORMAL) { if (dir == DIR_LEFT_TO_RIGHT) { x = left; } else { @@ -498,12 +502,11 @@ private int getLineStartPos(int line, int left, int right) { } } int max = (int)getLineExtent(line, tabStops, false); - if (align == Alignment.ALIGN_RIGHT) { - x = right - max; - } else if (align == Alignment.ALIGN_OPPOSITE) { + if (align == Alignment.ALIGN_OPPOSITE) { if (dir == DIR_LEFT_TO_RIGHT) { x = right - max; } else { + // max is negative here x = left - max; } } else { // Alignment.ALIGN_CENTER diff --git a/core/java/android/text/Spanned.java b/core/java/android/text/Spanned.java index 2b73763186dc3..b4622e0cf9049 100644 --- a/core/java/android/text/Spanned.java +++ b/core/java/android/text/Spanned.java @@ -30,8 +30,19 @@ public interface Spanned * of spans. * * MARK and POINT are conceptually located between two adjacent characters. - * A MARK is "attached" to the character on the left hand side, while a POINT - * tends to stick to the character on the right hand side. + * A MARK is "attached" to the character before, while a POINT will stick to the character + * after. The insertion cursor is conceptually located between the MARK and the POINT. + * + * As a result, inserting a new character between a MARK and a POINT will leave the MARK + * unchanged, while the POINT will be shifted, now located after the inserted character and + * still glued to the same character after it. + * + * Depending on whether the insertion happens at the beginning or the end of a span, the span + * will hence be expanded to include the new character (when the span is using a MARK at + * its beginning or a POINT at its end) or it will be excluded. + * + * Note that before and after here refer to offsets in the String, which are + * independent from the visual representation of the text (left-to-right or right-to-left). */ public static final int SPAN_POINT_MARK_MASK = 0x33; diff --git a/core/java/android/text/StaticLayout.java b/core/java/android/text/StaticLayout.java index 6a619af2cba40..90512853ca450 100644 --- a/core/java/android/text/StaticLayout.java +++ b/core/java/android/text/StaticLayout.java @@ -150,8 +150,8 @@ public StaticLayout(CharSequence source, int bufstart, int bufend, mColumns = COLUMNS_ELLIPSIZE; mLines = new int[ArrayUtils.idealIntArraySize(2 * mColumns)]; - mLineDirections = new Directions[ - ArrayUtils.idealIntArraySize(2 * mColumns)]; + mLineDirections = new Directions[ArrayUtils.idealIntArraySize(2 * mColumns)]; + // FIXME This is never recycled mMeasured = MeasuredText.obtain(); } @@ -340,7 +340,9 @@ public StaticLayout(CharSequence source, int bufstart, int bufend, w += widths[j - paraStart]; } - if (w <= width) { + boolean isSpaceOrTab = c == CHAR_SPACE || c == CHAR_TAB; + + if (w <= width || isSpaceOrTab) { fitWidth = w; fit = j + 1; @@ -353,30 +355,17 @@ public StaticLayout(CharSequence source, int bufstart, int bufend, if (fmBottom > fitBottom) fitBottom = fmBottom; - /* - * From the Unicode Line Breaking Algorithm: - * (at least approximately) - * - * .,:; are class IS: breakpoints - * except when adjacent to digits - * / is class SY: a breakpoint - * except when followed by a digit. - * - is class HY: a breakpoint - * except when followed by a digit. - * - * Ideographs are class ID: breakpoints when adjacent, - * except for NS (non-starters), which can be broken - * after but not before. - */ - if (c == CHAR_SPACE || c == CHAR_TAB || - ((c == CHAR_DOT || c == CHAR_COMMA || - c == CHAR_COLON || c == CHAR_SEMICOLON) && - (j - 1 < here || !Character.isDigit(chs[j - 1 - paraStart])) && - (j + 1 >= spanEnd || !Character.isDigit(chs[j + 1 - paraStart]))) || - ((c == CHAR_SLASH || c == CHAR_HYPHEN) && - (j + 1 >= spanEnd || !Character.isDigit(chs[j + 1 - paraStart]))) || - (c >= CHAR_FIRST_CJK && isIdeographic(c, true) && - j + 1 < spanEnd && isIdeographic(chs[j + 1 - paraStart], false))) { + // From the Unicode Line Breaking Algorithm (at least approximately) + boolean isLineBreak = isSpaceOrTab || + // / is class SY and - is class HY, except when followed by a digit + ((c == CHAR_SLASH || c == CHAR_HYPHEN) && + (j + 1 >= spanEnd || !Character.isDigit(chs[j + 1 - paraStart]))) || + // Ideographs are class ID: breakpoints when adjacent, except for NS + // (non-starters), which can be broken after but not before + (c >= CHAR_FIRST_CJK && isIdeographic(c, true) && + j + 1 < spanEnd && isIdeographic(chs[j + 1 - paraStart], false)); + + if (isLineBreak) { okWidth = w; ok = j + 1; @@ -396,13 +385,6 @@ public StaticLayout(CharSequence source, int bufstart, int bufend, float currentTextWidth; if (ok != here) { - // If it is a space that makes the length exceed width, cut here - if (c == CHAR_SPACE) ok = j + 1; - - while (ok < spanEnd && chs[ok - paraStart] == CHAR_SPACE) { - ok++; - } - endPos = ok; above = okAscent; below = okDescent; @@ -450,10 +432,10 @@ public StaticLayout(CharSequence source, int bufstart, int bufend, spanEnd = here; break; } - } - // FIXME This should be moved in the above else block which changes mLineCount - if (mLineCount >= mMaximumVisibleLineCount) { - break; + + if (mLineCount >= mMaximumVisibleLineCount) { + break; + } } } } @@ -972,10 +954,6 @@ void finish() { private static final char CHAR_NEW_LINE = '\n'; private static final char CHAR_TAB = '\t'; private static final char CHAR_SPACE = ' '; - private static final char CHAR_DOT = '.'; - private static final char CHAR_COMMA = ','; - private static final char CHAR_COLON = ':'; - private static final char CHAR_SEMICOLON = ';'; private static final char CHAR_SLASH = '/'; private static final char CHAR_HYPHEN = '-'; diff --git a/core/java/android/text/TextDirectionHeuristics.java b/core/java/android/text/TextDirectionHeuristics.java index be2840b8665d5..df8c4c665f1e6 100644 --- a/core/java/android/text/TextDirectionHeuristics.java +++ b/core/java/android/text/TextDirectionHeuristics.java @@ -17,11 +17,11 @@ package android.text; -import android.util.LocaleUtil; import android.view.View; /** * Some objects that implement TextDirectionHeuristic. + * * @hide */ public class TextDirectionHeuristics { @@ -241,7 +241,7 @@ public TextDirectionHeuristicLocale() { @Override protected boolean defaultIsRtl() { - final int dir = LocaleUtil.getLayoutDirectionFromLocale(java.util.Locale.getDefault()); + final int dir = TextUtils.getLayoutDirectionFromLocale(java.util.Locale.getDefault()); return (dir == View.LAYOUT_DIRECTION_RTL); } diff --git a/core/java/android/text/TextLine.java b/core/java/android/text/TextLine.java index 0d2835a98dbe7..1fecf81d5a4fe 100644 --- a/core/java/android/text/TextLine.java +++ b/core/java/android/text/TextLine.java @@ -939,27 +939,22 @@ private float handleRun(int start, int measureLimit, continue; } - if (c == null) { - x += handleText(wp, i, mlimit, i, inext, runIsRtl, c, x, top, - y, bottom, fmi, needWidth || mlimit < measureLimit); - } else { - for (int j = i, jnext; j < mlimit; j = jnext) { - jnext = mCharacterStyleSpanSet.getNextTransition(mStart + j, mStart + mlimit) - - mStart; - - wp.set(mPaint); - for (int k = 0; k < mCharacterStyleSpanSet.numberOfSpans; k++) { - // Intentionally using >= and <= as explained above - if ((mCharacterStyleSpanSet.spanStarts[k] >= mStart + jnext) || - (mCharacterStyleSpanSet.spanEnds[k] <= mStart + j)) continue; - - CharacterStyle span = mCharacterStyleSpanSet.spans[k]; - span.updateDrawState(wp); - } + for (int j = i, jnext; j < mlimit; j = jnext) { + jnext = mCharacterStyleSpanSet.getNextTransition(mStart + j, mStart + mlimit) - + mStart; + + wp.set(mPaint); + for (int k = 0; k < mCharacterStyleSpanSet.numberOfSpans; k++) { + // Intentionally using >= and <= as explained above + if ((mCharacterStyleSpanSet.spanStarts[k] >= mStart + jnext) || + (mCharacterStyleSpanSet.spanEnds[k] <= mStart + j)) continue; - x += handleText(wp, j, jnext, i, inext, runIsRtl, c, x, - top, y, bottom, fmi, needWidth || jnext < measureLimit); + CharacterStyle span = mCharacterStyleSpanSet.spans[k]; + span.updateDrawState(wp); } + + x += handleText(wp, j, jnext, i, inext, runIsRtl, c, x, + top, y, bottom, fmi, needWidth || jnext < measureLimit); } } diff --git a/core/java/android/text/TextUtils.java b/core/java/android/text/TextUtils.java index 270624cbfb179..1508d10ea6afe 100644 --- a/core/java/android/text/TextUtils.java +++ b/core/java/android/text/TextUtils.java @@ -27,6 +27,7 @@ import android.text.style.EasyEditSpan; import android.text.style.ForegroundColorSpan; import android.text.style.LeadingMarginSpan; +import android.text.style.LocaleSpan; import android.text.style.MetricAffectingSpan; import android.text.style.QuoteSpan; import android.text.style.RelativeSizeSpan; @@ -45,11 +46,14 @@ import android.text.style.UnderlineSpan; import android.util.Printer; +import android.view.View; import com.android.internal.R; import com.android.internal.util.ArrayUtils; +import libcore.icu.ICU; import java.lang.reflect.Array; import java.util.Iterator; +import java.util.Locale; import java.util.regex.Pattern; public class TextUtils { @@ -587,6 +591,8 @@ public void getChars(int start, int end, char[] dest, int destoff) { public static final int SUGGESTION_RANGE_SPAN = 21; /** @hide */ public static final int EASY_EDIT_SPAN = 22; + /** @hide */ + public static final int LOCALE_SPAN = 23; /** * Flatten a CharSequence and whatever styles can be copied across processes @@ -754,6 +760,10 @@ public CharSequence createFromParcel(Parcel p) { readSpan(p, sp, new EasyEditSpan()); break; + case LOCALE_SPAN: + readSpan(p, sp, new LocaleSpan(p)); + break; + default: throw new RuntimeException("bogus span encoding " + kind); } @@ -1042,9 +1052,14 @@ public static CharSequence ellipsize(CharSequence text, float avail, TruncateAt where, boolean preserveLength, EllipsizeCallback callback) { + + final String ellipsis = (where == TruncateAt.END_SMALL) ? + Resources.getSystem().getString(R.string.ellipsis_two_dots) : + Resources.getSystem().getString(R.string.ellipsis); + return ellipsize(text, paint, avail, where, preserveLength, callback, TextDirectionHeuristics.FIRSTSTRONG_LTR, - (where == TruncateAt.END_SMALL) ? ELLIPSIS_TWO_DOTS : ELLIPSIS_NORMAL); + ellipsis); } /** @@ -1694,15 +1709,64 @@ public static int unpackRangeEndFromLong(long range) { return (int) (range & 0x00000000FFFFFFFFL); } + /** + * Return the layout direction for a given Locale + * + * @param locale the Locale for which we want the layout direction. Can be null. + * @return the layout direction. This may be one of: + * {@link android.view.View#LAYOUT_DIRECTION_LTR} or + * {@link android.view.View#LAYOUT_DIRECTION_RTL}. + * + * Be careful: this code will need to be updated when vertical scripts will be supported + */ + public static int getLayoutDirectionFromLocale(Locale locale) { + if (locale != null && !locale.equals(Locale.ROOT)) { + final String scriptSubtag = ICU.getScript(ICU.addLikelySubtags(locale.toString())); + if (scriptSubtag == null) return getLayoutDirectionFromFirstChar(locale); + + if (scriptSubtag.equalsIgnoreCase(ARAB_SCRIPT_SUBTAG) || + scriptSubtag.equalsIgnoreCase(HEBR_SCRIPT_SUBTAG)) { + return View.LAYOUT_DIRECTION_RTL; + } + } + + return View.LAYOUT_DIRECTION_LTR; + } + + /** + * Fallback algorithm to detect the locale direction. Rely on the fist char of the + * localized locale name. This will not work if the localized locale name is in English + * (this is the case for ICU 4.4 and "Urdu" script) + * + * @param locale + * @return the layout direction. This may be one of: + * {@link View#LAYOUT_DIRECTION_LTR} or + * {@link View#LAYOUT_DIRECTION_RTL}. + * + * Be careful: this code will need to be updated when vertical scripts will be supported + * + * @hide + */ + private static int getLayoutDirectionFromFirstChar(Locale locale) { + switch(Character.getDirectionality(locale.getDisplayName(locale).charAt(0))) { + case Character.DIRECTIONALITY_RIGHT_TO_LEFT: + case Character.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC: + return View.LAYOUT_DIRECTION_RTL; + + case Character.DIRECTIONALITY_LEFT_TO_RIGHT: + default: + return View.LAYOUT_DIRECTION_LTR; + } + } + private static Object sLock = new Object(); + private static char[] sTemp = null; private static String[] EMPTY_STRING_ARRAY = new String[]{}; private static final char ZWNBS_CHAR = '\uFEFF'; - private static final String ELLIPSIS_NORMAL = Resources.getSystem().getString( - R.string.ellipsis); - private static final String ELLIPSIS_TWO_DOTS = Resources.getSystem().getString( - R.string.ellipsis_two_dots); + private static String ARAB_SCRIPT_SUBTAG = "Arab"; + private static String HEBR_SCRIPT_SUBTAG = "Hebr"; } diff --git a/core/java/android/text/format/DateFormat.java b/core/java/android/text/format/DateFormat.java index 524f9418c00b8..3c984b51fa4d1 100644 --- a/core/java/android/text/format/DateFormat.java +++ b/core/java/android/text/format/DateFormat.java @@ -35,10 +35,18 @@ Utility class for producing strings with formatted date/time.

        - This class takes as inputs a format string and a representation of a date/time. - The format string controls how the output is generated. + Most callers should avoid supplying their own format strings to this + class' {@code format} methods and rely on the correctly localized ones + supplied by the system. This class' factory methods return + appropriately-localized {@link java.text.DateFormat} instances, suitable + for both formatting and parsing dates. For the canonical documentation + of format strings, see {@link java.text.SimpleDateFormat}.

        + The format methods in this class takes as inputs a format string and a representation of a date/time. + The format string controls how the output is generated. + This class only supports a subset of the full Unicode specification. + Use {@link java.text.SimpleDateFormat} if you need more. Formatting characters may be repeated in order to get more detailed representations of that field. For instance, the format character 'M' is used to represent the month. Depending on how many times that character is repeated @@ -152,7 +160,8 @@ public class DateFormat { public static final char MINUTE = 'm'; /** - This designator indicates the month of the year + This designator indicates the month of the year. See also + {@link #STANDALONE_MONTH}. Examples for September: M -> 9 @@ -162,6 +171,14 @@ public class DateFormat { */ public static final char MONTH = 'M'; + /** + This designator indicates the standalone month of the year, + necessary in some format strings in some languages. For + example, Russian distinguishes between the "June" in + "June" and that in "June 2010". + */ + public static final char STANDALONE_MONTH = 'L'; + /** This designator indicates the seconds of the minute. @@ -232,12 +249,13 @@ public static boolean is24HourFormat(Context context) { synchronized (sLocaleLock) { sIs24HourLocale = locale; - sIs24Hour = !value.equals("12"); + sIs24Hour = value.equals("24"); } + + return sIs24Hour; } - boolean b24 = !(value == null || value.equals("12")); - return b24; + return value.equals("24"); } /** @@ -246,7 +264,7 @@ public static boolean is24HourFormat(Context context) { * @param context the application context * @return the {@link java.text.DateFormat} object that properly formats the time. */ - public static final java.text.DateFormat getTimeFormat(Context context) { + public static java.text.DateFormat getTimeFormat(Context context) { boolean b24 = is24HourFormat(context); int res; @@ -266,7 +284,7 @@ public static final java.text.DateFormat getTimeFormat(Context context) { * @param context the application context * @return the {@link java.text.DateFormat} object that properly formats the date. */ - public static final java.text.DateFormat getDateFormat(Context context) { + public static java.text.DateFormat getDateFormat(Context context) { String value = Settings.System.getString(context.getContentResolver(), Settings.System.DATE_FORMAT); @@ -336,7 +354,7 @@ private static String getDateFormatStringForSetting(Context context, String valu * @param context the application context * @return the {@link java.text.DateFormat} object that formats the date in long form. */ - public static final java.text.DateFormat getLongDateFormat(Context context) { + public static java.text.DateFormat getLongDateFormat(Context context) { return java.text.DateFormat.getDateInstance(java.text.DateFormat.LONG); } @@ -346,7 +364,7 @@ public static final java.text.DateFormat getLongDateFormat(Context context) { * @param context the application context * @return the {@link java.text.DateFormat} object that formats the date in long form. */ - public static final java.text.DateFormat getMediumDateFormat(Context context) { + public static java.text.DateFormat getMediumDateFormat(Context context) { return java.text.DateFormat.getDateInstance(java.text.DateFormat.MEDIUM); } @@ -359,7 +377,7 @@ public static final java.text.DateFormat getMediumDateFormat(Context context) { * not just the day, month, and year, and not necessarily in the same * order returned here. */ - public static final char[] getDateFormatOrder(Context context) { + public static char[] getDateFormatOrder(Context context) { char[] order = new char[] {DATE, MONTH, YEAR}; String value = getDateFormatString(context); int index = 0; @@ -374,7 +392,7 @@ public static final char[] getDateFormatOrder(Context context) { index++; } - if (!foundMonth && (c == MONTH)) { + if (!foundMonth && (c == MONTH || c == STANDALONE_MONTH)) { foundMonth = true; order[index] = MONTH; index++; @@ -403,7 +421,7 @@ private static String getDateFormatString(Context context) { * @param inTimeInMillis in milliseconds since Jan 1, 1970 GMT * @return a {@link CharSequence} containing the requested text */ - public static final CharSequence format(CharSequence inFormat, long inTimeInMillis) { + public static CharSequence format(CharSequence inFormat, long inTimeInMillis) { return format(inFormat, new Date(inTimeInMillis)); } @@ -414,7 +432,7 @@ public static final CharSequence format(CharSequence inFormat, long inTimeInMill * @param inDate the date to format * @return a {@link CharSequence} containing the requested text */ - public static final CharSequence format(CharSequence inFormat, Date inDate) { + public static CharSequence format(CharSequence inFormat, Date inDate) { Calendar c = new GregorianCalendar(); c.setTime(inDate); @@ -422,6 +440,68 @@ public static final CharSequence format(CharSequence inFormat, Date inDate) { return format(inFormat, c); } + /** + * Indicates whether the specified format string contains seconds. + * + * Always returns false if the input format is null. + * + * @param inFormat the format string, as described in {@link android.text.format.DateFormat} + * + * @return true if the format string contains {@link #SECONDS}, false otherwise + * + * @hide + */ + public static boolean hasSeconds(CharSequence inFormat) { + if (inFormat == null) return false; + + final int length = inFormat.length(); + + int c; + int count; + + for (int i = 0; i < length; i += count) { + count = 1; + c = inFormat.charAt(i); + + if (c == QUOTE) { + count = skipQuotedText(inFormat, i, length); + } else if (c == SECONDS) { + return true; + } + } + + return false; + } + + private static int skipQuotedText(CharSequence s, int i, int len) { + if (i + 1 < len && s.charAt(i + 1) == QUOTE) { + return 2; + } + + int count = 1; + // skip leading quote + i++; + + while (i < len) { + char c = s.charAt(i); + + if (c == QUOTE) { + count++; + // QUOTEQUOTE -> QUOTE + if (i + 1 < len && s.charAt(i + 1) == QUOTE) { + i++; + } else { + break; + } + } else { + i++; + count++; + } + } + + return count; + } + /** * Given a format string and a {@link java.util.Calendar} object, returns a CharSequence * containing the requested date. @@ -429,7 +509,7 @@ public static final CharSequence format(CharSequence inFormat, Date inDate) { * @param inDate the date to format * @return a {@link CharSequence} containing the requested text */ - public static final CharSequence format(CharSequence inFormat, Calendar inDate) { + public static CharSequence format(CharSequence inFormat, Calendar inDate) { SpannableStringBuilder s = new SpannableStringBuilder(inFormat); int c; int count; @@ -494,9 +574,10 @@ public static final CharSequence format(CharSequence inFormat, Calendar inDate) break; case MONTH: - replacement = getMonthString(inDate, count); + case STANDALONE_MONTH: + replacement = getMonthString(inDate, count, c); break; - + case SECONDS: replacement = zeroPad(inDate.get(Calendar.SECOND), count); break; @@ -527,20 +608,25 @@ public static final CharSequence format(CharSequence inFormat, Calendar inDate) return s.toString(); } - private static final String getMonthString(Calendar inDate, int count) { + private static String getMonthString(Calendar inDate, int count, int kind) { + boolean standalone = (kind == STANDALONE_MONTH); int month = inDate.get(Calendar.MONTH); - if (count >= 4) - return DateUtils.getMonthString(month, DateUtils.LENGTH_LONG); - else if (count == 3) - return DateUtils.getMonthString(month, DateUtils.LENGTH_MEDIUM); - else { + if (count >= 4) { + return standalone + ? DateUtils.getStandaloneMonthString(month, DateUtils.LENGTH_LONG) + : DateUtils.getMonthString(month, DateUtils.LENGTH_LONG); + } else if (count == 3) { + return standalone + ? DateUtils.getStandaloneMonthString(month, DateUtils.LENGTH_MEDIUM) + : DateUtils.getMonthString(month, DateUtils.LENGTH_MEDIUM); + } else { // Calendar.JANUARY == 0, so add 1 to month. return zeroPad(month+1, count); } } - private static final String getTimeZoneString(Calendar inDate, int count) { + private static String getTimeZoneString(Calendar inDate, int count) { TimeZone tz = inDate.getTimeZone(); if (count < 2) { // FIXME: shouldn't this be <= 2 ? @@ -553,7 +639,7 @@ private static final String getTimeZoneString(Calendar inDate, int count) { } } - private static final String formatZoneOffset(int offset, int count) { + private static String formatZoneOffset(int offset, int count) { offset /= 1000; // milliseconds to seconds StringBuilder tb = new StringBuilder(); @@ -572,12 +658,13 @@ private static final String formatZoneOffset(int offset, int count) { return tb.toString(); } - private static final String getYearString(Calendar inDate, int count) { + private static String getYearString(Calendar inDate, int count) { int year = inDate.get(Calendar.YEAR); - return (count <= 2) ? zeroPad(year % 100, 2) : String.valueOf(year); + return (count <= 2) ? zeroPad(year % 100, 2) + : String.format(Locale.getDefault(), "%d", year); } - private static final int appendQuotedText(SpannableStringBuilder s, int i, int len) { + private static int appendQuotedText(SpannableStringBuilder s, int i, int len) { if (i + 1 < len && s.charAt(i + 1) == QUOTE) { s.delete(i, i + 1); return 1; @@ -614,18 +701,7 @@ private static final int appendQuotedText(SpannableStringBuilder s, int i, int l return count; } - private static final String zeroPad(int inValue, int inMinDigits) { - String val = String.valueOf(inValue); - - if (val.length() < inMinDigits) { - char[] buf = new char[inMinDigits]; - - for (int i = 0; i < inMinDigits; i++) - buf[i] = '0'; - - val.getChars(0, val.length(), buf, inMinDigits - val.length()); - val = new String(buf); - } - return val; + private static String zeroPad(int inValue, int inMinDigits) { + return String.format(Locale.getDefault(), "%0" + inMinDigits + "d", inValue); } } diff --git a/core/java/android/text/format/DateUtils.java b/core/java/android/text/format/DateUtils.java index da103111a8ffb..1060bd84d1f6c 100644 --- a/core/java/android/text/format/DateUtils.java +++ b/core/java/android/text/format/DateUtils.java @@ -29,6 +29,8 @@ import java.util.Locale; import java.util.TimeZone; +import libcore.icu.LocaleData; + /** * This class contains various date-related utilities for creating text for things like * elapsed time and date ranges, strings for days of the week and months, and AM/PM text etc. @@ -36,102 +38,6 @@ public class DateUtils { private static final Object sLock = new Object(); - private static final int[] sDaysLong = new int[] { - com.android.internal.R.string.day_of_week_long_sunday, - com.android.internal.R.string.day_of_week_long_monday, - com.android.internal.R.string.day_of_week_long_tuesday, - com.android.internal.R.string.day_of_week_long_wednesday, - com.android.internal.R.string.day_of_week_long_thursday, - com.android.internal.R.string.day_of_week_long_friday, - com.android.internal.R.string.day_of_week_long_saturday, - }; - private static final int[] sDaysMedium = new int[] { - com.android.internal.R.string.day_of_week_medium_sunday, - com.android.internal.R.string.day_of_week_medium_monday, - com.android.internal.R.string.day_of_week_medium_tuesday, - com.android.internal.R.string.day_of_week_medium_wednesday, - com.android.internal.R.string.day_of_week_medium_thursday, - com.android.internal.R.string.day_of_week_medium_friday, - com.android.internal.R.string.day_of_week_medium_saturday, - }; - private static final int[] sDaysShort = new int[] { - com.android.internal.R.string.day_of_week_short_sunday, - com.android.internal.R.string.day_of_week_short_monday, - com.android.internal.R.string.day_of_week_short_tuesday, - com.android.internal.R.string.day_of_week_short_wednesday, - com.android.internal.R.string.day_of_week_short_thursday, - com.android.internal.R.string.day_of_week_short_friday, - com.android.internal.R.string.day_of_week_short_saturday, - }; - private static final int[] sDaysShortest = new int[] { - com.android.internal.R.string.day_of_week_shortest_sunday, - com.android.internal.R.string.day_of_week_shortest_monday, - com.android.internal.R.string.day_of_week_shortest_tuesday, - com.android.internal.R.string.day_of_week_shortest_wednesday, - com.android.internal.R.string.day_of_week_shortest_thursday, - com.android.internal.R.string.day_of_week_shortest_friday, - com.android.internal.R.string.day_of_week_shortest_saturday, - }; - private static final int[] sMonthsStandaloneLong = new int [] { - com.android.internal.R.string.month_long_standalone_january, - com.android.internal.R.string.month_long_standalone_february, - com.android.internal.R.string.month_long_standalone_march, - com.android.internal.R.string.month_long_standalone_april, - com.android.internal.R.string.month_long_standalone_may, - com.android.internal.R.string.month_long_standalone_june, - com.android.internal.R.string.month_long_standalone_july, - com.android.internal.R.string.month_long_standalone_august, - com.android.internal.R.string.month_long_standalone_september, - com.android.internal.R.string.month_long_standalone_october, - com.android.internal.R.string.month_long_standalone_november, - com.android.internal.R.string.month_long_standalone_december, - }; - private static final int[] sMonthsLong = new int [] { - com.android.internal.R.string.month_long_january, - com.android.internal.R.string.month_long_february, - com.android.internal.R.string.month_long_march, - com.android.internal.R.string.month_long_april, - com.android.internal.R.string.month_long_may, - com.android.internal.R.string.month_long_june, - com.android.internal.R.string.month_long_july, - com.android.internal.R.string.month_long_august, - com.android.internal.R.string.month_long_september, - com.android.internal.R.string.month_long_october, - com.android.internal.R.string.month_long_november, - com.android.internal.R.string.month_long_december, - }; - private static final int[] sMonthsMedium = new int [] { - com.android.internal.R.string.month_medium_january, - com.android.internal.R.string.month_medium_february, - com.android.internal.R.string.month_medium_march, - com.android.internal.R.string.month_medium_april, - com.android.internal.R.string.month_medium_may, - com.android.internal.R.string.month_medium_june, - com.android.internal.R.string.month_medium_july, - com.android.internal.R.string.month_medium_august, - com.android.internal.R.string.month_medium_september, - com.android.internal.R.string.month_medium_october, - com.android.internal.R.string.month_medium_november, - com.android.internal.R.string.month_medium_december, - }; - private static final int[] sMonthsShortest = new int [] { - com.android.internal.R.string.month_shortest_january, - com.android.internal.R.string.month_shortest_february, - com.android.internal.R.string.month_shortest_march, - com.android.internal.R.string.month_shortest_april, - com.android.internal.R.string.month_shortest_may, - com.android.internal.R.string.month_shortest_june, - com.android.internal.R.string.month_shortest_july, - com.android.internal.R.string.month_shortest_august, - com.android.internal.R.string.month_shortest_september, - com.android.internal.R.string.month_shortest_october, - com.android.internal.R.string.month_shortest_november, - com.android.internal.R.string.month_shortest_december, - }; - private static final int[] sAmPm = new int[] { - com.android.internal.R.string.am, - com.android.internal.R.string.pm, - }; private static Configuration sLastConfig; private static java.text.DateFormat sStatusTimeFormat; private static String sElapsedFormatMMSS; @@ -139,7 +45,6 @@ public class DateUtils private static final String FAST_FORMAT_HMMSS = "%1$d:%2$02d:%3$02d"; private static final String FAST_FORMAT_MMSS = "%1$02d:%2$02d"; - private static final char TIME_PADDING = '0'; private static final char TIME_SEPARATOR = ':'; @@ -161,12 +66,17 @@ public class DateUtils public static final int FORMAT_NO_YEAR = 0x00008; public static final int FORMAT_SHOW_DATE = 0x00010; public static final int FORMAT_NO_MONTH_DAY = 0x00020; + @Deprecated public static final int FORMAT_12HOUR = 0x00040; + @Deprecated public static final int FORMAT_24HOUR = 0x00080; + @Deprecated public static final int FORMAT_CAP_AMPM = 0x00100; public static final int FORMAT_NO_NOON = 0x00200; + @Deprecated public static final int FORMAT_CAP_NOON = 0x00400; public static final int FORMAT_NO_MIDNIGHT = 0x00800; + @Deprecated public static final int FORMAT_CAP_MIDNIGHT = 0x01000; /** * @deprecated Use @@ -181,19 +91,25 @@ public class DateUtils public static final int FORMAT_NUMERIC_DATE = 0x20000; public static final int FORMAT_ABBREV_RELATIVE = 0x40000; public static final int FORMAT_ABBREV_ALL = 0x80000; + @Deprecated public static final int FORMAT_CAP_NOON_MIDNIGHT = (FORMAT_CAP_NOON | FORMAT_CAP_MIDNIGHT); + @Deprecated public static final int FORMAT_NO_NOON_MIDNIGHT = (FORMAT_NO_NOON | FORMAT_NO_MIDNIGHT); // Date and time format strings that are constant and don't need to be // translated. /** * This is not actually the preferred 24-hour date format in all locales. + * @deprecated use {@link java.text.SimpleDateFormat} instead. */ + @Deprecated public static final String HOUR_MINUTE_24 = "%H:%M"; public static final String MONTH_FORMAT = "%B"; /** * This is not actually a useful month name in all locales. + * @deprecated use {@link java.text.SimpleDateFormat} instead. */ + @Deprecated public static final String ABBREV_MONTH_FORMAT = "%b"; public static final String NUMERIC_MONTH_FORMAT = "%m"; public static final String MONTH_DAY_FORMAT = "%-d"; @@ -207,6 +123,7 @@ public class DateUtils // The index is constructed from a bit-wise OR of the boolean values: // {showTime, showYear, showWeekDay}. For example, if showYear and // showWeekDay are both true, then the index would be 3. + /** @deprecated do not use. */ public static final int sameYearTable[] = { com.android.internal.R.string.same_year_md1_md2, com.android.internal.R.string.same_year_wday1_md1_wday2_md2, @@ -233,6 +150,7 @@ public class DateUtils // The index is constructed from a bit-wise OR of the boolean values: // {showTime, showYear, showWeekDay}. For example, if showYear and // showWeekDay are both true, then the index would be 3. + /** @deprecated do not use. */ public static final int sameMonthTable[] = { com.android.internal.R.string.same_month_md1_md2, com.android.internal.R.string.same_month_wday1_md1_wday2_md2, @@ -259,7 +177,9 @@ public class DateUtils * * @more

        * e.g. "Sunday" or "January" + * @deprecated use {@link java.text.SimpleDateFormat} instead. */ + @Deprecated public static final int LENGTH_LONG = 10; /** @@ -268,7 +188,9 @@ public class DateUtils * * @more

        * e.g. "Sun" or "Jan" + * @deprecated use {@link java.text.SimpleDateFormat} instead. */ + @Deprecated public static final int LENGTH_MEDIUM = 20; /** @@ -278,14 +200,18 @@ public class DateUtils *

        e.g. "Su" or "Jan" *

        In most languages, the results returned for LENGTH_SHORT will be the same as * the results returned for {@link #LENGTH_MEDIUM}. + * @deprecated use {@link java.text.SimpleDateFormat} instead. */ + @Deprecated public static final int LENGTH_SHORT = 30; /** * Request an even shorter abbreviated version of the name. * Do not use this. Currently this will always return the same result * as {@link #LENGTH_SHORT}. + * @deprecated use {@link java.text.SimpleDateFormat} instead. */ + @Deprecated public static final int LENGTH_SHORTER = 40; /** @@ -295,7 +221,9 @@ public class DateUtils *

        e.g. "S", "T", "T" or "J" *

        In some languages, the results returned for LENGTH_SHORTEST will be the same as * the results returned for {@link #LENGTH_SHORT}. + * @deprecated use {@link java.text.SimpleDateFormat} instead. */ + @Deprecated public static final int LENGTH_SHORTEST = 50; /** @@ -309,20 +237,21 @@ public class DateUtils * Undefined lengths will return {@link #LENGTH_MEDIUM} * but may return something different in the future. * @throws IndexOutOfBoundsException if the dayOfWeek is out of bounds. + * @deprecated use {@link java.text.SimpleDateFormat} instead. */ + @Deprecated public static String getDayOfWeekString(int dayOfWeek, int abbrev) { - int[] list; + LocaleData d = LocaleData.get(Locale.getDefault()); + String[] names; switch (abbrev) { - case LENGTH_LONG: list = sDaysLong; break; - case LENGTH_MEDIUM: list = sDaysMedium; break; - case LENGTH_SHORT: list = sDaysShort; break; - case LENGTH_SHORTER: list = sDaysShort; break; - case LENGTH_SHORTEST: list = sDaysShortest; break; - default: list = sDaysMedium; break; + case LENGTH_LONG: names = d.longWeekdayNames; break; + case LENGTH_MEDIUM: names = d.shortWeekdayNames; break; + case LENGTH_SHORT: names = d.shortWeekdayNames; break; // TODO + case LENGTH_SHORTER: names = d.shortWeekdayNames; break; // TODO + case LENGTH_SHORTEST: names = d.tinyWeekdayNames; break; + default: names = d.shortWeekdayNames; break; } - - Resources r = Resources.getSystem(); - return r.getString(list[dayOfWeek - Calendar.SUNDAY]); + return names[dayOfWeek]; } /** @@ -330,10 +259,11 @@ public static String getDayOfWeekString(int dayOfWeek, int abbrev) { * @param ampm Either {@link Calendar#AM Calendar.AM} or {@link Calendar#PM Calendar.PM}. * @throws IndexOutOfBoundsException if the ampm is out of bounds. * @return Localized version of "AM" or "PM". + * @deprecated use {@link java.text.SimpleDateFormat} instead. */ + @Deprecated public static String getAMPMString(int ampm) { - Resources r = Resources.getSystem(); - return r.getString(sAmPm[ampm - Calendar.AM]); + return LocaleData.get(Locale.getDefault()).amPm[ampm - Calendar.AM]; } /** @@ -345,24 +275,25 @@ public static String getAMPMString(int ampm) { * Undefined lengths will return {@link #LENGTH_MEDIUM} * but may return something different in the future. * @return Localized month of the year. + * @deprecated use {@link java.text.SimpleDateFormat} instead. */ + @Deprecated public static String getMonthString(int month, int abbrev) { - // Note that here we use sMonthsMedium for MEDIUM, SHORT and SHORTER. + // Note that here we use d.shortMonthNames for MEDIUM, SHORT and SHORTER. // This is a shortcut to not spam the translators with too many variations // of the same string. If we find that in a language the distinction // is necessary, we can can add more without changing this API. - int[] list; + LocaleData d = LocaleData.get(Locale.getDefault()); + String[] names; switch (abbrev) { - case LENGTH_LONG: list = sMonthsLong; break; - case LENGTH_MEDIUM: list = sMonthsMedium; break; - case LENGTH_SHORT: list = sMonthsMedium; break; - case LENGTH_SHORTER: list = sMonthsMedium; break; - case LENGTH_SHORTEST: list = sMonthsShortest; break; - default: list = sMonthsMedium; break; + case LENGTH_LONG: names = d.longMonthNames; break; + case LENGTH_MEDIUM: names = d.shortMonthNames; break; + case LENGTH_SHORT: names = d.shortMonthNames; break; + case LENGTH_SHORTER: names = d.shortMonthNames; break; + case LENGTH_SHORTEST: names = d.tinyMonthNames; break; + default: names = d.shortMonthNames; break; } - - Resources r = Resources.getSystem(); - return r.getString(list[month - Calendar.JANUARY]); + return names[month]; } /** @@ -378,25 +309,26 @@ public static String getMonthString(int month, int abbrev) { * but may return something different in the future. * @return Localized month of the year. * @hide Pending API council approval + * @deprecated use {@link java.text.SimpleDateFormat} instead. */ + @Deprecated public static String getStandaloneMonthString(int month, int abbrev) { - // Note that here we use sMonthsMedium for MEDIUM, SHORT and SHORTER. + // Note that here we use d.shortMonthNames for MEDIUM, SHORT and SHORTER. // This is a shortcut to not spam the translators with too many variations // of the same string. If we find that in a language the distinction // is necessary, we can can add more without changing this API. - int[] list; + LocaleData d = LocaleData.get(Locale.getDefault()); + String[] names; switch (abbrev) { - case LENGTH_LONG: list = sMonthsStandaloneLong; + case LENGTH_LONG: names = d.longStandAloneMonthNames; break; - case LENGTH_MEDIUM: list = sMonthsMedium; break; - case LENGTH_SHORT: list = sMonthsMedium; break; - case LENGTH_SHORTER: list = sMonthsMedium; break; - case LENGTH_SHORTEST: list = sMonthsShortest; break; - default: list = sMonthsMedium; break; + case LENGTH_MEDIUM: names = d.shortMonthNames; break; + case LENGTH_SHORT: names = d.shortMonthNames; break; + case LENGTH_SHORTER: names = d.shortMonthNames; break; + case LENGTH_SHORTEST: names = d.tinyMonthNames; break; + default: names = d.shortMonthNames; break; } - - Resources r = Resources.getSystem(); - return r.getString(list[month - Calendar.JANUARY]); + return names[month]; } /** @@ -619,14 +551,19 @@ private static final String getRelativeDayString(Resources r, long day, long tod int days = Math.abs(currentDay - startDay); boolean past = (today > day); + // TODO: some locales name other days too, such as de_DE's "Vorgestern" (today - 2). + Locale locale = r.getConfiguration().locale; + if (locale == null) { + locale = Locale.getDefault(); + } if (days == 1) { if (past) { - return r.getString(com.android.internal.R.string.yesterday); + return LocaleData.get(locale).yesterday; } else { - return r.getString(com.android.internal.R.string.tomorrow); + return LocaleData.get(locale).tomorrow; } } else if (days == 0) { - return r.getString(com.android.internal.R.string.today); + return LocaleData.get(locale).today; } int resId; @@ -710,33 +647,36 @@ public static String formatElapsedTime(StringBuilder recycle, long elapsedSecond } } + private static void append(StringBuilder sb, long value, boolean pad, char zeroDigit) { + if (value < 10) { + if (pad) { + sb.append(zeroDigit); + } + } else { + sb.append((char) (zeroDigit + (value / 10))); + } + sb.append((char) (zeroDigit + (value % 10))); + } + /** - * Fast formatting of h:mm:ss + * Fast formatting of h:mm:ss. */ private static String formatElapsedTime(StringBuilder recycle, String format, long hours, long minutes, long seconds) { if (FAST_FORMAT_HMMSS.equals(format)) { + char zeroDigit = LocaleData.get(Locale.getDefault()).zeroDigit; + StringBuilder sb = recycle; if (sb == null) { sb = new StringBuilder(8); } else { sb.setLength(0); } - sb.append(hours); + append(sb, hours, false, zeroDigit); sb.append(TIME_SEPARATOR); - if (minutes < 10) { - sb.append(TIME_PADDING); - } else { - sb.append(toDigitChar(minutes / 10)); - } - sb.append(toDigitChar(minutes % 10)); + append(sb, minutes, true, zeroDigit); sb.append(TIME_SEPARATOR); - if (seconds < 10) { - sb.append(TIME_PADDING); - } else { - sb.append(toDigitChar(seconds / 10)); - } - sb.append(toDigitChar(seconds % 10)); + append(sb, seconds, true, zeroDigit); return sb.toString(); } else { return String.format(format, hours, minutes, seconds); @@ -744,40 +684,28 @@ private static String formatElapsedTime(StringBuilder recycle, String format, lo } /** - * Fast formatting of m:ss + * Fast formatting of mm:ss. */ private static String formatElapsedTime(StringBuilder recycle, String format, long minutes, long seconds) { if (FAST_FORMAT_MMSS.equals(format)) { + char zeroDigit = LocaleData.get(Locale.getDefault()).zeroDigit; + StringBuilder sb = recycle; if (sb == null) { sb = new StringBuilder(8); } else { sb.setLength(0); } - if (minutes < 10) { - sb.append(TIME_PADDING); - } else { - sb.append(toDigitChar(minutes / 10)); - } - sb.append(toDigitChar(minutes % 10)); + append(sb, minutes, false, zeroDigit); sb.append(TIME_SEPARATOR); - if (seconds < 10) { - sb.append(TIME_PADDING); - } else { - sb.append(toDigitChar(seconds / 10)); - } - sb.append(toDigitChar(seconds % 10)); + append(sb, seconds, true, zeroDigit); return sb.toString(); } else { return String.format(format, minutes, seconds); } } - private static char toDigitChar(long digit) { - return (char) (digit + '0'); - } - /** * Format a date / time such that if the then is on the same day as now, it shows * just the time and if it's a different day, it shows just the date. @@ -1449,6 +1377,14 @@ public static Formatter formatDateRange(Context context, Formatter formatter, lo String endMonthDayString = isInstant ? null : endDate.format(MONTH_DAY_FORMAT); String endYearString = isInstant ? null : endDate.format(YEAR_FORMAT); + String startStandaloneMonthString = startMonthString; + String endStandaloneMonthString = endMonthString; + // We need standalone months for these strings in Persian (fa): http://b/6811327 + if (!numericDate && !abbrevMonth && Locale.getDefault().getLanguage().equals("fa")) { + startStandaloneMonthString = startDate.format("%-B"); + endStandaloneMonthString = endDate.format("%-B"); + } + if (startMonthNum != endMonthNum) { // Same year, different month. // Example: "October 28 - November 3" @@ -1469,7 +1405,8 @@ public static Formatter formatDateRange(Context context, Formatter formatter, lo startWeekDayString, startMonthString, startMonthDayString, startYearString, startTimeString, endWeekDayString, endMonthString, endMonthDayString, - endYearString, endTimeString); + endYearString, endTimeString, + startStandaloneMonthString, endStandaloneMonthString); } if (startDay != endDay) { @@ -1488,7 +1425,8 @@ public static Formatter formatDateRange(Context context, Formatter formatter, lo startWeekDayString, startMonthString, startMonthDayString, startYearString, startTimeString, endWeekDayString, endMonthString, endMonthDayString, - endYearString, endTimeString); + endYearString, endTimeString, + startStandaloneMonthString, endStandaloneMonthString); } // Same start and end day @@ -1618,7 +1556,7 @@ public static CharSequence getRelativeTimeSpanString(Context c, long millis, String result; long now = System.currentTimeMillis(); - long span = now - millis; + long span = Math.abs(now - millis); synchronized (DateUtils.class) { if (sNowTime == null) { diff --git a/core/java/android/text/format/Time.java b/core/java/android/text/format/Time.java index e9b0d325d2577..5ef86b1a5456d 100644 --- a/core/java/android/text/format/Time.java +++ b/core/java/android/text/format/Time.java @@ -21,6 +21,8 @@ import java.util.Locale; import java.util.TimeZone; +import libcore.icu.LocaleData; + /** * An alternative to the {@link java.util.Calendar} and * {@link java.util.GregorianCalendar} classes. An instance of the Time class represents @@ -149,6 +151,9 @@ public class Time { private static String sDateTimeFormat; private static String sAm; private static String sPm; + private static char sZeroDigit; + + // Referenced by native code. private static String sDateCommand = "%a %b %e %H:%M:%S %Z %Y"; /** @@ -317,83 +322,52 @@ public String format(String format) { Locale locale = Locale.getDefault(); if (sLocale == null || locale == null || !(locale.equals(sLocale))) { - Resources r = Resources.getSystem(); + LocaleData localeData = LocaleData.get(locale); + + sAm = localeData.amPm[0]; + sPm = localeData.amPm[1]; + sZeroDigit = localeData.zeroDigit; - sShortMonths = new String[] { - r.getString(com.android.internal.R.string.month_medium_january), - r.getString(com.android.internal.R.string.month_medium_february), - r.getString(com.android.internal.R.string.month_medium_march), - r.getString(com.android.internal.R.string.month_medium_april), - r.getString(com.android.internal.R.string.month_medium_may), - r.getString(com.android.internal.R.string.month_medium_june), - r.getString(com.android.internal.R.string.month_medium_july), - r.getString(com.android.internal.R.string.month_medium_august), - r.getString(com.android.internal.R.string.month_medium_september), - r.getString(com.android.internal.R.string.month_medium_october), - r.getString(com.android.internal.R.string.month_medium_november), - r.getString(com.android.internal.R.string.month_medium_december), - }; - sLongMonths = new String[] { - r.getString(com.android.internal.R.string.month_long_january), - r.getString(com.android.internal.R.string.month_long_february), - r.getString(com.android.internal.R.string.month_long_march), - r.getString(com.android.internal.R.string.month_long_april), - r.getString(com.android.internal.R.string.month_long_may), - r.getString(com.android.internal.R.string.month_long_june), - r.getString(com.android.internal.R.string.month_long_july), - r.getString(com.android.internal.R.string.month_long_august), - r.getString(com.android.internal.R.string.month_long_september), - r.getString(com.android.internal.R.string.month_long_october), - r.getString(com.android.internal.R.string.month_long_november), - r.getString(com.android.internal.R.string.month_long_december), - }; - sLongStandaloneMonths = new String[] { - r.getString(com.android.internal.R.string.month_long_standalone_january), - r.getString(com.android.internal.R.string.month_long_standalone_february), - r.getString(com.android.internal.R.string.month_long_standalone_march), - r.getString(com.android.internal.R.string.month_long_standalone_april), - r.getString(com.android.internal.R.string.month_long_standalone_may), - r.getString(com.android.internal.R.string.month_long_standalone_june), - r.getString(com.android.internal.R.string.month_long_standalone_july), - r.getString(com.android.internal.R.string.month_long_standalone_august), - r.getString(com.android.internal.R.string.month_long_standalone_september), - r.getString(com.android.internal.R.string.month_long_standalone_october), - r.getString(com.android.internal.R.string.month_long_standalone_november), - r.getString(com.android.internal.R.string.month_long_standalone_december), - }; - sShortWeekdays = new String[] { - r.getString(com.android.internal.R.string.day_of_week_medium_sunday), - r.getString(com.android.internal.R.string.day_of_week_medium_monday), - r.getString(com.android.internal.R.string.day_of_week_medium_tuesday), - r.getString(com.android.internal.R.string.day_of_week_medium_wednesday), - r.getString(com.android.internal.R.string.day_of_week_medium_thursday), - r.getString(com.android.internal.R.string.day_of_week_medium_friday), - r.getString(com.android.internal.R.string.day_of_week_medium_saturday), - }; - sLongWeekdays = new String[] { - r.getString(com.android.internal.R.string.day_of_week_long_sunday), - r.getString(com.android.internal.R.string.day_of_week_long_monday), - r.getString(com.android.internal.R.string.day_of_week_long_tuesday), - r.getString(com.android.internal.R.string.day_of_week_long_wednesday), - r.getString(com.android.internal.R.string.day_of_week_long_thursday), - r.getString(com.android.internal.R.string.day_of_week_long_friday), - r.getString(com.android.internal.R.string.day_of_week_long_saturday), - }; + sShortMonths = localeData.shortMonthNames; + sLongMonths = localeData.longMonthNames; + sLongStandaloneMonths = localeData.longStandAloneMonthNames; + sShortWeekdays = localeData.shortWeekdayNames; + sLongWeekdays = localeData.longWeekdayNames; + + Resources r = Resources.getSystem(); sTimeOnlyFormat = r.getString(com.android.internal.R.string.time_of_day); sDateOnlyFormat = r.getString(com.android.internal.R.string.month_day_year); sDateTimeFormat = r.getString(com.android.internal.R.string.date_and_time); - sAm = r.getString(com.android.internal.R.string.am); - sPm = r.getString(com.android.internal.R.string.pm); sLocale = locale; } - return format1(format); + String result = format1(format); + if (sZeroDigit != '0') { + result = localizeDigits(result); + } + return result; } } native private String format1(String format); + // TODO: unify this with java.util.Formatter's copy. + private String localizeDigits(String s) { + int length = s.length(); + int offsetToLocalizedDigits = sZeroDigit - '0'; + StringBuilder result = new StringBuilder(length); + for (int i = 0; i < length; ++i) { + char ch = s.charAt(i); + if (ch >= '0' && ch <= '9') { + ch += offsetToLocalizedDigits; + } + result.append(ch); + } + return result.toString(); + } + + /** * Return the current time in YYYYMMDDTHHMMSS format */ @@ -437,6 +411,9 @@ public String format(String format) { * @throws android.util.TimeFormatException if s cannot be parsed. */ public boolean parse(String s) { + if (s == null) { + throw new NullPointerException("time string is null"); + } if (nativeParse(s)) { timezone = TIMEZONE_UTC; return true; @@ -720,7 +697,7 @@ public String format3339(boolean allDay) { int minutes = (offset % 3600) / 60; int hours = offset / 3600; - return String.format("%s%s%02d:%02d", base, sign, hours, minutes); + return String.format(Locale.US, "%s%s%02d:%02d", base, sign, hours, minutes); } } diff --git a/core/java/android/text/style/LocaleSpan.java b/core/java/android/text/style/LocaleSpan.java new file mode 100644 index 0000000000000..a12c42fadb166 --- /dev/null +++ b/core/java/android/text/style/LocaleSpan.java @@ -0,0 +1,84 @@ +/* + * 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.text.style; + +import android.graphics.Paint; +import android.os.Parcel; +import android.text.ParcelableSpan; +import android.text.TextPaint; +import android.text.TextUtils; +import java.util.Locale; + +/** + * Changes the {@link Locale} of the text to which the span is attached. + */ +public class LocaleSpan extends MetricAffectingSpan implements ParcelableSpan { + private final Locale mLocale; + + /** + * Creates a LocaleSpan. + * @param locale The {@link Locale} of the text to which the span is + * attached. + */ + public LocaleSpan(Locale locale) { + mLocale = locale; + } + + public LocaleSpan(Parcel src) { + mLocale = new Locale(src.readString(), src.readString(), src.readString()); + } + + @Override + public int getSpanTypeId() { + return TextUtils.LOCALE_SPAN; + } + + @Override + public int describeContents() { + return 0; + } + + @Override + public void writeToParcel(Parcel dest, int flags) { + dest.writeString(mLocale.getLanguage()); + dest.writeString(mLocale.getCountry()); + dest.writeString(mLocale.getVariant()); + } + + /** + * Returns the {@link Locale}. + * + * @return The {@link Locale} for this span. + */ + public Locale getLocale() { + return mLocale; + } + + @Override + public void updateDrawState(TextPaint ds) { + apply(ds, mLocale); + } + + @Override + public void updateMeasureState(TextPaint paint) { + apply(paint, mLocale); + } + + private static void apply(Paint paint, Locale locale) { + paint.setTextLocale(locale); + } +} diff --git a/core/java/android/util/AtomicFile.java b/core/java/android/util/AtomicFile.java new file mode 100644 index 0000000000000..4fca570f6614a --- /dev/null +++ b/core/java/android/util/AtomicFile.java @@ -0,0 +1,233 @@ +/* + * Copyright (C) 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. + */ + +package android.util; + +import android.os.FileUtils; +import android.util.Log; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; + +/** + * Helper class for performing atomic operations on a file by creating a + * backup file until a write has successfully completed. If you need this + * on older versions of the platform you can use + * {@link android.support.v4.util.AtomicFile} in the v4 support library. + *

        + * Atomic file guarantees file integrity by ensuring that a file has + * been completely written and sync'd to disk before removing its backup. + * As long as the backup file exists, the original file is considered + * to be invalid (left over from a previous attempt to write the file). + *

        + * Atomic file does not confer any file locking semantics. + * Do not use this class when the file may be accessed or modified concurrently + * by multiple threads or processes. The caller is responsible for ensuring + * appropriate mutual exclusion invariants whenever it accesses the file. + *

        + */ +public class AtomicFile { + private final File mBaseName; + private final File mBackupName; + + /** + * Create a new AtomicFile for a file located at the given File path. + * The secondary backup file will be the same file path with ".bak" appended. + */ + public AtomicFile(File baseName) { + mBaseName = baseName; + mBackupName = new File(baseName.getPath() + ".bak"); + } + + /** + * Return the path to the base file. You should not generally use this, + * as the data at that path may not be valid. + */ + public File getBaseFile() { + return mBaseName; + } + + /** + * Delete the atomic file. This deletes both the base and backup files. + */ + public void delete() { + mBaseName.delete(); + mBackupName.delete(); + } + + /** + * Start a new write operation on the file. This returns a FileOutputStream + * to which you can write the new file data. The existing file is replaced + * with the new data. You must not directly close the given + * FileOutputStream; instead call either {@link #finishWrite(FileOutputStream)} + * or {@link #failWrite(FileOutputStream)}. + * + *

        Note that if another thread is currently performing + * a write, this will simply replace whatever that thread is writing + * with the new file being written by this thread, and when the other + * thread finishes the write the new write operation will no longer be + * safe (or will be lost). You must do your own threading protection for + * access to AtomicFile. + */ + public FileOutputStream startWrite() throws IOException { + // Rename the current file so it may be used as a backup during the next read + if (mBaseName.exists()) { + if (!mBackupName.exists()) { + if (!mBaseName.renameTo(mBackupName)) { + Log.w("AtomicFile", "Couldn't rename file " + mBaseName + + " to backup file " + mBackupName); + } + } else { + mBaseName.delete(); + } + } + FileOutputStream str = null; + try { + str = new FileOutputStream(mBaseName); + } catch (FileNotFoundException e) { + File parent = mBaseName.getParentFile(); + if (!parent.mkdir()) { + throw new IOException("Couldn't create directory " + mBaseName); + } + FileUtils.setPermissions( + parent.getPath(), + FileUtils.S_IRWXU|FileUtils.S_IRWXG|FileUtils.S_IXOTH, + -1, -1); + try { + str = new FileOutputStream(mBaseName); + } catch (FileNotFoundException e2) { + throw new IOException("Couldn't create " + mBaseName); + } + } + return str; + } + + /** + * Call when you have successfully finished writing to the stream + * returned by {@link #startWrite()}. This will close, sync, and + * commit the new data. The next attempt to read the atomic file + * will return the new file stream. + */ + public void finishWrite(FileOutputStream str) { + if (str != null) { + FileUtils.sync(str); + try { + str.close(); + mBackupName.delete(); + } catch (IOException e) { + Log.w("AtomicFile", "finishWrite: Got exception:", e); + } + } + } + + /** + * Call when you have failed for some reason at writing to the stream + * returned by {@link #startWrite()}. This will close the current + * write stream, and roll back to the previous state of the file. + */ + public void failWrite(FileOutputStream str) { + if (str != null) { + FileUtils.sync(str); + try { + str.close(); + mBaseName.delete(); + mBackupName.renameTo(mBaseName); + } catch (IOException e) { + Log.w("AtomicFile", "failWrite: Got exception:", e); + } + } + } + + /** @hide + * @deprecated This is not safe. + */ + @Deprecated public void truncate() throws IOException { + try { + FileOutputStream fos = new FileOutputStream(mBaseName); + FileUtils.sync(fos); + fos.close(); + } catch (FileNotFoundException e) { + throw new IOException("Couldn't append " + mBaseName); + } catch (IOException e) { + } + } + + /** @hide + * @deprecated This is not safe. + */ + @Deprecated public FileOutputStream openAppend() throws IOException { + try { + return new FileOutputStream(mBaseName, true); + } catch (FileNotFoundException e) { + throw new IOException("Couldn't append " + mBaseName); + } + } + + /** + * Open the atomic file for reading. If there previously was an + * incomplete write, this will roll back to the last good data before + * opening for read. You should call close() on the FileInputStream when + * you are done reading from it. + * + *

        Note that if another thread is currently performing + * a write, this will incorrectly consider it to be in the state of a bad + * write and roll back, causing the new data currently being written to + * be dropped. You must do your own threading protection for access to + * AtomicFile. + */ + public FileInputStream openRead() throws FileNotFoundException { + if (mBackupName.exists()) { + mBaseName.delete(); + mBackupName.renameTo(mBaseName); + } + return new FileInputStream(mBaseName); + } + + /** + * A convenience for {@link #openRead()} that also reads all of the + * file contents into a byte array which is returned. + */ + public byte[] readFully() throws IOException { + FileInputStream stream = openRead(); + try { + int pos = 0; + int avail = stream.available(); + byte[] data = new byte[avail]; + while (true) { + int amt = stream.read(data, pos, data.length-pos); + //Log.i("foo", "Read " + amt + " bytes at " + pos + // + " of avail " + data.length); + if (amt <= 0) { + //Log.i("foo", "**** FINISHED READING: pos=" + pos + // + " len=" + data.length); + return data; + } + pos += amt; + avail = stream.available(); + if (avail > data.length-pos) { + byte[] newData = new byte[pos+avail]; + System.arraycopy(data, 0, newData, 0, pos); + data = newData; + } + } + } finally { + stream.close(); + } + } +} diff --git a/core/java/android/util/DisplayMetrics.java b/core/java/android/util/DisplayMetrics.java index 80da0b2436ea5..85e4b9db25503 100644 --- a/core/java/android/util/DisplayMetrics.java +++ b/core/java/android/util/DisplayMetrics.java @@ -78,12 +78,21 @@ public class DisplayMetrics { */ public static final int DENSITY_DEFAULT = DENSITY_MEDIUM; + /** + * Scaling factor to convert a density in DPI units to the density scale. + * @hide + */ + public static final float DENSITY_DEFAULT_SCALE = 1.0f / DENSITY_DEFAULT; + /** * The device's density. - * @hide becase eventually this should be able to change while + * @hide because eventually this should be able to change while * running, so shouldn't be a constant. + * @deprecated There is no longer a static density; you can find the + * density for a display in {@link #densityDpi}. */ - public static final int DENSITY_DEVICE = getDeviceDensity(); + @Deprecated + public static int DENSITY_DEVICE = getDeviceDensity(); /** * The absolute width of the display in pixels. @@ -149,6 +158,12 @@ public class DisplayMetrics { * @hide */ public float noncompatDensity; + /** + * The reported display density prior to any compatibility mode scaling + * being applied. + * @hide + */ + public int noncompatDensityDpi; /** * The reported scaled density prior to any compatibility mode scaling * being applied. @@ -182,6 +197,7 @@ public void setTo(DisplayMetrics o) { noncompatWidthPixels = o.noncompatWidthPixels; noncompatHeightPixels = o.noncompatHeightPixels; noncompatDensity = o.noncompatDensity; + noncompatDensityDpi = o.noncompatDensityDpi; noncompatScaledDensity = o.noncompatScaledDensity; noncompatXdpi = o.noncompatXdpi; noncompatYdpi = o.noncompatYdpi; @@ -190,13 +206,52 @@ public void setTo(DisplayMetrics o) { public void setToDefaults() { widthPixels = 0; heightPixels = 0; - density = DENSITY_DEVICE / (float) DENSITY_DEFAULT; - densityDpi = DENSITY_DEVICE; + density = DENSITY_DEVICE / (float) DENSITY_DEFAULT; + densityDpi = DENSITY_DEVICE; scaledDensity = density; xdpi = DENSITY_DEVICE; ydpi = DENSITY_DEVICE; - noncompatWidthPixels = 0; - noncompatHeightPixels = 0; + noncompatWidthPixels = widthPixels; + noncompatHeightPixels = heightPixels; + noncompatDensity = density; + noncompatDensityDpi = densityDpi; + noncompatScaledDensity = scaledDensity; + noncompatXdpi = xdpi; + noncompatYdpi = ydpi; + } + + @Override + public boolean equals(Object o) { + return o instanceof DisplayMetrics && equals((DisplayMetrics)o); + } + + /** + * Returns true if these display metrics equal the other display metrics. + * + * @param other The display metrics with which to compare. + * @return True if the display metrics are equal. + */ + public boolean equals(DisplayMetrics other) { + return other != null + && widthPixels == other.widthPixels + && heightPixels == other.heightPixels + && density == other.density + && densityDpi == other.densityDpi + && scaledDensity == other.scaledDensity + && xdpi == other.xdpi + && ydpi == other.ydpi + && noncompatWidthPixels == other.noncompatWidthPixels + && noncompatHeightPixels == other.noncompatHeightPixels + && noncompatDensity == other.noncompatDensity + && noncompatDensityDpi == other.noncompatDensityDpi + && noncompatScaledDensity == other.noncompatScaledDensity + && noncompatXdpi == other.noncompatXdpi + && noncompatYdpi == other.noncompatYdpi; + } + + @Override + public int hashCode() { + return widthPixels * heightPixels * densityDpi; } @Override diff --git a/core/java/android/util/FloatMath.java b/core/java/android/util/FloatMath.java index 62166383c326c..955622396aac3 100644 --- a/core/java/android/util/FloatMath.java +++ b/core/java/android/util/FloatMath.java @@ -71,4 +71,33 @@ private FloatMath() {} * @return the square root of value */ public static native float sqrt(float value); + + /** + * Returns the closest float approximation of the raising "e" to the power + * of the argument. + * + * @param value to compute the exponential of + * @return the exponential of value + */ + public static native float exp(float value); + + /** + * Returns the closest float approximation of the result of raising {@code + * x} to the power of {@code y}. + * + * @param x the base of the operation. + * @param y the exponent of the operation. + * @return {@code x} to the power of {@code y}. + */ + public static native float pow(float x, float y); + + /** + * Returns {@code sqrt(}{@code x}{@code 2}{@code +} + * {@code y}{@code 2}{@code )}. + * + * @param x a float number + * @param y a float number + * @return the hypotenuse + */ + public static native float hypot(float x, float y); } diff --git a/core/java/android/util/IntProperty.java b/core/java/android/util/IntProperty.java index 459d6b28243ed..17977ca635185 100644 --- a/core/java/android/util/IntProperty.java +++ b/core/java/android/util/IntProperty.java @@ -42,7 +42,7 @@ public IntProperty(String name) { @Override final public void set(T object, Integer value) { - set(object, value.intValue()); + setValue(object, value.intValue()); } } \ No newline at end of file diff --git a/core/java/android/util/LocaleUtil.java b/core/java/android/util/LocaleUtil.java deleted file mode 100644 index 93f5cd36cac50..0000000000000 --- a/core/java/android/util/LocaleUtil.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.util; - -import java.util.Locale; - -import android.view.View; -import libcore.icu.ICU; - -/** - * Various utilities for Locales - * - * @hide - */ -public class LocaleUtil { - - private LocaleUtil() { /* cannot be instantiated */ } - - private static String ARAB_SCRIPT_SUBTAG = "Arab"; - private static String HEBR_SCRIPT_SUBTAG = "Hebr"; - - /** - * Return the layout direction for a given Locale - * - * @param locale the Locale for which we want the layout direction. Can be null. - * @return the layout direction. This may be one of: - * {@link View#LAYOUT_DIRECTION_LTR} or - * {@link View#LAYOUT_DIRECTION_RTL}. - * - * Warning: this code does not support vertical scripts. - * @hide - */ - public static int getLayoutDirectionFromLocale(Locale locale) { - if (locale != null && !locale.equals(Locale.ROOT)) { - final String scriptSubtag = ICU.getScript(ICU.addLikelySubtags(locale.toString())); - if (scriptSubtag == null) return getLayoutDirectionFromFirstChar(locale); - - if (scriptSubtag.equalsIgnoreCase(ARAB_SCRIPT_SUBTAG) || - scriptSubtag.equalsIgnoreCase(HEBR_SCRIPT_SUBTAG)) { - return View.LAYOUT_DIRECTION_RTL; - } - } - - return View.LAYOUT_DIRECTION_LTR; - } - - /** - * Fallback algorithm to detect the locale direction. Rely on the fist char of the - * localized locale name. This will not work if the localized locale name is in English - * (this is the case for ICU 4.4 and "Urdu" script) - * - * @param locale - * @return the layout direction. This may be one of: - * {@link View#LAYOUT_DIRECTION_LTR} or - * {@link View#LAYOUT_DIRECTION_RTL}. - * - * Warning: this code does not support vertical scripts. - * @hide - */ - private static int getLayoutDirectionFromFirstChar(Locale locale) { - switch(Character.getDirectionality(locale.getDisplayName(locale).charAt(0))) { - case Character.DIRECTIONALITY_RIGHT_TO_LEFT: - case Character.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC: - return View.LAYOUT_DIRECTION_RTL; - - case Character.DIRECTIONALITY_LEFT_TO_RIGHT: - default: - return View.LAYOUT_DIRECTION_LTR; - } - } -} diff --git a/core/java/android/util/LruCache.java b/core/java/android/util/LruCache.java index 51e373c8dddc3..dd504c159c8e0 100644 --- a/core/java/android/util/LruCache.java +++ b/core/java/android/util/LruCache.java @@ -186,10 +186,13 @@ public final V put(K key, V value) { } /** + * Remove the eldest entries until the total of remaining entries is at or + * below the requested size. + * * @param maxSize the maximum size of the cache before returning. May be -1 - * to evict even 0-sized elements. + * to evict even 0-sized elements. */ - private void trimToSize(int maxSize) { + public void trimToSize(int maxSize) { while (true) { K key; V value; diff --git a/core/java/android/util/NtpTrustedTime.java b/core/java/android/util/NtpTrustedTime.java index 2179ff36e1c73..602a68c81a692 100644 --- a/core/java/android/util/NtpTrustedTime.java +++ b/core/java/android/util/NtpTrustedTime.java @@ -59,10 +59,10 @@ public static synchronized NtpTrustedTime getInstance(Context context) { final long defaultTimeout = res.getInteger( com.android.internal.R.integer.config_ntpTimeout); - final String secureServer = Settings.Secure.getString( - resolver, Settings.Secure.NTP_SERVER); - final long timeout = Settings.Secure.getLong( - resolver, Settings.Secure.NTP_TIMEOUT, defaultTimeout); + final String secureServer = Settings.Global.getString( + resolver, Settings.Global.NTP_SERVER); + final long timeout = Settings.Global.getLong( + resolver, Settings.Global.NTP_TIMEOUT, defaultTimeout); final String server = secureServer != null ? secureServer : defaultServer; sSingleton = new NtpTrustedTime(server, timeout); @@ -71,7 +71,7 @@ public static synchronized NtpTrustedTime getInstance(Context context) { return sSingleton; } - /** {@inheritDoc} */ + @Override public boolean forceRefresh() { if (mServer == null) { // missing server, so no trusted time available @@ -91,12 +91,12 @@ public boolean forceRefresh() { } } - /** {@inheritDoc} */ + @Override public boolean hasCache() { return mHasCache; } - /** {@inheritDoc} */ + @Override public long getCacheAge() { if (mHasCache) { return SystemClock.elapsedRealtime() - mCachedNtpElapsedRealtime; @@ -105,7 +105,7 @@ public long getCacheAge() { } } - /** {@inheritDoc} */ + @Override public long getCacheCertainty() { if (mHasCache) { return mCachedNtpCertainty; @@ -114,7 +114,7 @@ public long getCacheCertainty() { } } - /** {@inheritDoc} */ + @Override public long currentTimeMillis() { if (!mHasCache) { throw new IllegalStateException("Missing authoritative time source"); diff --git a/core/java/android/util/Pair.java b/core/java/android/util/Pair.java index bf25306540fd5..6027d081510de 100644 --- a/core/java/android/util/Pair.java +++ b/core/java/android/util/Pair.java @@ -16,6 +16,8 @@ package android.util; +import libcore.util.Objects; + /** * Container to ease passing around a tuple of two objects. This object provides a sensible * implementation of equals(), returning true if equals() is true on each of the contained @@ -26,8 +28,8 @@ public class Pair { public final S second; /** - * Constructor for a Pair. If either are null then equals() and hashCode() will throw - * a NullPointerException. + * Constructor for a Pair. + * * @param first the first object in the Pair * @param second the second object in the pair */ @@ -37,31 +39,30 @@ public Pair(F first, S second) { } /** - * Checks the two objects for equality by delegating to their respective equals() methods. - * @param o the Pair to which this one is to be checked for equality - * @return true if the underlying objects of the Pair are both considered equals() + * Checks the two objects for equality by delegating to their respective + * {@link Object#equals(Object)} methods. + * + * @param o the {@link Pair} to which this one is to be checked for equality + * @return true if the underlying objects of the Pair are both considered + * equal */ + @Override public boolean equals(Object o) { - if (o == this) return true; - if (!(o instanceof Pair)) return false; - final Pair other; - try { - other = (Pair) o; - } catch (ClassCastException e) { + if (!(o instanceof Pair)) { return false; } - return first.equals(other.first) && second.equals(other.second); + Pair p = (Pair) o; + return Objects.equal(p.first, first) && Objects.equal(p.second, second); } /** * Compute a hash code using the hash codes of the underlying objects + * * @return a hashcode of the Pair */ + @Override public int hashCode() { - int result = 17; - result = 31 * result + first.hashCode(); - result = 31 * result + second.hashCode(); - return result; + return (first == null ? 0 : first.hashCode()) ^ (second == null ? 0 : second.hashCode()); } /** diff --git a/core/java/android/util/Spline.java b/core/java/android/util/Spline.java new file mode 100644 index 0000000000000..ed027eb18166e --- /dev/null +++ b/core/java/android/util/Spline.java @@ -0,0 +1,156 @@ +/* + * 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.util; + +/** + * Performs spline interpolation given a set of control points. + * @hide + */ +public final class Spline { + private final float[] mX; + private final float[] mY; + private final float[] mM; + + private Spline(float[] x, float[] y, float[] m) { + mX = x; + mY = y; + mM = m; + } + + /** + * Creates a monotone cubic spline from a given set of control points. + * + * The spline is guaranteed to pass through each control point exactly. + * Moreover, assuming the control points are monotonic (Y is non-decreasing or + * non-increasing) then the interpolated values will also be monotonic. + * + * This function uses the Fritsch-Carlson method for computing the spline parameters. + * http://en.wikipedia.org/wiki/Monotone_cubic_interpolation + * + * @param x The X component of the control points, strictly increasing. + * @param y The Y component of the control points, monotonic. + * @return + * + * @throws IllegalArgumentException if the X or Y arrays are null, have + * different lengths or have fewer than 2 values. + * @throws IllegalArgumentException if the control points are not monotonic. + */ + public static Spline createMonotoneCubicSpline(float[] x, float[] y) { + if (x == null || y == null || x.length != y.length || x.length < 2) { + throw new IllegalArgumentException("There must be at least two control " + + "points and the arrays must be of equal length."); + } + + final int n = x.length; + float[] d = new float[n - 1]; // could optimize this out + float[] m = new float[n]; + + // Compute slopes of secant lines between successive points. + for (int i = 0; i < n - 1; i++) { + float h = x[i + 1] - x[i]; + if (h <= 0f) { + throw new IllegalArgumentException("The control points must all " + + "have strictly increasing X values."); + } + d[i] = (y[i + 1] - y[i]) / h; + } + + // Initialize the tangents as the average of the secants. + m[0] = d[0]; + for (int i = 1; i < n - 1; i++) { + m[i] = (d[i - 1] + d[i]) * 0.5f; + } + m[n - 1] = d[n - 2]; + + // Update the tangents to preserve monotonicity. + for (int i = 0; i < n - 1; i++) { + if (d[i] == 0f) { // successive Y values are equal + m[i] = 0f; + m[i + 1] = 0f; + } else { + float a = m[i] / d[i]; + float b = m[i + 1] / d[i]; + if (a < 0f || b < 0f) { + throw new IllegalArgumentException("The control points must have " + + "monotonic Y values."); + } + float h = FloatMath.hypot(a, b); + if (h > 9f) { + float t = 3f / h; + m[i] = t * a * d[i]; + m[i + 1] = t * b * d[i]; + } + } + } + return new Spline(x, y, m); + } + + /** + * Interpolates the value of Y = f(X) for given X. + * Clamps X to the domain of the spline. + * + * @param x The X value. + * @return The interpolated Y = f(X) value. + */ + public float interpolate(float x) { + // Handle the boundary cases. + final int n = mX.length; + if (Float.isNaN(x)) { + return x; + } + if (x <= mX[0]) { + return mY[0]; + } + if (x >= mX[n - 1]) { + return mY[n - 1]; + } + + // Find the index 'i' of the last point with smaller X. + // We know this will be within the spline due to the boundary tests. + int i = 0; + while (x >= mX[i + 1]) { + i += 1; + if (x == mX[i]) { + return mY[i]; + } + } + + // Perform cubic Hermite spline interpolation. + float h = mX[i + 1] - mX[i]; + float t = (x - mX[i]) / h; + return (mY[i] * (1 + 2 * t) + h * mM[i] * t) * (1 - t) * (1 - t) + + (mY[i + 1] * (3 - 2 * t) + h * mM[i + 1] * (t - 1)) * t * t; + } + + // For debugging. + @Override + public String toString() { + StringBuilder str = new StringBuilder(); + final int n = mX.length; + str.append("["); + for (int i = 0; i < n; i++) { + if (i != 0) { + str.append(", "); + } + str.append("(").append(mX[i]); + str.append(", ").append(mY[i]); + str.append(": ").append(mM[i]).append(")"); + } + str.append("]"); + return str.toString(); + } +} diff --git a/core/java/android/util/TimeUtils.java b/core/java/android/util/TimeUtils.java index c4ebec45bc04b..5a4f3227ec908 100644 --- a/core/java/android/util/TimeUtils.java +++ b/core/java/android/util/TimeUtils.java @@ -18,8 +18,11 @@ import android.content.res.Resources; import android.content.res.XmlResourceParser; +import android.os.SystemClock; +import android.text.format.DateUtils; + +import com.android.internal.util.XmlUtils; -import libcore.util.ZoneInfoDB; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; @@ -28,10 +31,10 @@ import java.util.ArrayList; import java.util.Calendar; import java.util.Collection; -import java.util.TimeZone; import java.util.Date; +import java.util.TimeZone; -import com.android.internal.util.XmlUtils; +import libcore.util.ZoneInfoDB; /** * A class containing utility methods related to time zones. @@ -245,6 +248,8 @@ public static String getTimeZoneDatabaseVersion() { private static final Object sFormatSync = new Object(); private static char[] sFormatStr = new char[HUNDRED_DAY_FIELD_LEN+5]; + private static final long LARGEST_DURATION = (1000 * DateUtils.DAY_IN_MILLIS) - 1; + static private int accumField(int amt, int suffix, boolean always, int zeropad) { if (amt > 99 || (always && zeropad >= 3)) { return 3+suffix; @@ -307,6 +312,10 @@ private static int formatDurationLocked(long duration, int fieldLen) { duration = -duration; } + if (duration > LARGEST_DURATION) { + duration = LARGEST_DURATION; + } + int millis = (int)(duration%1000); int seconds = (int) Math.floor(duration / 1000); int days = 0, hours = 0, minutes = 0; @@ -383,6 +392,18 @@ public static void formatDuration(long time, long now, PrintWriter pw) { formatDuration(time-now, pw, 0); } + /** @hide Just for debugging; not internationalized. */ + public static String formatUptime(long time) { + final long diff = time - SystemClock.uptimeMillis(); + if (diff > 0) { + return time + " (in " + diff + " ms)"; + } + if (diff < 0) { + return time + " (" + -diff + " ms ago)"; + } + return time + " (now)"; + } + /** * Convert a System.currentTimeMillis() value to a time of day value like * that printed in logs. MM-DD HH:MM:SS.MMM diff --git a/core/java/android/view/AccessibilityInteractionController.java b/core/java/android/view/AccessibilityInteractionController.java index 0aabc44a5a99d..9bee4bf9737d5 100644 --- a/core/java/android/view/AccessibilityInteractionController.java +++ b/core/java/android/view/AccessibilityInteractionController.java @@ -18,22 +18,21 @@ import static android.view.accessibility.AccessibilityNodeInfo.INCLUDE_NOT_IMPORTANT_VIEWS; +import android.graphics.Rect; import android.os.Bundle; import android.os.Handler; import android.os.Looper; import android.os.Message; import android.os.Process; import android.os.RemoteException; -import android.util.Pool; -import android.util.Poolable; -import android.util.PoolableManager; -import android.util.Pools; import android.util.SparseLongArray; import android.view.accessibility.AccessibilityInteractionClient; import android.view.accessibility.AccessibilityNodeInfo; import android.view.accessibility.AccessibilityNodeProvider; import android.view.accessibility.IAccessibilityInteractionConnectionCallback; +import com.android.internal.os.SomeArgs; + import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -47,7 +46,6 @@ * UI thread. */ final class AccessibilityInteractionController { - private static final int POOL_SIZE = 5; private ArrayList mTempAccessibilityNodeInfoList = new ArrayList(); @@ -64,6 +62,8 @@ final class AccessibilityInteractionController { private final ArrayList mTempArrayList = new ArrayList(); + private final Rect mTempRect = new Rect(); + public AccessibilityInteractionController(ViewRootImpl viewRootImpl) { Looper looper = viewRootImpl.mHandler.getLooper(); mMyLooperThreadId = looper.getThread().getId(); @@ -73,60 +73,6 @@ public AccessibilityInteractionController(ViewRootImpl viewRootImpl) { mPrefetcher = new AccessibilityNodePrefetcher(); } - // Reusable poolable arguments for interacting with the view hierarchy - // to fit more arguments than Message and to avoid sharing objects between - // two messages since several threads can send messages concurrently. - private final Pool mPool = Pools.synchronizedPool(Pools.finitePool( - new PoolableManager() { - public SomeArgs newInstance() { - return new SomeArgs(); - } - - public void onAcquired(SomeArgs info) { - /* do nothing */ - } - - public void onReleased(SomeArgs info) { - info.clear(); - } - }, POOL_SIZE) - ); - - private class SomeArgs implements Poolable { - private SomeArgs mNext; - private boolean mIsPooled; - - public Object arg1; - public Object arg2; - public int argi1; - public int argi2; - public int argi3; - - public SomeArgs getNextPoolable() { - return mNext; - } - - public boolean isPooled() { - return mIsPooled; - } - - public void setNextPoolable(SomeArgs args) { - mNext = args; - } - - public void setPooled(boolean isPooled) { - mIsPooled = isPooled; - } - - private void clear() { - arg1 = null; - arg2 = null; - argi1 = 0; - argi2 = 0; - argi3 = 0; - } - } - private boolean isShown(View view) { // The first two checks are made also made by isShown() which // however traverses the tree up to the parent to catch that. @@ -138,24 +84,18 @@ private boolean isShown(View view) { } public void findAccessibilityNodeInfoByAccessibilityIdClientThread( - long accessibilityNodeId, int windowLeft, int windowTop, int interactionId, + long accessibilityNodeId, int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid, long interrogatingTid) { Message message = mHandler.obtainMessage(); message.what = PrivateHandler.MSG_FIND_ACCESSIBLITY_NODE_INFO_BY_ACCESSIBILITY_ID; message.arg1 = flags; - SomeArgs args = mPool.acquire(); + SomeArgs args = SomeArgs.obtain(); args.argi1 = AccessibilityNodeInfo.getAccessibilityViewId(accessibilityNodeId); args.argi2 = AccessibilityNodeInfo.getVirtualDescendantId(accessibilityNodeId); args.argi3 = interactionId; args.arg1 = callback; - - SomeArgs moreArgs = mPool.acquire(); - moreArgs.argi1 = windowLeft; - moreArgs.argi2 = windowTop; - args.arg2 = moreArgs; - message.obj = args; // If the interrogation is performed by the same thread as the main UI @@ -180,12 +120,7 @@ private void findAccessibilityNodeInfoByAccessibilityIdUiThread(Message message) final IAccessibilityInteractionConnectionCallback callback = (IAccessibilityInteractionConnectionCallback) args.arg1; - SomeArgs moreArgs = (SomeArgs) args.arg2; - mViewRootImpl.mAttachInfo.mActualWindowLeft = moreArgs.argi1; - mViewRootImpl.mAttachInfo.mActualWindowTop = moreArgs.argi2; - - mPool.release(moreArgs); - mPool.release(args); + args.recycle(); List infos = mTempAccessibilityNodeInfoList; infos.clear(); @@ -207,6 +142,7 @@ private void findAccessibilityNodeInfoByAccessibilityIdUiThread(Message message) } finally { try { mViewRootImpl.mAttachInfo.mIncludeNotImportantViews = false; + applyApplicationScaleIfNeeded(infos); callback.setFindAccessibilityNodeInfosResult(infos, interactionId); infos.clear(); } catch (RemoteException re) { @@ -216,24 +152,18 @@ private void findAccessibilityNodeInfoByAccessibilityIdUiThread(Message message) } public void findAccessibilityNodeInfoByViewIdClientThread(long accessibilityNodeId, - int viewId, int windowLeft, int windowTop, int interactionId, - IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid, - long interrogatingTid) { + int viewId, int interactionId, IAccessibilityInteractionConnectionCallback callback, + int flags, int interrogatingPid, long interrogatingTid) { Message message = mHandler.obtainMessage(); message.what = PrivateHandler.MSG_FIND_ACCESSIBLITY_NODE_INFO_BY_VIEW_ID; message.arg1 = flags; message.arg2 = AccessibilityNodeInfo.getAccessibilityViewId(accessibilityNodeId); - SomeArgs args = mPool.acquire(); + SomeArgs args = SomeArgs.obtain(); args.argi1 = viewId; args.argi2 = interactionId; args.arg1 = callback; - SomeArgs moreArgs = mPool.acquire(); - moreArgs.argi1 = windowLeft; - moreArgs.argi2 = windowTop; - args.arg2 = moreArgs; - message.obj = args; // If the interrogation is performed by the same thread as the main UI @@ -258,12 +188,7 @@ private void findAccessibilityNodeInfoByViewIdUiThread(Message message) { final IAccessibilityInteractionConnectionCallback callback = (IAccessibilityInteractionConnectionCallback) args.arg1; - SomeArgs moreArgs = (SomeArgs) args.arg2; - mViewRootImpl.mAttachInfo.mActualWindowLeft = moreArgs.argi1; - mViewRootImpl.mAttachInfo.mActualWindowTop = moreArgs.argi2; - - mPool.release(moreArgs); - mPool.release(args); + args.recycle(); AccessibilityNodeInfo info = null; try { @@ -287,6 +212,7 @@ private void findAccessibilityNodeInfoByViewIdUiThread(Message message) { } finally { try { mViewRootImpl.mAttachInfo.mIncludeNotImportantViews = false; + applyApplicationScaleIfNeeded(info); callback.setFindAccessibilityNodeInfoResult(info, interactionId); } catch (RemoteException re) { /* ignore - the other side will time out */ @@ -295,25 +221,19 @@ private void findAccessibilityNodeInfoByViewIdUiThread(Message message) { } public void findAccessibilityNodeInfosByTextClientThread(long accessibilityNodeId, - String text, int windowLeft, int windowTop, int interactionId, - IAccessibilityInteractionConnectionCallback callback, int flags, - int interrogatingPid, long interrogatingTid) { + String text, int interactionId, IAccessibilityInteractionConnectionCallback callback, + int flags, int interrogatingPid, long interrogatingTid) { Message message = mHandler.obtainMessage(); message.what = PrivateHandler.MSG_FIND_ACCESSIBLITY_NODE_INFO_BY_TEXT; message.arg1 = flags; - SomeArgs args = mPool.acquire(); + SomeArgs args = SomeArgs.obtain(); args.arg1 = text; + args.arg2 = callback; args.argi1 = AccessibilityNodeInfo.getAccessibilityViewId(accessibilityNodeId); args.argi2 = AccessibilityNodeInfo.getVirtualDescendantId(accessibilityNodeId); args.argi3 = interactionId; - SomeArgs moreArgs = mPool.acquire(); - moreArgs.arg1 = callback; - moreArgs.argi1 = windowLeft; - moreArgs.argi2 = windowTop; - args.arg2 = moreArgs; - message.obj = args; // If the interrogation is performed by the same thread as the main UI @@ -333,18 +253,12 @@ private void findAccessibilityNodeInfosByTextUiThread(Message message) { SomeArgs args = (SomeArgs) message.obj; final String text = (String) args.arg1; + final IAccessibilityInteractionConnectionCallback callback = + (IAccessibilityInteractionConnectionCallback) args.arg2; final int accessibilityViewId = args.argi1; final int virtualDescendantId = args.argi2; final int interactionId = args.argi3; - - SomeArgs moreArgs = (SomeArgs) args.arg2; - final IAccessibilityInteractionConnectionCallback callback = - (IAccessibilityInteractionConnectionCallback) moreArgs.arg1; - mViewRootImpl.mAttachInfo.mActualWindowLeft = moreArgs.argi1; - mViewRootImpl.mAttachInfo.mActualWindowTop = moreArgs.argi2; - - mPool.release(moreArgs); - mPool.release(args); + args.recycle(); List infos = null; try { @@ -396,6 +310,7 @@ private void findAccessibilityNodeInfosByTextUiThread(Message message) { } finally { try { mViewRootImpl.mAttachInfo.mIncludeNotImportantViews = false; + applyApplicationScaleIfNeeded(infos); callback.setFindAccessibilityNodeInfosResult(infos, interactionId); } catch (RemoteException re) { /* ignore - the other side will time out */ @@ -403,25 +318,20 @@ private void findAccessibilityNodeInfosByTextUiThread(Message message) { } } - public void findFocusClientThread(long accessibilityNodeId, int focusType, int windowLeft, - int windowTop, int interactionId, IAccessibilityInteractionConnectionCallback callback, - int flags, int interogatingPid, long interrogatingTid) { + public void findFocusClientThread(long accessibilityNodeId, int focusType, int interactionId, + IAccessibilityInteractionConnectionCallback callback, int flags, int interogatingPid, + long interrogatingTid) { Message message = mHandler.obtainMessage(); message.what = PrivateHandler.MSG_FIND_FOCUS; message.arg1 = flags; message.arg2 = focusType; - SomeArgs args = mPool.acquire(); + SomeArgs args = SomeArgs.obtain(); args.argi1 = interactionId; args.argi2 = AccessibilityNodeInfo.getAccessibilityViewId(accessibilityNodeId); args.argi3 = AccessibilityNodeInfo.getVirtualDescendantId(accessibilityNodeId); args.arg1 = callback; - SomeArgs moreArgs = mPool.acquire(); - moreArgs.argi1 = windowLeft; - moreArgs.argi2 = windowTop; - args.arg2 = moreArgs; - message.obj = args; // If the interrogation is performed by the same thread as the main UI @@ -447,12 +357,7 @@ private void findFocusUiThread(Message message) { final IAccessibilityInteractionConnectionCallback callback = (IAccessibilityInteractionConnectionCallback) args.arg1; - SomeArgs moreArgs = (SomeArgs) args.arg2; - mViewRootImpl.mAttachInfo.mActualWindowLeft = moreArgs.argi1; - mViewRootImpl.mAttachInfo.mActualWindowTop = moreArgs.argi2; - - mPool.release(moreArgs); - mPool.release(args); + args.recycle(); AccessibilityNodeInfo focused = null; try { @@ -502,6 +407,7 @@ private void findFocusUiThread(Message message) { } finally { try { mViewRootImpl.mAttachInfo.mIncludeNotImportantViews = false; + applyApplicationScaleIfNeeded(focused); callback.setFindAccessibilityNodeInfoResult(focused, interactionId); } catch (RemoteException re) { /* ignore - the other side will time out */ @@ -509,25 +415,19 @@ private void findFocusUiThread(Message message) { } } - public void focusSearchClientThread(long accessibilityNodeId, int direction, int windowLeft, - int windowTop, int interactionId, IAccessibilityInteractionConnectionCallback callback, - int flags, int interogatingPid, long interrogatingTid) { + public void focusSearchClientThread(long accessibilityNodeId, int direction, int interactionId, + IAccessibilityInteractionConnectionCallback callback, int flags, int interogatingPid, + long interrogatingTid) { Message message = mHandler.obtainMessage(); message.what = PrivateHandler.MSG_FOCUS_SEARCH; message.arg1 = flags; message.arg2 = AccessibilityNodeInfo.getAccessibilityViewId(accessibilityNodeId); - SomeArgs args = mPool.acquire(); - args.argi1 = AccessibilityNodeInfo.getVirtualDescendantId(accessibilityNodeId); + SomeArgs args = SomeArgs.obtain(); args.argi2 = direction; args.argi3 = interactionId; args.arg1 = callback; - SomeArgs moreArgs = mPool.acquire(); - moreArgs.argi1 = windowLeft; - moreArgs.argi2 = windowTop; - args.arg2 = moreArgs; - message.obj = args; // If the interrogation is performed by the same thread as the main UI @@ -547,18 +447,12 @@ private void focusSearchUiThread(Message message) { final int accessibilityViewId = message.arg2; SomeArgs args = (SomeArgs) message.obj; - final int virtualDescendantId = args.argi1; final int direction = args.argi2; final int interactionId = args.argi3; final IAccessibilityInteractionConnectionCallback callback = (IAccessibilityInteractionConnectionCallback) args.arg1; - SomeArgs moreArgs = (SomeArgs) args.arg2; - mViewRootImpl.mAttachInfo.mActualWindowLeft = moreArgs.argi1; - mViewRootImpl.mAttachInfo.mActualWindowTop = moreArgs.argi2; - - mPool.release(moreArgs); - mPool.release(args); + args.recycle(); AccessibilityNodeInfo next = null; try { @@ -574,43 +468,15 @@ private void focusSearchUiThread(Message message) { root = mViewRootImpl.mView; } if (root != null && isShown(root)) { - if ((direction & View.FOCUS_ACCESSIBILITY) == View.FOCUS_ACCESSIBILITY) { - AccessibilityNodeProvider provider = root.getAccessibilityNodeProvider(); - if (provider != null) { - next = provider.accessibilityFocusSearch(direction, virtualDescendantId); - if (next != null) { - return; - } - } - View nextView = root.focusSearch(direction); - while (nextView != null) { - // If the focus search reached a node with a provider - // we delegate to the provider to find the next one. - // If the provider does not return a virtual view to - // take accessibility focus we try the next view found - // by the focus search algorithm. - provider = nextView.getAccessibilityNodeProvider(); - if (provider != null) { - next = provider.accessibilityFocusSearch(direction, View.NO_ID); - if (next != null) { - break; - } - nextView = nextView.focusSearch(direction); - } else { - next = nextView.createAccessibilityNodeInfo(); - break; - } - } - } else { - View nextView = root.focusSearch(direction); - if (nextView != null) { - next = nextView.createAccessibilityNodeInfo(); - } + View nextView = root.focusSearch(direction); + if (nextView != null) { + next = nextView.createAccessibilityNodeInfo(); } } } finally { try { mViewRootImpl.mAttachInfo.mIncludeNotImportantViews = false; + applyApplicationScaleIfNeeded(next); callback.setFindAccessibilityNodeInfoResult(next, interactionId); } catch (RemoteException re) { /* ignore - the other side will time out */ @@ -627,7 +493,7 @@ public void performAccessibilityActionClientThread(long accessibilityNodeId, int message.arg1 = flags; message.arg2 = AccessibilityNodeInfo.getAccessibilityViewId(accessibilityNodeId); - SomeArgs args = mPool.acquire(); + SomeArgs args = SomeArgs.obtain(); args.argi1 = AccessibilityNodeInfo.getVirtualDescendantId(accessibilityNodeId); args.argi2 = action; args.argi3 = interactionId; @@ -660,7 +526,7 @@ private void perfromAccessibilityActionUiThread(Message message) { (IAccessibilityInteractionConnectionCallback) args.arg1; Bundle arguments = (Bundle) args.arg2; - mPool.release(args); + args.recycle(); boolean succeeded = false; try { @@ -706,6 +572,39 @@ private View findViewByAccessibilityId(int accessibilityId) { return foundView; } + private void applyApplicationScaleIfNeeded(List infos) { + if (infos == null) { + return; + } + final float applicationScale = mViewRootImpl.mAttachInfo.mApplicationScale; + if (applicationScale != 1.0f) { + final int infoCount = infos.size(); + for (int i = 0; i < infoCount; i++) { + AccessibilityNodeInfo info = infos.get(i); + applyApplicationScaleIfNeeded(info); + } + } + } + + private void applyApplicationScaleIfNeeded(AccessibilityNodeInfo info) { + if (info == null) { + return; + } + final float applicationScale = mViewRootImpl.mAttachInfo.mApplicationScale; + if (applicationScale != 1.0f) { + Rect bounds = mTempRect; + + info.getBoundsInParent(bounds); + bounds.scale(applicationScale); + info.setBoundsInParent(bounds); + + info.getBoundsInScreen(bounds); + bounds.scale(applicationScale); + info.setBoundsInScreen(bounds); + } + } + + /** * This class encapsulates a prefetching strategy for the accessibility APIs for * querying window content. It is responsible to prefetch a batch of diff --git a/core/java/android/view/Choreographer.java b/core/java/android/view/Choreographer.java index 78dc86f4dd94f..b6617480764f2 100644 --- a/core/java/android/view/Choreographer.java +++ b/core/java/android/view/Choreographer.java @@ -16,6 +16,7 @@ package android.view; +import android.hardware.display.DisplayManagerGlobal; import android.os.Handler; import android.os.Looper; import android.os.Message; @@ -164,8 +165,8 @@ private Choreographer(Looper looper) { mHandler = new FrameHandler(looper); mDisplayEventReceiver = USE_VSYNC ? new FrameDisplayEventReceiver(looper) : null; mLastFrameTimeNanos = Long.MIN_VALUE; - mFrameIntervalNanos = (long)(1000000000 / - new Display(Display.DEFAULT_DISPLAY, null).getRefreshRate()); + + mFrameIntervalNanos = (long)(1000000000 / getRefreshRate()); mCallbackQueues = new CallbackQueue[CALLBACK_LAST + 1]; for (int i = 0; i <= CALLBACK_LAST; i++) { @@ -173,6 +174,12 @@ private Choreographer(Looper looper) { } } + private static float getRefreshRate() { + DisplayInfo di = DisplayManagerGlobal.getInstance().getDisplayInfo( + Display.DEFAULT_DISPLAY); + return di.refreshRate; + } + /** * Gets the choreographer for the calling thread. Must be called from * a thread that already has a {@link android.os.Looper} associated with it. @@ -677,7 +684,24 @@ public FrameDisplayEventReceiver(Looper looper) { } @Override - public void onVsync(long timestampNanos, int frame) { + public void onVsync(long timestampNanos, int builtInDisplayId, int frame) { + // Ignore vsync from secondary display. + // This can be problematic because the call to scheduleVsync() is a one-shot. + // We need to ensure that we will still receive the vsync from the primary + // display which is the one we really care about. Ideally we should schedule + // vsync for a particular display. + // At this time Surface Flinger won't send us vsyncs for secondary displays + // but that could change in the future so let's log a message to help us remember + // that we need to fix this. + if (builtInDisplayId != Surface.BUILT_IN_DISPLAY_ID_MAIN) { + Log.d(TAG, "Received vsync from secondary display, but we don't support " + + "this case yet. Choreographer needs a way to explicitly request " + + "vsync for a specific display to ensure it doesn't lose track " + + "of its scheduled vsync."); + scheduleVsync(); + return; + } + // Post the vsync event to the Handler. // The idea is to prevent incoming vsync events from completely starving // the message queue. If there are no messages in the queue with timestamps diff --git a/core/java/android/view/ContextThemeWrapper.java b/core/java/android/view/ContextThemeWrapper.java index 626f385551f76..6c733f9e11a88 100644 --- a/core/java/android/view/ContextThemeWrapper.java +++ b/core/java/android/view/ContextThemeWrapper.java @@ -18,6 +18,7 @@ import android.content.Context; import android.content.ContextWrapper; +import android.content.res.Configuration; import android.content.res.Resources; import android.os.Build; @@ -30,6 +31,8 @@ public class ContextThemeWrapper extends ContextWrapper { private int mThemeResource; private Resources.Theme mTheme; private LayoutInflater mInflater; + private Configuration mOverrideConfiguration; + private Resources mResources; public ContextThemeWrapper() { super(null); @@ -45,6 +48,41 @@ public ContextThemeWrapper(Context base, int themeres) { super.attachBaseContext(newBase); mBase = newBase; } + + /** + * Call to set an "override configuration" on this context -- this is + * a configuration that replies one or more values of the standard + * configuration that is applied to the context. See + * {@link Context#createConfigurationContext(Configuration)} for more + * information. + * + *

        This method can only be called once, and must be called before any + * calls to {@link #getResources()} are made. + */ + public void applyOverrideConfiguration(Configuration overrideConfiguration) { + if (mResources != null) { + throw new IllegalStateException("getResources() has already been called"); + } + if (mOverrideConfiguration != null) { + throw new IllegalStateException("Override configuration has already been set"); + } + mOverrideConfiguration = new Configuration(overrideConfiguration); + } + + @Override + public Resources getResources() { + if (mResources != null) { + return mResources; + } + if (mOverrideConfiguration == null) { + mResources = super.getResources(); + return mResources; + } else { + Context resc = createConfigurationContext(mOverrideConfiguration); + mResources = resc.getResources(); + return mResources; + } + } @Override public void setTheme(int resid) { mThemeResource = resid; diff --git a/core/java/android/view/Display.java b/core/java/android/view/Display.java index c94731201349b..758abb5999c4b 100644 --- a/core/java/android/view/Display.java +++ b/core/java/android/view/Display.java @@ -16,61 +16,309 @@ package android.view; -import android.content.res.CompatibilityInfo; +import android.graphics.PixelFormat; import android.graphics.Point; import android.graphics.Rect; -import android.os.RemoteException; -import android.os.ServiceManager; +import android.hardware.display.DisplayManagerGlobal; 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. + *

        + * The display area is described in two different ways. + *

          + *
        • 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}.
        • + *
        • 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}.
        • + *
        + *

        + * 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. + *

        */ -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 static final boolean DEBUG = false; + + private final DisplayManagerGlobal mGlobal; + private final int mDisplayId; + private final int mLayerStack; + private final int mFlags; + private final int mType; + private final String mAddress; + private final CompatibilityInfoHolder mCompatibilityInfo; + + private DisplayInfo mDisplayInfo; // never null + private boolean mIsValid; + + // 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. + * The default Display id, which is the id of the built-in primary display + * assuming there is one. */ 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. + * Display flag: Indicates that the display supports compositing content + * that is stored in protected graphics buffers. + *

        + * If this flag is set then the display device supports compositing protected buffers. + *

        + * If this flag is not set then the display device may not support compositing + * protected buffers; the user may see a blank region on the screen instead of + * the protected content. + *

        + * Secure (DRM) video decoders may allocate protected graphics buffers to request that + * a hardware-protected path be provided between the video decoder and the external + * display sink. If a hardware-protected path is not available, then content stored + * in protected graphics buffers may not be composited. + *

        + * An application can use the absence of this flag as a hint that it should not use protected + * buffers for this display because the content may not be visible. For example, + * if the flag is not set then the application may choose not to show content on this + * display, show an informative error message, select an alternate content stream + * or adopt a different strategy for decoding content that does not rely on + * protected buffers. + *

        + * + * @see #getFlags */ - 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 static final int FLAG_SUPPORTS_PROTECTED_BUFFERS = 1 << 0; + + /** + * Display flag: Indicates that the display has a secure video output and + * supports compositing secure surfaces. + *

        + * If this flag is set then the display device has a secure video output + * and is capable of showing secure surfaces. It may also be capable of + * showing {@link #FLAG_SUPPORTS_PROTECTED_BUFFERS protected buffers}. + *

        + * If this flag is not set then the display device may not have a secure video + * output; the user may see a blank region on the screen instead of + * the contents of secure surfaces or protected buffers. + *

        + * Secure surfaces are used to prevent content rendered into those surfaces + * by applications from appearing in screenshots or from being viewed + * on non-secure displays. Protected buffers are used by secure video decoders + * for a similar purpose. + *

        + * An application creates a window with a secure surface by specifying the + * {@link WindowManager.LayoutParams#FLAG_SECURE} window flag. + * Likewise, an application creates a {@link SurfaceView} with a secure surface + * by calling {@link SurfaceView#setSecure} before attaching the secure view to + * its containing window. + *

        + * An application can use the absence of this flag as a hint that it should not create + * secure surfaces or protected buffers on this display because the content may + * not be visible. For example, if the flag is not set then the application may + * choose not to show content on this display, show an informative error message, + * select an alternate content stream or adopt a different strategy for decoding + * content that does not rely on secure surfaces or protected buffers. + *

        + * + * @see #getFlags + */ + public static final int FLAG_SECURE = 1 << 1; + + /** + * Display type: Unknown display type. + * @hide + */ + public static final int TYPE_UNKNOWN = 0; + + /** + * Display type: Built-in display. + * @hide + */ + public static final int TYPE_BUILT_IN = 1; + + /** + * Display type: HDMI display. + * @hide + */ + public static final int TYPE_HDMI = 2; + + /** + * Display type: WiFi display. + * @hide + */ + public static final int TYPE_WIFI = 3; + + /** + * Display type: Overlay display. + * @hide + */ + public static final int TYPE_OVERLAY = 4; + + /** + * Internal method to create a display. + * Applications should use {@link android.view.WindowManager#getDefaultDisplay()} + * or {@link android.hardware.display.DisplayManager#getDisplay} + * to get a display object. + * + * @hide + */ + public Display(DisplayManagerGlobal global, + int displayId, DisplayInfo displayInfo /*not null*/, + CompatibilityInfoHolder compatibilityInfo) { + mGlobal = global; + mDisplayId = displayId; + mDisplayInfo = displayInfo; + mCompatibilityInfo = compatibilityInfo; + mIsValid = true; + + // Cache properties that cannot change as long as the display is valid. + mLayerStack = displayInfo.layerStack; + mFlags = displayInfo.flags; + mType = displayInfo.type; + mAddress = displayInfo.address; } /** - * Returns the index of this display. This is currently undefined; do - * not use. + * Gets the display id. + *

        + * Each logical display has a unique id. + * The default display has id {@link #DEFAULT_DISPLAY}. + *

        */ public int getDisplayId() { - return mDisplay; + return mDisplayId; } /** - * Returns the number of displays connected to the device. This is - * currently undefined; do not use. + * Returns true if this display is still valid, false if the display has been removed. + * + * If the display is invalid, then the methods of this class will + * continue to report the most recently observed display information. + * However, it is unwise (and rather fruitless) to continue using a + * {@link Display} object after the display's demise. + * + * It's possible for a display that was previously invalid to become + * valid again if a display with the same id is reconnected. + * + * @return True if the display is still valid. + */ + public boolean isValid() { + synchronized (this) { + updateDisplayInfoLocked(); + return mIsValid; + } + } + + /** + * Gets a full copy of the display information. + * + * @param outDisplayInfo The object to receive the copy of the display information. + * @return True if the display is still valid. + * @hide + */ + public boolean getDisplayInfo(DisplayInfo outDisplayInfo) { + synchronized (this) { + updateDisplayInfoLocked(); + outDisplayInfo.copyFrom(mDisplayInfo); + return mIsValid; + } + } + + /** + * Gets the display's layer stack. + * + * Each display has its own independent layer stack upon which surfaces + * are placed to be managed by surface flinger. + * + * @return The display's layer stack number. + * @hide + */ + public int getLayerStack() { + return mLayerStack; + } + + /** + * Returns a combination of flags that describe the capabilities of the display. + * + * @return The display flags. + * + * @see #FLAG_SUPPORTS_PROTECTED_BUFFERS + * @see #FLAG_SECURE + */ + public int getFlags() { + return mFlags; + } + + /** + * Gets the display type. + * + * @return The display type. + * + * @see #TYPE_UNKNOWN + * @see #TYPE_BUILT_IN + * @see #TYPE_HDMI + * @see #TYPE_WIFI + * @see #TYPE_OVERLAY + * @hide + */ + public int getType() { + return mType; + } + + /** + * Gets the display address, or null if none. + * Interpretation varies by display type. + * + * @return The display address. + * @hide + */ + public String getAddress() { + return mAddress; + } + + /** + * Gets the compatibility info used by this display instance. + * + * @return The compatibility info holder, or null if none is required. + * @hide + */ + public CompatibilityInfoHolder getCompatibilityInfo() { + return mCompatibilityInfo; + } + + /** + * Gets the name of the display. + *

        + * Note that some displays may be renamed by the user. + *

        + * + * @return The display's name. */ - native static int getDisplayCount(); - + public String getName() { + synchronized (this) { + updateDisplayInfoLocked(); + return mDisplayInfo.name; + } + } + /** * Gets the size of the display, in pixels. *

        @@ -84,7 +332,7 @@ public int getDisplayId() { *

        * 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. *

        @@ -92,43 +340,14 @@ public int getDisplayId() { * @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 +355,10 @@ private void getSizeInternal(Point outSize, boolean doCompat) { * @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 +393,12 @@ public void getRectSize(Rect outSize) { * 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 +408,9 @@ public void getCurrentSizeRange(Point outSmallestSize, Point outLargestSize) { * @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 +419,9 @@ public int getMaximumSizeDimension() { */ @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,75 +430,12 @@ public int getWidth() { */ @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. - *

        - * 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). - *

        - * The size is adjusted based on the current rotation of the display. - *

        - * @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. - *

        - * The size is adjusted based on the current rotation of the display. - *

        - * @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. - *

        - * The size is adjusted based on the current rotation of the display. - *

        - * @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} @@ -307,30 +454,43 @@ public int getRawHeight() { * {@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. *

        @@ -346,117 +506,113 @@ public float getRefreshRate() { * @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(); - if (ci != null) { - ci.applyToDisplayMetrics(outMetrics); + /** + * Gets the real size of the display without subtracting any window decor or + * applying any compatibility scale factors. + *

        + * The size is adjusted based on the current rotation of the display. + *

        + * 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). + *

        + * + * @param outSize Set to the real size of the display. + */ + public void getRealSize(Point outSize) { + synchronized (this) { + updateDisplayInfoLocked(); + outSize.x = mDisplayInfo.logicalWidth; + outSize.y = mDisplayInfo.logicalHeight; } - - 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 + *

        + * The size is adjusted based on the current rotation of the display. + *

        + * 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). + *

        + * + * @param outMetrics A {@link DisplayMetrics} object to receive the metrics. */ public void getRealMetrics(DisplayMetrics outMetrics) { - synchronized (mTmpPoint) { - getRealSize(mTmpPoint); - getMetricsWithSize(outMetrics, mTmpPoint.x, mTmpPoint.y); + synchronized (this) { + updateDisplayInfoLocked(); + mDisplayInfo.getLogicalMetrics(outMetrics, null); } } - /** - * If the display is mirrored to an external HDMI display, returns the - * width of that display. - * @hide - */ - public int getRawExternalWidth() { - return 1280; + private void updateDisplayInfoLocked() { + // Note: The display manager caches display info objects on our behalf. + DisplayInfo newInfo = mGlobal.getDisplayInfo(mDisplayId); + if (newInfo == null) { + // Preserve the old mDisplayInfo after the display is removed. + if (mIsValid) { + mIsValid = false; + if (DEBUG) { + Log.d(TAG, "Logical display " + mDisplayId + " was removed."); + } + } + } else { + // Use the new display info. (It might be the same object if nothing changed.) + mDisplayInfo = newInfo; + if (!mIsValid) { + mIsValid = true; + if (DEBUG) { + Log.d(TAG, "Logical display " + mDisplayId + " was recreated."); + } + } + } } - /** - * If the display is mirrored to an external HDMI display, returns the - * height of that display. - * @hide - */ - public int getRawExternalHeight() { - return 720; + 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; + } } - /** - * If the display is mirrored to an external HDMI display, returns the - * rotation of that display relative to its natural orientation. - * @hide - */ - public int getExternalRotation() { - return Surface.ROTATION_0; + // For debugging purposes + @Override + public String toString() { + synchronized (this) { + updateDisplayInfoLocked(); + mDisplayInfo.getAppMetrics(mTempMetrics, mCompatibilityInfo); + return "Display id " + mDisplayId + ": " + mDisplayInfo + + ", " + mTempMetrics + ", isValid=" + mIsValid; + } } /** - * 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; - } - - static IWindowManager getWindowManager() { - synchronized (sStaticInit) { - if (sWindowManager == null) { - sWindowManager = IWindowManager.Stub.asInterface( - ServiceManager.getService("window")); - } - return sWindowManager; + public static String typeToString(int type) { + switch (type) { + case TYPE_UNKNOWN: + return "UNKNOWN"; + case TYPE_BUILT_IN: + return "BUILT_IN"; + case TYPE_HDMI: + return "HDMI"; + case TYPE_WIFI: + return "WIFI"; + case TYPE_OVERLAY: + return "OVERLAY"; + default: + return Integer.toString(type); } } - - /* - * 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; - - /** - * Returns a display object which uses the metric's width/height instead. - * @hide - */ - public static Display createCompatibleDisplay(int displayId, CompatibilityInfoHolder compat) { - return new Display(displayId, compat); - } } diff --git a/core/java/android/view/DisplayEventReceiver.java b/core/java/android/view/DisplayEventReceiver.java index 6c2e540185922..a919ffc462ee2 100644 --- a/core/java/android/view/DisplayEventReceiver.java +++ b/core/java/android/view/DisplayEventReceiver.java @@ -66,7 +66,7 @@ public DisplayEventReceiver(Looper looper) { @Override protected void finalize() throws Throwable { try { - dispose(); + dispose(true); } finally { super.finalize(); } @@ -76,9 +76,17 @@ protected void finalize() throws Throwable { * Disposes the receiver. */ public void dispose() { + dispose(false); + } + + private void dispose(boolean finalized) { if (mCloseGuard != null) { + if (finalized) { + mCloseGuard.warnIfOpen(); + } mCloseGuard.close(); } + if (mReceiverPtr != 0) { nativeDispose(mReceiverPtr); mReceiverPtr = 0; @@ -93,9 +101,23 @@ public void dispose() { * * @param timestampNanos The timestamp of the pulse, in the {@link System#nanoTime()} * timebase. + * @param builtInDisplayId The surface flinger built-in display id such as + * {@link Surface#BUILT_IN_DISPLAY_ID_MAIN}. * @param frame The frame number. Increases by one for each vertical sync interval. */ - public void onVsync(long timestampNanos, int frame) { + public void onVsync(long timestampNanos, int builtInDisplayId, int frame) { + } + + /** + * Called when a display hotplug event is received. + * + * @param timestampNanos The timestamp of the event, in the {@link System#nanoTime()} + * timebase. + * @param builtInDisplayId The surface flinger built-in display id such as + * {@link Surface#BUILT_IN_DISPLAY_ID_HDMI}. + * @param connected True if the display is connected, false if it disconnected. + */ + public void onHotplug(long timestampNanos, int builtInDisplayId, boolean connected) { } /** @@ -113,7 +135,13 @@ public void scheduleVsync() { // Called from native code. @SuppressWarnings("unused") - private void dispatchVsync(long timestampNanos, int frame) { - onVsync(timestampNanos, frame); + private void dispatchVsync(long timestampNanos, int builtInDisplayId, int frame) { + onVsync(timestampNanos, builtInDisplayId, frame); + } + + // Called from native code. + @SuppressWarnings("unused") + private void dispatchHotplug(long timestampNanos, int builtInDisplayId, boolean connected) { + onHotplug(timestampNanos, builtInDisplayId, connected); } } diff --git a/core/java/android/view/DisplayInfo.aidl b/core/java/android/view/DisplayInfo.aidl new file mode 100644 index 0000000000000..e679208e73f76 --- /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 0000000000000..f3841d5960d98 --- /dev/null +++ b/core/java/android/view/DisplayInfo.java @@ -0,0 +1,335 @@ +/* + * 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; + +import libcore.util.Objects; + +/** + * Describes the characteristics of a particular logical display. + * @hide + */ +public final class DisplayInfo implements Parcelable { + /** + * The surface flinger layer stack associated with this logical display. + */ + public int layerStack; + + /** + * Display flags. + */ + public int flags; + + /** + * Display type. + */ + public int type; + + /** + * Display address, or null if none. + * Interpretation varies by display type. + */ + public String address; + + /** + * The human-readable name of the display. + */ + public String name; + + /** + * 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}. + *

        + * The value of this field is indeterminate if the logical display is presented on + * more than one physical display. + *

        + */ + public int rotation; + + /** + * The refresh rate of this display in frames per second. + *

        + * The value of this field is indeterminate if the logical display is presented on + * more than one physical display. + *

        + */ + public float refreshRate; + + /** + * The logical display density which is the basis for density-independent + * pixels. + */ + public int logicalDensityDpi; + + /** + * The exact physical pixels per inch of the screen in the X dimension. + *

        + * The value of this field is indeterminate if the logical display is presented on + * more than one physical display. + *

        + */ + public float physicalXDpi; + + /** + * The exact physical pixels per inch of the screen in the Y dimension. + *

        + * The value of this field is indeterminate if the logical display is presented on + * more than one physical display. + *

        + */ + public float physicalYDpi; + + public static final Creator CREATOR = new Creator() { + @Override + public DisplayInfo createFromParcel(Parcel source) { + return new DisplayInfo(source); + } + + @Override + public DisplayInfo[] newArray(int size) { + return new DisplayInfo[size]; + } + }; + + public DisplayInfo() { + } + + public DisplayInfo(DisplayInfo other) { + copyFrom(other); + } + + private DisplayInfo(Parcel source) { + readFromParcel(source); + } + + @Override + public boolean equals(Object o) { + return o instanceof DisplayInfo && equals((DisplayInfo)o); + } + + public boolean equals(DisplayInfo other) { + return other != null + && layerStack == other.layerStack + && flags == other.flags + && type == other.type + && Objects.equal(address, other.address) + && Objects.equal(name, other.name) + && 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 + && logicalDensityDpi == other.logicalDensityDpi + && physicalXDpi == other.physicalXDpi + && physicalYDpi == other.physicalYDpi; + } + + @Override + public int hashCode() { + return 0; // don't care + } + + public void copyFrom(DisplayInfo other) { + layerStack = other.layerStack; + flags = other.flags; + type = other.type; + address = other.address; + name = other.name; + 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; + logicalDensityDpi = other.logicalDensityDpi; + physicalXDpi = other.physicalXDpi; + physicalYDpi = other.physicalYDpi; + } + + public void readFromParcel(Parcel source) { + layerStack = source.readInt(); + flags = source.readInt(); + type = source.readInt(); + address = source.readString(); + name = source.readString(); + 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(); + logicalDensityDpi = source.readInt(); + physicalXDpi = source.readFloat(); + physicalYDpi = source.readFloat(); + } + + @Override + public void writeToParcel(Parcel dest, int flags) { + dest.writeInt(layerStack); + dest.writeInt(this.flags); + dest.writeInt(type); + dest.writeString(address); + dest.writeString(name); + 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.writeInt(logicalDensityDpi); + dest.writeFloat(physicalXDpi); + dest.writeFloat(physicalYDpi); + } + + @Override + public int describeContents() { + return 0; + } + + 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 = outMetrics.noncompatDensityDpi = logicalDensityDpi; + outMetrics.noncompatWidthPixels = outMetrics.widthPixels = width; + outMetrics.noncompatHeightPixels = outMetrics.heightPixels = height; + + outMetrics.density = outMetrics.noncompatDensity = + logicalDensityDpi * DisplayMetrics.DENSITY_DEFAULT_SCALE; + 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); + } + } + } + + // For debugging purposes + @Override + public String toString() { + return "DisplayInfo{\"" + name + "\", app " + appWidth + " x " + appHeight + + ", real " + logicalWidth + " x " + logicalHeight + + ", largest app " + largestNominalAppWidth + " x " + largestNominalAppHeight + + ", smallest app " + smallestNominalAppWidth + " x " + smallestNominalAppHeight + + ", " + refreshRate + " fps" + + ", rotation " + rotation + + ", density " + logicalDensityDpi + + ", " + physicalXDpi + " x " + physicalYDpi + " dpi" + + ", layerStack " + layerStack + + ", type " + Display.typeToString(type) + + ", address " + address + + flagsToString(flags) + "}"; + } + + private static String flagsToString(int flags) { + StringBuilder result = new StringBuilder(); + if ((flags & Display.FLAG_SECURE) != 0) { + result.append(", FLAG_SECURE"); + } + if ((flags & Display.FLAG_SUPPORTS_PROTECTED_BUFFERS) != 0) { + result.append(", FLAG_SUPPORTS_PROTECTED_BUFFERS"); + } + return result.toString(); + } +} diff --git a/core/java/android/view/DisplayList.java b/core/java/android/view/DisplayList.java index a42e15677c39d..5e34a36bb52da 100644 --- a/core/java/android/view/DisplayList.java +++ b/core/java/android/view/DisplayList.java @@ -332,4 +332,11 @@ public abstract void setTransformationInfo(float alpha, float translationX, floa * @see View#offsetTopAndBottom(int) */ public abstract void offsetTopBottom(int offset); + + /** + * Reset native resources. This is called when cleaning up the state of DisplayLists + * during destruction of hardware resources, to ensure that we do not hold onto + * obsolete resources after related resources are gone. + */ + public abstract void reset(); } diff --git a/core/java/android/view/FocusFinder.java b/core/java/android/view/FocusFinder.java index 9063cea940576..b2988ed34971b 100644 --- a/core/java/android/view/FocusFinder.java +++ b/core/java/android/view/FocusFinder.java @@ -79,17 +79,9 @@ public View findNextFocusFromRect(ViewGroup root, Rect focusedRect, int directio } private View findNextFocus(ViewGroup root, View focused, Rect focusedRect, int direction) { - if ((direction & View.FOCUS_ACCESSIBILITY) != View.FOCUS_ACCESSIBILITY) { - return findNextInputFocus(root, focused, focusedRect, direction); - } else { - return findNextAccessibilityFocus(root, focused, focusedRect, direction); - } - } - - private View findNextInputFocus(ViewGroup root, View focused, Rect focusedRect, int direction) { View next = null; if (focused != null) { - next = findNextUserSpecifiedInputFocus(root, focused, direction); + next = findNextUserSpecifiedFocus(root, focused, direction); } if (next != null) { return next; @@ -107,7 +99,7 @@ private View findNextInputFocus(ViewGroup root, View focused, Rect focusedRect, return next; } - private View findNextUserSpecifiedInputFocus(ViewGroup root, View focused, int direction) { + private View findNextUserSpecifiedFocus(ViewGroup root, View focused, int direction) { // check for user specified next focus View userSetNextFocus = focused.findUserSetNextFocus(root, direction); if (userSetNextFocus != null && userSetNextFocus.isFocusable() @@ -120,7 +112,6 @@ private View findNextUserSpecifiedInputFocus(ViewGroup root, View focused, int d private View findNextFocus(ViewGroup root, View focused, Rect focusedRect, int direction, ArrayList focusables) { - final int directionMasked = (direction & ~View.FOCUS_ACCESSIBILITY); if (focused != null) { if (focusedRect == null) { focusedRect = mFocusedRect; @@ -132,7 +123,7 @@ private View findNextFocus(ViewGroup root, View focused, Rect focusedRect, if (focusedRect == null) { focusedRect = mFocusedRect; // make up a rect at top left or bottom right of root - switch (directionMasked) { + switch (direction) { case View.FOCUS_RIGHT: case View.FOCUS_DOWN: setFocusTopLeft(root, focusedRect); @@ -160,37 +151,23 @@ private View findNextFocus(ViewGroup root, View focused, Rect focusedRect, } } - switch (directionMasked) { + switch (direction) { case View.FOCUS_FORWARD: case View.FOCUS_BACKWARD: - return findNextInputFocusInRelativeDirection(focusables, root, focused, focusedRect, - directionMasked); + return findNextFocusInRelativeDirection(focusables, root, focused, focusedRect, + direction); case View.FOCUS_UP: case View.FOCUS_DOWN: case View.FOCUS_LEFT: case View.FOCUS_RIGHT: - return findNextInputFocusInAbsoluteDirection(focusables, root, focused, - focusedRect, directionMasked); + return findNextFocusInAbsoluteDirection(focusables, root, focused, + focusedRect, direction); default: - throw new IllegalArgumentException("Unknown direction: " + directionMasked); - } - } - - private View findNextAccessibilityFocus(ViewGroup root, View focused, - Rect focusedRect, int direction) { - ArrayList focusables = mTempList; - try { - focusables.clear(); - root.addFocusables(focusables, direction, View.FOCUSABLES_ACCESSIBILITY); - View next = findNextFocus(root, focused, focusedRect, direction, - focusables); - return next; - } finally { - focusables.clear(); + throw new IllegalArgumentException("Unknown direction: " + direction); } } - private View findNextInputFocusInRelativeDirection(ArrayList focusables, ViewGroup root, + private View findNextFocusInRelativeDirection(ArrayList focusables, ViewGroup root, View focused, Rect focusedRect, int direction) { try { // Note: This sort is stable. @@ -222,7 +199,7 @@ private void setFocusTopLeft(ViewGroup root, Rect focusedRect) { focusedRect.set(rootLeft, rootTop, rootLeft, rootTop); } - View findNextInputFocusInAbsoluteDirection(ArrayList focusables, ViewGroup root, View focused, + View findNextFocusInAbsoluteDirection(ArrayList focusables, ViewGroup root, View focused, Rect focusedRect, int direction) { // initialize the best candidate to something impossible // (so the first plausible view will become the best choice) @@ -250,8 +227,8 @@ View findNextInputFocusInAbsoluteDirection(ArrayList focusables, ViewGroup // only interested in other non-root views if (focusable == focused || focusable == root) continue; - // get visible bounds of other view in same coordinate system - focusable.getDrawingRect(mOtherRect); + // get focus bounds of other view in same coordinate system + focusable.getFocusedRect(mOtherRect); root.offsetDescendantRectToMyCoords(focusable, mOtherRect); if (isBetterCandidate(direction, focusedRect, mOtherRect, mBestCandidateRect)) { diff --git a/core/java/android/view/GLES20Canvas.java b/core/java/android/view/GLES20Canvas.java index 055aee3e84400..b64a06e9cc790 100644 --- a/core/java/android/view/GLES20Canvas.java +++ b/core/java/android/view/GLES20Canvas.java @@ -147,20 +147,36 @@ protected void finalize() throws Throwable { /////////////////////////////////////////////////////////////////////////// // Hardware layers /////////////////////////////////////////////////////////////////////////// - + + @Override + void pushLayerUpdate(HardwareLayer layer) { + nPushLayerUpdate(mRenderer, ((GLES20RenderLayer) layer).mLayer); + } + + @Override + void clearLayerUpdates() { + nClearLayerUpdates(mRenderer); + } + static native int nCreateTextureLayer(boolean opaque, int[] layerInfo); static native int nCreateLayer(int width, int height, boolean isOpaque, int[] layerInfo); - static native void nResizeLayer(int layerId, int width, int height, int[] layerInfo); + static native boolean nResizeLayer(int layerId, int width, int height, int[] layerInfo); + static native void nSetOpaqueLayer(int layerId, boolean isOpaque); + static native void nSetLayerPaint(int layerId, int nativePaint); + static native void nSetLayerColorFilter(int layerId, int nativeColorFilter); static native void nUpdateTextureLayer(int layerId, int width, int height, boolean opaque, SurfaceTexture surface); + static native void nClearLayerTexture(int layerId); static native void nSetTextureLayerTransform(int layerId, int matrix); static native void nDestroyLayer(int layerId); static native void nDestroyLayerDeferred(int layerId); - static native void nFlushLayer(int layerId); static native void nUpdateRenderLayer(int layerId, int renderer, int displayList, int left, int top, int right, int bottom); static native boolean nCopyLayer(int layerId, int bitmap); + private static native void nClearLayerUpdates(int renderer); + private static native void nPushLayerUpdate(int renderer, int layer); + /////////////////////////////////////////////////////////////////////////// // Canvas management /////////////////////////////////////////////////////////////////////////// @@ -394,13 +410,8 @@ void outputDisplayList(DisplayList displayList) { void drawHardwareLayer(HardwareLayer layer, float x, float y, Paint paint) { final GLES20Layer glLayer = (GLES20Layer) layer; - int modifier = paint != null ? setupColorFilter(paint) : MODIFIER_NONE; - try { - final int nativePaint = paint == null ? 0 : paint.mNativePaint; - nDrawLayer(mRenderer, glLayer.getLayer(), x, y, nativePaint); - } finally { - if (modifier != MODIFIER_NONE) nResetModifiers(mRenderer, modifier); - } + final int nativePaint = paint == null ? 0 : paint.mNativePaint; + nDrawLayer(mRenderer, glLayer.getLayer(), x, y, nativePaint); } private static native void nDrawLayer(int renderer, int layer, float x, float y, int paint); diff --git a/core/java/android/view/GLES20DisplayList.java b/core/java/android/view/GLES20DisplayList.java index 2d2e8e48e16d8..e9bd0c43976de 100644 --- a/core/java/android/view/GLES20DisplayList.java +++ b/core/java/android/view/GLES20DisplayList.java @@ -25,9 +25,12 @@ * An implementation of display list for OpenGL ES 2.0. */ class GLES20DisplayList extends DisplayList { - // These lists ensure that any Bitmaps recorded by a DisplayList are kept alive as long - // as the DisplayList is alive. The Bitmaps are populated by the GLES20RecordingCanvas. + // These lists ensure that any Bitmaps and DisplayLists recorded by a DisplayList are kept + // alive as long as the DisplayList is alive. The Bitmap and DisplayList lists + // are populated by the GLES20RecordingCanvas during appropriate drawing calls and are + // cleared at the start of a new drawing frame or when the view is detached from the window. final ArrayList mBitmaps = new ArrayList(5); + final ArrayList mChildDisplayLists = new ArrayList(); private GLES20RecordingCanvas mCanvas; private boolean mValid; @@ -79,6 +82,14 @@ public void invalidate() { public void clear() { if (!mValid) { mBitmaps.clear(); + mChildDisplayLists.clear(); + } + } + + @Override + public void reset() { + if (hasNativeDisplayList()) { + nReset(mFinalizer.mNativeDisplayList); } } @@ -290,6 +301,7 @@ public void offsetTopBottom(int offset) { } } + private static native void nReset(int displayList); private static native void nOffsetTopBottom(int displayList, int offset); private static native void nOffsetLeftRight(int displayList, int offset); private static native void nSetLeftTopRightBottom(int displayList, int left, int top, diff --git a/core/java/android/view/GLES20Layer.java b/core/java/android/view/GLES20Layer.java index 4f25792d6317e..812fb977421ed 100644 --- a/core/java/android/view/GLES20Layer.java +++ b/core/java/android/view/GLES20Layer.java @@ -18,6 +18,7 @@ package android.view; import android.graphics.Bitmap; +import android.graphics.Paint; /** * An OpenGL ES 2.0 implementation of {@link HardwareLayer}. @@ -43,13 +44,17 @@ public int getLayer() { } @Override - boolean copyInto(Bitmap bitmap) { - return GLES20Canvas.nCopyLayer(mLayer, bitmap.mNativeBitmap); + void setLayerPaint(Paint paint) { + if (paint != null) { + GLES20Canvas.nSetLayerPaint(mLayer, paint.mNativePaint); + GLES20Canvas.nSetLayerColorFilter(mLayer, paint.getColorFilter() != null ? + paint.getColorFilter().nativeColorFilter : 0); + } } - + @Override - void update(int width, int height, boolean isOpaque) { - super.update(width, height, isOpaque); + boolean copyInto(Bitmap bitmap) { + return GLES20Canvas.nCopyLayer(mLayer, bitmap.mNativeBitmap); } @Override @@ -60,12 +65,10 @@ void destroy() { } mLayer = 0; } - + @Override - void flush() { - if (mLayer != 0) { - GLES20Canvas.nFlushLayer(mLayer); - } + void clearStorage() { + if (mLayer != 0) GLES20Canvas.nClearLayerTexture(mLayer); } static class Finalizer { diff --git a/core/java/android/view/GLES20RecordingCanvas.java b/core/java/android/view/GLES20RecordingCanvas.java index c9ba65f3ab40d..d2df45adec136 100644 --- a/core/java/android/view/GLES20RecordingCanvas.java +++ b/core/java/android/view/GLES20RecordingCanvas.java @@ -76,6 +76,7 @@ void recycle() { void start() { mDisplayList.mBitmaps.clear(); + mDisplayList.mChildDisplayLists.clear(); } int end(int nativeDisplayList) { @@ -155,6 +156,13 @@ public void drawCircle(float cx, float cy, float radius, Paint paint) { recordShaderBitmap(paint); } + @Override + public int drawDisplayList(DisplayList displayList, Rect dirty, int flags) { + int status = super.drawDisplayList(displayList, dirty, flags); + mDisplayList.mChildDisplayLists.add(displayList); + return status; + } + @Override public void drawLine(float startX, float startY, float stopX, float stopY, Paint paint) { super.drawLine(startX, startY, stopX, stopY, paint); @@ -227,18 +235,6 @@ public void drawRect(float left, float top, float right, float bottom, Paint pai recordShaderBitmap(paint); } - @Override - public void drawRect(Rect r, Paint paint) { - super.drawRect(r, paint); - recordShaderBitmap(paint); - } - - @Override - public void drawRect(RectF r, Paint paint) { - super.drawRect(r, paint); - recordShaderBitmap(paint); - } - @Override public void drawRoundRect(RectF rect, float rx, float ry, Paint paint) { super.drawRoundRect(rect, rx, ry, paint); diff --git a/core/java/android/view/GLES20RenderLayer.java b/core/java/android/view/GLES20RenderLayer.java index c727a367180d5..44d4719bcfbac 100644 --- a/core/java/android/view/GLES20RenderLayer.java +++ b/core/java/android/view/GLES20RenderLayer.java @@ -54,8 +54,8 @@ boolean isValid() { } @Override - void resize(int width, int height) { - if (!isValid() || width <= 0 || height <= 0) return; + boolean resize(int width, int height) { + if (!isValid() || width <= 0 || height <= 0) return false; mWidth = width; mHeight = height; @@ -63,11 +63,23 @@ void resize(int width, int height) { if (width != mLayerWidth || height != mLayerHeight) { int[] layerInfo = new int[2]; - GLES20Canvas.nResizeLayer(mLayer, width, height, layerInfo); - - mLayerWidth = layerInfo[0]; - mLayerHeight = layerInfo[1]; + if (GLES20Canvas.nResizeLayer(mLayer, width, height, layerInfo)) { + mLayerWidth = layerInfo[0]; + mLayerHeight = layerInfo[1]; + } else { + // Failure: not enough GPU resources for requested size + mLayer = 0; + mLayerWidth = 0; + mLayerHeight = 0; + } } + return isValid(); + } + + @Override + void setOpaque(boolean isOpaque) { + mOpaque = isOpaque; + GLES20Canvas.nSetOpaqueLayer(mLayer, isOpaque); } @Override @@ -98,7 +110,7 @@ void setTransform(Matrix matrix) { } @Override - void redraw(DisplayList displayList, Rect dirtyRect) { + void redrawLater(DisplayList displayList, Rect dirtyRect) { GLES20Canvas.nUpdateRenderLayer(mLayer, mCanvas.getRenderer(), ((GLES20DisplayList) displayList).getNativeDisplayList(), dirtyRect.left, dirtyRect.top, dirtyRect.right, dirtyRect.bottom); diff --git a/core/java/android/view/GLES20TextureLayer.java b/core/java/android/view/GLES20TextureLayer.java index 16a13cfa2f7a1..e863e49a01411 100644 --- a/core/java/android/view/GLES20TextureLayer.java +++ b/core/java/android/view/GLES20TextureLayer.java @@ -39,13 +39,7 @@ class GLES20TextureLayer extends GLES20Layer { mFinalizer = new Finalizer(mLayer); } else { mFinalizer = null; - } - } - - GLES20TextureLayer(SurfaceTexture surface, boolean isOpaque) { - this(isOpaque); - mSurface = surface; - mSurface.attachToGLContext(mTexture); + } } @Override @@ -54,7 +48,8 @@ boolean isValid() { } @Override - void resize(int width, int height) { + boolean resize(int width, int height) { + return isValid(); } @Override @@ -92,12 +87,17 @@ void update(int width, int height, boolean isOpaque) { GLES20Canvas.nUpdateTextureLayer(mLayer, width, height, isOpaque, mSurface); } + @Override + void setOpaque(boolean isOpaque) { + throw new UnsupportedOperationException("Use update(int, int, boolean) instead"); + } + @Override void setTransform(Matrix matrix) { GLES20Canvas.nSetTextureLayerTransform(mLayer, matrix.native_instance); } @Override - void redraw(DisplayList displayList, Rect dirtyRect) { + void redrawLater(DisplayList displayList, Rect dirtyRect) { } } diff --git a/core/java/android/view/GestureDetector.java b/core/java/android/view/GestureDetector.java index 4bbdd4e3b534a..9ddb32e9b2aad 100644 --- a/core/java/android/view/GestureDetector.java +++ b/core/java/android/view/GestureDetector.java @@ -482,6 +482,27 @@ public boolean onTouchEvent(MotionEvent ev) { case MotionEvent.ACTION_POINTER_UP: mDownFocusX = mLastFocusX = focusX; mDownFocusY = mLastFocusY = focusY; + + // Check the dot product of current velocities. + // If the pointer that left was opposing another velocity vector, clear. + mVelocityTracker.computeCurrentVelocity(1000, mMaximumFlingVelocity); + final int upIndex = ev.getActionIndex(); + final int id1 = ev.getPointerId(upIndex); + final float x1 = mVelocityTracker.getXVelocity(id1); + final float y1 = mVelocityTracker.getYVelocity(id1); + for (int i = 0; i < count; i++) { + if (i == upIndex) continue; + + final int id2 = ev.getPointerId(i); + final float x = x1 * mVelocityTracker.getXVelocity(id2); + final float y = y1 * mVelocityTracker.getYVelocity(id2); + + final float dot = x + y; + if (dot < 0) { + mVelocityTracker.clear(); + break; + } + } break; case MotionEvent.ACTION_DOWN: diff --git a/core/java/android/view/Gravity.java b/core/java/android/view/Gravity.java index 4547aa681c07f..9a89fa58d4573 100644 --- a/core/java/android/view/Gravity.java +++ b/core/java/android/view/Gravity.java @@ -153,9 +153,8 @@ public static void apply(int gravity, int w, int h, Rect container, Rect outRect * container. * @param layoutDirection The layout direction. * - * @see {@link View#LAYOUT_DIRECTION_LTR} - * @see {@link View#LAYOUT_DIRECTION_RTL} - * @hide + * @see View#LAYOUT_DIRECTION_LTR + * @see View#LAYOUT_DIRECTION_RTL */ public static void apply(int gravity, int w, int h, Rect container, Rect outRect, int layoutDirection) { @@ -291,9 +290,8 @@ public static void apply(int gravity, int w, int h, Rect container, * container. * @param layoutDirection The layout direction. * - * @see {@link View#LAYOUT_DIRECTION_LTR} - * @see {@link View#LAYOUT_DIRECTION_RTL} - * @hide + * @see View#LAYOUT_DIRECTION_LTR + * @see View#LAYOUT_DIRECTION_RTL */ public static void apply(int gravity, int w, int h, Rect container, int xAdj, int yAdj, Rect outRect, int layoutDirection) { @@ -372,9 +370,8 @@ public static void applyDisplay(int gravity, Rect display, Rect inoutObj) { * modified if needed to fit in the display. * @param layoutDirection The layout direction. * - * @see {@link View#LAYOUT_DIRECTION_LTR} - * @see {@link View#LAYOUT_DIRECTION_RTL} - * @hide + * @see View#LAYOUT_DIRECTION_LTR + * @see View#LAYOUT_DIRECTION_RTL */ public static void applyDisplay(int gravity, Rect display, Rect inoutObj, int layoutDirection) { int absGravity = getAbsoluteGravity(gravity, layoutDirection); @@ -411,7 +408,6 @@ public static boolean isHorizontal(int gravity) { * @param gravity The gravity to convert to absolute (horizontal) values. * @param layoutDirection The layout direction. * @return gravity converted to absolute (horizontal) values. - * @hide */ public static int getAbsoluteGravity(int gravity, int layoutDirection) { int result = gravity; diff --git a/core/java/android/view/HardwareCanvas.java b/core/java/android/view/HardwareCanvas.java index 777552a23b5a5..eeae3ed841657 100644 --- a/core/java/android/view/HardwareCanvas.java +++ b/core/java/android/view/HardwareCanvas.java @@ -132,4 +132,20 @@ public int invokeFunctors(Rect dirty) { * @see #detachFunctor(int) */ abstract void attachFunctor(int functor); + + /** + * Indicates that the specified layer must be updated as soon as possible. + * + * @param layer The layer to update + * + * @see #clearLayerUpdates() + */ + abstract void pushLayerUpdate(HardwareLayer layer); + + /** + * Removes all enqueued layer updates. + * + * @see #pushLayerUpdate(HardwareLayer) + */ + abstract void clearLayerUpdates(); } diff --git a/core/java/android/view/HardwareLayer.java b/core/java/android/view/HardwareLayer.java index e73f7bf786dec..d3bc35a2af42d 100644 --- a/core/java/android/view/HardwareLayer.java +++ b/core/java/android/view/HardwareLayer.java @@ -19,6 +19,7 @@ import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Matrix; +import android.graphics.Paint; import android.graphics.Rect; /** @@ -61,6 +62,14 @@ abstract class HardwareLayer { mOpaque = isOpaque; } + /** + * Update the paint used when drawing this layer. + * + * @param paint The paint used when the layer is drawn into the destination canvas. + * @see View#setLayerPaint(android.graphics.Paint) + */ + void setLayerPaint(Paint paint) {} + /** * Returns the minimum width of the layer. * @@ -106,6 +115,13 @@ boolean isOpaque() { return mOpaque; } + /** + * Sets whether or not this layer should be considered opaque. + * + * @param isOpaque True if the layer is opaque, false otherwise + */ + abstract void setOpaque(boolean isOpaque); + /** * Indicates whether this layer can be rendered. * @@ -119,8 +135,9 @@ boolean isOpaque() { * * @param width The new desired minimum width for this layer * @param height The new desired minimum height for this layer + * @return True if the resulting layer is valid, false otherwise */ - abstract void resize(int width, int height); + abstract boolean resize(int width, int height); /** * Returns a hardware canvas that can be used to render onto @@ -135,11 +152,6 @@ boolean isOpaque() { */ abstract void destroy(); - /** - * Flush the render queue associated with this layer. - */ - abstract void flush(); - /** * This must be invoked before drawing onto this layer. * @param currentCanvas @@ -191,5 +203,10 @@ void update(int width, int height, boolean isOpaque) { * execute in this layer * @param dirtyRect The dirty region of the layer that needs to be redrawn */ - abstract void redraw(DisplayList displayList, Rect dirtyRect); + abstract void redrawLater(DisplayList displayList, Rect dirtyRect); + + /** + * Indicates that this layer has lost its underlying storage. + */ + abstract void clearStorage(); } diff --git a/core/java/android/view/HardwareRenderer.java b/core/java/android/view/HardwareRenderer.java index dab48b1400e3e..1c61324595018 100644 --- a/core/java/android/view/HardwareRenderer.java +++ b/core/java/android/view/HardwareRenderer.java @@ -21,6 +21,7 @@ import android.graphics.Paint; import android.graphics.Rect; import android.graphics.SurfaceTexture; +import android.opengl.EGL14; import android.opengl.GLUtils; import android.opengl.ManagedEGLContext; import android.os.Handler; @@ -135,7 +136,30 @@ public abstract class HardwareRenderer { * @hide */ public static final String DEBUG_DIRTY_REGIONS_PROPERTY = "debug.hwui.show_dirty_regions"; - + + /** + * Turn on to flash hardware layers when they update. + * + * Possible values: + * "true", to enable hardware layers updates debugging + * "false", to disable hardware layers updates debugging + * + * @hide + */ + public static final String DEBUG_SHOW_LAYERS_UPDATES_PROPERTY = + "debug.hwui.show_layers_updates"; + + /** + * Turn on to show overdraw level. + * + * Possible values: + * "true", to enable overdraw debugging + * "false", to disable overdraw debugging + * + * @hide + */ + public static final String DEBUG_SHOW_OVERDRAW_PROPERTY = "debug.hwui.show_overdraw"; + /** * A process can set this flag to false to prevent the use of hardware * rendering. @@ -197,18 +221,18 @@ public static boolean isAvailable() { /** * Initializes the hardware renderer for the specified surface. * - * @param holder The holder for the surface to hardware accelerate. + * @param surface The surface to hardware accelerate * * @return True if the initialization was successful, false otherwise. */ - abstract boolean initialize(SurfaceHolder holder) throws Surface.OutOfResourcesException; + abstract boolean initialize(Surface surface) throws Surface.OutOfResourcesException; /** * Updates the hardware renderer for the specified surface. - * - * @param holder The holder for the surface to hardware accelerate + * + * @param surface The surface to hardware accelerate */ - abstract void updateSurface(SurfaceHolder holder) throws Surface.OutOfResourcesException; + abstract void updateSurface(Surface surface) throws Surface.OutOfResourcesException; /** * Destroys the layers used by the specified view hierarchy. @@ -228,10 +252,10 @@ public static boolean isAvailable() { /** * This method should be invoked whenever the current hardware renderer * context should be reset. - * - * @param holder The holder for the surface to hardware accelerate + * + * @param surface The surface to hardware accelerate */ - abstract void invalidate(SurfaceHolder holder); + abstract void invalidate(Surface surface); /** * This method should be invoked to ensure the hardware renderer is in @@ -357,6 +381,14 @@ static void disableVsync() { private static native void nDisableVsync(); + /** + * Indicates that the specified hardware layer needs to be updated + * as soon as possible. + * + * @param layer The hardware layer that needs an update + */ + abstract void pushLayerUpdate(HardwareLayer layer); + /** * Interface used to receive callbacks whenever a view is drawn by * a hardware renderer instance. @@ -474,18 +506,23 @@ abstract boolean draw(View view, View.AttachInfo attachInfo, HardwareDrawCallbac * * @param width The width of the drawing surface. * @param height The height of the drawing surface. - * @param holder The target surface + * @param surface The surface to hardware accelerate + * + * @return true if the surface was initialized, false otherwise. Returning + * false might mean that the surface was already initialized. */ - void initializeIfNeeded(int width, int height, SurfaceHolder holder) + boolean initializeIfNeeded(int width, int height, Surface surface) throws Surface.OutOfResourcesException { if (isRequested()) { // We lost the gl context, so recreate it. if (!isEnabled()) { - if (initialize(holder)) { + if (initialize(surface)) { setup(width, height); + return true; } } - } + } + return false; } /** @@ -577,12 +614,6 @@ void setRequested(boolean requested) { @SuppressWarnings({"deprecation"}) static abstract class GlRenderer extends HardwareRenderer { - // These values are not exposed in our EGL APIs - static final int EGL_CONTEXT_CLIENT_VERSION = 0x3098; - static final int EGL_OPENGL_ES2_BIT = 4; - static final int EGL_SURFACE_TYPE = 0x3033; - static final int EGL_SWAP_BEHAVIOR_PRESERVED_BIT = 0x0400; - static final int SURFACE_STATE_ERROR = 0; static final int SURFACE_STATE_SUCCESS = 1; static final int SURFACE_STATE_UPDATED = 2; @@ -629,6 +660,7 @@ static abstract class GlRenderer extends HardwareRenderer { int mProfileCurrentFrame = -PROFILE_FRAME_DATA_COUNT; final boolean mDebugDirtyRegions; + final boolean mShowOverdraw; final int mGlVersion; final boolean mTranslucent; @@ -678,6 +710,9 @@ static abstract class GlRenderer extends HardwareRenderer { if (mDebugDirtyRegions) { Log.d(LOG_TAG, "Debugging dirty regions"); } + + mShowOverdraw = SystemProperties.getBoolean( + HardwareRenderer.DEBUG_SHOW_OVERDRAW_PROPERTY, false); } @Override @@ -721,13 +756,17 @@ boolean hasDirtyRegions() { */ void checkEglErrors() { if (isEnabled()) { - int error = sEgl.eglGetError(); - if (error != EGL_SUCCESS) { - // something bad has happened revert to - // normal rendering. - Log.w(LOG_TAG, "EGL error: " + GLUtils.getEGLErrorString(error)); - fallback(error != EGL11.EGL_CONTEXT_LOST); - } + checkEglErrorsForced(); + } + } + + private void checkEglErrorsForced() { + int error = sEgl.eglGetError(); + if (error != EGL_SUCCESS) { + // something bad has happened revert to + // normal rendering. + Log.w(LOG_TAG, "EGL error: " + GLUtils.getEGLErrorString(error)); + fallback(error != EGL11.EGL_CONTEXT_LOST); } } @@ -742,10 +781,10 @@ private void fallback(boolean fallback) { } @Override - boolean initialize(SurfaceHolder holder) throws Surface.OutOfResourcesException { + boolean initialize(Surface surface) throws Surface.OutOfResourcesException { if (isRequested() && !isEnabled()) { initializeEgl(); - mGl = createEglSurface(holder); + mGl = createEglSurface(surface); mDestroyed = false; if (mGl != null) { @@ -771,9 +810,9 @@ boolean initialize(SurfaceHolder holder) throws Surface.OutOfResourcesException } @Override - void updateSurface(SurfaceHolder holder) throws Surface.OutOfResourcesException { + void updateSurface(Surface surface) throws Surface.OutOfResourcesException { if (isRequested() && isEnabled()) { - createEglSurface(holder); + createEglSurface(surface); } } @@ -800,7 +839,9 @@ void initializeEgl() { throw new RuntimeException("eglInitialize failed " + GLUtils.getEGLErrorString(sEgl.eglGetError())); } - + + checkEglErrorsForced(); + sEglConfig = chooseEglConfig(); if (sEglConfig == null) { // We tried to use EGL_SWAP_BEHAVIOR_PRESERVED_BIT, try again without @@ -884,11 +925,20 @@ private static void printConfig(EGLConfig config) { sEgl.eglGetConfigAttrib(sEglDisplay, config, EGL_STENCIL_SIZE, value); Log.d(LOG_TAG, " STENCIL_SIZE = " + value[0]); + sEgl.eglGetConfigAttrib(sEglDisplay, config, EGL_SAMPLE_BUFFERS, value); + Log.d(LOG_TAG, " SAMPLE_BUFFERS = " + value[0]); + + sEgl.eglGetConfigAttrib(sEglDisplay, config, EGL_SAMPLES, value); + Log.d(LOG_TAG, " SAMPLES = " + value[0]); + sEgl.eglGetConfigAttrib(sEglDisplay, config, EGL_SURFACE_TYPE, value); Log.d(LOG_TAG, " SURFACE_TYPE = 0x" + Integer.toHexString(value[0])); + + sEgl.eglGetConfigAttrib(sEglDisplay, config, EGL_CONFIG_CAVEAT, value); + Log.d(LOG_TAG, " CONFIG_CAVEAT = 0x" + Integer.toHexString(value[0])); } - GL createEglSurface(SurfaceHolder holder) throws Surface.OutOfResourcesException { + GL createEglSurface(Surface surface) throws Surface.OutOfResourcesException { // Check preconditions. if (sEgl == null) { throw new RuntimeException("egl not initialized"); @@ -908,23 +958,12 @@ GL createEglSurface(SurfaceHolder holder) throws Surface.OutOfResourcesException destroySurface(); // Create an EGL surface we can render into. - if (!createSurface(holder)) { + if (!createSurface(surface)) { return null; } - /* - * Before we can issue GL commands, we need to make sure - * the context is current and bound to a surface. - */ - if (!sEgl.eglMakeCurrent(sEglDisplay, mEglSurface, mEglSurface, mEglContext)) { - throw new Surface.OutOfResourcesException("eglMakeCurrent failed " - + GLUtils.getEGLErrorString(sEgl.eglGetError())); - } - initCaches(); - enableDirtyRegions(); - return mEglContext.getGL(); } @@ -949,10 +988,17 @@ private void enableDirtyRegions() { abstract void initCaches(); EGLContext createContext(EGL10 egl, EGLDisplay eglDisplay, EGLConfig eglConfig) { - int[] attribs = { EGL_CONTEXT_CLIENT_VERSION, mGlVersion, EGL_NONE }; - - return egl.eglCreateContext(eglDisplay, eglConfig, EGL_NO_CONTEXT, - mGlVersion != 0 ? attribs : null); + int[] attribs = { EGL14.EGL_CONTEXT_CLIENT_VERSION, mGlVersion, EGL_NONE }; + + EGLContext context = egl.eglCreateContext(eglDisplay, eglConfig, EGL_NO_CONTEXT, + mGlVersion != 0 ? attribs : null); + if (context == null || context == EGL_NO_CONTEXT) { + //noinspection ConstantConditions + throw new IllegalStateException( + "Could not create an EGL context. eglCreateContext failed with error: " + + GLUtils.getEGLErrorString(sEgl.eglGetError())); + } + return context; } @Override @@ -982,7 +1028,7 @@ void destroySurface() { } @Override - void invalidate(SurfaceHolder holder) { + void invalidate(Surface surface) { // Cancels any existing buffer to ensure we'll get a buffer // of the right size before we call eglSwapBuffers sEgl.eglMakeCurrent(sEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); @@ -993,8 +1039,8 @@ void invalidate(SurfaceHolder holder) { setEnabled(false); } - if (holder.getSurface().isValid()) { - if (!createSurface(holder)) { + if (surface.isValid()) { + if (!createSurface(surface)) { return; } @@ -1006,8 +1052,8 @@ void invalidate(SurfaceHolder holder) { } } - private boolean createSurface(SurfaceHolder holder) { - mEglSurface = sEgl.eglCreateWindowSurface(sEglDisplay, sEglConfig, holder, null); + private boolean createSurface(Surface surface) { + mEglSurface = sEgl.eglCreateWindowSurface(sEglDisplay, sEglConfig, surface, null); if (mEglSurface == null || mEglSurface == EGL_NO_SURFACE) { int error = sEgl.eglGetError(); @@ -1018,6 +1064,14 @@ private boolean createSurface(SurfaceHolder holder) { throw new RuntimeException("createWindowSurface failed " + GLUtils.getEGLErrorString(error)); } + + if (!sEgl.eglMakeCurrent(sEglDisplay, mEglSurface, mEglSurface, mEglContext)) { + throw new IllegalStateException("eglMakeCurrent failed " + + GLUtils.getEGLErrorString(sEgl.eglGetError())); + } + + enableDirtyRegions(); + return true; } @@ -1089,7 +1143,7 @@ boolean draw(View view, View.AttachInfo attachInfo, HardwareDrawCallbacks callba attachInfo.mIgnoreDirtyState = true; attachInfo.mDrawingTime = SystemClock.uptimeMillis(); - view.mPrivateFlags |= View.DRAWN; + view.mPrivateFlags |= View.PFLAG_DRAWN; final int surfaceState = checkCurrent(); if (surfaceState != SURFACE_STATE_ERROR) { @@ -1118,14 +1172,13 @@ boolean draw(View view, View.AttachInfo attachInfo, HardwareDrawCallbacks callba } } - int status = onPreDraw(dirty); - int saveCount = canvas.save(); - callbacks.onHardwarePreDraw(canvas); + int saveCount = 0; + int status = DisplayList.STATUS_DONE; try { - view.mRecreateDisplayList = - (view.mPrivateFlags & View.INVALIDATED) == View.INVALIDATED; - view.mPrivateFlags &= ~View.INVALIDATED; + view.mRecreateDisplayList = (view.mPrivateFlags & View.PFLAG_INVALIDATED) + == View.PFLAG_INVALIDATED; + view.mPrivateFlags &= ~View.PFLAG_INVALIDATED; long getDisplayListStartTime = 0; if (mProfileEnabled) { @@ -1137,8 +1190,9 @@ boolean draw(View view, View.AttachInfo attachInfo, HardwareDrawCallbacks callba getDisplayListStartTime = System.nanoTime(); } - DisplayList displayList; + canvas.clearLayerUpdates(); + DisplayList displayList; Trace.traceBegin(Trace.TRACE_TAG_VIEW, "getDisplayList"); try { displayList = view.getDisplayList(); @@ -1146,6 +1200,15 @@ boolean draw(View view, View.AttachInfo attachInfo, HardwareDrawCallbacks callba Trace.traceEnd(Trace.TRACE_TAG_VIEW); } + Trace.traceBegin(Trace.TRACE_TAG_VIEW, "prepareFrame"); + try { + status = onPreDraw(dirty); + } finally { + Trace.traceEnd(Trace.TRACE_TAG_VIEW); + } + saveCount = canvas.save(); + callbacks.onHardwarePreDraw(canvas); + if (mProfileEnabled) { long now = System.nanoTime(); float total = (now - getDisplayListStartTime) * 0.000001f; @@ -1378,15 +1441,17 @@ ManagedEGLContext createManagedContext(EGLContext eglContext) { @Override int[] getConfig(boolean dirtyRegions) { return new int[] { - EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, + EGL_RENDERABLE_TYPE, EGL14.EGL_OPENGL_ES2_BIT, EGL_RED_SIZE, 8, EGL_GREEN_SIZE, 8, EGL_BLUE_SIZE, 8, EGL_ALPHA_SIZE, 8, EGL_DEPTH_SIZE, 0, - EGL_STENCIL_SIZE, GLES20Canvas.getStencilSize(), + EGL_CONFIG_CAVEAT, EGL_NONE, + // TODO: Find a better way to choose the stencil size + EGL_STENCIL_SIZE, mShowOverdraw ? GLES20Canvas.getStencilSize() : 0, EGL_SURFACE_TYPE, EGL_WINDOW_BIT | - (dirtyRegions ? EGL_SWAP_BEHAVIOR_PRESERVED_BIT : 0), + (dirtyRegions ? EGL14.EGL_SWAP_BEHAVIOR_PRESERVED_BIT : 0), EGL_NONE }; } @@ -1430,6 +1495,11 @@ void setup(int width, int height) { } } + @Override + void pushLayerUpdate(HardwareLayer layer) { + mGlCanvas.pushLayerUpdate(layer); + } + @Override public DisplayList createDisplayList(String name) { return new GLES20DisplayList(name); @@ -1455,27 +1525,6 @@ void setSurfaceTexture(HardwareLayer layer, SurfaceTexture surfaceTexture) { ((GLES20TextureLayer) layer).setSurfaceTexture(surfaceTexture); } - @Override - void destroyLayers(View view) { - if (view != null && isEnabled() && checkCurrent() != SURFACE_STATE_ERROR) { - destroyHardwareLayer(view); - GLES20Canvas.flushCaches(GLES20Canvas.FLUSH_CACHES_LAYERS); - } - } - - private static void destroyHardwareLayer(View view) { - view.destroyLayer(true); - - if (view instanceof ViewGroup) { - ViewGroup group = (ViewGroup) view; - - int count = group.getChildCount(); - for (int i = 0; i < count; i++) { - destroyHardwareLayer(group.getChildAt(i)); - } - } - } - @Override boolean safelyRun(Runnable action) { boolean needsContext = true; @@ -1500,12 +1549,44 @@ boolean safelyRun(Runnable action) { return true; } + @Override + void destroyLayers(final View view) { + if (view != null) { + safelyRun(new Runnable() { + @Override + public void run() { + if (mCanvas != null) { + mCanvas.clearLayerUpdates(); + } + destroyHardwareLayer(view); + GLES20Canvas.flushCaches(GLES20Canvas.FLUSH_CACHES_LAYERS); + } + }); + } + } + + private static void destroyHardwareLayer(View view) { + view.destroyLayer(true); + + if (view instanceof ViewGroup) { + ViewGroup group = (ViewGroup) view; + + int count = group.getChildCount(); + for (int i = 0; i < count; i++) { + destroyHardwareLayer(group.getChildAt(i)); + } + } + } + @Override void destroyHardwareResources(final View view) { if (view != null) { safelyRun(new Runnable() { @Override public void run() { + if (mCanvas != null) { + mCanvas.clearLayerUpdates(); + } destroyResources(view); GLES20Canvas.flushCaches(GLES20Canvas.FLUSH_CACHES_LAYERS); } diff --git a/core/java/android/view/IDisplayContentChangeListener.aidl b/core/java/android/view/IDisplayContentChangeListener.aidl new file mode 100644 index 0000000000000..ef7edeab3894c --- /dev/null +++ b/core/java/android/view/IDisplayContentChangeListener.aidl @@ -0,0 +1,33 @@ +/* +** Copyright 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.os.IBinder; +import android.view.WindowInfo; +import android.graphics.Rect; + +/** + * Interface for observing content changes on a display. + * + * {@hide} + */ +oneway interface IDisplayContentChangeListener { + void onWindowTransition(int displayId, int transition, in WindowInfo info); + void onRectangleOnScreenRequested(int displayId, in Rect rectangle, boolean immediate); + void onWindowLayersChanged(int displayId); + void onRotationChanged(int rotation); +} diff --git a/core/java/android/view/IInputFilter.aidl b/core/java/android/view/IInputFilter.aidl new file mode 100644 index 0000000000000..fead5f6eb1db0 --- /dev/null +++ b/core/java/android/view/IInputFilter.aidl @@ -0,0 +1,32 @@ +/** + * 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.view.IInputFilterHost; +import android.view.InputEvent; + +/** + * Interface for implementing an filter which observes and + * potentially transforms the input event stream in the system. + * + * @hide + */ +oneway interface IInputFilter { + void install(IInputFilterHost host); + void uninstall(); + void filterInputEvent(in InputEvent event, int policyFlags); +} diff --git a/core/java/android/view/IInputFilterHost.aidl b/core/java/android/view/IInputFilterHost.aidl new file mode 100644 index 0000000000000..93b823992b00b --- /dev/null +++ b/core/java/android/view/IInputFilterHost.aidl @@ -0,0 +1,28 @@ +/** + * 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.view.InputEvent; + +/** + * Interface for calls from an input filter to its host. + * + * @hide + */ +oneway interface IInputFilterHost { + void sendInputEvent(in InputEvent event, int policyFlags); +} diff --git a/core/java/android/view/IWindow.aidl b/core/java/android/view/IWindow.aidl index b4caad3d3908f..15bd46cf5b117 100644 --- a/core/java/android/view/IWindow.aidl +++ b/core/java/android/view/IWindow.aidl @@ -45,8 +45,9 @@ oneway interface IWindow { */ void executeCommand(String command, String parameters, in ParcelFileDescriptor descriptor); - void resized(int w, int h, in Rect contentInsets, + void resized(in Rect frame, in Rect contentInsets, in Rect visibleInsets, boolean reportDraw, in Configuration newConfig); + void moved(int newX, int newY); void dispatchAppVisibility(boolean visible); void dispatchGetNewSurface(); void dispatchScreenState(boolean on); diff --git a/core/java/android/view/IWindowManager.aidl b/core/java/android/view/IWindowManager.aidl index 4d4eec7101c9f..0fe2a8e3f8302 100644 --- a/core/java/android/view/IWindowManager.aidl +++ b/core/java/android/view/IWindowManager.aidl @@ -1,16 +1,16 @@ /* ** Copyright 2006, 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 +** 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 +** 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 +** 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. */ @@ -23,8 +23,11 @@ import android.content.res.CompatibilityInfo; import android.content.res.Configuration; import android.graphics.Bitmap; import android.graphics.Point; +import android.graphics.Rect; +import android.os.Bundle; import android.os.IRemoteCallback; import android.view.IApplicationToken; +import android.view.IDisplayContentChangeListener; import android.view.IOnKeyguardExitResult; import android.view.IRotationWatcher; import android.view.IWindowSession; @@ -33,6 +36,8 @@ import android.view.InputEvent; import android.view.MotionEvent; import android.view.InputChannel; import android.view.InputDevice; +import android.view.IInputFilter; +import android.view.WindowInfo; /** * System private interface to the window manager. @@ -54,14 +59,11 @@ 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(); + void setForcedDisplaySize(int displayId, int width, int height); + void clearForcedDisplaySize(int displayId); + void setForcedDisplayDensity(int displayId, int density); + void clearForcedDisplayDensity(int displayId); // Is the device configured to have a full system bar for larger screens? boolean hasSystemNavBar(); @@ -73,7 +75,7 @@ interface IWindowManager void addWindowToken(IBinder token, int type); void removeWindowToken(IBinder token); void addAppToken(int addPos, IApplicationToken token, - int groupId, int requestedOrientation, boolean fullscreen); + int groupId, int requestedOrientation, boolean fullscreen, boolean showWhenLocked); void setAppGroupId(IBinder token, int groupId); void setAppOrientation(IApplicationToken token, int requestedOrientation); int getAppOrientation(IApplicationToken token); @@ -85,7 +87,7 @@ interface IWindowManager void overridePendingAppTransitionScaleUp(int startX, int startY, int startWidth, int startHeight); void overridePendingAppTransitionThumb(in Bitmap srcThumb, int startX, int startY, - IRemoteCallback startedCallback, boolean delayed); + IRemoteCallback startedCallback, boolean scaleUp); void executeAppTransition(); void setAppStartingWindow(IBinder token, String pkg, int theme, in CompatibilityInfo compatInfo, CharSequence nonLocalizedLabel, int labelRes, @@ -105,7 +107,10 @@ interface IWindowManager Configuration updateOrientationFromAppTokens(in Configuration currentConfig, IBinder freezeThisOneIfNeeded); void setNewConfiguration(in Configuration config); - + + void startFreezingScreen(int exitAnim, int enterAnim); + void stopFreezingScreen(); + // these require DISABLE_KEYGUARD permission void disableKeyguard(IBinder token, String tag); void reenableKeyguard(IBinder token); @@ -116,13 +121,13 @@ interface IWindowManager void dismissKeyguard(); void closeSystemDialogs(String reason); - + // These can only be called with the SET_ANIMATON_SCALE permission. float getAnimationScale(int which); float[] getAnimationScales(); void setAnimationScale(int which, float scale); void setAnimationScales(in float[] scales); - + // For testing void setInTouchMode(boolean showFocus); @@ -156,7 +161,7 @@ interface IWindowManager * {@link android.view.Surface}. */ int getRotation(); - + /** * Watch the rotation of the screen. Returns the current rotation, * calls back when it changes. @@ -170,24 +175,24 @@ interface IWindowManager */ int getPreferredOptionsPanelGravity(); - /** - * Lock the device orientation to the specified rotation, or to the - * current rotation if -1. Sensor input will be ignored until - * thawRotation() is called. - * @hide - */ - void freezeRotation(int rotation); + /** + * Lock the device orientation to the specified rotation, or to the + * current rotation if -1. Sensor input will be ignored until + * thawRotation() is called. + * @hide + */ + void freezeRotation(int rotation); - /** - * Release the orientation lock imposed by freezeRotation(). - * @hide - */ - void thawRotation(); + /** + * Release the orientation lock imposed by freezeRotation(). + * @hide + */ + void thawRotation(); - /** - * Create a screenshot of the applications currently displayed. - */ - Bitmap screenshotApplications(IBinder appToken, int maxWidth, int maxHeight); + /** + * Create a screenshot of the applications currently displayed. + */ + Bitmap screenshotApplications(IBinder appToken, int displayId, int maxWidth, int maxHeight); /** * Called by the status bar to notify Views of changes to System UI visiblity. @@ -196,8 +201,9 @@ interface IWindowManager /** * Block until the given window has been drawn to the screen. + * Returns true if really waiting, false if the window does not exist. */ - void waitForWindowDrawn(IBinder token, in IRemoteCallback callback); + boolean waitForWindowDrawn(IBinder token, in IRemoteCallback callback); /** * Device has a software navigation bar (separate from the status bar). @@ -205,7 +211,58 @@ interface IWindowManager boolean hasNavigationBar(); /** - * Lock the device immediately. + * Lock the device immediately with the specified options (can be null). + */ + void lockNow(in Bundle options); + + /** + * Gets the token for the focused window. + */ + IBinder getFocusedWindowToken(); + + /** + * Gets the compatibility scale of e window given its token. + */ + float getWindowCompatibilityScale(IBinder windowToken); + + /** + * Sets an input filter for manipulating the input event stream. + */ + void setInputFilter(in IInputFilter filter); + + /** + * Sets the scale and offset for implementing accessibility magnification. + */ + void magnifyDisplay(int dipslayId, float scale, float offsetX, float offsetY); + + /** + * Adds a listener for display content changes. + */ + void addDisplayContentChangeListener(int displayId, IDisplayContentChangeListener listener); + + /** + * Removes a listener for display content changes. + */ + void removeDisplayContentChangeListener(int displayId, IDisplayContentChangeListener listener); + + /** + * Gets the info for a window given its token. + */ + WindowInfo getWindowInfo(IBinder token); + + /** + * Gets the infos for all visible windows. + */ + void getVisibleWindowsForDisplay(int displayId, out List outInfos); + + /** + * Device is in safe mode. + */ + boolean isSafeModeEnabled(); + + /** + * Tell keyguard to show the assistant (Intent.ACTION_ASSIST) after asking for the user's + * credentials. */ - void lockNow(); + void showAssistant(); } diff --git a/core/java/android/view/IWindowSession.aidl b/core/java/android/view/IWindowSession.aidl index d4a03ce657e38..ff9dcce58d565 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); /** @@ -54,8 +59,8 @@ interface IWindowSession { * @param requestedWidth The width the window wants to be. * @param requestedHeight The height the window wants to be. * @param viewVisibility Window root view's visibility. - * @param flags Request flags: {@link WindowManagerImpl#RELAYOUT_INSETS_PENDING}, - * {@link WindowManagerImpl#RELAYOUT_DEFER_SURFACE_DESTROY}. + * @param flags Request flags: {@link WindowManagerGlobal#RELAYOUT_INSETS_PENDING}, + * {@link WindowManagerGlobal#RELAYOUT_DEFER_SURFACE_DESTROY}. * @param outFrame Rect in which is placed the new position/size on * screen. * @param outContentInsets Rect in which is placed the offsets from @@ -74,8 +79,8 @@ interface IWindowSession { * was last displayed. * @param outSurface Object in which is placed the new display surface. * - * @return int Result flags: {@link WindowManagerImpl#RELAYOUT_SHOW_FOCUS}, - * {@link WindowManagerImpl#RELAYOUT_FIRST_TIME}. + * @return int Result flags: {@link WindowManagerGlobal#RELAYOUT_SHOW_FOCUS}, + * {@link WindowManagerGlobal#RELAYOUT_FIRST_TIME}. */ int relayout(IWindow window, int seq, in WindowManager.LayoutParams attrs, int requestedWidth, int requestedHeight, int viewVisibility, @@ -172,4 +177,12 @@ interface IWindowSession { int z, in Bundle extras, boolean sync); void wallpaperCommandComplete(IBinder window, in Bundle result); + + void setUniverseTransform(IBinder window, float alpha, float offx, float offy, + float dsdx, float dtdx, float dsdy, float dtdy); + + /** + * Notifies that a rectangle on the screen has been requested. + */ + void onRectangleOnScreenRequested(IBinder token, in Rect rectangle, boolean immediate); } diff --git a/core/java/android/view/InputEventConsistencyVerifier.java b/core/java/android/view/InputEventConsistencyVerifier.java index fafe416defdf7..5dda9343a742c 100644 --- a/core/java/android/view/InputEventConsistencyVerifier.java +++ b/core/java/android/view/InputEventConsistencyVerifier.java @@ -322,7 +322,7 @@ public void onTouchEvent(MotionEvent event, int nestingLevel) { final int action = event.getAction(); final boolean newStream = action == MotionEvent.ACTION_DOWN - || action == MotionEvent.ACTION_CANCEL; + || action == MotionEvent.ACTION_CANCEL || action == MotionEvent.ACTION_OUTSIDE; if (newStream && (mTouchEventStreamIsTainted || mTouchEventStreamUnhandled)) { mTouchEventStreamIsTainted = false; mTouchEventStreamUnhandled = false; diff --git a/core/java/android/view/InputEventReceiver.java b/core/java/android/view/InputEventReceiver.java index 9c56782f9091d..117c101832274 100644 --- a/core/java/android/view/InputEventReceiver.java +++ b/core/java/android/view/InputEventReceiver.java @@ -73,7 +73,7 @@ public InputEventReceiver(InputChannel inputChannel, Looper looper) { @Override protected void finalize() throws Throwable { try { - dispose(); + dispose(true); } finally { super.finalize(); } @@ -83,9 +83,17 @@ protected void finalize() throws Throwable { * Disposes the receiver. */ public void dispose() { + dispose(false); + } + + private void dispose(boolean finalized) { if (mCloseGuard != null) { + if (finalized) { + mCloseGuard.warnIfOpen(); + } mCloseGuard.close(); } + if (mReceiverPtr != 0) { nativeDispose(mReceiverPtr); mReceiverPtr = 0; diff --git a/services/java/com/android/server/input/InputFilter.java b/core/java/android/view/InputFilter.java similarity index 94% rename from services/java/com/android/server/input/InputFilter.java rename to core/java/android/view/InputFilter.java index 2ce0a029533c9..c25b87ba9d482 100644 --- a/services/java/com/android/server/input/InputFilter.java +++ b/core/java/android/view/InputFilter.java @@ -14,13 +14,13 @@ * limitations under the License. */ -package com.android.server.input; - -import com.android.server.wm.WindowManagerService; +package android.view; import android.os.Handler; import android.os.Looper; import android.os.Message; +import android.os.RemoteException; +import android.view.IInputFilter; import android.view.InputEvent; import android.view.InputEventConsistencyVerifier; import android.view.KeyEvent; @@ -94,15 +94,14 @@ * It may be prudent to disable automatic key repeating for synthetic key events * by setting the {@link WindowManagerPolicy#FLAG_DISABLE_KEY_REPEAT} policy flag. *

        + * + * @hide */ -public abstract class InputFilter { +public abstract class InputFilter extends IInputFilter.Stub { private static final int MSG_INSTALL = 1; private static final int MSG_UNINSTALL = 2; private static final int MSG_INPUT_EVENT = 3; - private final H mH; - private Host mHost; - // Consistency verifiers for debugging purposes. private final InputEventConsistencyVerifier mInboundInputEventConsistencyVerifier = InputEventConsistencyVerifier.isInstrumentationEnabled() ? @@ -115,6 +114,10 @@ public abstract class InputFilter { InputEventConsistencyVerifier.FLAG_RAW_DEVICE_INPUT, "InputFilter#OutboundInputEventConsistencyVerifier") : null; + private final H mH; + + private IInputFilterHost mHost; + /** * Creates the input filter. * @@ -130,7 +133,7 @@ public InputFilter(Looper looper) { * * @param host The input filter host environment. */ - final void install(Host host) { + public final void install(IInputFilterHost host) { mH.obtainMessage(MSG_INSTALL, host).sendToTarget(); } @@ -138,7 +141,7 @@ final void install(Host host) { * Called when the input filter is uninstalled. * This method is guaranteed to be non-reentrant. */ - final void uninstall() { + public final void uninstall() { mH.obtainMessage(MSG_UNINSTALL).sendToTarget(); } @@ -149,7 +152,7 @@ final void uninstall() { * * @param event The input event to enqueue. */ - final void filterInputEvent(InputEvent event, int policyFlags) { + final public void filterInputEvent(InputEvent event, int policyFlags) { mH.obtainMessage(MSG_INPUT_EVENT, policyFlags, 0, event).sendToTarget(); } @@ -170,7 +173,11 @@ public void sendInputEvent(InputEvent event, int policyFlags) { if (mOutboundInputEventConsistencyVerifier != null) { mOutboundInputEventConsistencyVerifier.onInputEvent(event, 0); } - mHost.sendInputEvent(event, policyFlags); + try { + mHost.sendInputEvent(event, policyFlags); + } catch (RemoteException re) { + /* ignore */ + } } /** @@ -218,7 +225,7 @@ public H(Looper looper) { public void handleMessage(Message msg) { switch (msg.what) { case MSG_INSTALL: - mHost = (Host)msg.obj; + mHost = (IInputFilterHost) msg.obj; if (mInboundInputEventConsistencyVerifier != null) { mInboundInputEventConsistencyVerifier.reset(); } @@ -251,8 +258,4 @@ public void handleMessage(Message msg) { } } } - - interface Host { - public void sendInputEvent(InputEvent event, int policyFlags); - } } diff --git a/core/java/android/view/ScaleGestureDetector.java b/core/java/android/view/ScaleGestureDetector.java index bcb8800621e15..ee3f5d8e266b3 100644 --- a/core/java/android/view/ScaleGestureDetector.java +++ b/core/java/android/view/ScaleGestureDetector.java @@ -17,6 +17,8 @@ package android.view; import android.content.Context; +import android.content.res.Resources; +import android.os.SystemClock; import android.util.FloatMath; /** @@ -137,6 +139,18 @@ public void onScaleEnd(ScaleGestureDetector detector) { private long mPrevTime; private boolean mInProgress; private int mSpanSlop; + private int mMinSpan; + + // Bounds for recently seen values + private float mTouchUpper; + private float mTouchLower; + private float mTouchHistoryLastAccepted; + private int mTouchHistoryDirection; + private long mTouchHistoryLastAcceptedTime; + private int mTouchMinMajor; + + private static final long TOUCH_STABILIZE_TIME = 128; // ms + private static final int TOUCH_MIN_MAJOR = 48; // dp /** * Consistency verifier for debugging purposes. @@ -149,6 +163,83 @@ public ScaleGestureDetector(Context context, OnScaleGestureListener listener) { mContext = context; mListener = listener; mSpanSlop = ViewConfiguration.get(context).getScaledTouchSlop() * 2; + + final Resources res = context.getResources(); + mTouchMinMajor = res.getDimensionPixelSize( + com.android.internal.R.dimen.config_minScalingTouchMajor); + mMinSpan = res.getDimensionPixelSize( + com.android.internal.R.dimen.config_minScalingSpan); + } + + /** + * The touchMajor/touchMinor elements of a MotionEvent can flutter/jitter on + * some hardware/driver combos. Smooth it out to get kinder, gentler behavior. + * @param ev MotionEvent to add to the ongoing history + */ + private void addTouchHistory(MotionEvent ev) { + final long currentTime = SystemClock.uptimeMillis(); + final int count = ev.getPointerCount(); + boolean accept = currentTime - mTouchHistoryLastAcceptedTime >= TOUCH_STABILIZE_TIME; + float total = 0; + int sampleCount = 0; + for (int i = 0; i < count; i++) { + final boolean hasLastAccepted = !Float.isNaN(mTouchHistoryLastAccepted); + final int historySize = ev.getHistorySize(); + final int pointerSampleCount = historySize + 1; + for (int h = 0; h < pointerSampleCount; h++) { + float major; + if (h < historySize) { + major = ev.getHistoricalTouchMajor(i, h); + } else { + major = ev.getTouchMajor(i); + } + if (major < mTouchMinMajor) major = mTouchMinMajor; + total += major; + + if (Float.isNaN(mTouchUpper) || major > mTouchUpper) { + mTouchUpper = major; + } + if (Float.isNaN(mTouchLower) || major < mTouchLower) { + mTouchLower = major; + } + + if (hasLastAccepted) { + final int directionSig = (int) Math.signum(major - mTouchHistoryLastAccepted); + if (directionSig != mTouchHistoryDirection || + (directionSig == 0 && mTouchHistoryDirection == 0)) { + mTouchHistoryDirection = directionSig; + final long time = h < historySize ? ev.getHistoricalEventTime(h) + : ev.getEventTime(); + mTouchHistoryLastAcceptedTime = time; + accept = false; + } + } + } + sampleCount += pointerSampleCount; + } + + final float avg = total / sampleCount; + + if (accept) { + float newAccepted = (mTouchUpper + mTouchLower + avg) / 3; + mTouchUpper = (mTouchUpper + newAccepted) / 2; + mTouchLower = (mTouchLower + newAccepted) / 2; + mTouchHistoryLastAccepted = newAccepted; + mTouchHistoryDirection = 0; + mTouchHistoryLastAcceptedTime = ev.getEventTime(); + } + } + + /** + * Clear all touch history tracking. Useful in ACTION_CANCEL or ACTION_UP. + * @see #addTouchHistory(MotionEvent) + */ + private void clearTouchHistory() { + mTouchUpper = Float.NaN; + mTouchLower = Float.NaN; + mTouchHistoryLastAccepted = Float.NaN; + mTouchHistoryDirection = 0; + mTouchHistoryLastAcceptedTime = 0; } /** @@ -183,11 +274,12 @@ public boolean onTouchEvent(MotionEvent event) { } if (streamComplete) { + clearTouchHistory(); return true; } } - final boolean configChanged = + final boolean configChanged = action == MotionEvent.ACTION_DOWN || action == MotionEvent.ACTION_POINTER_UP || action == MotionEvent.ACTION_POINTER_DOWN; final boolean pointerUp = action == MotionEvent.ACTION_POINTER_UP; @@ -205,12 +297,18 @@ public boolean onTouchEvent(MotionEvent event) { final float focusX = sumX / div; final float focusY = sumY / div; + + addTouchHistory(event); + // Determine average deviation from focal point float devSumX = 0, devSumY = 0; for (int i = 0; i < count; i++) { if (skipIndex == i) continue; - devSumX += Math.abs(event.getX(i) - focusX); - devSumY += Math.abs(event.getY(i) - focusY); + + // Convert the resulting diameter into a radius. + final float touchSize = mTouchHistoryLastAccepted / 2; + devSumX += Math.abs(event.getX(i) - focusX) + touchSize; + devSumY += Math.abs(event.getY(i) - focusY) + touchSize; } final float devX = devSumX / div; final float devY = devSumY / div; @@ -228,7 +326,7 @@ public boolean onTouchEvent(MotionEvent event) { final boolean wasInProgress = mInProgress; mFocusX = focusX; mFocusY = focusY; - if (mInProgress && (span == 0 || configChanged)) { + if (mInProgress && (span < mMinSpan || configChanged)) { mListener.onScaleEnd(this); mInProgress = false; mInitialSpan = span; @@ -238,7 +336,7 @@ public boolean onTouchEvent(MotionEvent event) { mPrevSpanY = mCurrSpanY = spanY; mInitialSpan = mPrevSpan = mCurrSpan = span; } - if (!mInProgress && span != 0 && + if (!mInProgress && span >= mMinSpan && (wasInProgress || Math.abs(span - mInitialSpan) > mSpanSlop)) { mPrevSpanX = mCurrSpanX = spanX; mPrevSpanY = mCurrSpanY = spanY; diff --git a/core/java/android/view/Surface.java b/core/java/android/view/Surface.java index a9687683a6edd..550a740195d71 100644 --- a/core/java/android/view/Surface.java +++ b/core/java/android/view/Surface.java @@ -16,8 +16,16 @@ package android.view; +import dalvik.system.CloseGuard; + import android.content.res.CompatibilityInfo.Translator; -import android.graphics.*; +import android.graphics.Bitmap; +import android.graphics.Canvas; +import android.graphics.Matrix; +import android.graphics.Rect; +import android.graphics.Region; +import android.graphics.SurfaceTexture; +import android.os.IBinder; import android.os.Parcelable; import android.os.Parcel; import android.os.SystemProperties; @@ -27,212 +35,187 @@ * Handle onto a raw buffer that is being managed by the screen compositor. */ public class Surface implements Parcelable { - private static final String LOG_TAG = "Surface"; - private static final boolean DEBUG_RELEASE = false; - - /* orientations for setOrientation() */ - public static final int ROTATION_0 = 0; - public static final int ROTATION_90 = 1; - public static final int ROTATION_180 = 2; - public static final int ROTATION_270 = 3; + private static final String TAG = "Surface"; - private static final boolean headless = "1".equals( + private static final boolean HEADLESS = "1".equals( SystemProperties.get("ro.config.headless", "0")); - private static void checkHeadless() { - if(headless) { - throw new UnsupportedOperationException("Device is headless"); + public static final Parcelable.Creator CREATOR = + new Parcelable.Creator() { + public Surface createFromParcel(Parcel source) { + try { + Surface s = new Surface(); + s.readFromParcel(source); + return s; + } catch (Exception e) { + Log.e(TAG, "Exception creating surface from parcel", e); + return null; + } } - } - /** - * Create Surface from a {@link SurfaceTexture}. - * - * Images drawn to the Surface will be made available to the {@link - * SurfaceTexture}, which can attach them an OpenGL ES texture via {@link - * SurfaceTexture#updateTexImage}. - * - * @param surfaceTexture The {@link SurfaceTexture} that is updated by this - * Surface. - */ - public Surface(SurfaceTexture surfaceTexture) { - checkHeadless(); - - if (DEBUG_RELEASE) { - mCreationStack = new Exception(); + public Surface[] newArray(int size) { + return new Surface[size]; } - mCanvas = new CompatibleCanvas(); - initFromSurfaceTexture(surfaceTexture); - } + }; /** - * Does this object hold a valid surface? Returns true if it holds - * a physical surface, so lockCanvas() will succeed. Otherwise - * returns false. + * Rotation constant: 0 degree rotation (natural orientation) */ - public native boolean isValid(); + public static final int ROTATION_0 = 0; - /** Release the local reference to the server-side surface. - * Always call release() when you're done with a Surface. This will - * make the surface invalid. + /** + * Rotation constant: 90 degree rotation. */ - public native void release(); - - /** draw into a surface */ - public Canvas lockCanvas(Rect dirty) throws OutOfResourcesException, IllegalArgumentException { - /* - * the dirty rectangle may be expanded to the surface's size, if for - * instance it has been resized or if the bits were lost, since the last - * call. - */ - return lockCanvasNative(dirty); - } - - /** unlock the surface and asks a page flip */ - public native void unlockCanvasAndPost(Canvas canvas); + public static final int ROTATION_90 = 1; - /** - * unlock the surface. the screen won't be updated until - * post() or postAll() is called + /** + * Rotation constant: 180 degree rotation. */ - public native void unlockCanvas(Canvas canvas); + public static final int ROTATION_180 = 2; - @Override - public String toString() { - return "Surface(name=" + mName + ", identity=" + getIdentity() + ")"; - } - - public int describeContents() { - return 0; - } + /** + * Rotation constant: 270 degree rotation. + */ + public static final int ROTATION_270 = 3; - public native void readFromParcel(Parcel source); - public native void writeToParcel(Parcel dest, int flags); + /* built-in physical display ids (keep in sync with ISurfaceComposer.h) + * these are different from the logical display ids used elsewhere in the framework */ /** - * Exception thrown when a surface couldn't be created or resized + * Built-in physical display id: Main display. + * Use only with {@link #getBuiltInDisplay()}. + * @hide */ - public static class OutOfResourcesException extends Exception { - public OutOfResourcesException() { - } - public OutOfResourcesException(String name) { - super(name); - } - } - - /* - * ----------------------------------------------------------------------- - * No user serviceable parts beyond this point - * ----------------------------------------------------------------------- + public static final int BUILT_IN_DISPLAY_ID_MAIN = 0; + + /** + * Built-in physical display id: Attached HDMI display. + * Use only with {@link #getBuiltInDisplay()}. + * @hide */ + public static final int BUILT_IN_DISPLAY_ID_HDMI = 1; - /* flags used in constructor (keep in sync with ISurfaceComposer.h) */ + /* flags used in constructor (keep in sync with ISurfaceComposerClient.h) */ - /** Surface is created hidden @hide */ - public static final int HIDDEN = 0x00000004; + /** + * Surface creation flag: Surface is created hidden + * @hide */ + public static final int HIDDEN = 0x00000004; - /** The surface contains secure content, special measures will - * be taken to disallow the surface's content to be copied from - * another process. In particular, screenshots and VNC servers will + /** + * Surface creation flag: The surface contains secure content, special + * measures will be taken to disallow the surface's content to be copied + * from another process. In particular, screenshots and VNC servers will * be disabled, but other measures can take place, for instance the * surface might not be hardware accelerated. - * @hide*/ - public static final int SECURE = 0x00000080; - - /** Creates a surface where color components are interpreted as - * "non pre-multiplied" by their alpha channel. Of course this flag is - * meaningless for surfaces without an alpha channel. By default - * surfaces are pre-multiplied, which means that each color component is - * already multiplied by its alpha value. In this case the blending - * equation used is: - * + * @hide + */ + public static final int SECURE = 0x00000080; + + /** + * Surface creation flag: Creates a surface where color components are interpreted + * as "non pre-multiplied" by their alpha channel. Of course this flag is + * meaningless for surfaces without an alpha channel. By default + * surfaces are pre-multiplied, which means that each color component is + * already multiplied by its alpha value. In this case the blending + * equation used is: + * * DEST = SRC + DEST * (1-SRC_ALPHA) - * - * By contrast, non pre-multiplied surfaces use the following equation: - * + * + * By contrast, non pre-multiplied surfaces use the following equation: + * * DEST = SRC * SRC_ALPHA * DEST * (1-SRC_ALPHA) - * - * pre-multiplied surfaces must always be used if transparent pixels are - * composited on top of each-other into the surface. A pre-multiplied - * surface can never lower the value of the alpha component of a given - * pixel. - * - * In some rare situations, a non pre-multiplied surface is preferable. - * - * @hide - */ - public static final int NON_PREMULTIPLIED = 0x00000100; - + * + * pre-multiplied surfaces must always be used if transparent pixels are + * composited on top of each-other into the surface. A pre-multiplied + * surface can never lower the value of the alpha component of a given + * pixel. + * + * In some rare situations, a non pre-multiplied surface is preferable. + * @hide + */ + public static final int NON_PREMULTIPLIED = 0x00000100; + /** - * Indicates that the surface must be considered opaque, even if its - * pixel format is set to translucent. This can be useful if an + * Surface creation flag: Indicates that the surface must be considered opaque, + * even if its pixel format is set to translucent. This can be useful if an * application needs full RGBA 8888 support for instance but will * still draw every pixel opaque. - * * @hide */ - public static final int OPAQUE = 0x00000400; - + public static final int OPAQUE = 0x00000400; + /** - * Application requires a hardware-protected path to an + * Surface creation flag: Application requires a hardware-protected path to an * external display sink. If a hardware-protected path is not available, * then this surface will not be displayed on the external sink. - * * @hide */ - public static final int PROTECTED_APP = 0x00000800; + public static final int PROTECTED_APP = 0x00000800; // 0x1000 is reserved for an independent DRM protected flag in framework - /** Creates a normal surface. This is the default. @hide */ + /** + * Surface creation flag: Creates a normal surface. + * This is the default. + * @hide + */ public static final int FX_SURFACE_NORMAL = 0x00000000; - - /** Creates a Blur surface. Everything behind this surface is blurred - * by some amount. The quality and refresh speed of the blur effect - * is not settable or guaranteed. - * It is an error to lock a Blur surface, since it doesn't have - * a backing store. + + /** + * Surface creation flag: Creates a Blur surface. + * Everything behind this surface is blurred by some amount. + * The quality and refresh speed of the blur effect is not settable or guaranteed. + * It is an error to lock a Blur surface, since it doesn't have a backing store. * @hide * @deprecated */ @Deprecated - public static final int FX_SURFACE_BLUR = 0x00010000; - - /** Creates a Dim surface. Everything behind this surface is dimmed - * by the amount specified in {@link #setAlpha}. - * It is an error to lock a Dim surface, since it doesn't have - * a backing store. + public static final int FX_SURFACE_BLUR = 0x00010000; + + /** + * Surface creation flag: Creates a Dim surface. + * Everything behind this surface is dimmed by the amount specified + * in {@link #setAlpha}. It is an error to lock a Dim surface, since it + * doesn't have a backing store. * @hide */ - public static final int FX_SURFACE_DIM = 0x00020000; + public static final int FX_SURFACE_DIM = 0x00020000; - /** @hide */ - public static final int FX_SURFACE_SCREENSHOT = 0x00030000; + /** + * @hide + */ + public static final int FX_SURFACE_SCREENSHOT = 0x00030000; - /** Mask used for FX values above @hide */ - public static final int FX_SURFACE_MASK = 0x000F0000; + /** + * Mask used for FX values above. + * @hide + */ + public static final int FX_SURFACE_MASK = 0x000F0000; /* flags used with setFlags() (keep in sync with ISurfaceComposer.h) */ - /** Hide the surface. Equivalent to calling hide(). @hide */ - public static final int SURFACE_HIDDEN = 0x01; - - /** Freeze the surface. Equivalent to calling freeze(). @hide */ - public static final int SURFACE_FROZEN = 0x02; + /** + * Surface flag: Hide the surface. + * Equivalent to calling hide(). + * @hide + */ + public static final int SURFACE_HIDDEN = 0x01; - /** Enable dithering when compositing this surface @hide */ - public static final int SURFACE_DITHER = 0x04; + private final CloseGuard mCloseGuard = CloseGuard.get(); + private String mName; + + // Note: These fields are accessed by native code. // The mSurfaceControl will only be present for Surfaces used by the window // server or system processes. When this class is parceled we defer to the // mSurfaceControl to do the parceling. Otherwise we parcel the // mNativeSurface. - private int mSurfaceControl; - private int mSaveCount; - private Canvas mCanvas; - private int mNativeSurface; - private int mSurfaceGenerationId; - private String mName; + private int mNativeSurface; // Surface* + private int mNativeSurfaceControl; // SurfaceControl* + private int mGenerationId; // incremented each time mNativeSurface changes + private final Canvas mCanvas = new CompatibleCanvas(); + private int mCanvasSaveCount; // Canvas save count at time of lockCanvas() // The Translator for density compatibility mode. This is used for scaling // the canvas to perform the appropriate density transformation. @@ -242,154 +225,244 @@ public OutOfResourcesException(String name) { // non compatibility mode. private Matrix mCompatibleMatrix; - private Exception mCreationStack; + private native void nativeCreate(SurfaceSession session, String name, + int w, int h, int format, int flags) + throws OutOfResourcesException; + private native void nativeCreateFromSurfaceTexture(SurfaceTexture surfaceTexture) + throws OutOfResourcesException; + private native void nativeRelease(); + private native void nativeDestroy(); + + private native boolean nativeIsValid(); + private native int nativeGetIdentity(); + private native boolean nativeIsConsumerRunningBehind(); + + private native Canvas nativeLockCanvas(Rect dirty); + private native void nativeUnlockCanvasAndPost(Canvas canvas); + + private static native Bitmap nativeScreenshot(IBinder displayToken, + int width, int height, int minLayer, int maxLayer, boolean allLayers); + + private static native void nativeOpenTransaction(); + private static native void nativeCloseTransaction(); + private static native void nativeSetAnimationTransaction(); + + private native void nativeSetLayer(int zorder); + private native void nativeSetPosition(float x, float y); + private native void nativeSetSize(int w, int h); + private native void nativeSetTransparentRegionHint(Region region); + private native void nativeSetAlpha(float alpha); + private native void nativeSetMatrix(float dsdx, float dtdx, float dsdy, float dtdy); + private native void nativeSetFlags(int flags, int mask); + private native void nativeSetWindowCrop(Rect crop); + private native void nativeSetLayerStack(int layerStack); + + private static native IBinder nativeGetBuiltInDisplay(int physicalDisplayId); + private static native IBinder nativeCreateDisplay(String name, boolean secure); + private static native void nativeSetDisplaySurface( + IBinder displayToken, Surface surface); + private static native void nativeSetDisplayLayerStack( + IBinder displayToken, int layerStack); + private static native void nativeSetDisplayProjection( + IBinder displayToken, int orientation, Rect layerStackRect, Rect displayRect); + private static native boolean nativeGetDisplayInfo( + IBinder displayToken, PhysicalDisplayInfo outInfo); + private static native void nativeBlankDisplay(IBinder displayToken); + private static native void nativeUnblankDisplay(IBinder displayToken); + + private native void nativeCopyFrom(Surface other); + private native void nativeTransferFrom(Surface other); + private native void nativeReadFromParcel(Parcel source); + private native void nativeWriteToParcel(Parcel dest); - /* - * We use a class initializer to allow the native code to cache some - * field offsets. + /** + * Create an empty surface, which will later be filled in by readFromParcel(). + * @hide */ - native private static void nativeClassInit(); - static { nativeClassInit(); } - - /** create a surface @hide */ - public Surface(SurfaceSession s, - int pid, int display, int w, int h, int format, int flags) - throws OutOfResourcesException { + public Surface() { checkHeadless(); - if (DEBUG_RELEASE) { - mCreationStack = new Exception(); - } - mCanvas = new CompatibleCanvas(); - init(s,pid,null,display,w,h,format,flags); + mCloseGuard.open("release"); } - /** 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) - throws OutOfResourcesException { - checkHeadless(); + /** + * Create a surface with a name. + * + * The surface creation flags specify what kind of surface to create and + * certain options such as whether the surface can be assumed to be opaque + * and whether it should be initially hidden. Surfaces should always be + * created with the {@link #HIDDEN} flag set to ensure that they are not + * made visible prematurely before all of the surface's properties have been + * configured. + * + * Good practice is to first create the surface with the {@link #HIDDEN} flag + * specified, open a transaction, set the surface layer, layer stack, alpha, + * and position, call {@link #show} if appropriate, and close the transaction. + * + * @param session The surface session, must not be null. + * @param name The surface name, must not be null. + * @param w The surface initial width. + * @param h The surface initial height. + * @param flags The surface creation flags. Should always include {@link #HIDDEN} + * in the creation flags. + * @hide + */ + public Surface(SurfaceSession session, + String name, int w, int h, int format, int flags) + throws OutOfResourcesException { + if (session == null) { + throw new IllegalArgumentException("session must not be null"); + } + if (name == null) { + throw new IllegalArgumentException("name must not be null"); + } - if (DEBUG_RELEASE) { - mCreationStack = new Exception(); + if ((flags & HIDDEN) == 0) { + Log.w(TAG, "Surfaces should always be created with the HIDDEN flag set " + + "to ensure that they are not made visible prematurely before " + + "all of the surface's properties have been configured. " + + "Set the other properties and make the surface visible within " + + "a transaction. New surface name: " + name, + new Throwable()); } - mCanvas = new CompatibleCanvas(); - init(s,pid,name,display,w,h,format,flags); + + checkHeadless(); + mName = name; + nativeCreate(session, name, w, h, format, flags); + + mCloseGuard.open("release"); } /** - * Create an empty surface, which will later be filled in by - * readFromParcel(). - * @hide + * Create Surface from a {@link SurfaceTexture}. + * + * Images drawn to the Surface will be made available to the {@link + * SurfaceTexture}, which can attach them to an OpenGL ES texture via {@link + * SurfaceTexture#updateTexImage}. + * + * @param surfaceTexture The {@link SurfaceTexture} that is updated by this + * Surface. */ - public Surface() { + public Surface(SurfaceTexture surfaceTexture) { + if (surfaceTexture == null) { + throw new IllegalArgumentException("surfaceTexture must not be null"); + } + checkHeadless(); - if (DEBUG_RELEASE) { - mCreationStack = new Exception(); + mName = surfaceTexture.toString(); + try { + nativeCreateFromSurfaceTexture(surfaceTexture); + } catch (OutOfResourcesException ex) { + // We can't throw OutOfResourcesException because it would be an API change. + throw new RuntimeException(ex); } - mCanvas = new CompatibleCanvas(); + + mCloseGuard.open("release"); } - private Surface(Parcel source) throws OutOfResourcesException { - init(source); + @Override + protected void finalize() throws Throwable { + try { + if (mCloseGuard != null) { + mCloseGuard.warnIfOpen(); + } + nativeRelease(); + } finally { + super.finalize(); + } } /** - * Copy another surface to this one. This surface now holds a reference - * to the same data as the original surface, and is -not- the owner. - * This is for use by the window manager when returning a window surface - * back from a client, converting it from the representation being managed - * by the window manager to the representation the client uses to draw - * in to it. + * Release the local reference to the server-side surface. + * Always call release() when you're done with a Surface. + * This will make the surface invalid. + */ + public void release() { + nativeRelease(); + mCloseGuard.close(); + } + + /** + * Free all server-side state associated with this surface and + * release this object's reference. This method can only be + * called from the process that created the service. * @hide */ - public native void copyFrom(Surface o); + public void destroy() { + nativeDestroy(); + mCloseGuard.close(); + } /** - * Transfer the native state from 'o' to this surface, releasing it - * from 'o'. This is for use in the client side for drawing into a - * surface; not guaranteed to work on the window manager side. - * This is for use by the client to move the underlying surface from - * one Surface object to another, in particular in SurfaceFlinger. - * @hide. + * Returns true if this object holds a valid surface. + * + * @return True if it holds a physical surface, so lockCanvas() will succeed. + * Otherwise returns false. */ - public native void transferFrom(Surface o); + public boolean isValid() { + return nativeIsValid(); + } - /** @hide */ + /** + * Gets the generation number of this surface, incremented each time + * the native surface contained within this object changes. + * + * @return The current generation number. + * @hide + */ public int getGenerationId() { - return mSurfaceGenerationId; + return mGenerationId; } - /** - * Whether the consumer of this Surface is running behind the producer; - * that is, isConsumerRunningBehind() returns true if the consumer is more - * than one buffer ahead of the producer. + * Returns true if the consumer of this Surface is running behind the producer. + * + * @return True if the consumer is more than one buffer ahead of the producer. * @hide */ - public native boolean isConsumerRunningBehind(); + public boolean isConsumerRunningBehind() { + return nativeIsConsumerRunningBehind(); + } /** - * A Canvas class that can handle the compatibility mode. This does two - * things differently. - *
          - *
        • Returns the width and height of the target metrics, rather than - * native. For example, the canvas returns 320x480 even if an app is running - * in WVGA high density. - *
        • Scales the matrix in setMatrix by the application scale, except if - * the matrix looks like obtained from getMatrix. This is a hack to handle - * the case that an application uses getMatrix to keep the original matrix, - * set matrix of its own, then set the original matrix back. There is no - * perfect solution that works for all cases, and there are a lot of cases - * that this model does not work, but we hope this works for many apps. - *
        + * Gets a {@link Canvas} for drawing into this surface. + * + * After drawing into the provided {@link Canvas}, the caller should + * invoke {@link #unlockCanvasAndPost} to post the new contents to the surface. + * + * @param dirty A rectangle that represents the dirty region that the caller wants + * to redraw. This function may choose to expand the dirty rectangle if for example + * the surface has been resized or if the previous contents of the surface were + * not available. The caller should redraw the entire dirty region as represented + * by the contents of the dirty rect upon return from this function. + * The caller may also pass null instead, in the case where the + * entire surface should be redrawn. + * @return A canvas for drawing into the surface. */ - private class CompatibleCanvas extends Canvas { - // A temp matrix to remember what an application obtained via {@link getMatrix} - private Matrix mOrigMatrix = null; - - @Override - public int getWidth() { - int w = super.getWidth(); - if (mCompatibilityTranslator != null) { - w = (int)(w * mCompatibilityTranslator.applicationInvertedScale + .5f); - } - return w; - } - - @Override - public int getHeight() { - int h = super.getHeight(); - if (mCompatibilityTranslator != null) { - h = (int)(h * mCompatibilityTranslator.applicationInvertedScale + .5f); - } - return h; - } + public Canvas lockCanvas(Rect dirty) + throws OutOfResourcesException, IllegalArgumentException { + return nativeLockCanvas(dirty); + } - @Override - public void setMatrix(Matrix matrix) { - if (mCompatibleMatrix == null || mOrigMatrix == null || mOrigMatrix.equals(matrix)) { - // don't scale the matrix if it's not compatibility mode, or - // the matrix was obtained from getMatrix. - super.setMatrix(matrix); - } else { - Matrix m = new Matrix(mCompatibleMatrix); - m.preConcat(matrix); - super.setMatrix(m); - } - } + /** + * Posts the new contents of the {@link Canvas} to the surface and + * releases the {@link Canvas}. + * + * @param canvas The canvas previously obtained from {@link #lockCanvas}. + */ + public void unlockCanvasAndPost(Canvas canvas) { + nativeUnlockCanvasAndPost(canvas); + } - @Override - public void getMatrix(Matrix m) { - super.getMatrix(m); - if (mOrigMatrix == null) { - mOrigMatrix = new Matrix(); - } - mOrigMatrix.set(m); - } + /** + * @deprecated This API has been removed and is not supported. Do not use. + */ + @Deprecated + public void unlockCanvas(Canvas canvas) { + throw new UnsupportedOperationException(); } /** @@ -403,60 +476,19 @@ void setCompatibilityTranslator(Translator translator) { mCompatibleMatrix.setScale(appScale, appScale); } } - - /** Free all server-side state associated with this surface and - * release this object's reference. @hide */ - public native void destroy(); - - private native Canvas lockCanvasNative(Rect dirty); - - /* - * set display parameters & screenshots - */ - - /** - * Freezes the specified display, No updating of the screen will occur - * until unfreezeDisplay() is called. Everything else works as usual though, - * in particular transactions. - * @param display - * @hide - */ - public static native void freezeDisplay(int display); - /** - * resume updating the specified display. - * @param display - * @hide - */ - public static native void unfreezeDisplay(int display); - - /** - * 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); - - /** - * 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. * * @hide */ - public static native Bitmap screenshot(int width, int height); - + public static Bitmap screenshot(int width, int height) { + // TODO: should take the display as a parameter + IBinder displayToken = getBuiltInDisplay(BUILT_IN_DISPLAY_ID_MAIN); + return nativeScreenshot(displayToken, width, height, 0, 0, true); + } + /** * Copy the current screen contents into a bitmap and return it. * @@ -468,95 +500,370 @@ public static void setOrientation(int display, int orientation) { * include in the screenshot. * @param maxLayer The highest (top-most Z order) surface layer to * include in the screenshot. - * @return Returns a Bitmap containing the screen contents. + * @return Returns a Bitmap containing the screen contents, or null + * if an error occurs. * * @hide */ - public static native Bitmap screenshot(int width, int height, int minLayer, int maxLayer); + public static Bitmap screenshot(int width, int height, int minLayer, int maxLayer) { + // TODO: should take the display as a parameter + IBinder displayToken = getBuiltInDisplay(BUILT_IN_DISPLAY_ID_MAIN); + return nativeScreenshot(displayToken, width, height, minLayer, maxLayer, false); + } - /* * set surface parameters. * needs to be inside open/closeTransaction block */ - + /** start a transaction @hide */ - public static native void openTransaction(); + public static void openTransaction() { + nativeOpenTransaction(); + } + /** end a transaction @hide */ - public static native void closeTransaction(); + public static void closeTransaction() { + nativeCloseTransaction(); + } + + /** flag the transaction as an animation @hide */ + public static void setAnimationTransaction() { + nativeSetAnimationTransaction(); + } + /** @hide */ - public native void setLayer(int zorder); + public void setLayer(int zorder) { + nativeSetLayer(zorder); + } + /** @hide */ - public void setPosition(int x, int y) { setPosition((float)x, (float)y); } + public void setPosition(int x, int y) { + nativeSetPosition((float)x, (float)y); + } + /** @hide */ - public native void setPosition(float x, float y); + public void setPosition(float x, float y) { + nativeSetPosition(x, y); + } + /** @hide */ - public native void setSize(int w, int h); + public void setSize(int w, int h) { + nativeSetSize(w, h); + } + /** @hide */ - public native void hide(); + public void hide() { + nativeSetFlags(SURFACE_HIDDEN, SURFACE_HIDDEN); + } + /** @hide */ - public native void show(); + public void show() { + nativeSetFlags(0, SURFACE_HIDDEN); + } + /** @hide */ - public native void setTransparentRegionHint(Region region); + public void setTransparentRegionHint(Region region) { + nativeSetTransparentRegionHint(region); + } + /** @hide */ - public native void setAlpha(float alpha); + public void setAlpha(float alpha) { + nativeSetAlpha(alpha); + } + /** @hide */ - public native void setMatrix(float dsdx, float dtdx, float dsdy, float dtdy); + public void setMatrix(float dsdx, float dtdx, float dsdy, float dtdy) { + nativeSetMatrix(dsdx, dtdx, dsdy, dtdy); + } + /** @hide */ - public native void freeze(); + public void setFlags(int flags, int mask) { + nativeSetFlags(flags, mask); + } + /** @hide */ - public native void unfreeze(); + public void setWindowCrop(Rect crop) { + nativeSetWindowCrop(crop); + } + /** @hide */ - public native void setFreezeTint(int tint); + public void setLayerStack(int layerStack) { + nativeSetLayerStack(layerStack); + } + /** @hide */ - public native void setFlags(int flags, int mask); + public static IBinder getBuiltInDisplay(int builtInDisplayId) { + return nativeGetBuiltInDisplay(builtInDisplayId); + } + /** @hide */ - public native void setWindowCrop(Rect crop); + public static IBinder createDisplay(String name, boolean secure) { + if (name == null) { + throw new IllegalArgumentException("name must not be null"); + } + return nativeCreateDisplay(name, secure); + } + /** @hide */ + public static void setDisplaySurface(IBinder displayToken, Surface surface) { + if (displayToken == null) { + throw new IllegalArgumentException("displayToken must not be null"); + } + nativeSetDisplaySurface(displayToken, surface); + } - - public static final Parcelable.Creator CREATOR - = new Parcelable.Creator() - { - public Surface createFromParcel(Parcel source) { - try { - return new Surface(source); - } catch (Exception e) { - Log.e(LOG_TAG, "Exception creating surface from parcel", e); - } - return null; + /** @hide */ + public static void setDisplayLayerStack(IBinder displayToken, int layerStack) { + if (displayToken == null) { + throw new IllegalArgumentException("displayToken must not be null"); } + nativeSetDisplayLayerStack(displayToken, layerStack); + } - public Surface[] newArray(int size) { - return new Surface[size]; + /** @hide */ + public static void setDisplayProjection(IBinder displayToken, + int orientation, Rect layerStackRect, Rect displayRect) { + if (displayToken == null) { + throw new IllegalArgumentException("displayToken must not be null"); } - }; + if (layerStackRect == null) { + throw new IllegalArgumentException("layerStackRect must not be null"); + } + if (displayRect == null) { + throw new IllegalArgumentException("displayRect must not be null"); + } + nativeSetDisplayProjection(displayToken, orientation, layerStackRect, displayRect); + } + + /** @hide */ + public static boolean getDisplayInfo(IBinder displayToken, PhysicalDisplayInfo outInfo) { + if (displayToken == null) { + throw new IllegalArgumentException("displayToken must not be null"); + } + if (outInfo == null) { + throw new IllegalArgumentException("outInfo must not be null"); + } + return nativeGetDisplayInfo(displayToken, outInfo); + } + + /** @hide */ + public static void blankDisplay(IBinder displayToken) { + if (displayToken == null) { + throw new IllegalArgumentException("displayToken must not be null"); + } + nativeBlankDisplay(displayToken); + } + + /** @hide */ + public static void unblankDisplay(IBinder displayToken) { + if (displayToken == null) { + throw new IllegalArgumentException("displayToken must not be null"); + } + nativeUnblankDisplay(displayToken); + } + + /** + * Copy another surface to this one. This surface now holds a reference + * to the same data as the original surface, and is -not- the owner. + * This is for use by the window manager when returning a window surface + * back from a client, converting it from the representation being managed + * by the window manager to the representation the client uses to draw + * in to it. + * @hide + */ + public void copyFrom(Surface other) { + if (other == null) { + throw new IllegalArgumentException("other must not be null"); + } + if (other != this) { + nativeCopyFrom(other); + } + } + + /** + * Transfer the native state from 'other' to this surface, releasing it + * from 'other'. This is for use in the client side for drawing into a + * surface; not guaranteed to work on the window manager side. + * This is for use by the client to move the underlying surface from + * one Surface object to another, in particular in SurfaceFlinger. + * @hide. + */ + public void transferFrom(Surface other) { + if (other == null) { + throw new IllegalArgumentException("other must not be null"); + } + if (other != this) { + nativeTransferFrom(other); + } + } @Override - protected void finalize() throws Throwable { - try { - super.finalize(); - } finally { - if (mNativeSurface != 0 || mSurfaceControl != 0) { - if (DEBUG_RELEASE) { - Log.w(LOG_TAG, "Surface.finalize() has work. You should have called release() (" - + mNativeSurface + ", " + mSurfaceControl + ")", mCreationStack); - } else { - Log.w(LOG_TAG, "Surface.finalize() has work. You should have called release() (" - + mNativeSurface + ", " + mSurfaceControl + ")"); - } - } - release(); + public int describeContents() { + return 0; + } + + public void readFromParcel(Parcel source) { + if (source == null) { + throw new IllegalArgumentException("source must not be null"); } + + mName = source.readString(); + nativeReadFromParcel(source); } - - private native void init(SurfaceSession s, - int pid, String name, int display, int w, int h, int format, int flags) - throws OutOfResourcesException; - private native void init(Parcel source); + @Override + public void writeToParcel(Parcel dest, int flags) { + if (dest == null) { + throw new IllegalArgumentException("dest must not be null"); + } + + dest.writeString(mName); + nativeWriteToParcel(dest); + if ((flags & Parcelable.PARCELABLE_WRITE_RETURN_VALUE) != 0) { + release(); + } + } + + @Override + public String toString() { + return "Surface(name=" + mName + ", identity=" + nativeGetIdentity() + ")"; + } + + private static void checkHeadless() { + if (HEADLESS) { + throw new UnsupportedOperationException("Device is headless"); + } + } + + /** + * Exception thrown when a surface couldn't be created or resized. + */ + public static class OutOfResourcesException extends Exception { + public OutOfResourcesException() { + } + + public OutOfResourcesException(String name) { + super(name); + } + } + + /** + * Describes the properties of a physical display known to surface flinger. + * @hide + */ + public static final class PhysicalDisplayInfo { + public int width; + public int height; + public float refreshRate; + public float density; + public float xDpi; + public float yDpi; + public boolean secure; + + public PhysicalDisplayInfo() { + } + + public PhysicalDisplayInfo(PhysicalDisplayInfo other) { + copyFrom(other); + } + + @Override + public boolean equals(Object o) { + return o instanceof PhysicalDisplayInfo && equals((PhysicalDisplayInfo)o); + } + + public boolean equals(PhysicalDisplayInfo other) { + return other != null + && width == other.width + && height == other.height + && refreshRate == other.refreshRate + && density == other.density + && xDpi == other.xDpi + && yDpi == other.yDpi + && secure == other.secure; + } + + @Override + public int hashCode() { + return 0; // don't care + } + + public void copyFrom(PhysicalDisplayInfo other) { + width = other.width; + height = other.height; + refreshRate = other.refreshRate; + density = other.density; + xDpi = other.xDpi; + yDpi = other.yDpi; + secure = other.secure; + } + + // For debugging purposes + @Override + public String toString() { + return "PhysicalDisplayInfo{" + width + " x " + height + ", " + refreshRate + " fps, " + + "density " + density + ", " + xDpi + " x " + yDpi + " dpi, secure " + secure + + "}"; + } + } + + /** + * A Canvas class that can handle the compatibility mode. + * This does two things differently. + *
          + *
        • Returns the width and height of the target metrics, rather than + * native. For example, the canvas returns 320x480 even if an app is running + * in WVGA high density. + *
        • Scales the matrix in setMatrix by the application scale, except if + * the matrix looks like obtained from getMatrix. This is a hack to handle + * the case that an application uses getMatrix to keep the original matrix, + * set matrix of its own, then set the original matrix back. There is no + * perfect solution that works for all cases, and there are a lot of cases + * that this model does not work, but we hope this works for many apps. + *
        + */ + private final class CompatibleCanvas extends Canvas { + // A temp matrix to remember what an application obtained via {@link getMatrix} + private Matrix mOrigMatrix = null; + + @Override + public int getWidth() { + int w = super.getWidth(); + if (mCompatibilityTranslator != null) { + w = (int)(w * mCompatibilityTranslator.applicationInvertedScale + .5f); + } + return w; + } + + @Override + public int getHeight() { + int h = super.getHeight(); + if (mCompatibilityTranslator != null) { + h = (int)(h * mCompatibilityTranslator.applicationInvertedScale + .5f); + } + return h; + } - private native void initFromSurfaceTexture(SurfaceTexture surfaceTexture); + @Override + public void setMatrix(Matrix matrix) { + if (mCompatibleMatrix == null || mOrigMatrix == null || mOrigMatrix.equals(matrix)) { + // don't scale the matrix if it's not compatibility mode, or + // the matrix was obtained from getMatrix. + super.setMatrix(matrix); + } else { + Matrix m = new Matrix(mCompatibleMatrix); + m.preConcat(matrix); + super.setMatrix(m); + } + } - private native int getIdentity(); + @Override + public void getMatrix(Matrix m) { + super.getMatrix(m); + if (mOrigMatrix == null) { + mOrigMatrix = new Matrix(); + } + mOrigMatrix.set(m); + } + } } diff --git a/core/java/android/view/SurfaceSession.java b/core/java/android/view/SurfaceSession.java index 2a04675de04aa..0dfd94a932194 100644 --- a/core/java/android/view/SurfaceSession.java +++ b/core/java/android/view/SurfaceSession.java @@ -16,34 +16,44 @@ package android.view; - /** * An instance of this class represents a connection to the surface - * flinger, in which you can create one or more Surface instances that will + * flinger, from which you can create one or more Surface instances that will * be composited to the screen. * {@hide} */ -public class SurfaceSession { +public final class SurfaceSession { + // Note: This field is accessed by native code. + private int mNativeClient; // SurfaceComposerClient* + + private static native int nativeCreate(); + private static native void nativeDestroy(int ptr); + private static native void nativeKill(int ptr); + /** Create a new connection with the surface flinger. */ public SurfaceSession() { - init(); + mNativeClient = nativeCreate(); } - /** Forcibly detach native resources associated with this object. - * Unlike destroy(), after this call any surfaces that were created - * from the session will no longer work. The session itself is destroyed. - */ - public native void kill(); - /* no user serviceable parts here ... */ @Override protected void finalize() throws Throwable { - destroy(); + try { + if (mNativeClient != 0) { + nativeDestroy(mNativeClient); + } + } finally { + super.finalize(); + } + } + + /** + * Forcibly detach native resources associated with this object. + * Unlike destroy(), after this call any surfaces that were created + * from the session will no longer work. + */ + public void kill() { + nativeKill(mNativeClient); } - - private native void init(); - private native void destroy(); - - private int mClient; } diff --git a/core/java/android/view/SurfaceView.java b/core/java/android/view/SurfaceView.java index fd302dc5b359c..9008521e3b1dc 100644 --- a/core/java/android/view/SurfaceView.java +++ b/core/java/android/view/SurfaceView.java @@ -46,13 +46,18 @@ * *

        The surface is Z ordered so that it is behind the window holding its * SurfaceView; the SurfaceView punches a hole in its window to allow its - * surface to be displayed. The view hierarchy will take care of correctly + * surface to be displayed. The view hierarchy will take care of correctly * compositing with the Surface any siblings of the SurfaceView that would - * normally appear on top of it. This can be used to place overlays such as + * normally appear on top of it. This can be used to place overlays such as * buttons on top of the Surface, though note however that it can have an * impact on performance since a full alpha-blended composite will be performed * each time the Surface changes. * + *

        The transparent region that makes the surface visible is based on the + * layout positions in the view hierarchy. If the post-layout transform + * properties are used to draw a sibling view on top of the SurfaceView, the + * view may not be properly composited with the surface. + * *

        Access to the underlying surface is provided via the SurfaceHolder interface, * which can be retrieved by calling {@link #getHolder}. * @@ -62,14 +67,14 @@ * Surface is created and destroyed as the window is shown and hidden. * *

        One of the purposes of this class is to provide a surface in which a - * secondary thread can render into the screen. If you are going to use it + * secondary thread can render into the screen. If you are going to use it * this way, you need to be aware of some threading semantics: * *

          *
        • All SurfaceView and * {@link SurfaceHolder.Callback SurfaceHolder.Callback} methods will be called * from the thread running the SurfaceView's window (typically the main thread - * of the application). They thus need to correctly synchronize with any + * of the application). They thus need to correctly synchronize with any * state that is also touched by the drawing thread. *
        • You must ensure that the drawing thread only touches the underlying * Surface while it is valid -- between @@ -296,7 +301,7 @@ public boolean gatherTransparentRegion(Region region) { } boolean opaque = true; - if ((mPrivateFlags & SKIP_DRAW) == 0) { + if ((mPrivateFlags & PFLAG_SKIP_DRAW) == 0) { // this view draws, remove it from the transparent region opaque = super.gatherTransparentRegion(region); } else if (region != null) { @@ -320,7 +325,7 @@ public boolean gatherTransparentRegion(Region region) { public void draw(Canvas canvas) { if (mWindowType != WindowManager.LayoutParams.TYPE_APPLICATION_PANEL) { // draw() is not called when SKIP_DRAW is set - if ((mPrivateFlags & SKIP_DRAW) == 0) { + if ((mPrivateFlags & PFLAG_SKIP_DRAW) == 0) { // punch a whole in the view-hierarchy below us canvas.drawColor(0, PorterDuff.Mode.CLEAR); } @@ -332,7 +337,7 @@ public void draw(Canvas canvas) { protected void dispatchDraw(Canvas canvas) { if (mWindowType != WindowManager.LayoutParams.TYPE_APPLICATION_PANEL) { // if SKIP_DRAW is cleared, draw() has already punched a hole - if ((mPrivateFlags & SKIP_DRAW) == SKIP_DRAW) { + if ((mPrivateFlags & PFLAG_SKIP_DRAW) == PFLAG_SKIP_DRAW) { // punch a whole in the view-hierarchy below us canvas.drawColor(0, PorterDuff.Mode.CLEAR); } @@ -380,7 +385,27 @@ public void setZOrderOnTop(boolean onTop) { mLayout.flags &= ~WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM; } } - + + /** + * Control whether the surface view's content should be treated as secure, + * preventing it from appearing in screenshots or from being viewed on + * non-secure displays. + * + *

          Note that this must be set before the surface view's containing + * window is attached to the window manager. + * + *

          See {@link android.view.Display#FLAG_SECURE} for details. + * + * @param isSecure True if the surface view is secure. + */ + public void setSecure(boolean isSecure) { + if (isSecure) { + mLayout.flags |= WindowManager.LayoutParams.FLAG_SECURE; + } else { + mLayout.flags &= ~WindowManager.LayoutParams.FLAG_SECURE; + } + } + /** * Hack to allow special layering of windows. The type is one of the * types in WindowManager.LayoutParams. This is a hack so: @@ -456,11 +481,12 @@ private void updateWindow(boolean force, boolean redrawNeeded) { } if (mWindow == null) { + Display display = getDisplay(); mWindow = new MyWindow(this); mLayout.type = mWindowType; - mLayout.gravity = Gravity.LEFT|Gravity.TOP; - mSession.addWithoutInputChannel(mWindow, mWindow.mSeq, mLayout, - mVisible ? VISIBLE : GONE, mContentInsets); + mLayout.gravity = Gravity.START|Gravity.TOP; + mSession.addToDisplayWithoutInputChannel(mWindow, mWindow.mSeq, mLayout, + mVisible ? VISIBLE : GONE, display.getDisplayId(), mContentInsets); } boolean realSizeChanged; @@ -480,10 +506,10 @@ private void updateWindow(boolean force, boolean redrawNeeded) { relayoutResult = mSession.relayout( mWindow, mWindow.mSeq, mLayout, mWidth, mHeight, visible ? VISIBLE : GONE, - WindowManagerImpl.RELAYOUT_DEFER_SURFACE_DESTROY, + WindowManagerGlobal.RELAYOUT_DEFER_SURFACE_DESTROY, mWinFrame, mContentInsets, mVisibleInsets, mConfiguration, mNewSurface); - if ((relayoutResult&WindowManagerImpl.RELAYOUT_RES_FIRST_TIME) != 0) { + if ((relayoutResult & WindowManagerGlobal.RELAYOUT_RES_FIRST_TIME) != 0) { mReportDrawNeeded = true; } @@ -516,8 +542,8 @@ private void updateWindow(boolean force, boolean redrawNeeded) { SurfaceHolder.Callback callbacks[] = null; - final boolean surfaceChanged = - (relayoutResult&WindowManagerImpl.RELAYOUT_RES_SURFACE_CHANGED) != 0; + final boolean surfaceChanged = (relayoutResult + & WindowManagerGlobal.RELAYOUT_RES_SURFACE_CHANGED) != 0; if (mSurfaceCreated && (surfaceChanged || (!visible && visibleChanged))) { mSurfaceCreated = false; if (mSurface.isValid()) { @@ -531,7 +557,7 @@ private void updateWindow(boolean force, boolean redrawNeeded) { mSurface.transferFrom(mNewSurface); - if (visible) { + if (visible && mSurface.isValid()) { if (!mSurfaceCreated && (surfaceChanged || visibleChanged)) { mSurfaceCreated = true; mIsCreating = true; @@ -615,21 +641,22 @@ public MyWindow(SurfaceView surfaceView) { mSurfaceView = new WeakReference(surfaceView); } - public void resized(int w, int h, Rect contentInsets, + @Override + public void resized(Rect frame, Rect contentInsets, Rect visibleInsets, boolean reportDraw, Configuration newConfig) { SurfaceView surfaceView = mSurfaceView.get(); if (surfaceView != null) { if (DEBUG) Log.v( - "SurfaceView", surfaceView + " got resized: w=" + - w + " h=" + h + ", cur w=" + mCurWidth + " h=" + mCurHeight); + "SurfaceView", surfaceView + " got resized: w=" + frame.width() + + " h=" + frame.height() + ", cur w=" + mCurWidth + " h=" + mCurHeight); surfaceView.mSurfaceLock.lock(); try { if (reportDraw) { surfaceView.mUpdateWindowNeeded = true; surfaceView.mReportDrawNeeded = true; surfaceView.mHandler.sendEmptyMessage(UPDATE_WINDOW_MSG); - } else if (surfaceView.mWinFrame.width() != w - || surfaceView.mWinFrame.height() != h) { + } else if (surfaceView.mWinFrame.width() != frame.width() + || surfaceView.mWinFrame.height() != frame.height()) { surfaceView.mUpdateWindowNeeded = true; surfaceView.mHandler.sendEmptyMessage(UPDATE_WINDOW_MSG); } diff --git a/core/java/android/view/TextureView.java b/core/java/android/view/TextureView.java index a719a0159c18a..230f426626a0b 100644 --- a/core/java/android/view/TextureView.java +++ b/core/java/android/view/TextureView.java @@ -189,7 +189,7 @@ public void setOpaque(boolean opaque) { if (opaque != mOpaque) { mOpaque = opaque; if (mLayer != null) { - updateLayer(); + updateLayerAndInvalidate(); } } } @@ -224,6 +224,9 @@ public void run() { private void destroySurface() { if (mLayer != null) { mSurface.detachFromGLContext(); + // SurfaceTexture owns the texture name and detachFromGLContext + // should have deleted it + mLayer.clearStorage(); boolean shouldRelease = true; if (mListener != null) { @@ -290,6 +293,9 @@ public void buildLayer() { */ @Override public final void draw(Canvas canvas) { + // NOTE: Maintain this carefully (see View.java) + mPrivateFlags = (mPrivateFlags & ~PFLAG_DIRTY_MASK) | PFLAG_DRAWN; + applyUpdate(); applyTransformMatrix(); } @@ -309,6 +315,7 @@ protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); if (mSurface != null) { nSetDefaultBufferSize(mSurface, getWidth(), getHeight()); + updateLayer(); if (mListener != null) { mListener.onSurfaceTextureSizeChanged(mSurface, getWidth(), getHeight()); } @@ -333,6 +340,10 @@ protected void destroyHardwareResources() { @Override HardwareLayer getHardwareLayer() { + // NOTE: Maintain these two lines very carefully (see View.java) + mPrivateFlags |= PFLAG_DRAWN | PFLAG_DRAWING_CACHE_VALID; + mPrivateFlags &= ~PFLAG_DIRTY_MASK; + if (mLayer == null) { if (mAttachInfo == null || mAttachInfo.mHardwareRenderer == null) { return null; @@ -351,9 +362,7 @@ HardwareLayer getHardwareLayer() { public void onFrameAvailable(SurfaceTexture surfaceTexture) { // Per SurfaceTexture's documentation, the callback may be invoked // from an arbitrary thread - synchronized (mLock) { - mUpdateLayer = true; - } + updateLayer(); if (Looper.myLooper() == Looper.getMainLooper()) { invalidate(); @@ -367,6 +376,7 @@ public void onFrameAvailable(SurfaceTexture surfaceTexture) { if (mListener != null && !mUpdateSurface) { mListener.onSurfaceTextureAvailable(mSurface, getWidth(), getHeight()); } + mLayer.setLayerPaint(mLayerPaint); } if (mUpdateSurface) { @@ -377,9 +387,7 @@ public void onFrameAvailable(SurfaceTexture surfaceTexture) { // Since we are updating the layer, force an update to ensure its // parameters are correct (width, height, transform, etc.) - synchronized (mLock) { - mUpdateLayer = true; - } + updateLayer(); mMatrixChanged = true; mAttachInfo.mHardwareRenderer.setSurfaceTexture(mLayer, mSurface); @@ -402,7 +410,7 @@ protected void onVisibilityChanged(View changedView, int visibility) { // updates listener if (visibility == VISIBLE) { mSurface.setOnFrameAvailableListener(mUpdateListener); - updateLayer(); + updateLayerAndInvalidate(); } else { mSurface.setOnFrameAvailableListener(null); } @@ -410,7 +418,15 @@ protected void onVisibilityChanged(View changedView, int visibility) { } private void updateLayer() { - mUpdateLayer = true; + synchronized (mLock) { + mUpdateLayer = true; + } + } + + private void updateLayerAndInvalidate() { + synchronized (mLock) { + mUpdateLayer = true; + } invalidate(); } @@ -534,7 +550,8 @@ public Bitmap getBitmap() { */ public Bitmap getBitmap(int width, int height) { if (isAvailable() && width > 0 && height > 0) { - return getBitmap(Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888)); + return getBitmap(Bitmap.createBitmap(getResources().getDisplayMetrics(), + width, height, Bitmap.Config.ARGB_8888)); } return null; } @@ -765,6 +782,7 @@ public static interface SurfaceTextureListener { * Invoked when the specified {@link SurfaceTexture} is about to be destroyed. * If returns true, no rendering should happen inside the surface texture after this method * is invoked. If returns false, the client needs to call {@link SurfaceTexture#release()}. + * Most applications should return true. * * @param surface The surface about to be destroyed */ diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index f0ca302f42137..ff44475a7e285 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -39,6 +39,7 @@ import android.graphics.Shader; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; +import android.hardware.display.DisplayManagerGlobal; import android.os.Bundle; import android.os.Handler; import android.os.IBinder; @@ -47,9 +48,9 @@ import android.os.RemoteException; import android.os.SystemClock; import android.os.SystemProperties; +import android.text.TextUtils; import android.util.AttributeSet; import android.util.FloatProperty; -import android.util.LocaleUtil; import android.util.Log; import android.util.Pool; import android.util.Poolable; @@ -82,14 +83,21 @@ import com.android.internal.R; import com.android.internal.util.Predicate; import com.android.internal.view.menu.MenuBuilder; +import com.google.android.collect.Lists; +import com.google.android.collect.Maps; import java.lang.ref.WeakReference; +import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import java.lang.reflect.Modifier; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; import java.util.Locale; import java.util.concurrent.CopyOnWriteArrayList; +import java.util.concurrent.atomic.AtomicInteger; /** *

          @@ -343,9 +351,10 @@ * Padding can be used to offset the content of the view by a specific amount of * pixels. For instance, a left padding of 2 will push the view's content by * 2 pixels to the right of the left edge. Padding can be set using the - * {@link #setPadding(int, int, int, int)} method and queried by calling - * {@link #getPaddingLeft()}, {@link #getPaddingTop()}, {@link #getPaddingRight()}, - * {@link #getPaddingBottom()}. + * {@link #setPadding(int, int, int, int)} or {@link #setPaddingRelative(int, int, int, int)} + * method and queried by calling {@link #getPaddingLeft()}, {@link #getPaddingTop()}, + * {@link #getPaddingRight()}, {@link #getPaddingBottom()}, {@link #getPaddingStart()}, + * {@link #getPaddingEnd()}. *

          * *

          @@ -627,6 +636,8 @@ * @attr ref android.R.styleable#View_paddingLeft * @attr ref android.R.styleable#View_paddingRight * @attr ref android.R.styleable#View_paddingTop + * @attr ref android.R.styleable#View_paddingStart + * @attr ref android.R.styleable#View_paddingEnd * @attr ref android.R.styleable#View_saveEnabled * @attr ref android.R.styleable#View_rotation * @attr ref android.R.styleable#View_rotationX @@ -648,6 +659,7 @@ * @attr ref android.R.styleable#View_scrollbarAlwaysDrawVerticalTrack * @attr ref android.R.styleable#View_soundEffectsEnabled * @attr ref android.R.styleable#View_tag + * @attr ref android.R.styleable#View_textAlignment * @attr ref android.R.styleable#View_transformPivotX * @attr ref android.R.styleable#View_transformPivotY * @attr ref android.R.styleable#View_translationX @@ -656,7 +668,7 @@ * * @see android.view.ViewGroup */ -public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Callback, +public class View implements Drawable.Callback, KeyEvent.Callback, AccessibilityEventSource { private static final boolean DBG = false; @@ -1002,14 +1014,6 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal */ public static final int FOCUSABLES_TOUCH_MODE = 0x00000001; - /** - * View flag indicating whether {@link #addFocusables(ArrayList, int, int)} - * should add only accessibility focusable Views. - * - * @hide - */ - public static final int FOCUSABLES_ACCESSIBILITY = 0x00000002; - /** * Use with {@link #focusSearch(int)}. Move focus to the previous selectable * item. @@ -1042,58 +1046,6 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal */ public static final int FOCUS_DOWN = 0x00000082; - // Accessibility focus directions. - - /** - * The accessibility focus which is the current user position when - * interacting with the accessibility framework. - * - * @hide - */ - public static final int FOCUS_ACCESSIBILITY = 0x00001000; - - /** - * Use with {@link #focusSearch(int)}. Move acessibility focus left. - * - * @hide - */ - public static final int ACCESSIBILITY_FOCUS_LEFT = FOCUS_LEFT | FOCUS_ACCESSIBILITY; - - /** - * Use with {@link #focusSearch(int)}. Move acessibility focus up. - * - * @hide - */ - public static final int ACCESSIBILITY_FOCUS_UP = FOCUS_UP | FOCUS_ACCESSIBILITY; - - /** - * Use with {@link #focusSearch(int)}. Move acessibility focus right. - * - * @hide - */ - public static final int ACCESSIBILITY_FOCUS_RIGHT = FOCUS_RIGHT | FOCUS_ACCESSIBILITY; - - /** - * Use with {@link #focusSearch(int)}. Move acessibility focus down. - * - * @hide - */ - public static final int ACCESSIBILITY_FOCUS_DOWN = FOCUS_DOWN | FOCUS_ACCESSIBILITY; - - /** - * Use with {@link #focusSearch(int)}. Move acessibility focus forward. - * - * @hide - */ - public static final int ACCESSIBILITY_FOCUS_FORWARD = FOCUS_FORWARD | FOCUS_ACCESSIBILITY; - - /** - * Use with {@link #focusSearch(int)}. Move acessibility focus backward. - * - * @hide - */ - public static final int ACCESSIBILITY_FOCUS_BACKWARD = FOCUS_BACKWARD | FOCUS_ACCESSIBILITY; - /** * Bits of {@link #getMeasuredWidthAndState()} and * {@link #getMeasuredWidthAndState()} that provide the actual measured size. @@ -1557,7 +1509,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal private SparseArray mKeyedTags; /** - * The next available accessiiblity id. + * The next available accessibility id. */ private static int sNextAccessibilityViewId; @@ -1623,17 +1575,17 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal // for mPrivateFlags: /** {@hide} */ - static final int WANTS_FOCUS = 0x00000001; + static final int PFLAG_WANTS_FOCUS = 0x00000001; /** {@hide} */ - static final int FOCUSED = 0x00000002; + static final int PFLAG_FOCUSED = 0x00000002; /** {@hide} */ - static final int SELECTED = 0x00000004; + static final int PFLAG_SELECTED = 0x00000004; /** {@hide} */ - static final int IS_ROOT_NAMESPACE = 0x00000008; + static final int PFLAG_IS_ROOT_NAMESPACE = 0x00000008; /** {@hide} */ - static final int HAS_BOUNDS = 0x00000010; + static final int PFLAG_HAS_BOUNDS = 0x00000010; /** {@hide} */ - static final int DRAWN = 0x00000020; + static final int PFLAG_DRAWN = 0x00000020; /** * When this flag is set, this view is running an animation on behalf of its * children and should therefore not cancel invalidate requests, even if they @@ -1641,58 +1593,58 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * * {@hide} */ - static final int DRAW_ANIMATION = 0x00000040; + static final int PFLAG_DRAW_ANIMATION = 0x00000040; /** {@hide} */ - static final int SKIP_DRAW = 0x00000080; + static final int PFLAG_SKIP_DRAW = 0x00000080; /** {@hide} */ - static final int ONLY_DRAWS_BACKGROUND = 0x00000100; + static final int PFLAG_ONLY_DRAWS_BACKGROUND = 0x00000100; /** {@hide} */ - static final int REQUEST_TRANSPARENT_REGIONS = 0x00000200; + static final int PFLAG_REQUEST_TRANSPARENT_REGIONS = 0x00000200; /** {@hide} */ - static final int DRAWABLE_STATE_DIRTY = 0x00000400; + static final int PFLAG_DRAWABLE_STATE_DIRTY = 0x00000400; /** {@hide} */ - static final int MEASURED_DIMENSION_SET = 0x00000800; + static final int PFLAG_MEASURED_DIMENSION_SET = 0x00000800; /** {@hide} */ - static final int FORCE_LAYOUT = 0x00001000; + static final int PFLAG_FORCE_LAYOUT = 0x00001000; /** {@hide} */ - static final int LAYOUT_REQUIRED = 0x00002000; + static final int PFLAG_LAYOUT_REQUIRED = 0x00002000; - private static final int PRESSED = 0x00004000; + private static final int PFLAG_PRESSED = 0x00004000; /** {@hide} */ - static final int DRAWING_CACHE_VALID = 0x00008000; + static final int PFLAG_DRAWING_CACHE_VALID = 0x00008000; /** * Flag used to indicate that this view should be drawn once more (and only once * more) after its animation has completed. * {@hide} */ - static final int ANIMATION_STARTED = 0x00010000; + static final int PFLAG_ANIMATION_STARTED = 0x00010000; - private static final int SAVE_STATE_CALLED = 0x00020000; + private static final int PFLAG_SAVE_STATE_CALLED = 0x00020000; /** * Indicates that the View returned true when onSetAlpha() was called and that * the alpha must be restored. * {@hide} */ - static final int ALPHA_SET = 0x00040000; + static final int PFLAG_ALPHA_SET = 0x00040000; /** * Set by {@link #setScrollContainer(boolean)}. */ - static final int SCROLL_CONTAINER = 0x00080000; + static final int PFLAG_SCROLL_CONTAINER = 0x00080000; /** * Set by {@link #setScrollContainer(boolean)}. */ - static final int SCROLL_CONTAINER_ADDED = 0x00100000; + static final int PFLAG_SCROLL_CONTAINER_ADDED = 0x00100000; /** * View flag indicating whether this view was invalidated (fully or partially.) * * @hide */ - static final int DIRTY = 0x00200000; + static final int PFLAG_DIRTY = 0x00200000; /** * View flag indicating whether this view was invalidated by an opaque @@ -1700,35 +1652,35 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * * @hide */ - static final int DIRTY_OPAQUE = 0x00400000; + static final int PFLAG_DIRTY_OPAQUE = 0x00400000; /** - * Mask for {@link #DIRTY} and {@link #DIRTY_OPAQUE}. + * Mask for {@link #PFLAG_DIRTY} and {@link #PFLAG_DIRTY_OPAQUE}. * * @hide */ - static final int DIRTY_MASK = 0x00600000; + static final int PFLAG_DIRTY_MASK = 0x00600000; /** * Indicates whether the background is opaque. * * @hide */ - static final int OPAQUE_BACKGROUND = 0x00800000; + static final int PFLAG_OPAQUE_BACKGROUND = 0x00800000; /** * Indicates whether the scrollbars are opaque. * * @hide */ - static final int OPAQUE_SCROLLBARS = 0x01000000; + static final int PFLAG_OPAQUE_SCROLLBARS = 0x01000000; /** * Indicates whether the view is opaque. * * @hide */ - static final int OPAQUE_MASK = 0x01800000; + static final int PFLAG_OPAQUE_MASK = 0x01800000; /** * Indicates a prepressed state; @@ -1738,27 +1690,27 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * * @hide */ - private static final int PREPRESSED = 0x02000000; + private static final int PFLAG_PREPRESSED = 0x02000000; /** * Indicates whether the view is temporarily detached. * * @hide */ - static final int CANCEL_NEXT_UP_EVENT = 0x04000000; + static final int PFLAG_CANCEL_NEXT_UP_EVENT = 0x04000000; /** * Indicates that we should awaken scroll bars once attached * * @hide */ - private static final int AWAKEN_SCROLL_BARS_ON_ATTACH = 0x08000000; + private static final int PFLAG_AWAKEN_SCROLL_BARS_ON_ATTACH = 0x08000000; /** * Indicates that the view has received HOVER_ENTER. Cleared on HOVER_EXIT. * @hide */ - private static final int HOVERED = 0x10000000; + private static final int PFLAG_HOVERED = 0x10000000; /** * Indicates that pivotX or pivotY were explicitly set and we should not assume the center @@ -1766,10 +1718,10 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * * @hide */ - private static final int PIVOT_EXPLICITLY_SET = 0x20000000; + private static final int PFLAG_PIVOT_EXPLICITLY_SET = 0x20000000; /** {@hide} */ - static final int ACTIVATED = 0x40000000; + static final int PFLAG_ACTIVATED = 0x40000000; /** * Indicates that this view was specifically invalidated, not just dirtied because some @@ -1779,16 +1731,60 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * * @hide */ - static final int INVALIDATED = 0x80000000; - - /* Masks for mPrivateFlags2 */ + static final int PFLAG_INVALIDATED = 0x80000000; + + /** + * Masks for mPrivateFlags2, as generated by dumpFlags(): + * + * -------|-------|-------|-------| + * PFLAG2_TEXT_ALIGNMENT_FLAGS[0] + * PFLAG2_TEXT_DIRECTION_FLAGS[0] + * 1 PFLAG2_DRAG_CAN_ACCEPT + * 1 PFLAG2_DRAG_HOVERED + * 1 PFLAG2_LAYOUT_DIRECTION_MASK_SHIFT + * 11 PFLAG2_TEXT_DIRECTION_MASK_SHIFT + * 1 1 PFLAG2_TEXT_DIRECTION_RESOLVED_MASK_SHIFT + * 11 PFLAG2_LAYOUT_DIRECTION_MASK + * 11 1 PFLAG2_TEXT_ALIGNMENT_MASK_SHIFT + * 1 PFLAG2_LAYOUT_DIRECTION_RESOLVED_RTL + * 1 1 PFLAG2_TEXT_ALIGNMENT_RESOLVED_MASK_SHIFT + * 1 1 PFLAG2_IMPORTANT_FOR_ACCESSIBILITY_SHIFT + * 1 PFLAG2_LAYOUT_DIRECTION_RESOLVED + * 11 PFLAG2_LAYOUT_DIRECTION_RESOLVED_MASK + * 1 PFLAG2_TEXT_DIRECTION_FLAGS[1] + * 1 PFLAG2_TEXT_DIRECTION_FLAGS[2] + * 11 PFLAG2_TEXT_DIRECTION_FLAGS[3] + * 1 PFLAG2_TEXT_DIRECTION_FLAGS[4] + * 1 1 PFLAG2_TEXT_DIRECTION_FLAGS[5] + * 111 PFLAG2_TEXT_DIRECTION_MASK + * 1 PFLAG2_TEXT_DIRECTION_RESOLVED + * 1 PFLAG2_TEXT_DIRECTION_RESOLVED_DEFAULT + * 111 PFLAG2_TEXT_DIRECTION_RESOLVED_MASK + * 1 PFLAG2_TEXT_ALIGNMENT_FLAGS[1] + * 1 PFLAG2_TEXT_ALIGNMENT_FLAGS[2] + * 11 PFLAG2_TEXT_ALIGNMENT_FLAGS[3] + * 1 PFLAG2_TEXT_ALIGNMENT_FLAGS[4] + * 1 1 PFLAG2_TEXT_ALIGNMENT_FLAGS[5] + * 11 PFLAG2_TEXT_ALIGNMENT_FLAGS[6] + * 111 PFLAG2_TEXT_ALIGNMENT_MASK + * 1 PFLAG2_TEXT_ALIGNMENT_RESOLVED + * 1 PFLAG2_TEXT_ALIGNMENT_RESOLVED_DEFAULT + * 111 PFLAG2_TEXT_ALIGNMENT_RESOLVED_MASK + * 11 PFLAG2_IMPORTANT_FOR_ACCESSIBILITY_MASK + * 1 PFLAG2_HAS_TRANSIENT_STATE + * 1 PFLAG2_ACCESSIBILITY_FOCUSED + * 1 PFLAG2_ACCESSIBILITY_STATE_CHANGED + * 1 PFLAG2_VIEW_QUICK_REJECTED + * 1 PFLAG2_PADDING_RESOLVED + * -------|-------|-------|-------| + */ /** * Indicates that this view has reported that it can accept the current drag's content. * Cleared when the drag operation concludes. * @hide */ - static final int DRAG_CAN_ACCEPT = 0x00000001; + static final int PFLAG2_DRAG_CAN_ACCEPT = 0x00000001; /** * Indicates that this view is currently directly under the drag location in a @@ -1796,33 +1792,29 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * the drag exits the view, or when the drag operation concludes. * @hide */ - static final int DRAG_HOVERED = 0x00000002; + static final int PFLAG2_DRAG_HOVERED = 0x00000002; /** * Horizontal layout direction of this view is from Left to Right. * Use with {@link #setLayoutDirection}. - * @hide */ public static final int LAYOUT_DIRECTION_LTR = 0; /** * Horizontal layout direction of this view is from Right to Left. * Use with {@link #setLayoutDirection}. - * @hide */ public static final int LAYOUT_DIRECTION_RTL = 1; /** * Horizontal layout direction of this view is inherited from its parent. * Use with {@link #setLayoutDirection}. - * @hide */ public static final int LAYOUT_DIRECTION_INHERIT = 2; /** * Horizontal layout direction of this view is from deduced from the default language * script for the locale. Use with {@link #setLayoutDirection}. - * @hide */ public static final int LAYOUT_DIRECTION_LOCALE = 3; @@ -1830,32 +1822,33 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * Bit shift to get the horizontal layout direction. (bits after DRAG_HOVERED) * @hide */ - static final int LAYOUT_DIRECTION_MASK_SHIFT = 2; + static final int PFLAG2_LAYOUT_DIRECTION_MASK_SHIFT = 2; /** * Mask for use with private flags indicating bits used for horizontal layout direction. * @hide */ - static final int LAYOUT_DIRECTION_MASK = 0x00000003 << LAYOUT_DIRECTION_MASK_SHIFT; + static final int PFLAG2_LAYOUT_DIRECTION_MASK = 0x00000003 << PFLAG2_LAYOUT_DIRECTION_MASK_SHIFT; /** * Indicates whether the view horizontal layout direction has been resolved and drawn to the * right-to-left direction. * @hide */ - static final int LAYOUT_DIRECTION_RESOLVED_RTL = 4 << LAYOUT_DIRECTION_MASK_SHIFT; + static final int PFLAG2_LAYOUT_DIRECTION_RESOLVED_RTL = 4 << PFLAG2_LAYOUT_DIRECTION_MASK_SHIFT; /** * Indicates whether the view horizontal layout direction has been resolved. * @hide */ - static final int LAYOUT_DIRECTION_RESOLVED = 8 << LAYOUT_DIRECTION_MASK_SHIFT; + static final int PFLAG2_LAYOUT_DIRECTION_RESOLVED = 8 << PFLAG2_LAYOUT_DIRECTION_MASK_SHIFT; /** * Mask for use with private flags indicating bits used for resolved horizontal layout direction. * @hide */ - static final int LAYOUT_DIRECTION_RESOLVED_MASK = 0x0000000C << LAYOUT_DIRECTION_MASK_SHIFT; + static final int PFLAG2_LAYOUT_DIRECTION_RESOLVED_MASK = 0x0000000C + << PFLAG2_LAYOUT_DIRECTION_MASK_SHIFT; /* * Array of horizontal layout direction flags for mapping attribute "layoutDirection" to correct @@ -1871,7 +1864,6 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal /** * Default horizontal layout direction. - * @hide */ private static final int LAYOUT_DIRECTION_DEFAULT = LAYOUT_DIRECTION_INHERIT; @@ -1882,12 +1874,10 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * * @hide */ - static final int HAS_TRANSIENT_STATE = 0x00000100; - + static final int PFLAG2_HAS_TRANSIENT_STATE = 0x1 << 22; /** * Text direction is inherited thru {@link ViewGroup} - * @hide */ public static final int TEXT_DIRECTION_INHERIT = 0; @@ -1895,7 +1885,6 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * Text direction is using "first strong algorithm". The first strong directional character * determines the paragraph direction. If there is no strong directional character, the * paragraph direction is the view's resolved layout direction. - * @hide */ public static final int TEXT_DIRECTION_FIRST_STRONG = 1; @@ -1903,89 +1892,86 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * Text direction is using "any-RTL" algorithm. The paragraph direction is RTL if it contains * any strong RTL character, otherwise it is LTR if it contains any strong LTR characters. * If there are neither, the paragraph direction is the view's resolved layout direction. - * @hide */ public static final int TEXT_DIRECTION_ANY_RTL = 2; /** * Text direction is forced to LTR. - * @hide */ public static final int TEXT_DIRECTION_LTR = 3; /** * Text direction is forced to RTL. - * @hide */ public static final int TEXT_DIRECTION_RTL = 4; /** * Text direction is coming from the system Locale. - * @hide */ public static final int TEXT_DIRECTION_LOCALE = 5; /** * Default text direction is inherited - * @hide */ - protected static int TEXT_DIRECTION_DEFAULT = TEXT_DIRECTION_INHERIT; + private static final int TEXT_DIRECTION_DEFAULT = TEXT_DIRECTION_INHERIT; /** * Bit shift to get the horizontal layout direction. (bits after LAYOUT_DIRECTION_RESOLVED) * @hide */ - static final int TEXT_DIRECTION_MASK_SHIFT = 6; + static final int PFLAG2_TEXT_DIRECTION_MASK_SHIFT = 6; /** * Mask for use with private flags indicating bits used for text direction. * @hide */ - static final int TEXT_DIRECTION_MASK = 0x00000007 << TEXT_DIRECTION_MASK_SHIFT; + static final int PFLAG2_TEXT_DIRECTION_MASK = 0x00000007 + << PFLAG2_TEXT_DIRECTION_MASK_SHIFT; /** * Array of text direction flags for mapping attribute "textDirection" to correct * flag value. * @hide */ - private static final int[] TEXT_DIRECTION_FLAGS = { - TEXT_DIRECTION_INHERIT << TEXT_DIRECTION_MASK_SHIFT, - TEXT_DIRECTION_FIRST_STRONG << TEXT_DIRECTION_MASK_SHIFT, - TEXT_DIRECTION_ANY_RTL << TEXT_DIRECTION_MASK_SHIFT, - TEXT_DIRECTION_LTR << TEXT_DIRECTION_MASK_SHIFT, - TEXT_DIRECTION_RTL << TEXT_DIRECTION_MASK_SHIFT, - TEXT_DIRECTION_LOCALE << TEXT_DIRECTION_MASK_SHIFT + private static final int[] PFLAG2_TEXT_DIRECTION_FLAGS = { + TEXT_DIRECTION_INHERIT << PFLAG2_TEXT_DIRECTION_MASK_SHIFT, + TEXT_DIRECTION_FIRST_STRONG << PFLAG2_TEXT_DIRECTION_MASK_SHIFT, + TEXT_DIRECTION_ANY_RTL << PFLAG2_TEXT_DIRECTION_MASK_SHIFT, + TEXT_DIRECTION_LTR << PFLAG2_TEXT_DIRECTION_MASK_SHIFT, + TEXT_DIRECTION_RTL << PFLAG2_TEXT_DIRECTION_MASK_SHIFT, + TEXT_DIRECTION_LOCALE << PFLAG2_TEXT_DIRECTION_MASK_SHIFT }; /** * Indicates whether the view text direction has been resolved. * @hide */ - static final int TEXT_DIRECTION_RESOLVED = 0x00000008 << TEXT_DIRECTION_MASK_SHIFT; + static final int PFLAG2_TEXT_DIRECTION_RESOLVED = 0x00000008 + << PFLAG2_TEXT_DIRECTION_MASK_SHIFT; /** * Bit shift to get the horizontal layout direction. (bits after DRAG_HOVERED) * @hide */ - static final int TEXT_DIRECTION_RESOLVED_MASK_SHIFT = 10; + static final int PFLAG2_TEXT_DIRECTION_RESOLVED_MASK_SHIFT = 10; /** * Mask for use with private flags indicating bits used for resolved text direction. * @hide */ - static final int TEXT_DIRECTION_RESOLVED_MASK = 0x00000007 << TEXT_DIRECTION_RESOLVED_MASK_SHIFT; + static final int PFLAG2_TEXT_DIRECTION_RESOLVED_MASK = 0x00000007 + << PFLAG2_TEXT_DIRECTION_RESOLVED_MASK_SHIFT; /** * Indicates whether the view text direction has been resolved to the "first strong" heuristic. * @hide */ - static final int TEXT_DIRECTION_RESOLVED_DEFAULT = - TEXT_DIRECTION_FIRST_STRONG << TEXT_DIRECTION_RESOLVED_MASK_SHIFT; + static final int PFLAG2_TEXT_DIRECTION_RESOLVED_DEFAULT = + TEXT_DIRECTION_FIRST_STRONG << PFLAG2_TEXT_DIRECTION_RESOLVED_MASK_SHIFT; /* * Default text alignment. The text alignment of this View is inherited from its parent. * Use with {@link #setTextAlignment(int)} - * @hide */ public static final int TEXT_ALIGNMENT_INHERIT = 0; @@ -1994,7 +1980,6 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * ALIGN_CENTER, or ALIGN_OPPOSITE, which are relative to each paragraph’s text direction. * * Use with {@link #setTextAlignment(int)} - * @hide */ public static final int TEXT_ALIGNMENT_GRAVITY = 1; @@ -2002,7 +1987,6 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * Align to the start of the paragraph, e.g. ALIGN_NORMAL. * * Use with {@link #setTextAlignment(int)} - * @hide */ public static final int TEXT_ALIGNMENT_TEXT_START = 2; @@ -2010,7 +1994,6 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * Align to the end of the paragraph, e.g. ALIGN_OPPOSITE. * * Use with {@link #setTextAlignment(int)} - * @hide */ public static final int TEXT_ALIGNMENT_TEXT_END = 3; @@ -2018,7 +2001,6 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * Center the paragraph, e.g. ALIGN_CENTER. * * Use with {@link #setTextAlignment(int)} - * @hide */ public static final int TEXT_ALIGNMENT_CENTER = 4; @@ -2027,7 +2009,6 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * layoutDirection is LTR, and ALIGN_RIGHT otherwise. * * Use with {@link #setTextAlignment(int)} - * @hide */ public static final int TEXT_ALIGNMENT_VIEW_START = 5; @@ -2036,66 +2017,65 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * layoutDirection is LTR, and ALIGN_LEFT otherwise. * * Use with {@link #setTextAlignment(int)} - * @hide */ public static final int TEXT_ALIGNMENT_VIEW_END = 6; /** * Default text alignment is inherited - * @hide */ - protected static int TEXT_ALIGNMENT_DEFAULT = TEXT_ALIGNMENT_GRAVITY; + private static final int TEXT_ALIGNMENT_DEFAULT = TEXT_ALIGNMENT_GRAVITY; /** * Bit shift to get the horizontal layout direction. (bits after DRAG_HOVERED) * @hide */ - static final int TEXT_ALIGNMENT_MASK_SHIFT = 13; + static final int PFLAG2_TEXT_ALIGNMENT_MASK_SHIFT = 13; /** * Mask for use with private flags indicating bits used for text alignment. * @hide */ - static final int TEXT_ALIGNMENT_MASK = 0x00000007 << TEXT_ALIGNMENT_MASK_SHIFT; + static final int PFLAG2_TEXT_ALIGNMENT_MASK = 0x00000007 << PFLAG2_TEXT_ALIGNMENT_MASK_SHIFT; /** * Array of text direction flags for mapping attribute "textAlignment" to correct * flag value. * @hide */ - private static final int[] TEXT_ALIGNMENT_FLAGS = { - TEXT_ALIGNMENT_INHERIT << TEXT_ALIGNMENT_MASK_SHIFT, - TEXT_ALIGNMENT_GRAVITY << TEXT_ALIGNMENT_MASK_SHIFT, - TEXT_ALIGNMENT_TEXT_START << TEXT_ALIGNMENT_MASK_SHIFT, - TEXT_ALIGNMENT_TEXT_END << TEXT_ALIGNMENT_MASK_SHIFT, - TEXT_ALIGNMENT_CENTER << TEXT_ALIGNMENT_MASK_SHIFT, - TEXT_ALIGNMENT_VIEW_START << TEXT_ALIGNMENT_MASK_SHIFT, - TEXT_ALIGNMENT_VIEW_END << TEXT_ALIGNMENT_MASK_SHIFT + private static final int[] PFLAG2_TEXT_ALIGNMENT_FLAGS = { + TEXT_ALIGNMENT_INHERIT << PFLAG2_TEXT_ALIGNMENT_MASK_SHIFT, + TEXT_ALIGNMENT_GRAVITY << PFLAG2_TEXT_ALIGNMENT_MASK_SHIFT, + TEXT_ALIGNMENT_TEXT_START << PFLAG2_TEXT_ALIGNMENT_MASK_SHIFT, + TEXT_ALIGNMENT_TEXT_END << PFLAG2_TEXT_ALIGNMENT_MASK_SHIFT, + TEXT_ALIGNMENT_CENTER << PFLAG2_TEXT_ALIGNMENT_MASK_SHIFT, + TEXT_ALIGNMENT_VIEW_START << PFLAG2_TEXT_ALIGNMENT_MASK_SHIFT, + TEXT_ALIGNMENT_VIEW_END << PFLAG2_TEXT_ALIGNMENT_MASK_SHIFT }; /** * Indicates whether the view text alignment has been resolved. * @hide */ - static final int TEXT_ALIGNMENT_RESOLVED = 0x00000008 << TEXT_ALIGNMENT_MASK_SHIFT; + static final int PFLAG2_TEXT_ALIGNMENT_RESOLVED = 0x00000008 << PFLAG2_TEXT_ALIGNMENT_MASK_SHIFT; /** * Bit shift to get the resolved text alignment. * @hide */ - static final int TEXT_ALIGNMENT_RESOLVED_MASK_SHIFT = 17; + static final int PFLAG2_TEXT_ALIGNMENT_RESOLVED_MASK_SHIFT = 17; /** * Mask for use with private flags indicating bits used for text alignment. * @hide */ - static final int TEXT_ALIGNMENT_RESOLVED_MASK = 0x00000007 << TEXT_ALIGNMENT_RESOLVED_MASK_SHIFT; + static final int PFLAG2_TEXT_ALIGNMENT_RESOLVED_MASK = 0x00000007 + << PFLAG2_TEXT_ALIGNMENT_RESOLVED_MASK_SHIFT; /** * Indicates whether if the view text alignment has been resolved to gravity */ - public static final int TEXT_ALIGNMENT_RESOLVED_DEFAULT = - TEXT_ALIGNMENT_GRAVITY << TEXT_ALIGNMENT_RESOLVED_MASK_SHIFT; + private static final int PFLAG2_TEXT_ALIGNMENT_RESOLVED_DEFAULT = + TEXT_ALIGNMENT_GRAVITY << PFLAG2_TEXT_ALIGNMENT_RESOLVED_MASK_SHIFT; // Accessiblity constants for mPrivateFlags2 @@ -2103,7 +2083,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * Shift for the bits in {@link #mPrivateFlags2} related to the * "importantForAccessibility" attribute. */ - static final int IMPORTANT_FOR_ACCESSIBILITY_SHIFT = 20; + static final int PFLAG2_IMPORTANT_FOR_ACCESSIBILITY_SHIFT = 20; /** * Automatically determine whether a view is important for accessibility. @@ -2121,7 +2101,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal public static final int IMPORTANT_FOR_ACCESSIBILITY_NO = 0x00000002; /** - * The default whether the view is important for accessiblity. + * The default whether the view is important for accessibility. */ static final int IMPORTANT_FOR_ACCESSIBILITY_DEFAULT = IMPORTANT_FOR_ACCESSIBILITY_AUTO; @@ -2129,92 +2109,52 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * Mask for obtainig the bits which specify how to determine * whether a view is important for accessibility. */ - static final int IMPORTANT_FOR_ACCESSIBILITY_MASK = (IMPORTANT_FOR_ACCESSIBILITY_AUTO + static final int PFLAG2_IMPORTANT_FOR_ACCESSIBILITY_MASK = (IMPORTANT_FOR_ACCESSIBILITY_AUTO | IMPORTANT_FOR_ACCESSIBILITY_YES | IMPORTANT_FOR_ACCESSIBILITY_NO) - << IMPORTANT_FOR_ACCESSIBILITY_SHIFT; + << PFLAG2_IMPORTANT_FOR_ACCESSIBILITY_SHIFT; /** * Flag indicating whether a view has accessibility focus. */ - static final int ACCESSIBILITY_FOCUSED = 0x00000040 << IMPORTANT_FOR_ACCESSIBILITY_SHIFT; + static final int PFLAG2_ACCESSIBILITY_FOCUSED = 0x00000040 << PFLAG2_IMPORTANT_FOR_ACCESSIBILITY_SHIFT; /** * Flag indicating whether a view state for accessibility has changed. */ - static final int ACCESSIBILITY_STATE_CHANGED = 0x00000080 << IMPORTANT_FOR_ACCESSIBILITY_SHIFT; + static final int PFLAG2_ACCESSIBILITY_STATE_CHANGED = 0x00000080 + << PFLAG2_IMPORTANT_FOR_ACCESSIBILITY_SHIFT; /** * Flag indicating whether a view failed the quickReject() check in draw(). This condition * is used to check whether later changes to the view's transform should invalidate the * view to force the quickReject test to run again. */ - static final int VIEW_QUICK_REJECTED = 0x10000000; - - // Accessiblity constants for mPrivateFlags2 + static final int PFLAG2_VIEW_QUICK_REJECTED = 0x10000000; /** - * Shift for the bits in {@link #mPrivateFlags2} related to the - * "accessibilityFocusable" attribute. - */ - static final int ACCESSIBILITY_FOCUSABLE_SHIFT = 29; - - /** - * The system determines whether the view can take accessibility focus - default (recommended). - *

          - * Such a view is consideted by the focus search if it is: - *

            - *
          • - * Important for accessibility and actionable (clickable, long clickable, focusable) - *
          • - *
          • - * Important for accessibility, not actionable (clickable, long clickable, focusable), - * and does not have an actionable predecessor. - *
          • - *
          - * An accessibility srvice can request putting accessibility focus on such a view. - *

          - * - * @hide + * Flag indicating that start/end padding has been resolved into left/right padding + * for use in measurement, layout, drawing, etc. This is set by {@link #resolvePadding()} + * and checked by {@link #measure(int, int)} to determine if padding needs to be resolved + * during measurement. In some special cases this is required such as when an adapter-based + * view measures prospective children without attaching them to a window. */ - public static final int ACCESSIBILITY_FOCUSABLE_AUTO = 0x00000000; + static final int PFLAG2_PADDING_RESOLVED = 0x20000000; /** - * The view can take accessibility focus. - *

          - * A view that can take accessibility focus is always considered during focus - * search and an accessibility service can request putting accessibility focus - * on it. - *

          - * - * @hide + * Flag indicating that the start/end drawables has been resolved into left/right ones. */ - public static final int ACCESSIBILITY_FOCUSABLE_YES = 0x00000001; + static final int PFLAG2_DRAWABLE_RESOLVED = 0x40000000; /** - * The view can not take accessibility focus. - *

          - * A view that can not take accessibility focus is never considered during focus - * search and an accessibility service can not request putting accessibility focus - * on it. - *

          - * - * @hide + * Group of bits indicating that RTL properties resolution is done. */ - public static final int ACCESSIBILITY_FOCUSABLE_NO = 0x00000002; - - /** - * The default whether the view is accessiblity focusable. - */ - static final int ACCESSIBILITY_FOCUSABLE_DEFAULT = ACCESSIBILITY_FOCUSABLE_AUTO; - - /** - * Mask for obtainig the bits which specifies how to determine - * whether a view is accessibility focusable. - */ - static final int ACCESSIBILITY_FOCUSABLE_MASK = (ACCESSIBILITY_FOCUSABLE_AUTO - | ACCESSIBILITY_FOCUSABLE_YES | ACCESSIBILITY_FOCUSABLE_NO) - << ACCESSIBILITY_FOCUSABLE_SHIFT; + static final int ALL_RTL_PROPERTIES_RESOLVED = PFLAG2_LAYOUT_DIRECTION_RESOLVED | + PFLAG2_TEXT_DIRECTION_RESOLVED | + PFLAG2_TEXT_ALIGNMENT_RESOLVED | + PFLAG2_PADDING_RESOLVED | + PFLAG2_DRAWABLE_RESOLVED; + // There are a couple of flags left in mPrivateFlags2 /* End of masks for mPrivateFlags2 */ @@ -2225,19 +2165,19 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * an animation is cleared between successive frames, in order to tell the associated * DisplayList to clear its animation matrix. */ - static final int VIEW_IS_ANIMATING_TRANSFORM = 0x1; + static final int PFLAG3_VIEW_IS_ANIMATING_TRANSFORM = 0x1; /** * Flag indicating that view has an alpha animation set on it. This is used to track whether an * animation is cleared between successive frames, in order to tell the associated * DisplayList to restore its alpha value. */ - static final int VIEW_IS_ANIMATING_ALPHA = 0x2; + static final int PFLAG3_VIEW_IS_ANIMATING_ALPHA = 0x2; /* End of masks for mPrivateFlags3 */ - static final int DRAG_MASK = DRAG_CAN_ACCEPT | DRAG_HOVERED; + static final int DRAG_MASK = PFLAG2_DRAG_CAN_ACCEPT | PFLAG2_DRAG_HOVERED; /** * Always allow a user to over-scroll this view, provided it is a @@ -2509,6 +2449,17 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal */ public static final int STATUS_BAR_DISABLE_RECENT = 0x01000000; + /** + * @hide + * + * NOTE: This flag may only be used in subtreeSystemUiVisibility. It is masked + * out of the public fields to keep the undefined bits out of the developer's way. + * + * Flag to disable the global search gesture. Don't use this + * unless you're a special part of the system UI (i.e., setup wizard, keyguard). + */ + public static final int STATUS_BAR_DISABLE_SEARCH = 0x02000000; + /** * @hide */ @@ -2604,16 +2555,16 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * {@hide} */ @ViewDebug.ExportedProperty(flagMapping = { - @ViewDebug.FlagToString(mask = FORCE_LAYOUT, equals = FORCE_LAYOUT, + @ViewDebug.FlagToString(mask = PFLAG_FORCE_LAYOUT, equals = PFLAG_FORCE_LAYOUT, name = "FORCE_LAYOUT"), - @ViewDebug.FlagToString(mask = LAYOUT_REQUIRED, equals = LAYOUT_REQUIRED, + @ViewDebug.FlagToString(mask = PFLAG_LAYOUT_REQUIRED, equals = PFLAG_LAYOUT_REQUIRED, name = "LAYOUT_REQUIRED"), - @ViewDebug.FlagToString(mask = DRAWING_CACHE_VALID, equals = DRAWING_CACHE_VALID, + @ViewDebug.FlagToString(mask = PFLAG_DRAWING_CACHE_VALID, equals = PFLAG_DRAWING_CACHE_VALID, name = "DRAWING_CACHE_INVALID", outputIf = false), - @ViewDebug.FlagToString(mask = DRAWN, equals = DRAWN, name = "DRAWN", outputIf = true), - @ViewDebug.FlagToString(mask = DRAWN, equals = DRAWN, name = "NOT_DRAWN", outputIf = false), - @ViewDebug.FlagToString(mask = DIRTY_MASK, equals = DIRTY_OPAQUE, name = "DIRTY_OPAQUE"), - @ViewDebug.FlagToString(mask = DIRTY_MASK, equals = DIRTY, name = "DIRTY") + @ViewDebug.FlagToString(mask = PFLAG_DRAWN, equals = PFLAG_DRAWN, name = "DRAWN", outputIf = true), + @ViewDebug.FlagToString(mask = PFLAG_DRAWN, equals = PFLAG_DRAWN, name = "NOT_DRAWN", outputIf = false), + @ViewDebug.FlagToString(mask = PFLAG_DIRTY_MASK, equals = PFLAG_DIRTY_OPAQUE, name = "DIRTY_OPAQUE"), + @ViewDebug.FlagToString(mask = PFLAG_DIRTY_MASK, equals = PFLAG_DIRTY, name = "DIRTY") }) int mPrivateFlags; int mPrivateFlags2; @@ -2846,14 +2797,14 @@ static class TransformationInfo { * {@hide} */ @ViewDebug.ExportedProperty(category = "padding") - protected int mPaddingLeft; + protected int mPaddingLeft = 0; /** * The right padding in pixels, that is the distance in pixels between the * right edge of this view and the right edge of its content. * {@hide} */ @ViewDebug.ExportedProperty(category = "padding") - protected int mPaddingRight; + protected int mPaddingRight = 0; /** * The top padding in pixels, that is the distance in pixels between the * top edge of this view and the top edge of its content. @@ -2880,6 +2831,23 @@ static class TransformationInfo { */ private CharSequence mContentDescription; + /** + * Specifies the id of a view for which this view serves as a label for + * accessibility purposes. + */ + private int mLabelForId = View.NO_ID; + + /** + * Predicate for matching labeled view id with its label for + * accessibility purposes. + */ + private MatchLabelForPredicate mMatchLabelForPredicate; + + /** + * Predicate for matching a view by its id. + */ + private MatchIdPredicate mMatchIdPredicate; + /** * Cache the paddingRight set by the user to append to the scrollbar's size. * @@ -2904,13 +2872,6 @@ static class TransformationInfo { @ViewDebug.ExportedProperty(category = "padding") protected int mUserPaddingLeft; - /** - * Cache if the user padding is relative. - * - */ - @ViewDebug.ExportedProperty(category = "padding") - boolean mUserPaddingRelative; - /** * Cache the paddingStart set by the user to append to the scrollbar's size. * @@ -2925,6 +2886,25 @@ static class TransformationInfo { @ViewDebug.ExportedProperty(category = "padding") int mUserPaddingEnd; + /** + * Cache initial left padding. + * + * @hide + */ + int mUserPaddingLeftInitial = 0; + + /** + * Cache initial right padding. + * + * @hide + */ + int mUserPaddingRightInitial = 0; + + /** + * Default undefined padding + */ + private static final int UNDEFINED_PADDING = Integer.MIN_VALUE; + /** * @hide */ @@ -2934,6 +2914,7 @@ static class TransformationInfo { */ int mOldHeightMeasureSpec = Integer.MIN_VALUE; + @ViewDebug.ExportedProperty(deepExport = true, prefix = "bg_") private Drawable mBackground; private int mBackgroundResource; @@ -3217,6 +3198,21 @@ static class ListenerInfo { */ private boolean mSendingHoverAccessibilityEvents; + /** + * Delegate for injecting accessibility functionality. + */ + AccessibilityDelegate mAccessibilityDelegate; + + /** + * Consistency verifier for debugging purposes. + * @hide + */ + protected final InputEventConsistencyVerifier mInputEventConsistencyVerifier = + InputEventConsistencyVerifier.isInstrumentationEnabled() ? + new InputEventConsistencyVerifier(this, 0) : null; + + private static final AtomicInteger sNextGeneratedId = new AtomicInteger(1); + /** * Simple constructor to use when creating a view from code. * @@ -3227,32 +3223,20 @@ public View(Context context) { mContext = context; mResources = context != null ? context.getResources() : null; mViewFlags = SOUND_EFFECTS_ENABLED | HAPTIC_FEEDBACK_ENABLED; - // Set layout and text direction defaults - mPrivateFlags2 = (LAYOUT_DIRECTION_DEFAULT << LAYOUT_DIRECTION_MASK_SHIFT) | - (TEXT_DIRECTION_DEFAULT << TEXT_DIRECTION_MASK_SHIFT) | - (TEXT_ALIGNMENT_DEFAULT << TEXT_ALIGNMENT_MASK_SHIFT) | - (IMPORTANT_FOR_ACCESSIBILITY_DEFAULT << IMPORTANT_FOR_ACCESSIBILITY_SHIFT) | - (ACCESSIBILITY_FOCUSABLE_DEFAULT << ACCESSIBILITY_FOCUSABLE_SHIFT); + // Set some flags defaults + mPrivateFlags2 = + (LAYOUT_DIRECTION_DEFAULT << PFLAG2_LAYOUT_DIRECTION_MASK_SHIFT) | + (TEXT_DIRECTION_DEFAULT << PFLAG2_TEXT_DIRECTION_MASK_SHIFT) | + (PFLAG2_TEXT_DIRECTION_RESOLVED_DEFAULT) | + (TEXT_ALIGNMENT_DEFAULT << PFLAG2_TEXT_ALIGNMENT_MASK_SHIFT) | + (PFLAG2_TEXT_ALIGNMENT_RESOLVED_DEFAULT) | + (IMPORTANT_FOR_ACCESSIBILITY_DEFAULT << PFLAG2_IMPORTANT_FOR_ACCESSIBILITY_SHIFT); mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop(); setOverScrollMode(OVER_SCROLL_IF_CONTENT_SCROLLS); - mUserPaddingStart = -1; - mUserPaddingEnd = -1; - mUserPaddingRelative = false; + mUserPaddingStart = UNDEFINED_PADDING; + mUserPaddingEnd = UNDEFINED_PADDING; } - /** - * Delegate for injecting accessiblity functionality. - */ - AccessibilityDelegate mAccessibilityDelegate; - - /** - * Consistency verifier for debugging purposes. - * @hide - */ - protected final InputEventConsistencyVerifier mInputEventConsistencyVerifier = - InputEventConsistencyVerifier.isInstrumentationEnabled() ? - new InputEventConsistencyVerifier(this, 0) : null; - /** * Constructor that is called when inflating a view from XML. This is called * when a view is being constructed from an XML file, supplying attributes @@ -3303,8 +3287,8 @@ public View(Context context, AttributeSet attrs, int defStyle) { int topPadding = -1; int rightPadding = -1; int bottomPadding = -1; - int startPadding = -1; - int endPadding = -1; + int startPadding = UNDEFINED_PADDING; + int endPadding = UNDEFINED_PADDING; int padding = -1; @@ -3326,8 +3310,16 @@ public View(Context context, AttributeSet attrs, int defStyle) { boolean transformSet = false; int scrollbarStyle = SCROLLBARS_INSIDE_OVERLAY; - int overScrollMode = mOverScrollMode; + boolean initializeScrollbars = false; + + boolean leftPaddingDefined = false; + boolean rightPaddingDefined = false; + boolean startPaddingDefined = false; + boolean endPaddingDefined = false; + + final int targetSdkVersion = context.getApplicationInfo().targetSdkVersion; + final int N = a.getIndexCount(); for (int i = 0; i < N; i++) { int attr = a.getIndex(i); @@ -3337,24 +3329,34 @@ public View(Context context, AttributeSet attrs, int defStyle) { break; case com.android.internal.R.styleable.View_padding: padding = a.getDimensionPixelSize(attr, -1); + mUserPaddingLeftInitial = padding; + mUserPaddingRightInitial = padding; + leftPaddingDefined = true; + rightPaddingDefined = true; break; case com.android.internal.R.styleable.View_paddingLeft: leftPadding = a.getDimensionPixelSize(attr, -1); + mUserPaddingLeftInitial = leftPadding; + leftPaddingDefined = true; break; case com.android.internal.R.styleable.View_paddingTop: topPadding = a.getDimensionPixelSize(attr, -1); break; case com.android.internal.R.styleable.View_paddingRight: rightPadding = a.getDimensionPixelSize(attr, -1); + mUserPaddingRightInitial = rightPadding; + rightPaddingDefined = true; break; case com.android.internal.R.styleable.View_paddingBottom: bottomPadding = a.getDimensionPixelSize(attr, -1); break; case com.android.internal.R.styleable.View_paddingStart: - startPadding = a.getDimensionPixelSize(attr, -1); + startPadding = a.getDimensionPixelSize(attr, UNDEFINED_PADDING); + startPaddingDefined = true; break; case com.android.internal.R.styleable.View_paddingEnd: - endPadding = a.getDimensionPixelSize(attr, -1); + endPadding = a.getDimensionPixelSize(attr, UNDEFINED_PADDING); + endPaddingDefined = true; break; case com.android.internal.R.styleable.View_scrollX: x = a.getDimensionPixelOffset(attr, 0); @@ -3456,12 +3458,13 @@ public View(Context context, AttributeSet attrs, int defStyle) { break; case com.android.internal.R.styleable.View_layoutDirection: // Clear any layout direction flags (included resolved bits) already set - mPrivateFlags2 &= ~(LAYOUT_DIRECTION_MASK | LAYOUT_DIRECTION_RESOLVED_MASK); + mPrivateFlags2 &= + ~(PFLAG2_LAYOUT_DIRECTION_MASK | PFLAG2_LAYOUT_DIRECTION_RESOLVED_MASK); // Set the layout direction flags depending on the value of the attribute final int layoutDirection = a.getInt(attr, -1); final int value = (layoutDirection != -1) ? LAYOUT_DIRECTION_FLAGS[layoutDirection] : LAYOUT_DIRECTION_DEFAULT; - mPrivateFlags2 |= (value << LAYOUT_DIRECTION_MASK_SHIFT); + mPrivateFlags2 |= (value << PFLAG2_LAYOUT_DIRECTION_MASK_SHIFT); break; case com.android.internal.R.styleable.View_drawingCacheQuality: final int cacheQuality = a.getInt(attr, 0); @@ -3473,6 +3476,9 @@ public View(Context context, AttributeSet attrs, int defStyle) { case com.android.internal.R.styleable.View_contentDescription: setContentDescription(a.getString(attr)); break; + case com.android.internal.R.styleable.View_labelFor: + setLabelFor(a.getResourceId(attr, NO_ID)); + break; case com.android.internal.R.styleable.View_soundEffectsEnabled: if (!a.getBoolean(attr, true)) { viewFlagValues &= ~SOUND_EFFECTS_ENABLED; @@ -3490,12 +3496,12 @@ public View(Context context, AttributeSet attrs, int defStyle) { if (scrollbars != SCROLLBARS_NONE) { viewFlagValues |= scrollbars; viewFlagMasks |= SCROLLBARS_MASK; - initializeScrollbars(a); + initializeScrollbars = true; } break; //noinspection deprecation case R.styleable.View_fadingEdge: - if (context.getApplicationInfo().targetSdkVersion >= ICE_CREAM_SANDWICH) { + if (targetSdkVersion >= ICE_CREAM_SANDWICH) { // Ignore the attribute starting with ICS break; } @@ -3606,19 +3612,19 @@ public void onClick(View v) { break; case R.styleable.View_textDirection: // Clear any text direction flag already set - mPrivateFlags2 &= ~TEXT_DIRECTION_MASK; + mPrivateFlags2 &= ~PFLAG2_TEXT_DIRECTION_MASK; // Set the text direction flags depending on the value of the attribute final int textDirection = a.getInt(attr, -1); if (textDirection != -1) { - mPrivateFlags2 |= TEXT_DIRECTION_FLAGS[textDirection]; + mPrivateFlags2 |= PFLAG2_TEXT_DIRECTION_FLAGS[textDirection]; } break; case R.styleable.View_textAlignment: // Clear any text alignment flag already set - mPrivateFlags2 &= ~TEXT_ALIGNMENT_MASK; + mPrivateFlags2 &= ~PFLAG2_TEXT_ALIGNMENT_MASK; // Set the text alignment flag depending on the value of the attribute final int textAlignment = a.getInt(attr, TEXT_ALIGNMENT_DEFAULT); - mPrivateFlags2 |= TEXT_ALIGNMENT_FLAGS[textAlignment]; + mPrivateFlags2 |= PFLAG2_TEXT_ALIGNMENT_FLAGS[textAlignment]; break; case R.styleable.View_importantForAccessibility: setImportantForAccessibility(a.getInt(attr, @@ -3627,41 +3633,73 @@ public void onClick(View v) { } } - a.recycle(); - setOverScrollMode(overScrollMode); - if (background != null) { - setBackground(background); - } - - // Cache user padding as we cannot fully resolve padding here (we dont have yet the resolved - // layout direction). Those cached values will be used later during padding resolution. + // Cache start/end user padding as we cannot fully resolve padding here (we dont have yet + // the resolved layout direction). Those cached values will be used later during padding + // resolution. mUserPaddingStart = startPadding; mUserPaddingEnd = endPadding; - updateUserPaddingRelative(); + if (background != null) { + setBackground(background); + } if (padding >= 0) { leftPadding = padding; topPadding = padding; rightPadding = padding; bottomPadding = padding; + mUserPaddingLeftInitial = padding; + mUserPaddingRightInitial = padding; + } + + if (isRtlCompatibilityMode()) { + // RTL compatibility mode: pre Jelly Bean MR1 case OR no RTL support case. + // left / right padding are used if defined (meaning here nothing to do). If they are not + // defined and start / end padding are defined (e.g. in Frameworks resources), then we use + // start / end and resolve them as left / right (layout direction is not taken into account). + // Padding from the background drawable is stored at this point in mUserPaddingLeftInitial + // and mUserPaddingRightInitial) so drawable padding will be used as ultimate default if + // defined. + if (!leftPaddingDefined && startPaddingDefined) { + leftPadding = startPadding; + } + mUserPaddingLeftInitial = (leftPadding >= 0) ? leftPadding : mUserPaddingLeftInitial; + if (!rightPaddingDefined && endPaddingDefined) { + rightPadding = endPadding; + } + mUserPaddingRightInitial = (rightPadding >= 0) ? rightPadding : mUserPaddingRightInitial; + } else { + // Jelly Bean MR1 and after case: if start/end defined, they will override any left/right + // values defined. Otherwise, left /right values are used. + // Padding from the background drawable is stored at this point in mUserPaddingLeftInitial + // and mUserPaddingRightInitial) so drawable padding will be used as ultimate default if + // defined. + if (leftPaddingDefined) { + mUserPaddingLeftInitial = leftPadding; + } + if (rightPaddingDefined) { + mUserPaddingRightInitial = rightPadding; + } } - // If the user specified the padding (either with android:padding or - // android:paddingLeft/Top/Right/Bottom), use this padding, otherwise - // use the default padding or the padding from the background drawable - // (stored at this point in mPadding*) - setPadding(leftPadding >= 0 ? leftPadding : mPaddingLeft, + internalSetPadding( + mUserPaddingLeftInitial, topPadding >= 0 ? topPadding : mPaddingTop, - rightPadding >= 0 ? rightPadding : mPaddingRight, + mUserPaddingRightInitial, bottomPadding >= 0 ? bottomPadding : mPaddingBottom); if (viewFlagMasks != 0) { setFlags(viewFlagValues, viewFlagMasks); } + if (initializeScrollbars) { + initializeScrollbars(a); + } + + a.recycle(); + // Needs to be called after mViewFlags is set if (scrollbarStyle != SCROLLBARS_INSIDE_OVERLAY) { recomputePadding(); @@ -3688,10 +3726,6 @@ public void onClick(View v) { computeOpaqueFlags(); } - private void updateUserPaddingRelative() { - mUserPaddingRelative = (mUserPaddingStart >= 0 || mUserPaddingEnd >= 0); - } - /** * Non-public constructor for use in testing */ @@ -3699,6 +3733,81 @@ private void updateUserPaddingRelative() { mResources = null; } + public String toString() { + StringBuilder out = new StringBuilder(128); + out.append(getClass().getName()); + out.append('{'); + out.append(Integer.toHexString(System.identityHashCode(this))); + out.append(' '); + switch (mViewFlags&VISIBILITY_MASK) { + case VISIBLE: out.append('V'); break; + case INVISIBLE: out.append('I'); break; + case GONE: out.append('G'); break; + default: out.append('.'); break; + } + out.append((mViewFlags&FOCUSABLE_MASK) == FOCUSABLE ? 'F' : '.'); + out.append((mViewFlags&ENABLED_MASK) == ENABLED ? 'E' : '.'); + out.append((mViewFlags&DRAW_MASK) == WILL_NOT_DRAW ? '.' : 'D'); + out.append((mViewFlags&SCROLLBARS_HORIZONTAL) != 0 ? 'H' : '.'); + out.append((mViewFlags&SCROLLBARS_VERTICAL) != 0 ? 'V' : '.'); + out.append((mViewFlags&CLICKABLE) != 0 ? 'C' : '.'); + out.append((mViewFlags&LONG_CLICKABLE) != 0 ? 'L' : '.'); + out.append(' '); + out.append((mPrivateFlags&PFLAG_IS_ROOT_NAMESPACE) != 0 ? 'R' : '.'); + out.append((mPrivateFlags&PFLAG_FOCUSED) != 0 ? 'F' : '.'); + out.append((mPrivateFlags&PFLAG_SELECTED) != 0 ? 'S' : '.'); + if ((mPrivateFlags&PFLAG_PREPRESSED) != 0) { + out.append('p'); + } else { + out.append((mPrivateFlags&PFLAG_PRESSED) != 0 ? 'P' : '.'); + } + out.append((mPrivateFlags&PFLAG_HOVERED) != 0 ? 'H' : '.'); + out.append((mPrivateFlags&PFLAG_ACTIVATED) != 0 ? 'A' : '.'); + out.append((mPrivateFlags&PFLAG_INVALIDATED) != 0 ? 'I' : '.'); + out.append((mPrivateFlags&PFLAG_DIRTY_MASK) != 0 ? 'D' : '.'); + out.append(' '); + out.append(mLeft); + out.append(','); + out.append(mTop); + out.append('-'); + out.append(mRight); + out.append(','); + out.append(mBottom); + final int id = getId(); + if (id != NO_ID) { + out.append(" #"); + out.append(Integer.toHexString(id)); + final Resources r = mResources; + if (id != 0 && r != null) { + try { + String pkgname; + switch (id&0xff000000) { + case 0x7f000000: + pkgname="app"; + break; + case 0x01000000: + pkgname="android"; + break; + default: + pkgname = r.getResourcePackageName(id); + break; + } + String typename = r.getResourceTypeName(id); + String entryname = r.getResourceEntryName(id); + out.append(" "); + out.append(pkgname); + out.append(":"); + out.append(typename); + out.append("/"); + out.append(entryname); + } catch (Resources.NotFoundException e) { + } + } + } + out.append("}"); + return out.toString(); + } + /** *

          * Initializes the fading edges from a given set of styled attributes. This @@ -3881,6 +3990,15 @@ protected void initializeScrollbars(TypedArray a) { scrollabilityCache.scrollBar.setAlwaysDrawVerticalTrack(true); } + // Apply layout direction to the new Drawables if needed + final int layoutDirection = getLayoutDirection(); + if (track != null) { + track.setLayoutDirection(layoutDirection); + } + if (thumb != null) { + thumb.setLayoutDirection(layoutDirection); + } + // Re-apply user/background padding so that scrollbar(s) get added resolvePadding(); } @@ -4247,8 +4365,8 @@ void handleFocusGainInternal(int direction, Rect previouslyFocusedRect) { System.out.println(this + " requestFocus()"); } - if ((mPrivateFlags & FOCUSED) == 0) { - mPrivateFlags |= FOCUSED; + if ((mPrivateFlags & PFLAG_FOCUSED) == 0) { + mPrivateFlags |= PFLAG_FOCUSED; if (mParent != null) { mParent.requestChildFocus(this, this); @@ -4294,25 +4412,42 @@ public boolean requestRectangleOnScreen(Rect rectangle) { * @return Whether any parent scrolled. */ public boolean requestRectangleOnScreen(Rect rectangle, boolean immediate) { + if (mParent == null) { + return false; + } + View child = this; + + RectF position = (mAttachInfo != null) ? mAttachInfo.mTmpTransformRect : new RectF(); + position.set(rectangle); + ViewParent parent = mParent; boolean scrolled = false; while (parent != null) { + rectangle.set((int) position.left, (int) position.top, + (int) position.right, (int) position.bottom); + scrolled |= parent.requestChildRectangleOnScreen(child, rectangle, immediate); - // offset rect so next call has the rectangle in the - // coordinate system of its direct child. - rectangle.offset(child.getLeft(), child.getTop()); - rectangle.offset(-child.getScrollX(), -child.getScrollY()); + if (!child.hasIdentityMatrix()) { + child.getMatrix().mapRect(position); + } + + position.offset(child.mLeft, child.mTop); if (!(parent instanceof View)) { break; } - child = (View) parent; + View parentView = (View) parent; + + position.offset(-parentView.getScrollX(), -parentView.getScrollY()); + + child = parentView; parent = child.getParent(); } + return scrolled; } @@ -4332,8 +4467,8 @@ public void clearFocus() { System.out.println(this + " clearFocus()"); } - if ((mPrivateFlags & FOCUSED) != 0) { - mPrivateFlags &= ~FOCUSED; + if ((mPrivateFlags & PFLAG_FOCUSED) != 0) { + mPrivateFlags &= ~PFLAG_FOCUSED; if (mParent != null) { mParent.clearChildFocus(this); @@ -4367,8 +4502,8 @@ void unFocus() { System.out.println(this + " unFocus()"); } - if ((mPrivateFlags & FOCUSED) != 0) { - mPrivateFlags &= ~FOCUSED; + if ((mPrivateFlags & PFLAG_FOCUSED) != 0) { + mPrivateFlags &= ~PFLAG_FOCUSED; onFocusChanged(false, 0, null); refreshDrawableState(); @@ -4387,7 +4522,7 @@ void unFocus() { */ @ViewDebug.ExportedProperty(category = "focus") public boolean hasFocus() { - return (mPrivateFlags & FOCUSED) != 0; + return (mPrivateFlags & PFLAG_FOCUSED) != 0; } /** @@ -4458,7 +4593,7 @@ protected void onFocusChanged(boolean gainFocus, int direction, Rect previouslyF } /** - * Sends an accessibility event of the given type. If accessiiblity is + * Sends an accessibility event of the given type. If accessibility is * not enabled this method has no effect. The default implementation calls * {@link #onInitializeAccessibilityEvent(AccessibilityEvent)} first * to populate information about the event source (this View), then calls @@ -4502,11 +4637,13 @@ public void sendAccessibilityEvent(int eventType) { * @param text The announcement text. */ public void announceForAccessibility(CharSequence text) { - if (AccessibilityManager.getInstance(mContext).isEnabled()) { + if (AccessibilityManager.getInstance(mContext).isEnabled() && mParent != null) { AccessibilityEvent event = AccessibilityEvent.obtain( AccessibilityEvent.TYPE_ANNOUNCEMENT); + onInitializeAccessibilityEvent(event); event.getText().add(text); - sendAccessibilityEventUnchecked(event); + event.setContentDescription(null); + mParent.requestSendAccessibilityEvent(this, event); } } @@ -4779,7 +4916,7 @@ public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { * * @param outRect The output location */ - private void getBoundsOnScreen(Rect outRect) { + void getBoundsOnScreen(Rect outRect) { if (mAttachInfo == null) { return; } @@ -4826,6 +4963,7 @@ private void getBoundsOnScreen(Rect outRect) { */ void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { Rect bounds = mAttachInfo.mTmpInvalRect; + getDrawingRect(bounds); info.setBoundsInParent(bounds); @@ -4837,6 +4975,28 @@ void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { info.setParent((View) parent); } + if (mID != View.NO_ID) { + View rootView = getRootView(); + if (rootView == null) { + rootView = this; + } + View label = rootView.findLabelForView(this, mID); + if (label != null) { + info.setLabeledBy(label); + } + } + + if (mLabelForId != View.NO_ID) { + View rootView = getRootView(); + if (rootView == null) { + rootView = this; + } + View labeled = rootView.findViewInsideOutShouldExist(this, mLabelForId); + if (labeled != null) { + info.setLabelFor(labeled); + } + } + info.setVisibleToUser(isVisibleToUser()); info.setPackageName(mContext.getPackageName()); @@ -4852,7 +5012,7 @@ void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { info.setLongClickable(isLongClickable()); // TODO: These make sense only if we are in an AdapterView but all - // views can be selected. Maybe from accessiiblity perspective + // views can be selected. Maybe from accessibility perspective // we should report as selectable view in an AdapterView. info.addAction(AccessibilityNodeInfo.ACTION_SELECT); info.addAction(AccessibilityNodeInfo.ACTION_CLEAR_SELECTION); @@ -4866,10 +5026,7 @@ void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { } if (!isAccessibilityFocused()) { - final int mode = getAccessibilityFocusable(); - if (mode == ACCESSIBILITY_FOCUSABLE_YES || mode == ACCESSIBILITY_FOCUSABLE_AUTO) { - info.addAction(AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS); - } + info.addAction(AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS); } else { info.addAction(AccessibilityNodeInfo.ACTION_CLEAR_ACCESSIBILITY_FOCUS); } @@ -4891,28 +5048,12 @@ void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { } } - /** - * Returns the delta between the actual and last reported window left. - * - * @hide - */ - public int getActualAndReportedWindowLeftDelta() { - if (mAttachInfo != null) { - return mAttachInfo.mActualWindowLeft - mAttachInfo.mWindowLeft; + private View findLabelForView(View view, int labeledId) { + if (mMatchLabelForPredicate == null) { + mMatchLabelForPredicate = new MatchLabelForPredicate(); } - return 0; - } - - /** - * Returns the delta between the actual and last reported window top. - * - * @hide - */ - public int getActualAndReportedWindowTopDelta() { - if (mAttachInfo != null) { - return mAttachInfo.mActualWindowTop - mAttachInfo.mWindowTop; - } - return 0; + mMatchLabelForPredicate.mLabeledId = labeledId; + return findViewByPredicateInsideOut(view, mMatchLabelForPredicate); } /** @@ -4929,9 +5070,10 @@ protected boolean isVisibleToUser() { } /** - * Computes whether the given portion of this view is visible to the user. Such a view is - * attached, visible, all its predecessors are visible, has an alpha greater than zero, and - * the specified portion is not clipped entirely by its predecessors. + * Computes whether the given portion of this view is visible to the user. + * Such a view is attached, visible, all its predecessors are visible, + * has an alpha greater than zero, and the specified portion is not + * clipped entirely by its predecessors. * * @param boundInView the portion of the view to test; coordinates should be relative; may be * null, and the entire view will be tested in this case. @@ -4945,26 +5087,53 @@ protected boolean isVisibleToUser() { * @hide */ protected boolean isVisibleToUser(Rect boundInView) { - Rect visibleRect = mAttachInfo.mTmpInvalRect; - Point offset = mAttachInfo.mPoint; - // The first two checks are made also made by isShown() which - // however traverses the tree up to the parent to catch that. - // Therefore, we do some fail fast check to minimize the up - // tree traversal. - boolean isVisible = mAttachInfo != null - && mAttachInfo.mWindowVisibility == View.VISIBLE - && getAlpha() > 0 - && isShown() - && getGlobalVisibleRect(visibleRect, offset); - if (isVisible && boundInView != null) { + if (mAttachInfo != null) { + // Attached to invisible window means this view is not visible. + if (mAttachInfo.mWindowVisibility != View.VISIBLE) { + return false; + } + // An invisible predecessor or one with alpha zero means + // that this view is not visible to the user. + Object current = this; + while (current instanceof View) { + View view = (View) current; + // We have attach info so this view is attached and there is no + // need to check whether we reach to ViewRootImpl on the way up. + if (view.getAlpha() <= 0 || view.getVisibility() != VISIBLE) { + return false; + } + current = view.mParent; + } + // Check if the view is entirely covered by its predecessors. + Rect visibleRect = mAttachInfo.mTmpInvalRect; + Point offset = mAttachInfo.mPoint; + if (!getGlobalVisibleRect(visibleRect, offset)) { + return false; + } + // Check if the visible portion intersects the rectangle of interest. + if (boundInView != null) { visibleRect.offset(-offset.x, -offset.y); - isVisible &= boundInView.intersect(visibleRect); + return boundInView.intersect(visibleRect); } - return isVisible; + return true; + } + return false; } /** - * Sets a delegate for implementing accessibility support via compositon as + * Returns the delegate for implementing accessibility support via + * composition. For more details see {@link AccessibilityDelegate}. + * + * @return The delegate, or null if none set. + * + * @hide + */ + public AccessibilityDelegate getAccessibilityDelegate() { + return mAccessibilityDelegate; + } + + /** + * Sets a delegate for implementing accessibility support via composition as * opposed to inheritance. The delegate's primary use is for implementing * backwards compatible widgets. For more details see {@link AccessibilityDelegate}. * @@ -5061,11 +5230,45 @@ public CharSequence getContentDescription() { */ @RemotableViewMethod public void setContentDescription(CharSequence contentDescription) { + if (mContentDescription == null) { + if (contentDescription == null) { + return; + } + } else if (mContentDescription.equals(contentDescription)) { + return; + } mContentDescription = contentDescription; final boolean nonEmptyDesc = contentDescription != null && contentDescription.length() > 0; if (nonEmptyDesc && getImportantForAccessibility() == IMPORTANT_FOR_ACCESSIBILITY_AUTO) { setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_YES); } + notifyAccessibilityStateChanged(); + } + + /** + * Gets the id of a view for which this view serves as a label for + * accessibility purposes. + * + * @return The labeled view id. + */ + @ViewDebug.ExportedProperty(category = "accessibility") + public int getLabelFor() { + return mLabelForId; + } + + /** + * Sets the id of a view for which this view serves as a label for + * accessibility purposes. + * + * @param id The labeled view id. + */ + @RemotableViewMethod + public void setLabelFor(int id) { + mLabelForId = id; + if (mLabelForId != View.NO_ID + && mID == View.NO_ID) { + mID = generateViewId(); + } } /** @@ -5106,7 +5309,7 @@ private void resetPressedState() { */ @ViewDebug.ExportedProperty(category = "focus") public boolean isFocused() { - return (mPrivateFlags & FOCUSED) != 0; + return (mPrivateFlags & PFLAG_FOCUSED) != 0; } /** @@ -5117,7 +5320,7 @@ public boolean isFocused() { * be found. */ public View findFocus() { - return (mPrivateFlags & FOCUSED) != 0 ? this : null; + return (mPrivateFlags & PFLAG_FOCUSED) != 0 ? this : null; } /** @@ -5130,7 +5333,7 @@ public View findFocus() { * @attr ref android.R.styleable#View_isScrollContainer */ public boolean isScrollContainer() { - return (mPrivateFlags & SCROLL_CONTAINER_ADDED) != 0; + return (mPrivateFlags & PFLAG_SCROLL_CONTAINER_ADDED) != 0; } /** @@ -5144,16 +5347,16 @@ public boolean isScrollContainer() { */ public void setScrollContainer(boolean isScrollContainer) { if (isScrollContainer) { - if (mAttachInfo != null && (mPrivateFlags&SCROLL_CONTAINER_ADDED) == 0) { + if (mAttachInfo != null && (mPrivateFlags&PFLAG_SCROLL_CONTAINER_ADDED) == 0) { mAttachInfo.mScrollContainers.add(this); - mPrivateFlags |= SCROLL_CONTAINER_ADDED; + mPrivateFlags |= PFLAG_SCROLL_CONTAINER_ADDED; } - mPrivateFlags |= SCROLL_CONTAINER; + mPrivateFlags |= PFLAG_SCROLL_CONTAINER; } else { - if ((mPrivateFlags&SCROLL_CONTAINER_ADDED) != 0) { + if ((mPrivateFlags&PFLAG_SCROLL_CONTAINER_ADDED) != 0) { mAttachInfo.mScrollContainers.remove(this); } - mPrivateFlags &= ~(SCROLL_CONTAINER|SCROLL_CONTAINER_ADDED); + mPrivateFlags &= ~(PFLAG_SCROLL_CONTAINER|PFLAG_SCROLL_CONTAINER_ADDED); } } @@ -5403,14 +5606,13 @@ public boolean isShown() { * @return Return true if this view applied the insets and it should not * continue propagating further down the hierarchy, false otherwise. * @see #getFitsSystemWindows() - * @see #setFitsSystemWindows() + * @see #setFitsSystemWindows(boolean) * @see #setSystemUiVisibility(int) */ protected boolean fitSystemWindows(Rect insets) { if ((mViewFlags & FITS_SYSTEM_WINDOWS) == FITS_SYSTEM_WINDOWS) { - mUserPaddingStart = -1; - mUserPaddingEnd = -1; - mUserPaddingRelative = false; + mUserPaddingStart = UNDEFINED_PADDING; + mUserPaddingEnd = UNDEFINED_PADDING; if ((mViewFlags & OPTIONAL_FITS_SYSTEM_WINDOWS) == 0 || mAttachInfo == null || (mAttachInfo.mSystemUiVisibility & SYSTEM_UI_LAYOUT_FLAGS) == 0) { @@ -5652,8 +5854,8 @@ public boolean isHapticFeedbackEnabled() { * {@link #LAYOUT_DIRECTION_RTL}, * {@link #LAYOUT_DIRECTION_INHERIT} or * {@link #LAYOUT_DIRECTION_LOCALE}. - * * @attr ref android.R.styleable#View_layoutDirection + * * @hide */ @ViewDebug.ExportedProperty(category = "layout", mapping = { @@ -5662,32 +5864,40 @@ public boolean isHapticFeedbackEnabled() { @ViewDebug.IntToString(from = LAYOUT_DIRECTION_INHERIT, to = "INHERIT"), @ViewDebug.IntToString(from = LAYOUT_DIRECTION_LOCALE, to = "LOCALE") }) - public int getLayoutDirection() { - return (mPrivateFlags2 & LAYOUT_DIRECTION_MASK) >> LAYOUT_DIRECTION_MASK_SHIFT; + public int getRawLayoutDirection() { + return (mPrivateFlags2 & PFLAG2_LAYOUT_DIRECTION_MASK) >> PFLAG2_LAYOUT_DIRECTION_MASK_SHIFT; } /** * Set the layout direction for this view. This will propagate a reset of layout direction * resolution to the view's children and resolve layout direction for this view. * - * @param layoutDirection One of {@link #LAYOUT_DIRECTION_LTR}, - * {@link #LAYOUT_DIRECTION_RTL}, - * {@link #LAYOUT_DIRECTION_INHERIT} or - * {@link #LAYOUT_DIRECTION_LOCALE}. + * @param layoutDirection the layout direction to set. Should be one of: + * + * {@link #LAYOUT_DIRECTION_LTR}, + * {@link #LAYOUT_DIRECTION_RTL}, + * {@link #LAYOUT_DIRECTION_INHERIT}, + * {@link #LAYOUT_DIRECTION_LOCALE}. + * + * Resolution will be done if the value is set to LAYOUT_DIRECTION_INHERIT. The resolution + * proceeds up the parent chain of the view to get the value. If there is no parent, then it + * will return the default {@link #LAYOUT_DIRECTION_LTR}. * * @attr ref android.R.styleable#View_layoutDirection - * @hide */ @RemotableViewMethod public void setLayoutDirection(int layoutDirection) { - if (getLayoutDirection() != layoutDirection) { + if (getRawLayoutDirection() != layoutDirection) { // Reset the current layout direction and the resolved one - mPrivateFlags2 &= ~LAYOUT_DIRECTION_MASK; - resetResolvedLayoutDirection(); - // Set the new layout direction (filtered) and ask for a layout pass + mPrivateFlags2 &= ~PFLAG2_LAYOUT_DIRECTION_MASK; + resetRtlProperties(); + // Set the new layout direction (filtered) mPrivateFlags2 |= - ((layoutDirection << LAYOUT_DIRECTION_MASK_SHIFT) & LAYOUT_DIRECTION_MASK); + ((layoutDirection << PFLAG2_LAYOUT_DIRECTION_MASK_SHIFT) & PFLAG2_LAYOUT_DIRECTION_MASK); + // We need to resolve all RTL properties as they all depend on layout direction + resolveRtlPropertiesIfNeeded(); requestLayout(); + invalidate(true); } } @@ -5696,19 +5906,22 @@ public void setLayoutDirection(int layoutDirection) { * * @return {@link #LAYOUT_DIRECTION_RTL} if the layout direction is RTL or returns * {@link #LAYOUT_DIRECTION_LTR} if the layout direction is not RTL. - * @hide + * + * For compatibility, this will return {@link #LAYOUT_DIRECTION_LTR} if API version + * is lower than {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1}. */ @ViewDebug.ExportedProperty(category = "layout", mapping = { @ViewDebug.IntToString(from = LAYOUT_DIRECTION_LTR, to = "RESOLVED_DIRECTION_LTR"), @ViewDebug.IntToString(from = LAYOUT_DIRECTION_RTL, to = "RESOLVED_DIRECTION_RTL") }) - public int getResolvedLayoutDirection() { - // The layout diretion will be resolved only if needed - if ((mPrivateFlags2 & LAYOUT_DIRECTION_RESOLVED) != LAYOUT_DIRECTION_RESOLVED) { - resolveLayoutDirection(); + public int getLayoutDirection() { + final int targetSdkVersion = getContext().getApplicationInfo().targetSdkVersion; + if (targetSdkVersion < JELLY_BEAN_MR1) { + mPrivateFlags2 |= PFLAG2_LAYOUT_DIRECTION_RESOLVED; + return LAYOUT_DIRECTION_LTR; } - return ((mPrivateFlags2 & LAYOUT_DIRECTION_RESOLVED_RTL) == LAYOUT_DIRECTION_RESOLVED_RTL) ? - LAYOUT_DIRECTION_RTL : LAYOUT_DIRECTION_LTR; + return ((mPrivateFlags2 & PFLAG2_LAYOUT_DIRECTION_RESOLVED_RTL) == + PFLAG2_LAYOUT_DIRECTION_RESOLVED_RTL) ? LAYOUT_DIRECTION_RTL : LAYOUT_DIRECTION_LTR; } /** @@ -5716,11 +5929,12 @@ public int getResolvedLayoutDirection() { * layout attribute and/or the inherited value from the parent * * @return true if the layout is right-to-left. + * * @hide */ @ViewDebug.ExportedProperty(category = "layout") public boolean isLayoutRtl() { - return (getResolvedLayoutDirection() == LAYOUT_DIRECTION_RTL); + return (getLayoutDirection() == LAYOUT_DIRECTION_RTL); } /** @@ -5737,7 +5951,7 @@ public boolean isLayoutRtl() { */ @ViewDebug.ExportedProperty(category = "layout") public boolean hasTransientState() { - return (mPrivateFlags2 & HAS_TRANSIENT_STATE) == HAS_TRANSIENT_STATE; + return (mPrivateFlags2 & PFLAG2_HAS_TRANSIENT_STATE) == PFLAG2_HAS_TRANSIENT_STATE; } /** @@ -5764,8 +5978,8 @@ public void setHasTransientState(boolean hasTransientState) { if ((hasTransientState && mTransientStateCount == 1) || (!hasTransientState && mTransientStateCount == 0)) { // update flag if we've just incremented up from 0 or decremented down to 0 - mPrivateFlags2 = (mPrivateFlags2 & ~HAS_TRANSIENT_STATE) | - (hasTransientState ? HAS_TRANSIENT_STATE : 0); + mPrivateFlags2 = (mPrivateFlags2 & ~PFLAG2_HAS_TRANSIENT_STATE) | + (hasTransientState ? PFLAG2_HAS_TRANSIENT_STATE : 0); if (mParent != null) { try { mParent.childHasTransientStateChanged(this, hasTransientState); @@ -5888,12 +6102,12 @@ public void setLongClickable(boolean longClickable) { * the View's internal state from a previously set "pressed" state. */ public void setPressed(boolean pressed) { - final boolean needsRefresh = pressed != ((mPrivateFlags & PRESSED) == PRESSED); + final boolean needsRefresh = pressed != ((mPrivateFlags & PFLAG_PRESSED) == PFLAG_PRESSED); if (pressed) { - mPrivateFlags |= PRESSED; + mPrivateFlags |= PFLAG_PRESSED; } else { - mPrivateFlags &= ~PRESSED; + mPrivateFlags &= ~PFLAG_PRESSED; } if (needsRefresh) { @@ -5924,7 +6138,7 @@ protected void dispatchSetPressed(boolean pressed) { * @return true if the view is currently pressed, false otherwise */ public boolean isPressed() { - return (mPrivateFlags & PRESSED) == PRESSED; + return (mPrivateFlags & PFLAG_PRESSED) == PFLAG_PRESSED; } /** @@ -6117,17 +6331,14 @@ public boolean apply(View t) { return null; } - private View findViewInsideOutShouldExist(View root, final int childViewId) { - View result = root.findViewByPredicateInsideOut(this, new Predicate() { - @Override - public boolean apply(View t) { - return t.mID == childViewId; - } - }); - + private View findViewInsideOutShouldExist(View root, int id) { + if (mMatchIdPredicate == null) { + mMatchIdPredicate = new MatchIdPredicate(); + } + mMatchIdPredicate.mId = id; + View result = root.findViewByPredicateInsideOut(this, mMatchIdPredicate); if (result == null) { - Log.w(VIEW_LOG_TAG, "couldn't find next focus view specified " - + "by user for id " + childViewId); + Log.w(VIEW_LOG_TAG, "couldn't find view with id " + id); } return result; } @@ -6177,12 +6388,6 @@ public void addFocusables(ArrayList views, int direction, int focusableMod if (views == null) { return; } - if ((focusableMode & FOCUSABLES_ACCESSIBILITY) == FOCUSABLES_ACCESSIBILITY) { - if (isAccessibilityFocusable()) { - views.add(this); - return; - } - } if (!isFocusable()) { return; } @@ -6257,7 +6462,7 @@ public void addTouchables(ArrayList views) { * @return True if this View is accessibility focused. */ boolean isAccessibilityFocused() { - return (mPrivateFlags2 & ACCESSIBILITY_FOCUSED) != 0; + return (mPrivateFlags2 & PFLAG2_ACCESSIBILITY_FOCUSED) != 0; } /** @@ -6282,8 +6487,8 @@ public boolean requestAccessibilityFocus() { if ((mViewFlags & VISIBILITY_MASK) != VISIBLE) { return false; } - if ((mPrivateFlags2 & ACCESSIBILITY_FOCUSED) == 0) { - mPrivateFlags2 |= ACCESSIBILITY_FOCUSED; + if ((mPrivateFlags2 & PFLAG2_ACCESSIBILITY_FOCUSED) == 0) { + mPrivateFlags2 |= PFLAG2_ACCESSIBILITY_FOCUSED; ViewRootImpl viewRootImpl = getViewRootImpl(); if (viewRootImpl != null) { viewRootImpl.setAccessibilityFocus(this, null); @@ -6305,8 +6510,8 @@ public boolean requestAccessibilityFocus() { * @hide */ public void clearAccessibilityFocus() { - if ((mPrivateFlags2 & ACCESSIBILITY_FOCUSED) != 0) { - mPrivateFlags2 &= ~ACCESSIBILITY_FOCUSED; + if ((mPrivateFlags2 & PFLAG2_ACCESSIBILITY_FOCUSED) != 0) { + mPrivateFlags2 &= ~PFLAG2_ACCESSIBILITY_FOCUSED; invalidate(); sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED); notifyAccessibilityStateChanged(); @@ -6347,29 +6552,6 @@ private void sendAccessibilityHoverEvent(int eventType) { } } - private void requestAccessibilityFocusFromHover() { - if (includeForAccessibility() && isActionableForAccessibility()) { - requestAccessibilityFocus(); - } else { - if (mParent != null) { - View nextFocus = mParent.findViewToTakeAccessibilityFocusFromHover(this, this); - if (nextFocus != null) { - nextFocus.requestAccessibilityFocus(); - } - } - } - } - - private boolean canTakeAccessibilityFocusFromHover() { - if (includeForAccessibility() && isActionableForAccessibility()) { - return true; - } - if (mParent != null) { - return (mParent.findViewToTakeAccessibilityFocusFromHover(this, this) == this); - } - return false; - } - /** * Clears accessibility focus without calling any callback methods * normally invoked in {@link #clearAccessibilityFocus()}. This method @@ -6377,8 +6559,8 @@ private boolean canTakeAccessibilityFocusFromHover() { * another view. */ void clearAccessibilityFocusNoCallbacks() { - if ((mPrivateFlags2 & ACCESSIBILITY_FOCUSED) != 0) { - mPrivateFlags2 &= ~ACCESSIBILITY_FOCUSED; + if ((mPrivateFlags2 & PFLAG2_ACCESSIBILITY_FOCUSED) != 0) { + mPrivateFlags2 &= ~PFLAG2_ACCESSIBILITY_FOCUSED; invalidate(); } } @@ -6535,8 +6717,8 @@ private boolean hasAncestorThatBlocksDescendantFocus() { @ViewDebug.IntToString(from = IMPORTANT_FOR_ACCESSIBILITY_NO, to = "no") }) public int getImportantForAccessibility() { - return (mPrivateFlags2 & IMPORTANT_FOR_ACCESSIBILITY_MASK) - >> IMPORTANT_FOR_ACCESSIBILITY_SHIFT; + return (mPrivateFlags2 & PFLAG2_IMPORTANT_FOR_ACCESSIBILITY_MASK) + >> PFLAG2_IMPORTANT_FOR_ACCESSIBILITY_SHIFT; } /** @@ -6554,9 +6736,9 @@ public int getImportantForAccessibility() { */ public void setImportantForAccessibility(int mode) { if (mode != getImportantForAccessibility()) { - mPrivateFlags2 &= ~IMPORTANT_FOR_ACCESSIBILITY_MASK; - mPrivateFlags2 |= (mode << IMPORTANT_FOR_ACCESSIBILITY_SHIFT) - & IMPORTANT_FOR_ACCESSIBILITY_MASK; + mPrivateFlags2 &= ~PFLAG2_IMPORTANT_FOR_ACCESSIBILITY_MASK; + mPrivateFlags2 |= (mode << PFLAG2_IMPORTANT_FOR_ACCESSIBILITY_SHIFT) + & PFLAG2_IMPORTANT_FOR_ACCESSIBILITY_MASK; notifyAccessibilityStateChanged(); } } @@ -6569,88 +6751,22 @@ public void setImportantForAccessibility(int mode) { * @hide */ public boolean isImportantForAccessibility() { - final int mode = (mPrivateFlags2 & IMPORTANT_FOR_ACCESSIBILITY_MASK) - >> IMPORTANT_FOR_ACCESSIBILITY_SHIFT; + final int mode = (mPrivateFlags2 & PFLAG2_IMPORTANT_FOR_ACCESSIBILITY_MASK) + >> PFLAG2_IMPORTANT_FOR_ACCESSIBILITY_SHIFT; switch (mode) { case IMPORTANT_FOR_ACCESSIBILITY_YES: return true; case IMPORTANT_FOR_ACCESSIBILITY_NO: return false; case IMPORTANT_FOR_ACCESSIBILITY_AUTO: - return isActionableForAccessibility() || hasListenersForAccessibility(); + return isActionableForAccessibility() || hasListenersForAccessibility() + || getAccessibilityNodeProvider() != null; default: throw new IllegalArgumentException("Unknow important for accessibility mode: " + mode); } } - /** - * Gets the mode for determining whether this View can take accessibility focus. - * - * @return The mode for determining whether a View can take accessibility focus. - * - * @attr ref android.R.styleable#View_accessibilityFocusable - * - * @see #ACCESSIBILITY_FOCUSABLE_YES - * @see #ACCESSIBILITY_FOCUSABLE_NO - * @see #ACCESSIBILITY_FOCUSABLE_AUTO - * - * @hide - */ - @ViewDebug.ExportedProperty(category = "accessibility", mapping = { - @ViewDebug.IntToString(from = ACCESSIBILITY_FOCUSABLE_AUTO, to = "auto"), - @ViewDebug.IntToString(from = ACCESSIBILITY_FOCUSABLE_YES, to = "yes"), - @ViewDebug.IntToString(from = ACCESSIBILITY_FOCUSABLE_NO, to = "no") - }) - public int getAccessibilityFocusable() { - return (mPrivateFlags2 & ACCESSIBILITY_FOCUSABLE_MASK) >>> ACCESSIBILITY_FOCUSABLE_SHIFT; - } - - /** - * Sets how to determine whether this view can take accessibility focus. - * - * @param mode How to determine whether this view can take accessibility focus. - * - * @attr ref android.R.styleable#View_accessibilityFocusable - * - * @see #ACCESSIBILITY_FOCUSABLE_YES - * @see #ACCESSIBILITY_FOCUSABLE_NO - * @see #ACCESSIBILITY_FOCUSABLE_AUTO - * - * @hide - */ - public void setAccessibilityFocusable(int mode) { - if (mode != getAccessibilityFocusable()) { - mPrivateFlags2 &= ~ACCESSIBILITY_FOCUSABLE_MASK; - mPrivateFlags2 |= (mode << ACCESSIBILITY_FOCUSABLE_SHIFT) - & ACCESSIBILITY_FOCUSABLE_MASK; - notifyAccessibilityStateChanged(); - } - } - - /** - * Gets whether this view can take accessibility focus. - * - * @return Whether the view can take accessibility focus. - * - * @hide - */ - public boolean isAccessibilityFocusable() { - final int mode = (mPrivateFlags2 & ACCESSIBILITY_FOCUSABLE_MASK) - >>> ACCESSIBILITY_FOCUSABLE_SHIFT; - switch (mode) { - case ACCESSIBILITY_FOCUSABLE_YES: - return true; - case ACCESSIBILITY_FOCUSABLE_NO: - return false; - case ACCESSIBILITY_FOCUSABLE_AUTO: - return canTakeAccessibilityFocusFromHover() - || getAccessibilityNodeProvider() != null; - default: - throw new IllegalArgumentException("Unknow accessibility focusable mode: " + mode); - } - } - /** * Gets the parent for accessibility purposes. Note that the parent for * accessibility is not necessary the immediate parent. It is the first @@ -6696,10 +6812,7 @@ public void addChildrenForAccessibility(ArrayList children) { */ public boolean includeForAccessibility() { if (mAttachInfo != null) { - if (!mAttachInfo.mIncludeNotImportantViews) { - return isImportantForAccessibility(); - } - return true; + return mAttachInfo.mIncludeNotImportantViews || isImportantForAccessibility(); } return false; } @@ -6707,7 +6820,7 @@ public boolean includeForAccessibility() { /** * Returns whether the View is considered actionable from * accessibility perspective. Such view are important for - * accessiiblity. + * accessibility. * * @return True if the view is actionable for accessibility. * @@ -6719,7 +6832,7 @@ public boolean isActionableForAccessibility() { /** * Returns whether the View has registered callbacks wich makes it - * important for accessiiblity. + * important for accessibility. * * @return True if the view is actionable for accessibility. */ @@ -6748,8 +6861,8 @@ public void notifyAccessibilityStateChanged() { if (!AccessibilityManager.getInstance(mContext).isEnabled()) { return; } - if ((mPrivateFlags2 & ACCESSIBILITY_STATE_CHANGED) == 0) { - mPrivateFlags2 |= ACCESSIBILITY_STATE_CHANGED; + if ((mPrivateFlags2 & PFLAG2_ACCESSIBILITY_STATE_CHANGED) == 0) { + mPrivateFlags2 |= PFLAG2_ACCESSIBILITY_STATE_CHANGED; if (mParent != null) { mParent.childAccessibilityStateChanged(this); } @@ -6758,23 +6871,23 @@ public void notifyAccessibilityStateChanged() { /** * Reset the state indicating the this view has requested clients - * interested in its accessiblity state to be notified. + * interested in its accessibility state to be notified. * * @hide */ public void resetAccessibilityStateChanged() { - mPrivateFlags2 &= ~ACCESSIBILITY_STATE_CHANGED; + mPrivateFlags2 &= ~PFLAG2_ACCESSIBILITY_STATE_CHANGED; } /** * Performs the specified accessibility action on the view. For * possible accessibility actions look at {@link AccessibilityNodeInfo}. - *

          - * If an {@link AccessibilityDelegate} has been specified via calling - * {@link #setAccessibilityDelegate(AccessibilityDelegate)} its - * {@link AccessibilityDelegate#performAccessibilityAction(View, int, Bundle)} - * is responsible for handling this call. - *

          + *

          + * If an {@link AccessibilityDelegate} has been specified via calling + * {@link #setAccessibilityDelegate(AccessibilityDelegate)} its + * {@link AccessibilityDelegate#performAccessibilityAction(View, int, Bundle)} + * is responsible for handling this call. + *

          * * @param action The action to perform. * @param arguments Optional action arguments. @@ -6797,12 +6910,14 @@ boolean performAccessibilityActionInternal(int action, Bundle arguments) { switch (action) { case AccessibilityNodeInfo.ACTION_CLICK: { if (isClickable()) { - return performClick(); + performClick(); + return true; } } break; case AccessibilityNodeInfo.ACTION_LONG_CLICK: { if (isLongClickable()) { - return performLongClick(); + performLongClick(); + return true; } } break; case AccessibilityNodeInfo.ACTION_FOCUS: { @@ -6832,10 +6947,7 @@ boolean performAccessibilityActionInternal(int action, Bundle arguments) { } } break; case AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS: { - final int mode = getAccessibilityFocusable(); - if (!isAccessibilityFocused() - && (mode == ACCESSIBILITY_FOCUSABLE_YES - || mode == ACCESSIBILITY_FOCUSABLE_AUTO)) { + if (!isAccessibilityFocused()) { return requestAccessibilityFocus(); } } break; @@ -6929,7 +7041,7 @@ private boolean previousAtGranularity(int granularity) { * @hide */ public CharSequence getIterableTextForAccessibility() { - return mContentDescription; + return getContentDescription(); } /** @@ -7018,7 +7130,7 @@ public void dispatchStartTemporaryDetach() { */ public void onStartTemporaryDetach() { removeUnsetPressCallback(); - mPrivateFlags |= CANCEL_NEXT_UP_EVENT; + mPrivateFlags |= PFLAG_CANCEL_NEXT_UP_EVENT; } /** @@ -7337,13 +7449,13 @@ public void onWindowFocusChanged(boolean hasWindowFocus) { if (isPressed()) { setPressed(false); } - if (imm != null && (mPrivateFlags & FOCUSED) != 0) { + if (imm != null && (mPrivateFlags & PFLAG_FOCUSED) != 0) { imm.focusOut(this); } removeLongPressCallback(); removeTapCallback(); onFocusLost(); - } else if (imm != null && (mPrivateFlags & FOCUSED) != 0) { + } else if (imm != null && (mPrivateFlags & PFLAG_FOCUSED) != 0) { imm.focusIn(this); } refreshDrawableState(); @@ -7383,7 +7495,7 @@ protected void onVisibilityChanged(View changedView, int visibility) { if (mAttachInfo != null) { initialAwakenScrollBars(); } else { - mPrivateFlags |= AWAKEN_SCROLL_BARS_ON_ATTACH; + mPrivateFlags |= PFLAG_AWAKEN_SCROLL_BARS_ON_ATTACH; } } } @@ -7484,7 +7596,9 @@ public void getWindowVisibleDisplayFrame(Rect outRect) { outRect.bottom -= insets.bottom; return; } - Display d = WindowManagerImpl.getDefault().getDefaultDisplay(); + // The view is not attached to a display so we don't have a context. + // Make a best guess about the display size. + Display d = DisplayManagerGlobal.getInstance().getRealDisplay(Display.DEFAULT_DISPLAY); d.getRectSize(outRect); } @@ -7537,7 +7651,7 @@ void performCollectViewAttributes(AttachInfo attachInfo, int visibility) { void needGlobalAttributesUpdate(boolean force) { final AttachInfo ai = mAttachInfo; - if (ai != null) { + if (ai != null && !ai.mRecomputeGlobalAttributes) { if (force || ai.mKeepScreenOn || (ai.mSystemUiVisibility != 0) || ai.mHasSystemUiListeners) { ai.mRecomputeGlobalAttributes = true; @@ -7983,7 +8097,7 @@ private boolean isHoverable() { */ @ViewDebug.ExportedProperty public boolean isHovered() { - return (mPrivateFlags & HOVERED) != 0; + return (mPrivateFlags & PFLAG_HOVERED) != 0; } /** @@ -8003,14 +8117,14 @@ public boolean isHovered() { */ public void setHovered(boolean hovered) { if (hovered) { - if ((mPrivateFlags & HOVERED) == 0) { - mPrivateFlags |= HOVERED; + if ((mPrivateFlags & PFLAG_HOVERED) == 0) { + mPrivateFlags |= PFLAG_HOVERED; refreshDrawableState(); onHoverChanged(true); } } else { - if ((mPrivateFlags & HOVERED) != 0) { - mPrivateFlags &= ~HOVERED; + if ((mPrivateFlags & PFLAG_HOVERED) != 0) { + mPrivateFlags &= ~PFLAG_HOVERED; refreshDrawableState(); onHoverChanged(false); } @@ -8042,7 +8156,7 @@ public boolean onTouchEvent(MotionEvent event) { final int viewFlags = mViewFlags; if ((viewFlags & ENABLED_MASK) == DISABLED) { - if (event.getAction() == MotionEvent.ACTION_UP && (mPrivateFlags & PRESSED) != 0) { + if (event.getAction() == MotionEvent.ACTION_UP && (mPrivateFlags & PFLAG_PRESSED) != 0) { setPressed(false); } // A disabled view that is clickable still consumes the touch @@ -8061,8 +8175,8 @@ public boolean onTouchEvent(MotionEvent event) { (viewFlags & LONG_CLICKABLE) == LONG_CLICKABLE)) { switch (event.getAction()) { case MotionEvent.ACTION_UP: - boolean prepressed = (mPrivateFlags & PREPRESSED) != 0; - if ((mPrivateFlags & PRESSED) != 0 || prepressed) { + boolean prepressed = (mPrivateFlags & PFLAG_PREPRESSED) != 0; + if ((mPrivateFlags & PFLAG_PRESSED) != 0 || prepressed) { // take focus if we don't have it already and we should in // touch mode. boolean focusTaken = false; @@ -8124,7 +8238,7 @@ public boolean onTouchEvent(MotionEvent event) { // For views inside a scrolling container, delay the pressed feedback for // a short period in case this is a scroll. if (isInScrollingContainer) { - mPrivateFlags |= PREPRESSED; + mPrivateFlags |= PFLAG_PREPRESSED; if (mPendingCheckForTap == null) { mPendingCheckForTap = new CheckForTap(); } @@ -8139,6 +8253,7 @@ public boolean onTouchEvent(MotionEvent event) { case MotionEvent.ACTION_CANCEL: setPressed(false); removeTapCallback(); + removeLongPressCallback(); break; case MotionEvent.ACTION_MOVE: @@ -8149,7 +8264,7 @@ public boolean onTouchEvent(MotionEvent event) { if (!pointInView(x, y, mTouchSlop)) { // Outside button removeTapCallback(); - if ((mPrivateFlags & PRESSED) != 0) { + if ((mPrivateFlags & PFLAG_PRESSED) != 0) { // Remove any future long press/tap checks removeLongPressCallback(); @@ -8200,7 +8315,7 @@ private void removePerformClickCallback() { * Remove the prepress detection timer. */ private void removeUnsetPressCallback() { - if ((mPrivateFlags & PRESSED) != 0 && mUnsetPressedState != null) { + if ((mPrivateFlags & PFLAG_PRESSED) != 0 && mUnsetPressedState != null) { setPressed(false); removeCallbacks(mUnsetPressedState); } @@ -8211,7 +8326,7 @@ private void removeUnsetPressCallback() { */ private void removeTapCallback() { if (mPendingCheckForTap != null) { - mPrivateFlags &= ~PREPRESSED; + mPrivateFlags &= ~PFLAG_PREPRESSED; removeCallbacks(mPendingCheckForTap); } } @@ -8276,13 +8391,13 @@ void setFlags(int flags, int mask) { /* Check if the FOCUSABLE bit has changed */ if (((changed & FOCUSABLE_MASK) != 0) && - ((privateFlags & HAS_BOUNDS) !=0)) { + ((privateFlags & PFLAG_HAS_BOUNDS) !=0)) { if (((old & FOCUSABLE_MASK) == FOCUSABLE) - && ((privateFlags & FOCUSED) != 0)) { + && ((privateFlags & PFLAG_FOCUSED) != 0)) { /* Give up focus if we are no longer focusable */ clearFocus(); } else if (((old & FOCUSABLE_MASK) == NOT_FOCUSABLE) - && ((privateFlags & FOCUSED) == 0)) { + && ((privateFlags & PFLAG_FOCUSED) == 0)) { /* * Tell the view system that we are now available to take focus * if no one else already has it. @@ -8301,7 +8416,7 @@ void setFlags(int flags, int mask) { * it was not visible. Marking it drawn ensures that the invalidation will * go through. */ - mPrivateFlags |= DRAWN; + mPrivateFlags |= PFLAG_DRAWN; invalidate(true); needGlobalAttributesUpdate(true); @@ -8331,7 +8446,7 @@ void setFlags(int flags, int mask) { } // Mark the view drawn to ensure that it gets invalidated properly the next // time it is visible and gets invalidated - mPrivateFlags |= DRAWN; + mPrivateFlags |= PFLAG_DRAWN; } if (mAttachInfo != null) { mAttachInfo.mViewVisibilityChanged = true; @@ -8345,7 +8460,7 @@ void setFlags(int flags, int mask) { * If this view is becoming invisible, set the DRAWN flag so that * the next invalidate() will not be skipped. */ - mPrivateFlags |= DRAWN; + mPrivateFlags |= PFLAG_DRAWN; if (((mViewFlags & VISIBILITY_MASK) == INVISIBLE) && hasFocus()) { // root view becoming invisible shouldn't clear focus and accessibility focus @@ -8376,25 +8491,25 @@ void setFlags(int flags, int mask) { if ((changed & DRAWING_CACHE_ENABLED) != 0) { destroyDrawingCache(); - mPrivateFlags &= ~DRAWING_CACHE_VALID; + mPrivateFlags &= ~PFLAG_DRAWING_CACHE_VALID; invalidateParentCaches(); } if ((changed & DRAWING_CACHE_QUALITY_MASK) != 0) { destroyDrawingCache(); - mPrivateFlags &= ~DRAWING_CACHE_VALID; + mPrivateFlags &= ~PFLAG_DRAWING_CACHE_VALID; } if ((changed & DRAW_MASK) != 0) { if ((mViewFlags & WILL_NOT_DRAW) != 0) { if (mBackground != null) { - mPrivateFlags &= ~SKIP_DRAW; - mPrivateFlags |= ONLY_DRAWS_BACKGROUND; + mPrivateFlags &= ~PFLAG_SKIP_DRAW; + mPrivateFlags |= PFLAG_ONLY_DRAWS_BACKGROUND; } else { - mPrivateFlags |= SKIP_DRAW; + mPrivateFlags |= PFLAG_SKIP_DRAW; } } else { - mPrivateFlags &= ~SKIP_DRAW; + mPrivateFlags &= ~PFLAG_SKIP_DRAW; } requestLayout(); invalidate(true); @@ -8568,7 +8683,9 @@ public final int getHeight() { /** * Return the visible drawing bounds of your view. Fills in the output * rectangle with the values from getScrollX(), getScrollY(), - * getWidth(), and getHeight(). + * getWidth(), and getHeight(). These bounds do not account for any + * transformation properties currently set on the view, such as + * {@link #setScaleX(float)} or {@link #setRotation(float)}. * * @param outRect The (scrolled) drawing bounds of the view. */ @@ -8702,7 +8819,7 @@ private void updateMatrix() { // asked for the matrix; recalculate it with the current values // Figure out if we need to update the pivot point - if ((mPrivateFlags & PIVOT_EXPLICITLY_SET) == 0) { + if ((mPrivateFlags & PFLAG_PIVOT_EXPLICITLY_SET) == 0) { if ((mRight - mLeft) != info.mPrevWidth || (mBottom - mTop) != info.mPrevHeight) { info.mPrevWidth = mRight - mLeft; info.mPrevHeight = mBottom - mTop; @@ -8736,7 +8853,7 @@ private void updateMatrix() { } } - /** + /** * Utility method to retrieve the inverse of the current mMatrix property. * We cache the matrix to avoid recalculating it when transform properties * have not changed. @@ -8834,7 +8951,7 @@ public void setCameraDistance(float distance) { if (mDisplayList != null) { mDisplayList.setCameraDistance(-Math.abs(distance) / dpi); } - if ((mPrivateFlags2 & VIEW_QUICK_REJECTED) == VIEW_QUICK_REJECTED) { + if ((mPrivateFlags2 & PFLAG2_VIEW_QUICK_REJECTED) == PFLAG2_VIEW_QUICK_REJECTED) { // View was rejected last time it was drawn by its parent; this may have changed invalidateParentIfNeeded(); } @@ -8880,7 +8997,7 @@ public void setRotation(float rotation) { if (mDisplayList != null) { mDisplayList.setRotation(rotation); } - if ((mPrivateFlags2 & VIEW_QUICK_REJECTED) == VIEW_QUICK_REJECTED) { + if ((mPrivateFlags2 & PFLAG2_VIEW_QUICK_REJECTED) == PFLAG2_VIEW_QUICK_REJECTED) { // View was rejected last time it was drawn by its parent; this may have changed invalidateParentIfNeeded(); } @@ -8931,7 +9048,7 @@ public void setRotationY(float rotationY) { if (mDisplayList != null) { mDisplayList.setRotationY(rotationY); } - if ((mPrivateFlags2 & VIEW_QUICK_REJECTED) == VIEW_QUICK_REJECTED) { + if ((mPrivateFlags2 & PFLAG2_VIEW_QUICK_REJECTED) == PFLAG2_VIEW_QUICK_REJECTED) { // View was rejected last time it was drawn by its parent; this may have changed invalidateParentIfNeeded(); } @@ -8982,7 +9099,7 @@ public void setRotationX(float rotationX) { if (mDisplayList != null) { mDisplayList.setRotationX(rotationX); } - if ((mPrivateFlags2 & VIEW_QUICK_REJECTED) == VIEW_QUICK_REJECTED) { + if ((mPrivateFlags2 & PFLAG2_VIEW_QUICK_REJECTED) == PFLAG2_VIEW_QUICK_REJECTED) { // View was rejected last time it was drawn by its parent; this may have changed invalidateParentIfNeeded(); } @@ -9025,7 +9142,7 @@ public void setScaleX(float scaleX) { if (mDisplayList != null) { mDisplayList.setScaleX(scaleX); } - if ((mPrivateFlags2 & VIEW_QUICK_REJECTED) == VIEW_QUICK_REJECTED) { + if ((mPrivateFlags2 & PFLAG2_VIEW_QUICK_REJECTED) == PFLAG2_VIEW_QUICK_REJECTED) { // View was rejected last time it was drawn by its parent; this may have changed invalidateParentIfNeeded(); } @@ -9068,7 +9185,7 @@ public void setScaleY(float scaleY) { if (mDisplayList != null) { mDisplayList.setScaleY(scaleY); } - if ((mPrivateFlags2 & VIEW_QUICK_REJECTED) == VIEW_QUICK_REJECTED) { + if ((mPrivateFlags2 & PFLAG2_VIEW_QUICK_REJECTED) == PFLAG2_VIEW_QUICK_REJECTED) { // View was rejected last time it was drawn by its parent; this may have changed invalidateParentIfNeeded(); } @@ -9109,7 +9226,7 @@ public float getPivotX() { */ public void setPivotX(float pivotX) { ensureTransformationInfo(); - mPrivateFlags |= PIVOT_EXPLICITLY_SET; + mPrivateFlags |= PFLAG_PIVOT_EXPLICITLY_SET; final TransformationInfo info = mTransformationInfo; if (info.mPivotX != pivotX) { invalidateViewProperty(true, false); @@ -9119,7 +9236,7 @@ public void setPivotX(float pivotX) { if (mDisplayList != null) { mDisplayList.setPivotX(pivotX); } - if ((mPrivateFlags2 & VIEW_QUICK_REJECTED) == VIEW_QUICK_REJECTED) { + if ((mPrivateFlags2 & PFLAG2_VIEW_QUICK_REJECTED) == PFLAG2_VIEW_QUICK_REJECTED) { // View was rejected last time it was drawn by its parent; this may have changed invalidateParentIfNeeded(); } @@ -9159,7 +9276,7 @@ public float getPivotY() { */ public void setPivotY(float pivotY) { ensureTransformationInfo(); - mPrivateFlags |= PIVOT_EXPLICITLY_SET; + mPrivateFlags |= PFLAG_PIVOT_EXPLICITLY_SET; final TransformationInfo info = mTransformationInfo; if (info.mPivotY != pivotY) { invalidateViewProperty(true, false); @@ -9169,7 +9286,7 @@ public void setPivotY(float pivotY) { if (mDisplayList != null) { mDisplayList.setPivotY(pivotY); } - if ((mPrivateFlags2 & VIEW_QUICK_REJECTED) == VIEW_QUICK_REJECTED) { + if ((mPrivateFlags2 & PFLAG2_VIEW_QUICK_REJECTED) == PFLAG2_VIEW_QUICK_REJECTED) { // View was rejected last time it was drawn by its parent; this may have changed invalidateParentIfNeeded(); } @@ -9229,12 +9346,12 @@ public void setAlpha(float alpha) { if (mTransformationInfo.mAlpha != alpha) { mTransformationInfo.mAlpha = alpha; if (onSetAlpha((int) (alpha * 255))) { - mPrivateFlags |= ALPHA_SET; + mPrivateFlags |= PFLAG_ALPHA_SET; // subclass is handling alpha - don't optimize rendering cache invalidation invalidateParentCaches(); invalidate(true); } else { - mPrivateFlags &= ~ALPHA_SET; + mPrivateFlags &= ~PFLAG_ALPHA_SET; invalidateViewProperty(true, false); if (mDisplayList != null) { mDisplayList.setAlpha(alpha); @@ -9259,10 +9376,10 @@ boolean setAlphaNoInvalidation(float alpha) { mTransformationInfo.mAlpha = alpha; boolean subclassHandlesAlpha = onSetAlpha((int) (alpha * 255)); if (subclassHandlesAlpha) { - mPrivateFlags |= ALPHA_SET; + mPrivateFlags |= PFLAG_ALPHA_SET; return true; } else { - mPrivateFlags &= ~ALPHA_SET; + mPrivateFlags &= ~PFLAG_ALPHA_SET; if (mDisplayList != null) { mDisplayList.setAlpha(alpha); } @@ -9322,16 +9439,16 @@ public final void setTop(int top) { onSizeChanged(width, mBottom - mTop, width, oldHeight); if (!matrixIsIdentity) { - if ((mPrivateFlags & PIVOT_EXPLICITLY_SET) == 0) { + if ((mPrivateFlags & PFLAG_PIVOT_EXPLICITLY_SET) == 0) { // A change in dimension means an auto-centered pivot point changes, too mTransformationInfo.mMatrixDirty = true; } - mPrivateFlags |= DRAWN; // force another invalidation with the new orientation + mPrivateFlags |= PFLAG_DRAWN; // force another invalidation with the new orientation invalidate(true); } mBackgroundSizeChanged = true; invalidateParentIfNeeded(); - if ((mPrivateFlags2 & VIEW_QUICK_REJECTED) == VIEW_QUICK_REJECTED) { + if ((mPrivateFlags2 & PFLAG2_VIEW_QUICK_REJECTED) == PFLAG2_VIEW_QUICK_REJECTED) { // View was rejected last time it was drawn by its parent; this may have changed invalidateParentIfNeeded(); } @@ -9354,7 +9471,7 @@ public final int getBottom() { * @return The dirty state of this view. */ public boolean isDirty() { - return (mPrivateFlags & DIRTY_MASK) != 0; + return (mPrivateFlags & PFLAG_DIRTY_MASK) != 0; } /** @@ -9395,16 +9512,16 @@ public final void setBottom(int bottom) { onSizeChanged(width, mBottom - mTop, width, oldHeight); if (!matrixIsIdentity) { - if ((mPrivateFlags & PIVOT_EXPLICITLY_SET) == 0) { + if ((mPrivateFlags & PFLAG_PIVOT_EXPLICITLY_SET) == 0) { // A change in dimension means an auto-centered pivot point changes, too mTransformationInfo.mMatrixDirty = true; } - mPrivateFlags |= DRAWN; // force another invalidation with the new orientation + mPrivateFlags |= PFLAG_DRAWN; // force another invalidation with the new orientation invalidate(true); } mBackgroundSizeChanged = true; invalidateParentIfNeeded(); - if ((mPrivateFlags2 & VIEW_QUICK_REJECTED) == VIEW_QUICK_REJECTED) { + if ((mPrivateFlags2 & PFLAG2_VIEW_QUICK_REJECTED) == PFLAG2_VIEW_QUICK_REJECTED) { // View was rejected last time it was drawn by its parent; this may have changed invalidateParentIfNeeded(); } @@ -9462,16 +9579,16 @@ public final void setLeft(int left) { onSizeChanged(mRight - mLeft, height, oldWidth, height); if (!matrixIsIdentity) { - if ((mPrivateFlags & PIVOT_EXPLICITLY_SET) == 0) { + if ((mPrivateFlags & PFLAG_PIVOT_EXPLICITLY_SET) == 0) { // A change in dimension means an auto-centered pivot point changes, too mTransformationInfo.mMatrixDirty = true; } - mPrivateFlags |= DRAWN; // force another invalidation with the new orientation + mPrivateFlags |= PFLAG_DRAWN; // force another invalidation with the new orientation invalidate(true); } mBackgroundSizeChanged = true; invalidateParentIfNeeded(); - if ((mPrivateFlags2 & VIEW_QUICK_REJECTED) == VIEW_QUICK_REJECTED) { + if ((mPrivateFlags2 & PFLAG2_VIEW_QUICK_REJECTED) == PFLAG2_VIEW_QUICK_REJECTED) { // View was rejected last time it was drawn by its parent; this may have changed invalidateParentIfNeeded(); } @@ -9526,16 +9643,16 @@ public final void setRight(int right) { onSizeChanged(mRight - mLeft, height, oldWidth, height); if (!matrixIsIdentity) { - if ((mPrivateFlags & PIVOT_EXPLICITLY_SET) == 0) { + if ((mPrivateFlags & PFLAG_PIVOT_EXPLICITLY_SET) == 0) { // A change in dimension means an auto-centered pivot point changes, too mTransformationInfo.mMatrixDirty = true; } - mPrivateFlags |= DRAWN; // force another invalidation with the new orientation + mPrivateFlags |= PFLAG_DRAWN; // force another invalidation with the new orientation invalidate(true); } mBackgroundSizeChanged = true; invalidateParentIfNeeded(); - if ((mPrivateFlags2 & VIEW_QUICK_REJECTED) == VIEW_QUICK_REJECTED) { + if ((mPrivateFlags2 & PFLAG2_VIEW_QUICK_REJECTED) == PFLAG2_VIEW_QUICK_REJECTED) { // View was rejected last time it was drawn by its parent; this may have changed invalidateParentIfNeeded(); } @@ -9623,7 +9740,7 @@ public void setTranslationX(float translationX) { if (mDisplayList != null) { mDisplayList.setTranslationX(translationX); } - if ((mPrivateFlags2 & VIEW_QUICK_REJECTED) == VIEW_QUICK_REJECTED) { + if ((mPrivateFlags2 & PFLAG2_VIEW_QUICK_REJECTED) == PFLAG2_VIEW_QUICK_REJECTED) { // View was rejected last time it was drawn by its parent; this may have changed invalidateParentIfNeeded(); } @@ -9664,7 +9781,7 @@ public void setTranslationY(float translationY) { if (mDisplayList != null) { mDisplayList.setTranslationY(translationY); } - if ((mPrivateFlags2 & VIEW_QUICK_REJECTED) == VIEW_QUICK_REJECTED) { + if ((mPrivateFlags2 & PFLAG2_VIEW_QUICK_REJECTED) == PFLAG2_VIEW_QUICK_REJECTED) { // View was rejected last time it was drawn by its parent; this may have changed invalidateParentIfNeeded(); } @@ -9714,7 +9831,7 @@ private boolean pointInView(float localX, float localY, float slop) { * When a view has focus and the user navigates away from it, the next view is searched for * starting from the rectangle filled in by this method. * - * By default, the rectange is the {@link #getDrawingRect(android.graphics.Rect)}) + * By default, the rectangle is the {@link #getDrawingRect(android.graphics.Rect)}) * of the view. However, if your view maintains some idea of internal selection, * such as a cursor, or a selected row or column, you should override this method and * fill in a more specific rectangle. @@ -9898,12 +10015,24 @@ public void setLayoutParams(ViewGroup.LayoutParams params) { throw new NullPointerException("Layout parameters cannot be null"); } mLayoutParams = params; + resolveLayoutParams(); if (mParent instanceof ViewGroup) { ((ViewGroup) mParent).onSetLayoutParams(this, params); } requestLayout(); } + /** + * Resolve the layout parameters depending on the resolved layout direction + * + * @hide + */ + public void resolveLayoutParams() { + if (mLayoutParams != null) { + mLayoutParams.resolveLayoutDirection(getLayoutDirection()); + } + } + /** * Set the scrolled position of your view. This will cause a call to * {@link #onScrollChanged(int, int, int, int)} and the view will be @@ -10125,12 +10254,12 @@ public void invalidate(Rect dirty) { if (skipInvalidate()) { return; } - if ((mPrivateFlags & (DRAWN | HAS_BOUNDS)) == (DRAWN | HAS_BOUNDS) || - (mPrivateFlags & DRAWING_CACHE_VALID) == DRAWING_CACHE_VALID || - (mPrivateFlags & INVALIDATED) != INVALIDATED) { - mPrivateFlags &= ~DRAWING_CACHE_VALID; - mPrivateFlags |= INVALIDATED; - mPrivateFlags |= DIRTY; + if ((mPrivateFlags & (PFLAG_DRAWN | PFLAG_HAS_BOUNDS)) == (PFLAG_DRAWN | PFLAG_HAS_BOUNDS) || + (mPrivateFlags & PFLAG_DRAWING_CACHE_VALID) == PFLAG_DRAWING_CACHE_VALID || + (mPrivateFlags & PFLAG_INVALIDATED) != PFLAG_INVALIDATED) { + mPrivateFlags &= ~PFLAG_DRAWING_CACHE_VALID; + mPrivateFlags |= PFLAG_INVALIDATED; + mPrivateFlags |= PFLAG_DIRTY; final ViewParent p = mParent; final AttachInfo ai = mAttachInfo; //noinspection PointlessBooleanExpression,ConstantConditions @@ -10168,12 +10297,12 @@ public void invalidate(int l, int t, int r, int b) { if (skipInvalidate()) { return; } - if ((mPrivateFlags & (DRAWN | HAS_BOUNDS)) == (DRAWN | HAS_BOUNDS) || - (mPrivateFlags & DRAWING_CACHE_VALID) == DRAWING_CACHE_VALID || - (mPrivateFlags & INVALIDATED) != INVALIDATED) { - mPrivateFlags &= ~DRAWING_CACHE_VALID; - mPrivateFlags |= INVALIDATED; - mPrivateFlags |= DIRTY; + if ((mPrivateFlags & (PFLAG_DRAWN | PFLAG_HAS_BOUNDS)) == (PFLAG_DRAWN | PFLAG_HAS_BOUNDS) || + (mPrivateFlags & PFLAG_DRAWING_CACHE_VALID) == PFLAG_DRAWING_CACHE_VALID || + (mPrivateFlags & PFLAG_INVALIDATED) != PFLAG_INVALIDATED) { + mPrivateFlags &= ~PFLAG_DRAWING_CACHE_VALID; + mPrivateFlags |= PFLAG_INVALIDATED; + mPrivateFlags |= PFLAG_DIRTY; final ViewParent p = mParent; final AttachInfo ai = mAttachInfo; //noinspection PointlessBooleanExpression,ConstantConditions @@ -10220,15 +10349,15 @@ void invalidate(boolean invalidateCache) { if (skipInvalidate()) { return; } - if ((mPrivateFlags & (DRAWN | HAS_BOUNDS)) == (DRAWN | HAS_BOUNDS) || - (invalidateCache && (mPrivateFlags & DRAWING_CACHE_VALID) == DRAWING_CACHE_VALID) || - (mPrivateFlags & INVALIDATED) != INVALIDATED || isOpaque() != mLastIsOpaque) { + if ((mPrivateFlags & (PFLAG_DRAWN | PFLAG_HAS_BOUNDS)) == (PFLAG_DRAWN | PFLAG_HAS_BOUNDS) || + (invalidateCache && (mPrivateFlags & PFLAG_DRAWING_CACHE_VALID) == PFLAG_DRAWING_CACHE_VALID) || + (mPrivateFlags & PFLAG_INVALIDATED) != PFLAG_INVALIDATED || isOpaque() != mLastIsOpaque) { mLastIsOpaque = isOpaque(); - mPrivateFlags &= ~DRAWN; - mPrivateFlags |= DIRTY; + mPrivateFlags &= ~PFLAG_DRAWN; + mPrivateFlags |= PFLAG_DIRTY; if (invalidateCache) { - mPrivateFlags |= INVALIDATED; - mPrivateFlags &= ~DRAWING_CACHE_VALID; + mPrivateFlags |= PFLAG_INVALIDATED; + mPrivateFlags &= ~PFLAG_DRAWING_CACHE_VALID; } final AttachInfo ai = mAttachInfo; final ViewParent p = mParent; @@ -10269,12 +10398,12 @@ void invalidate(boolean invalidateCache) { * list properties are not being used in this view */ void invalidateViewProperty(boolean invalidateParent, boolean forceRedraw) { - if (mDisplayList == null || (mPrivateFlags & DRAW_ANIMATION) == DRAW_ANIMATION) { + if (mDisplayList == null || (mPrivateFlags & PFLAG_DRAW_ANIMATION) == PFLAG_DRAW_ANIMATION) { if (invalidateParent) { invalidateParentCaches(); } if (forceRedraw) { - mPrivateFlags |= DRAWN; // force another invalidation with the new orientation + mPrivateFlags |= PFLAG_DRAWN; // force another invalidation with the new orientation } invalidate(false); } else { @@ -10318,7 +10447,7 @@ void transformRect(final Rect rect) { */ protected void invalidateParentCaches() { if (mParent instanceof View) { - ((View) mParent).mPrivateFlags |= INVALIDATED; + ((View) mParent).mPrivateFlags |= PFLAG_INVALIDATED; } } @@ -10350,9 +10479,8 @@ protected void invalidateParentIfNeeded() { */ @ViewDebug.ExportedProperty(category = "drawing") public boolean isOpaque() { - return (mPrivateFlags & OPAQUE_MASK) == OPAQUE_MASK && - ((mTransformationInfo != null ? mTransformationInfo.mAlpha : 1) - >= 1.0f - ViewConfiguration.ALPHA_THRESHOLD); + return (mPrivateFlags & PFLAG_OPAQUE_MASK) == PFLAG_OPAQUE_MASK && + ((mTransformationInfo != null ? mTransformationInfo.mAlpha : 1.0f) >= 1.0f); } /** @@ -10365,17 +10493,17 @@ protected void computeOpaqueFlags() { // - Doesn't have scrollbars or scrollbars are inside overlay if (mBackground != null && mBackground.getOpacity() == PixelFormat.OPAQUE) { - mPrivateFlags |= OPAQUE_BACKGROUND; + mPrivateFlags |= PFLAG_OPAQUE_BACKGROUND; } else { - mPrivateFlags &= ~OPAQUE_BACKGROUND; + mPrivateFlags &= ~PFLAG_OPAQUE_BACKGROUND; } final int flags = mViewFlags; if (((flags & SCROLLBARS_VERTICAL) == 0 && (flags & SCROLLBARS_HORIZONTAL) == 0) || (flags & SCROLLBARS_STYLE_MASK) == SCROLLBARS_INSIDE_OVERLAY) { - mPrivateFlags |= OPAQUE_SCROLLBARS; + mPrivateFlags |= PFLAG_OPAQUE_SCROLLBARS; } else { - mPrivateFlags &= ~OPAQUE_SCROLLBARS; + mPrivateFlags &= ~PFLAG_OPAQUE_SCROLLBARS; } } @@ -10383,7 +10511,7 @@ protected void computeOpaqueFlags() { * @hide */ protected boolean hasOpaqueScrollbars() { - return (mPrivateFlags & OPAQUE_SCROLLBARS) == OPAQUE_SCROLLBARS; + return (mPrivateFlags & PFLAG_OPAQUE_SCROLLBARS) == PFLAG_OPAQUE_SCROLLBARS; } /** @@ -10413,9 +10541,6 @@ public ViewRootImpl getViewRootImpl() { *

          Causes the Runnable to be added to the message queue. * The runnable will be run on the user interface thread.

          * - *

          This method can be invoked from outside of the UI thread - * only when this View is attached to a window.

          - * * @param action The Runnable that will be executed. * * @return Returns true if the Runnable was successfully placed in to the @@ -10440,9 +10565,6 @@ public boolean post(Runnable action) { * after the specified amount of time elapses. * The runnable will be run on the user interface thread.

          * - *

          This method can be invoked from outside of the UI thread - * only when this View is attached to a window.

          - * * @param action The Runnable that will be executed. * @param delayMillis The delay (in milliseconds) until the Runnable * will be executed. @@ -10471,9 +10593,6 @@ public boolean postDelayed(Runnable action, long delayMillis) { *

          Causes the Runnable to execute on the next animation time step. * The runnable will be run on the user interface thread.

          * - *

          This method can be invoked from outside of the UI thread - * only when this View is attached to a window.

          - * * @param action The Runnable that will be executed. * * @see #postOnAnimationDelayed @@ -10495,9 +10614,6 @@ public void postOnAnimation(Runnable action) { * after the specified amount of time elapses. * The runnable will be run on the user interface thread.

          * - *

          This method can be invoked from outside of the UI thread - * only when this View is attached to a window.

          - * * @param action The Runnable that will be executed. * @param delayMillis The delay (in milliseconds) until the Runnable * will be executed. @@ -10519,9 +10635,6 @@ public void postOnAnimationDelayed(Runnable action, long delayMillis) { /** *

          Removes the specified Runnable from the message queue.

          * - *

          This method can be invoked from outside of the UI thread - * only when this View is attached to a window.

          - * * @param action The Runnable to remove from the message handling queue * * @return true if this view could ask the Handler to remove the Runnable, @@ -10911,7 +11024,7 @@ public void setVerticalScrollBarEnabled(boolean verticalScrollBarEnabled) { * @hide */ protected void recomputePadding() { - setPadding(mUserPaddingLeft, mPaddingTop, mUserPaddingRight, mUserPaddingBottom); + internalSetPadding(mUserPaddingLeft, mPaddingTop, mUserPaddingRight, mUserPaddingBottom); } /** @@ -11319,9 +11432,13 @@ protected final void onDrawScrollBars(Canvas canvas) { scrollBar.setParameters(computeVerticalScrollRange(), computeVerticalScrollOffset(), computeVerticalScrollExtent(), true); - switch (mVerticalScrollbarPosition) { + int verticalScrollbarPosition = mVerticalScrollbarPosition; + if (verticalScrollbarPosition == SCROLLBAR_POSITION_DEFAULT) { + verticalScrollbarPosition = isLayoutRtl() ? + SCROLLBAR_POSITION_LEFT : SCROLLBAR_POSITION_RIGHT; + } + switch (verticalScrollbarPosition) { default: - case SCROLLBAR_POSITION_DEFAULT: case SCROLLBAR_POSITION_RIGHT: left = scrollX + width - size - (mUserPaddingRight & inside); break; @@ -11424,24 +11541,17 @@ void assignParent(ViewParent parent) { * @see #onDetachedFromWindow() */ protected void onAttachedToWindow() { - if ((mPrivateFlags & REQUEST_TRANSPARENT_REGIONS) != 0) { + if ((mPrivateFlags & PFLAG_REQUEST_TRANSPARENT_REGIONS) != 0) { mParent.requestTransparentRegion(this); } - if ((mPrivateFlags & AWAKEN_SCROLL_BARS_ON_ATTACH) != 0) { + if ((mPrivateFlags & PFLAG_AWAKEN_SCROLL_BARS_ON_ATTACH) != 0) { initialAwakenScrollBars(); - mPrivateFlags &= ~AWAKEN_SCROLL_BARS_ON_ATTACH; + mPrivateFlags &= ~PFLAG_AWAKEN_SCROLL_BARS_ON_ATTACH; } jumpDrawablesToCurrentState(); - // Order is important here: LayoutDirection MUST be resolved before Padding - // and TextDirection - resolveLayoutDirection(); - resolvePadding(); - resolveTextDirection(); - resolveTextAlignment(); - clearAccessibilityFocus(); if (isFocused()) { InputMethodManager imm = InputMethodManager.peekInstance(); @@ -11453,6 +11563,48 @@ protected void onAttachedToWindow() { } } + /** + * Resolve all RTL related properties. + * + * @hide + */ + public void resolveRtlPropertiesIfNeeded() { + if (!needRtlPropertiesResolution()) return; + + // Order is important here: LayoutDirection MUST be resolved first + if (!isLayoutDirectionResolved()) { + resolveLayoutDirection(); + resolveLayoutParams(); + } + // ... then we can resolve the others properties depending on the resolved LayoutDirection. + if (!isTextDirectionResolved()) { + resolveTextDirection(); + } + if (!isTextAlignmentResolved()) { + resolveTextAlignment(); + } + if (!isPaddingResolved()) { + resolvePadding(); + } + if (!isDrawablesResolved()) { + resolveDrawables(); + } + onRtlPropertiesChanged(getLayoutDirection()); + } + + /** + * Reset resolution of all RTL related properties. + * + * @hide + */ + public void resetRtlProperties() { + resetResolvedLayoutDirection(); + resetResolvedTextDirection(); + resetResolvedTextAlignment(); + resetResolvedPadding(); + resetResolvedDrawables(); + } + /** * @see #onScreenStateChanged(int) */ @@ -11479,37 +11631,75 @@ private boolean hasRtlSupport() { return mContext.getApplicationInfo().hasRtlSupport(); } + /** + * Return true if we are in RTL compatibility mode (either before Jelly Bean MR1 or + * RTL not supported) + */ + private boolean isRtlCompatibilityMode() { + final int targetSdkVersion = getContext().getApplicationInfo().targetSdkVersion; + return targetSdkVersion < JELLY_BEAN_MR1 || !hasRtlSupport(); + } + + /** + * @return true if RTL properties need resolution. + */ + private boolean needRtlPropertiesResolution() { + return (mPrivateFlags2 & ALL_RTL_PROPERTIES_RESOLVED) != ALL_RTL_PROPERTIES_RESOLVED; + } + + /** + * Called when any RTL property (layout direction or text direction or text alignment) has + * been changed. + * + * Subclasses need to override this method to take care of cached information that depends on the + * resolved layout direction, or to inform child views that inherit their layout direction. + * + * The default implementation does nothing. + * + * @param layoutDirection the direction of the layout + * + * @see #LAYOUT_DIRECTION_LTR + * @see #LAYOUT_DIRECTION_RTL + */ + public void onRtlPropertiesChanged(int layoutDirection) { + } + /** * Resolve and cache the layout direction. LTR is set initially. This is implicitly supposing * that the parent directionality can and will be resolved before its children. - * Will call {@link View#onResolvedLayoutDirectionChanged} when resolution is done. + * + * @return true if resolution has been done, false otherwise. + * * @hide */ - public void resolveLayoutDirection() { + public boolean resolveLayoutDirection() { // Clear any previous layout direction resolution - mPrivateFlags2 &= ~LAYOUT_DIRECTION_RESOLVED_MASK; + mPrivateFlags2 &= ~PFLAG2_LAYOUT_DIRECTION_RESOLVED_MASK; if (hasRtlSupport()) { // Set resolved depending on layout direction - switch (getLayoutDirection()) { + switch ((mPrivateFlags2 & PFLAG2_LAYOUT_DIRECTION_MASK) >> + PFLAG2_LAYOUT_DIRECTION_MASK_SHIFT) { case LAYOUT_DIRECTION_INHERIT: - // If this is root view, no need to look at parent's layout dir. - if (canResolveLayoutDirection()) { - ViewGroup viewGroup = ((ViewGroup) mParent); + // We cannot resolve yet. LTR is by default and let the resolution happen again + // later to get the correct resolved value + if (!canResolveLayoutDirection()) return false; - if (viewGroup.getResolvedLayoutDirection() == LAYOUT_DIRECTION_RTL) { - mPrivateFlags2 |= LAYOUT_DIRECTION_RESOLVED_RTL; - } - } else { - // Nothing to do, LTR by default + View parent = ((View) mParent); + // Parent has not yet resolved, LTR is still the default + if (!parent.isLayoutDirectionResolved()) return false; + + if (parent.getLayoutDirection() == LAYOUT_DIRECTION_RTL) { + mPrivateFlags2 |= PFLAG2_LAYOUT_DIRECTION_RESOLVED_RTL; } break; case LAYOUT_DIRECTION_RTL: - mPrivateFlags2 |= LAYOUT_DIRECTION_RESOLVED_RTL; + mPrivateFlags2 |= PFLAG2_LAYOUT_DIRECTION_RESOLVED_RTL; break; case LAYOUT_DIRECTION_LOCALE: - if(isLayoutDirectionRtl(Locale.getDefault())) { - mPrivateFlags2 |= LAYOUT_DIRECTION_RESOLVED_RTL; + if((LAYOUT_DIRECTION_RTL == + TextUtils.getLayoutDirectionFromLocale(Locale.getDefault()))) { + mPrivateFlags2 |= PFLAG2_LAYOUT_DIRECTION_RESOLVED_RTL; } break; default: @@ -11518,137 +11708,115 @@ public void resolveLayoutDirection() { } // Set to resolved - mPrivateFlags2 |= LAYOUT_DIRECTION_RESOLVED; - onResolvedLayoutDirectionChanged(); - // Resolve padding - resolvePadding(); + mPrivateFlags2 |= PFLAG2_LAYOUT_DIRECTION_RESOLVED; + return true; } /** - * Called when layout direction has been resolved. + * Check if layout direction resolution can be done. + * + * @return true if layout direction resolution can be done otherwise return false. * - * The default implementation does nothing. * @hide */ - public void onResolvedLayoutDirectionChanged() { + public boolean canResolveLayoutDirection() { + switch (getRawLayoutDirection()) { + case LAYOUT_DIRECTION_INHERIT: + return (mParent != null) && (mParent instanceof ViewGroup) && + ((ViewGroup) mParent).canResolveLayoutDirection(); + default: + return true; + } } /** - * Resolve padding depending on layout direction. + * Reset the resolved layout direction. Layout direction will be resolved during a call to + * {@link #onMeasure(int, int)}. + * * @hide */ - public void resolvePadding() { - // If the user specified the absolute padding (either with android:padding or - // android:paddingLeft/Top/Right/Bottom), use this padding, otherwise - // use the default padding or the padding from the background drawable - // (stored at this point in mPadding*) - int resolvedLayoutDirection = getResolvedLayoutDirection(); - switch (resolvedLayoutDirection) { - case LAYOUT_DIRECTION_RTL: - // Start user padding override Right user padding. Otherwise, if Right user - // padding is not defined, use the default Right padding. If Right user padding - // is defined, just use it. - if (mUserPaddingStart >= 0) { - mUserPaddingRight = mUserPaddingStart; - } else if (mUserPaddingRight < 0) { - mUserPaddingRight = mPaddingRight; - } - if (mUserPaddingEnd >= 0) { - mUserPaddingLeft = mUserPaddingEnd; - } else if (mUserPaddingLeft < 0) { - mUserPaddingLeft = mPaddingLeft; - } - break; - case LAYOUT_DIRECTION_LTR: - default: - // Start user padding override Left user padding. Otherwise, if Left user - // padding is not defined, use the default left padding. If Left user padding - // is defined, just use it. - if (mUserPaddingStart >= 0) { - mUserPaddingLeft = mUserPaddingStart; - } else if (mUserPaddingLeft < 0) { - mUserPaddingLeft = mPaddingLeft; - } - if (mUserPaddingEnd >= 0) { - mUserPaddingRight = mUserPaddingEnd; - } else if (mUserPaddingRight < 0) { - mUserPaddingRight = mPaddingRight; - } - } - - mUserPaddingBottom = (mUserPaddingBottom >= 0) ? mUserPaddingBottom : mPaddingBottom; - - if(isPaddingRelative()) { - setPaddingRelative(mUserPaddingStart, mPaddingTop, mUserPaddingEnd, mUserPaddingBottom); - } else { - recomputePadding(); - } - onPaddingChanged(resolvedLayoutDirection); + public void resetResolvedLayoutDirection() { + // Reset the current resolved bits + mPrivateFlags2 &= ~PFLAG2_LAYOUT_DIRECTION_RESOLVED_MASK; } /** - * Resolve padding depending on the layout direction. Subclasses that care about - * padding resolution should override this method. The default implementation does - * nothing. + * @return true if the layout direction is inherited. * - * @param layoutDirection the direction of the layout - * - * @see {@link #LAYOUT_DIRECTION_LTR} - * @see {@link #LAYOUT_DIRECTION_RTL} * @hide */ - public void onPaddingChanged(int layoutDirection) { + public boolean isLayoutDirectionInherited() { + return (getRawLayoutDirection() == LAYOUT_DIRECTION_INHERIT); } /** - * Check if layout direction resolution can be done. - * - * @return true if layout direction resolution can be done otherwise return false. - * @hide + * @return true if layout direction has been resolved. */ - public boolean canResolveLayoutDirection() { - switch (getLayoutDirection()) { - case LAYOUT_DIRECTION_INHERIT: - return (mParent != null) && (mParent instanceof ViewGroup); - default: - return true; - } + private boolean isLayoutDirectionResolved() { + return (mPrivateFlags2 & PFLAG2_LAYOUT_DIRECTION_RESOLVED) == PFLAG2_LAYOUT_DIRECTION_RESOLVED; } /** - * Reset the resolved layout direction. Will call {@link View#onResolvedLayoutDirectionReset} - * when reset is done. + * Return if padding has been resolved + * * @hide */ - public void resetResolvedLayoutDirection() { - // Reset the current resolved bits - mPrivateFlags2 &= ~LAYOUT_DIRECTION_RESOLVED_MASK; - onResolvedLayoutDirectionReset(); - // Reset also the text direction - resetResolvedTextDirection(); + boolean isPaddingResolved() { + return (mPrivateFlags2 & PFLAG2_PADDING_RESOLVED) == PFLAG2_PADDING_RESOLVED; } /** - * Called during reset of resolved layout direction. - * - * Subclasses need to override this method to clear cached information that depends on the - * resolved layout direction, or to inform child views that inherit their layout direction. + * Resolve padding depending on layout direction. * - * The default implementation does nothing. * @hide */ - public void onResolvedLayoutDirectionReset() { + public void resolvePadding() { + if (!isRtlCompatibilityMode()) { + // Post Jelly Bean MR1 case: we need to take the resolved layout direction into account. + // If start / end padding are defined, they will be resolved (hence overriding) to + // left / right or right / left depending on the resolved layout direction. + // If start / end padding are not defined, use the left / right ones. + int resolvedLayoutDirection = getLayoutDirection(); + // Set user padding to initial values ... + mUserPaddingLeft = mUserPaddingLeftInitial; + mUserPaddingRight = mUserPaddingRightInitial; + // ... then resolve it. + switch (resolvedLayoutDirection) { + case LAYOUT_DIRECTION_RTL: + if (mUserPaddingStart != UNDEFINED_PADDING) { + mUserPaddingRight = mUserPaddingStart; + } + if (mUserPaddingEnd != UNDEFINED_PADDING) { + mUserPaddingLeft = mUserPaddingEnd; + } + break; + case LAYOUT_DIRECTION_LTR: + default: + if (mUserPaddingStart != UNDEFINED_PADDING) { + mUserPaddingLeft = mUserPaddingStart; + } + if (mUserPaddingEnd != UNDEFINED_PADDING) { + mUserPaddingRight = mUserPaddingEnd; + } + } + + mUserPaddingBottom = (mUserPaddingBottom >= 0) ? mUserPaddingBottom : mPaddingBottom; + + internalSetPadding(mUserPaddingLeft, mPaddingTop, mUserPaddingRight, + mUserPaddingBottom); + onRtlPropertiesChanged(resolvedLayoutDirection); + } + + mPrivateFlags2 |= PFLAG2_PADDING_RESOLVED; } /** - * Check if a Locale uses an RTL script. + * Reset the resolved layout direction. * - * @param locale Locale to check - * @return true if the Locale uses an RTL script. * @hide */ - protected static boolean isLayoutDirectionRtl(Locale locale) { - return (LAYOUT_DIRECTION_RTL == LocaleUtil.getLayoutDirectionFromLocale(locale)); + public void resetResolvedPadding() { + mPrivateFlags2 &= ~PFLAG2_PADDING_RESOLVED; } /** @@ -11658,7 +11826,7 @@ protected static boolean isLayoutDirectionRtl(Locale locale) { * @see #onAttachedToWindow() */ protected void onDetachedFromWindow() { - mPrivateFlags &= ~CANCEL_NEXT_UP_EVENT; + mPrivateFlags &= ~PFLAG_CANCEL_NEXT_UP_EVENT; removeUnsetPressCallback(); removeLongPressCallback(); @@ -11681,8 +11849,8 @@ protected void onDetachedFromWindow() { mCurrentAnimation = null; - resetResolvedLayoutDirection(); - resetResolvedTextAlignment(); + resetRtlProperties(); + onRtlPropertiesChanged(LAYOUT_DIRECTION_DEFAULT); resetAccessibilityStateChanged(); } @@ -11724,6 +11892,15 @@ public IBinder getApplicationWindowToken() { return null; } + /** + * Gets the logical display to which the view's window has been attached. + * + * @return The logical display, or null if the view is not currently attached to a window. + */ + public Display getDisplay() { + return mAttachInfo != null ? mAttachInfo.mDisplay : null; + } + /** * Retrieve private session object this view hierarchy is using to * communicate with the window manager. @@ -11742,14 +11919,14 @@ void dispatchAttachedToWindow(AttachInfo info, int visibility) { mAttachInfo = info; mWindowAttachCount++; // We will need to evaluate the drawable state at least once. - mPrivateFlags |= DRAWABLE_STATE_DIRTY; + mPrivateFlags |= PFLAG_DRAWABLE_STATE_DIRTY; if (mFloatingTreeObserver != null) { info.mTreeObserver.merge(mFloatingTreeObserver); mFloatingTreeObserver = null; } - if ((mPrivateFlags&SCROLL_CONTAINER) != 0) { + if ((mPrivateFlags&PFLAG_SCROLL_CONTAINER) != 0) { mAttachInfo.mScrollContainers.add(this); - mPrivateFlags |= SCROLL_CONTAINER_ADDED; + mPrivateFlags |= PFLAG_SCROLL_CONTAINER_ADDED; } performCollectViewAttributes(mAttachInfo, visibility); onAttachedToWindow(); @@ -11771,10 +11948,11 @@ void dispatchAttachedToWindow(AttachInfo info, int visibility) { if (vis != GONE) { onWindowVisibilityChanged(vis); } - if ((mPrivateFlags&DRAWABLE_STATE_DIRTY) != 0) { + if ((mPrivateFlags&PFLAG_DRAWABLE_STATE_DIRTY) != 0) { // If nobody has evaluated the drawable state yet, then do it now. refreshDrawableState(); } + needGlobalAttributesUpdate(false); } void dispatchDetachedFromWindow() { @@ -11801,9 +11979,9 @@ void dispatchDetachedFromWindow() { } } - if ((mPrivateFlags & SCROLL_CONTAINER_ADDED) != 0) { + if ((mPrivateFlags & PFLAG_SCROLL_CONTAINER_ADDED) != 0) { mAttachInfo.mScrollContainers.remove(this); - mPrivateFlags &= ~SCROLL_CONTAINER_ADDED; + mPrivateFlags &= ~PFLAG_SCROLL_CONTAINER_ADDED; } mAttachInfo = null; @@ -11835,9 +12013,9 @@ public void saveHierarchyState(SparseArray container) { */ protected void dispatchSaveInstanceState(SparseArray container) { if (mID != NO_ID && (mViewFlags & SAVE_DISABLED_MASK) == 0) { - mPrivateFlags &= ~SAVE_STATE_CALLED; + mPrivateFlags &= ~PFLAG_SAVE_STATE_CALLED; Parcelable state = onSaveInstanceState(); - if ((mPrivateFlags & SAVE_STATE_CALLED) == 0) { + if ((mPrivateFlags & PFLAG_SAVE_STATE_CALLED) == 0) { throw new IllegalStateException( "Derived class did not call super.onSaveInstanceState()"); } @@ -11871,7 +12049,7 @@ protected void dispatchSaveInstanceState(SparseArray container) { * @see #setSaveEnabled(boolean) */ protected Parcelable onSaveInstanceState() { - mPrivateFlags |= SAVE_STATE_CALLED; + mPrivateFlags |= PFLAG_SAVE_STATE_CALLED; return BaseSavedState.EMPTY_STATE; } @@ -11906,9 +12084,9 @@ protected void dispatchRestoreInstanceState(SparseArray container) { if (state != null) { // Log.i("View", "Restoreing #" + Integer.toHexString(mID) // + ": " + state); - mPrivateFlags &= ~SAVE_STATE_CALLED; + mPrivateFlags &= ~PFLAG_SAVE_STATE_CALLED; onRestoreInstanceState(state); - if ((mPrivateFlags & SAVE_STATE_CALLED) == 0) { + if ((mPrivateFlags & PFLAG_SAVE_STATE_CALLED) == 0) { throw new IllegalStateException( "Derived class did not call super.onRestoreInstanceState()"); } @@ -11929,7 +12107,7 @@ protected void dispatchRestoreInstanceState(SparseArray container) { * @see #dispatchRestoreInstanceState(android.util.SparseArray) */ protected void onRestoreInstanceState(Parcelable state) { - mPrivateFlags |= SAVE_STATE_CALLED; + mPrivateFlags |= PFLAG_SAVE_STATE_CALLED; if (state != BaseSavedState.EMPTY_STATE && state != null) { throw new IllegalArgumentException("Wrong state class, expecting View State but " + "received " + state.getClass().toString() + " instead. This usually happens " @@ -12004,13 +12182,13 @@ public boolean isDuplicateParentStateEnabled() { * {@link #setAlpha(float)}, the alpha value of the layer's paint is replaced by * this view's alpha value. Calling {@link #setAlpha(float)} is therefore * equivalent to setting a hardware layer on this view and providing a paint with - * the desired alpha value.

          + * the desired alpha value.

          * *

          Refer to the documentation of {@link #LAYER_TYPE_NONE disabled}, * {@link #LAYER_TYPE_SOFTWARE software} and {@link #LAYER_TYPE_HARDWARE hardware} * for more information on when and how to use layers.

          * - * @param layerType The ype of layer to use with this view, must be one of + * @param layerType The type of layer to use with this view, must be one of * {@link #LAYER_TYPE_NONE}, {@link #LAYER_TYPE_SOFTWARE} or * {@link #LAYER_TYPE_HARDWARE} * @param paint The paint used to compose the layer. This argument is optional @@ -12061,6 +12239,50 @@ public void setLayerType(int layerType, Paint paint) { invalidate(true); } + /** + * Updates the {@link Paint} object used with the current layer (used only if the current + * layer type is not set to {@link #LAYER_TYPE_NONE}). Changed properties of the Paint + * provided to {@link #setLayerType(int, android.graphics.Paint)} will be used the next time + * the View is redrawn, but {@link #setLayerPaint(android.graphics.Paint)} must be called to + * ensure that the view gets redrawn immediately. + * + *

          A layer is associated with an optional {@link android.graphics.Paint} + * instance that controls how the layer is composed on screen. The following + * properties of the paint are taken into account when composing the layer:

          + *
            + *
          • {@link android.graphics.Paint#getAlpha() Translucency (alpha)}
          • + *
          • {@link android.graphics.Paint#getXfermode() Blending mode}
          • + *
          • {@link android.graphics.Paint#getColorFilter() Color filter}
          • + *
          + * + *

          If this view has an alpha value set to < 1.0 by calling + * {@link #setAlpha(float)}, the alpha value of the layer's paint is replaced by + * this view's alpha value. Calling {@link #setAlpha(float)} is therefore + * equivalent to setting a hardware layer on this view and providing a paint with + * the desired alpha value.

          + * + * @param paint The paint used to compose the layer. This argument is optional + * and can be null. It is ignored when the layer type is + * {@link #LAYER_TYPE_NONE} + * + * @see #setLayerType(int, android.graphics.Paint) + */ + public void setLayerPaint(Paint paint) { + int layerType = getLayerType(); + if (layerType != LAYER_TYPE_NONE) { + mLayerPaint = paint == null ? new Paint() : paint; + if (layerType == LAYER_TYPE_HARDWARE) { + HardwareLayer layer = getHardwareLayer(); + if (layer != null) { + layer.setLayerPaint(paint); + } + invalidateViewProperty(false, false); + } else { + invalidate(); + } + } + } + /** * Indicates whether this view has a static layer. A view with layer type * {@link #LAYER_TYPE_NONE} is a static layer. Other types of layers are @@ -12123,13 +12345,6 @@ public void buildLayer() { } } - // Make sure the HardwareRenderer.validate() was invoked before calling this method - void flushLayer() { - if (mLayerType == LAYER_TYPE_HARDWARE && mHardwareLayer != null) { - mHardwareLayer.flush(); - } - } - /** *

          Returns a hardware layer that can be used to draw this view again * without executing its draw method.

          @@ -12151,14 +12366,30 @@ HardwareLayer getHardwareLayer() { return null; } - if ((mPrivateFlags & DRAWING_CACHE_VALID) == 0 || mHardwareLayer == null) { + if ((mPrivateFlags & PFLAG_DRAWING_CACHE_VALID) == 0 || mHardwareLayer == null) { if (mHardwareLayer == null) { mHardwareLayer = mAttachInfo.mHardwareRenderer.createHardwareLayer( width, height, isOpaque()); mLocalDirtyRect.set(0, 0, width, height); - } else if (mHardwareLayer.getWidth() != width || mHardwareLayer.getHeight() != height) { - mHardwareLayer.resize(width, height); - mLocalDirtyRect.set(0, 0, width, height); + } else { + if (mHardwareLayer.getWidth() != width || mHardwareLayer.getHeight() != height) { + if (mHardwareLayer.resize(width, height)) { + mLocalDirtyRect.set(0, 0, width, height); + } + } + + // This should not be necessary but applications that change + // the parameters of their background drawable without calling + // this.setBackground(Drawable) can leave the view in a bad state + // (for instance isOpaque() returns true, but the background is + // not opaque.) + computeOpaqueFlags(); + + final boolean opaque = isOpaque(); + if (mHardwareLayer.isValid() && mHardwareLayer.isOpaque() != opaque) { + mHardwareLayer.setOpaque(opaque); + mLocalDirtyRect.set(0, 0, width, height); + } } // The layer is not valid if the underlying GPU resources cannot be allocated @@ -12166,7 +12397,11 @@ HardwareLayer getHardwareLayer() { return null; } - mHardwareLayer.redraw(getHardwareLayerDisplayList(mHardwareLayer), mLocalDirtyRect); + mHardwareLayer.setLayerPaint(mLayerPaint); + mHardwareLayer.redrawLater(getHardwareLayerDisplayList(mHardwareLayer), mLocalDirtyRect); + ViewRootImpl viewRoot = getViewRootImpl(); + if (viewRoot != null) viewRoot.pushHardwareLayerUpdate(mHardwareLayer); + mLocalDirtyRect.setEmpty(); } @@ -12190,6 +12425,9 @@ boolean destroyLayer(boolean valid) { mHardwareLayer.destroy(); mHardwareLayer = null; + if (mDisplayList != null) { + mDisplayList.reset(); + } invalidate(true); invalidateParentCaches(); } @@ -12266,10 +12504,10 @@ public boolean isDrawingCacheEnabled() { */ @SuppressWarnings({"UnusedDeclaration"}) public void outputDirtyFlags(String indent, boolean clear, int clearMask) { - Log.d("View", indent + this + " DIRTY(" + (mPrivateFlags & View.DIRTY_MASK) + - ") DRAWN(" + (mPrivateFlags & DRAWN) + ")" + " CACHE_VALID(" + - (mPrivateFlags & View.DRAWING_CACHE_VALID) + - ") INVALIDATED(" + (mPrivateFlags & INVALIDATED) + ")"); + Log.d("View", indent + this + " DIRTY(" + (mPrivateFlags & View.PFLAG_DIRTY_MASK) + + ") DRAWN(" + (mPrivateFlags & PFLAG_DRAWN) + ")" + " CACHE_VALID(" + + (mPrivateFlags & View.PFLAG_DRAWING_CACHE_VALID) + + ") INVALIDATED(" + (mPrivateFlags & PFLAG_INVALIDATED) + ")"); if (clear) { mPrivateFlags &= clearMask; } @@ -12333,15 +12571,15 @@ private DisplayList getDisplayList(DisplayList displayList, boolean isLayer) { return null; } - if (((mPrivateFlags & DRAWING_CACHE_VALID) == 0 || + if (((mPrivateFlags & PFLAG_DRAWING_CACHE_VALID) == 0 || displayList == null || !displayList.isValid() || (!isLayer && mRecreateDisplayList))) { // Don't need to recreate the display list, just need to tell our // children to restore/recreate theirs if (displayList != null && displayList.isValid() && !isLayer && !mRecreateDisplayList) { - mPrivateFlags |= DRAWN | DRAWING_CACHE_VALID; - mPrivateFlags &= ~DIRTY_MASK; + mPrivateFlags |= PFLAG_DRAWN | PFLAG_DRAWING_CACHE_VALID; + mPrivateFlags &= ~PFLAG_DIRTY_MASK; dispatchGetDisplayList(); return displayList; @@ -12370,9 +12608,7 @@ private DisplayList getDisplayList(DisplayList displayList, boolean isLayer) { canvas.setViewport(width, height); // The dirty rect should always be null for a display list canvas.onPreDraw(null); - int layerType = ( - !(mParent instanceof ViewGroup) || ((ViewGroup)mParent).mDrawLayers) ? - getLayerType() : LAYER_TYPE_NONE; + int layerType = getLayerType(); if (!isLayer && layerType != LAYER_TYPE_NONE) { if (layerType == LAYER_TYPE_HARDWARE) { final HardwareLayer layer = getHardwareLayer(); @@ -12398,12 +12634,12 @@ private DisplayList getDisplayList(DisplayList displayList, boolean isLayer) { canvas.translate(-mScrollX, -mScrollY); if (!isLayer) { - mPrivateFlags |= DRAWN | DRAWING_CACHE_VALID; - mPrivateFlags &= ~DIRTY_MASK; + mPrivateFlags |= PFLAG_DRAWN | PFLAG_DRAWING_CACHE_VALID; + mPrivateFlags &= ~PFLAG_DIRTY_MASK; } // Fast path for layouts with no backgrounds - if ((mPrivateFlags & SKIP_DRAW) == SKIP_DRAW) { + if ((mPrivateFlags & PFLAG_SKIP_DRAW) == PFLAG_SKIP_DRAW) { dispatchDraw(canvas); } else { draw(canvas); @@ -12421,8 +12657,8 @@ private DisplayList getDisplayList(DisplayList displayList, boolean isLayer) { } } } else if (!isLayer) { - mPrivateFlags |= DRAWN | DRAWING_CACHE_VALID; - mPrivateFlags &= ~DIRTY_MASK; + mPrivateFlags |= PFLAG_DRAWN | PFLAG_DRAWING_CACHE_VALID; + mPrivateFlags &= ~PFLAG_DIRTY_MASK; } return displayList; @@ -12544,7 +12780,7 @@ public void destroyDrawingCache() { public void setDrawingCacheBackgroundColor(int color) { if (color != mDrawingCacheBackgroundColor) { mDrawingCacheBackgroundColor = color; - mPrivateFlags &= ~DRAWING_CACHE_VALID; + mPrivateFlags &= ~PFLAG_DRAWING_CACHE_VALID; } } @@ -12590,7 +12826,7 @@ public void buildDrawingCache() { * @see #destroyDrawingCache() */ public void buildDrawingCache(boolean autoScale) { - if ((mPrivateFlags & DRAWING_CACHE_VALID) == 0 || (autoScale ? + if ((mPrivateFlags & PFLAG_DRAWING_CACHE_VALID) == 0 || (autoScale ? mDrawingCache == null : mUnscaledDrawingCache == null)) { mCachingFailed = false; @@ -12609,10 +12845,15 @@ public void buildDrawingCache(boolean autoScale) { final boolean opaque = drawingCacheBackgroundColor != 0 || isOpaque(); final boolean use32BitCache = attachInfo != null && attachInfo.mUse32BitDrawingCache; - if (width <= 0 || height <= 0 || - // Projected bitmap size in bytes - (width * height * (opaque && !use32BitCache ? 2 : 4) > - ViewConfiguration.get(mContext).getScaledMaximumDrawingCacheSize())) { + final long projectedBitmapSize = width * height * (opaque && !use32BitCache ? 2 : 4); + final long drawingCacheSize = + ViewConfiguration.get(mContext).getScaledMaximumDrawingCacheSize(); + if (width <= 0 || height <= 0 || projectedBitmapSize > drawingCacheSize) { + if (width > 0 && height > 0) { + Log.w(VIEW_LOG_TAG, "View too large to fit into drawing cache, needs " + + projectedBitmapSize + " bytes, only " + + drawingCacheSize + " available"); + } destroyDrawingCache(); mCachingFailed = true; return; @@ -12650,7 +12891,8 @@ public void buildDrawingCache(boolean autoScale) { if (bitmap != null) bitmap.recycle(); try { - bitmap = Bitmap.createBitmap(width, height, quality); + bitmap = Bitmap.createBitmap(mResources.getDisplayMetrics(), + width, height, quality); bitmap.setDensity(getResources().getDisplayMetrics().densityDpi); if (autoScale) { mDrawingCache = bitmap; @@ -12705,15 +12947,15 @@ public void buildDrawingCache(boolean autoScale) { canvas.translate(-mScrollX, -mScrollY); - mPrivateFlags |= DRAWN; + mPrivateFlags |= PFLAG_DRAWN; if (mAttachInfo == null || !mAttachInfo.mHardwareAccelerated || mLayerType != LAYER_TYPE_NONE) { - mPrivateFlags |= DRAWING_CACHE_VALID; + mPrivateFlags |= PFLAG_DRAWING_CACHE_VALID; } // Fast path for layouts with no backgrounds - if ((mPrivateFlags & SKIP_DRAW) == SKIP_DRAW) { - mPrivateFlags &= ~DIRTY_MASK; + if ((mPrivateFlags & PFLAG_SKIP_DRAW) == PFLAG_SKIP_DRAW) { + mPrivateFlags &= ~PFLAG_DIRTY_MASK; dispatchDraw(canvas); } else { draw(canvas); @@ -12742,7 +12984,8 @@ Bitmap createSnapshot(Bitmap.Config quality, int backgroundColor, boolean skipCh width = (int) ((width * scale) + 0.5f); height = (int) ((height * scale) + 0.5f); - Bitmap bitmap = Bitmap.createBitmap(width > 0 ? width : 1, height > 0 ? height : 1, quality); + Bitmap bitmap = Bitmap.createBitmap(mResources.getDisplayMetrics(), + width > 0 ? width : 1, height > 0 ? height : 1, quality); if (bitmap == null) { throw new OutOfMemoryError(); } @@ -12780,10 +13023,10 @@ Bitmap createSnapshot(Bitmap.Config quality, int backgroundColor, boolean skipCh // Temporarily remove the dirty mask int flags = mPrivateFlags; - mPrivateFlags &= ~DIRTY_MASK; + mPrivateFlags &= ~PFLAG_DIRTY_MASK; // Fast path for layouts with no backgrounds - if ((mPrivateFlags & SKIP_DRAW) == SKIP_DRAW) { + if ((mPrivateFlags & PFLAG_SKIP_DRAW) == PFLAG_SKIP_DRAW) { dispatchDraw(canvas); } else { draw(canvas); @@ -12967,13 +13210,13 @@ private boolean drawAnimation(ViewGroup parent, long drawingTime, if (more) { if (!a.willChangeBounds()) { - if ((flags & (parent.FLAG_OPTIMIZE_INVALIDATE | parent.FLAG_ANIMATION_DONE)) == - parent.FLAG_OPTIMIZE_INVALIDATE) { - parent.mGroupFlags |= parent.FLAG_INVALIDATE_REQUIRED; - } else if ((flags & parent.FLAG_INVALIDATE_REQUIRED) == 0) { + if ((flags & (ViewGroup.FLAG_OPTIMIZE_INVALIDATE | ViewGroup.FLAG_ANIMATION_DONE)) == + ViewGroup.FLAG_OPTIMIZE_INVALIDATE) { + parent.mGroupFlags |= ViewGroup.FLAG_INVALIDATE_REQUIRED; + } else if ((flags & ViewGroup.FLAG_INVALIDATE_REQUIRED) == 0) { // The child need to draw an animation, potentially offscreen, so // make sure we do not cancel invalidate requests - parent.mPrivateFlags |= DRAW_ANIMATION; + parent.mPrivateFlags |= PFLAG_DRAW_ANIMATION; parent.invalidate(mLeft, mTop, mRight, mBottom); } } else { @@ -12986,7 +13229,7 @@ private boolean drawAnimation(ViewGroup parent, long drawingTime, // The child need to draw an animation, potentially offscreen, so // make sure we do not cancel invalidate requests - parent.mPrivateFlags |= DRAW_ANIMATION; + parent.mPrivateFlags |= PFLAG_DRAW_ANIMATION; final int left = mLeft + (int) region.left; final int top = mTop + (int) region.top; @@ -13048,7 +13291,7 @@ void setDisplayListProperties(DisplayList displayList) { mTransformationInfo.matrix3D = new Matrix(); } displayList.setCameraDistance(mTransformationInfo.mCamera.getLocationZ()); - if ((mPrivateFlags & PIVOT_EXPLICITLY_SET) == PIVOT_EXPLICITLY_SET) { + if ((mPrivateFlags & PFLAG_PIVOT_EXPLICITLY_SET) == PFLAG_PIVOT_EXPLICITLY_SET) { displayList.setPivotX(getPivotX()); displayList.setPivotY(getPivotY()); } @@ -13079,7 +13322,7 @@ boolean draw(Canvas canvas, ViewGroup parent, long drawingTime) { boolean scalingRequired = false; boolean caching; - int layerType = parent.mDrawLayers ? getLayerType() : LAYER_TYPE_NONE; + int layerType = getLayerType(); final boolean hardwareAccelerated = canvas.isHardwareAccelerated(); if ((flags & ViewGroup.FLAG_CHILDREN_DRAWN_WITH_CACHE) != 0 || @@ -13096,15 +13339,15 @@ boolean draw(Canvas canvas, ViewGroup parent, long drawingTime) { more = drawAnimation(parent, drawingTime, a, scalingRequired); concatMatrix = a.willChangeTransformationMatrix(); if (concatMatrix) { - mPrivateFlags3 |= VIEW_IS_ANIMATING_TRANSFORM; + mPrivateFlags3 |= PFLAG3_VIEW_IS_ANIMATING_TRANSFORM; } transformToApply = parent.mChildTransformation; } else { - if ((mPrivateFlags3 & VIEW_IS_ANIMATING_TRANSFORM) == VIEW_IS_ANIMATING_TRANSFORM && + if ((mPrivateFlags3 & PFLAG3_VIEW_IS_ANIMATING_TRANSFORM) == PFLAG3_VIEW_IS_ANIMATING_TRANSFORM && mDisplayList != null) { // No longer animating: clear out old animation matrix mDisplayList.setAnimationMatrix(null); - mPrivateFlags3 &= ~VIEW_IS_ANIMATING_TRANSFORM; + mPrivateFlags3 &= ~PFLAG3_VIEW_IS_ANIMATING_TRANSFORM; } if (!useDisplayListProperties && (flags & ViewGroup.FLAG_SUPPORT_STATIC_TRANSFORMATIONS) != 0) { @@ -13123,27 +13366,25 @@ boolean draw(Canvas canvas, ViewGroup parent, long drawingTime) { // Sets the flag as early as possible to allow draw() implementations // to call invalidate() successfully when doing animations - mPrivateFlags |= DRAWN; - - if (!concatMatrix && canvas.quickReject(mLeft, mTop, mRight, mBottom, Canvas.EdgeType.BW) && - (mPrivateFlags & DRAW_ANIMATION) == 0) { - mPrivateFlags2 |= VIEW_QUICK_REJECTED; + mPrivateFlags |= PFLAG_DRAWN; + + if (!concatMatrix && + (flags & (ViewGroup.FLAG_SUPPORT_STATIC_TRANSFORMATIONS | + ViewGroup.FLAG_CLIP_CHILDREN)) == ViewGroup.FLAG_CLIP_CHILDREN && + canvas.quickReject(mLeft, mTop, mRight, mBottom, Canvas.EdgeType.BW) && + (mPrivateFlags & PFLAG_DRAW_ANIMATION) == 0) { + mPrivateFlags2 |= PFLAG2_VIEW_QUICK_REJECTED; return more; } - mPrivateFlags2 &= ~VIEW_QUICK_REJECTED; + mPrivateFlags2 &= ~PFLAG2_VIEW_QUICK_REJECTED; if (hardwareAccelerated) { // Clear INVALIDATED flag to allow invalidation to occur during rendering, but // retain the flag's value temporarily in the mRecreateDisplayList flag - mRecreateDisplayList = (mPrivateFlags & INVALIDATED) == INVALIDATED; - mPrivateFlags &= ~INVALIDATED; + mRecreateDisplayList = (mPrivateFlags & PFLAG_INVALIDATED) == PFLAG_INVALIDATED; + mPrivateFlags &= ~PFLAG_INVALIDATED; } - computeScroll(); - - final int sx = mScrollX; - final int sy = mScrollY; - DisplayList displayList = null; Bitmap cache = null; boolean hasDisplayList = false; @@ -13190,6 +13431,14 @@ boolean draw(Canvas canvas, ViewGroup parent, long drawingTime) { } } + int sx = 0; + int sy = 0; + if (!hasDisplayList) { + computeScroll(); + sx = mScrollX; + sy = mScrollY; + } + final boolean hasNoCache = cache == null || hasDisplayList; final boolean offsetForScroll = cache == null && !hasDisplayList && layerType != LAYER_TYPE_HARDWARE; @@ -13217,7 +13466,7 @@ boolean draw(Canvas canvas, ViewGroup parent, long drawingTime) { float alpha = useDisplayListProperties ? 1 : getAlpha(); if (transformToApply != null || alpha < 1 || !hasIdentityMatrix() || - (mPrivateFlags3 & VIEW_IS_ANIMATING_ALPHA) == VIEW_IS_ANIMATING_ALPHA) { + (mPrivateFlags3 & PFLAG3_VIEW_IS_ANIMATING_ALPHA) == PFLAG3_VIEW_IS_ANIMATING_ALPHA) { if (transformToApply != null || !childHasIdentityMatrix) { int transX = 0; int transY = 0; @@ -13257,11 +13506,11 @@ boolean draw(Canvas canvas, ViewGroup parent, long drawingTime) { // Deal with alpha if it is or used to be <1 if (alpha < 1 || - (mPrivateFlags3 & VIEW_IS_ANIMATING_ALPHA) == VIEW_IS_ANIMATING_ALPHA) { + (mPrivateFlags3 & PFLAG3_VIEW_IS_ANIMATING_ALPHA) == PFLAG3_VIEW_IS_ANIMATING_ALPHA) { if (alpha < 1) { - mPrivateFlags3 |= VIEW_IS_ANIMATING_ALPHA; + mPrivateFlags3 |= PFLAG3_VIEW_IS_ANIMATING_ALPHA; } else { - mPrivateFlags3 &= ~VIEW_IS_ANIMATING_ALPHA; + mPrivateFlags3 &= ~PFLAG3_VIEW_IS_ANIMATING_ALPHA; } parent.mGroupFlags |= ViewGroup.FLAG_CLEAR_TRANSFORMATION; if (hasNoCache) { @@ -13282,13 +13531,13 @@ boolean draw(Canvas canvas, ViewGroup parent, long drawingTime) { } } else { // Alpha is handled by the child directly, clobber the layer's alpha - mPrivateFlags |= ALPHA_SET; + mPrivateFlags |= PFLAG_ALPHA_SET; } } } - } else if ((mPrivateFlags & ALPHA_SET) == ALPHA_SET) { + } else if ((mPrivateFlags & PFLAG_ALPHA_SET) == PFLAG_ALPHA_SET) { onSetAlpha(255); - mPrivateFlags &= ~ALPHA_SET; + mPrivateFlags &= ~PFLAG_ALPHA_SET; } if ((flags & ViewGroup.FLAG_CLIP_CHILDREN) == ViewGroup.FLAG_CLIP_CHILDREN && @@ -13335,19 +13584,19 @@ boolean draw(Canvas canvas, ViewGroup parent, long drawingTime) { if (!layerRendered) { if (!hasDisplayList) { // Fast path for layouts with no backgrounds - if ((mPrivateFlags & SKIP_DRAW) == SKIP_DRAW) { - mPrivateFlags &= ~DIRTY_MASK; + if ((mPrivateFlags & PFLAG_SKIP_DRAW) == PFLAG_SKIP_DRAW) { + mPrivateFlags &= ~PFLAG_DIRTY_MASK; dispatchDraw(canvas); } else { draw(canvas); } } else { - mPrivateFlags &= ~DIRTY_MASK; + mPrivateFlags &= ~PFLAG_DIRTY_MASK; ((HardwareCanvas) canvas).drawDisplayList(displayList, null, flags); } } } else if (cache != null) { - mPrivateFlags &= ~DIRTY_MASK; + mPrivateFlags &= ~PFLAG_DIRTY_MASK; Paint cachePaint; if (layerType == LAYER_TYPE_NONE) { @@ -13387,7 +13636,7 @@ boolean draw(Canvas canvas, ViewGroup parent, long drawingTime) { // display lists to render, force an invalidate to allow the animation to // continue drawing another frame parent.invalidate(true); - if (a.hasAlpha() && (mPrivateFlags & ALPHA_SET) == ALPHA_SET) { + if (a.hasAlpha() && (mPrivateFlags & PFLAG_ALPHA_SET) == PFLAG_ALPHA_SET) { // alpha animations should cause the child to recreate its display list invalidate(true); } @@ -13409,9 +13658,9 @@ boolean draw(Canvas canvas, ViewGroup parent, long drawingTime) { */ public void draw(Canvas canvas) { final int privateFlags = mPrivateFlags; - final boolean dirtyOpaque = (privateFlags & DIRTY_MASK) == DIRTY_OPAQUE && + final boolean dirtyOpaque = (privateFlags & PFLAG_DIRTY_MASK) == PFLAG_DIRTY_OPAQUE && (mAttachInfo == null || !mAttachInfo.mIgnoreDirtyState); - mPrivateFlags = (privateFlags & ~DIRTY_MASK) | DRAWN; + mPrivateFlags = (privateFlags & ~PFLAG_DIRTY_MASK) | PFLAG_DRAWN; /* * Draw traversal performs several drawing steps which must be executed @@ -13666,12 +13915,12 @@ private static String printPrivateFlags(int privateFlags) { String output = ""; int numFlags = 0; - if ((privateFlags & WANTS_FOCUS) == WANTS_FOCUS) { + if ((privateFlags & PFLAG_WANTS_FOCUS) == PFLAG_WANTS_FOCUS) { output += "WANTS_FOCUS"; numFlags++; } - if ((privateFlags & FOCUSED) == FOCUSED) { + if ((privateFlags & PFLAG_FOCUSED) == PFLAG_FOCUSED) { if (numFlags > 0) { output += " "; } @@ -13679,7 +13928,7 @@ private static String printPrivateFlags(int privateFlags) { numFlags++; } - if ((privateFlags & SELECTED) == SELECTED) { + if ((privateFlags & PFLAG_SELECTED) == PFLAG_SELECTED) { if (numFlags > 0) { output += " "; } @@ -13687,7 +13936,7 @@ private static String printPrivateFlags(int privateFlags) { numFlags++; } - if ((privateFlags & IS_ROOT_NAMESPACE) == IS_ROOT_NAMESPACE) { + if ((privateFlags & PFLAG_IS_ROOT_NAMESPACE) == PFLAG_IS_ROOT_NAMESPACE) { if (numFlags > 0) { output += " "; } @@ -13695,7 +13944,7 @@ private static String printPrivateFlags(int privateFlags) { numFlags++; } - if ((privateFlags & HAS_BOUNDS) == HAS_BOUNDS) { + if ((privateFlags & PFLAG_HAS_BOUNDS) == PFLAG_HAS_BOUNDS) { if (numFlags > 0) { output += " "; } @@ -13703,7 +13952,7 @@ private static String printPrivateFlags(int privateFlags) { numFlags++; } - if ((privateFlags & DRAWN) == DRAWN) { + if ((privateFlags & PFLAG_DRAWN) == PFLAG_DRAWN) { if (numFlags > 0) { output += " "; } @@ -13720,7 +13969,7 @@ private static String printPrivateFlags(int privateFlags) { * @return true if the layout will be forced during next layout pass */ public boolean isLayoutRequested() { - return (mPrivateFlags & FORCE_LAYOUT) == FORCE_LAYOUT; + return (mPrivateFlags & PFLAG_FORCE_LAYOUT) == PFLAG_FORCE_LAYOUT; } /** @@ -13750,9 +13999,9 @@ public void layout(int l, int t, int r, int b) { int oldB = mBottom; int oldR = mRight; boolean changed = setFrame(l, t, r, b); - if (changed || (mPrivateFlags & LAYOUT_REQUIRED) == LAYOUT_REQUIRED) { + if (changed || (mPrivateFlags & PFLAG_LAYOUT_REQUIRED) == PFLAG_LAYOUT_REQUIRED) { onLayout(changed, l, t, r, b); - mPrivateFlags &= ~LAYOUT_REQUIRED; + mPrivateFlags &= ~PFLAG_LAYOUT_REQUIRED; ListenerInfo li = mListenerInfo; if (li != null && li.mOnLayoutChangeListeners != null) { @@ -13764,7 +14013,7 @@ public void layout(int l, int t, int r, int b) { } } } - mPrivateFlags &= ~FORCE_LAYOUT; + mPrivateFlags &= ~PFLAG_FORCE_LAYOUT; } /** @@ -13808,7 +14057,7 @@ protected boolean setFrame(int left, int top, int right, int bottom) { changed = true; // Remember our drawn bit - int drawn = mPrivateFlags & DRAWN; + int drawn = mPrivateFlags & PFLAG_DRAWN; int oldWidth = mRight - mLeft; int oldHeight = mBottom - mTop; @@ -13827,11 +14076,11 @@ protected boolean setFrame(int left, int top, int right, int bottom) { mDisplayList.setLeftTopRightBottom(mLeft, mTop, mRight, mBottom); } - mPrivateFlags |= HAS_BOUNDS; + mPrivateFlags |= PFLAG_HAS_BOUNDS; if (sizeChanged) { - if ((mPrivateFlags & PIVOT_EXPLICITLY_SET) == 0) { + if ((mPrivateFlags & PFLAG_PIVOT_EXPLICITLY_SET) == 0) { // A change in dimension means an auto-centered pivot point changes, too if (mTransformationInfo != null) { mTransformationInfo.mMatrixDirty = true; @@ -13846,7 +14095,7 @@ protected boolean setFrame(int left, int top, int right, int bottom) { // This is because someone may have invalidated this view // before this call to setFrame came in, thereby clearing // the DRAWN bit. - mPrivateFlags |= DRAWN; + mPrivateFlags |= PFLAG_DRAWN; invalidate(sizeChanged); // parent display list may need to be recreated based on a change in the bounds // of any child @@ -13951,13 +14200,47 @@ public void unscheduleDrawable(Drawable who) { } /** - * Return the layout direction of a given Drawable. - * - * @param who the Drawable to query - * @hide - */ - public int getResolvedLayoutDirection(Drawable who) { - return (who == mBackground) ? getResolvedLayoutDirection() : LAYOUT_DIRECTION_DEFAULT; + * Resolve the Drawables depending on the layout direction. This is implicitly supposing + * that the View directionality can and will be resolved before its Drawables. + * + * Will call {@link View#onResolveDrawables} when resolution is done. + * + * @hide + */ + protected void resolveDrawables() { + if (canResolveLayoutDirection()) { + if (mBackground != null) { + mBackground.setLayoutDirection(getLayoutDirection()); + } + mPrivateFlags2 |= PFLAG2_DRAWABLE_RESOLVED; + onResolveDrawables(getLayoutDirection()); + } + } + + /** + * Called when layout direction has been resolved. + * + * The default implementation does nothing. + * + * @param layoutDirection The resolved layout direction. + * + * @see #LAYOUT_DIRECTION_LTR + * @see #LAYOUT_DIRECTION_RTL + * + * @hide + */ + public void onResolveDrawables(int layoutDirection) { + } + + /** + * @hide + */ + protected void resetResolvedDrawables() { + mPrivateFlags2 &= ~PFLAG2_DRAWABLE_RESOLVED; + } + + private boolean isDrawablesResolved() { + return (mPrivateFlags2 & PFLAG2_DRAWABLE_RESOLVED) == PFLAG2_DRAWABLE_RESOLVED; } /** @@ -14008,7 +14291,7 @@ protected void drawableStateChanged() { * @see #getDrawableState */ public void refreshDrawableState() { - mPrivateFlags |= DRAWABLE_STATE_DIRTY; + mPrivateFlags |= PFLAG_DRAWABLE_STATE_DIRTY; drawableStateChanged(); ViewParent parent = mParent; @@ -14028,11 +14311,11 @@ public void refreshDrawableState() { * @see #onCreateDrawableState(int) */ public final int[] getDrawableState() { - if ((mDrawableState != null) && ((mPrivateFlags & DRAWABLE_STATE_DIRTY) == 0)) { + if ((mDrawableState != null) && ((mPrivateFlags & PFLAG_DRAWABLE_STATE_DIRTY) == 0)) { return mDrawableState; } else { mDrawableState = onCreateDrawableState(0); - mPrivateFlags &= ~DRAWABLE_STATE_DIRTY; + mPrivateFlags &= ~PFLAG_DRAWABLE_STATE_DIRTY; return mDrawableState; } } @@ -14063,12 +14346,12 @@ protected int[] onCreateDrawableState(int extraSpace) { int privateFlags = mPrivateFlags; int viewStateIndex = 0; - if ((privateFlags & PRESSED) != 0) viewStateIndex |= VIEW_STATE_PRESSED; + if ((privateFlags & PFLAG_PRESSED) != 0) viewStateIndex |= VIEW_STATE_PRESSED; if ((mViewFlags & ENABLED_MASK) == ENABLED) viewStateIndex |= VIEW_STATE_ENABLED; if (isFocused()) viewStateIndex |= VIEW_STATE_FOCUSED; - if ((privateFlags & SELECTED) != 0) viewStateIndex |= VIEW_STATE_SELECTED; + if ((privateFlags & PFLAG_SELECTED) != 0) viewStateIndex |= VIEW_STATE_SELECTED; if (hasWindowFocus()) viewStateIndex |= VIEW_STATE_WINDOW_FOCUSED; - if ((privateFlags & ACTIVATED) != 0) viewStateIndex |= VIEW_STATE_ACTIVATED; + if ((privateFlags & PFLAG_ACTIVATED) != 0) viewStateIndex |= VIEW_STATE_ACTIVATED; if (mAttachInfo != null && mAttachInfo.mHardwareAccelerationRequested && HardwareRenderer.isAvailable()) { // This is set if HW acceleration is requested, even if the current @@ -14076,11 +14359,11 @@ protected int[] onCreateDrawableState(int extraSpace) { // windows to better match their app. viewStateIndex |= VIEW_STATE_ACCELERATED; } - if ((privateFlags & HOVERED) != 0) viewStateIndex |= VIEW_STATE_HOVERED; + if ((privateFlags & PFLAG_HOVERED) != 0) viewStateIndex |= VIEW_STATE_HOVERED; final int privateFlags2 = mPrivateFlags2; - if ((privateFlags2 & DRAG_CAN_ACCEPT) != 0) viewStateIndex |= VIEW_STATE_DRAG_CAN_ACCEPT; - if ((privateFlags2 & DRAG_HOVERED) != 0) viewStateIndex |= VIEW_STATE_DRAG_HOVERED; + if ((privateFlags2 & PFLAG2_DRAG_CAN_ACCEPT) != 0) viewStateIndex |= VIEW_STATE_DRAG_CAN_ACCEPT; + if ((privateFlags2 & PFLAG2_DRAG_HOVERED) != 0) viewStateIndex |= VIEW_STATE_DRAG_HOVERED; drawableState = VIEW_STATE_SETS[viewStateIndex]; @@ -14088,10 +14371,10 @@ protected int[] onCreateDrawableState(int extraSpace) { if (false) { Log.i("View", "drawableStateIndex=" + viewStateIndex); Log.i("View", toString() - + " pressed=" + ((privateFlags & PRESSED) != 0) + + " pressed=" + ((privateFlags & PFLAG_PRESSED) != 0) + " en=" + ((mViewFlags & ENABLED_MASK) == ENABLED) + " fo=" + hasFocus() - + " sl=" + ((privateFlags & SELECTED) != 0) + + " sl=" + ((privateFlags & PFLAG_SELECTED) != 0) + " wf=" + hasWindowFocus() + ": " + Arrays.toString(drawableState)); } @@ -14155,7 +14438,8 @@ public void jumpDrawablesToCurrentState() { @RemotableViewMethod public void setBackgroundColor(int color) { if (mBackground instanceof ColorDrawable) { - ((ColorDrawable) mBackground).setColor(color); + ((ColorDrawable) mBackground.mutate()).setColor(color); + computeOpaqueFlags(); } else { setBackground(new ColorDrawable(color)); } @@ -14203,6 +14487,8 @@ public void setBackground(Drawable background) { */ @Deprecated public void setBackgroundDrawable(Drawable background) { + computeOpaqueFlags(); + if (background == mBackground) { return; } @@ -14226,14 +14512,21 @@ public void setBackgroundDrawable(Drawable background) { padding = new Rect(); sThreadLocal.set(padding); } + resetResolvedDrawables(); + background.setLayoutDirection(getLayoutDirection()); if (background.getPadding(padding)) { - switch (background.getResolvedLayoutDirectionSelf()) { + resetResolvedPadding(); + switch (background.getLayoutDirection()) { case LAYOUT_DIRECTION_RTL: - setPadding(padding.right, padding.top, padding.left, padding.bottom); + mUserPaddingLeftInitial = padding.right; + mUserPaddingRightInitial = padding.left; + internalSetPadding(padding.right, padding.top, padding.left, padding.bottom); break; case LAYOUT_DIRECTION_LTR: default: - setPadding(padding.left, padding.top, padding.right, padding.bottom); + mUserPaddingLeftInitial = padding.left; + mUserPaddingRightInitial = padding.right; + internalSetPadding(padding.left, padding.top, padding.right, padding.bottom); } } @@ -14251,23 +14544,23 @@ public void setBackgroundDrawable(Drawable background) { background.setVisible(getVisibility() == VISIBLE, false); mBackground = background; - if ((mPrivateFlags & SKIP_DRAW) != 0) { - mPrivateFlags &= ~SKIP_DRAW; - mPrivateFlags |= ONLY_DRAWS_BACKGROUND; + if ((mPrivateFlags & PFLAG_SKIP_DRAW) != 0) { + mPrivateFlags &= ~PFLAG_SKIP_DRAW; + mPrivateFlags |= PFLAG_ONLY_DRAWS_BACKGROUND; requestLayout = true; } } else { /* Remove the background */ mBackground = null; - if ((mPrivateFlags & ONLY_DRAWS_BACKGROUND) != 0) { + if ((mPrivateFlags & PFLAG_ONLY_DRAWS_BACKGROUND) != 0) { /* * This view ONLY drew the background before and we're removing * the background, so now it won't draw anything * (hence we SKIP_DRAW) */ - mPrivateFlags &= ~ONLY_DRAWS_BACKGROUND; - mPrivateFlags |= SKIP_DRAW; + mPrivateFlags &= ~PFLAG_ONLY_DRAWS_BACKGROUND; + mPrivateFlags |= PFLAG_SKIP_DRAW; } /* @@ -14323,14 +14616,21 @@ public Drawable getBackground() { * @param bottom the bottom padding in pixels */ public void setPadding(int left, int top, int right, int bottom) { - mUserPaddingStart = -1; - mUserPaddingEnd = -1; - mUserPaddingRelative = false; + resetResolvedPadding(); + + mUserPaddingStart = UNDEFINED_PADDING; + mUserPaddingEnd = UNDEFINED_PADDING; + + mUserPaddingLeftInitial = left; + mUserPaddingRightInitial = right; internalSetPadding(left, top, right, bottom); } - private void internalSetPadding(int left, int top, int right, int bottom) { + /** + * @hide + */ + protected void internalSetPadding(int left, int top, int right, int bottom) { mUserPaddingLeft = left; mUserPaddingRight = right; mUserPaddingBottom = bottom; @@ -14345,7 +14645,7 @@ private void internalSetPadding(int left, int top, int right, int bottom) { ? 0 : getVerticalScrollbarWidth(); switch (mVerticalScrollbarPosition) { case SCROLLBAR_POSITION_DEFAULT: - if (getResolvedLayoutDirection() == LAYOUT_DIRECTION_RTL) { + if (isLayoutRtl()) { left += offset; } else { right += offset; @@ -14390,25 +14690,36 @@ private void internalSetPadding(int left, int top, int right, int bottom) { /** * Sets the relative padding. The view may add on the space required to display * the scrollbars, depending on the style and visibility of the scrollbars. + * So the values returned from {@link #getPaddingStart}, {@link #getPaddingTop}, + * {@link #getPaddingEnd} and {@link #getPaddingBottom} may be different * from the values set in this call. * + * @attr ref android.R.styleable#View_padding + * @attr ref android.R.styleable#View_paddingBottom + * @attr ref android.R.styleable#View_paddingStart + * @attr ref android.R.styleable#View_paddingEnd + * @attr ref android.R.styleable#View_paddingTop * @param start the start padding in pixels * @param top the top padding in pixels * @param end the end padding in pixels * @param bottom the bottom padding in pixels - * @hide */ public void setPaddingRelative(int start, int top, int end, int bottom) { + resetResolvedPadding(); + mUserPaddingStart = start; mUserPaddingEnd = end; - mUserPaddingRelative = true; - switch(getResolvedLayoutDirection()) { + switch(getLayoutDirection()) { case LAYOUT_DIRECTION_RTL: + mUserPaddingLeftInitial = end; + mUserPaddingRightInitial = start; internalSetPadding(end, top, start, bottom); break; case LAYOUT_DIRECTION_LTR: default: + mUserPaddingLeftInitial = start; + mUserPaddingRightInitial = end; internalSetPadding(start, top, end, bottom); } } @@ -14441,6 +14752,9 @@ public int getPaddingBottom() { * @return the left padding in pixels */ public int getPaddingLeft() { + if (!isPaddingResolved()) { + resolvePadding(); + } return mPaddingLeft; } @@ -14450,10 +14764,12 @@ public int getPaddingLeft() { * required to display the scrollbars as well. * * @return the start padding in pixels - * @hide */ public int getPaddingStart() { - return (getResolvedLayoutDirection() == LAYOUT_DIRECTION_RTL) ? + if (!isPaddingResolved()) { + resolvePadding(); + } + return (getLayoutDirection() == LAYOUT_DIRECTION_RTL) ? mPaddingRight : mPaddingLeft; } @@ -14465,6 +14781,9 @@ public int getPaddingStart() { * @return the right padding in pixels */ public int getPaddingRight() { + if (!isPaddingResolved()) { + resolvePadding(); + } return mPaddingRight; } @@ -14474,22 +14793,43 @@ public int getPaddingRight() { * required to display the scrollbars as well. * * @return the end padding in pixels - * @hide */ public int getPaddingEnd() { - return (getResolvedLayoutDirection() == LAYOUT_DIRECTION_RTL) ? + if (!isPaddingResolved()) { + resolvePadding(); + } + return (getLayoutDirection() == LAYOUT_DIRECTION_RTL) ? mPaddingLeft : mPaddingRight; } /** * Return if the padding as been set thru relative values - * {@link #setPaddingRelative(int, int, int, int)} + * {@link #setPaddingRelative(int, int, int, int)} or thru + * @attr ref android.R.styleable#View_paddingStart or + * @attr ref android.R.styleable#View_paddingEnd * * @return true if the padding is relative or false if it is not. - * @hide */ public boolean isPaddingRelative() { - return mUserPaddingRelative; + return (mUserPaddingStart != UNDEFINED_PADDING || mUserPaddingEnd != UNDEFINED_PADDING); + } + + /** + * @hide + */ + public void resetPaddingToInitialValues() { + if (isRtlCompatibilityMode()) { + mPaddingLeft = mUserPaddingLeftInitial; + mPaddingRight = mUserPaddingRightInitial; + return; + } + if (isLayoutRtl()) { + mPaddingLeft = (mUserPaddingEnd >= 0) ? mUserPaddingEnd : mUserPaddingLeftInitial; + mPaddingRight = (mUserPaddingStart >= 0) ? mUserPaddingStart : mUserPaddingRightInitial; + } else { + mPaddingLeft = (mUserPaddingStart >= 0) ? mUserPaddingStart : mUserPaddingLeftInitial; + mPaddingRight = (mUserPaddingEnd >= 0) ? mUserPaddingEnd : mUserPaddingRightInitial; + } } /** @@ -14518,8 +14858,8 @@ public void setLayoutInsets(Insets layoutInsets) { * @param selected true if the view must be selected, false otherwise */ public void setSelected(boolean selected) { - if (((mPrivateFlags & SELECTED) != 0) != selected) { - mPrivateFlags = (mPrivateFlags & ~SELECTED) | (selected ? SELECTED : 0); + if (((mPrivateFlags & PFLAG_SELECTED) != 0) != selected) { + mPrivateFlags = (mPrivateFlags & ~PFLAG_SELECTED) | (selected ? PFLAG_SELECTED : 0); if (!selected) resetPressedState(); invalidate(true); refreshDrawableState(); @@ -14547,7 +14887,7 @@ protected void dispatchSetSelected(boolean selected) { */ @ViewDebug.ExportedProperty public boolean isSelected() { - return (mPrivateFlags & SELECTED) != 0; + return (mPrivateFlags & PFLAG_SELECTED) != 0; } /** @@ -14564,8 +14904,8 @@ public boolean isSelected() { * @param activated true if the view must be activated, false otherwise */ public void setActivated(boolean activated) { - if (((mPrivateFlags & ACTIVATED) != 0) != activated) { - mPrivateFlags = (mPrivateFlags & ~ACTIVATED) | (activated ? ACTIVATED : 0); + if (((mPrivateFlags & PFLAG_ACTIVATED) != 0) != activated) { + mPrivateFlags = (mPrivateFlags & ~PFLAG_ACTIVATED) | (activated ? PFLAG_ACTIVATED : 0); invalidate(true); refreshDrawableState(); dispatchSetActivated(activated); @@ -14589,7 +14929,7 @@ protected void dispatchSetActivated(boolean activated) { */ @ViewDebug.ExportedProperty public boolean isActivated() { - return (mPrivateFlags & ACTIVATED) != 0; + return (mPrivateFlags & PFLAG_ACTIVATED) != 0; } /** @@ -14867,6 +15207,9 @@ public final View findViewByPredicateInsideOut(View start, Predicate predi */ public void setId(int id) { mID = id; + if (mID == View.NO_ID && mLabelForId != View.NO_ID) { + mID = generateViewId(); + } } /** @@ -14877,9 +15220,9 @@ public void setId(int id) { */ public void setIsRootNamespace(boolean isRoot) { if (isRoot) { - mPrivateFlags |= IS_ROOT_NAMESPACE; + mPrivateFlags |= PFLAG_IS_ROOT_NAMESPACE; } else { - mPrivateFlags &= ~IS_ROOT_NAMESPACE; + mPrivateFlags &= ~PFLAG_IS_ROOT_NAMESPACE; } } @@ -14889,7 +15232,7 @@ public void setIsRootNamespace(boolean isRoot) { * @return true if the view belongs to the root namespace, false otherwise */ public boolean isRootNamespace() { - return (mPrivateFlags&IS_ROOT_NAMESPACE) != 0; + return (mPrivateFlags&PFLAG_IS_ROOT_NAMESPACE) != 0; } /** @@ -15038,7 +15381,7 @@ protected void debug(int depth) { } Log.d(VIEW_LOG_TAG, output); - if ((mPrivateFlags & FOCUSED) != 0) { + if ((mPrivateFlags & PFLAG_FOCUSED) != 0) { output = debugIndent(depth) + " FOCUSED"; Log.d(VIEW_LOG_TAG, output); } @@ -15118,12 +15461,8 @@ public int getBaseline() { * tree. */ public void requestLayout() { - mPrivateFlags |= FORCE_LAYOUT; - mPrivateFlags |= INVALIDATED; - - if (mLayoutParams != null) { - mLayoutParams.onResolveLayoutDirection(getResolvedLayoutDirection()); - } + mPrivateFlags |= PFLAG_FORCE_LAYOUT; + mPrivateFlags |= PFLAG_INVALIDATED; if (mParent != null && !mParent.isLayoutRequested()) { mParent.requestLayout(); @@ -15136,8 +15475,8 @@ public void requestLayout() { * on the parent. */ public void forceLayout() { - mPrivateFlags |= FORCE_LAYOUT; - mPrivateFlags |= INVALIDATED; + mPrivateFlags |= PFLAG_FORCE_LAYOUT; + mPrivateFlags |= PFLAG_INVALIDATED; } /** @@ -15161,25 +15500,27 @@ public void forceLayout() { * @see #onMeasure(int, int) */ public final void measure(int widthMeasureSpec, int heightMeasureSpec) { - if ((mPrivateFlags & FORCE_LAYOUT) == FORCE_LAYOUT || + if ((mPrivateFlags & PFLAG_FORCE_LAYOUT) == PFLAG_FORCE_LAYOUT || widthMeasureSpec != mOldWidthMeasureSpec || heightMeasureSpec != mOldHeightMeasureSpec) { // first clears the measured dimension flag - mPrivateFlags &= ~MEASURED_DIMENSION_SET; + mPrivateFlags &= ~PFLAG_MEASURED_DIMENSION_SET; + + resolveRtlPropertiesIfNeeded(); // measure ourselves, this should set the measured dimension flag back onMeasure(widthMeasureSpec, heightMeasureSpec); // flag not set, setMeasuredDimension() was not invoked, we raise // an exception to warn the developer - if ((mPrivateFlags & MEASURED_DIMENSION_SET) != MEASURED_DIMENSION_SET) { + if ((mPrivateFlags & PFLAG_MEASURED_DIMENSION_SET) != PFLAG_MEASURED_DIMENSION_SET) { throw new IllegalStateException("onMeasure() did not set the" + " measured dimension by calling" + " setMeasuredDimension()"); } - mPrivateFlags |= LAYOUT_REQUIRED; + mPrivateFlags |= PFLAG_LAYOUT_REQUIRED; } mOldWidthMeasureSpec = widthMeasureSpec; @@ -15253,7 +15594,7 @@ protected final void setMeasuredDimension(int measuredWidth, int measuredHeight) mMeasuredWidth = measuredWidth; mMeasuredHeight = measuredHeight; - mPrivateFlags |= MEASURED_DIMENSION_SET; + mPrivateFlags |= PFLAG_MEASURED_DIMENSION_SET; } /** @@ -15497,7 +15838,7 @@ public void setAnimation(Animation animation) { * @see #getAnimation() */ protected void onAnimationStart() { - mPrivateFlags |= ANIMATION_STARTED; + mPrivateFlags |= PFLAG_ANIMATION_STARTED; } /** @@ -15509,7 +15850,7 @@ protected void onAnimationStart() { * @see #getAnimation() */ protected void onAnimationEnd() { - mPrivateFlags &= ~ANIMATION_STARTED; + mPrivateFlags &= ~PFLAG_ANIMATION_STARTED; } /** @@ -15546,14 +15887,14 @@ public boolean gatherTransparentRegion(Region region) { final AttachInfo attachInfo = mAttachInfo; if (region != null && attachInfo != null) { final int pflags = mPrivateFlags; - if ((pflags & SKIP_DRAW) == 0) { + if ((pflags & PFLAG_SKIP_DRAW) == 0) { // The SKIP_DRAW flag IS NOT set, so this view draws. We need to // remove it from the transparent region. final int[] location = attachInfo.mTransparentLocation; getLocationInWindow(location); region.op(location[0], location[1], location[0] + mRight - mLeft, location[1] + mBottom - mTop, Region.Op.DIFFERENCE); - } else if ((pflags & ONLY_DRAWS_BACKGROUND) != 0 && mBackground != null) { + } else if ((pflags & PFLAG_ONLY_DRAWS_BACKGROUND) != 0 && mBackground != null) { // The ONLY_DRAWS_BACKGROUND flag IS set and the background drawable // exists, so we remove the background drawable's non-transparent // parts from this transparent region. @@ -16030,7 +16371,7 @@ public boolean dispatchDragEvent(DragEvent event) { } boolean canAcceptDrag() { - return (mPrivateFlags2 & DRAG_CAN_ACCEPT) != 0; + return (mPrivateFlags2 & PFLAG2_DRAG_CAN_ACCEPT) != 0; } /** @@ -16285,6 +16626,7 @@ protected float getHorizontalScrollFactor() { * {@link #TEXT_DIRECTION_LTR}, * {@link #TEXT_DIRECTION_RTL}, * {@link #TEXT_DIRECTION_LOCALE} + * * @hide */ @ViewDebug.ExportedProperty(category = "text", mapping = { @@ -16295,8 +16637,8 @@ protected float getHorizontalScrollFactor() { @ViewDebug.IntToString(from = TEXT_DIRECTION_RTL, to = "RTL"), @ViewDebug.IntToString(from = TEXT_DIRECTION_LOCALE, to = "LOCALE") }) - public int getTextDirection() { - return (mPrivateFlags2 & TEXT_DIRECTION_MASK) >> TEXT_DIRECTION_MASK_SHIFT; + public int getRawTextDirection() { + return (mPrivateFlags2 & PFLAG2_TEXT_DIRECTION_MASK) >> PFLAG2_TEXT_DIRECTION_MASK_SHIFT; } /** @@ -16310,15 +16652,22 @@ public int getTextDirection() { * {@link #TEXT_DIRECTION_LTR}, * {@link #TEXT_DIRECTION_RTL}, * {@link #TEXT_DIRECTION_LOCALE} - * @hide + * + * Resolution will be done if the value is set to TEXT_DIRECTION_INHERIT. The resolution + * proceeds up the parent chain of the view to get the value. If there is no parent, then it will + * return the default {@link #TEXT_DIRECTION_FIRST_STRONG}. */ public void setTextDirection(int textDirection) { - if (getTextDirection() != textDirection) { + if (getRawTextDirection() != textDirection) { // Reset the current text direction and the resolved one - mPrivateFlags2 &= ~TEXT_DIRECTION_MASK; + mPrivateFlags2 &= ~PFLAG2_TEXT_DIRECTION_MASK; resetResolvedTextDirection(); // Set the new text direction - mPrivateFlags2 |= ((textDirection << TEXT_DIRECTION_MASK_SHIFT) & TEXT_DIRECTION_MASK); + mPrivateFlags2 |= ((textDirection << PFLAG2_TEXT_DIRECTION_MASK_SHIFT) & PFLAG2_TEXT_DIRECTION_MASK); + // Do resolution + resolveTextDirection(); + // Notify change + onRtlPropertiesChanged(getLayoutDirection()); // Refresh requestLayout(); invalidate(true); @@ -16328,11 +16677,6 @@ public void setTextDirection(int textDirection) { /** * Return the resolved text direction. * - * This needs resolution if the value is TEXT_DIRECTION_INHERIT. The resolution matches - * {@link #getTextDirection()}if it is not TEXT_DIRECTION_INHERIT, otherwise resolution proceeds - * up the parent chain of the view. if there is no parent, then it will return the default - * {@link #TEXT_DIRECTION_FIRST_STRONG}. - * * @return the resolved text direction. Returns one of: * * {@link #TEXT_DIRECTION_FIRST_STRONG} @@ -16340,51 +16684,56 @@ public void setTextDirection(int textDirection) { * {@link #TEXT_DIRECTION_LTR}, * {@link #TEXT_DIRECTION_RTL}, * {@link #TEXT_DIRECTION_LOCALE} - * @hide */ - public int getResolvedTextDirection() { - // The text direction will be resolved only if needed - if ((mPrivateFlags2 & TEXT_DIRECTION_RESOLVED) != TEXT_DIRECTION_RESOLVED) { - resolveTextDirection(); - } - return (mPrivateFlags2 & TEXT_DIRECTION_RESOLVED_MASK) >> TEXT_DIRECTION_RESOLVED_MASK_SHIFT; + public int getTextDirection() { + return (mPrivateFlags2 & PFLAG2_TEXT_DIRECTION_RESOLVED_MASK) >> PFLAG2_TEXT_DIRECTION_RESOLVED_MASK_SHIFT; } /** - * Resolve the text direction. Will call {@link View#onResolvedTextDirectionChanged} when - * resolution is done. + * Resolve the text direction. + * + * @return true if resolution has been done, false otherwise. + * * @hide */ - public void resolveTextDirection() { + public boolean resolveTextDirection() { // Reset any previous text direction resolution - mPrivateFlags2 &= ~(TEXT_DIRECTION_RESOLVED | TEXT_DIRECTION_RESOLVED_MASK); + mPrivateFlags2 &= ~(PFLAG2_TEXT_DIRECTION_RESOLVED | PFLAG2_TEXT_DIRECTION_RESOLVED_MASK); if (hasRtlSupport()) { // Set resolved text direction flag depending on text direction flag - final int textDirection = getTextDirection(); + final int textDirection = getRawTextDirection(); switch(textDirection) { case TEXT_DIRECTION_INHERIT: - if (canResolveTextDirection()) { - ViewGroup viewGroup = ((ViewGroup) mParent); - - // Set current resolved direction to the same value as the parent's one - final int parentResolvedDirection = viewGroup.getResolvedTextDirection(); - switch (parentResolvedDirection) { - case TEXT_DIRECTION_FIRST_STRONG: - case TEXT_DIRECTION_ANY_RTL: - case TEXT_DIRECTION_LTR: - case TEXT_DIRECTION_RTL: - case TEXT_DIRECTION_LOCALE: - mPrivateFlags2 |= - (parentResolvedDirection << TEXT_DIRECTION_RESOLVED_MASK_SHIFT); - break; - default: - // Default resolved direction is "first strong" heuristic - mPrivateFlags2 |= TEXT_DIRECTION_RESOLVED_DEFAULT; - } - } else { + if (!canResolveTextDirection()) { // We cannot do the resolution if there is no parent, so use the default one - mPrivateFlags2 |= TEXT_DIRECTION_RESOLVED_DEFAULT; + mPrivateFlags2 |= PFLAG2_TEXT_DIRECTION_RESOLVED_DEFAULT; + // Resolution will need to happen again later + return false; + } + + View parent = ((View) mParent); + // Parent has not yet resolved, so we still return the default + if (!parent.isTextDirectionResolved()) { + mPrivateFlags2 |= PFLAG2_TEXT_DIRECTION_RESOLVED_DEFAULT; + // Resolution will need to happen again later + return false; + } + + // Set current resolved direction to the same value as the parent's one + final int parentResolvedDirection = parent.getTextDirection(); + switch (parentResolvedDirection) { + case TEXT_DIRECTION_FIRST_STRONG: + case TEXT_DIRECTION_ANY_RTL: + case TEXT_DIRECTION_LTR: + case TEXT_DIRECTION_RTL: + case TEXT_DIRECTION_LOCALE: + mPrivateFlags2 |= + (parentResolvedDirection << PFLAG2_TEXT_DIRECTION_RESOLVED_MASK_SHIFT); + break; + default: + // Default resolved direction is "first strong" heuristic + mPrivateFlags2 |= PFLAG2_TEXT_DIRECTION_RESOLVED_DEFAULT; } break; case TEXT_DIRECTION_FIRST_STRONG: @@ -16393,65 +16742,64 @@ public void resolveTextDirection() { case TEXT_DIRECTION_RTL: case TEXT_DIRECTION_LOCALE: // Resolved direction is the same as text direction - mPrivateFlags2 |= (textDirection << TEXT_DIRECTION_RESOLVED_MASK_SHIFT); + mPrivateFlags2 |= (textDirection << PFLAG2_TEXT_DIRECTION_RESOLVED_MASK_SHIFT); break; default: // Default resolved direction is "first strong" heuristic - mPrivateFlags2 |= TEXT_DIRECTION_RESOLVED_DEFAULT; + mPrivateFlags2 |= PFLAG2_TEXT_DIRECTION_RESOLVED_DEFAULT; } } else { // Default resolved direction is "first strong" heuristic - mPrivateFlags2 |= TEXT_DIRECTION_RESOLVED_DEFAULT; + mPrivateFlags2 |= PFLAG2_TEXT_DIRECTION_RESOLVED_DEFAULT; } // Set to resolved - mPrivateFlags2 |= TEXT_DIRECTION_RESOLVED; - onResolvedTextDirectionChanged(); - } - - /** - * Called when text direction has been resolved. Subclasses that care about text direction - * resolution should override this method. - * - * The default implementation does nothing. - * @hide - */ - public void onResolvedTextDirectionChanged() { + mPrivateFlags2 |= PFLAG2_TEXT_DIRECTION_RESOLVED; + return true; } /** * Check if text direction resolution can be done. * * @return true if text direction resolution can be done otherwise return false. - * @hide */ - public boolean canResolveTextDirection() { - switch (getTextDirection()) { + private boolean canResolveTextDirection() { + switch (getRawTextDirection()) { case TEXT_DIRECTION_INHERIT: - return (mParent != null) && (mParent instanceof ViewGroup); + return (mParent != null) && (mParent instanceof View) && + ((View) mParent).canResolveTextDirection(); default: return true; } } /** - * Reset resolved text direction. Text direction can be resolved with a call to - * getResolvedTextDirection(). Will call {@link View#onResolvedTextDirectionReset} when - * reset is done. + * Reset resolved text direction. Text direction will be resolved during a call to + * {@link #onMeasure(int, int)}. + * * @hide */ public void resetResolvedTextDirection() { - mPrivateFlags2 &= ~(TEXT_DIRECTION_RESOLVED | TEXT_DIRECTION_RESOLVED_MASK); - onResolvedTextDirectionReset(); + // Reset any previous text direction resolution + mPrivateFlags2 &= ~(PFLAG2_TEXT_DIRECTION_RESOLVED | PFLAG2_TEXT_DIRECTION_RESOLVED_MASK); + // Set to default value + mPrivateFlags2 |= PFLAG2_TEXT_DIRECTION_RESOLVED_DEFAULT; } /** - * Called when text direction is reset. Subclasses that care about text direction reset should - * override this method and do a reset of the text direction of their children. The default - * implementation does nothing. + * @return true if text direction is inherited. + * * @hide */ - public void onResolvedTextDirectionReset() { + public boolean isTextDirectionInherited() { + return (getRawTextDirection() == TEXT_DIRECTION_INHERIT); + } + + /** + * @return true if text direction is resolved. + */ + private boolean isTextDirectionResolved() { + return (mPrivateFlags2 & PFLAG2_TEXT_DIRECTION_RESOLVED) == PFLAG2_TEXT_DIRECTION_RESOLVED; } /** @@ -16467,6 +16815,7 @@ public void onResolvedTextDirectionReset() { * {@link #TEXT_ALIGNMENT_TEXT_END}, * {@link #TEXT_ALIGNMENT_VIEW_START}, * {@link #TEXT_ALIGNMENT_VIEW_END} + * * @hide */ @ViewDebug.ExportedProperty(category = "text", mapping = { @@ -16478,8 +16827,8 @@ public void onResolvedTextDirectionReset() { @ViewDebug.IntToString(from = TEXT_ALIGNMENT_VIEW_START, to = "VIEW_START"), @ViewDebug.IntToString(from = TEXT_ALIGNMENT_VIEW_END, to = "VIEW_END") }) - public int getTextAlignment() { - return (mPrivateFlags2 & TEXT_ALIGNMENT_MASK) >> TEXT_ALIGNMENT_MASK_SHIFT; + public int getRawTextAlignment() { + return (mPrivateFlags2 & PFLAG2_TEXT_ALIGNMENT_MASK) >> PFLAG2_TEXT_ALIGNMENT_MASK_SHIFT; } /** @@ -16495,16 +16844,24 @@ public int getTextAlignment() { * {@link #TEXT_ALIGNMENT_VIEW_START}, * {@link #TEXT_ALIGNMENT_VIEW_END} * + * Resolution will be done if the value is set to TEXT_ALIGNMENT_INHERIT. The resolution + * proceeds up the parent chain of the view to get the value. If there is no parent, then it + * will return the default {@link #TEXT_ALIGNMENT_GRAVITY}. + * * @attr ref android.R.styleable#View_textAlignment - * @hide */ public void setTextAlignment(int textAlignment) { - if (textAlignment != getTextAlignment()) { + if (textAlignment != getRawTextAlignment()) { // Reset the current and resolved text alignment - mPrivateFlags2 &= ~TEXT_ALIGNMENT_MASK; + mPrivateFlags2 &= ~PFLAG2_TEXT_ALIGNMENT_MASK; resetResolvedTextAlignment(); // Set the new text alignment - mPrivateFlags2 |= ((textAlignment << TEXT_ALIGNMENT_MASK_SHIFT) & TEXT_ALIGNMENT_MASK); + mPrivateFlags2 |= + ((textAlignment << PFLAG2_TEXT_ALIGNMENT_MASK_SHIFT) & PFLAG2_TEXT_ALIGNMENT_MASK); + // Do resolution + resolveTextAlignment(); + // Notify change + onRtlPropertiesChanged(getLayoutDirection()); // Refresh requestLayout(); invalidate(true); @@ -16514,10 +16871,6 @@ public void setTextAlignment(int textAlignment) { /** * Return the resolved text alignment. * - * The resolved text alignment. This needs resolution if the value is - * TEXT_ALIGNMENT_INHERIT. The resolution matches {@link #setTextAlignment(int)} if it is - * not TEXT_ALIGNMENT_INHERIT, otherwise resolution proceeds up the parent chain of the view. - * * @return the resolved text alignment. Returns one of: * * {@link #TEXT_ALIGNMENT_GRAVITY}, @@ -16526,7 +16879,6 @@ public void setTextAlignment(int textAlignment) { * {@link #TEXT_ALIGNMENT_TEXT_END}, * {@link #TEXT_ALIGNMENT_VIEW_START}, * {@link #TEXT_ALIGNMENT_VIEW_END} - * @hide */ @ViewDebug.ExportedProperty(category = "text", mapping = { @ViewDebug.IntToString(from = TEXT_ALIGNMENT_INHERIT, to = "INHERIT"), @@ -16537,53 +16889,59 @@ public void setTextAlignment(int textAlignment) { @ViewDebug.IntToString(from = TEXT_ALIGNMENT_VIEW_START, to = "VIEW_START"), @ViewDebug.IntToString(from = TEXT_ALIGNMENT_VIEW_END, to = "VIEW_END") }) - public int getResolvedTextAlignment() { - // If text alignment is not resolved, then resolve it - if ((mPrivateFlags2 & TEXT_ALIGNMENT_RESOLVED) != TEXT_ALIGNMENT_RESOLVED) { - resolveTextAlignment(); - } - return (mPrivateFlags2 & TEXT_ALIGNMENT_RESOLVED_MASK) >> TEXT_ALIGNMENT_RESOLVED_MASK_SHIFT; + public int getTextAlignment() { + return (mPrivateFlags2 & PFLAG2_TEXT_ALIGNMENT_RESOLVED_MASK) >> + PFLAG2_TEXT_ALIGNMENT_RESOLVED_MASK_SHIFT; } /** - * Resolve the text alignment. Will call {@link View#onResolvedTextAlignmentChanged} when - * resolution is done. + * Resolve the text alignment. + * + * @return true if resolution has been done, false otherwise. + * * @hide */ - public void resolveTextAlignment() { + public boolean resolveTextAlignment() { // Reset any previous text alignment resolution - mPrivateFlags2 &= ~(TEXT_ALIGNMENT_RESOLVED | TEXT_ALIGNMENT_RESOLVED_MASK); + mPrivateFlags2 &= ~(PFLAG2_TEXT_ALIGNMENT_RESOLVED | PFLAG2_TEXT_ALIGNMENT_RESOLVED_MASK); if (hasRtlSupport()) { // Set resolved text alignment flag depending on text alignment flag - final int textAlignment = getTextAlignment(); + final int textAlignment = getRawTextAlignment(); switch (textAlignment) { case TEXT_ALIGNMENT_INHERIT: // Check if we can resolve the text alignment - if (canResolveLayoutDirection() && mParent instanceof View) { - View view = (View) mParent; - - final int parentResolvedTextAlignment = view.getResolvedTextAlignment(); - switch (parentResolvedTextAlignment) { - case TEXT_ALIGNMENT_GRAVITY: - case TEXT_ALIGNMENT_TEXT_START: - case TEXT_ALIGNMENT_TEXT_END: - case TEXT_ALIGNMENT_CENTER: - case TEXT_ALIGNMENT_VIEW_START: - case TEXT_ALIGNMENT_VIEW_END: - // Resolved text alignment is the same as the parent resolved - // text alignment - mPrivateFlags2 |= - (parentResolvedTextAlignment << TEXT_ALIGNMENT_RESOLVED_MASK_SHIFT); - break; - default: - // Use default resolved text alignment - mPrivateFlags2 |= TEXT_ALIGNMENT_RESOLVED_DEFAULT; - } - } - else { + if (!canResolveTextAlignment()) { // We cannot do the resolution if there is no parent so use the default - mPrivateFlags2 |= TEXT_ALIGNMENT_RESOLVED_DEFAULT; + mPrivateFlags2 |= PFLAG2_TEXT_ALIGNMENT_RESOLVED_DEFAULT; + // Resolution will need to happen again later + return false; + } + View parent = (View) mParent; + + // Parent has not yet resolved, so we still return the default + if (!parent.isTextAlignmentResolved()) { + mPrivateFlags2 |= PFLAG2_TEXT_ALIGNMENT_RESOLVED_DEFAULT; + // Resolution will need to happen again later + return false; + } + + final int parentResolvedTextAlignment = parent.getTextAlignment(); + switch (parentResolvedTextAlignment) { + case TEXT_ALIGNMENT_GRAVITY: + case TEXT_ALIGNMENT_TEXT_START: + case TEXT_ALIGNMENT_TEXT_END: + case TEXT_ALIGNMENT_CENTER: + case TEXT_ALIGNMENT_VIEW_START: + case TEXT_ALIGNMENT_VIEW_END: + // Resolved text alignment is the same as the parent resolved + // text alignment + mPrivateFlags2 |= + (parentResolvedTextAlignment << PFLAG2_TEXT_ALIGNMENT_RESOLVED_MASK_SHIFT); + break; + default: + // Use default resolved text alignment + mPrivateFlags2 |= PFLAG2_TEXT_ALIGNMENT_RESOLVED_DEFAULT; } break; case TEXT_ALIGNMENT_GRAVITY: @@ -16593,66 +16951,82 @@ public void resolveTextAlignment() { case TEXT_ALIGNMENT_VIEW_START: case TEXT_ALIGNMENT_VIEW_END: // Resolved text alignment is the same as text alignment - mPrivateFlags2 |= (textAlignment << TEXT_ALIGNMENT_RESOLVED_MASK_SHIFT); + mPrivateFlags2 |= (textAlignment << PFLAG2_TEXT_ALIGNMENT_RESOLVED_MASK_SHIFT); break; default: // Use default resolved text alignment - mPrivateFlags2 |= TEXT_ALIGNMENT_RESOLVED_DEFAULT; + mPrivateFlags2 |= PFLAG2_TEXT_ALIGNMENT_RESOLVED_DEFAULT; } } else { // Use default resolved text alignment - mPrivateFlags2 |= TEXT_ALIGNMENT_RESOLVED_DEFAULT; + mPrivateFlags2 |= PFLAG2_TEXT_ALIGNMENT_RESOLVED_DEFAULT; } // Set the resolved - mPrivateFlags2 |= TEXT_ALIGNMENT_RESOLVED; - onResolvedTextAlignmentChanged(); + mPrivateFlags2 |= PFLAG2_TEXT_ALIGNMENT_RESOLVED; + return true; } /** * Check if text alignment resolution can be done. * * @return true if text alignment resolution can be done otherwise return false. - * @hide */ - public boolean canResolveTextAlignment() { - switch (getTextAlignment()) { + private boolean canResolveTextAlignment() { + switch (getRawTextAlignment()) { case TEXT_DIRECTION_INHERIT: - return (mParent != null); + return (mParent != null) && (mParent instanceof View) && + ((View) mParent).canResolveTextAlignment(); default: return true; } } /** - * Called when text alignment has been resolved. Subclasses that care about text alignment - * resolution should override this method. + * Reset resolved text alignment. Text alignment will be resolved during a call to + * {@link #onMeasure(int, int)}. * - * The default implementation does nothing. * @hide */ - public void onResolvedTextAlignmentChanged() { + public void resetResolvedTextAlignment() { + // Reset any previous text alignment resolution + mPrivateFlags2 &= ~(PFLAG2_TEXT_ALIGNMENT_RESOLVED | PFLAG2_TEXT_ALIGNMENT_RESOLVED_MASK); + // Set to default + mPrivateFlags2 |= PFLAG2_TEXT_ALIGNMENT_RESOLVED_DEFAULT; } /** - * Reset resolved text alignment. Text alignment can be resolved with a call to - * getResolvedTextAlignment(). Will call {@link View#onResolvedTextAlignmentReset} when - * reset is done. + * @return true if text alignment is inherited. + * * @hide */ - public void resetResolvedTextAlignment() { - // Reset any previous text alignment resolution - mPrivateFlags2 &= ~(TEXT_ALIGNMENT_RESOLVED | TEXT_ALIGNMENT_RESOLVED_MASK); - onResolvedTextAlignmentReset(); + public boolean isTextAlignmentInherited() { + return (getRawTextAlignment() == TEXT_ALIGNMENT_INHERIT); } /** - * Called when text alignment is reset. Subclasses that care about text alignment reset should - * override this method and do a reset of the text alignment of their children. The default - * implementation does nothing. - * @hide + * @return true if text alignment is resolved. + */ + private boolean isTextAlignmentResolved() { + return (mPrivateFlags2 & PFLAG2_TEXT_ALIGNMENT_RESOLVED) == PFLAG2_TEXT_ALIGNMENT_RESOLVED; + } + + /** + * Generate a value suitable for use in {@link #setId(int)}. + * This value will not collide with ID values generated at build time by aapt for R.id. + * + * @return a generated ID value */ - public void onResolvedTextAlignmentReset() { + public static int generateViewId() { + for (;;) { + final int result = sNextGeneratedId.get(); + // aapt-generated IDs have the high byte nonzero; clamp to the range under that. + int newValue = result + 1; + if (newValue > 0x00FFFFFF) newValue = 1; // Roll over to 1, not 0. + if (sNextGeneratedId.compareAndSet(result, newValue)) { + return result; + } + } } // @@ -16955,7 +17329,7 @@ public void rememberWindowAttachCount() { private final class CheckForTap implements Runnable { public void run() { - mPrivateFlags &= ~PREPRESSED; + mPrivateFlags &= ~PFLAG_PREPRESSED; setPressed(true); checkForLongClick(ViewConfiguration.getTapTimeout()); } @@ -17303,6 +17677,8 @@ public void setPooled(boolean isPooled) { final IBinder mWindowToken; + final Display mDisplay; + final Callbacks mRootCallbacks; HardwareCanvas mHardwareCanvas; @@ -17332,7 +17708,7 @@ public void setPooled(boolean isPooled) { boolean mScalingRequired; /** - * If set, ViewAncestor doesn't use its lame animation for when the window resizes. + * If set, ViewRootImpl doesn't use its lame animation for when the window resizes. */ boolean mTurnOffWindowResizeAnim; @@ -17346,20 +17722,6 @@ public void setPooled(boolean isPooled) { */ int mWindowTop; - /** - * Left actual position of this view's window. - * - * TODO: This is a workaround for 6623031. Remove when fixed. - */ - int mActualWindowLeft; - - /** - * Actual top position of this view's window. - * - * TODO: This is a workaround for 6623031. Remove when fixed. - */ - int mActualWindowTop; - /** * Indicates whether views need to use 32-bit drawing caches */ @@ -17529,6 +17891,16 @@ public void setPooled(boolean isPooled) { */ final RectF mTmpTransformRect = new RectF(); + /** + * Temporary for use in transforming invalidation rect + */ + final Matrix mTmpMatrix = new Matrix(); + + /** + * Temporary for use in transforming invalidation rect + */ + final Transformation mTmpTransformation = new Transformation(); + /** * Temporary list for use in collecting focusable descendents of a view. */ @@ -17566,11 +17938,12 @@ public void setPooled(boolean isPooled) { * * @param handler the events handler the view must use */ - AttachInfo(IWindowSession session, IWindow window, + AttachInfo(IWindowSession session, IWindow window, Display display, ViewRootImpl viewRootImpl, Handler handler, Callbacks effectPlayer) { mSession = session; mWindow = window; mWindowToken = window.asBinder(); + mDisplay = display; mViewRootImpl = viewRootImpl; mHandler = handler; mRootCallbacks = effectPlayer; @@ -17644,23 +18017,27 @@ public ScrollabilityCache(ViewConfiguration configuration, View host) { // use use a height of 1, and then wack the matrix each time we // actually use it. shader = new LinearGradient(0, 0, 0, 1, 0xFF000000, 0, Shader.TileMode.CLAMP); - paint.setShader(shader); paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_OUT)); + this.host = host; } public void setFadeColor(int color) { - if (color != 0 && color != mLastColor) { + if (color != mLastColor) { mLastColor = color; - color |= 0xFF000000; - - shader = new LinearGradient(0, 0, 0, 1, color | 0xFF000000, - color & 0x00FFFFFF, Shader.TileMode.CLAMP); - paint.setShader(shader); - // Restore the default transfer mode (src_over) - paint.setXfermode(null); + if (color != 0) { + shader = new LinearGradient(0, 0, 0, 1, color | 0xFF000000, + color & 0x00FFFFFF, Shader.TileMode.CLAMP); + paint.setShader(shader); + // Restore the default transfer mode (src_over) + paint.setXfermode(null); + } else { + shader = new LinearGradient(0, 0, 0, 1, 0xFF000000, 0, Shader.TileMode.CLAMP); + paint.setShader(shader); + paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_OUT)); + } } } @@ -17948,4 +18325,64 @@ public AccessibilityNodeProvider getAccessibilityNodeProvider(View host) { return null; } } + + private class MatchIdPredicate implements Predicate { + public int mId; + + @Override + public boolean apply(View view) { + return (view.mID == mId); + } + } + + private class MatchLabelForPredicate implements Predicate { + private int mLabeledId; + + @Override + public boolean apply(View view) { + return (view.mLabelForId == mLabeledId); + } + } + + /** + * Dump all private flags in readable format, useful for documentation and + * sanity checking. + */ + private static void dumpFlags() { + final HashMap found = Maps.newHashMap(); + try { + for (Field field : View.class.getDeclaredFields()) { + final int modifiers = field.getModifiers(); + if (Modifier.isStatic(modifiers) && Modifier.isFinal(modifiers)) { + if (field.getType().equals(int.class)) { + final int value = field.getInt(null); + dumpFlag(found, field.getName(), value); + } else if (field.getType().equals(int[].class)) { + final int[] values = (int[]) field.get(null); + for (int i = 0; i < values.length; i++) { + dumpFlag(found, field.getName() + "[" + i + "]", values[i]); + } + } + } + } + } catch (IllegalAccessException e) { + throw new RuntimeException(e); + } + + final ArrayList keys = Lists.newArrayList(); + keys.addAll(found.keySet()); + Collections.sort(keys); + for (String key : keys) { + Log.d(VIEW_LOG_TAG, found.get(key)); + } + } + + private static void dumpFlag(HashMap found, String name, int value) { + // Sort flags by prefix, then by bits, always keeping unique keys + final String bits = String.format("%32s", Integer.toBinaryString(value)).replace('0', ' '); + final int prefix = name.indexOf('_'); + final String key = (prefix > 0 ? name.substring(0, prefix) : name) + bits + name; + final String output = bits + " " + name; + found.put(key, output); + } } diff --git a/core/java/android/view/ViewConfiguration.java b/core/java/android/view/ViewConfiguration.java index 823befb22f7b8..73295a2813122 100644 --- a/core/java/android/view/ViewConfiguration.java +++ b/core/java/android/view/ViewConfiguration.java @@ -20,6 +20,7 @@ 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; @@ -29,24 +30,6 @@ * Contains methods to standard constants used in the UI for timeouts, sizes, and distances. */ public class ViewConfiguration { - /** - * Expected bit depth of the display panel. - * - * @hide - */ - public static final float PANEL_BIT_DEPTH = 24; - - /** - * Minimum alpha required for a view to draw. - * - * @hide - */ - public static final float ALPHA_THRESHOLD = 0.5f / PANEL_BIT_DEPTH; - /** - * @hide - */ - public static final float ALPHA_THRESHOLD_INT = 0x7f / PANEL_BIT_DEPTH; - /** * Defines the width of the horizontal scrollbar and the height of the vertical scrollbar in * dips @@ -240,6 +223,8 @@ public class ViewConfiguration { private boolean sHasPermanentMenuKey; private boolean sHasPermanentMenuKeySet; + private Context mContext; + static final SparseArray sConfigurations = new SparseArray(2); @@ -287,6 +272,8 @@ private ViewConfiguration(Context context) { sizeAndDensity = density; } + mContext = context; + mEdgeSlop = (int) (sizeAndDensity * EDGE_SLOP + 0.5f); mFadingEdgeLength = (int) (sizeAndDensity * FADING_EDGE_LENGTH + 0.5f); mMinimumFlingVelocity = (int) (density * MINIMUM_FLING_VELOCITY + 0.5f); @@ -295,15 +282,18 @@ private ViewConfiguration(Context context) { 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 WindowManager win = (WindowManager)context.getSystemService(Context.WINDOW_SERVICE); + final Display display = win.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 = WindowManagerGlobal.getWindowManagerService(); try { sHasPermanentMenuKey = !wm.hasSystemNavBar() && !wm.hasNavigationBar(); sHasPermanentMenuKeySet = true; @@ -692,7 +682,18 @@ public static float getScrollFriction() { * @return true if a permanent menu key is present, false otherwise. */ public boolean hasPermanentMenuKey() { - return sHasPermanentMenuKey; + // The action overflow button within app UI can + // be controlled with a system setting + int showOverflowButton = Settings.System.getInt( + mContext.getContentResolver(), + Settings.System.UI_FORCE_OVERFLOW_BUTTON, 0); + if (showOverflowButton == 1) { + // Force overflow button on by reporting that + // the device has no permanent menu key + return false; + } else { + return sHasPermanentMenuKey; + } } /** diff --git a/core/java/android/view/ViewDebug.java b/core/java/android/view/ViewDebug.java index dd671dc4cf4ed..023e58f3a15f6 100644 --- a/core/java/android/view/ViewDebug.java +++ b/core/java/android/view/ViewDebug.java @@ -255,6 +255,35 @@ public class ViewDebug { boolean retrieveReturn() default false; } + /** + * Allows a View to inject custom children into HierarchyViewer. For example, + * WebView uses this to add its internal layer tree as a child to itself + * @hide + */ + public interface HierarchyHandler { + /** + * Dumps custom children to hierarchy viewer. + * See ViewDebug.dumpViewWithProperties(Context, View, BufferedWriter, int) + * for the format + * + * An empty implementation should simply do nothing + * + * @param out The output writer + * @param level The indentation level + */ + public void dumpViewHierarchyWithProperties(BufferedWriter out, int level); + + /** + * Returns a View to enable grabbing screenshots from custom children + * returned in dumpViewHierarchyWithProperties. + * + * @param className The className of the view to find + * @param hashCode The hashCode of the view to find + * @return the View to capture from, or null if not found + */ + public View findHierarchyView(String className, int hashCode); + } + private static HashMap, Method[]> mCapturedViewMethodsForClasses = null; private static HashMap, Field[]> mCapturedViewFieldsForClasses = null; @@ -468,8 +497,8 @@ private static void profileViewAndChildren(final View view, BufferedWriter out, throws IOException { long durationMeasure = - (root || (view.mPrivateFlags & View.MEASURED_DIMENSION_SET) != 0) ? profileViewOperation( - view, new ViewOperation() { + (root || (view.mPrivateFlags & View.PFLAG_MEASURED_DIMENSION_SET) != 0) + ? profileViewOperation(view, new ViewOperation() { public Void[] pre() { forceLayout(view); return null; @@ -495,8 +524,8 @@ public void post(Void... data) { }) : 0; long durationLayout = - (root || (view.mPrivateFlags & View.LAYOUT_REQUIRED) != 0) ? profileViewOperation( - view, new ViewOperation() { + (root || (view.mPrivateFlags & View.PFLAG_LAYOUT_REQUIRED) != 0) + ? profileViewOperation(view, new ViewOperation() { public Void[] pre() { return null; } @@ -509,15 +538,14 @@ public void post(Void... data) { } }) : 0; long durationDraw = - (root || !view.willNotDraw() || (view.mPrivateFlags & View.DRAWN) != 0) ? profileViewOperation( - view, - new ViewOperation() { + (root || !view.willNotDraw() || (view.mPrivateFlags & View.PFLAG_DRAWN) != 0) + ? profileViewOperation(view, new ViewOperation() { public Object[] pre() { final DisplayMetrics metrics = (view != null && view.getResources() != null) ? view.getResources().getDisplayMetrics() : null; final Bitmap bitmap = metrics != null ? - Bitmap.createBitmap(metrics.widthPixels, + Bitmap.createBitmap(metrics, metrics.widthPixels, metrics.heightPixels, Bitmap.Config.RGB_565) : null; final Canvas canvas = bitmap != null ? new Canvas(bitmap) : null; return new Object[] { @@ -622,7 +650,7 @@ private static void captureViewLayer(View view, DataOutputStream clientStream, b final boolean localVisible = view.getVisibility() == View.VISIBLE && visible; - if ((view.mPrivateFlags & View.SKIP_DRAW) != View.SKIP_DRAW) { + if ((view.mPrivateFlags & View.PFLAG_SKIP_DRAW) != View.PFLAG_SKIP_DRAW) { final int id = view.getId(); String name = view.getClass().getSimpleName(); if (id != View.NO_ID) { @@ -677,7 +705,8 @@ private static void capture(View root, final OutputStream clientStream, String p Log.w("View", "Failed to create capture bitmap!"); // Send an empty one so that it doesn't get stuck waiting for // something. - b = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888); + b = Bitmap.createBitmap(root.getResources().getDisplayMetrics(), + 1, 1, Bitmap.Config.ARGB_8888); } BufferedOutputStream out = null; @@ -759,6 +788,13 @@ private static View findView(ViewGroup group, String className, int hashCode) { } else if (isRequestedView(view, className, hashCode)) { return view; } + if (view instanceof HierarchyHandler) { + final View found = ((HierarchyHandler)view) + .findHierarchyView(className, hashCode); + if (found != null) { + return found; + } + } } return null; @@ -783,6 +819,9 @@ private static void dumpViewHierarchyWithProperties(Context context, ViewGroup g dumpViewWithProperties(context, view, out, level + 1); } } + if (group instanceof HierarchyHandler) { + ((HierarchyHandler)group).dumpViewHierarchyWithProperties(out, level + 1); + } } private static boolean dumpViewWithProperties(Context context, View view, @@ -884,8 +923,12 @@ private static void dumpViewProperties(Context context, Object view, private static void dumpViewProperties(Context context, Object view, BufferedWriter out, String prefix) throws IOException { - Class klass = view.getClass(); + if (view == null) { + out.write(prefix + "=4,null "); + return; + } + Class klass = view.getClass(); do { exportFields(context, view, out, klass, prefix); exportMethods(context, view, out, klass, prefix); @@ -1025,8 +1068,8 @@ private static void exportFields(Context context, Object view, BufferedWriter ou return; } else if (!type.isPrimitive()) { if (property.deepExport()) { - dumpViewProperties(context, field.get(view), out, prefix - + property.prefix()); + dumpViewProperties(context, field.get(view), out, prefix + + property.prefix()); continue; } } @@ -1139,10 +1182,14 @@ static Object resolveId(Context context, int id) { private static void writeValue(BufferedWriter out, Object value) throws IOException { if (value != null) { - String output = value.toString().replace("\n", "\\n"); - out.write(String.valueOf(output.length())); - out.write(","); - out.write(output); + String output = "[EXCEPTION]"; + try { + output = value.toString().replace("\n", "\\n"); + } finally { + out.write(String.valueOf(output.length())); + out.write(","); + out.write(output); + } } else { out.write("4,null"); } diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java index 0c83a738e7ec4..00723f3b91e35 100644 --- a/core/java/android/view/ViewGroup.java +++ b/core/java/android/view/ViewGroup.java @@ -170,6 +170,14 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager * This field should be made private, so it is hidden from the SDK. * {@hide} */ + @ViewDebug.ExportedProperty(flagMapping = { + @ViewDebug.FlagToString(mask = FLAG_CLIP_CHILDREN, equals = FLAG_CLIP_CHILDREN, + name = "CLIP_CHILDREN"), + @ViewDebug.FlagToString(mask = FLAG_CLIP_TO_PADDING, equals = FLAG_CLIP_TO_PADDING, + name = "CLIP_TO_PADDING"), + @ViewDebug.FlagToString(mask = FLAG_PADDING_NOT_NULL, equals = FLAG_PADDING_NOT_NULL, + name = "PADDING_NOT_NULL") + }) protected int mGroupFlags; /* @@ -404,10 +412,6 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager // views during a transition when they otherwise would have become gone/invisible private ArrayList mVisibilityChangingChildren; - // Indicates whether this container will use its children layers to draw - @ViewDebug.ExportedProperty(category = "drawing") - boolean mDrawLayers = true; - // Indicates how many of this container's child subtrees contain transient state @ViewDebug.ExportedProperty(category = "layout") private int mChildCountWithTransientState = 0; @@ -628,11 +632,7 @@ public ActionMode startActionModeForChild(View originalView, ActionMode.Callback * FOCUS_RIGHT, or 0 for not applicable. */ public View focusSearch(View focused, int direction) { - // If we are moving accessibility focus we want to consider all - // views no matter if they are on the screen. It is responsibility - // of the accessibility service to check whether the result is in - // the screen. - if (isRootNamespace() && (direction & FOCUS_ACCESSIBILITY) == 0) { + if (isRootNamespace()) { // root namespace means we should consider ourselves the top of the // tree for focus searching; otherwise we could be focus searching // into other tabs. see LocalActivityManager and TabHost for more info @@ -804,7 +804,7 @@ public View getFocusedChild() { */ @Override public boolean hasFocus() { - return (mPrivateFlags & FOCUSED) != 0 || mFocused != null; + return (mPrivateFlags & PFLAG_FOCUSED) != 0 || mFocused != null; } /* @@ -867,8 +867,7 @@ public void addFocusables(ArrayList views, int direction, int focusableMod final int descendantFocusability = getDescendantFocusability(); - if (descendantFocusability != FOCUS_BLOCK_DESCENDANTS - || (focusableMode & FOCUSABLES_ACCESSIBILITY) == FOCUSABLES_ACCESSIBILITY) { + if (descendantFocusability != FOCUS_BLOCK_DESCENDANTS) { final int count = mChildrenCount; final View[] children = mChildren; @@ -886,9 +885,7 @@ public void addFocusables(ArrayList views, int direction, int focusableMod // among the focusable children would be more interesting. if (descendantFocusability != FOCUS_AFTER_DESCENDANTS // No focusable descendants - || (focusableCount == views.size()) - // We are collecting accessibility focusables. - || (focusableMode & FOCUSABLES_ACCESSIBILITY) == FOCUSABLES_ACCESSIBILITY) { + || (focusableCount == views.size())) { super.addFocusables(views, direction, focusableMode); } } @@ -901,7 +898,7 @@ public void findViewsWithText(ArrayList outViews, CharSequence text, int f for (int i = 0; i < childrenCount; i++) { View child = children[i]; if ((child.mViewFlags & VISIBILITY_MASK) == VISIBLE - && (child.mPrivateFlags & IS_ROOT_NAMESPACE) == 0) { + && (child.mPrivateFlags & PFLAG_IS_ROOT_NAMESPACE) == 0) { child.findViewsWithText(outViews, text, flags); } } @@ -1180,7 +1177,7 @@ public boolean dispatchDragEvent(DragEvent event) { final View view = mCurrentDragView; event.mAction = DragEvent.ACTION_DRAG_EXITED; view.dispatchDragEvent(event); - view.mPrivateFlags2 &= ~View.DRAG_HOVERED; + view.mPrivateFlags2 &= ~View.PFLAG2_DRAG_HOVERED; view.refreshDrawableState(); } mCurrentDragView = target; @@ -1189,7 +1186,7 @@ public boolean dispatchDragEvent(DragEvent event) { if (target != null) { event.mAction = DragEvent.ACTION_DRAG_ENTERED; target.dispatchDragEvent(event); - target.mPrivateFlags2 |= View.DRAG_HOVERED; + target.mPrivateFlags2 |= View.PFLAG2_DRAG_HOVERED; target.refreshDrawableState(); } event.mAction = action; // restore the event's original state @@ -1223,7 +1220,7 @@ public boolean dispatchDragEvent(DragEvent event) { if (mCurrentDragView != null) { final View view = mCurrentDragView; view.dispatchDragEvent(event); - view.mPrivateFlags2 &= ~View.DRAG_HOVERED; + view.mPrivateFlags2 &= ~View.PFLAG2_DRAG_HOVERED; view.refreshDrawableState(); mCurrentDragView = null; @@ -1284,7 +1281,7 @@ boolean notifyChildOfDrag(View child) { mDragNotifiedChildren.add(child); canAccept = child.dispatchDragEvent(mCurrentDrag); if (canAccept && !child.canAcceptDrag()) { - child.mPrivateFlags2 |= View.DRAG_CAN_ACCEPT; + child.mPrivateFlags2 |= View.PFLAG2_DRAG_CAN_ACCEPT; child.refreshDrawableState(); } } @@ -1333,9 +1330,11 @@ boolean updateLocalSystemUiVisibility(int localValue, int localChanges) { */ @Override public boolean dispatchKeyEventPreIme(KeyEvent event) { - if ((mPrivateFlags & (FOCUSED | HAS_BOUNDS)) == (FOCUSED | HAS_BOUNDS)) { + if ((mPrivateFlags & (PFLAG_FOCUSED | PFLAG_HAS_BOUNDS)) + == (PFLAG_FOCUSED | PFLAG_HAS_BOUNDS)) { return super.dispatchKeyEventPreIme(event); - } else if (mFocused != null && (mFocused.mPrivateFlags & HAS_BOUNDS) == HAS_BOUNDS) { + } else if (mFocused != null && (mFocused.mPrivateFlags & PFLAG_HAS_BOUNDS) + == PFLAG_HAS_BOUNDS) { return mFocused.dispatchKeyEventPreIme(event); } return false; @@ -1350,11 +1349,13 @@ public boolean dispatchKeyEvent(KeyEvent event) { mInputEventConsistencyVerifier.onKeyEvent(event, 1); } - if ((mPrivateFlags & (FOCUSED | HAS_BOUNDS)) == (FOCUSED | HAS_BOUNDS)) { + if ((mPrivateFlags & (PFLAG_FOCUSED | PFLAG_HAS_BOUNDS)) + == (PFLAG_FOCUSED | PFLAG_HAS_BOUNDS)) { if (super.dispatchKeyEvent(event)) { return true; } - } else if (mFocused != null && (mFocused.mPrivateFlags & HAS_BOUNDS) == HAS_BOUNDS) { + } else if (mFocused != null && (mFocused.mPrivateFlags & PFLAG_HAS_BOUNDS) + == PFLAG_HAS_BOUNDS) { if (mFocused.dispatchKeyEvent(event)) { return true; } @@ -1371,9 +1372,11 @@ public boolean dispatchKeyEvent(KeyEvent event) { */ @Override public boolean dispatchKeyShortcutEvent(KeyEvent event) { - if ((mPrivateFlags & (FOCUSED | HAS_BOUNDS)) == (FOCUSED | HAS_BOUNDS)) { + if ((mPrivateFlags & (PFLAG_FOCUSED | PFLAG_HAS_BOUNDS)) + == (PFLAG_FOCUSED | PFLAG_HAS_BOUNDS)) { return super.dispatchKeyShortcutEvent(event); - } else if (mFocused != null && (mFocused.mPrivateFlags & HAS_BOUNDS) == HAS_BOUNDS) { + } else if (mFocused != null && (mFocused.mPrivateFlags & PFLAG_HAS_BOUNDS) + == PFLAG_HAS_BOUNDS) { return mFocused.dispatchKeyShortcutEvent(event); } return false; @@ -1388,11 +1391,13 @@ public boolean dispatchTrackballEvent(MotionEvent event) { mInputEventConsistencyVerifier.onTrackballEvent(event, 1); } - if ((mPrivateFlags & (FOCUSED | HAS_BOUNDS)) == (FOCUSED | HAS_BOUNDS)) { + if ((mPrivateFlags & (PFLAG_FOCUSED | PFLAG_HAS_BOUNDS)) + == (PFLAG_FOCUSED | PFLAG_HAS_BOUNDS)) { if (super.dispatchTrackballEvent(event)) { return true; } - } else if (mFocused != null && (mFocused.mPrivateFlags & HAS_BOUNDS) == HAS_BOUNDS) { + } else if (mFocused != null && (mFocused.mPrivateFlags & PFLAG_HAS_BOUNDS) + == PFLAG_HAS_BOUNDS) { if (mFocused.dispatchTrackballEvent(event)) { return true; } @@ -1657,20 +1662,6 @@ public void childAccessibilityStateChanged(View child) { } } - /** - * @hide - */ - @Override - public View findViewToTakeAccessibilityFocusFromHover(View child, View descendant) { - if (includeForAccessibility() && isActionableForAccessibility()) { - return this; - } - if (mParent != null) { - return mParent.findViewToTakeAccessibilityFocusFromHover(this, descendant); - } - return null; - } - /** * Implement this method to intercept hover events before they are handled * by child views. @@ -1732,8 +1723,10 @@ protected boolean dispatchGenericPointerEvent(MotionEvent event) { final float x = event.getX(); final float y = event.getY(); + final boolean customOrder = isChildrenDrawingOrderEnabled(); for (int i = childrenCount - 1; i >= 0; i--) { - final View child = children[i]; + final int childIndex = customOrder ? getChildDrawingOrder(childrenCount, i) : i; + final View child = children[childIndex]; if (!canViewReceivePointerEvents(child) || !isTransformedTouchPointInView(x, y, child, null)) { continue; @@ -1755,9 +1748,11 @@ protected boolean dispatchGenericPointerEvent(MotionEvent event) { @Override protected boolean dispatchGenericFocusedEvent(MotionEvent event) { // Send the event to the focused child or to this view group if it has focus. - if ((mPrivateFlags & (FOCUSED | HAS_BOUNDS)) == (FOCUSED | HAS_BOUNDS)) { + if ((mPrivateFlags & (PFLAG_FOCUSED | PFLAG_HAS_BOUNDS)) + == (PFLAG_FOCUSED | PFLAG_HAS_BOUNDS)) { return super.dispatchGenericFocusedEvent(event); - } else if (mFocused != null && (mFocused.mPrivateFlags & HAS_BOUNDS) == HAS_BOUNDS) { + } else if (mFocused != null && (mFocused.mPrivateFlags & PFLAG_HAS_BOUNDS) + == PFLAG_HAS_BOUNDS) { return mFocused.dispatchGenericMotionEvent(event); } return false; @@ -1858,8 +1853,11 @@ public boolean dispatchTouchEvent(MotionEvent ev) { final float x = ev.getX(actionIndex); final float y = ev.getY(actionIndex); + final boolean customOrder = isChildrenDrawingOrderEnabled(); for (int i = childrenCount - 1; i >= 0; i--) { - final View child = children[i]; + final int childIndex = customOrder ? + getChildDrawingOrder(childrenCount, i) : i; + final View child = children[childIndex]; if (!canViewReceivePointerEvents(child) || !isTransformedTouchPointInView(x, y, child, null)) { continue; @@ -1877,7 +1875,7 @@ public boolean dispatchTouchEvent(MotionEvent ev) { if (dispatchTransformedTouchEvent(ev, false, child, idBitsToAssign)) { // Child wants to receive touch within its bounds. mLastTouchDownTime = ev.getDownTime(); - mLastTouchDownIndex = i; + mLastTouchDownIndex = childIndex; mLastTouchDownX = ev.getX(); mLastTouchDownY = ev.getY(); newTouchTarget = addTouchTarget(child, idBitsToAssign); @@ -1968,8 +1966,8 @@ private void resetTouchState() { * Returns true if the flag was previously set. */ private static boolean resetCancelNextUpFlag(View view) { - if ((view.mPrivateFlags & CANCEL_NEXT_UP_EVENT) != 0) { - view.mPrivateFlags &= ~CANCEL_NEXT_UP_EVENT; + if ((view.mPrivateFlags & PFLAG_CANCEL_NEXT_UP_EVENT) != 0) { + view.mPrivateFlags &= ~PFLAG_CANCEL_NEXT_UP_EVENT; return true; } return false; @@ -2535,11 +2533,11 @@ void dispatchDetachedFromWindow() { } /** - * {@inheritDoc} + * @hide */ @Override - public void setPadding(int left, int top, int right, int bottom) { - super.setPadding(left, top, right, bottom); + protected void internalSetPadding(int left, int top, int right, int bottom) { + super.internalSetPadding(left, top, right, bottom); if ((mPaddingLeft | mPaddingTop | mPaddingRight | mPaddingBottom) != 0) { mGroupFlags |= FLAG_PADDING_NOT_NULL; @@ -2786,7 +2784,7 @@ protected void dispatchDraw(Canvas canvas) { } // We will draw our child's animation, let's reset the flag - mPrivateFlags &= ~DRAW_ANIMATION; + mPrivateFlags &= ~PFLAG_DRAW_ANIMATION; mGroupFlags &= ~FLAG_INVALIDATE_REQUIRED; boolean more = false; @@ -2906,8 +2904,9 @@ protected void dispatchGetDisplayList() { final View child = children[i]; if (((child.mViewFlags & VISIBILITY_MASK) == VISIBLE || child.getAnimation() != null) && child.hasStaticLayer()) { - child.mRecreateDisplayList = (child.mPrivateFlags & INVALIDATED) == INVALIDATED; - child.mPrivateFlags &= ~INVALIDATED; + child.mRecreateDisplayList = (child.mPrivateFlags & PFLAG_INVALIDATED) + == PFLAG_INVALIDATED; + child.mPrivateFlags &= ~PFLAG_INVALIDATED; child.getDisplayList(); child.mRecreateDisplayList = false; } @@ -2929,45 +2928,6 @@ protected boolean drawChild(Canvas canvas, View child, long drawingTime) { return child.draw(canvas, this, drawingTime); } - /** - * - * @param enabled True if children should be drawn with layers, false otherwise. - * - * @hide - */ - public void setChildrenLayersEnabled(boolean enabled) { - if (enabled != mDrawLayers) { - mDrawLayers = enabled; - invalidate(true); - - boolean flushLayers = !enabled; - AttachInfo info = mAttachInfo; - if (info != null && info.mHardwareRenderer != null && - info.mHardwareRenderer.isEnabled()) { - if (!info.mHardwareRenderer.validate()) { - flushLayers = false; - } - } else { - flushLayers = false; - } - - // We need to invalidate any child with a layer. For instance, - // if a child is backed by a hardware layer and we disable layers - // the child is marked as not dirty (flags cleared the last time - // the child was drawn inside its layer.) However, that child might - // never have created its own display list or have an obsolete - // display list. By invalidating the child we ensure the display - // list is in sync with the content of the hardware layer. - for (int i = 0; i < mChildrenCount; i++) { - View child = mChildren[i]; - if (child.mLayerType != LAYER_TYPE_NONE) { - if (flushLayers) child.flushLayer(); - child.invalidate(true); - } - } - } - } - /** * By default, children are clipped to their bounds before drawing. This * allows view groups to override this behavior for animations, etc. @@ -3052,7 +3012,7 @@ protected void dispatchSetPressed(boolean pressed) { * * @param enabled True to enable static transformations on children, false otherwise. * - * @see #FLAG_SUPPORT_STATIC_TRANSFORMATIONS + * @see #getChildStaticTransformation(View, android.view.animation.Transformation) */ protected void setStaticTransformationsEnabled(boolean enabled) { setBooleanFlag(FLAG_SUPPORT_STATIC_TRANSFORMATIONS, enabled); @@ -3062,7 +3022,8 @@ protected void setStaticTransformationsEnabled(boolean enabled) { * Sets t to be the static transformation of the child, if set, returning a * boolean to indicate whether a static transform was set. The default implementation * simply returns false; subclasses may override this method for different - * behavior. + * behavior. {@link #setStaticTransformationsEnabled(boolean)} must be set to true + * for this method to be called. * * @param child The child view whose static transform is being requested * @param t The Transformation which will hold the result @@ -3088,7 +3049,7 @@ protected View findViewTraversal(int id) { for (int i = 0; i < len; i++) { View v = where[i]; - if ((v.mPrivateFlags & IS_ROOT_NAMESPACE) == 0) { + if ((v.mPrivateFlags & PFLAG_IS_ROOT_NAMESPACE) == 0) { v = v.findViewById(id); if (v != null) { @@ -3115,7 +3076,7 @@ protected View findViewWithTagTraversal(Object tag) { for (int i = 0; i < len; i++) { View v = where[i]; - if ((v.mPrivateFlags & IS_ROOT_NAMESPACE) == 0) { + if ((v.mPrivateFlags & PFLAG_IS_ROOT_NAMESPACE) == 0) { v = v.findViewWithTag(tag); if (v != null) { @@ -3142,7 +3103,7 @@ protected View findViewByPredicateTraversal(Predicate predicate, View chil for (int i = 0; i < len; i++) { View v = where[i]; - if (v != childToSkip && (v.mPrivateFlags & IS_ROOT_NAMESPACE) == 0) { + if (v != childToSkip && (v.mPrivateFlags & PFLAG_IS_ROOT_NAMESPACE) == 0) { v = v.findViewByPredicate(predicate); if (v != null) { @@ -3352,7 +3313,7 @@ protected boolean addViewInLayout(View child, int index, LayoutParams params, boolean preventRequestLayout) { child.mParent = null; addViewInner(child, index, params, preventRequestLayout); - child.mPrivateFlags = (child.mPrivateFlags & ~DIRTY_MASK) | DRAWN; + child.mPrivateFlags = (child.mPrivateFlags & ~PFLAG_DIRTY_MASK) | PFLAG_DRAWN; return true; } @@ -3362,7 +3323,7 @@ protected boolean addViewInLayout(View child, int index, LayoutParams params, * @param child the child on which to perform the cleanup */ protected void cleanupLayoutState(View child) { - child.mPrivateFlags &= ~View.FORCE_LAYOUT; + child.mPrivateFlags &= ~View.PFLAG_FORCE_LAYOUT; } private void addViewInner(View child, int index, LayoutParams params, @@ -3421,6 +3382,10 @@ private void addViewInner(View child, int index, LayoutParams params, ai.mKeepScreenOn = lastKeepOn; } + if (child.isLayoutDirectionInherited()) { + child.resetRtlProperties(); + } + onViewAdded(child); if ((child.mViewFlags & DUPLICATE_PARENT_STATE) == DUPLICATE_PARENT_STATE) { @@ -3655,6 +3620,8 @@ private void removeViewInternal(int index, View view) { childHasTransientStateChanged(view, false); } + view.resetRtlProperties(); + onViewRemoved(view); needGlobalAttributesUpdate(false); @@ -3838,6 +3805,13 @@ public void removeAllViewsInLayout() { /** * Finishes the removal of a detached view. This method will dispatch the detached from * window event and notify the hierarchy change listener. + *

          + * This method is intended to be lightweight and makes no assumptions about whether the + * parent or child should be redrawn. Proper use of this method will include also making + * any appropriate {@link #requestLayout()} or {@link #invalidate()} calls. + * For example, callers can {@link #post(Runnable) post} a {@link Runnable} + * which performs a {@link #requestLayout()} on the next frame, after all detach/remove + * calls are finished, causing layout to be run prior to redrawing the view hierarchy. * * @param child the child to be definitely removed from the view hierarchy * @param animate if true and the view has an animation, the view is placed in the @@ -3878,10 +3852,17 @@ protected void removeDetachedView(View child, boolean animate) { /** * Attaches a view to this view group. Attaching a view assigns this group as the parent, - * sets the layout parameters and puts the view in the list of children so it can be retrieved - * by calling {@link #getChildAt(int)}. - * - * This method should be called only for view which were detached from their parent. + * sets the layout parameters and puts the view in the list of children so that + * it can be retrieved by calling {@link #getChildAt(int)}. + *

          + * This method is intended to be lightweight and makes no assumptions about whether the + * parent or child should be redrawn. Proper use of this method will include also making + * any appropriate {@link #requestLayout()} or {@link #invalidate()} calls. + * For example, callers can {@link #post(Runnable) post} a {@link Runnable} + * which performs a {@link #requestLayout()} on the next frame, after all detach/attach + * calls are finished, causing layout to be run prior to redrawing the view hierarchy. + *

          + * This method should be called only for views which were detached from their parent. * * @param child the child to attach * @param index the index at which the child should be attached @@ -3902,9 +3883,10 @@ protected void attachViewToParent(View child, int index, LayoutParams params) { addInArray(child, index); child.mParent = this; - child.mPrivateFlags = (child.mPrivateFlags & ~DIRTY_MASK & ~DRAWING_CACHE_VALID) | - DRAWN | INVALIDATED; - this.mPrivateFlags |= INVALIDATED; + child.mPrivateFlags = (child.mPrivateFlags & ~PFLAG_DIRTY_MASK + & ~PFLAG_DRAWING_CACHE_VALID) + | PFLAG_DRAWN | PFLAG_INVALIDATED; + this.mPrivateFlags |= PFLAG_INVALIDATED; if (child.hasFocus()) { requestChildFocus(child, child.findFocus()); @@ -3912,10 +3894,13 @@ protected void attachViewToParent(View child, int index, LayoutParams params) { } /** - * Detaches a view from its parent. Detaching a view should be temporary and followed - * either by a call to {@link #attachViewToParent(View, int, android.view.ViewGroup.LayoutParams)} - * or a call to {@link #removeDetachedView(View, boolean)}. When a view is detached, - * its parent is null and cannot be retrieved by a call to {@link #getChildAt(int)}. + * Detaches a view from its parent. Detaching a view should be followed + * either by a call to + * {@link #attachViewToParent(View, int, android.view.ViewGroup.LayoutParams)} + * or a call to {@link #removeDetachedView(View, boolean)}. Detachment should only be + * temporary; reattachment or removal should happen within the same drawing cycle as + * detachment. When a view is detached, its parent is null and cannot be retrieved by a + * call to {@link #getChildAt(int)}. * * @param child the child to detach * @@ -3930,10 +3915,13 @@ protected void detachViewFromParent(View child) { } /** - * Detaches a view from its parent. Detaching a view should be temporary and followed - * either by a call to {@link #attachViewToParent(View, int, android.view.ViewGroup.LayoutParams)} - * or a call to {@link #removeDetachedView(View, boolean)}. When a view is detached, - * its parent is null and cannot be retrieved by a call to {@link #getChildAt(int)}. + * Detaches a view from its parent. Detaching a view should be followed + * either by a call to + * {@link #attachViewToParent(View, int, android.view.ViewGroup.LayoutParams)} + * or a call to {@link #removeDetachedView(View, boolean)}. Detachment should only be + * temporary; reattachment or removal should happen within the same drawing cycle as + * detachment. When a view is detached, its parent is null and cannot be retrieved by a + * call to {@link #getChildAt(int)}. * * @param index the index of the child to detach * @@ -3948,10 +3936,13 @@ protected void detachViewFromParent(int index) { } /** - * Detaches a range of view from their parent. Detaching a view should be temporary and followed - * either by a call to {@link #attachViewToParent(View, int, android.view.ViewGroup.LayoutParams)} - * or a call to {@link #removeDetachedView(View, boolean)}. When a view is detached, its - * parent is null and cannot be retrieved by a call to {@link #getChildAt(int)}. + * Detaches a range of views from their parents. Detaching a view should be followed + * either by a call to + * {@link #attachViewToParent(View, int, android.view.ViewGroup.LayoutParams)} + * or a call to {@link #removeDetachedView(View, boolean)}. Detachment should only be + * temporary; reattachment or removal should happen within the same drawing cycle as + * detachment. When a view is detached, its parent is null and cannot be retrieved by a + * call to {@link #getChildAt(int)}. * * @param start the first index of the childrend range to detach * @param count the number of children to detach @@ -3967,10 +3958,13 @@ protected void detachViewsFromParent(int start, int count) { } /** - * Detaches all views from the parent. Detaching a view should be temporary and followed - * either by a call to {@link #attachViewToParent(View, int, android.view.ViewGroup.LayoutParams)} - * or a call to {@link #removeDetachedView(View, boolean)}. When a view is detached, - * its parent is null and cannot be retrieved by a call to {@link #getChildAt(int)}. + * Detaches all views from the parent. Detaching a view should be followed + * either by a call to + * {@link #attachViewToParent(View, int, android.view.ViewGroup.LayoutParams)} + * or a call to {@link #removeDetachedView(View, boolean)}. Detachment should only be + * temporary; reattachment or removal should happen within the same drawing cycle as + * detachment. When a view is detached, its parent is null and cannot be retrieved by a + * call to {@link #getChildAt(int)}. * * @see #detachViewFromParent(View) * @see #detachViewFromParent(int) @@ -4005,7 +3999,8 @@ public final void invalidateChild(View child, final Rect dirty) { // If the child is drawing an animation, we want to copy this flag onto // ourselves and the parent to make sure the invalidate request goes // through - final boolean drawAnimation = (child.mPrivateFlags & DRAW_ANIMATION) == DRAW_ANIMATION; + final boolean drawAnimation = (child.mPrivateFlags & PFLAG_DRAW_ANIMATION) + == PFLAG_DRAW_ANIMATION; // Check whether the child that requests the invalidate is fully opaque // Views being animated or transformed are not considered opaque because we may @@ -4015,22 +4010,38 @@ public final void invalidateChild(View child, final Rect dirty) { child.getAnimation() == null && childMatrix.isIdentity(); // Mark the child as dirty, using the appropriate flag // Make sure we do not set both flags at the same time - int opaqueFlag = isOpaque ? DIRTY_OPAQUE : DIRTY; + int opaqueFlag = isOpaque ? PFLAG_DIRTY_OPAQUE : PFLAG_DIRTY; if (child.mLayerType != LAYER_TYPE_NONE) { - mPrivateFlags |= INVALIDATED; - mPrivateFlags &= ~DRAWING_CACHE_VALID; + mPrivateFlags |= PFLAG_INVALIDATED; + mPrivateFlags &= ~PFLAG_DRAWING_CACHE_VALID; child.mLocalDirtyRect.union(dirty); } final int[] location = attachInfo.mInvalidateChildLocation; location[CHILD_LEFT_INDEX] = child.mLeft; location[CHILD_TOP_INDEX] = child.mTop; - if (!childMatrix.isIdentity()) { + if (!childMatrix.isIdentity() || + (mGroupFlags & ViewGroup.FLAG_SUPPORT_STATIC_TRANSFORMATIONS) != 0) { RectF boundingRect = attachInfo.mTmpTransformRect; boundingRect.set(dirty); - //boundingRect.inset(-0.5f, -0.5f); - childMatrix.mapRect(boundingRect); + Matrix transformMatrix; + if ((mGroupFlags & ViewGroup.FLAG_SUPPORT_STATIC_TRANSFORMATIONS) != 0) { + Transformation t = attachInfo.mTmpTransformation; + boolean transformed = getChildStaticTransformation(child, t); + if (transformed) { + transformMatrix = attachInfo.mTmpMatrix; + transformMatrix.set(t.getMatrix()); + if (!childMatrix.isIdentity()) { + transformMatrix.preConcat(childMatrix); + } + } else { + transformMatrix = childMatrix; + } + } else { + transformMatrix = childMatrix; + } + transformMatrix.mapRect(boundingRect); dirty.set((int) (boundingRect.left - 0.5f), (int) (boundingRect.top - 0.5f), (int) (boundingRect.right + 0.5f), @@ -4045,7 +4056,7 @@ public final void invalidateChild(View child, final Rect dirty) { if (drawAnimation) { if (view != null) { - view.mPrivateFlags |= DRAW_ANIMATION; + view.mPrivateFlags |= PFLAG_DRAW_ANIMATION; } else if (parent instanceof ViewRootImpl) { ((ViewRootImpl) parent).mIsAnimating = true; } @@ -4056,10 +4067,10 @@ public final void invalidateChild(View child, final Rect dirty) { if (view != null) { if ((view.mViewFlags & FADING_EDGE_MASK) != 0 && view.getSolidColor() == 0) { - opaqueFlag = DIRTY; + opaqueFlag = PFLAG_DIRTY; } - if ((view.mPrivateFlags & DIRTY_MASK) != DIRTY) { - view.mPrivateFlags = (view.mPrivateFlags & ~DIRTY_MASK) | opaqueFlag; + if ((view.mPrivateFlags & PFLAG_DIRTY_MASK) != PFLAG_DIRTY) { + view.mPrivateFlags = (view.mPrivateFlags & ~PFLAG_DIRTY_MASK) | opaqueFlag; } } @@ -4090,8 +4101,8 @@ public final void invalidateChild(View child, final Rect dirty) { * does not intersect with this ViewGroup's bounds. */ public ViewParent invalidateChildInParent(final int[] location, final Rect dirty) { - if ((mPrivateFlags & DRAWN) == DRAWN || - (mPrivateFlags & DRAWING_CACHE_VALID) == DRAWING_CACHE_VALID) { + if ((mPrivateFlags & PFLAG_DRAWN) == PFLAG_DRAWN || + (mPrivateFlags & PFLAG_DRAWING_CACHE_VALID) == PFLAG_DRAWING_CACHE_VALID) { if ((mGroupFlags & (FLAG_OPTIMIZE_INVALIDATE | FLAG_ANIMATION_DONE)) != FLAG_OPTIMIZE_INVALIDATE) { dirty.offset(location[CHILD_LEFT_INDEX] - mScrollX, @@ -4105,20 +4116,20 @@ public ViewParent invalidateChildInParent(final int[] location, final Rect dirty dirty.setEmpty(); } } - mPrivateFlags &= ~DRAWING_CACHE_VALID; + mPrivateFlags &= ~PFLAG_DRAWING_CACHE_VALID; location[CHILD_LEFT_INDEX] = left; location[CHILD_TOP_INDEX] = top; if (mLayerType != LAYER_TYPE_NONE) { - mPrivateFlags |= INVALIDATED; + mPrivateFlags |= PFLAG_INVALIDATED; mLocalDirtyRect.union(dirty); } return mParent; } else { - mPrivateFlags &= ~DRAWN & ~DRAWING_CACHE_VALID; + mPrivateFlags &= ~PFLAG_DRAWN & ~PFLAG_DRAWING_CACHE_VALID; location[CHILD_LEFT_INDEX] = mLeft; location[CHILD_TOP_INDEX] = mTop; @@ -4130,7 +4141,7 @@ public ViewParent invalidateChildInParent(final int[] location, final Rect dirty } if (mLayerType != LAYER_TYPE_NONE) { - mPrivateFlags |= INVALIDATED; + mPrivateFlags |= PFLAG_INVALIDATED; mLocalDirtyRect.union(dirty); } @@ -4192,8 +4203,8 @@ public void invalidateChildFast(View child, final Rect dirty) { * coordinate system, pruning the invalidation if the parent has already been invalidated. */ private ViewParent invalidateChildInParentFast(int left, int top, final Rect dirty) { - if ((mPrivateFlags & DRAWN) == DRAWN || - (mPrivateFlags & DRAWING_CACHE_VALID) == DRAWING_CACHE_VALID) { + if ((mPrivateFlags & PFLAG_DRAWN) == PFLAG_DRAWN || + (mPrivateFlags & PFLAG_DRAWING_CACHE_VALID) == PFLAG_DRAWING_CACHE_VALID) { dirty.offset(left - mScrollX, top - mScrollY); if ((mGroupFlags & FLAG_CLIP_CHILDREN) == 0 || @@ -4956,11 +4967,11 @@ void finishAnimatingView(final View view, Animation animation) { view.clearAnimation(); } - if ((view.mPrivateFlags & ANIMATION_STARTED) == ANIMATION_STARTED) { + if ((view.mPrivateFlags & PFLAG_ANIMATION_STARTED) == PFLAG_ANIMATION_STARTED) { view.onAnimationEnd(); // Should be performed by onAnimationEnd() but this avoid an infinite loop, // so we'd rather be safe than sorry - view.mPrivateFlags &= ~ANIMATION_STARTED; + view.mPrivateFlags &= ~PFLAG_ANIMATION_STARTED; // Draw one more frame after the animation is done mGroupFlags |= FLAG_INVALIDATE_REQUIRED; } @@ -5059,7 +5070,7 @@ public void endTransition(LayoutTransition transition, ViewGroup container, @Override public boolean gatherTransparentRegion(Region region) { // If no transparent regions requested, we are always opaque. - final boolean meOpaque = (mPrivateFlags & View.REQUEST_TRANSPARENT_REGIONS) == 0; + final boolean meOpaque = (mPrivateFlags & View.PFLAG_REQUEST_TRANSPARENT_REGIONS) == 0; if (meOpaque && region == null) { // The caller doesn't care about the region, so stop now. return true; @@ -5084,7 +5095,7 @@ public boolean gatherTransparentRegion(Region region) { */ public void requestTransparentRegion(View child) { if (child != null) { - child.mPrivateFlags |= View.REQUEST_TRANSPARENT_REGIONS; + child.mPrivateFlags |= View.PFLAG_REQUEST_TRANSPARENT_REGIONS; if (mParent != null) { mParent.requestTransparentRegion(this); } @@ -5249,12 +5260,140 @@ public void requestTransitionStart(LayoutTransition transition) { * @hide */ @Override - public void onResolvedLayoutDirectionReset() { - // Take care of resetting the children resolution too - final int count = getChildCount(); + public void resolveRtlPropertiesIfNeeded() { + super.resolveRtlPropertiesIfNeeded(); + int count = getChildCount(); + for (int i = 0; i < count; i++) { + final View child = getChildAt(i); + if (child.isLayoutDirectionInherited()) { + child.resolveRtlPropertiesIfNeeded(); + } + } + } + + /** + * @hide + */ + @Override + public boolean resolveLayoutDirection() { + final boolean result = super.resolveLayoutDirection(); + if (result) { + int count = getChildCount(); + for (int i = 0; i < count; i++) { + final View child = getChildAt(i); + if (child.isLayoutDirectionInherited()) { + child.resolveLayoutDirection(); + } + } + } + return result; + } + + /** + * @hide + */ + @Override + public boolean resolveTextDirection() { + final boolean result = super.resolveTextDirection(); + if (result) { + int count = getChildCount(); + for (int i = 0; i < count; i++) { + final View child = getChildAt(i); + if (child.isTextDirectionInherited()) { + child.resolveTextDirection(); + } + } + } + return result; + } + + /** + * @hide + */ + @Override + public boolean resolveTextAlignment() { + final boolean result = super.resolveTextAlignment(); + if (result) { + int count = getChildCount(); + for (int i = 0; i < count; i++) { + final View child = getChildAt(i); + if (child.isTextAlignmentInherited()) { + child.resolveTextAlignment(); + } + } + } + return result; + } + + /** + * @hide + */ + @Override + public void resolvePadding() { + super.resolvePadding(); + int count = getChildCount(); + for (int i = 0; i < count; i++) { + final View child = getChildAt(i); + if (child.isLayoutDirectionInherited()) { + child.resolvePadding(); + } + } + } + + /** + * @hide + */ + @Override + protected void resolveDrawables() { + super.resolveDrawables(); + int count = getChildCount(); + for (int i = 0; i < count; i++) { + final View child = getChildAt(i); + if (child.isLayoutDirectionInherited()) { + child.resolveDrawables(); + } + } + } + + /** + * @hide + */ + @Override + public void resolveLayoutParams() { + super.resolveLayoutParams(); + int count = getChildCount(); + for (int i = 0; i < count; i++) { + final View child = getChildAt(i); + child.resolveLayoutParams(); + } + } + + /** + * @hide + */ + @Override + public void resetRtlProperties() { + super.resetRtlProperties(); + int count = getChildCount(); + for (int i = 0; i < count; i++) { + final View child = getChildAt(i); + if (child.isLayoutDirectionInherited()) { + child.resetRtlProperties(); + } + } + } + + /** + * @hide + */ + @Override + public void resetResolvedLayoutDirection() { + super.resetResolvedLayoutDirection(); + + int count = getChildCount(); for (int i = 0; i < count; i++) { final View child = getChildAt(i); - if (child.getLayoutDirection() == LAYOUT_DIRECTION_INHERIT) { + if (child.isLayoutDirectionInherited()) { child.resetResolvedLayoutDirection(); } } @@ -5264,12 +5403,13 @@ public void onResolvedLayoutDirectionReset() { * @hide */ @Override - public void onResolvedTextDirectionReset() { - // Take care of resetting the children resolution too - final int count = getChildCount(); + public void resetResolvedTextDirection() { + super.resetResolvedTextDirection(); + + int count = getChildCount(); for (int i = 0; i < count; i++) { final View child = getChildAt(i); - if (child.getTextDirection() == TEXT_DIRECTION_INHERIT) { + if (child.isTextDirectionInherited()) { child.resetResolvedTextDirection(); } } @@ -5279,17 +5419,50 @@ public void onResolvedTextDirectionReset() { * @hide */ @Override - public void onResolvedTextAlignmentReset() { - // Take care of resetting the children resolution too - final int count = getChildCount(); + public void resetResolvedTextAlignment() { + super.resetResolvedTextAlignment(); + + int count = getChildCount(); for (int i = 0; i < count; i++) { final View child = getChildAt(i); - if (child.getTextAlignment() == TEXT_ALIGNMENT_INHERIT) { + if (child.isTextAlignmentInherited()) { child.resetResolvedTextAlignment(); } } } + /** + * @hide + */ + @Override + public void resetResolvedPadding() { + super.resetResolvedPadding(); + + int count = getChildCount(); + for (int i = 0; i < count; i++) { + final View child = getChildAt(i); + if (child.isLayoutDirectionInherited()) { + child.resetResolvedPadding(); + } + } + } + + /** + * @hide + */ + @Override + protected void resetResolvedDrawables() { + super.resetResolvedDrawables(); + + int count = getChildCount(); + for (int i = 0; i < count; i++) { + final View child = getChildAt(i); + if (child.isLayoutDirectionInherited()) { + child.resetResolvedDrawables(); + } + } + } + /** * Return true if the pressed state should be delayed for children or descendants of this * ViewGroup. Generally, this should be done for containers that can scroll, such as a List. @@ -5468,9 +5641,8 @@ protected void setBaseAttributes(TypedArray a, int widthAttr, int heightAttr) { * * {@link View#LAYOUT_DIRECTION_LTR} * {@link View#LAYOUT_DIRECTION_RTL} - * @hide */ - public void onResolveLayoutDirection(int layoutDirection) { + public void resolveLayoutDirection(int layoutDirection) { } /** @@ -5560,24 +5732,31 @@ public static class MarginLayoutParams extends ViewGroup.LayoutParams { * The start margin in pixels of the child. * Call {@link ViewGroup#setLayoutParams(LayoutParams)} after reassigning a new value * to this field. - * @hide */ @ViewDebug.ExportedProperty(category = "layout") - public int startMargin = DEFAULT_RELATIVE; + private int startMargin = DEFAULT_RELATIVE; /** * The end margin in pixels of the child. * Call {@link ViewGroup#setLayoutParams(LayoutParams)} after reassigning a new value * to this field. - * @hide */ @ViewDebug.ExportedProperty(category = "layout") - public int endMargin = DEFAULT_RELATIVE; + private int endMargin = DEFAULT_RELATIVE; /** * The default start and end margin. + * @hide */ - static private final int DEFAULT_RELATIVE = Integer.MIN_VALUE; + public static final int DEFAULT_RELATIVE = Integer.MIN_VALUE; + + private int initialLeftMargin; + private int initialRightMargin; + + private static int LAYOUT_DIRECTION_UNDEFINED = -1; + + // Layout direction undefined by default + private int layoutDirection = LAYOUT_DIRECTION_UNDEFINED; /** * Creates a new set of layout parameters. The values are extracted from @@ -5617,6 +5796,9 @@ public MarginLayoutParams(Context c, AttributeSet attrs) { R.styleable.ViewGroup_MarginLayout_layout_marginEnd, DEFAULT_RELATIVE); } + initialLeftMargin = leftMargin; + initialRightMargin = rightMargin; + a.recycle(); } @@ -5642,6 +5824,11 @@ public MarginLayoutParams(MarginLayoutParams source) { this.bottomMargin = source.bottomMargin; this.startMargin = source.startMargin; this.endMargin = source.endMargin; + + this.initialLeftMargin = source.leftMargin; + this.initialRightMargin = source.rightMargin; + + setLayoutDirection(source.layoutDirection); } /** @@ -5671,6 +5858,8 @@ public void setMargins(int left, int top, int right, int bottom) { topMargin = top; rightMargin = right; bottomMargin = bottom; + initialLeftMargin = left; + initialRightMargin = right; } /** @@ -5688,6 +5877,7 @@ public void setMargins(int left, int top, int right, int bottom) { * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginTop * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginEnd * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginBottom + * * @hide */ public void setMarginsRelative(int start, int top, int end, int bottom) { @@ -5695,6 +5885,19 @@ public void setMarginsRelative(int start, int top, int end, int bottom) { topMargin = top; endMargin = end; bottomMargin = bottom; + initialLeftMargin = 0; + initialRightMargin = 0; + } + + /** + * Sets the relative start margin. + * + * @param start the start margin size + * + * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginStart + */ + public void setMarginStart(int start) { + startMargin = start; } /** @@ -5703,10 +5906,27 @@ public void setMarginsRelative(int start, int top, int end, int bottom) { * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginStart * * @return the start margin in pixels. - * @hide */ public int getMarginStart() { - return startMargin; + if (startMargin != DEFAULT_RELATIVE) return startMargin; + switch(layoutDirection) { + case View.LAYOUT_DIRECTION_RTL: + return rightMargin; + case View.LAYOUT_DIRECTION_LTR: + default: + return leftMargin; + } + } + + /** + * Sets the relative end margin. + * + * @param end the end margin size + * + * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginEnd + */ + public void setMarginEnd(int end) { + endMargin = end; } /** @@ -5715,10 +5935,16 @@ public int getMarginStart() { * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginEnd * * @return the end margin in pixels. - * @hide */ public int getMarginEnd() { - return endMargin; + if (endMargin != DEFAULT_RELATIVE) return endMargin; + switch(layoutDirection) { + case View.LAYOUT_DIRECTION_RTL: + return leftMargin; + case View.LAYOUT_DIRECTION_LTR: + default: + return rightMargin; + } } /** @@ -5727,33 +5953,64 @@ public int getMarginEnd() { * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginStart * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginEnd * - * @return true if either marginStart or marginEnd has been set - * @hide + * @return true if either marginStart or marginEnd has been set. */ public boolean isMarginRelative() { return (startMargin != DEFAULT_RELATIVE) || (endMargin != DEFAULT_RELATIVE); } + /** + * Set the layout direction + * @param layoutDirection the layout direction. + * Should be either {@link View#LAYOUT_DIRECTION_LTR} + * or {@link View#LAYOUT_DIRECTION_RTL}. + */ + public void setLayoutDirection(int layoutDirection) { + if (layoutDirection != View.LAYOUT_DIRECTION_LTR && + layoutDirection != View.LAYOUT_DIRECTION_RTL) return; + this.layoutDirection = layoutDirection; + } + + /** + * Retuns the layout direction. Can be either {@link View#LAYOUT_DIRECTION_LTR} or + * {@link View#LAYOUT_DIRECTION_RTL}. + * + * @return the layout direction. + */ + public int getLayoutDirection() { + return layoutDirection; + } + /** * This will be called by {@link android.view.View#requestLayout()}. Left and Right margins * may be overridden depending on layout direction. - * @hide */ @Override - public void onResolveLayoutDirection(int layoutDirection) { + public void resolveLayoutDirection(int layoutDirection) { + setLayoutDirection(layoutDirection); + + if (!isMarginRelative()) return; + switch(layoutDirection) { case View.LAYOUT_DIRECTION_RTL: - leftMargin = (endMargin > DEFAULT_RELATIVE) ? endMargin : leftMargin; - rightMargin = (startMargin > DEFAULT_RELATIVE) ? startMargin : rightMargin; + leftMargin = (endMargin > DEFAULT_RELATIVE) ? endMargin : initialLeftMargin; + rightMargin = (startMargin > DEFAULT_RELATIVE) ? startMargin : initialRightMargin; break; case View.LAYOUT_DIRECTION_LTR: default: - leftMargin = (startMargin > DEFAULT_RELATIVE) ? startMargin : leftMargin; - rightMargin = (endMargin > DEFAULT_RELATIVE) ? endMargin : rightMargin; + leftMargin = (startMargin > DEFAULT_RELATIVE) ? startMargin : initialLeftMargin; + rightMargin = (endMargin > DEFAULT_RELATIVE) ? endMargin : initialRightMargin; break; } } + /** + * @hide + */ + public boolean isLayoutRtl() { + return (layoutDirection == View.LAYOUT_DIRECTION_RTL); + } + /** * @hide */ @@ -6080,7 +6337,7 @@ private void init(ViewGroup root, View view) { view.getDrawingRect(viewLocation); root.offsetDescendantRectToMyCoords(view, viewLocation); mView = view; - mLayoutDirection = root.getResolvedLayoutDirection(); + mLayoutDirection = root.getLayoutDirection(); } private void clear() { diff --git a/core/java/android/view/ViewManager.java b/core/java/android/view/ViewManager.java index 7f318c1ac9a14..ab6856f8ae88c 100644 --- a/core/java/android/view/ViewManager.java +++ b/core/java/android/view/ViewManager.java @@ -21,6 +21,16 @@ */ public interface ViewManager { + /** + * Assign the passed LayoutParams to the passed View and add the view to the window. + *

          Throws {@link android.view.WindowManager.BadTokenException} for certain programming + * errors, such as adding a second view to a window without removing the first view. + *

          Throws {@link android.view.WindowManager.InvalidDisplayException} if the window is on a + * secondary {@link Display} and the specified display can't be found + * (see {@link android.app.Presentation}). + * @param view The view to be added to this window. + * @param params The LayoutParams to assign to view. + */ public void addView(View view, ViewGroup.LayoutParams params); public void updateViewLayout(View view, ViewGroup.LayoutParams params); public void removeView(View view); diff --git a/core/java/android/view/ViewParent.java b/core/java/android/view/ViewParent.java index d93b996085786..ddff91de0ac92 100644 --- a/core/java/android/view/ViewParent.java +++ b/core/java/android/view/ViewParent.java @@ -295,16 +295,4 @@ public boolean requestChildRectangleOnScreen(View child, Rect rectangle, * @hide */ public void childAccessibilityStateChanged(View child); - - /** - * A descendant requests this view to find a candidate to take accessibility - * focus from hover. - * - * @param child The child making the call. - * @param descendant The descendant that made the initial request. - * @return A view to take accessibility focus. - * - * @hide - */ - public View findViewToTakeAccessibilityFocusFromHover(View child, View descendant); } diff --git a/core/java/android/view/ViewPropertyAnimator.java b/core/java/android/view/ViewPropertyAnimator.java index ce6f4c5cd50b1..d8db14ca28867 100644 --- a/core/java/android/view/ViewPropertyAnimator.java +++ b/core/java/android/view/ViewPropertyAnimator.java @@ -1036,7 +1036,7 @@ public void onAnimationUpdate(ValueAnimator animation) { if ((propertyMask & TRANSFORM_MASK) != 0) { mView.mTransformationInfo.mMatrixDirty = true; if (!useDisplayListProperties) { - mView.mPrivateFlags |= View.DRAWN; // force another invalidation + mView.mPrivateFlags |= View.PFLAG_DRAWN; // force another invalidation } } // invalidate(false) in all cases except if alphaHandled gets set to true diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index ad850daa6c30e..b6016e93be535 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -18,7 +18,6 @@ import android.Manifest; import android.animation.LayoutTransition; -import android.animation.ValueAnimator; import android.app.ActivityManagerNative; import android.content.ClipDescription; import android.content.ComponentCallbacks; @@ -74,10 +73,9 @@ import android.widget.Scroller; import com.android.internal.R; +import com.android.internal.os.SomeArgs; import com.android.internal.policy.PolicyManager; import com.android.internal.view.BaseSurfaceHolder; -import com.android.internal.view.IInputMethodCallback; -import com.android.internal.view.IInputMethodSession; import com.android.internal.view.RootViewSurfaceTaker; import java.io.IOException; @@ -89,7 +87,7 @@ /** * The top of a view hierarchy, implementing the needed protocol between View * and the WindowManager. This is for the most part an internal implementation - * detail of {@link WindowManagerImpl}. + * detail of {@link WindowManagerGlobal}. * * {@hide} */ @@ -111,7 +109,7 @@ public final class ViewRootImpl implements ViewParent, private static final boolean DEBUG_FPS = false; private static final boolean USE_RENDER_THREAD = false; - + /** * Set this system property to true to force the view hierarchy to render * at 60 Hz. This can be used to measure the potential framerate. @@ -127,11 +125,6 @@ public final class ViewRootImpl implements ViewParent, */ static final int MAX_TRACKBALL_DELAY = 250; - static IWindowSession sWindowSession; - - static final Object mStaticInit = new Object(); - static boolean mInitialized = false; - static final ThreadLocal sRunQueues = new ThreadLocal(); static final ArrayList sFirstDrawHandlers = new ArrayList(); @@ -144,6 +137,9 @@ public final class ViewRootImpl implements ViewParent, private static boolean sRenderThreadQueried = false; private static final Object[] sRenderThreadQueryLock = new Object[0]; + final IWindowSession mWindowSession; + final Display mDisplay; + long mLastTrackballTime = 0; final TrackballAxis mTrackballAxisX = new TrackballAxis(); final TrackballAxis mTrackballAxisY = new TrackballAxis(); @@ -218,6 +214,9 @@ public final class ViewRootImpl implements ViewParent, boolean mTraversalScheduled; int mTraversalBarrier; boolean mWillDrawSoon; + /** Set to true while in performTraversals for detecting when die(true) is called from internal + * callbacks such as onMeasure, onPreDraw, onDraw and deferring doDie() until later. */ + boolean mIsInTraversal; boolean mFitSystemWindowsRequested; boolean mLayoutRequested; boolean mFirst; @@ -251,9 +250,7 @@ public final class ViewRootImpl implements ViewParent, boolean mAdded; boolean mAddedTouchMode; - CompatibilityInfoHolder mCompatibilityInfo; - - /*package*/ int mAddNesting; + final CompatibilityInfoHolder mCompatibilityInfo; // These are accessed by multiple threads. final Rect mWinFrame; // frame given by window manager. @@ -268,12 +265,6 @@ public final class ViewRootImpl implements ViewParent, final Configuration mLastConfiguration = new Configuration(); final Configuration mPendingConfiguration = new Configuration(); - class ResizedInfo { - Rect contentInsets; - Rect visibleInsets; - Configuration newConfig; - } - boolean mScrollMayChange; int mSoftInputMode; View mLastScrolledFocus; @@ -322,6 +313,9 @@ class ResizedInfo { HashSet mTempHashSet; private final int mDensity; + private final int mNoncompatDensity; + + private int mViewLayoutDirectionInitial; /** * Consistency verifier for debugging purposes. @@ -330,24 +324,6 @@ class ResizedInfo { InputEventConsistencyVerifier.isInstrumentationEnabled() ? new InputEventConsistencyVerifier(this, 0) : null; - public static IWindowSession getWindowSession(Looper mainLooper) { - synchronized (mStaticInit) { - if (!mInitialized) { - try { - InputMethodManager imm = InputMethodManager.getInstance(mainLooper); - IWindowManager windowManager = Display.getWindowManager(); - sWindowSession = windowManager.openSession( - imm.getClient(), imm.getInputContext()); - float animatorScale = windowManager.getAnimationScale(2); - ValueAnimator.setDurationScale(animatorScale); - mInitialized = true; - } catch (RemoteException e) { - } - } - return sWindowSession; - } - } - static final class SystemUiVisibilityInfo { int seq; int globalVisibility; @@ -355,7 +331,7 @@ static final class SystemUiVisibilityInfo { int localChanges; } - public ViewRootImpl(Context context) { + public ViewRootImpl(Context context, Display display) { super(); if (MEASURE_LATENCY) { @@ -367,7 +343,11 @@ public ViewRootImpl(Context context) { // Initialize the statics when this class is first instantiated. This is // done here instead of in the static block because Zygote does not // allow the spawning of threads. - getWindowSession(context.getMainLooper()); + mWindowSession = WindowManagerGlobal.getWindowSession(context.getMainLooper()); + mDisplay = display; + + CompatibilityInfoHolder cih = display.getCompatibilityInfo(); + mCompatibilityInfo = cih != null ? cih : new CompatibilityInfoHolder(); mThread = Thread.currentThread(); mLocation = new WindowLeaked(null); @@ -391,9 +371,10 @@ public ViewRootImpl(Context context) { new AccessibilityInteractionConnectionManager(); mAccessibilityManager.addAccessibilityStateChangeListener( mAccessibilityInteractionConnectionManager); - mAttachInfo = new View.AttachInfo(sWindowSession, mWindow, this, mHandler, this); + mAttachInfo = new View.AttachInfo(mWindowSession, mWindow, display, this, mHandler, this); mViewConfiguration = ViewConfiguration.get(context); mDensity = context.getResources().getDisplayMetrics().densityDpi; + mNoncompatDensity = context.getResources().getDisplayMetrics().noncompatDensityDpi; mFallbackEventHandler = PolicyManager.makeNewFallbackEventHandler(context); mProfileRendering = Boolean.parseBoolean( SystemProperties.get(PROPERTY_PROFILE_RENDERING, "false")); @@ -467,9 +448,10 @@ public void profile() { * @hide */ static boolean isInTouchMode() { - if (mInitialized) { + IWindowSession windowSession = WindowManagerGlobal.peekWindowSession(); + if (windowSession != null) { try { - return sWindowSession.getInTouchMode(); + return windowSession.getInTouchMode(); } catch (RemoteException e) { } } @@ -483,6 +465,7 @@ public void setView(View view, WindowManager.LayoutParams attrs, View panelParen synchronized (this) { if (mView == null) { mView = view; + mViewLayoutDirectionInitial = mView.getRawLayoutDirection(); mFallbackEventHandler.setView(view); mWindowAttributes.copyFrom(attrs); attrs = mWindowAttributes; @@ -548,9 +531,9 @@ public void setView(View view, WindowManager.LayoutParams attrs, View panelParen mOrigWindowType = mWindowAttributes.type; mAttachInfo.mRecomputeGlobalAttributes = true; collectViewAttributes(); - res = sWindowSession.add(mWindow, mSeq, mWindowAttributes, - getHostVisibility(), mAttachInfo.mContentInsets, - mInputChannel); + res = mWindowSession.addToDisplay(mWindow, mSeq, mWindowAttributes, + getHostVisibility(), mDisplay.getDisplayId(), + mAttachInfo.mContentInsets, mInputChannel); } catch (RemoteException e) { mAdded = false; mView = null; @@ -572,43 +555,46 @@ public void setView(View view, WindowManager.LayoutParams attrs, View panelParen mPendingContentInsets.set(mAttachInfo.mContentInsets); mPendingVisibleInsets.set(0, 0, 0, 0); if (DEBUG_LAYOUT) Log.v(TAG, "Added window " + mWindow); - if (res < WindowManagerImpl.ADD_OKAY) { - mView = null; + if (res < WindowManagerGlobal.ADD_OKAY) { mAttachInfo.mRootView = null; mAdded = false; mFallbackEventHandler.setView(null); unscheduleTraversals(); setAccessibilityFocus(null, null); switch (res) { - case WindowManagerImpl.ADD_BAD_APP_TOKEN: - case WindowManagerImpl.ADD_BAD_SUBWINDOW_TOKEN: - throw new WindowManagerImpl.BadTokenException( + case WindowManagerGlobal.ADD_BAD_APP_TOKEN: + case WindowManagerGlobal.ADD_BAD_SUBWINDOW_TOKEN: + throw new WindowManager.BadTokenException( "Unable to add window -- token " + attrs.token + " is not valid; is your activity running?"); - case WindowManagerImpl.ADD_NOT_APP_TOKEN: - throw new WindowManagerImpl.BadTokenException( + case WindowManagerGlobal.ADD_NOT_APP_TOKEN: + throw new WindowManager.BadTokenException( "Unable to add window -- token " + attrs.token + " is not for an application"); - case WindowManagerImpl.ADD_APP_EXITING: - throw new WindowManagerImpl.BadTokenException( + case WindowManagerGlobal.ADD_APP_EXITING: + throw new WindowManager.BadTokenException( "Unable to add window -- app for token " + attrs.token + " is exiting"); - case WindowManagerImpl.ADD_DUPLICATE_ADD: - throw new WindowManagerImpl.BadTokenException( + case WindowManagerGlobal.ADD_DUPLICATE_ADD: + throw new WindowManager.BadTokenException( "Unable to add window -- window " + mWindow + " has already been added"); - case WindowManagerImpl.ADD_STARTING_NOT_NEEDED: + case WindowManagerGlobal.ADD_STARTING_NOT_NEEDED: // Silently ignore -- we would have just removed it // right away, anyway. return; - case WindowManagerImpl.ADD_MULTIPLE_SINGLETON: - throw new WindowManagerImpl.BadTokenException( + case WindowManagerGlobal.ADD_MULTIPLE_SINGLETON: + throw new WindowManager.BadTokenException( "Unable to add window " + mWindow + " -- another window of this type already exists"); - case WindowManagerImpl.ADD_PERMISSION_DENIED: - throw new WindowManagerImpl.BadTokenException( + case WindowManagerGlobal.ADD_PERMISSION_DENIED: + throw new WindowManager.BadTokenException( "Unable to add window " + mWindow + " -- permission denied for this window type"); + case WindowManagerGlobal.ADD_INVALID_DISPLAY: + throw new WindowManager.InvalidDisplayException( + "Unable to add window " + mWindow + + " -- the specified display can not be found"); } throw new RuntimeException( "Unable to add window -- unknown error code " + res); @@ -629,8 +615,8 @@ public void setView(View view, WindowManager.LayoutParams attrs, View panelParen } view.assignParent(this); - mAddedTouchMode = (res&WindowManagerImpl.ADD_FLAG_IN_TOUCH_MODE) != 0; - mAppVisible = (res&WindowManagerImpl.ADD_FLAG_APP_VISIBLE) != 0; + mAddedTouchMode = (res & WindowManagerGlobal.ADD_FLAG_IN_TOUCH_MODE) != 0; + mAppVisible = (res & WindowManagerGlobal.ADD_FLAG_APP_VISIBLE) != 0; if (mAccessibilityManager.isEnabled()) { mAccessibilityInteractionConnectionManager.ensureConnection(); @@ -673,6 +659,12 @@ void destroyHardwareLayers() { } } + void pushHardwareLayerUpdate(HardwareLayer layer) { + if (mAttachInfo.mHardwareRenderer != null && mAttachInfo.mHardwareRenderer.isEnabled()) { + mAttachInfo.mHardwareRenderer.pushLayerUpdate(layer); + } + } + public boolean attachFunctor(int functor) { //noinspection SimplifiableIfStatement if (mAttachInfo.mHardwareRenderer != null && mAttachInfo.mHardwareRenderer.isEnabled()) { @@ -819,27 +811,21 @@ void handleScreenStateChange(boolean on) { } } - /** - * {@inheritDoc} - */ + @Override public void requestFitSystemWindows() { checkThread(); mFitSystemWindowsRequested = true; scheduleTraversals(); } - /** - * {@inheritDoc} - */ + @Override public void requestLayout() { checkThread(); mLayoutRequested = true; scheduleTraversals(); } - /** - * {@inheritDoc} - */ + @Override public boolean isLayoutRequested() { return mLayoutRequested; } @@ -852,13 +838,14 @@ void invalidate() { void invalidateWorld(View view) { view.invalidate(); if (view instanceof ViewGroup) { - ViewGroup parent = (ViewGroup)view; - for (int i=0; i 0) { - final ArrayList listeners = - (ArrayList) mOnPreDrawListeners.clone(); - int numListeners = listeners.size(); - for (int i = 0; i < numListeners; ++i) { - cancelDraw |= !(listeners.get(i).onPreDraw()); + final CopyOnWriteArray listeners = mOnPreDrawListeners; + if (listeners != null && listeners.size() > 0) { + CopyOnWriteArray.Access access = listeners.start(); + try { + int count = access.size(); + for (int i = 0; i < count; i++) { + cancelDraw |= !(access.get(i).onPreDraw()); + } + } finally { + listeners.end(); } } return cancelDraw; @@ -710,10 +722,16 @@ final void dispatchOnScrollChanged() { // perform the dispatching. The iterator is a safe guard against listeners that // could mutate the list by calling the various add/remove methods. This prevents // the array from being modified while we iterate it. - final CopyOnWriteArrayList listeners = mOnScrollChangedListeners; + final CopyOnWriteArray listeners = mOnScrollChangedListeners; if (listeners != null && listeners.size() > 0) { - for (OnScrollChangedListener listener : listeners) { - listener.onScrollChanged(); + CopyOnWriteArray.Access access = listeners.start(); + try { + int count = access.size(); + for (int i = 0; i < count; i++) { + access.get(i).onScrollChanged(); + } + } finally { + listeners.end(); } } } @@ -722,11 +740,11 @@ final void dispatchOnScrollChanged() { * Returns whether there are listeners for computing internal insets. */ final boolean hasComputeInternalInsetsListeners() { - final CopyOnWriteArrayList listeners = + final CopyOnWriteArray listeners = mOnComputeInternalInsetsListeners; return (listeners != null && listeners.size() > 0); } - + /** * Calls all listeners to compute the current insets. */ @@ -735,12 +753,105 @@ final void dispatchOnComputeInternalInsets(InternalInsetsInfo inoutInfo) { // perform the dispatching. The iterator is a safe guard against listeners that // could mutate the list by calling the various add/remove methods. This prevents // the array from being modified while we iterate it. - final CopyOnWriteArrayList listeners = + final CopyOnWriteArray listeners = mOnComputeInternalInsetsListeners; if (listeners != null && listeners.size() > 0) { - for (OnComputeInternalInsetsListener listener : listeners) { - listener.onComputeInternalInsets(inoutInfo); + CopyOnWriteArray.Access access = listeners.start(); + try { + int count = access.size(); + for (int i = 0; i < count; i++) { + access.get(i).onComputeInternalInsets(inoutInfo); + } + } finally { + listeners.end(); + } + } + } + + /** + * Copy on write array. This array is not thread safe, and only one loop can + * iterate over this array at any given time. This class avoids allocations + * until a concurrent modification happens. + * + * Usage: + * + * CopyOnWriteArray.Access access = array.start(); + * try { + * for (int i = 0; i < access.size(); i++) { + * MyData d = access.get(i); + * } + * } finally { + * access.end(); + * } + */ + static class CopyOnWriteArray { + private ArrayList mData = new ArrayList(); + private ArrayList mDataCopy; + + private final Access mAccess = new Access(); + + private boolean mStart; + + static class Access { + private ArrayList mData; + private int mSize; + + T get(int index) { + return mData.get(index); + } + + int size() { + return mSize; + } + } + + CopyOnWriteArray() { + } + + private ArrayList getArray() { + if (mStart) { + if (mDataCopy == null) mDataCopy = new ArrayList(mData); + return mDataCopy; } + return mData; + } + + Access start() { + if (mStart) throw new IllegalStateException("Iteration already started"); + mStart = true; + mDataCopy = null; + mAccess.mData = mData; + mAccess.mSize = mData.size(); + return mAccess; + } + + void end() { + if (!mStart) throw new IllegalStateException("Iteration not started"); + mStart = false; + if (mDataCopy != null) { + mData = mDataCopy; + } + mDataCopy = null; + } + + int size() { + return getArray().size(); + } + + void add(T item) { + getArray().add(item); + } + + void addAll(CopyOnWriteArray array) { + getArray().addAll(array.mData); + } + + void remove(T item) { + getArray().remove(item); + } + + void clear() { + getArray().clear(); } } } diff --git a/core/java/android/view/VolumePanel.java b/core/java/android/view/VolumePanel.java index cf9bcdd8616ca..2c5d3954e2cc0 100644 --- a/core/java/android/view/VolumePanel.java +++ b/core/java/android/view/VolumePanel.java @@ -18,6 +18,7 @@ import com.android.internal.R; +import android.app.AlertDialog; import android.app.Dialog; import android.content.DialogInterface.OnDismissListener; import android.content.BroadcastReceiver; @@ -26,6 +27,7 @@ import android.content.Intent; import android.content.IntentFilter; import android.content.res.Resources; +import android.database.ContentObserver; import android.media.AudioManager; import android.media.AudioService; import android.media.AudioSystem; @@ -34,7 +36,9 @@ import android.net.Uri; import android.os.Handler; import android.os.Message; +import android.os.RemoteException; import android.os.Vibrator; +import android.provider.Settings; import android.util.Log; import android.view.WindowManager.LayoutParams; import android.widget.ImageView; @@ -92,17 +96,28 @@ public class VolumePanel extends Handler implements OnSeekBarChangeListener, Vie private static final int MSG_REMOTE_VOLUME_CHANGED = 8; private static final int MSG_REMOTE_VOLUME_UPDATE_IF_SHOWN = 9; private static final int MSG_SLIDER_VISIBILITY_CHANGED = 10; + private static final int MSG_DISPLAY_SAFE_VOLUME_WARNING = 11; // Pseudo stream type for master volume private static final int STREAM_MASTER = -100; // Pseudo stream type for remote volume is defined in AudioService.STREAM_REMOTE_MUSIC + public static final int VOLUME_OVERLAY_SINGLE = 0; + public static final int VOLUME_OVERLAY_EXPANDABLE = 1; + public static final int VOLUME_OVERLAY_EXPANDED = 2; + public static final int VOLUME_OVERLAY_NONE = 3; + protected Context mContext; private AudioManager mAudioManager; protected AudioService mAudioService; private boolean mRingIsSilent; private boolean mShowCombinedVolumes; private boolean mVoiceCapable; + private boolean mVolumeLinkNotification; + private int mCurrentOverlayStyle = -1; + + // True if we want to play tones on the system stream when the master stream is specified. + private final boolean mPlayMasterStreamTones; /** Dialog containing all the sliders */ private final Dialog mDialog; @@ -133,7 +148,7 @@ private enum StreamResources { R.string.volume_icon_description_ringer, R.drawable.ic_audio_ring_notif, R.drawable.ic_audio_ring_notif_mute, - false), + true), VoiceStream(AudioManager.STREAM_VOICE_CALL, R.string.volume_icon_description_incall, R.drawable.ic_audio_phone, @@ -143,7 +158,7 @@ private enum StreamResources { R.string.volume_alarm, R.drawable.ic_audio_alarm, R.drawable.ic_audio_alarm_mute, - false), + true), MediaStream(AudioManager.STREAM_MUSIC, R.string.volume_icon_description_media, R.drawable.ic_audio_vol, @@ -208,6 +223,49 @@ private class StreamControl { private ToneGenerator mToneGenerators[]; private Vibrator mVibrator; + private ContentObserver mSettingsObserver = new ContentObserver(this) { + @Override + public void onChange(boolean selfChange) { + mVolumeLinkNotification = Settings.System.getInt(mContext.getContentResolver(), + Settings.System.VOLUME_LINK_NOTIFICATION, 1) == 1; + final int overlayStyle = Settings.System.getInt(mContext.getContentResolver(), + Settings.System.MODE_VOLUME_OVERLAY, VOLUME_OVERLAY_EXPANDABLE); + changeOverlayStyle(overlayStyle); + } + }; + + private static AlertDialog sConfirmSafeVolumeDialog; + private static Object sConfirmSafeVolumeLock = new Object(); + + private static class WarningDialogReceiver extends BroadcastReceiver + implements DialogInterface.OnDismissListener { + private Context mContext; + private Dialog mDialog; + + WarningDialogReceiver(Context context, Dialog dialog) { + mContext = context; + mDialog = dialog; + IntentFilter filter = new IntentFilter(Intent.ACTION_CLOSE_SYSTEM_DIALOGS); + context.registerReceiver(this, filter); + } + + @Override + public void onReceive(Context context, Intent intent) { + mDialog.cancel(); + synchronized (sConfirmSafeVolumeLock) { + sConfirmSafeVolumeDialog = null; + } + } + + public void onDismiss(DialogInterface unused) { + mContext.unregisterReceiver(this); + synchronized (sConfirmSafeVolumeLock) { + sConfirmSafeVolumeDialog = null; + } + } + } + + public VolumePanel(final Context context, AudioService volumeService) { mContext = context; mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); @@ -225,7 +283,7 @@ public VolumePanel(final Context context, AudioService volumeService) { LayoutInflater inflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); - View view = mView = inflater.inflate(R.layout.volume_adjust, null); + mView = inflater.inflate(R.layout.volume_adjust, null); mView.setOnTouchListener(new View.OnTouchListener() { public boolean onTouch(View v, MotionEvent event) { resetTimeout(); @@ -271,17 +329,32 @@ public void onDismiss(DialogInterface dialog) { mToneGenerators = new ToneGenerator[AudioSystem.getNumStreamTypes()]; mVibrator = (Vibrator)context.getSystemService(Context.VIBRATOR_SERVICE); - mVoiceCapable = context.getResources().getBoolean(R.bool.config_voice_capable); - mShowCombinedVolumes = !mVoiceCapable && !useMasterVolume; - // If we don't want to show multiple volumes, hide the settings button and divider - if (!mShowCombinedVolumes) { - mMoreButton.setVisibility(View.GONE); - mDivider.setVisibility(View.GONE); - } else { - mMoreButton.setOnClickListener(this); - } + // Get the user's preferences + mVolumeLinkNotification = Settings.System.getInt(mContext.getContentResolver(), + Settings.System.VOLUME_LINK_NOTIFICATION, 1) == 1; + final int chosenStyle = Settings.System.getInt(context.getContentResolver(), + Settings.System.MODE_VOLUME_OVERLAY, VOLUME_OVERLAY_EXPANDABLE); + changeOverlayStyle(chosenStyle); + + context.getContentResolver().registerContentObserver( + Settings.System.getUriFor(Settings.System.VOLUME_LINK_NOTIFICATION), false, + mSettingsObserver); + context.getContentResolver().registerContentObserver( + Settings.System.getUriFor(Settings.System.MODE_VOLUME_OVERLAY), false, + mSettingsObserver); + + // This is new with 4.2 it seems + boolean masterVolumeOnly = context.getResources().getBoolean( + com.android.internal.R.bool.config_useMasterVolume); + boolean masterVolumeKeySounds = mContext.getResources().getBoolean( + com.android.internal.R.bool.config_useVolumeKeySounds); + + mPlayMasterStreamTones = masterVolumeOnly && masterVolumeKeySounds; + // End this is new + + mMoreButton.setOnClickListener(this); listenToRingerMode(); } @@ -301,13 +374,37 @@ public void onReceive(Context context, Intent intent) { }, filter); } - private boolean isMuted(int streamType) { - if (streamType == STREAM_MASTER) { - return mAudioManager.isMasterMute(); - } else if (streamType == AudioService.STREAM_REMOTE_MUSIC) { - return (mAudioService.getRemoteStreamVolume() <= 0); - } else { - return mAudioManager.isStreamMute(streamType); + private void changeOverlayStyle(int newStyle) { + Log.i("VolumePanel", "changeOverlayStyle : " + newStyle); + // Don't change to the same style + if (newStyle == mCurrentOverlayStyle) return; + switch (newStyle) { + case VOLUME_OVERLAY_SINGLE : + mMoreButton.setVisibility(View.GONE); + mDivider.setVisibility(View.GONE); + mShowCombinedVolumes = false; + mCurrentOverlayStyle = VOLUME_OVERLAY_SINGLE; + break; + case VOLUME_OVERLAY_EXPANDABLE : + mMoreButton.setVisibility(View.VISIBLE); + mDivider.setVisibility(View.VISIBLE); + mShowCombinedVolumes = true; + mCurrentOverlayStyle = VOLUME_OVERLAY_EXPANDABLE; + break; + case VOLUME_OVERLAY_EXPANDED : + mMoreButton.setVisibility(View.GONE); + mDivider.setVisibility(View.GONE); + mShowCombinedVolumes = true; + if (mCurrentOverlayStyle == VOLUME_OVERLAY_NONE) { + addOtherVolumes(); + expand(); + } + mCurrentOverlayStyle = VOLUME_OVERLAY_EXPANDED; + break; + case VOLUME_OVERLAY_NONE : + mShowCombinedVolumes = false; + mCurrentOverlayStyle = VOLUME_OVERLAY_NONE; + break; } } @@ -341,6 +438,16 @@ private void setStreamVolume(int streamType, int index, int flags) { } } + private boolean isMuted(int streamType) { + if (streamType == STREAM_MASTER) { + return mAudioManager.isMasterMute(); + } else if (streamType == AudioService.STREAM_REMOTE_MUSIC) { + return (mAudioService.getRemoteStreamVolume() <= 0); + } else { + return mAudioManager.isStreamMute(streamType); + } + } + private void createSliders() { LayoutInflater inflater = (LayoutInflater) mContext .getSystemService(Context.LAYOUT_INFLATER_SERVICE); @@ -349,9 +456,6 @@ private void createSliders() { for (int i = 0; i < STREAMS.length; i++) { StreamResources streamRes = STREAMS[i]; int streamType = streamRes.streamType; - if (mVoiceCapable && streamRes == StreamResources.NotificationStream) { - streamRes = StreamResources.RingerStream; - } StreamControl sc = new StreamControl(); sc.streamType = streamType; sc.group = (ViewGroup) inflater.inflate(R.layout.volume_adjust_item, null); @@ -362,6 +466,7 @@ private void createSliders() { sc.iconRes = streamRes.iconRes; sc.iconMuteRes = streamRes.iconMuteRes; sc.icon.setImageResource(sc.iconRes); + sc.icon.setOnClickListener(this); sc.seekbarView = (SeekBar) sc.group.findViewById(R.id.seekbar); int plusOne = (streamType == AudioSystem.STREAM_BLUETOOTH_SCO || streamType == AudioSystem.STREAM_VOICE_CALL) ? 1 : 0; @@ -398,6 +503,15 @@ private void addOtherVolumes() { if (!STREAMS[i].show || streamType == mActiveStreamType) { continue; } + // Skip ring volume for non-phone devices + if (!mVoiceCapable && streamType == AudioManager.STREAM_RING) { + continue; + } + // Skip notification volume if linked with ring volume + if (mVoiceCapable && mVolumeLinkNotification && + streamType == AudioManager.STREAM_NOTIFICATION) { + continue; + } StreamControl sc = mStreamControls.get(streamType); mSliderGroup.addView(sc.group); updateSlider(sc); @@ -431,10 +545,22 @@ private boolean isExpanded() { private void expand() { final int count = mSliderGroup.getChildCount(); for (int i = 0; i < count; i++) { - mSliderGroup.getChildAt(i).setVisibility(View.VISIBLE); + if (mSliderGroup.getChildAt(i).getVisibility() != View.VISIBLE) { + mSliderGroup.getChildAt(i).setVisibility(View.VISIBLE); + } + } + mMoreButton.setVisibility(View.GONE); + mDivider.setVisibility(View.GONE); + } + + private void hideSlider(int mActiveStreamType) { + final int count = mSliderGroup.getChildCount(); + for (int i = 0; i < count; i++) { + StreamControl sc = (StreamControl) mSliderGroup.getChildAt(i).getTag(); + if (mActiveStreamType == sc.streamType) { + mSliderGroup.getChildAt(i).setVisibility(View.GONE); + } } - mMoreButton.setVisibility(View.INVISIBLE); - mDivider.setVisibility(View.INVISIBLE); } private void collapse() { @@ -518,6 +644,11 @@ public void postMasterMuteChanged(int flags) { postMuteChanged(STREAM_MASTER, flags); } + public void postDisplaySafeVolumeWarning() { + if (hasMessages(MSG_DISPLAY_SAFE_VOLUME_WARNING)) return; + obtainMessage(MSG_DISPLAY_SAFE_VOLUME_WARNING, 0, 0).sendToTarget(); + } + /** * Override this if you have other work to do when the volume changes (for * example, vibrating, playing a sound, etc.). Make sure to call through to @@ -529,7 +660,10 @@ protected void onVolumeChanged(int streamType, int flags) { if ((flags & AudioManager.FLAG_SHOW_UI) != 0) { synchronized (this) { - if (mActiveStreamType != streamType) { + if (streamType != mActiveStreamType) { + if (mCurrentOverlayStyle == VOLUME_OVERLAY_EXPANDABLE) { + hideSlider(mActiveStreamType); + } reorderSliders(streamType); } onShowVolumeChanged(streamType, flags); @@ -650,24 +784,32 @@ protected void onShowVolumeChanged(int streamType, int flags) { if (sc.seekbarView.getMax() != max) { sc.seekbarView.setMax(max); } + sc.seekbarView.setProgress(index); - if (streamType != mAudioManager.getMasterStreamType() - && streamType != AudioService.STREAM_REMOTE_MUSIC && isMuted(streamType)) { + if (((flags & AudioManager.FLAG_FIXED_VOLUME) != 0) || + (streamType != mAudioManager.getMasterStreamType() && + streamType != AudioService.STREAM_REMOTE_MUSIC && + isMuted(streamType))) { sc.seekbarView.setEnabled(false); } else { sc.seekbarView.setEnabled(true); } } - if (!mDialog.isShowing()) { + // Only Show if style needs it + if (!mDialog.isShowing() && mCurrentOverlayStyle != VOLUME_OVERLAY_NONE) { int stream = (streamType == AudioService.STREAM_REMOTE_MUSIC) ? -1 : streamType; // when the stream is for remote playback, use -1 to reset the stream type evaluation mAudioManager.forceVolumeControlStream(stream); mDialog.setContentView(mView); // Showing dialog - use collapsed state - if (mShowCombinedVolumes) { + if (mShowCombinedVolumes && mCurrentOverlayStyle != VOLUME_OVERLAY_EXPANDED) { collapse(); } + // If just changed the style and we need to expand + if (mCurrentOverlayStyle == VOLUME_OVERLAY_EXPANDED) { + expand(); + } mDialog.show(); } @@ -786,11 +928,46 @@ synchronized protected void onSliderVisibilityChanged(int streamType, int visibl } } + protected void onDisplaySafeVolumeWarning() { + synchronized (sConfirmSafeVolumeLock) { + if (sConfirmSafeVolumeDialog != null) { + return; + } + sConfirmSafeVolumeDialog = new AlertDialog.Builder(mContext) + .setMessage(com.android.internal.R.string.safe_media_volume_warning) + .setPositiveButton(com.android.internal.R.string.yes, + new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + mAudioService.disableSafeMediaVolume(); + } + }) + .setNegativeButton(com.android.internal.R.string.no, null) + .setIconAttribute(android.R.attr.alertDialogIcon) + .create(); + final WarningDialogReceiver warning = new WarningDialogReceiver(mContext, + sConfirmSafeVolumeDialog); + + sConfirmSafeVolumeDialog.setOnDismissListener(warning); + sConfirmSafeVolumeDialog.getWindow().setType( + WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG); + sConfirmSafeVolumeDialog.show(); + } + } + /** * Lock on this VolumePanel instance as long as you use the returned ToneGenerator. */ private ToneGenerator getOrCreateToneGenerator(int streamType) { - if (streamType == STREAM_MASTER) return null; + if (streamType == STREAM_MASTER) { + // For devices that use the master volume setting only but still want to + // play a volume-changed tone, direct the master volume pseudostream to + // the system stream's tone generator. + if (mPlayMasterStreamTones) { + streamType = AudioManager.STREAM_SYSTEM; + } else { + return null; + } + } synchronized (this) { if (mToneGenerators[streamType] == null) { try { @@ -891,6 +1068,10 @@ public void handleMessage(Message msg) { case MSG_SLIDER_VISIBILITY_CHANGED: onSliderVisibilityChanged(msg.arg1, msg.arg2); break; + + case MSG_DISPLAY_SAFE_VOLUME_WARNING: + onDisplaySafeVolumeWarning(); + break; } } @@ -904,8 +1085,7 @@ private void forceTimeout() { sendMessage(obtainMessage(MSG_TIMEOUT)); } - public void onProgressChanged(SeekBar seekBar, int progress, - boolean fromUser) { + public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { final Object tag = seekBar.getTag(); if (fromUser && tag instanceof StreamControl) { StreamControl sc = (StreamControl) tag; @@ -936,6 +1116,12 @@ public void onStopTrackingTouch(SeekBar seekBar) { public void onClick(View v) { if (v == mMoreButton) { expand(); + } else if (v instanceof ImageView) { + Intent volumeSettings = new Intent(android.provider.Settings.ACTION_SOUND_SETTINGS); + volumeSettings.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED); + forceTimeout(); + mContext.startActivity(volumeSettings); + return; } resetTimeout(); } diff --git a/core/java/android/view/Window.java b/core/java/android/view/Window.java index b0e90db001102..fcf0924c8df84 100644 --- a/core/java/android/view/Window.java +++ b/core/java/android/view/Window.java @@ -16,9 +16,7 @@ package android.view; -import android.app.Application; import android.content.Context; -import android.content.res.CompatibilityInfo; import android.content.res.Configuration; import android.content.res.TypedArray; import android.graphics.PixelFormat; @@ -27,7 +25,6 @@ import android.os.Bundle; import android.os.IBinder; import android.os.SystemProperties; -import android.util.Slog; import android.view.accessibility.AccessibilityEvent; /** @@ -92,6 +89,13 @@ public abstract class Window { * If overlay is enabled, the action mode UI will be allowed to cover existing window content. */ public static final int FEATURE_ACTION_MODE_OVERLAY = 10; + + /** + * Max value used as a feature ID + * @hide + */ + public static final int FEATURE_MAX = FEATURE_ACTION_MODE_OVERLAY; + /** Flag for setting the progress bar's visibility to VISIBLE */ public static final int PROGRESS_VISIBILITY_ON = -1; /** Flag for setting the progress bar's visibility to GONE */ @@ -119,6 +123,8 @@ public abstract class Window { */ public static final int ID_ANDROID_CONTENT = com.android.internal.R.id.content; + private static final String PROPERTY_HARDWARE_UI = "persist.sys.ui.hw"; + private final Context mContext; private TypedArray mWindowStyle; @@ -126,6 +132,7 @@ public abstract class Window { private WindowManager mWindowManager; private IBinder mAppToken; private String mAppName; + private boolean mHardwareAccelerated; private Window mContainer; private Window mActiveChild; private boolean mIsActive = false; @@ -454,7 +461,7 @@ public final boolean isDestroyed() { * display panels. This is not used for displaying the * Window itself -- that must be done by the client. * - * @param wm The ViewManager for adding new windows. + * @param wm The window manager for adding new windows. */ public void setWindowManager(WindowManager wm, IBinder appToken, String appName) { setWindowManager(wm, appToken, appName, false); @@ -465,86 +472,64 @@ public void setWindowManager(WindowManager wm, IBinder appToken, String appName) * display panels. This is not used for displaying the * Window itself -- that must be done by the client. * - * @param wm The ViewManager for adding new windows. + * @param wm The window manager for adding new windows. */ public void setWindowManager(WindowManager wm, IBinder appToken, String appName, boolean hardwareAccelerated) { mAppToken = appToken; mAppName = appName; + mHardwareAccelerated = hardwareAccelerated + || SystemProperties.getBoolean(PROPERTY_HARDWARE_UI, false); if (wm == null) { - wm = WindowManagerImpl.getDefault(); + wm = (WindowManager)mContext.getSystemService(Context.WINDOW_SERVICE); } - mWindowManager = new LocalWindowManager(wm, hardwareAccelerated); + mWindowManager = ((WindowManagerImpl)wm).createLocalWindowManager(this); } - static CompatibilityInfoHolder getCompatInfo(Context context) { - Application app = (Application)context.getApplicationContext(); - return app != null ? app.mLoadedApk.mCompatibilityInfo : new CompatibilityInfoHolder(); - } - - private class LocalWindowManager extends WindowManagerImpl.CompatModeWrapper { - private static final String PROPERTY_HARDWARE_UI = "persist.sys.ui.hw"; - - private final boolean mHardwareAccelerated; - - LocalWindowManager(WindowManager wm, boolean hardwareAccelerated) { - super(wm, getCompatInfo(mContext)); - mHardwareAccelerated = hardwareAccelerated || - SystemProperties.getBoolean(PROPERTY_HARDWARE_UI, false); - } - - public boolean isHardwareAccelerated() { - return mHardwareAccelerated; - } - - public final void addView(View view, ViewGroup.LayoutParams params) { - // Let this throw an exception on a bad params. - WindowManager.LayoutParams wp = (WindowManager.LayoutParams)params; - CharSequence curTitle = wp.getTitle(); - if (wp.type >= WindowManager.LayoutParams.FIRST_SUB_WINDOW && - wp.type <= WindowManager.LayoutParams.LAST_SUB_WINDOW) { - if (wp.token == null) { - View decor = peekDecorView(); - if (decor != null) { - wp.token = decor.getWindowToken(); - } - } - if (curTitle == null || curTitle.length() == 0) { - String title; - if (wp.type == WindowManager.LayoutParams.TYPE_APPLICATION_MEDIA) { - title="Media"; - } else if (wp.type == WindowManager.LayoutParams.TYPE_APPLICATION_MEDIA_OVERLAY) { - title="MediaOvr"; - } else if (wp.type == WindowManager.LayoutParams.TYPE_APPLICATION_PANEL) { - title="Panel"; - } else if (wp.type == WindowManager.LayoutParams.TYPE_APPLICATION_SUB_PANEL) { - title="SubPanel"; - } else if (wp.type == WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG) { - title="AtchDlg"; - } else { - title=Integer.toString(wp.type); - } - if (mAppName != null) { - title += ":" + mAppName; - } - wp.setTitle(title); + void adjustLayoutParamsForSubWindow(WindowManager.LayoutParams wp) { + CharSequence curTitle = wp.getTitle(); + if (wp.type >= WindowManager.LayoutParams.FIRST_SUB_WINDOW && + wp.type <= WindowManager.LayoutParams.LAST_SUB_WINDOW) { + if (wp.token == null) { + View decor = peekDecorView(); + if (decor != null) { + wp.token = decor.getWindowToken(); } - } else { - if (wp.token == null) { - wp.token = mContainer == null ? mAppToken : mContainer.mAppToken; + } + if (curTitle == null || curTitle.length() == 0) { + String title; + if (wp.type == WindowManager.LayoutParams.TYPE_APPLICATION_MEDIA) { + title="Media"; + } else if (wp.type == WindowManager.LayoutParams.TYPE_APPLICATION_MEDIA_OVERLAY) { + title="MediaOvr"; + } else if (wp.type == WindowManager.LayoutParams.TYPE_APPLICATION_PANEL) { + title="Panel"; + } else if (wp.type == WindowManager.LayoutParams.TYPE_APPLICATION_SUB_PANEL) { + title="SubPanel"; + } else if (wp.type == WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG) { + title="AtchDlg"; + } else { + title=Integer.toString(wp.type); } - if ((curTitle == null || curTitle.length() == 0) - && mAppName != null) { - wp.setTitle(mAppName); + if (mAppName != null) { + title += ":" + mAppName; } - } - if (wp.packageName == null) { - wp.packageName = mContext.getPackageName(); + wp.setTitle(title); + } + } else { + if (wp.token == null) { + wp.token = mContainer == null ? mAppToken : mContainer.mAppToken; } - if (mHardwareAccelerated) { - wp.flags |= WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED; + if ((curTitle == null || curTitle.length() == 0) + && mAppName != null) { + wp.setTitle(mAppName); } - super.addView(view, params); + } + if (wp.packageName == null) { + wp.packageName = mContext.getPackageName(); + } + if (mHardwareAccelerated) { + wp.flags |= WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED; } } @@ -718,6 +703,7 @@ public void setSoftInputMode(int mode) { * per {@link #setFlags}. * @param flags The flag bits to be set. * @see #setFlags + * @see #clearFlags */ public void addFlags(int flags) { setFlags(flags, flags); @@ -728,6 +714,7 @@ public void addFlags(int flags) { * per {@link #setFlags}. * @param flags The flag bits to be cleared. * @see #setFlags + * @see #addFlags */ public void clearFlags(int flags) { setFlags(0, flags); @@ -749,8 +736,14 @@ public void clearFlags(int flags) { * * @param flags The new window flags (see WindowManager.LayoutParams). * @param mask Which of the window flag bits to modify. + * @see #addFlags + * @see #clearFlags */ public void setFlags(int flags, int mask) { + if ((flags & mask & WindowManager.LayoutParams.PREVENT_POWER_KEY) != 0){ + mContext.enforceCallingOrSelfPermission("android.permission.PREVENT_POWER_KEY", + "No permission to prevent power key"); + } final WindowManager.LayoutParams attrs = getAttributes(); attrs.flags = (attrs.flags&~mask) | (flags&mask); if ((mask&WindowManager.LayoutParams.FLAG_NEEDS_MENU_KEY) != 0) { @@ -790,6 +783,10 @@ public void setDimAmount(float amount) { * current values. */ public void setAttributes(WindowManager.LayoutParams a) { + if ((a.flags & WindowManager.LayoutParams.PREVENT_POWER_KEY) != 0) { + mContext.enforceCallingOrSelfPermission("android.permission.PREVENT_POWER_KEY", + "No permission to prevent power key"); + } mWindowAttributes.copyFrom(a); if (mCallback != null) { mCallback.onWindowAttributesChanged(mWindowAttributes); diff --git a/core/java/android/view/WindowInfo.aidl b/core/java/android/view/WindowInfo.aidl new file mode 100644 index 0000000000000..23e927a1ee207 --- /dev/null +++ b/core/java/android/view/WindowInfo.aidl @@ -0,0 +1,20 @@ +/* +** +** Copyright 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 WindowInfo; diff --git a/core/java/android/view/WindowInfo.java b/core/java/android/view/WindowInfo.java new file mode 100644 index 0000000000000..7d16e147d2937 --- /dev/null +++ b/core/java/android/view/WindowInfo.java @@ -0,0 +1,175 @@ +/* + * 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.graphics.Rect; +import android.os.IBinder; +import android.os.Parcel; +import android.os.Parcelable; + +/** + * Information the state of a window. + * + * @hide + */ +public class WindowInfo implements Parcelable { + + private static final int MAX_POOL_SIZE = 20; + + private static int UNDEFINED = -1; + + private static Object sPoolLock = new Object(); + private static WindowInfo sPool; + private static int sPoolSize; + + private WindowInfo mNext; + private boolean mInPool; + + public IBinder token; + + public final Rect frame = new Rect(); + + public final Rect touchableRegion = new Rect(); + + public int type = UNDEFINED; + + public float compatibilityScale = UNDEFINED; + + public boolean visible; + + public int displayId = UNDEFINED; + + public int layer = UNDEFINED; + + private WindowInfo() { + /* do nothing - reduce visibility */ + } + + @Override + public int describeContents() { + return 0; + } + + @Override + public void writeToParcel(Parcel parcel, int flags) { + parcel.writeStrongBinder(token); + parcel.writeParcelable(frame, 0); + parcel.writeParcelable(touchableRegion, 0); + parcel.writeInt(type); + parcel.writeFloat(compatibilityScale); + parcel.writeInt(visible ? 1 : 0); + parcel.writeInt(displayId); + parcel.writeInt(layer); + recycle(); + } + + private void initFromParcel(Parcel parcel) { + token = parcel.readStrongBinder(); + frame.set((Rect) parcel.readParcelable(null)); + touchableRegion.set((Rect) parcel.readParcelable(null)); + type = parcel.readInt(); + compatibilityScale = parcel.readFloat(); + visible = (parcel.readInt() == 1); + displayId = parcel.readInt(); + layer = parcel.readInt(); + } + + public static WindowInfo obtain(WindowInfo other) { + WindowInfo info = obtain(); + info.token = other.token; + info.frame.set(other.frame); + info.touchableRegion.set(other.touchableRegion); + info.type = other.type; + info.compatibilityScale = other.compatibilityScale; + info.visible = other.visible; + info.displayId = other.displayId; + info.layer = other.layer; + return info; + } + + public static WindowInfo obtain() { + synchronized (sPoolLock) { + if (sPoolSize > 0) { + WindowInfo info = sPool; + sPool = info.mNext; + info.mNext = null; + info.mInPool = false; + sPoolSize--; + return info; + } else { + return new WindowInfo(); + } + } + } + + public void recycle() { + if (mInPool) { + throw new IllegalStateException("Already recycled."); + } + clear(); + synchronized (sPoolLock) { + if (sPoolSize < MAX_POOL_SIZE) { + mNext = sPool; + sPool = this; + mInPool = true; + sPoolSize++; + } + } + } + + private void clear() { + token = null; + frame.setEmpty(); + touchableRegion.setEmpty(); + type = UNDEFINED; + compatibilityScale = UNDEFINED; + visible = false; + displayId = UNDEFINED; + layer = UNDEFINED; + } + + @Override + public String toString() { + StringBuilder builder = new StringBuilder(); + builder.append("Window [token:").append((token != null) ? token.hashCode() : null); + builder.append(", displayId:").append(displayId); + builder.append(", type:").append(type); + builder.append(", visible:").append(visible); + builder.append(", layer:").append(layer); + builder.append(", compatibilityScale:").append(compatibilityScale); + builder.append(", frame:").append(frame); + builder.append(", touchableRegion:").append(touchableRegion); + builder.append("]"); + return builder.toString(); + } + + /** + * @see Parcelable.Creator + */ + public static final Parcelable.Creator CREATOR = + new Parcelable.Creator() { + public WindowInfo createFromParcel(Parcel parcel) { + WindowInfo info = WindowInfo.obtain(); + info.initFromParcel(parcel); + return info; + } + + public WindowInfo[] newArray(int size) { + return new WindowInfo[size]; + } + }; +} diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java index d94275bcd61af..e61efa03c1fa3 100644 --- a/core/java/android/view/WindowManager.java +++ b/core/java/android/view/WindowManager.java @@ -16,6 +16,8 @@ package android.view; +import android.app.Presentation; +import android.content.Context; import android.content.pm.ActivityInfo; import android.graphics.PixelFormat; import android.os.IBinder; @@ -29,6 +31,17 @@ * The interface that apps use to talk to the window manager. *

          * Use Context.getSystemService(Context.WINDOW_SERVICE) to get one of these. + *

          + * Each window manager instance is bound to a particular {@link Display}. + * To obtain a {@link WindowManager} for a different display, use + * {@link Context#createDisplayContext} to obtain a {@link Context} for that + * display, then use Context.getSystemService(Context.WINDOW_SERVICE) + * to get the WindowManager. + *

          + * The simplest way to show a window on another display is to create a + * {@link Presentation}. The presentation will automatically obtain a + * {@link WindowManager} and {@link Context} for that display. + *

          * * @see android.content.Context#getSystemService * @see android.content.Context#WINDOW_SERVICE @@ -49,12 +62,37 @@ public BadTokenException(String name) { } /** - * Use this method to get the default Display object. - * - * @return default Display object + * Exception that is thrown when calling {@link #addView} to a secondary display that cannot + * be found. See {@link android.app.Presentation} for more information on secondary displays. + */ + public static class InvalidDisplayException extends RuntimeException { + public InvalidDisplayException() { + } + + public InvalidDisplayException(String name) { + super(name); + } + } + + /** + * Returns the {@link Display} upon which this {@link WindowManager} instance + * will create new windows. + *

          + * Despite the name of this method, the display that is returned is not + * necessarily the primary display of the system (see {@link Display#DEFAULT_DISPLAY}). + * The returned display could instead be a secondary display that this + * window manager instance is managing. Think of it as the display that + * this {@link WindowManager} instance uses by default. + *

          + * To create windows on a different display, you need to obtain a + * {@link WindowManager} for that {@link Display}. (See the {@link WindowManager} + * class documentation for more information.) + *

          + * + * @return The display that this window manager is managing. */ public Display getDefaultDisplay(); - + /** * Special variation of {@link #removeView} that immediately invokes * the given view hierarchy's {@link View#onDetachedFromWindow() @@ -64,15 +102,7 @@ public BadTokenException(String name) { * @param view The view to be removed. */ public void removeViewImmediate(View view); - - /** - * Return true if this window manager is configured to request hardware - * accelerated windows. This does not guarantee that they will - * actually be accelerated, since that depends on the device supporting them. - * @hide - */ - public boolean isHardwareAccelerated(); - + public static class LayoutParams extends ViewGroup.LayoutParams implements Parcelable { /** @@ -162,6 +192,7 @@ public static class LayoutParams extends ViewGroup.LayoutParams @ViewDebug.IntToString(from = TYPE_APPLICATION_MEDIA, to = "TYPE_APPLICATION_MEDIA"), @ViewDebug.IntToString(from = TYPE_APPLICATION_SUB_PANEL, to = "TYPE_APPLICATION_SUB_PANEL"), @ViewDebug.IntToString(from = TYPE_APPLICATION_ATTACHED_DIALOG, to = "TYPE_APPLICATION_ATTACHED_DIALOG"), + @ViewDebug.IntToString(from = TYPE_APPLICATION_MEDIA_OVERLAY, to = "TYPE_APPLICATION_MEDIA_OVERLAY"), @ViewDebug.IntToString(from = TYPE_STATUS_BAR, to = "TYPE_STATUS_BAR"), @ViewDebug.IntToString(from = TYPE_SEARCH_BAR, to = "TYPE_SEARCH_BAR"), @ViewDebug.IntToString(from = TYPE_PHONE, to = "TYPE_PHONE"), @@ -170,8 +201,6 @@ public static class LayoutParams extends ViewGroup.LayoutParams @ViewDebug.IntToString(from = TYPE_TOAST, to = "TYPE_TOAST"), @ViewDebug.IntToString(from = TYPE_SYSTEM_OVERLAY, to = "TYPE_SYSTEM_OVERLAY"), @ViewDebug.IntToString(from = TYPE_PRIORITY_PHONE, to = "TYPE_PRIORITY_PHONE"), - @ViewDebug.IntToString(from = TYPE_STATUS_BAR_PANEL, to = "TYPE_STATUS_BAR_PANEL"), - @ViewDebug.IntToString(from = TYPE_STATUS_BAR_SUB_PANEL, to = "TYPE_STATUS_BAR_SUB_PANEL"), @ViewDebug.IntToString(from = TYPE_SYSTEM_DIALOG, to = "TYPE_SYSTEM_DIALOG"), @ViewDebug.IntToString(from = TYPE_KEYGUARD_DIALOG, to = "TYPE_KEYGUARD_DIALOG"), @ViewDebug.IntToString(from = TYPE_SYSTEM_ERROR, to = "TYPE_SYSTEM_ERROR"), @@ -185,7 +214,12 @@ public static class LayoutParams extends ViewGroup.LayoutParams @ViewDebug.IntToString(from = TYPE_POINTER, to = "TYPE_POINTER"), @ViewDebug.IntToString(from = TYPE_NAVIGATION_BAR, to = "TYPE_NAVIGATION_BAR"), @ViewDebug.IntToString(from = TYPE_VOLUME_OVERLAY, to = "TYPE_VOLUME_OVERLAY"), - @ViewDebug.IntToString(from = TYPE_BOOT_PROGRESS, to = "TYPE_BOOT_PROGRESS") + @ViewDebug.IntToString(from = TYPE_BOOT_PROGRESS, to = "TYPE_BOOT_PROGRESS"), + @ViewDebug.IntToString(from = TYPE_HIDDEN_NAV_CONSUMER, to = "TYPE_HIDDEN_NAV_CONSUMER"), + @ViewDebug.IntToString(from = TYPE_DREAM, to = "TYPE_DREAM"), + @ViewDebug.IntToString(from = TYPE_NAVIGATION_BAR_PANEL, to = "TYPE_NAVIGATION_BAR_PANEL"), + @ViewDebug.IntToString(from = TYPE_DISPLAY_OVERLAY, to = "TYPE_DISPLAY_OVERLAY"), + @ViewDebug.IntToString(from = TYPE_MAGNIFICATION_OVERLAY, to = "TYPE_MAGNIFICATION_OVERLAY") }) public int type; @@ -198,12 +232,14 @@ public static class LayoutParams extends ViewGroup.LayoutParams * Window type: an application window that serves as the "base" window * of the overall application; all other application windows will * appear on top of it. + * In multiuser systems shows only on the owning user's window. */ public static final int TYPE_BASE_APPLICATION = 1; /** * Window type: a normal application window. The {@link #token} must be * an Activity token identifying who the window belongs to. + * In multiuser systems shows only on the owning user's window. */ public static final int TYPE_APPLICATION = 2; @@ -212,6 +248,7 @@ public static class LayoutParams extends ViewGroup.LayoutParams * application is starting. Not for use by applications themselves; * this is used by the system to display something until the * application can show its own windows. + * In multiuser systems shows on all users' windows. */ public static final int TYPE_APPLICATION_STARTING = 3; @@ -277,12 +314,14 @@ public static class LayoutParams extends ViewGroup.LayoutParams * Window type: the status bar. There can be only one status bar * window; it is placed at the top of the screen, and all other * windows are shifted down so they are below it. + * In multiuser systems shows on all users' windows. */ public static final int TYPE_STATUS_BAR = FIRST_SYSTEM_WINDOW; /** * Window type: the search bar. There can be only one search bar * window; it is placed at the top of the screen. + * In multiuser systems shows on all users' windows. */ public static final int TYPE_SEARCH_BAR = FIRST_SYSTEM_WINDOW+1; @@ -291,22 +330,26 @@ public static class LayoutParams extends ViewGroup.LayoutParams * user interaction with the phone (in particular incoming calls). * These windows are normally placed above all applications, but behind * the status bar. + * In multiuser systems shows on all users' windows. */ public static final int TYPE_PHONE = FIRST_SYSTEM_WINDOW+2; /** * Window type: system window, such as low power alert. These windows * are always on top of application windows. + * In multiuser systems shows only on the owning user's window. */ public static final int TYPE_SYSTEM_ALERT = FIRST_SYSTEM_WINDOW+3; /** * Window type: keyguard window. + * In multiuser systems shows on all users' windows. */ public static final int TYPE_KEYGUARD = FIRST_SYSTEM_WINDOW+4; /** * Window type: transient notifications. + * In multiuser systems shows only on the owning user's window. */ public static final int TYPE_TOAST = FIRST_SYSTEM_WINDOW+5; @@ -314,6 +357,7 @@ public static class LayoutParams extends ViewGroup.LayoutParams * Window type: system overlay windows, which need to be displayed * on top of everything else. These windows must not take input * focus, or they will interfere with the keyguard. + * In multiuser systems shows only on the owning user's window. */ public static final int TYPE_SYSTEM_OVERLAY = FIRST_SYSTEM_WINDOW+6; @@ -321,22 +365,26 @@ public static class LayoutParams extends ViewGroup.LayoutParams * Window type: priority phone UI, which needs to be displayed even if * the keyguard is active. These windows must not take input * focus, or they will interfere with the keyguard. + * In multiuser systems shows on all users' windows. */ public static final int TYPE_PRIORITY_PHONE = FIRST_SYSTEM_WINDOW+7; /** * Window type: panel that slides out from the status bar + * In multiuser systems shows on all users' windows. */ public static final int TYPE_SYSTEM_DIALOG = FIRST_SYSTEM_WINDOW+8; /** * Window type: dialogs that the keyguard shows + * In multiuser systems shows on all users' windows. */ public static final int TYPE_KEYGUARD_DIALOG = FIRST_SYSTEM_WINDOW+9; /** * Window type: internal system error windows, appear on top of * everything they can. + * In multiuser systems shows only on the owning user's window. */ public static final int TYPE_SYSTEM_ERROR = FIRST_SYSTEM_WINDOW+10; @@ -344,23 +392,27 @@ public static class LayoutParams extends ViewGroup.LayoutParams * Window type: internal input methods windows, which appear above * the normal UI. Application windows may be resized or panned to keep * the input focus visible while this window is displayed. + * In multiuser systems shows only on the owning user's window. */ public static final int TYPE_INPUT_METHOD = FIRST_SYSTEM_WINDOW+11; /** * Window type: internal input methods dialog windows, which appear above * the current input method window. + * In multiuser systems shows only on the owning user's window. */ public static final int TYPE_INPUT_METHOD_DIALOG= FIRST_SYSTEM_WINDOW+12; /** * Window type: wallpaper window, placed behind any window that wants * to sit on top of the wallpaper. + * In multiuser systems shows only on the owning user's window. */ public static final int TYPE_WALLPAPER = FIRST_SYSTEM_WINDOW+13; /** * Window type: panel that slides out from over the status bar + * In multiuser systems shows on all users' windows. */ public static final int TYPE_STATUS_BAR_PANEL = FIRST_SYSTEM_WINDOW+14; @@ -372,6 +424,8 @@ public static class LayoutParams extends ViewGroup.LayoutParams * This is exactly like {@link #TYPE_SYSTEM_OVERLAY} except that only the * system itself is allowed to create these overlays. Applications cannot * obtain permission to create secure system overlays. + * + * In multiuser systems shows only on the owning user's window. * @hide */ public static final int TYPE_SECURE_SYSTEM_OVERLAY = FIRST_SYSTEM_WINDOW+15; @@ -379,24 +433,28 @@ public static class LayoutParams extends ViewGroup.LayoutParams /** * Window type: the drag-and-drop pseudowindow. There is only one * drag layer (at most), and it is placed on top of all other windows. + * In multiuser systems shows only on the owning user's window. * @hide */ public static final int TYPE_DRAG = FIRST_SYSTEM_WINDOW+16; /** * Window type: panel that slides out from under the status bar + * In multiuser systems shows on all users' windows. * @hide */ public static final int TYPE_STATUS_BAR_SUB_PANEL = FIRST_SYSTEM_WINDOW+17; /** * Window type: (mouse) pointer + * In multiuser systems shows on all users' windows. * @hide */ public static final int TYPE_POINTER = FIRST_SYSTEM_WINDOW+18; /** * Window type: Navigation bar (when distinct from status bar) + * In multiuser systems shows on all users' windows. * @hide */ public static final int TYPE_NAVIGATION_BAR = FIRST_SYSTEM_WINDOW+19; @@ -404,6 +462,7 @@ public static class LayoutParams extends ViewGroup.LayoutParams /** * Window type: The volume level overlay/dialog shown when the user * changes the system volume. + * In multiuser systems shows on all users' windows. * @hide */ public static final int TYPE_VOLUME_OVERLAY = FIRST_SYSTEM_WINDOW+20; @@ -411,6 +470,7 @@ public static class LayoutParams extends ViewGroup.LayoutParams /** * Window type: The boot progress dialog, goes on top of everything * in the world. + * In multiuser systems shows on all users' windows. * @hide */ public static final int TYPE_BOOT_PROGRESS = FIRST_SYSTEM_WINDOW+21; @@ -418,22 +478,55 @@ public static class LayoutParams extends ViewGroup.LayoutParams /** * Window type: Fake window to consume touch events when the navigation * bar is hidden. + * In multiuser systems shows on all users' windows. * @hide */ public static final int TYPE_HIDDEN_NAV_CONSUMER = FIRST_SYSTEM_WINDOW+22; /** * Window type: Dreams (screen saver) window, just above keyguard. + * In multiuser systems shows only on the owning user's window. * @hide */ public static final int TYPE_DREAM = FIRST_SYSTEM_WINDOW+23; /** * Window type: Navigation bar panel (when navigation bar is distinct from status bar) + * In multiuser systems shows on all users' windows. * @hide */ public static final int TYPE_NAVIGATION_BAR_PANEL = FIRST_SYSTEM_WINDOW+24; + /** + * Window type: Behind the universe of the real windows. + * In multiuser systems shows on all users' windows. + * @hide + */ + public static final int TYPE_UNIVERSE_BACKGROUND = FIRST_SYSTEM_WINDOW+25; + + /** + * Window type: Display overlay window. Used to simulate secondary display devices. + * In multiuser systems shows on all users' windows. + * @hide + */ + public static final int TYPE_DISPLAY_OVERLAY = FIRST_SYSTEM_WINDOW+26; + + /** + * Window type: Magnification overlay window. Used to highlight the magnified + * portion of a display when accessibility magnification is enabled. + * In multiuser systems shows on all users' windows. + * @hide + */ + public static final int TYPE_MAGNIFICATION_OVERLAY = FIRST_SYSTEM_WINDOW+27; + + /** + * Window type: Recents. Same layer as {@link #TYPE_SYSTEM_DIALOG} but only appears on + * one user's screen. + * In multiuser systems shows on all users' windows. + * @hide + */ + public static final int TYPE_RECENTS_OVERLAY = FIRST_SYSTEM_WINDOW+28; + /** * End of types of system windows. */ @@ -530,11 +623,18 @@ public static class LayoutParams extends ViewGroup.LayoutParams public static final int FLAG_FORCE_NOT_FULLSCREEN = 0x00000800; /** Window flag: turn on dithering when compositing this window to - * the screen. */ + * the screen. + * @deprecated This flag is no longer used. */ + @Deprecated public static final int FLAG_DITHER = 0x00001000; - /** Window flag: don't allow screen shots while this window is - * displayed. Maps to Surface.SECURE. */ + /** Window flag: Treat the content of the window as secure, preventing + * it from appearing in screenshots or from being viewed on non-secure + * displays. + * + *

          See {@link android.view.Display#FLAG_SECURE} for more details about + * secure surfaces and secure displays. + */ public static final int FLAG_SECURE = 0x00002000; /** Window flag: a special mode where the layout parameters are used @@ -704,6 +804,10 @@ public static class LayoutParams extends ViewGroup.LayoutParams * {@hide} */ public static final int FLAG_SYSTEM_ERROR = 0x40000000; + /** Window flag: Overrides default power key behavior + * {@hide} */ + public static final int PREVENT_POWER_KEY = 0x80000000; + /** * Various behavioral options/flags. Default is none. * @@ -718,7 +822,6 @@ public static class LayoutParams extends ViewGroup.LayoutParams * @see #FLAG_LAYOUT_NO_LIMITS * @see #FLAG_FULLSCREEN * @see #FLAG_FORCE_NOT_FULLSCREEN - * @see #FLAG_DITHER * @see #FLAG_SECURE * @see #FLAG_SCALED * @see #FLAG_IGNORE_CHEEK_PRESSES @@ -838,6 +941,14 @@ public static class LayoutParams extends ViewGroup.LayoutParams */ public static final int PRIVATE_FLAG_SET_NEEDS_MENU_KEY = 0x00000008; + /** In a multiuser system if this flag is set and the owner is a system process then this + * window will appear on all user screens. This overrides the default behavior of window + * types that normally only appear on the owning user's screen. Refer to each window type + * to determine its default behavior. + * + * {@hide} */ + public static final int PRIVATE_FLAG_SHOW_FOR_ALL_USERS = 0x00000010; + /** * Control flags that are private to the platform. * @hide @@ -1134,15 +1245,43 @@ public static boolean mayUseInputMethod(int flags) { */ public static final int INPUT_FEATURE_NO_INPUT_CHANNEL = 0x00000002; + /** + * When this window has focus, does not call user activity for all input events so + * the application will have to do it itself. Should only be used by + * the keyguard and phone app. + *

          + * Should only be used by the keyguard and phone app. + *

          + * + * @hide + */ + public static final int INPUT_FEATURE_DISABLE_USER_ACTIVITY = 0x00000004; + /** * Control special features of the input subsystem. * * @see #INPUT_FEATURE_DISABLE_TOUCH_PAD_GESTURES * @see #INPUT_FEATURE_NO_INPUT_CHANNEL + * @see #INPUT_FEATURE_DISABLE_USER_ACTIVITY * @hide */ public int inputFeatures; + /** + * Sets the number of milliseconds before the user activity timeout occurs + * when this window has focus. A value of -1 uses the standard timeout. + * A value of 0 uses the minimum support display timeout. + *

          + * This property can only be used to reduce the user specified display timeout; + * it can never make the timeout longer than it normally would be. + *

          + * Should only be used by the keyguard and phone app. + *

          + * + * @hide + */ + public long userActivityTimeout = -1; + public LayoutParams() { super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); type = TYPE_APPLICATION; @@ -1227,6 +1366,7 @@ public void writeToParcel(Parcel out, int parcelableFlags) { out.writeInt(subtreeSystemUiVisibility); out.writeInt(hasSystemUiListeners ? 1 : 0); out.writeInt(inputFeatures); + out.writeLong(userActivityTimeout); } public static final Parcelable.Creator CREATOR @@ -1267,6 +1407,7 @@ public LayoutParams(Parcel in) { subtreeSystemUiVisibility = in.readInt(); hasSystemUiListeners = in.readInt() != 0; inputFeatures = in.readInt(); + userActivityTimeout = in.readLong(); } @SuppressWarnings({"PointlessBitwiseExpression"}) @@ -1293,6 +1434,8 @@ public LayoutParams(Parcel in) { /** {@hide} */ public static final int PRIVATE_FLAGS_CHANGED = 1<<16; /** {@hide} */ + public static final int USER_ACTIVITY_TIMEOUT_CHANGED = 1<<17; + /** {@hide} */ public static final int EVERYTHING_CHANGED = 0xffffffff; // internal buffer to backup/restore parameters under compatibility mode. @@ -1414,6 +1557,11 @@ public final int copyFrom(LayoutParams o) { changes |= INPUT_FEATURES_CHANGED; } + if (userActivityTimeout != o.userActivityTimeout) { + userActivityTimeout = o.userActivityTimeout; + changes |= USER_ACTIVITY_TIMEOUT_CHANGED; + } + return changes; } @@ -1506,6 +1654,9 @@ public String toString() { if (inputFeatures != 0) { sb.append(" if=0x").append(Integer.toHexString(inputFeatures)); } + if (userActivityTimeout >= 0) { + sb.append(" userActivityTimeout=").append(userActivityTimeout); + } sb.append('}'); return sb.toString(); } diff --git a/core/java/android/view/WindowManagerGlobal.java b/core/java/android/view/WindowManagerGlobal.java new file mode 100644 index 0000000000000..e8945aa48a2e8 --- /dev/null +++ b/core/java/android/view/WindowManagerGlobal.java @@ -0,0 +1,526 @@ +/* + * 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.animation.ValueAnimator; +import android.app.ActivityManager; +import android.content.ComponentCallbacks2; +import android.content.res.Configuration; +import android.opengl.ManagedEGLContext; +import android.os.IBinder; +import android.os.Looper; +import android.os.RemoteException; +import android.os.ServiceManager; +import android.os.SystemProperties; +import android.util.AndroidRuntimeException; +import android.util.Log; +import android.view.inputmethod.InputMethodManager; + +import java.io.FileDescriptor; +import java.io.FileOutputStream; +import java.io.PrintWriter; + +/** + * Provides low-level communication with the system window manager for + * operations that are not associated with any particular context. + * + * This class is only used internally to implement global functions where + * the caller already knows the display and relevant compatibility information + * for the operation. For most purposes, you should use {@link WindowManager} instead + * since it is bound to a context. + * + * @see WindowManagerImpl + * @hide + */ +public final class WindowManagerGlobal { + private static final String TAG = "WindowManager"; + + /** + * The user is navigating with keys (not the touch screen), so + * navigational focus should be shown. + */ + public static final int RELAYOUT_RES_IN_TOUCH_MODE = 0x1; + + /** + * This is the first time the window is being drawn, + * so the client must call drawingFinished() when done + */ + public static final int RELAYOUT_RES_FIRST_TIME = 0x2; + + /** + * The window manager has changed the surface from the last call. + */ + public static final int RELAYOUT_RES_SURFACE_CHANGED = 0x4; + + /** + * The window manager is currently animating. It will call + * IWindow.doneAnimating() when done. + */ + public static final int RELAYOUT_RES_ANIMATING = 0x8; + + /** + * Flag for relayout: the client will be later giving + * internal insets; as a result, the window will not impact other window + * layouts until the insets are given. + */ + public static final int RELAYOUT_INSETS_PENDING = 0x1; + + /** + * Flag for relayout: the client may be currently using the current surface, + * so if it is to be destroyed as a part of the relayout the destroy must + * be deferred until later. The client will call performDeferredDestroy() + * when it is okay. + */ + public static final int RELAYOUT_DEFER_SURFACE_DESTROY = 0x2; + + public static final int ADD_FLAG_APP_VISIBLE = 0x2; + public static final int ADD_FLAG_IN_TOUCH_MODE = RELAYOUT_RES_IN_TOUCH_MODE; + + public static final int ADD_OKAY = 0; + public static final int ADD_BAD_APP_TOKEN = -1; + public static final int ADD_BAD_SUBWINDOW_TOKEN = -2; + public static final int ADD_NOT_APP_TOKEN = -3; + public static final int ADD_APP_EXITING = -4; + public static final int ADD_DUPLICATE_ADD = -5; + public static final int ADD_STARTING_NOT_NEEDED = -6; + public static final int ADD_MULTIPLE_SINGLETON = -7; + public static final int ADD_PERMISSION_DENIED = -8; + public static final int ADD_INVALID_DISPLAY = -9; + + private static WindowManagerGlobal sDefaultWindowManager; + private static IWindowManager sWindowManagerService; + private static IWindowSession sWindowSession; + + private final Object mLock = new Object(); + + private View[] mViews; + private ViewRootImpl[] mRoots; + private WindowManager.LayoutParams[] mParams; + private boolean mNeedsEglTerminate; + + private Runnable mSystemPropertyUpdater; + + private WindowManagerGlobal() { + } + + public static WindowManagerGlobal getInstance() { + synchronized (WindowManagerGlobal.class) { + if (sDefaultWindowManager == null) { + sDefaultWindowManager = new WindowManagerGlobal(); + } + return sDefaultWindowManager; + } + } + + public static IWindowManager getWindowManagerService() { + synchronized (WindowManagerGlobal.class) { + if (sWindowManagerService == null) { + sWindowManagerService = IWindowManager.Stub.asInterface( + ServiceManager.getService("window")); + } + return sWindowManagerService; + } + } + + public static IWindowSession getWindowSession(Looper mainLooper) { + synchronized (WindowManagerGlobal.class) { + if (sWindowSession == null) { + try { + InputMethodManager imm = InputMethodManager.getInstance(mainLooper); + IWindowManager windowManager = getWindowManagerService(); + sWindowSession = windowManager.openSession( + imm.getClient(), imm.getInputContext()); + float animatorScale = windowManager.getAnimationScale(2); + ValueAnimator.setDurationScale(animatorScale); + } catch (RemoteException e) { + Log.e(TAG, "Failed to open window session", e); + } + } + return sWindowSession; + } + } + + public static IWindowSession peekWindowSession() { + synchronized (WindowManagerGlobal.class) { + return sWindowSession; + } + } + + public void addView(View view, ViewGroup.LayoutParams params, + Display display, Window parentWindow) { + if (view == null) { + throw new IllegalArgumentException("view must not be null"); + } + if (display == null) { + throw new IllegalArgumentException("display must not be null"); + } + if (!(params instanceof WindowManager.LayoutParams)) { + throw new IllegalArgumentException("Params must be WindowManager.LayoutParams"); + } + + final WindowManager.LayoutParams wparams = (WindowManager.LayoutParams)params; + if (parentWindow != null) { + parentWindow.adjustLayoutParamsForSubWindow(wparams); + } + + ViewRootImpl root; + View panelParentView = null; + + synchronized (mLock) { + // Start watching for system property changes. + if (mSystemPropertyUpdater == null) { + mSystemPropertyUpdater = new Runnable() { + @Override public void run() { + synchronized (mLock) { + for (ViewRootImpl viewRoot : mRoots) { + viewRoot.loadSystemProperties(); + } + } + } + }; + SystemProperties.addChangeCallback(mSystemPropertyUpdater); + } + + int index = findViewLocked(view, false); + if (index >= 0) { + throw new IllegalStateException("View " + view + + " has already been added to the window manager."); + } + + // If this is a panel window, then find the window it is being + // attached to for future reference. + if (wparams.type >= WindowManager.LayoutParams.FIRST_SUB_WINDOW && + wparams.type <= WindowManager.LayoutParams.LAST_SUB_WINDOW) { + final int count = mViews != null ? mViews.length : 0; + for (int i=0; i= 0) { + removeViewLocked(index, true); + } + } + throw e; + } + } + + public void updateViewLayout(View view, ViewGroup.LayoutParams params) { + if (view == null) { + throw new IllegalArgumentException("view must not be null"); + } + if (!(params instanceof WindowManager.LayoutParams)) { + throw new IllegalArgumentException("Params must be WindowManager.LayoutParams"); + } + + final WindowManager.LayoutParams wparams = (WindowManager.LayoutParams)params; + + view.setLayoutParams(wparams); + + synchronized (mLock) { + int index = findViewLocked(view, true); + ViewRootImpl root = mRoots[index]; + mParams[index] = wparams; + root.setLayoutParams(wparams, false); + } + } + + public void removeView(View view, boolean immediate) { + if (view == null) { + throw new IllegalArgumentException("view must not be null"); + } + + synchronized (mLock) { + int index = findViewLocked(view, true); + View curView = removeViewLocked(index, immediate); + if (curView == view) { + return; + } + + throw new IllegalStateException("Calling with view " + view + + " but the ViewAncestor is attached to " + curView); + } + } + + public void closeAll(IBinder token, String who, String what) { + synchronized (mLock) { + if (mViews == null) + return; + + int count = mViews.length; + //Log.i("foo", "Closing all windows of " + token); + for (int i=0; i 0) { + if (index > 0) { + System.arraycopy(src, 0, dst, 0, index); + } + if (index < dst.length) { + System.arraycopy(src, index+1, dst, index, src.length-index-1); + } + } + } + + private int findViewLocked(View view, boolean required) { + if (mViews != null) { + final int count = mViews.length; + for (int i = 0; i < count; i++) { + if (mViews[i] == view) { + return i; + } + } + } + if (required) { + throw new IllegalArgumentException("View not attached to window manager"); + } + return -1; + } + + public void startTrimMemory(int level) { + if (HardwareRenderer.isAvailable()) { + // On low-end gfx devices we trim when memory is moderate; + // on high-end devices we do this when low. + if (level >= ComponentCallbacks2.TRIM_MEMORY_COMPLETE + || (level >= ComponentCallbacks2.TRIM_MEMORY_MODERATE + && !ActivityManager.isHighEndGfx())) { + // Destroy all hardware surfaces and resources associated to + // known windows + synchronized (mLock) { + if (mViews == null) return; + int count = mViews.length; + for (int i = 0; i < count; i++) { + mRoots[i].terminateHardwareResources(); + } + } + // Force a full memory flush + mNeedsEglTerminate = true; + HardwareRenderer.startTrimMemory(ComponentCallbacks2.TRIM_MEMORY_COMPLETE); + return; + } + + HardwareRenderer.startTrimMemory(level); + } + } + + public void endTrimMemory() { + HardwareRenderer.endTrimMemory(); + + if (mNeedsEglTerminate) { + ManagedEGLContext.doTerminate(); + mNeedsEglTerminate = false; + } + } + + public void trimLocalMemory() { + synchronized (mLock) { + if (mViews == null) return; + int count = mViews.length; + for (int i = 0; i < count; i++) { + mRoots[i].destroyHardwareLayers(); + } + } + } + + public void dumpGfxInfo(FileDescriptor fd) { + FileOutputStream fout = new FileOutputStream(fd); + PrintWriter pw = new PrintWriter(fout); + try { + synchronized (mLock) { + if (mViews != null) { + final int count = mViews.length; + + pw.println("Profile data in ms:"); + + for (int i = 0; i < count; i++) { + ViewRootImpl root = mRoots[i]; + String name = getWindowName(root); + pw.printf("\n\t%s", name); + + HardwareRenderer renderer = + root.getView().mAttachInfo.mHardwareRenderer; + if (renderer != null) { + renderer.dumpGfxInfo(pw); + } + } + + pw.println("\nView hierarchy:\n"); + + int viewsCount = 0; + int displayListsSize = 0; + int[] info = new int[2]; + + for (int i = 0; i < count; i++) { + ViewRootImpl root = mRoots[i]; + root.dumpGfxInfo(info); + + String name = getWindowName(root); + pw.printf(" %s\n %d views, %.2f kB of display lists", + name, info[0], info[1] / 1024.0f); + HardwareRenderer renderer = + root.getView().mAttachInfo.mHardwareRenderer; + if (renderer != null) { + pw.printf(", %d frames rendered", renderer.getFrameCount()); + } + pw.printf("\n\n"); + + viewsCount += info[0]; + displayListsSize += info[1]; + } + + pw.printf("\nTotal ViewRootImpl: %d\n", count); + pw.printf("Total Views: %d\n", viewsCount); + pw.printf("Total DisplayList: %.2f kB\n\n", displayListsSize / 1024.0f); + } + } + } finally { + pw.flush(); + } + } + + private static String getWindowName(ViewRootImpl root) { + return root.mWindowAttributes.getTitle() + "/" + + root.getClass().getName() + '@' + Integer.toHexString(root.hashCode()); + } + + public void setStoppedState(IBinder token, boolean stopped) { + synchronized (mLock) { + if (mViews != null) { + int count = mViews.length; + for (int i=0; i < count; i++) { + if (token == null || mParams[i].token == token) { + ViewRootImpl root = mRoots[i]; + root.setStopped(stopped); + } + } + } + } + } + + public void reportNewConfiguration(Configuration config) { + synchronized (mLock) { + if (mViews != null) { + int count = mViews.length; + config = new Configuration(config); + for (int i=0; i < count; i++) { + ViewRootImpl root = mRoots[i]; + root.requestUpdateConfiguration(config); + } + } + } + } +} + +final class WindowLeaked extends AndroidRuntimeException { + public WindowLeaked(String msg) { + super(msg); + } +} diff --git a/core/java/android/view/WindowManagerImpl.java b/core/java/android/view/WindowManagerImpl.java index dd6b5371d479d..52d79f84f9a15 100644 --- a/core/java/android/view/WindowManagerImpl.java +++ b/core/java/android/view/WindowManagerImpl.java @@ -16,36 +16,17 @@ package android.view; -import android.app.ActivityManager; -import android.content.ComponentCallbacks2; -import android.content.res.CompatibilityInfo; -import android.content.res.Configuration; -import android.graphics.PixelFormat; -import android.opengl.ManagedEGLContext; -import android.os.IBinder; -import android.os.SystemProperties; -import android.util.AndroidRuntimeException; -import android.util.Log; -import android.view.inputmethod.InputMethodManager; - -import java.io.FileDescriptor; -import java.io.FileOutputStream; -import java.io.PrintWriter; -import java.util.HashMap; - -final class WindowLeaked extends AndroidRuntimeException { - public WindowLeaked(String msg) { - super(msg); - } -} - /** - * Low-level communication with the global system window manager. It implements - * the ViewManager interface, allowing you to add any View subclass as a - * top-level window on the screen. Additional window manager specific layout - * parameters are defined for control over how windows are displayed. - * It also implemens the WindowManager interface, allowing you to control the - * displays attached to the device. + * Provides low-level communication with the system window manager for + * operations that are bound to a particular context, display or parent window. + * Instances of this object are sensitive to the compatibility info associated + * with the running application. + * + * This object implements the {@link ViewManager} interface, + * allowing you to add any View subclass as a top-level window on the screen. + * Additional window manager specific layout parameters are defined for + * control over how windows are displayed. It also implements the {@link WindowManager} + * interface, allowing you to control the displays attached to the device. * *

          Applications will not normally use WindowManager directly, instead relying * on the higher-level facilities in {@link android.app.Activity} and @@ -53,607 +34,58 @@ public WindowLeaked(String msg) { * *

          Even for low-level window manager access, it is almost never correct to use * this class. For example, {@link android.app.Activity#getWindowManager} - * provides a ViewManager for adding windows that are associated with that + * provides a window manager for adding windows that are associated with that * activity -- the window manager will not normally allow you to add arbitrary * windows that are not associated with an activity. - * + * + * @see WindowManager + * @see WindowManagerGlobal * @hide */ -public class WindowManagerImpl implements WindowManager { - /** - * The user is navigating with keys (not the touch screen), so - * navigational focus should be shown. - */ - public static final int RELAYOUT_RES_IN_TOUCH_MODE = 0x1; - /** - * This is the first time the window is being drawn, - * so the client must call drawingFinished() when done - */ - public static final int RELAYOUT_RES_FIRST_TIME = 0x2; - /** - * The window manager has changed the surface from the last call. - */ - public static final int RELAYOUT_RES_SURFACE_CHANGED = 0x4; - /** - * The window manager is currently animating. It will call - * IWindow.doneAnimating() when done. - */ - public static final int RELAYOUT_RES_ANIMATING = 0x8; - - /** - * Flag for relayout: the client will be later giving - * internal insets; as a result, the window will not impact other window - * layouts until the insets are given. - */ - public static final int RELAYOUT_INSETS_PENDING = 0x1; - - /** - * Flag for relayout: the client may be currently using the current surface, - * so if it is to be destroyed as a part of the relayout the destroy must - * be deferred until later. The client will call performDeferredDestroy() - * when it is okay. - */ - public static final int RELAYOUT_DEFER_SURFACE_DESTROY = 0x2; - - public static final int ADD_FLAG_APP_VISIBLE = 0x2; - public static final int ADD_FLAG_IN_TOUCH_MODE = RELAYOUT_RES_IN_TOUCH_MODE; - - public static final int ADD_OKAY = 0; - public static final int ADD_BAD_APP_TOKEN = -1; - public static final int ADD_BAD_SUBWINDOW_TOKEN = -2; - public static final int ADD_NOT_APP_TOKEN = -3; - public static final int ADD_APP_EXITING = -4; - public static final int ADD_DUPLICATE_ADD = -5; - public static final int ADD_STARTING_NOT_NEEDED = -6; - public static final int ADD_MULTIPLE_SINGLETON = -7; - public static final int ADD_PERMISSION_DENIED = -8; - - private View[] mViews; - private ViewRootImpl[] mRoots; - private WindowManager.LayoutParams[] mParams; - private boolean mNeedsEglTerminate; - - private Runnable mSystemPropertyUpdater = null; - - private final static Object sLock = new Object(); - private final static WindowManagerImpl sWindowManager = new WindowManagerImpl(); - private final static HashMap sCompatWindowManagers - = new HashMap(); - - static class CompatModeWrapper implements WindowManager { - private final WindowManagerImpl mWindowManager; - private final Display mDefaultDisplay; - private final CompatibilityInfoHolder mCompatibilityInfo; - - CompatModeWrapper(WindowManager wm, CompatibilityInfoHolder ci) { - mWindowManager = wm instanceof CompatModeWrapper - ? ((CompatModeWrapper)wm).mWindowManager : (WindowManagerImpl)wm; - - // Use the original display if there is no compatibility mode - // to apply, or the underlying window manager is already a - // compatibility mode wrapper. (We assume that if it is a - // wrapper, it is applying the same compatibility mode.) - if (ci == null) { - mDefaultDisplay = mWindowManager.getDefaultDisplay(); - } else { - //mDefaultDisplay = mWindowManager.getDefaultDisplay(); - mDefaultDisplay = Display.createCompatibleDisplay( - mWindowManager.getDefaultDisplay().getDisplayId(), ci); - } - - mCompatibilityInfo = ci; - } - - @Override - public void addView(View view, android.view.ViewGroup.LayoutParams params) { - mWindowManager.addView(view, params, mCompatibilityInfo); - } - - @Override - public void updateViewLayout(View view, android.view.ViewGroup.LayoutParams params) { - mWindowManager.updateViewLayout(view, params); - - } - - @Override - public void removeView(View view) { - mWindowManager.removeView(view); - } - - @Override - public Display getDefaultDisplay() { - return mDefaultDisplay; - } - - @Override - public void removeViewImmediate(View view) { - mWindowManager.removeViewImmediate(view); - } - - @Override - public boolean isHardwareAccelerated() { - return mWindowManager.isHardwareAccelerated(); - } +public final class WindowManagerImpl implements WindowManager { + private final WindowManagerGlobal mGlobal = WindowManagerGlobal.getInstance(); + private final Display mDisplay; + private final Window mParentWindow; + public WindowManagerImpl(Display display) { + this(display, null); } - public static WindowManagerImpl getDefault() { - return sWindowManager; + private WindowManagerImpl(Display display, Window parentWindow) { + mDisplay = display; + mParentWindow = parentWindow; } - public static WindowManager getDefault(CompatibilityInfo compatInfo) { - CompatibilityInfoHolder cih = new CompatibilityInfoHolder(); - cih.set(compatInfo); - if (cih.getIfNeeded() == null) { - return sWindowManager; - } - - synchronized (sLock) { - // NOTE: It would be cleaner to move the implementation of - // WindowManagerImpl into a static inner class, and have this - // public impl just call into that. Then we can make multiple - // instances of WindowManagerImpl for compat mode rather than - // having to make wrappers. - WindowManager wm = sCompatWindowManagers.get(compatInfo); - if (wm == null) { - wm = new CompatModeWrapper(sWindowManager, cih); - sCompatWindowManagers.put(compatInfo, wm); - } - return wm; - } + public WindowManagerImpl createLocalWindowManager(Window parentWindow) { + return new WindowManagerImpl(mDisplay, parentWindow); } - public static WindowManager getDefault(CompatibilityInfoHolder compatInfo) { - return new CompatModeWrapper(sWindowManager, compatInfo); - } - - public boolean isHardwareAccelerated() { - return false; - } - - public void addView(View view) { - addView(view, new WindowManager.LayoutParams( - WindowManager.LayoutParams.TYPE_APPLICATION, 0, PixelFormat.OPAQUE)); + public WindowManagerImpl createPresentationWindowManager(Display display) { + return new WindowManagerImpl(display, mParentWindow); } + @Override public void addView(View view, ViewGroup.LayoutParams params) { - addView(view, params, null, false); - } - - public void addView(View view, ViewGroup.LayoutParams params, CompatibilityInfoHolder cih) { - addView(view, params, cih, false); - } - - private void addView(View view, ViewGroup.LayoutParams params, - CompatibilityInfoHolder cih, boolean nest) { - if (false) Log.v("WindowManager", "addView view=" + view); - - if (!(params instanceof WindowManager.LayoutParams)) { - throw new IllegalArgumentException( - "Params must be WindowManager.LayoutParams"); - } - - final WindowManager.LayoutParams wparams - = (WindowManager.LayoutParams)params; - - ViewRootImpl root; - View panelParentView = null; - - synchronized (this) { - // Start watching for system property changes. - if (mSystemPropertyUpdater == null) { - mSystemPropertyUpdater = new Runnable() { - @Override public void run() { - synchronized (this) { - synchronized (this) { - for (ViewRootImpl root : mRoots) { - root.loadSystemProperties(); - } - } - } - } - }; - SystemProperties.addChangeCallback(mSystemPropertyUpdater); - } - - // Here's an odd/questionable case: if someone tries to add a - // view multiple times, then we simply bump up a nesting count - // and they need to remove the view the corresponding number of - // times to have it actually removed from the window manager. - // This is useful specifically for the notification manager, - // which can continually add/remove the same view as a - // notification gets updated. - int index = findViewLocked(view, false); - if (index >= 0) { - if (!nest) { - throw new IllegalStateException("View " + view - + " has already been added to the window manager."); - } - root = mRoots[index]; - root.mAddNesting++; - // Update layout parameters. - view.setLayoutParams(wparams); - root.setLayoutParams(wparams, true); - return; - } - - // If this is a panel window, then find the window it is being - // attached to for future reference. - if (wparams.type >= WindowManager.LayoutParams.FIRST_SUB_WINDOW && - wparams.type <= WindowManager.LayoutParams.LAST_SUB_WINDOW) { - final int count = mViews != null ? mViews.length : 0; - for (int i=0; i 0) { - return view; - } - - if (view != null) { - InputMethodManager imm = InputMethodManager.getInstance(view.getContext()); - if (imm != null) { - imm.windowDismissed(mViews[index].getWindowToken()); - } - } - root.die(false); - finishRemoveViewLocked(view, index); - return view; - } - - void finishRemoveViewLocked(View view, int index) { - final int count = mViews.length; - - // remove it from the list - View[] tmpViews = new View[count-1]; - removeItem(tmpViews, mViews, index); - mViews = tmpViews; - - ViewRootImpl[] tmpRoots = new ViewRootImpl[count-1]; - removeItem(tmpRoots, mRoots, index); - mRoots = tmpRoots; - - WindowManager.LayoutParams[] tmpParams - = new WindowManager.LayoutParams[count-1]; - removeItem(tmpParams, mParams, index); - mParams = tmpParams; - - if (view != null) { - view.assignParent(null); - // func doesn't allow null... does it matter if we clear them? - //view.setLayoutParams(null); - } - } - - public void closeAll(IBinder token, String who, String what) { - synchronized (this) { - if (mViews == null) - return; - - int count = mViews.length; - //Log.i("foo", "Closing all windows of " + token); - for (int i=0; i= ComponentCallbacks2.TRIM_MEMORY_COMPLETE - || (level >= ComponentCallbacks2.TRIM_MEMORY_MODERATE - && !ActivityManager.isHighEndGfx(getDefaultDisplay()))) { - // Destroy all hardware surfaces and resources associated to - // known windows - synchronized (this) { - if (mViews == null) return; - int count = mViews.length; - for (int i = 0; i < count; i++) { - mRoots[i].terminateHardwareResources(); - } - } - // Force a full memory flush - mNeedsEglTerminate = true; - HardwareRenderer.startTrimMemory(ComponentCallbacks2.TRIM_MEMORY_COMPLETE); - return; - } - - HardwareRenderer.startTrimMemory(level); - } - } - - /** - * @hide - */ - public void endTrimMemory() { - HardwareRenderer.endTrimMemory(); - - if (mNeedsEglTerminate) { - ManagedEGLContext.doTerminate(); - mNeedsEglTerminate = false; - } - } - - /** - * @hide - */ - public void trimLocalMemory() { - synchronized (this) { - if (mViews == null) return; - int count = mViews.length; - for (int i = 0; i < count; i++) { - mRoots[i].destroyHardwareLayers(); - } - } - } - - /** - * @hide - */ - public void dumpGfxInfo(FileDescriptor fd) { - FileOutputStream fout = new FileOutputStream(fd); - PrintWriter pw = new PrintWriter(fout); - try { - synchronized (this) { - if (mViews != null) { - final int count = mViews.length; - - pw.println("Profile data in ms:"); - - for (int i = 0; i < count; i++) { - ViewRootImpl root = mRoots[i]; - String name = getWindowName(root); - pw.printf("\n\t%s", name); - - HardwareRenderer renderer = root.getView().mAttachInfo.mHardwareRenderer; - if (renderer != null) { - renderer.dumpGfxInfo(pw); - } - } - - pw.println("\nView hierarchy:\n"); - - int viewsCount = 0; - int displayListsSize = 0; - int[] info = new int[2]; - - for (int i = 0; i < count; i++) { - ViewRootImpl root = mRoots[i]; - root.dumpGfxInfo(info); - - String name = getWindowName(root); - pw.printf(" %s\n %d views, %.2f kB of display lists", - name, info[0], info[1] / 1024.0f); - HardwareRenderer renderer = root.getView().mAttachInfo.mHardwareRenderer; - if (renderer != null) { - pw.printf(", %d frames rendered", renderer.getFrameCount()); - } - pw.printf("\n\n"); - - viewsCount += info[0]; - displayListsSize += info[1]; - } - - pw.printf("\nTotal ViewRootImpl: %d\n", count); - pw.printf("Total Views: %d\n", viewsCount); - pw.printf("Total DisplayList: %.2f kB\n\n", displayListsSize / 1024.0f); - } - } - } finally { - pw.flush(); - } - } - - private static String getWindowName(ViewRootImpl root) { - return root.mWindowAttributes.getTitle() + "/" + - root.getClass().getName() + '@' + Integer.toHexString(root.hashCode()); - } - - public void setStoppedState(IBinder token, boolean stopped) { - synchronized (this) { - if (mViews == null) - return; - int count = mViews.length; - for (int i=0; i 0) { - if (index > 0) { - System.arraycopy(src, 0, dst, 0, index); - } - if (index < dst.length) { - System.arraycopy(src, index+1, dst, index, src.length-index-1); - } - } - } - - private int findViewLocked(View view, boolean required) { - synchronized (this) { - final int count = mViews != null ? mViews.length : 0; - for (int i=0; i *

          *

          + * Touch interaction start - represents the event of starting a touch + * interaction, which is the user starts touching the screen.
          + * Type: {@link #TYPE_TOUCH_INTERACTION_START}
          + * Properties:
          + *

            + *
          • {@link #getEventType()} - The type of the event.
          • + *
          + * Note: This event is fired only by the system and is not passed to the + * view tree to be populated.
          + *

          + *

          + * Touch interaction end - represents the event of ending a touch + * interaction, which is the user stops touching the screen.
          + * Type: {@link #TYPE_TOUCH_INTERACTION_END}
          + * Properties:
          + *

            + *
          • {@link #getEventType()} - The type of the event.
          • + *
          + * Note: This event is fired only by the system and is not passed to the + * view tree to be populated.
          + *

          + *

          * Touch exploration gesture start - represents the event of starting a touch * exploring gesture.
          * Type: {@link #TYPE_TOUCH_EXPLORATION_GESTURE_START}
          @@ -431,15 +453,8 @@ *

            *
          • {@link #getEventType()} - The type of the event.
          • *
          - * Note: This event type is not dispatched to descendants though - * {@link android.view.View#dispatchPopulateAccessibilityEvent(AccessibilityEvent) - * View.dispatchPopulateAccessibilityEvent(AccessibilityEvent)}, hence the event - * source {@link android.view.View} and the sub-tree rooted at it will not receive - * calls to {@link android.view.View#onPopulateAccessibilityEvent(AccessibilityEvent) - * View.onPopulateAccessibilityEvent(AccessibilityEvent)}. The preferred way to add - * text content to such events is by setting the - * {@link android.R.styleable#View_contentDescription contentDescription} of the source - * view.
          + * Note: This event is fired only by the system and is not passed to the + * view tree to be populated.
          *

          *

          * Touch exploration gesture end - represents the event of ending a touch @@ -449,15 +464,30 @@ *

            *
          • {@link #getEventType()} - The type of the event.
          • *
          - * Note: This event type is not dispatched to descendants though - * {@link android.view.View#dispatchPopulateAccessibilityEvent(AccessibilityEvent) - * View.dispatchPopulateAccessibilityEvent(AccessibilityEvent)}, hence the event - * source {@link android.view.View} and the sub-tree rooted at it will not receive - * calls to {@link android.view.View#onPopulateAccessibilityEvent(AccessibilityEvent) - * View.onPopulateAccessibilityEvent(AccessibilityEvent)}. The preferred way to add - * text content to such events is by setting the - * {@link android.R.styleable#View_contentDescription contentDescription} of the source - * view.
          + * Note: This event is fired only by the system and is not passed to the + * view tree to be populated.
          + *

          + *

          + * Touch gesture detection start - represents the event of starting a user + * gesture detection.
          + * Type: {@link #TYPE_GESTURE_DETECTION_START}
          + * Properties:
          + *

            + *
          • {@link #getEventType()} - The type of the event.
          • + *
          + * Note: This event is fired only by the system and is not passed to the + * view tree to be populated.
          + *

          + *

          + * Touch gesture detection end - represents the event of ending a user + * gesture detection.
          + * Type: {@link #TYPE_GESTURE_DETECTION_END}
          + * Properties:
          + *

            + *
          • {@link #getEventType()} - The type of the event.
          • + *
          + * Note: This event is fired only by the system and is not passed to the + * view tree to be populated.
          *

          *

          * MISCELLANEOUS TYPES
          @@ -609,6 +639,26 @@ public final class AccessibilityEvent extends AccessibilityRecord implements Par */ public static final int TYPE_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY = 0x00020000; + /** + * Represents the event of beginning gesture detection. + */ + public static final int TYPE_GESTURE_DETECTION_START = 0x00040000; + + /** + * Represents the event of ending gesture detection. + */ + public static final int TYPE_GESTURE_DETECTION_END = 0x00080000; + + /** + * Represents the event of the user starting to touch the screen. + */ + public static final int TYPE_TOUCH_INTERACTION_START = 0x00100000; + + /** + * Represents the event of the user ending to touch the screen. + */ + public static final int TYPE_TOUCH_INTERACTION_END = 0x00200000; + /** * Mask for {@link AccessibilityEvent} all types. * @@ -628,6 +678,10 @@ public final class AccessibilityEvent extends AccessibilityRecord implements Par * @see #TYPE_VIEW_TEXT_SELECTION_CHANGED * @see #TYPE_ANNOUNCEMENT * @see #TYPE_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY + * @see #TYPE_GESTURE_DETECTION_START + * @see #TYPE_GESTURE_DETECTION_END + * @see #TYPE_TOUCH_INTERACTION_START + * @see #TYPE_TOUCH_INTERACTION_END */ public static final int TYPES_ALL_MASK = 0xFFFFFFFF; @@ -1120,6 +1174,14 @@ public static String eventTypeToString(int eventType) { return "TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED"; case TYPE_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY: return "TYPE_CURRENT_AT_GRANULARITY_MOVEMENT_CHANGED"; + case TYPE_GESTURE_DETECTION_START: + return "TYPE_GESTURE_DETECTION_START"; + case TYPE_GESTURE_DETECTION_END: + return "TYPE_GESTURE_DETECTION_END"; + case TYPE_TOUCH_INTERACTION_START: + return "TYPE_TOUCH_INTERACTION_START"; + case TYPE_TOUCH_INTERACTION_END: + return "TYPE_TOUCH_INTERACTION_END"; default: return null; } diff --git a/core/java/android/view/accessibility/AccessibilityManager.java b/core/java/android/view/accessibility/AccessibilityManager.java index 77fd12a9866fb..732699b0b0f41 100644 --- a/core/java/android/view/accessibility/AccessibilityManager.java +++ b/core/java/android/view/accessibility/AccessibilityManager.java @@ -27,6 +27,7 @@ import android.os.RemoteException; import android.os.ServiceManager; import android.os.SystemClock; +import android.os.UserHandle; import android.util.Log; import android.view.IWindow; import android.view.View; @@ -79,6 +80,8 @@ public final class AccessibilityManager { final IAccessibilityManager mService; + final int mUserId; + final Handler mHandler; boolean mIsEnabled; @@ -128,36 +131,73 @@ public void handleMessage(Message message) { } } + /** + * Creates the singleton AccessibilityManager to be shared across users. This + * has to be called before the local AccessibilityManager is created to ensure + * it registers itself in the system correctly. + *

          + * Note: Calling this method requires INTERACT_ACROSS_USERS_FULL or + * INTERACT_ACROSS_USERS permission. + *

          + * @param context Context in which this manager operates. + * @throws IllegalStateException if not called before the local + * AccessibilityManager is instantiated. + * + * @hide + */ + public static void createAsSharedAcrossUsers(Context context) { + synchronized (sInstanceSync) { + if (sInstance != null) { + throw new IllegalStateException("AccessibilityManager already created."); + } + createSingletonInstance(context, UserHandle.USER_CURRENT); + } + } + /** * Get an AccessibilityManager instance (create one if necessary). * + * @param context Context in which this manager operates. + * * @hide */ public static AccessibilityManager getInstance(Context context) { synchronized (sInstanceSync) { if (sInstance == null) { - IBinder iBinder = ServiceManager.getService(Context.ACCESSIBILITY_SERVICE); - IAccessibilityManager service = IAccessibilityManager.Stub.asInterface(iBinder); - sInstance = new AccessibilityManager(context, service); + createSingletonInstance(context, UserHandle.myUserId()); } } return sInstance; } + /** + * Creates the singleton instance. + * + * @param context Context in which this manager operates. + * @param userId The user id under which to operate. + */ + private static void createSingletonInstance(Context context, int userId) { + IBinder iBinder = ServiceManager.getService(Context.ACCESSIBILITY_SERVICE); + IAccessibilityManager service = IAccessibilityManager.Stub.asInterface(iBinder); + sInstance = new AccessibilityManager(context, service, userId); + } + /** * Create an instance. * * @param context A {@link Context}. * @param service An interface to the backing service. + * @param userId User id under which to run. * * @hide */ - public AccessibilityManager(Context context, IAccessibilityManager service) { + public AccessibilityManager(Context context, IAccessibilityManager service, int userId) { mHandler = new MyHandler(context.getMainLooper()); mService = service; + mUserId = userId; try { - final int stateFlags = mService.addClient(mClient); + final int stateFlags = mService.addClient(mClient, userId); setState(stateFlags); } catch (RemoteException re) { Log.e(LOG_TAG, "AccessibilityManagerService is dead", re); @@ -222,7 +262,7 @@ public void sendAccessibilityEvent(AccessibilityEvent event) { // client using it is called through Binder from another process. Example: MMS // app adds a SMS notification and the NotificationManagerService calls this method long identityToken = Binder.clearCallingIdentity(); - doRecycle = mService.sendAccessibilityEvent(event); + doRecycle = mService.sendAccessibilityEvent(event, mUserId); Binder.restoreCallingIdentity(identityToken); if (DEBUG) { Log.i(LOG_TAG, event + " sent"); @@ -244,7 +284,7 @@ public void interrupt() { throw new IllegalStateException("Accessibility off. Did you forget to check that?"); } try { - mService.interrupt(); + mService.interrupt(mUserId); if (DEBUG) { Log.i(LOG_TAG, "Requested interrupt from all services"); } @@ -280,7 +320,7 @@ public List getAccessibilityServiceList() { public List getInstalledAccessibilityServiceList() { List services = null; try { - services = mService.getInstalledAccessibilityServiceList(); + services = mService.getInstalledAccessibilityServiceList(mUserId); if (DEBUG) { Log.i(LOG_TAG, "Installed AccessibilityServices " + services); } @@ -307,7 +347,7 @@ public List getEnabledAccessibilityServiceList( int feedbackTypeFlags) { List services = null; try { - services = mService.getEnabledAccessibilityServiceList(feedbackTypeFlags); + services = mService.getEnabledAccessibilityServiceList(feedbackTypeFlags, mUserId); if (DEBUG) { Log.i(LOG_TAG, "Installed AccessibilityServices " + services); } @@ -385,7 +425,7 @@ private void notifyAccessibilityStateChanged() { public int addAccessibilityInteractionConnection(IWindow windowToken, IAccessibilityInteractionConnection connection) { try { - return mService.addAccessibilityInteractionConnection(windowToken, connection); + return mService.addAccessibilityInteractionConnection(windowToken, connection, mUserId); } catch (RemoteException re) { Log.e(LOG_TAG, "Error while adding an accessibility interaction connection. ", re); } diff --git a/core/java/android/view/accessibility/AccessibilityNodeInfo.java b/core/java/android/view/accessibility/AccessibilityNodeInfo.java index 3ad3a5557053f..1dc2487de9840 100644 --- a/core/java/android/view/accessibility/AccessibilityNodeInfo.java +++ b/core/java/android/view/accessibility/AccessibilityNodeInfo.java @@ -365,6 +365,8 @@ public static long makeNodeId(int accessibilityViewId, int virtualDescendantId) private int mWindowId = UNDEFINED; private long mSourceNodeId = ROOT_NODE_ID; private long mParentNodeId = ROOT_NODE_ID; + private long mLabelForId = ROOT_NODE_ID; + private long mLabeledById = ROOT_NODE_ID; private int mBooleanProperties; private final Rect mBoundsInParent = new Rect(); @@ -382,10 +384,6 @@ public static long makeNodeId(int accessibilityViewId, int virtualDescendantId) private int mConnectionId = UNDEFINED; - // TODO: These are a workaround for 6623031. Remove when fixed. - private int mActualAndReportedWindowLeftDelta; - private int mActualAndReportedWindowTopDelta; - /** * Hide constructor from clients. */ @@ -432,10 +430,6 @@ public void setSource(View root, int virtualDescendantId) { final int rootAccessibilityViewId = (root != null) ? root.getAccessibilityViewId() : UNDEFINED; mSourceNodeId = makeNodeId(rootAccessibilityViewId, virtualDescendantId); - if (root != null) { - mActualAndReportedWindowLeftDelta = root.getActualAndReportedWindowLeftDelta(); - mActualAndReportedWindowTopDelta = root.getActualAndReportedWindowTopDelta(); - } } /** @@ -833,7 +827,6 @@ public void getBoundsInScreen(Rect outBounds) { public void setBoundsInScreen(Rect bounds) { enforceNotSealed(); mBoundsInScreen.set(bounds.left, bounds.top, bounds.right, bounds.bottom); - mBoundsInScreen.offset(mActualAndReportedWindowLeftDelta, mActualAndReportedWindowTopDelta); } /** @@ -1241,6 +1234,120 @@ public void setContentDescription(CharSequence contentDescription) { mContentDescription = contentDescription; } + /** + * Sets the view for which the view represented by this info serves as a + * label for accessibility purposes. + * + * @param labeled The view for which this info serves as a label. + */ + public void setLabelFor(View labeled) { + setLabelFor(labeled, UNDEFINED); + } + + /** + * Sets the view for which the view represented by this info serves as a + * label for accessibility purposes. If virtualDescendantId + * is {@link View#NO_ID} the root is set as the labeled. + *

          + * A virtual descendant is an imaginary View that is reported as a part of the view + * hierarchy for accessibility purposes. This enables custom views that draw complex + * content to report themselves as a tree of virtual views, thus conveying their + * logical structure. + *

          + *

          + * Note: Cannot be called from an + * {@link android.accessibilityservice.AccessibilityService}. + * This class is made immutable before being delivered to an AccessibilityService. + *

          + * + * @param root The root whose virtual descendant serves as a label. + * @param virtualDescendantId The id of the virtual descendant. + */ + public void setLabelFor(View root, int virtualDescendantId) { + enforceNotSealed(); + final int rootAccessibilityViewId = (root != null) + ? root.getAccessibilityViewId() : UNDEFINED; + mLabelForId = makeNodeId(rootAccessibilityViewId, virtualDescendantId); + } + + /** + * Gets the node info for which the view represented by this info serves as + * a label for accessibility purposes. + *

          + * Note: It is a client responsibility to recycle the + * received info by calling {@link AccessibilityNodeInfo#recycle()} + * to avoid creating of multiple instances. + *

          + * + * @return The labeled info. + */ + public AccessibilityNodeInfo getLabelFor() { + enforceSealed(); + if (!canPerformRequestOverConnection(mLabelForId)) { + return null; + } + AccessibilityInteractionClient client = AccessibilityInteractionClient.getInstance(); + return client.findAccessibilityNodeInfoByAccessibilityId(mConnectionId, + mWindowId, mLabelForId, FLAG_PREFETCH_DESCENDANTS | FLAG_PREFETCH_SIBLINGS); + } + + /** + * Sets the view which serves as the label of the view represented by + * this info for accessibility purposes. + * + * @param label The view that labels this node's source. + */ + public void setLabeledBy(View label) { + setLabeledBy(label, UNDEFINED); + } + + /** + * Sets the view which serves as the label of the view represented by + * this info for accessibility purposes. If virtualDescendantId + * is {@link View#NO_ID} the root is set as the label. + *

          + * A virtual descendant is an imaginary View that is reported as a part of the view + * hierarchy for accessibility purposes. This enables custom views that draw complex + * content to report themselves as a tree of virtual views, thus conveying their + * logical structure. + *

          + *

          + * Note: Cannot be called from an + * {@link android.accessibilityservice.AccessibilityService}. + * This class is made immutable before being delivered to an AccessibilityService. + *

          + * + * @param root The root whose virtual descendant labels this node's source. + * @param virtualDescendantId The id of the virtual descendant. + */ + public void setLabeledBy(View root, int virtualDescendantId) { + enforceNotSealed(); + final int rootAccessibilityViewId = (root != null) + ? root.getAccessibilityViewId() : UNDEFINED; + mLabeledById = makeNodeId(rootAccessibilityViewId, virtualDescendantId); + } + + /** + * Gets the node info which serves as the label of the view represented by + * this info for accessibility purposes. + *

          + * Note: It is a client responsibility to recycle the + * received info by calling {@link AccessibilityNodeInfo#recycle()} + * to avoid creating of multiple instances. + *

          + * + * @return The label. + */ + public AccessibilityNodeInfo getLabeledBy() { + enforceSealed(); + if (!canPerformRequestOverConnection(mLabeledById)) { + return null; + } + AccessibilityInteractionClient client = AccessibilityInteractionClient.getInstance(); + return client.findAccessibilityNodeInfoByAccessibilityId(mConnectionId, + mWindowId, mLabeledById, FLAG_PREFETCH_DESCENDANTS | FLAG_PREFETCH_SIBLINGS); + } + /** * Gets the value of a boolean property. * @@ -1343,12 +1450,6 @@ private void enforceValidFocusDirection(int direction) { case View.FOCUS_RIGHT: case View.FOCUS_FORWARD: case View.FOCUS_BACKWARD: - case View.ACCESSIBILITY_FOCUS_DOWN: - case View.ACCESSIBILITY_FOCUS_UP: - case View.ACCESSIBILITY_FOCUS_LEFT: - case View.ACCESSIBILITY_FOCUS_RIGHT: - case View.ACCESSIBILITY_FOCUS_FORWARD: - case View.ACCESSIBILITY_FOCUS_BACKWARD: return; default: throw new IllegalArgumentException("Unknown direction: " + direction); @@ -1477,6 +1578,8 @@ public void writeToParcel(Parcel parcel, int flags) { parcel.writeLong(mSourceNodeId); parcel.writeInt(mWindowId); parcel.writeLong(mParentNodeId); + parcel.writeLong(mLabelForId); + parcel.writeLong(mLabeledById); parcel.writeInt(mConnectionId); SparseLongArray childIds = mChildNodeIds; @@ -1522,6 +1625,8 @@ private void init(AccessibilityNodeInfo other) { mSealed = other.mSealed; mSourceNodeId = other.mSourceNodeId; mParentNodeId = other.mParentNodeId; + mLabelForId = other.mLabelForId; + mLabeledById = other.mLabeledById; mWindowId = other.mWindowId; mConnectionId = other.mConnectionId; mBoundsInParent.set(other.mBoundsInParent); @@ -1549,6 +1654,8 @@ private void initFromParcel(Parcel parcel) { mSourceNodeId = parcel.readLong(); mWindowId = parcel.readInt(); mParentNodeId = parcel.readLong(); + mLabelForId = parcel.readLong(); + mLabeledById = parcel.readLong(); mConnectionId = parcel.readInt(); SparseLongArray childIds = mChildNodeIds; @@ -1587,6 +1694,8 @@ private void clear() { mSealed = false; mSourceNodeId = ROOT_NODE_ID; mParentNodeId = ROOT_NODE_ID; + mLabelForId = ROOT_NODE_ID; + mLabeledById = ROOT_NODE_ID; mWindowId = UNDEFINED; mConnectionId = UNDEFINED; mMovementGranularities = 0; diff --git a/core/java/android/view/accessibility/AccessibilityNodeProvider.java b/core/java/android/view/accessibility/AccessibilityNodeProvider.java index b3f3cee430a7d..688cbdf3c9f7a 100644 --- a/core/java/android/view/accessibility/AccessibilityNodeProvider.java +++ b/core/java/android/view/accessibility/AccessibilityNodeProvider.java @@ -132,60 +132,4 @@ public List findAccessibilityNodeInfosByText(String text, int virtualViewId) { return null; } - - /** - * Finds the accessibility focused {@link AccessibilityNodeInfo}. The search is - * relative to the virtual view, i.e. a descendant of the host View, with the - * given virtualViewId or the host View itself - * virtualViewId equals to {@link View#NO_ID}. - * - * Note: Normally the system is responsible to transparently find - * accessibility focused view starting from a given root but for virtual view - * hierarchies it is a responsibility of this provider's implementor to find - * the accessibility focused virtual view. - * - * @param virtualViewId A client defined virtual view id which defined - * the root of the tree in which to perform the search. - * @return A list of node info. - * - * @see #createAccessibilityNodeInfo(int) - * @see AccessibilityNodeInfo - * - * @hide - */ - public AccessibilityNodeInfo findAccessibilityFocus(int virtualViewId) { - return null; - } - - /** - * Finds {@link AccessibilityNodeInfo} to take accessibility focus in the given - * direction. The search is relative to the virtual view, i.e. a - * descendant of the host View, with the given virtualViewId or - * the host View itself virtualViewId equals to {@link View#NO_ID}. - * - * Note: Normally the system is responsible to transparently find - * the next view to take accessibility focus but for virtual view hierarchies - * it is a responsibility of this provider's implementor to compute the next - * focusable. - * - * @param direction The direction in which to search for a focus candidate. - * Values are - * {@link View#ACCESSIBILITY_FOCUS_FORWARD}, - * {@link View#ACCESSIBILITY_FOCUS_BACKWARD}, - * {@link View#ACCESSIBILITY_FOCUS_UP}, - * {@link View#ACCESSIBILITY_FOCUS_DOWN}, - * {@link View#ACCESSIBILITY_FOCUS_LEFT}, - * {@link View#ACCESSIBILITY_FOCUS_RIGHT}. - * @param virtualViewId A client defined virtual view id which defined - * the root of the tree in which to perform the search. - * @return A list of node info. - * - * @see #createAccessibilityNodeInfo(int) - * @see AccessibilityNodeInfo - * - * @hide - */ - public AccessibilityNodeInfo accessibilityFocusSearch(int direction, int virtualViewId) { - return null; - } } diff --git a/core/java/android/view/accessibility/AccessibilityRecord.java b/core/java/android/view/accessibility/AccessibilityRecord.java index 5c60a1262ff0e..7147c57c8b0d2 100644 --- a/core/java/android/view/accessibility/AccessibilityRecord.java +++ b/core/java/android/view/accessibility/AccessibilityRecord.java @@ -167,6 +167,17 @@ public AccessibilityNodeInfo getSource() { mSourceNodeId, GET_SOURCE_PREFETCH_FLAGS); } + /** + * Sets the window id. + * + * @param windowId The window id. + * + * @hide + */ + public void setWindowId(int windowId) { + mSourceWindowId = windowId; + } + /** * Gets the id of the window from which the event comes from. * diff --git a/core/java/android/view/accessibility/IAccessibilityInteractionConnection.aidl b/core/java/android/view/accessibility/IAccessibilityInteractionConnection.aidl index 292702ac894dd..9b393002d9bf9 100644 --- a/core/java/android/view/accessibility/IAccessibilityInteractionConnection.aidl +++ b/core/java/android/view/accessibility/IAccessibilityInteractionConnection.aidl @@ -28,25 +28,25 @@ import android.view.accessibility.IAccessibilityInteractionConnectionCallback; */ oneway interface IAccessibilityInteractionConnection { - void findAccessibilityNodeInfoByAccessibilityId(long accessibilityNodeId, int windowLeft, - int windowTop, int interactionId, IAccessibilityInteractionConnectionCallback callback, - int flags, int interrogatingPid, long interrogatingTid); + void findAccessibilityNodeInfoByAccessibilityId(long accessibilityNodeId, int interactionId, + IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid, + long interrogatingTid); - void findAccessibilityNodeInfoByViewId(long accessibilityNodeId, int viewId, int windowLeft, - int windowTop, int interactionId, IAccessibilityInteractionConnectionCallback callback, - int flags, int interrogatingPid, long interrogatingTid); + void findAccessibilityNodeInfoByViewId(long accessibilityNodeId, int viewId, int interactionId, + IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid, + long interrogatingTid); - void findAccessibilityNodeInfosByText(long accessibilityNodeId, String text, int windowLeft, - int windowTop, int interactionId, IAccessibilityInteractionConnectionCallback callback, - int flags, int interrogatingPid, long interrogatingTid); + void findAccessibilityNodeInfosByText(long accessibilityNodeId, String text, int interactionId, + IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid, + long interrogatingTid); - void findFocus(long accessibilityNodeId, int focusType, int windowLeft, int windowTop, - int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags, - int interrogatingPid, long interrogatingTid); + void findFocus(long accessibilityNodeId, int focusType, int interactionId, + IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid, + long interrogatingTid); - void focusSearch(long accessibilityNodeId, int direction, int windowLeft, int windowTop, - int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags, - int interrogatingPid, long interrogatingTid); + void focusSearch(long accessibilityNodeId, int direction, int interactionId, + IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid, + long interrogatingTid); void performAccessibilityAction(long accessibilityNodeId, int action, in Bundle arguments, int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags, diff --git a/core/java/android/view/accessibility/IAccessibilityManager.aidl b/core/java/android/view/accessibility/IAccessibilityManager.aidl index 5b5134a89f74e..c3ef54c6409f8 100644 --- a/core/java/android/view/accessibility/IAccessibilityManager.aidl +++ b/core/java/android/view/accessibility/IAccessibilityManager.aidl @@ -20,6 +20,7 @@ package android.view.accessibility; import android.accessibilityservice.AccessibilityServiceInfo; import android.accessibilityservice.IAccessibilityServiceConnection; import android.accessibilityservice.IAccessibilityServiceClient; +import android.content.ComponentName; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityNodeInfo; import android.view.accessibility.IAccessibilityInteractionConnection; @@ -34,18 +35,18 @@ import android.view.IWindow; */ interface IAccessibilityManager { - int addClient(IAccessibilityManagerClient client); + int addClient(IAccessibilityManagerClient client, int userId); - boolean sendAccessibilityEvent(in AccessibilityEvent uiEvent); + boolean sendAccessibilityEvent(in AccessibilityEvent uiEvent, int userId); - List getInstalledAccessibilityServiceList(); + List getInstalledAccessibilityServiceList(int userId); - List getEnabledAccessibilityServiceList(int feedbackType); + List getEnabledAccessibilityServiceList(int feedbackType, int userId); - void interrupt(); + void interrupt(int userId); int addAccessibilityInteractionConnection(IWindow windowToken, - in IAccessibilityInteractionConnection connection); + in IAccessibilityInteractionConnection connection, int userId); void removeAccessibilityInteractionConnection(IWindow windowToken); @@ -53,4 +54,7 @@ interface IAccessibilityManager { in AccessibilityServiceInfo info); void unregisterUiTestAutomationService(IAccessibilityServiceClient client); + + void temporaryEnableAccessibilityStateUntilKeyguardRemoved(in ComponentName service, + boolean touchExplorationEnabled); } diff --git a/core/java/android/view/animation/RotateAnimation.java b/core/java/android/view/animation/RotateAnimation.java index 67e03745ce6db..3c325d9b2aa91 100644 --- a/core/java/android/view/animation/RotateAnimation.java +++ b/core/java/android/view/animation/RotateAnimation.java @@ -22,7 +22,7 @@ /** * An animation that controls the rotation of an object. This rotation takes - * place int the X-Y plane. You can specify the point to use for the center of + * place in the X-Y plane. You can specify the point to use for the center of * the rotation, where (0,0) is the top left point. If not specified, (0,0) is * the default rotation point. * diff --git a/core/java/android/view/inputmethod/InputMethodInfo.java b/core/java/android/view/inputmethod/InputMethodInfo.java index 131f0aecba20f..08e30aa37c404 100644 --- a/core/java/android/view/inputmethod/InputMethodInfo.java +++ b/core/java/android/view/inputmethod/InputMethodInfo.java @@ -34,6 +34,7 @@ import android.os.Parcelable; import android.util.AttributeSet; import android.util.Printer; +import android.util.Slog; import android.util.Xml; import java.io.IOException; @@ -169,7 +170,10 @@ public InputMethodInfo(Context context, ResolveInfo service, a.getBoolean(com.android.internal.R.styleable .InputMethod_Subtype_isAuxiliary, false), a.getBoolean(com.android.internal.R.styleable - .InputMethod_Subtype_overridesImplicitlyEnabledSubtype, false)); + .InputMethod_Subtype_overridesImplicitlyEnabledSubtype, false), + a.getInt(com.android.internal.R.styleable + .InputMethod_Subtype_subtypeId, 0 /* use Arrays.hashCode */) + ); if (!subtype.isAuxiliary()) { mIsAuxIme = false; } @@ -194,6 +198,9 @@ public InputMethodInfo(Context context, ResolveInfo service, final InputMethodSubtype subtype = additionalSubtypes.get(i); if (!mSubtypes.contains(subtype)) { mSubtypes.add(subtype); + } else { + Slog.w(TAG, "Duplicated subtype definition found: " + + subtype.getLocale() + ", " + subtype.getMode()); } } } diff --git a/core/java/android/view/inputmethod/InputMethodManager.java b/core/java/android/view/inputmethod/InputMethodManager.java index d2cc2d86090c2..4a3f846f85b10 100644 --- a/core/java/android/view/inputmethod/InputMethodManager.java +++ b/core/java/android/view/inputmethod/InputMethodManager.java @@ -16,7 +16,7 @@ package android.view.inputmethod; -import com.android.internal.os.HandlerCaller; +import com.android.internal.os.SomeArgs; import com.android.internal.view.IInputConnectionWrapper; import com.android.internal.view.IInputContext; import com.android.internal.view.IInputMethodCallback; @@ -35,6 +35,7 @@ import android.os.RemoteException; import android.os.ResultReceiver; import android.os.ServiceManager; +import android.os.SystemClock; import android.text.style.SuggestionSpan; import android.util.Log; import android.util.PrintWriterPrinter; @@ -225,6 +226,13 @@ public final class InputMethodManager { */ public static final int CONTROL_START_INITIAL = 1<<8; + /** + * Timeout in milliseconds for delivering a key to an IME. + */ + static final long INPUT_METHOD_NOT_RESPONDING_TIMEOUT = 2500; + + private static final int MAX_PENDING_EVENT_POOL_SIZE = 4; + final IInputMethodManager mService; final Looper mMainLooper; @@ -312,12 +320,17 @@ public final class InputMethodManager { */ IInputMethodSession mCurMethod; + PendingEvent mPendingEventPool; + int mPendingEventPoolSize; + PendingEvent mFirstPendingEvent; + // ----------------------------------------------------------- static final int MSG_DUMP = 1; static final int MSG_BIND = 2; static final int MSG_UNBIND = 3; static final int MSG_SET_ACTIVE = 4; + static final int MSG_EVENT_TIMEOUT = 5; class H extends Handler { H(Looper looper) { @@ -328,7 +341,7 @@ class H extends Handler { public void handleMessage(Message msg) { switch (msg.what) { case MSG_DUMP: { - HandlerCaller.SomeArgs args = (HandlerCaller.SomeArgs)msg.obj; + SomeArgs args = (SomeArgs)msg.obj; try { doDump((FileDescriptor)args.arg1, (PrintWriter)args.arg2, (String[])args.arg3); @@ -338,10 +351,14 @@ public void handleMessage(Message msg) { synchronized (args.arg4) { ((CountDownLatch)args.arg4).countDown(); } + args.recycle(); return; } case MSG_BIND: { final InputBindResult res = (InputBindResult)msg.obj; + if (DEBUG) { + Log.i(TAG, "handleMessage: MSG_BIND " + res.sequence + "," + res.id); + } synchronized (mH) { if (mBindSequence < 0 || mBindSequence != res.sequence) { Log.w(TAG, "Ignoring onBind: cur seq=" + mBindSequence @@ -358,6 +375,9 @@ public void handleMessage(Message msg) { } case MSG_UNBIND: { final int sequence = msg.arg1; + if (DEBUG) { + Log.i(TAG, "handleMessage: MSG_UNBIND " + sequence); + } boolean startInput = false; synchronized (mH) { if (mBindSequence == sequence) { @@ -390,6 +410,9 @@ public void handleMessage(Message msg) { } case MSG_SET_ACTIVE: { final boolean active = msg.arg1 != 0; + if (DEBUG) { + Log.i(TAG, "handleMessage: MSG_SET_ACTIVE " + active + ", was " + mActive); + } synchronized (mH) { mActive = active; mFullscreenMode = false; @@ -407,12 +430,32 @@ public void handleMessage(Message msg) { // Check focus again in case that "onWindowFocus" is called before // handling this message. if (mServedView != null && mServedView.hasWindowFocus()) { - checkFocus(mHasBeenInactive); + // "finishComposingText" has been already called above. So we + // should not call mServedInputConnection.finishComposingText here. + // Also, please note that this handler thread could be different + // from a thread that created mServedView. That could happen + // the current activity is running in the system process. + // In that case, we really should not call + // mServedInputConnection.finishComposingText. + if (checkFocusNoStartInput(mHasBeenInactive, false)) { + startInputInner(null, 0, 0, 0); + } } } } return; } + case MSG_EVENT_TIMEOUT: { + // Even though the message contains both the sequence number + // and the PendingEvent object itself, we only pass the + // sequence number to the timeoutEvent function because it's + // possible for the PendingEvent object to be dequeued and + // recycled concurrently. To avoid a possible race, we make + // a point of always looking up the PendingEvent within the + // queue given only the sequence number of the event. + timeoutEvent(msg.arg1); + return; + } } } } @@ -444,7 +487,7 @@ void deactivate() { // interface to the system. CountDownLatch latch = new CountDownLatch(1); - HandlerCaller.SomeArgs sargs = new HandlerCaller.SomeArgs(); + SomeArgs sargs = SomeArgs.obtain(); sargs.arg1 = fd; sargs.arg2 = fout; sargs.arg3 = args; @@ -476,6 +519,18 @@ public void setActive(boolean active) { }; final InputConnection mDummyInputConnection = new BaseInputConnection(this, false); + + final IInputMethodCallback mInputMethodCallback = new IInputMethodCallback.Stub() { + @Override + public void finishedEvent(int seq, boolean handled) { + InputMethodManager.this.finishedEvent(seq, handled); + } + + @Override + public void sessionCreated(IInputMethodSession session) { + // Stub -- not for use in the client. + } + }; InputMethodManager(IInputMethodManager service, Looper looper) { mService = service; @@ -1023,8 +1078,11 @@ boolean startInputInner(IBinder windowGainingFocus, int controlFlags, int softIn Handler vh = view.getHandler(); if (vh == null) { // If the view doesn't have a handler, something has changed out - // from under us, so just bail. - if (DEBUG) Log.v(TAG, "ABORT input: no handler for view!"); + // from under us, so just close the current input. + // If we don't close the current input, the current input method can remain on the + // screen without a connection. + if (DEBUG) Log.v(TAG, "ABORT input: no handler for view! Close current input."); + closeCurrentInput(); return false; } if (vh.getLooper() != Looper.myLooper()) { @@ -1105,6 +1163,7 @@ public void run() { if (res.id != null) { mBindSequence = res.sequence; mCurMethod = res.method; + mCurId = res.id; } else if (mCurMethod == null) { // This means there is no input method available. if (DEBUG) Log.v(TAG, "ABORT input: no input method!"); @@ -1194,20 +1253,16 @@ static void scheduleCheckFocusLocked(View view) { } } - private void checkFocus(boolean forceNewFocus) { - if (checkFocusNoStartInput(forceNewFocus)) { - startInputInner(null, 0, 0, 0); - } - } - /** * @hide */ public void checkFocus() { - checkFocus(false); + if (checkFocusNoStartInput(false, true)) { + startInputInner(null, 0, 0, 0); + } } - private boolean checkFocusNoStartInput(boolean forceNewFocus) { + private boolean checkFocusNoStartInput(boolean forceNewFocus, boolean finishComposingText) { // This is called a lot, so short-circuit before locking. if (mServedView == mNextServedView && !forceNewFocus) { return false; @@ -1241,7 +1296,7 @@ private boolean checkFocusNoStartInput(boolean forceNewFocus) { mServedConnecting = true; } - if (ic != null) { + if (finishComposingText && ic != null) { ic.finishComposingText(); } @@ -1286,7 +1341,7 @@ public void onWindowFocus(View rootView, View focusedView, int softInputMode, controlFlags |= CONTROL_WINDOW_FIRST; } - if (checkFocusNoStartInput(forceNewFocus)) { + if (checkFocusNoStartInput(forceNewFocus, true)) { // We need to restart input on the current focus view. This // should be done in conjunction with telling the system service // about the window gaining focus, to help make the transition @@ -1511,76 +1566,184 @@ public void showSoftInputFromInputMethod(IBinder token, int flags) { * @hide */ public void dispatchKeyEvent(Context context, int seq, KeyEvent key, - IInputMethodCallback callback) { + FinishedEventCallback callback) { + boolean handled = false; synchronized (mH) { if (DEBUG) Log.d(TAG, "dispatchKeyEvent"); - - if (mCurMethod == null) { - try { - callback.finishedEvent(seq, false); - } catch (RemoteException e) { + + if (mCurMethod != null) { + if (key.getAction() == KeyEvent.ACTION_DOWN + && key.getKeyCode() == KeyEvent.KEYCODE_SYM) { + showInputMethodPickerLocked(); + handled = true; + } else { + try { + if (DEBUG) Log.v(TAG, "DISPATCH KEY: " + mCurMethod); + final long startTime = SystemClock.uptimeMillis(); + enqueuePendingEventLocked(startTime, seq, mCurId, callback); + mCurMethod.dispatchKeyEvent(seq, key, mInputMethodCallback); + return; + } catch (RemoteException e) { + Log.w(TAG, "IME died: " + mCurId + " dropping: " + key, e); + } } - return; } - - if (key.getAction() == KeyEvent.ACTION_DOWN - && key.getKeyCode() == KeyEvent.KEYCODE_SYM) { - showInputMethodPicker(); + } + + callback.finishedEvent(seq, handled); + } + + /** + * @hide + */ + public void dispatchTrackballEvent(Context context, int seq, MotionEvent motion, + FinishedEventCallback callback) { + synchronized (mH) { + if (DEBUG) Log.d(TAG, "dispatchTrackballEvent"); + + if (mCurMethod != null && mCurrentTextBoxAttribute != null) { try { - callback.finishedEvent(seq, true); + if (DEBUG) Log.v(TAG, "DISPATCH TRACKBALL: " + mCurMethod); + final long startTime = SystemClock.uptimeMillis(); + enqueuePendingEventLocked(startTime, seq, mCurId, callback); + mCurMethod.dispatchTrackballEvent(seq, motion, mInputMethodCallback); + return; } catch (RemoteException e) { - } - return; - } - try { - if (DEBUG) Log.v(TAG, "DISPATCH KEY: " + mCurMethod); - mCurMethod.dispatchKeyEvent(seq, key, callback); - } catch (RemoteException e) { - Log.w(TAG, "IME died: " + mCurId + " dropping: " + key, e); - try { - callback.finishedEvent(seq, false); - } catch (RemoteException ex) { + Log.w(TAG, "IME died: " + mCurId + " dropping trackball: " + motion, e); } } } + + callback.finishedEvent(seq, false); } /** * @hide */ - void dispatchTrackballEvent(Context context, int seq, MotionEvent motion, - IInputMethodCallback callback) { + public void dispatchGenericMotionEvent(Context context, int seq, MotionEvent motion, + FinishedEventCallback callback) { synchronized (mH) { - if (DEBUG) Log.d(TAG, "dispatchTrackballEvent"); - - if (mCurMethod == null || mCurrentTextBoxAttribute == null) { + if (DEBUG) Log.d(TAG, "dispatchGenericMotionEvent"); + + if (mCurMethod != null && mCurrentTextBoxAttribute != null) { try { - callback.finishedEvent(seq, false); + if (DEBUG) Log.v(TAG, "DISPATCH GENERIC MOTION: " + mCurMethod); + final long startTime = SystemClock.uptimeMillis(); + enqueuePendingEventLocked(startTime, seq, mCurId, callback); + mCurMethod.dispatchGenericMotionEvent(seq, motion, mInputMethodCallback); + return; } catch (RemoteException e) { + Log.w(TAG, "IME died: " + mCurId + " dropping generic motion: " + motion, e); } - return; } - - try { - if (DEBUG) Log.v(TAG, "DISPATCH TRACKBALL: " + mCurMethod); - mCurMethod.dispatchTrackballEvent(seq, motion, callback); - } catch (RemoteException e) { - Log.w(TAG, "IME died: " + mCurId + " dropping trackball: " + motion, e); - try { - callback.finishedEvent(seq, false); - } catch (RemoteException ex) { - } + } + + callback.finishedEvent(seq, false); + } + + void finishedEvent(int seq, boolean handled) { + final FinishedEventCallback callback; + synchronized (mH) { + PendingEvent p = dequeuePendingEventLocked(seq); + if (p == null) { + return; // spurious, event already finished or timed out } + mH.removeMessages(MSG_EVENT_TIMEOUT, p); + callback = p.mCallback; + recyclePendingEventLocked(p); } + callback.finishedEvent(seq, handled); } - public void showInputMethodPicker() { + void timeoutEvent(int seq) { + final FinishedEventCallback callback; synchronized (mH) { - try { - mService.showInputMethodPickerFromClient(mClient); - } catch (RemoteException e) { - Log.w(TAG, "IME died: " + mCurId, e); + PendingEvent p = dequeuePendingEventLocked(seq); + if (p == null) { + return; // spurious, event already finished or timed out } + long delay = SystemClock.uptimeMillis() - p.mStartTime; + Log.w(TAG, "Timeout waiting for IME to handle input event after " + + delay + "ms: " + p.mInputMethodId); + callback = p.mCallback; + recyclePendingEventLocked(p); + } + callback.finishedEvent(seq, false); + } + + private void enqueuePendingEventLocked( + long startTime, int seq, String inputMethodId, FinishedEventCallback callback) { + PendingEvent p = obtainPendingEventLocked(startTime, seq, inputMethodId, callback); + p.mNext = mFirstPendingEvent; + mFirstPendingEvent = p; + + Message msg = mH.obtainMessage(MSG_EVENT_TIMEOUT, seq, 0, p); + msg.setAsynchronous(true); + mH.sendMessageDelayed(msg, INPUT_METHOD_NOT_RESPONDING_TIMEOUT); + } + + private PendingEvent dequeuePendingEventLocked(int seq) { + PendingEvent p = mFirstPendingEvent; + if (p == null) { + return null; + } + if (p.mSeq == seq) { + mFirstPendingEvent = p.mNext; + } else { + PendingEvent prev; + do { + prev = p; + p = p.mNext; + if (p == null) { + return null; + } + } while (p.mSeq != seq); + prev.mNext = p.mNext; + } + p.mNext = null; + return p; + } + + private PendingEvent obtainPendingEventLocked( + long startTime, int seq, String inputMethodId, FinishedEventCallback callback) { + PendingEvent p = mPendingEventPool; + if (p != null) { + mPendingEventPoolSize -= 1; + mPendingEventPool = p.mNext; + p.mNext = null; + } else { + p = new PendingEvent(); + } + + p.mStartTime = startTime; + p.mSeq = seq; + p.mInputMethodId = inputMethodId; + p.mCallback = callback; + return p; + } + + private void recyclePendingEventLocked(PendingEvent p) { + p.mInputMethodId = null; + p.mCallback = null; + + if (mPendingEventPoolSize < MAX_PENDING_EVENT_POOL_SIZE) { + mPendingEventPoolSize += 1; + p.mNext = mPendingEventPool; + mPendingEventPool = p; + } + } + + public void showInputMethodPicker() { + synchronized (mH) { + showInputMethodPickerLocked(); + } + } + + private void showInputMethodPickerLocked() { + try { + mService.showInputMethodPickerFromClient(mClient); + } catch (RemoteException e) { + Log.w(TAG, "IME died: " + mCurId, e); } } @@ -1773,4 +1936,22 @@ void doDump(FileDescriptor fd, PrintWriter fout, String[] args) { + " mCursorCandStart=" + mCursorCandStart + " mCursorCandEnd=" + mCursorCandEnd); } + + /** + * Callback that is invoked when an input event that was dispatched to + * the IME has been finished. + * @hide + */ + public interface FinishedEventCallback { + public void finishedEvent(int seq, boolean handled); + } + + private static final class PendingEvent { + public PendingEvent mNext; + + public long mStartTime; + public int mSeq; + public String mInputMethodId; + public FinishedEventCallback mCallback; + } } diff --git a/core/java/android/view/inputmethod/InputMethodSession.java b/core/java/android/view/inputmethod/InputMethodSession.java index ea6f5ee4a9762..63862999519d9 100644 --- a/core/java/android/view/inputmethod/InputMethodSession.java +++ b/core/java/android/view/inputmethod/InputMethodSession.java @@ -137,6 +137,21 @@ public void updateSelection(int oldSelStart, int oldSelEnd, */ public void dispatchTrackballEvent(int seq, MotionEvent event, EventCallback callback); + /** + * This method is called when there is a generic motion event. + * + *

          + * If the input method wants to handle this event, return true, otherwise + * return false and the caller (i.e. the application) will handle the event. + * + * @param event The motion event. + * + * @return Whether the input method wants to handle this event. + * + * @see android.view.MotionEvent + */ + public void dispatchGenericMotionEvent(int seq, MotionEvent event, EventCallback callback); + /** * Process a private command sent from the application to the input method. * This can be used to provide domain-specific features that are diff --git a/core/java/android/view/inputmethod/InputMethodSubtype.java b/core/java/android/view/inputmethod/InputMethodSubtype.java index b7c94a32d9d6e..7895e6f1a3be2 100644 --- a/core/java/android/view/inputmethod/InputMethodSubtype.java +++ b/core/java/android/view/inputmethod/InputMethodSubtype.java @@ -55,13 +55,14 @@ public final class InputMethodSubtype implements Parcelable { private final int mSubtypeHashCode; private final int mSubtypeIconResId; private final int mSubtypeNameResId; + private final int mSubtypeId; private final String mSubtypeLocale; private final String mSubtypeMode; private final String mSubtypeExtraValue; private volatile HashMap mExtraValueHashMapCache; /** - * Constructor. + * Constructor with no subtype ID specified, overridesImplicitlyEnabledSubtype not specified. * @param nameId Resource ID of the subtype name string. The string resource may have exactly * one %s in it. If there is, the %s part will be replaced with the locale's display name by * the formatter. Please refer to {@link #getDisplayName} for details. @@ -87,7 +88,7 @@ public InputMethodSubtype(int nameId, int iconId, String locale, String mode, St } /** - * Constructor. + * Constructor with no subtype ID specified. * @param nameId Resource ID of the subtype name string. The string resource may have exactly * one %s in it. If there is, the %s part will be replaced with the locale's display name by * the formatter. Please refer to {@link #getDisplayName} for details. @@ -112,6 +113,41 @@ public InputMethodSubtype(int nameId, int iconId, String locale, String mode, St */ public InputMethodSubtype(int nameId, int iconId, String locale, String mode, String extraValue, boolean isAuxiliary, boolean overridesImplicitlyEnabledSubtype) { + this(nameId, iconId, locale, mode, extraValue, isAuxiliary, + overridesImplicitlyEnabledSubtype, 0); + } + + /** + * Constructor. + * @param nameId Resource ID of the subtype name string. The string resource may have exactly + * one %s in it. If there is, the %s part will be replaced with the locale's display name by + * the formatter. Please refer to {@link #getDisplayName} for details. + * @param iconId Resource ID of the subtype icon drawable. + * @param locale The locale supported by the subtype + * @param mode The mode supported by the subtype + * @param extraValue The extra value of the subtype. This string is free-form, but the API + * supplies tools to deal with a key-value comma-separated list; see + * {@link #containsExtraValueKey} and {@link #getExtraValueOf}. + * @param isAuxiliary true when this subtype is auxiliary, false otherwise. An auxiliary + * subtype will not be shown in the list of enabled IMEs for choosing the current IME in + * the Settings even when this subtype is enabled. Please note that this subtype will still + * be shown in the list of IMEs in the IME switcher to allow the user to tentatively switch + * to this subtype while an IME is shown. The framework will never switch the current IME to + * this subtype by {@link android.view.inputmethod.InputMethodManager#switchToLastInputMethod}. + * The intent of having this flag is to allow for IMEs that are invoked in a one-shot way as + * auxiliary input mode, and return to the previous IME once it is finished (e.g. voice input). + * @param overridesImplicitlyEnabledSubtype true when this subtype should be enabled by default + * if no other subtypes in the IME are enabled explicitly. Note that a subtype with this + * parameter being true will not be shown in the list of subtypes in each IME's subtype enabler. + * Having an "automatic" subtype is an example use of this flag. + * @param id The unique ID for the subtype. The input method framework keeps track of enabled + * subtypes by ID. When the IME package gets upgraded, enabled IDs will stay enabled even if + * other attributes are different. If the ID is unspecified or 0, + * Arrays.hashCode(new Object[] {locale, mode, extraValue, + * isAuxiliary, overridesImplicitlyEnabledSubtype}) will be used instead. + */ + public InputMethodSubtype(int nameId, int iconId, String locale, String mode, String extraValue, + boolean isAuxiliary, boolean overridesImplicitlyEnabledSubtype, int id) { mSubtypeNameResId = nameId; mSubtypeIconResId = iconId; mSubtypeLocale = locale != null ? locale : ""; @@ -119,8 +155,11 @@ public InputMethodSubtype(int nameId, int iconId, String locale, String mode, St mSubtypeExtraValue = extraValue != null ? extraValue : ""; mIsAuxiliary = isAuxiliary; mOverridesImplicitlyEnabledSubtype = overridesImplicitlyEnabledSubtype; - mSubtypeHashCode = hashCodeInternal(mSubtypeLocale, mSubtypeMode, mSubtypeExtraValue, - mIsAuxiliary, mOverridesImplicitlyEnabledSubtype); + // If hashCode() of this subtype is 0 and you want to specify it as an id of this subtype, + // just specify 0 as this subtype's id. Then, this subtype's id is treated as 0. + mSubtypeHashCode = id != 0 ? id : hashCodeInternal(mSubtypeLocale, mSubtypeMode, + mSubtypeExtraValue, mIsAuxiliary, mOverridesImplicitlyEnabledSubtype); + mSubtypeId = id; } InputMethodSubtype(Parcel source) { @@ -135,8 +174,8 @@ public InputMethodSubtype(int nameId, int iconId, String locale, String mode, St mSubtypeExtraValue = s != null ? s : ""; mIsAuxiliary = (source.readInt() == 1); mOverridesImplicitlyEnabledSubtype = (source.readInt() == 1); - mSubtypeHashCode = hashCodeInternal(mSubtypeLocale, mSubtypeMode, mSubtypeExtraValue, - mIsAuxiliary, mOverridesImplicitlyEnabledSubtype); + mSubtypeHashCode = source.readInt(); + mSubtypeId = source.readInt(); } /** @@ -288,6 +327,9 @@ public int hashCode() { public boolean equals(Object o) { if (o instanceof InputMethodSubtype) { InputMethodSubtype subtype = (InputMethodSubtype) o; + if (subtype.mSubtypeId != 0 || mSubtypeId != 0) { + return (subtype.hashCode() == hashCode()); + } return (subtype.hashCode() == hashCode()) && (subtype.getNameResId() == getNameResId()) && (subtype.getMode().equals(getMode())) @@ -313,6 +355,8 @@ public void writeToParcel(Parcel dest, int parcelableFlags) { dest.writeString(mSubtypeExtraValue); dest.writeInt(mIsAuxiliary ? 1 : 0); dest.writeInt(mOverridesImplicitlyEnabledSubtype ? 1 : 0); + dest.writeInt(mSubtypeHashCode); + dest.writeInt(mSubtypeId); } public static final Parcelable.Creator CREATOR diff --git a/core/java/android/view/textservice/TextServicesManager.java b/core/java/android/view/textservice/TextServicesManager.java index 81b36db50b297..e0e19b9030379 100644 --- a/core/java/android/view/textservice/TextServicesManager.java +++ b/core/java/android/view/textservice/TextServicesManager.java @@ -217,6 +217,12 @@ public void setCurrentSpellChecker(SpellCheckerInfo sci) { public SpellCheckerSubtype getCurrentSpellCheckerSubtype( boolean allowImplicitlySelectedSubtype) { try { + if (sService == null) { + // TODO: This is a workaround. Needs to investigate why sService could be null + // here. + Log.e(TAG, "sService is null."); + return null; + } // Passing null as a locale until we support multiple enabled spell checker subtypes. return sService.getCurrentSpellCheckerSubtype(null, allowImplicitlySelectedSubtype); } catch (RemoteException e) { diff --git a/core/java/android/webkit/AccessibilityInjector.java b/core/java/android/webkit/AccessibilityInjector.java index 7dfb5bb102e2a..008a615b5bcba 100644 --- a/core/java/android/webkit/AccessibilityInjector.java +++ b/core/java/android/webkit/AccessibilityInjector.java @@ -18,9 +18,14 @@ import android.content.Context; import android.os.Bundle; +import android.os.Handler; import android.os.SystemClock; import android.provider.Settings; import android.speech.tts.TextToSpeech; +import android.speech.tts.TextToSpeech.Engine; +import android.speech.tts.TextToSpeech.OnInitListener; +import android.speech.tts.UtteranceProgressListener; +import android.util.Log; import android.view.KeyEvent; import android.view.View; import android.view.accessibility.AccessibilityManager; @@ -34,6 +39,7 @@ import java.net.URI; import java.net.URISyntaxException; +import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.concurrent.atomic.AtomicInteger; @@ -43,6 +49,10 @@ * APIs. */ class AccessibilityInjector { + private static final String TAG = AccessibilityInjector.class.getSimpleName(); + + private static boolean DEBUG = false; + // The WebViewClassic this injector is responsible for managing. private final WebViewClassic mWebViewClassic; @@ -53,7 +63,7 @@ class AccessibilityInjector { private final WebView mWebView; // The Java objects that are exposed to JavaScript. - private TextToSpeech mTextToSpeech; + private TextToSpeechWrapper mTextToSpeech; private CallbackHandler mCallback; // Lazily loaded helper objects. @@ -87,7 +97,32 @@ class AccessibilityInjector { // Template for JavaScript that performs AndroidVox actions. private static final String ACCESSIBILITY_ANDROIDVOX_TEMPLATE = - "cvox.AndroidVox.performAction('%1s')"; + "(function() {" + + " if ((typeof(cvox) != 'undefined')" + + " && (cvox != null)" + + " && (typeof(cvox.ChromeVox) != 'undefined')" + + " && (cvox.ChromeVox != null)" + + " && (typeof(cvox.AndroidVox) != 'undefined')" + + " && (cvox.AndroidVox != null)" + + " && cvox.ChromeVox.isActive) {" + + " return cvox.AndroidVox.performAction('%1s');" + + " } else {" + + " return false;" + + " }" + + "})()"; + + // JS code used to shut down an active AndroidVox instance. + private static final String TOGGLE_CVOX_TEMPLATE = + "javascript:(function() {" + + " if ((typeof(cvox) != 'undefined')" + + " && (cvox != null)" + + " && (typeof(cvox.ChromeVox) != 'undefined')" + + " && (cvox.ChromeVox != null)" + + " && (typeof(cvox.ChromeVox.host) != 'undefined')" + + " && (cvox.ChromeVox.host != null)) {" + + " cvox.ChromeVox.host.activateOrDeactivateChromeVox(%b);" + + " }" + + "})();"; /** * Creates an instance of the AccessibilityInjector based on @@ -103,11 +138,27 @@ public AccessibilityInjector(WebViewClassic webViewClassic) { mAccessibilityManager = AccessibilityManager.getInstance(mContext); } + /** + * If JavaScript is enabled, pauses or resumes AndroidVox. + * + * @param enabled Whether feedback should be enabled. + */ + public void toggleAccessibilityFeedback(boolean enabled) { + if (!isAccessibilityEnabled() || !isJavaScriptEnabled()) { + return; + } + + toggleAndroidVox(enabled); + + if (!enabled && (mTextToSpeech != null)) { + mTextToSpeech.stop(); + } + } + /** * Attempts to load scripting interfaces for accessibility. *

          - * This should be called when the window is attached. - *

          + * This should only be called before a page loads. */ public void addAccessibilityApisIfNecessary() { if (!isAccessibilityEnabled() || !isJavaScriptEnabled()) { @@ -121,14 +172,36 @@ public void addAccessibilityApisIfNecessary() { /** * Attempts to unload scripting interfaces for accessibility. *

          - * This should be called when the window is detached. - *

          + * This should only be called before a page loads. */ - public void removeAccessibilityApisIfNecessary() { + private void removeAccessibilityApisIfNecessary() { removeTtsApis(); removeCallbackApis(); } + /** + * Destroys this accessibility injector. + */ + public void destroy() { + if (mTextToSpeech != null) { + mTextToSpeech.shutdown(); + mTextToSpeech = null; + } + + if (mCallback != null) { + mCallback = null; + } + } + + private void toggleAndroidVox(boolean state) { + if (!mAccessibilityScriptInjected) { + return; + } + + final String code = String.format(TOGGLE_CVOX_TEMPLATE, state); + mWebView.loadUrl(code); + } + /** * Initializes an {@link AccessibilityNodeInfo} with the actions and * movement granularity levels supported by this @@ -195,7 +268,7 @@ public boolean performAccessibilityAction(int action, Bundle arguments) { if (mAccessibilityScriptInjected) { return sendActionToAndroidVox(action, arguments); } - + if (mAccessibilityInjectorFallback != null) { return mAccessibilityInjectorFallback.performAccessibilityAction(action, arguments); } @@ -261,6 +334,10 @@ public void handleSelectionChangedIfNecessary(String selectionString) { */ public void onPageStarted(String url) { mAccessibilityScriptInjected = false; + if (DEBUG) { + Log.w(TAG, "[" + mWebView.hashCode() + "] Started loading new page"); + } + addAccessibilityApisIfNecessary(); } /** @@ -273,22 +350,75 @@ public void onPageStarted(String url) { */ public void onPageFinished(String url) { if (!isAccessibilityEnabled()) { - mAccessibilityScriptInjected = false; toggleFallbackAccessibilityInjector(false); return; } - if (!shouldInjectJavaScript(url)) { - toggleFallbackAccessibilityInjector(true); - return; + toggleFallbackAccessibilityInjector(true); + + if (shouldInjectJavaScript(url)) { + // If we're supposed to use the JS screen reader, request a + // callback to confirm that CallbackHandler is working. + if (DEBUG) { + Log.d(TAG, "[" + mWebView.hashCode() + "] Request callback "); + } + + mCallback.requestCallback(mWebView, mInjectScriptRunnable); + } + } + + /** + * Runnable used to inject the JavaScript-based screen reader if the + * {@link CallbackHandler} API was successfully exposed to JavaScript. + */ + private Runnable mInjectScriptRunnable = new Runnable() { + @Override + public void run() { + if (DEBUG) { + Log.d(TAG, "[" + mWebView.hashCode() + "] Received callback"); + } + + injectJavaScript(); } + }; + /** + * Called by {@link #mInjectScriptRunnable} to inject the JavaScript-based + * screen reader after confirming that the {@link CallbackHandler} API is + * functional. + */ + private void injectJavaScript() { toggleFallbackAccessibilityInjector(false); - final String injectionUrl = getScreenReaderInjectionUrl(); - mWebView.loadUrl(injectionUrl); + if (!mAccessibilityScriptInjected) { + mAccessibilityScriptInjected = true; + final String injectionUrl = getScreenReaderInjectionUrl(); + mWebView.loadUrl(injectionUrl); + if (DEBUG) { + Log.d(TAG, "[" + mWebView.hashCode() + "] Loading screen reader into WebView"); + } + } else { + if (DEBUG) { + Log.w(TAG, "[" + mWebView.hashCode() + "] Attempted to inject screen reader twice"); + } + } + } + + /** + * Adjusts the accessibility injection state to reflect changes in the + * JavaScript enabled state. + * + * @param enabled Whether JavaScript is enabled. + */ + public void updateJavaScriptEnabled(boolean enabled) { + if (enabled) { + addAccessibilityApisIfNecessary(); + } else { + removeAccessibilityApisIfNecessary(); + } - mAccessibilityScriptInjected = true; + // We have to reload the page after adding or removing APIs. + mWebView.reload(); } /** @@ -346,13 +476,10 @@ private boolean isScriptInjectionEnabled() { * been done. */ private void addTtsApis() { - if (mTextToSpeech != null) { - return; + if (mTextToSpeech == null) { + mTextToSpeech = new TextToSpeechWrapper(mContext); } - final String pkgName = mContext.getPackageName(); - - mTextToSpeech = new TextToSpeech(mContext, null, null, pkgName + ".**webview**", true); mWebView.addJavascriptInterface(mTextToSpeech, ALIAS_TTS_JS_INTERFACE); } @@ -361,32 +488,29 @@ private void addTtsApis() { * already been done. */ private void removeTtsApis() { - if (mTextToSpeech == null) { - return; + if (mTextToSpeech != null) { + mTextToSpeech.stop(); + mTextToSpeech.shutdown(); + mTextToSpeech = null; } mWebView.removeJavascriptInterface(ALIAS_TTS_JS_INTERFACE); - mTextToSpeech.stop(); - mTextToSpeech.shutdown(); - mTextToSpeech = null; } private void addCallbackApis() { - if (mCallback != null) { - return; + if (mCallback == null) { + mCallback = new CallbackHandler(ALIAS_TRAVERSAL_JS_INTERFACE); } - mCallback = new CallbackHandler(ALIAS_TRAVERSAL_JS_INTERFACE); mWebView.addJavascriptInterface(mCallback, ALIAS_TRAVERSAL_JS_INTERFACE); } private void removeCallbackApis() { - if (mCallback == null) { - return; + if (mCallback != null) { + mCallback = null; } mWebView.removeJavascriptInterface(ALIAS_TRAVERSAL_JS_INTERFACE); - mCallback = null; } /** @@ -412,6 +536,8 @@ private int getAxsUrlParameterValue(String url) { } } catch (URISyntaxException e) { // Do nothing. + } catch (IllegalArgumentException e) { + // Catch badly-formed URLs. } return ACCESSIBILITY_SCRIPT_INJECTION_UNDEFINED; @@ -448,7 +574,12 @@ private String getScreenReaderInjectionUrl() { * settings. */ private boolean isJavaScriptEnabled() { - return mWebView.getSettings().getJavaScriptEnabled(); + final WebSettings settings = mWebView.getSettings(); + if (settings == null) { + return false; + } + + return settings.getJavaScriptEnabled(); } /** @@ -507,6 +638,157 @@ private boolean sendActionToAndroidVox(int action, Bundle arguments) { return mCallback.performAction(mWebView, jsCode); } + /** + * Used to protect the TextToSpeech class, only exposing the methods we want to expose. + */ + private static class TextToSpeechWrapper { + private static final String WRAP_TAG = TextToSpeechWrapper.class.getSimpleName(); + + private final HashMap mTtsParams; + private final TextToSpeech mTextToSpeech; + + /** + * Whether this wrapper is ready to speak. If this is {@code true} then + * {@link #mShutdown} is guaranteed to be {@code false}. + */ + private volatile boolean mReady; + + /** + * Whether this wrapper was shut down. If this is {@code true} then + * {@link #mReady} is guaranteed to be {@code false}. + */ + private volatile boolean mShutdown; + + public TextToSpeechWrapper(Context context) { + if (DEBUG) { + Log.d(WRAP_TAG, "[" + hashCode() + "] Initializing text-to-speech on thread " + + Thread.currentThread().getId() + "..."); + } + + final String pkgName = context.getPackageName(); + + mReady = false; + mShutdown = false; + + mTtsParams = new HashMap(); + mTtsParams.put(Engine.KEY_PARAM_UTTERANCE_ID, WRAP_TAG); + + mTextToSpeech = new TextToSpeech( + context, mInitListener, null, pkgName + ".**webview**", true); + mTextToSpeech.setOnUtteranceProgressListener(mErrorListener); + } + + @JavascriptInterface + @SuppressWarnings("unused") + public boolean isSpeaking() { + synchronized (mTextToSpeech) { + if (!mReady) { + return false; + } + + return mTextToSpeech.isSpeaking(); + } + } + + @JavascriptInterface + @SuppressWarnings("unused") + public int speak(String text, int queueMode, HashMap params) { + synchronized (mTextToSpeech) { + if (!mReady) { + if (DEBUG) { + Log.w(WRAP_TAG, "[" + hashCode() + "] Attempted to speak before TTS init"); + } + return TextToSpeech.ERROR; + } else { + if (DEBUG) { + Log.i(WRAP_TAG, "[" + hashCode() + "] Speak called from JS binder"); + } + } + + return mTextToSpeech.speak(text, queueMode, params); + } + } + + @JavascriptInterface + @SuppressWarnings("unused") + public int stop() { + synchronized (mTextToSpeech) { + if (!mReady) { + if (DEBUG) { + Log.w(WRAP_TAG, "[" + hashCode() + "] Attempted to stop before initialize"); + } + return TextToSpeech.ERROR; + } else { + if (DEBUG) { + Log.i(WRAP_TAG, "[" + hashCode() + "] Stop called from JS binder"); + } + } + + return mTextToSpeech.stop(); + } + } + + @SuppressWarnings("unused") + protected void shutdown() { + synchronized (mTextToSpeech) { + if (!mReady) { + if (DEBUG) { + Log.w(WRAP_TAG, "[" + hashCode() + "] Called shutdown before initialize"); + } + } else { + if (DEBUG) { + Log.i(WRAP_TAG, "[" + hashCode() + "] Shutting down text-to-speech from " + + "thread " + Thread.currentThread().getId() + "..."); + } + } + mShutdown = true; + mReady = false; + mTextToSpeech.shutdown(); + } + } + + private final OnInitListener mInitListener = new OnInitListener() { + @Override + public void onInit(int status) { + synchronized (mTextToSpeech) { + if (!mShutdown && (status == TextToSpeech.SUCCESS)) { + if (DEBUG) { + Log.d(WRAP_TAG, "[" + TextToSpeechWrapper.this.hashCode() + + "] Initialized successfully"); + } + mReady = true; + } else { + if (DEBUG) { + Log.w(WRAP_TAG, "[" + TextToSpeechWrapper.this.hashCode() + + "] Failed to initialize"); + } + mReady = false; + } + } + } + }; + + private final UtteranceProgressListener mErrorListener = new UtteranceProgressListener() { + @Override + public void onStart(String utteranceId) { + // Do nothing. + } + + @Override + public void onError(String utteranceId) { + if (DEBUG) { + Log.w(WRAP_TAG, "[" + TextToSpeechWrapper.this.hashCode() + + "] Failed to speak utterance"); + } + } + + @Override + public void onDone(String utteranceId) { + // Do nothing. + } + }; + } + /** * Exposes result interface to JavaScript. */ @@ -520,12 +802,16 @@ private static class CallbackHandler { private final AtomicInteger mResultIdCounter = new AtomicInteger(); private final Object mResultLock = new Object(); private final String mInterfaceName; + private final Handler mMainHandler; + + private Runnable mCallbackRunnable; private boolean mResult = false; - private long mResultId = -1; + private int mResultId = -1; private CallbackHandler(String interfaceName) { mInterfaceName = interfaceName; + mMainHandler = new Handler(); } /** @@ -574,24 +860,53 @@ private void clearResultLocked() { * @return Whether the result was received. */ private boolean waitForResultTimedLocked(int resultId) { - long waitTimeMillis = RESULT_TIMEOUT; final long startTimeMillis = SystemClock.uptimeMillis(); + + if (DEBUG) { + Log.d(TAG, "Waiting for CVOX result with ID " + resultId + "..."); + } + while (true) { - try { - if (mResultId == resultId) { - return true; + // Fail if we received a callback from the future. + if (mResultId > resultId) { + if (DEBUG) { + Log.w(TAG, "Aborted CVOX result"); + } + return false; + } + + final long elapsedTimeMillis = (SystemClock.uptimeMillis() - startTimeMillis); + + // Succeed if we received the callback we were expecting. + if (DEBUG) { + Log.w(TAG, "Check " + mResultId + " versus expected " + resultId); + } + if (mResultId == resultId) { + if (DEBUG) { + Log.w(TAG, "Received CVOX result after " + elapsedTimeMillis + " ms"); } - if (mResultId > resultId) { - return false; + return true; + } + + final long waitTimeMillis = (RESULT_TIMEOUT - elapsedTimeMillis); + + // Fail if we've already exceeded the timeout. + if (waitTimeMillis <= 0) { + if (DEBUG) { + Log.w(TAG, "Timed out while waiting for CVOX result"); } - final long elapsedTimeMillis = SystemClock.uptimeMillis() - startTimeMillis; - waitTimeMillis = RESULT_TIMEOUT - elapsedTimeMillis; - if (waitTimeMillis <= 0) { - return false; + return false; + } + + try { + if (DEBUG) { + Log.w(TAG, "Start waiting..."); } mResultLock.wait(waitTimeMillis); } catch (InterruptedException ie) { - /* ignore */ + if (DEBUG) { + Log.w(TAG, "Interrupted while waiting for CVOX result"); + } } } } @@ -603,12 +918,16 @@ private boolean waitForResultTimedLocked(int resultId) { * @param id The result id of the request as a {@link String}. * @param result The result of the request as a {@link String}. */ + @JavascriptInterface @SuppressWarnings("unused") public void onResult(String id, String result) { - final long resultId; + if (DEBUG) { + Log.w(TAG, "Saw CVOX result of '" + result + "' for ID " + id); + } + final int resultId; try { - resultId = Long.parseLong(id); + resultId = Integer.parseInt(id); } catch (NumberFormatException e) { return; } @@ -617,9 +936,35 @@ public void onResult(String id, String result) { if (resultId > mResultId) { mResult = Boolean.parseBoolean(result); mResultId = resultId; + } else { + if (DEBUG) { + Log.w(TAG, "Result with ID " + resultId + " was stale vesus " + mResultId); + } } mResultLock.notifyAll(); } } + + /** + * Requests a callback to ensure that the JavaScript interface for this + * object has been added successfully. + * + * @param webView The web view to request a callback from. + * @param callbackRunnable Runnable to execute if a callback is received. + */ + public void requestCallback(WebView webView, Runnable callbackRunnable) { + mCallbackRunnable = callbackRunnable; + + webView.loadUrl("javascript:(function() { " + mInterfaceName + ".callback(); })();"); + } + + @JavascriptInterface + @SuppressWarnings("unused") + public void callback() { + if (mCallbackRunnable != null) { + mMainHandler.post(mCallbackRunnable); + mCallbackRunnable = null; + } + } } } diff --git a/core/java/android/webkit/BrowserDownloadListener.java b/core/java/android/webkit/BrowserDownloadListener.java new file mode 100644 index 0000000000000..724cc62895b4e --- /dev/null +++ b/core/java/android/webkit/BrowserDownloadListener.java @@ -0,0 +1,57 @@ +/* + * 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.webkit; + +/** + * An abstract download listener that allows passing extra information as + * part of onDownloadStart callback. + * @hide + */ +public abstract class BrowserDownloadListener implements DownloadListener { + + /** + * Notify the host application that a file should be downloaded + * @param url The full url to the content that should be downloaded + * @param userAgent the user agent to be used for the download. + * @param contentDisposition Content-disposition http header, if + * present. + * @param mimetype The mimetype of the content reported by the server + * @param referer The referer associated with this url + * @param contentLength The file size reported by the server + */ + public abstract void onDownloadStart(String url, String userAgent, + String contentDisposition, String mimetype, String referer, + long contentLength); + + + /** + * Notify the host application that a file should be downloaded + * @param url The full url to the content that should be downloaded + * @param userAgent the user agent to be used for the download. + * @param contentDisposition Content-disposition http header, if + * present. + * @param mimetype The mimetype of the content reported by the server + * @param contentLength The file size reported by the server + */ + @Override + public void onDownloadStart(String url, String userAgent, + String contentDisposition, String mimetype, long contentLength) { + + onDownloadStart(url, userAgent, contentDisposition, mimetype, null, + contentLength); + } +} diff --git a/core/java/android/webkit/BrowserFrame.java b/core/java/android/webkit/BrowserFrame.java index 5108990935589..4dbca23c92774 100644 --- a/core/java/android/webkit/BrowserFrame.java +++ b/core/java/android/webkit/BrowserFrame.java @@ -74,6 +74,7 @@ class BrowserFrame extends Handler { private final CallbackProxy mCallbackProxy; private final WebSettingsClassic mSettings; private final Context mContext; + private final WebViewDatabaseClassic mDatabase; private final WebViewCore mWebViewCore; /* package */ boolean mLoadInitFromJava; private int mLoadType; @@ -88,16 +89,24 @@ class BrowserFrame extends Handler { // Is this frame the main frame? private boolean mIsMainFrame; + // Javascript interface object + private class JSObject { + Object object; + boolean requireAnnotation; + + public JSObject(Object object, boolean requireAnnotation) { + this.object = object; + this.requireAnnotation = requireAnnotation; + } + } + // Attached Javascript interfaces - private Map mJavaScriptObjects; + private Map mJavaScriptObjects; private Set mRemovedJavaScriptObjects; // Key store handler when Chromium HTTP stack is used. private KeyStoreHandler mKeyStoreHandler = null; - // Implementation of the searchbox API. - private final SearchBoxImpl mSearchBox; - // message ids // a message posted when a frame loading is completed static final int FRAME_COMPLETED = 1001; @@ -233,20 +242,16 @@ public BrowserFrame(Context context, WebViewCore w, CallbackProxy proxy, } sConfigCallback.addHandler(this); - mJavaScriptObjects = javascriptInterfaces; - if (mJavaScriptObjects == null) { - mJavaScriptObjects = new HashMap(); - } + mJavaScriptObjects = new HashMap(); + addJavaScriptObjects(javascriptInterfaces); mRemovedJavaScriptObjects = new HashSet(); mSettings = settings; mContext = context; mCallbackProxy = proxy; + mDatabase = WebViewDatabaseClassic.getInstance(appContext); mWebViewCore = w; - mSearchBox = new SearchBoxImpl(mWebViewCore, mCallbackProxy); - mJavaScriptObjects.put(SearchBoxImpl.JS_INTERFACE_NAME, mSearchBox); - AssetManager am = context.getAssets(); nativeCreateFrame(w, am, proxy.getBackForwardList()); @@ -424,8 +429,7 @@ private void saveFormData(HashMap data) { if (h != null) { String url = WebTextView.urlForAutoCompleteData(h.getUrl()); if (url != null) { - WebViewDatabaseClassic.getInstance(mContext).setFormData( - url, data); + mDatabase.setFormData(url, data); } } } @@ -497,9 +501,8 @@ public void handleMessage(Message msg) { if (item != null) { WebAddress uri = new WebAddress(item.getUrl()); String schemePlusHost = uri.getScheme() + uri.getHost(); - String[] up = - WebViewDatabaseClassic.getInstance(mContext) - .getUsernamePassword(schemePlusHost); + String[] up = mDatabase.getUsernamePassword( + schemePlusHost); if (up != null && up[0] != null) { setUsernamePassword(up[0], up[1]); } @@ -591,15 +594,34 @@ private void windowObjectCleared(int nativeFramePointer) { Iterator iter = mJavaScriptObjects.keySet().iterator(); while (iter.hasNext()) { String interfaceName = iter.next(); - Object object = mJavaScriptObjects.get(interfaceName); - if (object != null) { + JSObject jsobject = mJavaScriptObjects.get(interfaceName); + if (jsobject != null && jsobject.object != null) { nativeAddJavascriptInterface(nativeFramePointer, - mJavaScriptObjects.get(interfaceName), interfaceName); + jsobject.object, interfaceName, jsobject.requireAnnotation); } } mRemovedJavaScriptObjects.clear(); + } - stringByEvaluatingJavaScriptFromString(SearchBoxImpl.JS_BRIDGE); + /* + * Add javascript objects to the internal list of objects. The default behavior + * is to allow access to inherited methods (no annotation needed). This is only + * used when js objects are passed through a constructor (via a hidden constructor). + * + * @TODO change the default behavior to be compatible with the public addjavascriptinterface + */ + private void addJavaScriptObjects(Map javascriptInterfaces) { + + // TODO in a separate CL provide logic to enable annotations for API level JB_MR1 and above. + if (javascriptInterfaces == null) return; + Iterator iter = javascriptInterfaces.keySet().iterator(); + while (iter.hasNext()) { + String interfaceName = iter.next(); + Object object = javascriptInterfaces.get(interfaceName); + if (object != null) { + mJavaScriptObjects.put(interfaceName, new JSObject(object, false)); + } + } } /** @@ -619,11 +641,11 @@ public boolean handleUrl(String url) { } } - public void addJavascriptInterface(Object obj, String interfaceName) { + public void addJavascriptInterface(Object obj, String interfaceName, + boolean requireAnnotation) { assert obj != null; removeJavascriptInterface(interfaceName); - - mJavaScriptObjects.put(interfaceName, obj); + mJavaScriptObjects.put(interfaceName, new JSObject(obj, requireAnnotation)); } public void removeJavascriptInterface(String interfaceName) { @@ -800,10 +822,10 @@ private void maybeSavePassword( // the post data (there could be another form on the // page and that was posted instead. String postString = new String(postData); - WebViewDatabaseClassic db = WebViewDatabaseClassic.getInstance(mContext); if (postString.contains(URLEncoder.encode(username)) && postString.contains(URLEncoder.encode(password))) { - String[] saved = db.getUsernamePassword(schemePlusHost); + String[] saved = mDatabase.getUsernamePassword( + schemePlusHost); if (saved != null) { // null username implies that user has chosen not to // save password @@ -811,8 +833,7 @@ private void maybeSavePassword( // non-null username implies that user has // chosen to save password, so update the // recorded password - db.setUsernamePassword(schemePlusHost, username, - password); + mDatabase.setUsernamePassword(schemePlusHost, username, password); } } else { // CallbackProxy will handle creating the resume @@ -1004,7 +1025,7 @@ private String getRawResFilename(int id) { } private float density() { - return mContext.getResources().getDisplayMetrics().density; + return WebViewCore.getFixedDisplayDensity(mContext); } /** @@ -1138,7 +1159,7 @@ private void requestClientCert(int handle, String hostAndPort) { * DownloadListener. */ private void downloadStart(String url, String userAgent, - String contentDisposition, String mimeType, long contentLength) { + String contentDisposition, String mimeType, String referer, long contentLength) { // This will only work if the url ends with the filename if (mimeType.isEmpty()) { try { @@ -1158,7 +1179,7 @@ private void downloadStart(String url, String userAgent, mKeyStoreHandler = new KeyStoreHandler(mimeType); } else { mCallbackProxy.onDownloadStart(url, userAgent, - contentDisposition, mimeType, contentLength); + contentDisposition, mimeType, referer, contentLength); } } @@ -1191,10 +1212,6 @@ private void setCertificate(byte cert_der[]) { } } - /*package*/ SearchBox getSearchBox() { - return mSearchBox; - } - /** * Called by JNI when processing the X-Auto-Login header. */ @@ -1249,7 +1266,7 @@ private native void nativeCallPolicyFunction(int policyFunction, * Add a javascript interface to the main frame. */ private native void nativeAddJavascriptInterface(int nativeFramePointer, - Object obj, String interfaceName); + Object obj, String interfaceName, boolean requireAnnotation); public native void clearCache(); diff --git a/core/java/android/webkit/CacheManager.java b/core/java/android/webkit/CacheManager.java index f0e6ff03a9196..52f41e64bc964 100644 --- a/core/java/android/webkit/CacheManager.java +++ b/core/java/android/webkit/CacheManager.java @@ -32,6 +32,7 @@ /** * Manages the HTTP cache used by an application's {@link WebView} instances. * @deprecated Access to the HTTP cache will be removed in a future release. + * @hide Since {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} */ // The class CacheManager provides the persistent cache of content that is // received over the network. The component handles parsing of HTTP headers and diff --git a/core/java/android/webkit/CallbackProxy.java b/core/java/android/webkit/CallbackProxy.java index 2d9f60dbc89fd..a326da2ef8970 100644 --- a/core/java/android/webkit/CallbackProxy.java +++ b/core/java/android/webkit/CallbackProxy.java @@ -71,7 +71,7 @@ class CallbackProxy extends Handler { // Start with 100 to indicate it is not in load for the empty page. private volatile int mLatestProgress = 100; // Back/Forward list - private final WebBackForwardList mBackForwardList; + private final WebBackForwardListClassic mBackForwardList; // Back/Forward list client private volatile WebBackForwardListClient mWebBackForwardListClient; // Used to call startActivity during url override. @@ -117,12 +117,8 @@ class CallbackProxy extends Handler { private static final int ADD_HISTORY_ITEM = 135; private static final int HISTORY_INDEX_CHANGED = 136; private static final int AUTH_CREDENTIALS = 137; - private static final int SET_INSTALLABLE_WEBAPP = 138; - private static final int NOTIFY_SEARCHBOX_LISTENERS = 139; private static final int AUTO_LOGIN = 140; private static final int CLIENT_CERT_REQUEST = 141; - private static final int SEARCHBOX_IS_SUPPORTED_CALLBACK = 142; - private static final int SEARCHBOX_DISPATCH_COMPLETE_CALLBACK = 143; private static final int PROCEEDED_AFTER_SSL_ERROR = 144; // Message triggered by the client to resume execution @@ -188,7 +184,7 @@ public CallbackProxy(Context context, WebViewClassic w) { // Used to start a default activity. mContext = context; mWebView = w; - mBackForwardList = new WebBackForwardList(this); + mBackForwardList = new WebBackForwardListClassic(this); } protected synchronized void blockMessages() { @@ -249,7 +245,7 @@ public void setDownloadListener(DownloadListener client) { * Get the Back/Forward list to return to the user or to update the cached * history list. */ - public WebBackForwardList getBackForwardList() { + public WebBackForwardListClassic getBackForwardList() { return mBackForwardList; } @@ -403,17 +399,18 @@ public void handleMessage(Message msg) { break; case PROCEEDED_AFTER_SSL_ERROR: - if (mWebViewClient != null) { - mWebViewClient.onProceededAfterSslError(mWebView.getWebView(), + if (mWebViewClient != null && mWebViewClient instanceof WebViewClientClassicExt) { + ((WebViewClientClassicExt) mWebViewClient).onProceededAfterSslError( + mWebView.getWebView(), (SslError) msg.obj); } break; case CLIENT_CERT_REQUEST: - if (mWebViewClient != null) { - HashMap map = - (HashMap) msg.obj; - mWebViewClient.onReceivedClientCertRequest(mWebView.getWebView(), + if (mWebViewClient != null && mWebViewClient instanceof WebViewClientClassicExt) { + HashMap map = (HashMap) msg.obj; + ((WebViewClientClassicExt) mWebViewClient).onReceivedClientCertRequest( + mWebView.getWebView(), (ClientCertRequestHandler) map.get("handler"), (String) map.get("host_and_port")); } @@ -452,10 +449,16 @@ public void handleMessage(Message msg) { String contentDisposition = msg.getData().getString("contentDisposition"); String mimetype = msg.getData().getString("mimetype"); + String referer = msg.getData().getString("referer"); Long contentLength = msg.getData().getLong("contentLength"); - mDownloadListener.onDownloadStart(url, userAgent, - contentDisposition, mimetype, contentLength); + if (mDownloadListener instanceof BrowserDownloadListener) { + ((BrowserDownloadListener) mDownloadListener).onDownloadStart(url, + userAgent, contentDisposition, mimetype, referer, contentLength); + } else { + mDownloadListener.onDownloadStart(url, userAgent, + contentDisposition, mimetype, contentLength); + } } break; @@ -736,6 +739,14 @@ public void onClick( res.cancel(); } }) + .setOnCancelListener( + new DialogInterface.OnCancelListener() { + @Override + public void onCancel( + DialogInterface dialog) { + res.cancel(); + } + }) .show(); } receiver.setReady(); @@ -857,19 +868,6 @@ public void onClick( host, realm, username, password); break; } - case SET_INSTALLABLE_WEBAPP: - if (mWebChromeClient != null) { - mWebChromeClient.setInstallableWebApp(); - } - break; - case NOTIFY_SEARCHBOX_LISTENERS: { - SearchBoxImpl searchBox = (SearchBoxImpl) mWebView.getSearchBox(); - - @SuppressWarnings("unchecked") - List suggestions = (List) msg.obj; - searchBox.handleSuggestions(msg.getData().getString("query"), suggestions); - break; - } case AUTO_LOGIN: { if (mWebViewClient != null) { String realm = msg.getData().getString("realm"); @@ -880,19 +878,6 @@ public void onClick( } break; } - case SEARCHBOX_IS_SUPPORTED_CALLBACK: { - SearchBoxImpl searchBox = (SearchBoxImpl) mWebView.getSearchBox(); - Boolean supported = (Boolean) msg.obj; - searchBox.handleIsSupportedCallback(supported); - break; - } - case SEARCHBOX_DISPATCH_COMPLETE_CALLBACK: { - SearchBoxImpl searchBox = (SearchBoxImpl) mWebView.getSearchBox(); - Boolean success = (Boolean) msg.obj; - searchBox.handleDispatchCompleteCallback(msg.getData().getString("function"), - msg.getData().getInt("id"), success); - break; - } } } @@ -1081,7 +1066,7 @@ public void onReceivedSslError(SslErrorHandler handler, SslError error) { } public void onProceededAfterSslError(SslError error) { - if (mWebViewClient == null) { + if (mWebViewClient == null || !(mWebViewClient instanceof WebViewClientClassicExt)) { return; } Message msg = obtainMessage(PROCEEDED_AFTER_SSL_ERROR); @@ -1092,7 +1077,7 @@ public void onProceededAfterSslError(SslError error) { public void onReceivedClientCertRequest(ClientCertRequestHandler handler, String host_and_port) { // Do an unsynchronized quick check to avoid posting if no callback has // been set. - if (mWebViewClient == null) { + if (mWebViewClient == null || !(mWebViewClient instanceof WebViewClientClassicExt)) { handler.cancel(); return; } @@ -1176,7 +1161,8 @@ void onReceivedLoginRequest(String realm, String account, String args) { * return false. */ public boolean onDownloadStart(String url, String userAgent, - String contentDisposition, String mimetype, long contentLength) { + String contentDisposition, String mimetype, String referer, + long contentLength) { // Do an unsynchronized quick check to avoid posting if no callback has // been set. if (mDownloadListener == null) { @@ -1189,6 +1175,7 @@ public boolean onDownloadStart(String url, String userAgent, bundle.putString("url", url); bundle.putString("userAgent", userAgent); bundle.putString("mimetype", mimetype); + bundle.putString("referer", referer); bundle.putLong("contentLength", contentLength); bundle.putString("contentDisposition", contentDisposition); sendMessage(msg); @@ -1301,7 +1288,7 @@ public void onCloseWindow(WebViewClassic window) { public void onReceivedIcon(Bitmap icon) { // The current item might be null if the icon was already stored in the // database and this is a new WebView. - WebHistoryItem i = mBackForwardList.getCurrentItem(); + WebHistoryItemClassic i = mBackForwardList.getCurrentItem(); if (i != null) { i.setFavicon(icon); } @@ -1316,7 +1303,7 @@ public void onReceivedIcon(Bitmap icon) { /* package */ void onReceivedTouchIconUrl(String url, boolean precomposed) { // We should have a current item but we do not want to crash so check // for null. - WebHistoryItem i = mBackForwardList.getCurrentItem(); + WebHistoryItemClassic i = mBackForwardList.getCurrentItem(); if (i != null) { i.setTouchIconUrl(url, precomposed); } @@ -1608,13 +1595,6 @@ void onIndexChanged(WebHistoryItem item, int index) { sendMessage(msg); } - void setInstallableWebApp() { - if (mWebChromeClient == null) { - return; - } - sendMessage(obtainMessage(SET_INSTALLABLE_WEBAPP)); - } - boolean canShowAlertDialog() { // We can only display the alert dialog if mContext is // an Activity context. @@ -1625,29 +1605,6 @@ boolean canShowAlertDialog() { return mContext instanceof Activity; } - void onSearchboxSuggestionsReceived(String query, List suggestions) { - Message msg = obtainMessage(NOTIFY_SEARCHBOX_LISTENERS); - msg.obj = suggestions; - msg.getData().putString("query", query); - - sendMessage(msg); - } - - void onIsSupportedCallback(boolean isSupported) { - Message msg = obtainMessage(SEARCHBOX_IS_SUPPORTED_CALLBACK); - msg.obj = Boolean.valueOf(isSupported); - sendMessage(msg); - } - - void onSearchboxDispatchCompleteCallback(String function, int id, boolean success) { - Message msg = obtainMessage(SEARCHBOX_DISPATCH_COMPLETE_CALLBACK); - msg.obj = Boolean.valueOf(success); - msg.getData().putString("function", function); - msg.getData().putInt("id", id); - - sendMessage(msg); - } - private synchronized void sendMessageToUiThreadSync(Message msg) { sendMessage(msg); WebCoreThreadWatchdog.pause(); diff --git a/core/java/android/webkit/CertTool.java b/core/java/android/webkit/CertTool.java index a2325c328af52..e4d09a9b85495 100644 --- a/core/java/android/webkit/CertTool.java +++ b/core/java/android/webkit/CertTool.java @@ -16,6 +16,7 @@ package android.webkit; +import com.android.org.bouncycastle.asn1.ASN1Encoding; import com.android.org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers; import com.android.org.bouncycastle.asn1.x509.AlgorithmIdentifier; import com.android.org.bouncycastle.jce.netscape.NetscapeCertRequest; @@ -57,7 +58,7 @@ static String getSignedPublicKey(Context context, int index, String challenge) { NetscapeCertRequest request = new NetscapeCertRequest(challenge, MD5_WITH_RSA, pair.getPublic()); request.sign(pair.getPrivate()); - byte[] signed = request.toASN1Object().getDEREncoded(); + byte[] signed = request.toASN1Primitive().getEncoded(ASN1Encoding.DER); Credentials.getInstance().install(context, pair); return new String(Base64.encode(signed)); diff --git a/core/java/android/webkit/CookieManager.java b/core/java/android/webkit/CookieManager.java index 30c713e814c0b..2b75d83a8da08 100644 --- a/core/java/android/webkit/CookieManager.java +++ b/core/java/android/webkit/CookieManager.java @@ -37,8 +37,8 @@ protected Object clone() throws CloneNotSupportedException { /** * Gets the singleton CookieManager instance. If this method is used * before the application instantiates a {@link WebView} instance, - * {@link CookieSyncManager#createInstance(Context)} must be called - * first. + * {@link CookieSyncManager#createInstance CookieSyncManager.createInstance(Context)} + * must be called first. * * @return the singleton CookieManager instance */ diff --git a/core/java/android/webkit/CookieSyncManager.java b/core/java/android/webkit/CookieSyncManager.java index 4e993355e260a..276bcae1161ea 100644 --- a/core/java/android/webkit/CookieSyncManager.java +++ b/core/java/android/webkit/CookieSyncManager.java @@ -86,10 +86,8 @@ public static synchronized CookieSyncManager createInstance( throw new IllegalArgumentException("Invalid context argument"); } - JniUtil.setContext(context); - Context appContext = context.getApplicationContext(); if (sRef == null) { - sRef = new CookieSyncManager(appContext); + sRef = new CookieSyncManager(context); } return sRef; } diff --git a/core/java/android/webkit/DateSorter.java b/core/java/android/webkit/DateSorter.java index 0e8ad7e075110..82c13aeea9a47 100644 --- a/core/java/android/webkit/DateSorter.java +++ b/core/java/android/webkit/DateSorter.java @@ -21,6 +21,9 @@ import java.util.Calendar; import java.util.Date; +import java.util.Locale; + +import libcore.icu.LocaleData; /** * Sorts dates into the following groups: @@ -63,8 +66,13 @@ public DateSorter(Context context) { mBins[3] = c.getTimeInMillis(); // One month ago // build labels - mLabels[0] = context.getText(com.android.internal.R.string.today).toString(); - mLabels[1] = context.getText(com.android.internal.R.string.yesterday).toString(); + Locale locale = resources.getConfiguration().locale; + if (locale == null) { + locale = Locale.getDefault(); + } + LocaleData localeData = LocaleData.get(locale); + mLabels[0] = localeData.today; + mLabels[1] = localeData.yesterday; int resId = com.android.internal.R.plurals.last_num_days; String format = resources.getQuantityString(resId, NUM_DAYS_AGO); diff --git a/core/java/android/webkit/DeviceOrientationService.java b/core/java/android/webkit/DeviceOrientationService.java index 2e8656c543642..a4d240dc9f3a2 100755 --- a/core/java/android/webkit/DeviceOrientationService.java +++ b/core/java/android/webkit/DeviceOrientationService.java @@ -123,7 +123,7 @@ private void getOrientationUsingGetRotationMatrix() { // The angles are in radians float[] rotationAngles = new float[3]; SensorManager.getOrientation(deviceRotationMatrix, rotationAngles); - double alpha = Math.toDegrees(-rotationAngles[0]) - 90.0; + double alpha = Math.toDegrees(-rotationAngles[0]); while (alpha < 0.0) { alpha += 360.0; } // [0, 360) double beta = Math.toDegrees(-rotationAngles[1]); while (beta < -180.0) { beta += 360.0; } // [-180, 180) diff --git a/core/java/android/webkit/HTML5VideoFullScreen.java b/core/java/android/webkit/HTML5VideoFullScreen.java index 33eaad6bde45e..9b93805cc256b 100644 --- a/core/java/android/webkit/HTML5VideoFullScreen.java +++ b/core/java/android/webkit/HTML5VideoFullScreen.java @@ -1,3 +1,18 @@ +/* + * 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.webkit; @@ -75,9 +90,10 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { // ratio is correct. private int mVideoWidth; private int mVideoHeight; - + private boolean mPlayingWhenDestroyed = false; SurfaceHolder.Callback mSHCallback = new SurfaceHolder.Callback() { + @Override public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) { @@ -91,6 +107,7 @@ public void surfaceChanged(SurfaceHolder holder, int format, } } + @Override public void surfaceCreated(SurfaceHolder holder) { mSurfaceHolder = holder; @@ -99,14 +116,14 @@ public void surfaceCreated(SurfaceHolder holder) prepareForFullScreen(); } + @Override public void surfaceDestroyed(SurfaceHolder holder) { - // After we return from this we can't use the surface any more. - // The current Video View will be destroy when we play a new video. + mPlayingWhenDestroyed = mPlayer.isPlaying(); pauseAndDispatch(mProxy); - // TODO: handle full screen->inline mode transition without a reload. - mPlayer.release(); - mPlayer = null; + // We need to set the display to null before switching into inline + // mode to avoid error. + mPlayer.setDisplay(null); mSurfaceHolder = null; if (mMediaController != null) { mMediaController.hide(); @@ -194,18 +211,6 @@ public void onPrepared(MediaPlayer mp) { mCanPause = mCanSeekBack = mCanSeekForward = true; } - if (mProgressView != null) { - mProgressView.setVisibility(View.GONE); - } - - mVideoWidth = mp.getVideoWidth(); - mVideoHeight = mp.getVideoHeight(); - // This will trigger the onMeasure to get the display size right. - mVideoSurfaceView.getHolder().setFixedSize(mVideoWidth, mVideoHeight); - // Call into the native to ask for the state, if still in play mode, - // this will trigger the video to play. - mProxy.dispatchOnRestoreState(); - if (getStartWhenPrepared()) { mPlayer.start(); // Clear the flag. @@ -219,20 +224,31 @@ public void onPrepared(MediaPlayer mp) { mMediaController.setEnabled(true); mMediaController.show(); } + + if (mProgressView != null) { + mProgressView.setVisibility(View.GONE); + } + + mVideoWidth = mp.getVideoWidth(); + mVideoHeight = mp.getVideoHeight(); + // This will trigger the onMeasure to get the display size right. + mVideoSurfaceView.getHolder().setFixedSize(mVideoWidth, mVideoHeight); + } + @Override public boolean fullScreenExited() { return (mLayout == null); } private final WebChromeClient.CustomViewCallback mCallback = new WebChromeClient.CustomViewCallback() { + @Override public void onCustomViewHidden() { // It listens to SurfaceHolder.Callback.SurfaceDestroyed event // which happens when the video view is detached from its parent // view. This happens in the WebChromeClient before this method // is invoked. - mProxy.dispatchOnStopFullScreen(); mLayout.removeView(getSurfaceView()); if (mProgressView != null) { @@ -242,12 +258,11 @@ public void onCustomViewHidden() { mLayout = null; // Re enable plugin views. mProxy.getWebView().getViewManager().showAll(); - - mProxy = null; - // Don't show the controller after exiting the full screen. mMediaController = null; - mCurrentState = STATE_RESETTED; + // Continue the inline mode playing if necessary. + mProxy.dispatchOnStopFullScreen(mPlayingWhenDestroyed); + mProxy = null; } }; @@ -264,7 +279,7 @@ public void enterFullScreenVideoState(int layerId, mVideoSurfaceView.setFocusable(true); mVideoSurfaceView.setFocusableInTouchMode(true); mVideoSurfaceView.requestFocus(); - + mVideoSurfaceView.setOnKeyListener(mProxy); // Create a FrameLayout that will contain the VideoView and the // progress view (if any). mLayout = new FrameLayout(mProxy.getContext()); @@ -296,6 +311,7 @@ public void enterFullScreenVideoState(int layerId, * @return true when we are in full screen mode, even the surface not fully * created. */ + @Override public boolean isFullScreenMode() { return true; } @@ -334,6 +350,7 @@ public void showControllerInFullScreen() { // Other listeners functions: private MediaPlayer.OnBufferingUpdateListener mBufferingUpdateListener = new MediaPlayer.OnBufferingUpdateListener() { + @Override public void onBufferingUpdate(MediaPlayer mp, int percent) { mCurrentBufferPercentage = percent; } diff --git a/core/java/android/webkit/HTML5VideoInline.java b/core/java/android/webkit/HTML5VideoInline.java index 2c7ea5d9b8589..2ab2ab94ca4c2 100644 --- a/core/java/android/webkit/HTML5VideoInline.java +++ b/core/java/android/webkit/HTML5VideoInline.java @@ -1,10 +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.webkit; import android.Manifest.permission; import android.content.pm.PackageManager; import android.graphics.SurfaceTexture; -import android.media.MediaPlayer; import android.webkit.HTML5VideoView; import android.webkit.HTML5VideoViewProxy; import android.view.Surface; @@ -34,8 +48,8 @@ public void start() { } } - HTML5VideoInline(int videoLayerId, int position) { - init(videoLayerId, position, false); + HTML5VideoInline(int videoLayerId, int position, boolean skipPrepare) { + init(videoLayerId, position, skipPrepare); } @Override @@ -84,7 +98,7 @@ public static SurfaceTexture getSurfaceTexture(int videoLayerId) { return mSurfaceTexture; } - public boolean surfaceTextureDeleted() { + public static boolean surfaceTextureDeleted() { return (mSurfaceTexture == null); } @@ -110,7 +124,9 @@ public int getTextureName() { } private void setFrameAvailableListener(SurfaceTexture.OnFrameAvailableListener l) { - mSurfaceTexture.setOnFrameAvailableListener(l); + if (mSurfaceTexture != null) { + mSurfaceTexture.setOnFrameAvailableListener(l); + } } } diff --git a/core/java/android/webkit/HTML5VideoView.java b/core/java/android/webkit/HTML5VideoView.java index 371feea7f5c55..0e8a5db4dcc4f 100644 --- a/core/java/android/webkit/HTML5VideoView.java +++ b/core/java/android/webkit/HTML5VideoView.java @@ -1,11 +1,23 @@ +/* + * 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.webkit; -import android.graphics.SurfaceTexture; import android.media.MediaPlayer; import android.net.Uri; -import android.util.Log; -import android.view.SurfaceView; import android.webkit.HTML5VideoViewProxy; import java.io.IOException; import java.util.HashMap; @@ -35,6 +47,7 @@ public class HTML5VideoView implements MediaPlayer.OnPreparedListener { static final int STATE_PREPARED = 2; static final int STATE_PLAYING = 3; static final int STATE_RESETTED = 4; + static final int STATE_RELEASED = 5; protected HTML5VideoViewProxy mProxy; @@ -126,7 +139,7 @@ public boolean isPlaying() { } public void reset() { - if (mCurrentState != STATE_RESETTED) { + if (mCurrentState < STATE_RESETTED) { mPlayer.reset(); } mCurrentState = STATE_RESETTED; @@ -138,6 +151,18 @@ public void stopPlayback() { } } + public static void release() { + if (mPlayer != null && mCurrentState != STATE_RELEASED) { + mPlayer.release(); + mPlayer = null; + } + mCurrentState = STATE_RELEASED; + } + + public boolean isReleased() { + return mCurrentState == STATE_RELEASED; + } + public boolean getPauseDuringPreparing() { return mPauseDuringPreparing; } @@ -337,11 +362,6 @@ protected void switchProgressView(boolean playerBuffering) { // Only used in HTML5VideoFullScreen } - public boolean surfaceTextureDeleted() { - // Only meaningful for HTML5VideoInline - return false; - } - public boolean fullScreenExited() { // Only meaningful for HTML5VideoFullScreen return false; diff --git a/core/java/android/webkit/HTML5VideoViewProxy.java b/core/java/android/webkit/HTML5VideoViewProxy.java index ab884dfbdd8cc..a3d62ae91129d 100644 --- a/core/java/android/webkit/HTML5VideoViewProxy.java +++ b/core/java/android/webkit/HTML5VideoViewProxy.java @@ -31,6 +31,8 @@ import android.os.Looper; import android.os.Message; import android.util.Log; +import android.view.KeyEvent; +import android.view.View; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -47,7 +49,8 @@ class HTML5VideoViewProxy extends Handler MediaPlayer.OnCompletionListener, MediaPlayer.OnErrorListener, MediaPlayer.OnInfoListener, - SurfaceTexture.OnFrameAvailableListener { + SurfaceTexture.OnFrameAvailableListener, + View.OnKeyListener { // Logging tag. private static final String LOGTAG = "HTML5VideoViewProxy"; @@ -59,6 +62,7 @@ class HTML5VideoViewProxy extends Handler private static final int LOAD_DEFAULT_POSTER = 104; private static final int BUFFERING_START = 105; private static final int BUFFERING_END = 106; + private static final int ENTER_FULLSCREEN = 107; // Message Ids to be handled on the WebCore thread private static final int PREPARED = 200; @@ -93,9 +97,6 @@ private static final class VideoPlayer { private static HTML5VideoView mHTML5VideoView; private static boolean isVideoSelfEnded = false; - // By using the baseLayer and the current video Layer ID, we can - // identify the exact layer on the UI thread to use the SurfaceTexture. - private static int mBaseLayer = 0; private static void setPlayerBuffering(boolean playerBuffering) { mHTML5VideoView.setPlayerBuffering(playerBuffering); @@ -108,9 +109,7 @@ public static void setBaseLayer(int layer) { // Don't do this for full screen mode. if (mHTML5VideoView != null && !mHTML5VideoView.isFullScreenMode() - && !mHTML5VideoView.surfaceTextureDeleted()) { - mBaseLayer = layer; - + && !mHTML5VideoView.isReleased()) { int currentVideoLayerId = mHTML5VideoView.getVideoLayerId(); SurfaceTexture surfTexture = HTML5VideoInline.getSurfaceTexture(currentVideoLayerId); @@ -126,7 +125,6 @@ public static void setBaseLayer(int layer) { if (playerState >= HTML5VideoView.STATE_PREPARED && !foundInTree) { mHTML5VideoView.pauseAndDispatch(mCurrentProxy); - mHTML5VideoView.deleteSurfaceTexture(); } } } @@ -136,9 +134,6 @@ public static void setBaseLayer(int layer) { public static void pauseAndDispatch() { if (mHTML5VideoView != null) { mHTML5VideoView.pauseAndDispatch(mCurrentProxy); - // When switching out, clean the video content on the old page - // by telling the layer not readyToUseSurfTex. - setBaseLayer(mBaseLayer); } } @@ -217,9 +212,16 @@ public static void play(String url, int time, HTML5VideoViewProxy proxy, } } + boolean skipPrepare = false; + boolean createInlineView = false; if (backFromFullScreenMode + && currentVideoLayerId == videoLayerId + && !mHTML5VideoView.isReleased()) { + skipPrepare = true; + createInlineView = true; + } else if(backFromFullScreenMode || currentVideoLayerId != videoLayerId - || mHTML5VideoView.surfaceTextureDeleted()) { + || HTML5VideoInline.surfaceTextureDeleted()) { // Here, we handle the case when switching to a new video, // either inside a WebView or across WebViews // For switching videos within a WebView or across the WebView, @@ -231,12 +233,18 @@ public static void play(String url, int time, HTML5VideoViewProxy proxy, } mHTML5VideoView.reset(); } + createInlineView = true; + } + if (createInlineView) { mCurrentProxy = proxy; - mHTML5VideoView = new HTML5VideoInline(videoLayerId, time); + mHTML5VideoView = new HTML5VideoInline(videoLayerId, time, skipPrepare); mHTML5VideoView.setVideoURI(url, mCurrentProxy); mHTML5VideoView.prepareDataAndDisplayMode(proxy); - } else if (mCurrentProxy == proxy) { + return; + } + + if (mCurrentProxy == proxy) { // Here, we handle the case when we keep playing with one video if (!mHTML5VideoView.isPlaying()) { mHTML5VideoView.seekTo(time); @@ -278,9 +286,6 @@ public static void onPrepared() { if (!mHTML5VideoView.isFullScreenMode()) { mHTML5VideoView.start(); } - if (mBaseLayer != 0) { - setBaseLayer(mBaseLayer); - } } public static void end() { @@ -297,6 +302,7 @@ public static void end() { // A bunch event listeners for our VideoView // MediaPlayer.OnPreparedListener + @Override public void onPrepared(MediaPlayer mp) { VideoPlayer.onPrepared(); Message msg = Message.obtain(mWebCoreHandler, PREPARED); @@ -309,6 +315,7 @@ public void onPrepared(MediaPlayer mp) { } // MediaPlayer.OnCompletionListener; + @Override public void onCompletion(MediaPlayer mp) { // The video ended by itself, so we need to // send a message to the UI thread to dismiss @@ -318,6 +325,7 @@ public void onCompletion(MediaPlayer mp) { } // MediaPlayer.OnErrorListener + @Override public boolean onError(MediaPlayer mp, int what, int extra) { sendMessage(obtainMessage(ERROR)); return false; @@ -333,8 +341,9 @@ public void dispatchOnPaused() { mWebCoreHandler.sendMessage(msg); } - public void dispatchOnStopFullScreen() { + public void dispatchOnStopFullScreen(boolean stillPlaying) { Message msg = Message.obtain(mWebCoreHandler, STOPFULLSCREEN); + msg.arg1 = stillPlaying ? 1 : 0; mWebCoreHandler.sendMessage(msg); } @@ -369,6 +378,15 @@ public void handleMessage(Message msg) { } break; } + case ENTER_FULLSCREEN:{ + String url = (String) msg.obj; + WebChromeClient client = mWebView.getWebChromeClient(); + int videoLayerID = msg.arg1; + if (client != null) { + VideoPlayer.enterFullScreenVideo(videoLayerID, url, this, mWebView); + } + break; + } case SEEK: { Integer time = (Integer) msg.obj; mSeekPosition = time; @@ -473,6 +491,7 @@ public void cancelAndReleaseQueue() { releaseQueue(); } // EventHandler methods. Executed on the network thread. + @Override public void status(int major_version, int minor_version, int code, @@ -480,10 +499,12 @@ public void status(int major_version, mStatusCode = code; } + @Override public void headers(Headers headers) { mHeaders = headers; } + @Override public void data(byte[] data, int len) { if (mPosterBytes == null) { mPosterBytes = new ByteArrayOutputStream(); @@ -491,6 +512,7 @@ public void data(byte[] data, int len) { mPosterBytes.write(data, 0, len); } + @Override public void endData() { if (mStatusCode == 200) { if (mPosterBytes.size() > 0) { @@ -508,6 +530,7 @@ public void endData() { } if (mUrl != null) { mHandler.post(new Runnable() { + @Override public void run() { if (mRequestHandle != null) { mRequestHandle.setupRedirect(mUrl.toString(), mStatusCode, @@ -519,14 +542,17 @@ public void run() { } } + @Override public void certificate(SslCertificate certificate) { // Don't care. } + @Override public void error(int id, String description) { cleanup(); } + @Override public boolean handleSslErrorRequest(SslError error) { // Don't care. If this happens, data() will never be called so // mPosterBytes will never be created, so no need to call cleanup. @@ -613,7 +639,7 @@ public void handleMessage(Message msg) { nativeOnTimeupdate(msg.arg1, mNativePointer); break; case STOPFULLSCREEN: - nativeOnStopFullscreen(mNativePointer); + nativeOnStopFullscreen(msg.arg1, mNativePointer); break; case RESTORESTATE: nativeOnRestoreState(mNativePointer); @@ -663,6 +689,21 @@ public void play(String url, int position, int videoLayerID) { sendMessage(message); } + /** + * Play a video stream in full screen mode. + * @param url is the URL of the video stream. + */ + public void enterFullscreenForVideoLayer(String url, int videoLayerID) { + if (url == null) { + return; + } + + Message message = obtainMessage(ENTER_FULLSCREEN); + message.arg1 = videoLayerID; + message.obj = url; + sendMessage(message); + } + /** * Seek into the video stream. * @param time is the position in the video stream. @@ -748,7 +789,7 @@ public static HTML5VideoViewProxy getInstance(WebViewCore webViewCore, int nativ private native void nativeOnPaused(int nativePointer); private native void nativeOnPosterFetched(Bitmap poster, int nativePointer); private native void nativeOnTimeupdate(int position, int nativePointer); - private native void nativeOnStopFullscreen(int nativePointer); + private native void nativeOnStopFullscreen(int stillPlaying, int nativePointer); private native void nativeOnRestoreState(int nativePointer); private native static boolean nativeSendSurfaceTexture(SurfaceTexture texture, int baseLayer, int videoLayerId, int textureName, @@ -763,4 +804,17 @@ public boolean onInfo(MediaPlayer mp, int what, int extra) { } return false; } + + @Override + public boolean onKey(View v, int keyCode, KeyEvent event) { + if (keyCode == KeyEvent.KEYCODE_BACK) { + if (event.getAction() == KeyEvent.ACTION_DOWN) { + return true; + } else if (event.getAction() == KeyEvent.ACTION_UP && !event.isCanceled()) { + VideoPlayer.exitFullScreenVideo(this, mWebView); + return true; + } + } + return false; + } } diff --git a/core/java/android/webkit/HttpAuthHandler.java b/core/java/android/webkit/HttpAuthHandler.java index 2fbd1d053ec83..296d960a5812f 100644 --- a/core/java/android/webkit/HttpAuthHandler.java +++ b/core/java/android/webkit/HttpAuthHandler.java @@ -19,40 +19,51 @@ import android.os.Handler; /** - * HTTP authentication request that must be handled by the user interface. - * WebView creates the object and hands it to the current {@link WebViewClient}, - * which must call either {@link #proceed(String, String)} or {@link #cancel()}. + * Represents a request for HTTP authentication. Instances of this class are + * created by the WebView and passed to + * {@link WebViewClient#onReceivedHttpAuthRequest}. The host application must + * call either {@link #proceed} or {@link #cancel} to set the WebView's + * response to the request. */ public class HttpAuthHandler extends Handler { /** - * Package-private constructor needed for API compatibility. + * @hide Only for use by WebViewProvider implementations. */ - HttpAuthHandler() { + public HttpAuthHandler() { } /** - * @return True if we can use user credentials on record - * (ie, if we did not fail trying to use them last time) + * Gets whether the credentials stored for the current host (i.e. the host + * for which {@link WebViewClient#onReceivedHttpAuthRequest} was called) + * are suitable for use. Credentials are not suitable if they have + * previously been rejected by the server for the current request. + * + * @return whether the credentials are suitable for use + * @see Webview#getHttpAuthUsernamePassword */ public boolean useHttpAuthUsernamePassword() { return false; } /** - * Cancel the authorization request. + * Instructs the WebView to cancel the authentication request. */ public void cancel() { } /** - * Proceed with the authorization with the given credentials. + * Instructs the WebView to proceed with the authentication with the given + * credentials. Credentials for use with this method can be retrieved from + * the WebView's store using {@link WebView#getHttpAuthUsernamePassword}. */ public void proceed(String username, String password) { } /** - * return true if the prompt dialog should be suppressed. + * Gets whether the prompt dialog should be suppressed. + * + * @return whether the prompt dialog should be suppressed * @hide */ public boolean suppressDialog() { diff --git a/core/java/android/webkit/JavascriptInterface.java b/core/java/android/webkit/JavascriptInterface.java new file mode 100644 index 0000000000000..6cd2a7b2fd016 --- /dev/null +++ b/core/java/android/webkit/JavascriptInterface.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 android.webkit; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Annotation that allows exposing methods to JavaScript. Starting from API level + * {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} and above, only methods explicitly + * marked with this annotation are available to the Javascript code. See + * {@link android.webkit.WebView#addJavascriptInterface} for more information about it. + * + */ +@SuppressWarnings("javadoc") +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.METHOD}) +public @interface JavascriptInterface { +} \ No newline at end of file diff --git a/core/java/android/webkit/JniUtil.java b/core/java/android/webkit/JniUtil.java index e3e6092e85a5b..01a81c4254583 100644 --- a/core/java/android/webkit/JniUtil.java +++ b/core/java/android/webkit/JniUtil.java @@ -173,8 +173,8 @@ private static synchronized String getAutofillQueryUrl() { checkInitialized(); // If the device has not checked in it won't have pulled down the system setting for the // Autofill Url. In that case we will not make autofill server requests. - return Settings.Secure.getString(sContext.getContentResolver(), - Settings.Secure.WEB_AUTOFILL_QUERY_URL); + return Settings.Global.getString(sContext.getContentResolver(), + Settings.Global.WEB_AUTOFILL_QUERY_URL); } private static boolean canSatisfyMemoryAllocation(long bytesRequested) { diff --git a/core/java/android/webkit/MockGeolocation.java b/core/java/android/webkit/MockGeolocation.java index fbda4924da0e8..885c6c2542bf1 100644 --- a/core/java/android/webkit/MockGeolocation.java +++ b/core/java/android/webkit/MockGeolocation.java @@ -17,21 +17,29 @@ package android.webkit; /** - * This class is simply a container for the methods used to configure WebKit's - * mock Geolocation service for use in LayoutTests. + * Used to configure the mock Geolocation client for the LayoutTests. * @hide */ public final class MockGeolocation { + private WebViewCore mWebViewCore; - // Global instance of a MockGeolocation - private static MockGeolocation sMockGeolocation; + public MockGeolocation(WebViewCore webViewCore) { + mWebViewCore = webViewCore; + } + + /** + * Sets use of the mock Geolocation client. Also resets that client. + */ + public void setUseMock() { + nativeSetUseMock(mWebViewCore); + } /** * Set the position for the mock Geolocation service. */ public void setPosition(double latitude, double longitude, double accuracy) { // This should only ever be called on the WebKit thread. - nativeSetPosition(latitude, longitude, accuracy); + nativeSetPosition(mWebViewCore, latitude, longitude, accuracy); } /** @@ -39,21 +47,18 @@ public void setPosition(double latitude, double longitude, double accuracy) { */ public void setError(int code, String message) { // This should only ever be called on the WebKit thread. - nativeSetError(code, message); + nativeSetError(mWebViewCore, code, message); } - /** - * Get the global instance of MockGeolocation. - * @return The global MockGeolocation instance. - */ - public static MockGeolocation getInstance() { - if (sMockGeolocation == null) { - sMockGeolocation = new MockGeolocation(); - } - return sMockGeolocation; + public void setPermission(boolean allow) { + // This should only ever be called on the WebKit thread. + nativeSetPermission(mWebViewCore, allow); } // Native functions - private static native void nativeSetPosition(double latitude, double longitude, double accuracy); - private static native void nativeSetError(int code, String message); + private static native void nativeSetUseMock(WebViewCore webViewCore); + private static native void nativeSetPosition(WebViewCore webViewCore, double latitude, + double longitude, double accuracy); + private static native void nativeSetError(WebViewCore webViewCore, int code, String message); + private static native void nativeSetPermission(WebViewCore webViewCore, boolean allow); } diff --git a/core/java/android/webkit/SearchBox.java b/core/java/android/webkit/SearchBox.java deleted file mode 100644 index 38a1740aefa7e..0000000000000 --- a/core/java/android/webkit/SearchBox.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -package android.webkit; - -import java.util.List; - -/** - * Defines the interaction between the browser/renderer and the page running on - * a given WebView frame, if the page supports the chromium SearchBox API. - * - * http://dev.chromium.org/searchbox - * - * The browser or container app can query the page for search results using - * SearchBox.query() and receive suggestions by registering a listener on the - * SearchBox object. - * - * @hide - */ -public interface SearchBox { - /** - * Sets the current searchbox query. Note that the caller must call - * onchange() to ensure that the search page processes this query. - */ - void setQuery(String query); - - /** - * Verbatim is true if the caller suggests that the search page - * treat the current query as a verbatim search query (as opposed to a - * partially typed search query). As with setQuery, onchange() must be - * called to ensure that the search page processes the query. - */ - void setVerbatim(boolean verbatim); - - /** - * These attributes must contain the offset to the characters that immediately - * follow the start and end of the selection in the search box. If there is - * no such selection, then both selectionStart and selectionEnd must be the offset - * to the character that immediately follows the text entry cursor. In the case - * that there is no explicit text entry cursor, the cursor is - * implicitly at the end of the input. - */ - void setSelection(int selectionStart, int selectionEnd); - - /** - * Sets the dimensions of the view (if any) that overlaps the current - * window object. This is to ensure that the page renders results in - * a manner that allows them to not be obscured by such a view. Note - * that a call to onresize() is required if these dimensions change. - */ - void setDimensions(int x, int y, int width, int height); - - /** - * Notify the search page of any changes to the searchbox. Such as - * a change in the typed query (onchange), the user commiting a given query - * (onsubmit), or a change in size of a suggestions dropdown (onresize). - * - * @param listener an optional listener to notify of the success of the operation, - * indicating if the javascript function existed and could be called or not. - * It will be called on the UI thread. - */ - void onchange(SearchBoxListener listener); - void onsubmit(SearchBoxListener listener); - void onresize(SearchBoxListener listener); - void oncancel(SearchBoxListener listener); - - /** - * Add and remove listeners to the given Searchbox. Listeners are notified - * of any suggestions to the query that the underlying search engine might - * provide. - */ - void addSearchBoxListener(SearchBoxListener l); - void removeSearchBoxListener(SearchBoxListener l); - - /** - * Indicates if the searchbox API is supported in the current page. - */ - void isSupported(IsSupportedCallback callback); - - /** - * Listeners (if any) will be called on the thread that created the - * webview. - */ - public abstract class SearchBoxListener { - public void onSuggestionsReceived(String query, List suggestions) {} - public void onChangeComplete(boolean called) {} - public void onSubmitComplete(boolean called) {} - public void onResizeComplete(boolean called) {} - public void onCancelComplete(boolean called) {} - } - - interface IsSupportedCallback { - void searchBoxIsSupported(boolean supported); - } -} diff --git a/core/java/android/webkit/SearchBoxImpl.java b/core/java/android/webkit/SearchBoxImpl.java deleted file mode 100644 index 9942d2580e68f..0000000000000 --- a/core/java/android/webkit/SearchBoxImpl.java +++ /dev/null @@ -1,304 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.webkit; - -import android.text.TextUtils; -import android.util.Log; -import android.webkit.WebViewCore.EventHub; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; -import org.json.JSONStringer; - -/** - * The default implementation of the SearchBox interface. Implemented - * as a java bridge object and a javascript adapter that is called into - * by the page hosted in the frame. - */ -final class SearchBoxImpl implements SearchBox { - private static final String TAG = "WebKit.SearchBoxImpl"; - - /* package */ static final String JS_INTERFACE_NAME = "searchBoxJavaBridge_"; - - /* package */ static final String JS_BRIDGE - = "(function()" - + "{" - + "if (!window.chrome) {" - + " window.chrome = {};" - + "}" - + "if (!window.chrome.searchBox) {" - + " var sb = window.chrome.searchBox = {};" - + " sb.setSuggestions = function(suggestions) {" - + " if (window.searchBoxJavaBridge_) {" - + " window.searchBoxJavaBridge_.setSuggestions(JSON.stringify(suggestions));" - + " }" - + " };" - + " sb.setValue = function(valueArray) { sb.value = valueArray[0]; };" - + " sb.value = '';" - + " sb.x = 0;" - + " sb.y = 0;" - + " sb.width = 0;" - + " sb.height = 0;" - + " sb.selectionStart = 0;" - + " sb.selectionEnd = 0;" - + " sb.verbatim = false;" - + "}" - + "})();"; - - private static final String SET_QUERY_SCRIPT - = "if (window.chrome && window.chrome.searchBox) {" - + " window.chrome.searchBox.setValue(%s);" - + "}"; - - private static final String SET_VERBATIM_SCRIPT - = "if (window.chrome && window.chrome.searchBox) {" - + " window.chrome.searchBox.verbatim = %1$s;" - + "}"; - - private static final String SET_SELECTION_SCRIPT - = "if (window.chrome && window.chrome.searchBox) {" - + " var f = window.chrome.searchBox;" - + " f.selectionStart = %d" - + " f.selectionEnd = %d" - + "}"; - - private static final String SET_DIMENSIONS_SCRIPT - = "if (window.chrome && window.chrome.searchBox) { " - + " var f = window.chrome.searchBox;" - + " f.x = %d;" - + " f.y = %d;" - + " f.width = %d;" - + " f.height = %d;" - + "}"; - - private static final String DISPATCH_EVENT_SCRIPT - = "if (window.chrome && window.chrome.searchBox && window.chrome.searchBox.on%1$s) {" - + " window.chrome.searchBox.on%1$s();" - + " window.searchBoxJavaBridge_.dispatchCompleteCallback('%1$s', %2$d, true);" - + "} else {" - + " window.searchBoxJavaBridge_.dispatchCompleteCallback('%1$s', %2$d, false);" - + "}"; - - private static final String EVENT_CHANGE = "change"; - private static final String EVENT_SUBMIT = "submit"; - private static final String EVENT_RESIZE = "resize"; - private static final String EVENT_CANCEL = "cancel"; - - private static final String IS_SUPPORTED_SCRIPT - = "if (window.searchBoxJavaBridge_) {" - + " if (window.chrome && window.chrome.sv) {" - + " window.searchBoxJavaBridge_.isSupportedCallback(true);" - + " } else {" - + " window.searchBoxJavaBridge_.isSupportedCallback(false);" - + " }}"; - - private final List mListeners; - private final WebViewCore mWebViewCore; - private final CallbackProxy mCallbackProxy; - private IsSupportedCallback mSupportedCallback; - private int mNextEventId = 1; - private final HashMap mEventCallbacks; - - SearchBoxImpl(WebViewCore webViewCore, CallbackProxy callbackProxy) { - mListeners = new ArrayList(); - mWebViewCore = webViewCore; - mCallbackProxy = callbackProxy; - mEventCallbacks = new HashMap(); - } - - @Override - public void setQuery(String query) { - final String formattedQuery = jsonSerialize(query); - if (formattedQuery != null) { - final String js = String.format(SET_QUERY_SCRIPT, formattedQuery); - dispatchJs(js); - } - } - - @Override - public void setVerbatim(boolean verbatim) { - final String js = String.format(SET_VERBATIM_SCRIPT, String.valueOf(verbatim)); - dispatchJs(js); - } - - - @Override - public void setSelection(int selectionStart, int selectionEnd) { - final String js = String.format(SET_SELECTION_SCRIPT, selectionStart, selectionEnd); - dispatchJs(js); - } - - @Override - public void setDimensions(int x, int y, int width, int height) { - final String js = String.format(SET_DIMENSIONS_SCRIPT, x, y, width, height); - dispatchJs(js); - } - - @Override - public void onchange(SearchBoxListener callback) { - dispatchEvent(EVENT_CHANGE, callback); - } - - @Override - public void onsubmit(SearchBoxListener callback) { - dispatchEvent(EVENT_SUBMIT, callback); - } - - @Override - public void onresize(SearchBoxListener callback) { - dispatchEvent(EVENT_RESIZE, callback); - } - - @Override - public void oncancel(SearchBoxListener callback) { - dispatchEvent(EVENT_CANCEL, callback); - } - - private void dispatchEvent(String eventName, SearchBoxListener callback) { - int eventId; - if (callback != null) { - synchronized(this) { - eventId = mNextEventId++; - mEventCallbacks.put(eventId, callback); - } - } else { - eventId = 0; - } - final String js = String.format(DISPATCH_EVENT_SCRIPT, eventName, eventId); - dispatchJs(js); - } - - private void dispatchJs(String js) { - mWebViewCore.sendMessage(EventHub.EXECUTE_JS, js); - } - - @Override - public void addSearchBoxListener(SearchBoxListener l) { - synchronized (mListeners) { - mListeners.add(l); - } - } - - @Override - public void removeSearchBoxListener(SearchBoxListener l) { - synchronized (mListeners) { - mListeners.remove(l); - } - } - - @Override - public void isSupported(IsSupportedCallback callback) { - mSupportedCallback = callback; - dispatchJs(IS_SUPPORTED_SCRIPT); - } - - // Called by Javascript through the Java bridge. - public void isSupportedCallback(boolean isSupported) { - mCallbackProxy.onIsSupportedCallback(isSupported); - } - - public void handleIsSupportedCallback(boolean isSupported) { - IsSupportedCallback callback = mSupportedCallback; - mSupportedCallback = null; - if (callback != null) { - callback.searchBoxIsSupported(isSupported); - } - } - - // Called by Javascript through the Java bridge. - public void dispatchCompleteCallback(String function, int id, boolean successful) { - mCallbackProxy.onSearchboxDispatchCompleteCallback(function, id, successful); - } - - public void handleDispatchCompleteCallback(String function, int id, boolean successful) { - if (id != 0) { - SearchBoxListener listener; - synchronized(this) { - listener = mEventCallbacks.get(id); - mEventCallbacks.remove(id); - } - if (listener != null) { - if (TextUtils.equals(EVENT_CHANGE, function)) { - listener.onChangeComplete(successful); - } else if (TextUtils.equals(EVENT_SUBMIT, function)) { - listener.onSubmitComplete(successful); - } else if (TextUtils.equals(EVENT_RESIZE, function)) { - listener.onResizeComplete(successful); - } else if (TextUtils.equals(EVENT_CANCEL, function)) { - listener.onCancelComplete(successful); - } - } - } - } - - // This is used as a hackish alternative to javascript escaping. - // There appears to be no such functionality in the core framework. - private static String jsonSerialize(String query) { - JSONStringer stringer = new JSONStringer(); - try { - stringer.array().value(query).endArray(); - } catch (JSONException e) { - Log.w(TAG, "Error serializing query : " + query); - return null; - } - return stringer.toString(); - } - - // Called by Javascript through the Java bridge. - public void setSuggestions(String jsonArguments) { - if (jsonArguments == null) { - return; - } - - String query = null; - List suggestions = new ArrayList(); - try { - JSONObject suggestionsJson = new JSONObject(jsonArguments); - query = suggestionsJson.getString("query"); - - final JSONArray suggestionsArray = suggestionsJson.getJSONArray("suggestions"); - for (int i = 0; i < suggestionsArray.length(); ++i) { - final JSONObject suggestion = suggestionsArray.getJSONObject(i); - final String value = suggestion.getString("value"); - if (value != null) { - suggestions.add(value); - } - // We currently ignore the "type" of the suggestion. This isn't - // documented anywhere in the API documents. - // final String type = suggestions.getString("type"); - } - } catch (JSONException je) { - Log.w(TAG, "Error parsing json [" + jsonArguments + "], exception = " + je); - return; - } - - mCallbackProxy.onSearchboxSuggestionsReceived(query, suggestions); - } - - /* package */ void handleSuggestions(String query, List suggestions) { - synchronized (mListeners) { - for (int i = mListeners.size() - 1; i >= 0; i--) { - mListeners.get(i).onSuggestionsReceived(query, suggestions); - } - } - } -} diff --git a/core/java/android/webkit/SslErrorHandler.java b/core/java/android/webkit/SslErrorHandler.java index 426145ae7ca50..3a43950aace24 100644 --- a/core/java/android/webkit/SslErrorHandler.java +++ b/core/java/android/webkit/SslErrorHandler.java @@ -26,9 +26,9 @@ public class SslErrorHandler extends Handler { /** - * Package-private constructor needed for API compatibility. + * @hide Only for use by WebViewProvider implementations. */ - SslErrorHandler() {} + public SslErrorHandler() {} /** * Proceed with the SSL certificate. diff --git a/core/java/android/webkit/ViewStateSerializer.java b/core/java/android/webkit/ViewStateSerializer.java index c16108577a580..096d4cda02d7a 100644 --- a/core/java/android/webkit/ViewStateSerializer.java +++ b/core/java/android/webkit/ViewStateSerializer.java @@ -16,7 +16,6 @@ package android.webkit; import android.graphics.Point; -import android.graphics.Region; import android.webkit.WebViewCore.DrawData; import java.io.DataInputStream; @@ -68,6 +67,15 @@ static DrawData deserializeViewState(InputStream stream) return draw; } + public static void dumpLayerHierarchy(int baseLayer, OutputStream out, int level) { + nativeDumpLayerHierarchy(baseLayer, level, out, + new byte[WORKING_STREAM_STORAGE]); + } + + + private static native void nativeDumpLayerHierarchy(int baseLayer, int level, + OutputStream out, byte[] storage); + private static native boolean nativeSerializeViewState(int baseLayer, OutputStream stream, byte[] storage); diff --git a/core/java/android/webkit/WebBackForwardList.java b/core/java/android/webkit/WebBackForwardList.java index 79e634e5faa42..bfef2e7404b56 100644 --- a/core/java/android/webkit/WebBackForwardList.java +++ b/core/java/android/webkit/WebBackForwardList.java @@ -17,7 +17,6 @@ package android.webkit; import java.io.Serializable; -import java.util.ArrayList; /** * This class contains the back/forward list for a WebView. @@ -25,22 +24,11 @@ * inspect the entries in the list. */ public class WebBackForwardList implements Cloneable, Serializable { - // Current position in the list. - private int mCurrentIndex; - // ArrayList of WebHistoryItems for maintaining our copy. - private ArrayList mArray; - // Flag to indicate that the list is invalid - private boolean mClearPending; - // CallbackProxy to issue client callbacks. - private final CallbackProxy mCallbackProxy; /** - * Construct a back/forward list used by clients of WebView. + * @hide */ - /*package*/ WebBackForwardList(CallbackProxy proxy) { - mCurrentIndex = -1; - mArray = new ArrayList(); - mCallbackProxy = proxy; + public WebBackForwardList() { } /** @@ -49,7 +37,7 @@ public class WebBackForwardList implements Cloneable, Serializable { * @return The current history item. */ public synchronized WebHistoryItem getCurrentItem() { - return getItemAtIndex(mCurrentIndex); + throw new MustOverrideException(); } /** @@ -58,7 +46,7 @@ public synchronized WebHistoryItem getCurrentItem() { * @return The current index from 0...n or -1 if the list is empty. */ public synchronized int getCurrentIndex() { - return mCurrentIndex; + throw new MustOverrideException(); } /** @@ -67,10 +55,7 @@ public synchronized int getCurrentIndex() { * @param index The index to retrieve. */ public synchronized WebHistoryItem getItemAtIndex(int index) { - if (index < 0 || index >= getSize()) { - return null; - } - return mArray.get(index); + throw new MustOverrideException(); } /** @@ -78,78 +63,7 @@ public synchronized WebHistoryItem getItemAtIndex(int index) { * @return The size of the list. */ public synchronized int getSize() { - return mArray.size(); - } - - /** - * Mark the back/forward list as having a pending clear. This is used on the - * UI side to mark the list as being invalid during the clearHistory method. - */ - /*package*/ synchronized void setClearPending() { - mClearPending = true; - } - - /** - * Return the status of the clear flag. This is used on the UI side to - * determine if the list is valid for checking things like canGoBack. - */ - /*package*/ synchronized boolean getClearPending() { - return mClearPending; - } - - /** - * Add a new history item to the list. This will remove all items after the - * current item and append the new item to the end of the list. Called from - * the WebCore thread only. Synchronized because the UI thread may be - * reading the array or the current index. - * @param item A new history item. - */ - /*package*/ synchronized void addHistoryItem(WebHistoryItem item) { - // Update the current position because we are going to add the new item - // in that slot. - ++mCurrentIndex; - // If the current position is not at the end, remove all history items - // after the current item. - final int size = mArray.size(); - final int newPos = mCurrentIndex; - if (newPos != size) { - for (int i = size - 1; i >= newPos; i--) { - final WebHistoryItem h = mArray.remove(i); - } - } - // Add the item to the list. - mArray.add(item); - if (mCallbackProxy != null) { - mCallbackProxy.onNewHistoryItem(item); - } - } - - /** - * Clear the back/forward list. Called from the WebCore thread. - */ - /*package*/ synchronized void close(int nativeFrame) { - // Clear the array first because nativeClose will call addHistoryItem - // with the current item. - mArray.clear(); - mCurrentIndex = -1; - nativeClose(nativeFrame); - // Reset the clear flag - mClearPending = false; - } - - /* Remove the item at the given index. Called by JNI only. */ - private synchronized void removeHistoryItem(int index) { - // XXX: This is a special case. Since the callback is only triggered - // when removing the first item, we can assert that the index is 0. - // This lets us change the current index without having to query the - // native BackForwardList. - if (DebugFlags.WEB_BACK_FORWARD_LIST && (index != 0)) { - throw new AssertionError(); - } - final WebHistoryItem h = mArray.remove(index); - // XXX: If we ever add another callback for removing history items at - // any index, this will no longer be valid. - mCurrentIndex--; + throw new MustOverrideException(); } /** @@ -158,39 +72,7 @@ private synchronized void removeHistoryItem(int index) { * webkit package classes. */ protected synchronized WebBackForwardList clone() { - WebBackForwardList l = new WebBackForwardList(null); - if (mClearPending) { - // If a clear is pending, return a copy with only the current item. - l.addHistoryItem(getCurrentItem()); - return l; - } - l.mCurrentIndex = mCurrentIndex; - int size = getSize(); - l.mArray = new ArrayList(size); - for (int i = 0; i < size; i++) { - // Add a copy of each WebHistoryItem - l.mArray.add(mArray.get(i).clone()); - } - return l; - } - - /** - * Set the new history index. - * @param newIndex The new history index. - */ - /*package*/ synchronized void setCurrentIndex(int newIndex) { - mCurrentIndex = newIndex; - if (mCallbackProxy != null) { - mCallbackProxy.onIndexChanged(getItemAtIndex(newIndex), newIndex); - } + throw new MustOverrideException(); } - /** - * Restore the history index. - */ - /*package*/ static native synchronized void restoreIndex(int nativeFrame, - int index); - - /* Close the native list. */ - private static native void nativeClose(int nativeFrame); } diff --git a/core/java/android/webkit/WebBackForwardListClassic.java b/core/java/android/webkit/WebBackForwardListClassic.java new file mode 100644 index 0000000000000..2a14e6b5bc878 --- /dev/null +++ b/core/java/android/webkit/WebBackForwardListClassic.java @@ -0,0 +1,166 @@ +/* + * 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.webkit; + +import java.io.Serializable; +import java.util.ArrayList; + +/* package */ class WebBackForwardListClassic extends WebBackForwardList implements Cloneable, + Serializable { + + // Current position in the list. + private int mCurrentIndex; + // ArrayList of WebHistoryItems for maintaining our copy. + private ArrayList mArray; + // Flag to indicate that the list is invalid + private boolean mClearPending; + // CallbackProxy to issue client callbacks. + private final CallbackProxy mCallbackProxy; + + /*package*/ WebBackForwardListClassic(CallbackProxy proxy) { + mCurrentIndex = -1; + mArray = new ArrayList(); + mCallbackProxy = proxy; + } + + public synchronized WebHistoryItemClassic getCurrentItem() { + return getItemAtIndex(mCurrentIndex); + } + + public synchronized int getCurrentIndex() { + return mCurrentIndex; + } + + public synchronized WebHistoryItemClassic getItemAtIndex(int index) { + if (index < 0 || index >= getSize()) { + return null; + } + return mArray.get(index); + } + + public synchronized int getSize() { + return mArray.size(); + } + + /** + * Mark the back/forward list as having a pending clear. This is used on the + * UI side to mark the list as being invalid during the clearHistory method. + */ + /*package*/ synchronized void setClearPending() { + mClearPending = true; + } + + /** + * Return the status of the clear flag. This is used on the UI side to + * determine if the list is valid for checking things like canGoBack. + */ + /*package*/ synchronized boolean getClearPending() { + return mClearPending; + } + + /** + * Add a new history item to the list. This will remove all items after the + * current item and append the new item to the end of the list. Called from + * the WebCore thread only. Synchronized because the UI thread may be + * reading the array or the current index. + * @param item A new history item. + */ + /*package*/ synchronized void addHistoryItem(WebHistoryItem item) { + // Update the current position because we are going to add the new item + // in that slot. + ++mCurrentIndex; + // If the current position is not at the end, remove all history items + // after the current item. + final int size = mArray.size(); + final int newPos = mCurrentIndex; + if (newPos != size) { + for (int i = size - 1; i >= newPos; i--) { + final WebHistoryItem h = mArray.remove(i); + } + } + // Add the item to the list. + mArray.add((WebHistoryItemClassic) item); + if (mCallbackProxy != null) { + mCallbackProxy.onNewHistoryItem(item); + } + } + + /** + * Clear the back/forward list. Called from the WebCore thread. + */ + /*package*/ synchronized void close(int nativeFrame) { + // Clear the array first because nativeClose will call addHistoryItem + // with the current item. + mArray.clear(); + mCurrentIndex = -1; + nativeClose(nativeFrame); + // Reset the clear flag + mClearPending = false; + } + + /* Remove the item at the given index. Called by JNI only. */ + private synchronized void removeHistoryItem(int index) { + // XXX: This is a special case. Since the callback is only triggered + // when removing the first item, we can assert that the index is 0. + // This lets us change the current index without having to query the + // native BackForwardList. + if (DebugFlags.WEB_BACK_FORWARD_LIST && (index != 0)) { + throw new AssertionError(); + } + final WebHistoryItem h = mArray.remove(index); + // XXX: If we ever add another callback for removing history items at + // any index, this will no longer be valid. + mCurrentIndex--; + } + + public synchronized WebBackForwardListClassic clone() { + WebBackForwardListClassic l = new WebBackForwardListClassic(null); + if (mClearPending) { + // If a clear is pending, return a copy with only the current item. + l.addHistoryItem(getCurrentItem()); + return l; + } + l.mCurrentIndex = mCurrentIndex; + int size = getSize(); + l.mArray = new ArrayList(size); + for (int i = 0; i < size; i++) { + // Add a copy of each WebHistoryItem + l.mArray.add(mArray.get(i).clone()); + } + return l; + } + + /** + * Set the new history index. + * @param newIndex The new history index. + */ + /*package*/ synchronized void setCurrentIndex(int newIndex) { + mCurrentIndex = newIndex; + if (mCallbackProxy != null) { + mCallbackProxy.onIndexChanged(getItemAtIndex(newIndex), newIndex); + } + } + + /** + * Restore the history index. + */ + /*package*/ static native synchronized void restoreIndex(int nativeFrame, + int index); + + /* Close the native list. */ + private static native void nativeClose(int nativeFrame); +} diff --git a/core/java/android/webkit/WebChromeClient.java b/core/java/android/webkit/WebChromeClient.java index 4e8790bf1e886..e93db0912fc9a 100644 --- a/core/java/android/webkit/WebChromeClient.java +++ b/core/java/android/webkit/WebChromeClient.java @@ -245,8 +245,8 @@ public void onExceededDatabaseQuota(String url, String databaseIdentifier, } /** - * Tell the client that the quota has been reached for the Application Cache - * API and request a new quota. The client must respond by invoking the + * Notify the host application that the Application Cache has reached the + * maximum size. The client must respond by invoking the * {@link WebStorage.QuotaUpdater#updateQuota(long) updateQuota(long)} * method of the supplied {@link WebStorage.QuotaUpdater} instance. The * minimum value that can be set for the new quota is the current quota. The @@ -255,7 +255,7 @@ public void onExceededDatabaseQuota(String url, String databaseIdentifier, * @param requiredStorage The amount of storage required by the Application * Cache operation that triggered this notification, * in bytes. - * @param quota The quota, in bytes + * @param quota the current maximum Application Cache size, in bytes * @param quotaUpdater An instance of {@link WebStorage.QuotaUpdater} which * must be used to inform the WebView of the new quota. */ @@ -297,7 +297,12 @@ public void onGeolocationPermissionsHidePrompt() {} * will continue to occur if the script does not finish at the next check * point. * @return boolean Whether the JavaScript execution should be interrupted. + * @deprecated This method is no longer supported and will not be invoked. */ + // This method was only called when using the JSC javascript engine. V8 became + // the default JS engine with Froyo and support for building with JSC was + // removed in b/5495373. V8 does not have a mechanism for making a callback such + // as this. public boolean onJsTimeout() { return true; } @@ -371,13 +376,6 @@ public void openFileChooser(ValueCallback uploadFile, String acceptType, St uploadFile.onReceiveValue(null); } - /** - * Tell the client that the page being viewed is web app capable, - * i.e. has specified the fullscreen-web-app-capable meta tag. - * @hide - */ - public void setInstallableWebApp() { } - /** * Tell the client that the page being viewed has an autofillable * form and the user would like to set a profile up. diff --git a/core/java/android/webkit/WebCoreThreadWatchdog.java b/core/java/android/webkit/WebCoreThreadWatchdog.java index a22e6e85a454c..c27bb5f3454c5 100644 --- a/core/java/android/webkit/WebCoreThreadWatchdog.java +++ b/core/java/android/webkit/WebCoreThreadWatchdog.java @@ -270,7 +270,7 @@ public void onCancel(DialogInterface dialog) { SUBSEQUENT_TIMEOUT_PERIOD); } }) - .setIcon(android.R.drawable.ic_dialog_alert) + .setIconAttribute(android.R.attr.alertDialogIcon) .show(); } } diff --git a/core/java/android/webkit/WebHistoryItem.java b/core/java/android/webkit/WebHistoryItem.java index 788d05c4d0bb2..9a588e411f3a4 100644 --- a/core/java/android/webkit/WebHistoryItem.java +++ b/core/java/android/webkit/WebHistoryItem.java @@ -18,9 +18,6 @@ import android.graphics.Bitmap; -import java.net.MalformedURLException; -import java.net.URL; - /** * A convenience class for accessing fields in an entry in the back/forward list * of a WebView. Each WebHistoryItem is a snapshot of the requested history @@ -28,67 +25,11 @@ * @see WebBackForwardList */ public class WebHistoryItem implements Cloneable { - // Global identifier count. - private static int sNextId = 0; - // Unique identifier. - private final int mId; - // A point to a native WebHistoryItem instance which contains the actual data - private int mNativeBridge; - // The favicon for this item. - private Bitmap mFavicon; - // The pre-flattened data used for saving the state. - private byte[] mFlattenedData; - // The apple-touch-icon url for use when adding the site to the home screen, - // as obtained from a element in the page. - private String mTouchIconUrlFromLink; - // If no is specified, this holds the default location of the - // apple-touch-icon. - private String mTouchIconUrlServerDefault; - // Custom client data that is not flattened or read by native code. - private Object mCustomData; - - /** - * Basic constructor that assigns a unique id to the item. Called by JNI - * only. - */ - private WebHistoryItem(int nativeBridge) { - synchronized (WebHistoryItem.class) { - mId = sNextId++; - } - mNativeBridge = nativeBridge; - nativeRef(mNativeBridge); - } - - protected void finalize() throws Throwable { - if (mNativeBridge != 0) { - nativeUnref(mNativeBridge); - mNativeBridge = 0; - } - } /** - * Construct a new WebHistoryItem with initial flattened data. - * @param data The pre-flattened data coming from restoreState. - */ - /*package*/ WebHistoryItem(byte[] data) { - mFlattenedData = data; - synchronized (WebHistoryItem.class) { - mId = sNextId++; - } - } - - /** - * Construct a clone of a WebHistoryItem from the given item. - * @param item The history item to clone. + * @hide */ - private WebHistoryItem(WebHistoryItem item) { - mFlattenedData = item.mFlattenedData; - mId = item.mId; - mFavicon = item.mFavicon; - mNativeBridge = item.mNativeBridge; - if (mNativeBridge != 0) { - nativeRef(mNativeBridge); - } + public WebHistoryItem() { } /** @@ -97,10 +38,11 @@ private WebHistoryItem(WebHistoryItem item) { * same object. * @return The id for this item. * @deprecated This method is now obsolete. + * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} */ @Deprecated public int getId() { - return mId; + throw new MustOverrideException(); } /** @@ -112,8 +54,7 @@ public int getId() { * to synchronize this method. */ public String getUrl() { - if (mNativeBridge == 0) return null; - return nativeGetUrl(mNativeBridge); + throw new MustOverrideException(); } /** @@ -123,8 +64,7 @@ public String getUrl() { * @return The original url of this history item. */ public String getOriginalUrl() { - if (mNativeBridge == 0) return null; - return nativeGetOriginalUrl(mNativeBridge); + throw new MustOverrideException(); } /** @@ -134,8 +74,7 @@ public String getOriginalUrl() { * to synchronize this method. */ public String getTitle() { - if (mNativeBridge == 0) return null; - return nativeGetTitle(mNativeBridge); + throw new MustOverrideException(); } /** @@ -145,119 +84,14 @@ public String getTitle() { * to synchronize this method. */ public Bitmap getFavicon() { - if (mFavicon == null && mNativeBridge != 0) { - mFavicon = nativeGetFavicon(mNativeBridge); - } - return mFavicon; - } - - /** - * Return the touch icon url. - * If no touch icon tag was specified, returns - * /apple-touch-icon.png. The DownloadTouchIcon class that - * attempts to retrieve the touch icon will handle the case where - * that file does not exist. An icon set by a tag is always - * used in preference to an icon saved on the server. - * @hide - */ - public String getTouchIconUrl() { - if (mTouchIconUrlFromLink != null) { - return mTouchIconUrlFromLink; - } else if (mTouchIconUrlServerDefault != null) { - return mTouchIconUrlServerDefault; - } - - try { - URL url = new URL(getOriginalUrl()); - mTouchIconUrlServerDefault = new URL(url.getProtocol(), url.getHost(), url.getPort(), - "/apple-touch-icon.png").toString(); - } catch (MalformedURLException e) { - return null; - } - return mTouchIconUrlServerDefault; - } - - /** - * Return the custom data provided by the client. - * @hide - */ - public Object getCustomData() { - return mCustomData; - } - - /** - * Set the custom data field. - * @param data An Object containing any data the client wishes to associate - * with the item. - * @hide - */ - public void setCustomData(Object data) { - // NOTE: WebHistoryItems are used in multiple threads. However, the - // public facing apis are all getters with the exception of this one - // api. Since this api is exclusive to clients, we don't make any - // promises about thread safety. - mCustomData = data; - } - - /** - * Set the favicon. - * @param icon A Bitmap containing the favicon for this history item. - * Note: The VM ensures 32-bit atomic read/write operations so we don't have - * to synchronize this method. - */ - /*package*/ void setFavicon(Bitmap icon) { - mFavicon = icon; - } - - /** - * Set the touch icon url. Will not overwrite an icon that has been - * set already from a tag, unless the new icon is precomposed. - * @hide - */ - /*package*/ void setTouchIconUrl(String url, boolean precomposed) { - if (precomposed || mTouchIconUrlFromLink == null) { - mTouchIconUrlFromLink = url; - } - } - - /** - * Get the pre-flattened data. - * Note: The VM ensures 32-bit atomic read/write operations so we don't have - * to synchronize this method. - */ - /*package*/ byte[] getFlattenedData() { - if (mNativeBridge != 0) { - return nativeGetFlattenedData(mNativeBridge); - } - return mFlattenedData; - } - - /** - * Inflate this item. - * Note: The VM ensures 32-bit atomic read/write operations so we don't have - * to synchronize this method. - */ - /*package*/ void inflate(int nativeFrame) { - mNativeBridge = inflate(nativeFrame, mFlattenedData); - mFlattenedData = null; + throw new MustOverrideException(); } /** * Clone the history item for use by clients of WebView. */ protected synchronized WebHistoryItem clone() { - return new WebHistoryItem(this); + throw new MustOverrideException(); } - /* Natively inflate this item, this method is called in the WebCore thread. - */ - private native int inflate(int nativeFrame, byte[] data); - private native void nativeRef(int nptr); - private native void nativeUnref(int nptr); - private native String nativeGetTitle(int nptr); - private native String nativeGetUrl(int nptr); - private native String nativeGetOriginalUrl(int nptr); - private native byte[] nativeGetFlattenedData(int nptr); - private native Bitmap nativeGetFavicon(int nptr); - } diff --git a/core/java/android/webkit/WebHistoryItemClassic.java b/core/java/android/webkit/WebHistoryItemClassic.java new file mode 100644 index 0000000000000..1620fbf9bc3ac --- /dev/null +++ b/core/java/android/webkit/WebHistoryItemClassic.java @@ -0,0 +1,221 @@ +/* + * 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.webkit; + +import android.graphics.Bitmap; + +import java.net.MalformedURLException; +import java.net.URL; + +/* package */ class WebHistoryItemClassic extends WebHistoryItem implements Cloneable { + // Global identifier count. + private static int sNextId = 0; + // Unique identifier. + private final int mId; + // A point to a native WebHistoryItem instance which contains the actual data + private int mNativeBridge; + // The favicon for this item. + private Bitmap mFavicon; + // The pre-flattened data used for saving the state. + private byte[] mFlattenedData; + // The apple-touch-icon url for use when adding the site to the home screen, + // as obtained from a element in the page. + private String mTouchIconUrlFromLink; + // If no is specified, this holds the default location of the + // apple-touch-icon. + private String mTouchIconUrlServerDefault; + // Custom client data that is not flattened or read by native code. + private Object mCustomData; + + /** + * Basic constructor that assigns a unique id to the item. Called by JNI + * only. + */ + private WebHistoryItemClassic(int nativeBridge) { + synchronized (WebHistoryItemClassic.class) { + mId = sNextId++; + } + mNativeBridge = nativeBridge; + nativeRef(mNativeBridge); + } + + protected void finalize() throws Throwable { + if (mNativeBridge != 0) { + nativeUnref(mNativeBridge); + mNativeBridge = 0; + } + } + + /** + * Construct a new WebHistoryItem with initial flattened data. + * @param data The pre-flattened data coming from restoreState. + */ + /*package*/ WebHistoryItemClassic(byte[] data) { + mFlattenedData = data; + synchronized (WebHistoryItemClassic.class) { + mId = sNextId++; + } + } + + /** + * Construct a clone of a WebHistoryItem from the given item. + * @param item The history item to clone. + */ + private WebHistoryItemClassic(WebHistoryItemClassic item) { + mFlattenedData = item.mFlattenedData; + mId = item.mId; + mFavicon = item.mFavicon; + mNativeBridge = item.mNativeBridge; + if (mNativeBridge != 0) { + nativeRef(mNativeBridge); + } + } + + @Deprecated + public int getId() { + return mId; + } + + public String getUrl() { + if (mNativeBridge == 0) return null; + return nativeGetUrl(mNativeBridge); + } + + public String getOriginalUrl() { + if (mNativeBridge == 0) return null; + return nativeGetOriginalUrl(mNativeBridge); + } + + public String getTitle() { + if (mNativeBridge == 0) return null; + return nativeGetTitle(mNativeBridge); + } + + public Bitmap getFavicon() { + if (mFavicon == null && mNativeBridge != 0) { + mFavicon = nativeGetFavicon(mNativeBridge); + } + return mFavicon; + } + + /** + * Return the touch icon url. + * If no touch icon tag was specified, returns + * /apple-touch-icon.png. The DownloadTouchIcon class that + * attempts to retrieve the touch icon will handle the case where + * that file does not exist. An icon set by a tag is always + * used in preference to an icon saved on the server. + * @hide + */ + public String getTouchIconUrl() { + if (mTouchIconUrlFromLink != null) { + return mTouchIconUrlFromLink; + } else if (mTouchIconUrlServerDefault != null) { + return mTouchIconUrlServerDefault; + } + + try { + URL url = new URL(getOriginalUrl()); + mTouchIconUrlServerDefault = new URL(url.getProtocol(), url.getHost(), url.getPort(), + "/apple-touch-icon.png").toString(); + } catch (MalformedURLException e) { + return null; + } + return mTouchIconUrlServerDefault; + } + + /** + * Return the custom data provided by the client. + * @hide + */ + public Object getCustomData() { + return mCustomData; + } + + /** + * Set the custom data field. + * @param data An Object containing any data the client wishes to associate + * with the item. + * @hide + */ + public void setCustomData(Object data) { + // NOTE: WebHistoryItems are used in multiple threads. However, the + // public facing apis are all getters with the exception of this one + // api. Since this api is exclusive to clients, we don't make any + // promises about thread safety. + mCustomData = data; + } + + /** + * Set the favicon. + * @param icon A Bitmap containing the favicon for this history item. + * Note: The VM ensures 32-bit atomic read/write operations so we don't have + * to synchronize this method. + */ + /*package*/ void setFavicon(Bitmap icon) { + mFavicon = icon; + } + + /** + * Set the touch icon url. Will not overwrite an icon that has been + * set already from a tag, unless the new icon is precomposed. + * @hide + */ + /*package*/ void setTouchIconUrl(String url, boolean precomposed) { + if (precomposed || mTouchIconUrlFromLink == null) { + mTouchIconUrlFromLink = url; + } + } + + /** + * Get the pre-flattened data. + * Note: The VM ensures 32-bit atomic read/write operations so we don't have + * to synchronize this method. + */ + /*package*/ byte[] getFlattenedData() { + if (mNativeBridge != 0) { + return nativeGetFlattenedData(mNativeBridge); + } + return mFlattenedData; + } + + /** + * Inflate this item. + * Note: The VM ensures 32-bit atomic read/write operations so we don't have + * to synchronize this method. + */ + /*package*/ void inflate(int nativeFrame) { + mNativeBridge = inflate(nativeFrame, mFlattenedData); + mFlattenedData = null; + } + + public synchronized WebHistoryItemClassic clone() { + return new WebHistoryItemClassic(this); + } + + /* Natively inflate this item, this method is called in the WebCore thread. + */ + private native int inflate(int nativeFrame, byte[] data); + private native void nativeRef(int nptr); + private native void nativeUnref(int nptr); + private native String nativeGetTitle(int nptr); + private native String nativeGetUrl(int nptr); + private native String nativeGetOriginalUrl(int nptr); + private native byte[] nativeGetFlattenedData(int nptr); + private native Bitmap nativeGetFavicon(int nptr); + +} diff --git a/core/java/android/webkit/WebSettings.java b/core/java/android/webkit/WebSettings.java index fa3cb2047a0c4..aa689044e510c 100644 --- a/core/java/android/webkit/WebSettings.java +++ b/core/java/android/webkit/WebSettings.java @@ -16,8 +16,7 @@ package android.webkit; -import android.os.Message; -import android.os.Build; +import android.content.Context; /** * Manages settings state for a WebView. When a WebView is first created, it @@ -94,30 +93,38 @@ public enum ZoomDensity { } /** - * Default cache usage pattern. Use with {@link #setCacheMode}. + * Default cache usage mode. If the navigation type doesn't impose any + * specific behavior, use cached resources when they are available + * and not expired, otherwise load resources from the network. + * Use with {@link #setCacheMode}. */ public static final int LOAD_DEFAULT = -1; /** - * Normal cache usage pattern. Use with {@link #setCacheMode}. + * Normal cache usage mode. Use with {@link #setCacheMode}. + * + * @deprecated This value is obsolete, as from API level + * {@link android.os.Build.VERSION_CODES#HONEYCOMB} and onwards it has the + * same effect as {@link #LOAD_DEFAULT}. */ + @Deprecated public static final int LOAD_NORMAL = 0; /** - * Use cache if content is there, even if expired (eg, history nav). - * If it is not in the cache, load from network. + * Use cached resources when they are available, even if they have expired. + * Otherwise load resources from the network. * Use with {@link #setCacheMode}. */ public static final int LOAD_CACHE_ELSE_NETWORK = 1; /** - * Don't use the cache, load from network. + * Don't use the cache, load from the network. * Use with {@link #setCacheMode}. */ public static final int LOAD_NO_CACHE = 2; /** - * Don't use the network, load from cache only. + * Don't use the network, load from the cache. * Use with {@link #setCacheMode}. */ public static final int LOAD_CACHE_ONLY = 3; @@ -153,9 +160,11 @@ protected WebSettings() { } /** - * Enables dumping the pages navigation cache to a text file. + * Enables dumping the pages navigation cache to a text file. The default + * is false. * * @deprecated This method is now obsolete. + * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} */ @Deprecated public void setNavDump(boolean enabled) { @@ -165,7 +174,10 @@ public void setNavDump(boolean enabled) { /** * Gets whether dumping the navigation cache is enabled. * + * @return whether dumping the navigation cache is enabled + * @see #setNavDump * @deprecated This method is now obsolete. + * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} */ @Deprecated public boolean getNavDump() { @@ -195,6 +207,26 @@ public boolean supportZoom() { throw new MustOverrideException(); } + /** + * Sets whether the WebView requires a user gesture to play media. + * The default is true. + * + * @param require whether the WebView requires a user gesture to play media + */ + public void setMediaPlaybackRequiresUserGesture(boolean require) { + throw new MustOverrideException(); + } + + /** + * Gets whether the WebView requires a user gesture to play media. + * + * @return true if the WebView requires a user gesture to play media + * @see #setMediaPlaybackRequiresUserGesture + */ + public boolean getMediaPlaybackRequiresUserGesture() { + throw new MustOverrideException(); + } + /** * Sets whether the WebView should use its built-in zoom mechanisms. The * built-in zoom mechanisms comprise on-screen zoom controls, which are @@ -285,14 +317,18 @@ public boolean getAllowContentAccess() { } /** - * Sets whether the WebView loads a page with overview mode. + * Sets whether the WebView loads pages in overview mode. The default is + * false. */ public void setLoadWithOverviewMode(boolean overview) { throw new MustOverrideException(); } /** - * Gets whether this WebView loads pages with overview mode. + * Gets whether this WebView loads pages in overview mode. + * + * @return whether this WebView loads pages in overview mode + * @see #setLoadWithOverviewMode */ public boolean getLoadWithOverviewMode() { throw new MustOverrideException(); @@ -304,7 +340,10 @@ public boolean getLoadWithOverviewMode() { * If it is true, WebView will choose a solution to maximize the performance. * e.g. the WebView's content may not be updated during the transition. * If it is false, WebView will keep its fidelity. The default value is false. + * + * @deprecated This method is now obsolete, and will become a no-op in future. */ + @Deprecated public void setEnableSmoothTransition(boolean enable) { throw new MustOverrideException(); } @@ -314,7 +353,10 @@ public void setEnableSmoothTransition(boolean enable) { * zooming. * * @see #setEnableSmoothTransition + * + * @deprecated This method is now obsolete, and will become a no-op in future. */ + @Deprecated public boolean enableSmoothTransition() { throw new MustOverrideException(); } @@ -325,6 +367,7 @@ public boolean enableSmoothTransition() { * internal pattern. Default is true. * * @deprecated This method is now obsolete. + * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} */ @Deprecated public void setUseWebViewBackgroundForOverscrollBackground(boolean view) { @@ -337,6 +380,7 @@ public void setUseWebViewBackgroundForOverscrollBackground(boolean view) { * * @see #setUseWebViewBackgroundForOverscrollBackground * @deprecated This method is now obsolete. + * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} */ @Deprecated public boolean getUseWebViewBackgroundForOverscrollBackground() { @@ -344,38 +388,45 @@ public boolean getUseWebViewBackgroundForOverscrollBackground() { } /** - * Sets whether the WebView is saving form data. + * Sets whether the WebView should save form data. The default is true, + * unless in private browsing mode, when the value is always false. */ public void setSaveFormData(boolean save) { throw new MustOverrideException(); } /** - * Gets whether the WebView is saving form data and displaying prior - * entries/autofill++. Always false in private browsing mode. + * Gets whether the WebView saves form data. Always false in private + * browsing mode. + * + * @return whether the WebView saves form data + * @see #setSaveFormData */ public boolean getSaveFormData() { throw new MustOverrideException(); } /** - * Stores whether the WebView is saving password. + * Sets whether the WebView should save passwords. The default is true. */ public void setSavePassword(boolean save) { throw new MustOverrideException(); } /** - * Gets whether the WebView is saving password. + * Gets whether the WebView saves passwords. + * + * @return whether the WebView saves passwords + * @see #setSavePassword */ public boolean getSavePassword() { throw new MustOverrideException(); } /** - * Sets the text zoom of the page in percent. Default is 100. + * Sets the text zoom of the page in percent. The default is 100. * - * @param textZoom the percent value for increasing or decreasing the text + * @param textZoom the text zoom in percent */ public synchronized void setTextZoom(int textZoom) { throw new MustOverrideException(); @@ -384,53 +435,65 @@ public synchronized void setTextZoom(int textZoom) { /** * Gets the text zoom of the page in percent. * - * @return a percent value describing the text zoom - * @see #setTextSizeZoom + * @return the text zoom of the page in percent + * @see #setTextZoom */ public synchronized int getTextZoom() { throw new MustOverrideException(); } /** - * Sets the text size of the page. + * Sets the text size of the page. The default is {@link TextSize#NORMAL}. * - * @param t the TextSize value for increasing or decreasing the text - * @see WebSettings.TextSize - * @deprecated Use {@link #setTextZoom(int)} instead. + * @param t the text size as a {@link TextSize} value + * @deprecated Use {@link #setTextZoom} instead. */ public synchronized void setTextSize(TextSize t) { - throw new MustOverrideException(); + setTextZoom(t.value); } /** * Gets the text size of the page. If the text size was previously specified - * in percent using {@link #setTextZoom(int)}, this will return - * the closest matching {@link TextSize}. + * in percent using {@link #setTextZoom}, this will return the closest + * matching {@link TextSize}. * - * @return a TextSize enum value describing the text size - * @see WebSettings.TextSize - * @deprecated Use {@link #getTextZoom()} instead. + * @return the text size as a {@link TextSize} value + * @see #setTextSize + * @deprecated Use {@link #getTextZoom} instead. */ public synchronized TextSize getTextSize() { - throw new MustOverrideException(); + TextSize closestSize = null; + int smallestDelta = Integer.MAX_VALUE; + int textSize = getTextZoom(); + for (TextSize size : TextSize.values()) { + int delta = Math.abs(textSize - size.value); + if (delta == 0) { + return size; + } + if (delta < smallestDelta) { + smallestDelta = delta; + closestSize = size; + } + } + return closestSize != null ? closestSize : TextSize.NORMAL; } /** - * Sets the default zoom density of the page. This should be called from UI - * thread. + * Sets the default zoom density of the page. This must be called from the UI + * thread. The default is {@link ZoomDensity#MEDIUM}. * - * @param zoom a ZoomDensity value - * @see WebSettings.ZoomDensity + * @param zoom the zoom density */ public void setDefaultZoom(ZoomDensity zoom) { throw new MustOverrideException(); } /** - * Gets the default zoom density of the page. This should be called from UI - * thread. - * @return a ZoomDensity value - * @see WebSettings.ZoomDensity + * Gets the default zoom density of the page. This should be called from + * the UI thread. + * + * @return the zoom density + * @see #setDefaultZoom */ public ZoomDensity getDefaultZoom() { throw new MustOverrideException(); @@ -438,6 +501,7 @@ public ZoomDensity getDefaultZoom() { /** * Enables using light touches to make a selection and activate mouseovers. + * The default is false. */ public void setLightTouchEnabled(boolean enabled) { throw new MustOverrideException(); @@ -445,6 +509,9 @@ public void setLightTouchEnabled(boolean enabled) { /** * Gets whether light touches are enabled. + * + * @return whether light touches are enabled + * @see #setLightTouchEnabled */ public boolean getLightTouchEnabled() { throw new MustOverrideException(); @@ -455,6 +522,7 @@ public boolean getLightTouchEnabled() { * it now has no effect. * * @deprecated This setting now has no effect. + * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} */ @Deprecated public synchronized void setUseDoubleTree(boolean use) { @@ -466,6 +534,7 @@ public synchronized void setUseDoubleTree(boolean use) { * it now has no effect. * * @deprecated This setting now has no effect. + * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} */ @Deprecated public synchronized boolean getUseDoubleTree() { @@ -474,11 +543,17 @@ public synchronized boolean getUseDoubleTree() { } /** - * Tells the WebView about user-agent string. + * Sets the user-agent string using an integer code. + *
            + *
          • 0 means the WebView should use an Android user-agent string
          • + *
          • 1 means the WebView should use a desktop user-agent string
          • + *
          + * Other values are ignored. The default is an Android user-agent string, + * i.e. code value 0. * - * @param ua 0 if the WebView should use an Android user-agent string, - * 1 if the WebView should use a desktop user-agent string - * @deprecated Please use setUserAgentString instead. + * @param ua the integer code for the user-agent string + * @deprecated Please use {@link #setUserAgentString} instead. + * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} */ @Deprecated public synchronized void setUserAgent(int ua) { @@ -486,12 +561,18 @@ public synchronized void setUserAgent(int ua) { } /** - * Gets the user-agent as an int. + * Gets the user-agent as an integer code. + *
            + *
          • -1 means the WebView is using a custom user-agent string set with + * {@link #setUserAgentString}
          • + *
          • 0 means the WebView should use an Android user-agent string
          • + *
          • 1 means the WebView should use a desktop user-agent string
          • + *
          * - * @return 0 if the WebView is using an Android user-agent string, - * 1 if the WebView is using a desktop user-agent string, - * -1 if the WebView is using user defined user-agent string - * @deprecated Please use getUserAgentString instead. + * @return the integer code for the user-agent string + * @see #setUserAgent + * @deprecated Please use {@link #getUserAgentString} instead. + * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} */ @Deprecated public synchronized int getUserAgent() { @@ -499,7 +580,9 @@ public synchronized int getUserAgent() { } /** - * Tells the WebView to use the wide viewport. + * Tells the WebView to use a wide viewport. The default is false. + * + * @param use whether to use a wide viewport */ public synchronized void setUseWideViewPort(boolean use) { throw new MustOverrideException(); @@ -509,26 +592,28 @@ public synchronized void setUseWideViewPort(boolean use) { * Gets whether the WebView is using a wide viewport. * * @return true if the WebView is using a wide viewport + * @see #setUseWideViewPort */ public synchronized boolean getUseWideViewPort() { throw new MustOverrideException(); } /** - * Tells the WebView whether it supports multiple windows. TRUE means - * that {@link WebChromeClient#onCreateWindow(WebView, boolean, - * boolean, Message)} is implemented by the host application. + * Sets whether the WebView whether supports multiple windows. If set to + * true, {@link WebChromeClient#onCreateWindow} must be implemented by the + * host application. The default is false. + * + * @param support whether to suport multiple windows */ public synchronized void setSupportMultipleWindows(boolean support) { throw new MustOverrideException(); } /** - * Gets whether the WebView is supporting multiple windows. + * Gets whether the WebView supports multiple windows. * - * @return true if the WebView is supporting multiple windows. This means - * that {@link WebChromeClient#onCreateWindow(WebView, boolean, - * boolean, Message)} is implemented by the host application. + * @return true if the WebView supports multiple windows + * @see #setSupportMultipleWindows */ public synchronized boolean supportMultipleWindows() { throw new MustOverrideException(); @@ -536,10 +621,9 @@ public synchronized boolean supportMultipleWindows() { /** * Sets the underlying layout algorithm. This will cause a relayout of the - * WebView. The default is NARROW_COLUMNS. + * WebView. The default is {@link LayoutAlgorithm#NARROW_COLUMNS}. * - * @param l a LayoutAlgorithm enum specifying the algorithm to use - * @see WebSettings.LayoutAlgorithm + * @param l the layout algorithm to use, as a {@link LayoutAlgorithm} value */ public synchronized void setLayoutAlgorithm(LayoutAlgorithm l) { throw new MustOverrideException(); @@ -548,10 +632,8 @@ public synchronized void setLayoutAlgorithm(LayoutAlgorithm l) { /** * Gets the current layout algorithm. * - * @return a LayoutAlgorithm enum value describing the layout algorithm - * being used + * @return the layout algorithm in use, as a {@link LayoutAlgorithm} value * @see #setLayoutAlgorithm - * @see WebSettings.LayoutAlgorithm */ public synchronized LayoutAlgorithm getLayoutAlgorithm() { throw new MustOverrideException(); @@ -596,7 +678,7 @@ public synchronized String getFixedFontFamily() { } /** - * Sets the sans-serif font family name. + * Sets the sans-serif font family name. The default is "sans-serif". * * @param font a font family name */ @@ -608,6 +690,7 @@ public synchronized void setSansSerifFontFamily(String font) { * Gets the sans-serif font family name. * * @return the sans-serif font family name as a string + * @see #setSansSerifFontFamily */ public synchronized String getSansSerifFontFamily() { throw new MustOverrideException(); @@ -883,9 +966,9 @@ public synchronized void setJavaScriptEnabled(boolean flag) { public abstract void setAllowFileAccessFromFileURLs(boolean flag); /** - * Tells the WebView to enable plugins. + * Sets whether the WebView should enable plugins. The default is false. * - * @param flag true if the WebView should load plugins + * @param flag true if plugins should be enabled * @deprecated This method has been deprecated in favor of * {@link #setPluginState} */ @@ -898,7 +981,8 @@ public synchronized void setPluginsEnabled(boolean flag) { * Tells the WebView to enable, disable, or have plugins on demand. On * demand mode means that if a plugin exists that can handle the embedded * content, a placeholder icon will be shown instead of the plugin. When - * the placeholder is clicked, the plugin will be enabled. + * the placeholder is clicked, the plugin will be enabled. The default is + * {@link PluginState#OFF}. * * @param state a PluginState value */ @@ -921,23 +1005,27 @@ public synchronized void setPluginsPath(String pluginsPath) { /** * Sets the path to where database storage API databases should be saved. - * Note that the WebCore Database Tracker only allows the path to be set once. + * In order for the database storage API to function correctly, this method + * must be called with a path to which the application can write. This + * method should only be called once: repeated calls are ignored. * - * @param databasePath a String path to the directory where databases should - * be saved. May be the empty string but should never - * be null. + * @param databasePath a path to the directory where databases should be + * saved. */ // This will update WebCore when the Sync runs in the C++ side. + // Note that the WebCore Database Tracker only allows the path to be set + // once. public synchronized void setDatabasePath(String databasePath) { throw new MustOverrideException(); } /** - * Sets the path where the Geolocation permissions database should be saved. + * Sets the path where the Geolocation databases should be saved. In order + * for Geolocation permissions and cached positions to be persisted, this + * method must be called with a path to which the application can write. * - * @param databasePath a String path to the directory where the Geolocation - * permissions database should be saved. May be the - * empty string but should never be null. + * @param databasePath a path to the directory where databases should be + * saved. */ // This will update WebCore when the Sync runs in the C++ side. public synchronized void setGeolocationDatabasePath(String databasePath) { @@ -945,7 +1033,10 @@ public synchronized void setGeolocationDatabasePath(String databasePath) { } /** - * Tells the WebView to enable Application Caches API. + * Sets whether the Application Caches API should be enabled. The default + * is false. Note that in order for the Application Caches API to be + * enabled, a valid database path must also be supplied to + * {@link #setAppCachePath}. * * @param flag true if the WebView should enable Application Caches */ @@ -954,20 +1045,25 @@ public synchronized void setAppCacheEnabled(boolean flag) { } /** - * Sets a custom path to the Application Caches files. The client - * must ensure it exists before this call. + * Sets the path to the Application Caches files. In order for the + * Application Caches API to be enabled, this method must be called with a + * path to which the application can write. This method should only be + * called once: repeated calls are ignored. * * @param appCachePath a String path to the directory containing - * Application Caches files. The appCache path can be - * the empty string but should not be null. Passing - * null for this parameter will result in a no-op. + * Application Caches files. + * @see setAppCacheEnabled */ public synchronized void setAppCachePath(String appCachePath) { throw new MustOverrideException(); } /** - * Sets the maximum size for the Application Caches content. + * Sets the maximum size for the Application Cache content. The passed size + * will be rounded to the nearest value that the database can support, so + * this should be viewed as a guide, not a hard limit. Setting the + * size to a value less than current database size does not cause the + * database to be trimmed. The default size is {@link Long#MAX_VALUE}. * * @param appCacheMaxSize the maximum size in bytes */ @@ -976,7 +1072,9 @@ public synchronized void setAppCacheMaxSize(long appCacheMaxSize) { } /** - * Sets whether the database storage API is enabled. + * Sets whether the database storage API is enabled. The default value is + * false. See also {@link #setDatabasePath} for how to correctly set up the + * database storage API. * * @param flag true if the WebView should use the database storage API */ @@ -985,7 +1083,7 @@ public synchronized void setDatabaseEnabled(boolean flag) { } /** - * Sets whether the DOM storage API is enabled. + * Sets whether the DOM storage API is enabled. The default value is false. * * @param flag true if the WebView should use the DOM storage API */ @@ -997,15 +1095,16 @@ public synchronized void setDomStorageEnabled(boolean flag) { * Gets whether the DOM Storage APIs are enabled. * * @return true if the DOM Storage APIs are enabled + * @see #setDomStorageEnabled */ public synchronized boolean getDomStorageEnabled() { throw new MustOverrideException(); } /** - * Gets the path to where database storage API databases are saved for - * the current WebView. + * Gets the path to where database storage API databases are saved. * * @return the String path to the database storage API databases + * @see #setDatabasePath */ public synchronized String getDatabasePath() { throw new MustOverrideException(); @@ -1015,13 +1114,16 @@ public synchronized String getDatabasePath() { * Gets whether the database storage API is enabled. * * @return true if the database storage API is enabled + * @see #setDatabaseEnabled */ public synchronized boolean getDatabaseEnabled() { throw new MustOverrideException(); } /** - * Sets whether Geolocation is enabled. + * Sets whether Geolocation is enabled. The default is true. See also + * {@link #setGeolocationDatabasePath} for how to correctly set up + * Geolocation. * * @param flag whether Geolocation should be enabled */ @@ -1064,6 +1166,7 @@ public synchronized boolean getJavaScriptEnabled() { * Gets whether plugins are enabled. * * @return true if plugins are enabled + * @see #setPluginsEnabled * @deprecated This method has been replaced by {@link #getPluginState} */ @Deprecated @@ -1072,9 +1175,10 @@ public synchronized boolean getPluginsEnabled() { } /** - * Gets the current plugin state. + * Gets the current state regarding whether plugins are enabled. * - * @return a value corresponding to the enum PluginState + * @return the plugin state as a {@link PluginState} value + * @see #setPluginState */ public synchronized PluginState getPluginState() { throw new MustOverrideException(); @@ -1135,8 +1239,8 @@ public synchronized String getDefaultTextEncodingName() { } /** - * Sets the WebView's user-agent string. If the string "ua" is null or empty, - * it will use the system default user-agent string. + * Sets the WebView's user-agent string. If the string is null or empty, + * the system default value will be used. */ public synchronized void setUserAgentString(String ua) { throw new MustOverrideException(); @@ -1144,14 +1248,29 @@ public synchronized void setUserAgentString(String ua) { /** * Gets the WebView's user-agent string. + * + * @return the WebView's user-agent string + * @see #setUserAgentString */ public synchronized String getUserAgentString() { throw new MustOverrideException(); } + /** + * Returns the default User-Agent used by a WebView. + * An instance of WebView could use a different User-Agent if a call + * is made to {@link WebSettings#setUserAgentString(String)}. + * + * @param context a Context object used to access application assets + */ + public static String getDefaultUserAgent(Context context) { + return WebViewFactory.getProvider().getStatics().getDefaultUserAgent(context); + } + /** * Tells the WebView whether it needs to set a node to have focus when - * {@link WebView#requestFocus(int, android.graphics.Rect)} is called. + * {@link WebView#requestFocus(int, android.graphics.Rect)} is called. The + * default value is true. * * @param flag whether the WebView needs to set a node */ @@ -1161,9 +1280,10 @@ public void setNeedInitialFocus(boolean flag) { /** * Sets the priority of the Render thread. Unlike the other settings, this - * one only needs to be called once per process. The default is NORMAL. + * one only needs to be called once per process. The default value is + * {@link RenderPriority#NORMAL}. * - * @param priority a RenderPriority + * @param priority the priority */ public synchronized void setRenderPriority(RenderPriority priority) { throw new MustOverrideException(); @@ -1171,20 +1291,25 @@ public synchronized void setRenderPriority(RenderPriority priority) { /** * Overrides the way the cache is used. The way the cache is used is based - * on the navigation option. For a normal page load, the cache is checked + * on the navigation type. For a normal page load, the cache is checked * and content is re-validated as needed. When navigating back, content is - * not revalidated, instead the content is just pulled from the cache. - * This function allows the client to override this behavior. + * not revalidated, instead the content is just retrieved from the cache. + * This method allows the client to override this behavior by specifying + * one of {@link #LOAD_DEFAULT}, {@link #LOAD_NORMAL}, + * {@link #LOAD_CACHE_ELSE_NETWORK}, {@link #LOAD_NO_CACHE} or + * {@link #LOAD_CACHE_ONLY}. The default value is {@link #LOAD_DEFAULT}. * - * @param mode one of the LOAD_ values + * @param mode the mode to use */ public void setCacheMode(int mode) { throw new MustOverrideException(); } /** - * Gets the current setting for overriding the cache mode. For a full - * description, see the {@link #setCacheMode(int)} function. + * Gets the current setting for overriding the cache mode. + * + * @return the current setting for overriding the cache mode + * @see #setCacheMode */ public int getCacheMode() { throw new MustOverrideException(); diff --git a/core/java/android/webkit/WebSettingsClassic.java b/core/java/android/webkit/WebSettingsClassic.java index 1288613a3918d..878c1649d5139 100644 --- a/core/java/android/webkit/WebSettingsClassic.java +++ b/core/java/android/webkit/WebSettingsClassic.java @@ -22,6 +22,7 @@ import android.os.Build; import android.os.Handler; import android.os.Message; +import android.os.SystemProperties; import android.provider.Settings; import android.provider.Settings.SettingNotFoundException; import android.util.EventLog; @@ -34,7 +35,7 @@ */ public class WebSettingsClassic extends WebSettings { // TODO: Keep this up to date - private static final String PREVIOUS_VERSION = "4.0.4"; + private static final String PREVIOUS_VERSION = "4.1.1"; // WebView associated with this WebSettings. private WebViewClassic mWebView; @@ -116,6 +117,7 @@ public class WebSettingsClassic extends WebSettings { private boolean mNeedInitialFocus = true; private boolean mNavDump = false; private boolean mSupportZoom = true; + private boolean mMediaPlaybackRequiresUserGesture = true; private boolean mBuiltInZoomControls = false; private boolean mDisplayZoomControls = true; private boolean mAllowFileAccess = true; @@ -373,6 +375,21 @@ private synchronized String getCurrentUserAgent() { synchronized(sLockForLocaleSettings) { locale = sLocale; } + return getDefaultUserAgentForLocale(mContext, locale); + } + + /** + * Returns the default User-Agent used by a WebView. + * An instance of WebView could use a different User-Agent if a call + * is made to {@link WebSettings#setUserAgent(int)} or + * {@link WebSettings#setUserAgentString(String)}. + * + * @param context a Context object used to access application assets + * @param locale The Locale to use in the User-Agent string. + * @see WebViewFactoryProvider#getDefaultUserAgent(Context) + * @see WebView#getDefaultUserAgent(Context) + */ + public static String getDefaultUserAgentForLocale(Context context, Locale locale) { StringBuffer buffer = new StringBuffer(); // Add version final String version = Build.VERSION.RELEASE; @@ -416,9 +433,12 @@ private synchronized String getCurrentUserAgent() { buffer.append(" Build/"); buffer.append(id); } - String mobile = mContext.getResources().getText( + final String cmversion = SystemProperties.get("ro.cm.version"); + if (cmversion != null && cmversion.length() > 0) + buffer.append("; CyanogenMod-" + cmversion.replaceAll("([0-9\\.]+?)-.*","$1")); + String mobile = context.getResources().getText( com.android.internal.R.string.web_user_agent_target_content).toString(); - final String base = mContext.getResources().getText( + final String base = context.getResources().getText( com.android.internal.R.string.web_user_agent).toString(); return String.format(base, buffer, mobile); } @@ -458,6 +478,25 @@ public boolean supportZoom() { return mSupportZoom; } + /** + * @see android.webkit.WebSettings#setMediaPlaybackRequiresUserGesture(boolean) + */ + @Override + public void setMediaPlaybackRequiresUserGesture(boolean support) { + if (mMediaPlaybackRequiresUserGesture != support) { + mMediaPlaybackRequiresUserGesture = support; + postSync(); + } + } + + /** + * @see android.webkit.WebSettings#getMediaPlaybackRequiresUserGesture() + */ + @Override + public boolean getMediaPlaybackRequiresUserGesture() { + return mMediaPlaybackRequiresUserGesture; + } + /** * @see android.webkit.WebSettings#setBuiltInZoomControls(boolean) */ @@ -629,34 +668,6 @@ public synchronized int getTextZoom() { return mTextSize; } - /** - * @see android.webkit.WebSettings#setTextSize(android.webkit.WebSettingsClassic.TextSize) - */ - @Override - public synchronized void setTextSize(TextSize t) { - setTextZoom(t.value); - } - - /** - * @see android.webkit.WebSettings#getTextSize() - */ - @Override - public synchronized TextSize getTextSize() { - TextSize closestSize = null; - int smallestDelta = Integer.MAX_VALUE; - for (TextSize size : TextSize.values()) { - int delta = Math.abs(mTextSize - size.value); - if (delta == 0) { - return size; - } - if (delta < smallestDelta) { - smallestDelta = delta; - closestSize = size; - } - } - return closestSize != null ? closestSize : TextSize.NORMAL; - } - /** * Set the double-tap zoom of the page in percent. Default is 100. * @param doubleTapZoom A percent value for increasing or decreasing the double-tap zoom. @@ -1115,6 +1126,7 @@ public synchronized void setJavaScriptEnabled(boolean flag) { if (mJavaScriptEnabled != flag) { mJavaScriptEnabled = flag; postSync(); + mWebView.updateJavaScriptEnabled(flag); } } diff --git a/core/java/android/webkit/WebStorage.java b/core/java/android/webkit/WebStorage.java index 76674f42194b3..1e955bd3b2ef5 100644 --- a/core/java/android/webkit/WebStorage.java +++ b/core/java/android/webkit/WebStorage.java @@ -23,17 +23,22 @@ * {@link WebView}. It manages the Application Cache API, the Web SQL Database * API and the HTML5 Web Storage API. * - * The Web SQL Database API provides storage which is private to a given - * origin, where an origin comprises the host, scheme and port of a URI. - * Similarly, use of the Application Cache API can be attributed to an origin. - * This class provides access to the storage use and quotas for these APIs for - * a given origin. Origins are represented using {@link WebStorage.Origin}. + * The Application Cache API provides a mechanism to create and maintain an + * application cache to power offline Web applications. Use of the Application + * Cache API can be attributed to an origin {@link WebStorage.Origin}, however + * it is not possible to set per-origin quotas. Note that there can be only + * one application cache per application. + * + * The Web SQL Database API provides storage which is private to a given origin. + * Similar to the Application Cache, use of the Web SQL Database can be attributed + * to an origin. It is also possible to set per-origin quotas. */ public class WebStorage { /** * Encapsulates a callback function which is used to provide a new quota - * for a JavaScript storage API. See + * for a JavaScript storage API. + * See * {@link WebChromeClient#onExceededDatabaseQuota} and * {@link WebChromeClient#onReachedMaxAppCacheSize}. */ @@ -54,6 +59,7 @@ public interface QuotaUpdater { /** * This class encapsulates information about the amount of storage * currently used by an origin for the JavaScript storage APIs. + * An origin comprises the host, scheme and port of a URI. * See {@link WebStorage} for details. */ public static class Origin { diff --git a/core/java/android/webkit/WebSyncManager.java b/core/java/android/webkit/WebSyncManager.java index 38b5e5caf7063..d3ec6031ace47 100644 --- a/core/java/android/webkit/WebSyncManager.java +++ b/core/java/android/webkit/WebSyncManager.java @@ -37,9 +37,6 @@ abstract class WebSyncManager implements Runnable { // handler of the sync thread protected Handler mHandler; // database for the persistent storage - // Note that this remains uninitialised as it is unused. We cannot remove - // the member as it leaked into the public API via CookieSyncManager. - // TODO: hide this member, ditto for mHandler. protected WebViewDatabase mDataBase; // Ref count for calls to start/stop sync private int mStartSyncRefCount; @@ -65,6 +62,7 @@ public void handleMessage(Message msg) { protected WebSyncManager(Context context, String name) { mThreadName = name; if (context != null) { + mDataBase = WebViewDatabase.getInstance(context); mSyncThread = new Thread(this); mSyncThread.setName(mThreadName); mSyncThread.start(); diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index e4936532a0b8d..6df78204bb4f4 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -35,8 +35,8 @@ import android.view.KeyEvent; import android.view.MotionEvent; import android.view.View; +import android.view.ViewDebug; import android.view.ViewGroup; -import android.view.ViewGroup.LayoutParams; import android.view.ViewTreeObserver; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityNodeInfo; @@ -44,6 +44,7 @@ import android.view.inputmethod.InputConnection; import android.widget.AbsoluteLayout; +import java.io.BufferedWriter; import java.io.File; import java.util.Map; @@ -163,10 +164,7 @@ * *

          For obvious security reasons, your application has its own * cache, cookie store etc.—it does not share the Browser - * application's data. Cookies are managed on a separate thread, so - * operations like index building don't block the UI - * thread. Follow the instructions in {@link android.webkit.CookieSyncManager} - * if you want to use cookies in your application. + * application's data. *

          * *

          By default, requests by the HTML to open new windows are @@ -263,7 +261,7 @@ @Widget public class WebView extends AbsoluteLayout implements ViewTreeObserver.OnGlobalFocusChangeListener, - ViewGroup.OnHierarchyChangeListener { + ViewGroup.OnHierarchyChangeListener, ViewDebug.HierarchyHandler { private static final String LOGTAG = "webview_proxy"; @@ -312,15 +310,15 @@ public interface FindListener { /** * Notifies the listener about progress made by a find operation. * - * @param numberOfMatches how many matches have been found * @param activeMatchOrdinal the zero-based ordinal of the currently selected match + * @param numberOfMatches how many matches have been found * @param isDoneCounting whether the find operation has actually completed. The listener * may be notified multiple times while the * operation is underway, and the numberOfMatches * value should not be considered final unless * isDoneCounting is true. */ - public void onFindResultReceived(int numberOfMatches, int activeMatchOrdinal, + public void onFindResultReceived(int activeMatchOrdinal, int numberOfMatches, boolean isDoneCounting); } @@ -332,16 +330,12 @@ public void onFindResultReceived(int numberOfMatches, int activeMatchOrdinal, @Deprecated public interface PictureListener { /** - * Notifies the listener that the picture has changed. + * Used to provide notification that the WebView's picture has changed. + * See {@link WebView#capturePicture} for details of the picture. * * @param view the WebView that owns the picture * @param picture the new picture - * @deprecated Due to internal changes, the picture does not include - * composited layers such as fixed position elements or - * scrollable divs. While the PictureListener API can still - * be used to detect changes in the WebView content, you - * are advised against its usage until a replacement is - * provided in a future Android release. + * @deprecated Deprecated due to internal changes. */ @Deprecated public void onNewPicture(WebView view, Picture picture); @@ -475,7 +469,13 @@ public WebView(Context context, AttributeSet attrs, int defStyle) { * @param defStyle the default style resource ID * @param privateBrowsing whether this WebView will be initialized in * private mode + * + * @deprecated Private browsing is no longer supported directly via + * WebView and will be removed in a future release. Prefer using + * {@link WebSettings}, {@link WebViewDatabase}, {@link CookieManager} + * and {@link WebStorage} for fine-grained control of privacy data. */ + @Deprecated public WebView(Context context, AttributeSet attrs, int defStyle, boolean privateBrowsing) { this(context, attrs, defStyle, null, privateBrowsing); @@ -555,6 +555,7 @@ public boolean overlayVerticalScrollbar() { * Gets the visible height (in pixels) of the embedded title bar (if any). * * @deprecated This method is now obsolete. + * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} */ public int getVisibleTitleHeight() { checkThread(); @@ -574,7 +575,11 @@ public SslCertificate getCertificate() { /** * Sets the SSL certificate for the main top-level page. + * + * @deprecated Calling this function has no useful effect, and will be + * ignored in future releases. */ + @Deprecated public void setCertificate(SslCertificate certificate) { checkThread(); mProvider.setCertificate(certificate); @@ -585,12 +590,16 @@ public void setCertificate(SslCertificate certificate) { //------------------------------------------------------------------------- /** - * Saves the username and password for a particular host in this WebView's - * internal database. + * Sets a username and password pair for the specified host. This data is + * used by the Webview to autocomplete username and password fields in web + * forms. Note that this is unrelated to the credentials used for HTTP + * authentication. * * @param host the host that required the credentials * @param username the username for the given host * @param password the password for the given host + * @see WebViewDatabase#clearUsernamePassword + * @see WebViewDatabase#hasUsernamePassword */ public void savePassword(String host, String username, String password) { checkThread(); @@ -598,13 +607,17 @@ public void savePassword(String host, String username, String password) { } /** - * Sets the HTTP authentication credentials for a given host and realm. + * Stores HTTP authentication credentials for a given host and realm. This + * method is intended to be used with + * {@link WebViewClient#onReceivedHttpAuthRequest}. * - * @param host the host for the credentials - * @param realm the realm for the credentials - * @param username the username for the password. If it is null, it means - * password can't be saved. + * @param host the host to which the credentials apply + * @param realm the realm to which the credentials apply + * @param username the username * @param password the password + * @see getHttpAuthUsernamePassword + * @see WebViewDatabase#hasHttpAuthUsernamePassword + * @see WebViewDatabase#clearHttpAuthUsernamePassword */ public void setHttpAuthUsernamePassword(String host, String realm, String username, String password) { @@ -613,13 +626,18 @@ public void setHttpAuthUsernamePassword(String host, String realm, } /** - * Retrieves the HTTP authentication username and password for a given - * host and realm pair + * Retrieves HTTP authentication credentials for a given host and realm. + * This method is intended to be used with + * {@link WebViewClient#onReceivedHttpAuthRequest}. * - * @param host the host for which the credentials apply - * @param realm the realm for which the credentials apply - * @return String[] if found. String[0] is username, which can be null and - * String[1] is password. Return null if it can't find anything. + * @param host the host to which the credentials apply + * @param realm the realm to which the credentials apply + * @return the credentials as a String array, if found. The first element + * is the username and the second element is the password. Null if + * no credentials are found. + * @see setHttpAuthUsernamePassword + * @see WebViewDatabase#hasHttpAuthUsernamePassword + * @see WebViewDatabase#clearHttpAuthUsernamePassword */ public String[] getHttpAuthUsernamePassword(String host, String realm) { checkThread(); @@ -641,6 +659,7 @@ public void destroy() { * Notifications are enabled by default. * * @deprecated This method is now obsolete. + * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} */ @Deprecated public static void enablePlatformNotifications() { @@ -653,6 +672,7 @@ public static void enablePlatformNotifications() { * Notifications are enabled by default. * * @deprecated This method is now obsolete. + * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} */ @Deprecated public static void disablePlatformNotifications() { @@ -677,14 +697,11 @@ public void setNetworkAvailable(boolean networkUp) { * {@link android.app.Activity#onSaveInstanceState}. Please note that this * method no longer stores the display data for this WebView. The previous * behavior could potentially leak files if {@link #restoreState} was never - * called. See {@link #savePicture} and {@link #restorePicture} for saving - * and restoring the display data. + * called. * * @param outState the Bundle to store this WebView's state * @return the same copy of the back/forward list used to save the state. If * saveState fails, the returned list will be null. - * @see #savePicture - * @see #restorePicture */ public WebBackForwardList saveState(Bundle outState) { checkThread(); @@ -699,6 +716,7 @@ public WebBackForwardList saveState(Bundle outState) { * overwritten with this WebView's picture data. * @return true if the picture was successfully saved * @deprecated This method is now obsolete. + * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} */ @Deprecated public boolean savePicture(Bundle b, final File dest) { @@ -715,6 +733,7 @@ public boolean savePicture(Bundle b, final File dest) { * @param src the file where the picture data was stored * @return true if the picture was successfully restored * @deprecated This method is now obsolete. + * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} */ @Deprecated public boolean restorePicture(Bundle b, File src) { @@ -723,19 +742,16 @@ public boolean restorePicture(Bundle b, File src) { } /** - * Restores the state of this WebView from the given map used in - * {@link android.app.Activity#onRestoreInstanceState}. This method should - * be called to restore the state of this WebView before using the object. If + * Restores the state of this WebView from the given Bundle. This method is + * intended for use in {@link android.app.Activity#onRestoreInstanceState} + * and should be called to restore the state of this WebView. If * it is called after this WebView has had a chance to build state (load * pages, create a back/forward list, etc.) there may be undesirable * side-effects. Please note that this method no longer restores the - * display data for this WebView. See {@link #savePicture} and {@link - * #restorePicture} for saving and restoring the display data. + * display data for this WebView. * * @param inState the incoming Bundle of state * @return the restored back/forward list or null if restoreState failed - * @see #savePicture - * @see #restorePicture */ public WebBackForwardList restoreState(Bundle inState) { checkThread(); @@ -791,11 +807,13 @@ public void postUrl(String url, byte[] postData) { * #loadDataWithBaseURL(String,String,String,String,String) * loadDataWithBaseURL()} with an appropriate base URL. *

          - * If the value of the encoding parameter is 'base64', then the data must - * be encoded as base64. Otherwise, the data must use ASCII encoding for + * The encoding parameter specifies whether the data is base64 or URL + * encoded. If the data is base64 encoded, the value of the encoding + * parameter must be 'base64'. For all other values of the parameter, + * including null, it is assumed that the data uses ASCII encoding for * octets inside the range of safe URL characters and use the standard %xx - * hex encoding of URLs for octets outside that range. For example, - * '#', '%', '\', '?' should be replaced by %23, %25, %27, %3f respectively. + * hex encoding of URLs for octets outside that range. For example, '#', + * '%', '\', '?' should be replaced by %23, %25, %27, %3f respectively. *

          * The 'data' scheme URL formed by this method uses the default US-ASCII * charset. If you need need to set a different charset, you should form a @@ -986,13 +1004,18 @@ public void clearView() { } /** - * Gets a new picture that captures the current display of this WebView. - * This is a copy of the display, and will be unaffected if this WebView - * later loads a different URL. + * Gets a new picture that captures the current contents of this WebView. + * The picture is of the entire document being displayed, and is not + * limited to the area currently displayed by this WebView. Also, the + * picture is a static copy and is unaffected by later changes to the + * content being displayed. + *

          + * Note that due to internal changes, for API levels between + * {@link android.os.Build.VERSION_CODES#HONEYCOMB} and + * {@link android.os.Build.VERSION_CODES#ICE_CREAM_SANDWICH} inclusive, the + * picture does not include fixed position elements or scrollable divs. * - * @return a picture containing the current contents of this WebView. Note - * this picture is of the entire document, and is not restricted to - * the bounds of the view. + * @return a picture that captures the current contents of this WebView */ public Picture capturePicture() { checkThread(); @@ -1003,7 +1026,13 @@ public Picture capturePicture() { * Gets the current scale of this WebView. * * @return the current scale + * + * @deprecated This method is prone to inaccuracy due to race conditions + * between the web rendering and UI threads; prefer + * {@link WebViewClient#onScaleChanged}. */ + @Deprecated + @ViewDebug.ExportedProperty(category = "webview") public float getScale() { checkThread(); return mProvider.getScale(); @@ -1094,6 +1123,7 @@ public void requestImageRef(Message msg) { * * @return the URL for the current page */ + @ViewDebug.ExportedProperty(category = "webview") public String getUrl() { checkThread(); return mProvider.getUrl(); @@ -1108,6 +1138,7 @@ public String getUrl() { * * @return the URL that was originally requested for the current page */ + @ViewDebug.ExportedProperty(category = "webview") public String getOriginalUrl() { checkThread(); return mProvider.getOriginalUrl(); @@ -1119,6 +1150,7 @@ public String getOriginalUrl() { * * @return the title for the current page */ + @ViewDebug.ExportedProperty(category = "webview") public String getTitle() { checkThread(); return mProvider.getTitle(); @@ -1161,6 +1193,7 @@ public int getProgress() { * * @return the height of the HTML content */ + @ViewDebug.ExportedProperty(category = "webview") public int getContentHeight() { checkThread(); return mProvider.getContentHeight(); @@ -1172,6 +1205,7 @@ public int getContentHeight() { * @return the width of the HTML content * @hide */ + @ViewDebug.ExportedProperty(category = "webview") public int getContentWidth() { return mProvider.getContentWidth(); } @@ -1246,8 +1280,10 @@ public void clearCache(boolean includeDiskFiles) { } /** - * Makes sure that clearing the form data removes the adapter from the - * currently focused textfield if there is one. + * Removes the autocomplete popup from the currently focused form field, if + * present. Note this only affects the display of the autocomplete popup, + * it does not remove any saved form data from this WebView's store. To do + * that, use {@link WebViewDatabase#clearFormData}. */ public void clearFormData() { checkThread(); @@ -1297,12 +1333,11 @@ public void setFindListener(FindListener listener) { } /** - * Highlights and scrolls to the next match found by {@link #findAll} or + * Highlights and scrolls to the next match found by * {@link #findAllAsync}, wrapping around page boundaries as necessary. - * Notifies any registered {@link FindListener}. If neither - * {@link #findAll} nor {@link #findAllAsync(String)} has been called yet, - * or if {@link #clearMatches} has been called since the last find - * operation, this function does nothing. + * Notifies any registered {@link FindListener}. If {@link #findAllAsync(String)} + * has not been called yet, or if {@link #clearMatches} has been called since the + * last find operation, this function does nothing. * * @param forward the direction to search * @see #setFindListener @@ -1331,8 +1366,7 @@ public int findAll(String find) { /** * Finds all instances of find on the page and highlights them, * asynchronously. Notifies any registered {@link FindListener}. - * Successive calls to this or {@link #findAll} will cancel any - * pending searches. + * Successive calls to this will cancel any pending searches. * * @param find the string to find. * @see #setFindListener @@ -1381,13 +1415,12 @@ public boolean showFindDialog(String text, boolean showIme) { * @return the address, or if no address is found, null */ public static String findAddress(String addr) { - checkThread(); return getFactory().getStatics().findAddress(addr); } /** * Clears the highlighting surrounding text matches created by - * {@link #findAll} or {@link #findAllAsync}. + * {@link #findAllAsync}. */ public void clearMatches() { checkThread(); @@ -1457,10 +1490,22 @@ public void setPictureListener(PictureListener listener) { /** * Injects the supplied Java object into this WebView. The object is * injected into the JavaScript context of the main frame, using the - * supplied name. This allows the Java object's public methods to be - * accessed from JavaScript. Note that that injected objects will not + * supplied name. This allows the Java object's methods to be + * accessed from JavaScript. For applications targeted to API + * level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} + * and above, only public methods that are annotated with + * {@link android.webkit.JavascriptInterface} can be accessed from JavaScript. + * For applications targeted to API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN} or below, + * all public methods (including the inherited ones) can be accessed, see the + * important security note below for implications. + *

          Note that injected objects will not * appear in JavaScript until the page is next (re)loaded. For example: - *

           webView.addJavascriptInterface(new Object(), "injectedObject");
          +     * 
          +     * class JsObject {
          +     *    {@literal @}JavascriptInterface
          +     *    public String toString() { return "injectedObject"; }
          +     * }
          +     * webView.addJavascriptInterface(new JsObject(), "injectedObject");
                * webView.loadData("", "text/html", null);
                * webView.loadUrl("javascript:alert(injectedObject.toString())");
          *

          @@ -1468,7 +1513,9 @@ public void setPictureListener(PictureListener listener) { *

            *
          • This method can be used to allow JavaScript to control the host * application. This is a powerful feature, but also presents a security - * risk, particularly as JavaScript could use reflection to access an + * risk for applications targeted to API level + * {@link android.os.Build.VERSION_CODES#JELLY_BEAN} or below, because + * JavaScript could use reflection to access an * injected object's public fields. Use of this method in a WebView * containing untrusted content could allow an attacker to manipulate the * host application in unintended ways, executing Java code with the @@ -1477,6 +1524,7 @@ public void setPictureListener(PictureListener listener) { *
          • JavaScript interacts with Java object on a private, background * thread of this WebView. Care is therefore required to maintain thread * safety.
          • + *
          • The Java object's fields are not accessible.
          • *
          * * @param object the Java object to inject into this WebView's JavaScript @@ -1539,11 +1587,11 @@ public void refreshPlugins(boolean reloadOpenPages) { * functionality; it will be deprecated in the future. * * @deprecated This method is now obsolete. + * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} */ @Deprecated public void emulateShiftHeld() { checkThread(); - mProvider.emulateShiftHeld(); } /** @@ -1574,6 +1622,10 @@ public void onChildViewRemoved(View p, View child) {} public void onGlobalFocusChanged(View oldFocus, View newFocus) { } + /** + * @deprecated Only the default case, true, will be supported in a future version. + */ + @Deprecated public void setMapTrackballToArrowKeys(boolean setMap) { checkThread(); mProvider.setMapTrackballToArrowKeys(setMap); @@ -1607,7 +1659,12 @@ public View getZoomControls() { * Gets whether this WebView can be zoomed in. * * @return true if this WebView can be zoomed in + * + * @deprecated This method is prone to inaccuracy due to race conditions + * between the web rendering and UI threads; prefer + * {@link WebViewClient#onScaleChanged}. */ + @Deprecated public boolean canZoomIn() { checkThread(); return mProvider.canZoomIn(); @@ -1617,7 +1674,12 @@ public boolean canZoomIn() { * Gets whether this WebView can be zoomed out. * * @return true if this WebView can be zoomed out + * + * @deprecated This method is prone to inaccuracy due to race conditions + * between the web rendering and UI threads; prefer + * {@link WebViewClient#onScaleChanged}. */ + @Deprecated public boolean canZoomOut() { checkThread(); return mProvider.canZoomOut(); @@ -1645,11 +1707,29 @@ public boolean zoomOut() { /** * @deprecated This method is now obsolete. + * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} */ @Deprecated public void debugDump() { checkThread(); - mProvider.debugDump(); + } + + /** + * See {@link ViewDebug.HierarchyHandler#dumpViewHierarchyWithProperties(BufferedWriter, int)} + * @hide + */ + @Override + public void dumpViewHierarchyWithProperties(BufferedWriter out, int level) { + mProvider.dumpViewHierarchyWithProperties(out, level); + } + + /** + * See {@link ViewDebug.HierarchyHandler#findHierarchyView(String, int)} + * @hide + */ + @Override + public View findHierarchyView(String className, int hashCode) { + return mProvider.findHierarchyView(className, hashCode); } //------------------------------------------------------------------------- diff --git a/core/java/android/webkit/WebViewClassic.java b/core/java/android/webkit/WebViewClassic.java index 501db7d9f3acc..ae56e6bfde0e6 100644 --- a/core/java/android/webkit/WebViewClassic.java +++ b/core/java/android/webkit/WebViewClassic.java @@ -16,6 +16,7 @@ package android.webkit; +import android.accessibilityservice.AccessibilityServiceInfo; import android.animation.ObjectAnimator; import android.annotation.Widget; import android.app.ActivityManager; @@ -26,7 +27,6 @@ import android.content.ComponentCallbacks2; import android.content.Context; import android.content.DialogInterface; -import android.content.DialogInterface.OnCancelListener; import android.content.Intent; import android.content.IntentFilter; import android.content.pm.PackageManager; @@ -55,6 +55,7 @@ import android.net.Uri; import android.net.http.SslCertificate; import android.os.AsyncTask; +import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.os.Looper; @@ -68,7 +69,6 @@ import android.util.DisplayMetrics; import android.util.EventLog; import android.util.Log; -import android.view.Display; import android.view.Gravity; import android.view.HapticFeedbackConstants; import android.view.HardwareCanvas; @@ -86,7 +86,6 @@ import android.view.ViewGroup; import android.view.ViewParent; import android.view.ViewRootImpl; -import android.view.WindowManager; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityManager; import android.view.accessibility.AccessibilityNodeInfo; @@ -117,6 +116,8 @@ import junit.framework.Assert; +import java.io.BufferedWriter; +import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; @@ -129,11 +130,10 @@ import java.util.HashMap; import java.util.HashSet; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.Set; import java.util.Vector; -import java.util.regex.Matcher; -import java.util.regex.Pattern; /** * Implements a backend provider for the {@link WebView} public API. @@ -275,7 +275,6 @@ public boolean setComposingText(CharSequence text, int newCursorPosition) { super.setComposingText(limitedText, newCursorPosition); updateSelection(); if (limitedText != text) { - restartInput(); int lastCaret = start + limitedText.length(); finishComposingText(); setSelection(lastCaret, lastCaret); @@ -376,28 +375,26 @@ public void initEditorInfo(WebViewCore.TextFieldInitData initData) { imeOptions |= EditorInfo.IME_FLAG_NAVIGATE_PREVIOUS; } } + int action = EditorInfo.IME_ACTION_GO; switch (type) { case WebTextView.NORMAL_TEXT_FIELD: - imeOptions |= EditorInfo.IME_ACTION_GO; break; case WebTextView.TEXT_AREA: inputType |= InputType.TYPE_TEXT_FLAG_MULTI_LINE | InputType.TYPE_TEXT_FLAG_CAP_SENTENCES | InputType.TYPE_TEXT_FLAG_AUTO_CORRECT; - imeOptions |= EditorInfo.IME_ACTION_NONE; + action = EditorInfo.IME_ACTION_NONE; break; case WebTextView.PASSWORD: inputType |= EditorInfo.TYPE_TEXT_VARIATION_WEB_PASSWORD; - imeOptions |= EditorInfo.IME_ACTION_GO; break; case WebTextView.SEARCH: - imeOptions |= EditorInfo.IME_ACTION_SEARCH; + action = EditorInfo.IME_ACTION_SEARCH; break; case WebTextView.EMAIL: // inputType needs to be overwritten because of the different text variation. inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS; - imeOptions |= EditorInfo.IME_ACTION_GO; break; case WebTextView.NUMBER: // inputType needs to be overwritten because of the different class. @@ -405,23 +402,20 @@ public void initEditorInfo(WebViewCore.TextFieldInitData initData) { | InputType.TYPE_NUMBER_FLAG_SIGNED | InputType.TYPE_NUMBER_FLAG_DECIMAL; // Number and telephone do not have both a Tab key and an // action, so set the action to NEXT - imeOptions |= EditorInfo.IME_ACTION_NEXT; break; case WebTextView.TELEPHONE: // inputType needs to be overwritten because of the different class. inputType = InputType.TYPE_CLASS_PHONE; - imeOptions |= EditorInfo.IME_ACTION_NEXT; break; case WebTextView.URL: // TYPE_TEXT_VARIATION_URI prevents Tab key from showing, so // exclude it for now. - imeOptions |= EditorInfo.IME_ACTION_GO; inputType |= InputType.TYPE_TEXT_VARIATION_URI; break; default: - imeOptions |= EditorInfo.IME_ACTION_GO; break; } + imeOptions |= action; mHint = initData.mLabel; mInputType = inputType; mImeOptions = imeOptions; @@ -679,6 +673,8 @@ protected void measureContent() { // after resize. static private final int EDIT_RECT_BUFFER = 10; + static private final long SELECTION_HANDLE_ANIMATION_MS = 150; + // true means redraw the screen all-the-time. Only with AUTO_REDRAW_HACK private boolean mAutoRedraw; @@ -686,6 +682,10 @@ protected void measureContent() { // It's used to dismiss the dialog in destroy if not done before. private AlertDialog mListBoxDialog = null; + // Reference to the save password dialog so it can be dimissed in + // destroy if not done before. + private AlertDialog mSavePasswordDialog = null; + static final String LOGTAG = "webview"; private ZoomManager mZoomManager; @@ -738,12 +738,12 @@ public void onTrimMemory(int level) { // the existing GL resources for the html5 video will be destroyed // at native side. // Here we just need to clean up the Surface Texture which is static. - if (level >= TRIM_MEMORY_UI_HIDDEN) { + if (level > TRIM_MEMORY_UI_HIDDEN) { HTML5VideoInline.cleanupSurfaceTexture(); + HTML5VideoView.release(); } WebViewClassic.nativeOnTrimMemory(level); } - } // A final CallbackProxy shared by WebViewCore and BrowserFrame. @@ -945,21 +945,20 @@ public void onTrimMemory(int level) { private Drawable mSelectHandleLeft; private Drawable mSelectHandleRight; private Drawable mSelectHandleCenter; - private Point mSelectHandleLeftOffset; - private Point mSelectHandleRightOffset; - private Point mSelectHandleCenterOffset; - private Point mSelectCursorLeft = new Point(); - private int mSelectCursorLeftLayerId; - private QuadF mSelectCursorLeftTextQuad = new QuadF(); - private Point mSelectCursorRight = new Point(); - private int mSelectCursorRightLayerId; - private QuadF mSelectCursorRightTextQuad = new QuadF(); + private Point mSelectOffset; + private Point mSelectCursorBase = new Point(); + private Rect mSelectHandleBaseBounds = new Rect(); + private int mSelectCursorBaseLayerId; + private QuadF mSelectCursorBaseTextQuad = new QuadF(); + private Point mSelectCursorExtent = new Point(); + private Rect mSelectHandleExtentBounds = new Rect(); + private int mSelectCursorExtentLayerId; + private QuadF mSelectCursorExtentTextQuad = new QuadF(); private Point mSelectDraggingCursor; - private Point mSelectDraggingOffset; private QuadF mSelectDraggingTextQuad; private boolean mIsCaretSelection; - static final int HANDLE_ID_LEFT = 0; - static final int HANDLE_ID_RIGHT = 1; + static final int HANDLE_ID_BASE = 0; + static final int HANDLE_ID_EXTENT = 1; // the color used to highlight the touch rectangles static final int HIGHLIGHT_COLOR = 0x6633b5e5; @@ -1033,7 +1032,6 @@ public void onTrimMemory(int level) { static final int AUTOFILL_COMPLETE = 134; static final int SCREEN_ON = 136; - static final int ENTER_FULLSCREEN_VIDEO = 137; static final int UPDATE_ZOOM_DENSITY = 139; static final int EXIT_FULLSCREEN_VIDEO = 140; @@ -1049,6 +1047,7 @@ public void onTrimMemory(int level) { static final int EDIT_TEXT_SIZE_CHANGED = 150; static final int SHOW_CARET_HANDLE = 151; static final int UPDATE_CONTENT_BOUNDS = 152; + static final int SCROLL_HANDLE_INTO_VIEW = 153; private static final int FIRST_PACKAGE_MSG_ID = SCROLL_TO_MSG_ID; private static final int LAST_PACKAGE_MSG_ID = HIT_TEST_RESULT; @@ -1309,6 +1308,12 @@ public WebStorage getWebStorage() { public WebViewDatabase getWebViewDatabase(Context context) { return WebViewDatabaseClassic.getInstance(context); } + + @Override + public String getDefaultUserAgent(Context context) { + return WebSettingsClassic.getDefaultUserAgentForLocale(context, + Locale.getDefault()); + } } private void onHandleUiEvent(MotionEvent event, int eventType, int flags) { @@ -1642,6 +1647,12 @@ void updateMultiTouchSupport(Context context) { mZoomManager.updateMultiTouchSupport(context); } + void updateJavaScriptEnabled(boolean enabled) { + if (isAccessibilityInjectionEnabled()) { + getAccessibilityInjector().updateJavaScriptEnabled(enabled); + } + } + private void init() { OnTrimMemoryListener.init(mContext); mWebView.setWillNotDraw(false); @@ -1653,7 +1664,7 @@ private void init() { mTouchSlopSquare = slop * slop; slop = configuration.getScaledDoubleTapSlop(); mDoubleTapSlopSquare = slop * slop; - final float density = mContext.getResources().getDisplayMetrics().density; + final float density = WebViewCore.getFixedDisplayDensity(mContext); // use one line height, 16 based on our current default font, for how // far we allow a touch be away from the edge of a link mNavSlop = (int) (16 * density); @@ -1755,8 +1766,21 @@ public void onInitializeAccessibilityEvent(AccessibilityEvent event) { event.setMaxScrollY(Math.max(convertedContentHeight - adjustedViewHeight, 0)); } - private boolean isAccessibilityEnabled() { - return AccessibilityManager.getInstance(mContext).isEnabled(); + private boolean isAccessibilityInjectionEnabled() { + final AccessibilityManager manager = AccessibilityManager.getInstance(mContext); + if (!manager.isEnabled()) { + return false; + } + + // Accessibility scripts should be injected only when a speaking service + // is enabled. This may need to change later to accommodate Braille. + final List services = manager.getEnabledAccessibilityServiceList( + AccessibilityServiceInfo.FEEDBACK_SPOKEN); + if (services.isEmpty()) { + return false; + } + + return true; } private AccessibilityInjector getAccessibilityInjector() { @@ -1785,7 +1809,7 @@ public void setOverScrollMode(int mode) { } /* package */ void adjustDefaultZoomDensity(int zoomDensity) { - final float density = mContext.getResources().getDisplayMetrics().density + final float density = WebViewCore.getFixedDisplayDensity(mContext) * 100 / zoomDensity; updateDefaultZoomDensity(density); } @@ -1826,7 +1850,7 @@ public void setOverScrollMode(int mode) { neverRemember.getData().putString("password", password); neverRemember.obj = resumeMsg; - new AlertDialog.Builder(mContext) + mSavePasswordDialog = new AlertDialog.Builder(mContext) .setTitle(com.android.internal.R.string.save_password_label) .setMessage(com.android.internal.R.string.save_password_message) .setPositiveButton(com.android.internal.R.string.save_password_notnow, @@ -1837,6 +1861,7 @@ public void onClick(DialogInterface dialog, int which) { resumeMsg.sendToTarget(); mResumeMsg = null; } + mSavePasswordDialog = null; } }) .setNeutralButton(com.android.internal.R.string.save_password_remember, @@ -1847,6 +1872,7 @@ public void onClick(DialogInterface dialog, int which) { remember.sendToTarget(); mResumeMsg = null; } + mSavePasswordDialog = null; } }) .setNegativeButton(com.android.internal.R.string.save_password_never, @@ -1857,15 +1883,17 @@ public void onClick(DialogInterface dialog, int which) { neverRemember.sendToTarget(); mResumeMsg = null; } + mSavePasswordDialog = null; } }) - .setOnCancelListener(new OnCancelListener() { + .setOnDismissListener(new DialogInterface.OnDismissListener() { @Override - public void onCancel(DialogInterface dialog) { + public void onDismiss(DialogInterface dialog) { if (mResumeMsg != null) { resumeMsg.sendToTarget(); mResumeMsg = null; } + mSavePasswordDialog = null; } }).show(); // Return true so that WebViewCore will pause while the dialog is @@ -2065,14 +2093,18 @@ private void clearHelpers() { hideSoftKeyboard(); clearActionModes(); dismissFullScreenMode(); - cancelSelectDialog(); + cancelDialogs(); } - private void cancelSelectDialog() { + private void cancelDialogs() { if (mListBoxDialog != null) { mListBoxDialog.cancel(); mListBoxDialog = null; } + if (mSavePasswordDialog != null) { + mSavePasswordDialog.dismiss(); + mSavePasswordDialog = null; + } } /** @@ -2100,10 +2132,9 @@ private void ensureFunctorDetached() { private void destroyJava() { mCallbackProxy.blockMessages(); - clearHelpers(); - if (mListBoxDialog != null) { - mListBoxDialog.dismiss(); - mListBoxDialog = null; + if (mAccessibilityInjector != null) { + mAccessibilityInjector.destroy(); + mAccessibilityInjector = null; } if (mWebViewCore != null) { // Tell WebViewCore to destroy itself @@ -2211,7 +2242,7 @@ public WebBackForwardList saveState(Bundle outState) { } // We grab a copy of the back/forward list because a client of WebView // may have invalidated the history list by calling clearHistory. - WebBackForwardList list = copyBackForwardList(); + WebBackForwardListClassic list = copyBackForwardList(); final int currentIndex = list.getCurrentIndex(); final int size = list.getSize(); // We should fail saving the state if the list is empty or the index is @@ -2225,7 +2256,7 @@ public WebBackForwardList saveState(Bundle outState) { // arrays. ArrayList history = new ArrayList(size); for (int i = 0; i < size; i++) { - WebHistoryItem item = list.getItemAtIndex(i); + WebHistoryItemClassic item = list.getItemAtIndex(i); if (null == item) { // FIXME: this shouldn't happen // need to determine how item got set to null @@ -2424,7 +2455,7 @@ public void clearViewState() { */ @Override public WebBackForwardList restoreState(Bundle inState) { - WebBackForwardList returnList = null; + WebBackForwardListClassic returnList = null; if (inState == null) { return returnList; } @@ -2432,7 +2463,7 @@ public WebBackForwardList restoreState(Bundle inState) { mCertificate = SslCertificate.restoreState( inState.getBundle("certificate")); - final WebBackForwardList list = mCallbackProxy.getBackForwardList(); + final WebBackForwardListClassic list = mCallbackProxy.getBackForwardList(); final int index = inState.getInt("index"); // We can't use a clone of the list because we need to modify the // shared copy, so synchronize instead to prevent concurrent @@ -2453,7 +2484,7 @@ public WebBackForwardList restoreState(Bundle inState) { // the item and thus our history list cannot be rebuilt. return null; } - WebHistoryItem item = new WebHistoryItem(data); + WebHistoryItem item = new WebHistoryItemClassic(data); list.addHistoryItem(item); } // Grab the most recent copy to return to the caller. @@ -2469,6 +2500,9 @@ public WebBackForwardList restoreState(Bundle inState) { // Remove all pending messages because we are restoring previous // state. mWebViewCore.removeMessages(); + if (isAccessibilityInjectionEnabled()) { + getAccessibilityInjector().addAccessibilityApisIfNecessary(); + } // Send a restore state message. mWebViewCore.sendMessage(EventHub.RESTORE_STATE, index); } @@ -2626,7 +2660,7 @@ public void reload() { */ @Override public boolean canGoBack() { - WebBackForwardList l = mCallbackProxy.getBackForwardList(); + WebBackForwardListClassic l = mCallbackProxy.getBackForwardList(); synchronized (l) { if (l.getClearPending()) { return false; @@ -2649,7 +2683,7 @@ public void goBack() { */ @Override public boolean canGoForward() { - WebBackForwardList l = mCallbackProxy.getBackForwardList(); + WebBackForwardListClassic l = mCallbackProxy.getBackForwardList(); synchronized (l) { if (l.getClearPending()) { return false; @@ -2672,7 +2706,7 @@ public void goForward() { */ @Override public boolean canGoBackOrForward(int steps) { - WebBackForwardList l = mCallbackProxy.getBackForwardList(); + WebBackForwardListClassic l = mCallbackProxy.getBackForwardList(); synchronized (l) { if (l.getClearPending()) { return false; @@ -3320,6 +3354,7 @@ public void onOverScrolled(int scrollX, int scrollY, boolean clampedX, } if (mTouchMode == TOUCH_DRAG_LAYER_MODE) { scrollLayerTo(scrollX, scrollY); + animateHandles(); return; } mInOverScrollMode = false; @@ -3340,6 +3375,8 @@ public void onOverScrolled(int scrollX, int scrollY, boolean clampedX, mWebViewPrivate.super_scrollTo(scrollX, scrollY); + animateHandles(); + if (mOverScrollGlow != null) { mOverScrollGlow.pullGlow(getScrollX(), getScrollY(), oldX, oldY, maxX, maxY); } @@ -3386,7 +3423,7 @@ public Bitmap getFavicon() { */ @Override public String getTouchIconUrl() { - WebHistoryItem h = mCallbackProxy.getBackForwardList().getCurrentItem(); + WebHistoryItemClassic h = mCallbackProxy.getBackForwardList().getCurrentItem(); return h != null ? h.getTouchIconUrl() : null; } @@ -3452,7 +3489,7 @@ public void onPause() { nativeSetPauseDrawing(mNativeClass, true); } - cancelSelectDialog(); + cancelDialogs(); WebCoreThreadWatchdog.pause(); } } @@ -3550,7 +3587,7 @@ public void clearSslPreferences() { * See {@link WebView#copyBackForwardList()} */ @Override - public WebBackForwardList copyBackForwardList() { + public WebBackForwardListClassic copyBackForwardList() { return mCallbackProxy.getBackForwardList().clone(); } @@ -3558,7 +3595,8 @@ public WebBackForwardList copyBackForwardList() { * See {@link WebView#setFindListener(WebView.FindListener)}. * @hide */ - public void setFindListener(WebView.FindListener listener) { + @Override + public void setFindListener(WebView.FindListener listener) { mFindListener = listener; } @@ -3581,6 +3619,7 @@ public int findAll(String find) { return findAllBody(find, false); } + @Override public void findAllAsync(String find) { findAllBody(find, true); } @@ -3619,6 +3658,7 @@ private int findAllBody(String find, boolean isAsync) { * If false and text is non-null, perform a find all. * @return boolean True if the find dialog is shown, false otherwise. */ + @Override public boolean showFindDialog(String text, boolean showIme) { FindActionModeCallback callback = new FindActionModeCallback(mContext); if (mWebView.getParent() == null || mWebView.startActionMode(callback) == null) { @@ -3834,17 +3874,14 @@ private void scrollLayerTo(int x, int y) { return; } if (mSelectingText) { - if (mSelectCursorLeftLayerId == mCurrentScrollingLayerId) { - mSelectCursorLeft.offset(dx, dy); - mSelectCursorLeftTextQuad.offset(dx, dy); + if (mSelectCursorBaseLayerId == mCurrentScrollingLayerId) { + mSelectCursorBase.offset(dx, dy); + mSelectCursorBaseTextQuad.offset(dx, dy); } - if (mSelectCursorRightLayerId == mCurrentScrollingLayerId) { - mSelectCursorRight.offset(dx, dy); - mSelectCursorRightTextQuad.offset(dx, dy); + if (mSelectCursorExtentLayerId == mCurrentScrollingLayerId) { + mSelectCursorExtent.offset(dx, dy); + mSelectCursorExtentTextQuad.offset(dx, dy); } - } else if (mHandleAlpha.getAlpha() > 0) { - // stop fading as we're not going to move with the layer. - mHandleAlphaAnimator.end(); } if (mAutoCompletePopup != null && mCurrentScrollingLayerId == mEditTextLayerId) { @@ -3937,9 +3974,7 @@ private boolean setContentScrollBy(int cx, int cy, boolean animate) { // null, and that will be the case mWebView.setCertificate(null); - // reset the flag since we set to true in if need after - // loading is see onPageFinished(Url) - if (isAccessibilityEnabled()) { + if (isAccessibilityInjectionEnabled()) { getAccessibilityInjector().onPageStarted(url); } @@ -3954,7 +3989,7 @@ private boolean setContentScrollBy(int cx, int cy, boolean animate) { /* package */ void onPageFinished(String url) { mZoomManager.onPageFinished(url); - if (isAccessibilityEnabled()) { + if (isAccessibilityInjectionEnabled()) { getAccessibilityInjector().onPageFinished(url); } } @@ -4085,12 +4120,22 @@ public void documentAsText(Message callback) { */ @Override public void addJavascriptInterface(Object object, String name) { + if (object == null) { return; } WebViewCore.JSInterfaceData arg = new WebViewCore.JSInterfaceData(); + arg.mObject = object; arg.mInterfaceName = name; + + // starting with JELLY_BEAN_MR1, annotations are mandatory for enabling access to + // methods that are accessible from JS. + if (mContext.getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.JELLY_BEAN_MR1) { + arg.mRequireAnnotation = true; + } else { + arg.mRequireAnnotation = false; + } mWebViewCore.sendMessage(EventHub.ADD_JS_INTERFACE, arg); } @@ -4460,9 +4505,6 @@ int getBaseLayer() { } private void onZoomAnimationStart() { - if (!mSelectingText && mHandleAlpha.getAlpha() > 0) { - mHandleAlphaAnimator.end(); - } } private void onZoomAnimationEnd() { @@ -4495,34 +4537,63 @@ void onFixedLengthZoomAnimationEnd() { private class SelectionHandleAlpha { private int mAlpha = 0; + private int mTargetAlpha = 0; + public void setAlpha(int alpha) { mAlpha = alpha; - if (mSelectHandleCenter != null) { - mSelectHandleCenter.setAlpha(alpha); - mSelectHandleLeft.setAlpha(alpha); - mSelectHandleRight.setAlpha(alpha); - // TODO: Use partial invalidate - invalidate(); - } + // TODO: Use partial invalidate + invalidate(); } public int getAlpha() { return mAlpha; } + public void setTargetAlpha(int alpha) { + mTargetAlpha = alpha; + } + + public int getTargetAlpha() { + return mTargetAlpha; + } + } private void startSelectingText() { mSelectingText = true; mShowTextSelectionExtra = true; - mHandleAlphaAnimator.setIntValues(255); - mHandleAlphaAnimator.start(); + animateHandles(); + } + + private void animateHandle(boolean canShow, ObjectAnimator animator, + Point selectionPoint, int selectionLayerId, + SelectionHandleAlpha alpha) { + boolean isVisible = canShow && mSelectingText + && ((mSelectionStarted && mSelectDraggingCursor == selectionPoint) + || isHandleVisible(selectionPoint, selectionLayerId)); + int targetValue = isVisible ? 255 : 0; + if (targetValue != alpha.getTargetAlpha()) { + alpha.setTargetAlpha(targetValue); + animator.setIntValues(targetValue); + animator.setDuration(SELECTION_HANDLE_ANIMATION_MS); + animator.start(); + } + } + + private void animateHandles() { + boolean canShowBase = mSelectingText; + boolean canShowExtent = mSelectingText && !mIsCaretSelection; + animateHandle(canShowBase, mBaseHandleAlphaAnimator, mSelectCursorBase, + mSelectCursorBaseLayerId, mBaseAlpha); + animateHandle(canShowExtent, mExtentHandleAlphaAnimator, + mSelectCursorExtent, mSelectCursorExtentLayerId, + mExtentAlpha); } + private void endSelectingText() { mSelectingText = false; mShowTextSelectionExtra = false; - mHandleAlphaAnimator.setIntValues(0); - mHandleAlphaAnimator.start(); + animateHandles(); } private void ensureSelectionHandles() { @@ -4533,55 +4604,76 @@ private void ensureSelectionHandles() { com.android.internal.R.drawable.text_select_handle_left).mutate(); mSelectHandleRight = mContext.getResources().getDrawable( com.android.internal.R.drawable.text_select_handle_right).mutate(); - mHandleAlpha.setAlpha(mHandleAlpha.getAlpha()); - mSelectHandleCenterOffset = new Point(0, - -mSelectHandleCenter.getIntrinsicHeight()); - mSelectHandleLeftOffset = new Point(0, + // All handles have the same height, so we can save effort with + // this assumption. + mSelectOffset = new Point(0, -mSelectHandleLeft.getIntrinsicHeight()); - mSelectHandleRightOffset = new Point( - -mSelectHandleLeft.getIntrinsicWidth() / 2, - -mSelectHandleRight.getIntrinsicHeight()); } } + private void drawHandle(Point point, int handleId, Rect bounds, + int alpha, Canvas canvas) { + int offset; + int width; + int height; + Drawable drawable; + boolean isLeft = nativeIsHandleLeft(mNativeClass, handleId); + if (isLeft) { + drawable = mSelectHandleLeft; + width = mSelectHandleLeft.getIntrinsicWidth(); + height = mSelectHandleLeft.getIntrinsicHeight(); + // Magic formula copied from TextView + offset = (width * 3) / 4; + } else { + drawable = mSelectHandleRight; + width = mSelectHandleRight.getIntrinsicWidth(); + height = mSelectHandleRight.getIntrinsicHeight(); + // Magic formula copied from TextView + offset = width / 4; + } + int x = contentToViewDimension(point.x); + int y = contentToViewDimension(point.y); + bounds.set(x - offset, y, x - offset + width, y + height); + drawable.setBounds(bounds); + drawable.setAlpha(alpha); + drawable.draw(canvas); + } + private void drawTextSelectionHandles(Canvas canvas) { - if (mHandleAlpha.getAlpha() == 0) { + if (mBaseAlpha.getAlpha() == 0 && mExtentAlpha.getAlpha() == 0) { return; } ensureSelectionHandles(); - if (mSelectingText) { - int[] handles = new int[4]; - getSelectionHandles(handles); - int start_x = contentToViewDimension(handles[0]); - int start_y = contentToViewDimension(handles[1]); - int end_x = contentToViewDimension(handles[2]); - int end_y = contentToViewDimension(handles[3]); - - if (mIsCaretSelection) { - // Caret handle is centered - start_x -= (mSelectHandleCenter.getIntrinsicWidth() / 2); - mSelectHandleCenter.setBounds(start_x, start_y, - start_x + mSelectHandleCenter.getIntrinsicWidth(), - start_y + mSelectHandleCenter.getIntrinsicHeight()); - } else { - // Magic formula copied from TextView - start_x -= (mSelectHandleLeft.getIntrinsicWidth() * 3) / 4; - mSelectHandleLeft.setBounds(start_x, start_y, - start_x + mSelectHandleLeft.getIntrinsicWidth(), - start_y + mSelectHandleLeft.getIntrinsicHeight()); - end_x -= mSelectHandleRight.getIntrinsicWidth() / 4; - mSelectHandleRight.setBounds(end_x, end_y, - end_x + mSelectHandleRight.getIntrinsicWidth(), - end_y + mSelectHandleRight.getIntrinsicHeight()); - } - } - if (mIsCaretSelection) { + // Caret handle is centered + int x = contentToViewDimension(mSelectCursorBase.x) - + (mSelectHandleCenter.getIntrinsicWidth() / 2); + int y = contentToViewDimension(mSelectCursorBase.y); + mSelectHandleBaseBounds.set(x, y, + x + mSelectHandleCenter.getIntrinsicWidth(), + y + mSelectHandleCenter.getIntrinsicHeight()); + mSelectHandleCenter.setBounds(mSelectHandleBaseBounds); + mSelectHandleCenter.setAlpha(mBaseAlpha.getAlpha()); mSelectHandleCenter.draw(canvas); } else { - mSelectHandleLeft.draw(canvas); - mSelectHandleRight.draw(canvas); + drawHandle(mSelectCursorBase, HANDLE_ID_BASE, + mSelectHandleBaseBounds, mBaseAlpha.getAlpha(), canvas); + drawHandle(mSelectCursorExtent, HANDLE_ID_EXTENT, + mSelectHandleExtentBounds, mExtentAlpha.getAlpha(), canvas); + } + } + + private boolean isHandleVisible(Point selectionPoint, int layerId) { + boolean isVisible = true; + if (mIsEditingText) { + isVisible = mEditTextContentBounds.contains(selectionPoint.x, + selectionPoint.y); + } + if (isVisible) { + isVisible = nativeIsPointVisible(mNativeClass, layerId, + selectionPoint.x, selectionPoint.y); } + return isVisible; } /** @@ -4589,10 +4681,10 @@ private void drawTextSelectionHandles(Canvas canvas) { * startX, startY, endX, endY */ private void getSelectionHandles(int[] handles) { - handles[0] = mSelectCursorLeft.x; - handles[1] = mSelectCursorLeft.y; - handles[2] = mSelectCursorRight.x; - handles[3] = mSelectCursorRight.y; + handles[0] = mSelectCursorBase.x; + handles[1] = mSelectCursorBase.y; + handles[2] = mSelectCursorExtent.x; + handles[3] = mSelectCursorExtent.y; } // draw history @@ -4826,6 +4918,43 @@ public void setUseMockDeviceOrientation() { mWebViewCore.sendMessage(EventHub.SET_USE_MOCK_DEVICE_ORIENTATION); } + /** + * Sets use of the Geolocation mock client. Also resets that client. Called + * by DRT on UI thread, need to proxy to WebCore thread. + * + * debug only + */ + public void setUseMockGeolocation() { + mWebViewCore.sendMessage(EventHub.SET_USE_MOCK_GEOLOCATION); + } + + /** + * Called by DRT on WebCore thread. + * + * debug only + */ + public void setMockGeolocationPosition(double latitude, double longitude, double accuracy) { + mWebViewCore.setMockGeolocationPosition(latitude, longitude, accuracy); + } + + /** + * Called by DRT on WebCore thread. + * + * debug only + */ + public void setMockGeolocationError(int code, String message) { + mWebViewCore.setMockGeolocationError(code, message); + } + + /** + * Called by DRT on WebCore thread. + * + * debug only + */ + public void setMockGeolocationPermission(boolean allow) { + mWebViewCore.setMockGeolocationPermission(allow); + } + /** * Called by DRT on WebCore thread. * @@ -4911,7 +5040,7 @@ public boolean onKeyDown(int keyCode, KeyEvent event) { } // See if the accessibility injector needs to handle this event. - if (isAccessibilityEnabled() + if (isAccessibilityInjectionEnabled() && getAccessibilityInjector().handleKeyEventIfNecessary(event)) { return true; } @@ -5018,7 +5147,7 @@ public boolean onKeyUp(int keyCode, KeyEvent event) { } // See if the accessibility injector needs to handle this event. - if (isAccessibilityEnabled() + if (isAccessibilityInjectionEnabled() && getAccessibilityInjector().handleKeyEventIfNecessary(event)) { return true; } @@ -5059,9 +5188,9 @@ private void showPasteWindow() { ClipboardManager cm = (ClipboardManager)(mContext .getSystemService(Context.CLIPBOARD_SERVICE)); if (cm.hasPrimaryClip()) { - Point cursorPoint = new Point(contentToViewX(mSelectCursorLeft.x), - contentToViewY(mSelectCursorLeft.y)); - Point cursorTop = calculateCaretTop(); + Point cursorPoint = new Point(contentToViewX(mSelectCursorBase.x), + contentToViewY(mSelectCursorBase.y)); + Point cursorTop = calculateBaseCaretTop(); cursorTop.set(contentToViewX(cursorTop.x), contentToViewY(cursorTop.y)); @@ -5105,17 +5234,22 @@ private static float scaleAlongSegment(int x, int y, PointF a, PointF b) { return scale; } + private Point calculateBaseCaretTop() { + return calculateCaretTop(mSelectCursorBase, mSelectCursorBaseTextQuad); + } + + private Point calculateDraggingCaretTop() { + return calculateCaretTop(mSelectDraggingCursor, mSelectDraggingTextQuad); + } + /** * Assuming arbitrary shape of a quadralateral forming text bounds, this * calculates the top of a caret. */ - private Point calculateCaretTop() { - float scale = scaleAlongSegment(mSelectCursorLeft.x, mSelectCursorLeft.y, - mSelectCursorLeftTextQuad.p4, mSelectCursorLeftTextQuad.p3); - int x = Math.round(scaleCoordinate(scale, - mSelectCursorLeftTextQuad.p1.x, mSelectCursorLeftTextQuad.p2.x)); - int y = Math.round(scaleCoordinate(scale, - mSelectCursorLeftTextQuad.p1.y, mSelectCursorLeftTextQuad.p2.y)); + private static Point calculateCaretTop(Point base, QuadF quad) { + float scale = scaleAlongSegment(base.x, base.y, quad.p4, quad.p3); + int x = Math.round(scaleCoordinate(scale, quad.p1.x, quad.p2.x)); + int y = Math.round(scaleCoordinate(scale, quad.p1.y, quad.p2.y)); return new Point(x, y); } @@ -5126,50 +5260,12 @@ private void hidePasteButton() { } private void syncSelectionCursors() { - mSelectCursorLeftLayerId = - nativeGetHandleLayerId(mNativeClass, HANDLE_ID_LEFT, - mSelectCursorLeft, mSelectCursorLeftTextQuad); - mSelectCursorRightLayerId = - nativeGetHandleLayerId(mNativeClass, HANDLE_ID_RIGHT, - mSelectCursorRight, mSelectCursorRightTextQuad); - } - - private void adjustSelectionCursors() { - if (mIsCaretSelection) { - syncSelectionCursors(); - return; // no need to swap left and right handles. - } - - boolean wasDraggingLeft = (mSelectDraggingCursor == mSelectCursorLeft); - int oldX = mSelectDraggingCursor.x; - int oldY = mSelectDraggingCursor.y; - int oldLeftX = mSelectCursorLeft.x; - int oldLeftY = mSelectCursorLeft.y; - int oldRightX = mSelectCursorRight.x; - int oldRightY = mSelectCursorRight.y; - syncSelectionCursors(); - - boolean rightChanged = (oldRightX != mSelectCursorRight.x - || oldRightY != mSelectCursorRight.y); - boolean leftChanged = (oldLeftX != mSelectCursorLeft.x - || oldLeftY != mSelectCursorLeft.y); - if (leftChanged && rightChanged) { - // Left and right switched places, so swap dragging cursor - boolean draggingLeft = !wasDraggingLeft; - mSelectDraggingCursor = (draggingLeft - ? mSelectCursorLeft : mSelectCursorRight); - mSelectDraggingTextQuad = (draggingLeft - ? mSelectCursorLeftTextQuad : mSelectCursorRightTextQuad); - mSelectDraggingOffset = (draggingLeft - ? mSelectHandleLeftOffset : mSelectHandleRightOffset); - } - mSelectDraggingCursor.set(oldX, oldY); - } - - private float distanceSquared(int x, int y, Point p) { - float dx = p.x - x; - float dy = p.y - y; - return (dx * dx) + (dy * dy); + mSelectCursorBaseLayerId = + nativeGetHandleLayerId(mNativeClass, HANDLE_ID_BASE, + mSelectCursorBase, mSelectCursorBaseTextQuad); + mSelectCursorExtentLayerId = + nativeGetHandleLayerId(mNativeClass, HANDLE_ID_EXTENT, + mSelectCursorExtent, mSelectCursorExtentTextQuad); } private boolean setupWebkitSelect() { @@ -5183,19 +5279,20 @@ private boolean setupWebkitSelect() { return true; } - private void updateWebkitSelection() { - int[] handles = null; - if (mIsCaretSelection) { - mSelectCursorRight.set(mSelectCursorLeft.x, mSelectCursorLeft.y); - } - if (mSelectingText) { - handles = new int[4]; - getSelectionHandles(handles); - } else { - nativeSetTextSelection(mNativeClass, 0); + private void updateWebkitSelection(boolean isSnapped) { + int handleId = (mSelectDraggingCursor == mSelectCursorBase) + ? HANDLE_ID_BASE : HANDLE_ID_EXTENT; + int x = mSelectDraggingCursor.x; + int y = mSelectDraggingCursor.y; + if (isSnapped) { + // "center" the cursor in the snapping quad + Point top = calculateDraggingCaretTop(); + x = Math.round((top.x + x) / 2); + y = Math.round((top.y + y) / 2); } mWebViewCore.removeMessages(EventHub.SELECT_TEXT); - mWebViewCore.sendMessageAtFrontOfQueue(EventHub.SELECT_TEXT, handles); + mWebViewCore.sendMessageAtFrontOfQueue(EventHub.SELECT_TEXT, + x, y, (Integer)handleId); } private void resetCaretTimer() { @@ -5206,14 +5303,6 @@ private void resetCaretTimer() { } } - /** - * See {@link WebView#emulateShiftHeld()} - */ - @Override - @Deprecated - public void emulateShiftHeld() { - } - /** * Select all of the text in this WebView. * @@ -5300,16 +5389,6 @@ public void pasteFromClipboard() { } } - /** - * This is an implementation detail. - */ - public SearchBox getSearchBox() { - if ((mWebViewCore == null) || (mWebViewCore.getBrowserFrame() == null)) { - return null; - } - return mWebViewCore.getBrowserFrame().getSearchBox(); - } - /** * Returns the currently highlighted text as a string. */ @@ -5322,8 +5401,8 @@ String getSelection() { public void onAttachedToWindow() { if (mWebView.hasWindowFocus()) setActive(true); - if (isAccessibilityEnabled()) { - getAccessibilityInjector().addAccessibilityApisIfNecessary(); + if (isAccessibilityInjectionEnabled()) { + getAccessibilityInjector().toggleAccessibilityFeedback(true); } updateHwAccelerated(); @@ -5335,12 +5414,8 @@ public void onDetachedFromWindow() { mZoomManager.dismissZoomPicker(); if (mWebView.hasWindowFocus()) setActive(false); - if (isAccessibilityEnabled()) { - getAccessibilityInjector().removeAccessibilityApisIfNecessary(); - } else { - // Ensure the injector is cleared if we're detaching from the window - // and accessibility is disabled. - mAccessibilityInjector = null; + if (isAccessibilityInjectionEnabled()) { + getAccessibilityInjector().toggleAccessibilityFeedback(false); } updateHwAccelerated(); @@ -5555,24 +5630,24 @@ private void scrollEditIntoView() { Math.max(0, mEditTextContentBounds.top - buffer), mEditTextContentBounds.right + buffer, mEditTextContentBounds.bottom + buffer); - Point caretTop = calculateCaretTop(); + Point caretTop = calculateBaseCaretTop(); if (visibleRect.width() < mEditTextContentBounds.width()) { // The whole edit won't fit in the width, so use the caret rect - if (mSelectCursorLeft.x < caretTop.x) { - showRect.left = Math.max(0, mSelectCursorLeft.x - buffer); + if (mSelectCursorBase.x < caretTop.x) { + showRect.left = Math.max(0, mSelectCursorBase.x - buffer); showRect.right = caretTop.x + buffer; } else { showRect.left = Math.max(0, caretTop.x - buffer); - showRect.right = mSelectCursorLeft.x + buffer; + showRect.right = mSelectCursorBase.x + buffer; } } if (visibleRect.height() < mEditTextContentBounds.height()) { // The whole edit won't fit in the height, so use the caret rect - if (mSelectCursorLeft.y > caretTop.y) { + if (mSelectCursorBase.y > caretTop.y) { showRect.top = Math.max(0, caretTop.y - buffer); - showRect.bottom = mSelectCursorLeft.y + buffer; + showRect.bottom = mSelectCursorBase.y + buffer; } else { - showRect.top = Math.max(0, mSelectCursorLeft.y - buffer); + showRect.top = Math.max(0, mSelectCursorBase.y - buffer); showRect.bottom = caretTop.y + buffer; } } @@ -5816,28 +5891,19 @@ private void handleTouchEventCommon(MotionEvent event, int action, int x, int y) ensureSelectionHandles(); int shiftedY = y - getTitleHeight() + getScrollY(); int shiftedX = x + getScrollX(); - if (mSelectHandleCenter != null && mSelectHandleCenter.getBounds() - .contains(shiftedX, shiftedY)) { + if (mSelectHandleBaseBounds.contains(shiftedX, shiftedY)) { mSelectionStarted = true; - mSelectDraggingCursor = mSelectCursorLeft; - mSelectDraggingOffset = mSelectHandleCenterOffset; - mSelectDraggingTextQuad = mSelectCursorLeftTextQuad; - mPrivateHandler.removeMessages(CLEAR_CARET_HANDLE); - hidePasteButton(); - } else if (mSelectHandleLeft != null - && mSelectHandleLeft.getBounds() - .contains(shiftedX, shiftedY)) { - mSelectionStarted = true; - mSelectDraggingOffset = mSelectHandleLeftOffset; - mSelectDraggingCursor = mSelectCursorLeft; - mSelectDraggingTextQuad = mSelectCursorLeftTextQuad; - } else if (mSelectHandleRight != null - && mSelectHandleRight.getBounds() + mSelectDraggingCursor = mSelectCursorBase; + mSelectDraggingTextQuad = mSelectCursorBaseTextQuad; + if (mIsCaretSelection) { + mPrivateHandler.removeMessages(CLEAR_CARET_HANDLE); + hidePasteButton(); + } + } else if (mSelectHandleExtentBounds .contains(shiftedX, shiftedY)) { mSelectionStarted = true; - mSelectDraggingOffset = mSelectHandleRightOffset; - mSelectDraggingCursor = mSelectCursorRight; - mSelectDraggingTextQuad = mSelectCursorRightTextQuad; + mSelectDraggingCursor = mSelectCursorExtent; + mSelectDraggingTextQuad = mSelectCursorExtentTextQuad; } else if (mIsCaretSelection) { selectionDone(); } @@ -5882,9 +5948,9 @@ private void handleTouchEventCommon(MotionEvent event, int action, int x, int y) } if (deltaX != 0 || deltaY != 0) { int handleX = contentX + - viewToContentDimension(mSelectDraggingOffset.x); + viewToContentDimension(mSelectOffset.x); int handleY = contentY + - viewToContentDimension(mSelectDraggingOffset.y); + viewToContentDimension(mSelectOffset.y); mSelectDraggingCursor.set(handleX, handleY); boolean inCursorText = mSelectDraggingTextQuad.containsPoint(handleX, handleY); @@ -5895,10 +5961,12 @@ private void handleTouchEventCommon(MotionEvent event, int action, int x, int y) } else { endScrollEdit(); } + boolean snapped = false; if (inCursorText || (mIsEditingText && !inEditBounds)) { snapDraggingCursor(); + snapped = true; } - updateWebkitSelection(); + updateWebkitSelection(snapped); if (!inCursorText && mIsEditingText && inEditBounds) { // Visually snap even if we have moved the handle. snapDraggingCursor(); @@ -6021,12 +6089,15 @@ private void handleTouchEventCommon(MotionEvent event, int action, int x, int y) break; } case MotionEvent.ACTION_UP: { - endScrollEdit(); - if (!mConfirmMove && mIsEditingText && mSelectionStarted && - mIsCaretSelection) { - showPasteWindow(); - stopTouch(); - break; + if (mIsEditingText && mSelectionStarted) { + endScrollEdit(); + mPrivateHandler.sendEmptyMessageDelayed(SCROLL_HANDLE_INTO_VIEW, + TEXT_SCROLL_FIRST_SCROLL_MS); + if (!mConfirmMove && mIsCaretSelection) { + showPasteWindow(); + stopTouch(); + break; + } } mLastTouchUpTime = eventTime; if (mSentAutoScrollMessage) { @@ -6133,6 +6204,10 @@ private static float getTextScrollSpeed(int coordinate, int min, int max) { } } + private static int getSelectionCoordinate(int coordinate, int min, int max) { + return Math.max(Math.min(coordinate, max), min); + } + private void beginScrollEdit() { if (mLastEditScroll == 0) { mLastEditScroll = SystemClock.uptimeMillis() - @@ -6141,10 +6216,37 @@ private void beginScrollEdit() { } } + private void scrollDraggedSelectionHandleIntoView() { + if (mSelectDraggingCursor == null) { + return; + } + int x = mSelectDraggingCursor.x; + int y = mSelectDraggingCursor.y; + if (!mEditTextContentBounds.contains(x,y)) { + int left = Math.min(0, x - mEditTextContentBounds.left - EDIT_RECT_BUFFER); + int right = Math.max(0, x - mEditTextContentBounds.right + EDIT_RECT_BUFFER); + int deltaX = left + right; + int above = Math.min(0, y - mEditTextContentBounds.top - EDIT_RECT_BUFFER); + int below = Math.max(0, y - mEditTextContentBounds.bottom + EDIT_RECT_BUFFER); + int deltaY = above + below; + if (deltaX != 0 || deltaY != 0) { + int scrollX = getTextScrollX() + deltaX; + int scrollY = getTextScrollY() + deltaY; + scrollX = clampBetween(scrollX, 0, getMaxTextScrollX()); + scrollY = clampBetween(scrollY, 0, getMaxTextScrollY()); + scrollEditText(scrollX, scrollY); + } + } + } + private void endScrollEdit() { mLastEditScroll = 0; } + private static int clampBetween(int value, int min, int max) { + return Math.max(min, Math.min(value, max)); + } + private static int getTextScrollDelta(float speed, long deltaT) { float distance = speed * deltaT; int intDistance = (int)Math.floor(distance); @@ -6160,10 +6262,10 @@ private static int getTextScrollDelta(float speed, long deltaT) { */ private void scrollEditWithCursor() { if (mLastEditScroll != 0) { - int x = viewToContentX(mLastTouchX + getScrollX() + mSelectDraggingOffset.x); + int x = viewToContentX(mLastTouchX + getScrollX() + mSelectOffset.x); float scrollSpeedX = getTextScrollSpeed(x, mEditTextContentBounds.left, mEditTextContentBounds.right); - int y = viewToContentY(mLastTouchY + getScrollY() + mSelectDraggingOffset.y); + int y = viewToContentY(mLastTouchY + getScrollY() + mSelectOffset.y); float scrollSpeedY = getTextScrollSpeed(y, mEditTextContentBounds.top, mEditTextContentBounds.bottom); if (scrollSpeedX == 0.0f && scrollSpeedY == 0.0f) { @@ -6173,24 +6275,27 @@ private void scrollEditWithCursor() { long timeSinceLastUpdate = currentTime - mLastEditScroll; int deltaX = getTextScrollDelta(scrollSpeedX, timeSinceLastUpdate); int deltaY = getTextScrollDelta(scrollSpeedY, timeSinceLastUpdate); + int scrollX = getTextScrollX() + deltaX; + scrollX = clampBetween(scrollX, 0, getMaxTextScrollX()); + int scrollY = getTextScrollY() + deltaY; + scrollY = clampBetween(scrollY, 0, getMaxTextScrollY()); + mLastEditScroll = currentTime; - if (deltaX == 0 && deltaY == 0) { + if (scrollX == getTextScrollX() && scrollY == getTextScrollY()) { // By probability no text scroll this time. Try again later. mPrivateHandler.sendEmptyMessageDelayed(SCROLL_EDIT_TEXT, TEXT_SCROLL_FIRST_SCROLL_MS); } else { - int scrollX = getTextScrollX() + deltaX; - scrollX = Math.min(getMaxTextScrollX(), scrollX); - scrollX = Math.max(0, scrollX); - int scrollY = getTextScrollY() + deltaY; - scrollY = Math.min(getMaxTextScrollY(), scrollY); - scrollY = Math.max(0, scrollY); + int selectionX = getSelectionCoordinate(x, + mEditTextContentBounds.left, mEditTextContentBounds.right); + int selectionY = getSelectionCoordinate(y, + mEditTextContentBounds.top, mEditTextContentBounds.bottom); + int oldX = mSelectDraggingCursor.x; + int oldY = mSelectDraggingCursor.y; + mSelectDraggingCursor.set(selectionX, selectionY); + updateWebkitSelection(false); scrollEditText(scrollX, scrollY); - int cursorX = mSelectDraggingCursor.x; - int cursorY = mSelectDraggingCursor.y; - mSelectDraggingCursor.set(x - deltaX, y - deltaY); - updateWebkitSelection(); - mSelectDraggingCursor.set(cursorX, cursorY); + mSelectDraggingCursor.set(oldX, oldY); } } } @@ -6246,10 +6351,10 @@ private boolean doDrag(int deltaX, int deltaY) { // scrolling. The rectangle is in document coordinates. final int maxX = mScrollingLayerRect.right; final int maxY = mScrollingLayerRect.bottom; - final int resultX = Math.max(0, - Math.min(mScrollingLayerRect.left + contentX, maxX)); - final int resultY = Math.max(0, - Math.min(mScrollingLayerRect.top + contentY, maxY)); + final int resultX = clampBetween(maxX, 0, + mScrollingLayerRect.left + contentX); + final int resultY = clampBetween(maxY, 0, + mScrollingLayerRect.top + contentY); if (resultX != mScrollingLayerRect.left || resultY != mScrollingLayerRect.top @@ -6350,10 +6455,10 @@ private void snapDraggingCursor() { int x = Math.round(newX); int y = Math.round(newY); if (mIsEditingText) { - x = Math.max(mEditTextContentBounds.left, - Math.min(mEditTextContentBounds.right, x)); - y = Math.max(mEditTextContentBounds.top, - Math.min(mEditTextContentBounds.bottom, y)); + x = clampBetween(x, mEditTextContentBounds.left, + mEditTextContentBounds.right); + y = clampBetween(y, mEditTextContentBounds.top, + mEditTextContentBounds.bottom); } mSelectDraggingCursor.set(x, y); } @@ -6382,9 +6487,13 @@ public boolean onGenericMotionEvent(MotionEvent event) { mWebViewPrivate.getVerticalScrollFactor()); final int hdelta = (int) (hscroll * mWebViewPrivate.getHorizontalScrollFactor()); - if (pinScrollBy(hdelta, vdelta, false, 0)) { - return true; - } + + abortAnimation(); + int oldTouchMode = mTouchMode; + startScrollingLayer(event.getX(), event.getY()); + doDrag(hdelta, vdelta); + mTouchMode = oldTouchMode; + return true; } } } @@ -6416,9 +6525,12 @@ public boolean onGenericMotionEvent(MotionEvent event) { private long mTrackballUpTime = 0; private long mLastCursorTime = 0; private Rect mLastCursorBounds; - private SelectionHandleAlpha mHandleAlpha = new SelectionHandleAlpha(); - private ObjectAnimator mHandleAlphaAnimator = - ObjectAnimator.ofInt(mHandleAlpha, "alpha", 0); + private SelectionHandleAlpha mBaseAlpha = new SelectionHandleAlpha(); + private SelectionHandleAlpha mExtentAlpha = new SelectionHandleAlpha(); + private ObjectAnimator mBaseHandleAlphaAnimator = + ObjectAnimator.ofInt(mBaseAlpha, "alpha", 0); + private ObjectAnimator mExtentHandleAlphaAnimator = + ObjectAnimator.ofInt(mExtentAlpha, "alpha", 0); // Set by default; BrowserActivity clears to interpret trackball data // directly for movement. Currently, the framework only passes @@ -6428,6 +6540,7 @@ public boolean onGenericMotionEvent(MotionEvent event) { private DrawData mDelaySetPicture; private DrawData mLoadedPicture; + @Override public void setMapTrackballToArrowKeys(boolean setMap) { mMapTrackballToArrowKeys = setMap; } @@ -6654,6 +6767,7 @@ boolean updateScrollCoordinates(int x, int y) { } } + @Override public void flingScroll(int vx, int vy) { mScroller.fling(getScrollX(), getScrollY(), vx, vy, 0, computeMaxScrollX(), 0, computeMaxScrollY(), mOverflingDistance, mOverflingDistance); @@ -6906,6 +7020,8 @@ private void overrideLoading(String url) { @Override public boolean requestFocus(int direction, Rect previouslyFocusedRect) { + // Check if we are destroyed + if (mWebViewCore == null) return false; // FIXME: If a subwindow is showing find, and the user touches the // background window, it can steal focus. if (mFindIsUp) return false; @@ -7215,11 +7331,7 @@ public void handleMessage(Message msg) { // nativeCreate sets mNativeClass to a non-zero value String drawableDir = BrowserFrame.getRawResFilename( BrowserFrame.DRAWABLEDIR, mContext); - WindowManager windowManager = - (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE); - Display display = windowManager.getDefaultDisplay(); - nativeCreate(msg.arg1, drawableDir, - ActivityManager.isHighEndGfx(display)); + nativeCreate(msg.arg1, drawableDir, ActivityManager.isHighEndGfx()); if (mDelaySetPicture != null) { setNewPicture(mDelaySetPicture, true); mDelaySetPicture = null; @@ -7305,15 +7417,6 @@ public void handleMessage(Message msg) { mWebView.setKeepScreenOn(msg.arg1 == 1); break; - case ENTER_FULLSCREEN_VIDEO: - int layerId = msg.arg1; - - String url = (String) msg.obj; - if (mHTML5VideoViewProxy != null) { - mHTML5VideoViewProxy.enterFullScreenVideo(layerId, url); - } - break; - case EXIT_FULLSCREEN_VIDEO: if (mHTML5VideoViewProxy != null) { mHTML5VideoViewProxy.exitFullScreenVideo(); @@ -7393,7 +7496,7 @@ public void handleMessage(Message msg) { break; case SELECTION_STRING_CHANGED: - if (isAccessibilityEnabled()) { + if (isAccessibilityInjectionEnabled()) { getAccessibilityInjector() .handleSelectionChangedIfNecessary((String) msg.obj); } @@ -7452,7 +7555,7 @@ public void handleMessage(Message msg) { mEditTextLayerId = initData.mNodeLayerId; nativeMapLayerRect(mNativeClass, mEditTextLayerId, mEditTextContentBounds); - mEditTextContent.set(initData.mContentRect); + mEditTextContent.set(initData.mClientRect); relocateAutoCompletePopup(); } break; @@ -7533,6 +7636,10 @@ public void handleMessage(Message msg) { scrollEditWithCursor(); break; + case SCROLL_HANDLE_INTO_VIEW: + scrollDraggedSelectionHandleIntoView(); + break; + default: super.handleMessage(msg); break; @@ -7568,8 +7675,8 @@ public boolean shouldInterceptTouchEvent(MotionEvent event) { .contains(x, y); } else { isPressingHandle = - mSelectHandleLeft.getBounds().contains(x, y) - || mSelectHandleRight.getBounds().contains(x, y); + mSelectHandleBaseBounds.contains(x, y) + || mSelectHandleExtentBounds.contains(x, y); } return isPressingHandle; } @@ -7857,7 +7964,9 @@ void setNewPicture(final WebViewCore.DrawData draw, boolean updateBaseLayer) { int functor = 0; boolean forceInval = isPictureAfterFirstLayout; ViewRootImpl viewRoot = mWebView.getViewRootImpl(); - if (mWebView.isHardwareAccelerated() && viewRoot != null) { + if (mWebView.isHardwareAccelerated() + && mWebView.getLayerType() != View.LAYER_TYPE_SOFTWARE + && viewRoot != null) { functor = nativeGetDrawGLFunction(mNativeClass); if (functor != 0) { // force an invalidate if functor attach not successful @@ -7916,8 +8025,10 @@ private void updateTextSelectionFromMessage(int nodePointer, if (data.mSelectTextPtr != 0 && (data.mStart != data.mEnd || - (mFieldPointer == nodePointer && mFieldPointer != 0))) { - mIsCaretSelection = (data.mStart == data.mEnd); + (mFieldPointer == nodePointer && mFieldPointer != 0) || + (nodePointer == 0 && data.mStart == 0 && data.mEnd == 0))) { + mIsEditingText = (mFieldPointer == nodePointer) && nodePointer != 0; + mIsCaretSelection = (data.mStart == data.mEnd && nodePointer != 0); if (mIsCaretSelection && (mInputConnection == null || mInputConnection.getEditable().length() == 0)) { @@ -7926,11 +8037,10 @@ private void updateTextSelectionFromMessage(int nodePointer, } else { if (!mSelectingText) { setupWebkitSelect(); - } else if (!mSelectionStarted) { - syncSelectionCursors(); } else { - adjustSelectionCursors(); + syncSelectionCursors(); } + animateHandles(); if (mIsCaretSelection) { resetCaretTimer(); } @@ -7946,8 +8056,10 @@ private void scrollEditText(int scrollX, int scrollY) { float maxScrollX = getMaxTextScrollX(); float scrollPercentX = ((float)scrollX)/maxScrollX; mEditTextContent.offsetTo(-scrollX, -scrollY); - mWebViewCore.sendMessageAtFrontOfQueue(EventHub.SCROLL_TEXT_INPUT, 0, + mWebViewCore.removeMessages(EventHub.SCROLL_TEXT_INPUT); + mWebViewCore.sendMessage(EventHub.SCROLL_TEXT_INPUT, 0, scrollY, (Float)scrollPercentX); + animateHandles(); } private void beginTextBatch() { @@ -8391,14 +8503,6 @@ public void setBackgroundColor(int color) { mWebViewCore.sendMessage(EventHub.SET_BACKGROUND_COLOR, color); } - /** - * See {@link WebView#debugDump()} - */ - @Override - @Deprecated - public void debugDump() { - } - /** * Enable the communication b/t the webView and VideoViewProxy * @@ -8533,6 +8637,54 @@ public static void setShouldMonitorWebCoreThread() { WebViewCore.setShouldMonitorWebCoreThread(); } + @Override + public void dumpViewHierarchyWithProperties(BufferedWriter out, int level) { + int layer = getBaseLayer(); + if (layer != 0) { + try { + ByteArrayOutputStream stream = new ByteArrayOutputStream(); + ViewStateSerializer.dumpLayerHierarchy(layer, stream, level); + stream.close(); + byte[] buf = stream.toByteArray(); + out.write(new String(buf, "ascii")); + } catch (IOException e) {} + } + } + + @Override + public View findHierarchyView(String className, int hashCode) { + if (mNativeClass == 0) return null; + Picture pic = new Picture(); + if (!nativeDumpLayerContentToPicture(mNativeClass, className, hashCode, pic)) { + return null; + } + return new PictureWrapperView(getContext(), pic, mWebView); + } + + private static class PictureWrapperView extends View { + Picture mPicture; + WebView mWebView; + + public PictureWrapperView(Context context, Picture picture, WebView parent) { + super(context); + mPicture = picture; + mWebView = parent; + setWillNotDraw(false); + setRight(mPicture.getWidth()); + setBottom(mPicture.getHeight()); + } + + @Override + protected void onDraw(Canvas canvas) { + canvas.drawPicture(mPicture); + } + + @Override + public boolean post(Runnable action) { + return mWebView.post(action); + } + } + private native void nativeCreate(int ptr, String drawableDir, boolean isHighEndGfx); private native void nativeDebugDump(); private static native void nativeDestroy(int ptr); @@ -8553,6 +8705,8 @@ private native boolean nativeSetBaseLayer(int nativeInstance, int scrollingLayer); private native int nativeGetBaseLayer(int nativeInstance); private native void nativeCopyBaseContentToPicture(Picture pict); + private native boolean nativeDumpLayerContentToPicture(int nativeInstance, + String className, int layerId, Picture pict); private native boolean nativeHasContent(); private native void nativeStopGL(int ptr); private native void nativeDiscardAllTextures(); @@ -8596,4 +8750,7 @@ private static native void nativeMapLayerRect(int instance, int layerId, private static native int nativeSetHwAccelerated(int instance, boolean hwAccelerated); private static native void nativeFindMaxVisibleRect(int instance, int layerId, Rect visibleContentRect); + private static native boolean nativeIsHandleLeft(int instance, int handleId); + private static native boolean nativeIsPointVisible(int instance, + int layerId, int contentX, int contentY); } diff --git a/core/java/android/webkit/WebViewClient.java b/core/java/android/webkit/WebViewClient.java index 6aff10a958cc1..08a046a749922 100644 --- a/core/java/android/webkit/WebViewClient.java +++ b/core/java/android/webkit/WebViewClient.java @@ -204,43 +204,16 @@ public void onReceivedSslError(WebView view, SslErrorHandler handler, } /** - * Notify the host application that an SSL error occurred while loading a - * resource, but the WebView chose to proceed anyway based on a - * decision retained from a previous response to onReceivedSslError(). - * @hide - */ - public void onProceededAfterSslError(WebView view, SslError error) { - } - - /** - * Notify the host application to handle a SSL client certificate - * request (display the request to the user and ask whether to - * proceed with a client certificate or not). The host application - * has to call either handler.cancel() or handler.proceed() as the - * connection is suspended and waiting for the response. The - * default behavior is to cancel, returning no client certificate. - * - * @param view The WebView that is initiating the callback. - * @param handler A ClientCertRequestHandler object that will - * handle the user's response. - * @param host_and_port The host and port of the requesting server. + * Notifies the host application that the WebView received an HTTP + * authentication request. The host application can use the supplied + * {@link HttpAuthHandler} to set the WebView's response to the request. + * The default behavior is to cancel the request. * - * @hide - */ - public void onReceivedClientCertRequest(WebView view, - ClientCertRequestHandler handler, String host_and_port) { - handler.cancel(); - } - - /** - * Notify the host application to handle an authentication request. The - * default behavior is to cancel the request. - * - * @param view The WebView that is initiating the callback. - * @param handler The HttpAuthHandler that will handle the user's response. - * @param host The host requiring authentication. - * @param realm A description to help store user credentials for future - * visits. + * @param view the WebView that is initiating the callback + * @param handler the HttpAuthHandler used to set the WebView's response + * @param host the host requiring authentication + * @param realm the realm for which authentication is required + * @see Webview#getHttpAuthUsernamePassword */ public void onReceivedHttpAuthRequest(WebView view, HttpAuthHandler handler, String host, String realm) { diff --git a/core/java/android/webkit/WebViewClientClassicExt.java b/core/java/android/webkit/WebViewClientClassicExt.java new file mode 100644 index 0000000000000..a873585520171 --- /dev/null +++ b/core/java/android/webkit/WebViewClientClassicExt.java @@ -0,0 +1,53 @@ +/* + * 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.webkit; + +import android.net.http.SslError; + +/** + * Adds WebViewClassic specific extension methods to the WebViewClient callback class. + * These are not part of the public WebView API, so the class is hidden. + * @hide + */ +public class WebViewClientClassicExt extends WebViewClient { + + /** + * Notify the host application that an SSL error occurred while loading a + * resource, but the WebView chose to proceed anyway based on a + * decision retained from a previous response to onReceivedSslError(). + */ + public void onProceededAfterSslError(WebView view, SslError error) { + } + + /** + * Notify the host application to handle a SSL client certificate + * request (display the request to the user and ask whether to + * proceed with a client certificate or not). The host application + * has to call either handler.cancel() or handler.proceed() as the + * connection is suspended and waiting for the response. The + * default behavior is to cancel, returning no client certificate. + * + * @param view The WebView that is initiating the callback. + * @param handler A ClientCertRequestHandler object that will + * handle the user's response. + * @param host_and_port The host and port of the requesting server. + */ + public void onReceivedClientCertRequest(WebView view, + ClientCertRequestHandler handler, String host_and_port) { + handler.cancel(); + } +} diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java index 728ddbfc9fe11..c35b768130489 100644 --- a/core/java/android/webkit/WebViewCore.java +++ b/core/java/android/webkit/WebViewCore.java @@ -132,6 +132,8 @@ public final class WebViewCore { private int mRestoredX = 0; private int mRestoredY = 0; + private MockGeolocation mMockGeolocation = new MockGeolocation(this); + private DeviceMotionAndOrientationManager mDeviceMotionAndOrientationManager = new DeviceMotionAndOrientationManager(this); private DeviceMotionService mDeviceMotionService; @@ -441,7 +443,7 @@ private String openFileChooser(String acceptType, String capture) { } /** - * Notify the browser that the origin has exceeded it's database quota. + * Notify the embedding application that the origin has exceeded it's database quota. * @param url The URL that caused the overflow. * @param databaseIdentifier The identifier of the database. * @param quota The current quota for the origin. @@ -466,12 +468,15 @@ public void updateQuota(long newQuota) { } /** - * Notify the browser that the appcache has exceeded its max size. + * Notify the embedding application that the appcache has reached or exceeded its maximum + * allowed storage size. + * * @param requiredStorage is the amount of storage, in bytes, that would be * needed in order for the last appcache operation to succeed. + * @param maxSize maximum allowed Application Cache database size, in bytes. */ - protected void reachedMaxAppCacheSize(long requiredStorage) { - mCallbackProxy.onReachedMaxAppCacheSize(requiredStorage, getUsedQuota(), + protected void reachedMaxAppCacheSize(long requiredStorage, long maxSize) { + mCallbackProxy.onReachedMaxAppCacheSize(requiredStorage, maxSize, new WebStorage.QuotaUpdater() { @Override public void updateQuota(long newQuota) { @@ -559,24 +564,6 @@ protected boolean jsInterrupt() { return mCallbackProxy.onJsTimeout(); } - /** - * Notify the webview that this is an installable web app. - */ - protected void setInstallableWebApp() { - mCallbackProxy.setInstallableWebApp(); - } - - /** - * Notify the webview that we want to display the video layer fullscreen. - */ - protected void enterFullscreenForVideoLayer(int layerId, String url) { - if (mWebViewClassic == null) return; - Message message = Message.obtain(mWebViewClassic.mPrivateHandler, - WebViewClassic.ENTER_FULLSCREEN_VIDEO, layerId, 0); - message.obj = url; - message.sendToTarget(); - } - /** * Notify the webview that we want to exit the video fullscreen. * This is called through JNI by webcore. @@ -619,8 +606,6 @@ protected void exitFullscreenVideo() { */ private native void nativeNotifyAnimationStarted(int nativeClass); - private native boolean nativeFocusBoundsChanged(int nativeClass); - private native boolean nativeKey(int nativeClass, int keyCode, int unichar, int repeatCount, boolean isShift, boolean isAlt, boolean isSym, boolean isDown); @@ -839,6 +824,7 @@ static class BaseUrlData { static class JSInterfaceData { Object mObject; String mInterfaceName; + boolean mRequireAnnotation; } static class JSKeyData { @@ -960,7 +946,7 @@ static class TextFieldInitData { public int mMaxLength; public Rect mContentBounds; public int mNodeLayerId; - public Rect mContentRect; + public Rect mClientRect; } // mAction of TouchEventData can be MotionEvent.getAction() which uses the @@ -1199,6 +1185,7 @@ public class EventHub implements WebViewInputDispatcher.WebKitCallbacks { static final int SET_INITIAL_FOCUS = 224; static final int SAVE_VIEW_STATE = 225; + static final int SET_USE_MOCK_GEOLOCATION = 226; // Private handler for WebCore messages. private Handler mHandler; @@ -1291,6 +1278,7 @@ public void handleMessage(Message msg) { mBrowserFrame = null; mSettings.onDestroyed(); mNativeClass = 0; + WebCoreThreadWatchdog.unregisterWebView(mWebViewClassic); mWebViewClassic = null; } break; @@ -1306,13 +1294,8 @@ public void handleMessage(Message msg) { } else { xPercent = ((Float) msg.obj).floatValue(); } - Rect contentBounds = new Rect(); nativeScrollFocusedTextInput(mNativeClass, xPercent, - msg.arg2, contentBounds); - Message.obtain( - mWebViewClassic.mPrivateHandler, - WebViewClassic.UPDATE_CONTENT_BOUNDS, - contentBounds).sendToTarget(); + msg.arg2); break; case LOAD_URL: { @@ -1508,7 +1491,7 @@ public void handleMessage(Message msg) { case ADD_JS_INTERFACE: JSInterfaceData jsData = (JSInterfaceData) msg.obj; mBrowserFrame.addJavascriptInterface(jsData.mObject, - jsData.mInterfaceName); + jsData.mInterfaceName, jsData.mRequireAnnotation); break; case REMOVE_JS_INTERFACE: @@ -1660,6 +1643,10 @@ public void handleMessage(Message msg) { (Set) msg.obj); break; + case SET_USE_MOCK_GEOLOCATION: + setUseMockGeolocation(); + break; + case SET_USE_MOCK_DEVICE_ORIENTATION: setUseMockDeviceOrientation(); break; @@ -1708,13 +1695,9 @@ public void handleMessage(Message msg) { nativeInsertText(mNativeClass, (String) msg.obj); break; case SELECT_TEXT: { - int[] args = (int[]) msg.obj; - if (args == null) { - nativeClearTextSelection(mNativeClass); - } else { - nativeSelectText(mNativeClass, args[0], - args[1], args[2], args[3]); - } + int handleId = (Integer) msg.obj; + nativeSelectText(mNativeClass, handleId, + msg.arg1, msg.arg2); break; } case SELECT_WORD_AT: { @@ -2000,7 +1983,6 @@ void destroy() { mEventHub.sendMessageAtFrontOfQueue( Message.obtain(null, EventHub.DESTROY)); mEventHub.blockMessages(); - WebCoreThreadWatchdog.unregisterWebView(mWebViewClassic); } } @@ -2139,8 +2121,8 @@ private int calculateWindowWidth(int viewWidth) { return width; } - // Utility method for exceededDatabaseQuota and reachedMaxAppCacheSize - // callbacks. Computes the sum of database quota for all origins. + // Utility method for exceededDatabaseQuota callback. Computes the sum + // of WebSQL database quota for all origins. private long getUsedQuota() { WebStorageClassic webStorage = WebStorageClassic.getInstance(); Collection origins = webStorage.getOriginsSync(); @@ -2192,7 +2174,6 @@ static class DrawData { // only non-null if it is for the first picture set after the first layout ViewState mViewState; boolean mFirstLayoutForNonStandardLoad; - boolean mFocusSizeChanged; } DrawData mLastDrawData = null; @@ -2247,7 +2228,6 @@ private void webkitDraw() { private void webkitDraw(DrawData draw) { if (mWebViewClassic != null) { - draw.mFocusSizeChanged = nativeFocusBoundsChanged(mNativeClass); draw.mViewSize = new Point(mCurrentViewWidth, mCurrentViewHeight); if (mSettings.getUseWideViewPort()) { draw.mMinPrefWidth = Math.max( @@ -2330,7 +2310,6 @@ static void pauseUpdatePicture(WebViewCore core) { Log.w(LOGTAG, "Cannot pauseUpdatePicture, core destroyed or not initialized!"); return; } - core.nativeSetIsPaused(core.mNativeClass, true); core.mDrawIsPaused = true; } } @@ -2348,7 +2327,6 @@ static void resumeUpdatePicture(WebViewCore core) { Log.w(LOGTAG, "Cannot resumeUpdatePicture, core destroyed!"); return; } - core.nativeSetIsPaused(core.mNativeClass, false); core.mDrawIsPaused = false; // always redraw on resume to reenable gif animations core.mDrawIsScheduled = false; @@ -2363,13 +2341,13 @@ static boolean isUpdatePicturePaused(WebViewCore core) { ////////////////////////////////////////////////////////////////////////// private void restoreState(int index) { - WebBackForwardList list = mCallbackProxy.getBackForwardList(); + WebBackForwardListClassic list = mCallbackProxy.getBackForwardList(); int size = list.getSize(); for (int i = 0; i < size; i++) { list.getItemAtIndex(i).inflate(mBrowserFrame.mNativeFrame); } mBrowserFrame.mLoadInitFromJava = true; - list.restoreIndex(mBrowserFrame.mNativeFrame, index); + WebBackForwardListClassic.restoreIndex(mBrowserFrame.mNativeFrame, index); mBrowserFrame.mLoadInitFromJava = false; } @@ -2501,6 +2479,13 @@ private void updateViewport() { setupViewport(true); } + static float getFixedDisplayDensity(Context context) { + // We make bad assumptions about multiplying and dividing density by 100, + // force them to be true with this hack + float density = context.getResources().getDisplayMetrics().density; + return ((int) (density * 100)) / 100.0f; + } + private void setupViewport(boolean updateViewState) { if (mWebViewClassic == null || mSettings == null) { // We've been destroyed or are being destroyed, return early @@ -2545,11 +2530,13 @@ private void setupViewport(boolean updateViewState) { // adjust the default scale to match the densityDpi float adjust = 1.0f; if (mViewportDensityDpi == -1) { - adjust = mContext.getResources().getDisplayMetrics().density; + adjust = getFixedDisplayDensity(mContext); } else if (mViewportDensityDpi > 0) { adjust = (float) mContext.getResources().getDisplayMetrics().densityDpi / mViewportDensityDpi; + adjust = ((int) (adjust * 100)) / 100.0f; } + // Remove any update density messages in flight. // If the density is indeed different from WebView's default scale, // a new message will be queued. @@ -2787,14 +2774,11 @@ private void needTouchEvents(boolean need) { } // called by JNI - private void updateTextfield(int ptr, boolean changeToPassword, - String text, int textGeneration) { + private void updateTextfield(int ptr, String text, int textGeneration) { if (mWebViewClassic != null) { - Message msg = Message.obtain(mWebViewClassic.mPrivateHandler, + Message.obtain(mWebViewClassic.mPrivateHandler, WebViewClassic.UPDATE_TEXTFIELD_TEXT_MSG_ID, ptr, - textGeneration, text); - msg.getData().putBoolean("password", changeToPassword); - msg.sendToTarget(); + textGeneration, text).sendToTarget(); } } @@ -2855,7 +2839,7 @@ private native String nativeRequestLabel(int nativeClass, int framePtr, * Scroll the focused textfield to (xPercent, y) in document space */ private native void nativeScrollFocusedTextInput(int nativeClass, - float xPercent, int y, Rect contentBounds); + float xPercent, int y); // these must be in document space (i.e. not scaled/zoomed). private native void nativeSetScrollOffset(int nativeClass, @@ -3063,6 +3047,22 @@ private void setUseMockDeviceOrientation() { mDeviceMotionAndOrientationManager.setUseMock(); } + private void setUseMockGeolocation() { + mMockGeolocation.setUseMock(); + } + + public void setMockGeolocationPosition(double latitude, double longitude, double accuracy) { + mMockGeolocation.setPosition(latitude, longitude, accuracy); + } + + public void setMockGeolocationError(int code, String message) { + mMockGeolocation.setError(code, message); + } + + public void setMockGeolocationPermission(boolean allow) { + mMockGeolocation.setPermission(allow); + } + public void setMockDeviceOrientation(boolean canProvideAlpha, double alpha, boolean canProvideBeta, double beta, boolean canProvideGamma, double gamma) { mDeviceMotionAndOrientationManager.setMockOrientation(canProvideAlpha, alpha, @@ -3089,7 +3089,6 @@ static void setShouldMonitorWebCoreThread() { sShouldMonitorWebCoreThread = true; } - private native void nativeSetIsPaused(int nativeClass, boolean isPaused); private native void nativePause(int nativeClass); private native void nativeResume(int nativeClass); private native void nativeFreeMemory(int nativeClass); @@ -3135,7 +3134,7 @@ private native void nativeDeleteText(int nativeClass, private native String nativeGetText(int nativeClass, int startX, int startY, int endX, int endY); private native void nativeSelectText(int nativeClass, - int startX, int startY, int endX, int endY); + int handleId, int x, int y); private native void nativeClearTextSelection(int nativeClass); private native boolean nativeSelectWordAt(int nativeClass, int x, int y); private native void nativeSelectAll(int nativeClass); diff --git a/core/java/android/webkit/WebViewDatabase.java b/core/java/android/webkit/WebViewDatabase.java index 9d10d67be0f7f..559725994d139 100644 --- a/core/java/android/webkit/WebViewDatabase.java +++ b/core/java/android/webkit/WebViewDatabase.java @@ -23,13 +23,15 @@ * application has stored any of the following types of browsing data and * to clear any such stored data for all WebViews in the application. *
            - *
          • Username/password pairs entered into web forms
          • + *
          • Username/password pairs for web forms
          • *
          • HTTP authentication username/password pairs
          • *
          • Data entered into text fields (e.g. for autocomplete suggestions)
          • *
          */ public class WebViewDatabase { - // TODO: deprecate/hide this. + /** + * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} + */ protected static final String LOGTAG = "webviewdatabase"; /** @@ -38,55 +40,70 @@ public class WebViewDatabase { protected WebViewDatabase() { } - public static synchronized WebViewDatabase getInstance(Context context) { + public static WebViewDatabase getInstance(Context context) { return WebViewFactory.getProvider().getWebViewDatabase(context); } /** - * Gets whether there are any username/password combinations - * from web pages saved. + * Gets whether there are any saved username/password pairs for web forms. + * Note that these are unrelated to HTTP authentication credentials. * - * @return true if there are any username/passwords used in web - * forms saved + * @return true if there are any saved username/password pairs + * @see WebView#savePassword + * @see clearUsernamePassword */ public boolean hasUsernamePassword() { throw new MustOverrideException(); } /** - * Clears any username/password combinations saved from web forms. + * Clears any saved username/password pairs for web forms. + * Note that these are unrelated to HTTP authentication credentials. + * + * @see WebView#savePassword + * @see hasUsernamePassword */ public void clearUsernamePassword() { throw new MustOverrideException(); } /** - * Gets whether there are any HTTP authentication username/password combinations saved. + * Gets whether there are any saved credentials for HTTP authentication. * - * @return true if there are any HTTP authentication username/passwords saved + * @return whether there are any saved credentials + * @see Webview#getHttpAuthUsernamePassword + * @see Webview#setHttpAuthUsernamePassword + * @see clearHttpAuthUsernamePassword */ public boolean hasHttpAuthUsernamePassword() { throw new MustOverrideException(); } /** - * Clears any HTTP authentication username/passwords that are saved. + * Clears any saved credentials for HTTP authentication. + * + * @see Webview#getHttpAuthUsernamePassword + * @see Webview#setHttpAuthUsernamePassword + * @see hasHttpAuthUsernamePassword */ public void clearHttpAuthUsernamePassword() { throw new MustOverrideException(); } /** - * Gets whether there is any previously-entered form data saved. + * Gets whether there is any saved data for web forms. * - * @return true if there is form data saved + * @return whether there is any saved data for web forms + * @see clearFormData */ public boolean hasFormData() { throw new MustOverrideException(); } /** - * Clears any stored previously-entered form data. + * Clears any saved data for web forms. + * + * @see hasFormData */ public void clearFormData() { throw new MustOverrideException(); diff --git a/core/java/android/webkit/WebViewDatabaseClassic.java b/core/java/android/webkit/WebViewDatabaseClassic.java index 9b1d4cb929866..be0102874ff8b 100644 --- a/core/java/android/webkit/WebViewDatabaseClassic.java +++ b/core/java/android/webkit/WebViewDatabaseClassic.java @@ -52,6 +52,7 @@ final class WebViewDatabaseClassic extends WebViewDatabase { // implemented for b/5265606. private static WebViewDatabaseClassic sInstance = null; + private static final Object sInstanceLock = new Object(); private static SQLiteDatabase sDatabase = null; @@ -99,7 +100,8 @@ final class WebViewDatabaseClassic extends WebViewDatabase { // Initially true until the background thread completes. private boolean mInitialized = false; - WebViewDatabaseClassic(final Context context) { + private WebViewDatabaseClassic(final Context context) { + JniUtil.setContext(context); new Thread() { @Override public void run() { @@ -110,11 +112,13 @@ public void run() { // Singleton only, use getInstance() } - public static synchronized WebViewDatabaseClassic getInstance(Context context) { - if (sInstance == null) { - sInstance = new WebViewDatabaseClassic(context); + public static WebViewDatabaseClassic getInstance(Context context) { + synchronized (sInstanceLock) { + if (sInstance == null) { + sInstance = new WebViewDatabaseClassic(context); + } + return sInstance; } - return sInstance; } private synchronized void init(Context context) { diff --git a/core/java/android/webkit/WebViewFactory.java b/core/java/android/webkit/WebViewFactory.java index 73ae9109b5171..b833a010c45c5 100644 --- a/core/java/android/webkit/WebViewFactory.java +++ b/core/java/android/webkit/WebViewFactory.java @@ -16,14 +16,23 @@ package android.webkit; +import android.os.Build; +import android.os.StrictMode; +import android.os.SystemProperties; import android.util.Log; +import dalvik.system.PathClassLoader; + /** * Top level factory, used creating all the main WebView implementation classes. */ class WebViewFactory { // Default Provider factory class name. - private static final String DEFAULT_WEB_VIEW_FACTORY = "android.webkit.WebViewClassic$Factory"; + // TODO: When the Chromium powered WebView is ready, it should be the default factory class. + private static final String DEFAULT_WEBVIEW_FACTORY = "android.webkit.WebViewClassic$Factory"; + private static final String CHROMIUM_WEBVIEW_FACTORY = + "com.android.webviewchromium.WebViewChromiumFactoryProvider"; + private static final String CHROMIUM_WEBVIEW_JAR = "/system/framework/webviewchromium.jar"; private static final String LOGTAG = "WebViewFactory"; @@ -32,24 +41,54 @@ class WebViewFactory { // Cache the factory both for efficiency, and ensure any one process gets all webviews from the // same provider. private static WebViewFactoryProvider sProviderInstance; + private static final Object sProviderLock = new Object(); + + static WebViewFactoryProvider getProvider() { + synchronized (sProviderLock) { + // For now the main purpose of this function (and the factory abstraction) is to keep + // us honest and minimize usage of WebViewClassic internals when binding the proxy. + if (sProviderInstance != null) return sProviderInstance; - static synchronized WebViewFactoryProvider getProvider() { - // For now the main purpose of this function (and the factory abstraction) is to keep - // us honest and minimize usage of WebViewClassic internals when binding the proxy. - if (sProviderInstance != null) return sProviderInstance; + // For debug builds, we allow a system property to specify that we should use the + // Chromium powered WebView. This enables us to switch between implementations + // at runtime. For user (release) builds, don't allow this. + if (Build.IS_DEBUGGABLE && SystemProperties.getBoolean("webview.use_chromium", false)) { + StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskReads(); + try { + sProviderInstance = loadChromiumProvider(); + if (DEBUG) Log.v(LOGTAG, "Loaded Chromium provider: " + sProviderInstance); + } finally { + StrictMode.setThreadPolicy(oldPolicy); + } + } - sProviderInstance = getFactoryByName(DEFAULT_WEB_VIEW_FACTORY); - if (sProviderInstance == null) { - if (DEBUG) Log.v(LOGTAG, "Falling back to explicit linkage"); - sProviderInstance = new WebViewClassic.Factory(); + if (sProviderInstance == null) { + if (DEBUG) Log.v(LOGTAG, "Falling back to default provider: " + + DEFAULT_WEBVIEW_FACTORY); + sProviderInstance = getFactoryByName(DEFAULT_WEBVIEW_FACTORY, + WebViewFactory.class.getClassLoader()); + if (sProviderInstance == null) { + if (DEBUG) Log.v(LOGTAG, "Falling back to explicit linkage"); + sProviderInstance = new WebViewClassic.Factory(); + } + } + return sProviderInstance; } - return sProviderInstance; } - private static WebViewFactoryProvider getFactoryByName(String providerName) { + // TODO: This allows us to have the legacy and Chromium WebView coexist for development + // and side-by-side testing. After transition, remove this when no longer required. + private static WebViewFactoryProvider loadChromiumProvider() { + ClassLoader clazzLoader = new PathClassLoader(CHROMIUM_WEBVIEW_JAR, null, + WebViewFactory.class.getClassLoader()); + return getFactoryByName(CHROMIUM_WEBVIEW_FACTORY, clazzLoader); + } + + private static WebViewFactoryProvider getFactoryByName(String providerName, + ClassLoader loader) { try { if (DEBUG) Log.v(LOGTAG, "attempt to load class " + providerName); - Class c = Class.forName(providerName); + Class c = Class.forName(providerName, true, loader); if (DEBUG) Log.v(LOGTAG, "instantiating factory"); return (WebViewFactoryProvider) c.newInstance(); } catch (ClassNotFoundException e) { diff --git a/core/java/android/webkit/WebViewFactoryProvider.java b/core/java/android/webkit/WebViewFactoryProvider.java index 1d302f1983a08..934ef83db185d 100644 --- a/core/java/android/webkit/WebViewFactoryProvider.java +++ b/core/java/android/webkit/WebViewFactoryProvider.java @@ -42,6 +42,12 @@ interface Statics { * {@link android.webkit.WebView#disablePlatformNotifications()} */ void setPlatformNotificationsEnabled(boolean enable); + + /** + * Implements the API method: + * {@link android.webkit.WebSettings#getDefaultUserAgent(Context) } + */ + String getDefaultUserAgent(Context context); } Statics getStatics(); diff --git a/core/java/android/webkit/WebViewProvider.java b/core/java/android/webkit/WebViewProvider.java index 867ee5428e9ec..c9f9fbd555d6e 100644 --- a/core/java/android/webkit/WebViewProvider.java +++ b/core/java/android/webkit/WebViewProvider.java @@ -37,6 +37,7 @@ import android.webkit.WebView.HitTestResult; import android.webkit.WebView.PictureListener; +import java.io.BufferedWriter; import java.io.File; import java.util.Map; @@ -220,8 +221,6 @@ public void loadDataWithBaseURL(String baseUrl, String data, public WebSettings getSettings(); - public void emulateShiftHeld(); - public void setMapTrackballToArrowKeys(boolean setMap); public void flingScroll(int vx, int vy); @@ -236,7 +235,9 @@ public void loadDataWithBaseURL(String baseUrl, String data, public boolean zoomOut(); - public void debugDump(); + public void dumpViewHierarchyWithProperties(BufferedWriter out, int level); + + public View findHierarchyView(String className, int hashCode); //------------------------------------------------------------------------- // Provider glue methods diff --git a/core/java/android/webkit/ZoomControlEmbedded.java b/core/java/android/webkit/ZoomControlEmbedded.java index d2a05619ec32f..ae19832d01e46 100644 --- a/core/java/android/webkit/ZoomControlEmbedded.java +++ b/core/java/android/webkit/ZoomControlEmbedded.java @@ -90,7 +90,7 @@ private ZoomButtonsController getControls() { View controls = mZoomButtonsController.getZoomControls(); ViewGroup.LayoutParams params = controls.getLayoutParams(); if (params instanceof FrameLayout.LayoutParams) { - ((FrameLayout.LayoutParams) params).gravity = Gravity.RIGHT; + ((FrameLayout.LayoutParams) params).gravity = Gravity.END; } } return mZoomButtonsController; diff --git a/core/java/android/webkit/ZoomManager.java b/core/java/android/webkit/ZoomManager.java index 80a67826e1d62..1d864e5366537 100644 --- a/core/java/android/webkit/ZoomManager.java +++ b/core/java/android/webkit/ZoomManager.java @@ -287,6 +287,7 @@ private void setDefaultZoomScale(float defaultScale) { if (!exceedsMinScaleIncrement(mMinZoomScale, mMaxZoomScale)) { mMaxZoomScale = mMinZoomScale; } + sanitizeMinMaxScales(); } public final float getScale() { @@ -909,6 +910,14 @@ public void onScaleEnd(ScaleGestureDetector detector) { } } + private void sanitizeMinMaxScales() { + if (mMinZoomScale > mMaxZoomScale) { + Log.w(LOGTAG, "mMinZoom > mMaxZoom!!! " + mMinZoomScale + " > " + mMaxZoomScale, + new Exception()); + mMaxZoomScale = mMinZoomScale; + } + } + public void onSizeChanged(int w, int h, int ow, int oh) { // reset zoom and anchor to the top left corner of the screen // unless we are already zooming @@ -933,6 +942,7 @@ public void onSizeChanged(int w, int h, int ow, int oh) { if (mInitialScale > 0 && mInitialScale < mMinZoomScale) { mMinZoomScale = mInitialScale; } + sanitizeMinMaxScales(); } dismissZoomPicker(); @@ -1004,6 +1014,7 @@ public void updateZoomRange(WebViewCore.ViewState viewState, } else { mMaxZoomScale = viewState.mMaxScale; } + sanitizeMinMaxScales(); } /** @@ -1033,6 +1044,7 @@ public boolean onNewPicture(WebViewCore.DrawData drawData) { if (!mMinZoomScaleFixed || settings.getUseWideViewPort()) { mMinZoomScale = newZoomOverviewScale; mMaxZoomScale = Math.max(mMaxZoomScale, mMinZoomScale); + sanitizeMinMaxScales(); } // fit the content width to the current view for the first new picture // after first layout. @@ -1113,6 +1125,7 @@ public void onFirstLayout(WebViewCore.DrawData drawData) { mMinZoomScale = (mInitialScale > 0) ? Math.min(mInitialScale, overviewScale) : overviewScale; mMaxZoomScale = Math.max(mMaxZoomScale, mMinZoomScale); + sanitizeMinMaxScales(); } if (!mWebView.drawHistory()) { diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java index 437da59333429..33a8531194ac0 100644 --- a/core/java/android/widget/AbsListView.java +++ b/core/java/android/widget/AbsListView.java @@ -40,7 +40,6 @@ import android.util.StateSet; import android.view.ActionMode; import android.view.ContextMenu.ContextMenuInfo; -import android.view.FocusFinder; import android.view.Gravity; import android.view.HapticFeedbackConstants; import android.view.InputDevice; @@ -66,6 +65,7 @@ import android.view.inputmethod.InputConnection; import android.view.inputmethod.InputConnectionWrapper; import android.view.inputmethod.InputMethodManager; +import android.widget.RemoteViews.OnClickHandler; import com.android.internal.R; @@ -675,6 +675,14 @@ public abstract class AbsListView extends AdapterView implements Te */ static final Interpolator sLinearInterpolator = new LinearInterpolator(); + /** + * The saved state that we will be restoring from when we next sync. + * Kept here so that if we happen to be asked to save our state before + * the sync happens, we can return this existing data rather than losing + * it. + */ + private SavedState mPendingSync; + /** * Interface definition for a callback to be invoked when the list or grid * has been scrolled. @@ -974,6 +982,12 @@ public void setItemChecked(int position, boolean value) { // Start selection mode if needed. We don't need to if we're unchecking something. if (value && mChoiceMode == CHOICE_MODE_MULTIPLE_MODAL && mChoiceActionMode == null) { + if (mMultiChoiceModeCallback == null || + !mMultiChoiceModeCallback.hasWrappedCallback()) { + throw new IllegalStateException("AbsListView: attempted to start selection mode " + + "for CHOICE_MODE_MULTIPLE_MODAL but no choice mode callback was " + + "supplied. Call setMultiChoiceModeListener to set a callback."); + } mChoiceActionMode = startActionMode(mMultiChoiceModeCallback); } @@ -1041,29 +1055,29 @@ public boolean performItemClick(View view, int position, long id) { if (mChoiceMode == CHOICE_MODE_MULTIPLE || (mChoiceMode == CHOICE_MODE_MULTIPLE_MODAL && mChoiceActionMode != null)) { - boolean newValue = !mCheckStates.get(position, false); - mCheckStates.put(position, newValue); + boolean checked = !mCheckStates.get(position, false); + mCheckStates.put(position, checked); if (mCheckedIdStates != null && mAdapter.hasStableIds()) { - if (newValue) { + if (checked) { mCheckedIdStates.put(mAdapter.getItemId(position), position); } else { mCheckedIdStates.delete(mAdapter.getItemId(position)); } } - if (newValue) { + if (checked) { mCheckedItemCount++; } else { mCheckedItemCount--; } if (mChoiceActionMode != null) { mMultiChoiceModeCallback.onItemCheckedStateChanged(mChoiceActionMode, - position, id, newValue); + position, id, checked); dispatchItemClick = false; } checkedStateChanged = true; } else if (mChoiceMode == CHOICE_MODE_SINGLE) { - boolean newValue = !mCheckStates.get(position, false); - if (newValue) { + boolean checked = !mCheckStates.get(position, false); + if (checked) { mCheckStates.clear(); mCheckStates.put(position, true); if (mCheckedIdStates != null && mAdapter.hasStableIds()) { @@ -1328,150 +1342,6 @@ void invokeOnItemScrollListener() { onScrollChanged(0, 0, 0, 0); // dummy values, View's implementation does not use these. } - @Override - public void addFocusables(ArrayList views, int direction, int focusableMode) { - if ((focusableMode & FOCUSABLES_ACCESSIBILITY) == FOCUSABLES_ACCESSIBILITY) { - switch(direction) { - case ACCESSIBILITY_FOCUS_BACKWARD: { - View focusable = (getChildCount() > 0) ? getChildAt(getChildCount() - 1) : this; - if (focusable.isAccessibilityFocusable()) { - views.add(focusable); - } - } return; - case ACCESSIBILITY_FOCUS_FORWARD: { - if (isAccessibilityFocusable()) { - views.add(this); - } - } return; - } - } - super.addFocusables(views, direction, focusableMode); - } - - @Override - public View focusSearch(int direction) { - return focusSearch(this, direction); - } - - @Override - public View focusSearch(View focused, int direction) { - switch (direction) { - case ACCESSIBILITY_FOCUS_FORWARD: { - // If we are the focused view try giving it to the first child. - if (focused == this) { - final int childCount = getChildCount(); - for (int i = 0; i < childCount; i++) { - View child = getChildAt(i); - if (child.getVisibility() == View.VISIBLE) { - return child; - } - } - return super.focusSearch(this, direction); - } - // Find the item that has the focused view. - final int currentPosition = getPositionForView(focused); - if (currentPosition < 0 || currentPosition >= getCount()) { - return super.focusSearch(this, direction); - } - // Try to advance focus in the current item. - View currentItem = getChildAt(currentPosition - getFirstVisiblePosition()); - if (currentItem.getVisibility() == View.VISIBLE) { - if (currentItem instanceof ViewGroup) { - ViewGroup currentItemGroup = (ViewGroup) currentItem; - View nextFocus = FocusFinder.getInstance().findNextFocus(currentItemGroup, - focused, direction); - if (nextFocus != null && nextFocus != currentItemGroup - && nextFocus != focused) { - return nextFocus; - } - } - } - // Try to move focus to the next item. - final int nextPosition = currentPosition - getFirstVisiblePosition() + 1; - for (int i = nextPosition; i < getChildCount(); i++) { - View child = getChildAt(i); - if (child.getVisibility() == View.VISIBLE) { - return child; - } - } - // No next item start searching from the list. - return super.focusSearch(this, direction); - } - case ACCESSIBILITY_FOCUS_BACKWARD: { - // If we are the focused search from the view that is - // as closer to the bottom as possible. - if (focused == this) { - final int childCount = getChildCount(); - for (int i = childCount - 1; i >= 0; i--) { - View child = getChildAt(i); - if (child.getVisibility() == View.VISIBLE) { - return super.focusSearch(child, direction); - } - } - return super.focusSearch(this, direction); - } - // Find the item that has the focused view. - final int currentPosition = getPositionForView(focused); - if (currentPosition < 0 || currentPosition >= getCount()) { - return super.focusSearch(this, direction); - } - - View currentItem = getChildAt(currentPosition - getFirstVisiblePosition()); - - // If a list item is the focused view we try to find a view - // in the previous item since in reverse the item contents - // get accessibility focus before the item itself. - if (currentItem == focused) { - currentItem = null; - focused = null; - // This list gets accessibility focus after the last item. - final int previousPosition = currentPosition - getFirstVisiblePosition() - 1; - for (int i = previousPosition; i >= 0; i--) { - View child = getChildAt(i); - if (child.getVisibility() == View.VISIBLE) { - currentItem = child; - break; - } - } - if (currentItem == null) { - return this; - } - } - - if (currentItem.getVisibility() == View.VISIBLE) { - // Search into the item. - if (currentItem instanceof ViewGroup) { - ViewGroup currentItemGroup = (ViewGroup) currentItem; - View nextFocus = FocusFinder.getInstance().findNextFocus(currentItemGroup, - focused, direction); - if (nextFocus != null && nextFocus != currentItemGroup - && nextFocus != focused) { - return nextFocus; - } - } - - // If not item content wants focus we give it to the item. - return currentItem; - } - - return super.focusSearch(this, direction); - } - } - return super.focusSearch(focused, direction); - } - - /** - * @hide - */ - @Override - public View findViewToTakeAccessibilityFocusFromHover(View child, View descendant) { - final int position = getPositionForView(child); - if (position != INVALID_POSITION) { - return getChildAt(position - mFirstPosition); - } - return super.findViewToTakeAccessibilityFocusFromHover(child, descendant); - } - @Override public void sendAccessibilityEvent(int eventType) { // Since this class calls onScrollChanged even if the mFirstPosition and the @@ -1751,6 +1621,21 @@ public Parcelable onSaveInstanceState() { SavedState ss = new SavedState(superState); + if (mPendingSync != null) { + // Just keep what we last restored. + ss.selectedId = mPendingSync.selectedId; + ss.firstId = mPendingSync.firstId; + ss.viewTop = mPendingSync.viewTop; + ss.position = mPendingSync.position; + ss.height = mPendingSync.height; + ss.filter = mPendingSync.filter; + ss.inActionMode = mPendingSync.inActionMode; + ss.checkedItemCount = mPendingSync.checkedItemCount; + ss.checkState = mPendingSync.checkState; + ss.checkIdState = mPendingSync.checkIdState; + return ss; + } + boolean haveChildren = getChildCount() > 0 && mItemCount > 0; long selectedId = getSelectedItemId(); ss.selectedId = selectedId; @@ -1831,6 +1716,7 @@ public void onRestoreInstanceState(Parcelable state) { if (ss.selectedId >= 0) { mNeedSync = true; + mPendingSync = ss; mSyncRowId = ss.selectedId; mSyncPosition = ss.position; mSpecificTop = ss.viewTop; @@ -1841,6 +1727,7 @@ public void onRestoreInstanceState(Parcelable state) { setNextSelectedPositionInt(INVALID_POSITION); mSelectorPosition = INVALID_POSITION; mNeedSync = true; + mPendingSync = ss; mSyncRowId = ss.firstId; mSyncPosition = ss.position; mSpecificTop = ss.viewTop; @@ -1942,6 +1829,7 @@ void resetList() { mDataChanged = false; mPositionScrollAfterLayout = null; mNeedSync = false; + mPendingSync = null; mOldSelectedPosition = INVALID_POSITION; mOldSelectedRowId = INVALID_ROW_ID; setSelectedPositionInt(INVALID_POSITION); @@ -2297,7 +2185,9 @@ View obtainView(int position, boolean[] isScrap) { if (mAccessibilityDelegate == null) { mAccessibilityDelegate = new ListItemAccessibilityDelegate(); } - child.setAccessibilityDelegate(mAccessibilityDelegate); + if (child.getAccessibilityDelegate() == null) { + child.setAccessibilityDelegate(mAccessibilityDelegate); + } } return child; @@ -5346,6 +5236,7 @@ protected void handleDataChanged() { if (mNeedSync) { // Update this first, since setNextSelectedPositionInt inspects it mNeedSync = false; + mPendingSync = null; if (mTranscriptMode == TRANSCRIPT_MODE_ALWAYS_SCROLL) { mLayoutMode = LAYOUT_FORCE_BOTTOM; @@ -5461,6 +5352,7 @@ protected void handleDataChanged() { mNextSelectedPosition = INVALID_POSITION; mNextSelectedRowId = INVALID_ROW_ID; mNeedSync = false; + mPendingSync = null; mSelectorPosition = INVALID_POSITION; checkSelectionChanged(); } @@ -5983,6 +5875,21 @@ public void setRemoteViewsAdapter(Intent intent) { } } + /** + * Sets up the onClickHandler to be used by the RemoteViewsAdapter when inflating RemoteViews + * + * @param handler The OnClickHandler to use when inflating RemoteViews. + * + * @hide + */ + public void setRemoteViewsOnClickHandler(OnClickHandler handler) { + // Ensure that we don't already have a RemoteViewsAdapter that is bound to an existing + // service handling the specified intent. + if (mRemoteAdapter != null) { + mRemoteAdapter.setRemoteViewsOnClickHandler(handler); + } + } + /** * This defers a notifyDataSetChanged on the pending RemoteViewsAdapter if it has not * connected yet. @@ -6090,6 +5997,10 @@ public void setWrapped(MultiChoiceModeListener wrapped) { mWrapped = wrapped; } + public boolean hasWrappedCallback() { + return mWrapped != null; + } + public boolean onCreateActionMode(ActionMode mode, Menu menu) { if (mWrapped.onCreateActionMode(mode, menu)) { // Initialize checked graphic state? diff --git a/core/java/android/widget/AbsSeekBar.java b/core/java/android/widget/AbsSeekBar.java index e217e4fcb6a7f..3b5e75b91d979 100644 --- a/core/java/android/widget/AbsSeekBar.java +++ b/core/java/android/widget/AbsSeekBar.java @@ -107,6 +107,9 @@ public void setThumb(Drawable thumb) { } if (thumb != null) { thumb.setCallback(this); + if (canResolveLayoutDirection()) { + thumb.setLayoutDirection(getLayoutDirection()); + } // Assuming the thumb drawable is symmetric, set the thumb offset // such that the thumb will hang halfway off either edge of the @@ -238,6 +241,7 @@ void onProgressRefresh(float scale, boolean fromUser) { @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { + super.onSizeChanged(w, h, oldw, oldh); updateThumbPos(w, h); } @@ -301,9 +305,22 @@ private void setThumbPos(int w, Drawable thumb, float scale, int gap) { } // Canvas will be translated, so 0,0 is where we start drawing - thumb.setBounds(thumbPos, topBound, thumbPos + thumbWidth, bottomBound); + final int left = isLayoutRtl() ? available - thumbPos : thumbPos; + thumb.setBounds(left, topBound, left + thumbWidth, bottomBound); } - + + /** + * @hide + */ + @Override + public void onResolveDrawables(int layoutDirection) { + super.onResolveDrawables(layoutDirection); + + if (mThumb != null) { + mThumb.setLayoutDirection(layoutDirection); + } + } + @Override protected synchronized void onDraw(Canvas canvas) { super.onDraw(canvas); @@ -409,15 +426,25 @@ private void trackTouchEvent(MotionEvent event) { int x = (int)event.getX(); float scale; float progress = 0; - if (x < mPaddingLeft) { - scale = 0.0f; - } else if (x > width - mPaddingRight) { - scale = 1.0f; + if (isLayoutRtl()) { + if (x > width - mPaddingRight) { + scale = 0.0f; + } else if (x < mPaddingLeft) { + scale = 1.0f; + } else { + scale = (float)(available - x + mPaddingLeft) / (float)available; + progress = mTouchProgressOffset; + } } else { - scale = (float)(x - mPaddingLeft) / (float)available; - progress = mTouchProgressOffset; + if (x < mPaddingLeft) { + scale = 0.0f; + } else if (x > width - mPaddingRight) { + scale = 1.0f; + } else { + scale = (float)(x - mPaddingLeft) / (float)available; + progress = mTouchProgressOffset; + } } - final int max = getMax(); progress += scale * max; @@ -529,4 +556,23 @@ public boolean performAccessibilityAction(int action, Bundle arguments) { } return false; } + + @Override + public void onRtlPropertiesChanged(int layoutDirection) { + super.onRtlPropertiesChanged(layoutDirection); + + int max = getMax(); + float scale = max > 0 ? (float) getProgress() / (float) max : 0; + + Drawable thumb = mThumb; + if (thumb != null) { + setThumbPos(getWidth(), thumb, scale, Integer.MIN_VALUE); + /* + * Since we draw translated, the drawable's bounds that it signals + * for invalidation won't be the actual bounds we want invalidated, + * so just invalidate this whole view. + */ + invalidate(); + } + } } diff --git a/core/java/android/widget/ActivityChooserModel.java b/core/java/android/widget/ActivityChooserModel.java index fe6c4f5477ac9..736566e451128 100644 --- a/core/java/android/widget/ActivityChooserModel.java +++ b/core/java/android/widget/ActivityChooserModel.java @@ -21,7 +21,6 @@ import android.content.Intent; import android.content.pm.ResolveInfo; import android.database.DataSetObservable; -import android.database.DataSetObserver; import android.os.AsyncTask; import android.text.TextUtils; import android.util.Log; @@ -458,13 +457,18 @@ public int getActivityIndex(ResolveInfo activity) { *

          * * @return An {@link Intent} for launching the activity or null if the - * policy has consumed the intent. + * policy has consumed the intent or there is not current intent + * set via {@link #setIntent(Intent)}. * * @see HistoricalRecord * @see OnChooseActivityListener */ public Intent chooseActivity(int index) { synchronized (mInstanceLock) { + if (mIntent == null) { + return null; + } + ensureConsistentState(); ActivityResolveInfo chosenActivity = mActivities.get(index); diff --git a/core/java/android/widget/ActivityChooserView.java b/core/java/android/widget/ActivityChooserView.java index 4eb169bf9a6d2..2037c3afa28f9 100644 --- a/core/java/android/widget/ActivityChooserView.java +++ b/core/java/android/widget/ActivityChooserView.java @@ -497,7 +497,7 @@ private void updateAppearance() { // Default activity button. final int activityCount = mAdapter.getActivityCount(); final int historySize = mAdapter.getHistorySize(); - if (activityCount > 0 && historySize > 0) { + if (activityCount==1 || activityCount > 1 && historySize > 0) { mDefaultActivityButton.setVisibility(VISIBLE); ResolveInfo activity = mAdapter.getDefaultActivity(); PackageManager packageManager = mContext.getPackageManager(); diff --git a/core/java/android/widget/AdapterViewAnimator.java b/core/java/android/widget/AdapterViewAnimator.java index 2266cea8a92cd..90e949aef9340 100644 --- a/core/java/android/widget/AdapterViewAnimator.java +++ b/core/java/android/widget/AdapterViewAnimator.java @@ -31,6 +31,7 @@ import android.view.ViewGroup; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityNodeInfo; +import android.widget.RemoteViews.OnClickHandler; import java.util.ArrayList; import java.util.HashMap; @@ -992,6 +993,21 @@ public void setRemoteViewsAdapter(Intent intent) { } } + /** + * Sets up the onClickHandler to be used by the RemoteViewsAdapter when inflating RemoteViews + * + * @param handler The OnClickHandler to use when inflating RemoteViews. + * + * @hide + */ + public void setRemoteViewsOnClickHandler(OnClickHandler handler) { + // Ensure that we don't already have a RemoteViewsAdapter that is bound to an existing + // service handling the specified intent. + if (mRemoteViewsAdapter != null) { + mRemoteViewsAdapter.setRemoteViewsOnClickHandler(handler); + } + } + @Override public void setSelection(int position) { setDisplayedChild(position); diff --git a/core/java/android/widget/AnalogClock.java b/core/java/android/widget/AnalogClock.java index 63a0870307f79..c7da818907d4d 100644 --- a/core/java/android/widget/AnalogClock.java +++ b/core/java/android/widget/AnalogClock.java @@ -36,6 +36,10 @@ /** * This widget display an analogic clock with two hands for hours and * minutes. + * + * @attr ref android.R.styleable#AnalogClock_dial + * @attr ref android.R.styleable#AnalogClock_hand_hour + * @attr ref android.R.styleable#AnalogClock_hand_minute */ @RemoteView public class AnalogClock extends View { diff --git a/core/java/android/widget/AppSecurityPermissions.java b/core/java/android/widget/AppSecurityPermissions.java index 988760db7028d..06dadb0db9243 100755 --- a/core/java/android/widget/AppSecurityPermissions.java +++ b/core/java/android/widget/AppSecurityPermissions.java @@ -18,17 +18,23 @@ import com.android.internal.R; +import android.app.AlertDialog; import android.content.Context; +import android.content.pm.ApplicationInfo; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; -import android.content.pm.PackageParser; import android.content.pm.PermissionGroupInfo; import android.content.pm.PermissionInfo; import android.graphics.drawable.Drawable; +import android.os.Parcel; +import android.text.SpannableStringBuilder; +import android.text.TextUtils; +import android.util.AttributeSet; import android.util.Log; import android.view.LayoutInflater; import android.view.View; +import android.view.ViewGroup; import java.text.Collator; import java.util.ArrayList; @@ -36,7 +42,6 @@ import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; -import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; @@ -52,102 +57,270 @@ * * {@hide} */ -public class AppSecurityPermissions implements View.OnClickListener { +public class AppSecurityPermissions { - private enum State { - NO_PERMS, - DANGEROUS_ONLY, - NORMAL_ONLY, - BOTH - } + public static final int WHICH_PERSONAL = 1<<0; + public static final int WHICH_DEVICE = 1<<1; + public static final int WHICH_NEW = 1<<2; + public static final int WHICH_ALL = 0xffff; private final static String TAG = "AppSecurityPermissions"; - private boolean localLOGV = false; + private final static boolean localLOGV = false; private Context mContext; private LayoutInflater mInflater; private PackageManager mPm; - private LinearLayout mPermsView; - private Map mDangerousMap; - private Map mNormalMap; - private List mPermsList; - private String mDefaultGrpLabel; - private String mDefaultGrpName="DefaultGrp"; - private String mPermFormat; + private PackageInfo mInstalledPackageInfo; + private final Map mPermGroups + = new HashMap(); + private final List mPermGroupsList + = new ArrayList(); + private final PermissionGroupInfoComparator mPermGroupComparator; + private final PermissionInfoComparator mPermComparator; + private List mPermsList; + private CharSequence mNewPermPrefix; private Drawable mNormalIcon; private Drawable mDangerousIcon; - private boolean mExpanded; - private Drawable mShowMaxIcon; - private Drawable mShowMinIcon; - private View mShowMore; - private TextView mShowMoreText; - private ImageView mShowMoreIcon; - private State mCurrentState; - private LinearLayout mNonDangerousList; - private LinearLayout mDangerousList; - private HashMap mGroupLabelCache; - private View mNoPermsView; - + + static class MyPermissionGroupInfo extends PermissionGroupInfo { + CharSequence mLabel; + + final ArrayList mNewPermissions = new ArrayList(); + final ArrayList mPersonalPermissions = new ArrayList(); + final ArrayList mDevicePermissions = new ArrayList(); + final ArrayList mAllPermissions = new ArrayList(); + + MyPermissionGroupInfo(PermissionInfo perm) { + name = perm.packageName; + packageName = perm.packageName; + } + + MyPermissionGroupInfo(PermissionGroupInfo info) { + super(info); + } + + public Drawable loadGroupIcon(PackageManager pm) { + if (icon != 0) { + return loadIcon(pm); + } else { + ApplicationInfo appInfo; + try { + appInfo = pm.getApplicationInfo(packageName, 0); + return appInfo.loadIcon(pm); + } catch (NameNotFoundException e) { + } + } + return null; + } + } + + static class MyPermissionInfo extends PermissionInfo { + CharSequence mLabel; + + /** + * PackageInfo.requestedPermissionsFlags for the new package being installed. + */ + int mNewReqFlags; + + /** + * PackageInfo.requestedPermissionsFlags for the currently installed + * package, if it is installed. + */ + int mExistingReqFlags; + + /** + * True if this should be considered a new permission. + */ + boolean mNew; + + MyPermissionInfo() { + } + + MyPermissionInfo(PermissionInfo info) { + super(info); + } + + MyPermissionInfo(MyPermissionInfo info) { + super(info); + mNewReqFlags = info.mNewReqFlags; + mExistingReqFlags = info.mExistingReqFlags; + mNew = info.mNew; + } + } + + public static class PermissionItemView extends LinearLayout implements View.OnClickListener { + MyPermissionGroupInfo mGroup; + MyPermissionInfo mPerm; + AlertDialog mDialog; + + public PermissionItemView(Context context, AttributeSet attrs) { + super(context, attrs); + setClickable(true); + } + + public void setPermission(MyPermissionGroupInfo grp, MyPermissionInfo perm, + boolean first, CharSequence newPermPrefix) { + mGroup = grp; + mPerm = perm; + + ImageView permGrpIcon = (ImageView) findViewById(R.id.perm_icon); + TextView permNameView = (TextView) findViewById(R.id.perm_name); + + PackageManager pm = getContext().getPackageManager(); + Drawable icon = null; + if (first) { + icon = grp.loadGroupIcon(pm); + } + CharSequence label = perm.mLabel; + if (perm.mNew && newPermPrefix != null) { + // If this is a new permission, format it appropriately. + SpannableStringBuilder builder = new SpannableStringBuilder(); + Parcel parcel = Parcel.obtain(); + TextUtils.writeToParcel(newPermPrefix, parcel, 0); + parcel.setDataPosition(0); + CharSequence newStr = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(parcel); + parcel.recycle(); + builder.append(newStr); + builder.append(label); + label = builder; + } + + permGrpIcon.setImageDrawable(icon); + permNameView.setText(label); + setOnClickListener(this); + if (localLOGV) Log.i(TAG, "Made perm item " + perm.name + + ": " + label + " in group " + grp.name); + } + + @Override + public void onClick(View v) { + if (mGroup != null && mPerm != null) { + if (mDialog != null) { + mDialog.dismiss(); + } + PackageManager pm = getContext().getPackageManager(); + AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); + builder.setTitle(mGroup.mLabel); + if (mPerm.descriptionRes != 0) { + builder.setMessage(mPerm.loadDescription(pm)); + } else { + CharSequence appName; + try { + ApplicationInfo app = pm.getApplicationInfo(mPerm.packageName, 0); + appName = app.loadLabel(pm); + } catch (NameNotFoundException e) { + appName = mPerm.packageName; + } + StringBuilder sbuilder = new StringBuilder(128); + sbuilder.append(getContext().getString( + R.string.perms_description_app, appName)); + sbuilder.append("\n\n"); + sbuilder.append(mPerm.name); + builder.setMessage(sbuilder.toString()); + } + builder.setCancelable(true); + builder.setIcon(mGroup.loadGroupIcon(pm)); + mDialog = builder.show(); + mDialog.setCanceledOnTouchOutside(true); + } + } + + @Override + protected void onDetachedFromWindow() { + super.onDetachedFromWindow(); + if (mDialog != null) { + mDialog.dismiss(); + } + } + } + public AppSecurityPermissions(Context context, List permList) { mContext = context; mPm = mContext.getPackageManager(); - mPermsList = permList; + loadResources(); + mPermComparator = new PermissionInfoComparator(); + mPermGroupComparator = new PermissionGroupInfoComparator(); + for (PermissionInfo pi : permList) { + mPermsList.add(new MyPermissionInfo(pi)); + } + setPermissions(mPermsList); } public AppSecurityPermissions(Context context, String packageName) { mContext = context; mPm = mContext.getPackageManager(); - mPermsList = new ArrayList(); - Set permSet = new HashSet(); + loadResources(); + mPermComparator = new PermissionInfoComparator(); + mPermGroupComparator = new PermissionGroupInfoComparator(); + mPermsList = new ArrayList(); + Set permSet = new HashSet(); PackageInfo pkgInfo; try { pkgInfo = mPm.getPackageInfo(packageName, PackageManager.GET_PERMISSIONS); } catch (NameNotFoundException e) { - Log.w(TAG, "Could'nt retrieve permissions for package:"+packageName); + Log.w(TAG, "Couldn't retrieve permissions for package:"+packageName); return; } // Extract all user permissions if((pkgInfo.applicationInfo != null) && (pkgInfo.applicationInfo.uid != -1)) { getAllUsedPermissions(pkgInfo.applicationInfo.uid, permSet); } - for(PermissionInfo tmpInfo : permSet) { + for(MyPermissionInfo tmpInfo : permSet) { mPermsList.add(tmpInfo); } + setPermissions(mPermsList); } - - public AppSecurityPermissions(Context context, PackageParser.Package pkg) { + + public AppSecurityPermissions(Context context, PackageInfo info) { mContext = context; mPm = mContext.getPackageManager(); - mPermsList = new ArrayList(); - Set permSet = new HashSet(); - if(pkg == null) { + loadResources(); + mPermComparator = new PermissionInfoComparator(); + mPermGroupComparator = new PermissionGroupInfoComparator(); + mPermsList = new ArrayList(); + Set permSet = new HashSet(); + if(info == null) { return; } + + // Convert to a PackageInfo + PackageInfo installedPkgInfo = null; // Get requested permissions - if (pkg.requestedPermissions != null) { - ArrayList strList = pkg.requestedPermissions; - int size = strList.size(); - if (size > 0) { - extractPerms(strList.toArray(new String[size]), permSet); + if (info.requestedPermissions != null) { + try { + installedPkgInfo = mPm.getPackageInfo(info.packageName, + PackageManager.GET_PERMISSIONS); + } catch (NameNotFoundException e) { } + extractPerms(info, permSet, installedPkgInfo); } // Get permissions related to shared user if any - if(pkg.mSharedUserId != null) { + if (info.sharedUserId != null) { int sharedUid; try { - sharedUid = mPm.getUidForSharedUser(pkg.mSharedUserId); + sharedUid = mPm.getUidForSharedUser(info.sharedUserId); getAllUsedPermissions(sharedUid, permSet); } catch (NameNotFoundException e) { - Log.w(TAG, "Could'nt retrieve shared user id for:"+pkg.packageName); + Log.w(TAG, "Could'nt retrieve shared user id for:"+info.packageName); } } // Retrieve list of permissions - for(PermissionInfo tmpInfo : permSet) { + for (MyPermissionInfo tmpInfo : permSet) { mPermsList.add(tmpInfo); } + setPermissions(mPermsList); } - + + private void loadResources() { + // Pick up from framework resources instead. + mNewPermPrefix = mContext.getText(R.string.perms_new_perm_prefix); + mNormalIcon = mContext.getResources().getDrawable(R.drawable.ic_text_dot); + mDangerousIcon = mContext.getResources().getDrawable(R.drawable.ic_bullet_key_permission); + } + /** - * Utility to retrieve a view displaying a single permission. + * Utility to retrieve a view displaying a single permission. This provides + * the old UI layout for permissions; it is only here for the device admin + * settings to continue to use. */ public static View getPermissionItemView(Context context, CharSequence grpName, CharSequence description, boolean dangerous) { @@ -155,11 +328,15 @@ public static View getPermissionItemView(Context context, Context.LAYOUT_INFLATER_SERVICE); Drawable icon = context.getResources().getDrawable(dangerous ? R.drawable.ic_bullet_key_permission : R.drawable.ic_text_dot); - return getPermissionItemView(context, inflater, grpName, + return getPermissionItemViewOld(context, inflater, grpName, description, dangerous, icon); } - private void getAllUsedPermissions(int sharedUid, Set permSet) { + public PackageInfo getInstalledPackageInfo() { + return mInstalledPackageInfo; + } + + private void getAllUsedPermissions(int sharedUid, Set permSet) { String sharedPkgList[] = mPm.getPackagesForUid(sharedUid); if(sharedPkgList == null || (sharedPkgList.length == 0)) { return; @@ -170,29 +347,95 @@ private void getAllUsedPermissions(int sharedUid, Set permSet) { } private void getPermissionsForPackage(String packageName, - Set permSet) { + Set permSet) { PackageInfo pkgInfo; try { pkgInfo = mPm.getPackageInfo(packageName, PackageManager.GET_PERMISSIONS); } catch (NameNotFoundException e) { - Log.w(TAG, "Could'nt retrieve permissions for package:"+packageName); + Log.w(TAG, "Couldn't retrieve permissions for package:"+packageName); return; } if ((pkgInfo != null) && (pkgInfo.requestedPermissions != null)) { - extractPerms(pkgInfo.requestedPermissions, permSet); + extractPerms(pkgInfo, permSet, pkgInfo); } } - - private void extractPerms(String strList[], Set permSet) { - if((strList == null) || (strList.length == 0)) { + + private void extractPerms(PackageInfo info, Set permSet, + PackageInfo installedPkgInfo) { + String[] strList = info.requestedPermissions; + int[] flagsList = info.requestedPermissionsFlags; + if ((strList == null) || (strList.length == 0)) { return; } - for(String permName:strList) { + mInstalledPackageInfo = installedPkgInfo; + for (int i=0; i= 0 ? + installedPkgInfo.requestedPermissionsFlags[existingIndex] : 0; + if (!isDisplayablePermission(tmpPermInfo, flagsList[i], existingFlags)) { + // This is not a permission that is interesting for the user + // to see, so skip it. + continue; + } + final String origGroupName = tmpPermInfo.group; + String groupName = origGroupName; + if (groupName == null) { + groupName = tmpPermInfo.packageName; + tmpPermInfo.group = groupName; + } + MyPermissionGroupInfo group = mPermGroups.get(groupName); + if (group == null) { + PermissionGroupInfo grp = null; + if (origGroupName != null) { + grp = mPm.getPermissionGroupInfo(origGroupName, 0); + } + if (grp != null) { + group = new MyPermissionGroupInfo(grp); + } else { + // We could be here either because the permission + // didn't originally specify a group or the group it + // gave couldn't be found. In either case, we consider + // its group to be the permission's package name. + tmpPermInfo.group = tmpPermInfo.packageName; + group = mPermGroups.get(tmpPermInfo.group); + if (group == null) { + group = new MyPermissionGroupInfo(tmpPermInfo); + } + group = new MyPermissionGroupInfo(tmpPermInfo); + } + mPermGroups.put(tmpPermInfo.group, group); } + final boolean newPerm = installedPkgInfo != null + && (existingFlags&PackageInfo.REQUESTED_PERMISSION_GRANTED) == 0; + MyPermissionInfo myPerm = new MyPermissionInfo(tmpPermInfo); + myPerm.mNewReqFlags = flagsList[i]; + myPerm.mExistingReqFlags = existingFlags; + // This is a new permission if the app is already installed and + // doesn't currently hold this permission. + myPerm.mNew = newPerm; + permSet.add(myPerm); } catch (NameNotFoundException e) { Log.i(TAG, "Ignoring unknown permission:"+permName); } @@ -200,131 +443,101 @@ private void extractPerms(String strList[], Set permSet) { } public int getPermissionCount() { - return mPermsList.size(); + return getPermissionCount(WHICH_ALL); } - public View getPermissionsView() { - - mInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); - mPermsView = (LinearLayout) mInflater.inflate(R.layout.app_perms_summary, null); - mShowMore = mPermsView.findViewById(R.id.show_more); - mShowMoreIcon = (ImageView) mShowMore.findViewById(R.id.show_more_icon); - mShowMoreText = (TextView) mShowMore.findViewById(R.id.show_more_text); - mDangerousList = (LinearLayout) mPermsView.findViewById(R.id.dangerous_perms_list); - mNonDangerousList = (LinearLayout) mPermsView.findViewById(R.id.non_dangerous_perms_list); - mNoPermsView = mPermsView.findViewById(R.id.no_permissions); - - // Set up the LinearLayout that acts like a list item. - mShowMore.setClickable(true); - mShowMore.setOnClickListener(this); - mShowMore.setFocusable(true); - - // Pick up from framework resources instead. - mDefaultGrpLabel = mContext.getString(R.string.default_permission_group); - mPermFormat = mContext.getString(R.string.permissions_format); - mNormalIcon = mContext.getResources().getDrawable(R.drawable.ic_text_dot); - mDangerousIcon = mContext.getResources().getDrawable(R.drawable.ic_bullet_key_permission); - mShowMaxIcon = mContext.getResources().getDrawable(R.drawable.expander_close_holo_dark); - mShowMinIcon = mContext.getResources().getDrawable(R.drawable.expander_open_holo_dark); - - // Set permissions view - setPermissions(mPermsList); - return mPermsView; + private List getPermissionList(MyPermissionGroupInfo grp, int which) { + if (which == WHICH_NEW) { + return grp.mNewPermissions; + } else if (which == WHICH_PERSONAL) { + return grp.mPersonalPermissions; + } else if (which == WHICH_DEVICE) { + return grp.mDevicePermissions; + } else { + return grp.mAllPermissions; + } } - /** - * Canonicalizes the group description before it is displayed to the user. - * - * TODO check for internationalization issues remove trailing '.' in str1 - */ - private String canonicalizeGroupDesc(String groupDesc) { - if ((groupDesc == null) || (groupDesc.length() == 0)) { - return null; + public int getPermissionCount(int which) { + int N = 0; + for (int i=0; i permInfoMap = dangerous ? mDangerousMap : mNormalMap; - LinearLayout permListView = dangerous ? mDangerousList : mNonDangerousList; + private void displayPermissions(List groups, + LinearLayout permListView, int which) { permListView.removeAllViews(); - Set permInfoStrSet = permInfoMap.keySet(); - for (String loopPermGrpInfoStr : permInfoStrSet) { - CharSequence grpLabel = getGroupLabel(loopPermGrpInfoStr); - //guaranteed that grpLabel wont be null since permissions without groups - //will belong to the default group - if(localLOGV) Log.i(TAG, "Adding view group:" + grpLabel + ", desc:" - + permInfoMap.get(loopPermGrpInfoStr)); - permListView.addView(getPermissionItemView(grpLabel, - permInfoMap.get(loopPermGrpInfoStr), dangerous)); + int spacing = (int)(8*mContext.getResources().getDisplayMetrics().density); + + for (int i=0; i perms = getPermissionList(grp, which); + for (int j=0; j > map, Map retMap) { - if(map == null) { - return; + private static class PermissionGroupInfoComparator implements Comparator { + private final Collator sCollator = Collator.getInstance(); + PermissionGroupInfoComparator() { } - if(retMap == null) { - return; - } - Set grpNames = map.keySet(); - Iterator grpNamesIter = grpNames.iterator(); - while(grpNamesIter.hasNext()) { - String grpDesc = null; - String grpNameKey = grpNamesIter.next(); - List grpPermsList = map.get(grpNameKey); - if(grpPermsList == null) { - continue; - } - for(PermissionInfo permInfo: grpPermsList) { - CharSequence permDesc = permInfo.loadLabel(mPm); - grpDesc = formatPermissions(grpDesc, permDesc); + public final int compare(MyPermissionGroupInfo a, MyPermissionGroupInfo b) { + if (((a.flags^b.flags)&PermissionGroupInfo.FLAG_PERSONAL_INFO) != 0) { + return ((a.flags&PermissionGroupInfo.FLAG_PERSONAL_INFO) != 0) ? -1 : 1; } - // Insert grpDesc into map - if(grpDesc != null) { - if(localLOGV) Log.i(TAG, "Group:"+grpNameKey+" description:"+grpDesc.toString()); - retMap.put(grpNameKey, grpDesc.toString()); + if (a.priority != b.priority) { + return a.priority > b.priority ? -1 : 1; } + return sCollator.compare(a.mLabel, b.mLabel); } } - private static class PermissionInfoComparator implements Comparator { - private PackageManager mPm; + private static class PermissionInfoComparator implements Comparator { private final Collator sCollator = Collator.getInstance(); - PermissionInfoComparator(PackageManager pm) { - mPm = pm; + PermissionInfoComparator() { } - public final int compare(PermissionInfo a, PermissionInfo b) { - CharSequence sa = a.loadLabel(mPm); - CharSequence sb = b.loadLabel(mPm); - return sCollator.compare(sa, sb); + public final int compare(MyPermissionInfo a, MyPermissionInfo b) { + return sCollator.compare(a.mLabel, b.mLabel); } } - - private void setPermissions(List permList) { - mGroupLabelCache = new HashMap(); - //add the default label so that uncategorized permissions can go here - mGroupLabelCache.put(mDefaultGrpName, mDefaultGrpLabel); - - // Map containing group names and a list of permissions under that group - // categorized as dangerous - mDangerousMap = new HashMap(); - // Map containing group names and a list of permissions under that group - // categorized as normal - mNormalMap = new HashMap(); - - // Additional structures needed to ensure that permissions are unique under - // each group - Map> dangerousMap = - new HashMap>(); - Map > normalMap = - new HashMap>(); - PermissionInfoComparator permComparator = new PermissionInfoComparator(mPm); - + + private void addPermToList(List permList, + MyPermissionInfo pInfo) { + if (pInfo.mLabel == null) { + pInfo.mLabel = pInfo.loadLabel(mPm); + } + int idx = Collections.binarySearch(permList, pInfo, mPermComparator); + if(localLOGV) Log.i(TAG, "idx="+idx+", list.size="+permList.size()); + if (idx < 0) { + idx = -idx-1; + permList.add(idx, pInfo); + } + } + + private void setPermissions(List permList) { if (permList != null) { // First pass to group permissions - for (PermissionInfo pInfo : permList) { + for (MyPermissionInfo pInfo : permList) { if(localLOGV) Log.i(TAG, "Processing permission:"+pInfo.name); - if(!isDisplayablePermission(pInfo)) { + if(!isDisplayablePermission(pInfo, pInfo.mNewReqFlags, pInfo.mExistingReqFlags)) { if(localLOGV) Log.i(TAG, "Permission:"+pInfo.name+" is not displayable"); continue; } - Map > permInfoMap = - (pInfo.protectionLevel == PermissionInfo.PROTECTION_DANGEROUS) ? - dangerousMap : normalMap; - String grpName = (pInfo.group == null) ? mDefaultGrpName : pInfo.group; - if(localLOGV) Log.i(TAG, "Permission:"+pInfo.name+" belongs to group:"+grpName); - List grpPermsList = permInfoMap.get(grpName); - if(grpPermsList == null) { - grpPermsList = new ArrayList(); - permInfoMap.put(grpName, grpPermsList); - grpPermsList.add(pInfo); - } else { - int idx = Collections.binarySearch(grpPermsList, pInfo, permComparator); - if(localLOGV) Log.i(TAG, "idx="+idx+", list.size="+grpPermsList.size()); - if (idx < 0) { - idx = -idx-1; - grpPermsList.add(idx, pInfo); + MyPermissionGroupInfo group = mPermGroups.get(pInfo.group); + if (group != null) { + pInfo.mLabel = pInfo.loadLabel(mPm); + addPermToList(group.mAllPermissions, pInfo); + if (pInfo.mNew) { + addPermToList(group.mNewPermissions, pInfo); + } + if ((group.flags&PermissionGroupInfo.FLAG_PERSONAL_INFO) != 0) { + addPermToList(group.mPersonalPermissions, pInfo); + } else { + addPermToList(group.mDevicePermissions, pInfo); } } } - // Second pass to actually form the descriptions - // Look at dangerous permissions first - aggregateGroupDescs(dangerousMap, mDangerousMap); - aggregateGroupDescs(normalMap, mNormalMap); } - mCurrentState = State.NO_PERMS; - if(mDangerousMap.size() > 0) { - mCurrentState = (mNormalMap.size() > 0) ? State.BOTH : State.DANGEROUS_ONLY; - } else if(mNormalMap.size() > 0) { - mCurrentState = State.NORMAL_ONLY; + for (MyPermissionGroupInfo pgrp : mPermGroups.values()) { + if (pgrp.labelRes != 0 || pgrp.nonLocalizedLabel != null) { + pgrp.mLabel = pgrp.loadLabel(mPm); + } else { + ApplicationInfo app; + try { + app = mPm.getApplicationInfo(pgrp.packageName, 0); + pgrp.mLabel = app.loadLabel(mPm); + } catch (NameNotFoundException e) { + pgrp.mLabel = pgrp.loadLabel(mPm); + } + } + mPermGroupsList.add(pgrp); + } + Collections.sort(mPermGroupsList, mPermGroupComparator); + if (localLOGV) { + for (MyPermissionGroupInfo grp : mPermGroupsList) { + Log.i(TAG, "Group " + grp.name + " personal=" + + ((grp.flags&PermissionGroupInfo.FLAG_PERSONAL_INFO) != 0) + + " priority=" + grp.priority); + } } - if(localLOGV) Log.i(TAG, "mCurrentState=" + mCurrentState); - showPermissions(); - } - - public void onClick(View v) { - if(localLOGV) Log.i(TAG, "mExpanded="+mExpanded); - mExpanded = !mExpanded; - showPermissions(); } } diff --git a/core/java/android/widget/AutoCompleteTextView.java b/core/java/android/widget/AutoCompleteTextView.java index 30dd17d6f740d..f0eb94fcb1062 100644 --- a/core/java/android/widget/AutoCompleteTextView.java +++ b/core/java/android/widget/AutoCompleteTextView.java @@ -578,6 +578,23 @@ public AdapterView.OnItemSelectedListener getOnItemSelectedListener() { return mItemSelectedListener; } + /** + * Set a listener that will be invoked whenever the AutoCompleteTextView's + * list of completions is dismissed. + * @param dismissListener Listener to invoke when completions are dismissed + */ + public void setOnDismissListener(final OnDismissListener dismissListener) { + PopupWindow.OnDismissListener wrappedListener = null; + if (dismissListener != null) { + wrappedListener = new PopupWindow.OnDismissListener() { + @Override public void onDismiss() { + dismissListener.onDismiss(); + } + }; + } + mPopup.setOnDismissListener(wrappedListener); + } + /** *

          Returns a filterable list adapter used for auto completion.

          * @@ -904,8 +921,6 @@ public boolean isPerformingCompletion() { * * @param filter If false, no filtering will be performed * as a result of this call. - * - * @hide Pending API council approval. */ public void setText(CharSequence text, boolean filter) { if (filter) { @@ -1207,6 +1222,19 @@ public interface Validator { CharSequence fixText(CharSequence invalidText); } + /** + * Listener to respond to the AutoCompleteTextView's completion list being dismissed. + * @see AutoCompleteTextView#setOnDismissListener(OnDismissListener) + */ + public interface OnDismissListener { + /** + * This method will be invoked whenever the AutoCompleteTextView's list + * of completion options has been dismissed and is no longer available + * for user interaction. + */ + void onDismiss(); + } + /** * Allows us a private hook into the on click event without preventing users from setting * their own click listener. diff --git a/core/java/android/widget/CalendarView.java b/core/java/android/widget/CalendarView.java index b06da0672a166..361eca4d33992 100644 --- a/core/java/android/widget/CalendarView.java +++ b/core/java/android/widget/CalendarView.java @@ -1573,7 +1573,8 @@ public void init(int weekNumber, int selectedWeekDay, int focusedMonth) { // If we're showing the week number calculate it based on Monday int i = 0; if (mShowWeekNumber) { - mDayNumbers[0] = Integer.toString(mTempDate.get(Calendar.WEEK_OF_YEAR)); + mDayNumbers[0] = String.format(Locale.getDefault(), "%d", + mTempDate.get(Calendar.WEEK_OF_YEAR)); i++; } @@ -1594,7 +1595,8 @@ public void init(int weekNumber, int selectedWeekDay, int focusedMonth) { if (mTempDate.before(mMinDate) || mTempDate.after(mMaxDate)) { mDayNumbers[i] = ""; } else { - mDayNumbers[i] = Integer.toString(mTempDate.get(Calendar.DAY_OF_MONTH)); + mDayNumbers[i] = String.format(Locale.getDefault(), "%d", + mTempDate.get(Calendar.DAY_OF_MONTH)); } mTempDate.add(Calendar.DAY_OF_MONTH, 1); } @@ -1609,7 +1611,7 @@ public void init(int weekNumber, int selectedWeekDay, int focusedMonth) { } /** - * Initialize the paint isntances. + * Initialize the paint instances. */ private void initilaizePaints() { mDrawPaint.setFakeBoldText(false); @@ -1620,6 +1622,7 @@ private void initilaizePaints() { mMonthNumDrawPaint.setAntiAlias(true); mMonthNumDrawPaint.setStyle(Style.FILL); mMonthNumDrawPaint.setTextAlign(Align.CENTER); + mMonthNumDrawPaint.setTextSize(mDateTextSize); } /** @@ -1657,16 +1660,34 @@ public Calendar getFirstDay() { * @return True if a day was found for the given location. */ public boolean getDayFromLocation(float x, Calendar outCalendar) { - int dayStart = mShowWeekNumber ? mWidth / mNumCells : 0; - if (x < dayStart || x > mWidth) { + final boolean isLayoutRtl = isLayoutRtl(); + + int start; + int end; + + if (isLayoutRtl) { + start = 0; + end = mShowWeekNumber ? mWidth - mWidth / mNumCells : mWidth; + } else { + start = mShowWeekNumber ? mWidth / mNumCells : 0; + end = mWidth; + } + + if (x < start || x > end) { outCalendar.clear(); return false; } - // Selection is (x - start) / (pixels/day) == (x -s) * day / pixels - int dayPosition = (int) ((x - dayStart) * mDaysPerWeek - / (mWidth - dayStart)); + + // Selection is (x - start) / (pixels/day) which is (x - start) * day / pixels + int dayPosition = (int) ((x - start) * mDaysPerWeek / (end - start)); + + if (isLayoutRtl) { + dayPosition = mDaysPerWeek - 1 - dayPosition; + } + outCalendar.setTimeInMillis(mFirstDay.getTimeInMillis()); outCalendar.add(Calendar.DAY_OF_MONTH, dayPosition); + return true; } @@ -1691,12 +1712,25 @@ private void drawBackground(Canvas canvas) { mTempRect.top = mWeekSeperatorLineWidth; mTempRect.bottom = mHeight; - mTempRect.left = mShowWeekNumber ? mWidth / mNumCells : 0; - mTempRect.right = mSelectedLeft - 2; + + final boolean isLayoutRtl = isLayoutRtl(); + + if (isLayoutRtl) { + mTempRect.left = 0; + mTempRect.right = mSelectedLeft - 2; + } else { + mTempRect.left = mShowWeekNumber ? mWidth / mNumCells : 0; + mTempRect.right = mSelectedLeft - 2; + } canvas.drawRect(mTempRect, mDrawPaint); - mTempRect.left = mSelectedRight + 3; - mTempRect.right = mWidth; + if (isLayoutRtl) { + mTempRect.left = mSelectedRight + 3; + mTempRect.right = mShowWeekNumber ? mWidth - mWidth / mNumCells : mWidth; + } else { + mTempRect.left = mSelectedRight + 3; + mTempRect.right = mWidth; + } canvas.drawRect(mTempRect, mDrawPaint); } @@ -1706,25 +1740,41 @@ private void drawBackground(Canvas canvas) { * @param canvas The canvas to draw on */ private void drawWeekNumbersAndDates(Canvas canvas) { - float textHeight = mDrawPaint.getTextSize(); - int y = (int) ((mHeight + textHeight) / 2) - mWeekSeperatorLineWidth; - int nDays = mNumCells; + final float textHeight = mDrawPaint.getTextSize(); + final int y = (int) ((mHeight + textHeight) / 2) - mWeekSeperatorLineWidth; + final int nDays = mNumCells; + final int divisor = 2 * nDays; mDrawPaint.setTextAlign(Align.CENTER); mDrawPaint.setTextSize(mDateTextSize); + int i = 0; - int divisor = 2 * nDays; - if (mShowWeekNumber) { - mDrawPaint.setColor(mWeekNumberColor); - int x = mWidth / divisor; - canvas.drawText(mDayNumbers[0], x, y, mDrawPaint); - i++; - } - for (; i < nDays; i++) { - mMonthNumDrawPaint.setColor(mFocusDay[i] ? mFocusedMonthDateColor - : mUnfocusedMonthDateColor); - int x = (2 * i + 1) * mWidth / divisor; - canvas.drawText(mDayNumbers[i], x, y, mMonthNumDrawPaint); + + if (isLayoutRtl()) { + for (; i < nDays - 1; i++) { + mMonthNumDrawPaint.setColor(mFocusDay[i] ? mFocusedMonthDateColor + : mUnfocusedMonthDateColor); + int x = (2 * i + 1) * mWidth / divisor; + canvas.drawText(mDayNumbers[nDays - 1 - i], x, y, mMonthNumDrawPaint); + } + if (mShowWeekNumber) { + mDrawPaint.setColor(mWeekNumberColor); + int x = mWidth - mWidth / divisor; + canvas.drawText(mDayNumbers[0], x, y, mDrawPaint); + } + } else { + if (mShowWeekNumber) { + mDrawPaint.setColor(mWeekNumberColor); + int x = mWidth / divisor; + canvas.drawText(mDayNumbers[0], x, y, mDrawPaint); + i++; + } + for (; i < nDays; i++) { + mMonthNumDrawPaint.setColor(mFocusDay[i] ? mFocusedMonthDateColor + : mUnfocusedMonthDateColor); + int x = (2 * i + 1) * mWidth / divisor; + canvas.drawText(mDayNumbers[i], x, y, mMonthNumDrawPaint); + } } } @@ -1744,8 +1794,16 @@ private void drawWeekSeparators(Canvas canvas) { } mDrawPaint.setColor(mWeekSeparatorLineColor); mDrawPaint.setStrokeWidth(mWeekSeperatorLineWidth); - float x = mShowWeekNumber ? mWidth / mNumCells : 0; - canvas.drawLine(x, 0, mWidth, 0, mDrawPaint); + float startX; + float stopX; + if (isLayoutRtl()) { + startX = 0; + stopX = mShowWeekNumber ? mWidth - mWidth / mNumCells : mWidth; + } else { + startX = mShowWeekNumber ? mWidth / mNumCells : 0; + stopX = mWidth; + } + canvas.drawLine(startX, 0, stopX, 0, mDrawPaint); } /** @@ -1778,15 +1836,21 @@ protected void onSizeChanged(int w, int h, int oldw, int oldh) { */ private void updateSelectionPositions() { if (mHasSelectedDay) { + final boolean isLayoutRtl = isLayoutRtl(); int selectedPosition = mSelectedDay - mFirstDayOfWeek; if (selectedPosition < 0) { selectedPosition += 7; } - if (mShowWeekNumber) { + if (mShowWeekNumber && !isLayoutRtl) { selectedPosition++; } - mSelectedLeft = selectedPosition * mWidth / mNumCells; - mSelectedRight = (selectedPosition + 1) * mWidth / mNumCells; + if (isLayoutRtl) { + mSelectedLeft = (mDaysPerWeek - 1 - selectedPosition) * mWidth / mNumCells; + + } else { + mSelectedLeft = selectedPosition * mWidth / mNumCells; + } + mSelectedRight = mSelectedLeft + mWidth / mNumCells; } } diff --git a/core/java/android/widget/CheckedTextView.java b/core/java/android/widget/CheckedTextView.java index 61935c2b2024d..de8b80d45ec65 100644 --- a/core/java/android/widget/CheckedTextView.java +++ b/core/java/android/widget/CheckedTextView.java @@ -55,7 +55,7 @@ public CheckedTextView(Context context) { } public CheckedTextView(Context context, AttributeSet attrs) { - this(context, attrs, 0); + this(context, attrs, R.attr.checkedTextViewStyle); } public CheckedTextView(Context context, AttributeSet attrs, int defStyle) { @@ -101,7 +101,7 @@ public void setChecked(boolean checked) { /** * Set the checkmark to a given Drawable, identified by its resourece id. This will be drawn * when {@link #isChecked()} is true. - * + * * @param resid The Drawable to use for the checkmark. * * @see #setCheckMarkDrawable(Drawable) @@ -144,14 +144,14 @@ public void setCheckMarkDrawable(Drawable d) { d.setVisible(getVisibility() == VISIBLE, false); d.setState(CHECKED_STATE_SET); setMinHeight(d.getIntrinsicHeight()); - + mCheckMarkWidth = d.getIntrinsicWidth(); d.setState(getDrawableState()); } else { mCheckMarkWidth = 0; } mCheckMarkDrawable = d; - // Do padding resolution. This will call setPadding() and do a requestLayout() if needed. + // Do padding resolution. This will call internalSetPadding() and do a requestLayout() if needed. resolvePadding(); } @@ -169,28 +169,44 @@ public Drawable getCheckMarkDrawable() { return mCheckMarkDrawable; } + /** + * @hide + */ + @Override + protected void internalSetPadding(int left, int top, int right, int bottom) { + super.internalSetPadding(left, top, right, bottom); + setBasePadding(isLayoutRtl()); + } + @Override - public void onPaddingChanged(int layoutDirection) { + public void onRtlPropertiesChanged(int layoutDirection) { + super.onRtlPropertiesChanged(layoutDirection); + updatePadding(); + } + + private void updatePadding() { + resetPaddingToInitialValues(); int newPadding = (mCheckMarkDrawable != null) ? mCheckMarkWidth + mBasePadding : mBasePadding; - mNeedRequestlayout |= (mPaddingRight != newPadding); - mPaddingRight = newPadding; + if (isLayoutRtl()) { + mNeedRequestlayout |= (mPaddingLeft != newPadding); + mPaddingLeft = newPadding; + } else { + mNeedRequestlayout |= (mPaddingRight != newPadding); + mPaddingRight = newPadding; + } if (mNeedRequestlayout) { requestLayout(); mNeedRequestlayout = false; } } - - @Override - public void setPadding(int left, int top, int right, int bottom) { - super.setPadding(left, top, right, bottom); - mBasePadding = mPaddingRight; - } - @Override - public void setPaddingRelative(int start, int top, int end, int bottom) { - super.setPaddingRelative(start, top, end, bottom); - mBasePadding = getPaddingEnd(); + private void setBasePadding(boolean isLayoutRtl) { + if (isLayoutRtl) { + mBasePadding = mPaddingLeft; + } else { + mBasePadding = mPaddingRight; + } } @Override @@ -213,12 +229,20 @@ protected void onDraw(Canvas canvas) { 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; + final int right; + if (isLayoutRtl) { + left = mBasePadding; + right = left + mCheckMarkWidth; + } else { + right = width - mBasePadding; + left = right - mCheckMarkWidth; + } + checkMarkDrawable.setBounds( left, top, right, bottom); checkMarkDrawable.draw(canvas); } } diff --git a/core/java/android/widget/CompoundButton.java b/core/java/android/widget/CompoundButton.java index 0a71c5ad54328..421a3247e8c5c 100644 --- a/core/java/android/widget/CompoundButton.java +++ b/core/java/android/widget/CompoundButton.java @@ -224,6 +224,30 @@ public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { info.setChecked(mChecked); } + @Override + public int getCompoundPaddingLeft() { + int padding = super.getCompoundPaddingLeft(); + if (!isLayoutRtl()) { + final Drawable buttonDrawable = mButtonDrawable; + if (buttonDrawable != null) { + padding += buttonDrawable.getIntrinsicWidth(); + } + } + return padding; + } + + @Override + public int getCompoundPaddingRight() { + int padding = super.getCompoundPaddingRight(); + if (isLayoutRtl()) { + final Drawable buttonDrawable = mButtonDrawable; + if (buttonDrawable != null) { + padding += buttonDrawable.getIntrinsicWidth(); + } + } + return padding; + } + @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); @@ -231,20 +255,23 @@ protected void onDraw(Canvas canvas) { final Drawable buttonDrawable = mButtonDrawable; if (buttonDrawable != null) { final int verticalGravity = getGravity() & Gravity.VERTICAL_GRAVITY_MASK; - final int height = buttonDrawable.getIntrinsicHeight(); - - int y = 0; + final int drawableHeight = buttonDrawable.getIntrinsicHeight(); + final int drawableWidth = buttonDrawable.getIntrinsicWidth(); + int top = 0; switch (verticalGravity) { case Gravity.BOTTOM: - y = getHeight() - height; + top = getHeight() - drawableHeight; break; case Gravity.CENTER_VERTICAL: - y = (getHeight() - height) / 2; + top = (getHeight() - drawableHeight) / 2; break; } + int bottom = top + drawableHeight; + int left = isLayoutRtl() ? getWidth() - drawableWidth : 0; + int right = isLayoutRtl() ? getWidth() : drawableWidth; - buttonDrawable.setBounds(0, y, buttonDrawable.getIntrinsicWidth(), y + height); + buttonDrawable.setBounds(left, top, right, bottom); buttonDrawable.draw(canvas); } } diff --git a/core/java/android/widget/DatePicker.java b/core/java/android/widget/DatePicker.java index ac3bedb02d42d..07d3a7a75539d 100644 --- a/core/java/android/widget/DatePicker.java +++ b/core/java/android/widget/DatePicker.java @@ -220,7 +220,7 @@ public void onSelectedDayChange(CalendarView view, int year, int month, int mont // day mDaySpinner = (NumberPicker) findViewById(R.id.day); - mDaySpinner.setFormatter(NumberPicker.TWO_DIGIT_FORMATTER); + mDaySpinner.setFormatter(NumberPicker.getTwoDigitFormatter()); mDaySpinner.setOnLongPressUpdateInterval(100); mDaySpinner.setOnValueChangedListener(onChangeListener); mDaySpinnerInput = (EditText) mDaySpinner.findViewById(R.id.numberpicker_input); diff --git a/core/java/android/widget/DigitalClock.java b/core/java/android/widget/DigitalClock.java index add9d9b719968..c6b6dd68f1820 100644 --- a/core/java/android/widget/DigitalClock.java +++ b/core/java/android/widget/DigitalClock.java @@ -17,7 +17,6 @@ package android.widget; import android.content.Context; -import android.content.res.Resources; import android.database.ContentObserver; import android.os.Handler; import android.os.SystemClock; @@ -32,15 +31,17 @@ /** * Like AnalogClock, but digital. Shows seconds. * - * FIXME: implement separate views for hours/minutes/seconds, so - * proportional fonts don't shake rendering + * @deprecated It is recommended you use {@link TextClock} instead. */ - +@Deprecated public class DigitalClock extends TextView { + // FIXME: implement separate views for hours/minutes/seconds, so + // proportional fonts don't shake rendering Calendar mCalendar; private final static String m12 = "h:mm:ss aa"; private final static String m24 = "k:mm:ss"; + @SuppressWarnings("FieldCanBeLocal") // We must keep a reference to this observer private FormatChangeObserver mFormatChangeObserver; private Runnable mTicker; @@ -52,17 +53,15 @@ public class DigitalClock extends TextView { public DigitalClock(Context context) { super(context); - initClock(context); + initClock(); } public DigitalClock(Context context, AttributeSet attrs) { super(context, attrs); - initClock(context); + initClock(); } - private void initClock(Context context) { - Resources r = mContext.getResources(); - + private void initClock() { if (mCalendar == null) { mCalendar = Calendar.getInstance(); } @@ -84,16 +83,16 @@ protected void onAttachedToWindow() { * requests a tick on the next hard-second boundary */ mTicker = new Runnable() { - public void run() { - if (mTickerStopped) return; - mCalendar.setTimeInMillis(System.currentTimeMillis()); - setText(DateFormat.format(mFormat, mCalendar)); - invalidate(); - long now = SystemClock.uptimeMillis(); - long next = now + (1000 - now % 1000); - mHandler.postAtTime(mTicker, next); - } - }; + public void run() { + if (mTickerStopped) return; + mCalendar.setTimeInMillis(System.currentTimeMillis()); + setText(DateFormat.format(mFormat, mCalendar)); + invalidate(); + long now = SystemClock.uptimeMillis(); + long next = now + (1000 - now % 1000); + mHandler.postAtTime(mTicker, next); + } + }; mTicker.run(); } @@ -132,12 +131,14 @@ public void onChange(boolean selfChange) { @Override public void onInitializeAccessibilityEvent(AccessibilityEvent event) { super.onInitializeAccessibilityEvent(event); + //noinspection deprecation event.setClassName(DigitalClock.class.getName()); } @Override public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfo(info); + //noinspection deprecation info.setClassName(DigitalClock.class.getName()); } } diff --git a/core/java/android/widget/Editor.java b/core/java/android/widget/Editor.java index c29dd585ba1b6..b1a44c5a89bce 100644 --- a/core/java/android/widget/Editor.java +++ b/core/java/android/widget/Editor.java @@ -88,9 +88,6 @@ import android.view.inputmethod.InputConnection; import android.view.inputmethod.InputMethodManager; import android.widget.AdapterView.OnItemClickListener; -import android.widget.Editor.InputContentType; -import android.widget.Editor.InputMethodState; -import android.widget.Editor.SelectionModifierCursorController; import android.widget.TextView.Drawables; import android.widget.TextView.OnEditorActionListener; @@ -125,6 +122,7 @@ public class Editor { InputMethodState mInputMethodState; DisplayList[] mTextDisplayLists; + int mLastLayoutHeight; boolean mFrozenWithFocus; boolean mSelectionMoved; @@ -146,6 +144,7 @@ public class Editor { CharSequence mError; boolean mErrorWasChanged; ErrorPopup mErrorPopup; + /** * This flag is set if the TextView tries to display an error before it * is attached to the window (so its position is still unknown). @@ -290,22 +289,6 @@ private void showError() { public void setError(CharSequence error, Drawable icon) { mError = TextUtils.stringOrSpannedString(error); mErrorWasChanged = true; - final Drawables dr = mTextView.mDrawables; - if (dr != null) { - switch (mTextView.getResolvedLayoutDirection()) { - default: - case View.LAYOUT_DIRECTION_LTR: - mTextView.setCompoundDrawables(dr.mDrawableLeft, dr.mDrawableTop, icon, - dr.mDrawableBottom); - break; - case View.LAYOUT_DIRECTION_RTL: - mTextView.setCompoundDrawables(icon, dr.mDrawableTop, dr.mDrawableRight, - dr.mDrawableBottom); - break; - } - } else { - mTextView.setCompoundDrawables(null, null, icon, null); - } if (mError == null) { if (mErrorPopup != null) { @@ -315,10 +298,21 @@ public void setError(CharSequence error, Drawable icon) { mErrorPopup = null; } + + setErrorIcon(null); + } else if (mTextView.isFocused()) { + showError(); + setErrorIcon(icon); + } + } + + private void setErrorIcon(Drawable icon) { + final Drawables dr = mTextView.mDrawables; + if (dr != null) { + mTextView.setCompoundDrawables(dr.mDrawableLeft, dr.mDrawableTop, icon, + dr.mDrawableBottom); } else { - if (mTextView.isFocused()) { - showError(); - } + mTextView.setCompoundDrawables(null, null, icon, null); } } @@ -327,6 +321,8 @@ private void hideError() { if (mErrorPopup.isShowing()) { mErrorPopup.dismiss(); } + + setErrorIcon(null); } mShowErrorAfterAttach = false; @@ -978,8 +974,8 @@ void onWindowFocusChanged(boolean hasWindowFocus) { mSuggestionsPopupWindow.onParentLostFocus(); } - // Don't leave us in the middle of a batch edit. - mTextView.onEndBatchEdit(); + // Don't leave us in the middle of a batch edit. Same as in onFocusChanged + ensureEndedBatchEdit(); } } @@ -1261,6 +1257,16 @@ private void drawHardwareAccelerated(Canvas canvas, Layout layout, Path highligh mTextDisplayLists = new DisplayList[ArrayUtils.idealObjectArraySize(0)]; } + // If the height of the layout changes (usually when inserting or deleting a line, + // but could be changes within a span), invalidate everything. We could optimize + // more aggressively (for example, adding offsets to blocks) but it would be more + // complex and we would only get the benefit in some cases. + int layoutHeight = layout.getHeight(); + if (mLastLayoutHeight != layoutHeight) { + invalidateTextDisplayList(); + mLastLayoutHeight = layoutHeight; + } + DynamicLayout dynamicLayout = (DynamicLayout) layout; int[] blockEndLines = dynamicLayout.getBlockEndLines(); int[] blockIndices = dynamicLayout.getBlockIndices(); @@ -1801,13 +1807,13 @@ void onDrop(DragEvent event) { mTextView.deleteText_internal(dragSourceStart, dragSourceEnd); // Make sure we do not leave two adjacent spaces. - CharSequence t = mTextView.getTransformedText(dragSourceStart - 1, dragSourceStart + 1); - if ( (dragSourceStart == 0 || Character.isSpaceChar(t.charAt(0))) && - (dragSourceStart == mTextView.getText().length() || - Character.isSpaceChar(t.charAt(1))) ) { - final int pos = dragSourceStart == mTextView.getText().length() ? - dragSourceStart - 1 : dragSourceStart; - mTextView.deleteText_internal(pos, pos + 1); + final int prevCharIdx = Math.max(0, dragSourceStart - 1); + final int nextCharIdx = Math.min(mTextView.getText().length(), dragSourceStart + 1); + if (nextCharIdx > prevCharIdx + 1) { + CharSequence t = mTextView.getTransformedText(prevCharIdx, nextCharIdx); + if (Character.isSpaceChar(t.charAt(0)) && Character.isSpaceChar(t.charAt(1))) { + mTextView.deleteText_internal(prevCharIdx, prevCharIdx + 1); + } } } } @@ -2282,14 +2288,11 @@ public View getView(int position, View convertView, ViewGroup parent) { final SuggestionInfo suggestionInfo = mSuggestionInfos[position]; textView.setText(suggestionInfo.text); - if (suggestionInfo.suggestionIndex == ADD_TO_DICTIONARY) { - textView.setCompoundDrawablesWithIntrinsicBounds( - com.android.internal.R.drawable.ic_suggestions_add, 0, 0, 0); - } else if (suggestionInfo.suggestionIndex == DELETE_TEXT) { - textView.setCompoundDrawablesWithIntrinsicBounds( - com.android.internal.R.drawable.ic_suggestions_delete, 0, 0, 0); + if (suggestionInfo.suggestionIndex == ADD_TO_DICTIONARY || + suggestionInfo.suggestionIndex == DELETE_TEXT) { + textView.setBackgroundColor(Color.TRANSPARENT); } else { - textView.setCompoundDrawables(null, null, null, null); + textView.setBackgroundColor(Color.WHITE); } return textView; diff --git a/core/java/android/widget/FastScroller.java b/core/java/android/widget/FastScroller.java index 083a9521a4d23..d2139af22ea12 100644 --- a/core/java/android/widget/FastScroller.java +++ b/core/java/android/widget/FastScroller.java @@ -181,10 +181,13 @@ private void refreshDrawableState() { } public void setScrollbarPosition(int position) { + if (position == View.SCROLLBAR_POSITION_DEFAULT) { + position = mList.isLayoutRtl() ? + View.SCROLLBAR_POSITION_LEFT : View.SCROLLBAR_POSITION_RIGHT; + } mPosition = position; switch (position) { default: - case View.SCROLLBAR_POSITION_DEFAULT: case View.SCROLLBAR_POSITION_RIGHT: mOverlayDrawable = mOverlayDrawableRight; break; @@ -229,7 +232,6 @@ private void resetThumbPos() { final int viewWidth = mList.getWidth(); // Bounds are always top right. Y coordinate get's translated during draw switch (mPosition) { - case View.SCROLLBAR_POSITION_DEFAULT: case View.SCROLLBAR_POSITION_RIGHT: mThumbDrawable.setBounds(viewWidth - mThumbW, 0, viewWidth, mThumbH); break; @@ -327,7 +329,6 @@ public void draw(Canvas canvas) { } int left = 0; switch (mPosition) { - case View.SCROLLBAR_POSITION_DEFAULT: case View.SCROLLBAR_POSITION_RIGHT: left = viewWidth - (mThumbW * alpha) / ScrollFade.ALPHA_MAX; break; @@ -360,7 +361,6 @@ public void draw(Canvas canvas) { int left = 0; switch (mPosition) { default: - case View.SCROLLBAR_POSITION_DEFAULT: case View.SCROLLBAR_POSITION_RIGHT: left = Math.max(0, mThumbDrawable.getBounds().left - mThumbW - mOverlaySize); @@ -410,7 +410,6 @@ void onSizeChanged(int w, int h, int oldw, int oldh) { if (mThumbDrawable != null) { switch (mPosition) { default: - case View.SCROLLBAR_POSITION_DEFAULT: case View.SCROLLBAR_POSITION_RIGHT: mThumbDrawable.setBounds(w - mThumbW, 0, w, mThumbH); break; @@ -820,7 +819,6 @@ boolean isPointInside(float x, float y) { boolean inTrack = false; switch (mPosition) { default: - case View.SCROLLBAR_POSITION_DEFAULT: case View.SCROLLBAR_POSITION_RIGHT: inTrack = x > mList.getWidth() - mThumbW; break; diff --git a/core/java/android/widget/FrameLayout.java b/core/java/android/widget/FrameLayout.java index d019d8c7b4283..738f63bb9f4d3 100644 --- a/core/java/android/widget/FrameLayout.java +++ b/core/java/android/widget/FrameLayout.java @@ -55,7 +55,7 @@ */ @RemoteView public class FrameLayout extends ViewGroup { - private static final int DEFAULT_CHILD_GRAVITY = Gravity.TOP | Gravity.LEFT; + private static final int DEFAULT_CHILD_GRAVITY = Gravity.TOP | Gravity.START; @ViewDebug.ExportedProperty(category = "measurement") boolean mMeasureAllChildren = false; @@ -411,7 +411,7 @@ protected void onLayout(boolean changed, int left, int top, int right, int botto gravity = DEFAULT_CHILD_GRAVITY; } - final int layoutDirection = getResolvedLayoutDirection(); + final int layoutDirection = getLayoutDirection(); final int absoluteGravity = Gravity.getAbsoluteGravity(gravity, layoutDirection); final int verticalGravity = gravity & Gravity.VERTICAL_GRAVITY_MASK; @@ -483,7 +483,7 @@ public void draw(Canvas canvas) { selfBounds.set(mPaddingLeft, mPaddingTop, w - mPaddingRight, h - mPaddingBottom); } - final int layoutDirection = getResolvedLayoutDirection(); + final int layoutDirection = getLayoutDirection(); Gravity.apply(mForegroundGravity, foreground.getIntrinsicWidth(), foreground.getIntrinsicHeight(), selfBounds, overlayBounds, layoutDirection); diff --git a/core/java/android/widget/Gallery.java b/core/java/android/widget/Gallery.java index 323fcf0695526..e0c5bbd7e4ad2 100644 --- a/core/java/android/widget/Gallery.java +++ b/core/java/android/widget/Gallery.java @@ -182,6 +182,12 @@ public void run() { */ private boolean mIsRtl = true; + /** + * Offset between the center of the selected child view and the center of the Gallery. + * Used to reset position correctly during layout. + */ + private int mSelectedCenterOffset; + public Gallery(Context context) { this(context, null); } @@ -395,6 +401,14 @@ void trackMotionScroll(int deltaX) { setSelectionToCenterChild(); + final View selChild = mSelectedChild; + if (selChild != null) { + final int childLeft = selChild.getLeft(); + final int childCenter = selChild.getWidth() / 2; + final int galleryCenter = getWidth() / 2; + mSelectedCenterOffset = childLeft + childCenter - galleryCenter; + } + onScrollChanged(0, 0, 0, 0); // dummy values, View's implementation does not use these. invalidate(); @@ -537,6 +551,7 @@ private void onFinishedMovement() { // We haven't been callbacking during the fling, so do it now super.selectionChanged(); } + mSelectedCenterOffset = 0; invalidate(); } @@ -650,7 +665,8 @@ void layout(int delta, boolean animate) { View sel = makeAndAddView(mSelectedPosition, 0, 0, true); // Put the selected child in the center - int selectedOffset = childrenLeft + (childrenWidth / 2) - (sel.getWidth() / 2); + int selectedOffset = childrenLeft + (childrenWidth / 2) - (sel.getWidth() / 2) + + mSelectedCenterOffset; sel.offsetLeftAndRight(selectedOffset); fillToGalleryRight(); @@ -1192,15 +1208,15 @@ public boolean onKeyDown(int keyCode, KeyEvent event) { case KeyEvent.KEYCODE_DPAD_LEFT: if (movePrevious()) { playSoundEffect(SoundEffectConstants.NAVIGATION_LEFT); + return true; } - return true; - + break; case KeyEvent.KEYCODE_DPAD_RIGHT: if (moveNext()) { playSoundEffect(SoundEffectConstants.NAVIGATION_RIGHT); + return true; } - return true; - + break; case KeyEvent.KEYCODE_DPAD_CENTER: case KeyEvent.KEYCODE_ENTER: mReceivedInvokeKeyDown = true; diff --git a/core/java/android/widget/GridView.java b/core/java/android/widget/GridView.java index ff8c0a1558749..63147dd73411d 100644 --- a/core/java/android/widget/GridView.java +++ b/core/java/android/widget/GridView.java @@ -94,7 +94,7 @@ public class GridView extends AbsListView { private View mReferenceView = null; private View mReferenceViewInSelectedRow = null; - private int mGravity = Gravity.LEFT; + private int mGravity = Gravity.START; private final Rect mTempRect = new Rect(); @@ -300,9 +300,18 @@ private View makeRow(int startPos, int y, boolean flow) { final int columnWidth = mColumnWidth; final int horizontalSpacing = mHorizontalSpacing; + final boolean isLayoutRtl = isLayoutRtl(); + int last; - int nextLeft = mListPadding.left + - ((mStretchMode == STRETCH_SPACING_UNIFORM) ? horizontalSpacing : 0); + int nextLeft; + + if (isLayoutRtl) { + nextLeft = getWidth() - mListPadding.right - columnWidth - + ((mStretchMode == STRETCH_SPACING_UNIFORM) ? horizontalSpacing : 0); + } else { + nextLeft = mListPadding.left + + ((mStretchMode == STRETCH_SPACING_UNIFORM) ? horizontalSpacing : 0); + } if (!mStackFromBottom) { last = Math.min(startPos + mNumColumns, mItemCount); @@ -311,7 +320,8 @@ private View makeRow(int startPos, int y, boolean flow) { startPos = Math.max(0, startPos - mNumColumns + 1); if (last - startPos < mNumColumns) { - nextLeft += (mNumColumns - (last - startPos)) * (columnWidth + horizontalSpacing); + final int deltaLeft = (mNumColumns - (last - startPos)) * (columnWidth + horizontalSpacing); + nextLeft += (isLayoutRtl ? -1 : +1) * deltaLeft; } } @@ -330,7 +340,7 @@ private View makeRow(int startPos, int y, boolean flow) { final int where = flow ? -1 : pos - startPos; child = makeAndAddView(pos, y, flow, nextLeft, selected, where); - nextLeft += columnWidth; + nextLeft += (isLayoutRtl ? -1 : +1) * columnWidth; if (pos < last - 1) { nextLeft += horizontalSpacing; } @@ -1415,7 +1425,7 @@ private void setupChild(View child, int position, int y, boolean flow, int child int childLeft; final int childTop = flow ? y : y - h; - final int layoutDirection = getResolvedLayoutDirection(); + final int layoutDirection = getLayoutDirection(); final int absoluteGravity = Gravity.getAbsoluteGravity(mGravity, layoutDirection); switch (absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK) { case Gravity.LEFT: @@ -2207,8 +2217,13 @@ protected int computeVerticalScrollOffset() { int height = view.getHeight(); if (height > 0) { final int numColumns = mNumColumns; - final int whichRow = mFirstPosition / numColumns; final int rowCount = (mItemCount + numColumns - 1) / numColumns; + // In case of stackFromBottom the calculation of whichRow needs + // to take into account that counting from the top the first row + // might not be entirely filled. + final int oddItemsOnFirstRow = isStackFromBottom() ? ((rowCount * numColumns) - + mItemCount) : 0; + final int whichRow = (mFirstPosition + oddItemsOnFirstRow) / numColumns; return Math.max(whichRow * 100 - (top * 100) / height + (int) ((float) mScrollY / getHeight() * rowCount * 100), 0); } diff --git a/core/java/android/widget/HorizontalScrollView.java b/core/java/android/widget/HorizontalScrollView.java index 18c4fe631af3a..ff0579cd78f9f 100644 --- a/core/java/android/widget/HorizontalScrollView.java +++ b/core/java/android/widget/HorizontalScrollView.java @@ -22,6 +22,7 @@ import android.graphics.Rect; import android.os.Bundle; import android.util.AttributeSet; +import android.util.Log; import android.view.FocusFinder; import android.view.InputDevice; import android.view.KeyEvent; @@ -62,6 +63,7 @@ public class HorizontalScrollView extends FrameLayout { private static final float MAX_SCROLL_FACTOR = ScrollView.MAX_SCROLL_FACTOR; + private static final String TAG = "HorizontalScrollView"; private long mLastScroll; @@ -456,6 +458,12 @@ public boolean onInterceptTouchEvent(MotionEvent ev) { } final int pointerIndex = ev.findPointerIndex(activePointerId); + if (pointerIndex == -1) { + Log.e(TAG, "Invalid pointerId=" + activePointerId + + " in onInterceptTouchEvent"); + break; + } + final int x = (int) ev.getX(pointerIndex); final int xDiff = (int) Math.abs(x - mLastMotionX); if (xDiff > mTouchSlop) { @@ -557,6 +565,11 @@ public boolean onTouchEvent(MotionEvent ev) { } case MotionEvent.ACTION_MOVE: final int activePointerIndex = ev.findPointerIndex(mActivePointerId); + if (activePointerIndex == -1) { + Log.e(TAG, "Invalid pointerId=" + mActivePointerId + " in onTouchEvent"); + break; + } + final int x = (int) ev.getX(activePointerIndex); int deltaX = mLastMotionX - x; if (!mIsBeingDragged && Math.abs(deltaX) > mTouchSlop) { diff --git a/core/java/android/widget/ImageView.java b/core/java/android/widget/ImageView.java index cf28da4d0bdc7..87396fbc13d07 100644 --- a/core/java/android/widget/ImageView.java +++ b/core/java/android/widget/ImageView.java @@ -193,15 +193,6 @@ public void invalidateDrawable(Drawable dr) { } } - /** - * @hide - */ - @Override - public int getResolvedLayoutDirection(Drawable dr) { - return (dr == mDrawable) ? - getResolvedLayoutDirection() : super.getResolvedLayoutDirection(dr); - } - @Override public boolean hasOverlappingRendering() { return (getBackground() != null); @@ -351,8 +342,15 @@ public void setImageResource(int resId) { updateDrawable(null); mResource = resId; mUri = null; + + final int oldWidth = mDrawableWidth; + final int oldHeight = mDrawableHeight; + resolveUri(); - requestLayout(); + + if (oldWidth != mDrawableWidth || oldHeight != mDrawableHeight) { + requestLayout(); + } invalidate(); } } @@ -376,8 +374,15 @@ public void setImageURI(Uri uri) { updateDrawable(null); mResource = 0; mUri = uri; + + final int oldWidth = mDrawableWidth; + final int oldHeight = mDrawableHeight; + resolveUri(); - requestLayout(); + + if (oldWidth != mDrawableWidth || oldHeight != mDrawableHeight) { + requestLayout(); + } invalidate(); } } @@ -392,8 +397,8 @@ public void setImageDrawable(Drawable drawable) { mResource = 0; mUri = null; - int oldWidth = mDrawableWidth; - int oldHeight = mDrawableHeight; + final int oldWidth = mDrawableWidth; + final int oldHeight = mDrawableHeight; updateDrawable(drawable); @@ -675,6 +680,7 @@ private void updateDrawable(Drawable d) { d.setState(getDrawableState()); } d.setLevel(mLevel); + d.setLayoutDirection(getLayoutDirection()); mDrawableWidth = d.getIntrinsicWidth(); mDrawableHeight = d.getIntrinsicHeight(); applyColorMod(); diff --git a/core/java/android/widget/LinearLayout.java b/core/java/android/widget/LinearLayout.java index 09c0129561098..b6f08623a38fe 100644 --- a/core/java/android/widget/LinearLayout.java +++ b/core/java/android/widget/LinearLayout.java @@ -345,28 +345,42 @@ void drawDividersVertical(Canvas canvas) { void drawDividersHorizontal(Canvas canvas) { final int count = getVirtualChildCount(); + final boolean isLayoutRtl = isLayoutRtl(); for (int i = 0; i < count; i++) { final View child = getVirtualChildAt(i); if (child != null && child.getVisibility() != GONE) { if (hasDividerBeforeChildAt(i)) { final LayoutParams lp = (LayoutParams) child.getLayoutParams(); - final int left = child.getLeft() - lp.leftMargin - mDividerWidth; - drawVerticalDivider(canvas, left); + final int position; + if (isLayoutRtl) { + position = child.getRight() + lp.rightMargin; + } else { + position = child.getLeft() - lp.leftMargin - mDividerWidth; + } + drawVerticalDivider(canvas, position); } } } if (hasDividerBeforeChildAt(count)) { final View child = getVirtualChildAt(count - 1); - int right = 0; + int position; if (child == null) { - right = getWidth() - getPaddingRight() - mDividerWidth; + if (isLayoutRtl) { + position = getPaddingLeft(); + } else { + position = getWidth() - getPaddingRight() - mDividerWidth; + } } else { final LayoutParams lp = (LayoutParams) child.getLayoutParams(); - right = child.getRight() + lp.rightMargin; + if (isLayoutRtl) { + position = child.getLeft() - lp.leftMargin - mDividerWidth; + } else { + position = child.getRight() + lp.rightMargin; + } } - drawVerticalDivider(canvas, right); + drawVerticalDivider(canvas, position); } } @@ -1481,7 +1495,7 @@ void layoutVertical() { if (gravity < 0) { gravity = minorGravity; } - final int layoutDirection = getResolvedLayoutDirection(); + final int layoutDirection = getLayoutDirection(); final int absoluteGravity = Gravity.getAbsoluteGravity(gravity, layoutDirection); switch (absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK) { case Gravity.CENTER_HORIZONTAL: @@ -1545,7 +1559,7 @@ void layoutHorizontal() { final int[] maxAscent = mMaxAscent; final int[] maxDescent = mMaxDescent; - final int layoutDirection = getResolvedLayoutDirection(); + final int layoutDirection = getLayoutDirection(); switch (Gravity.getAbsoluteGravity(majorGravity, layoutDirection)) { case Gravity.RIGHT: // mTotalLength contains the padding already diff --git a/core/java/android/widget/ListPopupWindow.java b/core/java/android/widget/ListPopupWindow.java index 1d966b36c2530..3d6b69ee608f1 100644 --- a/core/java/android/widget/ListPopupWindow.java +++ b/core/java/android/widget/ListPopupWindow.java @@ -21,6 +21,7 @@ import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.os.Handler; +import android.text.TextUtils; import android.util.AttributeSet; import android.util.Log; import android.view.KeyEvent; @@ -31,6 +32,8 @@ import android.view.ViewGroup; import android.view.ViewParent; +import java.util.Locale; + /** * A ListPopupWindow anchors itself to a host view and displays a * list of choices. @@ -92,6 +95,8 @@ public class ListPopupWindow { private boolean mModal; + private int mLayoutDirection; + /** * The provided prompt view should appear above list content. * @@ -193,6 +198,9 @@ public ListPopupWindow(Context context, AttributeSet attrs, int defStyleAttr, in mContext = context; mPopup = new PopupWindow(context, attrs, defStyleAttr, defStyleRes); mPopup.setInputMethodMode(PopupWindow.INPUT_METHOD_NEEDED); + // Set the default layout direction to match the default locale one + final Locale locale = mContext.getResources().getConfiguration().locale; + mLayoutDirection = TextUtils.getLayoutDirectionFromLocale(locale); } /** diff --git a/core/java/android/widget/ListView.java b/core/java/android/widget/ListView.java index e011c13a9c845..03507b5ffd8ad 100644 --- a/core/java/android/widget/ListView.java +++ b/core/java/android/widget/ListView.java @@ -29,6 +29,7 @@ import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.util.AttributeSet; +import android.util.MathUtils; import android.util.SparseBooleanArray; import android.view.FocusFinder; import android.view.KeyEvent; @@ -37,6 +38,7 @@ import android.view.ViewDebug; import android.view.ViewGroup; import android.view.ViewParent; +import android.view.ViewRootImpl; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityNodeInfo; import android.widget.RemoteViews.RemoteView; @@ -1490,6 +1492,10 @@ protected void layoutChildren() { View focusLayoutRestoreView = null; + AccessibilityNodeInfo accessibilityFocusLayoutRestoreNode = null; + View accessibilityFocusLayoutRestoreView = null; + int accessibilityFocusPosition = INVALID_POSITION; + // Remember stuff we will need down below switch (mLayoutMode) { case LAYOUT_SET_SELECTION: @@ -1584,6 +1590,30 @@ protected void layoutChildren() { requestFocus(); } + // Remember which child, if any, had accessibility focus. + final ViewRootImpl viewRootImpl = getViewRootImpl(); + if (viewRootImpl != null) { + final View accessFocusedView = viewRootImpl.getAccessibilityFocusedHost(); + if (accessFocusedView != null) { + final View accessFocusedChild = findAccessibilityFocusedChild( + accessFocusedView); + if (accessFocusedChild != null) { + if (!dataChanged || isDirectChildHeaderOrFooter(accessFocusedChild)) { + // If the views won't be changing, try to maintain + // focus on the current view host and (if + // applicable) its virtual view. + accessibilityFocusLayoutRestoreView = accessFocusedView; + accessibilityFocusLayoutRestoreNode = viewRootImpl + .getAccessibilityFocusedVirtualView(); + } else { + // Otherwise, try to maintain focus at the same + // position. + accessibilityFocusPosition = getPositionForView(accessFocusedChild); + } + } + } + } + // Clear out old views detachAllViewsFromParent(); recycleBin.removeSkippedScrap(); @@ -1682,6 +1712,22 @@ protected void layoutChildren() { } } + // Attempt to restore accessibility focus. + if (accessibilityFocusLayoutRestoreNode != null) { + accessibilityFocusLayoutRestoreNode.performAction( + AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS); + } else if (accessibilityFocusLayoutRestoreView != null) { + accessibilityFocusLayoutRestoreView.requestAccessibilityFocus(); + } else if (accessibilityFocusPosition != INVALID_POSITION) { + // Bound the position within the visible children. + final int position = MathUtils.constrain( + (accessibilityFocusPosition - mFirstPosition), 0, (getChildCount() - 1)); + final View restoreView = getChildAt(position); + if (restoreView != null) { + restoreView.requestAccessibilityFocus(); + } + } + // tell focus view we are done mucking with it, if it is still in // our view hierarchy. if (focusLayoutRestoreView != null @@ -1712,6 +1758,22 @@ protected void layoutChildren() { } } + /** + * @param focusedView the view that has accessibility focus. + * @return the direct child that contains accessibility focus. + */ + private View findAccessibilityFocusedChild(View focusedView) { + ViewParent viewParent = focusedView.getParent(); + while ((viewParent instanceof View) && (viewParent != this)) { + focusedView = (View) viewParent; + viewParent = viewParent.getParent(); + } + if (!(viewParent instanceof View)) { + return null; + } + return focusedView; + } + /** * @param child a direct child of this list. * @return Whether child is a header or footer view. diff --git a/core/java/android/widget/MediaController.java b/core/java/android/widget/MediaController.java index fc35f059d5fb6..f76ab2be54e5f 100644 --- a/core/java/android/widget/MediaController.java +++ b/core/java/android/widget/MediaController.java @@ -477,7 +477,8 @@ public boolean dispatchKeyEvent(KeyEvent event) { return true; } else if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN || keyCode == KeyEvent.KEYCODE_VOLUME_UP - || keyCode == KeyEvent.KEYCODE_VOLUME_MUTE) { + || keyCode == KeyEvent.KEYCODE_VOLUME_MUTE + || keyCode == KeyEvent.KEYCODE_CAMERA) { // don't show the controls for volume adjustment return super.dispatchKeyEvent(event); } else if (keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_MENU) { diff --git a/core/java/android/widget/NumberPicker.java b/core/java/android/widget/NumberPicker.java index a458f57d7de24..ac21671720234 100644 --- a/core/java/android/widget/NumberPicker.java +++ b/core/java/android/widget/NumberPicker.java @@ -51,10 +51,12 @@ import android.view.inputmethod.InputMethodManager; import com.android.internal.R; +import libcore.icu.LocaleData; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.Locale; /** * A widget that enables the user to select a number form a predefined range. @@ -137,13 +139,6 @@ public class NumberPicker extends LinearLayout { */ private static final int DEFAULT_LAYOUT_RESOURCE_ID = R.layout.number_picker; - /** - * The numbers accepted by the input text's {@link Filter} - */ - private static final char[] DIGIT_CHARACTERS = new char[] { - '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' - }; - /** * Constant for unspecified size. */ @@ -154,23 +149,53 @@ public class NumberPicker extends LinearLayout { * strings like "01". Keeping a static formatter etc. is the most efficient * way to do this; it avoids creating temporary objects on every call to * format(). - * - * @hide */ - public static final NumberPicker.Formatter TWO_DIGIT_FORMATTER = new NumberPicker.Formatter() { + private static class TwoDigitFormatter implements NumberPicker.Formatter { final StringBuilder mBuilder = new StringBuilder(); - final java.util.Formatter mFmt = new java.util.Formatter(mBuilder, java.util.Locale.US); + char mZeroDigit; + java.util.Formatter mFmt; final Object[] mArgs = new Object[1]; + TwoDigitFormatter() { + final Locale locale = Locale.getDefault(); + init(locale); + } + + private void init(Locale locale) { + mFmt = createFormatter(locale); + mZeroDigit = getZeroDigit(locale); + } + public String format(int value) { + final Locale currentLocale = Locale.getDefault(); + if (mZeroDigit != getZeroDigit(currentLocale)) { + init(currentLocale); + } mArgs[0] = value; mBuilder.delete(0, mBuilder.length()); mFmt.format("%02d", mArgs); return mFmt.toString(); } - }; + + private static char getZeroDigit(Locale locale) { + return LocaleData.get(locale).zeroDigit; + } + + private java.util.Formatter createFormatter(Locale locale) { + return new java.util.Formatter(mBuilder, locale); + } + } + + private static final TwoDigitFormatter sTwoDigitFormatter = new TwoDigitFormatter(); + + /** + * @hide + */ + public static final Formatter getTwoDigitFormatter() { + return sTwoDigitFormatter; + } /** * The increment button. @@ -1156,7 +1181,7 @@ private void tryComputeMaxWidth() { if (mDisplayedValues == null) { float maxDigitWidth = 0; for (int i = 0; i <= 9; i++) { - final float digitWidth = mSelectorWheelPaint.measureText(String.valueOf(i)); + final float digitWidth = mSelectorWheelPaint.measureText(formatNumberWithLocale(i)); if (digitWidth > maxDigitWidth) { maxDigitWidth = digitWidth; } @@ -1259,7 +1284,12 @@ public int getMinValue() { /** * Sets the min value of the picker. * - * @param minValue The min value. + * @param minValue The min value inclusive. + * + * Note: The length of the displayed values array + * set via {@link #setDisplayedValues(String[])} must be equal to the + * range of selectable numbers which is equal to + * {@link #getMaxValue()} - {@link #getMinValue()} + 1. */ public void setMinValue(int minValue) { if (mMinValue == minValue) { @@ -1292,7 +1322,12 @@ public int getMaxValue() { /** * Sets the max value of the picker. * - * @param maxValue The max value. + * @param maxValue The max value inclusive. + * + * Note: The length of the displayed values array + * set via {@link #setDisplayedValues(String[])} must be equal to the + * range of selectable numbers which is equal to + * {@link #getMaxValue()} - {@link #getMinValue()} + 1. */ public void setMaxValue(int maxValue) { if (mMaxValue == maxValue) { @@ -1326,6 +1361,10 @@ public String[] getDisplayedValues() { * Sets the values to be displayed. * * @param displayedValues The displayed values. + * + * Note: The length of the displayed values array + * must be equal to the range of selectable numbers which is equal to + * {@link #getMaxValue()} - {@link #getMinValue()} + 1. */ public void setDisplayedValues(String[] displayedValues) { if (mDisplayedValues == displayedValues) { @@ -1416,19 +1455,6 @@ protected void onDraw(Canvas canvas) { } } - @Override - public void addFocusables(ArrayList views, int direction, int focusableMode) { - // We do not want the real descendant to be considered focus search - // since it is managed by the accessibility node provider. - if ((focusableMode & FOCUSABLES_ACCESSIBILITY) == FOCUSABLES_ACCESSIBILITY) { - if (isAccessibilityFocusable()) { - views.add(this); - return; - } - } - super.addFocusables(views, direction, focusableMode); - } - @Override public void onInitializeAccessibilityEvent(AccessibilityEvent event) { super.onInitializeAccessibilityEvent(event); @@ -1702,7 +1728,7 @@ private void ensureCachedScrollSelectorValue(int selectorIndex) { } private String formatNumber(int value) { - return (mFormatter != null) ? mFormatter.format(value) : String.valueOf(value); + return (mFormatter != null) ? mFormatter.format(value) : formatNumberWithLocale(value); } private void validateInputTextView(View v) { @@ -1861,6 +1887,20 @@ private void postSetSelectionCommand(int selectionStart, int selectionEnd) { post(mSetSelectionCommand); } + /** + * The numbers accepted by the input text's {@link Filter} + */ + private static final char[] DIGIT_CHARACTERS = new char[] { + // Latin digits are the common case + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', + // Arabic-Indic + '\u0660', '\u0661', '\u0662', '\u0663', '\u0664', '\u0665', '\u0666', '\u0667', '\u0668' + , '\u0669', + // Extended Arabic-Indic + '\u06f0', '\u06f1', '\u06f2', '\u06f3', '\u06f4', '\u06f5', '\u06f6', '\u06f7', '\u06f8' + , '\u06f9' + }; + /** * Filter for accepting only valid indices or prefixes of the string * representation of valid indices. @@ -2297,78 +2337,6 @@ public boolean performAction(int virtualViewId, int action, Bundle arguments) { return super.performAction(virtualViewId, action, arguments); } - @Override - public AccessibilityNodeInfo findAccessibilityFocus(int virtualViewId) { - return createAccessibilityNodeInfo(mAccessibilityFocusedView); - } - - @Override - public AccessibilityNodeInfo accessibilityFocusSearch(int direction, int virtualViewId) { - switch (direction) { - case View.ACCESSIBILITY_FOCUS_DOWN: - case View.ACCESSIBILITY_FOCUS_FORWARD: { - switch (mAccessibilityFocusedView) { - case UNDEFINED: { - return createAccessibilityNodeInfo(View.NO_ID); - } - case View.NO_ID: { - if (hasVirtualDecrementButton()) { - return createAccessibilityNodeInfo(VIRTUAL_VIEW_ID_DECREMENT); - } - } - //$FALL-THROUGH$ - case VIRTUAL_VIEW_ID_DECREMENT: { - return createAccessibilityNodeInfo(VIRTUAL_VIEW_ID_INPUT); - } - case VIRTUAL_VIEW_ID_INPUT: { - if (hasVirtualIncrementButton()) { - return createAccessibilityNodeInfo(VIRTUAL_VIEW_ID_INCREMENT); - } - } - //$FALL-THROUGH$ - case VIRTUAL_VIEW_ID_INCREMENT: { - View nextFocus = NumberPicker.this.focusSearch(direction); - if (nextFocus != null) { - return nextFocus.createAccessibilityNodeInfo(); - } - return null; - } - } - } break; - case View.ACCESSIBILITY_FOCUS_UP: - case View.ACCESSIBILITY_FOCUS_BACKWARD: { - switch (mAccessibilityFocusedView) { - case UNDEFINED: { - return createAccessibilityNodeInfo(View.NO_ID); - } - case View.NO_ID: { - if (hasVirtualIncrementButton()) { - return createAccessibilityNodeInfo(VIRTUAL_VIEW_ID_INCREMENT); - } - } - //$FALL-THROUGH$ - case VIRTUAL_VIEW_ID_INCREMENT: { - return createAccessibilityNodeInfo(VIRTUAL_VIEW_ID_INPUT); - } - case VIRTUAL_VIEW_ID_INPUT: { - if (hasVirtualDecrementButton()) { - return createAccessibilityNodeInfo(VIRTUAL_VIEW_ID_DECREMENT); - } - } - //$FALL-THROUGH$ - case VIRTUAL_VIEW_ID_DECREMENT: { - View nextFocus = NumberPicker.this.focusSearch(direction); - if (nextFocus != null) { - return nextFocus.createAccessibilityNodeInfo(); - } - return null; - } - } - } break; - } - return null; - } - public void sendAccessibilityEventForVirtualView(int virtualViewId, int eventType) { switch (virtualViewId) { case VIRTUAL_VIEW_ID_DECREMENT: { @@ -2390,22 +2358,26 @@ public void sendAccessibilityEventForVirtualView(int virtualViewId, int eventTyp } private void sendAccessibilityEventForVirtualText(int eventType) { - AccessibilityEvent event = AccessibilityEvent.obtain(eventType); - mInputText.onInitializeAccessibilityEvent(event); - mInputText.onPopulateAccessibilityEvent(event); - event.setSource(NumberPicker.this, VIRTUAL_VIEW_ID_INPUT); - requestSendAccessibilityEvent(NumberPicker.this, event); + if (AccessibilityManager.getInstance(mContext).isEnabled()) { + AccessibilityEvent event = AccessibilityEvent.obtain(eventType); + mInputText.onInitializeAccessibilityEvent(event); + mInputText.onPopulateAccessibilityEvent(event); + event.setSource(NumberPicker.this, VIRTUAL_VIEW_ID_INPUT); + requestSendAccessibilityEvent(NumberPicker.this, event); + } } private void sendAccessibilityEventForVirtualButton(int virtualViewId, int eventType, String text) { - AccessibilityEvent event = AccessibilityEvent.obtain(eventType); - event.setClassName(Button.class.getName()); - event.setPackageName(mContext.getPackageName()); - event.getText().add(text); - event.setEnabled(NumberPicker.this.isEnabled()); - event.setSource(NumberPicker.this, virtualViewId); - requestSendAccessibilityEvent(NumberPicker.this, event); + if (AccessibilityManager.getInstance(mContext).isEnabled()) { + AccessibilityEvent event = AccessibilityEvent.obtain(eventType); + event.setClassName(Button.class.getName()); + event.setPackageName(mContext.getPackageName()); + event.getText().add(text); + event.setEnabled(NumberPicker.this.isEnabled()); + event.setSource(NumberPicker.this, virtualViewId); + requestSendAccessibilityEvent(NumberPicker.this, event); + } } private void findAccessibilityNodeInfosByTextInChild(String searchedLowerCase, @@ -2506,14 +2478,22 @@ private AccessibilityNodeInfo createAccessibilityNodeInfoForNumberPicker(int lef info.setParent((View) getParentForAccessibility()); info.setEnabled(NumberPicker.this.isEnabled()); info.setScrollable(true); + + final float applicationScale = + getContext().getResources().getCompatibilityInfo().applicationScale; + Rect boundsInParent = mTempRect; boundsInParent.set(left, top, right, bottom); + boundsInParent.scale(applicationScale); info.setBoundsInParent(boundsInParent); + info.setVisibleToUser(isVisibleToUser()); + Rect boundsInScreen = boundsInParent; int[] locationOnScreen = mTempArray; getLocationOnScreen(locationOnScreen); boundsInScreen.offset(locationOnScreen[0], locationOnScreen[1]); + boundsInScreen.scale(applicationScale); info.setBoundsInScreen(boundsInScreen); if (mAccessibilityFocusedView != View.NO_ID) { @@ -2566,4 +2546,8 @@ private String getVirtualIncrementButtonText() { return null; } } + + static private String formatNumberWithLocale(int value) { + return String.format(Locale.getDefault(), "%d", value); + } } diff --git a/core/java/android/widget/OverScroller.java b/core/java/android/widget/OverScroller.java index 1c72a0d08a039..f2181991b4c45 100644 --- a/core/java/android/widget/OverScroller.java +++ b/core/java/android/widget/OverScroller.java @@ -72,10 +72,8 @@ public OverScroller(Context context, Interpolator interpolator) { public OverScroller(Context context, Interpolator interpolator, boolean flywheel) { mInterpolator = interpolator; mFlywheel = flywheel; - mScrollerX = new SplineOverScroller(); - mScrollerY = new SplineOverScroller(); - - SplineOverScroller.initFromContext(context); + mScrollerX = new SplineOverScroller(context); + mScrollerY = new SplineOverScroller(context); } /** @@ -585,8 +583,8 @@ static class SplineOverScroller { // Constant gravity value, used in the deceleration phase. private static final float GRAVITY = 2000.0f; - // A device specific coefficient adjusted to physical values. - private static float PHYSICAL_COEF; + // A context-specific coefficient adjusted to physical values. + private float mPhysicalCoeff; private static float DECELERATION_RATE = (float) (Math.log(0.78) / Math.log(0.9)); private static final float INFLEXION = 0.35f; // Tension lines cross at (INFLEXION, 1) @@ -636,20 +634,17 @@ static class SplineOverScroller { SPLINE_POSITION[NB_SAMPLES] = SPLINE_TIME[NB_SAMPLES] = 1.0f; } - static void initFromContext(Context context) { - final float ppi = context.getResources().getDisplayMetrics().density * 160.0f; - PHYSICAL_COEF = SensorManager.GRAVITY_EARTH // g (m/s^2) - * 39.37f // inch/meter - * ppi - * 0.84f; // look and feel tuning - } - void setFriction(float friction) { mFlingFriction = friction; } - SplineOverScroller() { + SplineOverScroller(Context context) { mFinished = true; + final float ppi = context.getResources().getDisplayMetrics().density * 160.0f; + mPhysicalCoeff = SensorManager.GRAVITY_EARTH // g (m/s^2) + * 39.37f // inch/meter + * ppi + * 0.84f; // look and feel tuning } void updateScroll(float q) { @@ -785,13 +780,13 @@ void fling(int start, int velocity, int min, int max, int over) { } private double getSplineDeceleration(int velocity) { - return Math.log(INFLEXION * Math.abs(velocity) / (mFlingFriction * PHYSICAL_COEF)); + return Math.log(INFLEXION * Math.abs(velocity) / (mFlingFriction * mPhysicalCoeff)); } private double getSplineFlingDistance(int velocity) { final double l = getSplineDeceleration(velocity); final double decelMinusOne = DECELERATION_RATE - 1.0; - return mFlingFriction * PHYSICAL_COEF * Math.exp(DECELERATION_RATE / decelMinusOne * l); + return mFlingFriction * mPhysicalCoeff * Math.exp(DECELERATION_RATE / decelMinusOne * l); } /* Returns the duration, expressed in milliseconds */ diff --git a/core/java/android/widget/PopupWindow.java b/core/java/android/widget/PopupWindow.java index f442912f08366..b71649ad817d8 100644 --- a/core/java/android/widget/PopupWindow.java +++ b/core/java/android/widget/PopupWindow.java @@ -142,6 +142,8 @@ public void onScrollChanged() { }; private int mAnchorXoff, mAnchorYoff; + private boolean mPopupViewInitialLayoutDirectionInherited; + /** *

          Create a new empty, non focusable popup window of dimension (0,0).

          * @@ -835,7 +837,7 @@ public void showAtLocation(IBinder token, int gravity, int x, int y) { preparePopup(p); if (gravity == Gravity.NO_GRAVITY) { - gravity = Gravity.TOP | Gravity.LEFT; + gravity = Gravity.TOP | Gravity.START; } p.gravity = gravity; p.x = x; @@ -968,6 +970,8 @@ private void preparePopup(WindowManager.LayoutParams p) { } else { mPopupView = mContentView; } + mPopupViewInitialLayoutDirectionInherited = + (mPopupView.getRawLayoutDirection() == View.LAYOUT_DIRECTION_INHERIT); mPopupWidth = p.width; mPopupHeight = p.height; } @@ -985,9 +989,19 @@ private void invokePopup(WindowManager.LayoutParams p) { p.packageName = mContext.getPackageName(); } mPopupView.setFitsSystemWindows(mLayoutInsetDecor); + setLayoutDirectionFromAnchor(); mWindowManager.addView(mPopupView, p); } + private void setLayoutDirectionFromAnchor() { + if (mAnchor != null) { + View anchor = mAnchor.get(); + if (anchor != null && mPopupViewInitialLayoutDirectionInherited) { + mPopupView.setLayoutDirection(anchor.getLayoutDirection()); + } + } + } + /** *

          Generate the layout parameters for the popup window.

          * @@ -1003,7 +1017,7 @@ private WindowManager.LayoutParams createPopupLayout(IBinder token) { // screen. The view is then positioned to the appropriate location // by setting the x and y offsets to match the anchor's bottom // left corner - p.gravity = Gravity.LEFT | Gravity.TOP; + p.gravity = Gravity.START | Gravity.TOP; p.width = mLastWidth = mWidth; p.height = mLastHeight = mHeight; if (mBackground != null) { @@ -1100,7 +1114,7 @@ private boolean findDropDownPosition(View anchor, WindowManager.LayoutParams p, boolean onTop = false; - p.gravity = Gravity.LEFT | Gravity.TOP; + p.gravity = Gravity.START | Gravity.TOP; anchor.getLocationOnScreen(mScreenLocation); final Rect displayFrame = new Rect(); @@ -1134,7 +1148,7 @@ private boolean findDropDownPosition(View anchor, WindowManager.LayoutParams p, onTop = (displayFrame.bottom - mScreenLocation[1] - anchor.getHeight() - yoff) < (mScreenLocation[1] - yoff - displayFrame.top); if (onTop) { - p.gravity = Gravity.LEFT | Gravity.BOTTOM; + p.gravity = Gravity.START | Gravity.BOTTOM; p.y = root.getHeight() - mDrawingLocation[1] + yoff; } else { p.y = mDrawingLocation[1] + anchor.getHeight() + yoff; @@ -1304,8 +1318,9 @@ public void update() { p.flags = newFlags; update = true; } - + if (update) { + setLayoutDirectionFromAnchor(); mWindowManager.updateViewLayout(mPopupView, p); } } @@ -1406,6 +1421,7 @@ public void update(int x, int y, int width, int height, boolean force) { } if (update) { + setLayoutDirectionFromAnchor(); mWindowManager.updateViewLayout(mPopupView, p); } } @@ -1482,7 +1498,7 @@ private void update(View anchor, boolean updateLocation, int xoff, int yoff, } else { updateAboveAnchor(findDropDownPosition(anchor, p, mAnchorXoff, mAnchorYoff)); } - + update(p.x, p.y, width, height, x != p.x || y != p.y); } diff --git a/core/java/android/widget/ProgressBar.java b/core/java/android/widget/ProgressBar.java index f3f18d585dbdd..ea50e2e438ecf 100644 --- a/core/java/android/widget/ProgressBar.java +++ b/core/java/android/widget/ProgressBar.java @@ -478,6 +478,9 @@ public void setIndeterminateDrawable(Drawable d) { d.setCallback(this); } mIndeterminateDrawable = d; + if (mIndeterminateDrawable != null && canResolveLayoutDirection()) { + mIndeterminateDrawable.setLayoutDirection(getLayoutDirection()); + } if (mIndeterminate) { mCurrentDrawable = d; postInvalidate(); @@ -517,6 +520,9 @@ public void setProgressDrawable(Drawable d) { if (d != null) { d.setCallback(this); + if (canResolveLayoutDirection()) { + d.setLayoutDirection(getLayoutDirection()); + } // Make sure the ProgressBar is always tall enough int drawableHeight = d.getMinimumHeight(); @@ -559,6 +565,23 @@ public void jumpDrawablesToCurrentState() { if (mIndeterminateDrawable != null) mIndeterminateDrawable.jumpToCurrentState(); } + /** + * @hide + */ + @Override + public void onResolveDrawables(int layoutDirection) { + final Drawable d = mCurrentDrawable; + if (d != null) { + d.setLayoutDirection(layoutDirection); + } + if (mIndeterminateDrawable != null) { + mIndeterminateDrawable.setLayoutDirection(layoutDirection); + } + if (mProgressDrawable != null) { + mProgressDrawable.setLayoutDirection(layoutDirection); + } + } + @Override public void postInvalidate() { if (!mNoInvalidate) { @@ -648,6 +671,9 @@ private synchronized void doRefreshProgress(int id, int progress, boolean fromUs if (d instanceof LayerDrawable) { progressDrawable = ((LayerDrawable) d).findDrawableByLayerId(id); + if (progressDrawable != null && canResolveLayoutDirection()) { + progressDrawable.setLayoutDirection(getLayoutDirection()); + } } final int level = (int) (scale * MAX_LEVEL); @@ -975,24 +1001,19 @@ public void invalidateDrawable(Drawable dr) { } } - /** - * @hide - */ - @Override - public int getResolvedLayoutDirection(Drawable who) { - return (who == mProgressDrawable || who == mIndeterminateDrawable) ? - getResolvedLayoutDirection() : super.getResolvedLayoutDirection(who); - } - @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { updateDrawableBounds(w, h); } private void updateDrawableBounds(int w, int h) { - // onDraw will translate the canvas so we draw starting at 0,0 - int right = w - mPaddingRight - mPaddingLeft; - int bottom = h - mPaddingBottom - mPaddingTop; + // onDraw will translate the canvas so we draw starting at 0,0. + // Subtract out padding for the purposes of the calculations below. + w -= mPaddingRight + mPaddingLeft; + h -= mPaddingTop + mPaddingBottom; + + int right = w; + int bottom = h; int top = 0; int left = 0; @@ -1019,6 +1040,11 @@ private void updateDrawableBounds(int w, int h) { } } } + if (isLayoutRtl()) { + int tempLeft = left; + left = w - right; + right = w - tempLeft; + } mIndeterminateDrawable.setBounds(left, top, right, bottom); } @@ -1036,7 +1062,12 @@ protected synchronized void onDraw(Canvas canvas) { // Translate canvas so a indeterminate circular progress bar with padding // rotates properly in its animation canvas.save(); - canvas.translate(mPaddingLeft, mPaddingTop); + if(isLayoutRtl()) { + canvas.translate(getWidth() - mPaddingRight, mPaddingTop); + canvas.scale(-1.0f, 1.0f); + } else { + canvas.translate(mPaddingLeft, mPaddingTop); + } long time = getDrawingTime(); if (mHasAnimation) { mAnimation.getTransformation(time, mTransformation); diff --git a/core/java/android/widget/RadioGroup.java b/core/java/android/widget/RadioGroup.java index f217c9c67336c..78d05b0987bfd 100644 --- a/core/java/android/widget/RadioGroup.java +++ b/core/java/android/widget/RadioGroup.java @@ -376,7 +376,7 @@ public void onChildViewAdded(View parent, View child) { int id = child.getId(); // generates an id if it's missing if (id == View.NO_ID) { - id = child.hashCode(); + id = View.generateViewId(); child.setId(id); } ((RadioButton) child).setOnCheckedChangeWidgetListener( diff --git a/core/java/android/widget/RelativeLayout.java b/core/java/android/widget/RelativeLayout.java index 569cf993eed38..e52e84df3fa28 100644 --- a/core/java/android/widget/RelativeLayout.java +++ b/core/java/android/widget/RelativeLayout.java @@ -149,8 +149,34 @@ public class RelativeLayout extends ViewGroup { * bounds of its RelativeLayout parent. */ public static final int CENTER_VERTICAL = 15; + /** + * Rule that aligns a child's end edge with another child's start edge. + */ + public static final int START_OF = 16; + /** + * Rule that aligns a child's start edge with another child's end edge. + */ + public static final int END_OF = 17; + /** + * Rule that aligns a child's start edge with another child's start edge. + */ + public static final int ALIGN_START = 18; + /** + * Rule that aligns a child's end edge with another child's end edge. + */ + public static final int ALIGN_END = 19; + /** + * Rule that aligns the child's start edge with its RelativeLayout + * parent's start edge. + */ + public static final int ALIGN_PARENT_START = 20; + /** + * Rule that aligns the child's end edge with its RelativeLayout + * parent's end edge. + */ + public static final int ALIGN_PARENT_END = 21; - private static final int VERB_COUNT = 16; + private static final int VERB_COUNT = 22; private static final int[] RULES_VERTICAL = { @@ -158,13 +184,13 @@ public class RelativeLayout extends ViewGroup { }; private static final int[] RULES_HORIZONTAL = { - LEFT_OF, RIGHT_OF, ALIGN_LEFT, ALIGN_RIGHT + LEFT_OF, RIGHT_OF, ALIGN_LEFT, ALIGN_RIGHT, START_OF, END_OF, ALIGN_START, ALIGN_END }; private View mBaselineView = null; private boolean mHasBaselineAlignedChild; - private int mGravity = Gravity.LEFT | Gravity.TOP; + private int mGravity = Gravity.START | Gravity.TOP; private final Rect mContentBounds = new Rect(); private final Rect mSelfBounds = new Rect(); private int mIgnoreGravity; @@ -204,7 +230,7 @@ public boolean shouldDelayChildPressedState() { /** * Defines which View is ignored when the gravity is applied. This setting has no - * effect if the gravity is Gravity.LEFT | Gravity.TOP. + * effect if the gravity is Gravity.START | Gravity.TOP. * * @param viewId The id of the View to be ignored by gravity, or 0 if no View * should be ignored. @@ -234,7 +260,7 @@ public int getGravity() { /** * Describes how the child views are positioned. Defaults to - * Gravity.LEFT | Gravity.TOP. + * Gravity.START | Gravity.TOP. * *

          Note that since RelativeLayout considers the positioning of each child * relative to one another to be significant, setting gravity will affect @@ -369,7 +395,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { View ignore = null; int gravity = mGravity & Gravity.RELATIVE_HORIZONTAL_GRAVITY_MASK; - final boolean horizontalGravity = gravity != Gravity.LEFT && gravity != 0; + final boolean horizontalGravity = gravity != Gravity.START && gravity != 0; gravity = mGravity & Gravity.VERTICAL_GRAVITY_MASK; final boolean verticalGravity = gravity != Gravity.TOP && gravity != 0; @@ -457,6 +483,8 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { } } + final int layoutDirection = getLayoutDirection(); + if (isWrapContentWidth) { // Width already has left padding in it since it was calculated by looking at // the right of each child view @@ -474,7 +502,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { View child = getChildAt(i); if (child.getVisibility() != GONE) { LayoutParams params = (LayoutParams) child.getLayoutParams(); - final int[] rules = params.getRules(); + final int[] rules = params.getRules(layoutDirection); if (rules[CENTER_IN_PARENT] != 0 || rules[CENTER_HORIZONTAL] != 0) { centerHorizontal(child, params, width); } else if (rules[ALIGN_PARENT_RIGHT] != 0) { @@ -504,7 +532,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { View child = getChildAt(i); if (child.getVisibility() != GONE) { LayoutParams params = (LayoutParams) child.getLayoutParams(); - final int[] rules = params.getRules(); + final int[] rules = params.getRules(layoutDirection); if (rules[CENTER_IN_PARENT] != 0 || rules[CENTER_VERTICAL] != 0) { centerVertical(child, params, height); } else if (rules[ALIGN_PARENT_BOTTOM] != 0) { @@ -523,7 +551,6 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { height - mPaddingBottom); final Rect contentBounds = mContentBounds; - final int layoutDirection = getResolvedLayoutDirection(); Gravity.apply(mGravity, right - left, bottom - top, selfBounds, contentBounds, layoutDirection); @@ -551,7 +578,8 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { } private void alignBaseline(View child, LayoutParams params) { - int[] rules = params.getRules(); + final int layoutDirection = getLayoutDirection(); + int[] rules = params.getRules(layoutDirection); int anchorBaseline = getRelatedViewBaseline(rules, ALIGN_BASELINE); if (anchorBaseline != -1) { @@ -619,7 +647,7 @@ private void measureChildHorizontal(View child, LayoutParams params, int myWidth /** * Get a measure spec that accounts for all of the constraints on this view. - * This includes size contstraints imposed by the RelativeLayout as well as + * This includes size constraints imposed by the RelativeLayout as well as * the View's desired dimension. * * @param childStart The left or top field of the child's layout params @@ -672,7 +700,7 @@ private int getChildMeasureSpec(int childStart, int childEnd, childSpecSize = childSize; } } else if (childSize == LayoutParams.MATCH_PARENT) { - // Child wanted to be as big as possible. Give all availble + // Child wanted to be as big as possible. Give all available // space childSpecMode = MeasureSpec.EXACTLY; childSpecSize = maxAvailable; @@ -681,7 +709,7 @@ private int getChildMeasureSpec(int childStart, int childEnd, // to communicate available space if we know // our max size if (maxAvailable >= 0) { - // We have a maxmum size in this dimension. + // We have a maximum size in this dimension. childSpecMode = MeasureSpec.AT_MOST; childSpecSize = maxAvailable; } else { @@ -699,7 +727,8 @@ private int getChildMeasureSpec(int childStart, int childEnd, private boolean positionChildHorizontal(View child, LayoutParams params, int myWidth, boolean wrapContent) { - int[] rules = params.getRules(); + final int layoutDirection = getLayoutDirection(); + int[] rules = params.getRules(layoutDirection); if (params.mLeft < 0 && params.mRight >= 0) { // Right is fixed, but left varies @@ -718,11 +747,18 @@ private boolean positionChildHorizontal(View child, LayoutParams params, int myW } return true; } else { - params.mLeft = mPaddingLeft + params.leftMargin; - params.mRight = params.mLeft + child.getMeasuredWidth(); + // This is the default case. For RTL we start from the right and for LTR we start + // from the left. This will give LEFT/TOP for LTR and RIGHT/TOP for RTL. + if (isLayoutRtl()) { + params.mRight = myWidth - mPaddingRight- params.rightMargin; + params.mLeft = params.mRight - child.getMeasuredWidth(); + } else { + params.mLeft = mPaddingLeft + params.leftMargin; + params.mRight = params.mLeft + child.getMeasuredWidth(); + } } } - return rules[ALIGN_PARENT_RIGHT] != 0; + return rules[ALIGN_PARENT_END] != 0; } private boolean positionChildVertical(View child, LayoutParams params, int myHeight, @@ -755,7 +791,8 @@ private boolean positionChildVertical(View child, LayoutParams params, int myHei } private void applyHorizontalSizeRules(LayoutParams childParams, int myWidth) { - int[] rules = childParams.getRules(); + final int layoutDirection = getLayoutDirection(); + int[] rules = childParams.getRules(layoutDirection); RelativeLayout.LayoutParams anchorParams; // -1 indicated a "soft requirement" in that direction. For example: @@ -946,7 +983,6 @@ protected void onLayout(boolean changed, int l, int t, int r, int b) { RelativeLayout.LayoutParams st = (RelativeLayout.LayoutParams) child.getLayoutParams(); child.layout(st.mLeft, st.mTop, st.mRight, st.mBottom); - } } } @@ -1061,6 +1097,12 @@ public int compare(View first, View second) { * @attr ref android.R.styleable#RelativeLayout_Layout_layout_centerInParent * @attr ref android.R.styleable#RelativeLayout_Layout_layout_centerHorizontal * @attr ref android.R.styleable#RelativeLayout_Layout_layout_centerVertical + * @attr ref android.R.styleable#RelativeLayout_Layout_layout_toStartOf + * @attr ref android.R.styleable#RelativeLayout_Layout_layout_toEndOf + * @attr ref android.R.styleable#RelativeLayout_Layout_layout_alignStart + * @attr ref android.R.styleable#RelativeLayout_Layout_layout_alignEnd + * @attr ref android.R.styleable#RelativeLayout_Layout_layout_alignParentStart + * @attr ref android.R.styleable#RelativeLayout_Layout_layout_alignParentEnd */ public static class LayoutParams extends ViewGroup.MarginLayoutParams { @ViewDebug.ExportedProperty(category = "layout", resolveId = true, indexMapping = { @@ -1079,15 +1121,28 @@ public static class LayoutParams extends ViewGroup.MarginLayoutParams { @ViewDebug.IntToString(from = CENTER_IN_PARENT, to = "center"), @ViewDebug.IntToString(from = CENTER_VERTICAL, to = "centerVertical"), @ViewDebug.IntToString(from = LEFT_OF, to = "leftOf"), - @ViewDebug.IntToString(from = RIGHT_OF, to = "rightOf") + @ViewDebug.IntToString(from = RIGHT_OF, to = "rightOf"), + @ViewDebug.IntToString(from = ALIGN_START, to = "alignStart"), + @ViewDebug.IntToString(from = ALIGN_END, to = "alignEnd"), + @ViewDebug.IntToString(from = ALIGN_PARENT_START, to = "alignParentStart"), + @ViewDebug.IntToString(from = ALIGN_PARENT_END, to = "alignParentEnd"), + @ViewDebug.IntToString(from = START_OF, to = "startOf"), + @ViewDebug.IntToString(from = END_OF, to = "endOf") }, mapping = { @ViewDebug.IntToString(from = TRUE, to = "true"), @ViewDebug.IntToString(from = 0, to = "false/NO_ID") }) + private int[] mRules = new int[VERB_COUNT]; + private int[] mInitialRules = new int[VERB_COUNT]; private int mLeft, mTop, mRight, mBottom; + private int mStart = DEFAULT_RELATIVE; + private int mEnd = DEFAULT_RELATIVE; + + private boolean mRulesChanged = false; + /** * When true, uses the parent as the anchor if the anchor doesn't exist or if * the anchor's visibility is GONE. @@ -1102,6 +1157,7 @@ public LayoutParams(Context c, AttributeSet attrs) { com.android.internal.R.styleable.RelativeLayout_Layout); final int[] rules = mRules; + final int[] initialRules = mInitialRules; final int N = a.getIndexCount(); for (int i = 0; i < N; i++) { @@ -1158,9 +1214,31 @@ public LayoutParams(Context c, AttributeSet attrs) { case com.android.internal.R.styleable.RelativeLayout_Layout_layout_centerVertical: rules[CENTER_VERTICAL] = a.getBoolean(attr, false) ? TRUE : 0; break; + case com.android.internal.R.styleable.RelativeLayout_Layout_layout_toStartOf: + rules[START_OF] = a.getResourceId(attr, 0); + break; + case com.android.internal.R.styleable.RelativeLayout_Layout_layout_toEndOf: + rules[END_OF] = a.getResourceId(attr, 0); + break; + case com.android.internal.R.styleable.RelativeLayout_Layout_layout_alignStart: + rules[ALIGN_START] = a.getResourceId(attr, 0); + break; + case com.android.internal.R.styleable.RelativeLayout_Layout_layout_alignEnd: + rules[ALIGN_END] = a.getResourceId(attr, 0); + break; + case com.android.internal.R.styleable.RelativeLayout_Layout_layout_alignParentStart: + rules[ALIGN_PARENT_START] = a.getBoolean(attr, false) ? TRUE : 0; + break; + case com.android.internal.R.styleable.RelativeLayout_Layout_layout_alignParentEnd: + rules[ALIGN_PARENT_END] = a.getBoolean(attr, false) ? TRUE : 0; + break; } } + for (int n = LEFT_OF; n < VERB_COUNT; n++) { + initialRules[n] = rules[n]; + } + a.recycle(); } @@ -1192,7 +1270,7 @@ public String debug(String output) { * Adds a layout rule to be interpreted by the RelativeLayout. This * method should only be used for constraints that don't refer to another sibling * (e.g., CENTER_IN_PARENT) or take a boolean value ({@link RelativeLayout#TRUE} - * for true or - for false). To specify a verb that takes a subject, use + * for true or 0 for false). To specify a verb that takes a subject, use * {@link #addRule(int, int)} instead. * * @param verb One of the verbs defined by @@ -1202,6 +1280,8 @@ public String debug(String output) { */ public void addRule(int verb) { mRules[verb] = TRUE; + mInitialRules[verb] = TRUE; + mRulesChanged = true; } /** @@ -1220,12 +1300,88 @@ public void addRule(int verb) { */ public void addRule(int verb, int anchor) { mRules[verb] = anchor; + mInitialRules[verb] = anchor; + 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 || + mInitialRules[ALIGN_PARENT_START] != 0 || mInitialRules[ALIGN_PARENT_END] != 0); + } + + private void resolveRules(int layoutDirection) { + final boolean isLayoutRtl = (layoutDirection == View.LAYOUT_DIRECTION_RTL); + // Reset to initial state + for (int n = LEFT_OF; n < VERB_COUNT; n++) { + mRules[n] = mInitialRules[n]; + } + // Apply rules depending on direction + if (mRules[ALIGN_START] != 0) { + mRules[isLayoutRtl ? ALIGN_RIGHT : ALIGN_LEFT] = mRules[ALIGN_START]; + } + if (mRules[ALIGN_END] != 0) { + mRules[isLayoutRtl ? ALIGN_LEFT : ALIGN_RIGHT] = mRules[ALIGN_END]; + } + if (mRules[START_OF] != 0) { + mRules[isLayoutRtl ? RIGHT_OF : LEFT_OF] = mRules[START_OF]; + } + if (mRules[END_OF] != 0) { + mRules[isLayoutRtl ? LEFT_OF : RIGHT_OF] = mRules[END_OF]; + } + if (mRules[ALIGN_PARENT_START] != 0) { + mRules[isLayoutRtl ? ALIGN_PARENT_RIGHT : ALIGN_PARENT_LEFT] = mRules[ALIGN_PARENT_START]; + } + if (mRules[ALIGN_PARENT_END] != 0) { + mRules[isLayoutRtl ? ALIGN_PARENT_LEFT : ALIGN_PARENT_RIGHT] = mRules[ALIGN_PARENT_END]; + } + mRulesChanged = false; } /** * Retrieves a complete list of all supported rules, where the index is the rule * verb, and the element value is the value specified, or "false" if it was never - * set. + * set. If there are relative rules defined (*_START / *_END), they will be resolved + * depending on the layout direction. + * + * @param layoutDirection the direction of the layout. + * Should be either {@link View#LAYOUT_DIRECTION_LTR} + * or {@link View#LAYOUT_DIRECTION_RTL} + * @return the supported rules + * @see #addRule(int, int) + * + * @hide + */ + public int[] getRules(int layoutDirection) { + if (hasRelativeRules() && + (mRulesChanged || layoutDirection != getLayoutDirection())) { + resolveRules(layoutDirection); + if (layoutDirection != getLayoutDirection()) { + setLayoutDirection(layoutDirection); + } + } + return mRules; + } + + /** + * Retrieves a complete list of all supported rules, where the index is the rule + * verb, and the element value is the value specified, or "false" if it was never + * set. There will be no resolution of relative rules done. * * @return the supported rules * @see #addRule(int, int) @@ -1233,6 +1389,24 @@ public void addRule(int verb, int anchor) { public int[] getRules() { return mRules; } + + @Override + public void resolveLayoutDirection(int layoutDirection) { + final boolean isLayoutRtl = isLayoutRtl(); + if (isLayoutRtl) { + if (mStart != DEFAULT_RELATIVE) mRight = mStart; + if (mEnd != DEFAULT_RELATIVE) mLeft = mEnd; + } else { + if (mStart != DEFAULT_RELATIVE) mLeft = mStart; + if (mEnd != DEFAULT_RELATIVE) mRight = mEnd; + } + + if (hasRelativeRules() && layoutDirection != getLayoutDirection()) { + resolveRules(layoutDirection); + } + // This will set the layout direction + super.resolveLayoutDirection(layoutDirection); + } } private static class DependencyGraph { diff --git a/core/java/android/widget/RemoteViews.java b/core/java/android/widget/RemoteViews.java index 4710798fbfbd0..8d1be53679813 100644 --- a/core/java/android/widget/RemoteViews.java +++ b/core/java/android/widget/RemoteViews.java @@ -23,7 +23,6 @@ import android.content.Intent; import android.content.IntentSender; import android.content.pm.ApplicationInfo; -import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.content.res.Configuration; import android.graphics.Bitmap; @@ -35,9 +34,9 @@ import android.os.Bundle; import android.os.Parcel; import android.os.Parcelable; +import android.os.UserHandle; import android.text.TextUtils; import android.util.Log; -import android.util.TypedValue; import android.view.LayoutInflater; import android.view.LayoutInflater.Filter; import android.view.RemotableViewMethod; @@ -52,6 +51,7 @@ import java.lang.annotation.Target; import java.lang.reflect.Method; import java.util.ArrayList; +import java.util.HashMap; /** @@ -61,9 +61,9 @@ * the content of the inflated hierarchy. */ public class RemoteViews implements Parcelable, Filter { - + private static final String LOG_TAG = "RemoteViews"; - + /** * The intent extra that contains the appWidgetId. * @hide @@ -71,11 +71,18 @@ public class RemoteViews implements Parcelable, Filter { static final String EXTRA_REMOTEADAPTER_APPWIDGET_ID = "remoteAdapterAppWidgetId"; /** - * The package name of the package containing the layout + * User that these views should be applied as. Requires + * {@link android.Manifest.permission#INTERACT_ACROSS_USERS_FULL} when + * crossing user boundaries. + */ + private UserHandle mUser = android.os.Process.myUserHandle(); + + /** + * The package name of the package containing the layout * resource. (Added to the parcel) */ private final String mPackage; - + /** * The resource ID of the layout file. (Added to the parcel) */ @@ -86,7 +93,7 @@ public class RemoteViews implements Parcelable, Filter { * inflated */ private ArrayList mActions; - + /** * A class to keep track of memory usage by this RemoteViews */ @@ -187,6 +194,10 @@ private abstract static class Action implements Parcelable { public abstract void apply(View root, ViewGroup rootParent, OnClickHandler handler) throws ActionException; + public static final int MERGE_REPLACE = 0; + public static final int MERGE_APPEND = 1; + public static final int MERGE_IGNORE = 2; + public int describeContents() { return 0; } @@ -203,6 +214,67 @@ public void updateMemoryUsageEstimate(MemoryUsageCounter counter) { public void setBitmapCache(BitmapCache bitmapCache) { // Do nothing } + + public int mergeBehavior() { + return MERGE_REPLACE; + } + + public abstract String getActionName(); + + public String getUniqueKey() { + return (getActionName() + viewId); + } + + int viewId; + } + + /** + * Merges the passed RemoteViews actions with this RemoteViews actions according to + * action-specific merge rules. + * + * @param newRv + * + * @hide + */ + public void mergeRemoteViews(RemoteViews newRv) { + if (newRv == null) return; + // We first copy the new RemoteViews, as the process of merging modifies the way the actions + // reference the bitmap cache. We don't want to modify the object as it may need to + // be merged and applied multiple times. + RemoteViews copy = newRv.clone(); + + HashMap map = new HashMap(); + if (mActions == null) { + mActions = new ArrayList(); + } + + int count = mActions.size(); + for (int i = 0; i < count; i++) { + Action a = mActions.get(i); + map.put(a.getUniqueKey(), a); + } + + ArrayList newActions = copy.mActions; + if (newActions == null) return; + count = newActions.size(); + for (int i = 0; i < count; i++) { + Action a = newActions.get(i); + String key = newActions.get(i).getUniqueKey(); + int mergeBehavior = newActions.get(i).mergeBehavior(); + if (map.containsKey(key) && mergeBehavior == Action.MERGE_REPLACE) { + mActions.remove(map.get(key)); + map.remove(key); + } + + // If the merge behavior is ignore, we don't bother keeping the extra action + if (mergeBehavior == Action.MERGE_REPLACE || mergeBehavior == Action.MERGE_APPEND) { + mActions.add(a); + } + } + + // Because pruning can remove the need for bitmaps, we reconstruct the bitmap cache + mBitmapCache = new BitmapCache(); + setBitmapCache(mBitmapCache); } private class SetEmptyView extends Action { @@ -239,6 +311,10 @@ public void apply(View root, ViewGroup rootParent, OnClickHandler handler) { adapterView.setEmptyView(emptyView); } + + public String getActionName() { + return "SetEmptyView"; + } } private class SetOnClickFillInIntent extends Action { @@ -275,12 +351,12 @@ public void apply(View root, ViewGroup rootParent, final OnClickHandler handler) public void onClick(View v) { // Insure that this view is a child of an AdapterView View parent = (View) v.getParent(); - while (!(parent instanceof AdapterView) + while (parent != null && !(parent instanceof AdapterView) && !(parent instanceof AppWidgetHostView)) { parent = (View) parent.getParent(); } - if (parent instanceof AppWidgetHostView) { + if (parent instanceof AppWidgetHostView || parent == null) { // Somehow they've managed to get this far without having // and AdapterView as a parent. Log.e("RemoteViews", "Collection item doesn't have AdapterView parent"); @@ -316,7 +392,10 @@ public void onClick(View v) { } } - int viewId; + public String getActionName() { + return "SetOnClickFillInIntent"; + } + Intent fillInIntent; public final static int TAG = 9; @@ -399,7 +478,10 @@ public void onItemClick(AdapterView parent, View view, } } - int viewId; + public String getActionName() { + return "SetPendingIntentTemplate"; + } + PendingIntent pendingIntentTemplate; public final static int TAG = 8; @@ -447,13 +529,18 @@ public void apply(View root, ViewGroup rootParent, OnClickHandler handler) { if (target instanceof AbsListView) { AbsListView v = (AbsListView) target; v.setRemoteViewsAdapter(intent); + v.setRemoteViewsOnClickHandler(handler); } else if (target instanceof AdapterViewAnimator) { AdapterViewAnimator v = (AdapterViewAnimator) target; v.setRemoteViewsAdapter(intent); + v.setRemoteViewsOnClickHandler(handler); } } - int viewId; + public String getActionName() { + return "SetRemoteViewsAdapterIntent"; + } + Intent intent; public final static int TAG = 10; @@ -522,13 +609,13 @@ public void onClick(View v) { .getCompatibilityInfo().applicationScale; final int[] pos = new int[2]; v.getLocationOnScreen(pos); - + final Rect rect = new Rect(); rect.left = (int) (pos[0] * appScale + 0.5f); rect.top = (int) (pos[1] * appScale + 0.5f); rect.right = (int) ((pos[0] + v.getWidth()) * appScale + 0.5f); rect.bottom = (int) ((pos[1] + v.getHeight()) * appScale + 0.5f); - + final Intent intent = new Intent(); intent.setSourceBounds(rect); handler.onClickHandler(v, pendingIntent, intent); @@ -539,7 +626,10 @@ public void onClick(View v) { } } - int viewId; + public String getActionName() { + return "SetOnClickPendingIntent"; + } + PendingIntent pendingIntent; public final static int TAG = 1; @@ -567,7 +657,7 @@ public SetDrawableParameters(int id, boolean targetBackground, int alpha, this.filterMode = mode; this.level = level; } - + public SetDrawableParameters(Parcel parcel) { viewId = parcel.readInt(); targetBackground = parcel.readInt() != 0; @@ -581,7 +671,7 @@ public SetDrawableParameters(Parcel parcel) { } level = parcel.readInt(); } - + public void writeToParcel(Parcel dest, int flags) { dest.writeInt(TAG); dest.writeInt(viewId); @@ -596,12 +686,12 @@ public void writeToParcel(Parcel dest, int flags) { } dest.writeInt(level); } - + @Override public void apply(View root, ViewGroup rootParent, OnClickHandler handler) { final View target = root.findViewById(viewId); if (target == null) return; - + // Pick the correct drawable to modify for this view Drawable targetDrawable = null; if (targetBackground) { @@ -610,7 +700,7 @@ public void apply(View root, ViewGroup rootParent, OnClickHandler handler) { ImageView imageView = (ImageView) target; targetDrawable = imageView.getDrawable(); } - + if (targetDrawable != null) { // Perform modifications only if values are set correctly if (alpha != -1) { @@ -625,7 +715,10 @@ public void apply(View root, ViewGroup rootParent, OnClickHandler handler) { } } - int viewId; + public String getActionName() { + return "SetDrawableParameters"; + } + boolean targetBackground; int alpha; int colorFilter; @@ -634,9 +727,8 @@ public void apply(View root, ViewGroup rootParent, OnClickHandler handler) { public final static int TAG = 3; } - + private class ReflectionActionWithoutParams extends Action { - int viewId; String methodName; public final static int TAG = 5; @@ -688,6 +780,19 @@ public void apply(View root, ViewGroup rootParent, OnClickHandler handler) { throw new ActionException(ex); } } + + public int mergeBehavior() { + // we don't need to build up showNext or showPrevious calls + if (methodName.equals("showNext") || methodName.equals("showPrevious")) { + return MERGE_IGNORE; + } else { + return MERGE_REPLACE; + } + } + + public String getActionName() { + return "ReflectionActionWithoutParams"; + } } private static class BitmapCache { @@ -755,7 +860,6 @@ public void addBitmapMemory(MemoryUsageCounter memoryCounter) { private class BitmapReflectionAction extends Action { int bitmapId; - int viewId; Bitmap bitmap; String methodName; @@ -794,6 +898,10 @@ public void setBitmapCache(BitmapCache bitmapCache) { bitmapId = bitmapCache.getBitmapId(bitmap); } + public String getActionName() { + return "BitmapReflectionAction"; + } + public final static int TAG = 12; } @@ -814,11 +922,12 @@ private class ReflectionAction extends Action { static final int STRING = 9; static final int CHAR_SEQUENCE = 10; static final int URI = 11; + // BITMAP actions are never stored in the list of actions. They are only used locally + // to implement BitmapReflectionAction, which eliminates duplicates using BitmapCache. static final int BITMAP = 12; static final int BUNDLE = 13; static final int INTENT = 14; - int viewId; String methodName; int type; Object value; @@ -938,7 +1047,7 @@ public void writeToParcel(Parcel out, int flags) { out.writeString((String)this.value); break; case CHAR_SEQUENCE: - TextUtils.writeToParcel((CharSequence)this.value, out, flags); + TextUtils.writeToParcel((CharSequence)this.value, out, flags); break; case URI: out.writeInt(this.value != null ? 1 : 0); @@ -1041,20 +1150,20 @@ public void apply(View root, ViewGroup rootParent, OnClickHandler handler) { } } - @Override - public void updateMemoryUsageEstimate(MemoryUsageCounter counter) { - // We currently only calculate Bitmap memory usage - switch (this.type) { - case BITMAP: - if (this.value != null) { - final Bitmap b = (Bitmap) this.value; - counter.addBitmapMemory(b); - } - break; - default: - break; + public int mergeBehavior() { + // smoothScrollBy is cumulative, everything else overwites. + if (methodName.equals("smoothScrollBy")) { + return MERGE_APPEND; + } else { + return MERGE_REPLACE; } } + + public String getActionName() { + // Each type of reflection action corresponds to a setter, so each should be seen as + // unique from the standpoint of merging. + return "ReflectionAction" + this.methodName + this.type; + } } private void configureRemoteViewsAsChild(RemoteViews rv) { @@ -1131,7 +1240,14 @@ public void setBitmapCache(BitmapCache bitmapCache) { } } - int viewId; + public String getActionName() { + return "ViewGroupAction" + this.nestedViews == null ? "Remove" : "Add"; + } + + public int mergeBehavior() { + return MERGE_APPEND; + } + RemoteViews nestedViews; public final static int TAG = 4; @@ -1182,7 +1298,10 @@ public void apply(View root, ViewGroup rootParent, OnClickHandler handler) { } } - int viewId; + public String getActionName() { + return "TextViewDrawableAction"; + } + boolean isRelative = false; int d1, d2, d3, d4; @@ -1220,7 +1339,10 @@ public void apply(View root, ViewGroup rootParent, OnClickHandler handler) { target.setTextSize(units, size); } - int viewId; + public String getActionName() { + return "TextViewSizeAction"; + } + int units; float size; @@ -1264,7 +1386,10 @@ public void apply(View root, ViewGroup rootParent, OnClickHandler handler) { target.setPadding(left, top, right, bottom); } - int viewId; + public String getActionName() { + return "ViewPaddingAction"; + } + int left, top, right, bottom; public final static int TAG = 14; @@ -1314,7 +1439,7 @@ public void addBitmapMemory(Bitmap b) { /** * Create a new RemoteViews object that will display the views contained * in the specified layout file. - * + * * @param packageName Name of the package that contains the layout resource * @param layoutId The id of the layout resource */ @@ -1328,11 +1453,16 @@ public RemoteViews(String packageName, int layoutId) { recalculateMemoryUsage(); } + /** {@hide} */ + public void setUser(UserHandle user) { + mUser = user; + } + private boolean hasLandscapeAndPortraitLayouts() { return (mLandscape != null) && (mPortrait != null); } - /** + /** * Create a new RemoteViews object that will inflate as the specified * landspace or portrait RemoteViews, depending on the current configuration. * @@ -1364,7 +1494,7 @@ public RemoteViews(RemoteViews landscape, RemoteViews portrait) { /** * Reads a RemoteViews object from a parcel. - * + * * @param parcel */ public RemoteViews(Parcel parcel) { @@ -1450,23 +1580,12 @@ private RemoteViews(Parcel parcel, BitmapCache bitmapCache) { recalculateMemoryUsage(); } - @Override - public RemoteViews clone() { - RemoteViews that; - if (!hasLandscapeAndPortraitLayouts()) { - that = new RemoteViews(mPackage, mLayoutId); - if (mActions != null) { - that.mActions = (ArrayList)mActions.clone(); - } - } else { - RemoteViews land = mLandscape.clone(); - RemoteViews port = mPortrait.clone(); - that = new RemoteViews(land, port); - } - // update the memory usage stats of the cloned RemoteViews - that.recalculateMemoryUsage(); - return that; + public RemoteViews clone() { + Parcel p = Parcel.obtain(); + writeToParcel(p, 0); + p.setDataPosition(0); + return new RemoteViews(p); } public String getPackage() { @@ -1547,7 +1666,7 @@ public int estimateMemoryUsage() { /** * Add an action to be executed on the remote side when apply is called. - * + * * @param a The action to add */ private void addAction(Action a) { @@ -1619,7 +1738,7 @@ public void setDisplayedChild(int viewId, int childIndex) { /** * Equivalent to calling View.setVisibility - * + * * @param viewId The id of the view whose visibility should change * @param visibility The new visibility for the view */ @@ -1629,7 +1748,7 @@ public void setViewVisibility(int viewId, int visibility) { /** * Equivalent to calling TextView.setText - * + * * @param viewId The id of the view whose text should change * @param text The new text for the view */ @@ -1639,7 +1758,7 @@ public void setTextViewText(int viewId, CharSequence text) { /** * Equivalent to calling {@link TextView#setTextSize(int, float)} - * + * * @param viewId The id of the view whose text size should change * @param units The units of size (e.g. COMPLEX_UNIT_SP) * @param size The size of the text @@ -1649,20 +1768,23 @@ public void setTextViewTextSize(int viewId, int units, float size) { } /** - * Equivalent to calling + * Equivalent to calling * {@link TextView#setCompoundDrawablesWithIntrinsicBounds(int, int, int, int)}. * * @param viewId The id of the view whose text should change * @param left The id of a drawable to place to the left of the text, or 0 * @param top The id of a drawable to place above the text, or 0 * @param right The id of a drawable to place to the right of the text, or 0 - * @param bottom The id of a drawable to place below the text, or 0 + * @param bottom The id of a drawable to place below the text, or 0 */ public void setTextViewCompoundDrawables(int viewId, int left, int top, int right, int bottom) { addAction(new TextViewDrawableAction(viewId, false, left, top, right, bottom)); } /** + * Equivalent to calling {@link + * TextView#setCompoundDrawablesRelativeWithIntrinsicBounds(int, int, int, int)}. + * * @param viewId The id of the view whose text should change * @param start The id of a drawable to place before the text (relative to the * layout direction), or 0 @@ -1676,17 +1798,17 @@ public void setTextViewCompoundDrawablesRelative(int viewId, int start, int top, /** * Equivalent to calling ImageView.setImageResource - * + * * @param viewId The id of the view whose drawable should change * @param srcId The new resource id for the drawable */ - public void setImageViewResource(int viewId, int srcId) { + public void setImageViewResource(int viewId, int srcId) { setInt(viewId, "setImageResource", srcId); } /** * Equivalent to calling ImageView.setImageURI - * + * * @param viewId The id of the view whose drawable should change * @param uri The Uri for the image */ @@ -1696,7 +1818,7 @@ public void setImageViewUri(int viewId, Uri uri) { /** * Equivalent to calling ImageView.setImageBitmap - * + * * @param viewId The id of the view whose bitmap should change * @param bitmap The new Bitmap for the drawable */ @@ -1719,7 +1841,7 @@ public void setEmptyView(int viewId, int emptyViewId) { * {@link Chronometer#setFormat Chronometer.setFormat}, * and {@link Chronometer#start Chronometer.start()} or * {@link Chronometer#stop Chronometer.stop()}. - * + * * @param viewId The id of the {@link Chronometer} to change * @param base The time at which the timer would have read 0:00. This * time should be based off of @@ -1733,21 +1855,21 @@ public void setChronometer(int viewId, long base, String format, boolean started setString(viewId, "setFormat", format); setBoolean(viewId, "setStarted", started); } - + /** * Equivalent to calling {@link ProgressBar#setMax ProgressBar.setMax}, * {@link ProgressBar#setProgress ProgressBar.setProgress}, and * {@link ProgressBar#setIndeterminate ProgressBar.setIndeterminate} * * If indeterminate is true, then the values for max and progress are ignored. - * + * * @param viewId The id of the {@link ProgressBar} to change * @param max The 100% value for the progress bar * @param progress The current value of the progress bar. - * @param indeterminate True if the progress bar is indeterminate, + * @param indeterminate True if the progress bar is indeterminate, * false if not. */ - public void setProgressBar(int viewId, int max, int progress, + public void setProgressBar(int viewId, int max, int progress, boolean indeterminate) { setBoolean(viewId, "setIndeterminate", indeterminate); if (!indeterminate) { @@ -1755,12 +1877,12 @@ public void setProgressBar(int viewId, int max, int progress, setInt(viewId, "setProgress", progress); } } - + /** * Equivalent to calling * {@link android.view.View#setOnClickListener(android.view.View.OnClickListener)} * to launch the provided {@link PendingIntent}. - * + * * When setting the on-click action of items within collections (eg. {@link ListView}, * {@link StackView} etc.), this method will not work. Instead, use {@link * RemoteViews#setPendingIntentTemplate(int, PendingIntent) in conjunction with @@ -1820,7 +1942,7 @@ public void setOnClickFillInIntent(int viewId, Intent fillInIntent) { * view. *

          * You can omit specific calls by marking their values with null or -1. - * + * * @param viewId The id of the view that contains the target * {@link Drawable} * @param targetBackground If true, apply these parameters to the @@ -1846,7 +1968,7 @@ public void setDrawableParameters(int viewId, boolean targetBackground, int alph /** * Equivalent to calling {@link android.widget.TextView#setTextColor(int)}. - * + * * @param viewId The id of the view whose text color should change * @param color Sets the text color for all the states (normal, selected, * focused) to be this color. @@ -2034,6 +2156,8 @@ public void setCharSequence(int viewId, String methodName, CharSequence value) { * @param value The value to pass to the method. */ public void setUri(int viewId, String methodName, Uri value) { + // Resolve any filesystem path before sending remotely + value = value.getCanonicalUri(); addAction(new ReflectionAction(viewId, methodName, ReflectionAction.URI, value)); } @@ -2074,15 +2198,25 @@ public void setIntent(int viewId, String methodName, Intent value) { } /** - * Equivalent to calling View.setContentDescription + * Equivalent to calling View.setContentDescription(CharSequence). * - * @param viewId The id of the view whose content description should change - * @param contentDescription The new content description for the view + * @param viewId The id of the view whose content description should change. + * @param contentDescription The new content description for the view. */ public void setContentDescription(int viewId, CharSequence contentDescription) { setCharSequence(viewId, "setContentDescription", contentDescription); } + /** + * Equivalent to calling View.setLabelFor(int). + * + * @param viewId The id of the view whose property to set. + * @param labeledId The id of a view for which this view serves as a label. + */ + public void setLabelFor(int viewId, int labeledId) { + setInt(viewId, "setLabelFor", labeledId); + } + private RemoteViews getRemoteViewsToApply(Context context) { if (hasLandscapeAndPortraitLayouts()) { int orientation = context.getResources().getConfiguration().orientation; @@ -2098,16 +2232,16 @@ private RemoteViews getRemoteViewsToApply(Context context) { /** * Inflates the view hierarchy represented by this object and applies * all of the actions. - * + * *

          Caller beware: this may throw - * + * * @param context Default context to use * @param parent Parent that the resulting view hierarchy will be attached to. This method * does not attach the hierarchy. The caller should do so when appropriate. * @return The inflated view hierarchy */ public View apply(Context context, ViewGroup parent) { - return apply(context, parent, DEFAULT_ON_CLICK_HANDLER); + return apply(context, parent, null); } /** @hide */ @@ -2135,12 +2269,12 @@ public View apply(Context context, ViewGroup parent, OnClickHandler handler) { * Applies all of the actions to the provided view. * *

          Caller beware: this may throw - * + * * @param v The view to apply the actions to. This should be the result of * the {@link #apply(Context,ViewGroup)} call. */ public void reapply(Context context, View v) { - reapply(context, v, DEFAULT_ON_CLICK_HANDLER); + reapply(context, v, null); } /** @hide */ @@ -2163,6 +2297,7 @@ public void reapply(Context context, View v, OnClickHandler handler) { private void performApply(View v, ViewGroup parent, OnClickHandler handler) { if (mActions != null) { + handler = handler == null ? DEFAULT_ON_CLICK_HANDLER : handler; final int count = mActions.size(); for (int i = 0; i < count; i++) { Action a = mActions.get(i); @@ -2177,7 +2312,8 @@ private Context prepareContext(Context context) { if (packageName != null) { try { - c = context.createPackageContext(packageName, Context.CONTEXT_RESTRICTED); + c = context.createPackageContextAsUser( + packageName, Context.CONTEXT_RESTRICTED, mUser); } catch (NameNotFoundException e) { Log.e(LOG_TAG, "Package name " + packageName + " not found"); c = context; @@ -2191,7 +2327,7 @@ private Context prepareContext(Context context) { /* (non-Javadoc) * Used to restrict the views which can be inflated - * + * * @see android.view.LayoutInflater.Filter#onLoadClass(java.lang.Class) */ public boolean onLoadClass(Class clazz) { diff --git a/core/java/android/widget/RemoteViewsAdapter.java b/core/java/android/widget/RemoteViewsAdapter.java index f0109ce947cec..e4817025c347f 100644 --- a/core/java/android/widget/RemoteViewsAdapter.java +++ b/core/java/android/widget/RemoteViewsAdapter.java @@ -36,6 +36,7 @@ import android.view.View; import android.view.View.MeasureSpec; import android.view.ViewGroup; +import android.widget.RemoteViews.OnClickHandler; import com.android.internal.widget.IRemoteViewsAdapterConnection; import com.android.internal.widget.IRemoteViewsFactory; @@ -68,6 +69,7 @@ public class RemoteViewsAdapter extends BaseAdapter implements Handler.Callback private LayoutInflater mLayoutInflater; private RemoteViewsAdapterServiceConnection mServiceConnection; private WeakReference mCallback; + private OnClickHandler mRemoteViewsOnClickHandler; private FixedSizeRemoteViewsCache mCache; private int mVisibleWindowLowerBound; private int mVisibleWindowUpperBound; @@ -277,11 +279,11 @@ public RemoteViewsFrameLayout(Context context) { * @param view the RemoteViews that was loaded. If null, the RemoteViews was not loaded * successfully. */ - public void onRemoteViewsLoaded(RemoteViews view) { + public void onRemoteViewsLoaded(RemoteViews view, OnClickHandler handler) { try { // Remove all the children of this layout first removeAllViews(); - addView(view.apply(getContext(), this)); + addView(view.apply(getContext(), this, handler)); } catch (Exception e) { Log.e(TAG, "Failed to apply RemoteViews."); } @@ -330,7 +332,7 @@ public void notifyOnRemoteViewsLoaded(int position, RemoteViews view) { // Notify all the references for that position of the newly loaded RemoteViews final LinkedList refs = mReferences.get(pos); for (final RemoteViewsFrameLayout ref : refs) { - ref.onRemoteViewsLoaded(view); + ref.onRemoteViewsLoaded(view, mRemoteViewsOnClickHandler); } refs.clear(); @@ -421,7 +423,8 @@ public boolean isViewTypeInRange(int typeId) { } private RemoteViewsFrameLayout createLoadingView(int position, View convertView, - ViewGroup parent, Object lock, LayoutInflater layoutInflater) { + ViewGroup parent, Object lock, LayoutInflater layoutInflater, OnClickHandler + handler) { // Create and return a new FrameLayout, and setup the references for this position final Context context = parent.getContext(); RemoteViewsFrameLayout layout = new RemoteViewsFrameLayout(context); @@ -433,7 +436,8 @@ private RemoteViewsFrameLayout createLoadingView(int position, View convertView, if (mUserLoadingView != null) { // Try to inflate user-specified loading view try { - View loadingView = mUserLoadingView.apply(parent.getContext(), parent); + View loadingView = mUserLoadingView.apply(parent.getContext(), parent, + handler); loadingView.setTagInternal(com.android.internal.R.id.rowTypeId, new Integer(0)); layout.addView(loadingView); @@ -448,7 +452,7 @@ private RemoteViewsFrameLayout createLoadingView(int position, View convertView, // Use the size of the first row as a guide for the size of the loading view if (mFirstViewHeight < 0) { try { - View firstView = mFirstView.apply(parent.getContext(), parent); + View firstView = mFirstView.apply(parent.getContext(), parent, handler); firstView.measure( MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED), MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED)); @@ -815,6 +819,10 @@ public boolean isDataReady() { return mDataReady; } + public void setRemoteViewsOnClickHandler(OnClickHandler handler) { + mRemoteViewsOnClickHandler = handler; + } + public void saveRemoteViewsCache() { final Pair key = new Pair (new Intent.FilterComparison(mIntent), mAppWidgetId); @@ -1102,7 +1110,7 @@ public View getView(int position, View convertView, ViewGroup parent) { // Reuse the convert view where possible if (layout != null) { if (convertViewTypeId == typeId) { - rv.reapply(context, convertViewChild); + rv.reapply(context, convertViewChild, mRemoteViewsOnClickHandler); return layout; } layout.removeAllViews(); @@ -1111,7 +1119,7 @@ public View getView(int position, View convertView, ViewGroup parent) { } // Otherwise, create a new view to be returned - View newView = rv.apply(context, parent); + View newView = rv.apply(context, parent, mRemoteViewsOnClickHandler); newView.setTagInternal(com.android.internal.R.id.rowTypeId, new Integer(typeId)); layout.addView(newView); @@ -1127,7 +1135,7 @@ public View getView(int position, View convertView, ViewGroup parent) { final RemoteViewsMetaData metaData = mCache.getMetaData(); synchronized (metaData) { loadingView = metaData.createLoadingView(position, convertView, parent, - mCache, mLayoutInflater); + mCache, mLayoutInflater, mRemoteViewsOnClickHandler); } return loadingView; } finally { @@ -1140,7 +1148,7 @@ public View getView(int position, View convertView, ViewGroup parent) { final RemoteViewsMetaData metaData = mCache.getMetaData(); synchronized (metaData) { loadingView = metaData.createLoadingView(position, convertView, parent, - mCache, mLayoutInflater); + mCache, mLayoutInflater, mRemoteViewsOnClickHandler); } mRequestedViews.add(position, loadingView); diff --git a/core/java/android/widget/ScrollView.java b/core/java/android/widget/ScrollView.java index ebc54f4527c81..bc41931c366af 100644 --- a/core/java/android/widget/ScrollView.java +++ b/core/java/android/widget/ScrollView.java @@ -25,6 +25,7 @@ import android.os.Bundle; import android.os.StrictMode; import android.util.AttributeSet; +import android.util.Log; import android.view.FocusFinder; import android.view.InputDevice; import android.view.KeyEvent; @@ -69,6 +70,8 @@ public class ScrollView extends FrameLayout { static final float MAX_SCROLL_FACTOR = 0.5f; + private static final String TAG = "ScrollView"; + private long mLastScroll; private final Rect mTempRect = new Rect(); @@ -460,6 +463,13 @@ public boolean onInterceptTouchEvent(MotionEvent ev) { return true; } + /* + * Don't try to intercept touch if we can't scroll anyway. + */ + if (getScrollY() == 0 && !canScrollVertically(1)) { + return false; + } + switch (action & MotionEvent.ACTION_MASK) { case MotionEvent.ACTION_MOVE: { /* @@ -478,6 +488,12 @@ public boolean onInterceptTouchEvent(MotionEvent ev) { } final int pointerIndex = ev.findPointerIndex(activePointerId); + if (pointerIndex == -1) { + Log.e(TAG, "Invalid pointerId=" + activePointerId + + " in onInterceptTouchEvent"); + break; + } + final int y = (int) ev.getY(pointerIndex); final int yDiff = Math.abs(y - mLastMotionY); if (yDiff > mTouchSlop) { @@ -585,6 +601,11 @@ public boolean onTouchEvent(MotionEvent ev) { } case MotionEvent.ACTION_MOVE: final int activePointerIndex = ev.findPointerIndex(mActivePointerId); + if (activePointerIndex == -1) { + Log.e(TAG, "Invalid pointerId=" + mActivePointerId + " in onTouchEvent"); + break; + } + final int y = (int) ev.getY(activePointerIndex); int deltaY = mLastMotionY - y; if (!mIsBeingDragged && Math.abs(deltaY) > mTouchSlop) { diff --git a/core/java/android/widget/Scroller.java b/core/java/android/widget/Scroller.java index a6e83f0604833..3a28e75e8823d 100644 --- a/core/java/android/widget/Scroller.java +++ b/core/java/android/widget/Scroller.java @@ -57,45 +57,70 @@ public class Scroller { private boolean mFlywheel; private float mVelocity; + private float mCurrVelocity; + private int mDistance; + + private float mFlingFriction = ViewConfiguration.getScrollFriction(); private static final int DEFAULT_DURATION = 250; private static final int SCROLL_MODE = 0; private static final int FLING_MODE = 1; - private static float DECELERATION_RATE = (float) (Math.log(0.75) / Math.log(0.9)); - private static float ALPHA = 800; // pixels / seconds - private static float START_TENSION = 0.4f; // Tension at start: (0.4 * total T, 1.0 * Distance) - private static float END_TENSION = 1.0f - START_TENSION; + private static float DECELERATION_RATE = (float) (Math.log(0.78) / Math.log(0.9)); + private static final float INFLEXION = 0.35f; // Tension lines cross at (INFLEXION, 1) + private static final float START_TENSION = 0.5f; + private static final float END_TENSION = 1.0f; + private static final float P1 = START_TENSION * INFLEXION; + private static final float P2 = 1.0f - END_TENSION * (1.0f - INFLEXION); + private static final int NB_SAMPLES = 100; - private static final float[] SPLINE = new float[NB_SAMPLES + 1]; + private static final float[] SPLINE_POSITION = new float[NB_SAMPLES + 1]; + private static final float[] SPLINE_TIME = new float[NB_SAMPLES + 1]; private float mDeceleration; private final float mPpi; + // A context-specific coefficient adjusted to physical values. + private float mPhysicalCoeff; + static { float x_min = 0.0f; - for (int i = 0; i <= NB_SAMPLES; i++) { - final float t = (float) i / NB_SAMPLES; + float y_min = 0.0f; + for (int i = 0; i < NB_SAMPLES; i++) { + final float alpha = (float) i / NB_SAMPLES; + float x_max = 1.0f; float x, tx, coef; while (true) { x = x_min + (x_max - x_min) / 2.0f; coef = 3.0f * x * (1.0f - x); - tx = coef * ((1.0f - x) * START_TENSION + x * END_TENSION) + x * x * x; - if (Math.abs(tx - t) < 1E-5) break; - if (tx > t) x_max = x; + tx = coef * ((1.0f - x) * P1 + x * P2) + x * x * x; + if (Math.abs(tx - alpha) < 1E-5) break; + if (tx > alpha) x_max = x; else x_min = x; } - final float d = coef + x * x * x; - SPLINE[i] = d; + SPLINE_POSITION[i] = coef * ((1.0f - x) * START_TENSION + x) + x * x * x; + + float y_max = 1.0f; + float y, dy; + while (true) { + y = y_min + (y_max - y_min) / 2.0f; + coef = 3.0f * y * (1.0f - y); + dy = coef * ((1.0f - y) * START_TENSION + y) + y * y * y; + if (Math.abs(dy - alpha) < 1E-5) break; + if (dy > alpha) y_max = y; + else y_min = y; + } + SPLINE_TIME[i] = coef * ((1.0f - y) * P1 + y * P2) + y * y * y; } - SPLINE[NB_SAMPLES] = 1.0f; + SPLINE_POSITION[NB_SAMPLES] = SPLINE_TIME[NB_SAMPLES] = 1.0f; // This controls the viscous fluid effect (how much of it) sViscousFluidScale = 8.0f; // must be set to 1.0 (used in viscousFluid()) sViscousFluidNormalize = 1.0f; sViscousFluidNormalize = 1.0f / viscousFluid(1.0f); + } private static float sViscousFluidScale; @@ -129,6 +154,8 @@ public Scroller(Context context, Interpolator interpolator, boolean flywheel) { mPpi = context.getResources().getDisplayMetrics().density * 160.0f; mDeceleration = computeDeceleration(ViewConfiguration.getScrollFriction()); mFlywheel = flywheel; + + mPhysicalCoeff = computeDeceleration(0.84f); // look and feel tuning } /** @@ -140,6 +167,7 @@ public Scroller(Context context, Interpolator interpolator, boolean flywheel) { */ public final void setFriction(float friction) { mDeceleration = computeDeceleration(friction); + mFlingFriction = friction; } private float computeDeceleration(float friction) { @@ -202,7 +230,8 @@ public final int getCurrY() { * negative. */ public float getCurrVelocity() { - return mVelocity - mDeceleration * timePassed() / 2000.0f; + return mMode == FLING_MODE ? + mCurrVelocity : mVelocity - mDeceleration * timePassed() / 2000.0f; } /** @@ -269,11 +298,18 @@ public boolean computeScrollOffset() { case FLING_MODE: final float t = (float) timePassed / mDuration; final int index = (int) (NB_SAMPLES * t); - final float t_inf = (float) index / NB_SAMPLES; - final float t_sup = (float) (index + 1) / NB_SAMPLES; - final float d_inf = SPLINE[index]; - final float d_sup = SPLINE[index + 1]; - final float distanceCoef = d_inf + (t - t_inf) / (t_sup - t_inf) * (d_sup - d_inf); + float distanceCoef = 1.f; + float velocityCoef = 0.f; + if (index < NB_SAMPLES) { + final float t_inf = (float) index / NB_SAMPLES; + final float t_sup = (float) (index + 1) / NB_SAMPLES; + final float d_inf = SPLINE_POSITION[index]; + final float d_sup = SPLINE_POSITION[index + 1]; + velocityCoef = (d_sup - d_inf) / (t_sup - t_inf); + distanceCoef = d_inf + (t - t_inf) * velocityCoef; + } + + mCurrVelocity = velocityCoef * mDistance / mDuration * 1000.0f; mCurrX = mStartX + Math.round(distanceCoef * (mFinalX - mStartX)); // Pin to mMinX <= mCurrX <= mMaxX @@ -392,8 +428,7 @@ public void fling(int startX, int startY, int velocityX, int velocityY, float velocity = FloatMath.sqrt(velocityX * velocityX + velocityY * velocityY); mVelocity = velocity; - final double l = Math.log(START_TENSION * velocity / ALPHA); - mDuration = (int) (1000.0 * Math.exp(l / (DECELERATION_RATE - 1.0))); + mDuration = getSplineFlingDuration(velocity); mStartTime = AnimationUtils.currentAnimationTimeMillis(); mStartX = startX; mStartY = startY; @@ -401,25 +436,41 @@ public void fling(int startX, int startY, int velocityX, int velocityY, float coeffX = velocity == 0 ? 1.0f : velocityX / velocity; float coeffY = velocity == 0 ? 1.0f : velocityY / velocity; - int totalDistance = - (int) (ALPHA * Math.exp(DECELERATION_RATE / (DECELERATION_RATE - 1.0) * l)); + double totalDistance = getSplineFlingDistance(velocity); + mDistance = (int) (totalDistance * Math.signum(velocity)); mMinX = minX; mMaxX = maxX; mMinY = minY; mMaxY = maxY; - mFinalX = startX + Math.round(totalDistance * coeffX); + mFinalX = startX + (int) Math.round(totalDistance * coeffX); // Pin to mMinX <= mFinalX <= mMaxX mFinalX = Math.min(mFinalX, mMaxX); mFinalX = Math.max(mFinalX, mMinX); - mFinalY = startY + Math.round(totalDistance * coeffY); + mFinalY = startY + (int) Math.round(totalDistance * coeffY); // Pin to mMinY <= mFinalY <= mMaxY mFinalY = Math.min(mFinalY, mMaxY); mFinalY = Math.max(mFinalY, mMinY); } + private double getSplineDeceleration(float velocity) { + return Math.log(INFLEXION * Math.abs(velocity) / (mFlingFriction * mPhysicalCoeff)); + } + + private int getSplineFlingDuration(float velocity) { + final double l = getSplineDeceleration(velocity); + final double decelMinusOne = DECELERATION_RATE - 1.0; + return (int) (1000.0 * Math.exp(l / decelMinusOne)); + } + + private double getSplineFlingDistance(float velocity) { + final double l = getSplineDeceleration(velocity); + final double decelMinusOne = DECELERATION_RATE - 1.0; + return mFlingFriction * mPhysicalCoeff * Math.exp(DECELERATION_RATE / decelMinusOne * l); + } + static float viscousFluid(float x) { x *= sViscousFluidScale; diff --git a/core/java/android/widget/SearchView.java b/core/java/android/widget/SearchView.java index a0e961fa42003..cd8638daab26c 100644 --- a/core/java/android/widget/SearchView.java +++ b/core/java/android/widget/SearchView.java @@ -326,7 +326,6 @@ public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) { adjustDropDownSizeAndPosition(); } - }); } @@ -1285,15 +1284,22 @@ private void adjustDropDownSizeAndPosition() { 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 void onNothingSelected(AdapterView parent) { } }; + @Override + public void onRtlPropertiesChanged(int layoutDirection) { + mQueryTextView.setLayoutDirection(layoutDirection); + } + /** * Query rewriting. */ @@ -1506,6 +1517,9 @@ private Intent createVoiceAppSearchIntent(Intent baseIntent, SearchableInfo sear // because the voice search activity will always need to insert "QUERY" into // it anyway. Bundle queryExtras = new Bundle(); + if (mAppSearchData != null) { + queryExtras.putParcelable(SearchManager.APP_DATA, mAppSearchData); + } // Now build the intent to launch the voice search. Add all necessary // extras to launch the voice recognizer, and then all the necessary extras @@ -1595,8 +1609,8 @@ private Intent createIntentFromSuggestion(Cursor c, int actionKey, String action } catch (RuntimeException e2 ) { rowNum = -1; } - Log.w(LOG_TAG, "Search Suggestions cursor at row " + rowNum + - " returned exception" + e.toString()); + Log.w(LOG_TAG, "Search suggestions cursor at row " + rowNum + + " returned exception.", e); return null; } } diff --git a/core/java/android/widget/SlidingDrawer.java b/core/java/android/widget/SlidingDrawer.java index 14edd101d5504..517246bf5df22 100644 --- a/core/java/android/widget/SlidingDrawer.java +++ b/core/java/android/widget/SlidingDrawer.java @@ -78,7 +78,12 @@ * @attr ref android.R.styleable#SlidingDrawer_orientation * @attr ref android.R.styleable#SlidingDrawer_allowSingleTap * @attr ref android.R.styleable#SlidingDrawer_animateOnClick + * + * @deprecated This class is not supported anymore. It is recommended you + * base your own implementation on the source code for the Android Open + * Source Project if you must use it in your application. */ +@Deprecated public class SlidingDrawer extends ViewGroup { public static final int ORIENTATION_HORIZONTAL = 0; public static final int ORIENTATION_VERTICAL = 1; diff --git a/core/java/android/widget/Spinner.java b/core/java/android/widget/Spinner.java index 64834b2a332a0..925864c9e3118 100644 --- a/core/java/android/widget/Spinner.java +++ b/core/java/android/widget/Spinner.java @@ -30,8 +30,11 @@ import android.view.Gravity; import android.view.View; import android.view.ViewGroup; +import android.view.ViewTreeObserver; +import android.view.ViewTreeObserver.OnGlobalLayoutListener; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityNodeInfo; +import android.widget.PopupWindow.OnDismissListener; /** @@ -355,7 +358,7 @@ public void setEnabled(boolean enabled) { public void setGravity(int gravity) { if (mGravity != gravity) { if ((gravity & Gravity.HORIZONTAL_GRAVITY_MASK) == 0) { - gravity |= Gravity.LEFT; + gravity |= Gravity.START; } mGravity = gravity; requestLayout(); @@ -460,7 +463,7 @@ protected void onLayout(boolean changed, int l, int t, int r, int b) { /** * Creates and positions all views for this Spinner. * - * @param delta Change in the selected position. +1 moves selection is moving to the right, + * @param delta Change in the selected position. +1 means selection is moving to the right, * so views are scrolling to the left. -1 means selection is moving to the left. */ @Override @@ -492,7 +495,9 @@ void layout(int delta, boolean animate) { View sel = makeAndAddView(mSelectedPosition); int width = sel.getMeasuredWidth(); int selectedOffset = childrenLeft; - switch (mGravity & Gravity.HORIZONTAL_GRAVITY_MASK) { + final int layoutDirection = getLayoutDirection(); + final int absoluteGravity = Gravity.getAbsoluteGravity(mGravity, layoutDirection); + switch (absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK) { case Gravity.CENTER_HORIZONTAL: selectedOffset = childrenLeft + (childrenWidth / 2) - (width / 2); break; @@ -939,19 +944,18 @@ public void setPromptText(CharSequence hintText) { @Override public void show() { final Drawable background = getBackground(); - int bgOffset = 0; + int hOffset = 0; if (background != null) { background.getPadding(mTempRect); - bgOffset = -mTempRect.left; + hOffset = isLayoutRtl() ? mTempRect.right : -mTempRect.left; } else { mTempRect.left = mTempRect.right = 0; } final int spinnerPaddingLeft = Spinner.this.getPaddingLeft(); + final int spinnerPaddingRight = Spinner.this.getPaddingRight(); + final int spinnerWidth = Spinner.this.getWidth(); if (mDropDownWidth == WRAP_CONTENT) { - final int spinnerWidth = Spinner.this.getWidth(); - final int spinnerPaddingRight = Spinner.this.getPaddingRight(); - int contentWidth = measureContentWidth( (SpinnerAdapter) mAdapter, getBackground()); final int contentWidthLimit = mContext.getResources() @@ -959,21 +963,48 @@ public void show() { if (contentWidth > contentWidthLimit) { contentWidth = contentWidthLimit; } - setContentWidth(Math.max( contentWidth, spinnerWidth - spinnerPaddingLeft - spinnerPaddingRight)); } else if (mDropDownWidth == MATCH_PARENT) { - final int spinnerWidth = Spinner.this.getWidth(); - final int spinnerPaddingRight = Spinner.this.getPaddingRight(); setContentWidth(spinnerWidth - spinnerPaddingLeft - spinnerPaddingRight); } else { setContentWidth(mDropDownWidth); } - setHorizontalOffset(bgOffset + spinnerPaddingLeft); + + if (isLayoutRtl()) { + hOffset += spinnerWidth - spinnerPaddingRight - getWidth(); + } else { + hOffset += spinnerPaddingLeft; + } + setHorizontalOffset(hOffset); setInputMethodMode(ListPopupWindow.INPUT_METHOD_NOT_NEEDED); super.show(); getListView().setChoiceMode(ListView.CHOICE_MODE_SINGLE); setSelection(Spinner.this.getSelectedItemPosition()); + + // Make sure we hide if our anchor goes away. + // TODO: This might be appropriate to push all the way down to PopupWindow, + // but it may have other side effects to investigate first. (Text editing handles, etc.) + final ViewTreeObserver vto = getViewTreeObserver(); + if (vto != null) { + final OnGlobalLayoutListener layoutListener = new OnGlobalLayoutListener() { + @Override + public void onGlobalLayout() { + if (!Spinner.this.isVisibleToUser()) { + dismiss(); + } + } + }; + vto.addOnGlobalLayoutListener(layoutListener); + setOnDismissListener(new OnDismissListener() { + @Override public void onDismiss() { + final ViewTreeObserver vto = getViewTreeObserver(); + if (vto != null) { + vto.removeOnGlobalLayoutListener(layoutListener); + } + } + }); + } } } } diff --git a/core/java/android/widget/StackView.java b/core/java/android/widget/StackView.java index 293eda1825597..68536604bf676 100644 --- a/core/java/android/widget/StackView.java +++ b/core/java/android/widget/StackView.java @@ -1412,8 +1412,8 @@ Bitmap createOutline(View v, int type, int color) { return null; } - Bitmap bitmap = Bitmap.createBitmap(v.getMeasuredWidth(), v.getMeasuredHeight(), - Bitmap.Config.ARGB_8888); + Bitmap bitmap = Bitmap.createBitmap(v.getResources().getDisplayMetrics(), + v.getMeasuredWidth(), v.getMeasuredHeight(), Bitmap.Config.ARGB_8888); mCanvas.setBitmap(bitmap); float rotationX = v.getRotationX(); diff --git a/core/java/android/widget/Switch.java b/core/java/android/widget/Switch.java index 56f66510fe144..e754c17ca2d1c 100644 --- a/core/java/android/widget/Switch.java +++ b/core/java/android/widget/Switch.java @@ -480,12 +480,6 @@ public void setTextOff(CharSequence textOff) { @Override public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { - final int widthMode = MeasureSpec.getMode(widthMeasureSpec); - final int heightMode = MeasureSpec.getMode(heightMeasureSpec); - int widthSize = MeasureSpec.getSize(widthMeasureSpec); - int heightSize = MeasureSpec.getSize(heightMeasureSpec); - - if (mOnLayout == null) { mOnLayout = makeLayout(mTextOn); } @@ -501,34 +495,6 @@ public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { mThumbWidth = maxTextWidth + mThumbTextPadding * 2; - switch (widthMode) { - case MeasureSpec.AT_MOST: - widthSize = Math.min(widthSize, switchWidth); - break; - - case MeasureSpec.UNSPECIFIED: - widthSize = switchWidth; - break; - - case MeasureSpec.EXACTLY: - // Just use what we were given - break; - } - - switch (heightMode) { - case MeasureSpec.AT_MOST: - heightSize = Math.min(heightSize, switchHeight); - break; - - case MeasureSpec.UNSPECIFIED: - heightSize = switchHeight; - break; - - case MeasureSpec.EXACTLY: - // Just use what we were given - break; - } - mSwitchWidth = switchWidth; mSwitchHeight = switchHeight; @@ -542,9 +508,9 @@ public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { @Override public void onPopulateAccessibilityEvent(AccessibilityEvent event) { super.onPopulateAccessibilityEvent(event); - CharSequence text = isChecked() ? mOnLayout.getText() : mOffLayout.getText(); - if (!TextUtils.isEmpty(text)) { - event.getText().add(text); + Layout layout = isChecked() ? mOnLayout : mOffLayout; + if (layout != null && !TextUtils.isEmpty(layout.getText())) { + event.getText().add(layout.getText()); } } @@ -662,7 +628,7 @@ private void stopDrag(MotionEvent ev) { mVelocityTracker.computeCurrentVelocity(1000); float xvel = mVelocityTracker.getXVelocity(); if (Math.abs(xvel) > mMinFlingVelocity) { - newState = xvel > 0; + newState = isLayoutRtl() ? (xvel < 0) : (xvel > 0); } else { newState = getTargetCheckedState(); } @@ -680,13 +646,25 @@ private void animateThumbToCheckedState(boolean newCheckedState) { } private boolean getTargetCheckedState() { - return mThumbPosition >= getThumbScrollRange() / 2; + if (isLayoutRtl()) { + return mThumbPosition <= getThumbScrollRange() / 2; + } else { + return mThumbPosition >= getThumbScrollRange() / 2; + } + } + + private void setThumbPosition(boolean checked) { + if (isLayoutRtl()) { + mThumbPosition = checked ? 0 : getThumbScrollRange(); + } else { + mThumbPosition = checked ? getThumbScrollRange() : 0; + } } @Override public void setChecked(boolean checked) { super.setChecked(checked); - mThumbPosition = checked ? getThumbScrollRange() : 0; + setThumbPosition(isChecked()); invalidate(); } @@ -694,10 +672,19 @@ public void setChecked(boolean checked) { protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); - mThumbPosition = isChecked() ? getThumbScrollRange() : 0; + setThumbPosition(isChecked()); + + int switchRight; + int switchLeft; + + if (isLayoutRtl()) { + switchLeft = getPaddingLeft(); + switchRight = switchLeft + mSwitchWidth; + } else { + switchRight = getWidth() - getPaddingRight(); + switchLeft = switchRight - mSwitchWidth; + } - int switchRight = getWidth() - getPaddingRight(); - int switchLeft = switchRight - mSwitchWidth; int switchTop = 0; int switchBottom = 0; switch (getGravity() & Gravity.VERTICAL_GRAVITY_MASK) { @@ -763,16 +750,32 @@ protected void onDraw(Canvas canvas) { mTextPaint.drawableState = getDrawableState(); Layout switchText = getTargetCheckedState() ? mOnLayout : mOffLayout; - - canvas.translate((thumbLeft + thumbRight) / 2 - switchText.getWidth() / 2, - (switchInnerTop + switchInnerBottom) / 2 - switchText.getHeight() / 2); - switchText.draw(canvas); + if (switchText != null) { + canvas.translate((thumbLeft + thumbRight) / 2 - switchText.getWidth() / 2, + (switchInnerTop + switchInnerBottom) / 2 - switchText.getHeight() / 2); + switchText.draw(canvas); + } canvas.restore(); } + @Override + public int getCompoundPaddingLeft() { + if (!isLayoutRtl()) { + return super.getCompoundPaddingLeft(); + } + int padding = super.getCompoundPaddingLeft() + mSwitchWidth; + if (!TextUtils.isEmpty(getText())) { + padding += mSwitchPadding; + } + return padding; + } + @Override public int getCompoundPaddingRight() { + if (isLayoutRtl()) { + return super.getCompoundPaddingRight(); + } int padding = super.getCompoundPaddingRight() + mSwitchWidth; if (!TextUtils.isEmpty(getText())) { padding += mSwitchPadding; diff --git a/core/java/android/widget/TabHost.java b/core/java/android/widget/TabHost.java index 8bb9348f388b5..238dc559b38a9 100644 --- a/core/java/android/widget/TabHost.java +++ b/core/java/android/widget/TabHost.java @@ -48,6 +48,10 @@ */ public class TabHost extends FrameLayout implements ViewTreeObserver.OnTouchModeChangeListener { + private static final int TABWIDGET_LOCATION_LEFT = 0; + private static final int TABWIDGET_LOCATION_TOP = 1; + private static final int TABWIDGET_LOCATION_RIGHT = 2; + private static final int TABWIDGET_LOCATION_BOTTOM = 3; private TabWidget mTabWidget; private FrameLayout mTabContent; private List mTabSpecs = new ArrayList(2); @@ -293,22 +297,73 @@ public FrameLayout getTabContentView() { return mTabContent; } + /** + * Get the location of the TabWidget. + * + * @return The TabWidget location. + */ + private int getTabWidgetLocation() { + int location = TABWIDGET_LOCATION_TOP; + + switch (mTabWidget.getOrientation()) { + case LinearLayout.VERTICAL: + location = (mTabContent.getLeft() < mTabWidget.getLeft()) ? TABWIDGET_LOCATION_RIGHT + : TABWIDGET_LOCATION_LEFT; + break; + case LinearLayout.HORIZONTAL: + default: + location = (mTabContent.getTop() < mTabWidget.getTop()) ? TABWIDGET_LOCATION_BOTTOM + : TABWIDGET_LOCATION_TOP; + break; + } + return location; + } + @Override public boolean dispatchKeyEvent(KeyEvent event) { final boolean handled = super.dispatchKeyEvent(event); - // unhandled key ups change focus to tab indicator for embedded activities - // when there is nothing that will take focus from default focus searching + // unhandled key events change focus to tab indicator for embedded + // activities when there is nothing that will take focus from default + // focus searching if (!handled && (event.getAction() == KeyEvent.ACTION_DOWN) - && (event.getKeyCode() == KeyEvent.KEYCODE_DPAD_UP) && (mCurrentView != null) && (mCurrentView.isRootNamespace()) - && (mCurrentView.hasFocus()) - && (mCurrentView.findFocus().focusSearch(View.FOCUS_UP) == null)) { - mTabWidget.getChildTabViewAt(mCurrentTab).requestFocus(); - playSoundEffect(SoundEffectConstants.NAVIGATION_UP); - return true; + && (mCurrentView.hasFocus())) { + int keyCodeShouldChangeFocus = KeyEvent.KEYCODE_DPAD_UP; + int directionShouldChangeFocus = View.FOCUS_UP; + int soundEffect = SoundEffectConstants.NAVIGATION_UP; + + switch (getTabWidgetLocation()) { + case TABWIDGET_LOCATION_LEFT: + keyCodeShouldChangeFocus = KeyEvent.KEYCODE_DPAD_LEFT; + directionShouldChangeFocus = View.FOCUS_LEFT; + soundEffect = SoundEffectConstants.NAVIGATION_LEFT; + break; + case TABWIDGET_LOCATION_RIGHT: + keyCodeShouldChangeFocus = KeyEvent.KEYCODE_DPAD_RIGHT; + directionShouldChangeFocus = View.FOCUS_RIGHT; + soundEffect = SoundEffectConstants.NAVIGATION_RIGHT; + break; + case TABWIDGET_LOCATION_BOTTOM: + keyCodeShouldChangeFocus = KeyEvent.KEYCODE_DPAD_DOWN; + directionShouldChangeFocus = View.FOCUS_DOWN; + soundEffect = SoundEffectConstants.NAVIGATION_DOWN; + break; + case TABWIDGET_LOCATION_TOP: + default: + keyCodeShouldChangeFocus = KeyEvent.KEYCODE_DPAD_UP; + directionShouldChangeFocus = View.FOCUS_UP; + soundEffect = SoundEffectConstants.NAVIGATION_UP; + break; + } + if (event.getKeyCode() == keyCodeShouldChangeFocus + && mCurrentView.findFocus().focusSearch(directionShouldChangeFocus) == null) { + mTabWidget.getChildTabViewAt(mCurrentTab).requestFocus(); + playSoundEffect(soundEffect); + return true; + } } return handled; } diff --git a/core/java/android/widget/TableLayout.java b/core/java/android/widget/TableLayout.java index 78e9453815964..399b4fa145440 100644 --- a/core/java/android/widget/TableLayout.java +++ b/core/java/android/widget/TableLayout.java @@ -184,6 +184,10 @@ private void initTableLayout() { mShrinkableColumns = new SparseBooleanArray(); } + // TableLayouts are always in vertical orientation; keep this tracked + // for shared LinearLayout code. + setOrientation(VERTICAL); + mPassThroughListener = new PassThroughHierarchyChangeListener(); // make sure to call the parent class method to avoid potential // infinite loops @@ -737,7 +741,8 @@ public LayoutParams(MarginLayoutParams source) { * @param heightAttr the height attribute to fetch */ @Override - protected void setBaseAttributes(TypedArray a, int widthAttr, int heightAttr) { + protected void setBaseAttributes(TypedArray a, + int widthAttr, int heightAttr) { this.width = MATCH_PARENT; if (a.hasValue(heightAttr)) { this.height = a.getLayoutDimension(heightAttr, "layout_height"); diff --git a/core/java/android/widget/TableRow.java b/core/java/android/widget/TableRow.java index 01c4c2c9e0c99..35927e05df73e 100644 --- a/core/java/android/widget/TableRow.java +++ b/core/java/android/widget/TableRow.java @@ -226,7 +226,7 @@ void measureChildBeforeLayout(View child, int childIndex, final int childWidth = child.getMeasuredWidth(); lp.mOffset[LayoutParams.LOCATION_NEXT] = columnWidth - childWidth; - final int layoutDirection = getResolvedLayoutDirection(); + final int layoutDirection = getLayoutDirection(); final int absoluteGravity = Gravity.getAbsoluteGravity(gravity, layoutDirection); switch (absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK) { case Gravity.LEFT: diff --git a/core/java/android/widget/TextClock.java b/core/java/android/widget/TextClock.java new file mode 100644 index 0000000000000..290d9b5b4a52e --- /dev/null +++ b/core/java/android/widget/TextClock.java @@ -0,0 +1,482 @@ +/* + * 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.widget; + +import android.content.BroadcastReceiver; +import android.content.ContentResolver; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; +import android.content.res.TypedArray; +import android.database.ContentObserver; +import android.net.Uri; +import android.os.Handler; +import android.os.SystemClock; +import android.provider.Settings; +import android.text.format.DateFormat; +import android.util.AttributeSet; +import android.view.RemotableViewMethod; + +import com.android.internal.R; + +import java.util.Calendar; +import java.util.TimeZone; + +import static android.view.ViewDebug.ExportedProperty; +import static android.widget.RemoteViews.*; + +/** + *

          TextClock can display the current date and/or time as + * a formatted string.

          + * + *

          This view honors the 24-hour format system setting. As such, it is + * possible and recommended to provide two different formatting patterns: + * one to display the date/time in 24-hour mode and one to display the + * date/time in 12-hour mode.

          + * + *

          It is possible to determine whether the system is currently in + * 24-hour mode by calling {@link #is24HourModeEnabled()}.

          + * + *

          The rules used by this widget to decide how to format the date and + * time are the following:

          + *
            + *
          • In 24-hour mode: + *
              + *
            • Use the value returned by {@link #getFormat24Hour()} when non-null
            • + *
            • Otherwise, use the value returned by {@link #getFormat12Hour()} when non-null
            • + *
            • Otherwise, use {@link #DEFAULT_FORMAT_24_HOUR}
            • + *
            + *
          • + *
          • In 12-hour mode: + *
              + *
            • Use the value returned by {@link #getFormat12Hour()} when non-null
            • + *
            • Otherwise, use the value returned by {@link #getFormat24Hour()} when non-null
            • + *
            • Otherwise, use {@link #DEFAULT_FORMAT_12_HOUR}
            • + *
            + *
          • + *
          + * + *

          The {@link CharSequence} instances used as formatting patterns when calling either + * {@link #setFormat24Hour(CharSequence)} or {@link #setFormat12Hour(CharSequence)} can + * contain styling information. To do so, use a {@link android.text.Spanned} object.

          + * + * @attr ref android.R.styleable#TextClock_format12Hour + * @attr ref android.R.styleable#TextClock_format24Hour + * @attr ref android.R.styleable#TextClock_timeZone + */ +@RemoteView +public class TextClock extends TextView { + /** + * The default formatting pattern in 12-hour mode. This pattenr is used + * if {@link #setFormat12Hour(CharSequence)} is called with a null pattern + * or if no pattern was specified when creating an instance of this class. + * + * This default pattern shows only the time, hours and minutes, and an am/pm + * indicator. + * + * @see #setFormat12Hour(CharSequence) + * @see #getFormat12Hour() + */ + public static final CharSequence DEFAULT_FORMAT_12_HOUR = "h:mm aa"; + + /** + * The default formatting pattern in 24-hour mode. This pattenr is used + * if {@link #setFormat24Hour(CharSequence)} is called with a null pattern + * or if no pattern was specified when creating an instance of this class. + * + * This default pattern shows only the time, hours and minutes. + * + * @see #setFormat24Hour(CharSequence) + * @see #getFormat24Hour() + */ + public static final CharSequence DEFAULT_FORMAT_24_HOUR = "k:mm"; + + private CharSequence mFormat12 = DEFAULT_FORMAT_12_HOUR; + private CharSequence mFormat24 = DEFAULT_FORMAT_24_HOUR; + + @ExportedProperty + private CharSequence mFormat; + @ExportedProperty + private boolean mHasSeconds; + + private boolean mAttached; + + private Calendar mTime; + private String mTimeZone; + + private final ContentObserver mFormatChangeObserver = new ContentObserver(new Handler()) { + @Override + public void onChange(boolean selfChange) { + chooseFormat(); + onTimeChanged(); + } + + @Override + public void onChange(boolean selfChange, Uri uri) { + chooseFormat(); + onTimeChanged(); + } + }; + + private final BroadcastReceiver mIntentReceiver = new BroadcastReceiver() { + @Override + public void onReceive(Context context, Intent intent) { + if (mTimeZone == null && Intent.ACTION_TIMEZONE_CHANGED.equals(intent.getAction())) { + final String timeZone = intent.getStringExtra("time-zone"); + createTime(timeZone); + } + onTimeChanged(); + } + }; + + private final Runnable mTicker = new Runnable() { + public void run() { + onTimeChanged(); + + long now = SystemClock.uptimeMillis(); + long next = now + (1000 - now % 1000); + + getHandler().postAtTime(mTicker, next); + } + }; + + /** + * Creates a new clock using the default patterns + * {@link #DEFAULT_FORMAT_24_HOUR} and {@link #DEFAULT_FORMAT_12_HOUR} + * respectively for the 24-hour and 12-hour modes. + * + * @param context The Context the view is running in, through which it can + * access the current theme, resources, etc. + */ + @SuppressWarnings("UnusedDeclaration") + public TextClock(Context context) { + super(context); + init(); + } + + /** + * Creates a new clock inflated from XML. This object's properties are + * intialized from the attributes specified in XML. + * + * This constructor uses a default style of 0, so the only attribute values + * applied are those in the Context's Theme and the given AttributeSet. + * + * @param context The Context the view is running in, through which it can + * access the current theme, resources, etc. + * @param attrs The attributes of the XML tag that is inflating the view + */ + @SuppressWarnings("UnusedDeclaration") + public TextClock(Context context, AttributeSet attrs) { + this(context, attrs, 0); + } + + /** + * Creates a new clock inflated from XML. This object's properties are + * intialized from the attributes specified in XML. + * + * @param context The Context the view is running in, through which it can + * access the current theme, resources, etc. + * @param attrs The attributes of the XML tag that is inflating the view + * @param defStyle The default style to apply to this view. If 0, no style + * will be applied (beyond what is included in the theme). This may + * either be an attribute resource, whose value will be retrieved + * from the current theme, or an explicit style resource + */ + public TextClock(Context context, AttributeSet attrs, int defStyle) { + super(context, attrs, defStyle); + + TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.TextClock, defStyle, 0); + try { + CharSequence format; + + format = a.getText(R.styleable.TextClock_format12Hour); + mFormat12 = format == null ? DEFAULT_FORMAT_12_HOUR : format; + + format = a.getText(R.styleable.TextClock_format24Hour); + mFormat24 = format == null ? DEFAULT_FORMAT_24_HOUR : format; + + mTimeZone = a.getString(R.styleable.TextClock_timeZone); + } finally { + a.recycle(); + } + + init(); + } + + private void init() { + createTime(mTimeZone); + // Wait until onAttachedToWindow() to handle the ticker + chooseFormat(false); + } + + private void createTime(String timeZone) { + if (timeZone != null) { + mTime = Calendar.getInstance(TimeZone.getTimeZone(timeZone)); + } else { + mTime = Calendar.getInstance(); + } + } + + /** + * Returns the formatting pattern used to display the date and/or time + * in 12-hour mode. The formatting pattern syntax is described in + * {@link DateFormat}. + * + * @return A {@link CharSequence} or null. + * + * @see #setFormat12Hour(CharSequence) + * @see #is24HourModeEnabled() + */ + @ExportedProperty + public CharSequence getFormat12Hour() { + return mFormat12; + } + + /** + * Specifies the formatting pattern used to display the date and/or time + * in 12-hour mode. The formatting pattern syntax is described in + * {@link DateFormat}. + * + * If this pattern is set to null, {@link #getFormat24Hour()} will be used + * even in 12-hour mode. If both 24-hour and 12-hour formatting patterns + * are set to null, {@link #DEFAULT_FORMAT_24_HOUR} and + * {@link #DEFAULT_FORMAT_12_HOUR} will be used instead. + * + * @param format A date/time formatting pattern as described in {@link DateFormat} + * + * @see #getFormat12Hour() + * @see #is24HourModeEnabled() + * @see #DEFAULT_FORMAT_12_HOUR + * @see DateFormat + * + * @attr ref android.R.styleable#TextClock_format12Hour + */ + @RemotableViewMethod + public void setFormat12Hour(CharSequence format) { + mFormat12 = format; + + chooseFormat(); + onTimeChanged(); + } + + /** + * Returns the formatting pattern used to display the date and/or time + * in 24-hour mode. The formatting pattern syntax is described in + * {@link DateFormat}. + * + * @return A {@link CharSequence} or null. + * + * @see #setFormat24Hour(CharSequence) + * @see #is24HourModeEnabled() + */ + @ExportedProperty + public CharSequence getFormat24Hour() { + return mFormat24; + } + + /** + * Specifies the formatting pattern used to display the date and/or time + * in 24-hour mode. The formatting pattern syntax is described in + * {@link DateFormat}. + * + * If this pattern is set to null, {@link #getFormat12Hour()} will be used + * even in 24-hour mode. If both 24-hour and 12-hour formatting patterns + * are set to null, {@link #DEFAULT_FORMAT_24_HOUR} and + * {@link #DEFAULT_FORMAT_12_HOUR} will be used instead. + * + * @param format A date/time formatting pattern as described in {@link DateFormat} + * + * @see #getFormat24Hour() + * @see #is24HourModeEnabled() + * @see #DEFAULT_FORMAT_24_HOUR + * @see DateFormat + * + * @attr ref android.R.styleable#TextClock_format24Hour + */ + @RemotableViewMethod + public void setFormat24Hour(CharSequence format) { + mFormat24 = format; + + chooseFormat(); + onTimeChanged(); + } + + /** + * Indicates whether the system is currently using the 24-hour mode. + * + * When the system is in 24-hour mode, this view will use the pattern + * returned by {@link #getFormat24Hour()}. In 12-hour mode, the pattern + * returned by {@link #getFormat12Hour()} is used instead. + * + * If either one of the formats is null, the other format is used. If + * both formats are null, the default values {@link #DEFAULT_FORMAT_12_HOUR} + * and {@link #DEFAULT_FORMAT_24_HOUR} are used instead. + * + * @return true if time should be displayed in 24-hour format, false if it + * should be displayed in 12-hour format. + * + * @see #setFormat12Hour(CharSequence) + * @see #getFormat12Hour() + * @see #setFormat24Hour(CharSequence) + * @see #getFormat24Hour() + */ + public boolean is24HourModeEnabled() { + return DateFormat.is24HourFormat(getContext()); + } + + /** + * Indicates which time zone is currently used by this view. + * + * @return The ID of the current time zone or null if the default time zone, + * as set by the user, must be used + * + * @see TimeZone + * @see java.util.TimeZone#getAvailableIDs() + * @see #setTimeZone(String) + */ + public String getTimeZone() { + return mTimeZone; + } + + /** + * Sets the specified time zone to use in this clock. When the time zone + * is set through this method, system time zone changes (when the user + * sets the time zone in settings for instance) will be ignored. + * + * @param timeZone The desired time zone's ID as specified in {@link TimeZone} + * or null to user the time zone specified by the user + * (system time zone) + * + * @see #getTimeZone() + * @see java.util.TimeZone#getAvailableIDs() + * @see TimeZone#getTimeZone(String) + * + * @attr ref android.R.styleable#TextClock_timeZone + */ + @RemotableViewMethod + public void setTimeZone(String timeZone) { + mTimeZone = timeZone; + + createTime(timeZone); + onTimeChanged(); + } + + /** + * Selects either one of {@link #getFormat12Hour()} or {@link #getFormat24Hour()} + * depending on whether the user has selected 24-hour format. + * + * Calling this method does not schedule or unschedule the time ticker. + */ + private void chooseFormat() { + chooseFormat(true); + } + + /** + * Selects either one of {@link #getFormat12Hour()} or {@link #getFormat24Hour()} + * depending on whether the user has selected 24-hour format. + * + * @param handleTicker true if calling this method should schedule/unschedule the + * time ticker, false otherwise + */ + private void chooseFormat(boolean handleTicker) { + final boolean format24Requested = is24HourModeEnabled(); + + if (format24Requested) { + mFormat = abc(mFormat24, mFormat12, DEFAULT_FORMAT_24_HOUR); + } else { + mFormat = abc(mFormat12, mFormat24, DEFAULT_FORMAT_12_HOUR); + } + + boolean hadSeconds = mHasSeconds; + mHasSeconds = DateFormat.hasSeconds(mFormat); + + if (handleTicker && mAttached && hadSeconds != mHasSeconds) { + if (hadSeconds) getHandler().removeCallbacks(mTicker); + else mTicker.run(); + } + } + + /** + * Returns a if not null, else return b if not null, else return c. + */ + private static CharSequence abc(CharSequence a, CharSequence b, CharSequence c) { + return a == null ? (b == null ? c : b) : a; + } + + @Override + protected void onAttachedToWindow() { + super.onAttachedToWindow(); + + if (!mAttached) { + mAttached = true; + + registerReceiver(); + registerObserver(); + + createTime(mTimeZone); + + if (mHasSeconds) { + mTicker.run(); + } else { + onTimeChanged(); + } + } + } + + @Override + protected void onDetachedFromWindow() { + super.onDetachedFromWindow(); + + if (mAttached) { + unregisterReceiver(); + unregisterObserver(); + + getHandler().removeCallbacks(mTicker); + + mAttached = false; + } + } + + private void registerReceiver() { + final IntentFilter filter = new IntentFilter(); + + filter.addAction(Intent.ACTION_TIME_TICK); + filter.addAction(Intent.ACTION_TIME_CHANGED); + filter.addAction(Intent.ACTION_TIMEZONE_CHANGED); + + getContext().registerReceiver(mIntentReceiver, filter, null, getHandler()); + } + + private void registerObserver() { + final ContentResolver resolver = getContext().getContentResolver(); + resolver.registerContentObserver(Settings.System.CONTENT_URI, true, mFormatChangeObserver); + } + + private void unregisterReceiver() { + getContext().unregisterReceiver(mIntentReceiver); + } + + private void unregisterObserver() { + final ContentResolver resolver = getContext().getContentResolver(); + resolver.unregisterContentObserver(mFormatChangeObserver); + } + + private void onTimeChanged() { + mTime.setTimeInMillis(System.currentTimeMillis()); + setText(DateFormat.format(mFormat, mTime)); + } +} diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index 01617da73b9a5..5d904004cf027 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -33,6 +33,7 @@ import android.graphics.Typeface; import android.graphics.drawable.Drawable; import android.inputmethodservice.ExtractEditText; +import android.os.AsyncTask; import android.os.Bundle; import android.os.Handler; import android.os.Message; @@ -132,6 +133,7 @@ import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.Locale; +import java.util.concurrent.locks.ReentrantLock; /** * Displays text to the user and optionally allows them to edit it. A TextView @@ -302,8 +304,9 @@ static class Drawables { // The alignment to pass to Layout, or null if not resolved. private Layout.Alignment mLayoutAlignment; + private int mResolvedTextAlignment; - private boolean mResolvedDrawables; + private int mLastLayoutDirection = -1; /** * On some devices the fading edges add a performance penalty if used @@ -364,6 +367,7 @@ static class Drawables { private boolean mSingleLine; private int mDesiredHeightAtMeasure = -1; private boolean mIncludePad = true; + private int mDeferScroll = -1; // tmp primitives, so we don't alloc them on each draw private Rect mTempRect; @@ -377,6 +381,9 @@ static class Drawables { private InputFilter[] mFilters = NO_FILTERS; + private volatile Locale mCurrentTextServicesLocaleCache; + private final ReentrantLock mCurrentTextServicesLocaleLock = new ReentrantLock(); + // It is possible to have a selection even when mEditor is null (programmatically set, like when // a link is pressed). These highlight-related fields do not go in mEditor. int mHighlightColor = 0x6633B5E5; @@ -1542,11 +1549,10 @@ public int getCompoundPaddingRight() { /** * Returns the start padding of the view, plus space for the start * Drawable if any. - * @hide */ public int getCompoundPaddingStart() { resolveDrawables(); - switch(getResolvedLayoutDirection()) { + switch(getLayoutDirection()) { default: case LAYOUT_DIRECTION_LTR: return getCompoundPaddingLeft(); @@ -1558,11 +1564,10 @@ public int getCompoundPaddingStart() { /** * Returns the end padding of the view, plus space for the end * Drawable if any. - * @hide */ public int getCompoundPaddingEnd() { resolveDrawables(); - switch(getResolvedLayoutDirection()) { + switch(getLayoutDirection()) { default: case LAYOUT_DIRECTION_LTR: return getCompoundPaddingRight(); @@ -1656,7 +1661,6 @@ public int getTotalPaddingRight() { /** * Returns the total start padding of the view, including the start * Drawable if any. - * @hide */ public int getTotalPaddingStart() { return getCompoundPaddingStart(); @@ -1665,7 +1669,6 @@ public int getTotalPaddingStart() { /** * Returns the total end padding of the view, including the end * Drawable if any. - * @hide */ public int getTotalPaddingEnd() { return getCompoundPaddingEnd(); @@ -1868,7 +1871,6 @@ public void setCompoundDrawablesWithIntrinsicBounds(Drawable left, Drawable top, * @attr ref android.R.styleable#TextView_drawableTop * @attr ref android.R.styleable#TextView_drawableEnd * @attr ref android.R.styleable#TextView_drawableBottom - * @hide */ public void setCompoundDrawablesRelative(Drawable start, Drawable top, Drawable end, Drawable bottom) { @@ -1990,7 +1992,6 @@ public void setCompoundDrawablesRelative(Drawable start, Drawable top, * @attr ref android.R.styleable#TextView_drawableTop * @attr ref android.R.styleable#TextView_drawableEnd * @attr ref android.R.styleable#TextView_drawableBottom - * @hide */ @android.view.RemotableViewMethod public void setCompoundDrawablesRelativeWithIntrinsicBounds(int start, int top, int end, @@ -2014,7 +2015,6 @@ public void setCompoundDrawablesRelativeWithIntrinsicBounds(int start, int top, * @attr ref android.R.styleable#TextView_drawableTop * @attr ref android.R.styleable#TextView_drawableEnd * @attr ref android.R.styleable#TextView_drawableBottom - * @hide */ public void setCompoundDrawablesRelativeWithIntrinsicBounds(Drawable start, Drawable top, Drawable end, Drawable bottom) { @@ -2061,7 +2061,6 @@ public Drawable[] getCompoundDrawables() { * @attr ref android.R.styleable#TextView_drawableTop * @attr ref android.R.styleable#TextView_drawableEnd * @attr ref android.R.styleable#TextView_drawableBottom - * @hide */ public Drawable[] getCompoundDrawablesRelative() { final Drawables dr = mDrawables; @@ -2210,6 +2209,27 @@ public void setTextAppearance(Context context, int resid) { appearance.recycle(); } + /** + * Get the default {@link Locale} of the text in this TextView. + * @return the default {@link Locale} of the text in this TextView. + */ + public Locale getTextLocale() { + return mTextPaint.getTextLocale(); + } + + /** + * Set the default {@link Locale} of the text in this TextView to the given value. This value + * is used to choose appropriate typefaces for ambiguous characters. Typically used for CJK + * locales to disambiguate Hanzi/Kanji/Hanja characters. + * + * @param locale the {@link Locale} for drawing text, must not be null. + * + * @see Paint#setTextLocale + */ + public void setTextLocale(Locale locale) { + mTextPaint.setTextLocale(locale); + } + /** * @return the size (in pixels) of the default text size in this TextView. */ @@ -4449,9 +4469,6 @@ protected void onAttachedToWindow() { mTemporaryDetach = false; - // Resolve drawables as the layout direction has been resolved - resolveDrawables(); - if (mEditor != null) mEditor.onAttachedToWindow(); } @@ -4586,23 +4603,6 @@ public void invalidateDrawable(Drawable drawable) { } } - /** - * @hide - */ - @Override - public int getResolvedLayoutDirection(Drawable who) { - if (who == null) return View.LAYOUT_DIRECTION_LTR; - if (mDrawables != null) { - final Drawables drawables = mDrawables; - if (who == drawables.mDrawableLeft || who == drawables.mDrawableRight || - who == drawables.mDrawableTop || who == drawables.mDrawableBottom || - who == drawables.mDrawableStart || who == drawables.mDrawableEnd) { - return getResolvedLayoutDirection(); - } - } - return super.getResolvedLayoutDirection(who); - } - @Override public boolean hasOverlappingRendering() { return (getBackground() != null || mText instanceof Spannable || hasSelection()); @@ -4862,18 +4862,23 @@ protected void onDraw(Canvas canvas) { } canvas.translate(compoundPaddingLeft, extendedPaddingTop + voffsetText); - final int layoutDirection = getResolvedLayoutDirection(); + final boolean isLayoutRtl = isLayoutRtl(); + + final int layoutDirection = getLayoutDirection(); 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); } } @@ -4887,7 +4892,8 @@ protected void onDraw(Canvas canvas) { } 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); } @@ -5634,13 +5640,11 @@ private void assumeLayout() { physicalWidth, false); } - /** @hide */ @Override - public void onResolvedLayoutDirectionReset() { + public void onRtlPropertiesChanged(int layoutDirection) { if (mLayoutAlignment != null) { - int resolvedTextAlignment = getResolvedTextAlignment(); - if (resolvedTextAlignment == TEXT_ALIGNMENT_VIEW_START || - resolvedTextAlignment == TEXT_ALIGNMENT_VIEW_END) { + if (mResolvedTextAlignment == TEXT_ALIGNMENT_VIEW_START || + mResolvedTextAlignment == TEXT_ALIGNMENT_VIEW_END) { mLayoutAlignment = null; } } @@ -5648,8 +5652,8 @@ public void onResolvedLayoutDirectionReset() { private Layout.Alignment getLayoutAlignment() { if (mLayoutAlignment == null) { - int textAlign = getResolvedTextAlignment(); - switch (textAlign) { + mResolvedTextAlignment = getTextAlignment(); + switch (mResolvedTextAlignment) { case TEXT_ALIGNMENT_GRAVITY: switch (mGravity & Gravity.RELATIVE_HORIZONTAL_GRAVITY_MASK) { case Gravity.START: @@ -5682,11 +5686,11 @@ private Layout.Alignment getLayoutAlignment() { mLayoutAlignment = Layout.Alignment.ALIGN_CENTER; break; case TEXT_ALIGNMENT_VIEW_START: - mLayoutAlignment = (getResolvedLayoutDirection() == LAYOUT_DIRECTION_RTL) ? + mLayoutAlignment = (getLayoutDirection() == LAYOUT_DIRECTION_RTL) ? Layout.Alignment.ALIGN_RIGHT : Layout.Alignment.ALIGN_LEFT; break; case TEXT_ALIGNMENT_VIEW_END: - mLayoutAlignment = (getResolvedLayoutDirection() == LAYOUT_DIRECTION_RTL) ? + mLayoutAlignment = (getLayoutDirection() == LAYOUT_DIRECTION_RTL) ? Layout.Alignment.ALIGN_LEFT : Layout.Alignment.ALIGN_RIGHT; break; case TEXT_ALIGNMENT_INHERIT: @@ -5735,7 +5739,7 @@ protected void makeNewLayout(int wantWidth, int hintWidth, } if (mTextDir == null) { - resolveTextDirection(); + mTextDir = getTextDirectionHeuristic(); } mLayout = makeSingleLayout(wantWidth, boring, ellipsisWidth, alignment, shouldEllipsize, @@ -5997,7 +6001,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { BoringLayout.Metrics hintBoring = UNKNOWN_BORING; if (mTextDir == null) { - resolveTextDirection(); + getTextDirectionHeuristic(); } int des = -1; @@ -6314,6 +6318,11 @@ private void checkForRelayout() { @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); + if (mDeferScroll >= 0) { + int curs = mDeferScroll; + mDeferScroll = -1; + bringPointIntoView(Math.min(curs, mText.length())); + } if (changed && mEditor != null) mEditor.invalidateTextDisplayList(); } @@ -6396,6 +6405,10 @@ private boolean bringTextIntoView() { * This has to be called after layout. Returns true if anything changed. */ public boolean bringPointIntoView(int offset) { + if (isLayoutRequested()) { + mDeferScroll = offset; + return false; + } boolean changed = false; Layout layout = isShowingHint() ? mHintLayout: mLayout; @@ -7105,13 +7118,13 @@ void updateAfterEdit() { registerForPreDraw(); } + checkForResize(); + if (curs >= 0) { mHighlightPathBogus = true; if (mEditor != null) mEditor.makeBlink(); bringPointIntoView(curs); } - - checkForResize(); } /** @@ -7158,6 +7171,7 @@ void spanChange(Spanned buf, Object what, int oldStart, int newStart, int oldEnd if (oldStart >= 0 || newStart >= 0) { invalidateCursor(Selection.getSelectionStart(buf), oldStart, newStart); + checkForResize(); registerForPreDraw(); if (mEditor != null) mEditor.makeBlink(); } @@ -7481,12 +7495,13 @@ protected float getLeftFadingEdgeStrength() { 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; } } else if (getLineCount() == 1) { - final int layoutDirection = getResolvedLayoutDirection(); + final int layoutDirection = getLayoutDirection(); final int absoluteGravity = Gravity.getAbsoluteGravity(mGravity, layoutDirection); switch (absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK) { case Gravity.LEFT: @@ -7509,9 +7524,11 @@ protected float getRightFadingEdgeStrength() { 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 layoutDirection = getLayoutDirection(); final int absoluteGravity = Gravity.getAbsoluteGravity(mGravity, layoutDirection); switch (absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK) { case Gravity.LEFT: @@ -7674,13 +7691,43 @@ boolean textCanBeSelected() { /** * This is a temporary method. Future versions may support multi-locale text. + * Caveat: This method may not return the latest text services locale, but this should be + * acceptable and it's more important to make this method asynchronous. * * @return The locale that should be used for a word iterator and a spell checker * in this TextView, based on the current spell checker settings, * the current IME's locale, or the system default locale. * @hide */ + // TODO: Support multi-locale + // TODO: Update the text services locale immediately after the keyboard locale is switched + // by catching intent of keyboard switch event public Locale getTextServicesLocale() { + if (mCurrentTextServicesLocaleCache == null) { + // If there is no cached text services locale, just return the default locale. + mCurrentTextServicesLocaleCache = Locale.getDefault(); + } + // Start fetching the text services locale asynchronously. + updateTextServicesLocaleAsync(); + return mCurrentTextServicesLocaleCache; + } + + private void updateTextServicesLocaleAsync() { + AsyncTask.execute(new Runnable() { + @Override + public void run() { + if (mCurrentTextServicesLocaleLock.tryLock()) { + try { + updateTextServicesLocaleLocked(); + } finally { + mCurrentTextServicesLocaleLock.unlock(); + } + } + } + }); + } + + private void updateTextServicesLocaleLocked() { Locale locale = Locale.getDefault(); final TextServicesManager textServicesManager = (TextServicesManager) mContext.getSystemService(Context.TEXT_SERVICES_MANAGER_SERVICE); @@ -7688,7 +7735,7 @@ public Locale getTextServicesLocale() { if (subtype != null) { locale = SpellCheckerSubtype.constructLocaleFromString(subtype.getLocale()); } - return locale; + mCurrentTextServicesLocaleCache = locale; } void onLocaleChanged() { @@ -8180,65 +8227,54 @@ boolean isInBatchEditMode() { return mEditor.mInBatchEditControllers; } - /** @hide */ - @Override - public void onResolvedTextDirectionChanged() { + TextDirectionHeuristic getTextDirectionHeuristic() { if (hasPasswordTransformationMethod()) { // TODO: take care of the content direction to show the password text and dots justified // to the left or to the right - mTextDir = TextDirectionHeuristics.LOCALE; - return; + return TextDirectionHeuristics.LOCALE; } // Always need to resolve layout direction first - final boolean defaultIsRtl = (getResolvedLayoutDirection() == LAYOUT_DIRECTION_RTL); + final boolean defaultIsRtl = (getLayoutDirection() == LAYOUT_DIRECTION_RTL); // Now, we can select the heuristic - int textDir = getResolvedTextDirection(); - switch (textDir) { + switch (getTextDirection()) { default: case TEXT_DIRECTION_FIRST_STRONG: - mTextDir = (defaultIsRtl ? TextDirectionHeuristics.FIRSTSTRONG_RTL : + return (defaultIsRtl ? TextDirectionHeuristics.FIRSTSTRONG_RTL : TextDirectionHeuristics.FIRSTSTRONG_LTR); - break; case TEXT_DIRECTION_ANY_RTL: - mTextDir = TextDirectionHeuristics.ANYRTL_LTR; - break; + return TextDirectionHeuristics.ANYRTL_LTR; case TEXT_DIRECTION_LTR: - mTextDir = TextDirectionHeuristics.LTR; - break; + return TextDirectionHeuristics.LTR; case TEXT_DIRECTION_RTL: - mTextDir = TextDirectionHeuristics.RTL; - break; + return TextDirectionHeuristics.RTL; case TEXT_DIRECTION_LOCALE: - mTextDir = TextDirectionHeuristics.LOCALE; - break; + return TextDirectionHeuristics.LOCALE; } } /** - * Subclasses will need to override this method to implement their own way of resolving - * drawables depending on the layout direction. - * - * A call to the super method will be required from the subclasses implementation. + * @hide */ - protected void resolveDrawables() { + @Override + public void onResolveDrawables(int layoutDirection) { // No need to resolve twice - if (mResolvedDrawables) { + if (mLastLayoutDirection == layoutDirection) { return; } + mLastLayoutDirection = layoutDirection; // No drawable to resolve if (mDrawables == null) { return; } // No relative drawable to resolve if (mDrawables.mDrawableStart == null && mDrawables.mDrawableEnd == null) { - mResolvedDrawables = true; return; } Drawables dr = mDrawables; - switch(getResolvedLayoutDirection()) { + switch(layoutDirection) { case LAYOUT_DIRECTION_RTL: if (dr.mDrawableStart != null) { dr.mDrawableRight = dr.mDrawableStart; @@ -8270,11 +8306,29 @@ protected void resolveDrawables() { } break; } - mResolvedDrawables = true; + updateDrawablesLayoutDirection(dr, layoutDirection); + } + + private void updateDrawablesLayoutDirection(Drawables dr, int layoutDirection) { + if (dr.mDrawableLeft != null) { + dr.mDrawableLeft.setLayoutDirection(layoutDirection); + } + if (dr.mDrawableRight != null) { + dr.mDrawableRight.setLayoutDirection(layoutDirection); + } + if (dr.mDrawableTop != null) { + dr.mDrawableTop.setLayoutDirection(layoutDirection); + } + if (dr.mDrawableBottom != null) { + dr.mDrawableBottom.setLayoutDirection(layoutDirection); + } } + /** + * @hide + */ protected void resetResolvedDrawables() { - mResolvedDrawables = false; + mLastLayoutDirection = -1; } /** @@ -8341,7 +8395,7 @@ private void createEditorIfNeeded() { */ @Override public CharSequence getIterableTextForAccessibility() { - if (getContentDescription() == null) { + if (!TextUtils.isEmpty(mText)) { if (!(mText instanceof Spannable)) { setText(mText, BufferType.SPANNABLE); } @@ -8593,13 +8647,13 @@ private static final class Marquee extends Handler { 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; @@ -8691,6 +8745,14 @@ float getGhostOffset() { return mGhostOffset; } + float getScroll() { + return mScroll; + } + + float getMaxFadeScroll() { + return mMaxFadeScroll; + } + boolean shouldDrawLeftFade() { return mScroll <= mFadeStop; } @@ -8718,8 +8780,8 @@ public void beforeTextChanged(CharSequence buffer, int start, + " before=" + before + " after=" + after + ": " + buffer); if (AccessibilityManager.getInstance(mContext).isEnabled() - && !isPasswordInputType(getInputType()) - && !hasPasswordTransformationMethod()) { + && ((!isPasswordInputType(getInputType()) && !hasPasswordTransformationMethod()) + || shouldSpeakPasswordsForAccessibility())) { mBeforeText = buffer.toString(); } diff --git a/core/java/android/widget/TimePicker.java b/core/java/android/widget/TimePicker.java index cb9ed619613c0..e6796cb343df4 100644 --- a/core/java/android/widget/TimePicker.java +++ b/core/java/android/widget/TimePicker.java @@ -172,7 +172,7 @@ public void onValueChange(NumberPicker spinner, int oldVal, int newVal) { mMinuteSpinner.setMinValue(0); mMinuteSpinner.setMaxValue(59); mMinuteSpinner.setOnLongPressUpdateInterval(100); - mMinuteSpinner.setFormatter(NumberPicker.TWO_DIGIT_FORMATTER); + mMinuteSpinner.setFormatter(NumberPicker.getTwoDigitFormatter()); mMinuteSpinner.setOnValueChangedListener(new NumberPicker.OnValueChangeListener() { public void onValueChange(NumberPicker spinner, int oldVal, int newVal) { updateInputState(); @@ -500,7 +500,7 @@ private void updateHourControl() { if (is24HourView()) { mHourSpinner.setMinValue(0); mHourSpinner.setMaxValue(23); - mHourSpinner.setFormatter(NumberPicker.TWO_DIGIT_FORMATTER); + mHourSpinner.setFormatter(NumberPicker.getTwoDigitFormatter()); } else { mHourSpinner.setMinValue(1); mHourSpinner.setMaxValue(12); diff --git a/core/java/android/widget/Toast.java b/core/java/android/widget/Toast.java index fafc113bf7a24..ab361390fdefe 100644 --- a/core/java/android/widget/Toast.java +++ b/core/java/android/widget/Toast.java @@ -19,6 +19,7 @@ import android.app.INotificationManager; import android.app.ITransientNotification; import android.content.Context; +import android.content.res.Configuration; import android.content.res.Resources; import android.graphics.PixelFormat; import android.os.Handler; @@ -29,7 +30,6 @@ import android.view.LayoutInflater; import android.view.View; import android.view.WindowManager; -import android.view.WindowManagerImpl; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityManager; @@ -305,12 +305,14 @@ static private INotificationManager getService() { private static class TN extends ITransientNotification.Stub { final Runnable mShow = new Runnable() { + @Override public void run() { handleShow(); } }; final Runnable mHide = new Runnable() { + @Override public void run() { handleHide(); // Don't do this in handleHide() because it is also invoked by handleShow() @@ -329,8 +331,8 @@ public void run() { View mView; View mNextView; - - WindowManagerImpl mWM; + + WindowManager mWM; TN() { // XXX This should be changed to use a Dialog, with a Theme.Toast @@ -350,6 +352,7 @@ public void run() { /** * schedule handleShow into the right thread */ + @Override public void show() { if (localLOGV) Log.v(TAG, "SHOW: " + this); mHandler.post(mShow); @@ -358,6 +361,7 @@ public void show() { /** * schedule handleHide into the right thread */ + @Override public void hide() { if (localLOGV) Log.v(TAG, "HIDE: " + this); mHandler.post(mHide); @@ -370,8 +374,17 @@ public void handleShow() { // remove the old view if necessary handleHide(); mView = mNextView; - mWM = WindowManagerImpl.getDefault(); - final int gravity = mGravity; + Context context = mView.getContext(); + if (context.getApplicationContext() != null) { + // Use application context, except when called from system + // service where there is no application context. + context = context.getApplicationContext(); + } + mWM = (WindowManager)context.getSystemService(Context.WINDOW_SERVICE); + // We can resolve the Gravity here by using the Locale for getting + // the layout direction + final Configuration config = mView.getContext().getResources().getConfiguration(); + final int gravity = Gravity.getAbsoluteGravity(mGravity, config.getLayoutDirection()); mParams.gravity = gravity; if ((gravity & Gravity.HORIZONTAL_GRAVITY_MASK) == Gravity.FILL_HORIZONTAL) { mParams.horizontalWeight = 1.0f; diff --git a/core/java/android/widget/TwoLineListItem.java b/core/java/android/widget/TwoLineListItem.java index e707ea384e8b3..f7e5266e619d6 100644 --- a/core/java/android/widget/TwoLineListItem.java +++ b/core/java/android/widget/TwoLineListItem.java @@ -37,7 +37,11 @@ * layout for this object. * * @attr ref android.R.styleable#TwoLineListItem_mode + * + * @deprecated This class can be implemented easily by apps using a {@link RelativeLayout} + * or a {@link LinearLayout}. */ +@Deprecated @Widget public class TwoLineListItem extends RelativeLayout { diff --git a/core/java/android/widget/VideoView.java b/core/java/android/widget/VideoView.java index 0fba498b7eb61..7c8196d859f95 100644 --- a/core/java/android/widget/VideoView.java +++ b/core/java/android/widget/VideoView.java @@ -26,6 +26,7 @@ import android.media.Metadata; import android.media.MediaPlayer.OnCompletionListener; import android.media.MediaPlayer.OnErrorListener; +import android.media.MediaPlayer.OnInfoListener; import android.net.Uri; import android.util.AttributeSet; import android.util.Log; @@ -84,6 +85,7 @@ public class VideoView extends SurfaceView implements MediaPlayerControl { private MediaPlayer.OnPreparedListener mOnPreparedListener; private int mCurrentBufferPercentage; private OnErrorListener mOnErrorListener; + private OnInfoListener mOnInfoListener; private int mSeekWhenPrepared; // recording the seek position while preparing private boolean mCanPause; private boolean mCanSeekBack; @@ -230,6 +232,7 @@ private void openVideo() { mDuration = -1; mMediaPlayer.setOnCompletionListener(mCompletionListener); mMediaPlayer.setOnErrorListener(mErrorListener); + mMediaPlayer.setOnInfoListener(mOnInfoListener); mMediaPlayer.setOnBufferingUpdateListener(mBufferingUpdateListener); mCurrentBufferPercentage = 0; mMediaPlayer.setDataSource(mContext, mUri, mHeaders); @@ -281,6 +284,7 @@ public void onVideoSizeChanged(MediaPlayer mp, int width, int height) { mVideoHeight = mp.getVideoHeight(); if (mVideoWidth != 0 && mVideoHeight != 0) { getHolder().setFixedSize(mVideoWidth, mVideoHeight); + requestLayout(); } } }; @@ -455,6 +459,16 @@ public void setOnErrorListener(OnErrorListener l) mOnErrorListener = l; } + /** + * Register a callback to be invoked when an informational event + * occurs during playback or setup. + * + * @param l The callback that will be run + */ + public void setOnInfoListener(OnInfoListener l) { + mOnInfoListener = l; + } + SurfaceHolder.Callback mSHCallback = new SurfaceHolder.Callback() { public void surfaceChanged(SurfaceHolder holder, int format, diff --git a/core/java/android/widget/ViewAnimator.java b/core/java/android/widget/ViewAnimator.java index 6a68240c6ddd6..eee914eb4d36b 100644 --- a/core/java/android/widget/ViewAnimator.java +++ b/core/java/android/widget/ViewAnimator.java @@ -328,9 +328,22 @@ public void setOutAnimation(Context context, int resourceID) { setOutAnimation(AnimationUtils.loadAnimation(context, resourceID)); } + /** + * Returns whether the current View should be animated the first time the ViewAnimator + * is displayed. + * + * @return true if the current View will be animated the first time it is displayed, + * false otherwise. + * + * @see #setAnimateFirstView(boolean) + */ + public boolean getAnimateFirstView() { + return mAnimateFirstTime; + } + /** * Indicates whether the current View should be animated the first time - * the ViewAnimation is displayed. + * the ViewAnimator is displayed. * * @param animate True to animate the current View the first time it is displayed, * false otherwise. diff --git a/core/java/android/widget/ZoomButtonsController.java b/core/java/android/widget/ZoomButtonsController.java index 02dc27bef3e91..a89c9c14244b0 100644 --- a/core/java/android/widget/ZoomButtonsController.java +++ b/core/java/android/widget/ZoomButtonsController.java @@ -242,7 +242,7 @@ public void setZoomSpeed(long speed) { private FrameLayout createContainer() { LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); // Controls are positioned BOTTOM | CENTER with respect to the owner view. - lp.gravity = Gravity.TOP | Gravity.LEFT; + lp.gravity = Gravity.TOP | Gravity.START; lp.flags = LayoutParams.FLAG_NOT_TOUCHABLE | LayoutParams.FLAG_NOT_FOCUSABLE | LayoutParams.FLAG_LAYOUT_NO_LIMITS | diff --git a/core/java/android/widget/package.html b/core/java/android/widget/package.html index 7d94a4b71f849..91d327c4951b7 100644 --- a/core/java/android/widget/package.html +++ b/core/java/android/widget/package.html @@ -1,11 +1,16 @@ +

          The widget package contains (mostly visual) UI elements to use -on your Application screen. You can design your own

          +on your Application screen. You can also design your own. +

          + +

          To create your own widget, extend {@link android.view.View} or a subclass. To use your widget in layout XML, there are two additional files for you to create. Here is a list of files you'll need to create to implement a custom widget: +

          • Java implementation file - This is the file that implements the behavior of the widget. If you can instantiate the object from layout XML, @@ -19,14 +24,16 @@ res/layout/ that describes the layout of your widget. You could also do this in code in your Java file.
          + +

          ApiDemos sample application has an example of creating a custom layout XML tag, LabelView. See the following files that demonstrate implementing and using -a custom widget:

          +a custom widget: +

            -
          • LabelView.java - The implentation file
          • +
          • LabelView.java - The implementation file
          • res/values/attrs.xml - Definition file
          • -
          • res/layout/custom_view_1.xml - Layout -file
          • +
          • res/layout/custom_view_1.xml - Layout file
          diff --git a/core/java/com/android/internal/app/ActivityTrigger.java b/core/java/com/android/internal/app/ActivityTrigger.java new file mode 100644 index 0000000000000..71aeff3c770a1 --- /dev/null +++ b/core/java/com/android/internal/app/ActivityTrigger.java @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2011, Code Aurora Forum. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Code Aurora nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package com.android.internal.app; + +import android.content.ComponentName; +import android.content.Intent; +import android.util.Log; + +public class ActivityTrigger +{ + private static final String TAG = "ActivityTrigger"; + + /** &hide */ + public ActivityTrigger() { + //Log.d(TAG, "ActivityTrigger initialized"); + } + + /** &hide */ + protected void finalize() { + native_at_deinit(); + } + + /** &hide */ + public void activityStartTrigger(Intent intent) { + ComponentName cn = intent.getComponent(); + String activity = null; + + if (cn != null) + activity = cn.flattenToString(); + native_at_startActivity(activity); + } + + /** &hide */ + public void activityResumeTrigger(Intent intent) { + ComponentName cn = intent.getComponent(); + String activity = null; + + if (cn != null) + activity = cn.flattenToString(); + native_at_resumeActivity(activity); + } + + private native void native_at_startActivity(String activity); + private native void native_at_resumeActivity(String activity); + private native void native_at_deinit(); +} diff --git a/core/java/com/android/internal/app/AlertController.java b/core/java/com/android/internal/app/AlertController.java index 2061c905ebb0f..43a02cf27b3a1 100644 --- a/core/java/com/android/internal/app/AlertController.java +++ b/core/java/com/android/internal/app/AlertController.java @@ -347,6 +347,18 @@ public void setIcon(Drawable icon) { } } + /** + * @param attrId the attributeId of the theme-specific drawable + * to resolve the resourceId for. + * + * @return resId the resourceId of the theme-specific drawable + */ + public int getIconAttributeResId(int attrId) { + TypedValue out = new TypedValue(); + mContext.getTheme().resolveAttribute(attrId, out, true); + return out.resourceId; + } + public void setInverseBackgroundForced(boolean forceInverseBackground) { mForceInverseBackground = forceInverseBackground; } @@ -740,6 +752,7 @@ public static class AlertParams { public int mIconId = 0; public Drawable mIcon; + public int mIconAttrId = 0; public CharSequence mTitle; public View mCustomTitleView; public CharSequence mMessage; @@ -751,6 +764,7 @@ public static class AlertParams { public DialogInterface.OnClickListener mNeutralButtonListener; public boolean mCancelable; public DialogInterface.OnCancelListener mOnCancelListener; + public DialogInterface.OnDismissListener mOnDismissListener; public DialogInterface.OnKeyListener mOnKeyListener; public CharSequence[] mItems; public ListAdapter mAdapter; @@ -806,6 +820,9 @@ public void apply(AlertController dialog) { if (mIconId >= 0) { dialog.setIcon(mIconId); } + if (mIconAttrId > 0) { + dialog.setIcon(dialog.getIconAttributeResId(mIconAttrId)); + } } if (mMessage != null) { dialog.setMessage(mMessage); diff --git a/core/java/com/android/internal/app/IAssetRedirectionManager.aidl b/core/java/com/android/internal/app/IAssetRedirectionManager.aidl new file mode 100644 index 0000000000000..8b47f0b31c2bd --- /dev/null +++ b/core/java/com/android/internal/app/IAssetRedirectionManager.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2011, T-Mobile USA, Inc. + * + * 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.internal.app; + +import android.content.res.PackageRedirectionMap; + +/** + * Interface used to interact with the AssetRedirectionManagerService. + */ +interface IAssetRedirectionManager { + /** + * Access the package redirection map for the supplied package name given a + * particular theme. + */ + PackageRedirectionMap getPackageRedirectionMap(in String themePackageName, + String themeId, in String targetPackageName); + + /** + * Clear all redirection maps for the given theme. + */ + void clearRedirectionMapsByTheme(in String themePackageName, + in String themeId); + + /** + * Clear all redirection maps for the given target package. + */ + void clearPackageRedirectionMap(in String targetPackageName); +} diff --git a/core/java/com/android/internal/app/IBatteryStats.aidl b/core/java/com/android/internal/app/IBatteryStats.aidl index 6a0cd36c32e46..1a76461f4f26a 100644 --- a/core/java/com/android/internal/app/IBatteryStats.aidl +++ b/core/java/com/android/internal/app/IBatteryStats.aidl @@ -58,14 +58,14 @@ interface IBatteryStats { void noteBluetoothOff(); void noteFullWifiLockAcquired(int uid); void noteFullWifiLockReleased(int uid); - void noteScanWifiLockAcquired(int uid); - void noteScanWifiLockReleased(int uid); + void noteWifiScanStarted(int uid); + void noteWifiScanStopped(int uid); void noteWifiMulticastEnabled(int uid); void noteWifiMulticastDisabled(int uid); void noteFullWifiLockAcquiredFromSource(in WorkSource ws); void noteFullWifiLockReleasedFromSource(in WorkSource ws); - void noteScanWifiLockAcquiredFromSource(in WorkSource ws); - void noteScanWifiLockReleasedFromSource(in WorkSource ws); + void noteWifiScanStartedFromSource(in WorkSource ws); + void noteWifiScanStoppedFromSource(in WorkSource ws); void noteWifiMulticastEnabledFromSource(in WorkSource ws); void noteWifiMulticastDisabledFromSource(in WorkSource ws); void noteNetworkInterfaceType(String iface, int type); diff --git a/core/java/com/android/internal/app/IMediaContainerService.aidl b/core/java/com/android/internal/app/IMediaContainerService.aidl index c82834f7afd81..83eb352cd799e 100755 --- a/core/java/com/android/internal/app/IMediaContainerService.aidl +++ b/core/java/com/android/internal/app/IMediaContainerService.aidl @@ -33,7 +33,10 @@ interface IMediaContainerService { boolean checkExternalFreeStorage(in Uri fileUri, boolean isForwardLocked); ObbInfo getObbInfo(in String filename); long calculateDirectorySize(in String directory); + byte[] listDirectory(in String directory); /** Return file system stats: [0] is total bytes, [1] is available bytes */ long[] getFileSystemStats(in String path); void clearDirectory(in String directory); + void deleteFile(in String file); + long calculateInstalledSize(in String packagePath, boolean isForwardLocked); } diff --git a/core/java/com/android/internal/app/LocalePicker.java b/core/java/com/android/internal/app/LocalePicker.java index 52cb679f75af4..f173327fe69f5 100644 --- a/core/java/com/android/internal/app/LocalePicker.java +++ b/core/java/com/android/internal/app/LocalePicker.java @@ -28,9 +28,12 @@ import android.os.Bundle; import android.os.RemoteException; import android.util.Log; +import android.view.LayoutInflater; import android.view.View; +import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.ListView; +import android.widget.TextView; import java.text.Collator; import java.util.Arrays; @@ -86,7 +89,7 @@ public static ArrayAdapter constructAdapter(Context context) { } public static ArrayAdapter constructAdapter(Context context, - int layoutId, int fieldId) { + final int layoutId, final int fieldId) { final Resources resources = context.getResources(); final String[] locales = Resources.getSystem().getAssets().getLocales(); final String[] specialLocaleCodes = resources.getStringArray(R.array.special_locale_codes); @@ -154,7 +157,29 @@ public static ArrayAdapter constructAdapter(Context context, localeInfos[i] = preprocess[i]; } Arrays.sort(localeInfos); - return new ArrayAdapter(context, layoutId, fieldId, localeInfos); + + final LayoutInflater inflater = + (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + return new ArrayAdapter(context, layoutId, fieldId, localeInfos) { + @Override + public View getView(int position, View convertView, ViewGroup parent) { + View view; + TextView text; + if (convertView == null) { + view = inflater.inflate(layoutId, parent, false); + text = (TextView) view.findViewById(fieldId); + view.setTag(text); + } else { + view = convertView; + text = (TextView) view.getTag(); + } + LocaleInfo item = getItem(position); + text.setText(item.toString()); + text.setTextLocale(item.getLocale()); + + return view; + } + }; } private static String toTitleCase(String s) { @@ -218,10 +243,9 @@ public static void updateLocale(Locale locale) { IActivityManager am = ActivityManagerNative.getDefault(); Configuration config = am.getConfiguration(); - config.locale = locale; - - // indicate this isn't some passing default - the user wants this remembered - config.userSetLocale = true; + // Will set userSetLocale to indicate this isn't some passing default - the user + // wants this remembered + config.setLocale(locale); am.updateConfiguration(config); // Trigger the dirty bit for the Settings Provider. @@ -230,4 +254,4 @@ public static void updateLocale(Locale locale) { // Intentionally left blank } } -} \ No newline at end of file +} diff --git a/core/java/com/android/internal/app/MediaRouteChooserDialogFragment.java b/core/java/com/android/internal/app/MediaRouteChooserDialogFragment.java index f010d7b482064..386f38779ef5f 100644 --- a/core/java/com/android/internal/app/MediaRouteChooserDialogFragment.java +++ b/core/java/com/android/internal/app/MediaRouteChooserDialogFragment.java @@ -25,7 +25,7 @@ import android.app.MediaRouteButton; import android.content.Context; import android.graphics.drawable.Drawable; -import android.media.AudioManager; +import android.hardware.display.DisplayManager; import android.media.MediaRouter; import android.media.MediaRouter.RouteCategory; import android.media.MediaRouter.RouteGroup; @@ -70,6 +70,7 @@ public class MediaRouteChooserDialogFragment extends DialogFragment { }; MediaRouter mRouter; + DisplayManager mDisplayService; private int mRouteTypes; private LayoutInflater mInflater; @@ -97,6 +98,7 @@ public void setLauncherListener(LauncherListener listener) { public void onAttach(Activity activity) { super.onAttach(activity); mRouter = (MediaRouter) activity.getSystemService(Context.MEDIA_ROUTER_SERVICE); + mDisplayService = (DisplayManager) activity.getSystemService(Context.DISPLAY_SERVICE); } @Override @@ -119,6 +121,15 @@ public void setExtendedSettingsClickListener(View.OnClickListener listener) { public void setRouteTypes(int types) { mRouteTypes = types; + if ((mRouteTypes & MediaRouter.ROUTE_TYPE_LIVE_VIDEO) != 0 && mDisplayService == null) { + final Context activity = getActivity(); + if (activity != null) { + mDisplayService = (DisplayManager) activity.getSystemService( + Context.DISPLAY_SERVICE); + } + } else { + mDisplayService = null; + } } void updateVolume() { @@ -194,6 +205,9 @@ public Dialog onCreateDialog(Bundle savedInstanceState) { @Override public void onResume() { super.onResume(); + if (mDisplayService != null) { + mDisplayService.scanWifiDisplays(); + } } private static class ViewHolder { @@ -253,7 +267,9 @@ void update() { final RouteCategory cat = mRouter.getCategoryAt(i); routes = cat.getRoutes(mCatRouteList); - mItems.add(cat); + if (!cat.isSystem()) { + mItems.add(cat); + } if (cat == mCategoryEditingGroups) { addGroupEditingCategoryRoutes(routes); @@ -370,6 +386,7 @@ public boolean areAllItemsEnabled() { public boolean isEnabled(int position) { switch (getItemViewType(position)) { case VIEW_ROUTE: + return ((RouteInfo) mItems.get(position)).isEnabled(); case VIEW_GROUPING_ROUTE: case VIEW_GROUPING_DONE: return true; @@ -434,6 +451,7 @@ public View getView(int position, View convertView, ViewGroup parent) { } convertView.setActivated(position == mSelectedItemPosition); + convertView.setEnabled(isEnabled(position)); return convertView; } diff --git a/core/java/com/android/internal/app/PlatLogoActivity.java b/core/java/com/android/internal/app/PlatLogoActivity.java index 3a2b647cdc8e0..bac8e213a4282 100644 --- a/core/java/com/android/internal/app/PlatLogoActivity.java +++ b/core/java/com/android/internal/app/PlatLogoActivity.java @@ -84,7 +84,7 @@ private View makeView() { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - + final boolean isCid = getIntent().hasExtra("is_cid"); mToast = Toast.makeText(this, "", Toast.LENGTH_LONG); mToast.setView(makeView()); @@ -92,7 +92,8 @@ protected void onCreate(Bundle savedInstanceState) { getWindowManager().getDefaultDisplay().getMetrics(metrics); mContent = new ImageView(this); - mContent.setImageResource(com.android.internal.R.drawable.platlogo_alt); + mContent.setImageResource(isCid ? com.android.internal.R.drawable.cidlogo + : com.android.internal.R.drawable.platlogo_alt); mContent.setScaleType(ImageView.ScaleType.CENTER_INSIDE); final int p = (int)(32 * metrics.density); @@ -102,7 +103,8 @@ protected void onCreate(Bundle savedInstanceState) { @Override public void onClick(View v) { mToast.show(); - mContent.setImageResource(com.android.internal.R.drawable.platlogo); + mContent.setImageResource(isCid ? com.android.internal.R.drawable.cidlogo_alt + : com.android.internal.R.drawable.platlogo); } }); @@ -114,6 +116,7 @@ public boolean onLongClick(View v) { .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS) + .putExtra("is_cid", isCid) .addCategory("com.android.internal.category.PLATLOGO")); //.setClassName("com.android.systemui","com.android.systemui.BeanBag")); } catch (ActivityNotFoundException ex) { diff --git a/core/java/com/android/internal/app/ResolverActivity.java b/core/java/com/android/internal/app/ResolverActivity.java index 7334ac304af14..e63c57f47d80c 100644 --- a/core/java/com/android/internal/app/ResolverActivity.java +++ b/core/java/com/android/internal/app/ResolverActivity.java @@ -37,7 +37,7 @@ import android.os.PatternMatcher; import android.os.Process; import android.os.RemoteException; -import android.os.UserId; +import android.os.UserHandle; import android.util.Log; import android.view.LayoutInflater; import android.view.View; @@ -76,6 +76,7 @@ public class ResolverActivity extends AlertActivity implements AdapterView.OnIte private int mIconDpi; private int mIconSize; private int mMaxColumns; + private int mLastSelected = GridView.INVALID_POSITION; private boolean mRegistered; private final PackageMonitor mPackageMonitor = new PackageMonitor() { @@ -132,7 +133,7 @@ protected void onCreate(Bundle savedInstanceState, Intent intent, mAdapter = new ResolveListAdapter(this, intent, initialIntents, rList, mLaunchedFromUid); int count = mAdapter.getCount(); - if (mLaunchedFromUid < 0 || UserId.isIsolated(mLaunchedFromUid)) { + if (mLaunchedFromUid < 0 || UserHandle.isIsolated(mLaunchedFromUid)) { // Gulp! finish(); return; @@ -247,6 +248,7 @@ protected void onRestoreInstanceState(Bundle savedInstanceState) { if (mAlwaysUseOption) { final int checkedPos = mGrid.getCheckedItemPosition(); final boolean enabled = checkedPos != GridView.INVALID_POSITION; + mLastSelected = checkedPos; mAlwaysButton.setEnabled(enabled); mOnceButton.setEnabled(enabled); if (enabled) { @@ -257,14 +259,15 @@ protected void onRestoreInstanceState(Bundle savedInstanceState) { @Override public void onItemClick(AdapterView parent, View view, int position, long id) { - if (mAlwaysUseOption) { - final int checkedPos = mGrid.getCheckedItemPosition(); - final boolean enabled = checkedPos != GridView.INVALID_POSITION; - mAlwaysButton.setEnabled(enabled); - mOnceButton.setEnabled(enabled); - if (enabled) { + final int checkedPos = mGrid.getCheckedItemPosition(); + final boolean hasValidSelection = checkedPos != GridView.INVALID_POSITION; + if (mAlwaysUseOption && (!hasValidSelection || mLastSelected != checkedPos)) { + mAlwaysButton.setEnabled(hasValidSelection); + mOnceButton.setEnabled(hasValidSelection); + if (hasValidSelection) { mGrid.smoothScrollToPosition(checkedPos); } + mLastSelected = checkedPos; } else { startSelected(position, false); } @@ -371,7 +374,8 @@ protected void onIntentSelected(ResolveInfo ri, Intent intent, boolean alwaysChe void showAppDetails(ResolveInfo ri) { Intent in = new Intent().setAction("android.settings.APPLICATION_DETAILS_SETTINGS") - .setData(Uri.fromParts("package", ri.activityInfo.packageName, null)); + .setData(Uri.fromParts("package", ri.activityInfo.packageName, null)) + .addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); startActivity(in); } diff --git a/core/java/com/android/internal/app/ThemeUtils.java b/core/java/com/android/internal/app/ThemeUtils.java new file mode 100644 index 0000000000000..4265fd5e1b266 --- /dev/null +++ b/core/java/com/android/internal/app/ThemeUtils.java @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2012 The CyanogenMod 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.internal.app; + +import android.content.Context; +import android.content.BroadcastReceiver; +import android.content.IntentFilter; +import android.content.pm.PackageManager; +import android.util.Log; + +/** + * @hide + */ + +public class ThemeUtils { + private static final String TAG = "ThemeUtils"; + private static final String DATA_TYPE_TMOBILE_STYLE = "vnd.tmobile.cursor.item/style"; + private static final String DATA_TYPE_TMOBILE_THEME = "vnd.tmobile.cursor.item/theme"; + private static final String ACTION_TMOBILE_THEME_CHANGED = "com.tmobile.intent.action.THEME_CHANGED"; + + public static Context createUiContext(final Context context) { + try { + return context.createPackageContext("com.android.systemui", Context.CONTEXT_RESTRICTED); + } catch (PackageManager.NameNotFoundException e) { + } + + return null; + } + + public static void registerThemeChangeReceiver(final Context context, final BroadcastReceiver receiver) { + IntentFilter filter = new IntentFilter(ACTION_TMOBILE_THEME_CHANGED); + try { + filter.addDataType(DATA_TYPE_TMOBILE_THEME); + filter.addDataType(DATA_TYPE_TMOBILE_STYLE); + } catch (IntentFilter.MalformedMimeTypeException e) { + Log.e(TAG, "Could not add MIME types to filter", e); + } + + context.registerReceiver(receiver, filter); + } +} + diff --git a/core/java/com/android/internal/appwidget/IAppWidgetHost.aidl b/core/java/com/android/internal/appwidget/IAppWidgetHost.aidl index 216d985bd55db..78b446637b953 100644 --- a/core/java/com/android/internal/appwidget/IAppWidgetHost.aidl +++ b/core/java/com/android/internal/appwidget/IAppWidgetHost.aidl @@ -24,6 +24,7 @@ import android.widget.RemoteViews; oneway interface IAppWidgetHost { void updateAppWidget(int appWidgetId, in RemoteViews views); void providerChanged(int appWidgetId, in AppWidgetProviderInfo info); + void providersChanged(); void viewDataChanged(int appWidgetId, int viewId); } diff --git a/core/java/com/android/internal/appwidget/IAppWidgetService.aidl b/core/java/com/android/internal/appwidget/IAppWidgetService.aidl index 7df45cf780783..cfb16fadbea5a 100644 --- a/core/java/com/android/internal/appwidget/IAppWidgetService.aidl +++ b/core/java/com/android/internal/appwidget/IAppWidgetService.aidl @@ -52,9 +52,9 @@ interface IAppWidgetService { AppWidgetProviderInfo getAppWidgetInfo(int appWidgetId); boolean hasBindAppWidgetPermission(in String packageName); void setBindAppWidgetPermission(in String packageName, in boolean permission); - void bindAppWidgetId(int appWidgetId, in ComponentName provider); + void bindAppWidgetId(int appWidgetId, in ComponentName provider, in Bundle options); boolean bindAppWidgetIdIfAllowed( - in String packageName, int appWidgetId, in ComponentName provider); + in String packageName, int appWidgetId, in ComponentName provider, in Bundle options); void bindRemoteViewsService(int appWidgetId, in Intent intent, in IBinder connection); void unbindRemoteViewsService(int appWidgetId, in Intent intent); int[] getAppWidgetIds(in ComponentName provider); diff --git a/core/java/com/android/internal/content/PackageHelper.java b/core/java/com/android/internal/content/PackageHelper.java index 246b0c960fd67..c5e7d9de37164 100644 --- a/core/java/com/android/internal/content/PackageHelper.java +++ b/core/java/com/android/internal/content/PackageHelper.java @@ -49,6 +49,7 @@ public class PackageHelper { public static final int RECOMMEND_FAILED_ALREADY_EXISTS = -4; public static final int RECOMMEND_MEDIA_UNAVAILABLE = -5; public static final int RECOMMEND_FAILED_INVALID_URI = -6; + public static final int RECOMMEND_FAILED_VERSION_DOWNGRADE = -7; private static final boolean localLOGV = true; private static final String TAG = "PackageHelper"; diff --git a/core/java/com/android/internal/content/PackageMonitor.java b/core/java/com/android/internal/content/PackageMonitor.java index f41fcc6063446..20ecaceade132 100644 --- a/core/java/com/android/internal/content/PackageMonitor.java +++ b/core/java/com/android/internal/content/PackageMonitor.java @@ -24,6 +24,7 @@ import android.os.Handler; import android.os.HandlerThread; import android.os.Looper; +import android.os.UserHandle; import java.util.HashSet; @@ -49,6 +50,7 @@ public abstract class PackageMonitor extends android.content.BroadcastReceiver { sPackageFilt.addAction(Intent.ACTION_UID_REMOVED); sPackageFilt.addDataScheme("package"); sNonDataFilt.addAction(Intent.ACTION_UID_REMOVED); + sNonDataFilt.addAction(Intent.ACTION_USER_STOPPED); sExternalFilt.addAction(Intent.ACTION_EXTERNAL_APPLICATIONS_AVAILABLE); sExternalFilt.addAction(Intent.ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE); } @@ -61,11 +63,17 @@ public abstract class PackageMonitor extends android.content.BroadcastReceiver { String[] mAppearingPackages; String[] mModifiedPackages; int mChangeType; + int mChangeUserId = UserHandle.USER_NULL; boolean mSomePackagesChanged; - + String[] mTempArray = new String[1]; - + public void register(Context context, Looper thread, boolean externalStorage) { + register(context, thread, null, externalStorage); + } + + public void register(Context context, Looper thread, UserHandle user, + boolean externalStorage) { if (mRegisteredContext != null) { throw new IllegalStateException("Already registered"); } @@ -83,10 +91,19 @@ public void register(Context context, Looper thread, boolean externalStorage) { } else { mRegisteredHandler = new Handler(thread); } - context.registerReceiver(this, sPackageFilt, null, mRegisteredHandler); - context.registerReceiver(this, sNonDataFilt, null, mRegisteredHandler); - if (externalStorage) { - context.registerReceiver(this, sExternalFilt, null, mRegisteredHandler); + if (user != null) { + context.registerReceiverAsUser(this, user, sPackageFilt, null, mRegisteredHandler); + context.registerReceiverAsUser(this, user, sNonDataFilt, null, mRegisteredHandler); + if (externalStorage) { + context.registerReceiverAsUser(this, user, sExternalFilt, null, + mRegisteredHandler); + } + } else { + context.registerReceiver(this, sPackageFilt, null, mRegisteredHandler); + context.registerReceiver(this, sNonDataFilt, null, mRegisteredHandler); + if (externalStorage) { + context.registerReceiver(this, sExternalFilt, null, mRegisteredHandler); + } } } @@ -111,16 +128,29 @@ boolean isPackageUpdating(String packageName) { public void onBeginPackageChanges() { } - + + /** + * Called when a package is really added (and not replaced). + */ public void onPackageAdded(String packageName, int uid) { } - + + /** + * Called when a package is really removed (and not replaced). + */ public void onPackageRemoved(String packageName, int uid) { } - + + /** + * Called when a package is really removed (and not replaced) for + * all users on the device. + */ + public void onPackageRemovedAllUsers(String packageName, int uid) { + } + public void onPackageUpdateStarted(String packageName, int uid) { } - + public void onPackageUpdateFinished(String packageName, int uid) { } @@ -130,6 +160,9 @@ public void onPackageChanged(String packageName, int uid, String[] components) { public boolean onHandleForceStop(Intent intent, String[] packages, int uid, boolean doit) { return false; } + + public void onHandleUserStop(Intent intent, int userHandle) { + } public void onUidRemoved(int uid) { } @@ -144,10 +177,16 @@ public void onPackagesUnavailable(String[] packages) { public static final int PACKAGE_UPDATING = 1; public static final int PACKAGE_TEMPORARY_CHANGE = 2; public static final int PACKAGE_PERMANENT_CHANGE = 3; - + + /** + * Called when a package disappears for any reason. + */ public void onPackageDisappeared(String packageName, int reason) { } - + + /** + * Called when a package appears for any reason. + */ public void onPackageAppeared(String packageName, int reason) { } @@ -204,7 +243,11 @@ public void onSomePackagesChanged() { public void onFinishPackageChanges() { } - + + public int getChangingUserId() { + return mChangeUserId; + } + String getPackageName(Intent intent) { Uri uri = intent.getData(); String pkg = uri != null ? uri.getSchemeSpecificPart() : null; @@ -213,6 +256,12 @@ String getPackageName(Intent intent) { @Override public void onReceive(Context context, Intent intent) { + mChangeUserId = intent.getIntExtra(Intent.EXTRA_USER_HANDLE, + UserHandle.USER_NULL); + if (mChangeUserId == UserHandle.USER_NULL) { + throw new IllegalArgumentException( + "Intent broadcast does not contain user handle: " + intent); + } onBeginPackageChanges(); mDisappearingPackages = mAppearingPackages = null; @@ -265,6 +314,9 @@ public void onReceive(Context context, Intent intent) { // it when it is re-added. mSomePackagesChanged = true; onPackageRemoved(pkg, uid); + if (intent.getBooleanExtra(Intent.EXTRA_REMOVED_FOR_ALL_USERS, false)) { + onPackageRemovedAllUsers(pkg, uid); + } } onPackageDisappeared(pkg, mChangeType); } @@ -295,6 +347,10 @@ public void onReceive(Context context, Intent intent) { intent.getIntExtra(Intent.EXTRA_UID, 0), true); } else if (Intent.ACTION_UID_REMOVED.equals(action)) { onUidRemoved(intent.getIntExtra(Intent.EXTRA_UID, 0)); + } else if (Intent.ACTION_USER_STOPPED.equals(action)) { + if (intent.hasExtra(Intent.EXTRA_USER_HANDLE)) { + onHandleUserStop(intent, intent.getIntExtra(Intent.EXTRA_USER_HANDLE, 0)); + } } else if (Intent.ACTION_EXTERNAL_APPLICATIONS_AVAILABLE.equals(action)) { String[] pkgList = intent.getStringArrayExtra(Intent.EXTRA_CHANGED_PACKAGE_LIST); mAppearingPackages = pkgList; @@ -324,5 +380,6 @@ public void onReceive(Context context, Intent intent) { } onFinishPackageChanges(); + mChangeUserId = UserHandle.USER_NULL; } } diff --git a/core/java/com/android/internal/net/LegacyVpnInfo.java b/core/java/com/android/internal/net/LegacyVpnInfo.java index b620abac6b9e5..d6f6d0bac1a0d 100644 --- a/core/java/com/android/internal/net/LegacyVpnInfo.java +++ b/core/java/com/android/internal/net/LegacyVpnInfo.java @@ -17,8 +17,10 @@ package com.android.internal.net; import android.app.PendingIntent; +import android.net.NetworkInfo; import android.os.Parcel; import android.os.Parcelable; +import android.util.Log; /** * A simple container used to carry information of the ongoing legacy VPN. @@ -27,6 +29,8 @@ * @hide */ public class LegacyVpnInfo implements Parcelable { + private static final String TAG = "LegacyVpnInfo"; + public static final int STATE_DISCONNECTED = 0; public static final int STATE_INITIALIZING = 1; public static final int STATE_CONNECTING = 2; @@ -66,4 +70,25 @@ public LegacyVpnInfo[] newArray(int size) { return new LegacyVpnInfo[size]; } }; + + /** + * Return best matching {@link LegacyVpnInfo} state based on given + * {@link NetworkInfo}. + */ + public static int stateFromNetworkInfo(NetworkInfo info) { + switch (info.getDetailedState()) { + case CONNECTING: + return STATE_CONNECTING; + case CONNECTED: + return STATE_CONNECTED; + case DISCONNECTED: + return STATE_DISCONNECTED; + case FAILED: + return STATE_FAILED; + default: + Log.w(TAG, "Unhandled state " + info.getDetailedState() + + " ; treating as disconnected"); + return STATE_DISCONNECTED; + } + } } diff --git a/core/java/com/android/internal/net/VpnConfig.java b/core/java/com/android/internal/net/VpnConfig.java index d6f9e077d0feb..956653b7da5d3 100644 --- a/core/java/com/android/internal/net/VpnConfig.java +++ b/core/java/com/android/internal/net/VpnConfig.java @@ -22,6 +22,8 @@ import android.os.Parcel; import android.os.Parcelable; +import com.android.internal.util.Preconditions; + import java.util.List; /** @@ -45,13 +47,14 @@ public static Intent getIntentForConfirmation() { } public static PendingIntent getIntentForStatusPanel(Context context, VpnConfig config) { + Preconditions.checkNotNull(config); + Intent intent = new Intent(); intent.setClassName(DIALOGS_PACKAGE, DIALOGS_PACKAGE + ".ManageDialog"); intent.putExtra("config", config); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS); - return PendingIntent.getActivity(context, 0, intent, (config == null) ? - PendingIntent.FLAG_NO_CREATE : PendingIntent.FLAG_CANCEL_CURRENT); + return PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT); } public String user; @@ -64,6 +67,7 @@ public static PendingIntent getIntentForStatusPanel(Context context, VpnConfig c public List searchDomains; public PendingIntent configureIntent; public long startTime = -1; + public boolean legacy; @Override public int describeContents() { @@ -82,6 +86,7 @@ public void writeToParcel(Parcel out, int flags) { out.writeStringList(searchDomains); out.writeParcelable(configureIntent, flags); out.writeLong(startTime); + out.writeInt(legacy ? 1 : 0); } public static final Parcelable.Creator CREATOR = @@ -99,6 +104,7 @@ public VpnConfig createFromParcel(Parcel in) { config.searchDomains = in.createStringArrayList(); config.configureIntent = in.readParcelable(null); config.startTime = in.readLong(); + config.legacy = in.readInt() != 0; return config; } diff --git a/core/java/com/android/internal/net/VpnProfile.aidl b/core/java/com/android/internal/net/VpnProfile.aidl new file mode 100644 index 0000000000000..a072160e8a6f6 --- /dev/null +++ b/core/java/com/android/internal/net/VpnProfile.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 com.android.internal.net; + +parcelable VpnProfile; diff --git a/core/java/com/android/internal/net/VpnProfile.java b/core/java/com/android/internal/net/VpnProfile.java new file mode 100644 index 0000000000000..c9b7cb3a2e7bf --- /dev/null +++ b/core/java/com/android/internal/net/VpnProfile.java @@ -0,0 +1,215 @@ +/* + * Copyright (C) 2011 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.internal.net; + +import android.os.Parcel; +import android.os.Parcelable; +import android.text.TextUtils; +import android.util.Log; + +import java.net.InetAddress; +import java.nio.charset.Charsets; + +/** + * Parcel-like entity class for VPN profiles. To keep things simple, all + * fields are package private. Methods are provided for serialization, so + * storage can be implemented easily. Two rules are set for this class. + * First, all fields must be kept non-null. Second, always make a copy + * using clone() before modifying. + * + * @hide + */ +public class VpnProfile implements Cloneable, Parcelable { + private static final String TAG = "VpnProfile"; + + // Match these constants with R.array.vpn_types. + public static final int TYPE_PPTP = 0; + public static final int TYPE_L2TP_IPSEC_PSK = 1; + public static final int TYPE_L2TP_IPSEC_RSA = 2; + public static final int TYPE_IPSEC_XAUTH_PSK = 3; + public static final int TYPE_IPSEC_XAUTH_RSA = 4; + public static final int TYPE_IPSEC_HYBRID_RSA = 5; + public static final int TYPE_MAX = 5; + + // Entity fields. + public final String key; // -1 + public String name = ""; // 0 + public int type = TYPE_PPTP; // 1 + public String server = ""; // 2 + public String username = ""; // 3 + public String password = ""; // 4 + public String dnsServers = ""; // 5 + public String searchDomains = ""; // 6 + public String routes = ""; // 7 + public boolean mppe = true; // 8 + public String l2tpSecret = ""; // 9 + public String ipsecIdentifier = "";// 10 + public String ipsecSecret = ""; // 11 + public String ipsecUserCert = ""; // 12 + public String ipsecCaCert = ""; // 13 + public String ipsecServerCert = "";// 14 + + // Helper fields. + public boolean saveLogin = false; + + public VpnProfile(String key) { + this.key = key; + } + + public VpnProfile(Parcel in) { + key = in.readString(); + name = in.readString(); + type = in.readInt(); + server = in.readString(); + username = in.readString(); + password = in.readString(); + dnsServers = in.readString(); + searchDomains = in.readString(); + routes = in.readString(); + mppe = in.readInt() != 0; + l2tpSecret = in.readString(); + ipsecIdentifier = in.readString(); + ipsecSecret = in.readString(); + ipsecUserCert = in.readString(); + ipsecCaCert = in.readString(); + ipsecServerCert = in.readString(); + saveLogin = in.readInt() != 0; + } + + @Override + public void writeToParcel(Parcel out, int flags) { + out.writeString(key); + out.writeString(name); + out.writeInt(type); + out.writeString(server); + out.writeString(username); + out.writeString(password); + out.writeString(dnsServers); + out.writeString(searchDomains); + out.writeString(routes); + out.writeInt(mppe ? 1 : 0); + out.writeString(l2tpSecret); + out.writeString(ipsecIdentifier); + out.writeString(ipsecSecret); + out.writeString(ipsecUserCert); + out.writeString(ipsecCaCert); + out.writeString(ipsecServerCert); + out.writeInt(saveLogin ? 1 : 0); + } + + public static VpnProfile decode(String key, byte[] value) { + try { + if (key == null) { + return null; + } + + String[] values = new String(value, Charsets.UTF_8).split("\0", -1); + // There can be 14 or 15 values in ICS MR1. + if (values.length < 14 || values.length > 15) { + return null; + } + + VpnProfile profile = new VpnProfile(key); + profile.name = values[0]; + profile.type = Integer.valueOf(values[1]); + if (profile.type < 0 || profile.type > TYPE_MAX) { + return null; + } + profile.server = values[2]; + profile.username = values[3]; + profile.password = values[4]; + profile.dnsServers = values[5]; + profile.searchDomains = values[6]; + profile.routes = values[7]; + profile.mppe = Boolean.valueOf(values[8]); + profile.l2tpSecret = values[9]; + profile.ipsecIdentifier = values[10]; + profile.ipsecSecret = values[11]; + profile.ipsecUserCert = values[12]; + profile.ipsecCaCert = values[13]; + profile.ipsecServerCert = (values.length > 14) ? values[14] : ""; + + profile.saveLogin = !profile.username.isEmpty() || !profile.password.isEmpty(); + return profile; + } catch (Exception e) { + // ignore + } + return null; + } + + public byte[] encode() { + StringBuilder builder = new StringBuilder(name); + builder.append('\0').append(type); + builder.append('\0').append(server); + builder.append('\0').append(saveLogin ? username : ""); + builder.append('\0').append(saveLogin ? password : ""); + builder.append('\0').append(dnsServers); + builder.append('\0').append(searchDomains); + builder.append('\0').append(routes); + builder.append('\0').append(mppe); + builder.append('\0').append(l2tpSecret); + builder.append('\0').append(ipsecIdentifier); + builder.append('\0').append(ipsecSecret); + builder.append('\0').append(ipsecUserCert); + builder.append('\0').append(ipsecCaCert); + builder.append('\0').append(ipsecServerCert); + return builder.toString().getBytes(Charsets.UTF_8); + } + + /** + * Test if profile is valid for lockdown, which requires IPv4 address for + * both server and DNS. Server hostnames would require using DNS before + * connection. + */ + public boolean isValidLockdownProfile() { + try { + InetAddress.parseNumericAddress(server); + + for (String dnsServer : dnsServers.split(" +")) { + InetAddress.parseNumericAddress(this.dnsServers); + } + if (TextUtils.isEmpty(dnsServers)) { + Log.w(TAG, "DNS required"); + return false; + } + + // Everything checked out above + return true; + + } catch (IllegalArgumentException e) { + Log.w(TAG, "Invalid address", e); + return false; + } + } + + public static final Creator CREATOR = new Creator() { + @Override + public VpnProfile createFromParcel(Parcel in) { + return new VpnProfile(in); + } + + @Override + public VpnProfile[] newArray(int size) { + return new VpnProfile[size]; + } + }; + + @Override + public int describeContents() { + return 0; + } +} diff --git a/core/java/com/android/internal/os/BatteryStatsImpl.java b/core/java/com/android/internal/os/BatteryStatsImpl.java index 515738555e8ee..201e1dee20007 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; @@ -159,8 +159,8 @@ public void handleMessage(Message msg) { = new SparseArray>(); final ArrayList mWifiRunningTimers = new ArrayList(); final ArrayList mFullWifiLockTimers = new ArrayList(); - final ArrayList mScanWifiLockTimers = new ArrayList(); final ArrayList mWifiMulticastTimers = new ArrayList(); + final ArrayList mWifiScanTimers = new ArrayList(); // Last partial timers we use for distributing CPU usage. final ArrayList mLastPartialTimers = new ArrayList(); @@ -320,6 +320,18 @@ public void handleMessage(Message msg) { Process.PROC_TAB_TERM|Process.PROC_OUT_LONG, // 5: totalTime }; + private static final int[] WAKEUP_SOURCES_FORMAT = new int[] { + Process.PROC_TAB_TERM|Process.PROC_OUT_STRING, // 0: name + Process.PROC_TAB_TERM|Process.PROC_COMBINE| + Process.PROC_OUT_LONG, // 1: count + Process.PROC_TAB_TERM|Process.PROC_COMBINE, + Process.PROC_TAB_TERM|Process.PROC_COMBINE, + Process.PROC_TAB_TERM|Process.PROC_COMBINE, + Process.PROC_TAB_TERM|Process.PROC_COMBINE, + Process.PROC_TAB_TERM|Process.PROC_COMBINE + |Process.PROC_OUT_LONG, // 6: totalTime + }; + private final String[] mProcWakelocksName = new String[3]; private final long[] mProcWakelocksData = new long[3]; @@ -1028,34 +1040,44 @@ void readSummaryFromParcelLocked(Parcel in) { private final Map readKernelWakelockStats() { + FileInputStream is; byte[] buffer = new byte[8192]; int len; + boolean wakeup_sources = false; try { - FileInputStream is = new FileInputStream("/proc/wakelocks"); + try { + is = new FileInputStream("/proc/wakelocks"); + } catch (java.io.FileNotFoundException e) { + try { + is = new FileInputStream("/d/wakeup_sources"); + wakeup_sources = true; + } catch (java.io.FileNotFoundException e2) { + return null; + } + } + len = is.read(buffer); is.close(); + } catch (java.io.IOException e) { + return null; + } - if (len > 0) { - int i; - for (i=0; i 0) { + int i; + for (i=0; i parseProcWakelocks( - byte[] wlBuffer, int len) { + byte[] wlBuffer, int len, boolean wakeup_sources) { String name; int count; long totalTime; @@ -1092,12 +1114,20 @@ private final Map parseProcWakelocks( if ((wlBuffer[j] & 0x80) != 0) wlBuffer[j] = (byte) '?'; } boolean parsed = Process.parseProcLine(wlBuffer, startIndex, endIndex, - PROC_WAKELOCKS_FORMAT, nameStringArray, wlData, null); + wakeup_sources ? WAKEUP_SOURCES_FORMAT : + PROC_WAKELOCKS_FORMAT, + nameStringArray, wlData, null); name = nameStringArray[0]; count = (int) wlData[1]; - // convert nanoseconds to microseconds with rounding. - totalTime = (wlData[2] + 500) / 1000; + + if (wakeup_sources) { + // convert milliseconds to microseconds + totalTime = wlData[2] * 1000; + } else { + // convert nanoseconds to microseconds with rounding. + totalTime = (wlData[2] + 500) / 1000; + } if (parsed && name.length() > 0) { if (!m.containsKey(name)) { @@ -1985,6 +2015,9 @@ public void notePhoneDataConnectionStateLocked(int dataType, boolean hasData) { case TelephonyManager.NETWORK_TYPE_EHRPD: bin = DATA_CONNECTION_EHRPD; break; + case TelephonyManager.NETWORK_TYPE_HSPAP: + bin = DATA_CONNECTION_HSPAP; + break; default: bin = DATA_CONNECTION_OTHER; break; @@ -2174,28 +2207,28 @@ public void noteFullWifiLockReleasedLocked(int uid) { getUidStatsLocked(uid).noteFullWifiLockReleasedLocked(); } - int mWifiScanLockNesting = 0; + int mWifiScanNesting = 0; - public void noteScanWifiLockAcquiredLocked(int uid) { - if (mWifiScanLockNesting == 0) { - mHistoryCur.states |= HistoryItem.STATE_WIFI_SCAN_LOCK_FLAG; - if (DEBUG_HISTORY) Slog.v(TAG, "WIFI scan lock on to: " + public void noteWifiScanStartedLocked(int uid) { + if (mWifiScanNesting == 0) { + mHistoryCur.states |= HistoryItem.STATE_WIFI_SCAN_FLAG; + if (DEBUG_HISTORY) Slog.v(TAG, "WIFI scan started for: " + Integer.toHexString(mHistoryCur.states)); addHistoryRecordLocked(SystemClock.elapsedRealtime()); } - mWifiScanLockNesting++; - getUidStatsLocked(uid).noteScanWifiLockAcquiredLocked(); + mWifiScanNesting++; + getUidStatsLocked(uid).noteWifiScanStartedLocked(); } - public void noteScanWifiLockReleasedLocked(int uid) { - mWifiScanLockNesting--; - if (mWifiScanLockNesting == 0) { - mHistoryCur.states &= ~HistoryItem.STATE_WIFI_SCAN_LOCK_FLAG; - if (DEBUG_HISTORY) Slog.v(TAG, "WIFI scan lock off to: " + public void noteWifiScanStoppedLocked(int uid) { + mWifiScanNesting--; + if (mWifiScanNesting == 0) { + mHistoryCur.states &= ~HistoryItem.STATE_WIFI_SCAN_FLAG; + if (DEBUG_HISTORY) Slog.v(TAG, "WIFI scan stopped for: " + Integer.toHexString(mHistoryCur.states)); addHistoryRecordLocked(SystemClock.elapsedRealtime()); } - getUidStatsLocked(uid).noteScanWifiLockReleasedLocked(); + getUidStatsLocked(uid).noteWifiScanStoppedLocked(); } int mWifiMulticastNesting = 0; @@ -2236,17 +2269,17 @@ public void noteFullWifiLockReleasedFromSourceLocked(WorkSource ws) { } } - public void noteScanWifiLockAcquiredFromSourceLocked(WorkSource ws) { + public void noteWifiScanStartedFromSourceLocked(WorkSource ws) { int N = ws.size(); for (int i=0; i= 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 @@ -2698,9 +2734,9 @@ boolean reset() { active |= !mFullWifiLockTimer.reset(BatteryStatsImpl.this, false); active |= mFullWifiLockOut; } - if (mScanWifiLockTimer != null) { - active |= !mScanWifiLockTimer.reset(BatteryStatsImpl.this, false); - active |= mScanWifiLockOut; + if (mWifiScanTimer != null) { + active |= !mWifiScanTimer.reset(BatteryStatsImpl.this, false); + active |= mWifiScanStarted; } if (mWifiMulticastTimer != null) { active |= !mWifiMulticastTimer.reset(BatteryStatsImpl.this, false); @@ -2791,8 +2827,8 @@ boolean reset() { if (mFullWifiLockTimer != null) { mFullWifiLockTimer.detach(); } - if (mScanWifiLockTimer != null) { - mScanWifiLockTimer.detach(); + if (mWifiScanTimer != null) { + mWifiScanTimer.detach(); } if (mWifiMulticastTimer != null) { mWifiMulticastTimer.detach(); @@ -2860,9 +2896,9 @@ void writeToParcelLocked(Parcel out, long batteryRealtime) { } else { out.writeInt(0); } - if (mScanWifiLockTimer != null) { + if (mWifiScanTimer != null) { out.writeInt(1); - mScanWifiLockTimer.writeToParcel(out, batteryRealtime); + mWifiScanTimer.writeToParcel(out, batteryRealtime); } else { out.writeInt(0); } @@ -2954,12 +2990,12 @@ void readFromParcelLocked(ArrayList unpluggables, Parcel in) { } else { mFullWifiLockTimer = null; } - mScanWifiLockOut = false; + mWifiScanStarted = false; if (in.readInt() != 0) { - mScanWifiLockTimer = new StopwatchTimer(Uid.this, SCAN_WIFI_LOCK, - mScanWifiLockTimers, mUnpluggables, in); + mWifiScanTimer = new StopwatchTimer(Uid.this, WIFI_SCAN, + mWifiScanTimers, mUnpluggables, in); } else { - mScanWifiLockTimer = null; + mWifiScanTimer = null; } mWifiMulticastEnabled = false; if (in.readInt() != 0) { @@ -5118,9 +5154,9 @@ private void readSummaryFromParcel(Parcel in) { if (in.readInt() != 0) { u.mFullWifiLockTimer.readSummaryFromParcelLocked(in); } - u.mScanWifiLockOut = false; + u.mWifiScanStarted = false; if (in.readInt() != 0) { - u.mScanWifiLockTimer.readSummaryFromParcelLocked(in); + u.mWifiScanTimer.readSummaryFromParcelLocked(in); } u.mWifiMulticastEnabled = false; if (in.readInt() != 0) { @@ -5310,9 +5346,9 @@ public void writeSummaryToParcel(Parcel out) { } else { out.writeInt(0); } - if (u.mScanWifiLockTimer != null) { + if (u.mWifiScanTimer != null) { out.writeInt(1); - u.mScanWifiLockTimer.writeSummaryFromParcelLocked(out, NOWREAL); + u.mWifiScanTimer.writeSummaryFromParcelLocked(out, NOWREAL); } else { out.writeInt(0); } @@ -5537,7 +5573,7 @@ void readFromParcelLocked(Parcel in) { mWindowTimers.clear(); mWifiRunningTimers.clear(); mFullWifiLockTimers.clear(); - mScanWifiLockTimers.clear(); + mWifiScanTimers.clear(); mWifiMulticastTimers.clear(); sNumSpeedSteps = in.readInt(); diff --git a/core/java/com/android/internal/os/HandlerCaller.java b/core/java/com/android/internal/os/HandlerCaller.java index a94fb1eea3879..84699dcd4a0c8 100644 --- a/core/java/com/android/internal/os/HandlerCaller.java +++ b/core/java/com/android/internal/os/HandlerCaller.java @@ -22,35 +22,14 @@ import android.os.Message; public class HandlerCaller { - private static final String TAG = "HandlerCaller"; - private static final boolean DEBUG = false; - + public final Context mContext; final Looper mMainLooper; final Handler mH; final Callback mCallback; - - public static class SomeArgs { - SomeArgs next; - - public Object arg1; - public Object arg2; - public Object arg3; - public Object arg4; - public int argi1; - public int argi2; - public int argi3; - public int argi4; - public int argi5; - public int argi6; - } - - static final int ARGS_POOL_MAX_SIZE = 10; - int mArgsPoolSize; - SomeArgs mArgsPool; - + class MyHandler extends Handler { MyHandler(Looper looper) { super(looper); @@ -80,29 +59,6 @@ public HandlerCaller(Context context, Looper looper, Callback callback) { mCallback = callback; } - public SomeArgs obtainArgs() { - synchronized (mH) { - SomeArgs args = mArgsPool; - if (args != null) { - mArgsPool = args.next; - args.next = null; - mArgsPoolSize--; - return args; - } - } - return new SomeArgs(); - } - - public void recycleArgs(SomeArgs args) { - synchronized (mH) { - if (mArgsPoolSize < ARGS_POOL_MAX_SIZE) { - args.next = mArgsPool; - mArgsPool = args; - mArgsPoolSize++; - } - } - } - public void executeOrSendMessage(Message msg) { // If we are calling this from the main thread, then we can call // right through. Otherwise, we need to send the message to the @@ -141,7 +97,7 @@ public Message obtainMessageBO(int what, boolean arg1, Object arg2) { } public Message obtainMessageBOO(int what, boolean arg1, Object arg2, Object arg3) { - SomeArgs args = obtainArgs(); + SomeArgs args = SomeArgs.obtain(); args.arg1 = arg2; args.arg2 = arg3; return mH.obtainMessage(what, arg1 ? 1 : 0, 0, args); @@ -169,28 +125,28 @@ public Message obtainMessageIIO(int what, int arg1, int arg2, Object arg3) { public Message obtainMessageIIOO(int what, int arg1, int arg2, Object arg3, Object arg4) { - SomeArgs args = obtainArgs(); + SomeArgs args = SomeArgs.obtain(); args.arg1 = arg3; args.arg2 = arg4; return mH.obtainMessage(what, arg1, arg2, args); } public Message obtainMessageIOO(int what, int arg1, Object arg2, Object arg3) { - SomeArgs args = obtainArgs(); + SomeArgs args = SomeArgs.obtain(); args.arg1 = arg2; args.arg2 = arg3; return mH.obtainMessage(what, arg1, 0, args); } public Message obtainMessageOO(int what, Object arg1, Object arg2) { - SomeArgs args = obtainArgs(); + SomeArgs args = SomeArgs.obtain(); args.arg1 = arg1; args.arg2 = arg2; return mH.obtainMessage(what, 0, 0, args); } public Message obtainMessageOOO(int what, Object arg1, Object arg2, Object arg3) { - SomeArgs args = obtainArgs(); + SomeArgs args = SomeArgs.obtain(); args.arg1 = arg1; args.arg2 = arg2; args.arg3 = arg3; @@ -199,7 +155,7 @@ public Message obtainMessageOOO(int what, Object arg1, Object arg2, Object arg3) public Message obtainMessageOOOO(int what, Object arg1, Object arg2, Object arg3, Object arg4) { - SomeArgs args = obtainArgs(); + SomeArgs args = SomeArgs.obtain(); args.arg1 = arg1; args.arg2 = arg2; args.arg3 = arg3; @@ -209,7 +165,7 @@ public Message obtainMessageOOOO(int what, Object arg1, Object arg2, public Message obtainMessageIIII(int what, int arg1, int arg2, int arg3, int arg4) { - SomeArgs args = obtainArgs(); + SomeArgs args = SomeArgs.obtain(); args.argi1 = arg1; args.argi2 = arg2; args.argi3 = arg3; @@ -219,7 +175,7 @@ public Message obtainMessageIIII(int what, int arg1, int arg2, public Message obtainMessageIIIIII(int what, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6) { - SomeArgs args = obtainArgs(); + SomeArgs args = SomeArgs.obtain(); args.argi1 = arg1; args.argi2 = arg2; args.argi3 = arg3; @@ -231,7 +187,7 @@ public Message obtainMessageIIIIII(int what, int arg1, int arg2, public Message obtainMessageIIIIO(int what, int arg1, int arg2, int arg3, int arg4, Object arg5) { - SomeArgs args = obtainArgs(); + SomeArgs args = SomeArgs.obtain(); args.arg1 = arg5; args.argi1 = arg1; args.argi2 = arg2; diff --git a/core/java/com/android/internal/os/ProcessStats.java b/core/java/com/android/internal/os/ProcessStats.java index 1923b86b28d87..b1bb8c173a678 100644 --- a/core/java/com/android/internal/os/ProcessStats.java +++ b/core/java/com/android/internal/os/ProcessStats.java @@ -154,7 +154,7 @@ public class ProcessStats { private boolean mFirst = true; - private byte[] mBuffer = new byte[256]; + private byte[] mBuffer = new byte[4096]; /** * The time in microseconds that the CPU has been running at each speed. @@ -556,7 +556,7 @@ public long[] getLastCpuSpeedTimes() { private long[] getCpuSpeedTimes(long[] out) { long[] tempTimes = out; long[] tempSpeeds = mCpuSpeeds; - final int MAX_SPEEDS = 20; + final int MAX_SPEEDS = 60; if (out == null) { tempTimes = new long[MAX_SPEEDS]; // Hopefully no more than that tempSpeeds = new long[MAX_SPEEDS]; diff --git a/core/java/com/android/internal/os/SomeArgs.java b/core/java/com/android/internal/os/SomeArgs.java new file mode 100644 index 0000000000000..88e58dc520da5 --- /dev/null +++ b/core/java/com/android/internal/os/SomeArgs.java @@ -0,0 +1,95 @@ +/* + * 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.internal.os; + +/** + * Helper class for passing more arguments though a message + * and avoiding allocation of a custom class for wrapping the + * arguments. This class maintains a pool of instances and + * it is responsibility of the client to recycle and instance + * once it is no longer used. + */ +public final class SomeArgs { + + private static final int MAX_POOL_SIZE = 10; + + private static SomeArgs sPool; + private static int sPoolSize; + private static Object sPoolLock = new Object(); + + private SomeArgs mNext; + + private boolean mInPool; + + public Object arg1; + public Object arg2; + public Object arg3; + public Object arg4; + public int argi1; + public int argi2; + public int argi3; + public int argi4; + public int argi5; + public int argi6; + + private SomeArgs() { + /* do nothing - reduce visibility */ + } + + public static SomeArgs obtain() { + synchronized (sPoolLock) { + if (sPoolSize > 0) { + SomeArgs args = sPool; + sPool = sPool.mNext; + args.mNext = null; + args.mInPool = false; + sPoolSize--; + return args; + } else { + return new SomeArgs(); + } + } + } + + public void recycle() { + if (mInPool) { + throw new IllegalStateException("Already recycled."); + } + synchronized (sPoolLock) { + clear(); + if (sPoolSize < MAX_POOL_SIZE) { + mNext = sPool; + mInPool = true; + sPool = this; + sPoolSize++; + } + } + } + + private void clear() { + arg1 = null; + arg2 = null; + arg3 = null; + arg4 = null; + argi1 = 0; + argi2 = 0; + argi3 = 0; + argi4 = 0; + argi5 = 0; + argi6 = 0; + } +} diff --git a/core/java/com/android/internal/os/ZygoteConnection.java b/core/java/com/android/internal/os/ZygoteConnection.java index 9af7e96fd7ac9..d24513a3035b1 100644 --- a/core/java/com/android/internal/os/ZygoteConnection.java +++ b/core/java/com/android/internal/os/ZygoteConnection.java @@ -18,8 +18,8 @@ import android.net.Credentials; import android.net.LocalSocket; -import android.os.Build; import android.os.Process; +import android.os.SELinux; import android.os.SystemProperties; import android.util.Log; @@ -73,6 +73,7 @@ class ZygoteConnection { private final DataOutputStream mSocketOutStream; private final BufferedReader mSocketReader; private final Credentials peer; + private final String peerSecurityContext; /** * A long-lived reference to the original command socket used to launch @@ -109,6 +110,8 @@ class ZygoteConnection { Log.e(TAG, "Cannot read peer credentials", ex); throw ex; } + + peerSecurityContext = SELinux.getPeerContext(mSocket.getFileDescriptor()); } /** @@ -207,10 +210,11 @@ boolean runOnce() throws ZygoteInit.MethodAndArgsCaller { try { parsedArgs = new Arguments(args); - applyUidSecurityPolicy(parsedArgs, peer); - applyRlimitSecurityPolicy(parsedArgs, peer); - applyCapabilitiesSecurityPolicy(parsedArgs, peer); - applyInvokeWithSecurityPolicy(parsedArgs, peer); + applyUidSecurityPolicy(parsedArgs, peer, peerSecurityContext); + applyRlimitSecurityPolicy(parsedArgs, peer, peerSecurityContext); + applyCapabilitiesSecurityPolicy(parsedArgs, peer, peerSecurityContext); + applyInvokeWithSecurityPolicy(parsedArgs, peer, peerSecurityContext); + applyseInfoSecurityPolicy(parsedArgs, peer, peerSecurityContext); applyDebuggerSystemProperty(parsedArgs); applyInvokeWithSystemProperty(parsedArgs); @@ -228,8 +232,9 @@ boolean runOnce() throws ZygoteInit.MethodAndArgsCaller { ZygoteInit.setCloseOnExec(serverPipeFd, true); } - pid = Zygote.forkAndSpecialize(parsedArgs.uid, parsedArgs.gid, - parsedArgs.gids, parsedArgs.debugFlags, rlimits); + pid = Zygote.forkAndSpecialize(parsedArgs.uid, parsedArgs.gid, parsedArgs.gids, + parsedArgs.debugFlags, rlimits, parsedArgs.mountExternal, parsedArgs.seInfo, + parsedArgs.niceName); } catch (IOException ex) { logAndPrintError(newStderr, "Exception creating pipe", ex); } catch (ErrnoException ex) { @@ -334,6 +339,9 @@ static class Arguments { */ int debugFlags; + /** From --mount-external */ + int mountExternal = Zygote.MOUNT_EXTERNAL_NONE; + /** from --target-sdk-version. */ int targetSdkVersion; boolean targetSdkVersionSpecified; @@ -352,6 +360,10 @@ static class Arguments { long permittedCapabilities; long effectiveCapabilities; + /** from --seinfo */ + boolean seInfoSpecified; + String seInfo; + /** from all --rlimit=r,c,m */ ArrayList rlimits; @@ -429,6 +441,13 @@ private void parseArgs(String args[]) peerWait = true; } else if (arg.equals("--runtime-init")) { runtimeInit = true; + } else if (arg.startsWith("--seinfo=")) { + if (seInfoSpecified) { + throw new IllegalArgumentException( + "Duplicate arg specified"); + } + seInfoSpecified = true; + seInfo = arg.substring(arg.indexOf('=') + 1); } else if (arg.startsWith("--capabilities=")) { if (capabilitiesSpecified) { throw new IllegalArgumentException( @@ -508,6 +527,10 @@ private void parseArgs(String args[]) "Duplicate arg specified"); } niceName = arg.substring(arg.indexOf('=') + 1); + } else if (arg.equals("--mount-external-multiuser")) { + mountExternal = Zygote.MOUNT_EXTERNAL_MULTIUSER; + } else if (arg.equals("--mount-external-multiuser-all")) { + mountExternal = Zygote.MOUNT_EXTERNAL_MULTIUSER_ALL; } else { break; } @@ -591,7 +614,8 @@ private String[] readArgumentList() * @param peer non-null; peer credentials * @throws ZygoteSecurityException */ - private static void applyUidSecurityPolicy(Arguments args, Credentials peer) + private static void applyUidSecurityPolicy(Arguments args, Credentials peer, + String peerSecurityContext) throws ZygoteSecurityException { int peerUid = peer.getUid(); @@ -624,6 +648,17 @@ private static void applyUidSecurityPolicy(Arguments args, Credentials peer) } } + if (args.uidSpecified || args.gidSpecified || args.gids != null) { + boolean allowed = SELinux.checkSELinuxAccess(peerSecurityContext, + peerSecurityContext, + "zygote", + "specifyids"); + if (!allowed) { + throw new ZygoteSecurityException( + "Peer may not specify uid's or gid's"); + } + } + // If not otherwise specified, uid and gid are inherited from peer if (!args.uidSpecified) { args.uid = peer.getUid(); @@ -664,7 +699,7 @@ public static void applyDebuggerSystemProperty(Arguments args) { * @throws ZygoteSecurityException */ private static void applyRlimitSecurityPolicy( - Arguments args, Credentials peer) + Arguments args, Credentials peer, String peerSecurityContext) throws ZygoteSecurityException { int peerUid = peer.getUid(); @@ -676,6 +711,17 @@ private static void applyRlimitSecurityPolicy( "This UID may not specify rlimits."); } } + + if (args.rlimits != null) { + boolean allowed = SELinux.checkSELinuxAccess(peerSecurityContext, + peerSecurityContext, + "zygote", + "specifyrlimits"); + if (!allowed) { + throw new ZygoteSecurityException( + "Peer may not specify rlimits"); + } + } } /** @@ -689,7 +735,7 @@ private static void applyRlimitSecurityPolicy( * @throws ZygoteSecurityException */ private static void applyCapabilitiesSecurityPolicy( - Arguments args, Credentials peer) + Arguments args, Credentials peer, String peerSecurityContext) throws ZygoteSecurityException { if (args.permittedCapabilities == 0 @@ -698,6 +744,15 @@ private static void applyCapabilitiesSecurityPolicy( return; } + boolean allowed = SELinux.checkSELinuxAccess(peerSecurityContext, + peerSecurityContext, + "zygote", + "specifycapabilities"); + if (!allowed) { + throw new ZygoteSecurityException( + "Peer may not specify capabilities"); + } + if (peer.getUid() == 0) { // root may specify anything return; @@ -747,7 +802,8 @@ private static void applyCapabilitiesSecurityPolicy( * @param peer non-null; peer credentials * @throws ZygoteSecurityException */ - private static void applyInvokeWithSecurityPolicy(Arguments args, Credentials peer) + private static void applyInvokeWithSecurityPolicy(Arguments args, Credentials peer, + String peerSecurityContext) throws ZygoteSecurityException { int peerUid = peer.getUid(); @@ -755,6 +811,52 @@ private static void applyInvokeWithSecurityPolicy(Arguments args, Credentials pe throw new ZygoteSecurityException("Peer is not permitted to specify " + "an explicit invoke-with wrapper command"); } + + if (args.invokeWith != null) { + boolean allowed = SELinux.checkSELinuxAccess(peerSecurityContext, + peerSecurityContext, + "zygote", + "specifyinvokewith"); + if (!allowed) { + throw new ZygoteSecurityException("Peer is not permitted to specify " + + "an explicit invoke-with wrapper command"); + } + } + } + + /** + * Applies zygote security policy for SEAndroid information. + * + * @param args non-null; zygote spawner arguments + * @param peer non-null; peer credentials + * @throws ZygoteSecurityException + */ + private static void applyseInfoSecurityPolicy( + Arguments args, Credentials peer, String peerSecurityContext) + throws ZygoteSecurityException { + int peerUid = peer.getUid(); + + if (args.seInfo == null) { + // nothing to check + return; + } + + if (!(peerUid == 0 || peerUid == Process.SYSTEM_UID)) { + // All peers with UID other than root or SYSTEM_UID + throw new ZygoteSecurityException( + "This UID may not specify SEAndroid info."); + } + + boolean allowed = SELinux.checkSELinuxAccess(peerSecurityContext, + peerSecurityContext, + "zygote", + "specifyseinfo"); + if (!allowed) { + throw new ZygoteSecurityException( + "Peer may not specify SEAndroid info"); + } + + return; } /** diff --git a/core/java/com/android/internal/os/ZygoteInit.java b/core/java/com/android/internal/os/ZygoteInit.java index 998c037fc23a9..4597a541290ec 100644 --- a/core/java/com/android/internal/os/ZygoteInit.java +++ b/core/java/com/android/internal/os/ZygoteInit.java @@ -16,16 +16,17 @@ package com.android.internal.os; +import static libcore.io.OsConstants.S_IRWXG; +import static libcore.io.OsConstants.S_IRWXO; + import android.content.pm.ActivityInfo; import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.drawable.Drawable; import android.net.LocalServerSocket; import android.os.Debug; -import android.os.FileUtils; import android.os.Process; import android.os.SystemClock; -import android.os.SystemProperties; import android.util.EventLog; import android.util.Log; @@ -33,6 +34,7 @@ import dalvik.system.Zygote; import libcore.io.IoUtils; +import libcore.io.Libcore; import java.io.BufferedReader; import java.io.FileDescriptor; @@ -97,7 +99,7 @@ public class ZygoteInit { private static final String PRELOADED_CLASSES = "preloaded-classes"; /** Controls whether we should preload resources during zygote init. */ - private static final boolean PRELOAD_RESOURCES = true; + private static final boolean PRELOAD_RESOURCES = false; /** * Invokes a static "main(argv[]) method on class "className". @@ -359,6 +361,8 @@ private static void preloadResources() { ar.recycle(); Log.i(TAG, "...preloaded " + N + " resources in " + (SystemClock.uptimeMillis()-startTime) + "ms."); + } else { + Log.i(TAG, "Preload resources disabled, skipped."); } mResources.finishPreloading(); } catch (RuntimeException e) { @@ -384,7 +388,12 @@ private static int preloadColorStateLists(VMRuntime runtime, TypedArray ar) { Log.v(TAG, "Preloading resource #" + Integer.toHexString(id)); } if (id != 0) { - mResources.getColorStateList(id); + if (mResources.getColorStateList(id) == null) { + throw new IllegalArgumentException( + "Unable to find preloaded color resource #0x" + + Integer.toHexString(id) + + " (" + ar.getString(i) + ")"); + } } } return N; @@ -407,11 +416,11 @@ private static int preloadDrawables(VMRuntime runtime, TypedArray ar) { Log.v(TAG, "Preloading resource #" + Integer.toHexString(id)); } if (id != 0) { - Drawable dr = mResources.getDrawable(id); - if ((dr.getChangingConfigurations()&~ActivityInfo.CONFIG_FONT_SCALE) != 0) { - Log.w(TAG, "Preloaded drawable resource #0x" + if (mResources.getDrawable(id) == null) { + throw new IllegalArgumentException( + "Unable to find preloaded drawable resource #0x" + Integer.toHexString(id) - + " (" + ar.getString(i) + ") that varies with configuration!!"); + + " (" + ar.getString(i) + ")"); } } } @@ -447,7 +456,7 @@ private static void handleSystemServerProcess( closeServerSocket(); // set umask to 0077 so new files and directories will default to owner-only permissions. - FileUtils.setUMask(FileUtils.S_IRWXG | FileUtils.S_IRWXO); + Libcore.os.umask(S_IRWXG | S_IRWXO); if (parsedArgs.niceName != null) { Process.setArgV0(parsedArgs.niceName); diff --git a/core/java/com/android/internal/os/storage/ExternalStorageFormatter.java b/core/java/com/android/internal/os/storage/ExternalStorageFormatter.java index 3905c88ac2825..fb7f215607563 100644 --- a/core/java/com/android/internal/os/storage/ExternalStorageFormatter.java +++ b/core/java/com/android/internal/os/storage/ExternalStorageFormatter.java @@ -122,7 +122,7 @@ public IBinder onBind(Intent intent) { public void onCancel(DialogInterface dialog) { IMountService mountService = getMountService(); String extStoragePath = mStorageVolume == null ? - Environment.getExternalStorageDirectory().toString() : + Environment.getLegacyExternalStorageDirectory().toString() : mStorageVolume.getPath(); try { mountService.mountVolume(extStoragePath); @@ -149,7 +149,7 @@ void updateProgressState() { updateProgressDialog(R.string.progress_unmounting); IMountService mountService = getMountService(); final String extStoragePath = mStorageVolume == null ? - Environment.getExternalStorageDirectory().toString() : + Environment.getLegacyExternalStorageDirectory().toString() : mStorageVolume.getPath(); try { // Remove encryption mapping if this is an unmount for a factory reset. @@ -163,7 +163,7 @@ void updateProgressState() { updateProgressDialog(R.string.progress_erasing); final IMountService mountService = getMountService(); final String extStoragePath = mStorageVolume == null ? - Environment.getExternalStorageDirectory().toString() : + Environment.getLegacyExternalStorageDirectory().toString() : mStorageVolume.getPath(); if (mountService != null) { new Thread() { diff --git a/core/java/com/android/internal/policy/IFaceLockCallback.aidl b/core/java/com/android/internal/policy/IFaceLockCallback.aidl index eb902fd3989c6..280e4d5412ecb 100644 --- a/core/java/com/android/internal/policy/IFaceLockCallback.aidl +++ b/core/java/com/android/internal/policy/IFaceLockCallback.aidl @@ -22,6 +22,5 @@ oneway interface IFaceLockCallback { void unlock(); void cancel(); void reportFailedAttempt(); - void exposeFallback(); void pokeWakelock(int millis); } diff --git a/core/java/com/android/internal/statusbar/IStatusBar.aidl b/core/java/com/android/internal/statusbar/IStatusBar.aidl index 294d4c44028cb..780f5b3504dde 100644 --- a/core/java/com/android/internal/statusbar/IStatusBar.aidl +++ b/core/java/com/android/internal/statusbar/IStatusBar.aidl @@ -28,8 +28,9 @@ oneway interface IStatusBar void updateNotification(IBinder key, in StatusBarNotification notification); void removeNotification(IBinder key); void disable(int state); - void animateExpand(); - void animateCollapse(); + void animateExpandNotificationsPanel(); + void animateExpandSettingsPanel(); + void animateCollapsePanels(); void setSystemUiVisibility(int vis, int mask); void topAppWindowChanged(boolean menuVisible); void setImeWindowStatus(in IBinder token, int vis, int backDisposition); diff --git a/core/java/com/android/internal/statusbar/IStatusBarService.aidl b/core/java/com/android/internal/statusbar/IStatusBarService.aidl index c64f1700d2571..04e5bc97d39c4 100644 --- a/core/java/com/android/internal/statusbar/IStatusBarService.aidl +++ b/core/java/com/android/internal/statusbar/IStatusBarService.aidl @@ -24,14 +24,16 @@ import com.android.internal.statusbar.StatusBarNotification; /** @hide */ interface IStatusBarService { - void expand(); - void collapse(); + void expandNotificationsPanel(); + void collapsePanels(); void disable(int what, IBinder token, String pkg); void setIcon(String slot, String iconPackage, int iconId, int iconLevel, String contentDescription); void setIconVisibility(String slot, boolean visible); void removeIcon(String slot); void topAppWindowChanged(boolean menuVisible); void setImeWindowStatus(in IBinder token, int vis, int backDisposition); + void expandSettingsPanel(); + void setCurrentUser(int newUserId); // ---- Methods below are for use by the status bar policy services ---- // You need the STATUS_BAR_SERVICE permission diff --git a/core/java/com/android/internal/statusbar/StatusBarIcon.java b/core/java/com/android/internal/statusbar/StatusBarIcon.java index 3333c822edaa2..e0792cb376461 100644 --- a/core/java/com/android/internal/statusbar/StatusBarIcon.java +++ b/core/java/com/android/internal/statusbar/StatusBarIcon.java @@ -18,18 +18,21 @@ import android.os.Parcel; import android.os.Parcelable; +import android.os.UserHandle; public class StatusBarIcon implements Parcelable { public String iconPackage; + public UserHandle user; public int iconId; public int iconLevel; public boolean visible = true; public int number; public CharSequence contentDescription; - public StatusBarIcon(String iconPackage, int iconId, int iconLevel, int number, + public StatusBarIcon(String iconPackage, UserHandle user, int iconId, int iconLevel, int number, CharSequence contentDescription) { this.iconPackage = iconPackage; + this.user = user; this.iconId = iconId; this.iconLevel = iconLevel; this.number = number; @@ -38,15 +41,16 @@ public StatusBarIcon(String iconPackage, int iconId, int iconLevel, int number, @Override public String toString() { - return "StatusBarIcon(pkg=" + this.iconPackage + " id=0x" + Integer.toHexString(this.iconId) + return "StatusBarIcon(pkg=" + this.iconPackage + "user=" + user.getIdentifier() + + " id=0x" + Integer.toHexString(this.iconId) + " level=" + this.iconLevel + " visible=" + visible + " num=" + this.number + " )"; } @Override public StatusBarIcon clone() { - StatusBarIcon that = new StatusBarIcon(this.iconPackage, this.iconId, this.iconLevel, - this.number, this.contentDescription); + StatusBarIcon that = new StatusBarIcon(this.iconPackage, this.user, this.iconId, + this.iconLevel, this.number, this.contentDescription); that.visible = this.visible; return that; } @@ -60,6 +64,7 @@ public StatusBarIcon(Parcel in) { public void readFromParcel(Parcel in) { this.iconPackage = in.readString(); + this.user = (UserHandle) in.readParcelable(null); this.iconId = in.readInt(); this.iconLevel = in.readInt(); this.visible = in.readInt() != 0; @@ -69,6 +74,7 @@ public void readFromParcel(Parcel in) { public void writeToParcel(Parcel out, int flags) { out.writeString(this.iconPackage); + out.writeParcelable(this.user, 0); out.writeInt(this.iconId); out.writeInt(this.iconLevel); out.writeInt(this.visible ? 1 : 0); diff --git a/core/java/com/android/internal/statusbar/StatusBarNotification.java b/core/java/com/android/internal/statusbar/StatusBarNotification.java index d443523a2c124..a91aa3cc8132b 100644 --- a/core/java/com/android/internal/statusbar/StatusBarNotification.java +++ b/core/java/com/android/internal/statusbar/StatusBarNotification.java @@ -19,8 +19,7 @@ import android.app.Notification; import android.os.Parcel; import android.os.Parcelable; -import android.widget.RemoteViews; - +import android.os.UserHandle; /* boolean clearable = !n.ongoingEvent && ((notification.flags & Notification.FLAG_NO_CLEAR) == 0); @@ -38,19 +37,26 @@ * Class encapsulating a Notification. Sent by the NotificationManagerService to the IStatusBar (in System UI). */ public class StatusBarNotification implements Parcelable { - public String pkg; - public int id; - public String tag; - public int uid; - public int initialPid; - public Notification notification; - public int score; - - public StatusBarNotification() { + public final String pkg; + public final int id; + public final String tag; + public final int uid; + public final int initialPid; + // TODO: make this field private and move callers to an accessor that + // ensures sourceUser is applied. + public final Notification notification; + public final int score; + public final UserHandle user; + + /** This is temporarily needed for the JB MR1 PDK. */ + @Deprecated + public StatusBarNotification(String pkg, int id, String tag, int uid, int initialPid, int score, + Notification notification) { + this(pkg, id, tag, uid, initialPid, score, notification, UserHandle.OWNER); } - public StatusBarNotification(String pkg, int id, String tag, - int uid, int initialPid, int score, Notification notification) { + public StatusBarNotification(String pkg, int id, String tag, int uid, int initialPid, int score, + Notification notification, UserHandle user) { if (pkg == null) throw new NullPointerException(); if (notification == null) throw new NullPointerException(); @@ -61,13 +67,11 @@ public StatusBarNotification(String pkg, int id, String tag, this.initialPid = initialPid; this.score = score; this.notification = notification; + this.user = user; + this.notification.setUser(user); } public StatusBarNotification(Parcel in) { - readFromParcel(in); - } - - public void readFromParcel(Parcel in) { this.pkg = in.readString(); this.id = in.readInt(); if (in.readInt() != 0) { @@ -79,6 +83,8 @@ public void readFromParcel(Parcel in) { this.initialPid = in.readInt(); this.score = in.readInt(); this.notification = new Notification(in); + this.user = UserHandle.readFromParcel(in); + this.notification.setUser(user); } public void writeToParcel(Parcel out, int flags) { @@ -94,6 +100,7 @@ public void writeToParcel(Parcel out, int flags) { out.writeInt(this.initialPid); out.writeInt(this.score); this.notification.writeToParcel(out, flags); + user.writeToParcel(out, flags); } public int describeContents() { @@ -114,14 +121,16 @@ public StatusBarNotification[] newArray(int size) } }; + @Override public StatusBarNotification clone() { - return new StatusBarNotification(this.pkg, this.id, this.tag, - this.uid, this.initialPid, this.score, this.notification.clone()); + return new StatusBarNotification(this.pkg, this.id, this.tag, this.uid, this.initialPid, + this.score, this.notification.clone(), this.user); } + @Override public String toString() { - return "StatusBarNotification(pkg=" + pkg + " id=" + id + " tag=" + tag - + " score=" + score + " notn=" + notification + ")"; + return "StatusBarNotification(pkg=" + pkg + " id=" + id + " tag=" + tag + " score=" + score + + " notn=" + notification + " user=" + user + ")"; } public boolean isOngoing() { @@ -132,6 +141,9 @@ public boolean isClearable() { return ((notification.flags & Notification.FLAG_ONGOING_EVENT) == 0) && ((notification.flags & Notification.FLAG_NO_CLEAR) == 0); } -} - + /** Returns a userHandle for the instance of the app that posted this notification. */ + public int getUserId() { + return this.user.getIdentifier(); + } +} diff --git a/core/java/com/android/internal/util/AsyncChannel.java b/core/java/com/android/internal/util/AsyncChannel.java index d1c2d2ebf800e..5093b4da1ca6c 100644 --- a/core/java/com/android/internal/util/AsyncChannel.java +++ b/core/java/com/android/internal/util/AsyncChannel.java @@ -444,6 +444,16 @@ public void disconnect() { if ((mConnection != null) && (mSrcContext != null)) { mSrcContext.unbindService(mConnection); } + try { + // Send the DISCONNECTED, although it may not be received + // but its the best we can do. + Message msg = Message.obtain(); + msg.what = CMD_CHANNEL_DISCONNECTED; + msg.replyTo = mSrcMessenger; + mDstMessenger.send(msg); + } catch(Exception e) { + } + // Tell source we're disconnected. if (mSrcHandler != null) { replyDisconnected(STATUS_SUCCESSFUL); } diff --git a/core/java/com/android/internal/util/DumpUtils.java b/core/java/com/android/internal/util/DumpUtils.java new file mode 100644 index 0000000000000..7b8c582d4c610 --- /dev/null +++ b/core/java/com/android/internal/util/DumpUtils.java @@ -0,0 +1,57 @@ +/* + * 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.internal.util; + +import android.os.Handler; + +import java.io.PrintWriter; +import java.io.StringWriter; + +/** + * Helper functions for dumping the state of system services. + */ +public final class DumpUtils { + private DumpUtils() { + } + + /** + * Helper for dumping state owned by a handler thread. + * + * Because the caller might be holding an important lock that the handler is + * trying to acquire, we use a short timeout to avoid deadlocks. The process + * is inelegant but this function is only used for debugging purposes. + */ + public static void dumpAsync(Handler handler, final Dump dump, PrintWriter pw, long timeout) { + final StringWriter sw = new StringWriter(); + if (handler.runWithScissors(new Runnable() { + @Override + public void run() { + PrintWriter lpw = new PrintWriter(sw); + dump.dump(lpw); + lpw.close(); + } + }, timeout)) { + pw.print(sw.toString()); + } else { + pw.println("... timed out"); + } + } + + public interface Dump { + void dump(PrintWriter pw); + } +} diff --git a/core/java/com/android/internal/util/IndentingPrintWriter.java b/core/java/com/android/internal/util/IndentingPrintWriter.java index 699e9b3053c59..dd5918b966dc8 100644 --- a/core/java/com/android/internal/util/IndentingPrintWriter.java +++ b/core/java/com/android/internal/util/IndentingPrintWriter.java @@ -28,7 +28,7 @@ public class IndentingPrintWriter extends PrintWriter { private final String mIndent; private StringBuilder mBuilder = new StringBuilder(); - private String mCurrent = new String(); + private char[] mCurrent; private boolean mEmptyLine = true; public IndentingPrintWriter(Writer writer, String indent) { @@ -38,12 +38,12 @@ public IndentingPrintWriter(Writer writer, String indent) { public void increaseIndent() { mBuilder.append(mIndent); - mCurrent = mBuilder.toString(); + mCurrent = null; } public void decreaseIndent() { mBuilder.delete(0, mIndent.length()); - mCurrent = mBuilder.toString(); + mCurrent = null; } public void printPair(String key, Object value) { @@ -51,17 +51,35 @@ public void printPair(String key, Object value) { } @Override - public void println() { - super.println(); - mEmptyLine = true; + public void write(char[] buf, int offset, int count) { + final int bufferEnd = offset + count; + int lineStart = offset; + int lineEnd = offset; + while (lineEnd < bufferEnd) { + char ch = buf[lineEnd++]; + if (ch == '\n') { + writeIndent(); + super.write(buf, lineStart, lineEnd - lineStart); + lineStart = lineEnd; + mEmptyLine = true; + } + } + + if (lineStart != lineEnd) { + writeIndent(); + super.write(buf, lineStart, lineEnd - lineStart); + } } - @Override - public void write(char[] buf, int offset, int count) { + private void writeIndent() { if (mEmptyLine) { mEmptyLine = false; - super.print(mCurrent); + if (mBuilder.length() != 0) { + if (mCurrent == null) { + mCurrent = mBuilder.toString().toCharArray(); + } + super.write(mCurrent, 0, mCurrent.length); + } } - super.write(buf, offset, count); } } diff --git a/core/java/com/android/internal/util/JournaledFile.java b/core/java/com/android/internal/util/JournaledFile.java index af0c6c6fd32ad..eeffc1622f489 100644 --- a/core/java/com/android/internal/util/JournaledFile.java +++ b/core/java/com/android/internal/util/JournaledFile.java @@ -19,6 +19,15 @@ import java.io.File; import java.io.IOException; +/** + * @Deprecated Use {@link com.android.internal.os.AtomicFile} instead. It would + * be nice to update all existing uses of this to switch to AtomicFile, but since + * their on-file semantics are slightly different that would run the risk of losing + * data if at the point of the platform upgrade to the new code it would need to + * roll back to the backup file. This can be solved... but is it worth it and + * all of the testing needed to make sure it is correct? + */ +@Deprecated public class JournaledFile { File mReal; File mTemp; diff --git a/core/java/com/android/internal/util/Preconditions.java b/core/java/com/android/internal/util/Preconditions.java index a53a9c0c6eb69..a327adc7a431e 100644 --- a/core/java/com/android/internal/util/Preconditions.java +++ b/core/java/com/android/internal/util/Preconditions.java @@ -54,4 +54,16 @@ public static T checkNotNull(T reference, Object errorMessage) { return reference; } + /** + * Ensures the truth of an expression involving the state of the calling + * instance, but not involving any parameters to the calling method. + * + * @param expression a boolean expression + * @throws IllegalStateException if {@code expression} is false + */ + public static void checkState(boolean expression) { + if (!expression) { + throw new IllegalStateException(); + } + } } diff --git a/core/java/com/android/internal/util/StateMachine.java b/core/java/com/android/internal/util/StateMachine.java index 1391ac3940475..0ea7b832183bd 100644 --- a/core/java/com/android/internal/util/StateMachine.java +++ b/core/java/com/android/internal/util/StateMachine.java @@ -80,9 +80,9 @@ * and invoke halting. Any message subsequently received by the state * machine will cause haltedProcessMessage to be invoked.

          * - *

          If it is desirable to completely stop the state machine call quit. This - * will exit the current state and its parent and then exit from the controlling thread - * and no further messages will be processed.

          + *

          If it is desirable to completely stop the state machine call quit or + * abort. These will call exit of the current state and its parents, call + * onQuiting and then exit Thread/Loopers.

          * *

          In addition to processMessage each State has * an enter method and exit method which may be overridden.

          @@ -362,7 +362,7 @@ class P2 extends State { } @Override - void halting() { + void onHalting() { Log.d(TAG, "halting"); synchronized (this) { this.notifyAll(); @@ -423,10 +423,10 @@ public class StateMachine { private String mName; /** Message.what value when quitting */ - public static final int SM_QUIT_CMD = -1; + private static final int SM_QUIT_CMD = -1; /** Message.what value when initializing */ - public static final int SM_INIT_CMD = -2; + private static final int SM_INIT_CMD = -2; /** * Convenience constant that maybe returned by processMessage @@ -443,11 +443,10 @@ public class StateMachine { public static final boolean NOT_HANDLED = false; /** + * StateMachine logging record. * {@hide} - * - * The information maintained for a processed message. */ - public static class ProcessedMessageInfo { + public static class LogRec { private long mTime; private int mWhat; private String mInfo; @@ -456,12 +455,13 @@ public static class ProcessedMessageInfo { /** * Constructor - * @param message + * + * @param msg * @param state that handled the message * @param orgState is the first state the received the message but * did not processes the message. */ - ProcessedMessageInfo(Message msg, String info, State state, State orgState) { + LogRec(Message msg, String info, State state, State orgState) { update(msg, info, state, orgState); } @@ -473,7 +473,7 @@ public static class ProcessedMessageInfo { */ public void update(Message msg, String info, State state, State orgState) { mTime = System.currentTimeMillis(); - mWhat = msg.what; + mWhat = (msg != null) ? msg.what : 0; mInfo = info; mState = state; mOrgState = orgState; @@ -517,8 +517,7 @@ public State getOriginalState() { /** * @return as string */ - @Override - public String toString() { + public String toString(StateMachine sm) { StringBuilder sb = new StringBuilder(); sb.append("time="); Calendar c = Calendar.getInstance(); @@ -529,10 +528,15 @@ public String toString() { sb.append(" orgState="); sb.append(mOrgState == null ? "" : mOrgState.getName()); sb.append(" what="); - sb.append(mWhat); - sb.append("(0x"); - sb.append(Integer.toHexString(mWhat)); - sb.append(")"); + String what = sm.getWhatToString(mWhat); + if (TextUtils.isEmpty(what)) { + sb.append(mWhat); + sb.append("(0x"); + sb.append(Integer.toHexString(mWhat)); + sb.append(")"); + } else { + sb.append(what); + } if ( ! TextUtils.isEmpty(mInfo)) { sb.append(" "); sb.append(mInfo); @@ -542,21 +546,21 @@ public String toString() { } /** - * A list of messages recently processed by the state machine. + * A list of log records including messages recently processed by the state machine. * - * The class maintains a list of messages that have been most + * The class maintains a list of log records including messages * recently processed. The list is finite and may be set in the * constructor or by calling setSize. The public interface also - * includes size which returns the number of recent messages, - * count which is the number of message processed since the - * the last setSize, get which returns a processed message and - * add which adds a processed messaged. + * includes size which returns the number of recent records, + * count which is the number of records processed since the + * the last setSize, get which returns a record and + * add which adds a record. */ - private static class ProcessedMessages { + private static class LogRecords { private static final int DEFAULT_SIZE = 20; - private Vector mMessages = new Vector(); + private Vector mLogRecords = new Vector(); private int mMaxSize = DEFAULT_SIZE; private int mOldestIndex = 0; private int mCount = 0; @@ -564,39 +568,39 @@ private static class ProcessedMessages { /** * private constructor use add */ - private ProcessedMessages() { + private LogRecords() { } /** - * Set size of messages to maintain and clears all current messages. + * Set size of messages to maintain and clears all current records. * - * @param maxSize number of messages to maintain at anyone time. + * @param maxSize number of records to maintain at anyone time. */ - void setSize(int maxSize) { + synchronized void setSize(int maxSize) { mMaxSize = maxSize; mCount = 0; - mMessages.clear(); + mLogRecords.clear(); } /** - * @return the number of recent messages. + * @return the number of recent records. */ - int size() { - return mMessages.size(); + synchronized int size() { + return mLogRecords.size(); } /** - * @return the total number of messages processed since size was set. + * @return the total number of records processed since size was set. */ - int count() { + synchronized int count() { return mCount; } /** - * Clear the list of Processed Message Info. + * Clear the list of records. */ - void cleanup() { - mMessages.clear(); + synchronized void cleanup() { + mLogRecords.clear(); } /** @@ -604,7 +608,7 @@ void cleanup() { * record and size()-1 is the newest record. If the index is to * large null is returned. */ - ProcessedMessageInfo get(int index) { + synchronized LogRec get(int index) { int nextIndex = mOldestIndex + index; if (nextIndex >= mMaxSize) { nextIndex -= mMaxSize; @@ -612,7 +616,7 @@ ProcessedMessageInfo get(int index) { if (nextIndex >= size()) { return null; } else { - return mMessages.get(nextIndex); + return mLogRecords.get(nextIndex); } } @@ -625,12 +629,12 @@ ProcessedMessageInfo get(int index) { * @param orgState is the first state the received the message but * did not processes the message. */ - void add(Message msg, String messageInfo, State state, State orgState) { + synchronized void add(Message msg, String messageInfo, State state, State orgState) { mCount += 1; - if (mMessages.size() < mMaxSize) { - mMessages.add(new ProcessedMessageInfo(msg, messageInfo, state, orgState)); + if (mLogRecords.size() < mMaxSize) { + mLogRecords.add(new LogRec(msg, messageInfo, state, orgState)); } else { - ProcessedMessageInfo pmi = mMessages.get(mOldestIndex); + LogRec pmi = mLogRecords.get(mOldestIndex); mOldestIndex += 1; if (mOldestIndex >= mMaxSize) { mOldestIndex = 0; @@ -652,8 +656,8 @@ private static class SmHandler extends Handler { /** The current message */ private Message mMsg; - /** A list of messages that this state machine has processed */ - private ProcessedMessages mProcessedMessages = new ProcessedMessages(); + /** A list of log records including messages this state machine has processed */ + private LogRecords mLogRecords = new LogRecords(); /** true if construction of the state machine has not been completed */ private boolean mIsConstructionCompleted; @@ -814,15 +818,18 @@ private void performTransitions() { */ if (destState != null) { if (destState == mQuittingState) { + /** + * Call onQuitting to let subclasses cleanup. + */ + mSm.onQuitting(); cleanupAfterQuitting(); - } else if (destState == mHaltingState) { /** - * Call halting() if we've transitioned to the halting + * Call onHalting() if we've transitioned to the halting * state. All subsequent messages will be processed in * in the halting state which invokes haltedProcessMessage(msg); */ - mSm.halting(); + mSm.onHalting(); } } } @@ -831,7 +838,6 @@ private void performTransitions() { * Cleanup all the static variables and the looper after the SM has been quit. */ private final void cleanupAfterQuitting() { - mSm.quitting(); if (mSm.mSmThread != null) { // If we made the thread then quit looper which stops the thread. getLooper().quit(); @@ -841,7 +847,7 @@ private final void cleanupAfterQuitting() { mSm.mSmHandler = null; mSm = null; mMsg = null; - mProcessedMessages.cleanup(); + mLogRecords.cleanup(); mStateStack = null; mTempStateStack = null; mStateInfo.clear(); @@ -892,36 +898,38 @@ private final void processMsg(Message msg) { if (mDbg) { Log.d(TAG, "processMsg: " + curStateInfo.state.getName()); } - while (!curStateInfo.state.processMessage(msg)) { - /** - * Not processed - */ - curStateInfo = curStateInfo.parentStateInfo; - if (curStateInfo == null) { + + if (isQuit(msg)) { + transitionTo(mQuittingState); + } else { + while (!curStateInfo.state.processMessage(msg)) { /** - * No parents left so it's not handled + * Not processed */ - mSm.unhandledMessage(msg); - if (isQuit(msg)) { - transitionTo(mQuittingState); + curStateInfo = curStateInfo.parentStateInfo; + if (curStateInfo == null) { + /** + * No parents left so it's not handled + */ + mSm.unhandledMessage(msg); + break; + } + if (mDbg) { + Log.d(TAG, "processMsg: " + curStateInfo.state.getName()); } - break; - } - if (mDbg) { - Log.d(TAG, "processMsg: " + curStateInfo.state.getName()); } - } - /** - * Record that we processed the message - */ - if (mSm.recordProcessedMessage(msg)) { - if (curStateInfo != null) { - State orgState = mStateStack[mStateStackTopIndex].state; - mProcessedMessages.add(msg, mSm.getMessageInfo(msg), curStateInfo.state, - orgState); - } else { - mProcessedMessages.add(msg, mSm.getMessageInfo(msg), null, null); + /** + * Record that we processed the message + */ + if (mSm.recordLogRec(msg)) { + if (curStateInfo != null) { + State orgState = mStateStack[mStateStackTopIndex].state; + mLogRecords.add(msg, mSm.getLogRecString(msg), curStateInfo.state, + orgState); + } else { + mLogRecords.add(msg, mSm.getLogRecString(msg), null, null); + } } } } @@ -1141,13 +1149,19 @@ private final void deferMessage(Message msg) { mDeferredMessages.add(newMsg); } - /** @see StateMachine#deferMessage(Message) */ + /** @see StateMachine#quit() */ private final void quit() { if (mDbg) Log.d(TAG, "quit:"); sendMessage(obtainMessage(SM_QUIT_CMD, mSmHandlerObj)); } - /** @see StateMachine#isQuit(Message) */ + /** @see StateMachine#quitNow() */ + private final void quitNow() { + if (mDbg) Log.d(TAG, "abort:"); + sendMessageAtFrontOfQueue(obtainMessage(SM_QUIT_CMD, mSmHandlerObj)); + } + + /** Validate that the message was sent by quit or abort. */ private final boolean isQuit(Message msg) { return (msg.what == SM_QUIT_CMD) && (msg.obj == mSmHandlerObj); } @@ -1162,26 +1176,6 @@ private final void setDbg(boolean dbg) { mDbg = dbg; } - /** @see StateMachine#setProcessedMessagesSize(int) */ - private final void setProcessedMessagesSize(int maxSize) { - mProcessedMessages.setSize(maxSize); - } - - /** @see StateMachine#getProcessedMessagesSize() */ - private final int getProcessedMessagesSize() { - return mProcessedMessages.size(); - } - - /** @see StateMachine#getProcessedMessagesCount() */ - private final int getProcessedMessagesCount() { - return mProcessedMessages.count(); - } - - /** @see StateMachine#getProcessedMessageInfo(int) */ - private final ProcessedMessageInfo getProcessedMessageInfo(int index) { - return mProcessedMessages.get(index); - } - } private SmHandler mSmHandler; @@ -1282,8 +1276,8 @@ protected final void transitionTo(IState destState) { /** * transition to halt state. Upon returning * from processMessage we will exit all current - * states, execute the halting() method and then - * all subsequent messages haltedProcessMesage + * states, execute the onHalting() method and then + * for all subsequent messages haltedProcessMessage * will be called. */ protected final void transitionToHaltingState() { @@ -1303,7 +1297,6 @@ protected final void deferMessage(Message msg) { mSmHandler.deferMessage(msg); } - /** * Called when message wasn't handled * @@ -1325,7 +1318,7 @@ protected void haltedProcessMessage(Message msg) { * transitionToHalting. All subsequent messages will invoke * {@link StateMachine#haltedProcessMessage(Message)} */ - protected void halting() { + protected void onHalting() { } /** @@ -1334,7 +1327,7 @@ protected void halting() { * ignored. In addition, if this StateMachine created the thread, the thread will * be stopped after this method returns. */ - protected void quitting() { + protected void onQuitting() { } /** @@ -1345,33 +1338,77 @@ public final String getName() { } /** - * Set size of messages to maintain and clears all current messages. + * Set number of log records to maintain and clears all current records. * * @param maxSize number of messages to maintain at anyone time. */ - public final void setProcessedMessagesSize(int maxSize) { - mSmHandler.setProcessedMessagesSize(maxSize); + public final void setLogRecSize(int maxSize) { + mSmHandler.mLogRecords.setSize(maxSize); + } + + /** + * @return number of log records + */ + public final int getLogRecSize() { + return mSmHandler.mLogRecords.size(); + } + + /** + * @return the total number of records processed + */ + public final int getLogRecCount() { + return mSmHandler.mLogRecords.count(); + } + + /** + * @return a log record + */ + public final LogRec getLogRec(int index) { + return mSmHandler.mLogRecords.get(index); + } + + /** + * Add the string to LogRecords. + * + * @param string + */ + protected void addLogRec(String string) { + mSmHandler.mLogRecords.add(null, string, null, null); } /** - * @return number of messages processed + * Add the string and state to LogRecords + * + * @param string + * @param state current state */ - public final int getProcessedMessagesSize() { - return mSmHandler.getProcessedMessagesSize(); + protected void addLogRec(String string, State state) { + mSmHandler.mLogRecords.add(null, string, state, null); } /** - * @return the total number of messages processed + * @return true if msg should be saved in the log, default is true. */ - public final int getProcessedMessagesCount() { - return mSmHandler.getProcessedMessagesCount(); + protected boolean recordLogRec(Message msg) { + return true; } /** - * @return a processed message information + * Return a string to be logged by LogRec, default + * is an empty string. Override if additional information is desired. + * + * @param msg that was processed + * @return information to be logged as a String */ - public final ProcessedMessageInfo getProcessedMessageInfo(int index) { - return mSmHandler.getProcessedMessageInfo(index); + protected String getLogRecString(Message msg) { + return ""; + } + + /** + * @return the string for msg.what + */ + protected String getWhatToString(int what) { + return null; } /** @@ -1548,43 +1585,23 @@ protected final void removeMessages(int what) { } /** - * Conditionally quit the looper and stop execution. - * - * This sends the SM_QUIT_MSG to the state machine and - * if not handled by any state's processMessage then the - * state machine will be stopped and no further messages - * will be processed. + * Quit the state machine after all currently queued up messages are processed. */ - public final void quit() { - // mSmHandler can be null if the state machine has quit. + protected final void quit() { + // mSmHandler can be null if the state machine is already stopped. if (mSmHandler == null) return; mSmHandler.quit(); } /** - * @return ture if msg is quit + * Quit the state machine immediately all currently queued messages will be discarded. */ - protected final boolean isQuit(Message msg) { - return mSmHandler.isQuit(msg); - } - - /** - * @return true if msg should be saved in ProcessedMessage, default is true. - */ - protected boolean recordProcessedMessage(Message msg) { - return true; - } + protected final void quitNow() { + // mSmHandler can be null if the state machine is already stopped. + if (mSmHandler == null) return; - /** - * Return message info to be logged by ProcessedMessageInfo, default - * is an empty string. Override if additional information is desired. - * - * @param msg that was processed - * @return information to be logged as a String - */ - protected String getMessageInfo(Message msg) { - return ""; + mSmHandler.quitNow(); } /** @@ -1629,9 +1646,9 @@ public void start() { */ public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { pw.println(getName() + ":"); - pw.println(" total messages=" + getProcessedMessagesCount()); - for (int i=0; i < getProcessedMessagesSize(); i++) { - pw.printf(" msg[%d]: %s\n", i, getProcessedMessageInfo(i)); + pw.println(" total records=" + getLogRecCount()); + for (int i=0; i < getLogRecSize(); i++) { + pw.printf(" rec[%d]: %s\n", i, getLogRec(i).toString(this)); pw.flush(); } pw.println("curState=" + getCurrentState().getName()); diff --git a/core/java/com/android/internal/view/BaseIWindow.java b/core/java/com/android/internal/view/BaseIWindow.java index 4c34d73307d04..b76e89dbdc94d 100644 --- a/core/java/com/android/internal/view/BaseIWindow.java +++ b/core/java/com/android/internal/view/BaseIWindow.java @@ -28,12 +28,13 @@ public class BaseIWindow extends IWindow.Stub { private IWindowSession mSession; public int mSeq; - + public void setSession(IWindowSession session) { mSession = session; } - - public void resized(int w, int h, Rect contentInsets, + + @Override + public void resized(Rect frame, Rect contentInsets, Rect visibleInsets, boolean reportDraw, Configuration newConfig) { if (reportDraw) { try { @@ -43,24 +44,35 @@ public void resized(int w, int h, Rect contentInsets, } } + @Override + public void moved(int newX, int newY) { + } + + @Override public void dispatchAppVisibility(boolean visible) { } + @Override public void dispatchGetNewSurface() { } + @Override public void dispatchScreenState(boolean on) { } + @Override public void windowFocusChanged(boolean hasFocus, boolean touchEnabled) { } + @Override public void executeCommand(String command, String parameters, ParcelFileDescriptor out) { } - + + @Override public void closeSystemDialogs(String reason) { } - + + @Override public void dispatchWallpaperOffsets(float x, float y, float xStep, float yStep, boolean sync) { if (sync) { try { @@ -70,14 +82,17 @@ public void dispatchWallpaperOffsets(float x, float y, float xStep, float yStep, } } + @Override public void dispatchDragEvent(DragEvent event) { } + @Override public void dispatchSystemUiVisibilityChanged(int seq, int globalUi, int localValue, int localChanges) { mSeq = seq; } + @Override public void dispatchWallpaperCommand(String action, int x, int y, int z, Bundle extras, boolean sync) { if (sync) { @@ -88,6 +103,7 @@ public void dispatchWallpaperCommand(String action, int x, int y, } } + @Override public void doneAnimating() { } } diff --git a/core/java/com/android/internal/view/IInputMethodSession.aidl b/core/java/com/android/internal/view/IInputMethodSession.aidl index f875cbd95a079..cdec254e28df5 100644 --- a/core/java/com/android/internal/view/IInputMethodSession.aidl +++ b/core/java/com/android/internal/view/IInputMethodSession.aidl @@ -47,6 +47,8 @@ oneway interface IInputMethodSession { void dispatchTrackballEvent(int seq, in MotionEvent event, IInputMethodCallback callback); + void dispatchGenericMotionEvent(int seq, in MotionEvent event, IInputMethodCallback callback); + void appPrivateCommand(String action, in Bundle data); void toggleSoftInput(int showFlags, int hideFlags); diff --git a/core/java/com/android/internal/view/RotationPolicy.java b/core/java/com/android/internal/view/RotationPolicy.java index af512a30cce92..a86c3234f395a 100644 --- a/core/java/com/android/internal/view/RotationPolicy.java +++ b/core/java/com/android/internal/view/RotationPolicy.java @@ -23,10 +23,12 @@ import android.os.Handler; import android.os.RemoteException; import android.os.ServiceManager; +import android.os.UserHandle; import android.provider.Settings; import android.util.Log; import android.view.IWindowManager; import android.view.Surface; +import android.view.WindowManagerGlobal; /** * Provides helper functions for configuring the display rotation policy. @@ -54,16 +56,19 @@ public static boolean isRotationLockToggleSupported(Context context) { */ public static boolean isRotationLockToggleVisible(Context context) { return isRotationLockToggleSupported(context) && - Settings.System.getInt(context.getContentResolver(), - Settings.System.HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY, 0) == 0; + Settings.System.getIntForUser(context.getContentResolver(), + Settings.System.HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY, 0, + UserHandle.USER_CURRENT) == 0 && + !context.getResources().getBoolean(com.android + .internal.R.bool.config_hasRotationLockSwitch); } /** * Returns true if rotation lock is enabled. */ public static boolean isRotationLocked(Context context) { - return Settings.System.getInt(context.getContentResolver(), - Settings.System.ACCELEROMETER_ROTATION, 0) == 0; + return Settings.System.getIntForUser(context.getContentResolver(), + Settings.System.ACCELEROMETER_ROTATION, 0, UserHandle.USER_CURRENT) == 0; } /** @@ -72,15 +77,15 @@ public static boolean isRotationLocked(Context context) { * Should be used by the rotation lock toggle. */ public static void setRotationLock(Context context, final boolean enabled) { - Settings.System.putInt(context.getContentResolver(), - Settings.System.HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY, 0); + Settings.System.putIntForUser(context.getContentResolver(), + Settings.System.HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY, 0, + UserHandle.USER_CURRENT); AsyncTask.execute(new Runnable() { @Override public void run() { try { - IWindowManager wm = IWindowManager.Stub.asInterface( - ServiceManager.getService(Context.WINDOW_SERVICE)); + IWindowManager wm = WindowManagerGlobal.getWindowManagerService(); if (enabled) { wm.freezeRotation(-1); } else { @@ -100,15 +105,15 @@ public void run() { * Should be used by Display settings and Accessibility settings. */ public static void setRotationLockForAccessibility(Context context, final boolean enabled) { - Settings.System.putInt(context.getContentResolver(), - Settings.System.HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY, enabled ? 1 : 0); + Settings.System.putIntForUser(context.getContentResolver(), + Settings.System.HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY, enabled ? 1 : 0, + UserHandle.USER_CURRENT); AsyncTask.execute(new Runnable() { @Override public void run() { try { - IWindowManager wm = IWindowManager.Stub.asInterface( - ServiceManager.getService(Context.WINDOW_SERVICE)); + IWindowManager wm = WindowManagerGlobal.getWindowManagerService(); if (enabled) { wm.freezeRotation(Surface.ROTATION_0); } else { @@ -122,16 +127,25 @@ public void run() { } /** - * Registers a listener for rotation policy changes. + * Registers a listener for rotation policy changes affecting the caller's user */ public static void registerRotationPolicyListener(Context context, RotationPolicyListener listener) { + registerRotationPolicyListener(context, listener, UserHandle.getCallingUserId()); + } + + /** + * Registers a listener for rotation policy changes affecting a specific user, + * or USER_ALL for all users. + */ + public static void registerRotationPolicyListener(Context context, + RotationPolicyListener listener, int userHandle) { context.getContentResolver().registerContentObserver(Settings.System.getUriFor( Settings.System.ACCELEROMETER_ROTATION), - false, listener.mObserver); + false, listener.mObserver, userHandle); context.getContentResolver().registerContentObserver(Settings.System.getUriFor( Settings.System.HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY), - false, listener.mObserver); + false, listener.mObserver, userHandle); } /** diff --git a/core/java/com/android/internal/view/menu/ActionMenuItemView.java b/core/java/com/android/internal/view/menu/ActionMenuItemView.java index 449194bdfd908..238a9c033796e 100644 --- a/core/java/com/android/internal/view/menu/ActionMenuItemView.java +++ b/core/java/com/android/internal/view/menu/ActionMenuItemView.java @@ -17,6 +17,7 @@ package com.android.internal.view.menu; import android.content.Context; +import android.content.res.Configuration; import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.Rect; @@ -48,6 +49,9 @@ public class ActionMenuItemView extends TextView private int mMinWidth; private int mSavedPaddingLeft; + private static final int MAX_ICON_SIZE = 32; // dp + private int mMaxIconSize; + public ActionMenuItemView(Context context) { this(context, null); } @@ -67,12 +71,24 @@ public ActionMenuItemView(Context context, AttributeSet attrs, int defStyle) { com.android.internal.R.styleable.ActionMenuItemView_minWidth, 0); a.recycle(); + final float density = res.getDisplayMetrics().density; + mMaxIconSize = (int) (MAX_ICON_SIZE * density + 0.5f); + setOnClickListener(this); setOnLongClickListener(this); mSavedPaddingLeft = -1; } + @Override + public void onConfigurationChanged(Configuration newConfig) { + super.onConfigurationChanged(newConfig); + + mAllowTextWithIcon = getContext().getResources().getBoolean( + com.android.internal.R.bool.config_allowActionMenuItemTextWithIcon); + updateTextButtonVisibility(); + } + @Override public void setPadding(int l, int t, int r, int b) { mSavedPaddingLeft = l; @@ -135,7 +151,22 @@ private void updateTextButtonVisibility() { public void setIcon(Drawable icon) { mIcon = icon; - setCompoundDrawablesWithIntrinsicBounds(icon, null, null, null); + if (icon != null) { + int width = icon.getIntrinsicWidth(); + int height = icon.getIntrinsicHeight(); + if (width > mMaxIconSize) { + final float scale = (float) mMaxIconSize / width; + width = mMaxIconSize; + height *= scale; + } + if (height > mMaxIconSize) { + final float scale = (float) mMaxIconSize / height; + height = mMaxIconSize; + width *= scale; + } + icon.setBounds(0, 0, width, height); + } + setCompoundDrawables(icon, null, null, null); updateTextButtonVisibility(); } @@ -209,7 +240,7 @@ public boolean onLongClick(View v) { Toast cheatSheet = Toast.makeText(context, mItemData.getTitle(), Toast.LENGTH_SHORT); if (midy < displayFrame.height()) { // Show along the top; follow action buttons - cheatSheet.setGravity(Gravity.TOP | Gravity.RIGHT, + cheatSheet.setGravity(Gravity.TOP | Gravity.END, screenWidth - screenPos[0] - width / 2, height); } else { // Show along the bottom center @@ -221,6 +252,11 @@ public boolean onLongClick(View v) { @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + if (MeasureSpec.getMode(heightMeasureSpec) == MeasureSpec.AT_MOST) { + // Fill all available height. + heightMeasureSpec = MeasureSpec.makeMeasureSpec( + MeasureSpec.getSize(heightMeasureSpec), MeasureSpec.EXACTLY); + } final boolean textVisible = hasText(); if (textVisible && mSavedPaddingLeft >= 0) { super.setPadding(mSavedPaddingLeft, getPaddingTop(), @@ -245,7 +281,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { // TextView won't center compound drawables in both dimensions without // a little coercion. Pad in to center the icon after we've measured. final int w = getMeasuredWidth(); - final int dw = mIcon.getIntrinsicWidth(); + final int dw = mIcon.getBounds().width(); super.setPadding((w - dw) / 2, getPaddingTop(), getPaddingRight(), getPaddingBottom()); } } diff --git a/core/java/com/android/internal/view/menu/ActionMenuPresenter.java b/core/java/com/android/internal/view/menu/ActionMenuPresenter.java index 73324c0264512..4bb6d0694b376 100644 --- a/core/java/com/android/internal/view/menu/ActionMenuPresenter.java +++ b/core/java/com/android/internal/view/menu/ActionMenuPresenter.java @@ -278,7 +278,7 @@ private View findViewForItem(MenuItem item) { */ public boolean showOverflowMenu() { if (mReserveOverflow && !isOverflowMenuShowing() && mMenu != null && mMenuView != null && - mPostedOpenRunnable == null) { + mPostedOpenRunnable == null && !mMenu.getNonActionItems().isEmpty()) { OverflowPopup popup = new OverflowPopup(mContext, mMenu, mOverflowButton, true); mPostedOpenRunnable = new OpenOverflowRunnable(popup); // Post this for later; we might still need a layout for the anchor to be right. @@ -476,6 +476,9 @@ public boolean flagActionItems() { if (isAction) maxActions--; item.setIsActionButton(isAction); + } else { + // Neither requires nor requests an action button. + item.setIsActionButton(false); } } return true; @@ -576,6 +579,16 @@ public boolean needsDividerBefore() { public boolean needsDividerAfter() { return false; } + + @Override + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + if (MeasureSpec.getMode(heightMeasureSpec) == MeasureSpec.AT_MOST) { + // Fill available height + heightMeasureSpec = MeasureSpec.makeMeasureSpec( + MeasureSpec.getSize(heightMeasureSpec), MeasureSpec.EXACTLY); + } + super.onMeasure(widthMeasureSpec, heightMeasureSpec); + } } private class OverflowPopup extends MenuPopupHelper { diff --git a/core/java/com/android/internal/view/menu/ActionMenuView.java b/core/java/com/android/internal/view/menu/ActionMenuView.java index f54575b827df3..34ade74c9d29b 100644 --- a/core/java/com/android/internal/view/menu/ActionMenuView.java +++ b/core/java/com/android/internal/view/menu/ActionMenuView.java @@ -15,6 +15,8 @@ */ package com.android.internal.view.menu; +import com.android.internal.R; + import android.content.Context; import android.content.res.Configuration; import android.content.res.TypedArray; @@ -26,8 +28,6 @@ import android.view.accessibility.AccessibilityEvent; import android.widget.LinearLayout; -import com.android.internal.R; - /** * @hide */ @@ -73,6 +73,11 @@ public boolean isExpandedFormat() { return mFormatItems; } + public void setMaxItemHeight(int maxItemHeight) { + mMaxItemHeight = maxItemHeight; + requestLayout(); + } + @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); @@ -395,6 +400,7 @@ protected void onLayout(boolean changed, int left, int top, int right, int botto int nonOverflowCount = 0; int widthRemaining = right - left - getPaddingRight() - getPaddingLeft(); boolean hasOverflow = false; + final boolean isLayoutRtl = isLayoutRtl(); for (int i = 0; i < childCount; i++) { final View v = getChildAt(i); if (v.getVisibility() == GONE) { @@ -409,8 +415,15 @@ protected void onLayout(boolean changed, int left, int top, int right, int botto } int height = v.getMeasuredHeight(); - int r = getWidth() - getPaddingRight() - p.rightMargin; - int l = r - overflowWidth; + int r; + int l; + if (isLayoutRtl) { + l = getPaddingLeft() + p.leftMargin; + r = l + overflowWidth; + } else { + r = getWidth() - getPaddingRight() - p.rightMargin; + l = r - overflowWidth; + } int t = midVertical - (height / 2); int b = t + height; v.layout(l, t, r, b); @@ -443,20 +456,38 @@ protected void onLayout(boolean changed, int left, int top, int right, int botto final int spacerCount = nonOverflowCount - (hasOverflow ? 0 : 1); final int spacerSize = Math.max(0, spacerCount > 0 ? widthRemaining / spacerCount : 0); - int startLeft = getPaddingLeft(); - for (int i = 0; i < childCount; i++) { - final View v = getChildAt(i); - final LayoutParams lp = (LayoutParams) v.getLayoutParams(); - if (v.getVisibility() == GONE || lp.isOverflowButton) { - continue; + if (isLayoutRtl) { + int startRight = getWidth() - getPaddingRight(); + for (int i = 0; i < childCount; i++) { + final View v = getChildAt(i); + final LayoutParams lp = (LayoutParams) v.getLayoutParams(); + if (v.getVisibility() == GONE || lp.isOverflowButton) { + continue; + } + + startRight -= lp.rightMargin; + int width = v.getMeasuredWidth(); + int height = v.getMeasuredHeight(); + int t = midVertical - height / 2; + v.layout(startRight - width, t, startRight, t + height); + startRight -= width + lp.leftMargin + spacerSize; } + } else { + int startLeft = getPaddingLeft(); + for (int i = 0; i < childCount; i++) { + final View v = getChildAt(i); + final LayoutParams lp = (LayoutParams) v.getLayoutParams(); + if (v.getVisibility() == GONE || lp.isOverflowButton) { + continue; + } - startLeft += lp.leftMargin; - int width = v.getMeasuredWidth(); - int height = v.getMeasuredHeight(); - int t = midVertical - height / 2; - v.layout(startLeft, t, startLeft + width, t + height); - startLeft += width + lp.rightMargin + spacerSize; + startLeft += lp.leftMargin; + int width = v.getMeasuredWidth(); + int height = v.getMeasuredHeight(); + int t = midVertical - height / 2; + v.layout(startLeft, t, startLeft + width, t + height); + startLeft += width + lp.rightMargin + spacerSize; + } } } @@ -489,8 +520,10 @@ public LayoutParams generateLayoutParams(AttributeSet attrs) { @Override protected LayoutParams generateLayoutParams(ViewGroup.LayoutParams p) { - if (p instanceof LayoutParams) { - LayoutParams result = new LayoutParams((LayoutParams) p); + if (p != null) { + final LayoutParams result = p instanceof LayoutParams + ? new LayoutParams((LayoutParams) p) + : new LayoutParams(p); if (result.gravity <= Gravity.NO_GRAVITY) { result.gravity = Gravity.CENTER_VERTICAL; } @@ -524,6 +557,9 @@ public void initialize(MenuBuilder menu) { @Override protected boolean hasDividerBeforeChildAt(int childIndex) { + if (childIndex == 0) { + return false; + } final View childBefore = getChildAt(childIndex - 1); final View child = getChildAt(childIndex); boolean result = false; @@ -563,6 +599,10 @@ public LayoutParams(Context c, AttributeSet attrs) { super(c, attrs); } + public LayoutParams(ViewGroup.LayoutParams other) { + super(other); + } + public LayoutParams(LayoutParams other) { super((LinearLayout.LayoutParams) other); isOverflowButton = other.isOverflowButton; diff --git a/core/java/com/android/internal/view/menu/IconMenuItemView.java b/core/java/com/android/internal/view/menu/IconMenuItemView.java index a743cfa368d79..5d0b25f7ce16b 100644 --- a/core/java/com/android/internal/view/menu/IconMenuItemView.java +++ b/core/java/com/android/internal/view/menu/IconMenuItemView.java @@ -281,8 +281,8 @@ private void positionIcon() { Rect tmpRect = mPositionIconOutput; getLineBounds(0, tmpRect); mPositionIconAvailable.set(0, 0, getWidth(), tmpRect.top); - final int layoutDirection = getResolvedLayoutDirection(); - Gravity.apply(Gravity.CENTER_VERTICAL | Gravity.LEFT, mIcon.getIntrinsicWidth(), mIcon + final int layoutDirection = getLayoutDirection(); + Gravity.apply(Gravity.CENTER_VERTICAL | Gravity.START, mIcon.getIntrinsicWidth(), mIcon .getIntrinsicHeight(), mPositionIconAvailable, mPositionIconOutput, layoutDirection); mIcon.setBounds(mPositionIconOutput); diff --git a/core/java/com/android/internal/widget/AbsActionBarView.java b/core/java/com/android/internal/widget/AbsActionBarView.java index 25a9c54b88ff4..ca7f5d03b1bfa 100644 --- a/core/java/com/android/internal/widget/AbsActionBarView.java +++ b/core/java/com/android/internal/widget/AbsActionBarView.java @@ -95,6 +95,9 @@ public void setSplitWhenNarrow(boolean splitWhenNarrow) { public void setContentHeight(int height) { mContentHeight = height; + if (mMenuView != null) { + mMenuView.setMaxItemHeight(mContentHeight); + } requestLayout(); } @@ -219,24 +222,22 @@ protected int measureChildView(View child, int availableWidth, int childSpecHeig return Math.max(0, availableWidth); } - protected int positionChild(View child, int x, int y, int contentHeight) { - int childWidth = child.getMeasuredWidth(); - int childHeight = child.getMeasuredHeight(); - int childTop = y + (contentHeight - childHeight) / 2; - - child.layout(x, childTop, x + childWidth, childTop + childHeight); - - return childWidth; + static protected int next(int x, int val, boolean isRtl) { + return isRtl ? x - val : x + val; } - protected int positionChildInverse(View child, int x, int y, int contentHeight) { + protected int positionChild(View child, int x, int y, int contentHeight, boolean reverse) { int childWidth = child.getMeasuredWidth(); int childHeight = child.getMeasuredHeight(); int childTop = y + (contentHeight - childHeight) / 2; - child.layout(x - childWidth, childTop, x, childTop + childHeight); + if (reverse) { + child.layout(x - childWidth, childTop, x, childTop + childHeight); + } else { + child.layout(x, childTop, x + childWidth, childTop + childHeight); + } - return childWidth; + return (reverse ? -childWidth : childWidth); } protected class VisibilityAnimListener implements Animator.AnimatorListener { diff --git a/core/java/com/android/internal/widget/ActionBarContainer.java b/core/java/com/android/internal/widget/ActionBarContainer.java index 0c57270544b73..0cfe4fdf932ac 100644 --- a/core/java/com/android/internal/widget/ActionBarContainer.java +++ b/core/java/com/android/internal/widget/ActionBarContainer.java @@ -77,20 +77,107 @@ public void onFinishInflate() { } public void setPrimaryBackground(Drawable bg) { + if (mBackground != null) { + mBackground.setCallback(null); + unscheduleDrawable(mBackground); + } mBackground = bg; + if (bg != null) { + bg.setCallback(this); + } + setWillNotDraw(mIsSplit ? mSplitBackground == null : + mBackground == null && mStackedBackground == null); invalidate(); } public void setStackedBackground(Drawable bg) { + if (mStackedBackground != null) { + mStackedBackground.setCallback(null); + unscheduleDrawable(mStackedBackground); + } mStackedBackground = bg; + if (bg != null) { + bg.setCallback(this); + } + setWillNotDraw(mIsSplit ? mSplitBackground == null : + mBackground == null && mStackedBackground == null); invalidate(); } public void setSplitBackground(Drawable bg) { + if (mSplitBackground != null) { + mSplitBackground.setCallback(null); + unscheduleDrawable(mSplitBackground); + } mSplitBackground = bg; + if (bg != null) { + bg.setCallback(this); + } + setWillNotDraw(mIsSplit ? mSplitBackground == null : + mBackground == null && mStackedBackground == null); invalidate(); } + @Override + public void setVisibility(int visibility) { + super.setVisibility(visibility); + final boolean isVisible = visibility == VISIBLE; + if (mBackground != null) mBackground.setVisible(isVisible, false); + if (mStackedBackground != null) mStackedBackground.setVisible(isVisible, false); + if (mSplitBackground != null) mSplitBackground.setVisible(isVisible, false); + } + + @Override + protected boolean verifyDrawable(Drawable who) { + return (who == mBackground && !mIsSplit) || (who == mStackedBackground && mIsStacked) || + (who == mSplitBackground && mIsSplit) || super.verifyDrawable(who); + } + + @Override + protected void drawableStateChanged() { + super.drawableStateChanged(); + if (mBackground != null && mBackground.isStateful()) { + mBackground.setState(getDrawableState()); + } + if (mStackedBackground != null && mStackedBackground.isStateful()) { + mStackedBackground.setState(getDrawableState()); + } + if (mSplitBackground != null && mSplitBackground.isStateful()) { + mSplitBackground.setState(getDrawableState()); + } + } + + @Override + public void jumpDrawablesToCurrentState() { + super.jumpDrawablesToCurrentState(); + if (mBackground != null) { + mBackground.jumpToCurrentState(); + } + if (mStackedBackground != null) { + mStackedBackground.jumpToCurrentState(); + } + if (mSplitBackground != null) { + mSplitBackground.jumpToCurrentState(); + } + } + + /** + * @hide + */ + @Override + public void onResolveDrawables(int layoutDirection) { + super.onResolveDrawables(layoutDirection); + if (mBackground != null) { + mBackground.setLayoutDirection(layoutDirection); + } + if (mStackedBackground != null) { + mStackedBackground.setLayoutDirection(layoutDirection); + } + if (mSplitBackground != null) { + mSplitBackground.setLayoutDirection(layoutDirection); + } + } + /** * Set the action bar into a "transitioning" state. While transitioning * the bar will block focus and touch from all of its descendants. This diff --git a/core/java/com/android/internal/widget/ActionBarContextView.java b/core/java/com/android/internal/widget/ActionBarContextView.java index 16f08f55fea7a..8bc1081a3f97f 100644 --- a/core/java/com/android/internal/widget/ActionBarContextView.java +++ b/core/java/com/android/internal/widget/ActionBarContextView.java @@ -454,15 +454,18 @@ private Animator makeOutAnimation() { @Override protected void onLayout(boolean changed, int l, int t, int r, int b) { - int x = getPaddingLeft(); + final boolean isLayoutRtl = isLayoutRtl(); + int x = isLayoutRtl ? r - l - getPaddingRight() : getPaddingLeft(); final int y = getPaddingTop(); final int contentHeight = b - t - getPaddingTop() - getPaddingBottom(); if (mClose != null && mClose.getVisibility() != GONE) { MarginLayoutParams lp = (MarginLayoutParams) mClose.getLayoutParams(); - x += lp.leftMargin; - x += positionChild(mClose, x, y, contentHeight); - x += lp.rightMargin; + final int startMargin = (isLayoutRtl ? lp.rightMargin : lp.leftMargin); + final int endMargin = (isLayoutRtl ? lp.leftMargin : lp.rightMargin); + x = next(x, startMargin, isLayoutRtl); + x += positionChild(mClose, x, y, contentHeight, isLayoutRtl); + x = next(x, endMargin, isLayoutRtl); if (mAnimateInOnLayout) { mAnimationMode = ANIMATE_IN; @@ -473,17 +476,17 @@ protected void onLayout(boolean changed, int l, int t, int r, int b) { } if (mTitleLayout != null && mCustomView == null && mTitleLayout.getVisibility() != GONE) { - x += positionChild(mTitleLayout, x, y, contentHeight); + x += positionChild(mTitleLayout, x, y, contentHeight, isLayoutRtl); } if (mCustomView != null) { - x += positionChild(mCustomView, x, y, contentHeight); + x += positionChild(mCustomView, x, y, contentHeight, isLayoutRtl); } - - x = r - l - getPaddingRight(); + + x = isLayoutRtl ? getPaddingLeft() : r - l - getPaddingRight(); if (mMenuView != null) { - x -= positionChildInverse(mMenuView, x, y, contentHeight); + x += positionChild(mMenuView, x, y, contentHeight, !isLayoutRtl); } } diff --git a/core/java/com/android/internal/widget/ActionBarView.java b/core/java/com/android/internal/widget/ActionBarView.java index 450f418700c6e..6fb459c1b5ed5 100644 --- a/core/java/com/android/internal/widget/ActionBarView.java +++ b/core/java/com/android/internal/widget/ActionBarView.java @@ -26,6 +26,7 @@ import com.android.internal.view.menu.MenuView; import com.android.internal.view.menu.SubMenuBuilder; +import android.animation.LayoutTransition; import android.app.ActionBar; import android.app.ActionBar.OnNavigationListener; import android.app.Activity; @@ -84,7 +85,7 @@ public class ActionBarView extends AbsActionBarView { ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_SHOW_TITLE; - private static final int DEFAULT_CUSTOM_GRAVITY = Gravity.LEFT | Gravity.CENTER_VERTICAL; + private static final int DEFAULT_CUSTOM_GRAVITY = Gravity.START | Gravity.CENTER_VERTICAL; private int mNavigationMode; private int mDisplayOptions = -1; @@ -555,12 +556,16 @@ public void setHomeButtonEnabled(boolean enable) { // Make sure the home button has an accurate content description for accessibility. if (!enable) { mHomeLayout.setContentDescription(null); - } else if ((mDisplayOptions & ActionBar.DISPLAY_HOME_AS_UP) != 0) { - mHomeLayout.setContentDescription(mContext.getResources().getText( - R.string.action_bar_up_description)); + mHomeLayout.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO); } else { - mHomeLayout.setContentDescription(mContext.getResources().getText( - R.string.action_bar_home_description)); + mHomeLayout.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_AUTO); + if ((mDisplayOptions & ActionBar.DISPLAY_HOME_AS_UP) != 0) { + mHomeLayout.setContentDescription(mContext.getResources().getText( + R.string.action_bar_up_description)); + } else { + mHomeLayout.setContentDescription(mContext.getResources().getText( + R.string.action_bar_home_description)); + } } } @@ -623,12 +628,16 @@ public void setDisplayOptions(int options) { // Make sure the home button has an accurate content description for accessibility. if (!mHomeLayout.isEnabled()) { mHomeLayout.setContentDescription(null); - } else if ((options & ActionBar.DISPLAY_HOME_AS_UP) != 0) { - mHomeLayout.setContentDescription(mContext.getResources().getText( - R.string.action_bar_up_description)); + mHomeLayout.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO); } else { - mHomeLayout.setContentDescription(mContext.getResources().getText( - R.string.action_bar_home_description)); + mHomeLayout.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_AUTO); + if ((options & ActionBar.DISPLAY_HOME_AS_UP) != 0) { + mHomeLayout.setContentDescription(mContext.getResources().getText( + R.string.action_bar_up_description)); + } else { + mHomeLayout.setContentDescription(mContext.getResources().getText( + R.string.action_bar_home_description)); + } } } @@ -847,7 +856,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int contentWidth = MeasureSpec.getSize(widthMeasureSpec); - int maxHeight = mContentHeight > 0 ? + int maxHeight = mContentHeight >= 0 ? mContentHeight : MeasureSpec.getSize(heightMeasureSpec); final int verticalPadding = getPaddingTop() + getPaddingBottom(); @@ -855,6 +864,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { final int paddingRight = getPaddingRight(); final int height = maxHeight - verticalPadding; final int childSpecHeight = MeasureSpec.makeMeasureSpec(height, MeasureSpec.AT_MOST); + final int exactHeightSpec = MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY); int availableWidth = contentWidth - paddingLeft - paddingRight; int leftOfCenter = availableWidth / 2; @@ -870,16 +880,14 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { } else { homeWidthSpec = MeasureSpec.makeMeasureSpec(lp.width, MeasureSpec.EXACTLY); } - homeLayout.measure(homeWidthSpec, - MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY)); - final int homeWidth = homeLayout.getMeasuredWidth() + homeLayout.getLeftOffset(); + homeLayout.measure(homeWidthSpec, exactHeightSpec); + final int homeWidth = homeLayout.getMeasuredWidth() + homeLayout.getStartOffset(); availableWidth = Math.max(0, availableWidth - homeWidth); leftOfCenter = Math.max(0, availableWidth - homeWidth); } if (mMenuView != null && mMenuView.getParent() == this) { - availableWidth = measureChildView(mMenuView, availableWidth, - childSpecHeight, 0); + availableWidth = measureChildView(mMenuView, availableWidth, exactHeightSpec, 0); rightOfCenter = Math.max(0, rightOfCenter - mMenuView.getMeasuredWidth()); } @@ -1010,8 +1018,6 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { @Override protected void onLayout(boolean changed, int l, int t, int r, int b) { - int x = getPaddingLeft(); - final int y = getPaddingTop(); final int contentHeight = b - t - getPaddingTop() - getPaddingBottom(); if (contentHeight <= 0) { @@ -1019,13 +1025,23 @@ protected void onLayout(boolean changed, int l, int t, int r, int b) { return; } + final boolean isLayoutRtl = isLayoutRtl(); + final int direction = isLayoutRtl ? +1 : -1; + int menuStart = isLayoutRtl ? getPaddingLeft() : r - l - getPaddingRight(); + // In LTR mode, we start from left padding and go to the right; in RTL mode, we start + // from the padding right and go to the left (in reverse way) + int x = isLayoutRtl ? r - l - getPaddingRight() : getPaddingLeft(); + final int y = getPaddingTop(); + HomeView homeLayout = mExpandedActionView != null ? mExpandedHomeLayout : mHomeLayout; boolean needsTouchDelegate = false; int homeSlop = mMaxHomeSlop; int homeRight = 0; if (homeLayout.getVisibility() != GONE) { - final int leftOffset = homeLayout.getLeftOffset(); - x += positionChild(homeLayout, x + leftOffset, y, contentHeight) + leftOffset; + final int startOffset = homeLayout.getStartOffset(); + x += positionChild(homeLayout, + next(x, startOffset, isLayoutRtl), y, contentHeight, isLayoutRtl); + x = next(x, startOffset, isLayoutRtl); needsTouchDelegate = homeLayout == mHomeLayout; homeRight = x; } @@ -1034,7 +1050,7 @@ protected void onLayout(boolean changed, int l, int t, int r, int b) { final boolean showTitle = mTitleLayout != null && mTitleLayout.getVisibility() != GONE && (mDisplayOptions & ActionBar.DISPLAY_SHOW_TITLE) != 0; if (showTitle) { - x += positionChild(mTitleLayout, x, y, contentHeight); + x += positionChild(mTitleLayout, x, y, contentHeight, isLayoutRtl); } switch (mNavigationMode) { @@ -1042,31 +1058,34 @@ protected void onLayout(boolean changed, int l, int t, int r, int b) { break; case ActionBar.NAVIGATION_MODE_LIST: if (mListNavLayout != null) { - if (showTitle) x += mItemPadding; + if (showTitle) { + x = next(x, mItemPadding, isLayoutRtl); + } homeSlop = Math.min(homeSlop, Math.max(x - homeRight, 0)); - x += positionChild(mListNavLayout, x, y, contentHeight) + mItemPadding; + x += positionChild(mListNavLayout, x, y, contentHeight, isLayoutRtl); + x = next(x, mItemPadding, isLayoutRtl); } break; case ActionBar.NAVIGATION_MODE_TABS: if (mTabScrollView != null) { - if (showTitle) x += mItemPadding; + if (showTitle) x = next(x, mItemPadding, isLayoutRtl); homeSlop = Math.min(homeSlop, Math.max(x - homeRight, 0)); - x += positionChild(mTabScrollView, x, y, contentHeight) + mItemPadding; + x += positionChild(mTabScrollView, x, y, contentHeight, isLayoutRtl); + x = next(x, mItemPadding, isLayoutRtl); } break; } } - int menuLeft = r - l - getPaddingRight(); if (mMenuView != null && mMenuView.getParent() == this) { - positionChildInverse(mMenuView, menuLeft, y, contentHeight); - menuLeft -= mMenuView.getMeasuredWidth(); + positionChild(mMenuView, menuStart, y, contentHeight, !isLayoutRtl); + menuStart += direction * mMenuView.getMeasuredWidth(); } if (mIndeterminateProgressView != null && mIndeterminateProgressView.getVisibility() != GONE) { - positionChildInverse(mIndeterminateProgressView, menuLeft, y, contentHeight); - menuLeft -= mIndeterminateProgressView.getMeasuredWidth(); + positionChild(mIndeterminateProgressView, menuStart, y, contentHeight, !isLayoutRtl); + menuStart += direction * mIndeterminateProgressView.getMeasuredWidth(); } View customView = null; @@ -1077,51 +1096,63 @@ protected void onLayout(boolean changed, int l, int t, int r, int b) { customView = mCustomNavView; } if (customView != null) { + final int layoutDirection = getLayoutDirection(); ViewGroup.LayoutParams lp = customView.getLayoutParams(); final ActionBar.LayoutParams ablp = lp instanceof ActionBar.LayoutParams ? (ActionBar.LayoutParams) lp : null; - final int gravity = ablp != null ? ablp.gravity : DEFAULT_CUSTOM_GRAVITY; final int navWidth = customView.getMeasuredWidth(); int topMargin = 0; int bottomMargin = 0; if (ablp != null) { - x += ablp.leftMargin; - menuLeft -= ablp.rightMargin; + x = next(x, ablp.getMarginStart(), isLayoutRtl); + menuStart += direction * ablp.getMarginEnd(); topMargin = ablp.topMargin; bottomMargin = ablp.bottomMargin; } - int hgravity = gravity & Gravity.HORIZONTAL_GRAVITY_MASK; + int hgravity = gravity & Gravity.RELATIVE_HORIZONTAL_GRAVITY_MASK; // See if we actually have room to truly center; if not push against left or right. if (hgravity == Gravity.CENTER_HORIZONTAL) { final int centeredLeft = ((mRight - mLeft) - navWidth) / 2; - if (centeredLeft < x) { - hgravity = Gravity.LEFT; - } else if (centeredLeft + navWidth > menuLeft) { - hgravity = Gravity.RIGHT; + if (isLayoutRtl) { + final int centeredStart = centeredLeft + navWidth; + final int centeredEnd = centeredLeft; + if (centeredStart > x) { + hgravity = Gravity.RIGHT; + } else if (centeredEnd < menuStart) { + hgravity = Gravity.LEFT; + } + } else { + final int centeredStart = centeredLeft; + final int centeredEnd = centeredLeft + navWidth; + if (centeredStart < x) { + hgravity = Gravity.LEFT; + } else if (centeredEnd > menuStart) { + hgravity = Gravity.RIGHT; + } } - } else if (gravity == -1) { - hgravity = Gravity.LEFT; + } else if (gravity == Gravity.NO_GRAVITY) { + hgravity = Gravity.START; } int xpos = 0; - switch (hgravity) { + switch (Gravity.getAbsoluteGravity(hgravity, layoutDirection)) { case Gravity.CENTER_HORIZONTAL: xpos = ((mRight - mLeft) - navWidth) / 2; break; case Gravity.LEFT: - xpos = x; + xpos = isLayoutRtl ? menuStart : x; break; case Gravity.RIGHT: - xpos = menuLeft - navWidth; + xpos = isLayoutRtl ? x - navWidth : menuStart - navWidth; break; } int vgravity = gravity & Gravity.VERTICAL_GRAVITY_MASK; - if (gravity == -1) { + if (gravity == Gravity.NO_GRAVITY) { vgravity = Gravity.CENTER_VERTICAL; } @@ -1144,7 +1175,7 @@ protected void onLayout(boolean changed, int l, int t, int r, int b) { customView.layout(xpos, ypos, xpos + customWidth, ypos + customView.getMeasuredHeight()); homeSlop = Math.min(homeSlop, Math.max(xpos - homeRight, 0)); - x += customWidth; + x = next(x, customWidth, isLayoutRtl); } if (mProgressView != null) { @@ -1247,12 +1278,19 @@ private static class HomeView extends FrameLayout { private ImageView mIconView; private int mUpWidth; + private static final long DEFAULT_TRANSITION_DURATION = 150; + public HomeView(Context context) { this(context, null); } public HomeView(Context context, AttributeSet attrs) { super(context, attrs); + LayoutTransition t = getLayoutTransition(); + if (t != null) { + // Set a lower duration than the default + t.setDuration(DEFAULT_TRANSITION_DURATION); + } } public void setUp(boolean isUp) { @@ -1290,7 +1328,7 @@ protected void onFinishInflate() { mIconView = (ImageView) findViewById(com.android.internal.R.id.home); } - public int getLeftOffset() { + public int getStartOffset() { return mUpView.getVisibility() == GONE ? mUpWidth : 0; } @@ -1340,25 +1378,48 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { @Override protected void onLayout(boolean changed, int l, int t, int r, int b) { final int vCenter = (b - t) / 2; - int width = r - l; + final boolean isLayoutRtl = isLayoutRtl(); + final int width = getWidth(); int upOffset = 0; if (mUpView.getVisibility() != GONE) { final LayoutParams upLp = (LayoutParams) mUpView.getLayoutParams(); final int upHeight = mUpView.getMeasuredHeight(); final int upWidth = mUpView.getMeasuredWidth(); - final int upTop = vCenter - upHeight / 2; - mUpView.layout(0, upTop, upWidth, upTop + upHeight); upOffset = upLp.leftMargin + upWidth + upLp.rightMargin; - width -= upOffset; - l += upOffset; + final int upTop = vCenter - upHeight / 2; + final int upBottom = upTop + upHeight; + final int upRight; + final int upLeft; + if (isLayoutRtl) { + upRight = width; + upLeft = upRight - upWidth; + r -= upOffset; + } else { + upRight = upWidth; + upLeft = 0; + l += upOffset; + } + mUpView.layout(upLeft, upTop, upRight, upBottom); } + final LayoutParams iconLp = (LayoutParams) mIconView.getLayoutParams(); final int iconHeight = mIconView.getMeasuredHeight(); final int iconWidth = mIconView.getMeasuredWidth(); final int hCenter = (r - l) / 2; - final int iconLeft = upOffset + Math.max(iconLp.leftMargin, hCenter - iconWidth / 2); final int iconTop = Math.max(iconLp.topMargin, vCenter - iconHeight / 2); - mIconView.layout(iconLeft, iconTop, iconLeft + iconWidth, iconTop + iconHeight); + final int iconBottom = iconTop + iconHeight; + final int iconLeft; + final int iconRight; + int marginStart = iconLp.getMarginStart(); + final int delta = Math.max(marginStart, hCenter - iconWidth / 2); + if (isLayoutRtl) { + iconRight = width - upOffset - delta; + iconLeft = iconRight - iconWidth; + } else { + iconLeft = upOffset + delta; + iconRight = iconLeft + iconWidth; + } + mIconView.layout(iconLeft, iconTop, iconRight, iconBottom); } } diff --git a/core/java/com/android/internal/widget/FaceUnlockView.java b/core/java/com/android/internal/widget/FaceUnlockView.java new file mode 100644 index 0000000000000..e3c124730ae54 --- /dev/null +++ b/core/java/com/android/internal/widget/FaceUnlockView.java @@ -0,0 +1,69 @@ +/* + * 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.internal.widget; + +import android.content.Context; +import android.util.AttributeSet; +import android.util.Log; +import android.view.View; +import android.widget.RelativeLayout; + +public class FaceUnlockView extends RelativeLayout { + private static final String TAG = "FaceUnlockView"; + + public FaceUnlockView(Context context) { + this(context, null); + } + + public FaceUnlockView(Context context, AttributeSet attrs) { + super(context, attrs); + } + + private int resolveMeasured(int measureSpec, int desired) + { + int result = 0; + int specSize = MeasureSpec.getSize(measureSpec); + switch (MeasureSpec.getMode(measureSpec)) { + case MeasureSpec.UNSPECIFIED: + result = desired; + break; + case MeasureSpec.AT_MOST: + result = Math.max(specSize, desired); + break; + case MeasureSpec.EXACTLY: + default: + result = specSize; + } + return result; + } + + @Override + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + final int minimumWidth = getSuggestedMinimumWidth(); + final int minimumHeight = getSuggestedMinimumHeight(); + int viewWidth = resolveMeasured(widthMeasureSpec, minimumWidth); + int viewHeight = resolveMeasured(heightMeasureSpec, minimumHeight); + + final int chosenSize = Math.min(viewWidth, viewHeight); + final int newWidthMeasureSpec = + MeasureSpec.makeMeasureSpec(chosenSize, MeasureSpec.AT_MOST); + final int newHeightMeasureSpec = + MeasureSpec.makeMeasureSpec(chosenSize, MeasureSpec.AT_MOST); + + super.onMeasure(newWidthMeasureSpec, newHeightMeasureSpec); + } +} diff --git a/core/java/com/android/internal/widget/LockPatternUtils.java b/core/java/com/android/internal/widget/LockPatternUtils.java index f77e8f3c6b962..5453a0bbcfc32 100644 --- a/core/java/com/android/internal/widget/LockPatternUtils.java +++ b/core/java/com/android/internal/widget/LockPatternUtils.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2007 The Android Open Source Project + * Copyright (C) 2012 The CyanogenMod Project (Calendar) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,44 +17,46 @@ package com.android.internal.widget; -import com.android.internal.R; -import com.android.internal.telephony.ITelephony; -import com.google.android.collect.Lists; - +import android.app.ActivityManagerNative; import android.app.admin.DevicePolicyManager; -import android.content.BroadcastReceiver; +import android.appwidget.AppWidgetManager; import android.content.ContentResolver; import android.content.Context; import android.content.Intent; -import android.content.IntentFilter; import android.content.pm.PackageManager; +import android.database.Cursor; +import android.net.Uri; import android.os.Binder; -import android.os.FileObserver; +import android.os.Bundle; import android.os.IBinder; -import android.os.Process; import android.os.RemoteException; import android.os.ServiceManager; import android.os.SystemClock; -import android.os.UserId; +import android.os.UserHandle; import android.os.storage.IMountService; +import android.provider.CalendarContract; import android.provider.Settings; import android.security.KeyStore; import android.telephony.TelephonyManager; import android.text.TextUtils; +import android.text.format.DateFormat; +import android.text.format.Time; import android.util.Log; +import android.view.IWindowManager; import android.view.View; import android.widget.Button; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.RandomAccessFile; +import com.android.internal.R; +import com.android.internal.telephony.ITelephony; +import com.google.android.collect.Lists; + import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; -import java.util.Arrays; +import java.text.SimpleDateFormat; +import java.util.Date; import java.util.List; -import java.util.concurrent.atomic.AtomicBoolean; +import java.util.TimeZone; /** * Utilities for the lock pattern and its settings. @@ -106,12 +109,42 @@ public class LockPatternUtils { */ public static final int MIN_PATTERN_REGISTER_FAIL = MIN_LOCK_PATTERN_SIZE; + /** + * Tells the keyguard to show the user switcher when the keyguard is created. + */ + public static final String KEYGUARD_SHOW_USER_SWITCHER = "showuserswitcher"; + + /** + * Tells the keyguard to show the security challenge when the keyguard is created. + */ + public static final String KEYGUARD_SHOW_SECURITY_CHALLENGE = "showsecuritychallenge"; + + /** + * Tells the keyguard to show the widget with the specified id when the keyguard is created. + */ + public static final String KEYGUARD_SHOW_APPWIDGET = "showappwidget"; + + /** + * Options used to lock the device upon user switch. + */ + public static final Bundle USER_SWITCH_LOCK_OPTIONS = new Bundle(); + + static { + USER_SWITCH_LOCK_OPTIONS.putBoolean(KEYGUARD_SHOW_USER_SWITCHER, true); + USER_SWITCH_LOCK_OPTIONS.putBoolean(KEYGUARD_SHOW_SECURITY_CHALLENGE, true); + } + /** * The bit in LOCK_BIOMETRIC_WEAK_FLAGS to be used to indicate whether liveliness should * be used */ public static final int FLAG_BIOMETRIC_WEAK_LIVELINESS = 0x1; + /** + * Pseudo-appwidget id we use to represent the default clock status widget + */ + public static final int ID_DEFAULT_STATUS_WIDGET = -2; + protected final static String LOCKOUT_PERMANENT_KEY = "lockscreen.lockedoutpermanently"; protected final static String LOCKOUT_ATTEMPT_DEADLINE = "lockscreen.lockoutattemptdeadline"; protected final static String PATTERN_EVER_CHOSEN_KEY = "lockscreen.patterneverchosen"; @@ -133,7 +166,9 @@ public class LockPatternUtils { private final ContentResolver mContentResolver; private DevicePolicyManager mDevicePolicyManager; private ILockSettings mLockSettingsService; - private int mCurrentUserId = 0; + + // The current user is set by KeyguardViewMediator and shared by all LockPatternUtils. + private static volatile int sCurrentUserId = UserHandle.USER_NULL; public DevicePolicyManager getDevicePolicyManager() { if (mDevicePolicyManager == null) { @@ -164,7 +199,7 @@ private ILockSettings getLockSettings() { } public int getRequestedMinimumPasswordLength() { - return getDevicePolicyManager().getPasswordMinimumLength(null); + return getDevicePolicyManager().getPasswordMinimumLength(null, getCurrentOrCallingUserId()); } /** @@ -172,81 +207,88 @@ public int getRequestedMinimumPasswordLength() { * MODE_PATTERN which allows the user to choose anything. */ public int getRequestedPasswordQuality() { - return getDevicePolicyManager().getPasswordQuality(null); + return getDevicePolicyManager().getPasswordQuality(null, getCurrentOrCallingUserId()); } public int getRequestedPasswordHistoryLength() { - return getDevicePolicyManager().getPasswordHistoryLength(null); + return getDevicePolicyManager().getPasswordHistoryLength(null, getCurrentOrCallingUserId()); } public int getRequestedPasswordMinimumLetters() { - return getDevicePolicyManager().getPasswordMinimumLetters(null); + return getDevicePolicyManager().getPasswordMinimumLetters(null, + getCurrentOrCallingUserId()); } public int getRequestedPasswordMinimumUpperCase() { - return getDevicePolicyManager().getPasswordMinimumUpperCase(null); + return getDevicePolicyManager().getPasswordMinimumUpperCase(null, + getCurrentOrCallingUserId()); } public int getRequestedPasswordMinimumLowerCase() { - return getDevicePolicyManager().getPasswordMinimumLowerCase(null); + return getDevicePolicyManager().getPasswordMinimumLowerCase(null, + getCurrentOrCallingUserId()); } public int getRequestedPasswordMinimumNumeric() { - return getDevicePolicyManager().getPasswordMinimumNumeric(null); + return getDevicePolicyManager().getPasswordMinimumNumeric(null, + getCurrentOrCallingUserId()); } public int getRequestedPasswordMinimumSymbols() { - return getDevicePolicyManager().getPasswordMinimumSymbols(null); + return getDevicePolicyManager().getPasswordMinimumSymbols(null, + getCurrentOrCallingUserId()); } public int getRequestedPasswordMinimumNonLetter() { - return getDevicePolicyManager().getPasswordMinimumNonLetter(null); + return getDevicePolicyManager().getPasswordMinimumNonLetter(null, + getCurrentOrCallingUserId()); } + /** * Returns the actual password mode, as set by keyguard after updating the password. * * @return */ public void reportFailedPasswordAttempt() { - getDevicePolicyManager().reportFailedPasswordAttempt(); + getDevicePolicyManager().reportFailedPasswordAttempt(getCurrentOrCallingUserId()); } public void reportSuccessfulPasswordAttempt() { - getDevicePolicyManager().reportSuccessfulPasswordAttempt(); + getDevicePolicyManager().reportSuccessfulPasswordAttempt(getCurrentOrCallingUserId()); } public void setCurrentUser(int userId) { - if (Process.myUid() == Process.SYSTEM_UID) { - mCurrentUserId = userId; - } else { - throw new SecurityException("Only the system process can set the current user"); - } + sCurrentUserId = userId; } public int getCurrentUser() { - if (Process.myUid() == Process.SYSTEM_UID) { - return mCurrentUserId; - } else { - throw new SecurityException("Only the system process can get the current user"); + if (sCurrentUserId != UserHandle.USER_NULL) { + // Someone is regularly updating using setCurrentUser() use that value. + return sCurrentUserId; + } + try { + return ActivityManagerNative.getDefault().getCurrentUser().id; + } catch (RemoteException re) { + return UserHandle.USER_OWNER; } } public void removeUser(int userId) { - if (Process.myUid() == Process.SYSTEM_UID) { - try { - getLockSettings().removeUser(userId); - } catch (RemoteException re) { - Log.e(TAG, "Couldn't remove lock settings for user " + userId); - } + try { + getLockSettings().removeUser(userId); + } catch (RemoteException re) { + Log.e(TAG, "Couldn't remove lock settings for user " + userId); } } private int getCurrentOrCallingUserId() { int callingUid = Binder.getCallingUid(); if (callingUid == android.os.Process.SYSTEM_UID) { - return mCurrentUserId; + // TODO: This is a little inefficient. See if all users of this are able to + // handle USER_CURRENT and pass that instead. + return getCurrentUser(); } else { - return UserId.getUserId(callingUid); + return UserHandle.getUserId(callingUid); } } @@ -257,9 +299,13 @@ private int getCurrentOrCallingUserId() { * @return Whether the pattern matches the stored one. */ public boolean checkPattern(List pattern) { - int userId = getCurrentOrCallingUserId(); + final int userId = getCurrentOrCallingUserId(); try { - return getLockSettings().checkPattern(patternToHash(pattern), userId); + final boolean matched = getLockSettings().checkPattern(patternToHash(pattern), userId); + if (matched && (userId == UserHandle.USER_OWNER)) { + KeyStore.getInstance().password(patternToString(pattern)); + } + return matched; } catch (RemoteException re) { return true; } @@ -272,9 +318,14 @@ public boolean checkPattern(List pattern) { * @return Whether the password matches the stored one. */ public boolean checkPassword(String password) { - int userId = getCurrentOrCallingUserId(); + final int userId = getCurrentOrCallingUserId(); try { - return getLockSettings().checkPassword(passwordToHash(password), userId); + final boolean matched = getLockSettings().checkPassword(passwordToHash(password), + userId); + if (matched && (userId == UserHandle.USER_OWNER)) { + KeyStore.getInstance().password(password); + } + return matched; } catch (RemoteException re) { return true; } @@ -476,21 +527,21 @@ public void saveLockPattern(List pattern, boolean isFallba deleteGallery(); setLong(PASSWORD_TYPE_KEY, DevicePolicyManager.PASSWORD_QUALITY_SOMETHING); dpm.setActivePasswordState(DevicePolicyManager.PASSWORD_QUALITY_SOMETHING, - pattern.size(), 0, 0, 0, 0, 0, 0); + pattern.size(), 0, 0, 0, 0, 0, 0, getCurrentOrCallingUserId()); } else { setLong(PASSWORD_TYPE_KEY, DevicePolicyManager.PASSWORD_QUALITY_BIOMETRIC_WEAK); setLong(PASSWORD_TYPE_ALTERNATE_KEY, DevicePolicyManager.PASSWORD_QUALITY_SOMETHING); finishBiometricWeak(); dpm.setActivePasswordState(DevicePolicyManager.PASSWORD_QUALITY_BIOMETRIC_WEAK, - 0, 0, 0, 0, 0, 0, 0); + 0, 0, 0, 0, 0, 0, 0, getCurrentOrCallingUserId()); } } else { if (keyStore.isEmpty()) { keyStore.reset(); } dpm.setActivePasswordState(DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED, 0, 0, - 0, 0, 0, 0, 0); + 0, 0, 0, 0, 0, getCurrentOrCallingUserId()); } } catch (RemoteException re) { Log.e(TAG, "Couldn't save lock pattern " + re); @@ -527,7 +578,8 @@ static public int computePasswordQuality(String password) { /** Update the encryption password if it is enabled **/ private void updateEncryptionPassword(String password) { DevicePolicyManager dpm = getDevicePolicyManager(); - if (dpm.getStorageEncryptionStatus() != DevicePolicyManager.ENCRYPTION_STATUS_ACTIVE) { + if (dpm.getStorageEncryptionStatus(getCurrentOrCallingUserId()) + != DevicePolicyManager.ENCRYPTION_STATUS_ACTIVE) { return; } @@ -553,7 +605,7 @@ private void updateEncryptionPassword(String password) { * @param quality {@see DevicePolicyManager#getPasswordQuality(android.content.ComponentName)} */ public void saveLockPassword(String password, int quality) { - this.saveLockPassword(password, quality, false); + this.saveLockPassword(password, quality, false, getCurrentOrCallingUserId()); } /** @@ -565,23 +617,38 @@ public void saveLockPassword(String password, int quality) { * @param isFallback Specifies if this is a fallback to biometric weak */ public void saveLockPassword(String password, int quality, boolean isFallback) { + saveLockPassword(password, quality, isFallback, getCurrentOrCallingUserId()); + } + + /** + * Save a lock password. Does not ensure that the password is as good + * as the requested mode, but will adjust the mode to be as good as the + * pattern. + * @param password The password to save + * @param quality {@see DevicePolicyManager#getPasswordQuality(android.content.ComponentName)} + * @param isFallback Specifies if this is a fallback to biometric weak + * @param userHandle The userId of the user to change the password for + */ + public void saveLockPassword(String password, int quality, boolean isFallback, int userHandle) { // Compute the hash final byte[] hash = passwordToHash(password); try { - getLockSettings().setLockPassword(hash, getCurrentOrCallingUserId()); + getLockSettings().setLockPassword(hash, userHandle); DevicePolicyManager dpm = getDevicePolicyManager(); KeyStore keyStore = KeyStore.getInstance(); if (password != null) { - // Update the encryption password. - updateEncryptionPassword(password); + if (userHandle == UserHandle.USER_OWNER) { + // Update the encryption password. + updateEncryptionPassword(password); - // Update the keystore password - keyStore.password(password); + // Update the keystore password + keyStore.password(password); + } int computedQuality = computePasswordQuality(password); if (!isFallback) { deleteGallery(); - setLong(PASSWORD_TYPE_KEY, Math.max(quality, computedQuality)); + setLong(PASSWORD_TYPE_KEY, Math.max(quality, computedQuality), userHandle); if (computedQuality != DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED) { int letters = 0; int uppercase = 0; @@ -607,25 +674,27 @@ public void saveLockPassword(String password, int quality, boolean isFallback) { } dpm.setActivePasswordState(Math.max(quality, computedQuality), password.length(), letters, uppercase, lowercase, - numbers, symbols, nonletter); + numbers, symbols, nonletter, userHandle); } else { // The password is not anything. dpm.setActivePasswordState( DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED, - 0, 0, 0, 0, 0, 0, 0); + 0, 0, 0, 0, 0, 0, 0, userHandle); } } else { // Case where it's a fallback for biometric weak - setLong(PASSWORD_TYPE_KEY, DevicePolicyManager.PASSWORD_QUALITY_BIOMETRIC_WEAK); - setLong(PASSWORD_TYPE_ALTERNATE_KEY, Math.max(quality, computedQuality)); + setLong(PASSWORD_TYPE_KEY, DevicePolicyManager.PASSWORD_QUALITY_BIOMETRIC_WEAK, + userHandle); + setLong(PASSWORD_TYPE_ALTERNATE_KEY, Math.max(quality, computedQuality), + userHandle); finishBiometricWeak(); dpm.setActivePasswordState(DevicePolicyManager.PASSWORD_QUALITY_BIOMETRIC_WEAK, - 0, 0, 0, 0, 0, 0, 0); + 0, 0, 0, 0, 0, 0, 0, userHandle); } // Add the password to the password history. We assume all // password // hashes have the same length for simplicity of implementation. - String passwordHistory = getString(PASSWORD_HISTORY_KEY); + String passwordHistory = getString(PASSWORD_HISTORY_KEY, userHandle); if (passwordHistory == null) { passwordHistory = new String(); } @@ -640,7 +709,7 @@ public void saveLockPassword(String password, int quality, boolean isFallback) { * passwordHistoryLength + passwordHistoryLength - 1, passwordHistory .length())); } - setString(PASSWORD_HISTORY_KEY, passwordHistory); + setString(PASSWORD_HISTORY_KEY, passwordHistory, userHandle); } else { // Conditionally reset the keystore if empty. If // non-empty, we are just switching key guard type @@ -648,7 +717,8 @@ public void saveLockPassword(String password, int quality, boolean isFallback) { keyStore.reset(); } dpm.setActivePasswordState( - DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED, 0, 0, 0, 0, 0, 0, 0); + DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED, 0, 0, 0, 0, 0, 0, 0, + userHandle); } } catch (RemoteException re) { // Cant do much @@ -844,7 +914,7 @@ public boolean isBiometricWeakInstalled() { if (!pm.hasSystemFeature(PackageManager.FEATURE_CAMERA_FRONT)) { return false; } - if (getDevicePolicyManager().getCameraDisabled(null)) { + if (getDevicePolicyManager().getCameraDisabled(null, getCurrentOrCallingUserId())) { return false; } @@ -899,14 +969,8 @@ public void setVisiblePatternEnabled(boolean enabled) { * @return Whether tactile feedback for the pattern is enabled. */ public boolean isTactileFeedbackEnabled() { - return getBoolean(Settings.Secure.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED, false); - } - - /** - * Set whether tactile feedback for the pattern is enabled. - */ - public void setTactileFeedbackEnabled(boolean enabled) { - setBoolean(Settings.Secure.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED, enabled); + return Settings.System.getIntForUser(mContentResolver, + Settings.System.HAPTIC_FEEDBACK_ENABLED, 1, UserHandle.USER_CURRENT) != 0; } /** @@ -975,8 +1039,8 @@ public boolean isEmergencyCallEnabledWhileSimLocked() { * or null if there is no next alarm. */ public String getNextAlarm() { - String nextAlarm = Settings.System.getString(mContentResolver, - Settings.System.NEXT_ALARM_FORMATTED); + String nextAlarm = Settings.System.getStringForUser(mContentResolver, + Settings.System.NEXT_ALARM_FORMATTED, UserHandle.USER_CURRENT); if (nextAlarm == null || TextUtils.isEmpty(nextAlarm)) { return null; } @@ -1001,6 +1065,137 @@ private void setBoolean(String secureSettingKey, boolean enabled) { } } + public int[] getAppWidgets() { + String appWidgetIdString = Settings.Secure.getStringForUser( + mContentResolver, Settings.Secure.LOCK_SCREEN_APPWIDGET_IDS, + UserHandle.USER_CURRENT); + String delims = ","; + if (appWidgetIdString != null && appWidgetIdString.length() > 0) { + String[] appWidgetStringIds = appWidgetIdString.split(delims); + int[] appWidgetIds = new int[appWidgetStringIds.length]; + for (int i = 0; i < appWidgetStringIds.length; i++) { + String appWidget = appWidgetStringIds[i]; + try { + appWidgetIds[i] = Integer.decode(appWidget); + } catch (NumberFormatException e) { + Log.d(TAG, "Error when parsing widget id " + appWidget); + return null; + } + } + return appWidgetIds; + } + return new int[0]; + } + + private static String combineStrings(int[] list, String separator) { + int listLength = list.length; + + switch (listLength) { + case 0: { + return ""; + } + case 1: { + return Integer.toString(list[0]); + } + } + + int strLength = 0; + int separatorLength = separator.length(); + + String[] stringList = new String[list.length]; + for (int i = 0; i < listLength; i++) { + stringList[i] = Integer.toString(list[i]); + strLength += stringList[i].length(); + if (i < listLength - 1) { + strLength += separatorLength; + } + } + + StringBuilder sb = new StringBuilder(strLength); + + for (int i = 0; i < listLength; i++) { + sb.append(list[i]); + if (i < listLength - 1) { + sb.append(separator); + } + } + + return sb.toString(); + } + + // appwidget used when appwidgets are disabled (we make an exception for + // default clock widget) + public void writeFallbackAppWidgetId(int appWidgetId) { + Settings.Secure.putIntForUser(mContentResolver, + Settings.Secure.LOCK_SCREEN_FALLBACK_APPWIDGET_ID, + appWidgetId, + UserHandle.USER_CURRENT); + } + + // appwidget used when appwidgets are disabled (we make an exception for + // default clock widget) + public int getFallbackAppWidgetId() { + return Settings.Secure.getIntForUser( + mContentResolver, + Settings.Secure.LOCK_SCREEN_FALLBACK_APPWIDGET_ID, + AppWidgetManager.INVALID_APPWIDGET_ID, + UserHandle.USER_CURRENT); + } + + private void writeAppWidgets(int[] appWidgetIds) { + Settings.Secure.putStringForUser(mContentResolver, + Settings.Secure.LOCK_SCREEN_APPWIDGET_IDS, + combineStrings(appWidgetIds, ","), + UserHandle.USER_CURRENT); + } + + // TODO: log an error if this returns false + public boolean addAppWidget(int widgetId, int index) { + int[] widgets = getAppWidgets(); + if (widgets == null) { + return false; + } + if (index < 0 || index > widgets.length) { + return false; + } + int[] newWidgets = new int[widgets.length + 1]; + for (int i = 0, j = 0; i < newWidgets.length; i++) { + if (index == i) { + newWidgets[i] = widgetId; + i++; + } + if (i < newWidgets.length) { + newWidgets[i] = widgets[j]; + j++; + } + } + writeAppWidgets(newWidgets); + return true; + } + + public boolean removeAppWidget(int widgetId) { + int[] widgets = getAppWidgets(); + + if (widgets.length == 0) { + return false; + } + + int[] newWidgets = new int[widgets.length - 1]; + for (int i = 0, j = 0; i < widgets.length; i++) { + if (widgets[i] == widgetId) { + // continue... + } else if (j >= newWidgets.length) { + // we couldn't find the widget + return false; + } else { + newWidgets[j] = widgets[i]; + j++; + } + } + writeAppWidgets(newWidgets); + return true; + } + private long getLong(String secureSettingKey, long defaultValue) { try { return getLockSettings().getLong(secureSettingKey, defaultValue, @@ -1011,6 +1206,10 @@ private long getLong(String secureSettingKey, long defaultValue) { } private void setLong(String secureSettingKey, long value) { + setLong(secureSettingKey, value, getCurrentOrCallingUserId()); + } + + private void setLong(String secureSettingKey, long value, int userHandle) { try { getLockSettings().setLong(secureSettingKey, value, getCurrentOrCallingUserId()); } catch (RemoteException re) { @@ -1020,17 +1219,20 @@ private void setLong(String secureSettingKey, long value) { } private String getString(String secureSettingKey) { + return getString(secureSettingKey, getCurrentOrCallingUserId()); + } + + private String getString(String secureSettingKey, int userHandle) { try { - return getLockSettings().getString(secureSettingKey, null, - getCurrentOrCallingUserId()); + return getLockSettings().getString(secureSettingKey, null, userHandle); } catch (RemoteException re) { return null; } } - private void setString(String secureSettingKey, String value) { + private void setString(String secureSettingKey, String value, int userHandle) { try { - getLockSettings().setString(secureSettingKey, value, getCurrentOrCallingUserId()); + getLockSettings().setString(secureSettingKey, value, userHandle); } catch (RemoteException re) { // What can we do? Log.e(TAG, "Couldn't write string " + secureSettingKey + re); @@ -1062,8 +1264,13 @@ public boolean isSecure() { * {@link TelephonyManager#CALL_STATE_RINGING} * {@link TelephonyManager#CALL_STATE_OFFHOOK} * @param shown indicates whether the given screen wants the emergency button to show at all + * @param button + * @param phoneState + * @param shown shown if true; hidden if false + * @param upperCase if true, converts button label string to upper case */ - public void updateEmergencyCallButtonState(Button button, int phoneState, boolean shown) { + public void updateEmergencyCallButtonState(Button button, int phoneState, boolean shown, + boolean upperCase, boolean showIcon) { if (isEmergencyCallCapable() && shown) { button.setVisibility(View.VISIBLE); } else { @@ -1075,14 +1282,30 @@ public void updateEmergencyCallButtonState(Button button, int phoneState, boole if (phoneState == TelephonyManager.CALL_STATE_OFFHOOK) { // show "return to call" text and show phone icon textId = R.string.lockscreen_return_to_call; - int phoneCallIcon = R.drawable.stat_sys_phone_call; + int phoneCallIcon = showIcon ? R.drawable.stat_sys_phone_call : 0; button.setCompoundDrawablesWithIntrinsicBounds(phoneCallIcon, 0, 0, 0); } else { textId = R.string.lockscreen_emergency_call; - int emergencyIcon = R.drawable.ic_emergency; + int emergencyIcon = showIcon ? R.drawable.ic_emergency : 0; button.setCompoundDrawablesWithIntrinsicBounds(emergencyIcon, 0, 0, 0); } - button.setText(textId); + if (upperCase) { + CharSequence original = mContext.getResources().getText(textId); + String upper = original != null ? original.toString().toUpperCase() : null; + button.setText(upper); + } else { + button.setText(textId); + } + } + + /** + * @deprecated + * @param button + * @param phoneState + * @param shown + */ + public void updateEmergencyCallButtonState(Button button, int phoneState, boolean shown) { + updateEmergencyCallButtonState(button, phoneState, shown, false, true); } /** @@ -1122,4 +1345,23 @@ public boolean getPowerButtonInstantlyLocks() { return getBoolean(LOCKSCREEN_POWER_BUTTON_INSTANTLY_LOCKS, true); } + public static boolean isSafeModeEnabled() { + try { + return IWindowManager.Stub.asInterface( + ServiceManager.getService("window")).isSafeModeEnabled(); + } catch (RemoteException e) { + // Shouldn't happen! + } + return false; + } + + /** + * @hide + * Set the lock-before-unlock option (show widgets before the secure + * unlock screen). See config_enableLockBeforeUnlockScreen + */ + public void setLockBeforeUnlock(boolean enabled) { + setBoolean(Settings.Secure.LOCK_BEFORE_UNLOCK, enabled); + } + } diff --git a/core/java/com/android/internal/widget/LockPatternView.java b/core/java/com/android/internal/widget/LockPatternView.java index 0d9cf9ac4d272..7a76ab01b8c0c 100644 --- a/core/java/com/android/internal/widget/LockPatternView.java +++ b/core/java/com/android/internal/widget/LockPatternView.java @@ -18,7 +18,6 @@ import android.content.Context; -import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.Bitmap; import android.graphics.BitmapFactory; @@ -33,11 +32,9 @@ import android.os.Parcelable; import android.os.SystemClock; import android.util.AttributeSet; -import android.util.Log; import android.view.HapticFeedbackConstants; import android.view.MotionEvent; import android.view.View; -import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityManager; import com.android.internal.R; @@ -375,31 +372,31 @@ public void setDisplayMode(DisplayMode displayMode) { } private void notifyCellAdded() { + sendAccessEvent(R.string.lockscreen_access_pattern_cell_added); if (mOnPatternListener != null) { mOnPatternListener.onPatternCellAdded(mPattern); } - sendAccessEvent(R.string.lockscreen_access_pattern_cell_added); } private void notifyPatternStarted() { + sendAccessEvent(R.string.lockscreen_access_pattern_start); if (mOnPatternListener != null) { mOnPatternListener.onPatternStart(); } - sendAccessEvent(R.string.lockscreen_access_pattern_start); } private void notifyPatternDetected() { + sendAccessEvent(R.string.lockscreen_access_pattern_detected); if (mOnPatternListener != null) { mOnPatternListener.onPatternDetected(mPattern); } - sendAccessEvent(R.string.lockscreen_access_pattern_detected); } private void notifyPatternCleared() { + sendAccessEvent(R.string.lockscreen_access_pattern_cleared); if (mOnPatternListener != null) { mOnPatternListener.onPatternCleared(); } - sendAccessEvent(R.string.lockscreen_access_pattern_cleared); } /** @@ -657,9 +654,11 @@ public boolean onTouchEvent(MotionEvent event) { handleActionMove(event); return true; case MotionEvent.ACTION_CANCEL: - resetPattern(); - mPatternInProgress = false; - notifyPatternCleared(); + if (mPatternInProgress) { + mPatternInProgress = false; + resetPattern(); + notifyPatternCleared(); + } if (PROFILE_DRAWING) { if (mDrawingProfilingStarted) { Debug.stopMethodTracing(); @@ -799,9 +798,7 @@ private void handleActionMove(MotionEvent event) { } private void sendAccessEvent(int resId) { - setContentDescription(mContext.getString(resId)); - sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_SELECTED); - setContentDescription(null); + announceForAccessibility(mContext.getString(resId)); } private void handleActionUp(MotionEvent event) { @@ -828,7 +825,7 @@ private void handleActionDown(MotionEvent event) { mPatternInProgress = true; mPatternDisplayMode = DisplayMode.Correct; notifyPatternStarted(); - } else { + } else if (mPatternInProgress) { mPatternInProgress = false; notifyPatternCleared(); } diff --git a/core/java/com/android/internal/widget/LockSettingsService.java b/core/java/com/android/internal/widget/LockSettingsService.java index 24c7161a1e147..4ecbd1609e760 100644 --- a/core/java/com/android/internal/widget/LockSettingsService.java +++ b/core/java/com/android/internal/widget/LockSettingsService.java @@ -23,8 +23,10 @@ import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import android.os.Binder; +import android.os.Environment; import android.os.RemoteException; -import android.os.UserId; +import android.os.SystemProperties; +import android.os.UserHandle; import android.provider.Settings; import android.provider.Settings.Secure; import android.text.TextUtils; @@ -96,7 +98,7 @@ private void migrateOldData() { private static final void checkWritePermission(int userId) { final int callingUid = Binder.getCallingUid(); - if (UserId.getAppId(callingUid) != android.os.Process.SYSTEM_UID) { + if (UserHandle.getAppId(callingUid) != android.os.Process.SYSTEM_UID) { throw new SecurityException("uid=" + callingUid + " not authorized to write lock settings"); } @@ -104,7 +106,7 @@ private static final void checkWritePermission(int userId) { private static final void checkPasswordReadPermission(int userId) { final int callingUid = Binder.getCallingUid(); - if (UserId.getAppId(callingUid) != android.os.Process.SYSTEM_UID) { + if (UserHandle.getAppId(callingUid) != android.os.Process.SYSTEM_UID) { throw new SecurityException("uid=" + callingUid + " not authorized to read lock password"); } @@ -112,8 +114,8 @@ private static final void checkPasswordReadPermission(int userId) { private static final void checkReadPermission(int userId) { final int callingUid = Binder.getCallingUid(); - if (UserId.getAppId(callingUid) != android.os.Process.SYSTEM_UID - && UserId.getUserId(callingUid) != userId) { + if (UserHandle.getAppId(callingUid) != android.os.Process.SYSTEM_UID + && UserHandle.getUserId(callingUid) != userId) { throw new SecurityException("uid=" + callingUid + " not authorized to read settings of user " + userId); } @@ -172,7 +174,8 @@ private String getLockPatternFilename(int userId) { // Leave it in the same place for user 0 return dataSystemDirectory + LOCK_PATTERN_FILE; } else { - return dataSystemDirectory + "users/" + userId + "/" + LOCK_PATTERN_FILE; + return new File(Environment.getUserSystemDirectory(userId), LOCK_PATTERN_FILE) + .getAbsolutePath(); } } @@ -184,7 +187,8 @@ private String getLockPasswordFilename(int userId) { // Leave it in the same place for user 0 return dataSystemDirectory + LOCK_PASSWORD_FILE; } else { - return dataSystemDirectory + "users/" + userId + "/" + LOCK_PASSWORD_FILE; + return new File(Environment.getUserSystemDirectory(userId), LOCK_PASSWORD_FILE) + .getAbsolutePath(); } } @@ -303,12 +307,15 @@ private void writeFile(String name, byte[] hash) { } private void writeToDb(String key, String value, int userId) { + writeToDb(mOpenHelper.getWritableDatabase(), key, value, userId); + } + + private void writeToDb(SQLiteDatabase db, String key, String value, int userId) { ContentValues cv = new ContentValues(); cv.put(COLUMN_KEY, key); cv.put(COLUMN_USERID, userId); cv.put(COLUMN_VALUE, value); - SQLiteDatabase db = mOpenHelper.getWritableDatabase(); db.beginTransaction(); try { db.delete(TABLE, COLUMN_KEY + "=? AND " + COLUMN_USERID + "=?", @@ -359,6 +366,16 @@ private void createTable(SQLiteDatabase db) { @Override public void onCreate(SQLiteDatabase db) { createTable(db); + initializeDefaults(db); + } + + private void initializeDefaults(SQLiteDatabase db) { + // Get the lockscreen default from a system property, if available + boolean lockScreenDisable = SystemProperties.getBoolean("ro.lockscreen.disable.default", + false); + if (lockScreenDisable) { + writeToDb(db, LockPatternUtils.DISABLE_LOCKSCREEN_KEY, "1", 0); + } } @Override diff --git a/core/java/com/android/internal/widget/PasswordEntryKeyboardHelper.java b/core/java/com/android/internal/widget/PasswordEntryKeyboardHelper.java index 26518ebdd2a7d..f8332c48783a4 100644 --- a/core/java/com/android/internal/widget/PasswordEntryKeyboardHelper.java +++ b/core/java/com/android/internal/widget/PasswordEntryKeyboardHelper.java @@ -31,6 +31,7 @@ import android.view.KeyEvent; import android.view.View; import android.view.ViewGroup; +import android.view.ViewGroup.LayoutParams; import android.view.ViewRootImpl; import com.android.internal.R; @@ -55,23 +56,56 @@ public class PasswordEntryKeyboardHelper implements OnKeyboardActionListener { private long[] mVibratePattern; private boolean mEnableHaptics = false; + private static final int NUMERIC = 0; + private static final int QWERTY = 1; + private static final int QWERTY_SHIFTED = 2; + private static final int SYMBOLS = 3; + private static final int SYMBOLS_SHIFTED = 4; + + int mLayouts[] = new int[] { + R.xml.password_kbd_numeric, + R.xml.password_kbd_qwerty, + R.xml.password_kbd_qwerty_shifted, + R.xml.password_kbd_symbols, + R.xml.password_kbd_symbols_shift + }; + + private boolean mUsingScreenWidth; + public PasswordEntryKeyboardHelper(Context context, KeyboardView keyboardView, View targetView) { - this(context, keyboardView, targetView, true); + this(context, keyboardView, targetView, true, null); } public PasswordEntryKeyboardHelper(Context context, KeyboardView keyboardView, View targetView, boolean useFullScreenWidth) { + this(context, keyboardView, targetView, useFullScreenWidth, null); + } + + public PasswordEntryKeyboardHelper(Context context, KeyboardView keyboardView, View targetView, + boolean useFullScreenWidth, int layouts[]) { mContext = context; mTargetView = targetView; mKeyboardView = keyboardView; - if (useFullScreenWidth - || mKeyboardView.getLayoutParams().width == ViewGroup.LayoutParams.MATCH_PARENT) { - createKeyboards(); + mKeyboardView.setOnKeyboardActionListener(this); + mUsingScreenWidth = useFullScreenWidth; + if (layouts != null) { + if (layouts.length != mLayouts.length) { + throw new RuntimeException("Wrong number of layouts"); + } + for (int i = 0; i < mLayouts.length; i++) { + mLayouts[i] = layouts[i]; + } + } + createKeyboards(); + } + + public void createKeyboards() { + LayoutParams lp = mKeyboardView.getLayoutParams(); + if (mUsingScreenWidth || lp.width == ViewGroup.LayoutParams.MATCH_PARENT) { + createKeyboardsWithDefaultWidth(); } else { - createKeyboardsWithSpecificSize(mKeyboardView.getLayoutParams().width, - mKeyboardView.getLayoutParams().height); + createKeyboardsWithSpecificSize(lp.width, lp.height); } - mKeyboardView.setOnKeyboardActionListener(this); } public void setEnableHaptics(boolean enabled) { @@ -82,46 +116,40 @@ public boolean isAlpha() { return mKeyboardMode == KEYBOARD_MODE_ALPHA; } - private void createKeyboardsWithSpecificSize(int viewWidth, int viewHeight) { - mNumericKeyboard = new PasswordEntryKeyboard(mContext, R.xml.password_kbd_numeric, - viewWidth, viewHeight); - mQwertyKeyboard = new PasswordEntryKeyboard(mContext, - R.xml.password_kbd_qwerty, R.id.mode_normal, viewWidth, viewHeight); + private void createKeyboardsWithSpecificSize(int width, int height) { + mNumericKeyboard = new PasswordEntryKeyboard(mContext, mLayouts[NUMERIC], width, height); + mQwertyKeyboard = new PasswordEntryKeyboard(mContext, mLayouts[QWERTY], R.id.mode_normal, + width, height); mQwertyKeyboard.enableShiftLock(); - mQwertyKeyboardShifted = new PasswordEntryKeyboard(mContext, - R.xml.password_kbd_qwerty_shifted, - R.id.mode_normal, viewWidth, viewHeight); + mQwertyKeyboardShifted = new PasswordEntryKeyboard(mContext, mLayouts[QWERTY_SHIFTED], + R.id.mode_normal, width, height); mQwertyKeyboardShifted.enableShiftLock(); mQwertyKeyboardShifted.setShifted(true); // always shifted. - mSymbolsKeyboard = new PasswordEntryKeyboard(mContext, R.xml.password_kbd_symbols, - viewWidth, viewHeight); + mSymbolsKeyboard = new PasswordEntryKeyboard(mContext, mLayouts[SYMBOLS], width, height); mSymbolsKeyboard.enableShiftLock(); - mSymbolsKeyboardShifted = new PasswordEntryKeyboard(mContext, - R.xml.password_kbd_symbols_shift, viewWidth, viewHeight); + mSymbolsKeyboardShifted = new PasswordEntryKeyboard(mContext, mLayouts[SYMBOLS_SHIFTED], + width, height); mSymbolsKeyboardShifted.enableShiftLock(); mSymbolsKeyboardShifted.setShifted(true); // always shifted } - private void createKeyboards() { - mNumericKeyboard = new PasswordEntryKeyboard(mContext, R.xml.password_kbd_numeric); - mQwertyKeyboard = new PasswordEntryKeyboard(mContext, - R.xml.password_kbd_qwerty, R.id.mode_normal); + private void createKeyboardsWithDefaultWidth() { + mNumericKeyboard = new PasswordEntryKeyboard(mContext, mLayouts[NUMERIC]); + mQwertyKeyboard = new PasswordEntryKeyboard(mContext, mLayouts[QWERTY], R.id.mode_normal); mQwertyKeyboard.enableShiftLock(); - mQwertyKeyboardShifted = new PasswordEntryKeyboard(mContext, - R.xml.password_kbd_qwerty_shifted, + mQwertyKeyboardShifted = new PasswordEntryKeyboard(mContext, mLayouts[QWERTY_SHIFTED], R.id.mode_normal); mQwertyKeyboardShifted.enableShiftLock(); mQwertyKeyboardShifted.setShifted(true); // always shifted. - mSymbolsKeyboard = new PasswordEntryKeyboard(mContext, R.xml.password_kbd_symbols); + mSymbolsKeyboard = new PasswordEntryKeyboard(mContext, mLayouts[SYMBOLS]); mSymbolsKeyboard.enableShiftLock(); - mSymbolsKeyboardShifted = new PasswordEntryKeyboard(mContext, - R.xml.password_kbd_symbols_shift); + mSymbolsKeyboardShifted = new PasswordEntryKeyboard(mContext, mLayouts[SYMBOLS_SHIFTED]); mSymbolsKeyboardShifted.enableShiftLock(); mSymbolsKeyboardShifted.setShifted(true); // always shifted } diff --git a/core/java/com/android/internal/widget/RotarySelector.java b/core/java/com/android/internal/widget/RotarySelector.java index a2a38dcc9b510..4e405f4cd7e82 100644 --- a/core/java/com/android/internal/widget/RotarySelector.java +++ b/core/java/com/android/internal/widget/RotarySelector.java @@ -25,7 +25,9 @@ import android.graphics.BitmapFactory; import android.graphics.Matrix; import android.graphics.drawable.Drawable; +import android.os.UserHandle; import android.os.Vibrator; +import android.provider.Settings; import android.util.AttributeSet; import android.util.Log; import android.view.MotionEvent; @@ -667,11 +669,16 @@ private void reset() { * Triggers haptic feedback. */ private synchronized void vibrate(long duration) { - if (mVibrator == null) { - mVibrator = (android.os.Vibrator) - getContext().getSystemService(Context.VIBRATOR_SERVICE); + final boolean hapticEnabled = Settings.System.getIntForUser( + mContext.getContentResolver(), Settings.System.HAPTIC_FEEDBACK_ENABLED, 1, + UserHandle.USER_CURRENT) != 0; + if (hapticEnabled) { + if (mVibrator == null) { + mVibrator = (android.os.Vibrator) getContext() + .getSystemService(Context.VIBRATOR_SERVICE); + } + mVibrator.vibrate(duration); } - mVibrator.vibrate(duration); } /** diff --git a/core/java/com/android/internal/widget/ScrollingTabContainerView.java b/core/java/com/android/internal/widget/ScrollingTabContainerView.java index 83ac89689942b..b6205689bcece 100644 --- a/core/java/com/android/internal/widget/ScrollingTabContainerView.java +++ b/core/java/com/android/internal/widget/ScrollingTabContainerView.java @@ -23,7 +23,9 @@ import android.app.ActionBar; import android.content.Context; import android.content.res.Configuration; +import android.graphics.Rect; import android.graphics.drawable.Drawable; +import android.text.TextUtils; import android.text.TextUtils.TruncateAt; import android.view.Gravity; import android.view.View; @@ -38,6 +40,7 @@ import android.widget.ListView; import android.widget.Spinner; import android.widget.TextView; +import android.widget.Toast; /** * This widget implements the dynamic action bar tab behavior that can change @@ -352,7 +355,7 @@ public void onItemClick(AdapterView parent, View view, int position, long id) tabView.getTab().select(); } - private class TabView extends LinearLayout { + private class TabView extends LinearLayout implements OnLongClickListener { private ActionBar.Tab mTab; private TextView mTextView; private ImageView mIconView; @@ -363,7 +366,7 @@ public TabView(Context context, ActionBar.Tab tab, boolean forList) { mTab = tab; if (forList) { - setGravity(Gravity.LEFT | Gravity.CENTER_VERTICAL); + setGravity(Gravity.START | Gravity.CENTER_VERTICAL); } update(); @@ -426,7 +429,8 @@ public void update() { mIconView.setImageDrawable(null); } - if (text != null) { + final boolean hasText = !TextUtils.isEmpty(text); + if (hasText) { if (mTextView == null) { TextView textView = new TextView(getContext(), null, com.android.internal.R.attr.actionBarTabTextStyle); @@ -448,9 +452,35 @@ public void update() { if (mIconView != null) { mIconView.setContentDescription(tab.getContentDescription()); } + + if (!hasText && !TextUtils.isEmpty(tab.getContentDescription())) { + setOnLongClickListener(this); + } else { + setOnLongClickListener(null); + setLongClickable(false); + } } } + public boolean onLongClick(View v) { + final int[] screenPos = new int[2]; + getLocationOnScreen(screenPos); + + final Context context = getContext(); + final int width = getWidth(); + final int height = getHeight(); + final int screenWidth = context.getResources().getDisplayMetrics().widthPixels; + + Toast cheatSheet = Toast.makeText(context, mTab.getContentDescription(), + Toast.LENGTH_SHORT); + // Show under the tab + cheatSheet.setGravity(Gravity.TOP | Gravity.CENTER_HORIZONTAL, + (screenPos[0] + width / 2) - screenWidth / 2, height); + + cheatSheet.show(); + return true; + } + public ActionBar.Tab getTab() { return mTab; } diff --git a/core/java/com/android/internal/widget/SlidingTab.java b/core/java/com/android/internal/widget/SlidingTab.java index f535a0844bfbb..aebc4f6281e36 100644 --- a/core/java/com/android/internal/widget/SlidingTab.java +++ b/core/java/com/android/internal/widget/SlidingTab.java @@ -21,7 +21,9 @@ import android.content.res.TypedArray; import android.graphics.Rect; import android.graphics.drawable.Drawable; +import android.os.UserHandle; import android.os.Vibrator; +import android.provider.Settings; import android.util.AttributeSet; import android.util.Log; import android.view.Gravity; @@ -811,11 +813,16 @@ public void setHoldAfterTrigger(boolean holdLeft, boolean holdRight) { * Triggers haptic feedback. */ private synchronized void vibrate(long duration) { - if (mVibrator == null) { - mVibrator = (android.os.Vibrator) - getContext().getSystemService(Context.VIBRATOR_SERVICE); + final boolean hapticEnabled = Settings.System.getIntForUser( + mContext.getContentResolver(), Settings.System.HAPTIC_FEEDBACK_ENABLED, 1, + UserHandle.USER_CURRENT) != 0; + if (hapticEnabled) { + if (mVibrator == null) { + mVibrator = (android.os.Vibrator) getContext() + .getSystemService(Context.VIBRATOR_SERVICE); + } + mVibrator.vibrate(duration); } - mVibrator.vibrate(duration); } /** diff --git a/core/java/com/android/internal/widget/TextProgressBar.java b/core/java/com/android/internal/widget/TextProgressBar.java index e113dd8823465..e898aa4c940b7 100644 --- a/core/java/com/android/internal/widget/TextProgressBar.java +++ b/core/java/com/android/internal/widget/TextProgressBar.java @@ -155,7 +155,7 @@ public void onChronometerTick(Chronometer chronometer) { // Calculate any adjustment based on gravity int adjustLeft = 0; int textWidth = mChronometer.getWidth(); - if (mChronometerGravity == Gravity.RIGHT) { + if (mChronometerGravity == Gravity.END) { adjustLeft = -textWidth; } else if (mChronometerGravity == Gravity.CENTER_HORIZONTAL) { adjustLeft = -(textWidth / 2); diff --git a/core/java/com/android/internal/widget/TransportControlView.java b/core/java/com/android/internal/widget/TransportControlView.java index 2f525858c6f87..c33f0388bd4c3 100644 --- a/core/java/com/android/internal/widget/TransportControlView.java +++ b/core/java/com/android/internal/widget/TransportControlView.java @@ -23,7 +23,6 @@ import android.app.PendingIntent; import android.app.PendingIntent.CanceledException; -import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.graphics.Bitmap; @@ -193,7 +192,7 @@ public void setCurrentClientId(int clientGeneration, PendingIntent mediaIntent, public TransportControlView(Context context, AttributeSet attrs) { super(context, attrs); - Log.v(TAG, "Create TCV " + this); + if (DEBUG) Log.v(TAG, "Create TCV " + this); mAudioManager = new AudioManager(mContext); mCurrentPlayState = RemoteControlClient.PLAYSTATE_NONE; // until we get a callback mIRCD = new IRemoteControlDisplayWeak(mHandler); diff --git a/core/java/com/android/internal/widget/WaveView.java b/core/java/com/android/internal/widget/WaveView.java index 2d89234000a72..d33d50cc0c420 100644 --- a/core/java/com/android/internal/widget/WaveView.java +++ b/core/java/com/android/internal/widget/WaveView.java @@ -25,7 +25,9 @@ import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.drawable.BitmapDrawable; +import android.os.UserHandle; import android.os.Vibrator; +import android.provider.Settings; import android.text.TextUtils; import android.util.AttributeSet; import android.util.Log; @@ -573,11 +575,16 @@ private void announceUnlockHandle() { * Triggers haptic feedback. */ private synchronized void vibrate(long duration) { - if (mVibrator == null) { - mVibrator = (android.os.Vibrator) - getContext().getSystemService(Context.VIBRATOR_SERVICE); + final boolean hapticEnabled = Settings.System.getIntForUser( + mContext.getContentResolver(), Settings.System.HAPTIC_FEEDBACK_ENABLED, 1, + UserHandle.USER_CURRENT) != 0; + if (hapticEnabled) { + if (mVibrator == null) { + mVibrator = (android.os.Vibrator) getContext() + .getSystemService(Context.VIBRATOR_SERVICE); + } + mVibrator.vibrate(duration); } - mVibrator.vibrate(duration); } /** diff --git a/core/java/com/android/internal/widget/multiwaveview/GlowPadView.java b/core/java/com/android/internal/widget/multiwaveview/GlowPadView.java index 4e60b7537e71b..ec28e62eff683 100644 --- a/core/java/com/android/internal/widget/multiwaveview/GlowPadView.java +++ b/core/java/com/android/internal/widget/multiwaveview/GlowPadView.java @@ -23,6 +23,7 @@ import android.animation.ValueAnimator; import android.animation.ValueAnimator.AnimatorUpdateListener; import android.content.ComponentName; +import android.content.ContentResolver; import android.content.Context; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; @@ -31,7 +32,9 @@ import android.graphics.Canvas; import android.graphics.drawable.Drawable; import android.os.Bundle; +import android.os.UserHandle; import android.os.Vibrator; +import android.provider.Settings; import android.text.TextUtils; import android.util.AttributeSet; import android.util.Log; @@ -39,7 +42,6 @@ import android.view.Gravity; import android.view.MotionEvent; import android.view.View; -import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityManager; import com.android.internal.R; @@ -61,6 +63,40 @@ public class GlowPadView extends View { private static final int STATE_SNAP = 4; private static final int STATE_FINISH = 5; + //Lockscreen targets + /** + * @hide + */ + public final static String ICON_RESOURCE = "icon_resource"; + + /** + * @hide + */ + public final static String ICON_PACKAGE = "icon_package"; + + /** + * @hide + */ + public final static String ICON_FILE = "icon_file"; + + /** + * Number of customizable lockscreen targets for tablets + * @hide + */ + public final static int MAX_TABLET_TARGETS = 7; + + /** + * Number of customizable lockscreen targets for phones + * @hide + */ + public final static int MAX_PHONE_TARGETS = 4; + + /** + * Empty target used to reference unused lockscreen targets + * @hide + */ + public final static String EMPTY_TARGET = "empty"; + // Animation properties. private static final float SNAP_MARGIN_DEFAULT = 20.0f; // distance to ring before we snap to it @@ -112,11 +148,16 @@ public interface OnTriggerListener { private float mWaveCenterY; private int mMaxTargetHeight; private int mMaxTargetWidth; + private float mRingScaleFactor = 1f; + private boolean mAllowScaling; private float mOuterRadius = 0.0f; private float mSnapMargin = 0.0f; + private float mFirstItemOffset = 0.0f; + private boolean mMagneticTargets = false; private boolean mDragging; private int mNewTargetResources; + private ArrayList mNewTargetDrawables; private class AnimationBundle extends ArrayList { private static final long serialVersionUID = 0xA84D78726F127468L; @@ -182,6 +223,10 @@ public void onAnimationEnd(Animator animator) { internalSetTargetResources(mNewTargetResources); mNewTargetResources = 0; hideTargets(false, false); + } else if (mNewTargetDrawables != null) { + internalSetTargetResources(mNewTargetDrawables); + mNewTargetDrawables = null; + hideTargets(false, false); } mAnimatingTargets = false; } @@ -197,6 +242,7 @@ public void onAnimationEnd(Animator animator) { private Tweener mBackgroundAnimator; private PointCloud mPointCloud; private float mInnerRadius; + private int mPointerId; public GlowPadView(Context context) { this(context, null); @@ -210,17 +256,22 @@ public GlowPadView(Context context, AttributeSet attrs) { mInnerRadius = a.getDimension(R.styleable.GlowPadView_innerRadius, mInnerRadius); mOuterRadius = a.getDimension(R.styleable.GlowPadView_outerRadius, mOuterRadius); mSnapMargin = a.getDimension(R.styleable.GlowPadView_snapMargin, mSnapMargin); + mFirstItemOffset = (float) Math.toRadians( + a.getFloat(R.styleable.GlowPadView_firstItemOffset, + (float) Math.toDegrees(mFirstItemOffset))); mVibrationDuration = a.getInt(R.styleable.GlowPadView_vibrationDuration, mVibrationDuration); mFeedbackCount = a.getInt(R.styleable.GlowPadView_feedbackCount, mFeedbackCount); - mHandleDrawable = new TargetDrawable(res, - a.peekValue(R.styleable.GlowPadView_handleDrawable).resourceId); + mAllowScaling = a.getBoolean(R.styleable.GlowPadView_allowScaling, false); + TypedValue handle = a.peekValue(R.styleable.GlowPadView_handleDrawable); + mHandleDrawable = new TargetDrawable(res, handle != null ? handle.resourceId : 0); mHandleDrawable.setState(TargetDrawable.STATE_INACTIVE); mOuterRing = new TargetDrawable(res, getResourceId(a, R.styleable.GlowPadView_outerRingDrawable)); mAlwaysTrackFinger = a.getBoolean(R.styleable.GlowPadView_alwaysTrackFinger, false); + mMagneticTargets = a.getBoolean(R.styleable.GlowPadView_magneticTargets, mMagneticTargets); int pointId = getResourceId(a, R.styleable.GlowPadView_pointDrawable); Drawable pointDrawable = pointId != 0 ? res.getDrawable(pointId) : null; @@ -254,14 +305,13 @@ public GlowPadView(Context context, AttributeSet attrs) { setDirectionDescriptionsResourceId(resourceId); } - a.recycle(); + mGravity = a.getInt(R.styleable.GlowPadView_gravity, Gravity.TOP); - // Use gravity attribute from LinearLayout - a = context.obtainStyledAttributes(attrs, android.R.styleable.LinearLayout); - mGravity = a.getInt(android.R.styleable.LinearLayout_gravity, Gravity.TOP); a.recycle(); - setVibrateEnabled(mVibrationDuration > 0); + final ContentResolver resolver = context.getContentResolver(); + boolean vibrateEnabled = Settings.System.getInt(resolver,Settings.System.LOCKSCREEN_VIBRATE_ENABLED, 1) == 1; + setVibrateEnabled(vibrateEnabled ? mVibrationDuration > 0 : false); assignDefaultsIfNeeded(); @@ -314,6 +364,22 @@ protected int getSuggestedMinimumHeight() { return (int) (Math.max(mOuterRing.getHeight(), 2 * mOuterRadius) + mMaxTargetHeight); } + /** + * This gets the suggested width accounting for the ring's scale factor. + */ + protected int getScaledSuggestedMinimumWidth() { + return (int) (mRingScaleFactor * Math.max(mOuterRing.getWidth(), 2 * mOuterRadius) + + mMaxTargetWidth); + } + + /** + * This gets the suggested height accounting for the ring's scale factor. + */ + protected int getScaledSuggestedMinimumHeight() { + return (int) (mRingScaleFactor * Math.max(mOuterRing.getHeight(), 2 * mOuterRadius) + + mMaxTargetHeight); + } + private int resolveMeasured(int measureSpec, int desired) { int result = 0; @@ -332,16 +398,6 @@ private int resolveMeasured(int measureSpec, int desired) return result; } - @Override - protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { - final int minimumWidth = getSuggestedMinimumWidth(); - final int minimumHeight = getSuggestedMinimumHeight(); - int computedWidth = resolveMeasured(widthMeasureSpec, minimumWidth); - int computedHeight = resolveMeasured(heightMeasureSpec, minimumHeight); - computeInsets((computedWidth - minimumWidth), (computedHeight - minimumHeight)); - setMeasuredDimension(computedWidth, computedHeight); - } - private void switchToState(int state, float x, float y) { switch (state) { case STATE_IDLE: @@ -452,6 +508,7 @@ private void doFinish() { // Force ring and targets to finish animation to final expanded state mTargetAnimations.stop(); } + hideTargets(false, false); } else { // Animate handle back to the center based on current state. hideGlow(HIDE_ANIMATION_DURATION, 0, 0.0f, mResetListenerWithPing); @@ -499,8 +556,9 @@ private void hideTargets(boolean animate, boolean expanded) { "onUpdate", mUpdateListener)); } - final float ringScaleTarget = expanded ? + float ringScaleTarget = expanded ? RING_SCALE_EXPANDED : RING_SCALE_COLLAPSED; + ringScaleTarget *= mRingScaleFactor; mTargetAnimations.add(Tweener.to(mOuterRing, duration, "ease", interpolator, "alpha", 0.0f, @@ -530,11 +588,13 @@ private void showTargets(boolean animate) { "delay", delay, "onUpdate", mUpdateListener)); } + + float ringScale = mRingScaleFactor * RING_SCALE_EXPANDED; mTargetAnimations.add(Tweener.to(mOuterRing, duration, "ease", Ease.Cubic.easeOut, "alpha", 1.0f, - "scaleX", 1.0f, - "scaleY", 1.0f, + "scaleX", ringScale, + "scaleY", ringScale, "delay", delay, "onUpdate", mUpdateListener, "onComplete", mTargetUpdateListener)); @@ -543,7 +603,10 @@ private void showTargets(boolean animate) { } private void vibrate() { - if (mVibrator != null) { + final boolean hapticEnabled = Settings.System.getIntForUser( + mContext.getContentResolver(), Settings.System.HAPTIC_FEEDBACK_ENABLED, 1, + UserHandle.USER_CURRENT) != 0; + if (mVibrator != null && hapticEnabled) { mVibrator.vibrate(mVibrationDuration); } } @@ -585,6 +648,14 @@ private void internalSetTargetResources(int resourceId) { } } + private void internalSetTargetResources(ArrayList drawList) { + mTargetResourceId = 0; + mTargetDrawables = drawList; + updateTargetPositions(mWaveCenterX, mWaveCenterY); + updatePointCloudPosition(mWaveCenterX, mWaveCenterY); + hideTargets(false, false); + } + /** * Loads an array of drawables from the given resourceId. * @@ -599,10 +670,23 @@ public void setTargetResources(int resourceId) { } } + public void setTargetResources(ArrayList drawList) { + if (mAnimatingTargets) { + // postpone this change until we return to the initial state + mNewTargetDrawables = drawList; + } else { + internalSetTargetResources(drawList); + } + } + public int getTargetResourceId() { return mTargetResourceId; } + public ArrayList getTargetDrawables() { + return mTargetDrawables; + } + /** * Sets the resource id specifying the target descriptions for accessibility. * @@ -717,7 +801,7 @@ public void reset(boolean animate) { startBackgroundAnimation(0, 0.0f); stopAndHideWaveAnimation(); hideTargets(animate, false); - hideGlow(0, 0, 1.0f, null); + hideGlow(0, 0, 0.0f, null); Tweener.reset(); } @@ -737,9 +821,10 @@ private void startBackgroundAnimation(int duration, float alpha) { @Override public boolean onTouchEvent(MotionEvent event) { - final int action = event.getAction(); + final int action = event.getActionMasked(); boolean handled = false; switch (action) { + case MotionEvent.ACTION_POINTER_DOWN: case MotionEvent.ACTION_DOWN: if (DEBUG) Log.v(TAG, "*** DOWN ***"); handleDown(event); @@ -753,6 +838,7 @@ public boolean onTouchEvent(MotionEvent event) { handled = true; break; + case MotionEvent.ACTION_POINTER_UP: case MotionEvent.ACTION_UP: if (DEBUG) Log.v(TAG, "*** UP ***"); handleMove(event); @@ -766,43 +852,51 @@ public boolean onTouchEvent(MotionEvent event) { handleCancel(event); handled = true; break; + } invalidate(); return handled ? true : super.onTouchEvent(event); } private void updateGlowPosition(float x, float y) { - mPointCloud.glowManager.setX(x); - mPointCloud.glowManager.setY(y); + float dx = x - mOuterRing.getX(); + float dy = y - mOuterRing.getY(); + dx *= 1f / mRingScaleFactor; + dy *= 1f / mRingScaleFactor; + mPointCloud.glowManager.setX(mOuterRing.getX() + dx); + mPointCloud.glowManager.setY(mOuterRing.getY() + dy); } private void handleDown(MotionEvent event) { - float eventX = event.getX(); - float eventY = event.getY(); + int actionIndex = event.getActionIndex(); + float eventX = event.getX(actionIndex); + float eventY = event.getY(actionIndex); switchToState(STATE_START, eventX, eventY); if (!trySwitchToFirstTouchState(eventX, eventY)) { mDragging = false; } else { + mPointerId = event.getPointerId(actionIndex); updateGlowPosition(eventX, eventY); } } private void handleUp(MotionEvent event) { if (DEBUG && mDragging) Log.v(TAG, "** Handle RELEASE"); - switchToState(STATE_FINISH, event.getX(), event.getY()); + int actionIndex = event.getActionIndex(); + if (event.getPointerId(actionIndex) == mPointerId) { + switchToState(STATE_FINISH, event.getX(actionIndex), event.getY(actionIndex)); + } } private void handleCancel(MotionEvent event) { if (DEBUG && mDragging) Log.v(TAG, "** Handle CANCEL"); - // We should drop the active target here but it interferes with - // moving off the screen in the direction of the navigation bar. At some point we may - // want to revisit how we handle this. For now we'll allow a canceled event to - // activate the current target. - - // mActiveTarget = -1; // Drop the active target if canceled. + // Drop the active target if canceled. + mActiveTarget = -1; - switchToState(STATE_FINISH, event.getX(), event.getY()); + int actionIndex = event.findPointerIndex(mPointerId); + actionIndex = actionIndex == -1 ? 0 : actionIndex; + switchToState(STATE_FINISH, event.getX(actionIndex), event.getY(actionIndex)); } private void handleMove(MotionEvent event) { @@ -812,9 +906,18 @@ private void handleMove(MotionEvent event) { int ntargets = targets.size(); float x = 0.0f; float y = 0.0f; + float activeAngle = 0.0f; + int actionIndex = event.findPointerIndex(mPointerId); + + if (actionIndex == -1) { + return; // no data for this pointer + } + for (int k = 0; k < historySize + 1; k++) { - float eventX = k < historySize ? event.getHistoricalX(k) : event.getX(); - float eventY = k < historySize ? event.getHistoricalY(k) : event.getY(); + float eventX = k < historySize ? event.getHistoricalX(actionIndex, k) + : event.getX(actionIndex); + float eventY = k < historySize ? event.getHistoricalY(actionIndex, k) + : event.getY(actionIndex); // tx and ty are relative to wave center float tx = eventX - mWaveCenterX; float ty = eventY - mWaveCenterY; @@ -830,21 +933,29 @@ private void handleMove(MotionEvent event) { if (mDragging) { // For multiple targets, snap to the one that matches - final float snapRadius = mOuterRadius - mSnapMargin; + final float snapRadius = mRingScaleFactor * mOuterRadius - mSnapMargin; final float snapDistance2 = snapRadius * snapRadius; // Find first target in range for (int i = 0; i < ntargets; i++) { TargetDrawable target = targets.get(i); - double targetMinRad = (i - 0.5) * 2 * Math.PI / ntargets; - double targetMaxRad = (i + 0.5) * 2 * Math.PI / ntargets; + double targetMinRad = mFirstItemOffset + (i - 0.5) * 2 * Math.PI / ntargets; + double targetMaxRad = mFirstItemOffset + (i + 0.5) * 2 * Math.PI / ntargets; if (target.isEnabled()) { boolean angleMatches = (angleRad > targetMinRad && angleRad <= targetMaxRad) || (angleRad + 2 * Math.PI > targetMinRad && - angleRad + 2 * Math.PI <= targetMaxRad); + angleRad + 2 * Math.PI <= targetMaxRad) || + (angleRad - 2 * Math.PI > targetMinRad && + angleRad - 2 * Math.PI <= targetMaxRad); if (angleMatches && (dist2(tx, ty) > snapDistance2)) { activeTarget = i; + activeAngle = (float) -angleRad; + break; + } else if (dist2(tx, ty) > snapDistance2 && + mMagneticTargets && activeTarget == -1) { + activeTarget = 0; + activeAngle = (float) -angleRad; } } } @@ -864,7 +975,6 @@ private void handleMove(MotionEvent event) { switchToState(STATE_TRACKING, x, y); updateGlowPosition(x, y); } - if (mActiveTarget != activeTarget) { // Defocus the old target if (mActiveTarget != -1) { @@ -872,6 +982,9 @@ private void handleMove(MotionEvent event) { if (target.hasState(TargetDrawable.STATE_FOCUSED)) { target.setState(TargetDrawable.STATE_INACTIVE); } + if (mMagneticTargets) { + updateTargetPosition(mActiveTarget, mWaveCenterX, mWaveCenterY); + } } // Focus the new target if (activeTarget != -1) { @@ -879,6 +992,9 @@ private void handleMove(MotionEvent event) { if (target.hasState(TargetDrawable.STATE_FOCUSED)) { target.setState(TargetDrawable.STATE_FOCUSED); } + if (mMagneticTargets && activeTarget <= 0) { + updateTargetPosition(activeTarget, mWaveCenterX, mWaveCenterY, activeAngle); + } if (AccessibilityManager.getInstance(mContext).isEnabled()) { String targetContentDescription = getTargetDescription(activeTarget); announceForAccessibility(targetContentDescription); @@ -906,7 +1022,8 @@ public boolean onHoverEvent(MotionEvent event) { onTouchEvent(event); event.setAction(action); } - return super.onHoverEvent(event); + super.onHoverEvent(event); + return true; } /** @@ -957,7 +1074,7 @@ private void assignDefaultsIfNeeded() { } private void computeInsets(int dx, int dy) { - final int layoutDirection = getResolvedLayoutDirection(); + final int layoutDirection = getLayoutDirection(); final int absoluteGravity = Gravity.getAbsoluteGravity(mGravity, layoutDirection); switch (absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK) { @@ -986,6 +1103,78 @@ private void computeInsets(int dx, int dy) { } } + /** + * Given the desired width and height of the ring and the allocated width and height, compute + * how much we need to scale the ring. + */ + private float computeScaleFactor(int desiredWidth, int desiredHeight, + int actualWidth, int actualHeight) { + + // Return unity if scaling is not allowed. + if (!mAllowScaling) return 1f; + + final int layoutDirection = getLayoutDirection(); + final int absoluteGravity = Gravity.getAbsoluteGravity(mGravity, layoutDirection); + + float scaleX = 1f; + float scaleY = 1f; + + // We use the gravity as a cue for whether we want to scale on a particular axis. + // We only scale to fit horizontally if we're not pinned to the left or right. Likewise, + // we only scale to fit vertically if we're not pinned to the top or bottom. In these + // cases, we want the ring to hang off the side or top/bottom, respectively. + switch (absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK) { + case Gravity.LEFT: + case Gravity.RIGHT: + break; + case Gravity.CENTER_HORIZONTAL: + default: + if (desiredWidth > actualWidth) { + scaleX = (1f * actualWidth - mMaxTargetWidth) / + (desiredWidth - mMaxTargetWidth); + } + break; + } + switch (absoluteGravity & Gravity.VERTICAL_GRAVITY_MASK) { + case Gravity.TOP: + case Gravity.BOTTOM: + break; + case Gravity.CENTER_VERTICAL: + default: + if (desiredHeight > actualHeight) { + scaleY = (1f * actualHeight - mMaxTargetHeight) / + (desiredHeight - mMaxTargetHeight); + } + break; + } + return Math.min(scaleX, scaleY); + } + + @Override + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + final int minimumWidth = getSuggestedMinimumWidth(); + final int minimumHeight = getSuggestedMinimumHeight(); + int computedWidth = resolveMeasured(widthMeasureSpec, minimumWidth); + int computedHeight = resolveMeasured(heightMeasureSpec, minimumHeight); + + mRingScaleFactor = computeScaleFactor(minimumWidth, minimumHeight, + computedWidth, computedHeight); + + int scaledWidth = getScaledSuggestedMinimumWidth(); + int scaledHeight = getScaledSuggestedMinimumHeight(); + + computeInsets(computedWidth - scaledWidth, computedHeight - scaledHeight); + setMeasuredDimension(computedWidth, computedHeight); + } + + private float getRingWidth() { + return mRingScaleFactor * Math.max(mOuterRing.getWidth(), 2 * mOuterRadius); + } + + private float getRingHeight() { + return mRingScaleFactor * Math.max(mOuterRing.getHeight(), 2 * mOuterRadius); + } + @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); @@ -994,8 +1183,8 @@ protected void onLayout(boolean changed, int left, int top, int right, int botto // Target placement width/height. This puts the targets on the greater of the ring // width or the specified outer radius. - final float placementWidth = Math.max(mOuterRing.getWidth(), 2 * mOuterRadius); - final float placementHeight = Math.max(mOuterRing.getHeight(), 2 * mOuterRadius); + final float placementWidth = getRingWidth(); + final float placementHeight = getRingHeight(); float newWaveCenterX = mHorizontalInset + Math.max(width, mMaxTargetWidth + placementWidth) / 2; float newWaveCenterY = mVerticalInset @@ -1010,6 +1199,8 @@ protected void onLayout(boolean changed, int left, int top, int right, int botto mOuterRing.setPositionX(newWaveCenterX); mOuterRing.setPositionY(newWaveCenterY); + mPointCloud.setScale(mRingScaleFactor); + mHandleDrawable.setPositionX(newWaveCenterX); mHandleDrawable.setPositionY(newWaveCenterY); @@ -1023,21 +1214,47 @@ protected void onLayout(boolean changed, int left, int top, int right, int botto if (DEBUG) dump(); } - private void updateTargetPositions(float centerX, float centerY) { - // Reposition the target drawables if the view changed. - ArrayList targets = mTargetDrawables; - final int size = targets.size(); - final float alpha = (float) (-2.0f * Math.PI / size); - for (int i = 0; i < size; i++) { + private void updateTargetPosition(int i, float centerX, float centerY) { + final float angle = getAngle(getSliceAngle(), i); + updateTargetPosition(i, centerX, centerY, angle); + } + + private void updateTargetPosition(int i, float centerX, float centerY, float angle) { + final float placementRadiusX = getRingWidth() / 2; + final float placementRadiusY = getRingHeight() / 2; + if (i >= 0) { + ArrayList targets = mTargetDrawables; final TargetDrawable targetIcon = targets.get(i); - final float angle = alpha * i; targetIcon.setPositionX(centerX); targetIcon.setPositionY(centerY); - targetIcon.setX(mOuterRadius * (float) Math.cos(angle)); - targetIcon.setY(mOuterRadius * (float) Math.sin(angle)); + targetIcon.setX(placementRadiusX * (float) Math.cos(angle)); + targetIcon.setY(placementRadiusY * (float) Math.sin(angle)); } } + private void updateTargetPositions(float centerX, float centerY) { + updateTargetPositions(centerX, centerY, false); + } + + private void updateTargetPositions(float centerX, float centerY, boolean skipActive) { + final int size = mTargetDrawables.size(); + final float alpha = getSliceAngle(); + // Reposition the target drawables if the view changed. + for (int i = 0; i < size; i++) { + if (!skipActive || i != mActiveTarget) { + updateTargetPosition(i, centerX, centerY, getAngle(alpha, i)); + } + } + } + + private float getAngle(float alpha, int i) { + return mFirstItemOffset + alpha * i; + } + + private float getSliceAngle() { + return (float) (-2.0f * Math.PI / mTargetDrawables.size()); + } + private void updatePointCloudPosition(float centerX, float centerY) { mPointCloud.setCenter(centerX, centerY); } @@ -1096,7 +1313,7 @@ private void announceTargets() { } private String getTargetDescription(int index) { - if (mTargetDescriptions == null || mTargetDescriptions.isEmpty()) { + if (mTargetDescriptions == null || mTargetDescriptions.isEmpty() || index >= mTargetDescriptions.size()) { mTargetDescriptions = loadDescriptions(mTargetDescriptionsResourceId); if (mTargetDrawables.size() != mTargetDescriptions.size()) { Log.w(TAG, "The number of target drawables must be" @@ -1108,7 +1325,7 @@ private String getTargetDescription(int index) { } private String getDirectionDescription(int index) { - if (mDirectionDescriptions == null || mDirectionDescriptions.isEmpty()) { + if (mDirectionDescriptions == null || mDirectionDescriptions.isEmpty() || index >= mDirectionDescriptions.size()) { mDirectionDescriptions = loadDescriptions(mDirectionDescriptionsResourceId); if (mTargetDrawables.size() != mDirectionDescriptions.size()) { Log.w(TAG, "The number of target drawables must be" diff --git a/core/java/com/android/internal/widget/multiwaveview/MultiWaveView.java b/core/java/com/android/internal/widget/multiwaveview/MultiWaveView.java index 10804c024178e..e22d1e8d43ba6 100644 --- a/core/java/com/android/internal/widget/multiwaveview/MultiWaveView.java +++ b/core/java/com/android/internal/widget/multiwaveview/MultiWaveView.java @@ -19,7 +19,6 @@ import android.animation.Animator; import android.animation.Animator.AnimatorListener; import android.animation.AnimatorListenerAdapter; -import android.animation.ObjectAnimator; import android.animation.TimeInterpolator; import android.animation.ValueAnimator; import android.animation.ValueAnimator.AnimatorUpdateListener; @@ -33,7 +32,9 @@ import android.graphics.RectF; import android.graphics.drawable.Drawable; import android.os.Bundle; +import android.os.UserHandle; import android.os.Vibrator; +import android.provider.Settings; import android.text.TextUtils; import android.util.AttributeSet; import android.util.Log; @@ -594,7 +595,10 @@ private void showTargets(boolean animate) { } private void vibrate() { - if (mVibrator != null) { + final boolean hapticEnabled = Settings.System.getIntForUser( + mContext.getContentResolver(), Settings.System.HAPTIC_FEEDBACK_ENABLED, 1, + UserHandle.USER_CURRENT) != 0; + if (mVibrator != null && hapticEnabled) { mVibrator.vibrate(mVibrationDuration); } } @@ -970,7 +974,7 @@ private void assignDefaultsIfNeeded() { } private void computeInsets(int dx, int dy) { - final int layoutDirection = getResolvedLayoutDirection(); + final int layoutDirection = getLayoutDirection(); final int absoluteGravity = Gravity.getAbsoluteGravity(mGravity, layoutDirection); switch (absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK) { diff --git a/core/java/com/android/internal/widget/multiwaveview/TargetDrawable.java b/core/java/com/android/internal/widget/multiwaveview/TargetDrawable.java index 30f5f2f2ddee8..249c94892eace 100644 --- a/core/java/com/android/internal/widget/multiwaveview/TargetDrawable.java +++ b/core/java/com/android/internal/widget/multiwaveview/TargetDrawable.java @@ -28,9 +28,9 @@ public class TargetDrawable { private static final boolean DEBUG = false; public static final int[] STATE_ACTIVE = - { android.R.attr.state_enabled, android.R.attr.state_active }; + { android.R.attr.state_enabled, android.R.attr.state_active, -android.R.attr.state_focused }; public static final int[] STATE_INACTIVE = - { android.R.attr.state_enabled, -android.R.attr.state_active }; + { android.R.attr.state_enabled, -android.R.attr.state_active , -android.R.attr.state_focused }; public static final int[] STATE_FOCUSED = { android.R.attr.state_enabled, -android.R.attr.state_active, android.R.attr.state_focused }; @@ -91,6 +91,14 @@ public void setDrawable(Resources res, int resId) { setState(STATE_INACTIVE); } + public TargetDrawable(Resources res, Drawable drawable) { + mResourceId = 0; + // Mutate the drawable so we can animate shared drawable properties. + mDrawable = drawable != null ? drawable.mutate() : null; + resizeDrawables(); + setState(STATE_INACTIVE); + } + public TargetDrawable(TargetDrawable other) { mResourceId = other.mResourceId; // Mutate the drawable so we can animate shared drawable properties. diff --git a/core/java/com/google/android/mms/ContentType.java b/core/java/com/google/android/mms/ContentType.java deleted file mode 100644 index 12a134399c335..0000000000000 --- a/core/java/com/google/android/mms/ContentType.java +++ /dev/null @@ -1,229 +0,0 @@ -/* - * Copyright (C) 2007-2008 Esmertec AG. - * Copyright (C) 2007-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 com.google.android.mms; - -import java.util.ArrayList; - -public class ContentType { - public static final String MMS_MESSAGE = "application/vnd.wap.mms-message"; - // The phony content type for generic PDUs (e.g. ReadOrig.ind, - // Notification.ind, Delivery.ind). - public static final String MMS_GENERIC = "application/vnd.wap.mms-generic"; - public static final String MULTIPART_MIXED = "application/vnd.wap.multipart.mixed"; - public static final String MULTIPART_RELATED = "application/vnd.wap.multipart.related"; - public static final String MULTIPART_ALTERNATIVE = "application/vnd.wap.multipart.alternative"; - - public static final String TEXT_PLAIN = "text/plain"; - public static final String TEXT_HTML = "text/html"; - public static final String TEXT_VCALENDAR = "text/x-vCalendar"; - public static final String TEXT_VCARD = "text/x-vCard"; - - public static final String IMAGE_UNSPECIFIED = "image/*"; - public static final String IMAGE_JPEG = "image/jpeg"; - public static final String IMAGE_JPG = "image/jpg"; - public static final String IMAGE_GIF = "image/gif"; - public static final String IMAGE_WBMP = "image/vnd.wap.wbmp"; - public static final String IMAGE_PNG = "image/png"; - public static final String IMAGE_X_MS_BMP = "image/x-ms-bmp"; - - public static final String AUDIO_UNSPECIFIED = "audio/*"; - public static final String AUDIO_AAC = "audio/aac"; - public static final String AUDIO_AMR = "audio/amr"; - public static final String AUDIO_IMELODY = "audio/imelody"; - public static final String AUDIO_MID = "audio/mid"; - public static final String AUDIO_MIDI = "audio/midi"; - public static final String AUDIO_MP3 = "audio/mp3"; - public static final String AUDIO_MPEG3 = "audio/mpeg3"; - public static final String AUDIO_MPEG = "audio/mpeg"; - public static final String AUDIO_MPG = "audio/mpg"; - public static final String AUDIO_MP4 = "audio/mp4"; - public static final String AUDIO_X_MID = "audio/x-mid"; - public static final String AUDIO_X_MIDI = "audio/x-midi"; - public static final String AUDIO_X_MP3 = "audio/x-mp3"; - public static final String AUDIO_X_MPEG3 = "audio/x-mpeg3"; - public static final String AUDIO_X_MPEG = "audio/x-mpeg"; - public static final String AUDIO_X_MPG = "audio/x-mpg"; - public static final String AUDIO_3GPP = "audio/3gpp"; - public static final String AUDIO_X_WAV = "audio/x-wav"; - public static final String AUDIO_OGG = "application/ogg"; - - public static final String VIDEO_UNSPECIFIED = "video/*"; - public static final String VIDEO_3GPP = "video/3gpp"; - public static final String VIDEO_3G2 = "video/3gpp2"; - public static final String VIDEO_H263 = "video/h263"; - public static final String VIDEO_MP4 = "video/mp4"; - - public static final String APP_SMIL = "application/smil"; - public static final String APP_WAP_XHTML = "application/vnd.wap.xhtml+xml"; - public static final String APP_XHTML = "application/xhtml+xml"; - - public static final String APP_DRM_CONTENT = "application/vnd.oma.drm.content"; - public static final String APP_DRM_MESSAGE = "application/vnd.oma.drm.message"; - - private static final ArrayList sSupportedContentTypes = new ArrayList(); - private static final ArrayList sSupportedImageTypes = new ArrayList(); - private static final ArrayList sSupportedAudioTypes = new ArrayList(); - private static final ArrayList sSupportedVideoTypes = new ArrayList(); - - static { - sSupportedContentTypes.add(TEXT_PLAIN); - sSupportedContentTypes.add(TEXT_HTML); - sSupportedContentTypes.add(TEXT_VCALENDAR); - sSupportedContentTypes.add(TEXT_VCARD); - - sSupportedContentTypes.add(IMAGE_JPEG); - sSupportedContentTypes.add(IMAGE_GIF); - sSupportedContentTypes.add(IMAGE_WBMP); - sSupportedContentTypes.add(IMAGE_PNG); - sSupportedContentTypes.add(IMAGE_JPG); - sSupportedContentTypes.add(IMAGE_X_MS_BMP); - //supportedContentTypes.add(IMAGE_SVG); not yet supported. - - sSupportedContentTypes.add(AUDIO_AAC); - sSupportedContentTypes.add(AUDIO_AMR); - sSupportedContentTypes.add(AUDIO_IMELODY); - sSupportedContentTypes.add(AUDIO_MID); - sSupportedContentTypes.add(AUDIO_MIDI); - sSupportedContentTypes.add(AUDIO_MP3); - sSupportedContentTypes.add(AUDIO_MPEG3); - sSupportedContentTypes.add(AUDIO_MPEG); - sSupportedContentTypes.add(AUDIO_MPG); - sSupportedContentTypes.add(AUDIO_X_MID); - sSupportedContentTypes.add(AUDIO_X_MIDI); - sSupportedContentTypes.add(AUDIO_X_MP3); - sSupportedContentTypes.add(AUDIO_X_MPEG3); - sSupportedContentTypes.add(AUDIO_X_MPEG); - sSupportedContentTypes.add(AUDIO_X_MPG); - sSupportedContentTypes.add(AUDIO_X_WAV); - sSupportedContentTypes.add(AUDIO_3GPP); - sSupportedContentTypes.add(AUDIO_OGG); - - sSupportedContentTypes.add(VIDEO_3GPP); - sSupportedContentTypes.add(VIDEO_3G2); - sSupportedContentTypes.add(VIDEO_H263); - sSupportedContentTypes.add(VIDEO_MP4); - - sSupportedContentTypes.add(APP_SMIL); - sSupportedContentTypes.add(APP_WAP_XHTML); - sSupportedContentTypes.add(APP_XHTML); - - sSupportedContentTypes.add(APP_DRM_CONTENT); - sSupportedContentTypes.add(APP_DRM_MESSAGE); - - // add supported image types - sSupportedImageTypes.add(IMAGE_JPEG); - sSupportedImageTypes.add(IMAGE_GIF); - sSupportedImageTypes.add(IMAGE_WBMP); - sSupportedImageTypes.add(IMAGE_PNG); - sSupportedImageTypes.add(IMAGE_JPG); - sSupportedImageTypes.add(IMAGE_X_MS_BMP); - - // add supported audio types - sSupportedAudioTypes.add(AUDIO_AAC); - sSupportedAudioTypes.add(AUDIO_AMR); - sSupportedAudioTypes.add(AUDIO_IMELODY); - sSupportedAudioTypes.add(AUDIO_MID); - sSupportedAudioTypes.add(AUDIO_MIDI); - sSupportedAudioTypes.add(AUDIO_MP3); - sSupportedAudioTypes.add(AUDIO_MPEG3); - sSupportedAudioTypes.add(AUDIO_MPEG); - sSupportedAudioTypes.add(AUDIO_MPG); - sSupportedAudioTypes.add(AUDIO_MP4); - sSupportedAudioTypes.add(AUDIO_X_MID); - sSupportedAudioTypes.add(AUDIO_X_MIDI); - sSupportedAudioTypes.add(AUDIO_X_MP3); - sSupportedAudioTypes.add(AUDIO_X_MPEG3); - sSupportedAudioTypes.add(AUDIO_X_MPEG); - sSupportedAudioTypes.add(AUDIO_X_MPG); - sSupportedAudioTypes.add(AUDIO_X_WAV); - sSupportedAudioTypes.add(AUDIO_3GPP); - sSupportedAudioTypes.add(AUDIO_OGG); - - // add supported video types - sSupportedVideoTypes.add(VIDEO_3GPP); - sSupportedVideoTypes.add(VIDEO_3G2); - sSupportedVideoTypes.add(VIDEO_H263); - sSupportedVideoTypes.add(VIDEO_MP4); - } - - // This class should never be instantiated. - private ContentType() { - } - - public static boolean isSupportedType(String contentType) { - return (null != contentType) && sSupportedContentTypes.contains(contentType); - } - - public static boolean isSupportedImageType(String contentType) { - return isImageType(contentType) && isSupportedType(contentType); - } - - public static boolean isSupportedAudioType(String contentType) { - return isAudioType(contentType) && isSupportedType(contentType); - } - - public static boolean isSupportedVideoType(String contentType) { - return isVideoType(contentType) && isSupportedType(contentType); - } - - public static boolean isTextType(String contentType) { - return (null != contentType) && contentType.startsWith("text/"); - } - - public static boolean isImageType(String contentType) { - return (null != contentType) && contentType.startsWith("image/"); - } - - public static boolean isAudioType(String contentType) { - return (null != contentType) && contentType.startsWith("audio/"); - } - - public static boolean isVideoType(String contentType) { - return (null != contentType) && contentType.startsWith("video/"); - } - - public static boolean isDrmType(String contentType) { - return (null != contentType) - && (contentType.equals(APP_DRM_CONTENT) - || contentType.equals(APP_DRM_MESSAGE)); - } - - public static boolean isUnspecified(String contentType) { - return (null != contentType) && contentType.endsWith("*"); - } - - @SuppressWarnings("unchecked") - public static ArrayList getImageTypes() { - return (ArrayList) sSupportedImageTypes.clone(); - } - - @SuppressWarnings("unchecked") - public static ArrayList getAudioTypes() { - return (ArrayList) sSupportedAudioTypes.clone(); - } - - @SuppressWarnings("unchecked") - public static ArrayList getVideoTypes() { - return (ArrayList) sSupportedVideoTypes.clone(); - } - - @SuppressWarnings("unchecked") - public static ArrayList getSupportedTypes() { - return (ArrayList) sSupportedContentTypes.clone(); - } -} diff --git a/core/java/com/google/android/mms/InvalidHeaderValueException.java b/core/java/com/google/android/mms/InvalidHeaderValueException.java deleted file mode 100644 index 73d78328e257a..0000000000000 --- a/core/java/com/google/android/mms/InvalidHeaderValueException.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2007 Esmertec AG. - * 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. - */ - -package com.google.android.mms; - -/** - * Thrown when an invalid header value was set. - */ -public class InvalidHeaderValueException extends MmsException { - private static final long serialVersionUID = -2053384496042052262L; - - /** - * Constructs an InvalidHeaderValueException with no detailed message. - */ - public InvalidHeaderValueException() { - super(); - } - - /** - * Constructs an InvalidHeaderValueException with the specified detailed message. - * - * @param message the detailed message. - */ - public InvalidHeaderValueException(String message) { - super(message); - } -} diff --git a/core/java/com/google/android/mms/MmsException.java b/core/java/com/google/android/mms/MmsException.java deleted file mode 100644 index 6ca0c7eab9ac7..0000000000000 --- a/core/java/com/google/android/mms/MmsException.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (C) 2007 Esmertec AG. - * 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. - */ - -package com.google.android.mms; - -/** - * A generic exception that is thrown by the Mms client. - */ -public class MmsException extends Exception { - private static final long serialVersionUID = -7323249827281485390L; - - /** - * Creates a new MmsException. - */ - public MmsException() { - super(); - } - - /** - * Creates a new MmsException with the specified detail message. - * - * @param message the detail message. - */ - public MmsException(String message) { - super(message); - } - - /** - * Creates a new MmsException with the specified cause. - * - * @param cause the cause. - */ - public MmsException(Throwable cause) { - super(cause); - } - - /** - * Creates a new MmsException with the specified detail message and cause. - * - * @param message the detail message. - * @param cause the cause. - */ - public MmsException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/core/java/com/google/android/mms/package.html b/core/java/com/google/android/mms/package.html deleted file mode 100755 index c9f96a66ab3bc..0000000000000 --- a/core/java/com/google/android/mms/package.html +++ /dev/null @@ -1,5 +0,0 @@ - - -{@hide} - - diff --git a/core/java/com/google/android/mms/pdu/AcknowledgeInd.java b/core/java/com/google/android/mms/pdu/AcknowledgeInd.java deleted file mode 100644 index 0e96c60bd096f..0000000000000 --- a/core/java/com/google/android/mms/pdu/AcknowledgeInd.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (C) 2007 Esmertec AG. - * 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. - */ - -package com.google.android.mms.pdu; - -import com.google.android.mms.InvalidHeaderValueException; - -/** - * M-Acknowledge.ind PDU. - */ -public class AcknowledgeInd extends GenericPdu { - /** - * Constructor, used when composing a M-Acknowledge.ind pdu. - * - * @param mmsVersion current viersion of mms - * @param transactionId the transaction-id value - * @throws InvalidHeaderValueException if parameters are invalid. - * NullPointerException if transactionId is null. - */ - public AcknowledgeInd(int mmsVersion, byte[] transactionId) - throws InvalidHeaderValueException { - super(); - - setMessageType(PduHeaders.MESSAGE_TYPE_ACKNOWLEDGE_IND); - setMmsVersion(mmsVersion); - setTransactionId(transactionId); - } - - /** - * Constructor with given headers. - * - * @param headers Headers for this PDU. - */ - AcknowledgeInd(PduHeaders headers) { - super(headers); - } - - /** - * Get X-Mms-Report-Allowed field value. - * - * @return the X-Mms-Report-Allowed value - */ - public int getReportAllowed() { - return mPduHeaders.getOctet(PduHeaders.REPORT_ALLOWED); - } - - /** - * Set X-Mms-Report-Allowed field value. - * - * @param value the value - * @throws InvalidHeaderValueException if the value is invalid. - */ - public void setReportAllowed(int value) throws InvalidHeaderValueException { - mPduHeaders.setOctet(value, PduHeaders.REPORT_ALLOWED); - } - - /** - * Get X-Mms-Transaction-Id field value. - * - * @return the X-Mms-Report-Allowed value - */ - public byte[] getTransactionId() { - return mPduHeaders.getTextString(PduHeaders.TRANSACTION_ID); - } - - /** - * Set X-Mms-Transaction-Id field value. - * - * @param value the value - * @throws NullPointerException if the value is null. - */ - public void setTransactionId(byte[] value) { - mPduHeaders.setTextString(value, PduHeaders.TRANSACTION_ID); - } -} diff --git a/core/java/com/google/android/mms/pdu/Base64.java b/core/java/com/google/android/mms/pdu/Base64.java deleted file mode 100644 index 604bee0d50fe0..0000000000000 --- a/core/java/com/google/android/mms/pdu/Base64.java +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Copyright (C) 2007 Esmertec AG. - * 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. - */ - -package com.google.android.mms.pdu; - -public class Base64 { - /** - * Used to get the number of Quadruples. - */ - static final int FOURBYTE = 4; - - /** - * Byte used to pad output. - */ - static final byte PAD = (byte) '='; - - /** - * The base length. - */ - static final int BASELENGTH = 255; - - // Create arrays to hold the base64 characters - private static byte[] base64Alphabet = new byte[BASELENGTH]; - - // Populating the character arrays - static { - for (int i = 0; i < BASELENGTH; i++) { - base64Alphabet[i] = (byte) -1; - } - for (int i = 'Z'; i >= 'A'; i--) { - base64Alphabet[i] = (byte) (i - 'A'); - } - for (int i = 'z'; i >= 'a'; i--) { - base64Alphabet[i] = (byte) (i - 'a' + 26); - } - for (int i = '9'; i >= '0'; i--) { - base64Alphabet[i] = (byte) (i - '0' + 52); - } - - base64Alphabet['+'] = 62; - base64Alphabet['/'] = 63; - } - - /** - * Decodes Base64 data into octects - * - * @param base64Data Byte array containing Base64 data - * @return Array containing decoded data. - */ - public static byte[] decodeBase64(byte[] base64Data) { - // RFC 2045 requires that we discard ALL non-Base64 characters - base64Data = discardNonBase64(base64Data); - - // handle the edge case, so we don't have to worry about it later - if (base64Data.length == 0) { - return new byte[0]; - } - - int numberQuadruple = base64Data.length / FOURBYTE; - byte decodedData[] = null; - byte b1 = 0, b2 = 0, b3 = 0, b4 = 0, marker0 = 0, marker1 = 0; - - // Throw away anything not in base64Data - - int encodedIndex = 0; - int dataIndex = 0; - { - // this sizes the output array properly - rlw - int lastData = base64Data.length; - // ignore the '=' padding - while (base64Data[lastData - 1] == PAD) { - if (--lastData == 0) { - return new byte[0]; - } - } - decodedData = new byte[lastData - numberQuadruple]; - } - - for (int i = 0; i < numberQuadruple; i++) { - dataIndex = i * 4; - marker0 = base64Data[dataIndex + 2]; - marker1 = base64Data[dataIndex + 3]; - - b1 = base64Alphabet[base64Data[dataIndex]]; - b2 = base64Alphabet[base64Data[dataIndex + 1]]; - - if (marker0 != PAD && marker1 != PAD) { - //No PAD e.g 3cQl - b3 = base64Alphabet[marker0]; - b4 = base64Alphabet[marker1]; - - decodedData[encodedIndex] = (byte) (b1 << 2 | b2 >> 4); - decodedData[encodedIndex + 1] = - (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf)); - decodedData[encodedIndex + 2] = (byte) (b3 << 6 | b4); - } else if (marker0 == PAD) { - //Two PAD e.g. 3c[Pad][Pad] - decodedData[encodedIndex] = (byte) (b1 << 2 | b2 >> 4); - } else if (marker1 == PAD) { - //One PAD e.g. 3cQ[Pad] - b3 = base64Alphabet[marker0]; - - decodedData[encodedIndex] = (byte) (b1 << 2 | b2 >> 4); - decodedData[encodedIndex + 1] = - (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf)); - } - encodedIndex += 3; - } - return decodedData; - } - - /** - * Check octect wheter it is a base64 encoding. - * - * @param octect to be checked byte - * @return ture if it is base64 encoding, false otherwise. - */ - private static boolean isBase64(byte octect) { - if (octect == PAD) { - return true; - } else if (base64Alphabet[octect] == -1) { - return false; - } else { - return true; - } - } - - /** - * Discards any characters outside of the base64 alphabet, per - * the requirements on page 25 of RFC 2045 - "Any characters - * outside of the base64 alphabet are to be ignored in base64 - * encoded data." - * - * @param data The base-64 encoded data to groom - * @return The data, less non-base64 characters (see RFC 2045). - */ - static byte[] discardNonBase64(byte[] data) { - byte groomedData[] = new byte[data.length]; - int bytesCopied = 0; - - for (int i = 0; i < data.length; i++) { - if (isBase64(data[i])) { - groomedData[bytesCopied++] = data[i]; - } - } - - byte packedData[] = new byte[bytesCopied]; - - System.arraycopy(groomedData, 0, packedData, 0, bytesCopied); - - return packedData; - } -} diff --git a/core/java/com/google/android/mms/pdu/CharacterSets.java b/core/java/com/google/android/mms/pdu/CharacterSets.java deleted file mode 100644 index 4e22ca5e2cf82..0000000000000 --- a/core/java/com/google/android/mms/pdu/CharacterSets.java +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Copyright (C) 2007 Esmertec AG. - * 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. - */ - -package com.google.android.mms.pdu; - -import java.io.UnsupportedEncodingException; -import java.util.HashMap; - -public class CharacterSets { - /** - * IANA assigned MIB enum numbers. - * - * From wap-230-wsp-20010705-a.pdf - * Any-charset = - * Equivalent to the special RFC2616 charset value "*" - */ - public static final int ANY_CHARSET = 0x00; - public static final int US_ASCII = 0x03; - public static final int ISO_8859_1 = 0x04; - public static final int ISO_8859_2 = 0x05; - public static final int ISO_8859_3 = 0x06; - public static final int ISO_8859_4 = 0x07; - public static final int ISO_8859_5 = 0x08; - public static final int ISO_8859_6 = 0x09; - public static final int ISO_8859_7 = 0x0A; - public static final int ISO_8859_8 = 0x0B; - public static final int ISO_8859_9 = 0x0C; - public static final int SHIFT_JIS = 0x11; - public static final int UTF_8 = 0x6A; - public static final int BIG5 = 0x07EA; - public static final int UCS2 = 0x03E8; - public static final int UTF_16 = 0x03F7; - - /** - * If the encoding of given data is unsupported, use UTF_8 to decode it. - */ - public static final int DEFAULT_CHARSET = UTF_8; - - /** - * Array of MIB enum numbers. - */ - private static final int[] MIBENUM_NUMBERS = { - ANY_CHARSET, - US_ASCII, - ISO_8859_1, - ISO_8859_2, - ISO_8859_3, - ISO_8859_4, - ISO_8859_5, - ISO_8859_6, - ISO_8859_7, - ISO_8859_8, - ISO_8859_9, - SHIFT_JIS, - UTF_8, - BIG5, - UCS2, - UTF_16, - }; - - /** - * The Well-known-charset Mime name. - */ - public static final String MIMENAME_ANY_CHARSET = "*"; - public static final String MIMENAME_US_ASCII = "us-ascii"; - public static final String MIMENAME_ISO_8859_1 = "iso-8859-1"; - public static final String MIMENAME_ISO_8859_2 = "iso-8859-2"; - public static final String MIMENAME_ISO_8859_3 = "iso-8859-3"; - public static final String MIMENAME_ISO_8859_4 = "iso-8859-4"; - public static final String MIMENAME_ISO_8859_5 = "iso-8859-5"; - public static final String MIMENAME_ISO_8859_6 = "iso-8859-6"; - public static final String MIMENAME_ISO_8859_7 = "iso-8859-7"; - public static final String MIMENAME_ISO_8859_8 = "iso-8859-8"; - public static final String MIMENAME_ISO_8859_9 = "iso-8859-9"; - public static final String MIMENAME_SHIFT_JIS = "shift_JIS"; - public static final String MIMENAME_UTF_8 = "utf-8"; - public static final String MIMENAME_BIG5 = "big5"; - public static final String MIMENAME_UCS2 = "iso-10646-ucs-2"; - public static final String MIMENAME_UTF_16 = "utf-16"; - - public static final String DEFAULT_CHARSET_NAME = MIMENAME_UTF_8; - - /** - * Array of the names of character sets. - */ - private static final String[] MIME_NAMES = { - MIMENAME_ANY_CHARSET, - MIMENAME_US_ASCII, - MIMENAME_ISO_8859_1, - MIMENAME_ISO_8859_2, - MIMENAME_ISO_8859_3, - MIMENAME_ISO_8859_4, - MIMENAME_ISO_8859_5, - MIMENAME_ISO_8859_6, - MIMENAME_ISO_8859_7, - MIMENAME_ISO_8859_8, - MIMENAME_ISO_8859_9, - MIMENAME_SHIFT_JIS, - MIMENAME_UTF_8, - MIMENAME_BIG5, - MIMENAME_UCS2, - MIMENAME_UTF_16, - }; - - private static final HashMap MIBENUM_TO_NAME_MAP; - private static final HashMap NAME_TO_MIBENUM_MAP; - - static { - // Create the HashMaps. - MIBENUM_TO_NAME_MAP = new HashMap(); - NAME_TO_MIBENUM_MAP = new HashMap(); - assert(MIBENUM_NUMBERS.length == MIME_NAMES.length); - int count = MIBENUM_NUMBERS.length - 1; - for(int i = 0; i <= count; i++) { - MIBENUM_TO_NAME_MAP.put(MIBENUM_NUMBERS[i], MIME_NAMES[i]); - NAME_TO_MIBENUM_MAP.put(MIME_NAMES[i], MIBENUM_NUMBERS[i]); - } - } - - private CharacterSets() {} // Non-instantiatable - - /** - * Map an MIBEnum number to the name of the charset which this number - * is assigned to by IANA. - * - * @param mibEnumValue An IANA assigned MIBEnum number. - * @return The name string of the charset. - * @throws UnsupportedEncodingException - */ - public static String getMimeName(int mibEnumValue) - throws UnsupportedEncodingException { - String name = MIBENUM_TO_NAME_MAP.get(mibEnumValue); - if (name == null) { - throw new UnsupportedEncodingException(); - } - return name; - } - - /** - * Map a well-known charset name to its assigned MIBEnum number. - * - * @param mimeName The charset name. - * @return The MIBEnum number assigned by IANA for this charset. - * @throws UnsupportedEncodingException - */ - public static int getMibEnumValue(String mimeName) - throws UnsupportedEncodingException { - if(null == mimeName) { - return -1; - } - - Integer mibEnumValue = NAME_TO_MIBENUM_MAP.get(mimeName); - if (mibEnumValue == null) { - throw new UnsupportedEncodingException(); - } - return mibEnumValue; - } -} diff --git a/core/java/com/google/android/mms/pdu/DeliveryInd.java b/core/java/com/google/android/mms/pdu/DeliveryInd.java deleted file mode 100644 index dafa8d11b871a..0000000000000 --- a/core/java/com/google/android/mms/pdu/DeliveryInd.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (C) 2007 Esmertec AG. - * 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. - */ - -package com.google.android.mms.pdu; - -import com.google.android.mms.InvalidHeaderValueException; - -/** - * M-Delivery.Ind Pdu. - */ -public class DeliveryInd extends GenericPdu { - /** - * Empty constructor. - * Since the Pdu corresponding to this class is constructed - * by the Proxy-Relay server, this class is only instantiated - * by the Pdu Parser. - * - * @throws InvalidHeaderValueException if error occurs. - */ - public DeliveryInd() throws InvalidHeaderValueException { - super(); - setMessageType(PduHeaders.MESSAGE_TYPE_DELIVERY_IND); - } - - /** - * Constructor with given headers. - * - * @param headers Headers for this PDU. - */ - DeliveryInd(PduHeaders headers) { - super(headers); - } - - /** - * Get Date value. - * - * @return the value - */ - public long getDate() { - return mPduHeaders.getLongInteger(PduHeaders.DATE); - } - - /** - * Set Date value. - * - * @param value the value - */ - public void setDate(long value) { - mPduHeaders.setLongInteger(value, PduHeaders.DATE); - } - - /** - * Get Message-ID value. - * - * @return the value - */ - public byte[] getMessageId() { - return mPduHeaders.getTextString(PduHeaders.MESSAGE_ID); - } - - /** - * Set Message-ID value. - * - * @param value the value, should not be null - * @throws NullPointerException if the value is null. - */ - public void setMessageId(byte[] value) { - mPduHeaders.setTextString(value, PduHeaders.MESSAGE_ID); - } - - /** - * Get Status value. - * - * @return the value - */ - public int getStatus() { - return mPduHeaders.getOctet(PduHeaders.STATUS); - } - - /** - * Set Status value. - * - * @param value the value - * @throws InvalidHeaderValueException if the value is invalid. - */ - public void setStatus(int value) throws InvalidHeaderValueException { - mPduHeaders.setOctet(value, PduHeaders.STATUS); - } - - /** - * Get To value. - * - * @return the value - */ - public EncodedStringValue[] getTo() { - return mPduHeaders.getEncodedStringValues(PduHeaders.TO); - } - - /** - * set To value. - * - * @param value the value - * @throws NullPointerException if the value is null. - */ - public void setTo(EncodedStringValue[] value) { - mPduHeaders.setEncodedStringValues(value, PduHeaders.TO); - } - - /* - * Optional, not supported header fields: - * - * public byte[] getApplicId() {return null;} - * public void setApplicId(byte[] value) {} - * - * public byte[] getAuxApplicId() {return null;} - * public void getAuxApplicId(byte[] value) {} - * - * public byte[] getReplyApplicId() {return 0x00;} - * public void setReplyApplicId(byte[] value) {} - * - * public EncodedStringValue getStatusText() {return null;} - * public void setStatusText(EncodedStringValue value) {} - */ -} diff --git a/core/java/com/google/android/mms/pdu/EncodedStringValue.java b/core/java/com/google/android/mms/pdu/EncodedStringValue.java deleted file mode 100644 index 9495c1c5700ea..0000000000000 --- a/core/java/com/google/android/mms/pdu/EncodedStringValue.java +++ /dev/null @@ -1,283 +0,0 @@ -/* - * Copyright (C) 2007-2008 Esmertec AG. - * Copyright (C) 2007-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 com.google.android.mms.pdu; - -import android.util.Log; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.util.ArrayList; - -/** - * Encoded-string-value = Text-string | Value-length Char-set Text-string - */ -public class EncodedStringValue implements Cloneable { - private static final String TAG = "EncodedStringValue"; - private static final boolean DEBUG = false; - private static final boolean LOCAL_LOGV = false; - - /** - * The Char-set value. - */ - private int mCharacterSet; - - /** - * The Text-string value. - */ - private byte[] mData; - - /** - * Constructor. - * - * @param charset the Char-set value - * @param data the Text-string value - * @throws NullPointerException if Text-string value is null. - */ - public EncodedStringValue(int charset, byte[] data) { - // TODO: CharSet needs to be validated against MIBEnum. - if(null == data) { - throw new NullPointerException("EncodedStringValue: Text-string is null."); - } - - mCharacterSet = charset; - mData = new byte[data.length]; - System.arraycopy(data, 0, mData, 0, data.length); - } - - /** - * Constructor. - * - * @param data the Text-string value - * @throws NullPointerException if Text-string value is null. - */ - public EncodedStringValue(byte[] data) { - this(CharacterSets.DEFAULT_CHARSET, data); - } - - public EncodedStringValue(String data) { - try { - mData = data.getBytes(CharacterSets.DEFAULT_CHARSET_NAME); - mCharacterSet = CharacterSets.DEFAULT_CHARSET; - } catch (UnsupportedEncodingException e) { - Log.e(TAG, "Default encoding must be supported.", e); - } - } - - /** - * Get Char-set value. - * - * @return the value - */ - public int getCharacterSet() { - return mCharacterSet; - } - - /** - * Set Char-set value. - * - * @param charset the Char-set value - */ - public void setCharacterSet(int charset) { - // TODO: CharSet needs to be validated against MIBEnum. - mCharacterSet = charset; - } - - /** - * Get Text-string value. - * - * @return the value - */ - public byte[] getTextString() { - byte[] byteArray = new byte[mData.length]; - - System.arraycopy(mData, 0, byteArray, 0, mData.length); - return byteArray; - } - - /** - * Set Text-string value. - * - * @param textString the Text-string value - * @throws NullPointerException if Text-string value is null. - */ - public void setTextString(byte[] textString) { - if(null == textString) { - throw new NullPointerException("EncodedStringValue: Text-string is null."); - } - - mData = new byte[textString.length]; - System.arraycopy(textString, 0, mData, 0, textString.length); - } - - /** - * Convert this object to a {@link java.lang.String}. If the encoding of - * the EncodedStringValue is null or unsupported, it will be - * treated as iso-8859-1 encoding. - * - * @return The decoded String. - */ - public String getString() { - if (CharacterSets.ANY_CHARSET == mCharacterSet) { - return new String(mData); // system default encoding. - } else { - try { - String name = CharacterSets.getMimeName(mCharacterSet); - return new String(mData, name); - } catch (UnsupportedEncodingException e) { - if (LOCAL_LOGV) { - Log.v(TAG, e.getMessage(), e); - } - try { - return new String(mData, CharacterSets.MIMENAME_ISO_8859_1); - } catch (UnsupportedEncodingException _) { - return new String(mData); // system default encoding. - } - } - } - } - - /** - * Append to Text-string. - * - * @param textString the textString to append - * @throws NullPointerException if the text String is null - * or an IOException occured. - */ - public void appendTextString(byte[] textString) { - if(null == textString) { - throw new NullPointerException("Text-string is null."); - } - - if(null == mData) { - mData = new byte[textString.length]; - System.arraycopy(textString, 0, mData, 0, textString.length); - } else { - ByteArrayOutputStream newTextString = new ByteArrayOutputStream(); - try { - newTextString.write(mData); - newTextString.write(textString); - } catch (IOException e) { - e.printStackTrace(); - throw new NullPointerException( - "appendTextString: failed when write a new Text-string"); - } - - mData = newTextString.toByteArray(); - } - } - - /* - * (non-Javadoc) - * @see java.lang.Object#clone() - */ - @Override - public Object clone() throws CloneNotSupportedException { - super.clone(); - int len = mData.length; - byte[] dstBytes = new byte[len]; - System.arraycopy(mData, 0, dstBytes, 0, len); - - try { - return new EncodedStringValue(mCharacterSet, dstBytes); - } catch (Exception e) { - Log.e(TAG, "failed to clone an EncodedStringValue: " + this); - e.printStackTrace(); - throw new CloneNotSupportedException(e.getMessage()); - } - } - - /** - * Split this encoded string around matches of the given pattern. - * - * @param pattern the delimiting pattern - * @return the array of encoded strings computed by splitting this encoded - * string around matches of the given pattern - */ - public EncodedStringValue[] split(String pattern) { - String[] temp = getString().split(pattern); - EncodedStringValue[] ret = new EncodedStringValue[temp.length]; - for (int i = 0; i < ret.length; ++i) { - try { - ret[i] = new EncodedStringValue(mCharacterSet, - temp[i].getBytes()); - } catch (NullPointerException _) { - // Can't arrive here - return null; - } - } - return ret; - } - - /** - * Extract an EncodedStringValue[] from a given String. - */ - public static EncodedStringValue[] extract(String src) { - String[] values = src.split(";"); - - ArrayList list = new ArrayList(); - for (int i = 0; i < values.length; i++) { - if (values[i].length() > 0) { - list.add(new EncodedStringValue(values[i])); - } - } - - int len = list.size(); - if (len > 0) { - return list.toArray(new EncodedStringValue[len]); - } else { - return null; - } - } - - /** - * Concatenate an EncodedStringValue[] into a single String. - */ - public static String concat(EncodedStringValue[] addr) { - StringBuilder sb = new StringBuilder(); - int maxIndex = addr.length - 1; - for (int i = 0; i <= maxIndex; i++) { - sb.append(addr[i].getString()); - if (i < maxIndex) { - sb.append(";"); - } - } - - return sb.toString(); - } - - public static EncodedStringValue copy(EncodedStringValue value) { - if (value == null) { - return null; - } - - return new EncodedStringValue(value.mCharacterSet, value.mData); - } - - public static EncodedStringValue[] encodeStrings(String[] array) { - int count = array.length; - if (count > 0) { - EncodedStringValue[] encodedArray = new EncodedStringValue[count]; - for (int i = 0; i < count; i++) { - encodedArray[i] = new EncodedStringValue(array[i]); - } - return encodedArray; - } - return null; - } -} diff --git a/core/java/com/google/android/mms/pdu/GenericPdu.java b/core/java/com/google/android/mms/pdu/GenericPdu.java deleted file mode 100644 index 705de6afb8b61..0000000000000 --- a/core/java/com/google/android/mms/pdu/GenericPdu.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (C) 2007 Esmertec AG. - * 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. - */ - -package com.google.android.mms.pdu; - -import com.google.android.mms.InvalidHeaderValueException; - -public class GenericPdu { - /** - * The headers of pdu. - */ - PduHeaders mPduHeaders = null; - - /** - * Constructor. - */ - public GenericPdu() { - mPduHeaders = new PduHeaders(); - } - - /** - * Constructor. - * - * @param headers Headers for this PDU. - */ - GenericPdu(PduHeaders headers) { - mPduHeaders = headers; - } - - /** - * Get the headers of this PDU. - * - * @return A PduHeaders of this PDU. - */ - PduHeaders getPduHeaders() { - return mPduHeaders; - } - - /** - * Get X-Mms-Message-Type field value. - * - * @return the X-Mms-Report-Allowed value - */ - public int getMessageType() { - return mPduHeaders.getOctet(PduHeaders.MESSAGE_TYPE); - } - - /** - * Set X-Mms-Message-Type field value. - * - * @param value the value - * @throws InvalidHeaderValueException if the value is invalid. - * RuntimeException if field's value is not Octet. - */ - public void setMessageType(int value) throws InvalidHeaderValueException { - mPduHeaders.setOctet(value, PduHeaders.MESSAGE_TYPE); - } - - /** - * Get X-Mms-MMS-Version field value. - * - * @return the X-Mms-MMS-Version value - */ - public int getMmsVersion() { - return mPduHeaders.getOctet(PduHeaders.MMS_VERSION); - } - - /** - * Set X-Mms-MMS-Version field value. - * - * @param value the value - * @throws InvalidHeaderValueException if the value is invalid. - * RuntimeException if field's value is not Octet. - */ - public void setMmsVersion(int value) throws InvalidHeaderValueException { - mPduHeaders.setOctet(value, PduHeaders.MMS_VERSION); - } - - /** - * Get From value. - * From-value = Value-length - * (Address-present-token Encoded-string-value | Insert-address-token) - * - * @return the value - */ - public EncodedStringValue getFrom() { - return mPduHeaders.getEncodedStringValue(PduHeaders.FROM); - } - - /** - * Set From value. - * - * @param value the value - * @throws NullPointerException if the value is null. - */ - public void setFrom(EncodedStringValue value) { - mPduHeaders.setEncodedStringValue(value, PduHeaders.FROM); - } -} diff --git a/core/java/com/google/android/mms/pdu/MultimediaMessagePdu.java b/core/java/com/google/android/mms/pdu/MultimediaMessagePdu.java deleted file mode 100644 index 5a85e0e79ddc1..0000000000000 --- a/core/java/com/google/android/mms/pdu/MultimediaMessagePdu.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright (C) 2007 Esmertec AG. - * 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. - */ - -package com.google.android.mms.pdu; - -import com.google.android.mms.InvalidHeaderValueException; - -/** - * Multimedia message PDU. - */ -public class MultimediaMessagePdu extends GenericPdu{ - /** - * The body. - */ - private PduBody mMessageBody; - - /** - * Constructor. - */ - public MultimediaMessagePdu() { - super(); - } - - /** - * Constructor. - * - * @param header the header of this PDU - * @param body the body of this PDU - */ - public MultimediaMessagePdu(PduHeaders header, PduBody body) { - super(header); - mMessageBody = body; - } - - /** - * Constructor with given headers. - * - * @param headers Headers for this PDU. - */ - MultimediaMessagePdu(PduHeaders headers) { - super(headers); - } - - /** - * Get body of the PDU. - * - * @return the body - */ - public PduBody getBody() { - return mMessageBody; - } - - /** - * Set body of the PDU. - * - * @param body the body - */ - public void setBody(PduBody body) { - mMessageBody = body; - } - - /** - * Get subject. - * - * @return the value - */ - public EncodedStringValue getSubject() { - return mPduHeaders.getEncodedStringValue(PduHeaders.SUBJECT); - } - - /** - * Set subject. - * - * @param value the value - * @throws NullPointerException if the value is null. - */ - public void setSubject(EncodedStringValue value) { - mPduHeaders.setEncodedStringValue(value, PduHeaders.SUBJECT); - } - - /** - * Get To value. - * - * @return the value - */ - public EncodedStringValue[] getTo() { - return mPduHeaders.getEncodedStringValues(PduHeaders.TO); - } - - /** - * Add a "To" value. - * - * @param value the value - * @throws NullPointerException if the value is null. - */ - public void addTo(EncodedStringValue value) { - mPduHeaders.appendEncodedStringValue(value, PduHeaders.TO); - } - - /** - * Get X-Mms-Priority value. - * - * @return the value - */ - public int getPriority() { - return mPduHeaders.getOctet(PduHeaders.PRIORITY); - } - - /** - * Set X-Mms-Priority value. - * - * @param value the value - * @throws InvalidHeaderValueException if the value is invalid. - */ - public void setPriority(int value) throws InvalidHeaderValueException { - mPduHeaders.setOctet(value, PduHeaders.PRIORITY); - } - - /** - * Get Date value. - * - * @return the value - */ - public long getDate() { - return mPduHeaders.getLongInteger(PduHeaders.DATE); - } - - /** - * Set Date value in seconds. - * - * @param value the value - */ - public void setDate(long value) { - mPduHeaders.setLongInteger(value, PduHeaders.DATE); - } -} diff --git a/core/java/com/google/android/mms/pdu/NotificationInd.java b/core/java/com/google/android/mms/pdu/NotificationInd.java deleted file mode 100644 index c56cba6d14bfb..0000000000000 --- a/core/java/com/google/android/mms/pdu/NotificationInd.java +++ /dev/null @@ -1,285 +0,0 @@ -/* - * Copyright (C) 2007 Esmertec AG. - * 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. - */ - -package com.google.android.mms.pdu; - -import com.google.android.mms.InvalidHeaderValueException; - -/** - * M-Notification.ind PDU. - */ -public class NotificationInd extends GenericPdu { - /** - * Empty constructor. - * Since the Pdu corresponding to this class is constructed - * by the Proxy-Relay server, this class is only instantiated - * by the Pdu Parser. - * - * @throws InvalidHeaderValueException if error occurs. - * RuntimeException if an undeclared error occurs. - */ - public NotificationInd() throws InvalidHeaderValueException { - super(); - setMessageType(PduHeaders.MESSAGE_TYPE_NOTIFICATION_IND); - } - - /** - * Constructor with given headers. - * - * @param headers Headers for this PDU. - */ - NotificationInd(PduHeaders headers) { - super(headers); - } - - /** - * Get X-Mms-Content-Class Value. - * - * @return the value - */ - public int getContentClass() { - return mPduHeaders.getOctet(PduHeaders.CONTENT_CLASS); - } - - /** - * Set X-Mms-Content-Class Value. - * - * @param value the value - * @throws InvalidHeaderValueException if the value is invalid. - * RuntimeException if an undeclared error occurs. - */ - public void setContentClass(int value) throws InvalidHeaderValueException { - mPduHeaders.setOctet(value, PduHeaders.CONTENT_CLASS); - } - - /** - * Get X-Mms-Content-Location value. - * When used in a PDU other than M-Mbox-Delete.conf and M-Delete.conf: - * Content-location-value = Uri-value - * - * @return the value - */ - public byte[] getContentLocation() { - return mPduHeaders.getTextString(PduHeaders.CONTENT_LOCATION); - } - - /** - * Set X-Mms-Content-Location value. - * - * @param value the value - * @throws NullPointerException if the value is null. - * RuntimeException if an undeclared error occurs. - */ - public void setContentLocation(byte[] value) { - mPduHeaders.setTextString(value, PduHeaders.CONTENT_LOCATION); - } - - /** - * Get X-Mms-Expiry value. - * - * Expiry-value = Value-length - * (Absolute-token Date-value | Relative-token Delta-seconds-value) - * - * @return the value - */ - public long getExpiry() { - return mPduHeaders.getLongInteger(PduHeaders.EXPIRY); - } - - /** - * Set X-Mms-Expiry value. - * - * @param value the value - * @throws RuntimeException if an undeclared error occurs. - */ - public void setExpiry(long value) { - mPduHeaders.setLongInteger(value, PduHeaders.EXPIRY); - } - - /** - * Get From value. - * From-value = Value-length - * (Address-present-token Encoded-string-value | Insert-address-token) - * - * @return the value - */ - public EncodedStringValue getFrom() { - return mPduHeaders.getEncodedStringValue(PduHeaders.FROM); - } - - /** - * Set From value. - * - * @param value the value - * @throws NullPointerException if the value is null. - * RuntimeException if an undeclared error occurs. - */ - public void setFrom(EncodedStringValue value) { - mPduHeaders.setEncodedStringValue(value, PduHeaders.FROM); - } - - /** - * Get X-Mms-Message-Class value. - * Message-class-value = Class-identifier | Token-text - * Class-identifier = Personal | Advertisement | Informational | Auto - * - * @return the value - */ - public byte[] getMessageClass() { - return mPduHeaders.getTextString(PduHeaders.MESSAGE_CLASS); - } - - /** - * Set X-Mms-Message-Class value. - * - * @param value the value - * @throws NullPointerException if the value is null. - * RuntimeException if an undeclared error occurs. - */ - public void setMessageClass(byte[] value) { - mPduHeaders.setTextString(value, PduHeaders.MESSAGE_CLASS); - } - - /** - * Get X-Mms-Message-Size value. - * Message-size-value = Long-integer - * - * @return the value - */ - public long getMessageSize() { - return mPduHeaders.getLongInteger(PduHeaders.MESSAGE_SIZE); - } - - /** - * Set X-Mms-Message-Size value. - * - * @param value the value - * @throws RuntimeException if an undeclared error occurs. - */ - public void setMessageSize(long value) { - mPduHeaders.setLongInteger(value, PduHeaders.MESSAGE_SIZE); - } - - /** - * Get subject. - * - * @return the value - */ - public EncodedStringValue getSubject() { - return mPduHeaders.getEncodedStringValue(PduHeaders.SUBJECT); - } - - /** - * Set subject. - * - * @param value the value - * @throws NullPointerException if the value is null. - * RuntimeException if an undeclared error occurs. - */ - public void setSubject(EncodedStringValue value) { - mPduHeaders.setEncodedStringValue(value, PduHeaders.SUBJECT); - } - - /** - * Get X-Mms-Transaction-Id. - * - * @return the value - */ - public byte[] getTransactionId() { - return mPduHeaders.getTextString(PduHeaders.TRANSACTION_ID); - } - - /** - * Set X-Mms-Transaction-Id. - * - * @param value the value - * @throws NullPointerException if the value is null. - * RuntimeException if an undeclared error occurs. - */ - public void setTransactionId(byte[] value) { - mPduHeaders.setTextString(value, PduHeaders.TRANSACTION_ID); - } - - /** - * Get X-Mms-Delivery-Report Value. - * - * @return the value - */ - public int getDeliveryReport() { - return mPduHeaders.getOctet(PduHeaders.DELIVERY_REPORT); - } - - /** - * Set X-Mms-Delivery-Report Value. - * - * @param value the value - * @throws InvalidHeaderValueException if the value is invalid. - * RuntimeException if an undeclared error occurs. - */ - public void setDeliveryReport(int value) throws InvalidHeaderValueException { - mPduHeaders.setOctet(value, PduHeaders.DELIVERY_REPORT); - } - - /* - * Optional, not supported header fields: - * - * public byte[] getApplicId() {return null;} - * public void setApplicId(byte[] value) {} - * - * public byte[] getAuxApplicId() {return null;} - * public void getAuxApplicId(byte[] value) {} - * - * public byte getDrmContent() {return 0x00;} - * public void setDrmContent(byte value) {} - * - * public byte getDistributionIndicator() {return 0x00;} - * public void setDistributionIndicator(byte value) {} - * - * public ElementDescriptorValue getElementDescriptor() {return null;} - * public void getElementDescriptor(ElementDescriptorValue value) {} - * - * public byte getPriority() {return 0x00;} - * public void setPriority(byte value) {} - * - * public byte getRecommendedRetrievalMode() {return 0x00;} - * public void setRecommendedRetrievalMode(byte value) {} - * - * public byte getRecommendedRetrievalModeText() {return 0x00;} - * public void setRecommendedRetrievalModeText(byte value) {} - * - * public byte[] getReplaceId() {return 0x00;} - * public void setReplaceId(byte[] value) {} - * - * public byte[] getReplyApplicId() {return 0x00;} - * public void setReplyApplicId(byte[] value) {} - * - * public byte getReplyCharging() {return 0x00;} - * public void setReplyCharging(byte value) {} - * - * public byte getReplyChargingDeadline() {return 0x00;} - * public void setReplyChargingDeadline(byte value) {} - * - * public byte[] getReplyChargingId() {return 0x00;} - * public void setReplyChargingId(byte[] value) {} - * - * public long getReplyChargingSize() {return 0;} - * public void setReplyChargingSize(long value) {} - * - * public byte getStored() {return 0x00;} - * public void setStored(byte value) {} - */ -} diff --git a/core/java/com/google/android/mms/pdu/NotifyRespInd.java b/core/java/com/google/android/mms/pdu/NotifyRespInd.java deleted file mode 100644 index 2cc2fce0812df..0000000000000 --- a/core/java/com/google/android/mms/pdu/NotifyRespInd.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (C) 2007 Esmertec AG. - * 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. - */ - -package com.google.android.mms.pdu; - -import com.google.android.mms.InvalidHeaderValueException; - -/** - * M-NofifyResp.ind PDU. - */ -public class NotifyRespInd extends GenericPdu { - /** - * Constructor, used when composing a M-NotifyResp.ind pdu. - * - * @param mmsVersion current version of mms - * @param transactionId the transaction-id value - * @param status the status value - * @throws InvalidHeaderValueException if parameters are invalid. - * NullPointerException if transactionId is null. - * RuntimeException if an undeclared error occurs. - */ - public NotifyRespInd(int mmsVersion, - byte[] transactionId, - int status) throws InvalidHeaderValueException { - super(); - setMessageType(PduHeaders.MESSAGE_TYPE_NOTIFYRESP_IND); - setMmsVersion(mmsVersion); - setTransactionId(transactionId); - setStatus(status); - } - - /** - * Constructor with given headers. - * - * @param headers Headers for this PDU. - */ - NotifyRespInd(PduHeaders headers) { - super(headers); - } - - /** - * Get X-Mms-Report-Allowed field value. - * - * @return the X-Mms-Report-Allowed value - */ - public int getReportAllowed() { - return mPduHeaders.getOctet(PduHeaders.REPORT_ALLOWED); - } - - /** - * Set X-Mms-Report-Allowed field value. - * - * @param value the value - * @throws InvalidHeaderValueException if the value is invalid. - * RuntimeException if an undeclared error occurs. - */ - public void setReportAllowed(int value) throws InvalidHeaderValueException { - mPduHeaders.setOctet(value, PduHeaders.REPORT_ALLOWED); - } - - /** - * Set X-Mms-Status field value. - * - * @param value the value - * @throws InvalidHeaderValueException if the value is invalid. - * RuntimeException if an undeclared error occurs. - */ - public void setStatus(int value) throws InvalidHeaderValueException { - mPduHeaders.setOctet(value, PduHeaders.STATUS); - } - - /** - * GetX-Mms-Status field value. - * - * @return the X-Mms-Status value - */ - public int getStatus() { - return mPduHeaders.getOctet(PduHeaders.STATUS); - } - - /** - * Get X-Mms-Transaction-Id field value. - * - * @return the X-Mms-Report-Allowed value - */ - public byte[] getTransactionId() { - return mPduHeaders.getTextString(PduHeaders.TRANSACTION_ID); - } - - /** - * Set X-Mms-Transaction-Id field value. - * - * @param value the value - * @throws NullPointerException if the value is null. - * RuntimeException if an undeclared error occurs. - */ - public void setTransactionId(byte[] value) { - mPduHeaders.setTextString(value, PduHeaders.TRANSACTION_ID); - } -} diff --git a/core/java/com/google/android/mms/pdu/PduBody.java b/core/java/com/google/android/mms/pdu/PduBody.java deleted file mode 100644 index fa0416c6be6a8..0000000000000 --- a/core/java/com/google/android/mms/pdu/PduBody.java +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Copyright (C) 2007 Esmertec AG. - * 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. - */ - -package com.google.android.mms.pdu; - -import java.util.HashMap; -import java.util.Map; -import java.util.Vector; - -public class PduBody { - private Vector mParts = null; - - private Map mPartMapByContentId = null; - private Map mPartMapByContentLocation = null; - private Map mPartMapByName = null; - private Map mPartMapByFileName = null; - - /** - * Constructor. - */ - public PduBody() { - mParts = new Vector(); - - mPartMapByContentId = new HashMap(); - mPartMapByContentLocation = new HashMap(); - mPartMapByName = new HashMap(); - mPartMapByFileName = new HashMap(); - } - - private void putPartToMaps(PduPart part) { - // Put part to mPartMapByContentId. - byte[] contentId = part.getContentId(); - if(null != contentId) { - mPartMapByContentId.put(new String(contentId), part); - } - - // Put part to mPartMapByContentLocation. - byte[] contentLocation = part.getContentLocation(); - if(null != contentLocation) { - String clc = new String(contentLocation); - mPartMapByContentLocation.put(clc, part); - } - - // Put part to mPartMapByName. - byte[] name = part.getName(); - if(null != name) { - String clc = new String(name); - mPartMapByName.put(clc, part); - } - - // Put part to mPartMapByFileName. - byte[] fileName = part.getFilename(); - if(null != fileName) { - String clc = new String(fileName); - mPartMapByFileName.put(clc, part); - } - } - - /** - * Appends the specified part to the end of this body. - * - * @param part part to be appended - * @return true when success, false when fail - * @throws NullPointerException when part is null - */ - public boolean addPart(PduPart part) { - if(null == part) { - throw new NullPointerException(); - } - - putPartToMaps(part); - return mParts.add(part); - } - - /** - * Inserts the specified part at the specified position. - * - * @param index index at which the specified part is to be inserted - * @param part part to be inserted - * @throws NullPointerException when part is null - */ - public void addPart(int index, PduPart part) { - if(null == part) { - throw new NullPointerException(); - } - - putPartToMaps(part); - mParts.add(index, part); - } - - /** - * Removes the part at the specified position. - * - * @param index index of the part to return - * @return part at the specified index - */ - public PduPart removePart(int index) { - return mParts.remove(index); - } - - /** - * Remove all of the parts. - */ - public void removeAll() { - mParts.clear(); - } - - /** - * Get the part at the specified position. - * - * @param index index of the part to return - * @return part at the specified index - */ - public PduPart getPart(int index) { - return mParts.get(index); - } - - /** - * Get the index of the specified part. - * - * @param part the part object - * @return index the index of the first occurrence of the part in this body - */ - public int getPartIndex(PduPart part) { - return mParts.indexOf(part); - } - - /** - * Get the number of parts. - * - * @return the number of parts - */ - public int getPartsNum() { - return mParts.size(); - } - - /** - * Get pdu part by content id. - * - * @param cid the value of content id. - * @return the pdu part. - */ - public PduPart getPartByContentId(String cid) { - return mPartMapByContentId.get(cid); - } - - /** - * Get pdu part by Content-Location. Content-Location of part is - * the same as filename and name(param of content-type). - * - * @param fileName the value of filename. - * @return the pdu part. - */ - public PduPart getPartByContentLocation(String contentLocation) { - return mPartMapByContentLocation.get(contentLocation); - } - - /** - * Get pdu part by name. - * - * @param fileName the value of filename. - * @return the pdu part. - */ - public PduPart getPartByName(String name) { - return mPartMapByName.get(name); - } - - /** - * Get pdu part by filename. - * - * @param fileName the value of filename. - * @return the pdu part. - */ - public PduPart getPartByFileName(String filename) { - return mPartMapByFileName.get(filename); - } -} diff --git a/core/java/com/google/android/mms/pdu/PduComposer.java b/core/java/com/google/android/mms/pdu/PduComposer.java deleted file mode 100644 index d426f89bcb6ce..0000000000000 --- a/core/java/com/google/android/mms/pdu/PduComposer.java +++ /dev/null @@ -1,1179 +0,0 @@ -/* - * Copyright (C) 2007-2008 Esmertec AG. - * Copyright (C) 2007-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 com.google.android.mms.pdu; - -import android.content.ContentResolver; -import android.content.Context; -import android.util.Log; -import android.text.TextUtils; - -import java.io.ByteArrayOutputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.util.Arrays; -import java.util.HashMap; - -public class PduComposer { - /** - * Address type. - */ - static private final int PDU_PHONE_NUMBER_ADDRESS_TYPE = 1; - static private final int PDU_EMAIL_ADDRESS_TYPE = 2; - static private final int PDU_IPV4_ADDRESS_TYPE = 3; - static private final int PDU_IPV6_ADDRESS_TYPE = 4; - static private final int PDU_UNKNOWN_ADDRESS_TYPE = 5; - - /** - * Address regular expression string. - */ - static final String REGEXP_PHONE_NUMBER_ADDRESS_TYPE = "\\+?[0-9|\\.|\\-]+"; - static final String REGEXP_EMAIL_ADDRESS_TYPE = "[a-zA-Z| ]*\\<{0,1}[a-zA-Z| ]+@{1}" + - "[a-zA-Z| ]+\\.{1}[a-zA-Z| ]+\\>{0,1}"; - static final String REGEXP_IPV6_ADDRESS_TYPE = - "[a-fA-F]{4}\\:{1}[a-fA-F0-9]{4}\\:{1}[a-fA-F0-9]{4}\\:{1}" + - "[a-fA-F0-9]{4}\\:{1}[a-fA-F0-9]{4}\\:{1}[a-fA-F0-9]{4}\\:{1}" + - "[a-fA-F0-9]{4}\\:{1}[a-fA-F0-9]{4}"; - static final String REGEXP_IPV4_ADDRESS_TYPE = "[0-9]{1,3}\\.{1}[0-9]{1,3}\\.{1}" + - "[0-9]{1,3}\\.{1}[0-9]{1,3}"; - - /** - * The postfix strings of address. - */ - static final String STRING_PHONE_NUMBER_ADDRESS_TYPE = "/TYPE=PLMN"; - static final String STRING_IPV4_ADDRESS_TYPE = "/TYPE=IPV4"; - static final String STRING_IPV6_ADDRESS_TYPE = "/TYPE=IPV6"; - - /** - * Error values. - */ - static private final int PDU_COMPOSE_SUCCESS = 0; - static private final int PDU_COMPOSE_CONTENT_ERROR = 1; - static private final int PDU_COMPOSE_FIELD_NOT_SET = 2; - static private final int PDU_COMPOSE_FIELD_NOT_SUPPORTED = 3; - - /** - * WAP values defined in WSP spec. - */ - static private final int QUOTED_STRING_FLAG = 34; - static private final int END_STRING_FLAG = 0; - static private final int LENGTH_QUOTE = 31; - static private final int TEXT_MAX = 127; - static private final int SHORT_INTEGER_MAX = 127; - static private final int LONG_INTEGER_LENGTH_MAX = 8; - - /** - * Block size when read data from InputStream. - */ - static private final int PDU_COMPOSER_BLOCK_SIZE = 1024; - - /** - * The output message. - */ - protected ByteArrayOutputStream mMessage = null; - - /** - * The PDU. - */ - private GenericPdu mPdu = null; - - /** - * Current visiting position of the mMessage. - */ - protected int mPosition = 0; - - /** - * Message compose buffer stack. - */ - private BufferStack mStack = null; - - /** - * Content resolver. - */ - private final ContentResolver mResolver; - - /** - * Header of this pdu. - */ - private PduHeaders mPduHeader = null; - - /** - * Map of all content type - */ - private static HashMap mContentTypeMap = null; - - static { - mContentTypeMap = new HashMap(); - - int i; - for (i = 0; i < PduContentTypes.contentTypes.length; i++) { - mContentTypeMap.put(PduContentTypes.contentTypes[i], i); - } - } - - /** - * Constructor. - * - * @param context the context - * @param pdu the pdu to be composed - */ - public PduComposer(Context context, GenericPdu pdu) { - mPdu = pdu; - mResolver = context.getContentResolver(); - mPduHeader = pdu.getPduHeaders(); - mStack = new BufferStack(); - mMessage = new ByteArrayOutputStream(); - mPosition = 0; - } - - /** - * Make the message. No need to check whether mandatory fields are set, - * because the constructors of outgoing pdus are taking care of this. - * - * @return OutputStream of maked message. Return null if - * the PDU is invalid. - */ - public byte[] make() { - // Get Message-type. - int type = mPdu.getMessageType(); - - /* make the message */ - switch (type) { - case PduHeaders.MESSAGE_TYPE_SEND_REQ: - if (makeSendReqPdu() != PDU_COMPOSE_SUCCESS) { - return null; - } - break; - case PduHeaders.MESSAGE_TYPE_NOTIFYRESP_IND: - if (makeNotifyResp() != PDU_COMPOSE_SUCCESS) { - return null; - } - break; - case PduHeaders.MESSAGE_TYPE_ACKNOWLEDGE_IND: - if (makeAckInd() != PDU_COMPOSE_SUCCESS) { - return null; - } - break; - case PduHeaders.MESSAGE_TYPE_READ_REC_IND: - if (makeReadRecInd() != PDU_COMPOSE_SUCCESS) { - return null; - } - break; - default: - return null; - } - - return mMessage.toByteArray(); - } - - /** - * Copy buf to mMessage. - */ - protected void arraycopy(byte[] buf, int pos, int length) { - mMessage.write(buf, pos, length); - mPosition = mPosition + length; - } - - /** - * Append a byte to mMessage. - */ - protected void append(int value) { - mMessage.write(value); - mPosition ++; - } - - /** - * Append short integer value to mMessage. - * This implementation doesn't check the validity of parameter, since it - * assumes that the values are validated in the GenericPdu setter methods. - */ - protected void appendShortInteger(int value) { - /* - * From WAP-230-WSP-20010705-a: - * Short-integer = OCTET - * ; Integers in range 0-127 shall be encoded as a one octet value - * ; with the most significant bit set to one (1xxx xxxx) and with - * ; the value in the remaining least significant bits. - * In our implementation, only low 7 bits are stored and otherwise - * bits are ignored. - */ - append((value | 0x80) & 0xff); - } - - /** - * Append an octet number between 128 and 255 into mMessage. - * NOTE: - * A value between 0 and 127 should be appended by using appendShortInteger. - * This implementation doesn't check the validity of parameter, since it - * assumes that the values are validated in the GenericPdu setter methods. - */ - protected void appendOctet(int number) { - append(number); - } - - /** - * Append a short length into mMessage. - * This implementation doesn't check the validity of parameter, since it - * assumes that the values are validated in the GenericPdu setter methods. - */ - protected void appendShortLength(int value) { - /* - * From WAP-230-WSP-20010705-a: - * Short-length = - */ - append(value); - } - - /** - * Append long integer into mMessage. it's used for really long integers. - * This implementation doesn't check the validity of parameter, since it - * assumes that the values are validated in the GenericPdu setter methods. - */ - protected void appendLongInteger(long longInt) { - /* - * From WAP-230-WSP-20010705-a: - * Long-integer = Short-length Multi-octet-integer - * ; The Short-length indicates the length of the Multi-octet-integer - * Multi-octet-integer = 1*30 OCTET - * ; The content octets shall be an unsigned integer value with the - * ; most significant octet encoded first (big-endian representation). - * ; The minimum number of octets must be used to encode the value. - */ - int size; - long temp = longInt; - - // Count the length of the long integer. - for(size = 0; (temp != 0) && (size < LONG_INTEGER_LENGTH_MAX); size++) { - temp = (temp >>> 8); - } - - // Set Length. - appendShortLength(size); - - // Count and set the long integer. - int i; - int shift = (size -1) * 8; - - for (i = 0; i < size; i++) { - append((int)((longInt >>> shift) & 0xff)); - shift = shift - 8; - } - } - - /** - * Append text string into mMessage. - * This implementation doesn't check the validity of parameter, since it - * assumes that the values are validated in the GenericPdu setter methods. - */ - protected void appendTextString(byte[] text) { - /* - * From WAP-230-WSP-20010705-a: - * Text-string = [Quote] *TEXT End-of-string - * ; If the first character in the TEXT is in the range of 128-255, - * ; a Quote character must precede it. Otherwise the Quote character - * ;must be omitted. The Quote is not part of the contents. - */ - if (((text[0])&0xff) > TEXT_MAX) { // No need to check for <= 255 - append(TEXT_MAX); - } - - arraycopy(text, 0, text.length); - append(0); - } - - /** - * Append text string into mMessage. - * This implementation doesn't check the validity of parameter, since it - * assumes that the values are validated in the GenericPdu setter methods. - */ - protected void appendTextString(String str) { - /* - * From WAP-230-WSP-20010705-a: - * Text-string = [Quote] *TEXT End-of-string - * ; If the first character in the TEXT is in the range of 128-255, - * ; a Quote character must precede it. Otherwise the Quote character - * ;must be omitted. The Quote is not part of the contents. - */ - appendTextString(str.getBytes()); - } - - /** - * Append encoded string value to mMessage. - * This implementation doesn't check the validity of parameter, since it - * assumes that the values are validated in the GenericPdu setter methods. - */ - protected void appendEncodedString(EncodedStringValue enStr) { - /* - * From OMA-TS-MMS-ENC-V1_3-20050927-C: - * Encoded-string-value = Text-string | Value-length Char-set Text-string - */ - assert(enStr != null); - - int charset = enStr.getCharacterSet(); - byte[] textString = enStr.getTextString(); - if (null == textString) { - return; - } - - /* - * In the implementation of EncodedStringValue, the charset field will - * never be 0. It will always be composed as - * Encoded-string-value = Value-length Char-set Text-string - */ - mStack.newbuf(); - PositionMarker start = mStack.mark(); - - appendShortInteger(charset); - appendTextString(textString); - - int len = start.getLength(); - mStack.pop(); - appendValueLength(len); - mStack.copy(); - } - - /** - * Append uintvar integer into mMessage. - * This implementation doesn't check the validity of parameter, since it - * assumes that the values are validated in the GenericPdu setter methods. - */ - protected void appendUintvarInteger(long value) { - /* - * From WAP-230-WSP-20010705-a: - * To encode a large unsigned integer, split it into 7-bit fragments - * and place them in the payloads of multiple octets. The most significant - * bits are placed in the first octets with the least significant bits - * ending up in the last octet. All octets MUST set the Continue bit to 1 - * except the last octet, which MUST set the Continue bit to 0. - */ - int i; - long max = SHORT_INTEGER_MAX; - - for (i = 0; i < 5; i++) { - if (value < max) { - break; - } - - max = (max << 7) | 0x7fl; - } - - while(i > 0) { - long temp = value >>> (i * 7); - temp = temp & 0x7f; - - append((int)((temp | 0x80) & 0xff)); - - i--; - } - - append((int)(value & 0x7f)); - } - - /** - * Append date value into mMessage. - * This implementation doesn't check the validity of parameter, since it - * assumes that the values are validated in the GenericPdu setter methods. - */ - protected void appendDateValue(long date) { - /* - * From OMA-TS-MMS-ENC-V1_3-20050927-C: - * Date-value = Long-integer - */ - appendLongInteger(date); - } - - /** - * Append value length to mMessage. - * This implementation doesn't check the validity of parameter, since it - * assumes that the values are validated in the GenericPdu setter methods. - */ - protected void appendValueLength(long value) { - /* - * From WAP-230-WSP-20010705-a: - * Value-length = Short-length | (Length-quote Length) - * ; Value length is used to indicate the length of the value to follow - * Short-length = - * Length-quote = - * Length = Uintvar-integer - */ - if (value < LENGTH_QUOTE) { - appendShortLength((int) value); - return; - } - - append(LENGTH_QUOTE); - appendUintvarInteger(value); - } - - /** - * Append quoted string to mMessage. - * This implementation doesn't check the validity of parameter, since it - * assumes that the values are validated in the GenericPdu setter methods. - */ - protected void appendQuotedString(byte[] text) { - /* - * From WAP-230-WSP-20010705-a: - * Quoted-string = *TEXT End-of-string - * ;The TEXT encodes an RFC2616 Quoted-string with the enclosing - * ;quotation-marks <"> removed. - */ - append(QUOTED_STRING_FLAG); - arraycopy(text, 0, text.length); - append(END_STRING_FLAG); - } - - /** - * Append quoted string to mMessage. - * This implementation doesn't check the validity of parameter, since it - * assumes that the values are validated in the GenericPdu setter methods. - */ - protected void appendQuotedString(String str) { - /* - * From WAP-230-WSP-20010705-a: - * Quoted-string = *TEXT End-of-string - * ;The TEXT encodes an RFC2616 Quoted-string with the enclosing - * ;quotation-marks <"> removed. - */ - appendQuotedString(str.getBytes()); - } - - private EncodedStringValue appendAddressType(EncodedStringValue address) { - EncodedStringValue temp = null; - - try { - int addressType = checkAddressType(address.getString()); - temp = EncodedStringValue.copy(address); - if (PDU_PHONE_NUMBER_ADDRESS_TYPE == addressType) { - // Phone number. - temp.appendTextString(STRING_PHONE_NUMBER_ADDRESS_TYPE.getBytes()); - } else if (PDU_IPV4_ADDRESS_TYPE == addressType) { - // Ipv4 address. - temp.appendTextString(STRING_IPV4_ADDRESS_TYPE.getBytes()); - } else if (PDU_IPV6_ADDRESS_TYPE == addressType) { - // Ipv6 address. - temp.appendTextString(STRING_IPV6_ADDRESS_TYPE.getBytes()); - } - } catch (NullPointerException e) { - return null; - } - - return temp; - } - - /** - * Append header to mMessage. - */ - private int appendHeader(int field) { - switch (field) { - case PduHeaders.MMS_VERSION: - appendOctet(field); - - int version = mPduHeader.getOctet(field); - if (0 == version) { - appendShortInteger(PduHeaders.CURRENT_MMS_VERSION); - } else { - appendShortInteger(version); - } - - break; - - case PduHeaders.MESSAGE_ID: - case PduHeaders.TRANSACTION_ID: - byte[] textString = mPduHeader.getTextString(field); - if (null == textString) { - return PDU_COMPOSE_FIELD_NOT_SET; - } - - appendOctet(field); - appendTextString(textString); - break; - - case PduHeaders.TO: - case PduHeaders.BCC: - case PduHeaders.CC: - EncodedStringValue[] addr = mPduHeader.getEncodedStringValues(field); - - if (null == addr) { - return PDU_COMPOSE_FIELD_NOT_SET; - } - - EncodedStringValue temp; - for (int i = 0; i < addr.length; i++) { - temp = appendAddressType(addr[i]); - if (temp == null) { - return PDU_COMPOSE_CONTENT_ERROR; - } - - appendOctet(field); - appendEncodedString(temp); - } - break; - - case PduHeaders.FROM: - // Value-length (Address-present-token Encoded-string-value | Insert-address-token) - appendOctet(field); - - EncodedStringValue from = mPduHeader.getEncodedStringValue(field); - if ((from == null) - || TextUtils.isEmpty(from.getString()) - || new String(from.getTextString()).equals( - PduHeaders.FROM_INSERT_ADDRESS_TOKEN_STR)) { - // Length of from = 1 - append(1); - // Insert-address-token = - append(PduHeaders.FROM_INSERT_ADDRESS_TOKEN); - } else { - mStack.newbuf(); - PositionMarker fstart = mStack.mark(); - - // Address-present-token = - append(PduHeaders.FROM_ADDRESS_PRESENT_TOKEN); - - temp = appendAddressType(from); - if (temp == null) { - return PDU_COMPOSE_CONTENT_ERROR; - } - - appendEncodedString(temp); - - int flen = fstart.getLength(); - mStack.pop(); - appendValueLength(flen); - mStack.copy(); - } - break; - - case PduHeaders.READ_STATUS: - case PduHeaders.STATUS: - case PduHeaders.REPORT_ALLOWED: - case PduHeaders.PRIORITY: - case PduHeaders.DELIVERY_REPORT: - case PduHeaders.READ_REPORT: - int octet = mPduHeader.getOctet(field); - if (0 == octet) { - return PDU_COMPOSE_FIELD_NOT_SET; - } - - appendOctet(field); - appendOctet(octet); - break; - - case PduHeaders.DATE: - long date = mPduHeader.getLongInteger(field); - if (-1 == date) { - return PDU_COMPOSE_FIELD_NOT_SET; - } - - appendOctet(field); - appendDateValue(date); - break; - - case PduHeaders.SUBJECT: - EncodedStringValue enString = - mPduHeader.getEncodedStringValue(field); - if (null == enString) { - return PDU_COMPOSE_FIELD_NOT_SET; - } - - appendOctet(field); - appendEncodedString(enString); - break; - - case PduHeaders.MESSAGE_CLASS: - byte[] messageClass = mPduHeader.getTextString(field); - if (null == messageClass) { - return PDU_COMPOSE_FIELD_NOT_SET; - } - - appendOctet(field); - if (Arrays.equals(messageClass, - PduHeaders.MESSAGE_CLASS_ADVERTISEMENT_STR.getBytes())) { - appendOctet(PduHeaders.MESSAGE_CLASS_ADVERTISEMENT); - } else if (Arrays.equals(messageClass, - PduHeaders.MESSAGE_CLASS_AUTO_STR.getBytes())) { - appendOctet(PduHeaders.MESSAGE_CLASS_AUTO); - } else if (Arrays.equals(messageClass, - PduHeaders.MESSAGE_CLASS_PERSONAL_STR.getBytes())) { - appendOctet(PduHeaders.MESSAGE_CLASS_PERSONAL); - } else if (Arrays.equals(messageClass, - PduHeaders.MESSAGE_CLASS_INFORMATIONAL_STR.getBytes())) { - appendOctet(PduHeaders.MESSAGE_CLASS_INFORMATIONAL); - } else { - appendTextString(messageClass); - } - break; - - case PduHeaders.EXPIRY: - long expiry = mPduHeader.getLongInteger(field); - if (-1 == expiry) { - return PDU_COMPOSE_FIELD_NOT_SET; - } - - appendOctet(field); - - mStack.newbuf(); - PositionMarker expiryStart = mStack.mark(); - - append(PduHeaders.VALUE_RELATIVE_TOKEN); - appendLongInteger(expiry); - - int expiryLength = expiryStart.getLength(); - mStack.pop(); - appendValueLength(expiryLength); - mStack.copy(); - break; - - default: - return PDU_COMPOSE_FIELD_NOT_SUPPORTED; - } - - return PDU_COMPOSE_SUCCESS; - } - - /** - * Make ReadRec.Ind. - */ - private int makeReadRecInd() { - if (mMessage == null) { - mMessage = new ByteArrayOutputStream(); - mPosition = 0; - } - - // X-Mms-Message-Type - appendOctet(PduHeaders.MESSAGE_TYPE); - appendOctet(PduHeaders.MESSAGE_TYPE_READ_REC_IND); - - // X-Mms-MMS-Version - if (appendHeader(PduHeaders.MMS_VERSION) != PDU_COMPOSE_SUCCESS) { - return PDU_COMPOSE_CONTENT_ERROR; - } - - // Message-ID - if (appendHeader(PduHeaders.MESSAGE_ID) != PDU_COMPOSE_SUCCESS) { - return PDU_COMPOSE_CONTENT_ERROR; - } - - // To - if (appendHeader(PduHeaders.TO) != PDU_COMPOSE_SUCCESS) { - return PDU_COMPOSE_CONTENT_ERROR; - } - - // From - if (appendHeader(PduHeaders.FROM) != PDU_COMPOSE_SUCCESS) { - return PDU_COMPOSE_CONTENT_ERROR; - } - - // Date Optional - appendHeader(PduHeaders.DATE); - - // X-Mms-Read-Status - if (appendHeader(PduHeaders.READ_STATUS) != PDU_COMPOSE_SUCCESS) { - return PDU_COMPOSE_CONTENT_ERROR; - } - - // X-Mms-Applic-ID Optional(not support) - // X-Mms-Reply-Applic-ID Optional(not support) - // X-Mms-Aux-Applic-Info Optional(not support) - - return PDU_COMPOSE_SUCCESS; - } - - /** - * Make NotifyResp.Ind. - */ - private int makeNotifyResp() { - if (mMessage == null) { - mMessage = new ByteArrayOutputStream(); - mPosition = 0; - } - - // X-Mms-Message-Type - appendOctet(PduHeaders.MESSAGE_TYPE); - appendOctet(PduHeaders.MESSAGE_TYPE_NOTIFYRESP_IND); - - // X-Mms-Transaction-ID - if (appendHeader(PduHeaders.TRANSACTION_ID) != PDU_COMPOSE_SUCCESS) { - return PDU_COMPOSE_CONTENT_ERROR; - } - - // X-Mms-MMS-Version - if (appendHeader(PduHeaders.MMS_VERSION) != PDU_COMPOSE_SUCCESS) { - return PDU_COMPOSE_CONTENT_ERROR; - } - - // X-Mms-Status - if (appendHeader(PduHeaders.STATUS) != PDU_COMPOSE_SUCCESS) { - return PDU_COMPOSE_CONTENT_ERROR; - } - - // X-Mms-Report-Allowed Optional (not support) - return PDU_COMPOSE_SUCCESS; - } - - /** - * Make Acknowledge.Ind. - */ - private int makeAckInd() { - if (mMessage == null) { - mMessage = new ByteArrayOutputStream(); - mPosition = 0; - } - - // X-Mms-Message-Type - appendOctet(PduHeaders.MESSAGE_TYPE); - appendOctet(PduHeaders.MESSAGE_TYPE_ACKNOWLEDGE_IND); - - // X-Mms-Transaction-ID - if (appendHeader(PduHeaders.TRANSACTION_ID) != PDU_COMPOSE_SUCCESS) { - return PDU_COMPOSE_CONTENT_ERROR; - } - - // X-Mms-MMS-Version - if (appendHeader(PduHeaders.MMS_VERSION) != PDU_COMPOSE_SUCCESS) { - return PDU_COMPOSE_CONTENT_ERROR; - } - - // X-Mms-Report-Allowed Optional - appendHeader(PduHeaders.REPORT_ALLOWED); - - return PDU_COMPOSE_SUCCESS; - } - - /** - * Make Send.req. - */ - private int makeSendReqPdu() { - if (mMessage == null) { - mMessage = new ByteArrayOutputStream(); - mPosition = 0; - } - - // X-Mms-Message-Type - appendOctet(PduHeaders.MESSAGE_TYPE); - appendOctet(PduHeaders.MESSAGE_TYPE_SEND_REQ); - - // X-Mms-Transaction-ID - appendOctet(PduHeaders.TRANSACTION_ID); - - byte[] trid = mPduHeader.getTextString(PduHeaders.TRANSACTION_ID); - if (trid == null) { - // Transaction-ID should be set(by Transaction) before make(). - throw new IllegalArgumentException("Transaction-ID is null."); - } - appendTextString(trid); - - // X-Mms-MMS-Version - if (appendHeader(PduHeaders.MMS_VERSION) != PDU_COMPOSE_SUCCESS) { - return PDU_COMPOSE_CONTENT_ERROR; - } - - // Date Date-value Optional. - appendHeader(PduHeaders.DATE); - - // From - if (appendHeader(PduHeaders.FROM) != PDU_COMPOSE_SUCCESS) { - return PDU_COMPOSE_CONTENT_ERROR; - } - - boolean recipient = false; - - // To - if (appendHeader(PduHeaders.TO) != PDU_COMPOSE_CONTENT_ERROR) { - recipient = true; - } - - // Cc - if (appendHeader(PduHeaders.CC) != PDU_COMPOSE_CONTENT_ERROR) { - recipient = true; - } - - // Bcc - if (appendHeader(PduHeaders.BCC) != PDU_COMPOSE_CONTENT_ERROR) { - recipient = true; - } - - // Need at least one of "cc", "bcc" and "to". - if (false == recipient) { - return PDU_COMPOSE_CONTENT_ERROR; - } - - // Subject Optional - appendHeader(PduHeaders.SUBJECT); - - // X-Mms-Message-Class Optional - // Message-class-value = Class-identifier | Token-text - appendHeader(PduHeaders.MESSAGE_CLASS); - - // X-Mms-Expiry Optional - appendHeader(PduHeaders.EXPIRY); - - // X-Mms-Priority Optional - appendHeader(PduHeaders.PRIORITY); - - // X-Mms-Delivery-Report Optional - appendHeader(PduHeaders.DELIVERY_REPORT); - - // X-Mms-Read-Report Optional - appendHeader(PduHeaders.READ_REPORT); - - // Content-Type - appendOctet(PduHeaders.CONTENT_TYPE); - - // Message body - return makeMessageBody(); - } - - /** - * Make message body. - */ - private int makeMessageBody() { - // 1. add body informations - mStack.newbuf(); // Switching buffer because we need to - - PositionMarker ctStart = mStack.mark(); - - // This contentTypeIdentifier should be used for type of attachment... - String contentType = new String(mPduHeader.getTextString(PduHeaders.CONTENT_TYPE)); - Integer contentTypeIdentifier = mContentTypeMap.get(contentType); - if (contentTypeIdentifier == null) { - // content type is mandatory - return PDU_COMPOSE_CONTENT_ERROR; - } - - appendShortInteger(contentTypeIdentifier.intValue()); - - // content-type parameter: start - PduBody body = ((SendReq) mPdu).getBody(); - if (null == body || body.getPartsNum() == 0) { - // empty message - appendUintvarInteger(0); - mStack.pop(); - mStack.copy(); - return PDU_COMPOSE_SUCCESS; - } - - PduPart part; - try { - part = body.getPart(0); - - byte[] start = part.getContentId(); - if (start != null) { - appendOctet(PduPart.P_DEP_START); - if (('<' == start[0]) && ('>' == start[start.length - 1])) { - appendTextString(start); - } else { - appendTextString("<" + new String(start) + ">"); - } - } - - // content-type parameter: type - appendOctet(PduPart.P_CT_MR_TYPE); - appendTextString(part.getContentType()); - } - catch (ArrayIndexOutOfBoundsException e){ - e.printStackTrace(); - } - - int ctLength = ctStart.getLength(); - mStack.pop(); - appendValueLength(ctLength); - mStack.copy(); - - // 3. add content - int partNum = body.getPartsNum(); - appendUintvarInteger(partNum); - for (int i = 0; i < partNum; i++) { - part = body.getPart(i); - mStack.newbuf(); // Leaving space for header lengh and data length - PositionMarker attachment = mStack.mark(); - - mStack.newbuf(); // Leaving space for Content-Type length - PositionMarker contentTypeBegin = mStack.mark(); - - byte[] partContentType = part.getContentType(); - - if (partContentType == null) { - // content type is mandatory - return PDU_COMPOSE_CONTENT_ERROR; - } - - // content-type value - Integer partContentTypeIdentifier = - mContentTypeMap.get(new String(partContentType)); - if (partContentTypeIdentifier == null) { - appendTextString(partContentType); - } else { - appendShortInteger(partContentTypeIdentifier.intValue()); - } - - /* Content-type parameter : name. - * The value of name, filename, content-location is the same. - * Just one of them is enough for this PDU. - */ - byte[] name = part.getName(); - - if (null == name) { - name = part.getFilename(); - - if (null == name) { - name = part.getContentLocation(); - - if (null == name) { - /* at lease one of name, filename, Content-location - * should be available. - */ - return PDU_COMPOSE_CONTENT_ERROR; - } - } - } - appendOctet(PduPart.P_DEP_NAME); - appendTextString(name); - - // content-type parameter : charset - int charset = part.getCharset(); - if (charset != 0) { - appendOctet(PduPart.P_CHARSET); - appendShortInteger(charset); - } - - int contentTypeLength = contentTypeBegin.getLength(); - mStack.pop(); - appendValueLength(contentTypeLength); - mStack.copy(); - - // content id - byte[] contentId = part.getContentId(); - - if (null != contentId) { - appendOctet(PduPart.P_CONTENT_ID); - if (('<' == contentId[0]) && ('>' == contentId[contentId.length - 1])) { - appendQuotedString(contentId); - } else { - appendQuotedString("<" + new String(contentId) + ">"); - } - } - - // content-location - byte[] contentLocation = part.getContentLocation(); - if (null != contentLocation) { - appendOctet(PduPart.P_CONTENT_LOCATION); - appendTextString(contentLocation); - } - - // content - int headerLength = attachment.getLength(); - - int dataLength = 0; // Just for safety... - byte[] partData = part.getData(); - - if (partData != null) { - arraycopy(partData, 0, partData.length); - dataLength = partData.length; - } else { - InputStream cr; - try { - byte[] buffer = new byte[PDU_COMPOSER_BLOCK_SIZE]; - cr = mResolver.openInputStream(part.getDataUri()); - int len = 0; - while ((len = cr.read(buffer)) != -1) { - mMessage.write(buffer, 0, len); - mPosition += len; - dataLength += len; - } - } catch (FileNotFoundException e) { - return PDU_COMPOSE_CONTENT_ERROR; - } catch (IOException e) { - return PDU_COMPOSE_CONTENT_ERROR; - } catch (RuntimeException e) { - return PDU_COMPOSE_CONTENT_ERROR; - } - } - - if (dataLength != (attachment.getLength() - headerLength)) { - throw new RuntimeException("BUG: Length sanity check failed"); - } - - mStack.pop(); - appendUintvarInteger(headerLength); - appendUintvarInteger(dataLength); - mStack.copy(); - } - - return PDU_COMPOSE_SUCCESS; - } - - /** - * Record current message informations. - */ - static private class LengthRecordNode { - ByteArrayOutputStream currentMessage = null; - public int currentPosition = 0; - - public LengthRecordNode next = null; - } - - /** - * Mark current message position and stact size. - */ - private class PositionMarker { - private int c_pos; // Current position - private int currentStackSize; // Current stack size - - int getLength() { - // If these assert fails, likely that you are finding the - // size of buffer that is deep in BufferStack you can only - // find the length of the buffer that is on top - if (currentStackSize != mStack.stackSize) { - throw new RuntimeException("BUG: Invalid call to getLength()"); - } - - return mPosition - c_pos; - } - } - - /** - * This implementation can be OPTIMIZED to use only - * 2 buffers. This optimization involves changing BufferStack - * only... Its usage (interface) will not change. - */ - private class BufferStack { - private LengthRecordNode stack = null; - private LengthRecordNode toCopy = null; - - int stackSize = 0; - - /** - * Create a new message buffer and push it into the stack. - */ - void newbuf() { - // You can't create a new buff when toCopy != null - // That is after calling pop() and before calling copy() - // If you do, it is a bug - if (toCopy != null) { - throw new RuntimeException("BUG: Invalid newbuf() before copy()"); - } - - LengthRecordNode temp = new LengthRecordNode(); - - temp.currentMessage = mMessage; - temp.currentPosition = mPosition; - - temp.next = stack; - stack = temp; - - stackSize = stackSize + 1; - - mMessage = new ByteArrayOutputStream(); - mPosition = 0; - } - - /** - * Pop the message before and record current message in the stack. - */ - void pop() { - ByteArrayOutputStream currentMessage = mMessage; - int currentPosition = mPosition; - - mMessage = stack.currentMessage; - mPosition = stack.currentPosition; - - toCopy = stack; - // Re using the top element of the stack to avoid memory allocation - - stack = stack.next; - stackSize = stackSize - 1; - - toCopy.currentMessage = currentMessage; - toCopy.currentPosition = currentPosition; - } - - /** - * Append current message to the message before. - */ - void copy() { - arraycopy(toCopy.currentMessage.toByteArray(), 0, - toCopy.currentPosition); - - toCopy = null; - } - - /** - * Mark current message position - */ - PositionMarker mark() { - PositionMarker m = new PositionMarker(); - - m.c_pos = mPosition; - m.currentStackSize = stackSize; - - return m; - } - } - - /** - * Check address type. - * - * @param address address string without the postfix stinng type, - * such as "/TYPE=PLMN", "/TYPE=IPv6" and "/TYPE=IPv4" - * @return PDU_PHONE_NUMBER_ADDRESS_TYPE if it is phone number, - * PDU_EMAIL_ADDRESS_TYPE if it is email address, - * PDU_IPV4_ADDRESS_TYPE if it is ipv4 address, - * PDU_IPV6_ADDRESS_TYPE if it is ipv6 address, - * PDU_UNKNOWN_ADDRESS_TYPE if it is unknown. - */ - protected static int checkAddressType(String address) { - /** - * From OMA-TS-MMS-ENC-V1_3-20050927-C.pdf, section 8. - * address = ( e-mail / device-address / alphanum-shortcode / num-shortcode) - * e-mail = mailbox; to the definition of mailbox as described in - * section 3.4 of [RFC2822], but excluding the - * obsolete definitions as indicated by the "obs-" prefix. - * device-address = ( global-phone-number "/TYPE=PLMN" ) - * / ( ipv4 "/TYPE=IPv4" ) / ( ipv6 "/TYPE=IPv6" ) - * / ( escaped-value "/TYPE=" address-type ) - * - * global-phone-number = ["+"] 1*( DIGIT / written-sep ) - * written-sep =("-"/".") - * - * ipv4 = 1*3DIGIT 3( "." 1*3DIGIT ) ; IPv4 address value - * - * ipv6 = 4HEXDIG 7( ":" 4HEXDIG ) ; IPv6 address per RFC 2373 - */ - - if (null == address) { - return PDU_UNKNOWN_ADDRESS_TYPE; - } - - if (address.matches(REGEXP_IPV4_ADDRESS_TYPE)) { - // Ipv4 address. - return PDU_IPV4_ADDRESS_TYPE; - }else if (address.matches(REGEXP_PHONE_NUMBER_ADDRESS_TYPE)) { - // Phone number. - return PDU_PHONE_NUMBER_ADDRESS_TYPE; - } else if (address.matches(REGEXP_EMAIL_ADDRESS_TYPE)) { - // Email address. - return PDU_EMAIL_ADDRESS_TYPE; - } else if (address.matches(REGEXP_IPV6_ADDRESS_TYPE)) { - // Ipv6 address. - return PDU_IPV6_ADDRESS_TYPE; - } else { - // Unknown address. - return PDU_UNKNOWN_ADDRESS_TYPE; - } - } -} diff --git a/core/java/com/google/android/mms/pdu/PduContentTypes.java b/core/java/com/google/android/mms/pdu/PduContentTypes.java deleted file mode 100644 index 7799e0e834af2..0000000000000 --- a/core/java/com/google/android/mms/pdu/PduContentTypes.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (C) 2007 Esmertec AG. - * 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. - */ - -package com.google.android.mms.pdu; - -public class PduContentTypes { - /** - * All content types. From: - * http://www.openmobilealliance.org/tech/omna/omna-wsp-content-type.htm - */ - static final String[] contentTypes = { - "*/*", /* 0x00 */ - "text/*", /* 0x01 */ - "text/html", /* 0x02 */ - "text/plain", /* 0x03 */ - "text/x-hdml", /* 0x04 */ - "text/x-ttml", /* 0x05 */ - "text/x-vCalendar", /* 0x06 */ - "text/x-vCard", /* 0x07 */ - "text/vnd.wap.wml", /* 0x08 */ - "text/vnd.wap.wmlscript", /* 0x09 */ - "text/vnd.wap.wta-event", /* 0x0A */ - "multipart/*", /* 0x0B */ - "multipart/mixed", /* 0x0C */ - "multipart/form-data", /* 0x0D */ - "multipart/byterantes", /* 0x0E */ - "multipart/alternative", /* 0x0F */ - "application/*", /* 0x10 */ - "application/java-vm", /* 0x11 */ - "application/x-www-form-urlencoded", /* 0x12 */ - "application/x-hdmlc", /* 0x13 */ - "application/vnd.wap.wmlc", /* 0x14 */ - "application/vnd.wap.wmlscriptc", /* 0x15 */ - "application/vnd.wap.wta-eventc", /* 0x16 */ - "application/vnd.wap.uaprof", /* 0x17 */ - "application/vnd.wap.wtls-ca-certificate", /* 0x18 */ - "application/vnd.wap.wtls-user-certificate", /* 0x19 */ - "application/x-x509-ca-cert", /* 0x1A */ - "application/x-x509-user-cert", /* 0x1B */ - "image/*", /* 0x1C */ - "image/gif", /* 0x1D */ - "image/jpeg", /* 0x1E */ - "image/tiff", /* 0x1F */ - "image/png", /* 0x20 */ - "image/vnd.wap.wbmp", /* 0x21 */ - "application/vnd.wap.multipart.*", /* 0x22 */ - "application/vnd.wap.multipart.mixed", /* 0x23 */ - "application/vnd.wap.multipart.form-data", /* 0x24 */ - "application/vnd.wap.multipart.byteranges", /* 0x25 */ - "application/vnd.wap.multipart.alternative", /* 0x26 */ - "application/xml", /* 0x27 */ - "text/xml", /* 0x28 */ - "application/vnd.wap.wbxml", /* 0x29 */ - "application/x-x968-cross-cert", /* 0x2A */ - "application/x-x968-ca-cert", /* 0x2B */ - "application/x-x968-user-cert", /* 0x2C */ - "text/vnd.wap.si", /* 0x2D */ - "application/vnd.wap.sic", /* 0x2E */ - "text/vnd.wap.sl", /* 0x2F */ - "application/vnd.wap.slc", /* 0x30 */ - "text/vnd.wap.co", /* 0x31 */ - "application/vnd.wap.coc", /* 0x32 */ - "application/vnd.wap.multipart.related", /* 0x33 */ - "application/vnd.wap.sia", /* 0x34 */ - "text/vnd.wap.connectivity-xml", /* 0x35 */ - "application/vnd.wap.connectivity-wbxml", /* 0x36 */ - "application/pkcs7-mime", /* 0x37 */ - "application/vnd.wap.hashed-certificate", /* 0x38 */ - "application/vnd.wap.signed-certificate", /* 0x39 */ - "application/vnd.wap.cert-response", /* 0x3A */ - "application/xhtml+xml", /* 0x3B */ - "application/wml+xml", /* 0x3C */ - "text/css", /* 0x3D */ - "application/vnd.wap.mms-message", /* 0x3E */ - "application/vnd.wap.rollover-certificate", /* 0x3F */ - "application/vnd.wap.locc+wbxml", /* 0x40 */ - "application/vnd.wap.loc+xml", /* 0x41 */ - "application/vnd.syncml.dm+wbxml", /* 0x42 */ - "application/vnd.syncml.dm+xml", /* 0x43 */ - "application/vnd.syncml.notification", /* 0x44 */ - "application/vnd.wap.xhtml+xml", /* 0x45 */ - "application/vnd.wv.csp.cir", /* 0x46 */ - "application/vnd.oma.dd+xml", /* 0x47 */ - "application/vnd.oma.drm.message", /* 0x48 */ - "application/vnd.oma.drm.content", /* 0x49 */ - "application/vnd.oma.drm.rights+xml", /* 0x4A */ - "application/vnd.oma.drm.rights+wbxml", /* 0x4B */ - "application/vnd.wv.csp+xml", /* 0x4C */ - "application/vnd.wv.csp+wbxml", /* 0x4D */ - "application/vnd.syncml.ds.notification", /* 0x4E */ - "audio/*", /* 0x4F */ - "video/*", /* 0x50 */ - "application/vnd.oma.dd2+xml", /* 0x51 */ - "application/mikey" /* 0x52 */ - }; -} diff --git a/core/java/com/google/android/mms/pdu/PduHeaders.java b/core/java/com/google/android/mms/pdu/PduHeaders.java deleted file mode 100644 index 43138150f8045..0000000000000 --- a/core/java/com/google/android/mms/pdu/PduHeaders.java +++ /dev/null @@ -1,721 +0,0 @@ -/* - * Copyright (C) 2007 Esmertec AG. - * 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. - */ - -package com.google.android.mms.pdu; - -import com.google.android.mms.InvalidHeaderValueException; - -import java.util.ArrayList; -import java.util.HashMap; - -public class PduHeaders { - /** - * All pdu header fields. - */ - public static final int BCC = 0x81; - public static final int CC = 0x82; - public static final int CONTENT_LOCATION = 0x83; - public static final int CONTENT_TYPE = 0x84; - public static final int DATE = 0x85; - public static final int DELIVERY_REPORT = 0x86; - public static final int DELIVERY_TIME = 0x87; - public static final int EXPIRY = 0x88; - public static final int FROM = 0x89; - public static final int MESSAGE_CLASS = 0x8A; - public static final int MESSAGE_ID = 0x8B; - public static final int MESSAGE_TYPE = 0x8C; - public static final int MMS_VERSION = 0x8D; - public static final int MESSAGE_SIZE = 0x8E; - public static final int PRIORITY = 0x8F; - - public static final int READ_REPLY = 0x90; - public static final int READ_REPORT = 0x90; - public static final int REPORT_ALLOWED = 0x91; - public static final int RESPONSE_STATUS = 0x92; - public static final int RESPONSE_TEXT = 0x93; - public static final int SENDER_VISIBILITY = 0x94; - public static final int STATUS = 0x95; - public static final int SUBJECT = 0x96; - public static final int TO = 0x97; - public static final int TRANSACTION_ID = 0x98; - public static final int RETRIEVE_STATUS = 0x99; - public static final int RETRIEVE_TEXT = 0x9A; - public static final int READ_STATUS = 0x9B; - public static final int REPLY_CHARGING = 0x9C; - public static final int REPLY_CHARGING_DEADLINE = 0x9D; - public static final int REPLY_CHARGING_ID = 0x9E; - public static final int REPLY_CHARGING_SIZE = 0x9F; - - public static final int PREVIOUSLY_SENT_BY = 0xA0; - public static final int PREVIOUSLY_SENT_DATE = 0xA1; - public static final int STORE = 0xA2; - public static final int MM_STATE = 0xA3; - public static final int MM_FLAGS = 0xA4; - public static final int STORE_STATUS = 0xA5; - public static final int STORE_STATUS_TEXT = 0xA6; - public static final int STORED = 0xA7; - public static final int ATTRIBUTES = 0xA8; - public static final int TOTALS = 0xA9; - public static final int MBOX_TOTALS = 0xAA; - public static final int QUOTAS = 0xAB; - public static final int MBOX_QUOTAS = 0xAC; - public static final int MESSAGE_COUNT = 0xAD; - public static final int CONTENT = 0xAE; - public static final int START = 0xAF; - - public static final int ADDITIONAL_HEADERS = 0xB0; - public static final int DISTRIBUTION_INDICATOR = 0xB1; - public static final int ELEMENT_DESCRIPTOR = 0xB2; - public static final int LIMIT = 0xB3; - public static final int RECOMMENDED_RETRIEVAL_MODE = 0xB4; - public static final int RECOMMENDED_RETRIEVAL_MODE_TEXT = 0xB5; - public static final int STATUS_TEXT = 0xB6; - public static final int APPLIC_ID = 0xB7; - public static final int REPLY_APPLIC_ID = 0xB8; - public static final int AUX_APPLIC_ID = 0xB9; - public static final int CONTENT_CLASS = 0xBA; - public static final int DRM_CONTENT = 0xBB; - public static final int ADAPTATION_ALLOWED = 0xBC; - public static final int REPLACE_ID = 0xBD; - public static final int CANCEL_ID = 0xBE; - public static final int CANCEL_STATUS = 0xBF; - - /** - * X-Mms-Message-Type field types. - */ - public static final int MESSAGE_TYPE_SEND_REQ = 0x80; - public static final int MESSAGE_TYPE_SEND_CONF = 0x81; - public static final int MESSAGE_TYPE_NOTIFICATION_IND = 0x82; - public static final int MESSAGE_TYPE_NOTIFYRESP_IND = 0x83; - public static final int MESSAGE_TYPE_RETRIEVE_CONF = 0x84; - public static final int MESSAGE_TYPE_ACKNOWLEDGE_IND = 0x85; - public static final int MESSAGE_TYPE_DELIVERY_IND = 0x86; - public static final int MESSAGE_TYPE_READ_REC_IND = 0x87; - public static final int MESSAGE_TYPE_READ_ORIG_IND = 0x88; - public static final int MESSAGE_TYPE_FORWARD_REQ = 0x89; - public static final int MESSAGE_TYPE_FORWARD_CONF = 0x8A; - public static final int MESSAGE_TYPE_MBOX_STORE_REQ = 0x8B; - public static final int MESSAGE_TYPE_MBOX_STORE_CONF = 0x8C; - public static final int MESSAGE_TYPE_MBOX_VIEW_REQ = 0x8D; - public static final int MESSAGE_TYPE_MBOX_VIEW_CONF = 0x8E; - public static final int MESSAGE_TYPE_MBOX_UPLOAD_REQ = 0x8F; - public static final int MESSAGE_TYPE_MBOX_UPLOAD_CONF = 0x90; - public static final int MESSAGE_TYPE_MBOX_DELETE_REQ = 0x91; - public static final int MESSAGE_TYPE_MBOX_DELETE_CONF = 0x92; - public static final int MESSAGE_TYPE_MBOX_DESCR = 0x93; - public static final int MESSAGE_TYPE_DELETE_REQ = 0x94; - public static final int MESSAGE_TYPE_DELETE_CONF = 0x95; - public static final int MESSAGE_TYPE_CANCEL_REQ = 0x96; - public static final int MESSAGE_TYPE_CANCEL_CONF = 0x97; - - /** - * X-Mms-Delivery-Report | - * X-Mms-Read-Report | - * X-Mms-Report-Allowed | - * X-Mms-Sender-Visibility | - * X-Mms-Store | - * X-Mms-Stored | - * X-Mms-Totals | - * X-Mms-Quotas | - * X-Mms-Distribution-Indicator | - * X-Mms-DRM-Content | - * X-Mms-Adaptation-Allowed | - * field types. - */ - public static final int VALUE_YES = 0x80; - public static final int VALUE_NO = 0x81; - - /** - * Delivery-Time | - * Expiry and Reply-Charging-Deadline | - * field type components. - */ - public static final int VALUE_ABSOLUTE_TOKEN = 0x80; - public static final int VALUE_RELATIVE_TOKEN = 0x81; - - /** - * X-Mms-MMS-Version field types. - */ - public static final int MMS_VERSION_1_3 = ((1 << 4) | 3); - public static final int MMS_VERSION_1_2 = ((1 << 4) | 2); - public static final int MMS_VERSION_1_1 = ((1 << 4) | 1); - public static final int MMS_VERSION_1_0 = ((1 << 4) | 0); - - // Current version is 1.2. - public static final int CURRENT_MMS_VERSION = MMS_VERSION_1_2; - - /** - * From field type components. - */ - public static final int FROM_ADDRESS_PRESENT_TOKEN = 0x80; - public static final int FROM_INSERT_ADDRESS_TOKEN = 0x81; - - public static final String FROM_ADDRESS_PRESENT_TOKEN_STR = "address-present-token"; - public static final String FROM_INSERT_ADDRESS_TOKEN_STR = "insert-address-token"; - - /** - * X-Mms-Status Field. - */ - public static final int STATUS_EXPIRED = 0x80; - public static final int STATUS_RETRIEVED = 0x81; - public static final int STATUS_REJECTED = 0x82; - public static final int STATUS_DEFERRED = 0x83; - public static final int STATUS_UNRECOGNIZED = 0x84; - public static final int STATUS_INDETERMINATE = 0x85; - public static final int STATUS_FORWARDED = 0x86; - public static final int STATUS_UNREACHABLE = 0x87; - - /** - * MM-Flags field type components. - */ - public static final int MM_FLAGS_ADD_TOKEN = 0x80; - public static final int MM_FLAGS_REMOVE_TOKEN = 0x81; - public static final int MM_FLAGS_FILTER_TOKEN = 0x82; - - /** - * X-Mms-Message-Class field types. - */ - public static final int MESSAGE_CLASS_PERSONAL = 0x80; - public static final int MESSAGE_CLASS_ADVERTISEMENT = 0x81; - public static final int MESSAGE_CLASS_INFORMATIONAL = 0x82; - public static final int MESSAGE_CLASS_AUTO = 0x83; - - public static final String MESSAGE_CLASS_PERSONAL_STR = "personal"; - public static final String MESSAGE_CLASS_ADVERTISEMENT_STR = "advertisement"; - public static final String MESSAGE_CLASS_INFORMATIONAL_STR = "informational"; - public static final String MESSAGE_CLASS_AUTO_STR = "auto"; - - /** - * X-Mms-Priority field types. - */ - public static final int PRIORITY_LOW = 0x80; - public static final int PRIORITY_NORMAL = 0x81; - public static final int PRIORITY_HIGH = 0x82; - - /** - * X-Mms-Response-Status field types. - */ - public static final int RESPONSE_STATUS_OK = 0x80; - public static final int RESPONSE_STATUS_ERROR_UNSPECIFIED = 0x81; - public static final int RESPONSE_STATUS_ERROR_SERVICE_DENIED = 0x82; - - public static final int RESPONSE_STATUS_ERROR_MESSAGE_FORMAT_CORRUPT = 0x83; - public static final int RESPONSE_STATUS_ERROR_SENDING_ADDRESS_UNRESOLVED = 0x84; - - public static final int RESPONSE_STATUS_ERROR_MESSAGE_NOT_FOUND = 0x85; - public static final int RESPONSE_STATUS_ERROR_NETWORK_PROBLEM = 0x86; - public static final int RESPONSE_STATUS_ERROR_CONTENT_NOT_ACCEPTED = 0x87; - public static final int RESPONSE_STATUS_ERROR_UNSUPPORTED_MESSAGE = 0x88; - public static final int RESPONSE_STATUS_ERROR_TRANSIENT_FAILURE = 0xC0; - - public static final int RESPONSE_STATUS_ERROR_TRANSIENT_SENDNG_ADDRESS_UNRESOLVED = 0xC1; - public static final int RESPONSE_STATUS_ERROR_TRANSIENT_MESSAGE_NOT_FOUND = 0xC2; - public static final int RESPONSE_STATUS_ERROR_TRANSIENT_NETWORK_PROBLEM = 0xC3; - public static final int RESPONSE_STATUS_ERROR_TRANSIENT_PARTIAL_SUCCESS = 0xC4; - - public static final int RESPONSE_STATUS_ERROR_PERMANENT_FAILURE = 0xE0; - public static final int RESPONSE_STATUS_ERROR_PERMANENT_SERVICE_DENIED = 0xE1; - public static final int RESPONSE_STATUS_ERROR_PERMANENT_MESSAGE_FORMAT_CORRUPT = 0xE2; - public static final int RESPONSE_STATUS_ERROR_PERMANENT_SENDING_ADDRESS_UNRESOLVED = 0xE3; - public static final int RESPONSE_STATUS_ERROR_PERMANENT_MESSAGE_NOT_FOUND = 0xE4; - public static final int RESPONSE_STATUS_ERROR_PERMANENT_CONTENT_NOT_ACCEPTED = 0xE5; - public static final int RESPONSE_STATUS_ERROR_PERMANENT_REPLY_CHARGING_LIMITATIONS_NOT_MET = 0xE6; - public static final int RESPONSE_STATUS_ERROR_PERMANENT_REPLY_CHARGING_REQUEST_NOT_ACCEPTED = 0xE6; - public static final int RESPONSE_STATUS_ERROR_PERMANENT_REPLY_CHARGING_FORWARDING_DENIED = 0xE8; - public static final int RESPONSE_STATUS_ERROR_PERMANENT_REPLY_CHARGING_NOT_SUPPORTED = 0xE9; - public static final int RESPONSE_STATUS_ERROR_PERMANENT_ADDRESS_HIDING_NOT_SUPPORTED = 0xEA; - public static final int RESPONSE_STATUS_ERROR_PERMANENT_LACK_OF_PREPAID = 0xEB; - public static final int RESPONSE_STATUS_ERROR_PERMANENT_END = 0xFF; - - /** - * X-Mms-Retrieve-Status field types. - */ - public static final int RETRIEVE_STATUS_OK = 0x80; - public static final int RETRIEVE_STATUS_ERROR_TRANSIENT_FAILURE = 0xC0; - public static final int RETRIEVE_STATUS_ERROR_TRANSIENT_MESSAGE_NOT_FOUND = 0xC1; - public static final int RETRIEVE_STATUS_ERROR_TRANSIENT_NETWORK_PROBLEM = 0xC2; - public static final int RETRIEVE_STATUS_ERROR_PERMANENT_FAILURE = 0xE0; - public static final int RETRIEVE_STATUS_ERROR_PERMANENT_SERVICE_DENIED = 0xE1; - public static final int RETRIEVE_STATUS_ERROR_PERMANENT_MESSAGE_NOT_FOUND = 0xE2; - public static final int RETRIEVE_STATUS_ERROR_PERMANENT_CONTENT_UNSUPPORTED = 0xE3; - public static final int RETRIEVE_STATUS_ERROR_END = 0xFF; - - /** - * X-Mms-Sender-Visibility field types. - */ - public static final int SENDER_VISIBILITY_HIDE = 0x80; - public static final int SENDER_VISIBILITY_SHOW = 0x81; - - /** - * X-Mms-Read-Status field types. - */ - public static final int READ_STATUS_READ = 0x80; - public static final int READ_STATUS__DELETED_WITHOUT_BEING_READ = 0x81; - - /** - * X-Mms-Cancel-Status field types. - */ - public static final int CANCEL_STATUS_REQUEST_SUCCESSFULLY_RECEIVED = 0x80; - public static final int CANCEL_STATUS_REQUEST_CORRUPTED = 0x81; - - /** - * X-Mms-Reply-Charging field types. - */ - public static final int REPLY_CHARGING_REQUESTED = 0x80; - public static final int REPLY_CHARGING_REQUESTED_TEXT_ONLY = 0x81; - public static final int REPLY_CHARGING_ACCEPTED = 0x82; - public static final int REPLY_CHARGING_ACCEPTED_TEXT_ONLY = 0x83; - - /** - * X-Mms-MM-State field types. - */ - public static final int MM_STATE_DRAFT = 0x80; - public static final int MM_STATE_SENT = 0x81; - public static final int MM_STATE_NEW = 0x82; - public static final int MM_STATE_RETRIEVED = 0x83; - public static final int MM_STATE_FORWARDED = 0x84; - - /** - * X-Mms-Recommended-Retrieval-Mode field types. - */ - public static final int RECOMMENDED_RETRIEVAL_MODE_MANUAL = 0x80; - - /** - * X-Mms-Content-Class field types. - */ - public static final int CONTENT_CLASS_TEXT = 0x80; - public static final int CONTENT_CLASS_IMAGE_BASIC = 0x81; - public static final int CONTENT_CLASS_IMAGE_RICH = 0x82; - public static final int CONTENT_CLASS_VIDEO_BASIC = 0x83; - public static final int CONTENT_CLASS_VIDEO_RICH = 0x84; - public static final int CONTENT_CLASS_MEGAPIXEL = 0x85; - public static final int CONTENT_CLASS_CONTENT_BASIC = 0x86; - public static final int CONTENT_CLASS_CONTENT_RICH = 0x87; - - /** - * X-Mms-Store-Status field types. - */ - public static final int STORE_STATUS_SUCCESS = 0x80; - public static final int STORE_STATUS_ERROR_TRANSIENT_FAILURE = 0xC0; - public static final int STORE_STATUS_ERROR_TRANSIENT_NETWORK_PROBLEM = 0xC1; - public static final int STORE_STATUS_ERROR_PERMANENT_FAILURE = 0xE0; - public static final int STORE_STATUS_ERROR_PERMANENT_SERVICE_DENIED = 0xE1; - public static final int STORE_STATUS_ERROR_PERMANENT_MESSAGE_FORMAT_CORRUPT = 0xE2; - public static final int STORE_STATUS_ERROR_PERMANENT_MESSAGE_NOT_FOUND = 0xE3; - public static final int STORE_STATUS_ERROR_PERMANENT_MMBOX_FULL = 0xE4; - public static final int STORE_STATUS_ERROR_END = 0xFF; - - /** - * The map contains the value of all headers. - */ - private HashMap mHeaderMap = null; - - /** - * Constructor of PduHeaders. - */ - public PduHeaders() { - mHeaderMap = new HashMap(); - } - - /** - * Get octet value by header field. - * - * @param field the field - * @return the octet value of the pdu header - * with specified header field. Return 0 if - * the value is not set. - */ - protected int getOctet(int field) { - Integer octet = (Integer) mHeaderMap.get(field); - if (null == octet) { - return 0; - } - - return octet; - } - - /** - * Set octet value to pdu header by header field. - * - * @param value the value - * @param field the field - * @throws InvalidHeaderValueException if the value is invalid. - */ - protected void setOctet(int value, int field) - throws InvalidHeaderValueException{ - /** - * Check whether this field can be set for specific - * header and check validity of the field. - */ - switch (field) { - case REPORT_ALLOWED: - case ADAPTATION_ALLOWED: - case DELIVERY_REPORT: - case DRM_CONTENT: - case DISTRIBUTION_INDICATOR: - case QUOTAS: - case READ_REPORT: - case STORE: - case STORED: - case TOTALS: - case SENDER_VISIBILITY: - if ((VALUE_YES != value) && (VALUE_NO != value)) { - // Invalid value. - throw new InvalidHeaderValueException("Invalid Octet value!"); - } - break; - case READ_STATUS: - if ((READ_STATUS_READ != value) && - (READ_STATUS__DELETED_WITHOUT_BEING_READ != value)) { - // Invalid value. - throw new InvalidHeaderValueException("Invalid Octet value!"); - } - break; - case CANCEL_STATUS: - if ((CANCEL_STATUS_REQUEST_SUCCESSFULLY_RECEIVED != value) && - (CANCEL_STATUS_REQUEST_CORRUPTED != value)) { - // Invalid value. - throw new InvalidHeaderValueException("Invalid Octet value!"); - } - break; - case PRIORITY: - if ((value < PRIORITY_LOW) || (value > PRIORITY_HIGH)) { - // Invalid value. - throw new InvalidHeaderValueException("Invalid Octet value!"); - } - break; - case STATUS: - if ((value < STATUS_EXPIRED) || (value > STATUS_UNREACHABLE)) { - // Invalid value. - throw new InvalidHeaderValueException("Invalid Octet value!"); - } - break; - case REPLY_CHARGING: - if ((value < REPLY_CHARGING_REQUESTED) - || (value > REPLY_CHARGING_ACCEPTED_TEXT_ONLY)) { - // Invalid value. - throw new InvalidHeaderValueException("Invalid Octet value!"); - } - break; - case MM_STATE: - if ((value < MM_STATE_DRAFT) || (value > MM_STATE_FORWARDED)) { - // Invalid value. - throw new InvalidHeaderValueException("Invalid Octet value!"); - } - break; - case RECOMMENDED_RETRIEVAL_MODE: - if (RECOMMENDED_RETRIEVAL_MODE_MANUAL != value) { - // Invalid value. - throw new InvalidHeaderValueException("Invalid Octet value!"); - } - break; - case CONTENT_CLASS: - if ((value < CONTENT_CLASS_TEXT) - || (value > CONTENT_CLASS_CONTENT_RICH)) { - // Invalid value. - throw new InvalidHeaderValueException("Invalid Octet value!"); - } - break; - case RETRIEVE_STATUS: - // According to oma-ts-mms-enc-v1_3, section 7.3.50, we modify the invalid value. - if ((value > RETRIEVE_STATUS_ERROR_TRANSIENT_NETWORK_PROBLEM) && - (value < RETRIEVE_STATUS_ERROR_PERMANENT_FAILURE)) { - value = RETRIEVE_STATUS_ERROR_TRANSIENT_FAILURE; - } else if ((value > RETRIEVE_STATUS_ERROR_PERMANENT_CONTENT_UNSUPPORTED) && - (value <= RETRIEVE_STATUS_ERROR_END)) { - value = RETRIEVE_STATUS_ERROR_PERMANENT_FAILURE; - } else if ((value < RETRIEVE_STATUS_OK) || - ((value > RETRIEVE_STATUS_OK) && - (value < RETRIEVE_STATUS_ERROR_TRANSIENT_FAILURE)) || - (value > RETRIEVE_STATUS_ERROR_END)) { - value = RETRIEVE_STATUS_ERROR_PERMANENT_FAILURE; - } - break; - case STORE_STATUS: - // According to oma-ts-mms-enc-v1_3, section 7.3.58, we modify the invalid value. - if ((value > STORE_STATUS_ERROR_TRANSIENT_NETWORK_PROBLEM) && - (value < STORE_STATUS_ERROR_PERMANENT_FAILURE)) { - value = STORE_STATUS_ERROR_TRANSIENT_FAILURE; - } else if ((value > STORE_STATUS_ERROR_PERMANENT_MMBOX_FULL) && - (value <= STORE_STATUS_ERROR_END)) { - value = STORE_STATUS_ERROR_PERMANENT_FAILURE; - } else if ((value < STORE_STATUS_SUCCESS) || - ((value > STORE_STATUS_SUCCESS) && - (value < STORE_STATUS_ERROR_TRANSIENT_FAILURE)) || - (value > STORE_STATUS_ERROR_END)) { - value = STORE_STATUS_ERROR_PERMANENT_FAILURE; - } - break; - case RESPONSE_STATUS: - // According to oma-ts-mms-enc-v1_3, section 7.3.48, we modify the invalid value. - if ((value > RESPONSE_STATUS_ERROR_TRANSIENT_PARTIAL_SUCCESS) && - (value < RESPONSE_STATUS_ERROR_PERMANENT_FAILURE)) { - value = RESPONSE_STATUS_ERROR_TRANSIENT_FAILURE; - } else if (((value > RESPONSE_STATUS_ERROR_PERMANENT_LACK_OF_PREPAID) && - (value <= RESPONSE_STATUS_ERROR_PERMANENT_END)) || - (value < RESPONSE_STATUS_OK) || - ((value > RESPONSE_STATUS_ERROR_UNSUPPORTED_MESSAGE) && - (value < RESPONSE_STATUS_ERROR_TRANSIENT_FAILURE)) || - (value > RESPONSE_STATUS_ERROR_PERMANENT_END)) { - value = RESPONSE_STATUS_ERROR_PERMANENT_FAILURE; - } - break; - case MMS_VERSION: - if ((value < MMS_VERSION_1_0)|| (value > MMS_VERSION_1_3)) { - value = CURRENT_MMS_VERSION; // Current version is the default value. - } - break; - case MESSAGE_TYPE: - if ((value < MESSAGE_TYPE_SEND_REQ) || (value > MESSAGE_TYPE_CANCEL_CONF)) { - // Invalid value. - throw new InvalidHeaderValueException("Invalid Octet value!"); - } - break; - default: - // This header value should not be Octect. - throw new RuntimeException("Invalid header field!"); - } - mHeaderMap.put(field, value); - } - - /** - * Get TextString value by header field. - * - * @param field the field - * @return the TextString value of the pdu header - * with specified header field - */ - protected byte[] getTextString(int field) { - return (byte[]) mHeaderMap.get(field); - } - - /** - * Set TextString value to pdu header by header field. - * - * @param value the value - * @param field the field - * @return the TextString value of the pdu header - * with specified header field - * @throws NullPointerException if the value is null. - */ - protected void setTextString(byte[] value, int field) { - /** - * Check whether this field can be set for specific - * header and check validity of the field. - */ - if (null == value) { - throw new NullPointerException(); - } - - switch (field) { - case TRANSACTION_ID: - case REPLY_CHARGING_ID: - case AUX_APPLIC_ID: - case APPLIC_ID: - case REPLY_APPLIC_ID: - case MESSAGE_ID: - case REPLACE_ID: - case CANCEL_ID: - case CONTENT_LOCATION: - case MESSAGE_CLASS: - case CONTENT_TYPE: - break; - default: - // This header value should not be Text-String. - throw new RuntimeException("Invalid header field!"); - } - mHeaderMap.put(field, value); - } - - /** - * Get EncodedStringValue value by header field. - * - * @param field the field - * @return the EncodedStringValue value of the pdu header - * with specified header field - */ - protected EncodedStringValue getEncodedStringValue(int field) { - return (EncodedStringValue) mHeaderMap.get(field); - } - - /** - * Get TO, CC or BCC header value. - * - * @param field the field - * @return the EncodeStringValue array of the pdu header - * with specified header field - */ - protected EncodedStringValue[] getEncodedStringValues(int field) { - ArrayList list = - (ArrayList) mHeaderMap.get(field); - if (null == list) { - return null; - } - EncodedStringValue[] values = new EncodedStringValue[list.size()]; - return list.toArray(values); - } - - /** - * Set EncodedStringValue value to pdu header by header field. - * - * @param value the value - * @param field the field - * @return the EncodedStringValue value of the pdu header - * with specified header field - * @throws NullPointerException if the value is null. - */ - protected void setEncodedStringValue(EncodedStringValue value, int field) { - /** - * Check whether this field can be set for specific - * header and check validity of the field. - */ - if (null == value) { - throw new NullPointerException(); - } - - switch (field) { - case SUBJECT: - case RECOMMENDED_RETRIEVAL_MODE_TEXT: - case RETRIEVE_TEXT: - case STATUS_TEXT: - case STORE_STATUS_TEXT: - case RESPONSE_TEXT: - case FROM: - case PREVIOUSLY_SENT_BY: - case MM_FLAGS: - break; - default: - // This header value should not be Encoded-String-Value. - throw new RuntimeException("Invalid header field!"); - } - - mHeaderMap.put(field, value); - } - - /** - * Set TO, CC or BCC header value. - * - * @param value the value - * @param field the field - * @return the EncodedStringValue value array of the pdu header - * with specified header field - * @throws NullPointerException if the value is null. - */ - protected void setEncodedStringValues(EncodedStringValue[] value, int field) { - /** - * Check whether this field can be set for specific - * header and check validity of the field. - */ - if (null == value) { - throw new NullPointerException(); - } - - switch (field) { - case BCC: - case CC: - case TO: - break; - default: - // This header value should not be Encoded-String-Value. - throw new RuntimeException("Invalid header field!"); - } - - ArrayList list = new ArrayList(); - for (int i = 0; i < value.length; i++) { - list.add(value[i]); - } - mHeaderMap.put(field, list); - } - - /** - * Append one EncodedStringValue to another. - * - * @param value the EncodedStringValue to append - * @param field the field - * @throws NullPointerException if the value is null. - */ - protected void appendEncodedStringValue(EncodedStringValue value, - int field) { - if (null == value) { - throw new NullPointerException(); - } - - switch (field) { - case BCC: - case CC: - case TO: - break; - default: - throw new RuntimeException("Invalid header field!"); - } - - ArrayList list = - (ArrayList) mHeaderMap.get(field); - if (null == list) { - list = new ArrayList(); - } - list.add(value); - mHeaderMap.put(field, list); - } - - /** - * Get LongInteger value by header field. - * - * @param field the field - * @return the LongInteger value of the pdu header - * with specified header field. if return -1, the - * field is not existed in pdu header. - */ - protected long getLongInteger(int field) { - Long longInteger = (Long) mHeaderMap.get(field); - if (null == longInteger) { - return -1; - } - - return longInteger.longValue(); - } - - /** - * Set LongInteger value to pdu header by header field. - * - * @param value the value - * @param field the field - */ - protected void setLongInteger(long value, int field) { - /** - * Check whether this field can be set for specific - * header and check validity of the field. - */ - switch (field) { - case DATE: - case REPLY_CHARGING_SIZE: - case MESSAGE_SIZE: - case MESSAGE_COUNT: - case START: - case LIMIT: - case DELIVERY_TIME: - case EXPIRY: - case REPLY_CHARGING_DEADLINE: - case PREVIOUSLY_SENT_DATE: - break; - default: - // This header value should not be LongInteger. - throw new RuntimeException("Invalid header field!"); - } - mHeaderMap.put(field, value); - } -} diff --git a/core/java/com/google/android/mms/pdu/PduParser.java b/core/java/com/google/android/mms/pdu/PduParser.java deleted file mode 100755 index 015d864a01ea5..0000000000000 --- a/core/java/com/google/android/mms/pdu/PduParser.java +++ /dev/null @@ -1,1912 +0,0 @@ -/* - * Copyright (C) 2007-2008 Esmertec AG. - * Copyright (C) 2007-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 com.google.android.mms.pdu; - -import com.google.android.mms.ContentType; -import com.google.android.mms.InvalidHeaderValueException; - -import android.util.Log; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.UnsupportedEncodingException; -import java.util.Arrays; -import java.util.HashMap; - -import android.content.res.Resources; - -public class PduParser { - /** - * The next are WAP values defined in WSP specification. - */ - private static final int QUOTE = 127; - private static final int LENGTH_QUOTE = 31; - private static final int TEXT_MIN = 32; - private static final int TEXT_MAX = 127; - private static final int SHORT_INTEGER_MAX = 127; - private static final int SHORT_LENGTH_MAX = 30; - private static final int LONG_INTEGER_LENGTH_MAX = 8; - private static final int QUOTED_STRING_FLAG = 34; - private static final int END_STRING_FLAG = 0x00; - //The next two are used by the interface "parseWapString" to - //distinguish Text-String and Quoted-String. - private static final int TYPE_TEXT_STRING = 0; - private static final int TYPE_QUOTED_STRING = 1; - private static final int TYPE_TOKEN_STRING = 2; - - /** - * Specify the part position. - */ - private static final int THE_FIRST_PART = 0; - private static final int THE_LAST_PART = 1; - - /** - * The pdu data. - */ - private ByteArrayInputStream mPduDataStream = null; - - /** - * Store pdu headers - */ - private PduHeaders mHeaders = null; - - /** - * Store pdu parts. - */ - private PduBody mBody = null; - - /** - * Store the "type" parameter in "Content-Type" header field. - */ - private static byte[] mTypeParam = null; - - /** - * Store the "start" parameter in "Content-Type" header field. - */ - private static byte[] mStartParam = null; - - /** - * The log tag. - */ - private static final String LOG_TAG = "PduParser"; - private static final boolean DEBUG = false; - private static final boolean LOCAL_LOGV = false; - - /** - * Constructor. - * - * @param pduDataStream pdu data to be parsed - */ - public PduParser(byte[] pduDataStream) { - mPduDataStream = new ByteArrayInputStream(pduDataStream); - } - - /** - * Parse the pdu. - * - * @return the pdu structure if parsing successfully. - * null if parsing error happened or mandatory fields are not set. - */ - public GenericPdu parse(){ - if (mPduDataStream == null) { - return null; - } - - /* parse headers */ - mHeaders = parseHeaders(mPduDataStream); - if (null == mHeaders) { - // Parse headers failed. - return null; - } - - /* get the message type */ - int messageType = mHeaders.getOctet(PduHeaders.MESSAGE_TYPE); - - /* check mandatory header fields */ - if (false == checkMandatoryHeader(mHeaders)) { - log("check mandatory headers failed!"); - return null; - } - - if ((PduHeaders.MESSAGE_TYPE_SEND_REQ == messageType) || - (PduHeaders.MESSAGE_TYPE_RETRIEVE_CONF == messageType)) { - /* need to parse the parts */ - mBody = parseParts(mPduDataStream); - if (null == mBody) { - // Parse parts failed. - return null; - } - } - - switch (messageType) { - case PduHeaders.MESSAGE_TYPE_SEND_REQ: - SendReq sendReq = new SendReq(mHeaders, mBody); - return sendReq; - case PduHeaders.MESSAGE_TYPE_SEND_CONF: - SendConf sendConf = new SendConf(mHeaders); - return sendConf; - case PduHeaders.MESSAGE_TYPE_NOTIFICATION_IND: - NotificationInd notificationInd = - new NotificationInd(mHeaders); - return notificationInd; - case PduHeaders.MESSAGE_TYPE_NOTIFYRESP_IND: - NotifyRespInd notifyRespInd = - new NotifyRespInd(mHeaders); - return notifyRespInd; - case PduHeaders.MESSAGE_TYPE_RETRIEVE_CONF: - RetrieveConf retrieveConf = - new RetrieveConf(mHeaders, mBody); - - byte[] contentType = retrieveConf.getContentType(); - if (null == contentType) { - return null; - } - String ctTypeStr = new String(contentType); - if (ctTypeStr.equals(ContentType.MULTIPART_MIXED) - || ctTypeStr.equals(ContentType.MULTIPART_RELATED) - || ctTypeStr.equals(ContentType.MULTIPART_ALTERNATIVE)) { - // The MMS content type must be "application/vnd.wap.multipart.mixed" - // or "application/vnd.wap.multipart.related" - // or "application/vnd.wap.multipart.alternative" - return retrieveConf; - } else if (ctTypeStr.equals(ContentType.MULTIPART_ALTERNATIVE)) { - // "application/vnd.wap.multipart.alternative" - // should take only the first part. - PduPart firstPart = mBody.getPart(0); - mBody.removeAll(); - mBody.addPart(0, firstPart); - return retrieveConf; - } - return null; - case PduHeaders.MESSAGE_TYPE_DELIVERY_IND: - DeliveryInd deliveryInd = - new DeliveryInd(mHeaders); - return deliveryInd; - case PduHeaders.MESSAGE_TYPE_ACKNOWLEDGE_IND: - AcknowledgeInd acknowledgeInd = - new AcknowledgeInd(mHeaders); - return acknowledgeInd; - case PduHeaders.MESSAGE_TYPE_READ_ORIG_IND: - ReadOrigInd readOrigInd = - new ReadOrigInd(mHeaders); - return readOrigInd; - case PduHeaders.MESSAGE_TYPE_READ_REC_IND: - ReadRecInd readRecInd = - new ReadRecInd(mHeaders); - return readRecInd; - default: - log("Parser doesn't support this message type in this version!"); - return null; - } - } - - /** - * Parse pdu headers. - * - * @param pduDataStream pdu data input stream - * @return headers in PduHeaders structure, null when parse fail - */ - protected PduHeaders parseHeaders(ByteArrayInputStream pduDataStream){ - if (pduDataStream == null) { - return null; - } - - boolean keepParsing = true; - PduHeaders headers = new PduHeaders(); - - while (keepParsing && (pduDataStream.available() > 0)) { - pduDataStream.mark(1); - int headerField = extractByteValue(pduDataStream); - /* parse custom text header */ - if ((headerField >= TEXT_MIN) && (headerField <= TEXT_MAX)) { - pduDataStream.reset(); - byte [] bVal = parseWapString(pduDataStream, TYPE_TEXT_STRING); - if (LOCAL_LOGV) { - Log.v(LOG_TAG, "TextHeader: " + new String(bVal)); - } - /* we should ignore it at the moment */ - continue; - } - switch (headerField) { - case PduHeaders.MESSAGE_TYPE: - { - int messageType = extractByteValue(pduDataStream); - switch (messageType) { - // We don't support these kind of messages now. - case PduHeaders.MESSAGE_TYPE_FORWARD_REQ: - case PduHeaders.MESSAGE_TYPE_FORWARD_CONF: - case PduHeaders.MESSAGE_TYPE_MBOX_STORE_REQ: - case PduHeaders.MESSAGE_TYPE_MBOX_STORE_CONF: - case PduHeaders.MESSAGE_TYPE_MBOX_VIEW_REQ: - case PduHeaders.MESSAGE_TYPE_MBOX_VIEW_CONF: - case PduHeaders.MESSAGE_TYPE_MBOX_UPLOAD_REQ: - case PduHeaders.MESSAGE_TYPE_MBOX_UPLOAD_CONF: - case PduHeaders.MESSAGE_TYPE_MBOX_DELETE_REQ: - case PduHeaders.MESSAGE_TYPE_MBOX_DELETE_CONF: - case PduHeaders.MESSAGE_TYPE_MBOX_DESCR: - case PduHeaders.MESSAGE_TYPE_DELETE_REQ: - case PduHeaders.MESSAGE_TYPE_DELETE_CONF: - case PduHeaders.MESSAGE_TYPE_CANCEL_REQ: - case PduHeaders.MESSAGE_TYPE_CANCEL_CONF: - return null; - } - try { - headers.setOctet(messageType, headerField); - } catch(InvalidHeaderValueException e) { - log("Set invalid Octet value: " + messageType + - " into the header filed: " + headerField); - return null; - } catch(RuntimeException e) { - log(headerField + "is not Octet header field!"); - return null; - } - break; - } - /* Octect value */ - case PduHeaders.REPORT_ALLOWED: - case PduHeaders.ADAPTATION_ALLOWED: - case PduHeaders.DELIVERY_REPORT: - case PduHeaders.DRM_CONTENT: - case PduHeaders.DISTRIBUTION_INDICATOR: - case PduHeaders.QUOTAS: - case PduHeaders.READ_REPORT: - case PduHeaders.STORE: - case PduHeaders.STORED: - case PduHeaders.TOTALS: - case PduHeaders.SENDER_VISIBILITY: - case PduHeaders.READ_STATUS: - case PduHeaders.CANCEL_STATUS: - case PduHeaders.PRIORITY: - case PduHeaders.STATUS: - case PduHeaders.REPLY_CHARGING: - case PduHeaders.MM_STATE: - case PduHeaders.RECOMMENDED_RETRIEVAL_MODE: - case PduHeaders.CONTENT_CLASS: - case PduHeaders.RETRIEVE_STATUS: - case PduHeaders.STORE_STATUS: - /** - * The following field has a different value when - * used in the M-Mbox-Delete.conf and M-Delete.conf PDU. - * For now we ignore this fact, since we do not support these PDUs - */ - case PduHeaders.RESPONSE_STATUS: - { - int value = extractByteValue(pduDataStream); - - try { - headers.setOctet(value, headerField); - } catch(InvalidHeaderValueException e) { - log("Set invalid Octet value: " + value + - " into the header filed: " + headerField); - return null; - } catch(RuntimeException e) { - log(headerField + "is not Octet header field!"); - return null; - } - break; - } - - /* Long-Integer */ - case PduHeaders.DATE: - case PduHeaders.REPLY_CHARGING_SIZE: - case PduHeaders.MESSAGE_SIZE: - { - try { - long value = parseLongInteger(pduDataStream); - headers.setLongInteger(value, headerField); - } catch(RuntimeException e) { - log(headerField + "is not Long-Integer header field!"); - return null; - } - break; - } - - /* Integer-Value */ - case PduHeaders.MESSAGE_COUNT: - case PduHeaders.START: - case PduHeaders.LIMIT: - { - try { - long value = parseIntegerValue(pduDataStream); - headers.setLongInteger(value, headerField); - } catch(RuntimeException e) { - log(headerField + "is not Long-Integer header field!"); - return null; - } - break; - } - - /* Text-String */ - case PduHeaders.TRANSACTION_ID: - case PduHeaders.REPLY_CHARGING_ID: - case PduHeaders.AUX_APPLIC_ID: - case PduHeaders.APPLIC_ID: - case PduHeaders.REPLY_APPLIC_ID: - /** - * The next three header fields are email addresses - * as defined in RFC2822, - * not including the characters "<" and ">" - */ - case PduHeaders.MESSAGE_ID: - case PduHeaders.REPLACE_ID: - case PduHeaders.CANCEL_ID: - /** - * The following field has a different value when - * used in the M-Mbox-Delete.conf and M-Delete.conf PDU. - * For now we ignore this fact, since we do not support these PDUs - */ - case PduHeaders.CONTENT_LOCATION: - { - byte[] value = parseWapString(pduDataStream, TYPE_TEXT_STRING); - if (null != value) { - try { - headers.setTextString(value, headerField); - } catch(NullPointerException e) { - log("null pointer error!"); - } catch(RuntimeException e) { - log(headerField + "is not Text-String header field!"); - return null; - } - } - break; - } - - /* Encoded-string-value */ - case PduHeaders.SUBJECT: - case PduHeaders.RECOMMENDED_RETRIEVAL_MODE_TEXT: - case PduHeaders.RETRIEVE_TEXT: - case PduHeaders.STATUS_TEXT: - case PduHeaders.STORE_STATUS_TEXT: - /* the next one is not support - * M-Mbox-Delete.conf and M-Delete.conf now */ - case PduHeaders.RESPONSE_TEXT: - { - EncodedStringValue value = - parseEncodedStringValue(pduDataStream); - if (null != value) { - try { - headers.setEncodedStringValue(value, headerField); - } catch(NullPointerException e) { - log("null pointer error!"); - } catch (RuntimeException e) { - log(headerField + "is not Encoded-String-Value header field!"); - return null; - } - } - break; - } - - /* Addressing model */ - case PduHeaders.BCC: - case PduHeaders.CC: - case PduHeaders.TO: - { - EncodedStringValue value = - parseEncodedStringValue(pduDataStream); - if (null != value) { - byte[] address = value.getTextString(); - if (null != address) { - String str = new String(address); - int endIndex = str.indexOf("/"); - if (endIndex > 0) { - str = str.substring(0, endIndex); - } - try { - value.setTextString(str.getBytes()); - } catch(NullPointerException e) { - log("null pointer error!"); - return null; - } - } - - try { - headers.appendEncodedStringValue(value, headerField); - } catch(NullPointerException e) { - log("null pointer error!"); - } catch(RuntimeException e) { - log(headerField + "is not Encoded-String-Value header field!"); - return null; - } - } - break; - } - - /* Value-length - * (Absolute-token Date-value | Relative-token Delta-seconds-value) */ - case PduHeaders.DELIVERY_TIME: - case PduHeaders.EXPIRY: - case PduHeaders.REPLY_CHARGING_DEADLINE: - { - /* parse Value-length */ - parseValueLength(pduDataStream); - - /* Absolute-token or Relative-token */ - int token = extractByteValue(pduDataStream); - - /* Date-value or Delta-seconds-value */ - long timeValue; - try { - timeValue = parseLongInteger(pduDataStream); - } catch(RuntimeException e) { - log(headerField + "is not Long-Integer header field!"); - return null; - } - if (PduHeaders.VALUE_RELATIVE_TOKEN == token) { - /* need to convert the Delta-seconds-value - * into Date-value */ - timeValue = System.currentTimeMillis()/1000 + timeValue; - } - - try { - headers.setLongInteger(timeValue, headerField); - } catch(RuntimeException e) { - log(headerField + "is not Long-Integer header field!"); - return null; - } - break; - } - - case PduHeaders.FROM: { - /* From-value = - * Value-length - * (Address-present-token Encoded-string-value | Insert-address-token) - */ - EncodedStringValue from = null; - parseValueLength(pduDataStream); /* parse value-length */ - - /* Address-present-token or Insert-address-token */ - int fromToken = extractByteValue(pduDataStream); - - /* Address-present-token or Insert-address-token */ - if (PduHeaders.FROM_ADDRESS_PRESENT_TOKEN == fromToken) { - /* Encoded-string-value */ - from = parseEncodedStringValue(pduDataStream); - if (null != from) { - byte[] address = from.getTextString(); - if (null != address) { - String str = new String(address); - int endIndex = str.indexOf("/"); - if (endIndex > 0) { - str = str.substring(0, endIndex); - } - try { - from.setTextString(str.getBytes()); - } catch(NullPointerException e) { - log("null pointer error!"); - return null; - } - } - } - } else { - try { - from = new EncodedStringValue( - PduHeaders.FROM_INSERT_ADDRESS_TOKEN_STR.getBytes()); - } catch(NullPointerException e) { - log(headerField + "is not Encoded-String-Value header field!"); - return null; - } - } - - try { - headers.setEncodedStringValue(from, PduHeaders.FROM); - } catch(NullPointerException e) { - log("null pointer error!"); - } catch(RuntimeException e) { - log(headerField + "is not Encoded-String-Value header field!"); - return null; - } - break; - } - - case PduHeaders.MESSAGE_CLASS: { - /* Message-class-value = Class-identifier | Token-text */ - pduDataStream.mark(1); - int messageClass = extractByteValue(pduDataStream); - - if (messageClass >= PduHeaders.MESSAGE_CLASS_PERSONAL) { - /* Class-identifier */ - try { - if (PduHeaders.MESSAGE_CLASS_PERSONAL == messageClass) { - headers.setTextString( - PduHeaders.MESSAGE_CLASS_PERSONAL_STR.getBytes(), - PduHeaders.MESSAGE_CLASS); - } else if (PduHeaders.MESSAGE_CLASS_ADVERTISEMENT == messageClass) { - headers.setTextString( - PduHeaders.MESSAGE_CLASS_ADVERTISEMENT_STR.getBytes(), - PduHeaders.MESSAGE_CLASS); - } else if (PduHeaders.MESSAGE_CLASS_INFORMATIONAL == messageClass) { - headers.setTextString( - PduHeaders.MESSAGE_CLASS_INFORMATIONAL_STR.getBytes(), - PduHeaders.MESSAGE_CLASS); - } else if (PduHeaders.MESSAGE_CLASS_AUTO == messageClass) { - headers.setTextString( - PduHeaders.MESSAGE_CLASS_AUTO_STR.getBytes(), - PduHeaders.MESSAGE_CLASS); - } - } catch(NullPointerException e) { - log("null pointer error!"); - } catch(RuntimeException e) { - log(headerField + "is not Text-String header field!"); - return null; - } - } else { - /* Token-text */ - pduDataStream.reset(); - byte[] messageClassString = parseWapString(pduDataStream, TYPE_TEXT_STRING); - if (null != messageClassString) { - try { - headers.setTextString(messageClassString, PduHeaders.MESSAGE_CLASS); - } catch(NullPointerException e) { - log("null pointer error!"); - } catch(RuntimeException e) { - log(headerField + "is not Text-String header field!"); - return null; - } - } - } - break; - } - - case PduHeaders.MMS_VERSION: { - int version = parseShortInteger(pduDataStream); - - try { - headers.setOctet(version, PduHeaders.MMS_VERSION); - } catch(InvalidHeaderValueException e) { - log("Set invalid Octet value: " + version + - " into the header filed: " + headerField); - return null; - } catch(RuntimeException e) { - log(headerField + "is not Octet header field!"); - return null; - } - break; - } - - case PduHeaders.PREVIOUSLY_SENT_BY: { - /* Previously-sent-by-value = - * Value-length Forwarded-count-value Encoded-string-value */ - /* parse value-length */ - parseValueLength(pduDataStream); - - /* parse Forwarded-count-value */ - try { - parseIntegerValue(pduDataStream); - } catch(RuntimeException e) { - log(headerField + " is not Integer-Value"); - return null; - } - - /* parse Encoded-string-value */ - EncodedStringValue previouslySentBy = - parseEncodedStringValue(pduDataStream); - if (null != previouslySentBy) { - try { - headers.setEncodedStringValue(previouslySentBy, - PduHeaders.PREVIOUSLY_SENT_BY); - } catch(NullPointerException e) { - log("null pointer error!"); - } catch(RuntimeException e) { - log(headerField + "is not Encoded-String-Value header field!"); - return null; - } - } - break; - } - - case PduHeaders.PREVIOUSLY_SENT_DATE: { - /* Previously-sent-date-value = - * Value-length Forwarded-count-value Date-value */ - /* parse value-length */ - parseValueLength(pduDataStream); - - /* parse Forwarded-count-value */ - try { - parseIntegerValue(pduDataStream); - } catch(RuntimeException e) { - log(headerField + " is not Integer-Value"); - return null; - } - - /* Date-value */ - try { - long perviouslySentDate = parseLongInteger(pduDataStream); - headers.setLongInteger(perviouslySentDate, - PduHeaders.PREVIOUSLY_SENT_DATE); - } catch(RuntimeException e) { - log(headerField + "is not Long-Integer header field!"); - return null; - } - break; - } - - case PduHeaders.MM_FLAGS: { - /* MM-flags-value = - * Value-length - * ( Add-token | Remove-token | Filter-token ) - * Encoded-string-value - */ - - /* parse Value-length */ - parseValueLength(pduDataStream); - - /* Add-token | Remove-token | Filter-token */ - extractByteValue(pduDataStream); - - /* Encoded-string-value */ - parseEncodedStringValue(pduDataStream); - - /* not store this header filed in "headers", - * because now PduHeaders doesn't support it */ - break; - } - - /* Value-length - * (Message-total-token | Size-total-token) Integer-Value */ - case PduHeaders.MBOX_TOTALS: - case PduHeaders.MBOX_QUOTAS: - { - /* Value-length */ - parseValueLength(pduDataStream); - - /* Message-total-token | Size-total-token */ - extractByteValue(pduDataStream); - - /*Integer-Value*/ - try { - parseIntegerValue(pduDataStream); - } catch(RuntimeException e) { - log(headerField + " is not Integer-Value"); - return null; - } - - /* not store these headers filed in "headers", - because now PduHeaders doesn't support them */ - break; - } - - case PduHeaders.ELEMENT_DESCRIPTOR: { - parseContentType(pduDataStream, null); - - /* not store this header filed in "headers", - because now PduHeaders doesn't support it */ - break; - } - - case PduHeaders.CONTENT_TYPE: { - HashMap map = - new HashMap(); - byte[] contentType = - parseContentType(pduDataStream, map); - - if (null != contentType) { - try { - headers.setTextString(contentType, PduHeaders.CONTENT_TYPE); - } catch(NullPointerException e) { - log("null pointer error!"); - } catch(RuntimeException e) { - log(headerField + "is not Text-String header field!"); - return null; - } - } - - /* get start parameter */ - mStartParam = (byte[]) map.get(PduPart.P_START); - - /* get charset parameter */ - mTypeParam= (byte[]) map.get(PduPart.P_TYPE); - - keepParsing = false; - break; - } - - case PduHeaders.CONTENT: - case PduHeaders.ADDITIONAL_HEADERS: - case PduHeaders.ATTRIBUTES: - default: { - log("Unknown header"); - } - } - } - - return headers; - } - - /** - * Parse pdu parts. - * - * @param pduDataStream pdu data input stream - * @return parts in PduBody structure - */ - protected static PduBody parseParts(ByteArrayInputStream pduDataStream) { - if (pduDataStream == null) { - return null; - } - - int count = parseUnsignedInt(pduDataStream); // get the number of parts - PduBody body = new PduBody(); - - for (int i = 0 ; i < count ; i++) { - int headerLength = parseUnsignedInt(pduDataStream); - int dataLength = parseUnsignedInt(pduDataStream); - PduPart part = new PduPart(); - int startPos = pduDataStream.available(); - if (startPos <= 0) { - // Invalid part. - return null; - } - - /* parse part's content-type */ - HashMap map = new HashMap(); - byte[] contentType = parseContentType(pduDataStream, map); - if (null != contentType) { - part.setContentType(contentType); - } else { - part.setContentType((PduContentTypes.contentTypes[0]).getBytes()); //"*/*" - } - - /* get name parameter */ - byte[] name = (byte[]) map.get(PduPart.P_NAME); - if (null != name) { - part.setName(name); - } - - /* get charset parameter */ - Integer charset = (Integer) map.get(PduPart.P_CHARSET); - if (null != charset) { - part.setCharset(charset); - } - - /* parse part's headers */ - int endPos = pduDataStream.available(); - int partHeaderLen = headerLength - (startPos - endPos); - if (partHeaderLen > 0) { - if (false == parsePartHeaders(pduDataStream, part, partHeaderLen)) { - // Parse part header faild. - return null; - } - } else if (partHeaderLen < 0) { - // Invalid length of content-type. - return null; - } - - /* FIXME: check content-id, name, filename and content location, - * if not set anyone of them, generate a default content-location - */ - if ((null == part.getContentLocation()) - && (null == part.getName()) - && (null == part.getFilename()) - && (null == part.getContentId())) { - part.setContentLocation(Long.toOctalString( - System.currentTimeMillis()).getBytes()); - } - - /* get part's data */ - if (dataLength > 0) { - byte[] partData = new byte[dataLength]; - String partContentType = new String(part.getContentType()); - pduDataStream.read(partData, 0, dataLength); - if (partContentType.equalsIgnoreCase(ContentType.MULTIPART_ALTERNATIVE)) { - // parse "multipart/vnd.wap.multipart.alternative". - PduBody childBody = parseParts(new ByteArrayInputStream(partData)); - // take the first part of children. - part = childBody.getPart(0); - } else { - // Check Content-Transfer-Encoding. - byte[] partDataEncoding = part.getContentTransferEncoding(); - if (null != partDataEncoding) { - String encoding = new String(partDataEncoding); - if (encoding.equalsIgnoreCase(PduPart.P_BASE64)) { - // Decode "base64" into "binary". - partData = Base64.decodeBase64(partData); - } else if (encoding.equalsIgnoreCase(PduPart.P_QUOTED_PRINTABLE)) { - // Decode "quoted-printable" into "binary". - partData = QuotedPrintable.decodeQuotedPrintable(partData); - } else { - // "binary" is the default encoding. - } - } - if (null == partData) { - log("Decode part data error!"); - return null; - } - part.setData(partData); - } - } - - /* add this part to body */ - if (THE_FIRST_PART == checkPartPosition(part)) { - /* this is the first part */ - body.addPart(0, part); - } else { - /* add the part to the end */ - body.addPart(part); - } - } - - return body; - } - - /** - * Log status. - * - * @param text log information - */ - private static void log(String text) { - if (LOCAL_LOGV) { - Log.v(LOG_TAG, text); - } - } - - /** - * Parse unsigned integer. - * - * @param pduDataStream pdu data input stream - * @return the integer, -1 when failed - */ - protected static int parseUnsignedInt(ByteArrayInputStream pduDataStream) { - /** - * From wap-230-wsp-20010705-a.pdf - * The maximum size of a uintvar is 32 bits. - * So it will be encoded in no more than 5 octets. - */ - assert(null != pduDataStream); - int result = 0; - int temp = pduDataStream.read(); - if (temp == -1) { - return temp; - } - - while((temp & 0x80) != 0) { - result = result << 7; - result |= temp & 0x7F; - temp = pduDataStream.read(); - if (temp == -1) { - return temp; - } - } - - result = result << 7; - result |= temp & 0x7F; - - return result; - } - - /** - * Parse value length. - * - * @param pduDataStream pdu data input stream - * @return the integer - */ - protected static int parseValueLength(ByteArrayInputStream pduDataStream) { - /** - * From wap-230-wsp-20010705-a.pdf - * Value-length = Short-length | (Length-quote Length) - * Short-length = - * Length-quote = - * Length = Uintvar-integer - * Uintvar-integer = 1*5 OCTET - */ - assert(null != pduDataStream); - int temp = pduDataStream.read(); - assert(-1 != temp); - int first = temp & 0xFF; - - if (first <= SHORT_LENGTH_MAX) { - return first; - } else if (first == LENGTH_QUOTE) { - return parseUnsignedInt(pduDataStream); - } - - throw new RuntimeException ("Value length > LENGTH_QUOTE!"); - } - - /** - * Parse encoded string value. - * - * @param pduDataStream pdu data input stream - * @return the EncodedStringValue - */ - protected static EncodedStringValue parseEncodedStringValue(ByteArrayInputStream pduDataStream){ - /** - * From OMA-TS-MMS-ENC-V1_3-20050927-C.pdf - * Encoded-string-value = Text-string | Value-length Char-set Text-string - */ - assert(null != pduDataStream); - pduDataStream.mark(1); - EncodedStringValue returnValue = null; - int charset = 0; - int temp = pduDataStream.read(); - assert(-1 != temp); - int first = temp & 0xFF; - if (first == 0) { - return null; // Blank subject, bail. - } - - pduDataStream.reset(); - if (first < TEXT_MIN) { - parseValueLength(pduDataStream); - - charset = parseShortInteger(pduDataStream); //get the "Charset" - } - - byte[] textString = parseWapString(pduDataStream, TYPE_TEXT_STRING); - - try { - if (0 != charset) { - returnValue = new EncodedStringValue(charset, textString); - } else { - returnValue = new EncodedStringValue(textString); - } - } catch(Exception e) { - return null; - } - - return returnValue; - } - - /** - * Parse Text-String or Quoted-String. - * - * @param pduDataStream pdu data input stream - * @param stringType TYPE_TEXT_STRING or TYPE_QUOTED_STRING - * @return the string without End-of-string in byte array - */ - protected static byte[] parseWapString(ByteArrayInputStream pduDataStream, - int stringType) { - assert(null != pduDataStream); - /** - * From wap-230-wsp-20010705-a.pdf - * Text-string = [Quote] *TEXT End-of-string - * If the first character in the TEXT is in the range of 128-255, - * a Quote character must precede it. - * Otherwise the Quote character must be omitted. - * The Quote is not part of the contents. - * Quote = - * End-of-string = - * - * Quoted-string = *TEXT End-of-string - * - * Token-text = Token End-of-string - */ - - // Mark supposed beginning of Text-string - // We will have to mark again if first char is QUOTE or QUOTED_STRING_FLAG - pduDataStream.mark(1); - - // Check first char - int temp = pduDataStream.read(); - assert(-1 != temp); - if ((TYPE_QUOTED_STRING == stringType) && - (QUOTED_STRING_FLAG == temp)) { - // Mark again if QUOTED_STRING_FLAG and ignore it - pduDataStream.mark(1); - } else if ((TYPE_TEXT_STRING == stringType) && - (QUOTE == temp)) { - // Mark again if QUOTE and ignore it - pduDataStream.mark(1); - } else { - // Otherwise go back to origin - pduDataStream.reset(); - } - - // We are now definitely at the beginning of string - /** - * Return *TOKEN or *TEXT (Text-String without QUOTE, - * Quoted-String without QUOTED_STRING_FLAG and without End-of-string) - */ - return getWapString(pduDataStream, stringType); - } - - /** - * Check TOKEN data defined in RFC2616. - * @param ch checking data - * @return true when ch is TOKEN, false when ch is not TOKEN - */ - protected static boolean isTokenCharacter(int ch) { - /** - * Token = 1* - * separators = "("(40) | ")"(41) | "<"(60) | ">"(62) | "@"(64) - * | ","(44) | ";"(59) | ":"(58) | "\"(92) | <">(34) - * | "/"(47) | "["(91) | "]"(93) | "?"(63) | "="(61) - * | "{"(123) | "}"(125) | SP(32) | HT(9) - * CHAR = - * CTL = - * SP = - * HT = - */ - if((ch < 33) || (ch > 126)) { - return false; - } - - switch(ch) { - case '"': /* '"' */ - case '(': /* '(' */ - case ')': /* ')' */ - case ',': /* ',' */ - case '/': /* '/' */ - case ':': /* ':' */ - case ';': /* ';' */ - case '<': /* '<' */ - case '=': /* '=' */ - case '>': /* '>' */ - case '?': /* '?' */ - case '@': /* '@' */ - case '[': /* '[' */ - case '\\': /* '\' */ - case ']': /* ']' */ - case '{': /* '{' */ - case '}': /* '}' */ - return false; - } - - return true; - } - - /** - * Check TEXT data defined in RFC2616. - * @param ch checking data - * @return true when ch is TEXT, false when ch is not TEXT - */ - protected static boolean isText(int ch) { - /** - * TEXT = - * CTL = - * LWS = [CRLF] 1*( SP | HT ) - * CRLF = CR LF - * CR = - * LF = - */ - if(((ch >= 32) && (ch <= 126)) || ((ch >= 128) && (ch <= 255))) { - return true; - } - - switch(ch) { - case '\t': /* '\t' */ - case '\n': /* '\n' */ - case '\r': /* '\r' */ - return true; - } - - return false; - } - - protected static byte[] getWapString(ByteArrayInputStream pduDataStream, - int stringType) { - assert(null != pduDataStream); - ByteArrayOutputStream out = new ByteArrayOutputStream(); - int temp = pduDataStream.read(); - assert(-1 != temp); - while((-1 != temp) && ('\0' != temp)) { - // check each of the character - if (stringType == TYPE_TOKEN_STRING) { - if (isTokenCharacter(temp)) { - out.write(temp); - } - } else { - if (isText(temp)) { - out.write(temp); - } - } - - temp = pduDataStream.read(); - assert(-1 != temp); - } - - if (out.size() > 0) { - return out.toByteArray(); - } - - return null; - } - - /** - * Extract a byte value from the input stream. - * - * @param pduDataStream pdu data input stream - * @return the byte - */ - protected static int extractByteValue(ByteArrayInputStream pduDataStream) { - assert(null != pduDataStream); - int temp = pduDataStream.read(); - assert(-1 != temp); - return temp & 0xFF; - } - - /** - * Parse Short-Integer. - * - * @param pduDataStream pdu data input stream - * @return the byte - */ - protected static int parseShortInteger(ByteArrayInputStream pduDataStream) { - /** - * From wap-230-wsp-20010705-a.pdf - * Short-integer = OCTET - * Integers in range 0-127 shall be encoded as a one - * octet value with the most significant bit set to one (1xxx xxxx) - * and with the value in the remaining least significant bits. - */ - assert(null != pduDataStream); - int temp = pduDataStream.read(); - assert(-1 != temp); - return temp & 0x7F; - } - - /** - * Parse Long-Integer. - * - * @param pduDataStream pdu data input stream - * @return long integer - */ - protected static long parseLongInteger(ByteArrayInputStream pduDataStream) { - /** - * From wap-230-wsp-20010705-a.pdf - * Long-integer = Short-length Multi-octet-integer - * The Short-length indicates the length of the Multi-octet-integer - * Multi-octet-integer = 1*30 OCTET - * The content octets shall be an unsigned integer value - * with the most significant octet encoded first (big-endian representation). - * The minimum number of octets must be used to encode the value. - * Short-length = - */ - assert(null != pduDataStream); - int temp = pduDataStream.read(); - assert(-1 != temp); - int count = temp & 0xFF; - - if (count > LONG_INTEGER_LENGTH_MAX) { - throw new RuntimeException("Octet count greater than 8 and I can't represent that!"); - } - - long result = 0; - - for (int i = 0 ; i < count ; i++) { - temp = pduDataStream.read(); - assert(-1 != temp); - result <<= 8; - result += (temp & 0xFF); - } - - return result; - } - - /** - * Parse Integer-Value. - * - * @param pduDataStream pdu data input stream - * @return long integer - */ - protected static long parseIntegerValue(ByteArrayInputStream pduDataStream) { - /** - * From wap-230-wsp-20010705-a.pdf - * Integer-Value = Short-integer | Long-integer - */ - assert(null != pduDataStream); - pduDataStream.mark(1); - int temp = pduDataStream.read(); - assert(-1 != temp); - pduDataStream.reset(); - if (temp > SHORT_INTEGER_MAX) { - return parseShortInteger(pduDataStream); - } else { - return parseLongInteger(pduDataStream); - } - } - - /** - * To skip length of the wap value. - * - * @param pduDataStream pdu data input stream - * @param length area size - * @return the values in this area - */ - protected static int skipWapValue(ByteArrayInputStream pduDataStream, int length) { - assert(null != pduDataStream); - byte[] area = new byte[length]; - int readLen = pduDataStream.read(area, 0, length); - if (readLen < length) { //The actually read length is lower than the length - return -1; - } else { - return readLen; - } - } - - /** - * Parse content type parameters. For now we just support - * four parameters used in mms: "type", "start", "name", "charset". - * - * @param pduDataStream pdu data input stream - * @param map to store parameters of Content-Type field - * @param length length of all the parameters - */ - protected static void parseContentTypeParams(ByteArrayInputStream pduDataStream, - HashMap map, Integer length) { - /** - * From wap-230-wsp-20010705-a.pdf - * Parameter = Typed-parameter | Untyped-parameter - * Typed-parameter = Well-known-parameter-token Typed-value - * the actual expected type of the value is implied by the well-known parameter - * Well-known-parameter-token = Integer-value - * the code values used for parameters are specified in the Assigned Numbers appendix - * Typed-value = Compact-value | Text-value - * In addition to the expected type, there may be no value. - * If the value cannot be encoded using the expected type, it shall be encoded as text. - * Compact-value = Integer-value | - * Date-value | Delta-seconds-value | Q-value | Version-value | - * Uri-value - * Untyped-parameter = Token-text Untyped-value - * the type of the value is unknown, but it shall be encoded as an integer, - * if that is possible. - * Untyped-value = Integer-value | Text-value - */ - assert(null != pduDataStream); - assert(length > 0); - - int startPos = pduDataStream.available(); - int tempPos = 0; - int lastLen = length; - while(0 < lastLen) { - int param = pduDataStream.read(); - assert(-1 != param); - lastLen--; - - switch (param) { - /** - * From rfc2387, chapter 3.1 - * The type parameter must be specified and its value is the MIME media - * type of the "root" body part. It permits a MIME user agent to - * determine the content-type without reference to the enclosed body - * part. If the value of the type parameter and the root body part's - * content-type differ then the User Agent's behavior is undefined. - * - * From wap-230-wsp-20010705-a.pdf - * type = Constrained-encoding - * Constrained-encoding = Extension-Media | Short-integer - * Extension-media = *TEXT End-of-string - */ - case PduPart.P_TYPE: - case PduPart.P_CT_MR_TYPE: - pduDataStream.mark(1); - int first = extractByteValue(pduDataStream); - pduDataStream.reset(); - if (first > TEXT_MAX) { - // Short-integer (well-known type) - int index = parseShortInteger(pduDataStream); - - if (index < PduContentTypes.contentTypes.length) { - byte[] type = (PduContentTypes.contentTypes[index]).getBytes(); - map.put(PduPart.P_TYPE, type); - } else { - //not support this type, ignore it. - } - } else { - // Text-String (extension-media) - byte[] type = parseWapString(pduDataStream, TYPE_TEXT_STRING); - if ((null != type) && (null != map)) { - map.put(PduPart.P_TYPE, type); - } - } - - tempPos = pduDataStream.available(); - lastLen = length - (startPos - tempPos); - break; - - /** - * From oma-ts-mms-conf-v1_3.pdf, chapter 10.2.3. - * Start Parameter Referring to Presentation - * - * From rfc2387, chapter 3.2 - * The start parameter, if given, is the content-ID of the compound - * object's "root". If not present the "root" is the first body part in - * the Multipart/Related entity. The "root" is the element the - * applications processes first. - * - * From wap-230-wsp-20010705-a.pdf - * start = Text-String - */ - case PduPart.P_START: - case PduPart.P_DEP_START: - byte[] start = parseWapString(pduDataStream, TYPE_TEXT_STRING); - if ((null != start) && (null != map)) { - map.put(PduPart.P_START, start); - } - - tempPos = pduDataStream.available(); - lastLen = length - (startPos - tempPos); - break; - - /** - * From oma-ts-mms-conf-v1_3.pdf - * In creation, the character set SHALL be either us-ascii - * (IANA MIBenum 3) or utf-8 (IANA MIBenum 106)[Unicode]. - * In retrieval, both us-ascii and utf-8 SHALL be supported. - * - * From wap-230-wsp-20010705-a.pdf - * charset = Well-known-charset|Text-String - * Well-known-charset = Any-charset | Integer-value - * Both are encoded using values from Character Set - * Assignments table in Assigned Numbers - * Any-charset = - * Equivalent to the special RFC2616 charset value "*" - */ - case PduPart.P_CHARSET: - pduDataStream.mark(1); - int firstValue = extractByteValue(pduDataStream); - pduDataStream.reset(); - //Check first char - if (((firstValue > TEXT_MIN) && (firstValue < TEXT_MAX)) || - (END_STRING_FLAG == firstValue)) { - //Text-String (extension-charset) - byte[] charsetStr = parseWapString(pduDataStream, TYPE_TEXT_STRING); - try { - int charsetInt = CharacterSets.getMibEnumValue( - new String(charsetStr)); - map.put(PduPart.P_CHARSET, charsetInt); - } catch (UnsupportedEncodingException e) { - // Not a well-known charset, use "*". - Log.e(LOG_TAG, Arrays.toString(charsetStr), e); - map.put(PduPart.P_CHARSET, CharacterSets.ANY_CHARSET); - } - } else { - //Well-known-charset - int charset = (int) parseIntegerValue(pduDataStream); - if (map != null) { - map.put(PduPart.P_CHARSET, charset); - } - } - - tempPos = pduDataStream.available(); - lastLen = length - (startPos - tempPos); - break; - - /** - * From oma-ts-mms-conf-v1_3.pdf - * A name for multipart object SHALL be encoded using name-parameter - * for Content-Type header in WSP multipart headers. - * - * From wap-230-wsp-20010705-a.pdf - * name = Text-String - */ - case PduPart.P_DEP_NAME: - case PduPart.P_NAME: - byte[] name = parseWapString(pduDataStream, TYPE_TEXT_STRING); - if ((null != name) && (null != map)) { - map.put(PduPart.P_NAME, name); - } - - tempPos = pduDataStream.available(); - lastLen = length - (startPos - tempPos); - break; - default: - if (LOCAL_LOGV) { - Log.v(LOG_TAG, "Not supported Content-Type parameter"); - } - if (-1 == skipWapValue(pduDataStream, lastLen)) { - Log.e(LOG_TAG, "Corrupt Content-Type"); - } else { - lastLen = 0; - } - break; - } - } - - if (0 != lastLen) { - Log.e(LOG_TAG, "Corrupt Content-Type"); - } - } - - /** - * Parse content type. - * - * @param pduDataStream pdu data input stream - * @param map to store parameters in Content-Type header field - * @return Content-Type value - */ - protected static byte[] parseContentType(ByteArrayInputStream pduDataStream, - HashMap map) { - /** - * From wap-230-wsp-20010705-a.pdf - * Content-type-value = Constrained-media | Content-general-form - * Content-general-form = Value-length Media-type - * Media-type = (Well-known-media | Extension-Media) *(Parameter) - */ - assert(null != pduDataStream); - - byte[] contentType = null; - pduDataStream.mark(1); - int temp = pduDataStream.read(); - assert(-1 != temp); - pduDataStream.reset(); - - int cur = (temp & 0xFF); - - if (cur < TEXT_MIN) { - int length = parseValueLength(pduDataStream); - int startPos = pduDataStream.available(); - pduDataStream.mark(1); - temp = pduDataStream.read(); - assert(-1 != temp); - pduDataStream.reset(); - int first = (temp & 0xFF); - - if ((first >= TEXT_MIN) && (first <= TEXT_MAX)) { - contentType = parseWapString(pduDataStream, TYPE_TEXT_STRING); - } else if (first > TEXT_MAX) { - int index = parseShortInteger(pduDataStream); - - if (index < PduContentTypes.contentTypes.length) { //well-known type - contentType = (PduContentTypes.contentTypes[index]).getBytes(); - } else { - pduDataStream.reset(); - contentType = parseWapString(pduDataStream, TYPE_TEXT_STRING); - } - } else { - Log.e(LOG_TAG, "Corrupt content-type"); - return (PduContentTypes.contentTypes[0]).getBytes(); //"*/*" - } - - int endPos = pduDataStream.available(); - int parameterLen = length - (startPos - endPos); - if (parameterLen > 0) {//have parameters - parseContentTypeParams(pduDataStream, map, parameterLen); - } - - if (parameterLen < 0) { - Log.e(LOG_TAG, "Corrupt MMS message"); - return (PduContentTypes.contentTypes[0]).getBytes(); //"*/*" - } - } else if (cur <= TEXT_MAX) { - contentType = parseWapString(pduDataStream, TYPE_TEXT_STRING); - } else { - contentType = - (PduContentTypes.contentTypes[parseShortInteger(pduDataStream)]).getBytes(); - } - - return contentType; - } - - /** - * Parse part's headers. - * - * @param pduDataStream pdu data input stream - * @param part to store the header informations of the part - * @param length length of the headers - * @return true if parse successfully, false otherwise - */ - protected static boolean parsePartHeaders(ByteArrayInputStream pduDataStream, - PduPart part, int length) { - assert(null != pduDataStream); - assert(null != part); - assert(length > 0); - - /** - * From oma-ts-mms-conf-v1_3.pdf, chapter 10.2. - * A name for multipart object SHALL be encoded using name-parameter - * for Content-Type header in WSP multipart headers. - * In decoding, name-parameter of Content-Type SHALL be used if available. - * If name-parameter of Content-Type is not available, - * filename parameter of Content-Disposition header SHALL be used if available. - * If neither name-parameter of Content-Type header nor filename parameter - * of Content-Disposition header is available, - * Content-Location header SHALL be used if available. - * - * Within SMIL part the reference to the media object parts SHALL use - * either Content-ID or Content-Location mechanism [RFC2557] - * and the corresponding WSP part headers in media object parts - * contain the corresponding definitions. - */ - int startPos = pduDataStream.available(); - int tempPos = 0; - int lastLen = length; - while(0 < lastLen) { - int header = pduDataStream.read(); - assert(-1 != header); - lastLen--; - - if (header > TEXT_MAX) { - // Number assigned headers. - switch (header) { - case PduPart.P_CONTENT_LOCATION: - /** - * From wap-230-wsp-20010705-a.pdf, chapter 8.4.2.21 - * Content-location-value = Uri-value - */ - byte[] contentLocation = parseWapString(pduDataStream, TYPE_TEXT_STRING); - if (null != contentLocation) { - part.setContentLocation(contentLocation); - } - - tempPos = pduDataStream.available(); - lastLen = length - (startPos - tempPos); - break; - case PduPart.P_CONTENT_ID: - /** - * From wap-230-wsp-20010705-a.pdf, chapter 8.4.2.21 - * Content-ID-value = Quoted-string - */ - byte[] contentId = parseWapString(pduDataStream, TYPE_QUOTED_STRING); - if (null != contentId) { - part.setContentId(contentId); - } - - tempPos = pduDataStream.available(); - lastLen = length - (startPos - tempPos); - break; - case PduPart.P_DEP_CONTENT_DISPOSITION: - case PduPart.P_CONTENT_DISPOSITION: - /** - * From wap-230-wsp-20010705-a.pdf, chapter 8.4.2.21 - * Content-disposition-value = Value-length Disposition *(Parameter) - * Disposition = Form-data | Attachment | Inline | Token-text - * Form-data = - * Attachment = - * Inline = - */ - - /* - * some carrier mmsc servers do not support content_disposition - * field correctly - */ - boolean contentDisposition = Resources.getSystem().getBoolean(com - .android.internal.R.bool.config_mms_content_disposition_support); - - if (contentDisposition) { - int len = parseValueLength(pduDataStream); - pduDataStream.mark(1); - int thisStartPos = pduDataStream.available(); - int thisEndPos = 0; - int value = pduDataStream.read(); - - if (value == PduPart.P_DISPOSITION_FROM_DATA ) { - part.setContentDisposition(PduPart.DISPOSITION_FROM_DATA); - } else if (value == PduPart.P_DISPOSITION_ATTACHMENT) { - part.setContentDisposition(PduPart.DISPOSITION_ATTACHMENT); - } else if (value == PduPart.P_DISPOSITION_INLINE) { - part.setContentDisposition(PduPart.DISPOSITION_INLINE); - } else { - pduDataStream.reset(); - /* Token-text */ - part.setContentDisposition(parseWapString(pduDataStream - , TYPE_TEXT_STRING)); - } - - /* get filename parameter and skip other parameters */ - thisEndPos = pduDataStream.available(); - if (thisStartPos - thisEndPos < len) { - value = pduDataStream.read(); - if (value == PduPart.P_FILENAME) { //filename is text-string - part.setFilename(parseWapString(pduDataStream - , TYPE_TEXT_STRING)); - } - - /* skip other parameters */ - thisEndPos = pduDataStream.available(); - if (thisStartPos - thisEndPos < len) { - int last = len - (thisStartPos - thisEndPos); - byte[] temp = new byte[last]; - pduDataStream.read(temp, 0, last); - } - } - - tempPos = pduDataStream.available(); - lastLen = length - (startPos - tempPos); - } - break; - default: - if (LOCAL_LOGV) { - Log.v(LOG_TAG, "Not supported Part headers: " + header); - } - if (-1 == skipWapValue(pduDataStream, lastLen)) { - Log.e(LOG_TAG, "Corrupt Part headers"); - return false; - } - lastLen = 0; - break; - } - } else if ((header >= TEXT_MIN) && (header <= TEXT_MAX)) { - // Not assigned header. - byte[] tempHeader = parseWapString(pduDataStream, TYPE_TEXT_STRING); - byte[] tempValue = parseWapString(pduDataStream, TYPE_TEXT_STRING); - - // Check the header whether it is "Content-Transfer-Encoding". - if (true == - PduPart.CONTENT_TRANSFER_ENCODING.equalsIgnoreCase(new String(tempHeader))) { - part.setContentTransferEncoding(tempValue); - } - - tempPos = pduDataStream.available(); - lastLen = length - (startPos - tempPos); - } else { - if (LOCAL_LOGV) { - Log.v(LOG_TAG, "Not supported Part headers: " + header); - } - // Skip all headers of this part. - if (-1 == skipWapValue(pduDataStream, lastLen)) { - Log.e(LOG_TAG, "Corrupt Part headers"); - return false; - } - lastLen = 0; - } - } - - if (0 != lastLen) { - Log.e(LOG_TAG, "Corrupt Part headers"); - return false; - } - - return true; - } - - /** - * Check the position of a specified part. - * - * @param part the part to be checked - * @return part position, THE_FIRST_PART when it's the - * first one, THE_LAST_PART when it's the last one. - */ - private static int checkPartPosition(PduPart part) { - assert(null != part); - if ((null == mTypeParam) && - (null == mStartParam)) { - return THE_LAST_PART; - } - - /* check part's content-id */ - if (null != mStartParam) { - byte[] contentId = part.getContentId(); - if (null != contentId) { - if (true == Arrays.equals(mStartParam, contentId)) { - return THE_FIRST_PART; - } - } - } - - /* check part's content-type */ - if (null != mTypeParam) { - byte[] contentType = part.getContentType(); - if (null != contentType) { - if (true == Arrays.equals(mTypeParam, contentType)) { - return THE_FIRST_PART; - } - } - } - - return THE_LAST_PART; - } - - /** - * Check mandatory headers of a pdu. - * - * @param headers pdu headers - * @return true if the pdu has all of the mandatory headers, false otherwise. - */ - protected static boolean checkMandatoryHeader(PduHeaders headers) { - if (null == headers) { - return false; - } - - /* get message type */ - int messageType = headers.getOctet(PduHeaders.MESSAGE_TYPE); - - /* check Mms-Version field */ - int mmsVersion = headers.getOctet(PduHeaders.MMS_VERSION); - if (0 == mmsVersion) { - // Every message should have Mms-Version field. - return false; - } - - /* check mandatory header fields */ - switch (messageType) { - case PduHeaders.MESSAGE_TYPE_SEND_REQ: - // Content-Type field. - byte[] srContentType = headers.getTextString(PduHeaders.CONTENT_TYPE); - if (null == srContentType) { - return false; - } - - // From field. - EncodedStringValue srFrom = headers.getEncodedStringValue(PduHeaders.FROM); - if (null == srFrom) { - return false; - } - - // Transaction-Id field. - byte[] srTransactionId = headers.getTextString(PduHeaders.TRANSACTION_ID); - if (null == srTransactionId) { - return false; - } - - break; - case PduHeaders.MESSAGE_TYPE_SEND_CONF: - // Response-Status field. - int scResponseStatus = headers.getOctet(PduHeaders.RESPONSE_STATUS); - if (0 == scResponseStatus) { - return false; - } - - // Transaction-Id field. - byte[] scTransactionId = headers.getTextString(PduHeaders.TRANSACTION_ID); - if (null == scTransactionId) { - return false; - } - - break; - case PduHeaders.MESSAGE_TYPE_NOTIFICATION_IND: - // Content-Location field. - byte[] niContentLocation = headers.getTextString(PduHeaders.CONTENT_LOCATION); - if (null == niContentLocation) { - return false; - } - - // Expiry field. - long niExpiry = headers.getLongInteger(PduHeaders.EXPIRY); - if (-1 == niExpiry) { - return false; - } - - // Message-Class field. - byte[] niMessageClass = headers.getTextString(PduHeaders.MESSAGE_CLASS); - if (null == niMessageClass) { - return false; - } - - // Message-Size field. - long niMessageSize = headers.getLongInteger(PduHeaders.MESSAGE_SIZE); - if (-1 == niMessageSize) { - return false; - } - - // Transaction-Id field. - byte[] niTransactionId = headers.getTextString(PduHeaders.TRANSACTION_ID); - if (null == niTransactionId) { - return false; - } - - break; - case PduHeaders.MESSAGE_TYPE_NOTIFYRESP_IND: - // Status field. - int nriStatus = headers.getOctet(PduHeaders.STATUS); - if (0 == nriStatus) { - return false; - } - - // Transaction-Id field. - byte[] nriTransactionId = headers.getTextString(PduHeaders.TRANSACTION_ID); - if (null == nriTransactionId) { - return false; - } - - break; - case PduHeaders.MESSAGE_TYPE_RETRIEVE_CONF: - // Content-Type field. - byte[] rcContentType = headers.getTextString(PduHeaders.CONTENT_TYPE); - if (null == rcContentType) { - return false; - } - - // Date field. - long rcDate = headers.getLongInteger(PduHeaders.DATE); - if (-1 == rcDate) { - return false; - } - - break; - case PduHeaders.MESSAGE_TYPE_DELIVERY_IND: - // Date field. - long diDate = headers.getLongInteger(PduHeaders.DATE); - if (-1 == diDate) { - return false; - } - - // Message-Id field. - byte[] diMessageId = headers.getTextString(PduHeaders.MESSAGE_ID); - if (null == diMessageId) { - return false; - } - - // Status field. - int diStatus = headers.getOctet(PduHeaders.STATUS); - if (0 == diStatus) { - return false; - } - - // To field. - EncodedStringValue[] diTo = headers.getEncodedStringValues(PduHeaders.TO); - if (null == diTo) { - return false; - } - - break; - case PduHeaders.MESSAGE_TYPE_ACKNOWLEDGE_IND: - // Transaction-Id field. - byte[] aiTransactionId = headers.getTextString(PduHeaders.TRANSACTION_ID); - if (null == aiTransactionId) { - return false; - } - - break; - case PduHeaders.MESSAGE_TYPE_READ_ORIG_IND: - // Date field. - long roDate = headers.getLongInteger(PduHeaders.DATE); - if (-1 == roDate) { - return false; - } - - // From field. - EncodedStringValue roFrom = headers.getEncodedStringValue(PduHeaders.FROM); - if (null == roFrom) { - return false; - } - - // Message-Id field. - byte[] roMessageId = headers.getTextString(PduHeaders.MESSAGE_ID); - if (null == roMessageId) { - return false; - } - - // Read-Status field. - int roReadStatus = headers.getOctet(PduHeaders.READ_STATUS); - if (0 == roReadStatus) { - return false; - } - - // To field. - EncodedStringValue[] roTo = headers.getEncodedStringValues(PduHeaders.TO); - if (null == roTo) { - return false; - } - - break; - case PduHeaders.MESSAGE_TYPE_READ_REC_IND: - // From field. - EncodedStringValue rrFrom = headers.getEncodedStringValue(PduHeaders.FROM); - if (null == rrFrom) { - return false; - } - - // Message-Id field. - byte[] rrMessageId = headers.getTextString(PduHeaders.MESSAGE_ID); - if (null == rrMessageId) { - return false; - } - - // Read-Status field. - int rrReadStatus = headers.getOctet(PduHeaders.READ_STATUS); - if (0 == rrReadStatus) { - return false; - } - - // To field. - EncodedStringValue[] rrTo = headers.getEncodedStringValues(PduHeaders.TO); - if (null == rrTo) { - return false; - } - - break; - default: - // Parser doesn't support this message type in this version. - return false; - } - - return true; - } -} diff --git a/core/java/com/google/android/mms/pdu/PduPart.java b/core/java/com/google/android/mms/pdu/PduPart.java deleted file mode 100644 index b43e388b65173..0000000000000 --- a/core/java/com/google/android/mms/pdu/PduPart.java +++ /dev/null @@ -1,402 +0,0 @@ -/* - * Copyright (C) 2007-2008 Esmertec AG. - * Copyright (C) 2007-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 com.google.android.mms.pdu; - -import android.net.Uri; - -import java.util.HashMap; -import java.util.Map; - -/** - * The pdu part. - */ -public class PduPart { - /** - * Well-Known Parameters. - */ - public static final int P_Q = 0x80; - public static final int P_CHARSET = 0x81; - public static final int P_LEVEL = 0x82; - public static final int P_TYPE = 0x83; - public static final int P_DEP_NAME = 0x85; - public static final int P_DEP_FILENAME = 0x86; - public static final int P_DIFFERENCES = 0x87; - public static final int P_PADDING = 0x88; - // This value of "TYPE" s used with Content-Type: multipart/related - public static final int P_CT_MR_TYPE = 0x89; - public static final int P_DEP_START = 0x8A; - public static final int P_DEP_START_INFO = 0x8B; - public static final int P_DEP_COMMENT = 0x8C; - public static final int P_DEP_DOMAIN = 0x8D; - public static final int P_MAX_AGE = 0x8E; - public static final int P_DEP_PATH = 0x8F; - public static final int P_SECURE = 0x90; - public static final int P_SEC = 0x91; - public static final int P_MAC = 0x92; - public static final int P_CREATION_DATE = 0x93; - public static final int P_MODIFICATION_DATE = 0x94; - public static final int P_READ_DATE = 0x95; - public static final int P_SIZE = 0x96; - public static final int P_NAME = 0x97; - public static final int P_FILENAME = 0x98; - public static final int P_START = 0x99; - public static final int P_START_INFO = 0x9A; - public static final int P_COMMENT = 0x9B; - public static final int P_DOMAIN = 0x9C; - public static final int P_PATH = 0x9D; - - /** - * Header field names. - */ - public static final int P_CONTENT_TYPE = 0x91; - public static final int P_CONTENT_LOCATION = 0x8E; - public static final int P_CONTENT_ID = 0xC0; - public static final int P_DEP_CONTENT_DISPOSITION = 0xAE; - public static final int P_CONTENT_DISPOSITION = 0xC5; - // The next header is unassigned header, use reserved header(0x48) value. - public static final int P_CONTENT_TRANSFER_ENCODING = 0xC8; - - /** - * Content=Transfer-Encoding string. - */ - public static final String CONTENT_TRANSFER_ENCODING = - "Content-Transfer-Encoding"; - - /** - * Value of Content-Transfer-Encoding. - */ - public static final String P_BINARY = "binary"; - public static final String P_7BIT = "7bit"; - public static final String P_8BIT = "8bit"; - public static final String P_BASE64 = "base64"; - public static final String P_QUOTED_PRINTABLE = "quoted-printable"; - - /** - * Value of disposition can be set to PduPart when the value is octet in - * the PDU. - * "from-data" instead of Form-data. - * "attachment" instead of Attachment. - * "inline" instead of Inline. - */ - static final byte[] DISPOSITION_FROM_DATA = "from-data".getBytes(); - static final byte[] DISPOSITION_ATTACHMENT = "attachment".getBytes(); - static final byte[] DISPOSITION_INLINE = "inline".getBytes(); - - /** - * Content-Disposition value. - */ - public static final int P_DISPOSITION_FROM_DATA = 0x80; - public static final int P_DISPOSITION_ATTACHMENT = 0x81; - public static final int P_DISPOSITION_INLINE = 0x82; - - /** - * Header of part. - */ - private Map mPartHeader = null; - - /** - * Data uri. - */ - private Uri mUri = null; - - /** - * Part data. - */ - private byte[] mPartData = null; - - private static final String TAG = "PduPart"; - - /** - * Empty Constructor. - */ - public PduPart() { - mPartHeader = new HashMap(); - } - - /** - * Set part data. The data are stored as byte array. - * - * @param data the data - */ - public void setData(byte[] data) { - if(data == null) { - return; - } - - mPartData = new byte[data.length]; - System.arraycopy(data, 0, mPartData, 0, data.length); - } - - /** - * @return A copy of the part data or null if the data wasn't set or - * the data is stored as Uri. - * @see #getDataUri - */ - public byte[] getData() { - if(mPartData == null) { - return null; - } - - byte[] byteArray = new byte[mPartData.length]; - System.arraycopy(mPartData, 0, byteArray, 0, mPartData.length); - return byteArray; - } - - /** - * Set data uri. The data are stored as Uri. - * - * @param uri the uri - */ - public void setDataUri(Uri uri) { - mUri = uri; - } - - /** - * @return The Uri of the part data or null if the data wasn't set or - * the data is stored as byte array. - * @see #getData - */ - public Uri getDataUri() { - return mUri; - } - - /** - * Set Content-id value - * - * @param contentId the content-id value - * @throws NullPointerException if the value is null. - */ - public void setContentId(byte[] contentId) { - if((contentId == null) || (contentId.length == 0)) { - throw new IllegalArgumentException( - "Content-Id may not be null or empty."); - } - - if ((contentId.length > 1) - && ((char) contentId[0] == '<') - && ((char) contentId[contentId.length - 1] == '>')) { - mPartHeader.put(P_CONTENT_ID, contentId); - return; - } - - // Insert beginning '<' and trailing '>' for Content-Id. - byte[] buffer = new byte[contentId.length + 2]; - buffer[0] = (byte) (0xff & '<'); - buffer[buffer.length - 1] = (byte) (0xff & '>'); - System.arraycopy(contentId, 0, buffer, 1, contentId.length); - mPartHeader.put(P_CONTENT_ID, buffer); - } - - /** - * Get Content-id value. - * - * @return the value - */ - public byte[] getContentId() { - return (byte[]) mPartHeader.get(P_CONTENT_ID); - } - - /** - * Set Char-set value. - * - * @param charset the value - */ - public void setCharset(int charset) { - mPartHeader.put(P_CHARSET, charset); - } - - /** - * Get Char-set value - * - * @return the charset value. Return 0 if charset was not set. - */ - public int getCharset() { - Integer charset = (Integer) mPartHeader.get(P_CHARSET); - if(charset == null) { - return 0; - } else { - return charset.intValue(); - } - } - - /** - * Set Content-Location value. - * - * @param contentLocation the value - * @throws NullPointerException if the value is null. - */ - public void setContentLocation(byte[] contentLocation) { - if(contentLocation == null) { - throw new NullPointerException("null content-location"); - } - - mPartHeader.put(P_CONTENT_LOCATION, contentLocation); - } - - /** - * Get Content-Location value. - * - * @return the value - * return PduPart.disposition[0] instead of (Form-data). - * return PduPart.disposition[1] instead of (Attachment). - * return PduPart.disposition[2] instead of (Inline). - */ - public byte[] getContentLocation() { - return (byte[]) mPartHeader.get(P_CONTENT_LOCATION); - } - - /** - * Set Content-Disposition value. - * Use PduPart.disposition[0] instead of (Form-data). - * Use PduPart.disposition[1] instead of (Attachment). - * Use PduPart.disposition[2] instead of (Inline). - * - * @param contentDisposition the value - * @throws NullPointerException if the value is null. - */ - public void setContentDisposition(byte[] contentDisposition) { - if(contentDisposition == null) { - throw new NullPointerException("null content-disposition"); - } - - mPartHeader.put(P_CONTENT_DISPOSITION, contentDisposition); - } - - /** - * Get Content-Disposition value. - * - * @return the value - */ - public byte[] getContentDisposition() { - return (byte[]) mPartHeader.get(P_CONTENT_DISPOSITION); - } - - /** - * Set Content-Type value. - * - * @param value the value - * @throws NullPointerException if the value is null. - */ - public void setContentType(byte[] contentType) { - if(contentType == null) { - throw new NullPointerException("null content-type"); - } - - mPartHeader.put(P_CONTENT_TYPE, contentType); - } - - /** - * Get Content-Type value of part. - * - * @return the value - */ - public byte[] getContentType() { - return (byte[]) mPartHeader.get(P_CONTENT_TYPE); - } - - /** - * Set Content-Transfer-Encoding value - * - * @param contentId the content-id value - * @throws NullPointerException if the value is null. - */ - public void setContentTransferEncoding(byte[] contentTransferEncoding) { - if(contentTransferEncoding == null) { - throw new NullPointerException("null content-transfer-encoding"); - } - - mPartHeader.put(P_CONTENT_TRANSFER_ENCODING, contentTransferEncoding); - } - - /** - * Get Content-Transfer-Encoding value. - * - * @return the value - */ - public byte[] getContentTransferEncoding() { - return (byte[]) mPartHeader.get(P_CONTENT_TRANSFER_ENCODING); - } - - /** - * Set Content-type parameter: name. - * - * @param name the name value - * @throws NullPointerException if the value is null. - */ - public void setName(byte[] name) { - if(null == name) { - throw new NullPointerException("null content-id"); - } - - mPartHeader.put(P_NAME, name); - } - - /** - * Get content-type parameter: name. - * - * @return the name - */ - public byte[] getName() { - return (byte[]) mPartHeader.get(P_NAME); - } - - /** - * Get Content-disposition parameter: filename - * - * @param fileName the filename value - * @throws NullPointerException if the value is null. - */ - public void setFilename(byte[] fileName) { - if(null == fileName) { - throw new NullPointerException("null content-id"); - } - - mPartHeader.put(P_FILENAME, fileName); - } - - /** - * Set Content-disposition parameter: filename - * - * @return the filename - */ - public byte[] getFilename() { - return (byte[]) mPartHeader.get(P_FILENAME); - } - - public String generateLocation() { - // Assumption: At least one of the content-location / name / filename - // or content-id should be set. This is guaranteed by the PduParser - // for incoming messages and by MM composer for outgoing messages. - byte[] location = (byte[]) mPartHeader.get(P_NAME); - if(null == location) { - location = (byte[]) mPartHeader.get(P_FILENAME); - - if (null == location) { - location = (byte[]) mPartHeader.get(P_CONTENT_LOCATION); - } - } - - if (null == location) { - byte[] contentId = (byte[]) mPartHeader.get(P_CONTENT_ID); - return "cid:" + new String(contentId); - } else { - return new String(location); - } - } -} - diff --git a/core/java/com/google/android/mms/pdu/PduPersister.java b/core/java/com/google/android/mms/pdu/PduPersister.java deleted file mode 100644 index ee285aaba1c8e..0000000000000 --- a/core/java/com/google/android/mms/pdu/PduPersister.java +++ /dev/null @@ -1,1477 +0,0 @@ -/* - * Copyright (C) 2007-2008 Esmertec AG. - * Copyright (C) 2007-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 com.google.android.mms.pdu; - -import com.google.android.mms.ContentType; -import com.google.android.mms.InvalidHeaderValueException; -import com.google.android.mms.MmsException; -import com.google.android.mms.util.DownloadDrmHelper; -import com.google.android.mms.util.DrmConvertSession; -import com.google.android.mms.util.PduCache; -import com.google.android.mms.util.PduCacheEntry; -import com.google.android.mms.util.SqliteWrapper; - -import android.content.ContentResolver; -import android.content.ContentUris; -import android.content.ContentValues; -import android.content.Context; -import android.database.Cursor; -import android.database.DatabaseUtils; -import android.database.sqlite.SQLiteException; -import android.drm.DrmManagerClient; -import android.net.Uri; -import android.os.FileUtils; -import android.provider.MediaStore; -import android.provider.Telephony; -import android.provider.Telephony.Mms; -import android.provider.Telephony.MmsSms; -import android.provider.Telephony.Threads; -import android.provider.Telephony.Mms.Addr; -import android.provider.Telephony.Mms.Part; -import android.provider.Telephony.MmsSms.PendingMessages; -import android.text.TextUtils; -import android.util.Log; - -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.io.UnsupportedEncodingException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; -import java.util.Map.Entry; - -import com.google.android.mms.pdu.EncodedStringValue; - -/** - * This class is the high-level manager of PDU storage. - */ -public class PduPersister { - private static final String TAG = "PduPersister"; - private static final boolean DEBUG = false; - private static final boolean LOCAL_LOGV = false; - - private static final long DUMMY_THREAD_ID = Long.MAX_VALUE; - - /** - * The uri of temporary drm objects. - */ - public static final String TEMPORARY_DRM_OBJECT_URI = - "content://mms/" + Long.MAX_VALUE + "/part"; - /** - * Indicate that we transiently failed to process a MM. - */ - public static final int PROC_STATUS_TRANSIENT_FAILURE = 1; - /** - * Indicate that we permanently failed to process a MM. - */ - public static final int PROC_STATUS_PERMANENTLY_FAILURE = 2; - /** - * Indicate that we have successfully processed a MM. - */ - public static final int PROC_STATUS_COMPLETED = 3; - - private static PduPersister sPersister; - private static final PduCache PDU_CACHE_INSTANCE; - - private static final int[] ADDRESS_FIELDS = new int[] { - PduHeaders.BCC, - PduHeaders.CC, - PduHeaders.FROM, - PduHeaders.TO - }; - - private static final String[] PDU_PROJECTION = new String[] { - Mms._ID, - Mms.MESSAGE_BOX, - Mms.THREAD_ID, - Mms.RETRIEVE_TEXT, - Mms.SUBJECT, - Mms.CONTENT_LOCATION, - Mms.CONTENT_TYPE, - Mms.MESSAGE_CLASS, - Mms.MESSAGE_ID, - Mms.RESPONSE_TEXT, - Mms.TRANSACTION_ID, - Mms.CONTENT_CLASS, - Mms.DELIVERY_REPORT, - Mms.MESSAGE_TYPE, - Mms.MMS_VERSION, - Mms.PRIORITY, - Mms.READ_REPORT, - Mms.READ_STATUS, - Mms.REPORT_ALLOWED, - Mms.RETRIEVE_STATUS, - Mms.STATUS, - Mms.DATE, - Mms.DELIVERY_TIME, - Mms.EXPIRY, - Mms.MESSAGE_SIZE, - Mms.SUBJECT_CHARSET, - Mms.RETRIEVE_TEXT_CHARSET, - }; - - private static final int PDU_COLUMN_ID = 0; - private static final int PDU_COLUMN_MESSAGE_BOX = 1; - private static final int PDU_COLUMN_THREAD_ID = 2; - private static final int PDU_COLUMN_RETRIEVE_TEXT = 3; - private static final int PDU_COLUMN_SUBJECT = 4; - private static final int PDU_COLUMN_CONTENT_LOCATION = 5; - private static final int PDU_COLUMN_CONTENT_TYPE = 6; - private static final int PDU_COLUMN_MESSAGE_CLASS = 7; - private static final int PDU_COLUMN_MESSAGE_ID = 8; - private static final int PDU_COLUMN_RESPONSE_TEXT = 9; - private static final int PDU_COLUMN_TRANSACTION_ID = 10; - private static final int PDU_COLUMN_CONTENT_CLASS = 11; - private static final int PDU_COLUMN_DELIVERY_REPORT = 12; - private static final int PDU_COLUMN_MESSAGE_TYPE = 13; - private static final int PDU_COLUMN_MMS_VERSION = 14; - private static final int PDU_COLUMN_PRIORITY = 15; - private static final int PDU_COLUMN_READ_REPORT = 16; - private static final int PDU_COLUMN_READ_STATUS = 17; - private static final int PDU_COLUMN_REPORT_ALLOWED = 18; - private static final int PDU_COLUMN_RETRIEVE_STATUS = 19; - private static final int PDU_COLUMN_STATUS = 20; - private static final int PDU_COLUMN_DATE = 21; - private static final int PDU_COLUMN_DELIVERY_TIME = 22; - private static final int PDU_COLUMN_EXPIRY = 23; - private static final int PDU_COLUMN_MESSAGE_SIZE = 24; - private static final int PDU_COLUMN_SUBJECT_CHARSET = 25; - private static final int PDU_COLUMN_RETRIEVE_TEXT_CHARSET = 26; - - private static final String[] PART_PROJECTION = new String[] { - Part._ID, - Part.CHARSET, - Part.CONTENT_DISPOSITION, - Part.CONTENT_ID, - Part.CONTENT_LOCATION, - Part.CONTENT_TYPE, - Part.FILENAME, - Part.NAME, - Part.TEXT - }; - - private static final int PART_COLUMN_ID = 0; - private static final int PART_COLUMN_CHARSET = 1; - private static final int PART_COLUMN_CONTENT_DISPOSITION = 2; - private static final int PART_COLUMN_CONTENT_ID = 3; - private static final int PART_COLUMN_CONTENT_LOCATION = 4; - private static final int PART_COLUMN_CONTENT_TYPE = 5; - private static final int PART_COLUMN_FILENAME = 6; - private static final int PART_COLUMN_NAME = 7; - private static final int PART_COLUMN_TEXT = 8; - - private static final HashMap MESSAGE_BOX_MAP; - // These map are used for convenience in persist() and load(). - private static final HashMap CHARSET_COLUMN_INDEX_MAP; - private static final HashMap ENCODED_STRING_COLUMN_INDEX_MAP; - private static final HashMap TEXT_STRING_COLUMN_INDEX_MAP; - private static final HashMap OCTET_COLUMN_INDEX_MAP; - private static final HashMap LONG_COLUMN_INDEX_MAP; - private static final HashMap CHARSET_COLUMN_NAME_MAP; - private static final HashMap ENCODED_STRING_COLUMN_NAME_MAP; - private static final HashMap TEXT_STRING_COLUMN_NAME_MAP; - private static final HashMap OCTET_COLUMN_NAME_MAP; - private static final HashMap LONG_COLUMN_NAME_MAP; - - static { - MESSAGE_BOX_MAP = new HashMap(); - MESSAGE_BOX_MAP.put(Mms.Inbox.CONTENT_URI, Mms.MESSAGE_BOX_INBOX); - MESSAGE_BOX_MAP.put(Mms.Sent.CONTENT_URI, Mms.MESSAGE_BOX_SENT); - MESSAGE_BOX_MAP.put(Mms.Draft.CONTENT_URI, Mms.MESSAGE_BOX_DRAFTS); - MESSAGE_BOX_MAP.put(Mms.Outbox.CONTENT_URI, Mms.MESSAGE_BOX_OUTBOX); - - CHARSET_COLUMN_INDEX_MAP = new HashMap(); - CHARSET_COLUMN_INDEX_MAP.put(PduHeaders.SUBJECT, PDU_COLUMN_SUBJECT_CHARSET); - CHARSET_COLUMN_INDEX_MAP.put(PduHeaders.RETRIEVE_TEXT, PDU_COLUMN_RETRIEVE_TEXT_CHARSET); - - CHARSET_COLUMN_NAME_MAP = new HashMap(); - CHARSET_COLUMN_NAME_MAP.put(PduHeaders.SUBJECT, Mms.SUBJECT_CHARSET); - CHARSET_COLUMN_NAME_MAP.put(PduHeaders.RETRIEVE_TEXT, Mms.RETRIEVE_TEXT_CHARSET); - - // Encoded string field code -> column index/name map. - ENCODED_STRING_COLUMN_INDEX_MAP = new HashMap(); - ENCODED_STRING_COLUMN_INDEX_MAP.put(PduHeaders.RETRIEVE_TEXT, PDU_COLUMN_RETRIEVE_TEXT); - ENCODED_STRING_COLUMN_INDEX_MAP.put(PduHeaders.SUBJECT, PDU_COLUMN_SUBJECT); - - ENCODED_STRING_COLUMN_NAME_MAP = new HashMap(); - ENCODED_STRING_COLUMN_NAME_MAP.put(PduHeaders.RETRIEVE_TEXT, Mms.RETRIEVE_TEXT); - ENCODED_STRING_COLUMN_NAME_MAP.put(PduHeaders.SUBJECT, Mms.SUBJECT); - - // Text string field code -> column index/name map. - TEXT_STRING_COLUMN_INDEX_MAP = new HashMap(); - TEXT_STRING_COLUMN_INDEX_MAP.put(PduHeaders.CONTENT_LOCATION, PDU_COLUMN_CONTENT_LOCATION); - TEXT_STRING_COLUMN_INDEX_MAP.put(PduHeaders.CONTENT_TYPE, PDU_COLUMN_CONTENT_TYPE); - TEXT_STRING_COLUMN_INDEX_MAP.put(PduHeaders.MESSAGE_CLASS, PDU_COLUMN_MESSAGE_CLASS); - TEXT_STRING_COLUMN_INDEX_MAP.put(PduHeaders.MESSAGE_ID, PDU_COLUMN_MESSAGE_ID); - TEXT_STRING_COLUMN_INDEX_MAP.put(PduHeaders.RESPONSE_TEXT, PDU_COLUMN_RESPONSE_TEXT); - TEXT_STRING_COLUMN_INDEX_MAP.put(PduHeaders.TRANSACTION_ID, PDU_COLUMN_TRANSACTION_ID); - - TEXT_STRING_COLUMN_NAME_MAP = new HashMap(); - TEXT_STRING_COLUMN_NAME_MAP.put(PduHeaders.CONTENT_LOCATION, Mms.CONTENT_LOCATION); - TEXT_STRING_COLUMN_NAME_MAP.put(PduHeaders.CONTENT_TYPE, Mms.CONTENT_TYPE); - TEXT_STRING_COLUMN_NAME_MAP.put(PduHeaders.MESSAGE_CLASS, Mms.MESSAGE_CLASS); - TEXT_STRING_COLUMN_NAME_MAP.put(PduHeaders.MESSAGE_ID, Mms.MESSAGE_ID); - TEXT_STRING_COLUMN_NAME_MAP.put(PduHeaders.RESPONSE_TEXT, Mms.RESPONSE_TEXT); - TEXT_STRING_COLUMN_NAME_MAP.put(PduHeaders.TRANSACTION_ID, Mms.TRANSACTION_ID); - - // Octet field code -> column index/name map. - OCTET_COLUMN_INDEX_MAP = new HashMap(); - OCTET_COLUMN_INDEX_MAP.put(PduHeaders.CONTENT_CLASS, PDU_COLUMN_CONTENT_CLASS); - OCTET_COLUMN_INDEX_MAP.put(PduHeaders.DELIVERY_REPORT, PDU_COLUMN_DELIVERY_REPORT); - OCTET_COLUMN_INDEX_MAP.put(PduHeaders.MESSAGE_TYPE, PDU_COLUMN_MESSAGE_TYPE); - OCTET_COLUMN_INDEX_MAP.put(PduHeaders.MMS_VERSION, PDU_COLUMN_MMS_VERSION); - OCTET_COLUMN_INDEX_MAP.put(PduHeaders.PRIORITY, PDU_COLUMN_PRIORITY); - OCTET_COLUMN_INDEX_MAP.put(PduHeaders.READ_REPORT, PDU_COLUMN_READ_REPORT); - OCTET_COLUMN_INDEX_MAP.put(PduHeaders.READ_STATUS, PDU_COLUMN_READ_STATUS); - OCTET_COLUMN_INDEX_MAP.put(PduHeaders.REPORT_ALLOWED, PDU_COLUMN_REPORT_ALLOWED); - OCTET_COLUMN_INDEX_MAP.put(PduHeaders.RETRIEVE_STATUS, PDU_COLUMN_RETRIEVE_STATUS); - OCTET_COLUMN_INDEX_MAP.put(PduHeaders.STATUS, PDU_COLUMN_STATUS); - - OCTET_COLUMN_NAME_MAP = new HashMap(); - OCTET_COLUMN_NAME_MAP.put(PduHeaders.CONTENT_CLASS, Mms.CONTENT_CLASS); - OCTET_COLUMN_NAME_MAP.put(PduHeaders.DELIVERY_REPORT, Mms.DELIVERY_REPORT); - OCTET_COLUMN_NAME_MAP.put(PduHeaders.MESSAGE_TYPE, Mms.MESSAGE_TYPE); - OCTET_COLUMN_NAME_MAP.put(PduHeaders.MMS_VERSION, Mms.MMS_VERSION); - OCTET_COLUMN_NAME_MAP.put(PduHeaders.PRIORITY, Mms.PRIORITY); - OCTET_COLUMN_NAME_MAP.put(PduHeaders.READ_REPORT, Mms.READ_REPORT); - OCTET_COLUMN_NAME_MAP.put(PduHeaders.READ_STATUS, Mms.READ_STATUS); - OCTET_COLUMN_NAME_MAP.put(PduHeaders.REPORT_ALLOWED, Mms.REPORT_ALLOWED); - OCTET_COLUMN_NAME_MAP.put(PduHeaders.RETRIEVE_STATUS, Mms.RETRIEVE_STATUS); - OCTET_COLUMN_NAME_MAP.put(PduHeaders.STATUS, Mms.STATUS); - - // Long field code -> column index/name map. - LONG_COLUMN_INDEX_MAP = new HashMap(); - LONG_COLUMN_INDEX_MAP.put(PduHeaders.DATE, PDU_COLUMN_DATE); - LONG_COLUMN_INDEX_MAP.put(PduHeaders.DELIVERY_TIME, PDU_COLUMN_DELIVERY_TIME); - LONG_COLUMN_INDEX_MAP.put(PduHeaders.EXPIRY, PDU_COLUMN_EXPIRY); - LONG_COLUMN_INDEX_MAP.put(PduHeaders.MESSAGE_SIZE, PDU_COLUMN_MESSAGE_SIZE); - - LONG_COLUMN_NAME_MAP = new HashMap(); - LONG_COLUMN_NAME_MAP.put(PduHeaders.DATE, Mms.DATE); - LONG_COLUMN_NAME_MAP.put(PduHeaders.DELIVERY_TIME, Mms.DELIVERY_TIME); - LONG_COLUMN_NAME_MAP.put(PduHeaders.EXPIRY, Mms.EXPIRY); - LONG_COLUMN_NAME_MAP.put(PduHeaders.MESSAGE_SIZE, Mms.MESSAGE_SIZE); - - PDU_CACHE_INSTANCE = PduCache.getInstance(); - } - - private final Context mContext; - private final ContentResolver mContentResolver; - private final DrmManagerClient mDrmManagerClient; - - private PduPersister(Context context) { - mContext = context; - mContentResolver = context.getContentResolver(); - mDrmManagerClient = new DrmManagerClient(context); - } - - /** Get(or create if not exist) an instance of PduPersister */ - public static PduPersister getPduPersister(Context context) { - if ((sPersister == null) || !context.equals(sPersister.mContext)) { - sPersister = new PduPersister(context); - } - - return sPersister; - } - - private void setEncodedStringValueToHeaders( - Cursor c, int columnIndex, - PduHeaders headers, int mapColumn) { - String s = c.getString(columnIndex); - if ((s != null) && (s.length() > 0)) { - int charsetColumnIndex = CHARSET_COLUMN_INDEX_MAP.get(mapColumn); - int charset = c.getInt(charsetColumnIndex); - EncodedStringValue value = new EncodedStringValue( - charset, getBytes(s)); - headers.setEncodedStringValue(value, mapColumn); - } - } - - private void setTextStringToHeaders( - Cursor c, int columnIndex, - PduHeaders headers, int mapColumn) { - String s = c.getString(columnIndex); - if (s != null) { - headers.setTextString(getBytes(s), mapColumn); - } - } - - private void setOctetToHeaders( - Cursor c, int columnIndex, - PduHeaders headers, int mapColumn) throws InvalidHeaderValueException { - if (!c.isNull(columnIndex)) { - int b = c.getInt(columnIndex); - headers.setOctet(b, mapColumn); - } - } - - private void setLongToHeaders( - Cursor c, int columnIndex, - PduHeaders headers, int mapColumn) { - if (!c.isNull(columnIndex)) { - long l = c.getLong(columnIndex); - headers.setLongInteger(l, mapColumn); - } - } - - private Integer getIntegerFromPartColumn(Cursor c, int columnIndex) { - if (!c.isNull(columnIndex)) { - return c.getInt(columnIndex); - } - return null; - } - - private byte[] getByteArrayFromPartColumn(Cursor c, int columnIndex) { - if (!c.isNull(columnIndex)) { - return getBytes(c.getString(columnIndex)); - } - return null; - } - - private PduPart[] loadParts(long msgId) throws MmsException { - Cursor c = SqliteWrapper.query(mContext, mContentResolver, - Uri.parse("content://mms/" + msgId + "/part"), - PART_PROJECTION, null, null, null); - - PduPart[] parts = null; - - try { - if ((c == null) || (c.getCount() == 0)) { - if (LOCAL_LOGV) { - Log.v(TAG, "loadParts(" + msgId + "): no part to load."); - } - return null; - } - - int partCount = c.getCount(); - int partIdx = 0; - parts = new PduPart[partCount]; - while (c.moveToNext()) { - PduPart part = new PduPart(); - Integer charset = getIntegerFromPartColumn( - c, PART_COLUMN_CHARSET); - if (charset != null) { - part.setCharset(charset); - } - - byte[] contentDisposition = getByteArrayFromPartColumn( - c, PART_COLUMN_CONTENT_DISPOSITION); - if (contentDisposition != null) { - part.setContentDisposition(contentDisposition); - } - - byte[] contentId = getByteArrayFromPartColumn( - c, PART_COLUMN_CONTENT_ID); - if (contentId != null) { - part.setContentId(contentId); - } - - byte[] contentLocation = getByteArrayFromPartColumn( - c, PART_COLUMN_CONTENT_LOCATION); - if (contentLocation != null) { - part.setContentLocation(contentLocation); - } - - byte[] contentType = getByteArrayFromPartColumn( - c, PART_COLUMN_CONTENT_TYPE); - if (contentType != null) { - part.setContentType(contentType); - } else { - throw new MmsException("Content-Type must be set."); - } - - byte[] fileName = getByteArrayFromPartColumn( - c, PART_COLUMN_FILENAME); - if (fileName != null) { - part.setFilename(fileName); - } - - byte[] name = getByteArrayFromPartColumn( - c, PART_COLUMN_NAME); - if (name != null) { - part.setName(name); - } - - // Construct a Uri for this part. - long partId = c.getLong(PART_COLUMN_ID); - Uri partURI = Uri.parse("content://mms/part/" + partId); - part.setDataUri(partURI); - - // For images/audio/video, we won't keep their data in Part - // because their renderer accept Uri as source. - String type = toIsoString(contentType); - if (!ContentType.isImageType(type) - && !ContentType.isAudioType(type) - && !ContentType.isVideoType(type)) { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - InputStream is = null; - - // Store simple string values directly in the database instead of an - // external file. This makes the text searchable and retrieval slightly - // faster. - if (ContentType.TEXT_PLAIN.equals(type) || ContentType.APP_SMIL.equals(type) - || ContentType.TEXT_HTML.equals(type)) { - String text = c.getString(PART_COLUMN_TEXT); - byte [] blob = new EncodedStringValue(text != null ? text : "") - .getTextString(); - baos.write(blob, 0, blob.length); - } else { - - try { - is = mContentResolver.openInputStream(partURI); - - byte[] buffer = new byte[256]; - int len = is.read(buffer); - while (len >= 0) { - baos.write(buffer, 0, len); - len = is.read(buffer); - } - } catch (IOException e) { - Log.e(TAG, "Failed to load part data", e); - c.close(); - throw new MmsException(e); - } finally { - if (is != null) { - try { - is.close(); - } catch (IOException e) { - Log.e(TAG, "Failed to close stream", e); - } // Ignore - } - } - } - part.setData(baos.toByteArray()); - } - parts[partIdx++] = part; - } - } finally { - if (c != null) { - c.close(); - } - } - - return parts; - } - - private void loadAddress(long msgId, PduHeaders headers) { - Cursor c = SqliteWrapper.query(mContext, mContentResolver, - Uri.parse("content://mms/" + msgId + "/addr"), - new String[] { Addr.ADDRESS, Addr.CHARSET, Addr.TYPE }, - null, null, null); - - if (c != null) { - try { - while (c.moveToNext()) { - String addr = c.getString(0); - if (!TextUtils.isEmpty(addr)) { - int addrType = c.getInt(2); - switch (addrType) { - case PduHeaders.FROM: - headers.setEncodedStringValue( - new EncodedStringValue(c.getInt(1), getBytes(addr)), - addrType); - break; - case PduHeaders.TO: - case PduHeaders.CC: - case PduHeaders.BCC: - headers.appendEncodedStringValue( - new EncodedStringValue(c.getInt(1), getBytes(addr)), - addrType); - break; - default: - Log.e(TAG, "Unknown address type: " + addrType); - break; - } - } - } - } finally { - c.close(); - } - } - } - - /** - * Load a PDU from storage by given Uri. - * - * @param uri The Uri of the PDU to be loaded. - * @return A generic PDU object, it may be cast to dedicated PDU. - * @throws MmsException Failed to load some fields of a PDU. - */ - public GenericPdu load(Uri uri) throws MmsException { - GenericPdu pdu = null; - PduCacheEntry cacheEntry = null; - int msgBox = 0; - long threadId = -1; - try { - synchronized(PDU_CACHE_INSTANCE) { - if (PDU_CACHE_INSTANCE.isUpdating(uri)) { - if (LOCAL_LOGV) { - Log.v(TAG, "load: " + uri + " blocked by isUpdating()"); - } - try { - PDU_CACHE_INSTANCE.wait(); - } catch (InterruptedException e) { - Log.e(TAG, "load: ", e); - } - cacheEntry = PDU_CACHE_INSTANCE.get(uri); - if (cacheEntry != null) { - return cacheEntry.getPdu(); - } - } - // Tell the cache to indicate to other callers that this item - // is currently being updated. - PDU_CACHE_INSTANCE.setUpdating(uri, true); - } - - Cursor c = SqliteWrapper.query(mContext, mContentResolver, uri, - PDU_PROJECTION, null, null, null); - PduHeaders headers = new PduHeaders(); - Set> set; - long msgId = ContentUris.parseId(uri); - - try { - if ((c == null) || (c.getCount() != 1) || !c.moveToFirst()) { - throw new MmsException("Bad uri: " + uri); - } - - msgBox = c.getInt(PDU_COLUMN_MESSAGE_BOX); - threadId = c.getLong(PDU_COLUMN_THREAD_ID); - - set = ENCODED_STRING_COLUMN_INDEX_MAP.entrySet(); - for (Entry e : set) { - setEncodedStringValueToHeaders( - c, e.getValue(), headers, e.getKey()); - } - - set = TEXT_STRING_COLUMN_INDEX_MAP.entrySet(); - for (Entry e : set) { - setTextStringToHeaders( - c, e.getValue(), headers, e.getKey()); - } - - set = OCTET_COLUMN_INDEX_MAP.entrySet(); - for (Entry e : set) { - setOctetToHeaders( - c, e.getValue(), headers, e.getKey()); - } - - set = LONG_COLUMN_INDEX_MAP.entrySet(); - for (Entry e : set) { - setLongToHeaders( - c, e.getValue(), headers, e.getKey()); - } - } finally { - if (c != null) { - c.close(); - } - } - - // Check whether 'msgId' has been assigned a valid value. - if (msgId == -1L) { - throw new MmsException("Error! ID of the message: -1."); - } - - // Load address information of the MM. - loadAddress(msgId, headers); - - int msgType = headers.getOctet(PduHeaders.MESSAGE_TYPE); - PduBody body = new PduBody(); - - // For PDU which type is M_retrieve.conf or Send.req, we should - // load multiparts and put them into the body of the PDU. - if ((msgType == PduHeaders.MESSAGE_TYPE_RETRIEVE_CONF) - || (msgType == PduHeaders.MESSAGE_TYPE_SEND_REQ)) { - PduPart[] parts = loadParts(msgId); - if (parts != null) { - int partsNum = parts.length; - for (int i = 0; i < partsNum; i++) { - body.addPart(parts[i]); - } - } - } - - switch (msgType) { - case PduHeaders.MESSAGE_TYPE_NOTIFICATION_IND: - pdu = new NotificationInd(headers); - break; - case PduHeaders.MESSAGE_TYPE_DELIVERY_IND: - pdu = new DeliveryInd(headers); - break; - case PduHeaders.MESSAGE_TYPE_READ_ORIG_IND: - pdu = new ReadOrigInd(headers); - break; - case PduHeaders.MESSAGE_TYPE_RETRIEVE_CONF: - pdu = new RetrieveConf(headers, body); - break; - case PduHeaders.MESSAGE_TYPE_SEND_REQ: - pdu = new SendReq(headers, body); - break; - case PduHeaders.MESSAGE_TYPE_ACKNOWLEDGE_IND: - pdu = new AcknowledgeInd(headers); - break; - case PduHeaders.MESSAGE_TYPE_NOTIFYRESP_IND: - pdu = new NotifyRespInd(headers); - break; - case PduHeaders.MESSAGE_TYPE_READ_REC_IND: - pdu = new ReadRecInd(headers); - break; - case PduHeaders.MESSAGE_TYPE_SEND_CONF: - case PduHeaders.MESSAGE_TYPE_FORWARD_REQ: - case PduHeaders.MESSAGE_TYPE_FORWARD_CONF: - case PduHeaders.MESSAGE_TYPE_MBOX_STORE_REQ: - case PduHeaders.MESSAGE_TYPE_MBOX_STORE_CONF: - case PduHeaders.MESSAGE_TYPE_MBOX_VIEW_REQ: - case PduHeaders.MESSAGE_TYPE_MBOX_VIEW_CONF: - case PduHeaders.MESSAGE_TYPE_MBOX_UPLOAD_REQ: - case PduHeaders.MESSAGE_TYPE_MBOX_UPLOAD_CONF: - case PduHeaders.MESSAGE_TYPE_MBOX_DELETE_REQ: - case PduHeaders.MESSAGE_TYPE_MBOX_DELETE_CONF: - case PduHeaders.MESSAGE_TYPE_MBOX_DESCR: - case PduHeaders.MESSAGE_TYPE_DELETE_REQ: - case PduHeaders.MESSAGE_TYPE_DELETE_CONF: - case PduHeaders.MESSAGE_TYPE_CANCEL_REQ: - case PduHeaders.MESSAGE_TYPE_CANCEL_CONF: - throw new MmsException( - "Unsupported PDU type: " + Integer.toHexString(msgType)); - - default: - throw new MmsException( - "Unrecognized PDU type: " + Integer.toHexString(msgType)); - } - } finally { - synchronized(PDU_CACHE_INSTANCE) { - if (pdu != null) { - assert(PDU_CACHE_INSTANCE.get(uri) == null); - // Update the cache entry with the real info - cacheEntry = new PduCacheEntry(pdu, msgBox, threadId); - PDU_CACHE_INSTANCE.put(uri, cacheEntry); - } - PDU_CACHE_INSTANCE.setUpdating(uri, false); - PDU_CACHE_INSTANCE.notifyAll(); // tell anybody waiting on this entry to go ahead - } - } - return pdu; - } - - private void persistAddress( - long msgId, int type, EncodedStringValue[] array) { - ContentValues values = new ContentValues(3); - - for (EncodedStringValue addr : array) { - values.clear(); // Clear all values first. - values.put(Addr.ADDRESS, toIsoString(addr.getTextString())); - values.put(Addr.CHARSET, addr.getCharacterSet()); - values.put(Addr.TYPE, type); - - Uri uri = Uri.parse("content://mms/" + msgId + "/addr"); - SqliteWrapper.insert(mContext, mContentResolver, uri, values); - } - } - - public Uri persistPart(PduPart part, long msgId) - throws MmsException { - Uri uri = Uri.parse("content://mms/" + msgId + "/part"); - ContentValues values = new ContentValues(8); - - int charset = part.getCharset(); - if (charset != 0 ) { - values.put(Part.CHARSET, charset); - } - - String contentType = null; - if (part.getContentType() != null) { - contentType = toIsoString(part.getContentType()); - - // There is no "image/jpg" in Android (and it's an invalid mimetype). - // Change it to "image/jpeg" - if (ContentType.IMAGE_JPG.equals(contentType)) { - contentType = ContentType.IMAGE_JPEG; - } - - values.put(Part.CONTENT_TYPE, contentType); - // To ensure the SMIL part is always the first part. - if (ContentType.APP_SMIL.equals(contentType)) { - values.put(Part.SEQ, -1); - } - } else { - throw new MmsException("MIME type of the part must be set."); - } - - if (part.getFilename() != null) { - String fileName = new String(part.getFilename()); - values.put(Part.FILENAME, fileName); - } - - if (part.getName() != null) { - String name = new String(part.getName()); - values.put(Part.NAME, name); - } - - Object value = null; - if (part.getContentDisposition() != null) { - value = toIsoString(part.getContentDisposition()); - values.put(Part.CONTENT_DISPOSITION, (String) value); - } - - if (part.getContentId() != null) { - value = toIsoString(part.getContentId()); - values.put(Part.CONTENT_ID, (String) value); - } - - if (part.getContentLocation() != null) { - value = toIsoString(part.getContentLocation()); - values.put(Part.CONTENT_LOCATION, (String) value); - } - - Uri res = SqliteWrapper.insert(mContext, mContentResolver, uri, values); - if (res == null) { - throw new MmsException("Failed to persist part, return null."); - } - - persistData(part, res, contentType); - // After successfully store the data, we should update - // the dataUri of the part. - part.setDataUri(res); - - return res; - } - - /** - * Save data of the part into storage. The source data may be given - * by a byte[] or a Uri. If it's a byte[], directly save it - * into storage, otherwise load source data from the dataUri and then - * save it. If the data is an image, we may scale down it according - * to user preference. - * - * @param part The PDU part which contains data to be saved. - * @param uri The URI of the part. - * @param contentType The MIME type of the part. - * @throws MmsException Cannot find source data or error occurred - * while saving the data. - */ - private void persistData(PduPart part, Uri uri, - String contentType) - throws MmsException { - OutputStream os = null; - InputStream is = null; - DrmConvertSession drmConvertSession = null; - Uri dataUri = null; - String path = null; - - try { - byte[] data = part.getData(); - if (ContentType.TEXT_PLAIN.equals(contentType) - || ContentType.APP_SMIL.equals(contentType) - || ContentType.TEXT_HTML.equals(contentType)) { - ContentValues cv = new ContentValues(); - cv.put(Telephony.Mms.Part.TEXT, new EncodedStringValue(data).getString()); - if (mContentResolver.update(uri, cv, null, null) != 1) { - throw new MmsException("unable to update " + uri.toString()); - } - } else { - boolean isDrm = DownloadDrmHelper.isDrmConvertNeeded(contentType); - if (isDrm) { - if (uri != null) { - try { - path = convertUriToPath(mContext, uri); - if (LOCAL_LOGV) { - Log.v(TAG, "drm uri: " + uri + " path: " + path); - } - File f = new File(path); - long len = f.length(); - if (LOCAL_LOGV) { - Log.v(TAG, "drm path: " + path + " len: " + len); - } - if (len > 0) { - // we're not going to re-persist and re-encrypt an already - // converted drm file - return; - } - } catch (Exception e) { - Log.e(TAG, "Can't get file info for: " + part.getDataUri(), e); - } - } - // We haven't converted the file yet, start the conversion - drmConvertSession = DrmConvertSession.open(mContext, contentType); - if (drmConvertSession == null) { - throw new MmsException("Mimetype " + contentType + - " can not be converted."); - } - } - os = mContentResolver.openOutputStream(uri); - if (data == null) { - dataUri = part.getDataUri(); - if ((dataUri == null) || (dataUri == uri)) { - Log.w(TAG, "Can't find data for this part."); - return; - } - is = mContentResolver.openInputStream(dataUri); - - if (LOCAL_LOGV) { - Log.v(TAG, "Saving data to: " + uri); - } - - byte[] buffer = new byte[8192]; - for (int len = 0; (len = is.read(buffer)) != -1; ) { - if (!isDrm) { - os.write(buffer, 0, len); - } else { - byte[] convertedData = drmConvertSession.convert(buffer, len); - if (convertedData != null) { - os.write(convertedData, 0, convertedData.length); - } else { - throw new MmsException("Error converting drm data."); - } - } - } - } else { - if (LOCAL_LOGV) { - Log.v(TAG, "Saving data to: " + uri); - } - if (!isDrm) { - os.write(data); - } else { - dataUri = uri; - byte[] convertedData = drmConvertSession.convert(data, data.length); - if (convertedData != null) { - os.write(convertedData, 0, convertedData.length); - } else { - throw new MmsException("Error converting drm data."); - } - } - } - } - } catch (FileNotFoundException e) { - Log.e(TAG, "Failed to open Input/Output stream.", e); - throw new MmsException(e); - } catch (IOException e) { - Log.e(TAG, "Failed to read/write data.", e); - throw new MmsException(e); - } finally { - if (os != null) { - try { - os.close(); - } catch (IOException e) { - Log.e(TAG, "IOException while closing: " + os, e); - } // Ignore - } - if (is != null) { - try { - is.close(); - } catch (IOException e) { - Log.e(TAG, "IOException while closing: " + is, e); - } // Ignore - } - if (drmConvertSession != null) { - drmConvertSession.close(path); - - // Reset the permissions on the encrypted part file so everyone has only read - // permission. - File f = new File(path); - ContentValues values = new ContentValues(0); - SqliteWrapper.update(mContext, mContentResolver, - Uri.parse("content://mms/resetFilePerm/" + f.getName()), - values, null, null); - } - } - } - - /** - * This method expects uri in the following format - * content://media// (or) - * file://sdcard/test.mp4 - * http://test.com/test.mp4 - * - * Here shall be "video" or "audio" or "images" - * the index of the content in given table - */ - static public String convertUriToPath(Context context, Uri uri) { - String path = null; - if (null != uri) { - String scheme = uri.getScheme(); - if (null == scheme || scheme.equals("") || - scheme.equals(ContentResolver.SCHEME_FILE)) { - path = uri.getPath(); - - } else if (scheme.equals("http")) { - path = uri.toString(); - - } else if (scheme.equals(ContentResolver.SCHEME_CONTENT)) { - String[] projection = new String[] {MediaStore.MediaColumns.DATA}; - Cursor cursor = null; - try { - cursor = context.getContentResolver().query(uri, projection, null, - null, null); - if (null == cursor || 0 == cursor.getCount() || !cursor.moveToFirst()) { - throw new IllegalArgumentException("Given Uri could not be found" + - " in media store"); - } - int pathIndex = cursor.getColumnIndexOrThrow(MediaStore.MediaColumns.DATA); - path = cursor.getString(pathIndex); - } catch (SQLiteException e) { - throw new IllegalArgumentException("Given Uri is not formatted in a way " + - "so that it can be found in media store."); - } finally { - if (null != cursor) { - cursor.close(); - } - } - } else { - throw new IllegalArgumentException("Given Uri scheme is not supported"); - } - } - return path; - } - - private void updateAddress( - long msgId, int type, EncodedStringValue[] array) { - // Delete old address information and then insert new ones. - SqliteWrapper.delete(mContext, mContentResolver, - Uri.parse("content://mms/" + msgId + "/addr"), - Addr.TYPE + "=" + type, null); - - persistAddress(msgId, type, array); - } - - /** - * Update headers of a SendReq. - * - * @param uri The PDU which need to be updated. - * @param pdu New headers. - * @throws MmsException Bad URI or updating failed. - */ - public void updateHeaders(Uri uri, SendReq sendReq) { - synchronized(PDU_CACHE_INSTANCE) { - // If the cache item is getting updated, wait until it's done updating before - // purging it. - if (PDU_CACHE_INSTANCE.isUpdating(uri)) { - if (LOCAL_LOGV) { - Log.v(TAG, "updateHeaders: " + uri + " blocked by isUpdating()"); - } - try { - PDU_CACHE_INSTANCE.wait(); - } catch (InterruptedException e) { - Log.e(TAG, "updateHeaders: ", e); - } - } - } - PDU_CACHE_INSTANCE.purge(uri); - - ContentValues values = new ContentValues(10); - byte[] contentType = sendReq.getContentType(); - if (contentType != null) { - values.put(Mms.CONTENT_TYPE, toIsoString(contentType)); - } - - long date = sendReq.getDate(); - if (date != -1) { - values.put(Mms.DATE, date); - } - - int deliveryReport = sendReq.getDeliveryReport(); - if (deliveryReport != 0) { - values.put(Mms.DELIVERY_REPORT, deliveryReport); - } - - long expiry = sendReq.getExpiry(); - if (expiry != -1) { - values.put(Mms.EXPIRY, expiry); - } - - byte[] msgClass = sendReq.getMessageClass(); - if (msgClass != null) { - values.put(Mms.MESSAGE_CLASS, toIsoString(msgClass)); - } - - int priority = sendReq.getPriority(); - if (priority != 0) { - values.put(Mms.PRIORITY, priority); - } - - int readReport = sendReq.getReadReport(); - if (readReport != 0) { - values.put(Mms.READ_REPORT, readReport); - } - - byte[] transId = sendReq.getTransactionId(); - if (transId != null) { - values.put(Mms.TRANSACTION_ID, toIsoString(transId)); - } - - EncodedStringValue subject = sendReq.getSubject(); - if (subject != null) { - values.put(Mms.SUBJECT, toIsoString(subject.getTextString())); - values.put(Mms.SUBJECT_CHARSET, subject.getCharacterSet()); - } else { - values.put(Mms.SUBJECT, ""); - } - - long messageSize = sendReq.getMessageSize(); - if (messageSize > 0) { - values.put(Mms.MESSAGE_SIZE, messageSize); - } - - PduHeaders headers = sendReq.getPduHeaders(); - HashSet recipients = new HashSet(); - for (int addrType : ADDRESS_FIELDS) { - EncodedStringValue[] array = null; - if (addrType == PduHeaders.FROM) { - EncodedStringValue v = headers.getEncodedStringValue(addrType); - if (v != null) { - array = new EncodedStringValue[1]; - array[0] = v; - } - } else { - array = headers.getEncodedStringValues(addrType); - } - - if (array != null) { - long msgId = ContentUris.parseId(uri); - updateAddress(msgId, addrType, array); - if (addrType == PduHeaders.TO) { - for (EncodedStringValue v : array) { - if (v != null) { - recipients.add(v.getString()); - } - } - } - } - } - if (!recipients.isEmpty()) { - long threadId = Threads.getOrCreateThreadId(mContext, recipients); - values.put(Mms.THREAD_ID, threadId); - } - - SqliteWrapper.update(mContext, mContentResolver, uri, values, null, null); - } - - private void updatePart(Uri uri, PduPart part) throws MmsException { - ContentValues values = new ContentValues(7); - - int charset = part.getCharset(); - if (charset != 0 ) { - values.put(Part.CHARSET, charset); - } - - String contentType = null; - if (part.getContentType() != null) { - contentType = toIsoString(part.getContentType()); - values.put(Part.CONTENT_TYPE, contentType); - } else { - throw new MmsException("MIME type of the part must be set."); - } - - if (part.getFilename() != null) { - String fileName = new String(part.getFilename()); - values.put(Part.FILENAME, fileName); - } - - if (part.getName() != null) { - String name = new String(part.getName()); - values.put(Part.NAME, name); - } - - Object value = null; - if (part.getContentDisposition() != null) { - value = toIsoString(part.getContentDisposition()); - values.put(Part.CONTENT_DISPOSITION, (String) value); - } - - if (part.getContentId() != null) { - value = toIsoString(part.getContentId()); - values.put(Part.CONTENT_ID, (String) value); - } - - if (part.getContentLocation() != null) { - value = toIsoString(part.getContentLocation()); - values.put(Part.CONTENT_LOCATION, (String) value); - } - - SqliteWrapper.update(mContext, mContentResolver, uri, values, null, null); - - // Only update the data when: - // 1. New binary data supplied or - // 2. The Uri of the part is different from the current one. - if ((part.getData() != null) - || (uri != part.getDataUri())) { - persistData(part, uri, contentType); - } - } - - /** - * Update all parts of a PDU. - * - * @param uri The PDU which need to be updated. - * @param body New message body of the PDU. - * @throws MmsException Bad URI or updating failed. - */ - public void updateParts(Uri uri, PduBody body) - throws MmsException { - try { - PduCacheEntry cacheEntry; - synchronized(PDU_CACHE_INSTANCE) { - if (PDU_CACHE_INSTANCE.isUpdating(uri)) { - if (LOCAL_LOGV) { - Log.v(TAG, "updateParts: " + uri + " blocked by isUpdating()"); - } - try { - PDU_CACHE_INSTANCE.wait(); - } catch (InterruptedException e) { - Log.e(TAG, "updateParts: ", e); - } - cacheEntry = PDU_CACHE_INSTANCE.get(uri); - if (cacheEntry != null) { - ((MultimediaMessagePdu) cacheEntry.getPdu()).setBody(body); - } - } - // Tell the cache to indicate to other callers that this item - // is currently being updated. - PDU_CACHE_INSTANCE.setUpdating(uri, true); - } - - ArrayList toBeCreated = new ArrayList(); - HashMap toBeUpdated = new HashMap(); - - int partsNum = body.getPartsNum(); - StringBuilder filter = new StringBuilder().append('('); - for (int i = 0; i < partsNum; i++) { - PduPart part = body.getPart(i); - Uri partUri = part.getDataUri(); - if ((partUri == null) || !partUri.getAuthority().startsWith("mms")) { - toBeCreated.add(part); - } else { - toBeUpdated.put(partUri, part); - - // Don't use 'i > 0' to determine whether we should append - // 'AND' since 'i = 0' may be skipped in another branch. - if (filter.length() > 1) { - filter.append(" AND "); - } - - filter.append(Part._ID); - filter.append("!="); - DatabaseUtils.appendEscapedSQLString(filter, partUri.getLastPathSegment()); - } - } - filter.append(')'); - - long msgId = ContentUris.parseId(uri); - - // Remove the parts which doesn't exist anymore. - SqliteWrapper.delete(mContext, mContentResolver, - Uri.parse(Mms.CONTENT_URI + "/" + msgId + "/part"), - filter.length() > 2 ? filter.toString() : null, null); - - // Create new parts which didn't exist before. - for (PduPart part : toBeCreated) { - persistPart(part, msgId); - } - - // Update the modified parts. - for (Map.Entry e : toBeUpdated.entrySet()) { - updatePart(e.getKey(), e.getValue()); - } - } finally { - synchronized(PDU_CACHE_INSTANCE) { - PDU_CACHE_INSTANCE.setUpdating(uri, false); - PDU_CACHE_INSTANCE.notifyAll(); - } - } - } - - /** - * Persist a PDU object to specific location in the storage. - * - * @param pdu The PDU object to be stored. - * @param uri Where to store the given PDU object. - * @return A Uri which can be used to access the stored PDU. - */ - public Uri persist(GenericPdu pdu, Uri uri) throws MmsException { - if (uri == null) { - throw new MmsException("Uri may not be null."); - } - long msgId = -1; - try { - msgId = ContentUris.parseId(uri); - } catch (NumberFormatException e) { - // the uri ends with "inbox" or something else like that - } - boolean existingUri = msgId != -1; - - if (!existingUri && MESSAGE_BOX_MAP.get(uri) == null) { - throw new MmsException( - "Bad destination, must be one of " - + "content://mms/inbox, content://mms/sent, " - + "content://mms/drafts, content://mms/outbox, " - + "content://mms/temp."); - } - synchronized(PDU_CACHE_INSTANCE) { - // If the cache item is getting updated, wait until it's done updating before - // purging it. - if (PDU_CACHE_INSTANCE.isUpdating(uri)) { - if (LOCAL_LOGV) { - Log.v(TAG, "persist: " + uri + " blocked by isUpdating()"); - } - try { - PDU_CACHE_INSTANCE.wait(); - } catch (InterruptedException e) { - Log.e(TAG, "persist1: ", e); - } - } - } - PDU_CACHE_INSTANCE.purge(uri); - - PduHeaders header = pdu.getPduHeaders(); - PduBody body = null; - ContentValues values = new ContentValues(); - Set> set; - - set = ENCODED_STRING_COLUMN_NAME_MAP.entrySet(); - for (Entry e : set) { - int field = e.getKey(); - EncodedStringValue encodedString = header.getEncodedStringValue(field); - if (encodedString != null) { - String charsetColumn = CHARSET_COLUMN_NAME_MAP.get(field); - values.put(e.getValue(), toIsoString(encodedString.getTextString())); - values.put(charsetColumn, encodedString.getCharacterSet()); - } - } - - set = TEXT_STRING_COLUMN_NAME_MAP.entrySet(); - for (Entry e : set){ - byte[] text = header.getTextString(e.getKey()); - if (text != null) { - values.put(e.getValue(), toIsoString(text)); - } - } - - set = OCTET_COLUMN_NAME_MAP.entrySet(); - for (Entry e : set){ - int b = header.getOctet(e.getKey()); - if (b != 0) { - values.put(e.getValue(), b); - } - } - - set = LONG_COLUMN_NAME_MAP.entrySet(); - for (Entry e : set){ - long l = header.getLongInteger(e.getKey()); - if (l != -1L) { - values.put(e.getValue(), l); - } - } - - HashMap addressMap = - new HashMap(ADDRESS_FIELDS.length); - // Save address information. - for (int addrType : ADDRESS_FIELDS) { - EncodedStringValue[] array = null; - if (addrType == PduHeaders.FROM) { - EncodedStringValue v = header.getEncodedStringValue(addrType); - if (v != null) { - array = new EncodedStringValue[1]; - array[0] = v; - } - } else { - array = header.getEncodedStringValues(addrType); - } - addressMap.put(addrType, array); - } - - HashSet recipients = new HashSet(); - int msgType = pdu.getMessageType(); - // Here we only allocate thread ID for M-Notification.ind, - // M-Retrieve.conf and M-Send.req. - // Some of other PDU types may be allocated a thread ID outside - // this scope. - if ((msgType == PduHeaders.MESSAGE_TYPE_NOTIFICATION_IND) - || (msgType == PduHeaders.MESSAGE_TYPE_RETRIEVE_CONF) - || (msgType == PduHeaders.MESSAGE_TYPE_SEND_REQ)) { - EncodedStringValue[] array = null; - switch (msgType) { - case PduHeaders.MESSAGE_TYPE_NOTIFICATION_IND: - case PduHeaders.MESSAGE_TYPE_RETRIEVE_CONF: - array = addressMap.get(PduHeaders.FROM); - break; - case PduHeaders.MESSAGE_TYPE_SEND_REQ: - array = addressMap.get(PduHeaders.TO); - break; - } - - if (array != null) { - for (EncodedStringValue v : array) { - if (v != null) { - recipients.add(v.getString()); - } - } - } - if (!recipients.isEmpty()) { - long threadId = Threads.getOrCreateThreadId(mContext, recipients); - values.put(Mms.THREAD_ID, threadId); - } - } - - // Save parts first to avoid inconsistent message is loaded - // while saving the parts. - long dummyId = System.currentTimeMillis(); // Dummy ID of the msg. - // Get body if the PDU is a RetrieveConf or SendReq. - if (pdu instanceof MultimediaMessagePdu) { - body = ((MultimediaMessagePdu) pdu).getBody(); - // Start saving parts if necessary. - if (body != null) { - int partsNum = body.getPartsNum(); - for (int i = 0; i < partsNum; i++) { - PduPart part = body.getPart(i); - persistPart(part, dummyId); - } - } - } - - Uri res = null; - if (existingUri) { - res = uri; - SqliteWrapper.update(mContext, mContentResolver, res, values, null, null); - } else { - res = SqliteWrapper.insert(mContext, mContentResolver, uri, values); - if (res == null) { - throw new MmsException("persist() failed: return null."); - } - // Get the real ID of the PDU and update all parts which were - // saved with the dummy ID. - msgId = ContentUris.parseId(res); - } - - values = new ContentValues(1); - values.put(Part.MSG_ID, msgId); - SqliteWrapper.update(mContext, mContentResolver, - Uri.parse("content://mms/" + dummyId + "/part"), - values, null, null); - // We should return the longest URI of the persisted PDU, for - // example, if input URI is "content://mms/inbox" and the _ID of - // persisted PDU is '8', we should return "content://mms/inbox/8" - // instead of "content://mms/8". - // FIXME: Should the MmsProvider be responsible for this??? - if (!existingUri) { - res = Uri.parse(uri + "/" + msgId); - } - - // Save address information. - for (int addrType : ADDRESS_FIELDS) { - EncodedStringValue[] array = addressMap.get(addrType); - if (array != null) { - persistAddress(msgId, addrType, array); - } - } - - return res; - } - - /** - * Move a PDU object from one location to another. - * - * @param from Specify the PDU object to be moved. - * @param to The destination location, should be one of the following: - * "content://mms/inbox", "content://mms/sent", - * "content://mms/drafts", "content://mms/outbox", - * "content://mms/trash". - * @return New Uri of the moved PDU. - * @throws MmsException Error occurred while moving the message. - */ - public Uri move(Uri from, Uri to) throws MmsException { - // Check whether the 'msgId' has been assigned a valid value. - long msgId = ContentUris.parseId(from); - if (msgId == -1L) { - throw new MmsException("Error! ID of the message: -1."); - } - - // Get corresponding int value of destination box. - Integer msgBox = MESSAGE_BOX_MAP.get(to); - if (msgBox == null) { - throw new MmsException( - "Bad destination, must be one of " - + "content://mms/inbox, content://mms/sent, " - + "content://mms/drafts, content://mms/outbox, " - + "content://mms/temp."); - } - - ContentValues values = new ContentValues(1); - values.put(Mms.MESSAGE_BOX, msgBox); - SqliteWrapper.update(mContext, mContentResolver, from, values, null, null); - return ContentUris.withAppendedId(to, msgId); - } - - /** - * Wrap a byte[] into a String. - */ - public static String toIsoString(byte[] bytes) { - try { - return new String(bytes, CharacterSets.MIMENAME_ISO_8859_1); - } catch (UnsupportedEncodingException e) { - // Impossible to reach here! - Log.e(TAG, "ISO_8859_1 must be supported!", e); - return ""; - } - } - - /** - * Unpack a given String into a byte[]. - */ - public static byte[] getBytes(String data) { - try { - return data.getBytes(CharacterSets.MIMENAME_ISO_8859_1); - } catch (UnsupportedEncodingException e) { - // Impossible to reach here! - Log.e(TAG, "ISO_8859_1 must be supported!", e); - return new byte[0]; - } - } - - /** - * Remove all objects in the temporary path. - */ - public void release() { - Uri uri = Uri.parse(TEMPORARY_DRM_OBJECT_URI); - SqliteWrapper.delete(mContext, mContentResolver, uri, null, null); - } - - /** - * Find all messages to be sent or downloaded before certain time. - */ - public Cursor getPendingMessages(long dueTime) { - Uri.Builder uriBuilder = PendingMessages.CONTENT_URI.buildUpon(); - uriBuilder.appendQueryParameter("protocol", "mms"); - - String selection = PendingMessages.ERROR_TYPE + " < ?" - + " AND " + PendingMessages.DUE_TIME + " <= ?"; - - String[] selectionArgs = new String[] { - String.valueOf(MmsSms.ERR_TYPE_GENERIC_PERMANENT), - String.valueOf(dueTime) - }; - - return SqliteWrapper.query(mContext, mContentResolver, - uriBuilder.build(), null, selection, selectionArgs, - PendingMessages.DUE_TIME); - } -} diff --git a/core/java/com/google/android/mms/pdu/QuotedPrintable.java b/core/java/com/google/android/mms/pdu/QuotedPrintable.java deleted file mode 100644 index a34ed12638915..0000000000000 --- a/core/java/com/google/android/mms/pdu/QuotedPrintable.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (C) 2007 Esmertec AG. - * 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. - */ - -package com.google.android.mms.pdu; - -import java.io.ByteArrayOutputStream; - -public class QuotedPrintable { - private static byte ESCAPE_CHAR = '='; - - /** - * Decodes an array quoted-printable characters into an array of original bytes. - * Escaped characters are converted back to their original representation. - * - *

          - * This function implements a subset of - * quoted-printable encoding specification (rule #1 and rule #2) - * as defined in RFC 1521. - *

          - * - * @param bytes array of quoted-printable characters - * @return array of original bytes, - * null if quoted-printable decoding is unsuccessful. - */ - public static final byte[] decodeQuotedPrintable(byte[] bytes) { - if (bytes == null) { - return null; - } - ByteArrayOutputStream buffer = new ByteArrayOutputStream(); - for (int i = 0; i < bytes.length; i++) { - int b = bytes[i]; - if (b == ESCAPE_CHAR) { - try { - if('\r' == (char)bytes[i + 1] && - '\n' == (char)bytes[i + 2]) { - i += 2; - continue; - } - int u = Character.digit((char) bytes[++i], 16); - int l = Character.digit((char) bytes[++i], 16); - if (u == -1 || l == -1) { - return null; - } - buffer.write((char) ((u << 4) + l)); - } catch (ArrayIndexOutOfBoundsException e) { - return null; - } - } else { - buffer.write(b); - } - } - return buffer.toByteArray(); - } -} diff --git a/core/java/com/google/android/mms/pdu/ReadOrigInd.java b/core/java/com/google/android/mms/pdu/ReadOrigInd.java deleted file mode 100644 index 1bfc0bb3e2581..0000000000000 --- a/core/java/com/google/android/mms/pdu/ReadOrigInd.java +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright (C) 2007 Esmertec AG. - * 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. - */ - -package com.google.android.mms.pdu; - -import com.google.android.mms.InvalidHeaderValueException; - -public class ReadOrigInd extends GenericPdu { - /** - * Empty constructor. - * Since the Pdu corresponding to this class is constructed - * by the Proxy-Relay server, this class is only instantiated - * by the Pdu Parser. - * - * @throws InvalidHeaderValueException if error occurs. - */ - public ReadOrigInd() throws InvalidHeaderValueException { - super(); - setMessageType(PduHeaders.MESSAGE_TYPE_READ_ORIG_IND); - } - - /** - * Constructor with given headers. - * - * @param headers Headers for this PDU. - */ - ReadOrigInd(PduHeaders headers) { - super(headers); - } - - /** - * Get Date value. - * - * @return the value - */ - public long getDate() { - return mPduHeaders.getLongInteger(PduHeaders.DATE); - } - - /** - * Set Date value. - * - * @param value the value - */ - public void setDate(long value) { - mPduHeaders.setLongInteger(value, PduHeaders.DATE); - } - - /** - * Get From value. - * From-value = Value-length - * (Address-present-token Encoded-string-value | Insert-address-token) - * - * @return the value - */ - public EncodedStringValue getFrom() { - return mPduHeaders.getEncodedStringValue(PduHeaders.FROM); - } - - /** - * Set From value. - * - * @param value the value - * @throws NullPointerException if the value is null. - */ - public void setFrom(EncodedStringValue value) { - mPduHeaders.setEncodedStringValue(value, PduHeaders.FROM); - } - - /** - * Get Message-ID value. - * - * @return the value - */ - public byte[] getMessageId() { - return mPduHeaders.getTextString(PduHeaders.MESSAGE_ID); - } - - /** - * Set Message-ID value. - * - * @param value the value - * @throws NullPointerException if the value is null. - */ - public void setMessageId(byte[] value) { - mPduHeaders.setTextString(value, PduHeaders.MESSAGE_ID); - } - - /** - * Get X-MMS-Read-status value. - * - * @return the value - */ - public int getReadStatus() { - return mPduHeaders.getOctet(PduHeaders.READ_STATUS); - } - - /** - * Set X-MMS-Read-status value. - * - * @param value the value - * @throws InvalidHeaderValueException if the value is invalid. - */ - public void setReadStatus(int value) throws InvalidHeaderValueException { - mPduHeaders.setOctet(value, PduHeaders.READ_STATUS); - } - - /** - * Get To value. - * - * @return the value - */ - public EncodedStringValue[] getTo() { - return mPduHeaders.getEncodedStringValues(PduHeaders.TO); - } - - /** - * Set To value. - * - * @param value the value - * @throws NullPointerException if the value is null. - */ - public void setTo(EncodedStringValue[] value) { - mPduHeaders.setEncodedStringValues(value, PduHeaders.TO); - } - - /* - * Optional, not supported header fields: - * - * public byte[] getApplicId() {return null;} - * public void setApplicId(byte[] value) {} - * - * public byte[] getAuxApplicId() {return null;} - * public void getAuxApplicId(byte[] value) {} - * - * public byte[] getReplyApplicId() {return 0x00;} - * public void setReplyApplicId(byte[] value) {} - */ -} diff --git a/core/java/com/google/android/mms/pdu/ReadRecInd.java b/core/java/com/google/android/mms/pdu/ReadRecInd.java deleted file mode 100644 index 880e3ac3ddd43..0000000000000 --- a/core/java/com/google/android/mms/pdu/ReadRecInd.java +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright (C) 2007 Esmertec AG. - * 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. - */ - -package com.google.android.mms.pdu; - -import com.google.android.mms.InvalidHeaderValueException; - -public class ReadRecInd extends GenericPdu { - /** - * Constructor, used when composing a M-ReadRec.ind pdu. - * - * @param from the from value - * @param messageId the message ID value - * @param mmsVersion current viersion of mms - * @param readStatus the read status value - * @param to the to value - * @throws InvalidHeaderValueException if parameters are invalid. - * NullPointerException if messageId or to is null. - */ - public ReadRecInd(EncodedStringValue from, - byte[] messageId, - int mmsVersion, - int readStatus, - EncodedStringValue[] to) throws InvalidHeaderValueException { - super(); - setMessageType(PduHeaders.MESSAGE_TYPE_READ_REC_IND); - setFrom(from); - setMessageId(messageId); - setMmsVersion(mmsVersion); - setTo(to); - setReadStatus(readStatus); - } - - /** - * Constructor with given headers. - * - * @param headers Headers for this PDU. - */ - ReadRecInd(PduHeaders headers) { - super(headers); - } - - /** - * Get Date value. - * - * @return the value - */ - public long getDate() { - return mPduHeaders.getLongInteger(PduHeaders.DATE); - } - - /** - * Set Date value. - * - * @param value the value - */ - public void setDate(long value) { - mPduHeaders.setLongInteger(value, PduHeaders.DATE); - } - - /** - * Get Message-ID value. - * - * @return the value - */ - public byte[] getMessageId() { - return mPduHeaders.getTextString(PduHeaders.MESSAGE_ID); - } - - /** - * Set Message-ID value. - * - * @param value the value - * @throws NullPointerException if the value is null. - */ - public void setMessageId(byte[] value) { - mPduHeaders.setTextString(value, PduHeaders.MESSAGE_ID); - } - - /** - * Get To value. - * - * @return the value - */ - public EncodedStringValue[] getTo() { - return mPduHeaders.getEncodedStringValues(PduHeaders.TO); - } - - /** - * Set To value. - * - * @param value the value - * @throws NullPointerException if the value is null. - */ - public void setTo(EncodedStringValue[] value) { - mPduHeaders.setEncodedStringValues(value, PduHeaders.TO); - } - - /** - * Get X-MMS-Read-status value. - * - * @return the value - */ - public int getReadStatus() { - return mPduHeaders.getOctet(PduHeaders.READ_STATUS); - } - - /** - * Set X-MMS-Read-status value. - * - * @param value the value - * @throws InvalidHeaderValueException if the value is invalid. - */ - public void setReadStatus(int value) throws InvalidHeaderValueException { - mPduHeaders.setOctet(value, PduHeaders.READ_STATUS); - } - - /* - * Optional, not supported header fields: - * - * public byte[] getApplicId() {return null;} - * public void setApplicId(byte[] value) {} - * - * public byte[] getAuxApplicId() {return null;} - * public void getAuxApplicId(byte[] value) {} - * - * public byte[] getReplyApplicId() {return 0x00;} - * public void setReplyApplicId(byte[] value) {} - */ -} diff --git a/core/java/com/google/android/mms/pdu/RetrieveConf.java b/core/java/com/google/android/mms/pdu/RetrieveConf.java deleted file mode 100644 index 98e67c068d986..0000000000000 --- a/core/java/com/google/android/mms/pdu/RetrieveConf.java +++ /dev/null @@ -1,300 +0,0 @@ -/* - * Copyright (C) 2007 Esmertec AG. - * 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. - */ - -package com.google.android.mms.pdu; - -import com.google.android.mms.InvalidHeaderValueException; - -/** - * M-Retrive.conf Pdu. - */ -public class RetrieveConf extends MultimediaMessagePdu { - /** - * Empty constructor. - * Since the Pdu corresponding to this class is constructed - * by the Proxy-Relay server, this class is only instantiated - * by the Pdu Parser. - * - * @throws InvalidHeaderValueException if error occurs. - */ - public RetrieveConf() throws InvalidHeaderValueException { - super(); - setMessageType(PduHeaders.MESSAGE_TYPE_RETRIEVE_CONF); - } - - /** - * Constructor with given headers. - * - * @param headers Headers for this PDU. - */ - RetrieveConf(PduHeaders headers) { - super(headers); - } - - /** - * Constructor with given headers and body - * - * @param headers Headers for this PDU. - * @param body Body of this PDu. - */ - RetrieveConf(PduHeaders headers, PduBody body) { - super(headers, body); - } - - /** - * Get CC value. - * - * @return the value - */ - public EncodedStringValue[] getCc() { - return mPduHeaders.getEncodedStringValues(PduHeaders.CC); - } - - /** - * Add a "CC" value. - * - * @param value the value - * @throws NullPointerException if the value is null. - */ - public void addCc(EncodedStringValue value) { - mPduHeaders.appendEncodedStringValue(value, PduHeaders.CC); - } - - /** - * Get Content-type value. - * - * @return the value - */ - public byte[] getContentType() { - return mPduHeaders.getTextString(PduHeaders.CONTENT_TYPE); - } - - /** - * Set Content-type value. - * - * @param value the value - * @throws NullPointerException if the value is null. - */ - public void setContentType(byte[] value) { - mPduHeaders.setTextString(value, PduHeaders.CONTENT_TYPE); - } - - /** - * Get X-Mms-Delivery-Report value. - * - * @return the value - */ - public int getDeliveryReport() { - return mPduHeaders.getOctet(PduHeaders.DELIVERY_REPORT); - } - - /** - * Set X-Mms-Delivery-Report value. - * - * @param value the value - * @throws InvalidHeaderValueException if the value is invalid. - */ - public void setDeliveryReport(int value) throws InvalidHeaderValueException { - mPduHeaders.setOctet(value, PduHeaders.DELIVERY_REPORT); - } - - /** - * Get From value. - * From-value = Value-length - * (Address-present-token Encoded-string-value | Insert-address-token) - * - * @return the value - */ - public EncodedStringValue getFrom() { - return mPduHeaders.getEncodedStringValue(PduHeaders.FROM); - } - - /** - * Set From value. - * - * @param value the value - * @throws NullPointerException if the value is null. - */ - public void setFrom(EncodedStringValue value) { - mPduHeaders.setEncodedStringValue(value, PduHeaders.FROM); - } - - /** - * Get X-Mms-Message-Class value. - * Message-class-value = Class-identifier | Token-text - * Class-identifier = Personal | Advertisement | Informational | Auto - * - * @return the value - */ - public byte[] getMessageClass() { - return mPduHeaders.getTextString(PduHeaders.MESSAGE_CLASS); - } - - /** - * Set X-Mms-Message-Class value. - * - * @param value the value - * @throws NullPointerException if the value is null. - */ - public void setMessageClass(byte[] value) { - mPduHeaders.setTextString(value, PduHeaders.MESSAGE_CLASS); - } - - /** - * Get Message-ID value. - * - * @return the value - */ - public byte[] getMessageId() { - return mPduHeaders.getTextString(PduHeaders.MESSAGE_ID); - } - - /** - * Set Message-ID value. - * - * @param value the value - * @throws NullPointerException if the value is null. - */ - public void setMessageId(byte[] value) { - mPduHeaders.setTextString(value, PduHeaders.MESSAGE_ID); - } - - /** - * Get X-Mms-Read-Report value. - * - * @return the value - */ - public int getReadReport() { - return mPduHeaders.getOctet(PduHeaders.READ_REPORT); - } - - /** - * Set X-Mms-Read-Report value. - * - * @param value the value - * @throws InvalidHeaderValueException if the value is invalid. - */ - public void setReadReport(int value) throws InvalidHeaderValueException { - mPduHeaders.setOctet(value, PduHeaders.READ_REPORT); - } - - /** - * Get X-Mms-Retrieve-Status value. - * - * @return the value - */ - public int getRetrieveStatus() { - return mPduHeaders.getOctet(PduHeaders.RETRIEVE_STATUS); - } - - /** - * Set X-Mms-Retrieve-Status value. - * - * @param value the value - * @throws InvalidHeaderValueException if the value is invalid. - */ - public void setRetrieveStatus(int value) throws InvalidHeaderValueException { - mPduHeaders.setOctet(value, PduHeaders.RETRIEVE_STATUS); - } - - /** - * Get X-Mms-Retrieve-Text value. - * - * @return the value - */ - public EncodedStringValue getRetrieveText() { - return mPduHeaders.getEncodedStringValue(PduHeaders.RETRIEVE_TEXT); - } - - /** - * Set X-Mms-Retrieve-Text value. - * - * @param value the value - * @throws NullPointerException if the value is null. - */ - public void setRetrieveText(EncodedStringValue value) { - mPduHeaders.setEncodedStringValue(value, PduHeaders.RETRIEVE_TEXT); - } - - /** - * Get X-Mms-Transaction-Id. - * - * @return the value - */ - public byte[] getTransactionId() { - return mPduHeaders.getTextString(PduHeaders.TRANSACTION_ID); - } - - /** - * Set X-Mms-Transaction-Id. - * - * @param value the value - * @throws NullPointerException if the value is null. - */ - public void setTransactionId(byte[] value) { - mPduHeaders.setTextString(value, PduHeaders.TRANSACTION_ID); - } - - /* - * Optional, not supported header fields: - * - * public byte[] getApplicId() {return null;} - * public void setApplicId(byte[] value) {} - * - * public byte[] getAuxApplicId() {return null;} - * public void getAuxApplicId(byte[] value) {} - * - * public byte getContentClass() {return 0x00;} - * public void setApplicId(byte value) {} - * - * public byte getDrmContent() {return 0x00;} - * public void setDrmContent(byte value) {} - * - * public byte getDistributionIndicator() {return 0x00;} - * public void setDistributionIndicator(byte value) {} - * - * public PreviouslySentByValue getPreviouslySentBy() {return null;} - * public void setPreviouslySentBy(PreviouslySentByValue value) {} - * - * public PreviouslySentDateValue getPreviouslySentDate() {} - * public void setPreviouslySentDate(PreviouslySentDateValue value) {} - * - * public MmFlagsValue getMmFlags() {return null;} - * public void setMmFlags(MmFlagsValue value) {} - * - * public MmStateValue getMmState() {return null;} - * public void getMmState(MmStateValue value) {} - * - * public byte[] getReplaceId() {return 0x00;} - * public void setReplaceId(byte[] value) {} - * - * public byte[] getReplyApplicId() {return 0x00;} - * public void setReplyApplicId(byte[] value) {} - * - * public byte getReplyCharging() {return 0x00;} - * public void setReplyCharging(byte value) {} - * - * public byte getReplyChargingDeadline() {return 0x00;} - * public void setReplyChargingDeadline(byte value) {} - * - * public byte[] getReplyChargingId() {return 0x00;} - * public void setReplyChargingId(byte[] value) {} - * - * public long getReplyChargingSize() {return 0;} - * public void setReplyChargingSize(long value) {} - */ -} diff --git a/core/java/com/google/android/mms/pdu/SendConf.java b/core/java/com/google/android/mms/pdu/SendConf.java deleted file mode 100644 index 0568fe79c5fff..0000000000000 --- a/core/java/com/google/android/mms/pdu/SendConf.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (C) 2007 Esmertec AG. - * 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. - */ - -package com.google.android.mms.pdu; - -import com.google.android.mms.InvalidHeaderValueException; - -public class SendConf extends GenericPdu { - /** - * Empty constructor. - * Since the Pdu corresponding to this class is constructed - * by the Proxy-Relay server, this class is only instantiated - * by the Pdu Parser. - * - * @throws InvalidHeaderValueException if error occurs. - */ - public SendConf() throws InvalidHeaderValueException { - super(); - setMessageType(PduHeaders.MESSAGE_TYPE_SEND_CONF); - } - - /** - * Constructor with given headers. - * - * @param headers Headers for this PDU. - */ - SendConf(PduHeaders headers) { - super(headers); - } - - /** - * Get Message-ID value. - * - * @return the value - */ - public byte[] getMessageId() { - return mPduHeaders.getTextString(PduHeaders.MESSAGE_ID); - } - - /** - * Set Message-ID value. - * - * @param value the value - * @throws NullPointerException if the value is null. - */ - public void setMessageId(byte[] value) { - mPduHeaders.setTextString(value, PduHeaders.MESSAGE_ID); - } - - /** - * Get X-Mms-Response-Status. - * - * @return the value - */ - public int getResponseStatus() { - return mPduHeaders.getOctet(PduHeaders.RESPONSE_STATUS); - } - - /** - * Set X-Mms-Response-Status. - * - * @param value the values - * @throws InvalidHeaderValueException if the value is invalid. - */ - public void setResponseStatus(int value) throws InvalidHeaderValueException { - mPduHeaders.setOctet(value, PduHeaders.RESPONSE_STATUS); - } - - /** - * Get X-Mms-Transaction-Id field value. - * - * @return the X-Mms-Report-Allowed value - */ - public byte[] getTransactionId() { - return mPduHeaders.getTextString(PduHeaders.TRANSACTION_ID); - } - - /** - * Set X-Mms-Transaction-Id field value. - * - * @param value the value - * @throws NullPointerException if the value is null. - */ - public void setTransactionId(byte[] value) { - mPduHeaders.setTextString(value, PduHeaders.TRANSACTION_ID); - } - - /* - * Optional, not supported header fields: - * - * public byte[] getContentLocation() {return null;} - * public void setContentLocation(byte[] value) {} - * - * public EncodedStringValue getResponseText() {return null;} - * public void setResponseText(EncodedStringValue value) {} - * - * public byte getStoreStatus() {return 0x00;} - * public void setStoreStatus(byte value) {} - * - * public byte[] getStoreStatusText() {return null;} - * public void setStoreStatusText(byte[] value) {} - */ -} diff --git a/core/java/com/google/android/mms/pdu/SendReq.java b/core/java/com/google/android/mms/pdu/SendReq.java deleted file mode 100644 index 597cd00b99614..0000000000000 --- a/core/java/com/google/android/mms/pdu/SendReq.java +++ /dev/null @@ -1,345 +0,0 @@ -/* - * Copyright (C) 2007-2008 Esmertec AG. - * Copyright (C) 2007-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 com.google.android.mms.pdu; - -import android.util.Log; - -import com.google.android.mms.InvalidHeaderValueException; - -public class SendReq extends MultimediaMessagePdu { - private static final String TAG = "SendReq"; - - public SendReq() { - super(); - - try { - setMessageType(PduHeaders.MESSAGE_TYPE_SEND_REQ); - setMmsVersion(PduHeaders.CURRENT_MMS_VERSION); - // FIXME: Content-type must be decided according to whether - // SMIL part present. - setContentType("application/vnd.wap.multipart.related".getBytes()); - setFrom(new EncodedStringValue(PduHeaders.FROM_INSERT_ADDRESS_TOKEN_STR.getBytes())); - setTransactionId(generateTransactionId()); - } catch (InvalidHeaderValueException e) { - // Impossible to reach here since all headers we set above are valid. - Log.e(TAG, "Unexpected InvalidHeaderValueException.", e); - throw new RuntimeException(e); - } - } - - private byte[] generateTransactionId() { - String transactionId = "T" + Long.toHexString(System.currentTimeMillis()); - return transactionId.getBytes(); - } - - /** - * Constructor, used when composing a M-Send.req pdu. - * - * @param contentType the content type value - * @param from the from value - * @param mmsVersion current viersion of mms - * @param transactionId the transaction-id value - * @throws InvalidHeaderValueException if parameters are invalid. - * NullPointerException if contentType, form or transactionId is null. - */ - public SendReq(byte[] contentType, - EncodedStringValue from, - int mmsVersion, - byte[] transactionId) throws InvalidHeaderValueException { - super(); - setMessageType(PduHeaders.MESSAGE_TYPE_SEND_REQ); - setContentType(contentType); - setFrom(from); - setMmsVersion(mmsVersion); - setTransactionId(transactionId); - } - - /** - * Constructor with given headers. - * - * @param headers Headers for this PDU. - */ - SendReq(PduHeaders headers) { - super(headers); - } - - /** - * Constructor with given headers and body - * - * @param headers Headers for this PDU. - * @param body Body of this PDu. - */ - SendReq(PduHeaders headers, PduBody body) { - super(headers, body); - } - - /** - * Get Bcc value. - * - * @return the value - */ - public EncodedStringValue[] getBcc() { - return mPduHeaders.getEncodedStringValues(PduHeaders.BCC); - } - - /** - * Add a "BCC" value. - * - * @param value the value - * @throws NullPointerException if the value is null. - */ - public void addBcc(EncodedStringValue value) { - mPduHeaders.appendEncodedStringValue(value, PduHeaders.BCC); - } - - /** - * Set "BCC" value. - * - * @param value the value - * @throws NullPointerException if the value is null. - */ - public void setBcc(EncodedStringValue[] value) { - mPduHeaders.setEncodedStringValues(value, PduHeaders.BCC); - } - - /** - * Get CC value. - * - * @return the value - */ - public EncodedStringValue[] getCc() { - return mPduHeaders.getEncodedStringValues(PduHeaders.CC); - } - - /** - * Add a "CC" value. - * - * @param value the value - * @throws NullPointerException if the value is null. - */ - public void addCc(EncodedStringValue value) { - mPduHeaders.appendEncodedStringValue(value, PduHeaders.CC); - } - - /** - * Set "CC" value. - * - * @param value the value - * @throws NullPointerException if the value is null. - */ - public void setCc(EncodedStringValue[] value) { - mPduHeaders.setEncodedStringValues(value, PduHeaders.CC); - } - - /** - * Get Content-type value. - * - * @return the value - */ - public byte[] getContentType() { - return mPduHeaders.getTextString(PduHeaders.CONTENT_TYPE); - } - - /** - * Set Content-type value. - * - * @param value the value - * @throws NullPointerException if the value is null. - */ - public void setContentType(byte[] value) { - mPduHeaders.setTextString(value, PduHeaders.CONTENT_TYPE); - } - - /** - * Get X-Mms-Delivery-Report value. - * - * @return the value - */ - public int getDeliveryReport() { - return mPduHeaders.getOctet(PduHeaders.DELIVERY_REPORT); - } - - /** - * Set X-Mms-Delivery-Report value. - * - * @param value the value - * @throws InvalidHeaderValueException if the value is invalid. - */ - public void setDeliveryReport(int value) throws InvalidHeaderValueException { - mPduHeaders.setOctet(value, PduHeaders.DELIVERY_REPORT); - } - - /** - * Get X-Mms-Expiry value. - * - * Expiry-value = Value-length - * (Absolute-token Date-value | Relative-token Delta-seconds-value) - * - * @return the value - */ - public long getExpiry() { - return mPduHeaders.getLongInteger(PduHeaders.EXPIRY); - } - - /** - * Set X-Mms-Expiry value. - * - * @param value the value - */ - public void setExpiry(long value) { - mPduHeaders.setLongInteger(value, PduHeaders.EXPIRY); - } - - /** - * Get X-Mms-MessageSize value. - * - * Expiry-value = size of message - * - * @return the value - */ - public long getMessageSize() { - return mPduHeaders.getLongInteger(PduHeaders.MESSAGE_SIZE); - } - - /** - * Set X-Mms-MessageSize value. - * - * @param value the value - */ - public void setMessageSize(long value) { - mPduHeaders.setLongInteger(value, PduHeaders.MESSAGE_SIZE); - } - - /** - * Get X-Mms-Message-Class value. - * Message-class-value = Class-identifier | Token-text - * Class-identifier = Personal | Advertisement | Informational | Auto - * - * @return the value - */ - public byte[] getMessageClass() { - return mPduHeaders.getTextString(PduHeaders.MESSAGE_CLASS); - } - - /** - * Set X-Mms-Message-Class value. - * - * @param value the value - * @throws NullPointerException if the value is null. - */ - public void setMessageClass(byte[] value) { - mPduHeaders.setTextString(value, PduHeaders.MESSAGE_CLASS); - } - - /** - * Get X-Mms-Read-Report value. - * - * @return the value - */ - public int getReadReport() { - return mPduHeaders.getOctet(PduHeaders.READ_REPORT); - } - - /** - * Set X-Mms-Read-Report value. - * - * @param value the value - * @throws InvalidHeaderValueException if the value is invalid. - */ - public void setReadReport(int value) throws InvalidHeaderValueException { - mPduHeaders.setOctet(value, PduHeaders.READ_REPORT); - } - - /** - * Set "To" value. - * - * @param value the value - * @throws NullPointerException if the value is null. - */ - public void setTo(EncodedStringValue[] value) { - mPduHeaders.setEncodedStringValues(value, PduHeaders.TO); - } - - /** - * Get X-Mms-Transaction-Id field value. - * - * @return the X-Mms-Report-Allowed value - */ - public byte[] getTransactionId() { - return mPduHeaders.getTextString(PduHeaders.TRANSACTION_ID); - } - - /** - * Set X-Mms-Transaction-Id field value. - * - * @param value the value - * @throws NullPointerException if the value is null. - */ - public void setTransactionId(byte[] value) { - mPduHeaders.setTextString(value, PduHeaders.TRANSACTION_ID); - } - - /* - * Optional, not supported header fields: - * - * public byte getAdaptationAllowed() {return 0}; - * public void setAdaptationAllowed(btye value) {}; - * - * public byte[] getApplicId() {return null;} - * public void setApplicId(byte[] value) {} - * - * public byte[] getAuxApplicId() {return null;} - * public void getAuxApplicId(byte[] value) {} - * - * public byte getContentClass() {return 0x00;} - * public void setApplicId(byte value) {} - * - * public long getDeliveryTime() {return 0}; - * public void setDeliveryTime(long value) {}; - * - * public byte getDrmContent() {return 0x00;} - * public void setDrmContent(byte value) {} - * - * public MmFlagsValue getMmFlags() {return null;} - * public void setMmFlags(MmFlagsValue value) {} - * - * public MmStateValue getMmState() {return null;} - * public void getMmState(MmStateValue value) {} - * - * public byte[] getReplyApplicId() {return 0x00;} - * public void setReplyApplicId(byte[] value) {} - * - * public byte getReplyCharging() {return 0x00;} - * public void setReplyCharging(byte value) {} - * - * public byte getReplyChargingDeadline() {return 0x00;} - * public void setReplyChargingDeadline(byte value) {} - * - * public byte[] getReplyChargingId() {return 0x00;} - * public void setReplyChargingId(byte[] value) {} - * - * public long getReplyChargingSize() {return 0;} - * public void setReplyChargingSize(long value) {} - * - * public byte[] getReplyApplicId() {return 0x00;} - * public void setReplyApplicId(byte[] value) {} - * - * public byte getStore() {return 0x00;} - * public void setStore(byte value) {} - */ -} diff --git a/core/java/com/google/android/mms/pdu/package.html b/core/java/com/google/android/mms/pdu/package.html deleted file mode 100755 index c9f96a66ab3bc..0000000000000 --- a/core/java/com/google/android/mms/pdu/package.html +++ /dev/null @@ -1,5 +0,0 @@ - - -{@hide} - - diff --git a/core/java/com/google/android/mms/util/AbstractCache.java b/core/java/com/google/android/mms/util/AbstractCache.java deleted file mode 100644 index 39b2abf15a646..0000000000000 --- a/core/java/com/google/android/mms/util/AbstractCache.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (C) 2008 Esmertec AG. - * 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 com.google.android.mms.util; - -import android.util.Log; - -import java.util.HashMap; - -public abstract class AbstractCache { - private static final String TAG = "AbstractCache"; - private static final boolean DEBUG = false; - private static final boolean LOCAL_LOGV = false; - - private static final int MAX_CACHED_ITEMS = 500; - - private final HashMap> mCacheMap; - - protected AbstractCache() { - mCacheMap = new HashMap>(); - } - - public boolean put(K key, V value) { - if (LOCAL_LOGV) { - Log.v(TAG, "Trying to put " + key + " into cache."); - } - - if (mCacheMap.size() >= MAX_CACHED_ITEMS) { - // TODO Should remove the oldest or least hit cached entry - // and then cache the new one. - if (LOCAL_LOGV) { - Log.v(TAG, "Failed! size limitation reached."); - } - return false; - } - - if (key != null) { - CacheEntry cacheEntry = new CacheEntry(); - cacheEntry.value = value; - mCacheMap.put(key, cacheEntry); - - if (LOCAL_LOGV) { - Log.v(TAG, key + " cached, " + mCacheMap.size() + " items total."); - } - return true; - } - return false; - } - - public V get(K key) { - if (LOCAL_LOGV) { - Log.v(TAG, "Trying to get " + key + " from cache."); - } - - if (key != null) { - CacheEntry cacheEntry = mCacheMap.get(key); - if (cacheEntry != null) { - cacheEntry.hit++; - if (LOCAL_LOGV) { - Log.v(TAG, key + " hit " + cacheEntry.hit + " times."); - } - return cacheEntry.value; - } - } - return null; - } - - public V purge(K key) { - if (LOCAL_LOGV) { - Log.v(TAG, "Trying to purge " + key); - } - - CacheEntry v = mCacheMap.remove(key); - - if (LOCAL_LOGV) { - Log.v(TAG, mCacheMap.size() + " items cached."); - } - - return v != null ? v.value : null; - } - - public void purgeAll() { - if (LOCAL_LOGV) { - Log.v(TAG, "Purging cache, " + mCacheMap.size() - + " items dropped."); - } - mCacheMap.clear(); - } - - public int size() { - return mCacheMap.size(); - } - - private static class CacheEntry { - int hit; - V value; - } -} diff --git a/core/java/com/google/android/mms/util/DownloadDrmHelper.java b/core/java/com/google/android/mms/util/DownloadDrmHelper.java deleted file mode 100644 index 6852eca4890d9..0000000000000 --- a/core/java/com/google/android/mms/util/DownloadDrmHelper.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * 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.google.android.mms.util; - -import android.content.Context; -import android.drm.DrmManagerClient; -import android.util.Log; - -public class DownloadDrmHelper { - private static final String TAG = "DownloadDrmHelper"; - - /** The MIME type of special DRM files */ - public static final String MIMETYPE_DRM_MESSAGE = "application/vnd.oma.drm.message"; - - /** The extensions of special DRM files */ - public static final String EXTENSION_DRM_MESSAGE = ".dm"; - - public static final String EXTENSION_INTERNAL_FWDL = ".fl"; - - /** - * Checks if the Media Type is a DRM Media Type - * - * @param drmManagerClient A DrmManagerClient - * @param mimetype Media Type to check - * @return True if the Media Type is DRM else false - */ - public static boolean isDrmMimeType(Context context, String mimetype) { - boolean result = false; - if (context != null) { - try { - DrmManagerClient drmClient = new DrmManagerClient(context); - if (drmClient != null && mimetype != null && mimetype.length() > 0) { - result = drmClient.canHandle("", mimetype); - } - } catch (IllegalArgumentException e) { - Log.w(TAG, - "DrmManagerClient instance could not be created, context is Illegal."); - } catch (IllegalStateException e) { - Log.w(TAG, "DrmManagerClient didn't initialize properly."); - } - } - return result; - } - - /** - * Checks if the Media Type needs to be DRM converted - * - * @param mimetype Media type of the content - * @return True if convert is needed else false - */ - public static boolean isDrmConvertNeeded(String mimetype) { - return MIMETYPE_DRM_MESSAGE.equals(mimetype); - } - - /** - * Modifies the file extension for a DRM Forward Lock file NOTE: This - * function shouldn't be called if the file shouldn't be DRM converted - */ - public static String modifyDrmFwLockFileExtension(String filename) { - if (filename != null) { - int extensionIndex; - extensionIndex = filename.lastIndexOf("."); - if (extensionIndex != -1) { - filename = filename.substring(0, extensionIndex); - } - filename = filename.concat(EXTENSION_INTERNAL_FWDL); - } - return filename; - } - - /** - * Gets the original mime type of DRM protected content. - * - * @param context The context - * @param path Path to the file - * @param containingMime The current mime type of of the file i.e. the - * containing mime type - * @return The original mime type of the file if DRM protected else the - * currentMime - */ - public static String getOriginalMimeType(Context context, String path, String containingMime) { - String result = containingMime; - DrmManagerClient drmClient = new DrmManagerClient(context); - try { - if (drmClient.canHandle(path, null)) { - result = drmClient.getOriginalMimeType(path); - } - } catch (IllegalArgumentException ex) { - Log.w(TAG, - "Can't get original mime type since path is null or empty string."); - } catch (IllegalStateException ex) { - Log.w(TAG, "DrmManagerClient didn't initialize properly."); - } - return result; - } -} diff --git a/core/java/com/google/android/mms/util/DrmConvertSession.java b/core/java/com/google/android/mms/util/DrmConvertSession.java deleted file mode 100644 index 2d8f274f2bd4b..0000000000000 --- a/core/java/com/google/android/mms/util/DrmConvertSession.java +++ /dev/null @@ -1,172 +0,0 @@ -/* - * 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.google.android.mms.util; - -import android.content.Context; -import android.drm.DrmConvertedStatus; -import android.drm.DrmManagerClient; -import android.util.Log; -import android.provider.Downloads; - -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.RandomAccessFile; - - -public class DrmConvertSession { - private DrmManagerClient mDrmClient; - private int mConvertSessionId; - private static final String TAG = "DrmConvertSession"; - - private DrmConvertSession(DrmManagerClient drmClient, int convertSessionId) { - mDrmClient = drmClient; - mConvertSessionId = convertSessionId; - } - - /** - * Start of converting a file. - * - * @param context The context of the application running the convert session. - * @param mimeType Mimetype of content that shall be converted. - * @return A convert session or null in case an error occurs. - */ - public static DrmConvertSession open(Context context, String mimeType) { - DrmManagerClient drmClient = null; - int convertSessionId = -1; - if (context != null && mimeType != null && !mimeType.equals("")) { - try { - drmClient = new DrmManagerClient(context); - try { - convertSessionId = drmClient.openConvertSession(mimeType); - } catch (IllegalArgumentException e) { - Log.w(TAG, "Conversion of Mimetype: " + mimeType - + " is not supported.", e); - } catch (IllegalStateException e) { - Log.w(TAG, "Could not access Open DrmFramework.", e); - } - } catch (IllegalArgumentException e) { - Log.w(TAG, - "DrmManagerClient instance could not be created, context is Illegal."); - } catch (IllegalStateException e) { - Log.w(TAG, "DrmManagerClient didn't initialize properly."); - } - } - - if (drmClient == null || convertSessionId < 0) { - return null; - } else { - return new DrmConvertSession(drmClient, convertSessionId); - } - } - /** - * Convert a buffer of data to protected format. - * - * @param buffer Buffer filled with data to convert. - * @param size The number of bytes that shall be converted. - * @return A Buffer filled with converted data, if execution is ok, in all - * other case null. - */ - public byte [] convert(byte[] inBuffer, int size) { - byte[] result = null; - if (inBuffer != null) { - DrmConvertedStatus convertedStatus = null; - try { - if (size != inBuffer.length) { - byte[] buf = new byte[size]; - System.arraycopy(inBuffer, 0, buf, 0, size); - convertedStatus = mDrmClient.convertData(mConvertSessionId, buf); - } else { - convertedStatus = mDrmClient.convertData(mConvertSessionId, inBuffer); - } - - if (convertedStatus != null && - convertedStatus.statusCode == DrmConvertedStatus.STATUS_OK && - convertedStatus.convertedData != null) { - result = convertedStatus.convertedData; - } - } catch (IllegalArgumentException e) { - Log.w(TAG, "Buffer with data to convert is illegal. Convertsession: " - + mConvertSessionId, e); - } catch (IllegalStateException e) { - Log.w(TAG, "Could not convert data. Convertsession: " + - mConvertSessionId, e); - } - } else { - throw new IllegalArgumentException("Parameter inBuffer is null"); - } - return result; - } - - /** - * Ends a conversion session of a file. - * - * @param fileName The filename of the converted file. - * @return Downloads.Impl.STATUS_SUCCESS if execution is ok. - * Downloads.Impl.STATUS_FILE_ERROR in case converted file can not - * be accessed. Downloads.Impl.STATUS_NOT_ACCEPTABLE if a problem - * occurs when accessing drm framework. - * Downloads.Impl.STATUS_UNKNOWN_ERROR if a general error occurred. - */ - public int close(String filename) { - DrmConvertedStatus convertedStatus = null; - int result = Downloads.Impl.STATUS_UNKNOWN_ERROR; - if (mDrmClient != null && mConvertSessionId >= 0) { - try { - convertedStatus = mDrmClient.closeConvertSession(mConvertSessionId); - if (convertedStatus == null || - convertedStatus.statusCode != DrmConvertedStatus.STATUS_OK || - convertedStatus.convertedData == null) { - result = Downloads.Impl.STATUS_NOT_ACCEPTABLE; - } else { - RandomAccessFile rndAccessFile = null; - try { - rndAccessFile = new RandomAccessFile(filename, "rw"); - rndAccessFile.seek(convertedStatus.offset); - rndAccessFile.write(convertedStatus.convertedData); - result = Downloads.Impl.STATUS_SUCCESS; - } catch (FileNotFoundException e) { - result = Downloads.Impl.STATUS_FILE_ERROR; - Log.w(TAG, "File: " + filename + " could not be found.", e); - } catch (IOException e) { - result = Downloads.Impl.STATUS_FILE_ERROR; - Log.w(TAG, "Could not access File: " + filename + " .", e); - } catch (IllegalArgumentException e) { - result = Downloads.Impl.STATUS_FILE_ERROR; - Log.w(TAG, "Could not open file in mode: rw", e); - } catch (SecurityException e) { - Log.w(TAG, "Access to File: " + filename + - " was denied denied by SecurityManager.", e); - } finally { - if (rndAccessFile != null) { - try { - rndAccessFile.close(); - } catch (IOException e) { - result = Downloads.Impl.STATUS_FILE_ERROR; - Log.w(TAG, "Failed to close File:" + filename - + ".", e); - } - } - } - } - } catch (IllegalStateException e) { - Log.w(TAG, "Could not close convertsession. Convertsession: " + - mConvertSessionId, e); - } - } - return result; - } -} diff --git a/core/java/com/google/android/mms/util/PduCache.java b/core/java/com/google/android/mms/util/PduCache.java deleted file mode 100644 index de83124bad7b9..0000000000000 --- a/core/java/com/google/android/mms/util/PduCache.java +++ /dev/null @@ -1,261 +0,0 @@ -/* - * Copyright (C) 2008 Esmertec AG. - * 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 com.google.android.mms.util; - -import android.content.ContentUris; -import android.content.UriMatcher; -import android.net.Uri; -import android.provider.Telephony.Mms; -import android.util.Log; - -import java.util.HashMap; -import java.util.HashSet; - -public final class PduCache extends AbstractCache { - private static final String TAG = "PduCache"; - private static final boolean DEBUG = false; - private static final boolean LOCAL_LOGV = false; - - private static final int MMS_ALL = 0; - private static final int MMS_ALL_ID = 1; - private static final int MMS_INBOX = 2; - private static final int MMS_INBOX_ID = 3; - private static final int MMS_SENT = 4; - private static final int MMS_SENT_ID = 5; - private static final int MMS_DRAFTS = 6; - private static final int MMS_DRAFTS_ID = 7; - private static final int MMS_OUTBOX = 8; - private static final int MMS_OUTBOX_ID = 9; - private static final int MMS_CONVERSATION = 10; - private static final int MMS_CONVERSATION_ID = 11; - - private static final UriMatcher URI_MATCHER; - private static final HashMap MATCH_TO_MSGBOX_ID_MAP; - - private static PduCache sInstance; - - static { - URI_MATCHER = new UriMatcher(UriMatcher.NO_MATCH); - URI_MATCHER.addURI("mms", null, MMS_ALL); - URI_MATCHER.addURI("mms", "#", MMS_ALL_ID); - URI_MATCHER.addURI("mms", "inbox", MMS_INBOX); - URI_MATCHER.addURI("mms", "inbox/#", MMS_INBOX_ID); - URI_MATCHER.addURI("mms", "sent", MMS_SENT); - URI_MATCHER.addURI("mms", "sent/#", MMS_SENT_ID); - URI_MATCHER.addURI("mms", "drafts", MMS_DRAFTS); - URI_MATCHER.addURI("mms", "drafts/#", MMS_DRAFTS_ID); - URI_MATCHER.addURI("mms", "outbox", MMS_OUTBOX); - URI_MATCHER.addURI("mms", "outbox/#", MMS_OUTBOX_ID); - URI_MATCHER.addURI("mms-sms", "conversations", MMS_CONVERSATION); - URI_MATCHER.addURI("mms-sms", "conversations/#", MMS_CONVERSATION_ID); - - MATCH_TO_MSGBOX_ID_MAP = new HashMap(); - MATCH_TO_MSGBOX_ID_MAP.put(MMS_INBOX, Mms.MESSAGE_BOX_INBOX); - MATCH_TO_MSGBOX_ID_MAP.put(MMS_SENT, Mms.MESSAGE_BOX_SENT); - MATCH_TO_MSGBOX_ID_MAP.put(MMS_DRAFTS, Mms.MESSAGE_BOX_DRAFTS); - MATCH_TO_MSGBOX_ID_MAP.put(MMS_OUTBOX, Mms.MESSAGE_BOX_OUTBOX); - } - - private final HashMap> mMessageBoxes; - private final HashMap> mThreads; - private final HashSet mUpdating; - - private PduCache() { - mMessageBoxes = new HashMap>(); - mThreads = new HashMap>(); - mUpdating = new HashSet(); - } - - synchronized public static final PduCache getInstance() { - if (sInstance == null) { - if (LOCAL_LOGV) { - Log.v(TAG, "Constructing new PduCache instance."); - } - sInstance = new PduCache(); - } - return sInstance; - } - - @Override - synchronized public boolean put(Uri uri, PduCacheEntry entry) { - int msgBoxId = entry.getMessageBox(); - HashSet msgBox = mMessageBoxes.get(msgBoxId); - if (msgBox == null) { - msgBox = new HashSet(); - mMessageBoxes.put(msgBoxId, msgBox); - } - - long threadId = entry.getThreadId(); - HashSet thread = mThreads.get(threadId); - if (thread == null) { - thread = new HashSet(); - mThreads.put(threadId, thread); - } - - Uri finalKey = normalizeKey(uri); - boolean result = super.put(finalKey, entry); - if (result) { - msgBox.add(finalKey); - thread.add(finalKey); - } - setUpdating(uri, false); - return result; - } - - synchronized public void setUpdating(Uri uri, boolean updating) { - if (updating) { - mUpdating.add(uri); - } else { - mUpdating.remove(uri); - } - } - - synchronized public boolean isUpdating(Uri uri) { - return mUpdating.contains(uri); - } - - @Override - synchronized public PduCacheEntry purge(Uri uri) { - int match = URI_MATCHER.match(uri); - switch (match) { - case MMS_ALL_ID: - return purgeSingleEntry(uri); - case MMS_INBOX_ID: - case MMS_SENT_ID: - case MMS_DRAFTS_ID: - case MMS_OUTBOX_ID: - String msgId = uri.getLastPathSegment(); - return purgeSingleEntry(Uri.withAppendedPath(Mms.CONTENT_URI, msgId)); - // Implicit batch of purge, return null. - case MMS_ALL: - case MMS_CONVERSATION: - purgeAll(); - return null; - case MMS_INBOX: - case MMS_SENT: - case MMS_DRAFTS: - case MMS_OUTBOX: - purgeByMessageBox(MATCH_TO_MSGBOX_ID_MAP.get(match)); - return null; - case MMS_CONVERSATION_ID: - purgeByThreadId(ContentUris.parseId(uri)); - return null; - default: - return null; - } - } - - private PduCacheEntry purgeSingleEntry(Uri key) { - mUpdating.remove(key); - PduCacheEntry entry = super.purge(key); - if (entry != null) { - removeFromThreads(key, entry); - removeFromMessageBoxes(key, entry); - return entry; - } - return null; - } - - @Override - synchronized public void purgeAll() { - super.purgeAll(); - - mMessageBoxes.clear(); - mThreads.clear(); - mUpdating.clear(); - } - - /** - * @param uri The Uri to be normalized. - * @return Uri The normalized key of cached entry. - */ - private Uri normalizeKey(Uri uri) { - int match = URI_MATCHER.match(uri); - Uri normalizedKey = null; - - switch (match) { - case MMS_ALL_ID: - normalizedKey = uri; - break; - case MMS_INBOX_ID: - case MMS_SENT_ID: - case MMS_DRAFTS_ID: - case MMS_OUTBOX_ID: - String msgId = uri.getLastPathSegment(); - normalizedKey = Uri.withAppendedPath(Mms.CONTENT_URI, msgId); - break; - default: - return null; - } - - if (LOCAL_LOGV) { - Log.v(TAG, uri + " -> " + normalizedKey); - } - return normalizedKey; - } - - private void purgeByMessageBox(Integer msgBoxId) { - if (LOCAL_LOGV) { - Log.v(TAG, "Purge cache in message box: " + msgBoxId); - } - - if (msgBoxId != null) { - HashSet msgBox = mMessageBoxes.remove(msgBoxId); - if (msgBox != null) { - for (Uri key : msgBox) { - mUpdating.remove(key); - PduCacheEntry entry = super.purge(key); - if (entry != null) { - removeFromThreads(key, entry); - } - } - } - } - } - - private void removeFromThreads(Uri key, PduCacheEntry entry) { - HashSet thread = mThreads.get(entry.getThreadId()); - if (thread != null) { - thread.remove(key); - } - } - - private void purgeByThreadId(long threadId) { - if (LOCAL_LOGV) { - Log.v(TAG, "Purge cache in thread: " + threadId); - } - - HashSet thread = mThreads.remove(threadId); - if (thread != null) { - for (Uri key : thread) { - mUpdating.remove(key); - PduCacheEntry entry = super.purge(key); - if (entry != null) { - removeFromMessageBoxes(key, entry); - } - } - } - } - - private void removeFromMessageBoxes(Uri key, PduCacheEntry entry) { - HashSet msgBox = mThreads.get(Long.valueOf(entry.getMessageBox())); - if (msgBox != null) { - msgBox.remove(key); - } - } -} diff --git a/core/java/com/google/android/mms/util/PduCacheEntry.java b/core/java/com/google/android/mms/util/PduCacheEntry.java deleted file mode 100644 index 8b4138628113c..0000000000000 --- a/core/java/com/google/android/mms/util/PduCacheEntry.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2008 Esmertec AG. - * 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 com.google.android.mms.util; - -import com.google.android.mms.pdu.GenericPdu; - -public final class PduCacheEntry { - private final GenericPdu mPdu; - private final int mMessageBox; - private final long mThreadId; - - public PduCacheEntry(GenericPdu pdu, int msgBox, long threadId) { - mPdu = pdu; - mMessageBox = msgBox; - mThreadId = threadId; - } - - public GenericPdu getPdu() { - return mPdu; - } - - public int getMessageBox() { - return mMessageBox; - } - - public long getThreadId() { - return mThreadId; - } -} diff --git a/core/java/com/google/android/mms/util/SqliteWrapper.java b/core/java/com/google/android/mms/util/SqliteWrapper.java deleted file mode 100644 index bcdac22ce142d..0000000000000 --- a/core/java/com/google/android/mms/util/SqliteWrapper.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright (C) 2008 Esmertec AG. - * 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 com.google.android.mms.util; - -import android.app.ActivityManager; -import android.content.ContentResolver; -import android.content.ContentValues; -import android.content.Context; -import android.database.Cursor; -import android.database.sqlite.SQLiteException; -import android.net.Uri; -import android.util.Log; -import android.widget.Toast; - -public final class SqliteWrapper { - private static final String TAG = "SqliteWrapper"; - private static final String SQLITE_EXCEPTION_DETAIL_MESSAGE - = "unable to open database file"; - - private SqliteWrapper() { - // Forbidden being instantiated. - } - - // FIXME: It looks like outInfo.lowMemory does not work well as we expected. - // after run command: adb shell fillup -p 100, outInfo.lowMemory is still false. - private static boolean isLowMemory(Context context) { - if (null == context) { - return false; - } - - ActivityManager am = (ActivityManager) - context.getSystemService(Context.ACTIVITY_SERVICE); - ActivityManager.MemoryInfo outInfo = new ActivityManager.MemoryInfo(); - am.getMemoryInfo(outInfo); - - return outInfo.lowMemory; - } - - // FIXME: need to optimize this method. - private static boolean isLowMemory(SQLiteException e) { - return e.getMessage().equals(SQLITE_EXCEPTION_DETAIL_MESSAGE); - } - - public static void checkSQLiteException(Context context, SQLiteException e) { - if (isLowMemory(e)) { - Toast.makeText(context, com.android.internal.R.string.low_memory, - Toast.LENGTH_SHORT).show(); - } else { - throw e; - } - } - - public static Cursor query(Context context, ContentResolver resolver, Uri uri, - String[] projection, String selection, String[] selectionArgs, String sortOrder) { - try { - return resolver.query(uri, projection, selection, selectionArgs, sortOrder); - } catch (SQLiteException e) { - Log.e(TAG, "Catch a SQLiteException when query: ", e); - checkSQLiteException(context, e); - return null; - } - } - - public static boolean requery(Context context, Cursor cursor) { - try { - return cursor.requery(); - } catch (SQLiteException e) { - Log.e(TAG, "Catch a SQLiteException when requery: ", e); - checkSQLiteException(context, e); - return false; - } - } - public static int update(Context context, ContentResolver resolver, Uri uri, - ContentValues values, String where, String[] selectionArgs) { - try { - return resolver.update(uri, values, where, selectionArgs); - } catch (SQLiteException e) { - Log.e(TAG, "Catch a SQLiteException when update: ", e); - checkSQLiteException(context, e); - return -1; - } - } - - public static int delete(Context context, ContentResolver resolver, Uri uri, - String where, String[] selectionArgs) { - try { - return resolver.delete(uri, where, selectionArgs); - } catch (SQLiteException e) { - Log.e(TAG, "Catch a SQLiteException when delete: ", e); - checkSQLiteException(context, e); - return -1; - } - } - - public static Uri insert(Context context, ContentResolver resolver, - Uri uri, ContentValues values) { - try { - return resolver.insert(uri, values); - } catch (SQLiteException e) { - Log.e(TAG, "Catch a SQLiteException when insert: ", e); - checkSQLiteException(context, e); - return null; - } - } -} diff --git a/core/java/com/google/android/mms/util/package.html b/core/java/com/google/android/mms/util/package.html deleted file mode 100755 index c9f96a66ab3bc..0000000000000 --- a/core/java/com/google/android/mms/util/package.html +++ /dev/null @@ -1,5 +0,0 @@ - - -{@hide} - - diff --git a/core/jni/Android.mk b/core/jni/Android.mk index c24f6c6608a91..de1fb4ea2d789 100644 --- a/core/jni/Android.mk +++ b/core/jni/Android.mk @@ -32,6 +32,7 @@ LOCAL_SRC_FILES:= \ com_google_android_gles_jni_EGLImpl.cpp \ com_google_android_gles_jni_GLImpl.cpp.arm \ android_app_NativeActivity.cpp \ + android_opengl_EGL14.cpp \ android_opengl_GLES10.cpp \ android_opengl_GLES10Ext.cpp \ android_opengl_GLES11.cpp \ @@ -43,9 +44,9 @@ 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_SurfaceSession.cpp \ android_view_TextureView.cpp \ android_view_InputChannel.cpp \ android_view_InputDevice.cpp \ @@ -66,7 +67,7 @@ LOCAL_SRC_FILES:= \ android_os_MessageQueue.cpp \ android_os_ParcelFileDescriptor.cpp \ android_os_Parcel.cpp \ - android_os_StatFs.cpp \ + android_os_SELinux.cpp \ android_os_SystemClock.cpp \ android_os_SystemProperties.cpp \ android_os_Trace.cpp \ @@ -85,6 +86,7 @@ LOCAL_SRC_FILES:= \ android_util_Process.cpp \ android_util_StringBlock.cpp \ android_util_XmlBlock.cpp \ + android_util_PackageRedirectionMap.cpp \ android/graphics/AutoDecodeCancel.cpp \ android/graphics/Bitmap.cpp \ android/graphics/BitmapFactory.cpp \ @@ -125,6 +127,7 @@ LOCAL_SRC_FILES:= \ android_media_AudioSystem.cpp \ android_media_AudioTrack.cpp \ android_media_JetPlayer.cpp \ + android_media_RemoteDisplay.cpp \ android_media_ToneGenerator.cpp \ android_hardware_Camera.cpp \ android_hardware_SensorManager.cpp \ @@ -136,14 +139,6 @@ LOCAL_SRC_FILES:= \ android_util_FileObserver.cpp \ android/opengl/poly_clip.cpp.arm \ android/opengl/util.cpp.arm \ - android_bluetooth_HeadsetBase.cpp \ - android_bluetooth_common.cpp \ - android_bluetooth_BluetoothAudioGateway.cpp \ - android_bluetooth_BluetoothSocket.cpp \ - android_bluetooth_c.c \ - android_server_BluetoothService.cpp \ - android_server_BluetoothEventLoop.cpp \ - android_server_BluetoothA2dpService.cpp \ android_server_NetworkManagementSocketTagger.cpp \ android_server_Watchdog.cpp \ android_ddm_DdmHandleNativeHeap.cpp \ @@ -157,6 +152,12 @@ LOCAL_SRC_FILES:= \ android_content_res_Configuration.cpp \ android_animation_PropertyValuesHolder.cpp +ifeq ($(BOARD_USES_QCOM_HARDWARE),true) + LOCAL_CFLAGS += -DQCOM_HARDWARE + LOCAL_SRC_FILES += \ + com_android_internal_app_ActivityTrigger.cpp +endif + LOCAL_C_INCLUDES += \ $(JNI_H_INCLUDE) \ $(LOCAL_PATH)/android/graphics \ @@ -169,6 +170,7 @@ LOCAL_C_INCLUDES += \ external/skia/include/core \ external/skia/include/effects \ external/skia/include/images \ + external/skia/include/ports \ external/skia/src/ports \ external/skia/include/utils \ external/sqlite/dist \ @@ -218,18 +220,16 @@ LOCAL_SHARED_LIBRARIES := \ libharfbuzz \ libz +ifeq ($(HAVE_SELINUX),true) +LOCAL_C_INCLUDES += external/libselinux/include +LOCAL_SHARED_LIBRARIES += libselinux +LOCAL_CFLAGS += -DHAVE_SELINUX +endif # HAVE_SELINUX + ifeq ($(USE_OPENGL_RENDERER),true) LOCAL_SHARED_LIBRARIES += libhwui endif -ifeq ($(BOARD_HAVE_BLUETOOTH),true) -LOCAL_C_INCLUDES += \ - external/dbus \ - system/bluetooth/bluez-clean-headers -LOCAL_CFLAGS += -DHAVE_BLUETOOTH -LOCAL_SHARED_LIBRARIES += libbluedroid libdbus -endif - LOCAL_SHARED_LIBRARIES += \ libdl # we need to access the private Bionic header diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp index 241a905f1c1f0..01ad2f0e65e91 100644 --- a/core/jni/AndroidRuntime.cpp +++ b/core/jni/AndroidRuntime.cpp @@ -68,6 +68,7 @@ extern int register_android_graphics_YuvImage(JNIEnv* env); extern int register_com_google_android_gles_jni_EGLImpl(JNIEnv* env); extern int register_com_google_android_gles_jni_GLImpl(JNIEnv* env); +extern int register_android_opengl_jni_EGL14(JNIEnv* env); extern int register_android_opengl_jni_GLES10(JNIEnv* env); extern int register_android_opengl_jni_GLES10Ext(JNIEnv* env); extern int register_android_opengl_jni_GLES11(JNIEnv* env); @@ -115,12 +116,12 @@ 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); extern int register_android_view_HardwareRenderer(JNIEnv* env); extern int register_android_view_Surface(JNIEnv* env); +extern int register_android_view_SurfaceSession(JNIEnv* env); extern int register_android_view_TextureView(JNIEnv* env); extern int register_android_database_CursorWindow(JNIEnv* env); extern int register_android_database_SQLiteConnection(JNIEnv* env); @@ -133,7 +134,7 @@ extern int register_android_os_Debug(JNIEnv* env); extern int register_android_os_MessageQueue(JNIEnv* env); extern int register_android_os_Parcel(JNIEnv* env); extern int register_android_os_ParcelFileDescriptor(JNIEnv *env); -extern int register_android_os_StatFs(JNIEnv *env); +extern int register_android_os_SELinux(JNIEnv* env); extern int register_android_os_SystemProperties(JNIEnv *env); extern int register_android_os_SystemClock(JNIEnv* env); extern int register_android_os_Trace(JNIEnv* env); @@ -148,12 +149,6 @@ extern int register_android_net_wifi_WifiManager(JNIEnv* env); extern int register_android_text_AndroidCharacter(JNIEnv *env); extern int register_android_text_AndroidBidi(JNIEnv *env); extern int register_android_opengl_classes(JNIEnv *env); -extern int register_android_bluetooth_HeadsetBase(JNIEnv* env); -extern int register_android_bluetooth_BluetoothAudioGateway(JNIEnv* env); -extern int register_android_bluetooth_BluetoothSocket(JNIEnv *env); -extern int register_android_server_BluetoothService(JNIEnv* env); -extern int register_android_server_BluetoothEventLoop(JNIEnv *env); -extern int register_android_server_BluetoothA2dpService(JNIEnv* env); extern int register_android_server_NetworkManagementSocketTagger(JNIEnv* env); extern int register_android_server_Watchdog(JNIEnv* env); extern int register_android_ddm_DdmHandleNativeHeap(JNIEnv *env); @@ -165,6 +160,7 @@ extern int register_android_backup_BackupHelperDispatcher(JNIEnv *env); extern int register_android_app_backup_FullBackup(JNIEnv *env); extern int register_android_app_ActivityThread(JNIEnv *env); extern int register_android_app_NativeActivity(JNIEnv *env); +extern int register_android_media_RemoteDisplay(JNIEnv *env); extern int register_android_view_InputChannel(JNIEnv* env); extern int register_android_view_InputDevice(JNIEnv* env); extern int register_android_view_InputEventReceiver(JNIEnv* env); @@ -177,6 +173,10 @@ extern int register_android_content_res_ObbScanner(JNIEnv* env); extern int register_android_content_res_Configuration(JNIEnv* env); extern int register_android_animation_PropertyValuesHolder(JNIEnv *env); extern int register_com_android_internal_content_NativeLibraryHelper(JNIEnv *env); +extern int register_android_content_res_PackageRedirectionMap(JNIEnv* env); +#ifdef QCOM_HARDWARE +extern int register_com_android_internal_app_ActivityTrigger(JNIEnv *env); +#endif static AndroidRuntime* gCurRuntime = NULL; @@ -457,6 +457,9 @@ int AndroidRuntime::startVm(JavaVM** pJavaVM, JNIEnv** pEnv) char heapstartsizeOptsBuf[sizeof("-Xms")-1 + PROPERTY_VALUE_MAX]; char heapsizeOptsBuf[sizeof("-Xmx")-1 + PROPERTY_VALUE_MAX]; char heapgrowthlimitOptsBuf[sizeof("-XX:HeapGrowthLimit=")-1 + PROPERTY_VALUE_MAX]; + char heapminfreeOptsBuf[sizeof("-XX:HeapMinFree=")-1 + PROPERTY_VALUE_MAX]; + char heapmaxfreeOptsBuf[sizeof("-XX:HeapMaxFree=")-1 + PROPERTY_VALUE_MAX]; + char heaptargetutilizationOptsBuf[sizeof("-XX:HeapTargetUtilization=")-1 + PROPERTY_VALUE_MAX]; char extraOptsBuf[PROPERTY_VALUE_MAX]; char* stackTraceFile = NULL; bool checkJni = false; @@ -559,6 +562,27 @@ int AndroidRuntime::startVm(JavaVM** pJavaVM, JNIEnv** pEnv) mOptions.add(opt); } + strcpy(heapminfreeOptsBuf, "-XX:HeapMinFree="); + property_get("dalvik.vm.heapminfree", heapminfreeOptsBuf+16, ""); + if (heapminfreeOptsBuf[16] != '\0') { + opt.optionString = heapminfreeOptsBuf; + mOptions.add(opt); + } + + strcpy(heapmaxfreeOptsBuf, "-XX:HeapMaxFree="); + property_get("dalvik.vm.heapmaxfree", heapmaxfreeOptsBuf+16, ""); + if (heapmaxfreeOptsBuf[16] != '\0') { + opt.optionString = heapmaxfreeOptsBuf; + mOptions.add(opt); + } + + strcpy(heaptargetutilizationOptsBuf, "-XX:HeapTargetUtilization="); + property_get("dalvik.vm.heaptargetutilization", heaptargetutilizationOptsBuf+26, ""); + if (heaptargetutilizationOptsBuf[26] != '\0') { + opt.optionString = heaptargetutilizationOptsBuf; + mOptions.add(opt); + } + /* * Enable or disable dexopt features, such as bytecode verification and * calculation of register maps for precise GC. @@ -1092,7 +1116,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), @@ -1101,9 +1124,11 @@ static const RegJNIRec gRegJNI[] = { REG_JNI(register_android_view_GLES20Canvas), REG_JNI(register_android_view_HardwareRenderer), REG_JNI(register_android_view_Surface), + REG_JNI(register_android_view_SurfaceSession), REG_JNI(register_android_view_TextureView), REG_JNI(register_com_google_android_gles_jni_EGLImpl), REG_JNI(register_com_google_android_gles_jni_GLImpl), + REG_JNI(register_android_opengl_jni_EGL14), REG_JNI(register_android_opengl_jni_GLES10), REG_JNI(register_android_opengl_jni_GLES10Ext), REG_JNI(register_android_opengl_jni_GLES11), @@ -1146,7 +1171,7 @@ static const RegJNIRec gRegJNI[] = { REG_JNI(register_android_os_FileUtils), REG_JNI(register_android_os_MessageQueue), REG_JNI(register_android_os_ParcelFileDescriptor), - REG_JNI(register_android_os_StatFs), + REG_JNI(register_android_os_SELinux), REG_JNI(register_android_os_Trace), REG_JNI(register_android_os_UEventObserver), REG_JNI(register_android_net_LocalSocketImpl), @@ -1165,15 +1190,10 @@ static const RegJNIRec gRegJNI[] = { REG_JNI(register_android_media_AudioSystem), REG_JNI(register_android_media_AudioTrack), REG_JNI(register_android_media_JetPlayer), + REG_JNI(register_android_media_RemoteDisplay), REG_JNI(register_android_media_ToneGenerator), REG_JNI(register_android_opengl_classes), - REG_JNI(register_android_bluetooth_HeadsetBase), - REG_JNI(register_android_bluetooth_BluetoothAudioGateway), - REG_JNI(register_android_bluetooth_BluetoothSocket), - REG_JNI(register_android_server_BluetoothService), - REG_JNI(register_android_server_BluetoothEventLoop), - REG_JNI(register_android_server_BluetoothA2dpService), REG_JNI(register_android_server_NetworkManagementSocketTagger), REG_JNI(register_android_server_Watchdog), REG_JNI(register_android_ddm_DdmHandleNativeHeap), @@ -1196,6 +1216,12 @@ static const RegJNIRec gRegJNI[] = { REG_JNI(register_android_animation_PropertyValuesHolder), REG_JNI(register_com_android_internal_content_NativeLibraryHelper), + REG_JNI(register_android_content_res_PackageRedirectionMap), + +#ifdef QCOM_HARDWARE + REG_JNI(register_com_android_internal_app_ActivityTrigger), +#endif + }; /* diff --git a/core/jni/android/graphics/Bitmap.cpp b/core/jni/android/graphics/Bitmap.cpp index 3c27caf65c7f6..63683b4f49542 100644 --- a/core/jni/android/graphics/Bitmap.cpp +++ b/core/jni/android/graphics/Bitmap.cpp @@ -7,7 +7,7 @@ #include "SkUnPreMultiply.h" #include -#include "android_os_Parcel.h" +#include "android_os_Parcel.h" #include "android_util_Binder.h" #include "android_nio_utils.h" #include "CreateJavaOutputStreamAdaptor.h" @@ -145,7 +145,7 @@ static void ToColor_S4444_Alpha(SkColor dst[], const void* src, int width, static void ToColor_S4444_Opaque(SkColor dst[], const void* src, int width, SkColorTable*) { SkASSERT(width > 0); - const SkPMColor* s = (const SkPMColor*)src; + const SkPMColor16* s = (const SkPMColor16*)src; do { SkPMColor c = SkPixel4444ToPixel32(*s++); *dst++ = SkColorSetRGB(SkGetPackedR32(c), SkGetPackedG32(c), @@ -261,14 +261,14 @@ static void Bitmap_destructor(JNIEnv* env, jobject, SkBitmap* bitmap) { delete bitmap; } -static void Bitmap_recycle(JNIEnv* env, jobject, SkBitmap* bitmap) { +static jboolean Bitmap_recycle(JNIEnv* env, jobject, SkBitmap* bitmap) { #ifdef USE_OPENGL_RENDERER if (android::uirenderer::Caches::hasInstance()) { - android::uirenderer::Caches::getInstance().resourceCache.recycle(bitmap); - return; + return android::uirenderer::Caches::getInstance().resourceCache.recycle(bitmap); } #endif // USE_OPENGL_RENDERER bitmap->setPixels(NULL, NULL); + return true; } // These must match the int values in Bitmap.java @@ -298,8 +298,18 @@ static bool Bitmap_compress(JNIEnv* env, jobject clazz, SkBitmap* bitmap, } bool success = false; - SkWStream* strm = CreateJavaOutputStreamAdaptor(env, jstream, jstorage); - if (NULL != strm) { + if (NULL != bitmap) { + SkAutoLockPixels alp(*bitmap); + + if (NULL == bitmap->getPixels()) { + return false; + } + + SkWStream* strm = CreateJavaOutputStreamAdaptor(env, jstream, jstorage); + if (NULL == strm) { + return false; + } + SkImageEncoder* encoder = SkImageEncoder::Create(fm); if (NULL != encoder) { success = encoder->encodeStream(strm, *bitmap, quality); @@ -343,6 +353,15 @@ static void Bitmap_setHasAlpha(JNIEnv* env, jobject, SkBitmap* bitmap, bitmap->setIsOpaque(!hasAlpha); } +static jboolean Bitmap_hasMipMap(JNIEnv* env, jobject, SkBitmap* bitmap) { + return bitmap->hasHardwareMipMap(); +} + +static void Bitmap_setHasMipMap(JNIEnv* env, jobject, SkBitmap* bitmap, + jboolean hasMipMap) { + bitmap->setHasHardwareMipMap(hasMipMap); +} + /////////////////////////////////////////////////////////////////////////////// static jobject Bitmap_createFromParcel(JNIEnv* env, jobject, jobject parcel) { @@ -646,7 +665,7 @@ static JNINativeMethod gBitmapMethods[] = { { "nativeCopy", "(IIZ)Landroid/graphics/Bitmap;", (void*)Bitmap_copy }, { "nativeDestructor", "(I)V", (void*)Bitmap_destructor }, - { "nativeRecycle", "(I)V", (void*)Bitmap_recycle }, + { "nativeRecycle", "(I)Z", (void*)Bitmap_recycle }, { "nativeCompress", "(IIILjava/io/OutputStream;[B)Z", (void*)Bitmap_compress }, { "nativeErase", "(II)V", (void*)Bitmap_erase }, @@ -656,6 +675,8 @@ static JNINativeMethod gBitmapMethods[] = { { "nativeConfig", "(I)I", (void*)Bitmap_config }, { "nativeHasAlpha", "(I)Z", (void*)Bitmap_hasAlpha }, { "nativeSetHasAlpha", "(IZ)V", (void*)Bitmap_setHasAlpha }, + { "nativeHasMipMap", "(I)Z", (void*)Bitmap_hasMipMap }, + { "nativeSetHasMipMap", "(IZ)V", (void*)Bitmap_setHasMipMap }, { "nativeCreateFromParcel", "(Landroid/os/Parcel;)Landroid/graphics/Bitmap;", (void*)Bitmap_createFromParcel }, diff --git a/core/jni/android/graphics/BitmapFactory.cpp b/core/jni/android/graphics/BitmapFactory.cpp index 69ef08099a5d0..88233286e68f0 100644 --- a/core/jni/android/graphics/BitmapFactory.cpp +++ b/core/jni/android/graphics/BitmapFactory.cpp @@ -340,7 +340,9 @@ static jobject doDecode(JNIEnv* env, SkStream* stream, jobject padding, bitmap->setConfig(config, scaledWidth, scaledHeight); bitmap->setIsOpaque(decoded->isOpaque()); - bitmap->allocPixels(&javaAllocator, NULL); + if (!bitmap->allocPixels(&javaAllocator, NULL)) { + return nullObjectReturn("allocation failed for scaled bitmap"); + } bitmap->eraseColor(0); SkPaint paint; diff --git a/core/jni/android/graphics/Canvas.cpp b/core/jni/android/graphics/Canvas.cpp index 6b747055ff953..5d6f73849b8c8 100644 --- a/core/jni/android/graphics/Canvas.cpp +++ b/core/jni/android/graphics/Canvas.cpp @@ -20,6 +20,7 @@ #include "SkCanvas.h" #include "SkDevice.h" +#include "SkDrawFilter.h" #include "SkGraphics.h" #include "SkImageRef_GlobalPool.h" #include "SkPorterDuff.h" @@ -766,8 +767,54 @@ class SkCanvasGlue { if (value == NULL) { return; } - doDrawGlyphs(canvas, value->getGlyphs(), 0, value->getGlyphsCount(), x, y, flags, paint); + SkPaint::Align align = paint->getTextAlign(); + if (align == SkPaint::kCenter_Align) { + x -= 0.5 * value->getTotalAdvance(); + } else if (align == SkPaint::kRight_Align) { + x -= value->getTotalAdvance(); + } + paint->setTextAlign(SkPaint::kLeft_Align); + doDrawGlyphsPos(canvas, value->getGlyphs(), value->getPos(), 0, value->getGlyphsCount(), x, y, flags, paint); + doDrawTextDecorations(canvas, x, y, value->getTotalAdvance(), paint); + paint->setTextAlign(align); + } + +// Same values used by Skia +#define kStdStrikeThru_Offset (-6.0f / 21.0f) +#define kStdUnderline_Offset (1.0f / 9.0f) +#define kStdUnderline_Thickness (1.0f / 18.0f) + +static void doDrawTextDecorations(SkCanvas* canvas, jfloat x, jfloat y, jfloat length, SkPaint* paint) { + uint32_t flags; + SkDrawFilter* drawFilter = canvas->getDrawFilter(); + if (drawFilter) { + SkPaint paintCopy(*paint); + drawFilter->filter(&paintCopy, SkDrawFilter::kText_Type); + flags = paintCopy.getFlags(); + } else { + flags = paint->getFlags(); + } + if (flags & (SkPaint::kUnderlineText_Flag | SkPaint::kStrikeThruText_Flag)) { + SkScalar left = SkFloatToScalar(x); + SkScalar right = SkFloatToScalar(x + length); + float textSize = paint->getTextSize(); + float strokeWidth = fmax(textSize * kStdUnderline_Thickness, 1.0f); + if (flags & SkPaint::kUnderlineText_Flag) { + SkScalar top = SkFloatToScalar(y + textSize * kStdUnderline_Offset + - 0.5f * strokeWidth); + SkScalar bottom = SkFloatToScalar(y + textSize * kStdUnderline_Offset + + 0.5f * strokeWidth); + canvas->drawRectCoords(left, top, right, bottom, *paint); + } + if (flags & SkPaint::kStrikeThruText_Flag) { + SkScalar top = SkFloatToScalar(y + textSize * kStdStrikeThru_Offset + - 0.5f * strokeWidth); + SkScalar bottom = SkFloatToScalar(y + textSize * kStdStrikeThru_Offset + + 0.5f * strokeWidth); + canvas->drawRectCoords(left, top, right, bottom, *paint); + } } +} static void doDrawGlyphs(SkCanvas* canvas, const jchar* glyphArray, int index, int count, jfloat x, jfloat y, int flags, SkPaint* paint) { @@ -775,6 +822,17 @@ class SkCanvasGlue { canvas->drawText(glyphArray + index * 2, count * 2, x, y, *paint); } + static void doDrawGlyphsPos(SkCanvas* canvas, const jchar* glyphArray, const jfloat* posArray, + int index, int count, jfloat x, jfloat y, int flags, SkPaint* paint) { + SkPoint* posPtr = new SkPoint[count]; + for (int indx = 0; indx < count; indx++) { + posPtr[indx].fX = SkFloatToScalar(x + posArray[indx * 2]); + posPtr[indx].fY = SkFloatToScalar(y + posArray[indx * 2 + 1]); + } + canvas->drawPosText(glyphArray, count << 1, posPtr, *paint); + delete[] posPtr; + } + static void drawTextRun___CIIIIFFIPaint( JNIEnv* env, jobject, SkCanvas* canvas, jcharArray text, int index, int count, int contextIndex, int contextCount, @@ -882,6 +940,9 @@ class SkCanvasGlue { SkIRect ir; bool result = canvas->getClipBounds(&r, SkCanvas::kBW_EdgeType); + if (!result) { + r.setEmpty(); + } r.round(&ir); (void)GraphicsJNI::irect_to_jrect(ir, env, bounds); return result; diff --git a/core/jni/android/graphics/CreateJavaOutputStreamAdaptor.cpp b/core/jni/android/graphics/CreateJavaOutputStreamAdaptor.cpp index 6ce3f51925ac2..aa4cbde2f7ca7 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/graphics/Paint.cpp b/core/jni/android/graphics/Paint.cpp index a65262c0cb79f..150caf3c5a957 100644 --- a/core/jni/android/graphics/Paint.cpp +++ b/core/jni/android/graphics/Paint.cpp @@ -22,6 +22,7 @@ #include "jni.h" #include "GraphicsJNI.h" #include +#include #include "SkBlurDrawLooper.h" #include "SkColorFilter.h" @@ -30,6 +31,7 @@ #include "SkShader.h" #include "SkTypeface.h" #include "SkXfermode.h" +#include "unicode/uloc.h" #include "unicode/ushape.h" #include "TextLayout.h" @@ -254,11 +256,51 @@ class SkPaintGlue { obj->setTextAlign(align); } + // generate bcp47 identifier for the supplied locale + static void toLanguageTag(char* output, size_t outSize, + const char* locale) { + if (output == NULL || outSize <= 0) { + return; + } + if (locale == NULL) { + output[0] = '\0'; + return; + } + char canonicalChars[ULOC_FULLNAME_CAPACITY]; + UErrorCode uErr = U_ZERO_ERROR; + uloc_canonicalize(locale, canonicalChars, ULOC_FULLNAME_CAPACITY, + &uErr); + if (U_SUCCESS(uErr)) { + char likelyChars[ULOC_FULLNAME_CAPACITY]; + uErr = U_ZERO_ERROR; + uloc_addLikelySubtags(canonicalChars, likelyChars, + ULOC_FULLNAME_CAPACITY, &uErr); + if (U_SUCCESS(uErr)) { + uErr = U_ZERO_ERROR; + uloc_toLanguageTag(likelyChars, output, outSize, FALSE, &uErr); + if (U_SUCCESS(uErr)) { + return; + } else { + ALOGD("uloc_toLanguageTag(\"%s\") failed: %s", likelyChars, + u_errorName(uErr)); + } + } else { + ALOGD("uloc_addLikelySubtags(\"%s\") failed: %s", + canonicalChars, u_errorName(uErr)); + } + } else { + ALOGD("uloc_canonicalize(\"%s\") failed: %s", locale, + u_errorName(uErr)); + } + // unable to build a proper language identifier + output[0] = '\0'; + } + static void setTextLocale(JNIEnv* env, jobject clazz, SkPaint* obj, jstring locale) { - const char* localeArray = env->GetStringUTFChars(locale, NULL); - SkString skLocale(localeArray); - obj->setTextLocale(skLocale); - env->ReleaseStringUTFChars(locale, localeArray); + ScopedUtfChars localeChars(env, locale); + char langTag[ULOC_FULLNAME_CAPACITY]; + toLanguageTag(langTag, ULOC_FULLNAME_CAPACITY, localeChars.c_str()); + obj->setLanguage(SkLanguage(langTag)); } static jfloat getTextSize(JNIEnv* env, jobject paint) { @@ -587,7 +629,7 @@ class SkPaintGlue { jint count, jint flags, jint offset, jint opt) { jfloat scalarArray[count]; - TextLayout::getTextRunAdvances(paint, text, start, count, count, flags, + TextLayout::getTextRunAdvances(paint, text, start, count, start + count, flags, scalarArray, NULL /* dont need totalAdvance */); jint pos = offset - start; @@ -750,7 +792,7 @@ class SkPaintGlue { static void doTextBounds(JNIEnv* env, const jchar* text, int count, jobject bounds, const SkPaint& paint) { - SkRect r; + SkRect r{0,0,0,0}; SkIRect ir; sp value = TextLayoutEngine::getInstance().getValue(&paint, diff --git a/core/jni/android/graphics/Shader.cpp b/core/jni/android/graphics/Shader.cpp index f4cc9e44d7dfd..6323ab3486233 100644 --- a/core/jni/android/graphics/Shader.cpp +++ b/core/jni/android/graphics/Shader.cpp @@ -150,19 +150,35 @@ static SkiaShader* LinearGradient_postCreate1(JNIEnv* env, jobject o, SkShader* jfloat* storedBounds = new jfloat[4]; storedBounds[0] = x0; storedBounds[1] = y0; storedBounds[2] = x1; storedBounds[3] = y1; - jfloat* storedPositions = new jfloat[count]; - uint32_t* storedColors = new uint32_t[count]; - for (size_t i = 0; i < count; i++) { - storedColors[i] = static_cast(colorValues[i]); - } + + bool missFirst = false; + bool missLast = false; + size_t stopCount = count; + jfloat* storedPositions = NULL; if (posArray) { AutoJavaFloatArray autoPos(env, posArray, count); const float* posValues = autoPos.ptr(); - for (size_t i = 0; i < count; i++) { - storedPositions[i] = posValues[i]; + + missFirst = posValues[0] != 0.0f; + missLast = posValues[count - 1] != 1.0f; + + stopCount += missFirst + missLast; + storedPositions = new jfloat[stopCount]; + + if (missFirst) { + storedPositions[0] = 0.0f; + } + + for (size_t i = missFirst; i < count + missFirst; i++) { + storedPositions[i] = posValues[i - missFirst]; + } + + if (missLast) { + storedPositions[stopCount - 1] = 1.0f; } } else { + storedPositions = new jfloat[count]; storedPositions[0] = 0.0f; const jfloat step = 1.0f / (count - 1); for (size_t i = 1; i < count - 1; i++) { @@ -171,8 +187,22 @@ static SkiaShader* LinearGradient_postCreate1(JNIEnv* env, jobject o, SkShader* storedPositions[count - 1] = 1.0f; } + uint32_t* storedColors = new uint32_t[stopCount]; + + if (missFirst) { + storedColors[0] = static_cast(colorValues[0]); + } + + for (size_t i = missFirst; i < count + missFirst; i++) { + storedColors[i] = static_cast(colorValues[i - missFirst]); + } + + if (missLast) { + storedColors[stopCount - 1] = static_cast(colorValues[count - 1]); + } + SkiaShader* skiaShader = new SkiaLinearGradientShader(storedBounds, storedColors, - storedPositions, count, shader, static_cast(tileMode), NULL, + storedPositions, stopCount, shader, static_cast(tileMode), NULL, (shader->getFlags() & SkShader::kOpaqueAlpha_Flag) == 0); env->ReleaseIntArrayElements(colorArray, const_cast(colorValues), JNI_ABORT); diff --git a/core/jni/android/graphics/TextLayoutCache.cpp b/core/jni/android/graphics/TextLayoutCache.cpp index 35f82a85b9f04..4669c378365b8 100644 --- a/core/jni/android/graphics/TextLayoutCache.cpp +++ b/core/jni/android/graphics/TextLayoutCache.cpp @@ -19,6 +19,7 @@ #include "TextLayoutCache.h" #include "TextLayout.h" #include "SkFontHost.h" +#include "SkTypeface_android.h" #include #include #include @@ -30,14 +31,6 @@ extern "C" { namespace android { //-------------------------------------------------------------------------------------------------- -#define TYPEFACE_ARABIC "/system/fonts/DroidNaskh-Regular-SystemUI.ttf" -#define TYPE_FACE_HEBREW_REGULAR "/system/fonts/DroidSansHebrew-Regular.ttf" -#define TYPE_FACE_HEBREW_BOLD "/system/fonts/DroidSansHebrew-Bold.ttf" -#define TYPEFACE_BENGALI "/system/fonts/Lohit-Bengali.ttf" -#define TYPEFACE_DEVANAGARI_REGULAR "/system/fonts/DroidSansDevanagari-Regular.ttf" -#define TYPEFACE_TAMIL_REGULAR "/system/fonts/DroidSansTamil-Regular.ttf" -#define TYPEFACE_TAMIL_BOLD "/system/fonts/DroidSansTamil-Bold.ttf" -#define TYPEFACE_THAI "/system/fonts/DroidSansThai.ttf" ANDROID_SINGLETON_STATIC_INSTANCE(TextLayoutEngine); @@ -85,8 +78,10 @@ void TextLayoutCache::operator()(TextLayoutCacheKey& text, sp& /* * Cache clearing */ -void TextLayoutCache::clear() { +void TextLayoutCache::purgeCaches() { + AutoMutex _l(mLock); mCache.clear(); + mShaper->purgeCaches(); } /* @@ -116,7 +111,7 @@ sp TextLayoutCache::getValue(const SkPaint* paint, // Compute advances and store them mShaper->computeValues(value.get(), paint, - reinterpret_cast(text), start, count, + reinterpret_cast(key.getText()), start, count, size_t(contextCount), int(dirFlags)); if (mDebugEnabled) { @@ -144,15 +139,12 @@ sp TextLayoutCache::getValue(const SkPaint* paint, // Update current cache size mSize += size; - // Copy the text when we insert the new entry - key.internalTextCopy(); - bool putOne = mCache.put(key, value); LOG_ALWAYS_FATAL_IF(!putOne, "Failed to put an entry into the cache. " "This indicates that the cache already has an entry with the " "same key but it should not since we checked earlier!" " - start = %d, count = %d, contextCount = %d - Text = '%s'", - start, count, contextCount, String8(text + start, count).string()); + start, count, contextCount, String8(key.getText() + start, count).string()); if (mDebugEnabled) { nsecs_t totalTime = systemTime(SYSTEM_TIME_MONOTONIC) - startTime; @@ -163,7 +155,7 @@ sp TextLayoutCache::getValue(const SkPaint* paint, value.get(), start, count, contextCount, size, mMaxSize - mSize, value->getElapsedTime() * 0.000001f, (totalTime - value->getElapsedTime()) * 0.000001f, - String8(text + start, count).string()); + String8(key.getText() + start, count).string()); } } else { if (mDebugEnabled) { @@ -173,7 +165,7 @@ sp TextLayoutCache::getValue(const SkPaint* paint, " - Compute time %0.6f ms - Text = '%s'", start, count, contextCount, size, mMaxSize - mSize, value->getElapsedTime() * 0.000001f, - String8(text + start, count).string()); + String8(key.getText() + start, count).string()); } } } else { @@ -193,7 +185,7 @@ sp TextLayoutCache::getValue(const SkPaint* paint, value->getElapsedTime() * 0.000001f, elapsedTimeThruCacheGet * 0.000001f, deltaPercent, - String8(text + start, count).string()); + String8(key.getText() + start, count).string()); } if (mCacheHitCount % DEFAULT_DUMP_STATS_CACHE_HIT_INTERVAL == 0) { dumpCacheStats(); @@ -230,25 +222,27 @@ void TextLayoutCache::dumpCacheStats() { /** * TextLayoutCacheKey */ -TextLayoutCacheKey::TextLayoutCacheKey(): text(NULL), start(0), count(0), contextCount(0), +TextLayoutCacheKey::TextLayoutCacheKey(): start(0), count(0), contextCount(0), dirFlags(0), typeface(NULL), textSize(0), textSkewX(0), textScaleX(0), flags(0), - hinting(SkPaint::kNo_Hinting) { + hinting(SkPaint::kNo_Hinting), variant(SkPaint::kDefault_Variant), language() { } TextLayoutCacheKey::TextLayoutCacheKey(const SkPaint* paint, const UChar* text, size_t start, size_t count, size_t contextCount, int dirFlags) : - text(text), start(start), count(count), contextCount(contextCount), + start(start), count(count), contextCount(contextCount), dirFlags(dirFlags) { + textCopy.setTo(text, contextCount); typeface = paint->getTypeface(); textSize = paint->getTextSize(); textSkewX = paint->getTextSkewX(); textScaleX = paint->getTextScaleX(); flags = paint->getFlags(); hinting = paint->getHinting(); + variant = paint->getFontVariant(); + language = paint->getLanguage(); } TextLayoutCacheKey::TextLayoutCacheKey(const TextLayoutCacheKey& other) : - text(NULL), textCopy(other.textCopy), start(other.start), count(other.count), @@ -259,10 +253,9 @@ TextLayoutCacheKey::TextLayoutCacheKey(const TextLayoutCacheKey& other) : textSkewX(other.textSkewX), textScaleX(other.textScaleX), flags(other.flags), - hinting(other.hinting) { - if (other.text) { - textCopy.setTo(other.text, other.contextCount); - } + hinting(other.hinting), + variant(other.variant), + language(other.language) { } int TextLayoutCacheKey::compare(const TextLayoutCacheKey& lhs, const TextLayoutCacheKey& rhs) { @@ -296,12 +289,13 @@ int TextLayoutCacheKey::compare(const TextLayoutCacheKey& lhs, const TextLayoutC deltaInt = lhs.dirFlags - rhs.dirFlags; if (deltaInt) return (deltaInt); - return memcmp(lhs.getText(), rhs.getText(), lhs.contextCount * sizeof(UChar)); -} + deltaInt = lhs.variant - rhs.variant; + if (deltaInt) return (deltaInt); -void TextLayoutCacheKey::internalTextCopy() { - textCopy.setTo(text, contextCount); - text = NULL; + if (lhs.language < rhs.language) return -1; + if (lhs.language > rhs.language) return +1; + + return memcmp(lhs.getText(), rhs.getText(), lhs.contextCount * sizeof(UChar)); } size_t TextLayoutCacheKey::getSize() const { @@ -316,11 +310,12 @@ TextLayoutValue::TextLayoutValue(size_t contextCount) : // Give a hint for advances and glyphs vectors size mAdvances.setCapacity(contextCount); mGlyphs.setCapacity(contextCount); + mPos.setCapacity(contextCount * 2); } size_t TextLayoutValue::getSize() const { return sizeof(TextLayoutValue) + sizeof(jfloat) * mAdvances.capacity() + - sizeof(jchar) * mGlyphs.capacity(); + sizeof(jchar) * mGlyphs.capacity() + sizeof(jfloat) * mPos.capacity(); } void TextLayoutValue::setElapsedTime(uint32_t time) { @@ -337,13 +332,9 @@ TextLayoutShaper::TextLayoutShaper() : mShaperItemGlyphArraySize(0) { mFontRec.klass = &harfbuzzSkiaClass; mFontRec.userData = 0; - // The values which harfbuzzSkiaClass returns are already scaled to - // pixel units, so we just set all these to one to disable further - // scaling. - mFontRec.x_ppem = 1; - mFontRec.y_ppem = 1; - mFontRec.x_scale = 1; - mFontRec.y_scale = 1; + // Note that the scaling values (x_ and y_ppem, x_ and y_scale) will be set + // below, when the paint transform and em unit of the actual shaping font + // are known. memset(&mShaperItem, 0, sizeof(mShaperItem)); @@ -353,26 +344,10 @@ TextLayoutShaper::TextLayoutShaper() : mShaperItemGlyphArraySize(0) { void TextLayoutShaper::init() { mDefaultTypeface = SkFontHost::CreateTypeface(NULL, NULL, NULL, 0, SkTypeface::kNormal); - mArabicTypeface = NULL; - mHebrewRegularTypeface = NULL; - mHebrewBoldTypeface = NULL; - mBengaliTypeface = NULL; - mThaiTypeface = NULL; - mDevanagariRegularTypeface = NULL; - mTamilRegularTypeface = NULL; - mTamilBoldTypeface = NULL; } void TextLayoutShaper::unrefTypefaces() { SkSafeUnref(mDefaultTypeface); - SkSafeUnref(mArabicTypeface); - SkSafeUnref(mHebrewRegularTypeface); - SkSafeUnref(mHebrewBoldTypeface); - SkSafeUnref(mBengaliTypeface); - SkSafeUnref(mThaiTypeface); - SkSafeUnref(mDevanagariRegularTypeface); - SkSafeUnref(mTamilRegularTypeface); - SkSafeUnref(mTamilBoldTypeface); } TextLayoutShaper::~TextLayoutShaper() { @@ -384,7 +359,7 @@ void TextLayoutShaper::computeValues(TextLayoutValue* value, const SkPaint* pain size_t start, size_t count, size_t contextCount, int dirFlags) { computeValues(paint, chars, start, count, contextCount, dirFlags, - &value->mAdvances, &value->mTotalAdvance, &value->mGlyphs); + &value->mAdvances, &value->mTotalAdvance, &value->mGlyphs, &value->mPos); #if DEBUG_ADVANCES ALOGD("Advances - start = %d, count = %d, contextCount = %d, totalAdvance = %f", start, count, contextCount, value->mTotalAdvance); @@ -394,9 +369,9 @@ void TextLayoutShaper::computeValues(TextLayoutValue* value, const SkPaint* pain void TextLayoutShaper::computeValues(const SkPaint* paint, const UChar* chars, size_t start, size_t count, size_t contextCount, int dirFlags, Vector* const outAdvances, jfloat* outTotalAdvance, - Vector* const outGlyphs) { + Vector* const outGlyphs, Vector* const outPos) { + *outTotalAdvance = 0; if (!count) { - *outTotalAdvance = 0; return; } @@ -461,6 +436,7 @@ void TextLayoutShaper::computeValues(const SkPaint* paint, const UChar* chars, ALOGW("Visual run is not valid"); outGlyphs->clear(); outAdvances->clear(); + outPos->clear(); *outTotalAdvance = 0; isRTL = (paraDir == 1); useSingleRun = true; @@ -483,15 +459,13 @@ void TextLayoutShaper::computeValues(const SkPaint* paint, const UChar* chars, lengthRun = endRun - startRun; isRTL = (runDir == UBIDI_RTL); - jfloat runTotalAdvance = 0; #if DEBUG_GLYPHS ALOGD("Processing Bidi Run = %d -- run-start = %d, run-len = %d, isRTL = %d", i, startRun, lengthRun, isRTL); #endif computeRunValues(paint, chars + startRun, lengthRun, isRTL, - outAdvances, &runTotalAdvance, outGlyphs); + outAdvances, outTotalAdvance, outGlyphs, outPos); - *outTotalAdvance += runTotalAdvance; } } } else { @@ -514,7 +488,7 @@ void TextLayoutShaper::computeValues(const SkPaint* paint, const UChar* chars, "-- run-start = %d, run-len = %d, isRTL = %d", start, count, isRTL); #endif computeRunValues(paint, chars + start, count, isRTL, - outAdvances, outTotalAdvance, outGlyphs); + outAdvances, outTotalAdvance, outGlyphs, outPos); } #if DEBUG_GLYPHS @@ -536,10 +510,9 @@ static void logGlyphs(HB_ShaperItem shaperItem) { void TextLayoutShaper::computeRunValues(const SkPaint* paint, const UChar* chars, size_t count, bool isRTL, Vector* const outAdvances, jfloat* outTotalAdvance, - Vector* const outGlyphs) { + Vector* const outGlyphs, Vector* const outPos) { if (!count) { // We cannot shape an empty run. - *outTotalAdvance = 0; return; } @@ -639,16 +612,19 @@ void TextLayoutShaper::computeRunValues(const SkPaint* paint, const UChar* chars // Define shaping paint properties mShapingPaint.setTextSize(paint->getTextSize()); - mShapingPaint.setTextSkewX(paint->getTextSkewX()); + float skewX = paint->getTextSkewX(); + mShapingPaint.setTextSkewX(skewX); mShapingPaint.setTextScaleX(paint->getTextScaleX()); mShapingPaint.setFlags(paint->getFlags()); mShapingPaint.setHinting(paint->getHinting()); + mShapingPaint.setFontVariant(paint->getFontVariant()); + mShapingPaint.setLanguage(paint->getLanguage()); // Split the BiDi run into Script runs. Harfbuzz will populate the pos, length and script // into the shaperItem ssize_t indexFontRun = isRTL ? mShaperItem.stringLength - 1 : 0; unsigned numCodePoints = 0; - jfloat totalAdvance = 0; + jfloat totalAdvance = *outTotalAdvance; while ((isRTL) ? hb_utf16_script_run_prev(&numCodePoints, &mShaperItem.item, mShaperItem.string, mShaperItem.stringLength, &indexFontRun): @@ -699,24 +675,24 @@ void TextLayoutShaper::computeRunValues(const SkPaint* paint, const UChar* chars i, HBFixedToFloat(mShaperItem.advances[i])); } #endif - // Get Advances and their total - jfloat currentAdvance = HBFixedToFloat(mShaperItem.advances[mShaperItem.log_clusters[0]]); - jfloat totalFontRunAdvance = currentAdvance; - outAdvances->replaceAt(currentAdvance, startScriptRun); - for (size_t i = 1; i < countScriptRun; i++) { - size_t clusterPrevious = mShaperItem.log_clusters[i - 1]; + jfloat totalFontRunAdvance = 0; + size_t clusterStart = 0; + for (size_t i = 0; i < countScriptRun; i++) { size_t cluster = mShaperItem.log_clusters[i]; - if (cluster != clusterPrevious) { - currentAdvance = HBFixedToFloat(mShaperItem.advances[mShaperItem.log_clusters[i]]); - outAdvances->replaceAt(currentAdvance, startScriptRun + i); + size_t clusterNext = i == countScriptRun - 1 ? mShaperItem.num_glyphs : + mShaperItem.log_clusters[i + 1]; + if (cluster != clusterNext) { + jfloat advance = 0; + // The advance for the cluster is the sum of the advances of all glyphs within + // the cluster. + for (size_t j = cluster; j < clusterNext; j++) { + advance += HBFixedToFloat(mShaperItem.advances[j]); + } + totalFontRunAdvance += advance; + outAdvances->replaceAt(advance, startScriptRun + clusterStart); + clusterStart = i + 1; } } - // TODO: can be removed and go back in the previous loop when Harfbuzz log clusters are fixed - for (size_t i = 1; i < mShaperItem.num_glyphs; i++) { - currentAdvance = HBFixedToFloat(mShaperItem.advances[i]); - totalFontRunAdvance += currentAdvance; - } - totalAdvance += totalFontRunAdvance; #if DEBUG_ADVANCES ALOGD("Returned advances"); @@ -741,6 +717,30 @@ void TextLayoutShaper::computeRunValues(const SkPaint* paint, const UChar* chars outGlyphs->add(glyph); } } + + // Get glyph positions (and reverse them in place if RTL) + if (outPos) { + size_t countGlyphs = mShaperItem.num_glyphs; + jfloat x = totalAdvance; + for (size_t i = 0; i < countGlyphs; i++) { + size_t index = (!isRTL) ? i : countGlyphs - 1 - i; + float xo = HBFixedToFloat(mShaperItem.offsets[index].x); + float yo = HBFixedToFloat(mShaperItem.offsets[index].y); + // Apply skewX component of transform to position offsets. Note + // that scale has already been applied through x_ and y_scale + // set in the mFontRec. + outPos->add(x + xo + yo * skewX); + outPos->add(yo); +#if DEBUG_GLYPHS + ALOGD(" -- hb adv[%d] = %f, log_cluster[%d] = %d", + index, HBFixedToFloat(mShaperItem.advances[index]), + index, mShaperItem.log_clusters[index]); +#endif + x += HBFixedToFloat(mShaperItem.advances[index]); + } + } + + totalAdvance += totalFontRunAdvance; } *outTotalAdvance = totalAdvance; @@ -758,103 +758,30 @@ void TextLayoutShaper::computeRunValues(const SkPaint* paint, const UChar* chars * assumption is that its lifetime is managed elsewhere - in particular, the fallback typefaces * for the default font live in a global cache. */ -SkTypeface* TextLayoutShaper::typefaceForUnichar(const SkPaint* paint, SkTypeface* typeface, - SkUnichar unichar, HB_Script script) { - // Set the correct Typeface depending on the script - switch (script) { - case HB_Script_Arabic: - typeface = getCachedTypeface(&mArabicTypeface, TYPEFACE_ARABIC); -#if DEBUG_GLYPHS - ALOGD("Using Arabic Typeface"); -#endif - break; - - case HB_Script_Hebrew: - if (typeface) { - switch (typeface->style()) { - case SkTypeface::kBold: - case SkTypeface::kBoldItalic: - typeface = getCachedTypeface(&mHebrewBoldTypeface, TYPE_FACE_HEBREW_BOLD); -#if DEBUG_GLYPHS - ALOGD("Using Hebrew Bold/BoldItalic Typeface"); -#endif - break; - - case SkTypeface::kNormal: - case SkTypeface::kItalic: - default: - typeface = getCachedTypeface(&mHebrewRegularTypeface, TYPE_FACE_HEBREW_REGULAR); -#if DEBUG_GLYPHS - ALOGD("Using Hebrew Regular/Italic Typeface"); -#endif - break; - } - } else { - typeface = getCachedTypeface(&mHebrewRegularTypeface, TYPE_FACE_HEBREW_REGULAR); -#if DEBUG_GLYPHS - ALOGD("Using Hebrew Regular Typeface"); -#endif - } - break; - - case HB_Script_Bengali: - typeface = getCachedTypeface(&mBengaliTypeface, TYPEFACE_BENGALI); -#if DEBUG_GLYPHS - ALOGD("Using Bengali Typeface"); -#endif - break; - - case HB_Script_Thai: - typeface = getCachedTypeface(&mThaiTypeface, TYPEFACE_THAI); -#if DEBUG_GLYPHS - ALOGD("Using Thai Typeface"); -#endif - break; - - case HB_Script_Devanagari: - typeface = getCachedTypeface(&mDevanagariRegularTypeface, TYPEFACE_DEVANAGARI_REGULAR); -#if DEBUG_GLYPHS - ALOGD("Using Devanagari Regular Typeface"); -#endif - break; - - case HB_Script_Tamil: - if (typeface) { - switch (typeface->style()) { - case SkTypeface::kBold: - case SkTypeface::kBoldItalic: - typeface = getCachedTypeface(&mTamilBoldTypeface, TYPEFACE_TAMIL_BOLD); -#if DEBUG_GLYPHS - ALOGD("Using Tamil Bold Typeface"); -#endif - break; - - case SkTypeface::kNormal: - case SkTypeface::kItalic: - default: - typeface = getCachedTypeface(&mTamilRegularTypeface, TYPEFACE_TAMIL_REGULAR); -#if DEBUG_GLYPHS - ALOGD("Using Tamil Regular Typeface"); -#endif - break; - } - } else { - typeface = getCachedTypeface(&mTamilRegularTypeface, TYPEFACE_TAMIL_REGULAR); +SkTypeface* TextLayoutShaper::typefaceForScript(const SkPaint* paint, SkTypeface* typeface, + HB_Script script) { + SkTypeface::Style currentStyle = SkTypeface::kNormal; + if (typeface) { + currentStyle = typeface->style(); + } + typeface = SkCreateTypefaceForScript(script, currentStyle); #if DEBUG_GLYPHS - ALOGD("Using Tamil Regular Typeface"); + ALOGD("Using Harfbuzz Script %d, Style %d", script, currentStyle); #endif - } - break; + return typeface; +} +bool TextLayoutShaper::isComplexScript(HB_Script script) { + switch (script) { + case HB_Script_Common: + case HB_Script_Greek: + case HB_Script_Cyrillic: + case HB_Script_Hangul: + case HB_Script_Inherited: + return false; default: -#if DEBUG_GLYPHS - if (typeface) { - ALOGD("Using Paint Typeface"); - } -#endif - break; + return true; } - return typeface; } size_t TextLayoutShaper::shapeFontRun(const SkPaint* paint, bool isRTL) { @@ -872,63 +799,76 @@ size_t TextLayoutShaper::shapeFontRun(const SkPaint* paint, bool isRTL) { // If we are a "common" script we dont need to shift size_t baseGlyphCount = 0; SkUnichar firstUnichar = 0; - switch (mShaperItem.item.script) { - case HB_Script_Arabic: - case HB_Script_Hebrew: - case HB_Script_Bengali: - case HB_Script_Devanagari: - case HB_Script_Tamil: - case HB_Script_Thai:{ - const uint16_t* text16 = (const uint16_t*)(mShaperItem.string + mShaperItem.item.pos); + if (isComplexScript(mShaperItem.item.script)) { + const uint16_t* text16 = (const uint16_t*) (mShaperItem.string + mShaperItem.item.pos); const uint16_t* text16End = text16 + mShaperItem.item.length; firstUnichar = SkUTF16_NextUnichar(&text16); while (firstUnichar == ' ' && text16 < text16End) { firstUnichar = SkUTF16_NextUnichar(&text16); } baseGlyphCount = paint->getBaseGlyphCount(firstUnichar); - break; - } - default: - break; } - // We test the baseGlyphCount to see if the typeface supports the requested script if (baseGlyphCount != 0) { - typeface = typefaceForUnichar(paint, typeface, firstUnichar, mShaperItem.item.script); - } - - if (!typeface) { - typeface = mDefaultTypeface; + typeface = typefaceForScript(paint, typeface, mShaperItem.item.script); + if (!typeface) { + typeface = mDefaultTypeface; + SkSafeRef(typeface); #if DEBUG_GLYPHS - ALOGD("Using Default Typeface"); + ALOGD("Using Default Typeface"); #endif + } + } else { + if (!typeface) { + typeface = mDefaultTypeface; +#if DEBUG_GLYPHS + ALOGD("Using Default Typeface"); +#endif + } + SkSafeRef(typeface); } + mShapingPaint.setTypeface(typeface); mShaperItem.face = getCachedHBFace(typeface); + int textSize = paint->getTextSize(); + float scaleX = paint->getTextScaleX(); + mFontRec.x_ppem = floor(scaleX * textSize + 0.5); + mFontRec.y_ppem = textSize; + uint32_t unitsPerEm = SkFontHost::GetUnitsPerEm(typeface->uniqueID()); + // x_ and y_scale are the conversion factors from font design space + // (unitsPerEm) to 1/64th of device pixels in 16.16 format. + const int kDevicePixelFraction = 64; + const int kMultiplyFor16Dot16 = 1 << 16; + float emScale = kDevicePixelFraction * kMultiplyFor16Dot16 / (float)unitsPerEm; + mFontRec.x_scale = emScale * scaleX * textSize; + mFontRec.y_scale = emScale * textSize; + #if DEBUG_GLYPHS ALOGD("Run typeface = %p, uniqueID = %d, hb_face = %p", typeface, typeface->uniqueID(), mShaperItem.face); #endif + SkSafeUnref(typeface); // Shape assert(mShaperItem.item.length > 0); // Harfbuzz will overwrite other memory if length is 0. - ensureShaperItemGlyphArrays(mShaperItem.item.length * 3 / 2); - mShaperItem.num_glyphs = mShaperItemGlyphArraySize; - while (!HB_ShapeItem(&mShaperItem)) { + size_t size = mShaperItem.item.length * 3 / 2; + while (!doShaping(size)) { // We overflowed our glyph arrays. Resize and retry. // HB_ShapeItem fills in shaperItem.num_glyphs with the needed size. - ensureShaperItemGlyphArrays(mShaperItem.num_glyphs * 2); - mShaperItem.num_glyphs = mShaperItemGlyphArraySize; + size = mShaperItem.num_glyphs * 2; } return baseGlyphCount; } -void TextLayoutShaper::ensureShaperItemGlyphArrays(size_t size) { +bool TextLayoutShaper::doShaping(size_t size) { if (size > mShaperItemGlyphArraySize) { deleteShaperItemGlyphArrays(); createShaperItemGlyphArrays(size); } + mShaperItem.num_glyphs = mShaperItemGlyphArraySize; + memset(mShaperItem.offsets, 0, mShaperItem.num_glyphs * sizeof(HB_FixedPoint)); + return HB_ShapeItem(&mShaperItem); } void TextLayoutShaper::createShaperItemGlyphArrays(size_t size) { @@ -957,24 +897,6 @@ void TextLayoutShaper::deleteShaperItemGlyphArrays() { delete[] mShaperItem.log_clusters; } -SkTypeface* TextLayoutShaper::getCachedTypeface(SkTypeface** typeface, const char path[]) { - if (!*typeface) { - *typeface = SkTypeface::CreateFromFile(path); - // CreateFromFile(path) can return NULL if the path is non existing - if (!*typeface) { -#if DEBUG_GLYPHS - ALOGD("Font path '%s' is not valid, will use default font", path); -#endif - return mDefaultTypeface; - } - (*typeface)->ref(); -#if DEBUG_GLYPHS - ALOGD("Created SkTypeface from file '%s' with uniqueID = %d", path, (*typeface)->uniqueID()); -#endif - } - return *typeface; -} - HB_Face TextLayoutShaper::getCachedHBFace(SkTypeface* typeface) { SkFontID fontId = typeface->uniqueID(); ssize_t index = mCachedHBFaces.indexOfKey(fontId); @@ -1035,8 +957,7 @@ sp TextLayoutEngine::getValue(const SkPaint* paint, const jchar void TextLayoutEngine::purgeCaches() { #if USE_TEXT_LAYOUT_CACHE - mTextLayoutCache->clear(); - mShaper->purgeCaches(); + mTextLayoutCache->purgeCaches(); #if DEBUG_GLYPHS ALOGD("Purged TextLayoutEngine caches"); #endif diff --git a/core/jni/android/graphics/TextLayoutCache.h b/core/jni/android/graphics/TextLayoutCache.h index cb15a2ad24323..9994393a091ee 100644 --- a/core/jni/android/graphics/TextLayoutCache.h +++ b/core/jni/android/graphics/TextLayoutCache.h @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -56,7 +57,7 @@ #define MB(s) s * 1024 * 1024 // Define the default cache size in Mb -#define DEFAULT_TEXT_LAYOUT_CACHE_SIZE_IN_MB 0.250f +#define DEFAULT_TEXT_LAYOUT_CACHE_SIZE_IN_MB 0.500f // Define the interval in number of cache hits between two statistics dump #define DEFAULT_DUMP_STATS_CACHE_HIT_INTERVAL 100 @@ -75,12 +76,6 @@ class TextLayoutCacheKey { TextLayoutCacheKey(const TextLayoutCacheKey& other); - /** - * We need to copy the text when we insert the key into the cache itself. - * We don't need to copy the text when we are only comparing keys. - */ - void internalTextCopy(); - /** * Get the size of the Cache key. */ @@ -88,8 +83,9 @@ class TextLayoutCacheKey { static int compare(const TextLayoutCacheKey& lhs, const TextLayoutCacheKey& rhs); + inline const UChar* getText() const { return textCopy.string(); } + private: - const UChar* text; // if text is NULL, use textCopy String16 textCopy; size_t start; size_t count; @@ -101,8 +97,8 @@ class TextLayoutCacheKey { SkScalar textScaleX; uint32_t flags; SkPaint::Hinting hinting; - - inline const UChar* getText() const { return text ? text : textCopy.string(); } + SkPaint::FontVariant variant; + SkLanguage language; }; // TextLayoutCacheKey @@ -129,6 +125,8 @@ class TextLayoutValue : public RefBase { inline jfloat getTotalAdvance() const { return mTotalAdvance; } inline const jchar* getGlyphs() const { return mGlyphs.array(); } inline size_t getGlyphsCount() const { return mGlyphs.size(); } + inline const jfloat* getPos() const { return mPos.array(); } + inline size_t getPosCount() const { return mPos.size(); } /** * Advances vector @@ -145,6 +143,11 @@ class TextLayoutValue : public RefBase { */ Vector mGlyphs; + /** + * Pos vector (2 * i is x pos, 2 * i + 1 is y pos, same as drawPosText) + */ + Vector mPos; + /** * Get the size of the Cache entry */ @@ -188,17 +191,9 @@ class TextLayoutShaper { SkPaint mShapingPaint; /** - * Skia typefaces cached for shaping + * Skia default typeface to be returned if we cannot resolve script */ SkTypeface* mDefaultTypeface; - SkTypeface* mArabicTypeface; - SkTypeface* mHebrewRegularTypeface; - SkTypeface* mHebrewBoldTypeface; - SkTypeface* mBengaliTypeface; - SkTypeface* mThaiTypeface; - SkTypeface* mDevanagariRegularTypeface; - SkTypeface* mTamilRegularTypeface; - SkTypeface* mTamilBoldTypeface; /** * Cache of Harfbuzz faces @@ -223,27 +218,28 @@ class TextLayoutShaper { void init(); void unrefTypefaces(); - SkTypeface* typefaceForUnichar(const SkPaint* paint, SkTypeface* typeface, - SkUnichar unichar, HB_Script script); + SkTypeface* typefaceForScript(const SkPaint* paint, SkTypeface* typeface, + HB_Script script); size_t shapeFontRun(const SkPaint* paint, bool isRTL); void computeValues(const SkPaint* paint, const UChar* chars, size_t start, size_t count, size_t contextCount, int dirFlags, Vector* const outAdvances, jfloat* outTotalAdvance, - Vector* const outGlyphs); + Vector* const outGlyphs, Vector* const outPos); void computeRunValues(const SkPaint* paint, const UChar* chars, size_t count, bool isRTL, Vector* const outAdvances, jfloat* outTotalAdvance, - Vector* const outGlyphs); + Vector* const outGlyphs, Vector* const outPos); - SkTypeface* getCachedTypeface(SkTypeface** typeface, const char path[]); + SkTypeface* getCachedTypeface(SkTypeface** typeface, HB_Script script, SkTypeface::Style style); HB_Face getCachedHBFace(SkTypeface* typeface); - void ensureShaperItemGlyphArrays(size_t size); + bool doShaping(size_t size); void createShaperItemGlyphArrays(size_t size); void deleteShaperItemGlyphArrays(); + bool isComplexScript(HB_Script script); }; // TextLayoutShaper @@ -273,7 +269,7 @@ class TextLayoutCache : private OnEntryRemoved { TextLayoutEngine(); virtual ~TextLayoutEngine(); + /** + * Note: this method currently does a defensive copy of the text argument, in case + * there is concurrent mutation of it. The contract may change, and may in the + * future require the caller to guarantee that the contents will not change during + * the call. Be careful of this when doing optimization. + **/ sp getValue(const SkPaint* paint, const jchar* text, jint start, jint count, jint contextCount, jint dirFlags); diff --git a/core/jni/android/graphics/YuvToJpegEncoder.cpp b/core/jni/android/graphics/YuvToJpegEncoder.cpp index 8333e00057d64..f3869058230b5 100644 --- a/core/jni/android/graphics/YuvToJpegEncoder.cpp +++ b/core/jni/android/graphics/YuvToJpegEncoder.cpp @@ -90,8 +90,9 @@ void Yuv420SpToJpegEncoder::compress(jpeg_compress_struct* cinfo, // process 16 lines of Y and 8 lines of U/V each time. while (cinfo->next_scanline < cinfo->image_height) { //deitnerleave u and v - deinterleave(vuPlanar, uRows, vRows, cinfo->next_scanline, width); + deinterleave(vuPlanar, uRows, vRows, cinfo->next_scanline, width, height); + // Jpeg library ignores the rows whose indices are greater than height. for (int i = 0; i < 16; i++) { // y row y[i] = yPlanar + (cinfo->next_scanline + i) * fStrides[0]; @@ -112,8 +113,10 @@ void Yuv420SpToJpegEncoder::compress(jpeg_compress_struct* cinfo, } void Yuv420SpToJpegEncoder::deinterleave(uint8_t* vuPlanar, uint8_t* uRows, - uint8_t* vRows, int rowIndex, int width) { - for (int row = 0; row < 8; ++row) { + uint8_t* vRows, int rowIndex, int width, int height) { + int numRows = (height - rowIndex) / 2; + if (numRows > 8) numRows = 8; + for (int row = 0; row < numRows; ++row) { int offset = ((rowIndex >> 1) + row) * fStrides[1]; uint8_t* vu = vuPlanar + offset; for (int i = 0; i < (width >> 1); ++i) { @@ -164,6 +167,7 @@ void Yuv422IToJpegEncoder::compress(jpeg_compress_struct* cinfo, while (cinfo->next_scanline < cinfo->image_height) { deinterleave(yuvOffset, yRows, uRows, vRows, cinfo->next_scanline, width, height); + // Jpeg library ignores the rows whose indices are greater than height. for (int i = 0; i < 16; i++) { // y row y[i] = yRows + i * width; @@ -185,7 +189,9 @@ void Yuv422IToJpegEncoder::compress(jpeg_compress_struct* cinfo, void Yuv422IToJpegEncoder::deinterleave(uint8_t* yuv, uint8_t* yRows, uint8_t* uRows, uint8_t* vRows, int rowIndex, int width, int height) { - for (int row = 0; row < 16; ++row) { + int numRows = height - rowIndex; + if (numRows > 16) numRows = 16; + for (int row = 0; row < numRows; ++row) { uint8_t* yuvSeg = yuv + (rowIndex + row) * fStrides[0]; for (int i = 0; i < (width >> 1); ++i) { int indexY = row * width + (i << 1); diff --git a/core/jni/android/graphics/YuvToJpegEncoder.h b/core/jni/android/graphics/YuvToJpegEncoder.h index 97106ce628450..0d418ed38a385 100644 --- a/core/jni/android/graphics/YuvToJpegEncoder.h +++ b/core/jni/android/graphics/YuvToJpegEncoder.h @@ -55,7 +55,7 @@ class Yuv420SpToJpegEncoder : public YuvToJpegEncoder { void deinterleaveYuv(uint8_t* yuv, int width, int height, uint8_t*& yPlanar, uint8_t*& uPlanar, uint8_t*& vPlanar); void deinterleave(uint8_t* vuPlanar, uint8_t* uRows, uint8_t* vRows, - int rowIndex, int width); + int rowIndex, int width, int height); void compress(jpeg_compress_struct* cinfo, uint8_t* yuv, int* offsets); }; diff --git a/core/jni/android_app_NativeActivity.cpp b/core/jni/android_app_NativeActivity.cpp index 074afa3e38dc5..21162f43a9fef 100644 --- a/core/jni/android_app_NativeActivity.cpp +++ b/core/jni/android_app_NativeActivity.cpp @@ -436,7 +436,7 @@ struct NativeCode : public ANativeActivity { void setSurface(jobject _surface) { if (_surface != NULL) { - nativeWindow = android_Surface_getNativeWindow(env, _surface); + nativeWindow = android_view_Surface_getNativeWindow(env, _surface); } else { nativeWindow = NULL; } diff --git a/core/jni/android_bluetooth_BluetoothAudioGateway.cpp b/core/jni/android_bluetooth_BluetoothAudioGateway.cpp deleted file mode 100644 index 294c626be4707..0000000000000 --- a/core/jni/android_bluetooth_BluetoothAudioGateway.cpp +++ /dev/null @@ -1,553 +0,0 @@ -/* -** Copyright 2006, 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 "BluetoothAudioGateway.cpp" - -#include "android_bluetooth_common.h" -#include "android_bluetooth_c.h" -#include "android_runtime/AndroidRuntime.h" -#include "JNIHelp.h" -#include "jni.h" -#include "utils/Log.h" -#include "utils/misc.h" - -#define USE_ACCEPT_DIRECTLY (0) -#define USE_SELECT (0) /* 1 for select(), 0 for poll(); used only when - USE_ACCEPT_DIRECTLY == 0 */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#if USE_SELECT -#include -#else -#include -#endif - -#ifdef HAVE_BLUETOOTH -#include -#include -#include -#endif - -namespace android { - -#ifdef HAVE_BLUETOOTH -static jfieldID field_mNativeData; - /* in */ -static jfieldID field_mHandsfreeAgRfcommChannel; -static jfieldID field_mHeadsetAgRfcommChannel; - /* out */ -static jfieldID field_mTimeoutRemainingMs; /* out */ - -static jfieldID field_mConnectingHeadsetAddress; -static jfieldID field_mConnectingHeadsetRfcommChannel; /* -1 when not connected */ -static jfieldID field_mConnectingHeadsetSocketFd; - -static jfieldID field_mConnectingHandsfreeAddress; -static jfieldID field_mConnectingHandsfreeRfcommChannel; /* -1 when not connected */ -static jfieldID field_mConnectingHandsfreeSocketFd; - - -typedef struct { - int hcidev; - int hf_ag_rfcomm_channel; - int hs_ag_rfcomm_channel; - int hf_ag_rfcomm_sock; - int hs_ag_rfcomm_sock; -} native_data_t; - -static inline native_data_t * get_native_data(JNIEnv *env, jobject object) { - return (native_data_t *)(env->GetIntField(object, - field_mNativeData)); -} - -static int setup_listening_socket(int dev, int channel); -#endif - -static void classInitNative(JNIEnv* env, jclass clazz) { - ALOGV("%s", __FUNCTION__); -#ifdef HAVE_BLUETOOTH - - /* in */ - field_mNativeData = get_field(env, clazz, "mNativeData", "I"); - field_mHandsfreeAgRfcommChannel = - get_field(env, clazz, "mHandsfreeAgRfcommChannel", "I"); - field_mHeadsetAgRfcommChannel = - get_field(env, clazz, "mHeadsetAgRfcommChannel", "I"); - - /* out */ - field_mConnectingHeadsetAddress = - get_field(env, clazz, - "mConnectingHeadsetAddress", "Ljava/lang/String;"); - field_mConnectingHeadsetRfcommChannel = - get_field(env, clazz, "mConnectingHeadsetRfcommChannel", "I"); - field_mConnectingHeadsetSocketFd = - get_field(env, clazz, "mConnectingHeadsetSocketFd", "I"); - - field_mConnectingHandsfreeAddress = - get_field(env, clazz, - "mConnectingHandsfreeAddress", "Ljava/lang/String;"); - field_mConnectingHandsfreeRfcommChannel = - get_field(env, clazz, "mConnectingHandsfreeRfcommChannel", "I"); - field_mConnectingHandsfreeSocketFd = - get_field(env, clazz, "mConnectingHandsfreeSocketFd", "I"); - - field_mTimeoutRemainingMs = - get_field(env, clazz, "mTimeoutRemainingMs", "I"); -#endif -} - -static void initializeNativeDataNative(JNIEnv* env, jobject object) { - ALOGV("%s", __FUNCTION__); -#ifdef HAVE_BLUETOOTH - native_data_t *nat = (native_data_t *)calloc(1, sizeof(native_data_t)); - if (NULL == nat) { - ALOGE("%s: out of memory!", __FUNCTION__); - return; - } - - nat->hcidev = BLUETOOTH_ADAPTER_HCI_NUM; - - env->SetIntField(object, field_mNativeData, (jint)nat); - nat->hf_ag_rfcomm_channel = - env->GetIntField(object, field_mHandsfreeAgRfcommChannel); - nat->hs_ag_rfcomm_channel = - env->GetIntField(object, field_mHeadsetAgRfcommChannel); - ALOGV("HF RFCOMM channel = %d.", nat->hf_ag_rfcomm_channel); - ALOGV("HS RFCOMM channel = %d.", nat->hs_ag_rfcomm_channel); - - /* Set the default values of these to -1. */ - env->SetIntField(object, field_mConnectingHeadsetRfcommChannel, -1); - env->SetIntField(object, field_mConnectingHandsfreeRfcommChannel, -1); - - nat->hf_ag_rfcomm_sock = -1; - nat->hs_ag_rfcomm_sock = -1; -#endif -} - -static void cleanupNativeDataNative(JNIEnv* env, jobject object) { - ALOGV("%s", __FUNCTION__); -#ifdef HAVE_BLUETOOTH - native_data_t *nat = get_native_data(env, object); - if (nat) { - free(nat); - } -#endif -} - -#ifdef HAVE_BLUETOOTH - -#if USE_ACCEPT_DIRECTLY==0 -static int set_nb(int sk, bool nb) { - int flags = fcntl(sk, F_GETFL); - if (flags < 0) { - ALOGE("Can't get socket flags with fcntl(): %s (%d)", - strerror(errno), errno); - close(sk); - return -1; - } - flags &= ~O_NONBLOCK; - if (nb) flags |= O_NONBLOCK; - int status = fcntl(sk, F_SETFL, flags); - if (status < 0) { - ALOGE("Can't set socket to nonblocking mode with fcntl(): %s (%d)", - strerror(errno), errno); - close(sk); - return -1; - } - return 0; -} -#endif /*USE_ACCEPT_DIRECTLY==0*/ - -static int do_accept(JNIEnv* env, jobject object, int ag_fd, - jfieldID out_fd, - jfieldID out_address, - jfieldID out_channel) { - -#if USE_ACCEPT_DIRECTLY==0 - if (set_nb(ag_fd, true) < 0) - return -1; -#endif - - struct sockaddr_rc raddr; - int alen = sizeof(raddr); - int nsk = TEMP_FAILURE_RETRY(accept(ag_fd, (struct sockaddr *) &raddr, &alen)); - if (nsk < 0) { - ALOGE("Error on accept from socket fd %d: %s (%d).", - ag_fd, - strerror(errno), - errno); -#if USE_ACCEPT_DIRECTLY==0 - set_nb(ag_fd, false); -#endif - return -1; - } - - env->SetIntField(object, out_fd, nsk); - env->SetIntField(object, out_channel, raddr.rc_channel); - - char addr[BTADDR_SIZE]; - get_bdaddr_as_string(&raddr.rc_bdaddr, addr); - env->SetObjectField(object, out_address, env->NewStringUTF(addr)); - - ALOGI("Successful accept() on AG socket %d: new socket %d, address %s, RFCOMM channel %d", - ag_fd, - nsk, - addr, - raddr.rc_channel); -#if USE_ACCEPT_DIRECTLY==0 - set_nb(ag_fd, false); -#endif - return 0; -} - -#if USE_SELECT -static inline int on_accept_set_fields(JNIEnv* env, jobject object, - fd_set *rset, int ag_fd, - jfieldID out_fd, - jfieldID out_address, - jfieldID out_channel) { - - env->SetIntField(object, out_channel, -1); - - if (ag_fd >= 0 && FD_ISSET(ag_fd, &rset)) { - return do_accept(env, object, ag_fd, - out_fd, out_address, out_channel); - } - else { - ALOGI("fd = %d, FD_ISSET() = %d", - ag_fd, - FD_ISSET(ag_fd, &rset)); - if (ag_fd >= 0 && !FD_ISSET(ag_fd, &rset)) { - ALOGE("WTF???"); - return -1; - } - } - - return 0; -} -#endif -#endif /* HAVE_BLUETOOTH */ - -static jboolean waitForHandsfreeConnectNative(JNIEnv* env, jobject object, - jint timeout_ms) { -// ALOGV("%s", __FUNCTION__); -#ifdef HAVE_BLUETOOTH - - env->SetIntField(object, field_mTimeoutRemainingMs, timeout_ms); - - int n = 0; - native_data_t *nat = get_native_data(env, object); -#if USE_ACCEPT_DIRECTLY - if (nat->hf_ag_rfcomm_channel > 0) { - ALOGI("Setting HF AG server socket to RFCOMM port %d!", - nat->hf_ag_rfcomm_channel); - struct timeval tv; - int len = sizeof(tv); - if (getsockopt(nat->hf_ag_rfcomm_channel, - SOL_SOCKET, SO_RCVTIMEO, &tv, &len) < 0) { - ALOGE("getsockopt(%d, SOL_SOCKET, SO_RCVTIMEO): %s (%d)", - nat->hf_ag_rfcomm_channel, - strerror(errno), - errno); - return JNI_FALSE; - } - ALOGI("Current HF AG server socket RCVTIMEO is (%d(s), %d(us))!", - (int)tv.tv_sec, (int)tv.tv_usec); - if (timeout_ms >= 0) { - tv.tv_sec = timeout_ms / 1000; - tv.tv_usec = 1000 * (timeout_ms % 1000); - if (setsockopt(nat->hf_ag_rfcomm_channel, - SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)) < 0) { - ALOGE("setsockopt(%d, SOL_SOCKET, SO_RCVTIMEO): %s (%d)", - nat->hf_ag_rfcomm_channel, - strerror(errno), - errno); - return JNI_FALSE; - } - ALOGI("Changed HF AG server socket RCVTIMEO to (%d(s), %d(us))!", - (int)tv.tv_sec, (int)tv.tv_usec); - } - - if (!do_accept(env, object, nat->hf_ag_rfcomm_sock, - field_mConnectingHandsfreeSocketFd, - field_mConnectingHandsfreeAddress, - field_mConnectingHandsfreeRfcommChannel)) - { - env->SetIntField(object, field_mTimeoutRemainingMs, 0); - return JNI_TRUE; - } - return JNI_FALSE; - } -#else -#if USE_SELECT - fd_set rset; - FD_ZERO(&rset); - int cnt = 0; - if (nat->hf_ag_rfcomm_channel > 0) { - ALOGI("Setting HF AG server socket to RFCOMM port %d!", - nat->hf_ag_rfcomm_channel); - cnt++; - FD_SET(nat->hf_ag_rfcomm_sock, &rset); - } - if (nat->hs_ag_rfcomm_channel > 0) { - ALOGI("Setting HS AG server socket to RFCOMM port %d!", - nat->hs_ag_rfcomm_channel); - cnt++; - FD_SET(nat->hs_ag_rfcomm_sock, &rset); - } - if (cnt == 0) { - ALOGE("Neither HF nor HS listening sockets are open!"); - return JNI_FALSE; - } - - struct timeval to; - if (timeout_ms >= 0) { - to.tv_sec = timeout_ms / 1000; - to.tv_usec = 1000 * (timeout_ms % 1000); - } - n = TEMP_FAILURE_RETRY(select( - MAX(nat->hf_ag_rfcomm_sock, nat->hs_ag_rfcomm_sock) + 1, - &rset, - NULL, - NULL, - (timeout_ms < 0 ? NULL : &to))); - if (timeout_ms > 0) { - jint remaining = to.tv_sec*1000 + to.tv_usec/1000; - ALOGI("Remaining time %ldms", (long)remaining); - env->SetIntField(object, field_mTimeoutRemainingMs, - remaining); - } - - ALOGI("listening select() returned %d", n); - - if (n <= 0) { - if (n < 0) { - ALOGE("listening select() on RFCOMM sockets: %s (%d)", - strerror(errno), - errno); - } - return JNI_FALSE; - } - - n = on_accept_set_fields(env, object, - &rset, nat->hf_ag_rfcomm_sock, - field_mConnectingHandsfreeSocketFd, - field_mConnectingHandsfreeAddress, - field_mConnectingHandsfreeRfcommChannel); - - n += on_accept_set_fields(env, object, - &rset, nat->hs_ag_rfcomm_sock, - field_mConnectingHeadsetSocketFd, - field_mConnectingHeadsetAddress, - field_mConnectingHeadsetRfcommChannel); - - return !n ? JNI_TRUE : JNI_FALSE; -#else - struct pollfd fds[2]; - int cnt = 0; - if (nat->hf_ag_rfcomm_channel > 0) { -// ALOGI("Setting HF AG server socket %d to RFCOMM port %d!", -// nat->hf_ag_rfcomm_sock, -// nat->hf_ag_rfcomm_channel); - fds[cnt].fd = nat->hf_ag_rfcomm_sock; - fds[cnt].events = POLLIN | POLLPRI | POLLOUT | POLLERR; - cnt++; - } - if (nat->hs_ag_rfcomm_channel > 0) { -// ALOGI("Setting HS AG server socket %d to RFCOMM port %d!", -// nat->hs_ag_rfcomm_sock, -// nat->hs_ag_rfcomm_channel); - fds[cnt].fd = nat->hs_ag_rfcomm_sock; - fds[cnt].events = POLLIN | POLLPRI | POLLOUT | POLLERR; - cnt++; - } - if (cnt == 0) { - ALOGE("Neither HF nor HS listening sockets are open!"); - return JNI_FALSE; - } - n = TEMP_FAILURE_RETRY(poll(fds, cnt, timeout_ms)); - if (n <= 0) { - if (n < 0) { - ALOGE("listening poll() on RFCOMM sockets: %s (%d)", - strerror(errno), - errno); - } - else { - env->SetIntField(object, field_mTimeoutRemainingMs, 0); -// ALOGI("listening poll() on RFCOMM socket timed out"); - } - return JNI_FALSE; - } - - //ALOGI("listening poll() on RFCOMM socket returned %d", n); - int err = 0; - for (cnt = 0; cnt < (int)(sizeof(fds)/sizeof(fds[0])); cnt++) { - //ALOGI("Poll on fd %d revent = %d.", fds[cnt].fd, fds[cnt].revents); - if (fds[cnt].fd == nat->hf_ag_rfcomm_sock) { - if (fds[cnt].revents & (POLLIN | POLLPRI | POLLOUT)) { - ALOGI("Accepting HF connection.\n"); - err += do_accept(env, object, fds[cnt].fd, - field_mConnectingHandsfreeSocketFd, - field_mConnectingHandsfreeAddress, - field_mConnectingHandsfreeRfcommChannel); - n--; - } - } - else if (fds[cnt].fd == nat->hs_ag_rfcomm_sock) { - if (fds[cnt].revents & (POLLIN | POLLPRI | POLLOUT)) { - ALOGI("Accepting HS connection.\n"); - err += do_accept(env, object, fds[cnt].fd, - field_mConnectingHeadsetSocketFd, - field_mConnectingHeadsetAddress, - field_mConnectingHeadsetRfcommChannel); - n--; - } - } - } /* for */ - - if (n != 0) { - ALOGI("Bogus poll(): %d fake pollfd entrie(s)!", n); - return JNI_FALSE; - } - - return !err ? JNI_TRUE : JNI_FALSE; -#endif /* USE_SELECT */ -#endif /* USE_ACCEPT_DIRECTLY */ -#else - return JNI_FALSE; -#endif /* HAVE_BLUETOOTH */ -} - -static jboolean setUpListeningSocketsNative(JNIEnv* env, jobject object) { - ALOGV("%s", __FUNCTION__); -#ifdef HAVE_BLUETOOTH - native_data_t *nat = get_native_data(env, object); - - nat->hf_ag_rfcomm_sock = - setup_listening_socket(nat->hcidev, nat->hf_ag_rfcomm_channel); - if (nat->hf_ag_rfcomm_sock < 0) - return JNI_FALSE; - - nat->hs_ag_rfcomm_sock = - setup_listening_socket(nat->hcidev, nat->hs_ag_rfcomm_channel); - if (nat->hs_ag_rfcomm_sock < 0) { - close(nat->hf_ag_rfcomm_sock); - nat->hf_ag_rfcomm_sock = -1; - return JNI_FALSE; - } - - return JNI_TRUE; -#else - return JNI_FALSE; -#endif /* HAVE_BLUETOOTH */ -} - -#ifdef HAVE_BLUETOOTH -static int setup_listening_socket(int dev, int channel) { - struct sockaddr_rc laddr; - int sk, lm; - - sk = socket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM); - if (sk < 0) { - ALOGE("Can't create RFCOMM socket"); - return -1; - } - - if (debug_no_encrypt()) { - lm = RFCOMM_LM_AUTH; - } else { - lm = RFCOMM_LM_AUTH | RFCOMM_LM_ENCRYPT; - } - - if (lm && setsockopt(sk, SOL_RFCOMM, RFCOMM_LM, &lm, sizeof(lm)) < 0) { - ALOGE("Can't set RFCOMM link mode"); - close(sk); - return -1; - } - - laddr.rc_family = AF_BLUETOOTH; - bdaddr_t any = android_bluetooth_bdaddr_any(); - memcpy(&laddr.rc_bdaddr, &any, sizeof(bdaddr_t)); - laddr.rc_channel = channel; - - if (bind(sk, (struct sockaddr *)&laddr, sizeof(laddr)) < 0) { - ALOGE("Can't bind RFCOMM socket"); - close(sk); - return -1; - } - - listen(sk, 10); - return sk; -} -#endif /* HAVE_BLUETOOTH */ - -/* - private native void tearDownListeningSocketsNative(); -*/ -static void tearDownListeningSocketsNative(JNIEnv *env, jobject object) { - ALOGV("%s", __FUNCTION__); -#ifdef HAVE_BLUETOOTH - native_data_t *nat = get_native_data(env, object); - - if (nat->hf_ag_rfcomm_sock > 0) { - if (close(nat->hf_ag_rfcomm_sock) < 0) { - ALOGE("Could not close HF server socket: %s (%d)\n", - strerror(errno), errno); - } - nat->hf_ag_rfcomm_sock = -1; - } - if (nat->hs_ag_rfcomm_sock > 0) { - if (close(nat->hs_ag_rfcomm_sock) < 0) { - ALOGE("Could not close HS server socket: %s (%d)\n", - strerror(errno), errno); - } - nat->hs_ag_rfcomm_sock = -1; - } -#endif /* HAVE_BLUETOOTH */ -} - -static JNINativeMethod sMethods[] = { - /* name, signature, funcPtr */ - - {"classInitNative", "()V", (void*)classInitNative}, - {"initializeNativeDataNative", "()V", (void *)initializeNativeDataNative}, - {"cleanupNativeDataNative", "()V", (void *)cleanupNativeDataNative}, - - {"setUpListeningSocketsNative", "()Z", (void *)setUpListeningSocketsNative}, - {"tearDownListeningSocketsNative", "()V", (void *)tearDownListeningSocketsNative}, - {"waitForHandsfreeConnectNative", "(I)Z", (void *)waitForHandsfreeConnectNative}, -}; - -int register_android_bluetooth_BluetoothAudioGateway(JNIEnv *env) { - return AndroidRuntime::registerNativeMethods(env, - "android/bluetooth/BluetoothAudioGateway", sMethods, - NELEM(sMethods)); -} - -} /* namespace android */ diff --git a/core/jni/android_bluetooth_BluetoothSocket.cpp b/core/jni/android_bluetooth_BluetoothSocket.cpp deleted file mode 100644 index d9ff36ae34bf7..0000000000000 --- a/core/jni/android_bluetooth_BluetoothSocket.cpp +++ /dev/null @@ -1,588 +0,0 @@ -/* - * 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. - */ - -#define LOG_TAG "BluetoothSocket.cpp" - -#include "android_bluetooth_common.h" -#include "android_bluetooth_c.h" -#include "android_runtime/AndroidRuntime.h" -#include "JNIHelp.h" -#include "utils/Log.h" -#include "cutils/abort_socket.h" - -#include -#include -#include -#include -#include - -#ifdef HAVE_BLUETOOTH -#include -#include -#include -#include -#endif - -#define TYPE_AS_STR(t) \ - ((t) == TYPE_RFCOMM ? "RFCOMM" : ((t) == TYPE_SCO ? "SCO" : "L2CAP")) - -namespace android { - -static jfieldID field_mAuth; /* read-only */ -static jfieldID field_mEncrypt; /* read-only */ -static jfieldID field_mType; /* read-only */ -static jfieldID field_mAddress; /* read-only */ -static jfieldID field_mPort; /* read-only */ -static jfieldID field_mSocketData; -static jmethodID method_BluetoothSocket_ctor; -static jclass class_BluetoothSocket; - -/* Keep TYPE_RFCOMM etc in sync with BluetoothSocket.java */ -static const int TYPE_RFCOMM = 1; -static const int TYPE_SCO = 2; -static const int TYPE_L2CAP = 3; // TODO: Test l2cap code paths - -static const int RFCOMM_SO_SNDBUF = 70 * 1024; // 70 KB send buffer - -static void abortNative(JNIEnv *env, jobject obj); -static void destroyNative(JNIEnv *env, jobject obj); - -static struct asocket *get_socketData(JNIEnv *env, jobject obj) { - struct asocket *s = - (struct asocket *) env->GetIntField(obj, field_mSocketData); - if (!s) - jniThrowException(env, "java/io/IOException", "null socketData"); - return s; -} - -static void initSocketFromFdNative(JNIEnv *env, jobject obj, jint fd) { -#ifdef HAVE_BLUETOOTH - ALOGV("%s", __FUNCTION__); - - struct asocket *s = asocket_init(fd); - - if (!s) { - ALOGV("asocket_init() failed, throwing"); - jniThrowIOException(env, errno); - return; - } - - env->SetIntField(obj, field_mSocketData, (jint)s); - - return; -#endif - jniThrowIOException(env, ENOSYS); -} - -static void initSocketNative(JNIEnv *env, jobject obj) { -#ifdef HAVE_BLUETOOTH - ALOGV("%s", __FUNCTION__); - - int fd; - int lm = 0; - int sndbuf; - jboolean auth; - jboolean encrypt; - jint type; - - type = env->GetIntField(obj, field_mType); - - switch (type) { - case TYPE_RFCOMM: - fd = socket(PF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM); - break; - case TYPE_SCO: - fd = socket(PF_BLUETOOTH, SOCK_SEQPACKET, BTPROTO_SCO); - break; - case TYPE_L2CAP: - fd = socket(PF_BLUETOOTH, SOCK_SEQPACKET, BTPROTO_L2CAP); - break; - default: - jniThrowIOException(env, ENOSYS); - return; - } - - if (fd < 0) { - ALOGV("socket() failed, throwing"); - jniThrowIOException(env, errno); - return; - } - - auth = env->GetBooleanField(obj, field_mAuth); - encrypt = env->GetBooleanField(obj, field_mEncrypt); - - /* kernel does not yet support LM for SCO */ - switch (type) { - case TYPE_RFCOMM: - lm |= auth ? RFCOMM_LM_AUTH : 0; - lm |= encrypt ? RFCOMM_LM_ENCRYPT : 0; - lm |= (auth && encrypt) ? RFCOMM_LM_SECURE : 0; - break; - case TYPE_L2CAP: - lm |= auth ? L2CAP_LM_AUTH : 0; - lm |= encrypt ? L2CAP_LM_ENCRYPT : 0; - lm |= (auth && encrypt) ? L2CAP_LM_SECURE : 0; - break; - } - - if (lm) { - if (setsockopt(fd, SOL_RFCOMM, RFCOMM_LM, &lm, sizeof(lm))) { - ALOGV("setsockopt(RFCOMM_LM) failed, throwing"); - jniThrowIOException(env, errno); - return; - } - } - - if (type == TYPE_RFCOMM) { - sndbuf = RFCOMM_SO_SNDBUF; - if (setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &sndbuf, sizeof(sndbuf))) { - ALOGV("setsockopt(SO_SNDBUF) failed, throwing"); - jniThrowIOException(env, errno); - return; - } - } - - ALOGV("...fd %d created (%s, lm = %x)", fd, TYPE_AS_STR(type), lm); - - initSocketFromFdNative(env, obj, fd); - return; -#endif - jniThrowIOException(env, ENOSYS); -} - -static void connectNative(JNIEnv *env, jobject obj) { -#ifdef HAVE_BLUETOOTH - ALOGV("%s", __FUNCTION__); - - int ret; - jint type; - const char *c_address; - jstring address; - bdaddr_t bdaddress; - socklen_t addr_sz; - struct sockaddr *addr; - struct asocket *s = get_socketData(env, obj); - int retry = 0; - - if (!s) - return; - - type = env->GetIntField(obj, field_mType); - - /* parse address into bdaddress */ - address = (jstring) env->GetObjectField(obj, field_mAddress); - c_address = env->GetStringUTFChars(address, NULL); - if (get_bdaddr(c_address, &bdaddress)) { - env->ReleaseStringUTFChars(address, c_address); - jniThrowIOException(env, EINVAL); - return; - } - env->ReleaseStringUTFChars(address, c_address); - - switch (type) { - case TYPE_RFCOMM: - struct sockaddr_rc addr_rc; - addr = (struct sockaddr *)&addr_rc; - addr_sz = sizeof(addr_rc); - - memset(addr, 0, addr_sz); - addr_rc.rc_family = AF_BLUETOOTH; - addr_rc.rc_channel = env->GetIntField(obj, field_mPort); - memcpy(&addr_rc.rc_bdaddr, &bdaddress, sizeof(bdaddr_t)); - - break; - case TYPE_SCO: - struct sockaddr_sco addr_sco; - addr = (struct sockaddr *)&addr_sco; - addr_sz = sizeof(addr_sco); - - memset(addr, 0, addr_sz); - addr_sco.sco_family = AF_BLUETOOTH; - memcpy(&addr_sco.sco_bdaddr, &bdaddress, sizeof(bdaddr_t)); - - break; - case TYPE_L2CAP: - struct sockaddr_l2 addr_l2; - addr = (struct sockaddr *)&addr_l2; - addr_sz = sizeof(addr_l2); - - memset(addr, 0, addr_sz); - addr_l2.l2_family = AF_BLUETOOTH; - addr_l2.l2_psm = env->GetIntField(obj, field_mPort); - memcpy(&addr_l2.l2_bdaddr, &bdaddress, sizeof(bdaddr_t)); - - break; - default: - jniThrowIOException(env, ENOSYS); - return; - } - -connect: - ret = asocket_connect(s, addr, addr_sz, -1); - ALOGV("...connect(%d, %s) = %d (errno %d)", - s->fd, TYPE_AS_STR(type), ret, errno); - - if (ret && errno == EALREADY && retry < 2) { - /* workaround for bug 5082381 (EALREADY on ACL collision): - * retry the connect. Unfortunately we have to create a new fd. - * It's not ideal to switch the fd underneath the object, but - * is currently safe */ - ALOGD("Hit bug 5082381 (EALREADY on ACL collision), trying workaround"); - usleep(100000); - retry++; - abortNative(env, obj); - destroyNative(env, obj); - initSocketNative(env, obj); - if (env->ExceptionOccurred()) { - return; - } - goto connect; - } - if (!ret && retry > 0) - ALOGD("...workaround ok"); - - if (ret) - jniThrowIOException(env, errno); - - return; -#endif - jniThrowIOException(env, ENOSYS); -} - -/* Returns errno instead of throwing, so java can check errno */ -static int bindListenNative(JNIEnv *env, jobject obj) { -#ifdef HAVE_BLUETOOTH - ALOGV("%s", __FUNCTION__); - - jint type; - socklen_t addr_sz; - struct sockaddr *addr; - bdaddr_t bdaddr = android_bluetooth_bdaddr_any(); - struct asocket *s = get_socketData(env, obj); - - if (!s) - return EINVAL; - - type = env->GetIntField(obj, field_mType); - - switch (type) { - case TYPE_RFCOMM: - struct sockaddr_rc addr_rc; - addr = (struct sockaddr *)&addr_rc; - addr_sz = sizeof(addr_rc); - - memset(addr, 0, addr_sz); - addr_rc.rc_family = AF_BLUETOOTH; - addr_rc.rc_channel = env->GetIntField(obj, field_mPort); - memcpy(&addr_rc.rc_bdaddr, &bdaddr, sizeof(bdaddr_t)); - break; - case TYPE_SCO: - struct sockaddr_sco addr_sco; - addr = (struct sockaddr *)&addr_sco; - addr_sz = sizeof(addr_sco); - - memset(addr, 0, addr_sz); - addr_sco.sco_family = AF_BLUETOOTH; - memcpy(&addr_sco.sco_bdaddr, &bdaddr, sizeof(bdaddr_t)); - break; - case TYPE_L2CAP: - struct sockaddr_l2 addr_l2; - addr = (struct sockaddr *)&addr_l2; - addr_sz = sizeof(addr_l2); - - memset(addr, 0, addr_sz); - addr_l2.l2_family = AF_BLUETOOTH; - addr_l2.l2_psm = env->GetIntField(obj, field_mPort); - memcpy(&addr_l2.l2_bdaddr, &bdaddr, sizeof(bdaddr_t)); - break; - default: - return ENOSYS; - } - - if (bind(s->fd, addr, addr_sz)) { - ALOGV("...bind(%d) gave errno %d", s->fd, errno); - return errno; - } - - if (listen(s->fd, 1)) { - ALOGV("...listen(%d) gave errno %d", s->fd, errno); - return errno; - } - - ALOGV("...bindListenNative(%d) success", s->fd); - - return 0; - -#endif - return ENOSYS; -} - -static jobject acceptNative(JNIEnv *env, jobject obj, int timeout) { -#ifdef HAVE_BLUETOOTH - ALOGV("%s", __FUNCTION__); - - int fd; - jint type; - struct sockaddr *addr; - socklen_t addr_sz; - jstring addr_jstr; - char addr_cstr[BTADDR_SIZE]; - bdaddr_t *bdaddr; - jboolean auth; - jboolean encrypt; - - struct asocket *s = get_socketData(env, obj); - - if (!s) - return NULL; - - type = env->GetIntField(obj, field_mType); - - switch (type) { - case TYPE_RFCOMM: - struct sockaddr_rc addr_rc; - addr = (struct sockaddr *)&addr_rc; - addr_sz = sizeof(addr_rc); - bdaddr = &addr_rc.rc_bdaddr; - memset(addr, 0, addr_sz); - break; - case TYPE_SCO: - struct sockaddr_sco addr_sco; - addr = (struct sockaddr *)&addr_sco; - addr_sz = sizeof(addr_sco); - bdaddr = &addr_sco.sco_bdaddr; - memset(addr, 0, addr_sz); - break; - case TYPE_L2CAP: - struct sockaddr_l2 addr_l2; - addr = (struct sockaddr *)&addr_l2; - addr_sz = sizeof(addr_l2); - bdaddr = &addr_l2.l2_bdaddr; - memset(addr, 0, addr_sz); - break; - default: - jniThrowIOException(env, ENOSYS); - return NULL; - } - - fd = asocket_accept(s, addr, &addr_sz, timeout); - - ALOGV("...accept(%d, %s) = %d (errno %d)", - s->fd, TYPE_AS_STR(type), fd, errno); - - if (fd < 0) { - jniThrowIOException(env, errno); - return NULL; - } - - /* Connected - return new BluetoothSocket */ - auth = env->GetBooleanField(obj, field_mAuth); - encrypt = env->GetBooleanField(obj, field_mEncrypt); - - get_bdaddr_as_string(bdaddr, addr_cstr); - - addr_jstr = env->NewStringUTF(addr_cstr); - return env->NewObject(class_BluetoothSocket, method_BluetoothSocket_ctor, - type, fd, auth, encrypt, addr_jstr, -1); - -#endif - jniThrowIOException(env, ENOSYS); - return NULL; -} - -static jint availableNative(JNIEnv *env, jobject obj) { -#ifdef HAVE_BLUETOOTH - ALOGV("%s", __FUNCTION__); - - int available; - struct asocket *s = get_socketData(env, obj); - - if (!s) - return -1; - - if (ioctl(s->fd, FIONREAD, &available) < 0) { - jniThrowIOException(env, errno); - return -1; - } - - return available; - -#endif - jniThrowIOException(env, ENOSYS); - return -1; -} - -static jint readNative(JNIEnv *env, jobject obj, jbyteArray jb, jint offset, - jint length) { -#ifdef HAVE_BLUETOOTH - ALOGV("%s", __FUNCTION__); - - int ret; - jbyte *b; - int sz; - struct asocket *s = get_socketData(env, obj); - - if (!s) - return -1; - if (jb == NULL) { - jniThrowIOException(env, EINVAL); - return -1; - } - sz = env->GetArrayLength(jb); - if (offset < 0 || length < 0 || offset + length > sz) { - jniThrowIOException(env, EINVAL); - return -1; - } - - b = env->GetByteArrayElements(jb, NULL); - if (b == NULL) { - jniThrowIOException(env, EINVAL); - return -1; - } - - ret = asocket_read(s, &b[offset], length, -1); - if (ret < 0) { - jniThrowIOException(env, errno); - env->ReleaseByteArrayElements(jb, b, JNI_ABORT); - return -1; - } - - env->ReleaseByteArrayElements(jb, b, 0); - return (jint)ret; - -#endif - jniThrowIOException(env, ENOSYS); - return -1; -} - -static jint writeNative(JNIEnv *env, jobject obj, jbyteArray jb, jint offset, - jint length) { -#ifdef HAVE_BLUETOOTH - ALOGV("%s", __FUNCTION__); - - int ret, total; - jbyte *b; - int sz; - struct asocket *s = get_socketData(env, obj); - - if (!s) - return -1; - if (jb == NULL) { - jniThrowIOException(env, EINVAL); - return -1; - } - sz = env->GetArrayLength(jb); - if (offset < 0 || length < 0 || offset + length > sz) { - jniThrowIOException(env, EINVAL); - return -1; - } - - b = env->GetByteArrayElements(jb, NULL); - if (b == NULL) { - jniThrowIOException(env, EINVAL); - return -1; - } - - total = 0; - while (length > 0) { - ret = asocket_write(s, &b[offset], length, -1); - if (ret < 0) { - jniThrowIOException(env, errno); - env->ReleaseByteArrayElements(jb, b, JNI_ABORT); - return -1; - } - offset += ret; - total += ret; - length -= ret; - } - - env->ReleaseByteArrayElements(jb, b, JNI_ABORT); // no need to commit - return (jint)total; - -#endif - jniThrowIOException(env, ENOSYS); - return -1; -} - -static void abortNative(JNIEnv *env, jobject obj) { -#ifdef HAVE_BLUETOOTH - ALOGV("%s", __FUNCTION__); - struct asocket *s = get_socketData(env, obj); - - if (!s) - return; - - asocket_abort(s); - - ALOGV("...asocket_abort(%d) complete", s->fd); - return; -#endif - jniThrowIOException(env, ENOSYS); -} - -static void destroyNative(JNIEnv *env, jobject obj) { -#ifdef HAVE_BLUETOOTH - ALOGV("%s", __FUNCTION__); - struct asocket *s = get_socketData(env, obj); - int fd = s->fd; - - if (!s) - return; - - asocket_destroy(s); - - ALOGV("...asocket_destroy(%d) complete", fd); - return; -#endif - jniThrowIOException(env, ENOSYS); -} - -static void throwErrnoNative(JNIEnv *env, jobject obj, jint err) { - jniThrowIOException(env, err); -} - -static JNINativeMethod sMethods[] = { - {"initSocketNative", "()V", (void*) initSocketNative}, - {"initSocketFromFdNative", "(I)V", (void*) initSocketFromFdNative}, - {"connectNative", "()V", (void *) connectNative}, - {"bindListenNative", "()I", (void *) bindListenNative}, - {"acceptNative", "(I)Landroid/bluetooth/BluetoothSocket;", (void *) acceptNative}, - {"availableNative", "()I", (void *) availableNative}, - {"readNative", "([BII)I", (void *) readNative}, - {"writeNative", "([BII)I", (void *) writeNative}, - {"abortNative", "()V", (void *) abortNative}, - {"destroyNative", "()V", (void *) destroyNative}, - {"throwErrnoNative", "(I)V", (void *) throwErrnoNative}, -}; - -int register_android_bluetooth_BluetoothSocket(JNIEnv *env) { - jclass clazz = env->FindClass("android/bluetooth/BluetoothSocket"); - if (clazz == NULL) - return -1; - class_BluetoothSocket = (jclass) env->NewGlobalRef(clazz); - field_mType = env->GetFieldID(clazz, "mType", "I"); - field_mAddress = env->GetFieldID(clazz, "mAddress", "Ljava/lang/String;"); - field_mPort = env->GetFieldID(clazz, "mPort", "I"); - field_mAuth = env->GetFieldID(clazz, "mAuth", "Z"); - field_mEncrypt = env->GetFieldID(clazz, "mEncrypt", "Z"); - field_mSocketData = env->GetFieldID(clazz, "mSocketData", "I"); - method_BluetoothSocket_ctor = env->GetMethodID(clazz, "", "(IIZZLjava/lang/String;I)V"); - return AndroidRuntime::registerNativeMethods(env, - "android/bluetooth/BluetoothSocket", sMethods, NELEM(sMethods)); -} - -} /* namespace android */ - diff --git a/core/jni/android_bluetooth_HeadsetBase.cpp b/core/jni/android_bluetooth_HeadsetBase.cpp deleted file mode 100644 index 34447efc7e455..0000000000000 --- a/core/jni/android_bluetooth_HeadsetBase.cpp +++ /dev/null @@ -1,567 +0,0 @@ -/* -** Copyright 2006, 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 "BT HSHFP" - -#include "android_bluetooth_common.h" -#include "android_runtime/AndroidRuntime.h" -#include "JNIHelp.h" -#include "jni.h" -#include "utils/Log.h" -#include "utils/misc.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef HAVE_BLUETOOTH -#include -#include -#include -#endif - -namespace android { - -#ifdef HAVE_BLUETOOTH -static jfieldID field_mNativeData; -static jfieldID field_mAddress; -static jfieldID field_mRfcommChannel; -static jfieldID field_mTimeoutRemainingMs; - -typedef struct { - jstring address; - const char *c_address; - int rfcomm_channel; - int last_read_err; - int rfcomm_sock; - int rfcomm_connected; // -1 in progress, 0 not connected, 1 connected - int rfcomm_sock_flags; -} native_data_t; - -static inline native_data_t * get_native_data(JNIEnv *env, jobject object) { - return (native_data_t *)(env->GetIntField(object, field_mNativeData)); -} - -static const char CRLF[] = "\xd\xa"; -static const int CRLF_LEN = 2; - -static inline int write_error_check(int fd, const char* line, int len) { - int ret; - errno = 0; - ret = write(fd, line, len); - if (ret < 0) { - ALOGE("%s: write() failed: %s (%d)", __FUNCTION__, strerror(errno), - errno); - return -1; - } - if (ret != len) { - ALOGE("%s: write() only wrote %d of %d bytes", __FUNCTION__, ret, len); - return -1; - } - return 0; -} - -static int send_line(int fd, const char* line) { - int nw; - int len = strlen(line); - int llen = len + CRLF_LEN * 2 + 1; - char *buffer = (char *)calloc(llen, sizeof(char)); - - snprintf(buffer, llen, "%s%s%s", CRLF, line, CRLF); - - if (write_error_check(fd, buffer, llen - 1)) { - free(buffer); - return -1; - } - free(buffer); - return 0; -} - -static void mask_eighth_bit(char *line) -{ - for (;;line++) { - if (0 == *line) return; - *line &= 0x7F; - } -} - -static const char* get_line(int fd, char *buf, int len, int timeout_ms, - int *err) { - char *bufit=buf; - int fd_flags = fcntl(fd, F_GETFL, 0); - struct pollfd pfd; - -again: - *bufit = 0; - pfd.fd = fd; - pfd.events = POLLIN; - *err = errno = 0; - int ret = TEMP_FAILURE_RETRY(poll(&pfd, 1, timeout_ms)); - if (ret < 0) { - ALOGE("poll() error\n"); - *err = errno; - return NULL; - } - if (ret == 0) { - return NULL; - } - - if (pfd.revents & (POLLHUP | POLLERR | POLLNVAL)) { - ALOGW("RFCOMM poll() returned success (%d), " - "but with an unexpected revents bitmask: %#x\n", ret, pfd.revents); - errno = EIO; - *err = errno; - return NULL; - } - - while ((int)(bufit - buf) < (len - 1)) - { - errno = 0; - int rc = TEMP_FAILURE_RETRY(read(fd, bufit, 1)); - - if (!rc) - break; - - if (rc < 0) { - if (errno == EBUSY) { - ALOGI("read() error %s (%d): repeating read()...", - strerror(errno), errno); - goto again; - } - *err = errno; - ALOGE("read() error %s (%d)", strerror(errno), errno); - return NULL; - } - - - if (*bufit=='\xd') { - break; - } - - if (*bufit=='\xa') - bufit = buf; - else - bufit++; - } - - *bufit = 0; - - // According to ITU V.250 section 5.1, IA5 7 bit chars are used, - // the eighth bit or higher bits are ignored if they exists - // We mask out only eighth bit, no higher bit, since we do char - // string here, not wide char. - // We added this processing due to 2 real world problems. - // 1 BMW 2005 E46 which sends binary junk - // 2 Audi 2010 A3, dial command use 0xAD (soft-hyphen) as number - // formater, which was rejected by the AT handler - mask_eighth_bit(buf); - - return buf; -} -#endif - -static void classInitNative(JNIEnv* env, jclass clazz) { - ALOGV("%s", __FUNCTION__); -#ifdef HAVE_BLUETOOTH - field_mNativeData = get_field(env, clazz, "mNativeData", "I"); - field_mAddress = get_field(env, clazz, "mAddress", "Ljava/lang/String;"); - field_mTimeoutRemainingMs = get_field(env, clazz, "mTimeoutRemainingMs", "I"); - field_mRfcommChannel = get_field(env, clazz, "mRfcommChannel", "I"); -#endif -} - -static void initializeNativeDataNative(JNIEnv* env, jobject object, - jint socketFd) { - ALOGV("%s", __FUNCTION__); -#ifdef HAVE_BLUETOOTH - native_data_t *nat = (native_data_t *)calloc(1, sizeof(native_data_t)); - if (NULL == nat) { - ALOGE("%s: out of memory!", __FUNCTION__); - return; - } - - env->SetIntField(object, field_mNativeData, (jint)nat); - nat->address = - (jstring)env->NewGlobalRef(env->GetObjectField(object, - field_mAddress)); - nat->c_address = env->GetStringUTFChars(nat->address, NULL); - nat->rfcomm_channel = env->GetIntField(object, field_mRfcommChannel); - nat->rfcomm_sock = socketFd; - nat->rfcomm_connected = socketFd >= 0; - if (nat->rfcomm_connected) - ALOGI("%s: ALREADY CONNECTED!", __FUNCTION__); -#endif -} - -static void cleanupNativeDataNative(JNIEnv* env, jobject object) { - ALOGV("%s", __FUNCTION__); -#ifdef HAVE_BLUETOOTH - native_data_t *nat = - (native_data_t *)env->GetIntField(object, field_mNativeData); - env->ReleaseStringUTFChars(nat->address, nat->c_address); - env->DeleteGlobalRef(nat->address); - if (nat) - free(nat); -#endif -} - -static jboolean connectNative(JNIEnv *env, jobject obj) -{ - ALOGV("%s", __FUNCTION__); -#ifdef HAVE_BLUETOOTH - int lm; - struct sockaddr_rc addr; - native_data_t *nat = get_native_data(env, obj); - - nat->rfcomm_sock = socket(PF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM); - - if (nat->rfcomm_sock < 0) { - ALOGE("%s: Could not create RFCOMM socket: %s\n", __FUNCTION__, - strerror(errno)); - return JNI_FALSE; - } - - if (debug_no_encrypt()) { - lm = RFCOMM_LM_AUTH; - } else { - lm = RFCOMM_LM_AUTH | RFCOMM_LM_ENCRYPT; - } - - if (lm && setsockopt(nat->rfcomm_sock, SOL_RFCOMM, RFCOMM_LM, &lm, - sizeof(lm)) < 0) { - ALOGE("%s: Can't set RFCOMM link mode", __FUNCTION__); - close(nat->rfcomm_sock); - return JNI_FALSE; - } - - memset(&addr, 0, sizeof(struct sockaddr_rc)); - get_bdaddr(nat->c_address, &addr.rc_bdaddr); - addr.rc_channel = nat->rfcomm_channel; - addr.rc_family = AF_BLUETOOTH; - nat->rfcomm_connected = 0; - while (nat->rfcomm_connected == 0) { - if (connect(nat->rfcomm_sock, (struct sockaddr *)&addr, - sizeof(addr)) < 0) { - if (errno == EINTR) continue; - ALOGE("%s: connect() failed: %s\n", __FUNCTION__, strerror(errno)); - close(nat->rfcomm_sock); - nat->rfcomm_sock = -1; - return JNI_FALSE; - } else { - nat->rfcomm_connected = 1; - } - } - - return JNI_TRUE; -#else - return JNI_FALSE; -#endif -} - -static jint connectAsyncNative(JNIEnv *env, jobject obj) { - ALOGV("%s", __FUNCTION__); -#ifdef HAVE_BLUETOOTH - struct sockaddr_rc addr; - native_data_t *nat = get_native_data(env, obj); - - if (nat->rfcomm_connected) { - ALOGV("RFCOMM socket is already connected or connection is in progress."); - return 0; - } - - if (nat->rfcomm_sock < 0) { - int lm; - - nat->rfcomm_sock = socket(PF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM); - if (nat->rfcomm_sock < 0) { - ALOGE("%s: Could not create RFCOMM socket: %s\n", __FUNCTION__, - strerror(errno)); - return -1; - } - - if (debug_no_encrypt()) { - lm = RFCOMM_LM_AUTH; - } else { - lm = RFCOMM_LM_AUTH | RFCOMM_LM_ENCRYPT; - } - - if (lm && setsockopt(nat->rfcomm_sock, SOL_RFCOMM, RFCOMM_LM, &lm, - sizeof(lm)) < 0) { - ALOGE("%s: Can't set RFCOMM link mode", __FUNCTION__); - close(nat->rfcomm_sock); - return -1; - } - ALOGI("Created RFCOMM socket fd %d.", nat->rfcomm_sock); - } - - memset(&addr, 0, sizeof(struct sockaddr_rc)); - get_bdaddr(nat->c_address, &addr.rc_bdaddr); - addr.rc_channel = nat->rfcomm_channel; - addr.rc_family = AF_BLUETOOTH; - if (nat->rfcomm_sock_flags >= 0) { - nat->rfcomm_sock_flags = fcntl(nat->rfcomm_sock, F_GETFL, 0); - if (fcntl(nat->rfcomm_sock, - F_SETFL, nat->rfcomm_sock_flags | O_NONBLOCK) >= 0) { - int rc; - nat->rfcomm_connected = 0; - errno = 0; - rc = connect(nat->rfcomm_sock, - (struct sockaddr *)&addr, - sizeof(addr)); - - if (rc >= 0) { - nat->rfcomm_connected = 1; - ALOGI("async connect successful"); - return 0; - } - else if (rc < 0) { - if (errno == EINPROGRESS || errno == EAGAIN) - { - ALOGI("async connect is in progress (%s)", - strerror(errno)); - nat->rfcomm_connected = -1; - return 0; - } - else - { - ALOGE("async connect error: %s (%d)", strerror(errno), errno); - close(nat->rfcomm_sock); - nat->rfcomm_sock = -1; - return -errno; - } - } - } // fcntl(nat->rfcomm_sock ...) - } // if (nat->rfcomm_sock_flags >= 0) -#endif - return -1; -} - -static jint waitForAsyncConnectNative(JNIEnv *env, jobject obj, - jint timeout_ms) { - ALOGV("%s", __FUNCTION__); -#ifdef HAVE_BLUETOOTH - struct sockaddr_rc addr; - native_data_t *nat = get_native_data(env, obj); - - env->SetIntField(obj, field_mTimeoutRemainingMs, timeout_ms); - - if (nat->rfcomm_connected > 0) { - ALOGI("RFCOMM is already connected!"); - return 1; - } - - if (nat->rfcomm_sock >= 0 && nat->rfcomm_connected == 0) { - ALOGI("Re-opening RFCOMM socket."); - close(nat->rfcomm_sock); - nat->rfcomm_sock = -1; - } - int ret = connectAsyncNative(env, obj); - - if (ret < 0) { - ALOGI("Failed to re-open RFCOMM socket!"); - return ret; - } - - if (nat->rfcomm_sock >= 0) { - /* Do an asynchronous select() */ - int n; - fd_set rset, wset; - struct timeval to; - - FD_ZERO(&rset); - FD_ZERO(&wset); - FD_SET(nat->rfcomm_sock, &rset); - FD_SET(nat->rfcomm_sock, &wset); - if (timeout_ms >= 0) { - to.tv_sec = timeout_ms / 1000; - to.tv_usec = 1000 * (timeout_ms % 1000); - } - n = select(nat->rfcomm_sock + 1, - &rset, - &wset, - NULL, - (timeout_ms < 0 ? NULL : &to)); - - if (timeout_ms > 0) { - jint remaining = to.tv_sec*1000 + to.tv_usec/1000; - ALOGV("Remaining time %ldms", (long)remaining); - env->SetIntField(obj, field_mTimeoutRemainingMs, - remaining); - } - - if (n <= 0) { - if (n < 0) { - ALOGE("select() on RFCOMM socket: %s (%d)", - strerror(errno), - errno); - return -errno; - } - return 0; - } - /* n must be equal to 1 and either rset or wset must have the - file descriptor set. */ - ALOGV("select() returned %d.", n); - if (FD_ISSET(nat->rfcomm_sock, &rset) || - FD_ISSET(nat->rfcomm_sock, &wset)) - { - /* A trial async read() will tell us if everything is OK. */ - { - char ch; - errno = 0; - int nr = TEMP_FAILURE_RETRY(read(nat->rfcomm_sock, &ch, 1)); - /* It should be that nr != 1 because we just opened a socket - and we haven't sent anything over it for the other side to - respond... but one can't be paranoid enough. - */ - if (nr >= 0 || errno != EAGAIN) { - ALOGE("RFCOMM async connect() error: %s (%d), nr = %d\n", - strerror(errno), - errno, - nr); - /* Clear the rfcomm_connected flag to cause this function - to re-create the socket and re-attempt the connect() - the next time it is called. - */ - nat->rfcomm_connected = 0; - /* Restore the blocking properties of the socket. */ - fcntl(nat->rfcomm_sock, F_SETFL, nat->rfcomm_sock_flags); - close(nat->rfcomm_sock); - nat->rfcomm_sock = -1; - return -errno; - } - } - /* Restore the blocking properties of the socket. */ - fcntl(nat->rfcomm_sock, F_SETFL, nat->rfcomm_sock_flags); - ALOGI("Successful RFCOMM socket connect."); - nat->rfcomm_connected = 1; - return 1; - } - } - else ALOGE("RFCOMM socket file descriptor %d is bad!", - nat->rfcomm_sock); -#endif - return -1; -} - -static void disconnectNative(JNIEnv *env, jobject obj) { - ALOGV("%s", __FUNCTION__); -#ifdef HAVE_BLUETOOTH - native_data_t *nat = get_native_data(env, obj); - if (nat->rfcomm_sock >= 0) { - close(nat->rfcomm_sock); - nat->rfcomm_sock = -1; - nat->rfcomm_connected = 0; - } -#endif -} - -static void pretty_log_urc(const char *urc) { - size_t i; - bool in_line_break = false; - char *buf = (char *)calloc(strlen(urc) + 1, sizeof(char)); - - strcpy(buf, urc); - for (i = 0; i < strlen(buf); i++) { - switch(buf[i]) { - case '\r': - case '\n': - in_line_break = true; - buf[i] = ' '; - break; - default: - if (in_line_break) { - in_line_break = false; - buf[i-1] = '\n'; - } - } - } - IF_ALOGV() ALOG(LOG_VERBOSE, "Bluetooth AT sent", "%s", buf); - - free(buf); -} - -static jboolean sendURCNative(JNIEnv *env, jobject obj, jstring urc) { -#ifdef HAVE_BLUETOOTH - native_data_t *nat = get_native_data(env, obj); - if (nat->rfcomm_connected) { - const char *c_urc = env->GetStringUTFChars(urc, NULL); - jboolean ret = send_line(nat->rfcomm_sock, c_urc) == 0 ? JNI_TRUE : JNI_FALSE; - if (ret == JNI_TRUE) pretty_log_urc(c_urc); - env->ReleaseStringUTFChars(urc, c_urc); - return ret; - } -#endif - return JNI_FALSE; -} - -static jstring readNative(JNIEnv *env, jobject obj, jint timeout_ms) { -#ifdef HAVE_BLUETOOTH - { - native_data_t *nat = get_native_data(env, obj); - if (nat->rfcomm_connected) { - char buf[256]; - const char *ret = get_line(nat->rfcomm_sock, - buf, sizeof(buf), - timeout_ms, - &nat->last_read_err); - return ret ? env->NewStringUTF(ret) : NULL; - } - return NULL; - } -#else - return NULL; -#endif -} - -static jint getLastReadStatusNative(JNIEnv *env, jobject obj) { -#ifdef HAVE_BLUETOOTH - { - native_data_t *nat = get_native_data(env, obj); - if (nat->rfcomm_connected) - return (jint)nat->last_read_err; - return 0; - } -#else - return 0; -#endif -} - -static JNINativeMethod sMethods[] = { - /* name, signature, funcPtr */ - {"classInitNative", "()V", (void*)classInitNative}, - {"initializeNativeDataNative", "(I)V", (void *)initializeNativeDataNative}, - {"cleanupNativeDataNative", "()V", (void *)cleanupNativeDataNative}, - {"connectNative", "()Z", (void *)connectNative}, - {"connectAsyncNative", "()I", (void *)connectAsyncNative}, - {"waitForAsyncConnectNative", "(I)I", (void *)waitForAsyncConnectNative}, - {"disconnectNative", "()V", (void *)disconnectNative}, - {"sendURCNative", "(Ljava/lang/String;)Z", (void *)sendURCNative}, - {"readNative", "(I)Ljava/lang/String;", (void *)readNative}, - {"getLastReadStatusNative", "()I", (void *)getLastReadStatusNative}, -}; - -int register_android_bluetooth_HeadsetBase(JNIEnv *env) { - return AndroidRuntime::registerNativeMethods(env, - "android/bluetooth/HeadsetBase", sMethods, NELEM(sMethods)); -} - -} /* namespace android */ diff --git a/core/jni/android_bluetooth_c.c b/core/jni/android_bluetooth_c.c deleted file mode 100644 index b4c6727115949..0000000000000 --- a/core/jni/android_bluetooth_c.c +++ /dev/null @@ -1,31 +0,0 @@ -/* -** Copyright 2011, The Android Open Source Project -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ - -#ifdef HAVE_BLUETOOTH - -#include "android_bluetooth_c.h" - -/* - * A C helper for creating a bdaddr_t object with the value BDADDR_ANY. - * We have to do this in C because the macro BDADDR_ANY in bluetooth.h - * is not valid C++ code. - */ -bdaddr_t android_bluetooth_bdaddr_any(void) -{ - bdaddr_t any = *BDADDR_ANY; - return any; -} -#endif diff --git a/core/jni/android_bluetooth_c.h b/core/jni/android_bluetooth_c.h deleted file mode 100644 index e89024469475f..0000000000000 --- a/core/jni/android_bluetooth_c.h +++ /dev/null @@ -1,39 +0,0 @@ -/* -** Copyright 2010, The Android Open Source Project -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ - -#ifndef ANDROID_BLUETOOTH_C_H -#define ANDROID_BLUETOOTH_C_H -#ifdef HAVE_BLUETOOTH - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * A C helper for creating a bdaddr_t object with the value BDADDR_ANY. - * We have to do this in C because the macro BDADDR_ANY in bluetooth.h - * is not valid C++ code. - */ -bdaddr_t android_bluetooth_bdaddr_any(void); - -#ifdef __cplusplus -} -#endif - -#endif /*HAVE_BLUETOOTH*/ -#endif /*ANDROID_BLUETOOTH_C_H*/ diff --git a/core/jni/android_bluetooth_common.cpp b/core/jni/android_bluetooth_common.cpp deleted file mode 100644 index 5cdaa6c7bc07f..0000000000000 --- a/core/jni/android_bluetooth_common.cpp +++ /dev/null @@ -1,867 +0,0 @@ -/* -** Copyright 2006, 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 "bluetooth_common.cpp" - -#include "android_bluetooth_common.h" -#include "JNIHelp.h" -#include "jni.h" -#include "utils/Log.h" -#include "utils/misc.h" - -#include -#include -#include -#include -#include -#include - -#ifdef HAVE_BLUETOOTH -#include -#endif - -namespace android { - -#ifdef HAVE_BLUETOOTH - -static Properties remote_device_properties[] = { - {"Address", DBUS_TYPE_STRING}, - {"Name", DBUS_TYPE_STRING}, - {"Icon", DBUS_TYPE_STRING}, - {"Class", DBUS_TYPE_UINT32}, - {"UUIDs", DBUS_TYPE_ARRAY}, - {"Services", DBUS_TYPE_ARRAY}, - {"Paired", DBUS_TYPE_BOOLEAN}, - {"Connected", DBUS_TYPE_BOOLEAN}, - {"Trusted", DBUS_TYPE_BOOLEAN}, - {"Blocked", DBUS_TYPE_BOOLEAN}, - {"Alias", DBUS_TYPE_STRING}, - {"Nodes", DBUS_TYPE_ARRAY}, - {"Adapter", DBUS_TYPE_OBJECT_PATH}, - {"LegacyPairing", DBUS_TYPE_BOOLEAN}, - {"RSSI", DBUS_TYPE_INT16}, - {"TX", DBUS_TYPE_UINT32}, - {"Broadcaster", DBUS_TYPE_BOOLEAN} -}; - -static Properties adapter_properties[] = { - {"Address", DBUS_TYPE_STRING}, - {"Name", DBUS_TYPE_STRING}, - {"Class", DBUS_TYPE_UINT32}, - {"Powered", DBUS_TYPE_BOOLEAN}, - {"Discoverable", DBUS_TYPE_BOOLEAN}, - {"DiscoverableTimeout", DBUS_TYPE_UINT32}, - {"Pairable", DBUS_TYPE_BOOLEAN}, - {"PairableTimeout", DBUS_TYPE_UINT32}, - {"Discovering", DBUS_TYPE_BOOLEAN}, - {"Devices", DBUS_TYPE_ARRAY}, - {"UUIDs", DBUS_TYPE_ARRAY}, -}; - -static Properties input_properties[] = { - {"Connected", DBUS_TYPE_BOOLEAN}, -}; - -static Properties pan_properties[] = { - {"Connected", DBUS_TYPE_BOOLEAN}, - {"Interface", DBUS_TYPE_STRING}, - {"UUID", DBUS_TYPE_STRING}, -}; - -static Properties health_device_properties[] = { - {"MainChannel", DBUS_TYPE_OBJECT_PATH}, -}; - -static Properties health_channel_properties[] = { - {"Type", DBUS_TYPE_STRING}, - {"Device", DBUS_TYPE_OBJECT_PATH}, - {"Application", DBUS_TYPE_OBJECT_PATH}, -}; - -typedef union { - char *str_val; - int int_val; - char **array_val; -} property_value; - -jfieldID get_field(JNIEnv *env, jclass clazz, const char *member, - const char *mtype) { - jfieldID field = env->GetFieldID(clazz, member, mtype); - if (field == NULL) { - ALOGE("Can't find member %s", member); - } - return field; -} - -typedef struct { - void (*user_cb)(DBusMessage *, void *, void *); - void *user; - void *nat; - JNIEnv *env; -} dbus_async_call_t; - -void dbus_func_args_async_callback(DBusPendingCall *call, void *data) { - - dbus_async_call_t *req = (dbus_async_call_t *)data; - DBusMessage *msg; - - /* This is guaranteed to be non-NULL, because this function is called only - when once the remote method invokation returns. */ - msg = dbus_pending_call_steal_reply(call); - - if (msg) { - if (req->user_cb) { - // The user may not deref the message object. - req->user_cb(msg, req->user, req->nat); - } - dbus_message_unref(msg); - } - - //dbus_message_unref(req->method); - dbus_pending_call_cancel(call); - dbus_pending_call_unref(call); - free(req); -} - -static dbus_bool_t dbus_func_args_async_valist(JNIEnv *env, - DBusConnection *conn, - int timeout_ms, - void (*user_cb)(DBusMessage *, - void *, - void*), - void *user, - void *nat, - const char *path, - const char *ifc, - const char *func, - int first_arg_type, - va_list args) { - DBusMessage *msg = NULL; - const char *name; - dbus_async_call_t *pending; - dbus_bool_t reply = FALSE; - - /* Compose the command */ - msg = dbus_message_new_method_call(BLUEZ_DBUS_BASE_IFC, path, ifc, func); - - if (msg == NULL) { - ALOGE("Could not allocate D-Bus message object!"); - goto done; - } - - /* append arguments */ - if (!dbus_message_append_args_valist(msg, first_arg_type, args)) { - ALOGE("Could not append argument to method call!"); - goto done; - } - - /* Make the call. */ - pending = (dbus_async_call_t *)malloc(sizeof(dbus_async_call_t)); - if (pending) { - DBusPendingCall *call; - - pending->env = env; - pending->user_cb = user_cb; - pending->user = user; - pending->nat = nat; - //pending->method = msg; - - reply = dbus_connection_send_with_reply(conn, msg, - &call, - timeout_ms); - if (reply == TRUE) { - dbus_pending_call_set_notify(call, - dbus_func_args_async_callback, - pending, - NULL); - } - } - -done: - if (msg) dbus_message_unref(msg); - return reply; -} - -dbus_bool_t dbus_func_args_async(JNIEnv *env, - DBusConnection *conn, - int timeout_ms, - void (*reply)(DBusMessage *, void *, void*), - void *user, - void *nat, - const char *path, - const char *ifc, - const char *func, - int first_arg_type, - ...) { - dbus_bool_t ret; - va_list lst; - va_start(lst, first_arg_type); - - ret = dbus_func_args_async_valist(env, conn, - timeout_ms, - reply, user, nat, - path, ifc, func, - first_arg_type, lst); - va_end(lst); - return ret; -} - -// If err is NULL, then any errors will be ALOGE'd, and free'd and the reply -// will be NULL. -// If err is not NULL, then it is assumed that dbus_error_init was already -// called, and error's will be returned to the caller without logging. The -// return value is NULL iff an error was set. The client must free the error if -// set. -DBusMessage * dbus_func_args_timeout_valist(JNIEnv *env, - DBusConnection *conn, - int timeout_ms, - DBusError *err, - const char *path, - const char *ifc, - const char *func, - int first_arg_type, - va_list args) { - - DBusMessage *msg = NULL, *reply = NULL; - const char *name; - bool return_error = (err != NULL); - - if (!return_error) { - err = (DBusError*)malloc(sizeof(DBusError)); - dbus_error_init(err); - } - - /* Compose the command */ - msg = dbus_message_new_method_call(BLUEZ_DBUS_BASE_IFC, path, ifc, func); - - if (msg == NULL) { - ALOGE("Could not allocate D-Bus message object!"); - goto done; - } - - /* append arguments */ - if (!dbus_message_append_args_valist(msg, first_arg_type, args)) { - ALOGE("Could not append argument to method call!"); - goto done; - } - - /* Make the call. */ - reply = dbus_connection_send_with_reply_and_block(conn, msg, timeout_ms, err); - if (!return_error && dbus_error_is_set(err)) { - LOG_AND_FREE_DBUS_ERROR_WITH_MSG(err, msg); - } - -done: - if (!return_error) { - free(err); - } - if (msg) dbus_message_unref(msg); - return reply; -} - -DBusMessage * dbus_func_args_timeout(JNIEnv *env, - DBusConnection *conn, - int timeout_ms, - const char *path, - const char *ifc, - const char *func, - int first_arg_type, - ...) { - DBusMessage *ret; - va_list lst; - va_start(lst, first_arg_type); - ret = dbus_func_args_timeout_valist(env, conn, timeout_ms, NULL, - path, ifc, func, - first_arg_type, lst); - va_end(lst); - return ret; -} - -DBusMessage * dbus_func_args(JNIEnv *env, - DBusConnection *conn, - const char *path, - const char *ifc, - const char *func, - int first_arg_type, - ...) { - DBusMessage *ret; - va_list lst; - va_start(lst, first_arg_type); - ret = dbus_func_args_timeout_valist(env, conn, -1, NULL, - path, ifc, func, - first_arg_type, lst); - va_end(lst); - return ret; -} - -DBusMessage * dbus_func_args_error(JNIEnv *env, - DBusConnection *conn, - DBusError *err, - const char *path, - const char *ifc, - const char *func, - int first_arg_type, - ...) { - DBusMessage *ret; - va_list lst; - va_start(lst, first_arg_type); - ret = dbus_func_args_timeout_valist(env, conn, -1, err, - path, ifc, func, - first_arg_type, lst); - va_end(lst); - return ret; -} - -jint dbus_returns_unixfd(JNIEnv *env, DBusMessage *reply) { - - DBusError err; - jint ret = -1; - - dbus_error_init(&err); - if (!dbus_message_get_args(reply, &err, - DBUS_TYPE_UNIX_FD, &ret, - DBUS_TYPE_INVALID)) { - LOG_AND_FREE_DBUS_ERROR_WITH_MSG(&err, reply); - } - dbus_message_unref(reply); - return ret; -} - - -jint dbus_returns_int32(JNIEnv *env, DBusMessage *reply) { - - DBusError err; - jint ret = -1; - - dbus_error_init(&err); - if (!dbus_message_get_args(reply, &err, - DBUS_TYPE_INT32, &ret, - DBUS_TYPE_INVALID)) { - LOG_AND_FREE_DBUS_ERROR_WITH_MSG(&err, reply); - } - dbus_message_unref(reply); - return ret; -} - -jint dbus_returns_uint32(JNIEnv *env, DBusMessage *reply) { - - DBusError err; - jint ret = -1; - - dbus_error_init(&err); - if (!dbus_message_get_args(reply, &err, - DBUS_TYPE_UINT32, &ret, - DBUS_TYPE_INVALID)) { - LOG_AND_FREE_DBUS_ERROR_WITH_MSG(&err, reply); - } - dbus_message_unref(reply); - return ret; -} - -jstring dbus_returns_string(JNIEnv *env, DBusMessage *reply) { - - DBusError err; - jstring ret = NULL; - const char *name; - - dbus_error_init(&err); - if (dbus_message_get_args(reply, &err, - DBUS_TYPE_STRING, &name, - DBUS_TYPE_INVALID)) { - ret = env->NewStringUTF(name); - } else { - LOG_AND_FREE_DBUS_ERROR_WITH_MSG(&err, reply); - } - dbus_message_unref(reply); - - return ret; -} - -jboolean dbus_returns_boolean(JNIEnv *env, DBusMessage *reply) { - DBusError err; - jboolean ret = JNI_FALSE; - dbus_bool_t val = FALSE; - - dbus_error_init(&err); - - /* Check the return value. */ - if (dbus_message_get_args(reply, &err, - DBUS_TYPE_BOOLEAN, &val, - DBUS_TYPE_INVALID)) { - ret = val == TRUE ? JNI_TRUE : JNI_FALSE; - } else { - LOG_AND_FREE_DBUS_ERROR_WITH_MSG(&err, reply); - } - - dbus_message_unref(reply); - return ret; -} - -static void set_object_array_element(JNIEnv *env, jobjectArray strArray, - const char *value, int index) { - jstring obj; - obj = env->NewStringUTF(value); - env->SetObjectArrayElement(strArray, index, obj); - env->DeleteLocalRef(obj); -} - -jobjectArray dbus_returns_array_of_object_path(JNIEnv *env, - DBusMessage *reply) { - - DBusError err; - char **list; - int i, len; - jobjectArray strArray = NULL; - - dbus_error_init(&err); - if (dbus_message_get_args (reply, - &err, - DBUS_TYPE_ARRAY, DBUS_TYPE_OBJECT_PATH, - &list, &len, - DBUS_TYPE_INVALID)) { - jclass stringClass; - jstring classNameStr; - - stringClass = env->FindClass("java/lang/String"); - strArray = env->NewObjectArray(len, stringClass, NULL); - - for (i = 0; i < len; i++) - set_object_array_element(env, strArray, list[i], i); - } else { - LOG_AND_FREE_DBUS_ERROR_WITH_MSG(&err, reply); - } - - dbus_message_unref(reply); - return strArray; -} - -jobjectArray dbus_returns_array_of_strings(JNIEnv *env, DBusMessage *reply) { - - DBusError err; - char **list; - int i, len; - jobjectArray strArray = NULL; - - dbus_error_init(&err); - if (dbus_message_get_args (reply, - &err, - DBUS_TYPE_ARRAY, DBUS_TYPE_STRING, - &list, &len, - DBUS_TYPE_INVALID)) { - jclass stringClass; - jstring classNameStr; - - //ALOGV("%s: there are %d elements in string array!", __FUNCTION__, len); - - stringClass = env->FindClass("java/lang/String"); - strArray = env->NewObjectArray(len, stringClass, NULL); - - for (i = 0; i < len; i++) - set_object_array_element(env, strArray, list[i], i); - } else { - LOG_AND_FREE_DBUS_ERROR_WITH_MSG(&err, reply); - } - - dbus_message_unref(reply); - return strArray; -} - -jbyteArray dbus_returns_array_of_bytes(JNIEnv *env, DBusMessage *reply) { - - DBusError err; - int i, len; - jbyte *list; - jbyteArray byteArray = NULL; - - dbus_error_init(&err); - if (dbus_message_get_args(reply, &err, - DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE, &list, &len, - DBUS_TYPE_INVALID)) { - //ALOGV("%s: there are %d elements in byte array!", __FUNCTION__, len); - byteArray = env->NewByteArray(len); - if (byteArray) - env->SetByteArrayRegion(byteArray, 0, len, list); - - } else { - LOG_AND_FREE_DBUS_ERROR_WITH_MSG(&err, reply); - } - - dbus_message_unref(reply); - return byteArray; -} - -void append_variant(DBusMessageIter *iter, int type, void *val) -{ - DBusMessageIter value_iter; - char var_type[2] = { type, '\0'}; - dbus_message_iter_open_container(iter, DBUS_TYPE_VARIANT, var_type, &value_iter); - dbus_message_iter_append_basic(&value_iter, type, val); - dbus_message_iter_close_container(iter, &value_iter); -} - -static void dict_append_entry(DBusMessageIter *dict, - const char *key, int type, void *val) -{ - DBusMessageIter dict_entry; - dbus_message_iter_open_container(dict, DBUS_TYPE_DICT_ENTRY, - NULL, &dict_entry); - - dbus_message_iter_append_basic(&dict_entry, DBUS_TYPE_STRING, &key); - append_variant(&dict_entry, type, val); - dbus_message_iter_close_container(dict, &dict_entry); -} - -static void append_dict_valist(DBusMessageIter *iterator, const char *first_key, - va_list var_args) -{ - DBusMessageIter dict; - int val_type; - const char *val_key; - void *val; - - dbus_message_iter_open_container(iterator, DBUS_TYPE_ARRAY, - DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING - DBUS_TYPE_STRING_AS_STRING DBUS_TYPE_VARIANT_AS_STRING - DBUS_DICT_ENTRY_END_CHAR_AS_STRING, &dict); - - val_key = first_key; - while (val_key) { - val_type = va_arg(var_args, int); - val = va_arg(var_args, void *); - dict_append_entry(&dict, val_key, val_type, val); - val_key = va_arg(var_args, char *); - } - - dbus_message_iter_close_container(iterator, &dict); -} - -void append_dict_args(DBusMessage *reply, const char *first_key, ...) -{ - DBusMessageIter iter; - va_list var_args; - - dbus_message_iter_init_append(reply, &iter); - - va_start(var_args, first_key); - append_dict_valist(&iter, first_key, var_args); - va_end(var_args); -} - - -int get_property(DBusMessageIter iter, Properties *properties, - int max_num_properties, int *prop_index, property_value *value, int *len) { - DBusMessageIter prop_val, array_val_iter; - char *property = NULL; - uint32_t array_type; - char *str_val; - int i, j, type, int_val; - - if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_STRING) - return -1; - dbus_message_iter_get_basic(&iter, &property); - if (!dbus_message_iter_next(&iter)) - return -1; - if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_VARIANT) - return -1; - for (i = 0; i < max_num_properties; i++) { - if (!strncmp(property, properties[i].name, strlen(property))) - break; - } - *prop_index = i; - if (i == max_num_properties) - return -1; - - dbus_message_iter_recurse(&iter, &prop_val); - type = properties[*prop_index].type; - if (dbus_message_iter_get_arg_type(&prop_val) != type) { - ALOGE("Property type mismatch in get_property: %d, expected:%d, index:%d", - dbus_message_iter_get_arg_type(&prop_val), type, *prop_index); - return -1; - } - - switch(type) { - case DBUS_TYPE_STRING: - case DBUS_TYPE_OBJECT_PATH: - dbus_message_iter_get_basic(&prop_val, &value->str_val); - *len = 1; - break; - case DBUS_TYPE_UINT32: - case DBUS_TYPE_INT16: - case DBUS_TYPE_BOOLEAN: - dbus_message_iter_get_basic(&prop_val, &int_val); - value->int_val = int_val; - *len = 1; - break; - case DBUS_TYPE_ARRAY: - dbus_message_iter_recurse(&prop_val, &array_val_iter); - array_type = dbus_message_iter_get_arg_type(&array_val_iter); - *len = 0; - value->array_val = NULL; - if (array_type == DBUS_TYPE_OBJECT_PATH || - array_type == DBUS_TYPE_STRING){ - j = 0; - do { - j ++; - } while(dbus_message_iter_next(&array_val_iter)); - dbus_message_iter_recurse(&prop_val, &array_val_iter); - // Allocate an array of char * - *len = j; - char **tmp = (char **)malloc(sizeof(char *) * *len); - if (!tmp) - return -1; - j = 0; - do { - dbus_message_iter_get_basic(&array_val_iter, &tmp[j]); - j ++; - } while(dbus_message_iter_next(&array_val_iter)); - value->array_val = tmp; - } - break; - default: - return -1; - } - return 0; -} - -void create_prop_array(JNIEnv *env, jobjectArray strArray, Properties *property, - property_value *value, int len, int *array_index ) { - char **prop_val = NULL; - char buf[32] = {'\0'}, buf1[32] = {'\0'}; - int i; - - char *name = property->name; - int prop_type = property->type; - - set_object_array_element(env, strArray, name, *array_index); - *array_index += 1; - - if (prop_type == DBUS_TYPE_UINT32 || prop_type == DBUS_TYPE_INT16) { - sprintf(buf, "%d", value->int_val); - set_object_array_element(env, strArray, buf, *array_index); - *array_index += 1; - } else if (prop_type == DBUS_TYPE_BOOLEAN) { - sprintf(buf, "%s", value->int_val ? "true" : "false"); - - set_object_array_element(env, strArray, buf, *array_index); - *array_index += 1; - } else if (prop_type == DBUS_TYPE_ARRAY) { - // Write the length first - sprintf(buf1, "%d", len); - set_object_array_element(env, strArray, buf1, *array_index); - *array_index += 1; - - prop_val = value->array_val; - for (i = 0; i < len; i++) { - set_object_array_element(env, strArray, prop_val[i], *array_index); - *array_index += 1; - } - } else { - set_object_array_element(env, strArray, (const char *) value->str_val, *array_index); - *array_index += 1; - } -} - -jobjectArray parse_properties(JNIEnv *env, DBusMessageIter *iter, Properties *properties, - const int max_num_properties) { - DBusMessageIter dict_entry, dict; - jobjectArray strArray = NULL; - property_value value; - int i, size = 0,array_index = 0; - int len = 0, prop_type = DBUS_TYPE_INVALID, prop_index = -1, type; - struct { - property_value value; - int len; - bool used; - } values[max_num_properties]; - int t, j; - - jclass stringClass = env->FindClass("java/lang/String"); - DBusError err; - dbus_error_init(&err); - - for (i = 0; i < max_num_properties; i++) { - values[i].used = false; - } - - if(dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_ARRAY) - goto failure; - dbus_message_iter_recurse(iter, &dict); - do { - len = 0; - if (dbus_message_iter_get_arg_type(&dict) != DBUS_TYPE_DICT_ENTRY) - goto failure; - dbus_message_iter_recurse(&dict, &dict_entry); - - if (!get_property(dict_entry, properties, max_num_properties, &prop_index, - &value, &len)) { - size += 2; - if (properties[prop_index].type == DBUS_TYPE_ARRAY) - size += len; - values[prop_index].value = value; - values[prop_index].len = len; - values[prop_index].used = true; - } else { - goto failure; - } - } while(dbus_message_iter_next(&dict)); - - strArray = env->NewObjectArray(size, stringClass, NULL); - - for (i = 0; i < max_num_properties; i++) { - if (values[i].used) { - create_prop_array(env, strArray, &properties[i], &values[i].value, values[i].len, - &array_index); - - if (properties[i].type == DBUS_TYPE_ARRAY && values[i].used - && values[i].value.array_val != NULL) - free(values[i].value.array_val); - } - - } - return strArray; - -failure: - if (dbus_error_is_set(&err)) - LOG_AND_FREE_DBUS_ERROR(&err); - for (i = 0; i < max_num_properties; i++) - if (properties[i].type == DBUS_TYPE_ARRAY && values[i].used == true - && values[i].value.array_val != NULL) - free(values[i].value.array_val); - return NULL; -} - -jobjectArray parse_property_change(JNIEnv *env, DBusMessage *msg, - Properties *properties, int max_num_properties) { - DBusMessageIter iter; - DBusError err; - jobjectArray strArray = NULL; - jclass stringClass= env->FindClass("java/lang/String"); - int len = 0, prop_index = -1; - int array_index = 0, size = 0; - property_value value; - - dbus_error_init(&err); - if (!dbus_message_iter_init(msg, &iter)) - goto failure; - - if (!get_property(iter, properties, max_num_properties, - &prop_index, &value, &len)) { - size += 2; - if (properties[prop_index].type == DBUS_TYPE_ARRAY) - size += len; - strArray = env->NewObjectArray(size, stringClass, NULL); - - create_prop_array(env, strArray, &properties[prop_index], - &value, len, &array_index); - - if (properties[prop_index].type == DBUS_TYPE_ARRAY && value.array_val != NULL) - free(value.array_val); - - return strArray; - } -failure: - LOG_AND_FREE_DBUS_ERROR_WITH_MSG(&err, msg); - return NULL; -} - -jobjectArray parse_adapter_property_change(JNIEnv *env, DBusMessage *msg) { - return parse_property_change(env, msg, (Properties *) &adapter_properties, - sizeof(adapter_properties) / sizeof(Properties)); -} - -jobjectArray parse_remote_device_property_change(JNIEnv *env, DBusMessage *msg) { - return parse_property_change(env, msg, (Properties *) &remote_device_properties, - sizeof(remote_device_properties) / sizeof(Properties)); -} - -jobjectArray parse_input_property_change(JNIEnv *env, DBusMessage *msg) { - return parse_property_change(env, msg, (Properties *) &input_properties, - sizeof(input_properties) / sizeof(Properties)); -} - -jobjectArray parse_pan_property_change(JNIEnv *env, DBusMessage *msg) { - return parse_property_change(env, msg, (Properties *) &pan_properties, - sizeof(pan_properties) / sizeof(Properties)); -} - -jobjectArray parse_adapter_properties(JNIEnv *env, DBusMessageIter *iter) { - return parse_properties(env, iter, (Properties *) &adapter_properties, - sizeof(adapter_properties) / sizeof(Properties)); -} - -jobjectArray parse_remote_device_properties(JNIEnv *env, DBusMessageIter *iter) { - return parse_properties(env, iter, (Properties *) &remote_device_properties, - sizeof(remote_device_properties) / sizeof(Properties)); -} - -jobjectArray parse_input_properties(JNIEnv *env, DBusMessageIter *iter) { - return parse_properties(env, iter, (Properties *) &input_properties, - sizeof(input_properties) / sizeof(Properties)); -} - -jobjectArray parse_health_device_properties(JNIEnv *env, DBusMessageIter *iter) { - return parse_properties(env, iter, (Properties *) &health_device_properties, - sizeof(health_device_properties) / sizeof(Properties)); -} - -jobjectArray parse_health_device_property_change(JNIEnv *env, DBusMessage *msg) { - return parse_property_change(env, msg, (Properties *) &health_device_properties, - sizeof(health_device_properties) / sizeof(Properties)); -} - -jobjectArray parse_health_channel_properties(JNIEnv *env, DBusMessageIter *iter) { - return parse_properties(env, iter, (Properties *) &health_channel_properties, - sizeof(health_channel_properties) / sizeof(Properties)); -} - -int get_bdaddr(const char *str, bdaddr_t *ba) { - char *d = ((char *)ba) + 5, *endp; - int i; - for(i = 0; i < 6; i++) { - *d-- = strtol(str, &endp, 16); - if (*endp != ':' && i != 5) { - memset(ba, 0, sizeof(bdaddr_t)); - return -1; - } - str = endp + 1; - } - return 0; -} - -void get_bdaddr_as_string(const bdaddr_t *ba, char *str) { - const uint8_t *b = (const uint8_t *)ba; - sprintf(str, "%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X", - b[5], b[4], b[3], b[2], b[1], b[0]); -} - -bool debug_no_encrypt() { - return false; -#if 0 - char value[PROPERTY_VALUE_MAX] = ""; - - property_get("debug.bt.no_encrypt", value, ""); - if (!strncmp("true", value, PROPERTY_VALUE_MAX) || - !strncmp("1", value, PROPERTY_VALUE_MAX)) { - ALOGD("mandatory bluetooth encryption disabled"); - return true; - } else { - return false; - } -#endif -} -#endif - -} /* namespace android */ diff --git a/core/jni/android_bluetooth_common.h b/core/jni/android_bluetooth_common.h deleted file mode 100644 index daf4bb225f864..0000000000000 --- a/core/jni/android_bluetooth_common.h +++ /dev/null @@ -1,215 +0,0 @@ -/* -** Copyright 2006, The Android Open Source Project -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ - -#ifndef ANDROID_BLUETOOTH_COMMON_H -#define ANDROID_BLUETOOTH_COMMON_H - -// Set to 0 to enable verbose bluetooth logging -#define LOG_NDEBUG 1 - -#include "jni.h" -#include "utils/Log.h" - -#include -#include -#include -#include - -#ifdef HAVE_BLUETOOTH -#include -#include -#endif - -namespace android { - -#ifdef HAVE_BLUETOOTH -#define BLUEZ_DBUS_BASE_PATH "/org/bluez" -#define BLUEZ_DBUS_BASE_IFC "org.bluez" -#define BLUEZ_ERROR_IFC "org.bluez.Error" - -// It would be nicer to retrieve this from bluez using GetDefaultAdapter, -// but this is only possible when the adapter is up (and hcid is running). -// It is much easier just to hardcode bluetooth adapter to hci0 -#define BLUETOOTH_ADAPTER_HCI_NUM 0 -#define BLUEZ_ADAPTER_OBJECT_NAME BLUEZ_DBUS_BASE_PATH "/hci0" - -#define BTADDR_SIZE 18 // size of BT address character array (including null) - -// size of the dbus event loops pollfd structure, hopefully never to be grown -#define DEFAULT_INITIAL_POLLFD_COUNT 8 - -jfieldID get_field(JNIEnv *env, - jclass clazz, - const char *member, - const char *mtype); - -// ALOGE and free a D-Bus error -// Using #define so that __FUNCTION__ resolves usefully -#define LOG_AND_FREE_DBUS_ERROR_WITH_MSG(err, msg) \ - { ALOGE("%s: D-Bus error in %s: %s (%s)", __FUNCTION__, \ - dbus_message_get_member((msg)), (err)->name, (err)->message); \ - dbus_error_free((err)); } -#define LOG_AND_FREE_DBUS_ERROR(err) \ - { ALOGE("%s: D-Bus error: %s (%s)", __FUNCTION__, \ - (err)->name, (err)->message); \ - dbus_error_free((err)); } - -struct event_loop_native_data_t { - DBusConnection *conn; - const char *adapter; - - /* protects the thread */ - pthread_mutex_t thread_mutex; - pthread_t thread; - /* our comms socket */ - /* mem for the list of sockets to listen to */ - struct pollfd *pollData; - int pollMemberCount; - int pollDataSize; - /* mem for matching set of dbus watch ptrs */ - DBusWatch **watchData; - /* pair of sockets for event loop control, Reader and Writer */ - int controlFdR; - int controlFdW; - /* our vm and env Version for future env generation */ - JavaVM *vm; - int envVer; - /* reference to our java self */ - jobject me; - /* flag to indicate if the event loop thread is running */ - bool running; -}; - -struct _Properties { - char name[32]; - int type; -}; -typedef struct _Properties Properties; - -dbus_bool_t dbus_func_args_async(JNIEnv *env, - DBusConnection *conn, - int timeout_ms, - void (*reply)(DBusMessage *, void *, void *), - void *user, - void *nat, - const char *path, - const char *ifc, - const char *func, - int first_arg_type, - ...); - -DBusMessage * dbus_func_args(JNIEnv *env, - DBusConnection *conn, - const char *path, - const char *ifc, - const char *func, - int first_arg_type, - ...); - -DBusMessage * dbus_func_args_error(JNIEnv *env, - DBusConnection *conn, - DBusError *err, - const char *path, - const char *ifc, - const char *func, - int first_arg_type, - ...); - -DBusMessage * dbus_func_args_timeout(JNIEnv *env, - DBusConnection *conn, - int timeout_ms, - const char *path, - const char *ifc, - const char *func, - int first_arg_type, - ...); - -DBusMessage * dbus_func_args_timeout_valist(JNIEnv *env, - DBusConnection *conn, - int timeout_ms, - DBusError *err, - const char *path, - const char *ifc, - const char *func, - int first_arg_type, - va_list args); - -jint dbus_returns_int32(JNIEnv *env, DBusMessage *reply); -jint dbus_returns_uint32(JNIEnv *env, DBusMessage *reply); -jint dbus_returns_unixfd(JNIEnv *env, DBusMessage *reply); -jstring dbus_returns_string(JNIEnv *env, DBusMessage *reply); -jboolean dbus_returns_boolean(JNIEnv *env, DBusMessage *reply); -jobjectArray dbus_returns_array_of_strings(JNIEnv *env, DBusMessage *reply); -jobjectArray dbus_returns_array_of_object_path(JNIEnv *env, DBusMessage *reply); -jbyteArray dbus_returns_array_of_bytes(JNIEnv *env, DBusMessage *reply); - -jobjectArray parse_properties(JNIEnv *env, DBusMessageIter *iter, Properties *properties, - const int max_num_properties); -jobjectArray parse_property_change(JNIEnv *env, DBusMessage *msg, - Properties *properties, int max_num_properties); -jobjectArray parse_adapter_properties(JNIEnv *env, DBusMessageIter *iter); -jobjectArray parse_remote_device_properties(JNIEnv *env, DBusMessageIter *iter); -jobjectArray parse_remote_device_property_change(JNIEnv *env, DBusMessage *msg); -jobjectArray parse_adapter_property_change(JNIEnv *env, DBusMessage *msg); -jobjectArray parse_input_properties(JNIEnv *env, DBusMessageIter *iter); -jobjectArray parse_health_device_properties(JNIEnv *env, DBusMessageIter *iter); -jobjectArray parse_health_channel_properties(JNIEnv *env, DBusMessageIter *iter); -jobjectArray parse_input_property_change(JNIEnv *env, DBusMessage *msg); -jobjectArray parse_pan_property_change(JNIEnv *env, DBusMessage *msg); -jobjectArray parse_health_device_property_change(JNIEnv *env, DBusMessage *msg); - -void append_dict_args(DBusMessage *reply, const char *first_key, ...); -void append_variant(DBusMessageIter *iter, int type, void *val); -int get_bdaddr(const char *str, bdaddr_t *ba); -void get_bdaddr_as_string(const bdaddr_t *ba, char *str); - -bool debug_no_encrypt(); - - -// Result codes from Bluez DBus calls -#define BOND_RESULT_ERROR -1 -#define BOND_RESULT_SUCCESS 0 -#define BOND_RESULT_AUTH_FAILED 1 -#define BOND_RESULT_AUTH_REJECTED 2 -#define BOND_RESULT_AUTH_CANCELED 3 -#define BOND_RESULT_REMOTE_DEVICE_DOWN 4 -#define BOND_RESULT_DISCOVERY_IN_PROGRESS 5 -#define BOND_RESULT_AUTH_TIMEOUT 6 -#define BOND_RESULT_REPEATED_ATTEMPTS 7 - -#define PAN_DISCONNECT_FAILED_NOT_CONNECTED 1000 -#define PAN_CONNECT_FAILED_ALREADY_CONNECTED 1001 -#define PAN_CONNECT_FAILED_ATTEMPT_FAILED 1002 -#define PAN_OPERATION_GENERIC_FAILURE 1003 -#define PAN_OPERATION_SUCCESS 1004 - -#define INPUT_DISCONNECT_FAILED_NOT_CONNECTED 5000 -#define INPUT_CONNECT_FAILED_ALREADY_CONNECTED 5001 -#define INPUT_CONNECT_FAILED_ATTEMPT_FAILED 5002 -#define INPUT_OPERATION_GENERIC_FAILURE 5003 -#define INPUT_OPERATION_SUCCESS 5004 - -#define HEALTH_OPERATION_SUCCESS 6000 -#define HEALTH_OPERATION_ERROR 6001 -#define HEALTH_OPERATION_INVALID_ARGS 6002 -#define HEALTH_OPERATION_GENERIC_FAILURE 6003 -#define HEALTH_OPERATION_NOT_FOUND 6004 -#define HEALTH_OPERATION_NOT_ALLOWED 6005 - -#endif -} /* namespace android */ - -#endif/*ANDROID_BLUETOOTH_COMMON_H*/ diff --git a/core/jni/android_emoji_EmojiFactory.cpp b/core/jni/android_emoji_EmojiFactory.cpp index a658561b059fb..43839972227d3 100644 --- a/core/jni/android_emoji_EmojiFactory.cpp +++ b/core/jni/android_emoji_EmojiFactory.cpp @@ -3,8 +3,7 @@ #define LOG_TAG "EmojiFactory_jni" #include -#include -#include +#include #include "EmojiFactory.h" #include @@ -125,16 +124,13 @@ static jobject android_emoji_EmojiFactory_newInstance( return NULL; } - const jchar* jchars = env->GetStringChars(name, NULL); - jsize len = env->GetStringLength(name); - String8 str(String16(jchars, len)); + ScopedUtfChars nameUtf(env, name); - EmojiFactory *factory = gCaller->TryCallGetImplementation(str.string()); + EmojiFactory *factory = gCaller->TryCallGetImplementation(nameUtf.c_str()); // EmojiFactory *factory = EmojiFactory::GetImplementation(str.string()); if (NULL == factory) { return NULL; } - env->ReleaseStringChars(name, jchars); return create_java_EmojiFactory(env, factory, name); } @@ -151,8 +147,8 @@ static jobject android_emoji_EmojiFactory_newAvailableInstance( if (NULL == factory) { return NULL; } - String16 name_16(String8(factory->Name())); - jstring jname = env->NewString(name_16.string(), name_16.size()); + + jstring jname = env->NewStringUTF(factory->Name()); if (NULL == jname) { return NULL; } diff --git a/core/jni/android_hardware_Camera.cpp b/core/jni/android_hardware_Camera.cpp index 6cd8955d366ba..d8fc55efc143e 100644 --- a/core/jni/android_hardware_Camera.cpp +++ b/core/jni/android_hardware_Camera.cpp @@ -23,6 +23,7 @@ #include "JNIHelp.h" #include "android_runtime/AndroidRuntime.h" +#include #include #include @@ -38,6 +39,7 @@ struct fields_t { jfieldID surfaceTexture; jfieldID facing; jfieldID orientation; + jfieldID canDisableShutterSound; jfieldID face_rect; jfieldID face_score; jfieldID rect_left; @@ -453,6 +455,12 @@ static void android_hardware_Camera_getCameraInfo(JNIEnv *env, jobject thiz, } env->SetIntField(info_obj, fields.facing, cameraInfo.facing); env->SetIntField(info_obj, fields.orientation, cameraInfo.orientation); + + char value[PROPERTY_VALUE_MAX]; + property_get("ro.camera.sound.forced", value, "0"); + jboolean canDisableShutterSound = (strncmp(value, "0", 2) == 0); + env->SetBooleanField(info_obj, fields.canDisableShutterSound, + canDisableShutterSound); } // connect to camera service @@ -781,6 +789,25 @@ static void android_hardware_Camera_setDisplayOrientation(JNIEnv *env, jobject t } } +static jboolean android_hardware_Camera_enableShutterSound(JNIEnv *env, jobject thiz, + jboolean enabled) +{ + ALOGV("enableShutterSound"); + sp camera = get_native_camera(env, thiz, NULL); + if (camera == 0) return JNI_FALSE; + + int32_t value = (enabled == JNI_TRUE) ? 1 : 0; + status_t rc = camera->sendCommand(CAMERA_CMD_ENABLE_SHUTTER_SOUND, value, 0); + if (rc == NO_ERROR) { + return JNI_TRUE; + } else if (rc == PERMISSION_DENIED) { + return JNI_FALSE; + } else { + jniThrowRuntimeException(env, "enable shutter sound failed"); + return JNI_FALSE; + } +} + static void android_hardware_Camera_startFaceDetection(JNIEnv *env, jobject thiz, jint type) { @@ -813,12 +840,16 @@ static void android_hardware_Camera_stopFaceDetection(JNIEnv *env, jobject thiz) static void android_hardware_Camera_enableFocusMoveCallback(JNIEnv *env, jobject thiz, jint enable) { ALOGV("enableFocusMoveCallback"); +#ifdef ICS_CAMERA_BLOB + return; +#else sp camera = get_native_camera(env, thiz, NULL); if (camera == 0) return; if (camera->sendCommand(CAMERA_CMD_ENABLE_FOCUS_MOVE_MSG, enable, 0) != NO_ERROR) { jniThrowRuntimeException(env, "enable focus move callback failed"); } +#endif } //------------------------------------------------- @@ -827,7 +858,7 @@ static JNINativeMethod camMethods[] = { { "getNumberOfCameras", "()I", (void *)android_hardware_Camera_getNumberOfCameras }, - { "getCameraInfo", + { "_getCameraInfo", "(ILandroid/hardware/Camera$CameraInfo;)V", (void*)android_hardware_Camera_getCameraInfo }, { "native_setup", @@ -890,6 +921,9 @@ static JNINativeMethod camMethods[] = { { "setDisplayOrientation", "(I)V", (void *)android_hardware_Camera_setDisplayOrientation }, + { "_enableShutterSound", + "(Z)Z", + (void *)android_hardware_Camera_enableShutterSound }, { "_startFaceDetection", "(I)V", (void *)android_hardware_Camera_startFaceDetection }, @@ -940,6 +974,8 @@ int register_android_hardware_Camera(JNIEnv *env) ANDROID_GRAPHICS_SURFACETEXTURE_JNI_ID, "I", &fields.surfaceTexture }, { "android/hardware/Camera$CameraInfo", "facing", "I", &fields.facing }, { "android/hardware/Camera$CameraInfo", "orientation", "I", &fields.orientation }, + { "android/hardware/Camera$CameraInfo", "canDisableShutterSound", "Z", + &fields.canDisableShutterSound }, { "android/hardware/Camera$Face", "rect", "Landroid/graphics/Rect;", &fields.face_rect }, { "android/hardware/Camera$Face", "score", "I", &fields.face_score }, { "android/graphics/Rect", "left", "I", &fields.rect_left }, diff --git a/core/jni/android_hardware_UsbRequest.cpp b/core/jni/android_hardware_UsbRequest.cpp index 1398968b043dc..32d5135055ae0 100644 --- a/core/jni/android_hardware_UsbRequest.cpp +++ b/core/jni/android_hardware_UsbRequest.cpp @@ -90,6 +90,7 @@ android_hardware_UsbRequest_queue_array(JNIEnv *env, jobject thiz, request->buffer = malloc(length); if (!request->buffer) return false; + memset(request->buffer, 0, length); if (out) { // copy data from Java buffer to native buffer env->GetByteArrayRegion(buffer, 0, length, (jbyte *)request->buffer); @@ -113,14 +114,14 @@ android_hardware_UsbRequest_queue_array(JNIEnv *env, jobject thiz, } } -static void +static int android_hardware_UsbRequest_dequeue_array(JNIEnv *env, jobject thiz, jbyteArray buffer, jint length, jboolean out) { struct usb_request* request = get_request_from_object(env, thiz); if (!request) { ALOGE("request is closed in native_dequeue"); - return; + return -1; } if (buffer && length && request->buffer && !out) { @@ -129,7 +130,7 @@ android_hardware_UsbRequest_dequeue_array(JNIEnv *env, jobject thiz, } free(request->buffer); env->DeleteGlobalRef((jobject)request->client_data); - + return request->actual_length; } static jboolean @@ -163,16 +164,17 @@ android_hardware_UsbRequest_queue_direct(JNIEnv *env, jobject thiz, } } -static void +static int android_hardware_UsbRequest_dequeue_direct(JNIEnv *env, jobject thiz) { struct usb_request* request = get_request_from_object(env, thiz); if (!request) { ALOGE("request is closed in native_dequeue"); - return; + return -1; } // all we need to do is delete our global ref env->DeleteGlobalRef((jobject)request->client_data); + return request->actual_length; } static jboolean @@ -191,10 +193,10 @@ static JNINativeMethod method_table[] = { (void *)android_hardware_UsbRequest_init}, {"native_close", "()V", (void *)android_hardware_UsbRequest_close}, {"native_queue_array", "([BIZ)Z", (void *)android_hardware_UsbRequest_queue_array}, - {"native_dequeue_array", "([BIZ)V", (void *)android_hardware_UsbRequest_dequeue_array}, + {"native_dequeue_array", "([BIZ)I", (void *)android_hardware_UsbRequest_dequeue_array}, {"native_queue_direct", "(Ljava/nio/ByteBuffer;IZ)Z", (void *)android_hardware_UsbRequest_queue_direct}, - {"native_dequeue_direct", "()V", (void *)android_hardware_UsbRequest_dequeue_direct}, + {"native_dequeue_direct", "()I", (void *)android_hardware_UsbRequest_dequeue_direct}, {"native_cancel", "()Z", (void *)android_hardware_UsbRequest_cancel}, }; diff --git a/core/jni/android_media_AudioRecord.cpp b/core/jni/android_media_AudioRecord.cpp index 0f04e6fd45e6c..b75cc55b3b590 100644 --- a/core/jni/android_media_AudioRecord.cpp +++ b/core/jni/android_media_AudioRecord.cpp @@ -49,6 +49,11 @@ struct fields_t { jmethodID postNativeEventInJava; //... event post callback method int PCM16; //... format constants int PCM8; //... format constants + int AMRNB; //... format constants + int AMRWB; //... format constants + int EVRC; //... format constants + int EVRCB; //... format constants + int EVRCWB; //... format constants jfieldID nativeRecorderInJavaObj; // provides access to the C++ AudioRecord object jfieldID nativeCallbackCookie; // provides access to the AudioRecord callback data }; @@ -162,6 +167,24 @@ static sp setAudioRecord(JNIEnv* env, jobject thiz, const spSetIntField(thiz, javaAudioRecordFields.nativeRecorderInJavaObj, (int)ar.get()); return old; } +int getformatrec(int audioformat) +{ + if(audioformat==javaAudioRecordFields.PCM16) + return AUDIO_FORMAT_PCM_16_BIT; +#ifdef QCOM_HARDWARE + else if(audioformat==javaAudioRecordFields.AMRNB) + return AUDIO_FORMAT_AMR_NB; + else if(audioformat==javaAudioRecordFields.AMRWB) + return AUDIO_FORMAT_AMR_WB; + else if(audioformat==javaAudioRecordFields.EVRC) + return AUDIO_FORMAT_EVRC; + else if(audioformat==javaAudioRecordFields.EVRCB) + return AUDIO_FORMAT_EVRCB; + else if(audioformat==javaAudioRecordFields.EVRCWB) + return AUDIO_FORMAT_EVRCWB; +#endif + return AUDIO_FORMAT_PCM_8_BIT; +} // ---------------------------------------------------------------------------- static int @@ -181,14 +204,27 @@ android_media_AudioRecord_setup(JNIEnv *env, jobject thiz, jobject weak_this, // compare the format against the Java constants if ((audioFormat != javaAudioRecordFields.PCM16) +#ifdef QCOM_HARDWARE + && (audioFormat != javaAudioRecordFields.AMRNB) + && (audioFormat != javaAudioRecordFields.AMRWB) + && (audioFormat != javaAudioRecordFields.EVRC) + && (audioFormat != javaAudioRecordFields.EVRCB) +#endif && (audioFormat != javaAudioRecordFields.PCM8)) { ALOGE("Error creating AudioRecord: unsupported audio format."); return AUDIORECORD_ERROR_SETUP_INVALIDFORMAT; } - - int bytesPerSample = audioFormat==javaAudioRecordFields.PCM16 ? 2 : 1; - audio_format_t format = audioFormat==javaAudioRecordFields.PCM16 ? - AUDIO_FORMAT_PCM_16_BIT : AUDIO_FORMAT_PCM_8_BIT; + int bytesPerSample; + if(audioFormat == javaAudioRecordFields.PCM8) + bytesPerSample = 1; +#ifdef QCOM_HARDWARE + else if((audioFormat == javaAudioRecordFields.AMRWB) && + ((uint32_t)source != AUDIO_SOURCE_VOICE_COMMUNICATION)) + bytesPerSample = 61; +#endif + else + bytesPerSample = 2; + audio_format_t format = (audio_format_t)getformatrec(audioFormat); if (buffSizeInBytes == 0) { ALOGE("Error creating AudioRecord: frameCount is 0."); @@ -242,7 +278,6 @@ android_media_AudioRecord_setup(JNIEnv *env, jobject thiz, jobject weak_this, format, // word length, PCM channels, frameCount, - (AudioRecord::record_flags) 0, // flags recorderCallback,// callback_t lpCallbackData,// void* user 0, // notificationFrames, @@ -515,8 +550,7 @@ static jint android_media_AudioRecord_get_min_buff_size(JNIEnv *env, jobject th int frameCount = 0; status_t result = AudioRecord::getMinFrameCount(&frameCount, sampleRateInHertz, - (audioFormat == javaAudioRecordFields.PCM16 ? - AUDIO_FORMAT_PCM_16_BIT : AUDIO_FORMAT_PCM_8_BIT), + (audio_format_t)getformatrec(audioFormat), nbChannels); if (result == BAD_VALUE) { @@ -525,7 +559,17 @@ static jint android_media_AudioRecord_get_min_buff_size(JNIEnv *env, jobject th if (result != NO_ERROR) { return -1; } - return frameCount * nbChannels * (audioFormat == javaAudioRecordFields.PCM16 ? 2 : 1); + int bytesPerSample; + if(audioFormat == javaAudioRecordFields.PCM8) + bytesPerSample = 1; +#ifdef QCOM_HARDWARE + else if(audioFormat == javaAudioRecordFields.AMRWB) + bytesPerSample = 61; +#endif + else + bytesPerSample = 2; + + return frameCount * nbChannels * bytesPerSample; } @@ -559,6 +603,11 @@ static JNINativeMethod gMethods[] = { #define JAVA_POSTEVENT_CALLBACK_NAME "postEventFromNative" #define JAVA_CONST_PCM16_NAME "ENCODING_PCM_16BIT" #define JAVA_CONST_PCM8_NAME "ENCODING_PCM_8BIT" +#define JAVA_CONST_AMRNB_NAME "ENCODING_AMRNB" +#define JAVA_CONST_AMRWB_NAME "ENCODING_AMRWB" +#define JAVA_CONST_EVRC_NAME "ENCODING_EVRC" +#define JAVA_CONST_EVRCB_NAME "ENCODING_EVRCB" +#define JAVA_CONST_EVRCWB_NAME "ENCODING_EVRCWB" #define JAVA_NATIVERECORDERINJAVAOBJ_FIELD_NAME "mNativeRecorderInJavaObj" #define JAVA_NATIVECALLBACKINFO_FIELD_NAME "mNativeCallbackCookie" @@ -622,7 +671,22 @@ int register_android_media_AudioRecord(JNIEnv *env) JAVA_CONST_PCM16_NAME, &(javaAudioRecordFields.PCM16)) || !android_media_getIntConstantFromClass(env, audioFormatClass, JAVA_AUDIOFORMAT_CLASS_NAME, - JAVA_CONST_PCM8_NAME, &(javaAudioRecordFields.PCM8)) ) { + JAVA_CONST_PCM8_NAME, &(javaAudioRecordFields.PCM8)) + || !android_media_getIntConstantFromClass(env, audioFormatClass, + JAVA_AUDIOFORMAT_CLASS_NAME, + JAVA_CONST_AMRNB_NAME, &(javaAudioRecordFields.AMRNB)) + || !android_media_getIntConstantFromClass(env, audioFormatClass, + JAVA_AUDIOFORMAT_CLASS_NAME, + JAVA_CONST_AMRWB_NAME, &(javaAudioRecordFields.AMRWB)) + || !android_media_getIntConstantFromClass(env, audioFormatClass, + JAVA_AUDIOFORMAT_CLASS_NAME, + JAVA_CONST_EVRC_NAME, &(javaAudioRecordFields.EVRC)) + || !android_media_getIntConstantFromClass(env, audioFormatClass, + JAVA_AUDIOFORMAT_CLASS_NAME, + JAVA_CONST_EVRCB_NAME, &(javaAudioRecordFields.EVRCB)) + || !android_media_getIntConstantFromClass(env, audioFormatClass, + JAVA_AUDIOFORMAT_CLASS_NAME, + JAVA_CONST_EVRCWB_NAME, &(javaAudioRecordFields.EVRCWB))) { // error log performed in getIntConstantFromClass() return -1; } diff --git a/core/jni/android_media_AudioSystem.cpp b/core/jni/android_media_AudioSystem.cpp index f522a9a07f730..631cdaea806f2 100644 --- a/core/jni/android_media_AudioSystem.cpp +++ b/core/jni/android_media_AudioSystem.cpp @@ -75,6 +75,14 @@ android_media_AudioSystem_isStreamActive(JNIEnv *env, jobject thiz, jint stream, return state; } +static jboolean +android_media_AudioSystem_isSourceActive(JNIEnv *env, jobject thiz, jint source) +{ + bool state = false; + AudioSystem::isSourceActive((audio_source_t) source, &state); + return state; +} + static int android_media_AudioSystem_setParameters(JNIEnv *env, jobject thiz, jstring keyValuePairs) { @@ -242,6 +250,18 @@ android_media_AudioSystem_getDevicesForStream(JNIEnv *env, jobject thiz, jint st return (jint) AudioSystem::getDevicesForStream(static_cast (stream)); } +static jint +android_media_AudioSystem_getPrimaryOutputSamplingRate(JNIEnv *env, jobject clazz) +{ + return (jint) AudioSystem::getPrimaryOutputSamplingRate(); +} + +static jint +android_media_AudioSystem_getPrimaryOutputFrameCount(JNIEnv *env, jobject clazz) +{ + return (jint) AudioSystem::getPrimaryOutputFrameCount(); +} + // ---------------------------------------------------------------------------- static JNINativeMethod gMethods[] = { @@ -249,7 +269,8 @@ static JNINativeMethod gMethods[] = { {"getParameters", "(Ljava/lang/String;)Ljava/lang/String;", (void *)android_media_AudioSystem_getParameters}, {"muteMicrophone", "(Z)I", (void *)android_media_AudioSystem_muteMicrophone}, {"isMicrophoneMuted", "()Z", (void *)android_media_AudioSystem_isMicrophoneMuted}, - {"isStreamActive", "(II)Z", (void *)android_media_AudioSystem_isStreamActive}, + {"isStreamActive", "(II)Z", (void *)android_media_AudioSystem_isStreamActive}, + {"isSourceActive", "(I)Z", (void *)android_media_AudioSystem_isSourceActive}, {"setDeviceConnectionState", "(IILjava/lang/String;)I", (void *)android_media_AudioSystem_setDeviceConnectionState}, {"getDeviceConnectionState", "(ILjava/lang/String;)I", (void *)android_media_AudioSystem_getDeviceConnectionState}, {"setPhoneState", "(I)I", (void *)android_media_AudioSystem_setPhoneState}, @@ -263,6 +284,8 @@ static JNINativeMethod gMethods[] = { {"setMasterMute", "(Z)I", (void *)android_media_AudioSystem_setMasterMute}, {"getMasterMute", "()Z", (void *)android_media_AudioSystem_getMasterMute}, {"getDevicesForStream", "(I)I", (void *)android_media_AudioSystem_getDevicesForStream}, + {"getPrimaryOutputSamplingRate", "()I", (void *)android_media_AudioSystem_getPrimaryOutputSamplingRate}, + {"getPrimaryOutputFrameCount", "()I", (void *)android_media_AudioSystem_getPrimaryOutputFrameCount}, }; int register_android_media_AudioSystem(JNIEnv *env) diff --git a/core/jni/android_media_AudioTrack.cpp b/core/jni/android_media_AudioTrack.cpp index 7e5263d036be5..e462f58a0d297 100644 --- a/core/jni/android_media_AudioTrack.cpp +++ b/core/jni/android_media_AudioTrack.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2008 The Android Open Source Project + * Copyright (c) 2012, The Linux Foundation. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -49,6 +50,19 @@ struct fields_t { jmethodID postNativeEventInJava; //... event post callback method int PCM16; //... format constants int PCM8; //... format constants + int AMRNB; //... format constants + int AMRWB; //... format constants + int EVRC; //... format constants + int EVRCB; //... format constants + int EVRCWB; //... format constants + int STREAM_VOICE_CALL; //... stream type constants + int STREAM_SYSTEM; //... stream type constants + int STREAM_RING; //... stream type constants + int STREAM_MUSIC; //... stream type constants + int STREAM_ALARM; //... stream type constants + int STREAM_NOTIFICATION; //... stream type constants + int STREAM_BLUETOOTH_SCO; //... stream type constants + int STREAM_DTMF; //... stream type constants int MODE_STREAM; //... memory mode int MODE_STATIC; //... memory mode jfieldID nativeTrackInJavaObj; // stores in Java the native AudioTrack object @@ -199,6 +213,25 @@ static sp setAudioTrack(JNIEnv* env, jobject thiz, const spGetObjectClass(thiz); @@ -516,7 +560,16 @@ jint writeToTrack(const sp& track, jint audioFormat, jbyte* data, if (track->sharedBuffer() == 0) { written = track->write(data + offsetInBytes, sizeInBytes); } else { +#ifdef QCOM_HARDWARE + if ((audioFormat == javaAudioTrackFields.PCM16) + || (audioFormat == javaAudioTrackFields.AMRNB) + || (audioFormat == javaAudioTrackFields.AMRWB) + || (audioFormat == javaAudioTrackFields.EVRC) + || (audioFormat == javaAudioTrackFields.EVRCB) + || (audioFormat == javaAudioTrackFields.EVRCWB)) { +#else if (audioFormat == javaAudioTrackFields.PCM16) { +#endif // writing to shared memory, check for capacity if ((size_t)sizeInBytes > track->sharedBuffer()->size()) { sizeInBytes = track->sharedBuffer()->size(); @@ -791,7 +844,7 @@ static jint android_media_AudioTrack_get_min_buff_size(JNIEnv *env, jobject thi sampleRateInHertz) != NO_ERROR) { return -1; } - return frameCount * nbChannels * (audioFormat == javaAudioTrackFields.PCM16 ? 2 : 1); + return frameCount * nbChannels * (audioFormat == javaAudioTrackFields.PCM8 ? 1 : 2); } // ---------------------------------------------------------------------------- @@ -866,6 +919,11 @@ static JNINativeMethod gMethods[] = { #define JAVA_POSTEVENT_CALLBACK_NAME "postEventFromNative" #define JAVA_CONST_PCM16_NAME "ENCODING_PCM_16BIT" #define JAVA_CONST_PCM8_NAME "ENCODING_PCM_8BIT" +#define JAVA_CONST_AMRNB_NAME "ENCODING_AMRNB" +#define JAVA_CONST_AMRWB_NAME "ENCODING_AMRWB" +#define JAVA_CONST_EVRC_NAME "ENCODING_EVRC" +#define JAVA_CONST_EVRCB_NAME "ENCODING_EVRCB" +#define JAVA_CONST_EVRCWB_NAME "ENCODING_EVRCWB" #define JAVA_CONST_BUFFER_COUNT_NAME "BUFFER_COUNT" #define JAVA_CONST_STREAM_VOICE_CALL_NAME "STREAM_VOICE_CALL" #define JAVA_CONST_STREAM_SYSTEM_NAME "STREAM_SYSTEM" @@ -963,7 +1021,57 @@ int register_android_media_AudioTrack(JNIEnv *env) JAVA_CONST_PCM16_NAME, &(javaAudioTrackFields.PCM16)) || !android_media_getIntConstantFromClass(env, audioFormatClass, JAVA_AUDIOFORMAT_CLASS_NAME, - JAVA_CONST_PCM8_NAME, &(javaAudioTrackFields.PCM8)) ) { + JAVA_CONST_PCM8_NAME, &(javaAudioTrackFields.PCM8)) + || !android_media_getIntConstantFromClass(env, audioFormatClass, + JAVA_AUDIOFORMAT_CLASS_NAME, + JAVA_CONST_AMRNB_NAME, &(javaAudioTrackFields.AMRNB)) + || !android_media_getIntConstantFromClass(env, audioFormatClass, + JAVA_AUDIOFORMAT_CLASS_NAME, + JAVA_CONST_AMRWB_NAME, &(javaAudioTrackFields.AMRWB)) + || !android_media_getIntConstantFromClass(env, audioFormatClass, + JAVA_AUDIOFORMAT_CLASS_NAME, + JAVA_CONST_EVRC_NAME, &(javaAudioTrackFields.EVRC)) + || !android_media_getIntConstantFromClass(env, audioFormatClass, + JAVA_AUDIOFORMAT_CLASS_NAME, + JAVA_CONST_EVRCB_NAME, &(javaAudioTrackFields.EVRCB)) + || !android_media_getIntConstantFromClass(env, audioFormatClass, + JAVA_AUDIOFORMAT_CLASS_NAME, + JAVA_CONST_EVRCWB_NAME, &(javaAudioTrackFields.EVRCWB)) +) { + // error log performed in android_media_getIntConstantFromClass() + return -1; + } + // Get the stream types from the AudioManager class + jclass audioManagerClass = NULL; + audioManagerClass = env->FindClass(JAVA_AUDIOMANAGER_CLASS_NAME); + if (audioManagerClass == NULL) { + ALOGE("Can't find %s", JAVA_AUDIOMANAGER_CLASS_NAME); + return -1; + } + if ( !android_media_getIntConstantFromClass(env, audioManagerClass, + JAVA_AUDIOMANAGER_CLASS_NAME, + JAVA_CONST_STREAM_VOICE_CALL_NAME, &(javaAudioTrackFields.STREAM_VOICE_CALL)) + || !android_media_getIntConstantFromClass(env, audioManagerClass, + JAVA_AUDIOMANAGER_CLASS_NAME, + JAVA_CONST_STREAM_MUSIC_NAME, &(javaAudioTrackFields.STREAM_MUSIC)) + || !android_media_getIntConstantFromClass(env, audioManagerClass, + JAVA_AUDIOMANAGER_CLASS_NAME, + JAVA_CONST_STREAM_SYSTEM_NAME, &(javaAudioTrackFields.STREAM_SYSTEM)) + || !android_media_getIntConstantFromClass(env, audioManagerClass, + JAVA_AUDIOMANAGER_CLASS_NAME, + JAVA_CONST_STREAM_RING_NAME, &(javaAudioTrackFields.STREAM_RING)) + || !android_media_getIntConstantFromClass(env, audioManagerClass, + JAVA_AUDIOMANAGER_CLASS_NAME, + JAVA_CONST_STREAM_ALARM_NAME, &(javaAudioTrackFields.STREAM_ALARM)) + || !android_media_getIntConstantFromClass(env, audioManagerClass, + JAVA_AUDIOMANAGER_CLASS_NAME, + JAVA_CONST_STREAM_NOTIFICATION_NAME, &(javaAudioTrackFields.STREAM_NOTIFICATION)) + || !android_media_getIntConstantFromClass(env, audioManagerClass, + JAVA_AUDIOMANAGER_CLASS_NAME, + JAVA_CONST_STREAM_BLUETOOTH_SCO_NAME, &(javaAudioTrackFields.STREAM_BLUETOOTH_SCO)) + || !android_media_getIntConstantFromClass(env, audioManagerClass, + JAVA_AUDIOMANAGER_CLASS_NAME, + JAVA_CONST_STREAM_DTMF_NAME, &(javaAudioTrackFields.STREAM_DTMF))) { // error log performed in android_media_getIntConstantFromClass() return -1; } diff --git a/core/jni/android_media_RemoteDisplay.cpp b/core/jni/android_media_RemoteDisplay.cpp new file mode 100644 index 0000000000000..5d24f619c8963 --- /dev/null +++ b/core/jni/android_media_RemoteDisplay.cpp @@ -0,0 +1,182 @@ +/* + * 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 "RemoteDisplay" + +#include "jni.h" +#include "JNIHelp.h" + +#include "android_os_Parcel.h" +#include "android_util_Binder.h" + +#include +#include + +#include + +#include + +#include +#include +#include + +#include + +#include + +namespace android { + +static struct { + jmethodID notifyDisplayConnected; + jmethodID notifyDisplayDisconnected; + jmethodID notifyDisplayError; +} gRemoteDisplayClassInfo; + +// ---------------------------------------------------------------------------- + +class NativeRemoteDisplayClient : public BnRemoteDisplayClient { +public: + NativeRemoteDisplayClient(JNIEnv* env, jobject remoteDisplayObj) : + mRemoteDisplayObjGlobal(env->NewGlobalRef(remoteDisplayObj)) { + } + +protected: + ~NativeRemoteDisplayClient() { + JNIEnv* env = AndroidRuntime::getJNIEnv(); + env->DeleteGlobalRef(mRemoteDisplayObjGlobal); + } + +public: + virtual void onDisplayConnected(const sp& surfaceTexture, + uint32_t width, uint32_t height, uint32_t flags) { + JNIEnv* env = AndroidRuntime::getJNIEnv(); + + jobject surfaceObj = android_view_Surface_createFromISurfaceTexture(env, surfaceTexture); + if (surfaceObj == NULL) { + ALOGE("Could not create Surface from surface texture %p provided by media server.", + surfaceTexture.get()); + return; + } + + env->CallVoidMethod(mRemoteDisplayObjGlobal, + gRemoteDisplayClassInfo.notifyDisplayConnected, + surfaceObj, width, height, flags); + env->DeleteLocalRef(surfaceObj); + checkAndClearExceptionFromCallback(env, "notifyDisplayConnected"); + } + + virtual void onDisplayDisconnected() { + JNIEnv* env = AndroidRuntime::getJNIEnv(); + + env->CallVoidMethod(mRemoteDisplayObjGlobal, + gRemoteDisplayClassInfo.notifyDisplayDisconnected); + checkAndClearExceptionFromCallback(env, "notifyDisplayDisconnected"); + } + + virtual void onDisplayError(int32_t error) { + JNIEnv* env = AndroidRuntime::getJNIEnv(); + + env->CallVoidMethod(mRemoteDisplayObjGlobal, + gRemoteDisplayClassInfo.notifyDisplayError, error); + checkAndClearExceptionFromCallback(env, "notifyDisplayError"); + } + +private: + jobject mRemoteDisplayObjGlobal; + + static void checkAndClearExceptionFromCallback(JNIEnv* env, const char* methodName) { + if (env->ExceptionCheck()) { + ALOGE("An exception was thrown by callback '%s'.", methodName); + LOGE_EX(env); + env->ExceptionClear(); + } + } +}; + +class NativeRemoteDisplay { +public: + NativeRemoteDisplay(const sp& display, + const sp& client) : + mDisplay(display), mClient(client) { + } + + ~NativeRemoteDisplay() { + mDisplay->dispose(); + } + +private: + sp mDisplay; + sp mClient; +}; + + +// ---------------------------------------------------------------------------- + +static jint nativeListen(JNIEnv* env, jobject remoteDisplayObj, jstring ifaceStr) { + ScopedUtfChars iface(env, ifaceStr); + + sp sm = defaultServiceManager(); + sp service = interface_cast( + sm->getService(String16("media.player"))); + if (service == NULL) { + ALOGE("Could not obtain IMediaPlayerService from service manager"); + return 0; + } + + sp client(new NativeRemoteDisplayClient(env, remoteDisplayObj)); + sp display = service->listenForRemoteDisplay( + client, String8(iface.c_str())); + if (display == NULL) { + ALOGE("Media player service rejected request to listen for remote display '%s'.", + iface.c_str()); + return 0; + } + + NativeRemoteDisplay* wrapper = new NativeRemoteDisplay(display, client); + return reinterpret_cast(wrapper); +} + +static void nativeDispose(JNIEnv* env, jobject remoteDisplayObj, jint ptr) { + NativeRemoteDisplay* wrapper = reinterpret_cast(ptr); + delete wrapper; +} + +// ---------------------------------------------------------------------------- + +static JNINativeMethod gMethods[] = { + {"nativeListen", "(Ljava/lang/String;)I", + (void*)nativeListen }, + {"nativeDispose", "(I)V", + (void*)nativeDispose }, +}; + +int register_android_media_RemoteDisplay(JNIEnv* env) +{ + int err = AndroidRuntime::registerNativeMethods(env, "android/media/RemoteDisplay", + gMethods, NELEM(gMethods)); + + jclass clazz = env->FindClass("android/media/RemoteDisplay"); + gRemoteDisplayClassInfo.notifyDisplayConnected = + env->GetMethodID(clazz, "notifyDisplayConnected", + "(Landroid/view/Surface;III)V"); + gRemoteDisplayClassInfo.notifyDisplayDisconnected = + env->GetMethodID(clazz, "notifyDisplayDisconnected", "()V"); + gRemoteDisplayClassInfo.notifyDisplayError = + env->GetMethodID(clazz, "notifyDisplayError", "(I)V"); + return err; +} + +}; diff --git a/core/jni/android_net_wifi_Wifi.cpp b/core/jni/android_net_wifi_Wifi.cpp index e7c4c23ec026b..d752dda049826 100644 --- a/core/jni/android_net_wifi_Wifi.cpp +++ b/core/jni/android_net_wifi_Wifi.cpp @@ -190,7 +190,10 @@ static jstring android_net_wifi_doStringCommand(JNIEnv* env, jobject, jstring jI return doStringCommand(env, ifname.c_str(), "%s", command.c_str()); } - +static jboolean android_net_wifi_setMode(JNIEnv* env, jobject, jint type) +{ + return (jboolean)(::wifi_set_mode(type) == 0); +} // ---------------------------------------------------------------------------- @@ -217,6 +220,7 @@ static JNINativeMethod gWifiMethods[] = { (void*) android_net_wifi_doIntCommand }, { "doStringCommand", "(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;", (void*) android_net_wifi_doStringCommand }, + { "setMode", "(I)Z", (void*) android_net_wifi_setMode}, }; int register_android_net_wifi_WifiManager(JNIEnv* env) diff --git a/core/jni/android_opengl_EGL14.cpp b/core/jni/android_opengl_EGL14.cpp new file mode 100644 index 0000000000000..b1664c6690ad7 --- /dev/null +++ b/core/jni/android_opengl_EGL14.cpp @@ -0,0 +1,1247 @@ +/* +** +** Copyright 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. +*/ + +// This source file is automatically generated + +#include "jni.h" +#include "JNIHelp.h" +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include + +static int initialized = 0; + +static jclass egldisplayClass; +static jclass eglcontextClass; +static jclass eglsurfaceClass; +static jclass eglconfigClass; + +static jmethodID egldisplayGetHandleID; +static jmethodID eglcontextGetHandleID; +static jmethodID eglsurfaceGetHandleID; +static jmethodID eglconfigGetHandleID; + +static jmethodID egldisplayConstructor; +static jmethodID eglcontextConstructor; +static jmethodID eglsurfaceConstructor; +static jmethodID eglconfigConstructor; + +static jobject eglNoContextObject; +static jobject eglNoDisplayObject; +static jobject eglNoSurfaceObject; + + + +/* Cache method IDs each time the class is loaded. */ + +static void +nativeClassInit(JNIEnv *_env, jclass glImplClass) +{ + jclass egldisplayClassLocal = _env->FindClass("android/opengl/EGLDisplay"); + egldisplayClass = (jclass) _env->NewGlobalRef(egldisplayClassLocal); + jclass eglcontextClassLocal = _env->FindClass("android/opengl/EGLContext"); + eglcontextClass = (jclass) _env->NewGlobalRef(eglcontextClassLocal); + jclass eglsurfaceClassLocal = _env->FindClass("android/opengl/EGLSurface"); + eglsurfaceClass = (jclass) _env->NewGlobalRef(eglsurfaceClassLocal); + jclass eglconfigClassLocal = _env->FindClass("android/opengl/EGLConfig"); + eglconfigClass = (jclass) _env->NewGlobalRef(eglconfigClassLocal); + + egldisplayGetHandleID = _env->GetMethodID(egldisplayClass, "getHandle", "()I"); + eglcontextGetHandleID = _env->GetMethodID(eglcontextClass, "getHandle", "()I"); + eglsurfaceGetHandleID = _env->GetMethodID(eglsurfaceClass, "getHandle", "()I"); + eglconfigGetHandleID = _env->GetMethodID(eglconfigClass, "getHandle", "()I"); + + + egldisplayConstructor = _env->GetMethodID(egldisplayClass, "", "(I)V"); + eglcontextConstructor = _env->GetMethodID(eglcontextClass, "", "(I)V"); + eglsurfaceConstructor = _env->GetMethodID(eglsurfaceClass, "", "(I)V"); + eglconfigConstructor = _env->GetMethodID(eglconfigClass, "", "(I)V"); + + jobject localeglNoContextObject = _env->NewObject(eglcontextClass, eglcontextConstructor, (jint)EGL_NO_CONTEXT); + eglNoContextObject = _env->NewGlobalRef(localeglNoContextObject); + jobject localeglNoDisplayObject = _env->NewObject(egldisplayClass, egldisplayConstructor, (jint)EGL_NO_DISPLAY); + eglNoDisplayObject = _env->NewGlobalRef(localeglNoDisplayObject); + jobject localeglNoSurfaceObject = _env->NewObject(eglsurfaceClass, eglsurfaceConstructor, (jint)EGL_NO_SURFACE); + eglNoSurfaceObject = _env->NewGlobalRef(localeglNoSurfaceObject); + + + jclass eglClass = _env->FindClass("android/opengl/EGL14"); + jfieldID noContextFieldID = _env->GetStaticFieldID(eglClass, "EGL_NO_CONTEXT", "Landroid/opengl/EGLContext;"); + _env->SetStaticObjectField(eglClass, noContextFieldID, eglNoContextObject); + + jfieldID noDisplayFieldID = _env->GetStaticFieldID(eglClass, "EGL_NO_DISPLAY", "Landroid/opengl/EGLDisplay;"); + _env->SetStaticObjectField(eglClass, noDisplayFieldID, eglNoDisplayObject); + + jfieldID noSurfaceFieldID = _env->GetStaticFieldID(eglClass, "EGL_NO_SURFACE", "Landroid/opengl/EGLSurface;"); + _env->SetStaticObjectField(eglClass, noSurfaceFieldID, eglNoSurfaceObject); +} + +static void * +fromEGLHandle(JNIEnv *_env, jmethodID mid, jobject obj) { + if (obj == NULL){ + jniThrowException(_env, "java/lang/IllegalArgumentException", + "Object is set to null."); + } + + return (void*) (_env->CallIntMethod(obj, mid)); +} + +static jobject +toEGLHandle(JNIEnv *_env, jclass cls, jmethodID con, void * handle) { + if (cls == eglcontextClass && + (EGLContext)handle == EGL_NO_CONTEXT) { + return eglNoContextObject; + } + + if (cls == egldisplayClass && + (EGLDisplay)handle == EGL_NO_DISPLAY) { + return eglNoDisplayObject; + } + + if (cls == eglsurfaceClass && + (EGLSurface)handle == EGL_NO_SURFACE) { + return eglNoSurfaceObject; + } + + return _env->NewObject(cls, con, (jint)handle); +} + +// -------------------------------------------------------------------------- +/* EGLint eglGetError ( void ) */ +static jint +android_eglGetError + (JNIEnv *_env, jobject _this) { + EGLint _returnValue = (EGLint) 0; + _returnValue = eglGetError(); + return _returnValue; +} + +/* EGLDisplay eglGetDisplay ( EGLNativeDisplayType display_id ) */ +static jobject +android_eglGetDisplay + (JNIEnv *_env, jobject _this, jint display_id) { + EGLDisplay _returnValue = (EGLDisplay) 0; + _returnValue = eglGetDisplay( + (EGLNativeDisplayType)display_id + ); + return toEGLHandle(_env, egldisplayClass, egldisplayConstructor, _returnValue); +} + +/* EGLBoolean eglInitialize ( EGLDisplay dpy, EGLint *major, EGLint *minor ) */ +static jboolean +android_eglInitialize + (JNIEnv *_env, jobject _this, jobject dpy, jintArray major_ref, jint majorOffset, jintArray minor_ref, jint minorOffset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; + EGLBoolean _returnValue = (EGLBoolean) 0; + EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy); + EGLint *major_base = (EGLint *) 0; + jint _majorRemaining; + EGLint *major = (EGLint *) 0; + EGLint *minor_base = (EGLint *) 0; + jint _minorRemaining; + EGLint *minor = (EGLint *) 0; + + if (!major_ref) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "major == null"; + goto exit; + } + if (majorOffset < 0) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "majorOffset < 0"; + goto exit; + } + _majorRemaining = _env->GetArrayLength(major_ref) - majorOffset; + if (_majorRemaining < 1) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - majorOffset < 1 < needed"; + goto exit; + } + major_base = (EGLint *) + _env->GetPrimitiveArrayCritical(major_ref, (jboolean *)0); + major = major_base + majorOffset; + + if (!minor_ref) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "minor == null"; + goto exit; + } + if (minorOffset < 0) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "minorOffset < 0"; + goto exit; + } + _minorRemaining = _env->GetArrayLength(minor_ref) - minorOffset; + if (_minorRemaining < 1) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - minorOffset < 1 < needed"; + goto exit; + } + minor_base = (EGLint *) + _env->GetPrimitiveArrayCritical(minor_ref, (jboolean *)0); + minor = minor_base + minorOffset; + + _returnValue = eglInitialize( + (EGLDisplay)dpy_native, + (EGLint *)major, + (EGLint *)minor + ); + +exit: + if (minor_base) { + _env->ReleasePrimitiveArrayCritical(minor_ref, minor_base, + _exception ? JNI_ABORT: 0); + } + if (major_base) { + _env->ReleasePrimitiveArrayCritical(major_ref, major_base, + _exception ? JNI_ABORT: 0); + } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } + return _returnValue; +} + +/* EGLBoolean eglTerminate ( EGLDisplay dpy ) */ +static jboolean +android_eglTerminate + (JNIEnv *_env, jobject _this, jobject dpy) { + EGLBoolean _returnValue = (EGLBoolean) 0; + EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy); + + _returnValue = eglTerminate( + (EGLDisplay)dpy_native + ); + return _returnValue; +} + +/* const char * eglQueryString ( EGLDisplay dpy, EGLint name ) */ +static jstring +android_eglQueryString__Landroind_opengl_EGLDisplay_2I + (JNIEnv *_env, jobject _this, jobject dpy, jint name) { + const char* chars = (const char*) eglQueryString( + (EGLDisplay)fromEGLHandle(_env, egldisplayGetHandleID, dpy), + (EGLint)name + ); + return _env->NewStringUTF(chars); +} +/* EGLBoolean eglGetConfigs ( EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config ) */ +static jboolean +android_eglGetConfigs + (JNIEnv *_env, jobject _this, jobject dpy, jobjectArray configs_ref, jint configsOffset, jint config_size, jintArray num_config_ref, jint num_configOffset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; + EGLBoolean _returnValue = (EGLBoolean) 0; + EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy); + jint _configsRemaining; + EGLConfig *configs = (EGLConfig *) 0; + EGLint *num_config_base = (EGLint *) 0; + jint _num_configRemaining; + EGLint *num_config = (EGLint *) 0; + + if (!configs_ref) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "configs == null"; + goto exit; + } + if (configsOffset < 0) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "configsOffset < 0"; + goto exit; + } + _configsRemaining = _env->GetArrayLength(configs_ref) - configsOffset; + if (_configsRemaining < config_size) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - configsOffset < config_size < needed"; + goto exit; + } + configs = new EGLConfig[_configsRemaining]; + + if (!num_config_ref) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "num_config == null"; + goto exit; + } + if (num_configOffset < 0) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "num_configOffset < 0"; + goto exit; + } + _num_configRemaining = _env->GetArrayLength(num_config_ref) - num_configOffset; + num_config_base = (EGLint *) + _env->GetPrimitiveArrayCritical(num_config_ref, (jboolean *)0); + num_config = num_config_base + num_configOffset; + + _returnValue = eglGetConfigs( + (EGLDisplay)dpy_native, + (EGLConfig *)configs, + (EGLint)config_size, + (EGLint *)num_config + ); + +exit: + if (num_config_base) { + _env->ReleasePrimitiveArrayCritical(num_config_ref, num_config_base, + _exception ? JNI_ABORT: 0); + } + if (configs) { + for (int i = 0; i < _configsRemaining; i++) { + jobject configs_new = toEGLHandle(_env, eglconfigClass, eglconfigConstructor, configs[i]); + _env->SetObjectArrayElement(configs_ref, i + configsOffset, configs_new); + } + delete[] configs; + } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } + return _returnValue; +} + +/* EGLBoolean eglChooseConfig ( EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config ) */ +static jboolean +android_eglChooseConfig + (JNIEnv *_env, jobject _this, jobject dpy, jintArray attrib_list_ref, jint attrib_listOffset, jobjectArray configs_ref, jint configsOffset, jint config_size, jintArray num_config_ref, jint num_configOffset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; + EGLBoolean _returnValue = (EGLBoolean) 0; + EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy); + bool attrib_list_sentinel = false; + EGLint *attrib_list_base = (EGLint *) 0; + jint _attrib_listRemaining; + EGLint *attrib_list = (EGLint *) 0; + jint _configsRemaining; + EGLConfig *configs = (EGLConfig *) 0; + EGLint *num_config_base = (EGLint *) 0; + jint _num_configRemaining; + EGLint *num_config = (EGLint *) 0; + + if (!attrib_list_ref) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "attrib_list == null"; + goto exit; + } + if (attrib_listOffset < 0) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "attrib_listOffset < 0"; + goto exit; + } + _attrib_listRemaining = _env->GetArrayLength(attrib_list_ref) - attrib_listOffset; + attrib_list_base = (EGLint *) + _env->GetPrimitiveArrayCritical(attrib_list_ref, (jboolean *)0); + attrib_list = attrib_list_base + attrib_listOffset; + attrib_list_sentinel = false; + for (int i = _attrib_listRemaining - 1; i >= 0; i--) { + if (attrib_list[i] == EGL_NONE){ + attrib_list_sentinel = true; + break; + } + } + if (attrib_list_sentinel == false) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "attrib_list must contain EGL_NONE!"; + goto exit; + } + + if (!configs_ref) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "configs == null"; + goto exit; + } + if (configsOffset < 0) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "configsOffset < 0"; + goto exit; + } + _configsRemaining = _env->GetArrayLength(configs_ref) - configsOffset; + if (_configsRemaining < config_size) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - configsOffset < config_size < needed"; + goto exit; + } + configs = new EGLConfig[_configsRemaining]; + + if (!num_config_ref) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "num_config == null"; + goto exit; + } + if (num_configOffset < 0) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "num_configOffset < 0"; + goto exit; + } + _num_configRemaining = _env->GetArrayLength(num_config_ref) - num_configOffset; + if (_num_configRemaining < 1) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - num_configOffset < 1 < needed"; + goto exit; + } + num_config_base = (EGLint *) + _env->GetPrimitiveArrayCritical(num_config_ref, (jboolean *)0); + num_config = num_config_base + num_configOffset; + + _returnValue = eglChooseConfig( + (EGLDisplay)dpy_native, + (EGLint *)attrib_list, + (EGLConfig *)configs, + (EGLint)config_size, + (EGLint *)num_config + ); + +exit: + if (num_config_base) { + _env->ReleasePrimitiveArrayCritical(num_config_ref, num_config_base, + _exception ? JNI_ABORT: 0); + } + if (attrib_list_base) { + _env->ReleasePrimitiveArrayCritical(attrib_list_ref, attrib_list_base, + JNI_ABORT); + } + if (configs) { + for (int i = 0; i < _configsRemaining; i++) { + jobject configs_new = toEGLHandle(_env, eglconfigClass, eglconfigConstructor, configs[i]); + _env->SetObjectArrayElement(configs_ref, i + configsOffset, configs_new); + } + delete[] configs; + } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } + return _returnValue; +} + +/* EGLBoolean eglGetConfigAttrib ( EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value ) */ +static jboolean +android_eglGetConfigAttrib + (JNIEnv *_env, jobject _this, jobject dpy, jobject config, jint attribute, jintArray value_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; + EGLBoolean _returnValue = (EGLBoolean) 0; + EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy); + EGLConfig config_native = (EGLConfig) fromEGLHandle(_env, eglconfigGetHandleID, config); + EGLint *value_base = (EGLint *) 0; + jint _remaining; + EGLint *value = (EGLint *) 0; + + if (!value_ref) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "value == null"; + goto exit; + } + if (offset < 0) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; + goto exit; + } + _remaining = _env->GetArrayLength(value_ref) - offset; + if (_remaining < 1) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < 1 < needed"; + goto exit; + } + value_base = (EGLint *) + _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0); + value = value_base + offset; + + _returnValue = eglGetConfigAttrib( + (EGLDisplay)dpy_native, + (EGLConfig)config_native, + (EGLint)attribute, + (EGLint *)value + ); + +exit: + if (value_base) { + _env->ReleasePrimitiveArrayCritical(value_ref, value_base, + _exception ? JNI_ABORT: 0); + } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } + return _returnValue; +} + +/* EGLSurface eglCreateWindowSurface ( EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list ) */ +static jobject +android_eglCreateWindowSurface + (JNIEnv *_env, jobject _this, jobject dpy, jobject config, jobject win, jintArray attrib_list_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType = ""; + const char * _exceptionMessage = ""; + EGLSurface _returnValue = (EGLSurface) 0; + EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy); + EGLConfig config_native = (EGLConfig) fromEGLHandle(_env, eglconfigGetHandleID, config); + int attrib_list_sentinel = 0; + EGLint *attrib_list_base = (EGLint *) 0; + jint _remaining; + EGLint *attrib_list = (EGLint *) 0; + android::sp window; + + if (!attrib_list_ref) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "attrib_list == null"; + goto exit; + } + if (offset < 0) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; + goto exit; + } + if (win == NULL) { +not_valid_surface: + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "Make sure the SurfaceView or associated SurfaceHolder has a valid Surface"; + goto exit; + } + + window = android::android_view_Surface_getNativeWindow(_env, win); + + if (window == NULL) + goto not_valid_surface; + + _remaining = _env->GetArrayLength(attrib_list_ref) - offset; + attrib_list_base = (EGLint *) + _env->GetPrimitiveArrayCritical(attrib_list_ref, (jboolean *)0); + attrib_list = attrib_list_base + offset; + attrib_list_sentinel = 0; + for (int i = _remaining - 1; i >= 0; i--) { + if (*((EGLint*)(attrib_list + i)) == EGL_NONE){ + attrib_list_sentinel = 1; + break; + } + } + if (attrib_list_sentinel == 0) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "attrib_list must contain EGL_NONE!"; + goto exit; + } + + _returnValue = eglCreateWindowSurface( + (EGLDisplay)dpy_native, + (EGLConfig)config_native, + (EGLNativeWindowType)window.get(), + (EGLint *)attrib_list + ); + +exit: + if (attrib_list_base) { + _env->ReleasePrimitiveArrayCritical(attrib_list_ref, attrib_list_base, + JNI_ABORT); + } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } + return toEGLHandle(_env, eglsurfaceClass, eglsurfaceConstructor, _returnValue); +} + +/* EGLSurface eglCreateWindowSurface ( EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list ) */ +static jobject +android_eglCreateWindowSurfaceTexture + (JNIEnv *_env, jobject _this, jobject dpy, jobject config, jobject win, jintArray attrib_list_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType = ""; + const char * _exceptionMessage = ""; + EGLSurface _returnValue = (EGLSurface) 0; + EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy); + EGLConfig config_native = (EGLConfig) fromEGLHandle(_env, eglconfigGetHandleID, config); + int attrib_list_sentinel = 0; + EGLint *attrib_list_base = (EGLint *) 0; + jint _remaining; + EGLint *attrib_list = (EGLint *) 0; + android::sp window; + android::sp surfaceTexture; + + if (!attrib_list_ref) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "attrib_list == null"; + goto exit; + } + if (offset < 0) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; + goto exit; + } + if (win == NULL) { +not_valid_surface: + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "Make sure the SurfaceView or associated SurfaceHolder has a valid Surface"; + goto exit; + } + surfaceTexture = android::SurfaceTexture_getSurfaceTexture(_env, win); + window = new android::SurfaceTextureClient(surfaceTexture); + + if (window == NULL) + goto not_valid_surface; + + _remaining = _env->GetArrayLength(attrib_list_ref) - offset; + attrib_list_base = (EGLint *) + _env->GetPrimitiveArrayCritical(attrib_list_ref, (jboolean *)0); + attrib_list = attrib_list_base + offset; + attrib_list_sentinel = 0; + for (int i = _remaining - 1; i >= 0; i--) { + if (*((EGLint*)(attrib_list + i)) == EGL_NONE){ + attrib_list_sentinel = 1; + break; + } + } + if (attrib_list_sentinel == 0) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "attrib_list must contain EGL_NONE!"; + goto exit; + } + + _returnValue = eglCreateWindowSurface( + (EGLDisplay)dpy_native, + (EGLConfig)config_native, + (EGLNativeWindowType)window.get(), + (EGLint *)attrib_list + ); + +exit: + if (attrib_list_base) { + _env->ReleasePrimitiveArrayCritical(attrib_list_ref, attrib_list_base, + JNI_ABORT); + } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } + return toEGLHandle(_env, eglsurfaceClass, eglsurfaceConstructor, _returnValue); +} +/* EGLSurface eglCreatePbufferSurface ( EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list ) */ +static jobject +android_eglCreatePbufferSurface + (JNIEnv *_env, jobject _this, jobject dpy, jobject config, jintArray attrib_list_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; + EGLSurface _returnValue = (EGLSurface) 0; + EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy); + EGLConfig config_native = (EGLConfig) fromEGLHandle(_env, eglconfigGetHandleID, config); + bool attrib_list_sentinel = false; + EGLint *attrib_list_base = (EGLint *) 0; + jint _remaining; + EGLint *attrib_list = (EGLint *) 0; + + if (!attrib_list_ref) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "attrib_list == null"; + goto exit; + } + if (offset < 0) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; + goto exit; + } + _remaining = _env->GetArrayLength(attrib_list_ref) - offset; + attrib_list_base = (EGLint *) + _env->GetPrimitiveArrayCritical(attrib_list_ref, (jboolean *)0); + attrib_list = attrib_list_base + offset; + attrib_list_sentinel = false; + for (int i = _remaining - 1; i >= 0; i--) { + if (attrib_list[i] == EGL_NONE){ + attrib_list_sentinel = true; + break; + } + } + if (attrib_list_sentinel == false) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "attrib_list must contain EGL_NONE!"; + goto exit; + } + + _returnValue = eglCreatePbufferSurface( + (EGLDisplay)dpy_native, + (EGLConfig)config_native, + (EGLint *)attrib_list + ); + +exit: + if (attrib_list_base) { + _env->ReleasePrimitiveArrayCritical(attrib_list_ref, attrib_list_base, + JNI_ABORT); + } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } + return toEGLHandle(_env, eglsurfaceClass, eglsurfaceConstructor, _returnValue); +} + +/* EGLSurface eglCreatePixmapSurface ( EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list ) */ +static jobject +android_eglCreatePixmapSurface + (JNIEnv *_env, jobject _this, jobject dpy, jobject config, jint pixmap, jintArray attrib_list_ref, jint offset) { + jniThrowException(_env, "java/lang/UnsupportedOperationException", + "eglCreatePixmapSurface"); + return toEGLHandle(_env, eglsurfaceClass, eglsurfaceConstructor, (EGLSurface) 0); +} + +/* EGLBoolean eglDestroySurface ( EGLDisplay dpy, EGLSurface surface ) */ +static jboolean +android_eglDestroySurface + (JNIEnv *_env, jobject _this, jobject dpy, jobject surface) { + EGLBoolean _returnValue = (EGLBoolean) 0; + EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy); + EGLSurface surface_native = (EGLSurface) fromEGLHandle(_env, eglsurfaceGetHandleID, surface); + + _returnValue = eglDestroySurface( + (EGLDisplay)dpy_native, + (EGLSurface)surface_native + ); + return _returnValue; +} + +/* EGLBoolean eglQuerySurface ( EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value ) */ +static jboolean +android_eglQuerySurface + (JNIEnv *_env, jobject _this, jobject dpy, jobject surface, jint attribute, jintArray value_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; + EGLBoolean _returnValue = (EGLBoolean) 0; + EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy); + EGLSurface surface_native = (EGLSurface) fromEGLHandle(_env, eglsurfaceGetHandleID, surface); + EGLint *value_base = (EGLint *) 0; + jint _remaining; + EGLint *value = (EGLint *) 0; + + if (!value_ref) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "value == null"; + goto exit; + } + if (offset < 0) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; + goto exit; + } + _remaining = _env->GetArrayLength(value_ref) - offset; + if (_remaining < 1) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < 1 < needed"; + goto exit; + } + value_base = (EGLint *) + _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0); + value = value_base + offset; + + _returnValue = eglQuerySurface( + (EGLDisplay)dpy_native, + (EGLSurface)surface_native, + (EGLint)attribute, + (EGLint *)value + ); + +exit: + if (value_base) { + _env->ReleasePrimitiveArrayCritical(value_ref, value_base, + _exception ? JNI_ABORT: 0); + } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } + return _returnValue; +} + +/* EGLBoolean eglBindAPI ( EGLenum api ) */ +static jboolean +android_eglBindAPI + (JNIEnv *_env, jobject _this, jint api) { + EGLBoolean _returnValue = (EGLBoolean) 0; + _returnValue = eglBindAPI( + (EGLenum)api + ); + return _returnValue; +} + +/* EGLenum eglQueryAPI ( void ) */ +static jint +android_eglQueryAPI + (JNIEnv *_env, jobject _this) { + EGLenum _returnValue = (EGLenum) 0; + _returnValue = eglQueryAPI(); + return _returnValue; +} + +/* EGLBoolean eglWaitClient ( void ) */ +static jboolean +android_eglWaitClient + (JNIEnv *_env, jobject _this) { + EGLBoolean _returnValue = (EGLBoolean) 0; + _returnValue = eglWaitClient(); + return _returnValue; +} + +/* EGLBoolean eglReleaseThread ( void ) */ +static jboolean +android_eglReleaseThread + (JNIEnv *_env, jobject _this) { + EGLBoolean _returnValue = (EGLBoolean) 0; + _returnValue = eglReleaseThread(); + return _returnValue; +} + +/* EGLSurface eglCreatePbufferFromClientBuffer ( EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list ) */ +static jobject +android_eglCreatePbufferFromClientBuffer + (JNIEnv *_env, jobject _this, jobject dpy, jint buftype, jint buffer, jobject config, jintArray attrib_list_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; + EGLSurface _returnValue = (EGLSurface) 0; + EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy); + EGLConfig config_native = (EGLConfig) fromEGLHandle(_env, eglconfigGetHandleID, config); + bool attrib_list_sentinel = false; + EGLint *attrib_list_base = (EGLint *) 0; + jint _remaining; + EGLint *attrib_list = (EGLint *) 0; + + if (!attrib_list_ref) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "attrib_list == null"; + goto exit; + } + if (offset < 0) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; + goto exit; + } + _remaining = _env->GetArrayLength(attrib_list_ref) - offset; + attrib_list_base = (EGLint *) + _env->GetPrimitiveArrayCritical(attrib_list_ref, (jboolean *)0); + attrib_list = attrib_list_base + offset; + attrib_list_sentinel = false; + for (int i = _remaining - 1; i >= 0; i--) { + if (attrib_list[i] == EGL_NONE){ + attrib_list_sentinel = true; + break; + } + } + if (attrib_list_sentinel == false) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "attrib_list must contain EGL_NONE!"; + goto exit; + } + + _returnValue = eglCreatePbufferFromClientBuffer( + (EGLDisplay)dpy_native, + (EGLenum)buftype, + (EGLClientBuffer)buffer, + (EGLConfig)config_native, + (EGLint *)attrib_list + ); + +exit: + if (attrib_list_base) { + _env->ReleasePrimitiveArrayCritical(attrib_list_ref, attrib_list_base, + JNI_ABORT); + } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } + return toEGLHandle(_env, eglsurfaceClass, eglsurfaceConstructor, _returnValue); +} + +/* EGLBoolean eglSurfaceAttrib ( EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value ) */ +static jboolean +android_eglSurfaceAttrib + (JNIEnv *_env, jobject _this, jobject dpy, jobject surface, jint attribute, jint value) { + EGLBoolean _returnValue = (EGLBoolean) 0; + EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy); + EGLSurface surface_native = (EGLSurface) fromEGLHandle(_env, eglsurfaceGetHandleID, surface); + + _returnValue = eglSurfaceAttrib( + (EGLDisplay)dpy_native, + (EGLSurface)surface_native, + (EGLint)attribute, + (EGLint)value + ); + return _returnValue; +} + +/* EGLBoolean eglBindTexImage ( EGLDisplay dpy, EGLSurface surface, EGLint buffer ) */ +static jboolean +android_eglBindTexImage + (JNIEnv *_env, jobject _this, jobject dpy, jobject surface, jint buffer) { + EGLBoolean _returnValue = (EGLBoolean) 0; + EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy); + EGLSurface surface_native = (EGLSurface) fromEGLHandle(_env, eglsurfaceGetHandleID, surface); + + _returnValue = eglBindTexImage( + (EGLDisplay)dpy_native, + (EGLSurface)surface_native, + (EGLint)buffer + ); + return _returnValue; +} + +/* EGLBoolean eglReleaseTexImage ( EGLDisplay dpy, EGLSurface surface, EGLint buffer ) */ +static jboolean +android_eglReleaseTexImage + (JNIEnv *_env, jobject _this, jobject dpy, jobject surface, jint buffer) { + EGLBoolean _returnValue = (EGLBoolean) 0; + EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy); + EGLSurface surface_native = (EGLSurface) fromEGLHandle(_env, eglsurfaceGetHandleID, surface); + + _returnValue = eglReleaseTexImage( + (EGLDisplay)dpy_native, + (EGLSurface)surface_native, + (EGLint)buffer + ); + return _returnValue; +} + +/* EGLBoolean eglSwapInterval ( EGLDisplay dpy, EGLint interval ) */ +static jboolean +android_eglSwapInterval + (JNIEnv *_env, jobject _this, jobject dpy, jint interval) { + EGLBoolean _returnValue = (EGLBoolean) 0; + EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy); + + _returnValue = eglSwapInterval( + (EGLDisplay)dpy_native, + (EGLint)interval + ); + return _returnValue; +} + +/* EGLContext eglCreateContext ( EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list ) */ +static jobject +android_eglCreateContext + (JNIEnv *_env, jobject _this, jobject dpy, jobject config, jobject share_context, jintArray attrib_list_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; + EGLContext _returnValue = (EGLContext) 0; + EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy); + EGLConfig config_native = (EGLConfig) fromEGLHandle(_env, eglconfigGetHandleID, config); + EGLContext share_context_native = (EGLContext) fromEGLHandle(_env, eglcontextGetHandleID, share_context); + bool attrib_list_sentinel = false; + EGLint *attrib_list_base = (EGLint *) 0; + jint _remaining; + EGLint *attrib_list = (EGLint *) 0; + + if (!attrib_list_ref) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "attrib_list == null"; + goto exit; + } + if (offset < 0) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; + goto exit; + } + _remaining = _env->GetArrayLength(attrib_list_ref) - offset; + attrib_list_base = (EGLint *) + _env->GetPrimitiveArrayCritical(attrib_list_ref, (jboolean *)0); + attrib_list = attrib_list_base + offset; + attrib_list_sentinel = false; + for (int i = _remaining - 1; i >= 0; i--) { + if (attrib_list[i] == EGL_NONE){ + attrib_list_sentinel = true; + break; + } + } + if (attrib_list_sentinel == false) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "attrib_list must contain EGL_NONE!"; + goto exit; + } + + _returnValue = eglCreateContext( + (EGLDisplay)dpy_native, + (EGLConfig)config_native, + (EGLContext)share_context_native, + (EGLint *)attrib_list + ); + +exit: + if (attrib_list_base) { + _env->ReleasePrimitiveArrayCritical(attrib_list_ref, attrib_list_base, + JNI_ABORT); + } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } + return toEGLHandle(_env, eglcontextClass, eglcontextConstructor, _returnValue); +} + +/* EGLBoolean eglDestroyContext ( EGLDisplay dpy, EGLContext ctx ) */ +static jboolean +android_eglDestroyContext + (JNIEnv *_env, jobject _this, jobject dpy, jobject ctx) { + EGLBoolean _returnValue = (EGLBoolean) 0; + EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy); + EGLContext ctx_native = (EGLContext) fromEGLHandle(_env, eglcontextGetHandleID, ctx); + + _returnValue = eglDestroyContext( + (EGLDisplay)dpy_native, + (EGLContext)ctx_native + ); + return _returnValue; +} + +/* EGLBoolean eglMakeCurrent ( EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx ) */ +static jboolean +android_eglMakeCurrent + (JNIEnv *_env, jobject _this, jobject dpy, jobject draw, jobject read, jobject ctx) { + EGLBoolean _returnValue = (EGLBoolean) 0; + EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy); + EGLSurface draw_native = (EGLSurface) fromEGLHandle(_env, eglsurfaceGetHandleID, draw); + EGLSurface read_native = (EGLSurface) fromEGLHandle(_env, eglsurfaceGetHandleID, read); + EGLContext ctx_native = (EGLContext) fromEGLHandle(_env, eglcontextGetHandleID, ctx); + + _returnValue = eglMakeCurrent( + (EGLDisplay)dpy_native, + (EGLSurface)draw_native, + (EGLSurface)read_native, + (EGLContext)ctx_native + ); + return _returnValue; +} + +/* EGLContext eglGetCurrentContext ( void ) */ +static jobject +android_eglGetCurrentContext + (JNIEnv *_env, jobject _this) { + EGLContext _returnValue = (EGLContext) 0; + _returnValue = eglGetCurrentContext(); + return toEGLHandle(_env, eglcontextClass, eglcontextConstructor, _returnValue); +} + +/* EGLSurface eglGetCurrentSurface ( EGLint readdraw ) */ +static jobject +android_eglGetCurrentSurface + (JNIEnv *_env, jobject _this, jint readdraw) { + EGLSurface _returnValue = (EGLSurface) 0; + _returnValue = eglGetCurrentSurface( + (EGLint)readdraw + ); + return toEGLHandle(_env, eglsurfaceClass, eglsurfaceConstructor, _returnValue); +} + +/* EGLDisplay eglGetCurrentDisplay ( void ) */ +static jobject +android_eglGetCurrentDisplay + (JNIEnv *_env, jobject _this) { + EGLDisplay _returnValue = (EGLDisplay) 0; + _returnValue = eglGetCurrentDisplay(); + return toEGLHandle(_env, egldisplayClass, egldisplayConstructor, _returnValue); +} + +/* EGLBoolean eglQueryContext ( EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value ) */ +static jboolean +android_eglQueryContext + (JNIEnv *_env, jobject _this, jobject dpy, jobject ctx, jint attribute, jintArray value_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; + EGLBoolean _returnValue = (EGLBoolean) 0; + EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy); + EGLContext ctx_native = (EGLContext) fromEGLHandle(_env, eglcontextGetHandleID, ctx); + EGLint *value_base = (EGLint *) 0; + jint _remaining; + EGLint *value = (EGLint *) 0; + + if (!value_ref) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "value == null"; + goto exit; + } + if (offset < 0) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; + goto exit; + } + _remaining = _env->GetArrayLength(value_ref) - offset; + if (_remaining < 1) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < 1 < needed"; + goto exit; + } + value_base = (EGLint *) + _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0); + value = value_base + offset; + + _returnValue = eglQueryContext( + (EGLDisplay)dpy_native, + (EGLContext)ctx_native, + (EGLint)attribute, + (EGLint *)value + ); + +exit: + if (value_base) { + _env->ReleasePrimitiveArrayCritical(value_ref, value_base, + _exception ? JNI_ABORT: 0); + } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } + return _returnValue; +} + +/* EGLBoolean eglWaitGL ( void ) */ +static jboolean +android_eglWaitGL + (JNIEnv *_env, jobject _this) { + EGLBoolean _returnValue = (EGLBoolean) 0; + _returnValue = eglWaitGL(); + return _returnValue; +} + +/* EGLBoolean eglWaitNative ( EGLint engine ) */ +static jboolean +android_eglWaitNative + (JNIEnv *_env, jobject _this, jint engine) { + EGLBoolean _returnValue = (EGLBoolean) 0; + _returnValue = eglWaitNative( + (EGLint)engine + ); + return _returnValue; +} + +/* EGLBoolean eglSwapBuffers ( EGLDisplay dpy, EGLSurface surface ) */ +static jboolean +android_eglSwapBuffers + (JNIEnv *_env, jobject _this, jobject dpy, jobject surface) { + EGLBoolean _returnValue = (EGLBoolean) 0; + EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy); + EGLSurface surface_native = (EGLSurface) fromEGLHandle(_env, eglsurfaceGetHandleID, surface); + + _returnValue = eglSwapBuffers( + (EGLDisplay)dpy_native, + (EGLSurface)surface_native + ); + return _returnValue; +} + +/* EGLBoolean eglCopyBuffers ( EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target ) */ +static jboolean +android_eglCopyBuffers + (JNIEnv *_env, jobject _this, jobject dpy, jobject surface, jint target) { + jniThrowException(_env, "java/lang/UnsupportedOperationException", + "eglCopyBuffers"); + return (EGLBoolean) 0; +} + +static const char *classPathName = "android/opengl/EGL14"; + +static JNINativeMethod methods[] = { +{"_nativeClassInit", "()V", (void*)nativeClassInit }, +{"eglGetError", "()I", (void *) android_eglGetError }, +{"eglGetDisplay", "(I)Landroid/opengl/EGLDisplay;", (void *) android_eglGetDisplay }, +{"eglInitialize", "(Landroid/opengl/EGLDisplay;[II[II)Z", (void *) android_eglInitialize }, +{"eglTerminate", "(Landroid/opengl/EGLDisplay;)Z", (void *) android_eglTerminate }, +{"eglQueryString", "(Landroid/opengl/EGLDisplay;I)Ljava/lang/String;", (void *) android_eglQueryString__Landroind_opengl_EGLDisplay_2I }, +{"eglGetConfigs", "(Landroid/opengl/EGLDisplay;[Landroid/opengl/EGLConfig;II[II)Z", (void *) android_eglGetConfigs }, +{"eglChooseConfig", "(Landroid/opengl/EGLDisplay;[II[Landroid/opengl/EGLConfig;II[II)Z", (void *) android_eglChooseConfig }, +{"eglGetConfigAttrib", "(Landroid/opengl/EGLDisplay;Landroid/opengl/EGLConfig;I[II)Z", (void *) android_eglGetConfigAttrib }, +{"_eglCreateWindowSurface", "(Landroid/opengl/EGLDisplay;Landroid/opengl/EGLConfig;Ljava/lang/Object;[II)Landroid/opengl/EGLSurface;", (void *) android_eglCreateWindowSurface }, +{"_eglCreateWindowSurfaceTexture", "(Landroid/opengl/EGLDisplay;Landroid/opengl/EGLConfig;Ljava/lang/Object;[II)Landroid/opengl/EGLSurface;", (void *) android_eglCreateWindowSurfaceTexture }, +{"eglCreatePbufferSurface", "(Landroid/opengl/EGLDisplay;Landroid/opengl/EGLConfig;[II)Landroid/opengl/EGLSurface;", (void *) android_eglCreatePbufferSurface }, +{"eglCreatePixmapSurface", "(Landroid/opengl/EGLDisplay;Landroid/opengl/EGLConfig;I[II)Landroid/opengl/EGLSurface;", (void *) android_eglCreatePixmapSurface }, +{"eglDestroySurface", "(Landroid/opengl/EGLDisplay;Landroid/opengl/EGLSurface;)Z", (void *) android_eglDestroySurface }, +{"eglQuerySurface", "(Landroid/opengl/EGLDisplay;Landroid/opengl/EGLSurface;I[II)Z", (void *) android_eglQuerySurface }, +{"eglBindAPI", "(I)Z", (void *) android_eglBindAPI }, +{"eglQueryAPI", "()I", (void *) android_eglQueryAPI }, +{"eglWaitClient", "()Z", (void *) android_eglWaitClient }, +{"eglReleaseThread", "()Z", (void *) android_eglReleaseThread }, +{"eglCreatePbufferFromClientBuffer", "(Landroid/opengl/EGLDisplay;IILandroid/opengl/EGLConfig;[II)Landroid/opengl/EGLSurface;", (void *) android_eglCreatePbufferFromClientBuffer }, +{"eglSurfaceAttrib", "(Landroid/opengl/EGLDisplay;Landroid/opengl/EGLSurface;II)Z", (void *) android_eglSurfaceAttrib }, +{"eglBindTexImage", "(Landroid/opengl/EGLDisplay;Landroid/opengl/EGLSurface;I)Z", (void *) android_eglBindTexImage }, +{"eglReleaseTexImage", "(Landroid/opengl/EGLDisplay;Landroid/opengl/EGLSurface;I)Z", (void *) android_eglReleaseTexImage }, +{"eglSwapInterval", "(Landroid/opengl/EGLDisplay;I)Z", (void *) android_eglSwapInterval }, +{"eglCreateContext", "(Landroid/opengl/EGLDisplay;Landroid/opengl/EGLConfig;Landroid/opengl/EGLContext;[II)Landroid/opengl/EGLContext;", (void *) android_eglCreateContext }, +{"eglDestroyContext", "(Landroid/opengl/EGLDisplay;Landroid/opengl/EGLContext;)Z", (void *) android_eglDestroyContext }, +{"eglMakeCurrent", "(Landroid/opengl/EGLDisplay;Landroid/opengl/EGLSurface;Landroid/opengl/EGLSurface;Landroid/opengl/EGLContext;)Z", (void *) android_eglMakeCurrent }, +{"eglGetCurrentContext", "()Landroid/opengl/EGLContext;", (void *) android_eglGetCurrentContext }, +{"eglGetCurrentSurface", "(I)Landroid/opengl/EGLSurface;", (void *) android_eglGetCurrentSurface }, +{"eglGetCurrentDisplay", "()Landroid/opengl/EGLDisplay;", (void *) android_eglGetCurrentDisplay }, +{"eglQueryContext", "(Landroid/opengl/EGLDisplay;Landroid/opengl/EGLContext;I[II)Z", (void *) android_eglQueryContext }, +{"eglWaitGL", "()Z", (void *) android_eglWaitGL }, +{"eglWaitNative", "(I)Z", (void *) android_eglWaitNative }, +{"eglSwapBuffers", "(Landroid/opengl/EGLDisplay;Landroid/opengl/EGLSurface;)Z", (void *) android_eglSwapBuffers }, +{"eglCopyBuffers", "(Landroid/opengl/EGLDisplay;Landroid/opengl/EGLSurface;I)Z", (void *) android_eglCopyBuffers }, +}; + +int register_android_opengl_jni_EGL14(JNIEnv *_env) +{ + int err; + err = android::AndroidRuntime::registerNativeMethods(_env, classPathName, methods, NELEM(methods)); + return err; +} diff --git a/core/jni/android_opengl_GLES10.cpp b/core/jni/android_opengl_GLES10.cpp index 6c29d6c3df465..571f5790bd1ee 100644 --- a/core/jni/android_opengl_GLES10.cpp +++ b/core/jni/android_opengl_GLES10.cpp @@ -75,14 +75,12 @@ nativeClassInit(JNIEnv *_env, jclass glImplClass) } static void * -getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining) +getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining, jint *offset) { jint position; jint limit; jint elementSizeShift; jlong pointer; - jint offset; - void *data; position = _env->GetIntField(buffer, positionID); limit = _env->GetIntField(buffer, limitID); @@ -97,11 +95,10 @@ getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining) *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass, getBaseArrayID, buffer); - offset = _env->CallStaticIntMethod(nioAccessClass, + *offset = _env->CallStaticIntMethod(nioAccessClass, getBaseArrayOffsetID, buffer); - data = _env->GetPrimitiveArrayCritical(*array, (jboolean *) 0); - return (void *) ((char *) data + offset); + return NULL; } static void @@ -292,6 +289,7 @@ static void android_glColorPointerBounds__IIILjava_nio_Buffer_2I (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jobject pointer_buf, jint remaining) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLvoid *pointer = (GLvoid *) 0; @@ -315,10 +313,15 @@ static void android_glCompressedTexImage2D__IIIIIIILjava_nio_Buffer_2 (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint width, jint height, jint border, jint imageSize, jobject data_buf) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLvoid *data = (GLvoid *) 0; - data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining); + data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining, &_bufferOffset); + if (data == NULL) { + char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + data = (GLvoid *) (_dataBase + _bufferOffset); + } glCompressedTexImage2D( (GLenum)target, (GLint)level, @@ -339,10 +342,15 @@ static void android_glCompressedTexSubImage2D__IIIIIIIILjava_nio_Buffer_2 (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint width, jint height, jint format, jint imageSize, jobject data_buf) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLvoid *data = (GLvoid *) 0; - data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining); + data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining, &_bufferOffset); + if (data == NULL) { + char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + data = (GLvoid *) (_dataBase + _bufferOffset); + } glCompressedTexSubImage2D( (GLenum)target, (GLint)level, @@ -404,21 +412,30 @@ android_glCullFace__I static void android_glDeleteTextures__I_3II (JNIEnv *_env, jobject _this, jint n, jintArray textures_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLuint *textures_base = (GLuint *) 0; jint _remaining; GLuint *textures = (GLuint *) 0; if (!textures_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "textures == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "textures == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(textures_ref) - offset; if (_remaining < n) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < n"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < n < needed"; goto exit; } textures_base = (GLuint *) @@ -435,21 +452,34 @@ android_glDeleteTextures__I_3II _env->ReleasePrimitiveArrayCritical(textures_ref, textures_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glDeleteTextures ( GLsizei n, const GLuint *textures ) */ static void android_glDeleteTextures__ILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint n, jobject textures_buf) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLuint *textures = (GLuint *) 0; - textures = (GLuint *)getPointer(_env, textures_buf, &_array, &_remaining); + textures = (GLuint *)getPointer(_env, textures_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < n) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < n"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < n < needed"; goto exit; } + if (textures == NULL) { + char * _texturesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + textures = (GLuint *) (_texturesBase + _bufferOffset); + } glDeleteTextures( (GLsizei)n, (GLuint *)textures @@ -459,6 +489,9 @@ android_glDeleteTextures__ILjava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, textures, JNI_FALSE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glDepthFunc ( GLenum func ) */ @@ -532,15 +565,25 @@ android_glDrawArrays__III static void android_glDrawElements__IIILjava_nio_Buffer_2 (JNIEnv *_env, jobject _this, jint mode, jint count, jint type, jobject indices_buf) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLvoid *indices = (GLvoid *) 0; - indices = (GLvoid *)getPointer(_env, indices_buf, &_array, &_remaining); + indices = (GLvoid *)getPointer(_env, indices_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < count) { - jniThrowException(_env, "java/lang/ArrayIndexOutOfBoundsException", "remaining() < count"); + _exception = 1; + _exceptionType = "java/lang/ArrayIndexOutOfBoundsException"; + _exceptionMessage = "remaining() < count < needed"; goto exit; } + if (indices == NULL) { + char * _indicesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + indices = (GLvoid *) (_indicesBase + _bufferOffset); + } glDrawElements( (GLenum)mode, (GLsizei)count, @@ -552,6 +595,9 @@ android_glDrawElements__IIILjava_nio_Buffer_2 if (_array) { releasePointer(_env, _array, indices, JNI_FALSE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glEnable ( GLenum cap ) */ @@ -600,16 +646,23 @@ android_glFogf__IF static void android_glFogfv__I_3FI (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfloat *params_base = (GLfloat *) 0; jint _remaining; GLfloat *params = (GLfloat *) 0; if (!params_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -639,7 +692,9 @@ android_glFogfv__I_3FI break; } if (_remaining < _needed) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < needed"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < needed"; goto exit; } params_base = (GLfloat *) @@ -656,17 +711,24 @@ android_glFogfv__I_3FI _env->ReleasePrimitiveArrayCritical(params_ref, params_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glFogfv ( GLenum pname, const GLfloat *params ) */ static void android_glFogfv__ILjava_nio_FloatBuffer_2 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfloat *params = (GLfloat *) 0; - params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); int _needed; switch (pname) { #if defined(GL_FOG_MODE) @@ -693,9 +755,15 @@ android_glFogfv__ILjava_nio_FloatBuffer_2 break; } if (_remaining < _needed) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < needed"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < needed"; goto exit; } + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfloat *) (_paramsBase + _bufferOffset); + } glFogfv( (GLenum)pname, (GLfloat *)params @@ -705,6 +773,9 @@ android_glFogfv__ILjava_nio_FloatBuffer_2 if (_array) { releasePointer(_env, _array, params, JNI_FALSE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glFogx ( GLenum pname, GLfixed param ) */ @@ -721,16 +792,23 @@ android_glFogx__II static void android_glFogxv__I_3II (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfixed *params_base = (GLfixed *) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; if (!params_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -760,7 +838,9 @@ android_glFogxv__I_3II break; } if (_remaining < _needed) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < needed"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < needed"; goto exit; } params_base = (GLfixed *) @@ -777,17 +857,24 @@ android_glFogxv__I_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glFogxv ( GLenum pname, const GLfixed *params ) */ static void android_glFogxv__ILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; - params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); int _needed; switch (pname) { #if defined(GL_FOG_MODE) @@ -814,9 +901,15 @@ android_glFogxv__ILjava_nio_IntBuffer_2 break; } if (_remaining < _needed) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < needed"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < needed"; goto exit; } + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfixed *) (_paramsBase + _bufferOffset); + } glFogxv( (GLenum)pname, (GLfixed *)params @@ -826,6 +919,9 @@ android_glFogxv__ILjava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, params, JNI_FALSE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glFrontFace ( GLenum mode ) */ @@ -870,24 +966,29 @@ static void android_glGenTextures__I_3II (JNIEnv *_env, jobject _this, jint n, jintArray textures_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLuint *textures_base = (GLuint *) 0; jint _remaining; GLuint *textures = (GLuint *) 0; if (!textures_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "textures == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "textures == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(textures_ref) - offset; if (_remaining < n) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < n"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < n < needed"; goto exit; } textures_base = (GLuint *) @@ -904,6 +1005,9 @@ android_glGenTextures__I_3II _env->ReleasePrimitiveArrayCritical(textures_ref, textures_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGenTextures ( GLsizei n, GLuint *textures ) */ @@ -911,16 +1015,24 @@ static void android_glGenTextures__ILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint n, jobject textures_buf) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLuint *textures = (GLuint *) 0; - textures = (GLuint *)getPointer(_env, textures_buf, &_array, &_remaining); + textures = (GLuint *)getPointer(_env, textures_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < n) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < n"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < n < needed"; goto exit; } + if (textures == NULL) { + char * _texturesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + textures = (GLuint *) (_texturesBase + _bufferOffset); + } glGenTextures( (GLsizei)n, (GLuint *)textures @@ -930,6 +1042,9 @@ android_glGenTextures__ILjava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, textures, _exception ? JNI_FALSE : JNI_TRUE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* GLenum glGetError ( void ) */ @@ -946,18 +1061,22 @@ static void android_glGetIntegerv__I_3II (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLint *params_base = (GLint *) 0; jint _remaining; GLint *params = (GLint *) 0; if (!params_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -1294,7 +1413,8 @@ android_glGetIntegerv__I_3II } if (_remaining < _needed) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < needed"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < needed"; goto exit; } params_base = (GLint *) @@ -1311,6 +1431,9 @@ android_glGetIntegerv__I_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetIntegerv ( GLenum pname, GLint *params ) */ @@ -1318,11 +1441,14 @@ static void android_glGetIntegerv__ILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLint *params = (GLint *) 0; - params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); int _needed; switch (pname) { #if defined(GL_ALPHA_BITS) @@ -1656,9 +1782,14 @@ android_glGetIntegerv__ILjava_nio_IntBuffer_2 } if (_remaining < _needed) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < needed"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < needed"; goto exit; } + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLint *) (_paramsBase + _bufferOffset); + } glGetIntegerv( (GLenum)pname, (GLint *)params @@ -1668,6 +1799,9 @@ android_glGetIntegerv__ILjava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* const GLubyte * glGetString ( GLenum name ) */ @@ -1699,16 +1833,23 @@ android_glLightModelf__IF static void android_glLightModelfv__I_3FI (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfloat *params_base = (GLfloat *) 0; jint _remaining; GLfloat *params = (GLfloat *) 0; if (!params_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -1729,7 +1870,9 @@ android_glLightModelfv__I_3FI break; } if (_remaining < _needed) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < needed"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < needed"; goto exit; } params_base = (GLfloat *) @@ -1746,17 +1889,24 @@ android_glLightModelfv__I_3FI _env->ReleasePrimitiveArrayCritical(params_ref, params_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glLightModelfv ( GLenum pname, const GLfloat *params ) */ static void android_glLightModelfv__ILjava_nio_FloatBuffer_2 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfloat *params = (GLfloat *) 0; - params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); int _needed; switch (pname) { #if defined(GL_LIGHT_MODEL_TWO_SIDE) @@ -1774,9 +1924,15 @@ android_glLightModelfv__ILjava_nio_FloatBuffer_2 break; } if (_remaining < _needed) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < needed"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < needed"; goto exit; } + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfloat *) (_paramsBase + _bufferOffset); + } glLightModelfv( (GLenum)pname, (GLfloat *)params @@ -1786,6 +1942,9 @@ android_glLightModelfv__ILjava_nio_FloatBuffer_2 if (_array) { releasePointer(_env, _array, params, JNI_FALSE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glLightModelx ( GLenum pname, GLfixed param ) */ @@ -1802,16 +1961,23 @@ android_glLightModelx__II static void android_glLightModelxv__I_3II (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfixed *params_base = (GLfixed *) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; if (!params_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -1832,7 +1998,9 @@ android_glLightModelxv__I_3II break; } if (_remaining < _needed) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < needed"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < needed"; goto exit; } params_base = (GLfixed *) @@ -1849,17 +2017,24 @@ android_glLightModelxv__I_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glLightModelxv ( GLenum pname, const GLfixed *params ) */ static void android_glLightModelxv__ILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; - params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); int _needed; switch (pname) { #if defined(GL_LIGHT_MODEL_TWO_SIDE) @@ -1877,9 +2052,15 @@ android_glLightModelxv__ILjava_nio_IntBuffer_2 break; } if (_remaining < _needed) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < needed"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < needed"; goto exit; } + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfixed *) (_paramsBase + _bufferOffset); + } glLightModelxv( (GLenum)pname, (GLfixed *)params @@ -1889,6 +2070,9 @@ android_glLightModelxv__ILjava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, params, JNI_FALSE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glLightf ( GLenum light, GLenum pname, GLfloat param ) */ @@ -1906,16 +2090,23 @@ android_glLightf__IIF static void android_glLightfv__II_3FI (JNIEnv *_env, jobject _this, jint light, jint pname, jfloatArray params_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfloat *params_base = (GLfloat *) 0; jint _remaining; GLfloat *params = (GLfloat *) 0; if (!params_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -1962,7 +2153,9 @@ android_glLightfv__II_3FI break; } if (_remaining < _needed) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < needed"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < needed"; goto exit; } params_base = (GLfloat *) @@ -1980,17 +2173,24 @@ android_glLightfv__II_3FI _env->ReleasePrimitiveArrayCritical(params_ref, params_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glLightfv ( GLenum light, GLenum pname, const GLfloat *params ) */ static void android_glLightfv__IILjava_nio_FloatBuffer_2 (JNIEnv *_env, jobject _this, jint light, jint pname, jobject params_buf) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfloat *params = (GLfloat *) 0; - params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); int _needed; switch (pname) { #if defined(GL_SPOT_EXPONENT) @@ -2034,9 +2234,15 @@ android_glLightfv__IILjava_nio_FloatBuffer_2 break; } if (_remaining < _needed) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < needed"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < needed"; goto exit; } + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfloat *) (_paramsBase + _bufferOffset); + } glLightfv( (GLenum)light, (GLenum)pname, @@ -2047,6 +2253,9 @@ android_glLightfv__IILjava_nio_FloatBuffer_2 if (_array) { releasePointer(_env, _array, params, JNI_FALSE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glLightx ( GLenum light, GLenum pname, GLfixed param ) */ @@ -2064,16 +2273,23 @@ android_glLightx__III static void android_glLightxv__II_3II (JNIEnv *_env, jobject _this, jint light, jint pname, jintArray params_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfixed *params_base = (GLfixed *) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; if (!params_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -2120,7 +2336,9 @@ android_glLightxv__II_3II break; } if (_remaining < _needed) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < needed"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < needed"; goto exit; } params_base = (GLfixed *) @@ -2138,17 +2356,24 @@ android_glLightxv__II_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glLightxv ( GLenum light, GLenum pname, const GLfixed *params ) */ static void android_glLightxv__IILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint light, jint pname, jobject params_buf) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; - params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); int _needed; switch (pname) { #if defined(GL_SPOT_EXPONENT) @@ -2192,9 +2417,15 @@ android_glLightxv__IILjava_nio_IntBuffer_2 break; } if (_remaining < _needed) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < needed"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < needed"; goto exit; } + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfixed *) (_paramsBase + _bufferOffset); + } glLightxv( (GLenum)light, (GLenum)pname, @@ -2205,6 +2436,9 @@ android_glLightxv__IILjava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, params, JNI_FALSE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glLineWidth ( GLfloat width ) */ @@ -2236,16 +2470,23 @@ android_glLoadIdentity__ static void android_glLoadMatrixf___3FI (JNIEnv *_env, jobject _this, jfloatArray m_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfloat *m_base = (GLfloat *) 0; jint _remaining; GLfloat *m = (GLfloat *) 0; if (!m_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "m == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "m == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(m_ref) - offset; @@ -2262,6 +2503,9 @@ android_glLoadMatrixf___3FI _env->ReleasePrimitiveArrayCritical(m_ref, m_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glLoadMatrixf ( const GLfloat *m ) */ @@ -2269,10 +2513,15 @@ static void android_glLoadMatrixf__Ljava_nio_FloatBuffer_2 (JNIEnv *_env, jobject _this, jobject m_buf) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfloat *m = (GLfloat *) 0; - m = (GLfloat *)getPointer(_env, m_buf, &_array, &_remaining); + m = (GLfloat *)getPointer(_env, m_buf, &_array, &_remaining, &_bufferOffset); + if (m == NULL) { + char * _mBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + m = (GLfloat *) (_mBase + _bufferOffset); + } glLoadMatrixf( (GLfloat *)m ); @@ -2285,16 +2534,23 @@ android_glLoadMatrixf__Ljava_nio_FloatBuffer_2 static void android_glLoadMatrixx___3II (JNIEnv *_env, jobject _this, jintArray m_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfixed *m_base = (GLfixed *) 0; jint _remaining; GLfixed *m = (GLfixed *) 0; if (!m_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "m == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "m == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(m_ref) - offset; @@ -2311,6 +2567,9 @@ android_glLoadMatrixx___3II _env->ReleasePrimitiveArrayCritical(m_ref, m_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glLoadMatrixx ( const GLfixed *m ) */ @@ -2318,10 +2577,15 @@ static void android_glLoadMatrixx__Ljava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jobject m_buf) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfixed *m = (GLfixed *) 0; - m = (GLfixed *)getPointer(_env, m_buf, &_array, &_remaining); + m = (GLfixed *)getPointer(_env, m_buf, &_array, &_remaining, &_bufferOffset); + if (m == NULL) { + char * _mBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + m = (GLfixed *) (_mBase + _bufferOffset); + } glLoadMatrixx( (GLfixed *)m ); @@ -2354,16 +2618,23 @@ android_glMaterialf__IIF static void android_glMaterialfv__II_3FI (JNIEnv *_env, jobject _this, jint face, jint pname, jfloatArray params_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfloat *params_base = (GLfloat *) 0; jint _remaining; GLfloat *params = (GLfloat *) 0; if (!params_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -2396,7 +2667,9 @@ android_glMaterialfv__II_3FI break; } if (_remaining < _needed) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < needed"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < needed"; goto exit; } params_base = (GLfloat *) @@ -2414,17 +2687,24 @@ android_glMaterialfv__II_3FI _env->ReleasePrimitiveArrayCritical(params_ref, params_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glMaterialfv ( GLenum face, GLenum pname, const GLfloat *params ) */ static void android_glMaterialfv__IILjava_nio_FloatBuffer_2 (JNIEnv *_env, jobject _this, jint face, jint pname, jobject params_buf) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfloat *params = (GLfloat *) 0; - params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); int _needed; switch (pname) { #if defined(GL_SHININESS) @@ -2454,9 +2734,15 @@ android_glMaterialfv__IILjava_nio_FloatBuffer_2 break; } if (_remaining < _needed) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < needed"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < needed"; goto exit; } + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfloat *) (_paramsBase + _bufferOffset); + } glMaterialfv( (GLenum)face, (GLenum)pname, @@ -2467,6 +2753,9 @@ android_glMaterialfv__IILjava_nio_FloatBuffer_2 if (_array) { releasePointer(_env, _array, params, JNI_FALSE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glMaterialx ( GLenum face, GLenum pname, GLfixed param ) */ @@ -2484,16 +2773,23 @@ android_glMaterialx__III static void android_glMaterialxv__II_3II (JNIEnv *_env, jobject _this, jint face, jint pname, jintArray params_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfixed *params_base = (GLfixed *) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; if (!params_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -2526,7 +2822,9 @@ android_glMaterialxv__II_3II break; } if (_remaining < _needed) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < needed"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < needed"; goto exit; } params_base = (GLfixed *) @@ -2544,17 +2842,24 @@ android_glMaterialxv__II_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glMaterialxv ( GLenum face, GLenum pname, const GLfixed *params ) */ static void android_glMaterialxv__IILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint face, jint pname, jobject params_buf) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; - params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); int _needed; switch (pname) { #if defined(GL_SHININESS) @@ -2584,9 +2889,15 @@ android_glMaterialxv__IILjava_nio_IntBuffer_2 break; } if (_remaining < _needed) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < needed"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < needed"; goto exit; } + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfixed *) (_paramsBase + _bufferOffset); + } glMaterialxv( (GLenum)face, (GLenum)pname, @@ -2597,6 +2908,9 @@ android_glMaterialxv__IILjava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, params, JNI_FALSE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glMatrixMode ( GLenum mode ) */ @@ -2612,16 +2926,23 @@ android_glMatrixMode__I static void android_glMultMatrixf___3FI (JNIEnv *_env, jobject _this, jfloatArray m_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfloat *m_base = (GLfloat *) 0; jint _remaining; GLfloat *m = (GLfloat *) 0; if (!m_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "m == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "m == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(m_ref) - offset; @@ -2638,6 +2959,9 @@ android_glMultMatrixf___3FI _env->ReleasePrimitiveArrayCritical(m_ref, m_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glMultMatrixf ( const GLfloat *m ) */ @@ -2645,10 +2969,15 @@ static void android_glMultMatrixf__Ljava_nio_FloatBuffer_2 (JNIEnv *_env, jobject _this, jobject m_buf) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfloat *m = (GLfloat *) 0; - m = (GLfloat *)getPointer(_env, m_buf, &_array, &_remaining); + m = (GLfloat *)getPointer(_env, m_buf, &_array, &_remaining, &_bufferOffset); + if (m == NULL) { + char * _mBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + m = (GLfloat *) (_mBase + _bufferOffset); + } glMultMatrixf( (GLfloat *)m ); @@ -2661,16 +2990,23 @@ android_glMultMatrixf__Ljava_nio_FloatBuffer_2 static void android_glMultMatrixx___3II (JNIEnv *_env, jobject _this, jintArray m_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfixed *m_base = (GLfixed *) 0; jint _remaining; GLfixed *m = (GLfixed *) 0; if (!m_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "m == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "m == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(m_ref) - offset; @@ -2687,6 +3023,9 @@ android_glMultMatrixx___3II _env->ReleasePrimitiveArrayCritical(m_ref, m_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glMultMatrixx ( const GLfixed *m ) */ @@ -2694,10 +3033,15 @@ static void android_glMultMatrixx__Ljava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jobject m_buf) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfixed *m = (GLfixed *) 0; - m = (GLfixed *)getPointer(_env, m_buf, &_array, &_remaining); + m = (GLfixed *)getPointer(_env, m_buf, &_array, &_remaining, &_bufferOffset); + if (m == NULL) { + char * _mBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + m = (GLfixed *) (_mBase + _bufferOffset); + } glMultMatrixx( (GLfixed *)m ); @@ -2759,6 +3103,7 @@ static void android_glNormalPointerBounds__IILjava_nio_Buffer_2I (JNIEnv *_env, jobject _this, jint type, jint stride, jobject pointer_buf, jint remaining) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLvoid *pointer = (GLvoid *) 0; @@ -2870,12 +3215,16 @@ android_glPushMatrix__ static void android_glReadPixels__IIIIIILjava_nio_Buffer_2 (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height, jint format, jint type, jobject pixels_buf) { - jint _exception = 0; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLvoid *pixels = (GLvoid *) 0; - pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining); + pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining, &_bufferOffset); + if (pixels == NULL) { + char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + pixels = (GLvoid *) (_pixelsBase + _bufferOffset); + } glReadPixels( (GLint)x, (GLint)y, @@ -2886,7 +3235,7 @@ android_glReadPixels__IIIIIILjava_nio_Buffer_2 (GLvoid *)pixels ); if (_array) { - releasePointer(_env, _array, pixels, _exception ? JNI_FALSE : JNI_TRUE); + releasePointer(_env, _array, pixels, JNI_TRUE); } } @@ -3013,6 +3362,7 @@ static void android_glTexCoordPointerBounds__IIILjava_nio_Buffer_2I (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jobject pointer_buf, jint remaining) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLvoid *pointer = (GLvoid *) 0; @@ -3046,16 +3396,23 @@ android_glTexEnvf__IIF static void android_glTexEnvfv__II_3FI (JNIEnv *_env, jobject _this, jint target, jint pname, jfloatArray params_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfloat *params_base = (GLfloat *) 0; jint _remaining; GLfloat *params = (GLfloat *) 0; if (!params_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -3082,7 +3439,9 @@ android_glTexEnvfv__II_3FI break; } if (_remaining < _needed) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < needed"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < needed"; goto exit; } params_base = (GLfloat *) @@ -3100,17 +3459,24 @@ android_glTexEnvfv__II_3FI _env->ReleasePrimitiveArrayCritical(params_ref, params_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glTexEnvfv ( GLenum target, GLenum pname, const GLfloat *params ) */ static void android_glTexEnvfv__IILjava_nio_FloatBuffer_2 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfloat *params = (GLfloat *) 0; - params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); int _needed; switch (pname) { #if defined(GL_TEXTURE_ENV_MODE) @@ -3134,9 +3500,15 @@ android_glTexEnvfv__IILjava_nio_FloatBuffer_2 break; } if (_remaining < _needed) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < needed"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < needed"; goto exit; } + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfloat *) (_paramsBase + _bufferOffset); + } glTexEnvfv( (GLenum)target, (GLenum)pname, @@ -3147,6 +3519,9 @@ android_glTexEnvfv__IILjava_nio_FloatBuffer_2 if (_array) { releasePointer(_env, _array, params, JNI_FALSE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glTexEnvx ( GLenum target, GLenum pname, GLfixed param ) */ @@ -3164,16 +3539,23 @@ android_glTexEnvx__III static void android_glTexEnvxv__II_3II (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfixed *params_base = (GLfixed *) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; if (!params_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -3200,7 +3582,9 @@ android_glTexEnvxv__II_3II break; } if (_remaining < _needed) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < needed"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < needed"; goto exit; } params_base = (GLfixed *) @@ -3218,17 +3602,24 @@ android_glTexEnvxv__II_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glTexEnvxv ( GLenum target, GLenum pname, const GLfixed *params ) */ static void android_glTexEnvxv__IILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; - params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); int _needed; switch (pname) { #if defined(GL_TEXTURE_ENV_MODE) @@ -3252,9 +3643,15 @@ android_glTexEnvxv__IILjava_nio_IntBuffer_2 break; } if (_remaining < _needed) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < needed"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < needed"; goto exit; } + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfixed *) (_paramsBase + _bufferOffset); + } glTexEnvxv( (GLenum)target, (GLenum)pname, @@ -3265,6 +3662,9 @@ android_glTexEnvxv__IILjava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, params, JNI_FALSE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glTexImage2D ( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels ) */ @@ -3272,11 +3672,16 @@ static void android_glTexImage2D__IIIIIIIILjava_nio_Buffer_2 (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint width, jint height, jint border, jint format, jint type, jobject pixels_buf) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLvoid *pixels = (GLvoid *) 0; if (pixels_buf) { - pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining); + pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining, &_bufferOffset); + } + if (pixels_buf && pixels == NULL) { + char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + pixels = (GLvoid *) (_pixelsBase + _bufferOffset); } glTexImage2D( (GLenum)target, @@ -3321,11 +3726,16 @@ static void android_glTexSubImage2D__IIIIIIIILjava_nio_Buffer_2 (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint width, jint height, jint format, jint type, jobject pixels_buf) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLvoid *pixels = (GLvoid *) 0; if (pixels_buf) { - pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining); + pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining, &_bufferOffset); + } + if (pixels_buf && pixels == NULL) { + char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + pixels = (GLvoid *) (_pixelsBase + _bufferOffset); } glTexSubImage2D( (GLenum)target, @@ -3370,6 +3780,7 @@ static void android_glVertexPointerBounds__IIILjava_nio_Buffer_2I (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jobject pointer_buf, jint remaining) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLvoid *pointer = (GLvoid *) 0; diff --git a/core/jni/android_opengl_GLES10Ext.cpp b/core/jni/android_opengl_GLES10Ext.cpp index 1154cef2171b7..1cd8e44a1a8fb 100644 --- a/core/jni/android_opengl_GLES10Ext.cpp +++ b/core/jni/android_opengl_GLES10Ext.cpp @@ -63,14 +63,12 @@ nativeClassInit(JNIEnv *_env, jclass glImplClass) static void * -getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining) +getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining, jint *offset) { jint position; jint limit; jint elementSizeShift; jlong pointer; - jint offset; - void *data; position = _env->GetIntField(buffer, positionID); limit = _env->GetIntField(buffer, limitID); @@ -85,11 +83,10 @@ getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining) *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass, getBaseArrayID, buffer); - offset = _env->CallStaticIntMethod(nioAccessClass, + *offset = _env->CallStaticIntMethod(nioAccessClass, getBaseArrayOffsetID, buffer); - data = _env->GetPrimitiveArrayCritical(*array, (jboolean *) 0); - return (void *) ((char *) data + offset); + return NULL; } @@ -106,6 +103,8 @@ static jint android_glQueryMatrixxOES___3II_3II (JNIEnv *_env, jobject _this, jintArray mantissa_ref, jint mantissaOffset, jintArray exponent_ref, jint exponentOffset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLbitfield _returnValue = -1; GLfixed *mantissa_base = (GLfixed *) 0; jint _mantissaRemaining; @@ -116,18 +115,21 @@ android_glQueryMatrixxOES___3II_3II if (!mantissa_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "mantissa == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "mantissa == null"; goto exit; } if (mantissaOffset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "mantissaOffset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "mantissaOffset < 0"; goto exit; } _mantissaRemaining = _env->GetArrayLength(mantissa_ref) - mantissaOffset; if (_mantissaRemaining < 16) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - mantissaOffset < 16"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - mantissaOffset < 16 < needed"; goto exit; } mantissa_base = (GLfixed *) @@ -136,18 +138,21 @@ android_glQueryMatrixxOES___3II_3II if (!exponent_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "exponent == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "exponent == null"; goto exit; } if (exponentOffset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "exponentOffset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "exponentOffset < 0"; goto exit; } _exponentRemaining = _env->GetArrayLength(exponent_ref) - exponentOffset; if (_exponentRemaining < 16) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - exponentOffset < 16"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - exponentOffset < 16 < needed"; goto exit; } exponent_base = (GLint *) @@ -168,6 +173,9 @@ android_glQueryMatrixxOES___3II_3II _env->ReleasePrimitiveArrayCritical(mantissa_ref, mantissa_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } return _returnValue; } @@ -176,37 +184,54 @@ static jint android_glQueryMatrixxOES__Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jobject mantissa_buf, jobject exponent_buf) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _mantissaArray = (jarray) 0; + jint _mantissaBufferOffset = (jint) 0; jarray _exponentArray = (jarray) 0; + jint _exponentBufferOffset = (jint) 0; GLbitfield _returnValue = -1; jint _mantissaRemaining; GLfixed *mantissa = (GLfixed *) 0; jint _exponentRemaining; GLint *exponent = (GLint *) 0; - mantissa = (GLfixed *)getPointer(_env, mantissa_buf, &_mantissaArray, &_mantissaRemaining); + mantissa = (GLfixed *)getPointer(_env, mantissa_buf, &_mantissaArray, &_mantissaRemaining, &_mantissaBufferOffset); if (_mantissaRemaining < 16) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < 16"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < 16 < needed"; goto exit; } - exponent = (GLint *)getPointer(_env, exponent_buf, &_exponentArray, &_exponentRemaining); + exponent = (GLint *)getPointer(_env, exponent_buf, &_exponentArray, &_exponentRemaining, &_exponentBufferOffset); if (_exponentRemaining < 16) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < 16"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < 16 < needed"; goto exit; } + if (mantissa == NULL) { + char * _mantissaBase = (char *)_env->GetPrimitiveArrayCritical(_mantissaArray, (jboolean *) 0); + mantissa = (GLfixed *) (_mantissaBase + _mantissaBufferOffset); + } + if (exponent == NULL) { + char * _exponentBase = (char *)_env->GetPrimitiveArrayCritical(_exponentArray, (jboolean *) 0); + exponent = (GLint *) (_exponentBase + _exponentBufferOffset); + } _returnValue = glQueryMatrixxOES( (GLfixed *)mantissa, (GLint *)exponent ); exit: + if (_exponentArray) { + releasePointer(_env, _exponentArray, exponent, _exception ? JNI_FALSE : JNI_TRUE); + } if (_mantissaArray) { - releasePointer(_env, _mantissaArray, exponent, _exception ? JNI_FALSE : JNI_TRUE); + releasePointer(_env, _mantissaArray, mantissa, _exception ? JNI_FALSE : JNI_TRUE); } - if (_exponentArray) { - releasePointer(_env, _exponentArray, mantissa, _exception ? JNI_FALSE : JNI_TRUE); + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); } return _returnValue; } diff --git a/core/jni/android_opengl_GLES11.cpp b/core/jni/android_opengl_GLES11.cpp index d038f20514999..1e6ceb32b9cf5 100644 --- a/core/jni/android_opengl_GLES11.cpp +++ b/core/jni/android_opengl_GLES11.cpp @@ -70,14 +70,12 @@ nativeClassInit(JNIEnv *_env, jclass glImplClass) static void * -getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining) +getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining, jint *offset) { jint position; jint limit; jint elementSizeShift; jlong pointer; - jint offset; - void *data; position = _env->GetIntField(buffer, positionID); limit = _env->GetIntField(buffer, limitID); @@ -92,11 +90,10 @@ getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining) *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass, getBaseArrayID, buffer); - offset = _env->CallStaticIntMethod(nioAccessClass, + *offset = _env->CallStaticIntMethod(nioAccessClass, getBaseArrayOffsetID, buffer); - data = _env->GetPrimitiveArrayCritical(*array, (jboolean *) 0); - return (void *) ((char *) data + offset); + return NULL; } @@ -136,17 +133,27 @@ android_glBindBuffer__II static void android_glBufferData__IILjava_nio_Buffer_2I (JNIEnv *_env, jobject _this, jint target, jint size, jobject data_buf, jint usage) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLvoid *data = (GLvoid *) 0; if (data_buf) { - data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining); + data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < size) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < size"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < size < needed"; goto exit; } } + if (data_buf && data == NULL) { + char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + data = (GLvoid *) (_dataBase + _bufferOffset); + } glBufferData( (GLenum)target, (GLsizeiptr)size, @@ -158,21 +165,34 @@ android_glBufferData__IILjava_nio_Buffer_2I if (_array) { releasePointer(_env, _array, data, JNI_FALSE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glBufferSubData ( GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data ) */ static void android_glBufferSubData__IIILjava_nio_Buffer_2 (JNIEnv *_env, jobject _this, jint target, jint offset, jint size, jobject data_buf) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLvoid *data = (GLvoid *) 0; - data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining); + data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < size) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < size"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < size < needed"; goto exit; } + if (data == NULL) { + char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + data = (GLvoid *) (_dataBase + _bufferOffset); + } glBufferSubData( (GLenum)target, (GLintptr)offset, @@ -184,22 +204,32 @@ android_glBufferSubData__IIILjava_nio_Buffer_2 if (_array) { releasePointer(_env, _array, data, JNI_FALSE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glClipPlanef ( GLenum plane, const GLfloat *equation ) */ static void android_glClipPlanef__I_3FI (JNIEnv *_env, jobject _this, jint plane, jfloatArray equation_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfloat *equation_base = (GLfloat *) 0; jint _remaining; GLfloat *equation = (GLfloat *) 0; if (!equation_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "equation == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "equation == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(equation_ref) - offset; @@ -217,17 +247,28 @@ android_glClipPlanef__I_3FI _env->ReleasePrimitiveArrayCritical(equation_ref, equation_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glClipPlanef ( GLenum plane, const GLfloat *equation ) */ static void android_glClipPlanef__ILjava_nio_FloatBuffer_2 (JNIEnv *_env, jobject _this, jint plane, jobject equation_buf) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfloat *equation = (GLfloat *) 0; - equation = (GLfloat *)getPointer(_env, equation_buf, &_array, &_remaining); + equation = (GLfloat *)getPointer(_env, equation_buf, &_array, &_remaining, &_bufferOffset); + if (equation == NULL) { + char * _equationBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + equation = (GLfloat *) (_equationBase + _bufferOffset); + } glClipPlanef( (GLenum)plane, (GLfloat *)equation @@ -235,22 +276,32 @@ android_glClipPlanef__ILjava_nio_FloatBuffer_2 if (_array) { releasePointer(_env, _array, equation, JNI_FALSE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glClipPlanex ( GLenum plane, const GLfixed *equation ) */ static void android_glClipPlanex__I_3II (JNIEnv *_env, jobject _this, jint plane, jintArray equation_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfixed *equation_base = (GLfixed *) 0; jint _remaining; GLfixed *equation = (GLfixed *) 0; if (!equation_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "equation == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "equation == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(equation_ref) - offset; @@ -268,17 +319,28 @@ android_glClipPlanex__I_3II _env->ReleasePrimitiveArrayCritical(equation_ref, equation_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glClipPlanex ( GLenum plane, const GLfixed *equation ) */ static void android_glClipPlanex__ILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint plane, jobject equation_buf) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfixed *equation = (GLfixed *) 0; - equation = (GLfixed *)getPointer(_env, equation_buf, &_array, &_remaining); + equation = (GLfixed *)getPointer(_env, equation_buf, &_array, &_remaining, &_bufferOffset); + if (equation == NULL) { + char * _equationBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + equation = (GLfixed *) (_equationBase + _bufferOffset); + } glClipPlanex( (GLenum)plane, (GLfixed *)equation @@ -286,6 +348,9 @@ android_glClipPlanex__ILjava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, equation, JNI_FALSE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glColor4ub ( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha ) */ @@ -316,21 +381,30 @@ android_glColorPointer__IIII static void android_glDeleteBuffers__I_3II (JNIEnv *_env, jobject _this, jint n, jintArray buffers_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLuint *buffers_base = (GLuint *) 0; jint _remaining; GLuint *buffers = (GLuint *) 0; if (!buffers_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "buffers == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "buffers == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(buffers_ref) - offset; if (_remaining < n) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < n"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < n < needed"; goto exit; } buffers_base = (GLuint *) @@ -347,21 +421,34 @@ android_glDeleteBuffers__I_3II _env->ReleasePrimitiveArrayCritical(buffers_ref, buffers_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glDeleteBuffers ( GLsizei n, const GLuint *buffers ) */ static void android_glDeleteBuffers__ILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint n, jobject buffers_buf) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLuint *buffers = (GLuint *) 0; - buffers = (GLuint *)getPointer(_env, buffers_buf, &_array, &_remaining); + buffers = (GLuint *)getPointer(_env, buffers_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < n) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < n"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < n < needed"; goto exit; } + if (buffers == NULL) { + char * _buffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + buffers = (GLuint *) (_buffersBase + _bufferOffset); + } glDeleteBuffers( (GLsizei)n, (GLuint *)buffers @@ -371,18 +458,27 @@ android_glDeleteBuffers__ILjava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, buffers, JNI_FALSE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glDrawElements ( GLenum mode, GLsizei count, GLenum type, GLint offset ) */ static void android_glDrawElements__IIII (JNIEnv *_env, jobject _this, jint mode, jint count, jint type, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; glDrawElements( (GLenum)mode, (GLsizei)count, (GLenum)type, (const GLvoid *)offset ); + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGenBuffers ( GLsizei n, GLuint *buffers ) */ @@ -390,24 +486,29 @@ static void android_glGenBuffers__I_3II (JNIEnv *_env, jobject _this, jint n, jintArray buffers_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLuint *buffers_base = (GLuint *) 0; jint _remaining; GLuint *buffers = (GLuint *) 0; if (!buffers_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "buffers == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "buffers == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(buffers_ref) - offset; if (_remaining < n) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < n"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < n < needed"; goto exit; } buffers_base = (GLuint *) @@ -424,6 +525,9 @@ android_glGenBuffers__I_3II _env->ReleasePrimitiveArrayCritical(buffers_ref, buffers_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGenBuffers ( GLsizei n, GLuint *buffers ) */ @@ -431,16 +535,24 @@ static void android_glGenBuffers__ILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint n, jobject buffers_buf) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLuint *buffers = (GLuint *) 0; - buffers = (GLuint *)getPointer(_env, buffers_buf, &_array, &_remaining); + buffers = (GLuint *)getPointer(_env, buffers_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < n) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < n"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < n < needed"; goto exit; } + if (buffers == NULL) { + char * _buffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + buffers = (GLuint *) (_buffersBase + _bufferOffset); + } glGenBuffers( (GLsizei)n, (GLuint *)buffers @@ -450,6 +562,9 @@ android_glGenBuffers__ILjava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, buffers, _exception ? JNI_FALSE : JNI_TRUE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetBooleanv ( GLenum pname, GLboolean *params ) */ @@ -457,18 +572,22 @@ static void android_glGetBooleanv__I_3ZI (JNIEnv *_env, jobject _this, jint pname, jbooleanArray params_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLboolean *params_base = (GLboolean *) 0; jint _remaining; GLboolean *params = (GLboolean *) 0; if (!params_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -486,24 +605,31 @@ android_glGetBooleanv__I_3ZI _env->ReleasePrimitiveArrayCritical(params_ref, params_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetBooleanv ( GLenum pname, GLboolean *params ) */ static void android_glGetBooleanv__ILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { - jint _exception = 0; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLboolean *params = (GLboolean *) 0; - params = (GLboolean *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLboolean *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLboolean *) (_paramsBase + _bufferOffset); + } glGetBooleanv( (GLenum)pname, (GLboolean *)params ); if (_array) { - releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + releasePointer(_env, _array, params, JNI_TRUE); } } @@ -512,24 +638,29 @@ static void android_glGetBufferParameteriv__II_3II (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLint *params_base = (GLint *) 0; jint _remaining; GLint *params = (GLint *) 0; if (!params_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; if (_remaining < 1) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < 1"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < 1 < needed"; goto exit; } params_base = (GLint *) @@ -547,6 +678,9 @@ android_glGetBufferParameteriv__II_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */ @@ -554,16 +688,24 @@ static void android_glGetBufferParameteriv__IILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLint *params = (GLint *) 0; - params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < 1) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < 1"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < 1 < needed"; goto exit; } + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLint *) (_paramsBase + _bufferOffset); + } glGetBufferParameteriv( (GLenum)target, (GLenum)pname, @@ -574,6 +716,9 @@ android_glGetBufferParameteriv__IILjava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetClipPlanef ( GLenum pname, GLfloat *eqn ) */ @@ -581,18 +726,22 @@ static void android_glGetClipPlanef__I_3FI (JNIEnv *_env, jobject _this, jint pname, jfloatArray eqn_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfloat *eqn_base = (GLfloat *) 0; jint _remaining; GLfloat *eqn = (GLfloat *) 0; if (!eqn_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "eqn == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "eqn == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(eqn_ref) - offset; @@ -610,24 +759,31 @@ android_glGetClipPlanef__I_3FI _env->ReleasePrimitiveArrayCritical(eqn_ref, eqn_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetClipPlanef ( GLenum pname, GLfloat *eqn ) */ static void android_glGetClipPlanef__ILjava_nio_FloatBuffer_2 (JNIEnv *_env, jobject _this, jint pname, jobject eqn_buf) { - jint _exception = 0; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfloat *eqn = (GLfloat *) 0; - eqn = (GLfloat *)getPointer(_env, eqn_buf, &_array, &_remaining); + eqn = (GLfloat *)getPointer(_env, eqn_buf, &_array, &_remaining, &_bufferOffset); + if (eqn == NULL) { + char * _eqnBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + eqn = (GLfloat *) (_eqnBase + _bufferOffset); + } glGetClipPlanef( (GLenum)pname, (GLfloat *)eqn ); if (_array) { - releasePointer(_env, _array, eqn, _exception ? JNI_FALSE : JNI_TRUE); + releasePointer(_env, _array, eqn, JNI_TRUE); } } @@ -636,18 +792,22 @@ static void android_glGetClipPlanex__I_3II (JNIEnv *_env, jobject _this, jint pname, jintArray eqn_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfixed *eqn_base = (GLfixed *) 0; jint _remaining; GLfixed *eqn = (GLfixed *) 0; if (!eqn_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "eqn == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "eqn == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(eqn_ref) - offset; @@ -665,24 +825,31 @@ android_glGetClipPlanex__I_3II _env->ReleasePrimitiveArrayCritical(eqn_ref, eqn_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetClipPlanex ( GLenum pname, GLfixed *eqn ) */ static void android_glGetClipPlanex__ILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint pname, jobject eqn_buf) { - jint _exception = 0; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfixed *eqn = (GLfixed *) 0; - eqn = (GLfixed *)getPointer(_env, eqn_buf, &_array, &_remaining); + eqn = (GLfixed *)getPointer(_env, eqn_buf, &_array, &_remaining, &_bufferOffset); + if (eqn == NULL) { + char * _eqnBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + eqn = (GLfixed *) (_eqnBase + _bufferOffset); + } glGetClipPlanex( (GLenum)pname, (GLfixed *)eqn ); if (_array) { - releasePointer(_env, _array, eqn, _exception ? JNI_FALSE : JNI_TRUE); + releasePointer(_env, _array, eqn, JNI_TRUE); } } @@ -691,18 +858,22 @@ static void android_glGetFixedv__I_3II (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfixed *params_base = (GLfixed *) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; if (!params_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -720,24 +891,31 @@ android_glGetFixedv__I_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetFixedv ( GLenum pname, GLfixed *params ) */ static void android_glGetFixedv__ILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { - jint _exception = 0; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; - params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfixed *) (_paramsBase + _bufferOffset); + } glGetFixedv( (GLenum)pname, (GLfixed *)params ); if (_array) { - releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + releasePointer(_env, _array, params, JNI_TRUE); } } @@ -746,18 +924,22 @@ static void android_glGetFloatv__I_3FI (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfloat *params_base = (GLfloat *) 0; jint _remaining; GLfloat *params = (GLfloat *) 0; if (!params_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -775,24 +957,31 @@ android_glGetFloatv__I_3FI _env->ReleasePrimitiveArrayCritical(params_ref, params_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetFloatv ( GLenum pname, GLfloat *params ) */ static void android_glGetFloatv__ILjava_nio_FloatBuffer_2 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { - jint _exception = 0; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfloat *params = (GLfloat *) 0; - params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfloat *) (_paramsBase + _bufferOffset); + } glGetFloatv( (GLenum)pname, (GLfloat *)params ); if (_array) { - releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + releasePointer(_env, _array, params, JNI_TRUE); } } @@ -801,18 +990,22 @@ static void android_glGetLightfv__II_3FI (JNIEnv *_env, jobject _this, jint light, jint pname, jfloatArray params_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfloat *params_base = (GLfloat *) 0; jint _remaining; GLfloat *params = (GLfloat *) 0; if (!params_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -860,7 +1053,8 @@ android_glGetLightfv__II_3FI } if (_remaining < _needed) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < needed"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < needed"; goto exit; } params_base = (GLfloat *) @@ -878,6 +1072,9 @@ android_glGetLightfv__II_3FI _env->ReleasePrimitiveArrayCritical(params_ref, params_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetLightfv ( GLenum light, GLenum pname, GLfloat *params ) */ @@ -885,11 +1082,14 @@ static void android_glGetLightfv__IILjava_nio_FloatBuffer_2 (JNIEnv *_env, jobject _this, jint light, jint pname, jobject params_buf) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfloat *params = (GLfloat *) 0; - params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); int _needed; switch (pname) { #if defined(GL_SPOT_EXPONENT) @@ -934,9 +1134,14 @@ android_glGetLightfv__IILjava_nio_FloatBuffer_2 } if (_remaining < _needed) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < needed"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < needed"; goto exit; } + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfloat *) (_paramsBase + _bufferOffset); + } glGetLightfv( (GLenum)light, (GLenum)pname, @@ -947,6 +1152,9 @@ android_glGetLightfv__IILjava_nio_FloatBuffer_2 if (_array) { releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetLightxv ( GLenum light, GLenum pname, GLfixed *params ) */ @@ -954,18 +1162,22 @@ static void android_glGetLightxv__II_3II (JNIEnv *_env, jobject _this, jint light, jint pname, jintArray params_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfixed *params_base = (GLfixed *) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; if (!params_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -1013,7 +1225,8 @@ android_glGetLightxv__II_3II } if (_remaining < _needed) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < needed"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < needed"; goto exit; } params_base = (GLfixed *) @@ -1031,6 +1244,9 @@ android_glGetLightxv__II_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetLightxv ( GLenum light, GLenum pname, GLfixed *params ) */ @@ -1038,11 +1254,14 @@ static void android_glGetLightxv__IILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint light, jint pname, jobject params_buf) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; - params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); int _needed; switch (pname) { #if defined(GL_SPOT_EXPONENT) @@ -1087,9 +1306,14 @@ android_glGetLightxv__IILjava_nio_IntBuffer_2 } if (_remaining < _needed) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < needed"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < needed"; goto exit; } + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfixed *) (_paramsBase + _bufferOffset); + } glGetLightxv( (GLenum)light, (GLenum)pname, @@ -1100,6 +1324,9 @@ android_glGetLightxv__IILjava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetMaterialfv ( GLenum face, GLenum pname, GLfloat *params ) */ @@ -1107,18 +1334,22 @@ static void android_glGetMaterialfv__II_3FI (JNIEnv *_env, jobject _this, jint face, jint pname, jfloatArray params_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfloat *params_base = (GLfloat *) 0; jint _remaining; GLfloat *params = (GLfloat *) 0; if (!params_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -1152,7 +1383,8 @@ android_glGetMaterialfv__II_3FI } if (_remaining < _needed) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < needed"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < needed"; goto exit; } params_base = (GLfloat *) @@ -1170,6 +1402,9 @@ android_glGetMaterialfv__II_3FI _env->ReleasePrimitiveArrayCritical(params_ref, params_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetMaterialfv ( GLenum face, GLenum pname, GLfloat *params ) */ @@ -1177,11 +1412,14 @@ static void android_glGetMaterialfv__IILjava_nio_FloatBuffer_2 (JNIEnv *_env, jobject _this, jint face, jint pname, jobject params_buf) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfloat *params = (GLfloat *) 0; - params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); int _needed; switch (pname) { #if defined(GL_SHININESS) @@ -1212,9 +1450,14 @@ android_glGetMaterialfv__IILjava_nio_FloatBuffer_2 } if (_remaining < _needed) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < needed"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < needed"; goto exit; } + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfloat *) (_paramsBase + _bufferOffset); + } glGetMaterialfv( (GLenum)face, (GLenum)pname, @@ -1225,6 +1468,9 @@ android_glGetMaterialfv__IILjava_nio_FloatBuffer_2 if (_array) { releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetMaterialxv ( GLenum face, GLenum pname, GLfixed *params ) */ @@ -1232,18 +1478,22 @@ static void android_glGetMaterialxv__II_3II (JNIEnv *_env, jobject _this, jint face, jint pname, jintArray params_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfixed *params_base = (GLfixed *) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; if (!params_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -1277,7 +1527,8 @@ android_glGetMaterialxv__II_3II } if (_remaining < _needed) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < needed"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < needed"; goto exit; } params_base = (GLfixed *) @@ -1295,6 +1546,9 @@ android_glGetMaterialxv__II_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetMaterialxv ( GLenum face, GLenum pname, GLfixed *params ) */ @@ -1302,11 +1556,14 @@ static void android_glGetMaterialxv__IILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint face, jint pname, jobject params_buf) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; - params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); int _needed; switch (pname) { #if defined(GL_SHININESS) @@ -1337,9 +1594,14 @@ android_glGetMaterialxv__IILjava_nio_IntBuffer_2 } if (_remaining < _needed) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < needed"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < needed"; goto exit; } + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfixed *) (_paramsBase + _bufferOffset); + } glGetMaterialxv( (GLenum)face, (GLenum)pname, @@ -1350,6 +1612,9 @@ android_glGetMaterialxv__IILjava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetTexEnvfv ( GLenum env, GLenum pname, GLfloat *params ) */ @@ -1357,18 +1622,22 @@ static void android_glGetTexEnvfv__II_3FI (JNIEnv *_env, jobject _this, jint env, jint pname, jfloatArray params_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfloat *params_base = (GLfloat *) 0; jint _remaining; GLfloat *params = (GLfloat *) 0; if (!params_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -1396,7 +1665,8 @@ android_glGetTexEnvfv__II_3FI } if (_remaining < _needed) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < needed"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < needed"; goto exit; } params_base = (GLfloat *) @@ -1414,6 +1684,9 @@ android_glGetTexEnvfv__II_3FI _env->ReleasePrimitiveArrayCritical(params_ref, params_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetTexEnvfv ( GLenum env, GLenum pname, GLfloat *params ) */ @@ -1421,11 +1694,14 @@ static void android_glGetTexEnvfv__IILjava_nio_FloatBuffer_2 (JNIEnv *_env, jobject _this, jint env, jint pname, jobject params_buf) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfloat *params = (GLfloat *) 0; - params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); int _needed; switch (pname) { #if defined(GL_TEXTURE_ENV_MODE) @@ -1450,9 +1726,14 @@ android_glGetTexEnvfv__IILjava_nio_FloatBuffer_2 } if (_remaining < _needed) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < needed"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < needed"; goto exit; } + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfloat *) (_paramsBase + _bufferOffset); + } glGetTexEnvfv( (GLenum)env, (GLenum)pname, @@ -1463,6 +1744,9 @@ android_glGetTexEnvfv__IILjava_nio_FloatBuffer_2 if (_array) { releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetTexEnviv ( GLenum env, GLenum pname, GLint *params ) */ @@ -1470,18 +1754,22 @@ static void android_glGetTexEnviv__II_3II (JNIEnv *_env, jobject _this, jint env, jint pname, jintArray params_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLint *params_base = (GLint *) 0; jint _remaining; GLint *params = (GLint *) 0; if (!params_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -1509,7 +1797,8 @@ android_glGetTexEnviv__II_3II } if (_remaining < _needed) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < needed"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < needed"; goto exit; } params_base = (GLint *) @@ -1527,6 +1816,9 @@ android_glGetTexEnviv__II_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetTexEnviv ( GLenum env, GLenum pname, GLint *params ) */ @@ -1534,11 +1826,14 @@ static void android_glGetTexEnviv__IILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint env, jint pname, jobject params_buf) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLint *params = (GLint *) 0; - params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); int _needed; switch (pname) { #if defined(GL_TEXTURE_ENV_MODE) @@ -1563,9 +1858,14 @@ android_glGetTexEnviv__IILjava_nio_IntBuffer_2 } if (_remaining < _needed) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < needed"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < needed"; goto exit; } + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLint *) (_paramsBase + _bufferOffset); + } glGetTexEnviv( (GLenum)env, (GLenum)pname, @@ -1576,6 +1876,9 @@ android_glGetTexEnviv__IILjava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetTexEnvxv ( GLenum env, GLenum pname, GLfixed *params ) */ @@ -1583,18 +1886,22 @@ static void android_glGetTexEnvxv__II_3II (JNIEnv *_env, jobject _this, jint env, jint pname, jintArray params_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfixed *params_base = (GLfixed *) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; if (!params_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -1622,7 +1929,8 @@ android_glGetTexEnvxv__II_3II } if (_remaining < _needed) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < needed"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < needed"; goto exit; } params_base = (GLfixed *) @@ -1640,6 +1948,9 @@ android_glGetTexEnvxv__II_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetTexEnvxv ( GLenum env, GLenum pname, GLfixed *params ) */ @@ -1647,11 +1958,14 @@ static void android_glGetTexEnvxv__IILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint env, jint pname, jobject params_buf) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; - params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); int _needed; switch (pname) { #if defined(GL_TEXTURE_ENV_MODE) @@ -1676,9 +1990,14 @@ android_glGetTexEnvxv__IILjava_nio_IntBuffer_2 } if (_remaining < _needed) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < needed"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < needed"; goto exit; } + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfixed *) (_paramsBase + _bufferOffset); + } glGetTexEnvxv( (GLenum)env, (GLenum)pname, @@ -1689,6 +2008,9 @@ android_glGetTexEnvxv__IILjava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) */ @@ -1696,24 +2018,29 @@ static void android_glGetTexParameterfv__II_3FI (JNIEnv *_env, jobject _this, jint target, jint pname, jfloatArray params_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfloat *params_base = (GLfloat *) 0; jint _remaining; GLfloat *params = (GLfloat *) 0; if (!params_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; if (_remaining < 1) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < 1"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < 1 < needed"; goto exit; } params_base = (GLfloat *) @@ -1731,6 +2058,9 @@ android_glGetTexParameterfv__II_3FI _env->ReleasePrimitiveArrayCritical(params_ref, params_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) */ @@ -1738,16 +2068,24 @@ static void android_glGetTexParameterfv__IILjava_nio_FloatBuffer_2 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfloat *params = (GLfloat *) 0; - params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < 1) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < 1"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < 1 < needed"; goto exit; } + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfloat *) (_paramsBase + _bufferOffset); + } glGetTexParameterfv( (GLenum)target, (GLenum)pname, @@ -1758,6 +2096,9 @@ android_glGetTexParameterfv__IILjava_nio_FloatBuffer_2 if (_array) { releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) */ @@ -1765,24 +2106,29 @@ static void android_glGetTexParameteriv__II_3II (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLint *params_base = (GLint *) 0; jint _remaining; GLint *params = (GLint *) 0; if (!params_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; if (_remaining < 1) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < 1"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < 1 < needed"; goto exit; } params_base = (GLint *) @@ -1800,6 +2146,9 @@ android_glGetTexParameteriv__II_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) */ @@ -1807,16 +2156,24 @@ static void android_glGetTexParameteriv__IILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLint *params = (GLint *) 0; - params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < 1) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < 1"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < 1 < needed"; goto exit; } + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLint *) (_paramsBase + _bufferOffset); + } glGetTexParameteriv( (GLenum)target, (GLenum)pname, @@ -1827,6 +2184,9 @@ android_glGetTexParameteriv__IILjava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetTexParameterxv ( GLenum target, GLenum pname, GLfixed *params ) */ @@ -1834,24 +2194,29 @@ static void android_glGetTexParameterxv__II_3II (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfixed *params_base = (GLfixed *) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; if (!params_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; if (_remaining < 1) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < 1"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < 1 < needed"; goto exit; } params_base = (GLfixed *) @@ -1869,6 +2234,9 @@ android_glGetTexParameterxv__II_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetTexParameterxv ( GLenum target, GLenum pname, GLfixed *params ) */ @@ -1876,16 +2244,24 @@ static void android_glGetTexParameterxv__IILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; - params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < 1) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < 1"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < 1 < needed"; goto exit; } + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfixed *) (_paramsBase + _bufferOffset); + } glGetTexParameterxv( (GLenum)target, (GLenum)pname, @@ -1896,6 +2272,9 @@ android_glGetTexParameterxv__IILjava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* GLboolean glIsBuffer ( GLuint buffer ) */ @@ -1956,21 +2335,30 @@ android_glPointParameterf__IF static void android_glPointParameterfv__I_3FI (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfloat *params_base = (GLfloat *) 0; jint _remaining; GLfloat *params = (GLfloat *) 0; if (!params_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; if (_remaining < 1) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < 1"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < 1 < needed"; goto exit; } params_base = (GLfloat *) @@ -1987,21 +2375,34 @@ android_glPointParameterfv__I_3FI _env->ReleasePrimitiveArrayCritical(params_ref, params_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glPointParameterfv ( GLenum pname, const GLfloat *params ) */ static void android_glPointParameterfv__ILjava_nio_FloatBuffer_2 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfloat *params = (GLfloat *) 0; - params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < 1) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < 1"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < 1 < needed"; goto exit; } + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfloat *) (_paramsBase + _bufferOffset); + } glPointParameterfv( (GLenum)pname, (GLfloat *)params @@ -2011,6 +2412,9 @@ android_glPointParameterfv__ILjava_nio_FloatBuffer_2 if (_array) { releasePointer(_env, _array, params, JNI_FALSE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glPointParameterx ( GLenum pname, GLfixed param ) */ @@ -2027,21 +2431,30 @@ android_glPointParameterx__II static void android_glPointParameterxv__I_3II (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfixed *params_base = (GLfixed *) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; if (!params_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; if (_remaining < 1) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < 1"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < 1 < needed"; goto exit; } params_base = (GLfixed *) @@ -2058,21 +2471,34 @@ android_glPointParameterxv__I_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glPointParameterxv ( GLenum pname, const GLfixed *params ) */ static void android_glPointParameterxv__ILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; - params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < 1) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < 1"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < 1 < needed"; goto exit; } + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfixed *) (_paramsBase + _bufferOffset); + } glPointParameterxv( (GLenum)pname, (GLfixed *)params @@ -2082,6 +2508,9 @@ android_glPointParameterxv__ILjava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, params, JNI_FALSE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glPointSizePointerOES ( GLenum type, GLsizei stride, const GLvoid *pointer ) */ @@ -2089,6 +2518,7 @@ static void android_glPointSizePointerOESBounds__IILjava_nio_Buffer_2I (JNIEnv *_env, jobject _this, jint type, jint stride, jobject pointer_buf, jint remaining) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLvoid *pointer = (GLvoid *) 0; @@ -2133,16 +2563,23 @@ android_glTexEnvi__III static void android_glTexEnviv__II_3II (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLint *params_base = (GLint *) 0; jint _remaining; GLint *params = (GLint *) 0; if (!params_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -2169,7 +2606,9 @@ android_glTexEnviv__II_3II break; } if (_remaining < _needed) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < needed"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < needed"; goto exit; } params_base = (GLint *) @@ -2187,17 +2626,24 @@ android_glTexEnviv__II_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glTexEnviv ( GLenum target, GLenum pname, const GLint *params ) */ static void android_glTexEnviv__IILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLint *params = (GLint *) 0; - params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); int _needed; switch (pname) { #if defined(GL_TEXTURE_ENV_MODE) @@ -2221,9 +2667,15 @@ android_glTexEnviv__IILjava_nio_IntBuffer_2 break; } if (_remaining < _needed) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < needed"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < needed"; goto exit; } + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLint *) (_paramsBase + _bufferOffset); + } glTexEnviv( (GLenum)target, (GLenum)pname, @@ -2234,27 +2686,39 @@ android_glTexEnviv__IILjava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, params, JNI_FALSE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params ) */ static void android_glTexParameterfv__II_3FI (JNIEnv *_env, jobject _this, jint target, jint pname, jfloatArray params_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfloat *params_base = (GLfloat *) 0; jint _remaining; GLfloat *params = (GLfloat *) 0; if (!params_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; if (_remaining < 1) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < 1"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < 1 < needed"; goto exit; } params_base = (GLfloat *) @@ -2272,21 +2736,34 @@ android_glTexParameterfv__II_3FI _env->ReleasePrimitiveArrayCritical(params_ref, params_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params ) */ static void android_glTexParameterfv__IILjava_nio_FloatBuffer_2 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfloat *params = (GLfloat *) 0; - params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < 1) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < 1"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < 1 < needed"; goto exit; } + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfloat *) (_paramsBase + _bufferOffset); + } glTexParameterfv( (GLenum)target, (GLenum)pname, @@ -2297,6 +2774,9 @@ android_glTexParameterfv__IILjava_nio_FloatBuffer_2 if (_array) { releasePointer(_env, _array, params, JNI_FALSE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glTexParameteri ( GLenum target, GLenum pname, GLint param ) */ @@ -2314,21 +2794,30 @@ android_glTexParameteri__III static void android_glTexParameteriv__II_3II (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLint *params_base = (GLint *) 0; jint _remaining; GLint *params = (GLint *) 0; if (!params_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; if (_remaining < 1) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < 1"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < 1 < needed"; goto exit; } params_base = (GLint *) @@ -2346,21 +2835,34 @@ android_glTexParameteriv__II_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params ) */ static void android_glTexParameteriv__IILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLint *params = (GLint *) 0; - params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < 1) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < 1"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < 1 < needed"; goto exit; } + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLint *) (_paramsBase + _bufferOffset); + } glTexParameteriv( (GLenum)target, (GLenum)pname, @@ -2371,27 +2873,39 @@ android_glTexParameteriv__IILjava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, params, JNI_FALSE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glTexParameterxv ( GLenum target, GLenum pname, const GLfixed *params ) */ static void android_glTexParameterxv__II_3II (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfixed *params_base = (GLfixed *) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; if (!params_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; if (_remaining < 1) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < 1"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < 1 < needed"; goto exit; } params_base = (GLfixed *) @@ -2409,21 +2923,34 @@ android_glTexParameterxv__II_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glTexParameterxv ( GLenum target, GLenum pname, const GLfixed *params ) */ static void android_glTexParameterxv__IILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; - params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < 1) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < 1"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < 1 < needed"; goto exit; } + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfixed *) (_paramsBase + _bufferOffset); + } glTexParameterxv( (GLenum)target, (GLenum)pname, @@ -2434,6 +2961,9 @@ android_glTexParameterxv__IILjava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, params, JNI_FALSE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glVertexPointer ( GLint size, GLenum type, GLsizei stride, GLint offset ) */ diff --git a/core/jni/android_opengl_GLES11Ext.cpp b/core/jni/android_opengl_GLES11Ext.cpp index d6dc0fed1bdb6..073bbb26f555a 100644 --- a/core/jni/android_opengl_GLES11Ext.cpp +++ b/core/jni/android_opengl_GLES11Ext.cpp @@ -72,14 +72,12 @@ nativeClassInit(JNIEnv *_env, jclass glImplClass) static void * -getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining) +getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining, jint *offset) { jint position; jint limit; jint elementSizeShift; jlong pointer; - jint offset; - void *data; position = _env->GetIntField(buffer, positionID); limit = _env->GetIntField(buffer, limitID); @@ -94,11 +92,9 @@ getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining) *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass, getBaseArrayID, buffer); - offset = _env->CallStaticIntMethod(nioAccessClass, + *offset = _env->CallStaticIntMethod(nioAccessClass, getBaseArrayOffsetID, buffer); - data = _env->GetPrimitiveArrayCritical(*array, (jboolean *) 0); - - return (void *) ((char *) data + offset); + return NULL; } @@ -197,21 +193,30 @@ android_glDrawTexxOES__IIIII static void android_glDrawTexsvOES___3SI (JNIEnv *_env, jobject _this, jshortArray coords_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLshort *coords_base = (GLshort *) 0; jint _remaining; GLshort *coords = (GLshort *) 0; if (!coords_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "coords == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "coords == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(coords_ref) - offset; if (_remaining < 5) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < 5"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < 5 < needed"; goto exit; } coords_base = (GLshort *) @@ -227,21 +232,34 @@ android_glDrawTexsvOES___3SI _env->ReleasePrimitiveArrayCritical(coords_ref, coords_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glDrawTexsvOES ( const GLshort *coords ) */ static void android_glDrawTexsvOES__Ljava_nio_ShortBuffer_2 (JNIEnv *_env, jobject _this, jobject coords_buf) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLshort *coords = (GLshort *) 0; - coords = (GLshort *)getPointer(_env, coords_buf, &_array, &_remaining); + coords = (GLshort *)getPointer(_env, coords_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < 5) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < 5"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < 5 < needed"; goto exit; } + if (coords == NULL) { + char * _coordsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + coords = (GLshort *) (_coordsBase + _bufferOffset); + } glDrawTexsvOES( (GLshort *)coords ); @@ -250,27 +268,39 @@ android_glDrawTexsvOES__Ljava_nio_ShortBuffer_2 if (_array) { releasePointer(_env, _array, coords, JNI_FALSE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glDrawTexivOES ( const GLint *coords ) */ static void android_glDrawTexivOES___3II (JNIEnv *_env, jobject _this, jintArray coords_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLint *coords_base = (GLint *) 0; jint _remaining; GLint *coords = (GLint *) 0; if (!coords_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "coords == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "coords == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(coords_ref) - offset; if (_remaining < 5) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < 5"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < 5 < needed"; goto exit; } coords_base = (GLint *) @@ -286,21 +316,34 @@ android_glDrawTexivOES___3II _env->ReleasePrimitiveArrayCritical(coords_ref, coords_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glDrawTexivOES ( const GLint *coords ) */ static void android_glDrawTexivOES__Ljava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jobject coords_buf) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLint *coords = (GLint *) 0; - coords = (GLint *)getPointer(_env, coords_buf, &_array, &_remaining); + coords = (GLint *)getPointer(_env, coords_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < 5) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < 5"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < 5 < needed"; goto exit; } + if (coords == NULL) { + char * _coordsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + coords = (GLint *) (_coordsBase + _bufferOffset); + } glDrawTexivOES( (GLint *)coords ); @@ -309,27 +352,39 @@ android_glDrawTexivOES__Ljava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, coords, JNI_FALSE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glDrawTexxvOES ( const GLfixed *coords ) */ static void android_glDrawTexxvOES___3II (JNIEnv *_env, jobject _this, jintArray coords_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfixed *coords_base = (GLfixed *) 0; jint _remaining; GLfixed *coords = (GLfixed *) 0; if (!coords_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "coords == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "coords == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(coords_ref) - offset; if (_remaining < 5) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < 5"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < 5 < needed"; goto exit; } coords_base = (GLfixed *) @@ -345,21 +400,34 @@ android_glDrawTexxvOES___3II _env->ReleasePrimitiveArrayCritical(coords_ref, coords_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glDrawTexxvOES ( const GLfixed *coords ) */ static void android_glDrawTexxvOES__Ljava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jobject coords_buf) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfixed *coords = (GLfixed *) 0; - coords = (GLfixed *)getPointer(_env, coords_buf, &_array, &_remaining); + coords = (GLfixed *)getPointer(_env, coords_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < 5) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < 5"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < 5 < needed"; goto exit; } + if (coords == NULL) { + char * _coordsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + coords = (GLfixed *) (_coordsBase + _bufferOffset); + } glDrawTexxvOES( (GLfixed *)coords ); @@ -368,6 +436,9 @@ android_glDrawTexxvOES__Ljava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, coords, JNI_FALSE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glDrawTexfOES ( GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height ) */ @@ -387,21 +458,30 @@ android_glDrawTexfOES__FFFFF static void android_glDrawTexfvOES___3FI (JNIEnv *_env, jobject _this, jfloatArray coords_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfloat *coords_base = (GLfloat *) 0; jint _remaining; GLfloat *coords = (GLfloat *) 0; if (!coords_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "coords == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "coords == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(coords_ref) - offset; if (_remaining < 5) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < 5"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < 5 < needed"; goto exit; } coords_base = (GLfloat *) @@ -417,21 +497,34 @@ android_glDrawTexfvOES___3FI _env->ReleasePrimitiveArrayCritical(coords_ref, coords_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glDrawTexfvOES ( const GLfloat *coords ) */ static void android_glDrawTexfvOES__Ljava_nio_FloatBuffer_2 (JNIEnv *_env, jobject _this, jobject coords_buf) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfloat *coords = (GLfloat *) 0; - coords = (GLfloat *)getPointer(_env, coords_buf, &_array, &_remaining); + coords = (GLfloat *)getPointer(_env, coords_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < 5) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < 5"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < 5 < needed"; goto exit; } + if (coords == NULL) { + char * _coordsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + coords = (GLfloat *) (_coordsBase + _bufferOffset); + } glDrawTexfvOES( (GLfloat *)coords ); @@ -440,24 +533,31 @@ android_glDrawTexfvOES__Ljava_nio_FloatBuffer_2 if (_array) { releasePointer(_env, _array, coords, JNI_FALSE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glEGLImageTargetTexture2DOES ( GLenum target, GLeglImageOES image ) */ static void android_glEGLImageTargetTexture2DOES__ILjava_nio_Buffer_2 (JNIEnv *_env, jobject _this, jint target, jobject image_buf) { - jint _exception = 0; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLeglImageOES image = (GLeglImageOES) 0; - image = (GLeglImageOES)getPointer(_env, image_buf, &_array, &_remaining); + image = (GLeglImageOES)getPointer(_env, image_buf, &_array, &_remaining, &_bufferOffset); + if (image == NULL) { + char * _imageBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + image = (GLeglImageOES) (_imageBase + _bufferOffset); + } glEGLImageTargetTexture2DOES( (GLenum)target, (GLeglImageOES)image ); if (_array) { - releasePointer(_env, _array, image, _exception ? JNI_FALSE : JNI_TRUE); + releasePointer(_env, _array, image, JNI_TRUE); } } @@ -465,18 +565,22 @@ android_glEGLImageTargetTexture2DOES__ILjava_nio_Buffer_2 static void android_glEGLImageTargetRenderbufferStorageOES__ILjava_nio_Buffer_2 (JNIEnv *_env, jobject _this, jint target, jobject image_buf) { - jint _exception = 0; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLeglImageOES image = (GLeglImageOES) 0; - image = (GLeglImageOES)getPointer(_env, image_buf, &_array, &_remaining); + image = (GLeglImageOES)getPointer(_env, image_buf, &_array, &_remaining, &_bufferOffset); + if (image == NULL) { + char * _imageBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + image = (GLeglImageOES) (_imageBase + _bufferOffset); + } glEGLImageTargetRenderbufferStorageOES( (GLenum)target, (GLeglImageOES)image ); if (_array) { - releasePointer(_env, _array, image, _exception ? JNI_FALSE : JNI_TRUE); + releasePointer(_env, _array, image, JNI_TRUE); } } @@ -515,16 +619,23 @@ android_glClearDepthxOES__I static void android_glClipPlanexOES__I_3II (JNIEnv *_env, jobject _this, jint plane, jintArray equation_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfixed *equation_base = (GLfixed *) 0; jint _remaining; GLfixed *equation = (GLfixed *) 0; if (!equation_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "equation == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "equation == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(equation_ref) - offset; @@ -542,6 +653,9 @@ android_glClipPlanexOES__I_3II _env->ReleasePrimitiveArrayCritical(equation_ref, equation_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glClipPlanexOES ( GLenum plane, const GLfixed *equation ) */ @@ -549,10 +663,15 @@ static void android_glClipPlanexOES__ILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint plane, jobject equation_buf) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfixed *equation = (GLfixed *) 0; - equation = (GLfixed *)getPointer(_env, equation_buf, &_array, &_remaining); + equation = (GLfixed *)getPointer(_env, equation_buf, &_array, &_remaining, &_bufferOffset); + if (equation == NULL) { + char * _equationBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + equation = (GLfixed *) (_equationBase + _bufferOffset); + } glClipPlanexOES( (GLenum)plane, (GLfixed *)equation @@ -598,16 +717,23 @@ android_glFogxOES__II static void android_glFogxvOES__I_3II (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfixed *params_base = (GLfixed *) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; if (!params_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -625,6 +751,9 @@ android_glFogxvOES__I_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glFogxvOES ( GLenum pname, const GLfixed *params ) */ @@ -632,10 +761,15 @@ static void android_glFogxvOES__ILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; - params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfixed *) (_paramsBase + _bufferOffset); + } glFogxvOES( (GLenum)pname, (GLfixed *)params @@ -664,24 +798,29 @@ static void android_glGetClipPlanexOES__I_3II (JNIEnv *_env, jobject _this, jint pname, jintArray eqn_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfixed *eqn_base = (GLfixed *) 0; jint _remaining; GLfixed *eqn = (GLfixed *) 0; if (!eqn_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "eqn == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "eqn == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(eqn_ref) - offset; if (_remaining < 4) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < 4"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < 4 < needed"; goto exit; } eqn_base = (GLfixed *) @@ -698,6 +837,9 @@ android_glGetClipPlanexOES__I_3II _env->ReleasePrimitiveArrayCritical(eqn_ref, eqn_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetClipPlanexOES ( GLenum pname, GLfixed *eqn ) */ @@ -705,16 +847,24 @@ static void android_glGetClipPlanexOES__ILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint pname, jobject eqn_buf) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfixed *eqn = (GLfixed *) 0; - eqn = (GLfixed *)getPointer(_env, eqn_buf, &_array, &_remaining); + eqn = (GLfixed *)getPointer(_env, eqn_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < 4) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < 4"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < 4 < needed"; goto exit; } + if (eqn == NULL) { + char * _eqnBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + eqn = (GLfixed *) (_eqnBase + _bufferOffset); + } glGetClipPlanexOES( (GLenum)pname, (GLfixed *)eqn @@ -724,6 +874,9 @@ android_glGetClipPlanexOES__ILjava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, eqn, _exception ? JNI_FALSE : JNI_TRUE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetFixedvOES ( GLenum pname, GLfixed *params ) */ @@ -731,18 +884,22 @@ static void android_glGetFixedvOES__I_3II (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfixed *params_base = (GLfixed *) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; if (!params_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -760,24 +917,31 @@ android_glGetFixedvOES__I_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetFixedvOES ( GLenum pname, GLfixed *params ) */ static void android_glGetFixedvOES__ILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { - jint _exception = 0; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; - params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfixed *) (_paramsBase + _bufferOffset); + } glGetFixedvOES( (GLenum)pname, (GLfixed *)params ); if (_array) { - releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + releasePointer(_env, _array, params, JNI_TRUE); } } @@ -786,18 +950,22 @@ static void android_glGetLightxvOES__II_3II (JNIEnv *_env, jobject _this, jint light, jint pname, jintArray params_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfixed *params_base = (GLfixed *) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; if (!params_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -816,25 +984,32 @@ android_glGetLightxvOES__II_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetLightxvOES ( GLenum light, GLenum pname, GLfixed *params ) */ static void android_glGetLightxvOES__IILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint light, jint pname, jobject params_buf) { - jint _exception = 0; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; - params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfixed *) (_paramsBase + _bufferOffset); + } glGetLightxvOES( (GLenum)light, (GLenum)pname, (GLfixed *)params ); if (_array) { - releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + releasePointer(_env, _array, params, JNI_TRUE); } } @@ -843,18 +1018,22 @@ static void android_glGetMaterialxvOES__II_3II (JNIEnv *_env, jobject _this, jint face, jint pname, jintArray params_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfixed *params_base = (GLfixed *) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; if (!params_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -873,25 +1052,32 @@ android_glGetMaterialxvOES__II_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetMaterialxvOES ( GLenum face, GLenum pname, GLfixed *params ) */ static void android_glGetMaterialxvOES__IILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint face, jint pname, jobject params_buf) { - jint _exception = 0; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; - params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfixed *) (_paramsBase + _bufferOffset); + } glGetMaterialxvOES( (GLenum)face, (GLenum)pname, (GLfixed *)params ); if (_array) { - releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + releasePointer(_env, _array, params, JNI_TRUE); } } @@ -900,18 +1086,22 @@ static void android_glGetTexEnvxvOES__II_3II (JNIEnv *_env, jobject _this, jint env, jint pname, jintArray params_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfixed *params_base = (GLfixed *) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; if (!params_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -930,25 +1120,32 @@ android_glGetTexEnvxvOES__II_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetTexEnvxvOES ( GLenum env, GLenum pname, GLfixed *params ) */ static void android_glGetTexEnvxvOES__IILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint env, jint pname, jobject params_buf) { - jint _exception = 0; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; - params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfixed *) (_paramsBase + _bufferOffset); + } glGetTexEnvxvOES( (GLenum)env, (GLenum)pname, (GLfixed *)params ); if (_array) { - releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + releasePointer(_env, _array, params, JNI_TRUE); } } @@ -957,18 +1154,22 @@ static void android_glGetTexParameterxvOES__II_3II (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfixed *params_base = (GLfixed *) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; if (!params_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -987,25 +1188,32 @@ android_glGetTexParameterxvOES__II_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetTexParameterxvOES ( GLenum target, GLenum pname, GLfixed *params ) */ static void android_glGetTexParameterxvOES__IILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { - jint _exception = 0; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; - params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfixed *) (_paramsBase + _bufferOffset); + } glGetTexParameterxvOES( (GLenum)target, (GLenum)pname, (GLfixed *)params ); if (_array) { - releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + releasePointer(_env, _array, params, JNI_TRUE); } } @@ -1023,16 +1231,23 @@ android_glLightModelxOES__II static void android_glLightModelxvOES__I_3II (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfixed *params_base = (GLfixed *) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; if (!params_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -1050,6 +1265,9 @@ android_glLightModelxvOES__I_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glLightModelxvOES ( GLenum pname, const GLfixed *params ) */ @@ -1057,10 +1275,15 @@ static void android_glLightModelxvOES__ILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; - params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfixed *) (_paramsBase + _bufferOffset); + } glLightModelxvOES( (GLenum)pname, (GLfixed *)params @@ -1085,16 +1308,23 @@ android_glLightxOES__III static void android_glLightxvOES__II_3II (JNIEnv *_env, jobject _this, jint light, jint pname, jintArray params_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfixed *params_base = (GLfixed *) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; if (!params_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -1113,6 +1343,9 @@ android_glLightxvOES__II_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glLightxvOES ( GLenum light, GLenum pname, const GLfixed *params ) */ @@ -1120,10 +1353,15 @@ static void android_glLightxvOES__IILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint light, jint pname, jobject params_buf) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; - params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfixed *) (_paramsBase + _bufferOffset); + } glLightxvOES( (GLenum)light, (GLenum)pname, @@ -1147,16 +1385,23 @@ android_glLineWidthxOES__I static void android_glLoadMatrixxOES___3II (JNIEnv *_env, jobject _this, jintArray m_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfixed *m_base = (GLfixed *) 0; jint _remaining; GLfixed *m = (GLfixed *) 0; if (!m_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "m == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "m == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(m_ref) - offset; @@ -1173,6 +1418,9 @@ android_glLoadMatrixxOES___3II _env->ReleasePrimitiveArrayCritical(m_ref, m_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glLoadMatrixxOES ( const GLfixed *m ) */ @@ -1180,10 +1428,15 @@ static void android_glLoadMatrixxOES__Ljava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jobject m_buf) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfixed *m = (GLfixed *) 0; - m = (GLfixed *)getPointer(_env, m_buf, &_array, &_remaining); + m = (GLfixed *)getPointer(_env, m_buf, &_array, &_remaining, &_bufferOffset); + if (m == NULL) { + char * _mBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + m = (GLfixed *) (_mBase + _bufferOffset); + } glLoadMatrixxOES( (GLfixed *)m ); @@ -1207,16 +1460,23 @@ android_glMaterialxOES__III static void android_glMaterialxvOES__II_3II (JNIEnv *_env, jobject _this, jint face, jint pname, jintArray params_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfixed *params_base = (GLfixed *) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; if (!params_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -1235,6 +1495,9 @@ android_glMaterialxvOES__II_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glMaterialxvOES ( GLenum face, GLenum pname, const GLfixed *params ) */ @@ -1242,10 +1505,15 @@ static void android_glMaterialxvOES__IILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint face, jint pname, jobject params_buf) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; - params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfixed *) (_paramsBase + _bufferOffset); + } glMaterialxvOES( (GLenum)face, (GLenum)pname, @@ -1260,16 +1528,23 @@ android_glMaterialxvOES__IILjava_nio_IntBuffer_2 static void android_glMultMatrixxOES___3II (JNIEnv *_env, jobject _this, jintArray m_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfixed *m_base = (GLfixed *) 0; jint _remaining; GLfixed *m = (GLfixed *) 0; if (!m_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "m == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "m == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(m_ref) - offset; @@ -1286,6 +1561,9 @@ android_glMultMatrixxOES___3II _env->ReleasePrimitiveArrayCritical(m_ref, m_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glMultMatrixxOES ( const GLfixed *m ) */ @@ -1293,10 +1571,15 @@ static void android_glMultMatrixxOES__Ljava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jobject m_buf) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfixed *m = (GLfixed *) 0; - m = (GLfixed *)getPointer(_env, m_buf, &_array, &_remaining); + m = (GLfixed *)getPointer(_env, m_buf, &_array, &_remaining, &_bufferOffset); + if (m == NULL) { + char * _mBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + m = (GLfixed *) (_mBase + _bufferOffset); + } glMultMatrixxOES( (GLfixed *)m ); @@ -1357,16 +1640,23 @@ android_glPointParameterxOES__II static void android_glPointParameterxvOES__I_3II (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfixed *params_base = (GLfixed *) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; if (!params_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -1384,6 +1674,9 @@ android_glPointParameterxvOES__I_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glPointParameterxvOES ( GLenum pname, const GLfixed *params ) */ @@ -1391,10 +1684,15 @@ static void android_glPointParameterxvOES__ILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; - params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfixed *) (_paramsBase + _bufferOffset); + } glPointParameterxvOES( (GLenum)pname, (GLfixed *)params @@ -1471,16 +1769,23 @@ android_glTexEnvxOES__III static void android_glTexEnvxvOES__II_3II (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfixed *params_base = (GLfixed *) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; if (!params_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -1499,6 +1804,9 @@ android_glTexEnvxvOES__II_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glTexEnvxvOES ( GLenum target, GLenum pname, const GLfixed *params ) */ @@ -1506,10 +1814,15 @@ static void android_glTexEnvxvOES__IILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; - params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfixed *) (_paramsBase + _bufferOffset); + } glTexEnvxvOES( (GLenum)target, (GLenum)pname, @@ -1535,16 +1848,23 @@ android_glTexParameterxOES__III static void android_glTexParameterxvOES__II_3II (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfixed *params_base = (GLfixed *) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; if (!params_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -1563,6 +1883,9 @@ android_glTexParameterxvOES__II_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glTexParameterxvOES ( GLenum target, GLenum pname, const GLfixed *params ) */ @@ -1570,10 +1893,15 @@ static void android_glTexParameterxvOES__IILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; - params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfixed *) (_paramsBase + _bufferOffset); + } glTexParameterxvOES( (GLenum)target, (GLenum)pname, @@ -1620,21 +1948,30 @@ android_glBindRenderbufferOES__II static void android_glDeleteRenderbuffersOES__I_3II (JNIEnv *_env, jobject _this, jint n, jintArray renderbuffers_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLuint *renderbuffers_base = (GLuint *) 0; jint _remaining; GLuint *renderbuffers = (GLuint *) 0; if (!renderbuffers_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "renderbuffers == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "renderbuffers == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(renderbuffers_ref) - offset; if (_remaining < n) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < n"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < n < needed"; goto exit; } renderbuffers_base = (GLuint *) @@ -1651,21 +1988,34 @@ android_glDeleteRenderbuffersOES__I_3II _env->ReleasePrimitiveArrayCritical(renderbuffers_ref, renderbuffers_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glDeleteRenderbuffersOES ( GLsizei n, const GLuint *renderbuffers ) */ static void android_glDeleteRenderbuffersOES__ILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint n, jobject renderbuffers_buf) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLuint *renderbuffers = (GLuint *) 0; - renderbuffers = (GLuint *)getPointer(_env, renderbuffers_buf, &_array, &_remaining); + renderbuffers = (GLuint *)getPointer(_env, renderbuffers_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < n) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < n"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < n < needed"; goto exit; } + if (renderbuffers == NULL) { + char * _renderbuffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + renderbuffers = (GLuint *) (_renderbuffersBase + _bufferOffset); + } glDeleteRenderbuffersOES( (GLsizei)n, (GLuint *)renderbuffers @@ -1675,6 +2025,9 @@ android_glDeleteRenderbuffersOES__ILjava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, renderbuffers, JNI_FALSE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGenRenderbuffersOES ( GLsizei n, GLuint *renderbuffers ) */ @@ -1682,24 +2035,29 @@ static void android_glGenRenderbuffersOES__I_3II (JNIEnv *_env, jobject _this, jint n, jintArray renderbuffers_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLuint *renderbuffers_base = (GLuint *) 0; jint _remaining; GLuint *renderbuffers = (GLuint *) 0; if (!renderbuffers_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "renderbuffers == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "renderbuffers == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(renderbuffers_ref) - offset; if (_remaining < n) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < n"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < n < needed"; goto exit; } renderbuffers_base = (GLuint *) @@ -1716,6 +2074,9 @@ android_glGenRenderbuffersOES__I_3II _env->ReleasePrimitiveArrayCritical(renderbuffers_ref, renderbuffers_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGenRenderbuffersOES ( GLsizei n, GLuint *renderbuffers ) */ @@ -1723,16 +2084,24 @@ static void android_glGenRenderbuffersOES__ILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint n, jobject renderbuffers_buf) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLuint *renderbuffers = (GLuint *) 0; - renderbuffers = (GLuint *)getPointer(_env, renderbuffers_buf, &_array, &_remaining); + renderbuffers = (GLuint *)getPointer(_env, renderbuffers_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < n) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < n"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < n < needed"; goto exit; } + if (renderbuffers == NULL) { + char * _renderbuffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + renderbuffers = (GLuint *) (_renderbuffersBase + _bufferOffset); + } glGenRenderbuffersOES( (GLsizei)n, (GLuint *)renderbuffers @@ -1742,6 +2111,9 @@ android_glGenRenderbuffersOES__ILjava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, renderbuffers, _exception ? JNI_FALSE : JNI_TRUE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glRenderbufferStorageOES ( GLenum target, GLenum internalformat, GLsizei width, GLsizei height ) */ @@ -1761,24 +2133,29 @@ static void android_glGetRenderbufferParameterivOES__II_3II (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLint *params_base = (GLint *) 0; jint _remaining; GLint *params = (GLint *) 0; if (!params_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; if (_remaining < 1) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < 1"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < 1 < needed"; goto exit; } params_base = (GLint *) @@ -1796,6 +2173,9 @@ android_glGetRenderbufferParameterivOES__II_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetRenderbufferParameterivOES ( GLenum target, GLenum pname, GLint *params ) */ @@ -1803,16 +2183,24 @@ static void android_glGetRenderbufferParameterivOES__IILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLint *params = (GLint *) 0; - params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < 1) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < 1"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < 1 < needed"; goto exit; } + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLint *) (_paramsBase + _bufferOffset); + } glGetRenderbufferParameterivOES( (GLenum)target, (GLenum)pname, @@ -1823,6 +2211,9 @@ android_glGetRenderbufferParameterivOES__IILjava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* GLboolean glIsFramebufferOES ( GLuint framebuffer ) */ @@ -1850,21 +2241,30 @@ android_glBindFramebufferOES__II static void android_glDeleteFramebuffersOES__I_3II (JNIEnv *_env, jobject _this, jint n, jintArray framebuffers_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLuint *framebuffers_base = (GLuint *) 0; jint _remaining; GLuint *framebuffers = (GLuint *) 0; if (!framebuffers_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "framebuffers == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "framebuffers == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(framebuffers_ref) - offset; if (_remaining < n) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < n"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < n < needed"; goto exit; } framebuffers_base = (GLuint *) @@ -1881,21 +2281,34 @@ android_glDeleteFramebuffersOES__I_3II _env->ReleasePrimitiveArrayCritical(framebuffers_ref, framebuffers_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glDeleteFramebuffersOES ( GLsizei n, const GLuint *framebuffers ) */ static void android_glDeleteFramebuffersOES__ILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint n, jobject framebuffers_buf) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLuint *framebuffers = (GLuint *) 0; - framebuffers = (GLuint *)getPointer(_env, framebuffers_buf, &_array, &_remaining); + framebuffers = (GLuint *)getPointer(_env, framebuffers_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < n) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < n"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < n < needed"; goto exit; } + if (framebuffers == NULL) { + char * _framebuffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + framebuffers = (GLuint *) (_framebuffersBase + _bufferOffset); + } glDeleteFramebuffersOES( (GLsizei)n, (GLuint *)framebuffers @@ -1905,6 +2318,9 @@ android_glDeleteFramebuffersOES__ILjava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, framebuffers, JNI_FALSE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGenFramebuffersOES ( GLsizei n, GLuint *framebuffers ) */ @@ -1912,24 +2328,29 @@ static void android_glGenFramebuffersOES__I_3II (JNIEnv *_env, jobject _this, jint n, jintArray framebuffers_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLuint *framebuffers_base = (GLuint *) 0; jint _remaining; GLuint *framebuffers = (GLuint *) 0; if (!framebuffers_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "framebuffers == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "framebuffers == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(framebuffers_ref) - offset; if (_remaining < n) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < n"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < n < needed"; goto exit; } framebuffers_base = (GLuint *) @@ -1946,6 +2367,9 @@ android_glGenFramebuffersOES__I_3II _env->ReleasePrimitiveArrayCritical(framebuffers_ref, framebuffers_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGenFramebuffersOES ( GLsizei n, GLuint *framebuffers ) */ @@ -1953,16 +2377,24 @@ static void android_glGenFramebuffersOES__ILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint n, jobject framebuffers_buf) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLuint *framebuffers = (GLuint *) 0; - framebuffers = (GLuint *)getPointer(_env, framebuffers_buf, &_array, &_remaining); + framebuffers = (GLuint *)getPointer(_env, framebuffers_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < n) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < n"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < n < needed"; goto exit; } + if (framebuffers == NULL) { + char * _framebuffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + framebuffers = (GLuint *) (_framebuffersBase + _bufferOffset); + } glGenFramebuffersOES( (GLsizei)n, (GLuint *)framebuffers @@ -1972,6 +2404,9 @@ android_glGenFramebuffersOES__ILjava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, framebuffers, _exception ? JNI_FALSE : JNI_TRUE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* GLenum glCheckFramebufferStatusOES ( GLenum target ) */ @@ -2015,24 +2450,29 @@ static void android_glGetFramebufferAttachmentParameterivOES__III_3II (JNIEnv *_env, jobject _this, jint target, jint attachment, jint pname, jintArray params_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLint *params_base = (GLint *) 0; jint _remaining; GLint *params = (GLint *) 0; if (!params_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; if (_remaining < 1) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < 1"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < 1 < needed"; goto exit; } params_base = (GLint *) @@ -2051,6 +2491,9 @@ android_glGetFramebufferAttachmentParameterivOES__III_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetFramebufferAttachmentParameterivOES ( GLenum target, GLenum attachment, GLenum pname, GLint *params ) */ @@ -2058,16 +2501,24 @@ static void android_glGetFramebufferAttachmentParameterivOES__IIILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint target, jint attachment, jint pname, jobject params_buf) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLint *params = (GLint *) 0; - params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < 1) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < 1"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < 1 < needed"; goto exit; } + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLint *) (_paramsBase + _bufferOffset); + } glGetFramebufferAttachmentParameterivOES( (GLenum)target, (GLenum)attachment, @@ -2079,6 +2530,9 @@ android_glGetFramebufferAttachmentParameterivOES__IIILjava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGenerateMipmapOES ( GLenum target ) */ @@ -2111,6 +2565,7 @@ static void android_glMatrixIndexPointerOESBounds__IIILjava_nio_Buffer_2I (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jobject pointer_buf, jint remaining) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLvoid *pointer = (GLvoid *) 0; @@ -2134,6 +2589,7 @@ static void android_glWeightPointerOESBounds__IIILjava_nio_Buffer_2I (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jobject pointer_buf, jint remaining) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLvoid *pointer = (GLvoid *) 0; @@ -2194,16 +2650,23 @@ android_glOrthofOES__FFFFFF static void android_glClipPlanefOES__I_3FI (JNIEnv *_env, jobject _this, jint plane, jfloatArray equation_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfloat *equation_base = (GLfloat *) 0; jint _remaining; GLfloat *equation = (GLfloat *) 0; if (!equation_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "equation == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "equation == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(equation_ref) - offset; @@ -2221,6 +2684,9 @@ android_glClipPlanefOES__I_3FI _env->ReleasePrimitiveArrayCritical(equation_ref, equation_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glClipPlanefOES ( GLenum plane, const GLfloat *equation ) */ @@ -2228,10 +2694,15 @@ static void android_glClipPlanefOES__ILjava_nio_FloatBuffer_2 (JNIEnv *_env, jobject _this, jint plane, jobject equation_buf) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfloat *equation = (GLfloat *) 0; - equation = (GLfloat *)getPointer(_env, equation_buf, &_array, &_remaining); + equation = (GLfloat *)getPointer(_env, equation_buf, &_array, &_remaining, &_bufferOffset); + if (equation == NULL) { + char * _equationBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + equation = (GLfloat *) (_equationBase + _bufferOffset); + } glClipPlanefOES( (GLenum)plane, (GLfloat *)equation @@ -2246,24 +2717,29 @@ static void android_glGetClipPlanefOES__I_3FI (JNIEnv *_env, jobject _this, jint pname, jfloatArray eqn_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfloat *eqn_base = (GLfloat *) 0; jint _remaining; GLfloat *eqn = (GLfloat *) 0; if (!eqn_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "eqn == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "eqn == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(eqn_ref) - offset; if (_remaining < 4) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < 4"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < 4 < needed"; goto exit; } eqn_base = (GLfloat *) @@ -2280,6 +2756,9 @@ android_glGetClipPlanefOES__I_3FI _env->ReleasePrimitiveArrayCritical(eqn_ref, eqn_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetClipPlanefOES ( GLenum pname, GLfloat *eqn ) */ @@ -2287,16 +2766,24 @@ static void android_glGetClipPlanefOES__ILjava_nio_FloatBuffer_2 (JNIEnv *_env, jobject _this, jint pname, jobject eqn_buf) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfloat *eqn = (GLfloat *) 0; - eqn = (GLfloat *)getPointer(_env, eqn_buf, &_array, &_remaining); + eqn = (GLfloat *)getPointer(_env, eqn_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < 4) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < 4"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < 4 < needed"; goto exit; } + if (eqn == NULL) { + char * _eqnBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + eqn = (GLfloat *) (_eqnBase + _bufferOffset); + } glGetClipPlanefOES( (GLenum)pname, (GLfloat *)eqn @@ -2306,6 +2793,9 @@ android_glGetClipPlanefOES__ILjava_nio_FloatBuffer_2 if (_array) { releasePointer(_env, _array, eqn, _exception ? JNI_FALSE : JNI_TRUE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glClearDepthfOES ( GLclampf depth ) */ @@ -2332,16 +2822,23 @@ android_glTexGenfOES__IIF static void android_glTexGenfvOES__II_3FI (JNIEnv *_env, jobject _this, jint coord, jint pname, jfloatArray params_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfloat *params_base = (GLfloat *) 0; jint _remaining; GLfloat *params = (GLfloat *) 0; if (!params_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -2360,6 +2857,9 @@ android_glTexGenfvOES__II_3FI _env->ReleasePrimitiveArrayCritical(params_ref, params_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glTexGenfvOES ( GLenum coord, GLenum pname, const GLfloat *params ) */ @@ -2367,10 +2867,15 @@ static void android_glTexGenfvOES__IILjava_nio_FloatBuffer_2 (JNIEnv *_env, jobject _this, jint coord, jint pname, jobject params_buf) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfloat *params = (GLfloat *) 0; - params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfloat *) (_paramsBase + _bufferOffset); + } glTexGenfvOES( (GLenum)coord, (GLenum)pname, @@ -2396,16 +2901,23 @@ android_glTexGeniOES__III static void android_glTexGenivOES__II_3II (JNIEnv *_env, jobject _this, jint coord, jint pname, jintArray params_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLint *params_base = (GLint *) 0; jint _remaining; GLint *params = (GLint *) 0; if (!params_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -2424,6 +2936,9 @@ android_glTexGenivOES__II_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glTexGenivOES ( GLenum coord, GLenum pname, const GLint *params ) */ @@ -2431,10 +2946,15 @@ static void android_glTexGenivOES__IILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint coord, jint pname, jobject params_buf) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLint *params = (GLint *) 0; - params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLint *) (_paramsBase + _bufferOffset); + } glTexGenivOES( (GLenum)coord, (GLenum)pname, @@ -2460,16 +2980,23 @@ android_glTexGenxOES__III static void android_glTexGenxvOES__II_3II (JNIEnv *_env, jobject _this, jint coord, jint pname, jintArray params_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfixed *params_base = (GLfixed *) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; if (!params_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -2488,6 +3015,9 @@ android_glTexGenxvOES__II_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glTexGenxvOES ( GLenum coord, GLenum pname, const GLfixed *params ) */ @@ -2495,10 +3025,15 @@ static void android_glTexGenxvOES__IILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint coord, jint pname, jobject params_buf) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; - params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfixed *) (_paramsBase + _bufferOffset); + } glTexGenxvOES( (GLenum)coord, (GLenum)pname, @@ -2514,18 +3049,22 @@ static void android_glGetTexGenfvOES__II_3FI (JNIEnv *_env, jobject _this, jint coord, jint pname, jfloatArray params_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfloat *params_base = (GLfloat *) 0; jint _remaining; GLfloat *params = (GLfloat *) 0; if (!params_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -2544,25 +3083,32 @@ android_glGetTexGenfvOES__II_3FI _env->ReleasePrimitiveArrayCritical(params_ref, params_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetTexGenfvOES ( GLenum coord, GLenum pname, GLfloat *params ) */ static void android_glGetTexGenfvOES__IILjava_nio_FloatBuffer_2 (JNIEnv *_env, jobject _this, jint coord, jint pname, jobject params_buf) { - jint _exception = 0; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfloat *params = (GLfloat *) 0; - params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfloat *) (_paramsBase + _bufferOffset); + } glGetTexGenfvOES( (GLenum)coord, (GLenum)pname, (GLfloat *)params ); if (_array) { - releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + releasePointer(_env, _array, params, JNI_TRUE); } } @@ -2571,18 +3117,22 @@ static void android_glGetTexGenivOES__II_3II (JNIEnv *_env, jobject _this, jint coord, jint pname, jintArray params_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLint *params_base = (GLint *) 0; jint _remaining; GLint *params = (GLint *) 0; if (!params_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -2601,25 +3151,32 @@ android_glGetTexGenivOES__II_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetTexGenivOES ( GLenum coord, GLenum pname, GLint *params ) */ static void android_glGetTexGenivOES__IILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint coord, jint pname, jobject params_buf) { - jint _exception = 0; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLint *params = (GLint *) 0; - params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLint *) (_paramsBase + _bufferOffset); + } glGetTexGenivOES( (GLenum)coord, (GLenum)pname, (GLint *)params ); if (_array) { - releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + releasePointer(_env, _array, params, JNI_TRUE); } } @@ -2628,18 +3185,22 @@ static void android_glGetTexGenxvOES__II_3II (JNIEnv *_env, jobject _this, jint coord, jint pname, jintArray params_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfixed *params_base = (GLfixed *) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; if (!params_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -2658,25 +3219,32 @@ android_glGetTexGenxvOES__II_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetTexGenxvOES ( GLenum coord, GLenum pname, GLfixed *params ) */ static void android_glGetTexGenxvOES__IILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint coord, jint pname, jobject params_buf) { - jint _exception = 0; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; - params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfixed *) (_paramsBase + _bufferOffset); + } glGetTexGenxvOES( (GLenum)coord, (GLenum)pname, (GLfixed *)params ); if (_array) { - releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + releasePointer(_env, _array, params, JNI_TRUE); } } diff --git a/core/jni/android_opengl_GLES20.cpp b/core/jni/android_opengl_GLES20.cpp index a53e4d7081ece..c5301172f548d 100644 --- a/core/jni/android_opengl_GLES20.cpp +++ b/core/jni/android_opengl_GLES20.cpp @@ -63,14 +63,12 @@ nativeClassInit(JNIEnv *_env, jclass glImplClass) static void * -getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining) +getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining, jint *offset) { jint position; jint limit; jint elementSizeShift; jlong pointer; - jint offset; - void *data; position = _env->GetIntField(buffer, positionID); limit = _env->GetIntField(buffer, limitID); @@ -85,11 +83,10 @@ getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining) *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass, getBaseArrayID, buffer); - offset = _env->CallStaticIntMethod(nioAccessClass, + *offset = _env->CallStaticIntMethod(nioAccessClass, getBaseArrayOffsetID, buffer); - data = _env->GetPrimitiveArrayCritical(*array, (jboolean *) 0); - return (void *) ((char *) data + offset); + return NULL; } @@ -150,10 +147,14 @@ android_glAttachShader__II static void android_glBindAttribLocation__IILjava_lang_String_2 (JNIEnv *_env, jobject _this, jint program, jint index, jstring name) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; const char* _nativename = 0; if (!name) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "name == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "name == null"; goto exit; } _nativename = _env->GetStringUTFChars(name, 0); @@ -169,6 +170,9 @@ android_glBindAttribLocation__IILjava_lang_String_2 _env->ReleaseStringUTFChars(name, _nativename); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glBindBuffer ( GLenum target, GLuint buffer ) */ @@ -268,17 +272,27 @@ android_glBlendFuncSeparate__IIII static void android_glBufferData__IILjava_nio_Buffer_2I (JNIEnv *_env, jobject _this, jint target, jint size, jobject data_buf, jint usage) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLvoid *data = (GLvoid *) 0; if (data_buf) { - data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining); + data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < size) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < size"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < size < needed"; goto exit; } } + if (data_buf && data == NULL) { + char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + data = (GLvoid *) (_dataBase + _bufferOffset); + } glBufferData( (GLenum)target, (GLsizeiptr)size, @@ -290,21 +304,34 @@ android_glBufferData__IILjava_nio_Buffer_2I if (_array) { releasePointer(_env, _array, data, JNI_FALSE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glBufferSubData ( GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data ) */ static void android_glBufferSubData__IIILjava_nio_Buffer_2 (JNIEnv *_env, jobject _this, jint target, jint offset, jint size, jobject data_buf) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLvoid *data = (GLvoid *) 0; - data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining); + data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < size) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < size"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < size < needed"; goto exit; } + if (data == NULL) { + char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + data = (GLvoid *) (_dataBase + _bufferOffset); + } glBufferSubData( (GLenum)target, (GLintptr)offset, @@ -316,6 +343,9 @@ android_glBufferSubData__IIILjava_nio_Buffer_2 if (_array) { releasePointer(_env, _array, data, JNI_FALSE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* GLenum glCheckFramebufferStatus ( GLenum target ) */ @@ -394,10 +424,15 @@ static void android_glCompressedTexImage2D__IIIIIIILjava_nio_Buffer_2 (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint width, jint height, jint border, jint imageSize, jobject data_buf) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLvoid *data = (GLvoid *) 0; - data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining); + data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining, &_bufferOffset); + if (data == NULL) { + char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + data = (GLvoid *) (_dataBase + _bufferOffset); + } glCompressedTexImage2D( (GLenum)target, (GLint)level, @@ -418,10 +453,15 @@ static void android_glCompressedTexSubImage2D__IIIIIIIILjava_nio_Buffer_2 (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint width, jint height, jint format, jint imageSize, jobject data_buf) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLvoid *data = (GLvoid *) 0; - data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining); + data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining, &_bufferOffset); + if (data == NULL) { + char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + data = (GLvoid *) (_dataBase + _bufferOffset); + } glCompressedTexSubImage2D( (GLenum)target, (GLint)level, @@ -503,21 +543,30 @@ android_glCullFace__I static void android_glDeleteBuffers__I_3II (JNIEnv *_env, jobject _this, jint n, jintArray buffers_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLuint *buffers_base = (GLuint *) 0; jint _remaining; GLuint *buffers = (GLuint *) 0; if (!buffers_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "buffers == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "buffers == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(buffers_ref) - offset; if (_remaining < n) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < n"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < n < needed"; goto exit; } buffers_base = (GLuint *) @@ -534,21 +583,34 @@ android_glDeleteBuffers__I_3II _env->ReleasePrimitiveArrayCritical(buffers_ref, buffers_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glDeleteBuffers ( GLsizei n, const GLuint *buffers ) */ static void android_glDeleteBuffers__ILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint n, jobject buffers_buf) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLuint *buffers = (GLuint *) 0; - buffers = (GLuint *)getPointer(_env, buffers_buf, &_array, &_remaining); + buffers = (GLuint *)getPointer(_env, buffers_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < n) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < n"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < n < needed"; goto exit; } + if (buffers == NULL) { + char * _buffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + buffers = (GLuint *) (_buffersBase + _bufferOffset); + } glDeleteBuffers( (GLsizei)n, (GLuint *)buffers @@ -558,22 +620,32 @@ android_glDeleteBuffers__ILjava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, buffers, JNI_FALSE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glDeleteFramebuffers ( GLsizei n, const GLuint *framebuffers ) */ static void android_glDeleteFramebuffers__I_3II (JNIEnv *_env, jobject _this, jint n, jintArray framebuffers_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLuint *framebuffers_base = (GLuint *) 0; jint _remaining; GLuint *framebuffers = (GLuint *) 0; if (!framebuffers_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "framebuffers == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "framebuffers == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(framebuffers_ref) - offset; @@ -591,6 +663,9 @@ android_glDeleteFramebuffers__I_3II _env->ReleasePrimitiveArrayCritical(framebuffers_ref, framebuffers_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glDeleteFramebuffers ( GLsizei n, const GLuint *framebuffers ) */ @@ -598,10 +673,15 @@ static void android_glDeleteFramebuffers__ILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint n, jobject framebuffers_buf) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLuint *framebuffers = (GLuint *) 0; - framebuffers = (GLuint *)getPointer(_env, framebuffers_buf, &_array, &_remaining); + framebuffers = (GLuint *)getPointer(_env, framebuffers_buf, &_array, &_remaining, &_bufferOffset); + if (framebuffers == NULL) { + char * _framebuffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + framebuffers = (GLuint *) (_framebuffersBase + _bufferOffset); + } glDeleteFramebuffers( (GLsizei)n, (GLuint *)framebuffers @@ -624,16 +704,23 @@ android_glDeleteProgram__I static void android_glDeleteRenderbuffers__I_3II (JNIEnv *_env, jobject _this, jint n, jintArray renderbuffers_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLuint *renderbuffers_base = (GLuint *) 0; jint _remaining; GLuint *renderbuffers = (GLuint *) 0; if (!renderbuffers_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "renderbuffers == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "renderbuffers == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(renderbuffers_ref) - offset; @@ -651,6 +738,9 @@ android_glDeleteRenderbuffers__I_3II _env->ReleasePrimitiveArrayCritical(renderbuffers_ref, renderbuffers_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glDeleteRenderbuffers ( GLsizei n, const GLuint *renderbuffers ) */ @@ -658,10 +748,15 @@ static void android_glDeleteRenderbuffers__ILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint n, jobject renderbuffers_buf) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLuint *renderbuffers = (GLuint *) 0; - renderbuffers = (GLuint *)getPointer(_env, renderbuffers_buf, &_array, &_remaining); + renderbuffers = (GLuint *)getPointer(_env, renderbuffers_buf, &_array, &_remaining, &_bufferOffset); + if (renderbuffers == NULL) { + char * _renderbuffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + renderbuffers = (GLuint *) (_renderbuffersBase + _bufferOffset); + } glDeleteRenderbuffers( (GLsizei)n, (GLuint *)renderbuffers @@ -684,21 +779,30 @@ android_glDeleteShader__I static void android_glDeleteTextures__I_3II (JNIEnv *_env, jobject _this, jint n, jintArray textures_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLuint *textures_base = (GLuint *) 0; jint _remaining; GLuint *textures = (GLuint *) 0; if (!textures_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "textures == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "textures == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(textures_ref) - offset; if (_remaining < n) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < n"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < n < needed"; goto exit; } textures_base = (GLuint *) @@ -715,21 +819,34 @@ android_glDeleteTextures__I_3II _env->ReleasePrimitiveArrayCritical(textures_ref, textures_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glDeleteTextures ( GLsizei n, const GLuint *textures ) */ static void android_glDeleteTextures__ILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint n, jobject textures_buf) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLuint *textures = (GLuint *) 0; - textures = (GLuint *)getPointer(_env, textures_buf, &_array, &_remaining); + textures = (GLuint *)getPointer(_env, textures_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < n) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < n"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < n < needed"; goto exit; } + if (textures == NULL) { + char * _texturesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + textures = (GLuint *) (_texturesBase + _bufferOffset); + } glDeleteTextures( (GLsizei)n, (GLuint *)textures @@ -739,6 +856,9 @@ android_glDeleteTextures__ILjava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, textures, JNI_FALSE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glDepthFunc ( GLenum func ) */ @@ -812,27 +932,43 @@ android_glDrawArrays__III static void android_glDrawElements__IIII (JNIEnv *_env, jobject _this, jint mode, jint count, jint type, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; glDrawElements( (GLenum)mode, (GLsizei)count, (GLenum)type, (const GLvoid *)offset ); + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glDrawElements ( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices ) */ static void android_glDrawElements__IIILjava_nio_Buffer_2 (JNIEnv *_env, jobject _this, jint mode, jint count, jint type, jobject indices_buf) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLvoid *indices = (GLvoid *) 0; - indices = (GLvoid *)getPointer(_env, indices_buf, &_array, &_remaining); + indices = (GLvoid *)getPointer(_env, indices_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < count) { - jniThrowException(_env, "java/lang/ArrayIndexOutOfBoundsException", "remaining() < count"); + _exception = 1; + _exceptionType = "java/lang/ArrayIndexOutOfBoundsException"; + _exceptionMessage = "remaining() < count < needed"; goto exit; } + if (indices == NULL) { + char * _indicesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + indices = (GLvoid *) (_indicesBase + _bufferOffset); + } glDrawElements( (GLenum)mode, (GLsizei)count, @@ -844,6 +980,9 @@ android_glDrawElements__IIILjava_nio_Buffer_2 if (_array) { releasePointer(_env, _array, indices, JNI_FALSE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glEnable ( GLenum cap ) */ @@ -917,24 +1056,29 @@ static void android_glGenBuffers__I_3II (JNIEnv *_env, jobject _this, jint n, jintArray buffers_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLuint *buffers_base = (GLuint *) 0; jint _remaining; GLuint *buffers = (GLuint *) 0; if (!buffers_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "buffers == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "buffers == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(buffers_ref) - offset; if (_remaining < n) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < n"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < n < needed"; goto exit; } buffers_base = (GLuint *) @@ -951,6 +1095,9 @@ android_glGenBuffers__I_3II _env->ReleasePrimitiveArrayCritical(buffers_ref, buffers_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGenBuffers ( GLsizei n, GLuint *buffers ) */ @@ -958,16 +1105,24 @@ static void android_glGenBuffers__ILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint n, jobject buffers_buf) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLuint *buffers = (GLuint *) 0; - buffers = (GLuint *)getPointer(_env, buffers_buf, &_array, &_remaining); + buffers = (GLuint *)getPointer(_env, buffers_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < n) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < n"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < n < needed"; goto exit; } + if (buffers == NULL) { + char * _buffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + buffers = (GLuint *) (_buffersBase + _bufferOffset); + } glGenBuffers( (GLsizei)n, (GLuint *)buffers @@ -977,6 +1132,9 @@ android_glGenBuffers__ILjava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, buffers, _exception ? JNI_FALSE : JNI_TRUE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGenerateMipmap ( GLenum target ) */ @@ -993,18 +1151,22 @@ static void android_glGenFramebuffers__I_3II (JNIEnv *_env, jobject _this, jint n, jintArray framebuffers_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLuint *framebuffers_base = (GLuint *) 0; jint _remaining; GLuint *framebuffers = (GLuint *) 0; if (!framebuffers_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "framebuffers == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "framebuffers == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(framebuffers_ref) - offset; @@ -1022,24 +1184,31 @@ android_glGenFramebuffers__I_3II _env->ReleasePrimitiveArrayCritical(framebuffers_ref, framebuffers_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGenFramebuffers ( GLsizei n, GLuint *framebuffers ) */ static void android_glGenFramebuffers__ILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint n, jobject framebuffers_buf) { - jint _exception = 0; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLuint *framebuffers = (GLuint *) 0; - framebuffers = (GLuint *)getPointer(_env, framebuffers_buf, &_array, &_remaining); + framebuffers = (GLuint *)getPointer(_env, framebuffers_buf, &_array, &_remaining, &_bufferOffset); + if (framebuffers == NULL) { + char * _framebuffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + framebuffers = (GLuint *) (_framebuffersBase + _bufferOffset); + } glGenFramebuffers( (GLsizei)n, (GLuint *)framebuffers ); if (_array) { - releasePointer(_env, _array, framebuffers, _exception ? JNI_FALSE : JNI_TRUE); + releasePointer(_env, _array, framebuffers, JNI_TRUE); } } @@ -1048,18 +1217,22 @@ static void android_glGenRenderbuffers__I_3II (JNIEnv *_env, jobject _this, jint n, jintArray renderbuffers_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLuint *renderbuffers_base = (GLuint *) 0; jint _remaining; GLuint *renderbuffers = (GLuint *) 0; if (!renderbuffers_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "renderbuffers == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "renderbuffers == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(renderbuffers_ref) - offset; @@ -1077,24 +1250,31 @@ android_glGenRenderbuffers__I_3II _env->ReleasePrimitiveArrayCritical(renderbuffers_ref, renderbuffers_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGenRenderbuffers ( GLsizei n, GLuint *renderbuffers ) */ static void android_glGenRenderbuffers__ILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint n, jobject renderbuffers_buf) { - jint _exception = 0; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLuint *renderbuffers = (GLuint *) 0; - renderbuffers = (GLuint *)getPointer(_env, renderbuffers_buf, &_array, &_remaining); + renderbuffers = (GLuint *)getPointer(_env, renderbuffers_buf, &_array, &_remaining, &_bufferOffset); + if (renderbuffers == NULL) { + char * _renderbuffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + renderbuffers = (GLuint *) (_renderbuffersBase + _bufferOffset); + } glGenRenderbuffers( (GLsizei)n, (GLuint *)renderbuffers ); if (_array) { - releasePointer(_env, _array, renderbuffers, _exception ? JNI_FALSE : JNI_TRUE); + releasePointer(_env, _array, renderbuffers, JNI_TRUE); } } @@ -1103,24 +1283,29 @@ static void android_glGenTextures__I_3II (JNIEnv *_env, jobject _this, jint n, jintArray textures_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLuint *textures_base = (GLuint *) 0; jint _remaining; GLuint *textures = (GLuint *) 0; if (!textures_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "textures == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "textures == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(textures_ref) - offset; if (_remaining < n) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < n"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < n < needed"; goto exit; } textures_base = (GLuint *) @@ -1137,6 +1322,9 @@ android_glGenTextures__I_3II _env->ReleasePrimitiveArrayCritical(textures_ref, textures_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGenTextures ( GLsizei n, GLuint *textures ) */ @@ -1144,16 +1332,24 @@ static void android_glGenTextures__ILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint n, jobject textures_buf) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLuint *textures = (GLuint *) 0; - textures = (GLuint *)getPointer(_env, textures_buf, &_array, &_remaining); + textures = (GLuint *)getPointer(_env, textures_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < n) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < n"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < n < needed"; goto exit; } + if (textures == NULL) { + char * _texturesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + textures = (GLuint *) (_texturesBase + _bufferOffset); + } glGenTextures( (GLsizei)n, (GLuint *)textures @@ -1163,6 +1359,9 @@ android_glGenTextures__ILjava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, textures, _exception ? JNI_FALSE : JNI_TRUE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */ @@ -1170,6 +1369,8 @@ static void android_glGetActiveAttrib__III_3II_3II_3II_3BI (JNIEnv *_env, jobject _this, jint program, jint index, jint bufsize, jintArray length_ref, jint lengthOffset, jintArray size_ref, jint sizeOffset, jintArray type_ref, jint typeOffset, jbyteArray name_ref, jint nameOffset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLsizei *length_base = (GLsizei *) 0; jint _lengthRemaining; GLsizei *length = (GLsizei *) 0; @@ -1185,12 +1386,14 @@ android_glGetActiveAttrib__III_3II_3II_3II_3BI if (!length_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "length == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length == null"; goto exit; } if (lengthOffset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "lengthOffset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "lengthOffset < 0"; goto exit; } _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset; @@ -1200,12 +1403,14 @@ android_glGetActiveAttrib__III_3II_3II_3II_3BI if (!size_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "size == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "size == null"; goto exit; } if (sizeOffset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "sizeOffset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "sizeOffset < 0"; goto exit; } _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset; @@ -1215,12 +1420,14 @@ android_glGetActiveAttrib__III_3II_3II_3II_3BI if (!type_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "type == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "type == null"; goto exit; } if (typeOffset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "typeOffset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "typeOffset < 0"; goto exit; } _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset; @@ -1230,12 +1437,14 @@ android_glGetActiveAttrib__III_3II_3II_3II_3BI if (!name_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "name == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "name == null"; goto exit; } if (nameOffset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "nameOffset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "nameOffset < 0"; goto exit; } _nameRemaining = _env->GetArrayLength(name_ref) - nameOffset; @@ -1270,16 +1479,21 @@ android_glGetActiveAttrib__III_3II_3II_3II_3BI _env->ReleasePrimitiveArrayCritical(length_ref, length_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */ static void android_glGetActiveAttrib__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B (JNIEnv *_env, jobject _this, jint program, jint index, jint bufsize, jobject length_buf, jobject size_buf, jobject type_buf, jbyte name) { - jint _exception = 0; jarray _lengthArray = (jarray) 0; + jint _lengthBufferOffset = (jint) 0; jarray _sizeArray = (jarray) 0; + jint _sizeBufferOffset = (jint) 0; jarray _typeArray = (jarray) 0; + jint _typeBufferOffset = (jint) 0; jint _lengthRemaining; GLsizei *length = (GLsizei *) 0; jint _sizeRemaining; @@ -1287,9 +1501,21 @@ android_glGetActiveAttrib__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_ni jint _typeRemaining; GLenum *type = (GLenum *) 0; - length = (GLsizei *)getPointer(_env, length_buf, &_lengthArray, &_lengthRemaining); - size = (GLint *)getPointer(_env, size_buf, &_sizeArray, &_sizeRemaining); - type = (GLenum *)getPointer(_env, type_buf, &_typeArray, &_typeRemaining); + length = (GLsizei *)getPointer(_env, length_buf, &_lengthArray, &_lengthRemaining, &_lengthBufferOffset); + size = (GLint *)getPointer(_env, size_buf, &_sizeArray, &_sizeRemaining, &_sizeBufferOffset); + type = (GLenum *)getPointer(_env, type_buf, &_typeArray, &_typeRemaining, &_typeBufferOffset); + if (length == NULL) { + char * _lengthBase = (char *)_env->GetPrimitiveArrayCritical(_lengthArray, (jboolean *) 0); + length = (GLsizei *) (_lengthBase + _lengthBufferOffset); + } + if (size == NULL) { + char * _sizeBase = (char *)_env->GetPrimitiveArrayCritical(_sizeArray, (jboolean *) 0); + size = (GLint *) (_sizeBase + _sizeBufferOffset); + } + if (type == NULL) { + char * _typeBase = (char *)_env->GetPrimitiveArrayCritical(_typeArray, (jboolean *) 0); + type = (GLenum *) (_typeBase + _typeBufferOffset); + } glGetActiveAttrib( (GLuint)program, (GLuint)index, @@ -1299,22 +1525,180 @@ android_glGetActiveAttrib__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_ni (GLenum *)type, (char *)name ); - if (_lengthArray) { - releasePointer(_env, _lengthArray, type, _exception ? JNI_FALSE : JNI_TRUE); + if (_typeArray) { + releasePointer(_env, _typeArray, type, JNI_TRUE); } if (_sizeArray) { - releasePointer(_env, _sizeArray, size, _exception ? JNI_FALSE : JNI_TRUE); + releasePointer(_env, _sizeArray, size, JNI_TRUE); } - if (_typeArray) { - releasePointer(_env, _typeArray, length, _exception ? JNI_FALSE : JNI_TRUE); + if (_lengthArray) { + releasePointer(_env, _lengthArray, length, JNI_TRUE); + } +} + +/* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */ +static jstring +android_glGetActiveAttrib1 + (JNIEnv *_env, jobject _this, jint program, jint index, jintArray size_ref, jint sizeOffset, jintArray type_ref, jint typeOffset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; + GLint *size_base = (GLint *) 0; + jint _sizeRemaining; + GLint *size = (GLint *) 0; + GLenum *type_base = (GLenum *) 0; + jint _typeRemaining; + GLenum *type = (GLenum *) 0; + + jstring result = 0; + + GLint len = 0; + glGetProgramiv((GLuint)program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &len); + if (!len) { + return _env->NewStringUTF(""); + } + char* buf = (char*) malloc(len); + + if (buf == NULL) { + jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory"); + return NULL; + } + if (!size_ref) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "size == null"; + goto exit; + } + if (sizeOffset < 0) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "sizeOffset < 0"; + goto exit; + } + _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset; + size_base = (GLint *) + _env->GetPrimitiveArrayCritical(size_ref, (jboolean *)0); + size = size_base + sizeOffset; + + if (!type_ref) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "type == null"; + goto exit; + } + if (typeOffset < 0) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "typeOffset < 0"; + goto exit; + } + _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset; + type_base = (GLenum *) + _env->GetPrimitiveArrayCritical(type_ref, (jboolean *)0); + type = type_base + typeOffset; + + glGetActiveAttrib( + (GLuint)program, + (GLuint)index, + (GLsizei)len, + NULL, + (GLint *)size, + (GLenum *)type, + (char *)buf + ); +exit: + if (type_base) { + _env->ReleasePrimitiveArrayCritical(type_ref, type_base, + _exception ? JNI_ABORT: 0); + } + if (size_base) { + _env->ReleasePrimitiveArrayCritical(size_ref, size_base, + _exception ? JNI_ABORT: 0); + } + if (_exception != 1) { + result = _env->NewStringUTF(buf); } + if (buf) { + free(buf); + } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } + if (result == 0) { + result = _env->NewStringUTF(""); + } + + return result; } +/* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */ +static jstring +android_glGetActiveAttrib2 + (JNIEnv *_env, jobject _this, jint program, jint index, jobject size_buf, jobject type_buf) { + jarray _sizeArray = (jarray) 0; + jint _sizeBufferOffset = (jint) 0; + jarray _typeArray = (jarray) 0; + jint _typeBufferOffset = (jint) 0; + jint _lengthRemaining; + GLsizei *length = (GLsizei *) 0; + jint _sizeRemaining; + GLint *size = (GLint *) 0; + jint _typeRemaining; + GLenum *type = (GLenum *) 0; + + jstring result = 0; + + GLint len = 0; + glGetProgramiv((GLuint)program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &len); + if (!len) { + return _env->NewStringUTF(""); + } + char* buf = (char*) malloc(len); + + if (buf == NULL) { + jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory"); + return NULL; + } + + size = (GLint *)getPointer(_env, size_buf, &_sizeArray, &_sizeRemaining, &_sizeBufferOffset); + type = (GLenum *)getPointer(_env, type_buf, &_typeArray, &_typeRemaining, &_typeBufferOffset); + if (size == NULL) { + char * _sizeBase = (char *)_env->GetPrimitiveArrayCritical(_sizeArray, (jboolean *) 0); + size = (GLint *) (_sizeBase + _sizeBufferOffset); + } + if (type == NULL) { + char * _typeBase = (char *)_env->GetPrimitiveArrayCritical(_typeArray, (jboolean *) 0); + type = (GLenum *) (_typeBase + _typeBufferOffset); + } + glGetActiveAttrib( + (GLuint)program, + (GLuint)index, + (GLsizei)len, + NULL, + (GLint *)size, + (GLenum *)type, + (char *)buf + ); + + if (_typeArray) { + releasePointer(_env, _typeArray, type, JNI_TRUE); + } + if (_sizeArray) { + releasePointer(_env, _sizeArray, size, JNI_TRUE); + } + result = _env->NewStringUTF(buf); + if (buf) { + free(buf); + } + return result; +} /* void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */ static void android_glGetActiveUniform__III_3II_3II_3II_3BI (JNIEnv *_env, jobject _this, jint program, jint index, jint bufsize, jintArray length_ref, jint lengthOffset, jintArray size_ref, jint sizeOffset, jintArray type_ref, jint typeOffset, jbyteArray name_ref, jint nameOffset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLsizei *length_base = (GLsizei *) 0; jint _lengthRemaining; GLsizei *length = (GLsizei *) 0; @@ -1330,12 +1714,14 @@ android_glGetActiveUniform__III_3II_3II_3II_3BI if (!length_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "length == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length == null"; goto exit; } if (lengthOffset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "lengthOffset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "lengthOffset < 0"; goto exit; } _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset; @@ -1345,12 +1731,14 @@ android_glGetActiveUniform__III_3II_3II_3II_3BI if (!size_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "size == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "size == null"; goto exit; } if (sizeOffset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "sizeOffset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "sizeOffset < 0"; goto exit; } _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset; @@ -1360,12 +1748,14 @@ android_glGetActiveUniform__III_3II_3II_3II_3BI if (!type_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "type == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "type == null"; goto exit; } if (typeOffset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "typeOffset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "typeOffset < 0"; goto exit; } _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset; @@ -1375,12 +1765,14 @@ android_glGetActiveUniform__III_3II_3II_3II_3BI if (!name_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "name == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "name == null"; goto exit; } if (nameOffset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "nameOffset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "nameOffset < 0"; goto exit; } _nameRemaining = _env->GetArrayLength(name_ref) - nameOffset; @@ -1415,16 +1807,21 @@ android_glGetActiveUniform__III_3II_3II_3II_3BI _env->ReleasePrimitiveArrayCritical(length_ref, length_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */ static void android_glGetActiveUniform__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B (JNIEnv *_env, jobject _this, jint program, jint index, jint bufsize, jobject length_buf, jobject size_buf, jobject type_buf, jbyte name) { - jint _exception = 0; jarray _lengthArray = (jarray) 0; + jint _lengthBufferOffset = (jint) 0; jarray _sizeArray = (jarray) 0; + jint _sizeBufferOffset = (jint) 0; jarray _typeArray = (jarray) 0; + jint _typeBufferOffset = (jint) 0; jint _lengthRemaining; GLsizei *length = (GLsizei *) 0; jint _sizeRemaining; @@ -1432,9 +1829,21 @@ android_glGetActiveUniform__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_n jint _typeRemaining; GLenum *type = (GLenum *) 0; - length = (GLsizei *)getPointer(_env, length_buf, &_lengthArray, &_lengthRemaining); - size = (GLint *)getPointer(_env, size_buf, &_sizeArray, &_sizeRemaining); - type = (GLenum *)getPointer(_env, type_buf, &_typeArray, &_typeRemaining); + length = (GLsizei *)getPointer(_env, length_buf, &_lengthArray, &_lengthRemaining, &_lengthBufferOffset); + size = (GLint *)getPointer(_env, size_buf, &_sizeArray, &_sizeRemaining, &_sizeBufferOffset); + type = (GLenum *)getPointer(_env, type_buf, &_typeArray, &_typeRemaining, &_typeBufferOffset); + if (length == NULL) { + char * _lengthBase = (char *)_env->GetPrimitiveArrayCritical(_lengthArray, (jboolean *) 0); + length = (GLsizei *) (_lengthBase + _lengthBufferOffset); + } + if (size == NULL) { + char * _sizeBase = (char *)_env->GetPrimitiveArrayCritical(_sizeArray, (jboolean *) 0); + size = (GLint *) (_sizeBase + _sizeBufferOffset); + } + if (type == NULL) { + char * _typeBase = (char *)_env->GetPrimitiveArrayCritical(_typeArray, (jboolean *) 0); + type = (GLenum *) (_typeBase + _typeBufferOffset); + } glGetActiveUniform( (GLuint)program, (GLuint)index, @@ -1444,22 +1853,181 @@ android_glGetActiveUniform__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_n (GLenum *)type, (char *)name ); - if (_lengthArray) { - releasePointer(_env, _lengthArray, type, _exception ? JNI_FALSE : JNI_TRUE); + if (_typeArray) { + releasePointer(_env, _typeArray, type, JNI_TRUE); } if (_sizeArray) { - releasePointer(_env, _sizeArray, size, _exception ? JNI_FALSE : JNI_TRUE); + releasePointer(_env, _sizeArray, size, JNI_TRUE); } - if (_typeArray) { - releasePointer(_env, _typeArray, length, _exception ? JNI_FALSE : JNI_TRUE); + if (_lengthArray) { + releasePointer(_env, _lengthArray, length, JNI_TRUE); + } +} + +/* void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */ +static jstring +android_glGetActiveUniform1 + (JNIEnv *_env, jobject _this, jint program, jint index, jintArray size_ref, jint sizeOffset, jintArray type_ref, jint typeOffset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; + + GLint *size_base = (GLint *) 0; + jint _sizeRemaining; + GLint *size = (GLint *) 0; + + GLenum *type_base = (GLenum *) 0; + jint _typeRemaining; + GLenum *type = (GLenum *) 0; + + jstring result = 0; + + GLint len = 0; + glGetProgramiv((GLuint)program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &len); + if (!len) { + return _env->NewStringUTF(""); + } + char* buf = (char*) malloc(len); + + if (buf == NULL) { + jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory"); + return NULL; + } + + if (!size_ref) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "size == null"; + goto exit; + } + if (sizeOffset < 0) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "sizeOffset < 0"; + goto exit; + } + _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset; + size_base = (GLint *) + _env->GetPrimitiveArrayCritical(size_ref, (jboolean *)0); + size = size_base + sizeOffset; + + if (!type_ref) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "type == null"; + goto exit; + } + if (typeOffset < 0) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "typeOffset < 0"; + goto exit; + } + _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset; + type_base = (GLenum *) + _env->GetPrimitiveArrayCritical(type_ref, (jboolean *)0); + type = type_base + typeOffset; + + glGetActiveUniform( + (GLuint)program, + (GLuint)index, + (GLsizei)len, + NULL, + (GLint *)size, + (GLenum *)type, + (char *)buf + ); + +exit: + if (type_base) { + _env->ReleasePrimitiveArrayCritical(type_ref, type_base, + _exception ? JNI_ABORT: 0); } + if (size_base) { + _env->ReleasePrimitiveArrayCritical(size_ref, size_base, + _exception ? JNI_ABORT: 0); + } + if (_exception != 1) { + result = _env->NewStringUTF(buf); + } + if (buf) { + free(buf); + } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } + if (result == 0) { + result = _env->NewStringUTF(""); + } + return result; } +/* void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */ +static jstring +android_glGetActiveUniform2 + (JNIEnv *_env, jobject _this, jint program, jint index, jobject size_buf, jobject type_buf) { + jarray _sizeArray = (jarray) 0; + jint _sizeBufferOffset = (jint) 0; + jarray _typeArray = (jarray) 0; + jint _typeBufferOffset = (jint) 0; + jint _sizeRemaining; + GLint *size = (GLint *) 0; + jint _typeRemaining; + GLenum *type = (GLenum *) 0; + + jstring result = 0; + GLint len = 0; + glGetProgramiv((GLuint)program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &len); + if (!len) { + return _env->NewStringUTF(""); + } + char* buf = (char*) malloc(len); + + if (buf == NULL) { + jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory"); + return NULL; + } + + size = (GLint *)getPointer(_env, size_buf, &_sizeArray, &_sizeRemaining, &_sizeBufferOffset); + type = (GLenum *)getPointer(_env, type_buf, &_typeArray, &_typeRemaining, &_typeBufferOffset); + + if (size == NULL) { + char * _sizeBase = (char *)_env->GetPrimitiveArrayCritical(_sizeArray, (jboolean *) 0); + size = (GLint *) (_sizeBase + _sizeBufferOffset); + } + if (type == NULL) { + char * _typeBase = (char *)_env->GetPrimitiveArrayCritical(_typeArray, (jboolean *) 0); + type = (GLenum *) (_typeBase + _typeBufferOffset); + } + glGetActiveUniform( + (GLuint)program, + (GLuint)index, + len, + NULL, + (GLint *)size, + (GLenum *)type, + (char *)buf + ); + + if (_typeArray) { + releasePointer(_env, _typeArray, type, JNI_TRUE); + } + if (_sizeArray) { + releasePointer(_env, _sizeArray, size, JNI_TRUE); + } + result = _env->NewStringUTF(buf); + if (buf) { + free(buf); + } + return result; +} /* void glGetAttachedShaders ( GLuint program, GLsizei maxcount, GLsizei *count, GLuint *shaders ) */ static void android_glGetAttachedShaders__II_3II_3II (JNIEnv *_env, jobject _this, jint program, jint maxcount, jintArray count_ref, jint countOffset, jintArray shaders_ref, jint shadersOffset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLsizei *count_base = (GLsizei *) 0; jint _countRemaining; GLsizei *count = (GLsizei *) 0; @@ -1469,12 +2037,14 @@ android_glGetAttachedShaders__II_3II_3II if (!count_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "count == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "count == null"; goto exit; } if (countOffset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "countOffset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "countOffset < 0"; goto exit; } _countRemaining = _env->GetArrayLength(count_ref) - countOffset; @@ -1484,12 +2054,14 @@ android_glGetAttachedShaders__II_3II_3II if (!shaders_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "shaders == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "shaders == null"; goto exit; } if (shadersOffset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "shadersOffset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "shadersOffset < 0"; goto exit; } _shadersRemaining = _env->GetArrayLength(shaders_ref) - shadersOffset; @@ -1513,33 +2085,45 @@ android_glGetAttachedShaders__II_3II_3II _env->ReleasePrimitiveArrayCritical(count_ref, count_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetAttachedShaders ( GLuint program, GLsizei maxcount, GLsizei *count, GLuint *shaders ) */ static void android_glGetAttachedShaders__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint program, jint maxcount, jobject count_buf, jobject shaders_buf) { - jint _exception = 0; jarray _countArray = (jarray) 0; + jint _countBufferOffset = (jint) 0; jarray _shadersArray = (jarray) 0; + jint _shadersBufferOffset = (jint) 0; jint _countRemaining; GLsizei *count = (GLsizei *) 0; jint _shadersRemaining; GLuint *shaders = (GLuint *) 0; - count = (GLsizei *)getPointer(_env, count_buf, &_countArray, &_countRemaining); - shaders = (GLuint *)getPointer(_env, shaders_buf, &_shadersArray, &_shadersRemaining); + count = (GLsizei *)getPointer(_env, count_buf, &_countArray, &_countRemaining, &_countBufferOffset); + shaders = (GLuint *)getPointer(_env, shaders_buf, &_shadersArray, &_shadersRemaining, &_shadersBufferOffset); + if (count == NULL) { + char * _countBase = (char *)_env->GetPrimitiveArrayCritical(_countArray, (jboolean *) 0); + count = (GLsizei *) (_countBase + _countBufferOffset); + } + if (shaders == NULL) { + char * _shadersBase = (char *)_env->GetPrimitiveArrayCritical(_shadersArray, (jboolean *) 0); + shaders = (GLuint *) (_shadersBase + _shadersBufferOffset); + } glGetAttachedShaders( (GLuint)program, (GLsizei)maxcount, (GLsizei *)count, (GLuint *)shaders ); - if (_countArray) { - releasePointer(_env, _countArray, shaders, _exception ? JNI_FALSE : JNI_TRUE); - } if (_shadersArray) { - releasePointer(_env, _shadersArray, count, _exception ? JNI_FALSE : JNI_TRUE); + releasePointer(_env, _shadersArray, shaders, JNI_TRUE); + } + if (_countArray) { + releasePointer(_env, _countArray, count, JNI_TRUE); } } @@ -1547,11 +2131,15 @@ android_glGetAttachedShaders__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2 static jint android_glGetAttribLocation__ILjava_lang_String_2 (JNIEnv *_env, jobject _this, jint program, jstring name) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; int _returnValue = 0; const char* _nativename = 0; if (!name) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "name == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "name == null"; goto exit; } _nativename = _env->GetStringUTFChars(name, 0); @@ -1566,6 +2154,9 @@ android_glGetAttribLocation__ILjava_lang_String_2 _env->ReleaseStringUTFChars(name, _nativename); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } return _returnValue; } @@ -1574,18 +2165,22 @@ static void android_glGetBooleanv__I_3ZI (JNIEnv *_env, jobject _this, jint pname, jbooleanArray params_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLboolean *params_base = (GLboolean *) 0; jint _remaining; GLboolean *params = (GLboolean *) 0; if (!params_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -1603,24 +2198,31 @@ android_glGetBooleanv__I_3ZI _env->ReleasePrimitiveArrayCritical(params_ref, params_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetBooleanv ( GLenum pname, GLboolean *params ) */ static void android_glGetBooleanv__ILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { - jint _exception = 0; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLboolean *params = (GLboolean *) 0; - params = (GLboolean *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLboolean *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLboolean *) (_paramsBase + _bufferOffset); + } glGetBooleanv( (GLenum)pname, (GLboolean *)params ); if (_array) { - releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + releasePointer(_env, _array, params, JNI_TRUE); } } @@ -1629,24 +2231,29 @@ static void android_glGetBufferParameteriv__II_3II (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLint *params_base = (GLint *) 0; jint _remaining; GLint *params = (GLint *) 0; if (!params_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; if (_remaining < 1) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < 1"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < 1 < needed"; goto exit; } params_base = (GLint *) @@ -1664,6 +2271,9 @@ android_glGetBufferParameteriv__II_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */ @@ -1671,16 +2281,24 @@ static void android_glGetBufferParameteriv__IILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLint *params = (GLint *) 0; - params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < 1) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < 1"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < 1 < needed"; goto exit; } + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLint *) (_paramsBase + _bufferOffset); + } glGetBufferParameteriv( (GLenum)target, (GLenum)pname, @@ -1691,6 +2309,9 @@ android_glGetBufferParameteriv__IILjava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* GLenum glGetError ( void ) */ @@ -1707,18 +2328,22 @@ static void android_glGetFloatv__I_3FI (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfloat *params_base = (GLfloat *) 0; jint _remaining; GLfloat *params = (GLfloat *) 0; if (!params_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -1736,24 +2361,31 @@ android_glGetFloatv__I_3FI _env->ReleasePrimitiveArrayCritical(params_ref, params_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetFloatv ( GLenum pname, GLfloat *params ) */ static void android_glGetFloatv__ILjava_nio_FloatBuffer_2 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { - jint _exception = 0; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfloat *params = (GLfloat *) 0; - params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfloat *) (_paramsBase + _bufferOffset); + } glGetFloatv( (GLenum)pname, (GLfloat *)params ); if (_array) { - releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + releasePointer(_env, _array, params, JNI_TRUE); } } @@ -1762,18 +2394,22 @@ static void android_glGetFramebufferAttachmentParameteriv__III_3II (JNIEnv *_env, jobject _this, jint target, jint attachment, jint pname, jintArray params_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLint *params_base = (GLint *) 0; jint _remaining; GLint *params = (GLint *) 0; if (!params_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -1793,18 +2429,25 @@ android_glGetFramebufferAttachmentParameteriv__III_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetFramebufferAttachmentParameteriv ( GLenum target, GLenum attachment, GLenum pname, GLint *params ) */ static void android_glGetFramebufferAttachmentParameteriv__IIILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint target, jint attachment, jint pname, jobject params_buf) { - jint _exception = 0; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLint *params = (GLint *) 0; - params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLint *) (_paramsBase + _bufferOffset); + } glGetFramebufferAttachmentParameteriv( (GLenum)target, (GLenum)attachment, @@ -1812,7 +2455,7 @@ android_glGetFramebufferAttachmentParameteriv__IIILjava_nio_IntBuffer_2 (GLint *)params ); if (_array) { - releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + releasePointer(_env, _array, params, JNI_TRUE); } } @@ -1821,18 +2464,22 @@ static void android_glGetIntegerv__I_3II (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLint *params_base = (GLint *) 0; jint _remaining; GLint *params = (GLint *) 0; if (!params_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -2169,7 +2816,8 @@ android_glGetIntegerv__I_3II } if (_remaining < _needed) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < needed"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < needed"; goto exit; } params_base = (GLint *) @@ -2186,6 +2834,9 @@ android_glGetIntegerv__I_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetIntegerv ( GLenum pname, GLint *params ) */ @@ -2193,11 +2844,14 @@ static void android_glGetIntegerv__ILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLint *params = (GLint *) 0; - params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); int _needed; switch (pname) { #if defined(GL_ALPHA_BITS) @@ -2531,9 +3185,14 @@ android_glGetIntegerv__ILjava_nio_IntBuffer_2 } if (_remaining < _needed) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < needed"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < needed"; goto exit; } + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLint *) (_paramsBase + _bufferOffset); + } glGetIntegerv( (GLenum)pname, (GLint *)params @@ -2543,6 +3202,9 @@ android_glGetIntegerv__ILjava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetProgramiv ( GLuint program, GLenum pname, GLint *params ) */ @@ -2550,18 +3212,22 @@ static void android_glGetProgramiv__II_3II (JNIEnv *_env, jobject _this, jint program, jint pname, jintArray params_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLint *params_base = (GLint *) 0; jint _remaining; GLint *params = (GLint *) 0; if (!params_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -2580,25 +3246,32 @@ android_glGetProgramiv__II_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetProgramiv ( GLuint program, GLenum pname, GLint *params ) */ static void android_glGetProgramiv__IILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint program, jint pname, jobject params_buf) { - jint _exception = 0; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLint *params = (GLint *) 0; - params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLint *) (_paramsBase + _bufferOffset); + } glGetProgramiv( (GLuint)program, (GLenum)pname, (GLint *)params ); if (_array) { - releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + releasePointer(_env, _array, params, JNI_TRUE); } } @@ -2626,18 +3299,22 @@ static void android_glGetRenderbufferParameteriv__II_3II (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLint *params_base = (GLint *) 0; jint _remaining; GLint *params = (GLint *) 0; if (!params_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -2656,25 +3333,32 @@ android_glGetRenderbufferParameteriv__II_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetRenderbufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */ static void android_glGetRenderbufferParameteriv__IILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { - jint _exception = 0; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLint *params = (GLint *) 0; - params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLint *) (_paramsBase + _bufferOffset); + } glGetRenderbufferParameteriv( (GLenum)target, (GLenum)pname, (GLint *)params ); if (_array) { - releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + releasePointer(_env, _array, params, JNI_TRUE); } } @@ -2683,18 +3367,22 @@ static void android_glGetShaderiv__II_3II (JNIEnv *_env, jobject _this, jint shader, jint pname, jintArray params_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLint *params_base = (GLint *) 0; jint _remaining; GLint *params = (GLint *) 0; if (!params_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -2713,25 +3401,32 @@ android_glGetShaderiv__II_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetShaderiv ( GLuint shader, GLenum pname, GLint *params ) */ static void android_glGetShaderiv__IILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint shader, jint pname, jobject params_buf) { - jint _exception = 0; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLint *params = (GLint *) 0; - params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLint *) (_paramsBase + _bufferOffset); + } glGetShaderiv( (GLuint)shader, (GLenum)pname, (GLint *)params ); if (_array) { - releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + releasePointer(_env, _array, params, JNI_TRUE); } } @@ -2759,6 +3454,8 @@ static void android_glGetShaderPrecisionFormat__II_3II_3II (JNIEnv *_env, jobject _this, jint shadertype, jint precisiontype, jintArray range_ref, jint rangeOffset, jintArray precision_ref, jint precisionOffset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLint *range_base = (GLint *) 0; jint _rangeRemaining; GLint *range = (GLint *) 0; @@ -2768,12 +3465,14 @@ android_glGetShaderPrecisionFormat__II_3II_3II if (!range_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "range == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "range == null"; goto exit; } if (rangeOffset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "rangeOffset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "rangeOffset < 0"; goto exit; } _rangeRemaining = _env->GetArrayLength(range_ref) - rangeOffset; @@ -2783,12 +3482,14 @@ android_glGetShaderPrecisionFormat__II_3II_3II if (!precision_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "precision == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "precision == null"; goto exit; } if (precisionOffset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "precisionOffset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "precisionOffset < 0"; goto exit; } _precisionRemaining = _env->GetArrayLength(precision_ref) - precisionOffset; @@ -2812,33 +3513,45 @@ android_glGetShaderPrecisionFormat__II_3II_3II _env->ReleasePrimitiveArrayCritical(range_ref, range_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetShaderPrecisionFormat ( GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision ) */ static void android_glGetShaderPrecisionFormat__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint shadertype, jint precisiontype, jobject range_buf, jobject precision_buf) { - jint _exception = 0; jarray _rangeArray = (jarray) 0; + jint _rangeBufferOffset = (jint) 0; jarray _precisionArray = (jarray) 0; + jint _precisionBufferOffset = (jint) 0; jint _rangeRemaining; GLint *range = (GLint *) 0; jint _precisionRemaining; GLint *precision = (GLint *) 0; - range = (GLint *)getPointer(_env, range_buf, &_rangeArray, &_rangeRemaining); - precision = (GLint *)getPointer(_env, precision_buf, &_precisionArray, &_precisionRemaining); + range = (GLint *)getPointer(_env, range_buf, &_rangeArray, &_rangeRemaining, &_rangeBufferOffset); + precision = (GLint *)getPointer(_env, precision_buf, &_precisionArray, &_precisionRemaining, &_precisionBufferOffset); + if (range == NULL) { + char * _rangeBase = (char *)_env->GetPrimitiveArrayCritical(_rangeArray, (jboolean *) 0); + range = (GLint *) (_rangeBase + _rangeBufferOffset); + } + if (precision == NULL) { + char * _precisionBase = (char *)_env->GetPrimitiveArrayCritical(_precisionArray, (jboolean *) 0); + precision = (GLint *) (_precisionBase + _precisionBufferOffset); + } glGetShaderPrecisionFormat( (GLenum)shadertype, (GLenum)precisiontype, (GLint *)range, (GLint *)precision ); - if (_rangeArray) { - releasePointer(_env, _rangeArray, precision, _exception ? JNI_FALSE : JNI_TRUE); - } if (_precisionArray) { - releasePointer(_env, _precisionArray, range, _exception ? JNI_FALSE : JNI_TRUE); + releasePointer(_env, _precisionArray, precision, JNI_TRUE); + } + if (_rangeArray) { + releasePointer(_env, _rangeArray, range, JNI_TRUE); } } @@ -2847,6 +3560,8 @@ static void android_glGetShaderSource__II_3II_3BI (JNIEnv *_env, jobject _this, jint shader, jint bufsize, jintArray length_ref, jint lengthOffset, jbyteArray source_ref, jint sourceOffset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLsizei *length_base = (GLsizei *) 0; jint _lengthRemaining; GLsizei *length = (GLsizei *) 0; @@ -2856,12 +3571,14 @@ android_glGetShaderSource__II_3II_3BI if (!length_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "length == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length == null"; goto exit; } if (lengthOffset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "lengthOffset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "lengthOffset < 0"; goto exit; } _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset; @@ -2871,12 +3588,14 @@ android_glGetShaderSource__II_3II_3BI if (!source_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "source == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "source == null"; goto exit; } if (sourceOffset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "sourceOffset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "sourceOffset < 0"; goto exit; } _sourceRemaining = _env->GetArrayLength(source_ref) - sourceOffset; @@ -2900,18 +3619,25 @@ android_glGetShaderSource__II_3II_3BI _env->ReleasePrimitiveArrayCritical(length_ref, length_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetShaderSource ( GLuint shader, GLsizei bufsize, GLsizei *length, char *source ) */ static void android_glGetShaderSource__IILjava_nio_IntBuffer_2B (JNIEnv *_env, jobject _this, jint shader, jint bufsize, jobject length_buf, jbyte source) { - jint _exception = 0; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLsizei *length = (GLsizei *) 0; - length = (GLsizei *)getPointer(_env, length_buf, &_array, &_remaining); + length = (GLsizei *)getPointer(_env, length_buf, &_array, &_remaining, &_bufferOffset); + if (length == NULL) { + char * _lengthBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + length = (GLsizei *) (_lengthBase + _bufferOffset); + } glGetShaderSource( (GLuint)shader, (GLsizei)bufsize, @@ -2919,10 +3645,27 @@ android_glGetShaderSource__IILjava_nio_IntBuffer_2B (char *)source ); if (_array) { - releasePointer(_env, _array, length, _exception ? JNI_FALSE : JNI_TRUE); + releasePointer(_env, _array, length, JNI_TRUE); } } +/* void glGetShaderSource ( GLuint shader, GLsizei bufsize, GLsizei *length, char *source ) */ +static jstring android_glGetShaderSource(JNIEnv *_env, jobject, jint shader) { + GLint shaderLen = 0; + glGetShaderiv((GLuint)shader, GL_SHADER_SOURCE_LENGTH, &shaderLen); + if (!shaderLen) { + return _env->NewStringUTF(""); + } + char* buf = (char*) malloc(shaderLen); + if (buf == NULL) { + jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory"); + return NULL; + } + glGetShaderSource(shader, shaderLen, NULL, buf); + jstring result = _env->NewStringUTF(buf); + free(buf); + return result; +} /* const GLubyte * glGetString ( GLenum name ) */ static jstring android_glGetString(JNIEnv* _env, jobject, jint name) { const char* chars = (const char*) glGetString((GLenum) name); @@ -2933,24 +3676,29 @@ static void android_glGetTexParameterfv__II_3FI (JNIEnv *_env, jobject _this, jint target, jint pname, jfloatArray params_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfloat *params_base = (GLfloat *) 0; jint _remaining; GLfloat *params = (GLfloat *) 0; if (!params_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; if (_remaining < 1) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < 1"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < 1 < needed"; goto exit; } params_base = (GLfloat *) @@ -2968,6 +3716,9 @@ android_glGetTexParameterfv__II_3FI _env->ReleasePrimitiveArrayCritical(params_ref, params_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) */ @@ -2975,16 +3726,24 @@ static void android_glGetTexParameterfv__IILjava_nio_FloatBuffer_2 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfloat *params = (GLfloat *) 0; - params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < 1) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < 1"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < 1 < needed"; goto exit; } + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfloat *) (_paramsBase + _bufferOffset); + } glGetTexParameterfv( (GLenum)target, (GLenum)pname, @@ -2995,6 +3754,9 @@ android_glGetTexParameterfv__IILjava_nio_FloatBuffer_2 if (_array) { releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) */ @@ -3002,24 +3764,29 @@ static void android_glGetTexParameteriv__II_3II (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLint *params_base = (GLint *) 0; jint _remaining; GLint *params = (GLint *) 0; if (!params_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; if (_remaining < 1) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < 1"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < 1 < needed"; goto exit; } params_base = (GLint *) @@ -3037,6 +3804,9 @@ android_glGetTexParameteriv__II_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) */ @@ -3044,16 +3814,24 @@ static void android_glGetTexParameteriv__IILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLint *params = (GLint *) 0; - params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < 1) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < 1"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < 1 < needed"; goto exit; } + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLint *) (_paramsBase + _bufferOffset); + } glGetTexParameteriv( (GLenum)target, (GLenum)pname, @@ -3064,6 +3842,9 @@ android_glGetTexParameteriv__IILjava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetUniformfv ( GLuint program, GLint location, GLfloat *params ) */ @@ -3071,18 +3852,22 @@ static void android_glGetUniformfv__II_3FI (JNIEnv *_env, jobject _this, jint program, jint location, jfloatArray params_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfloat *params_base = (GLfloat *) 0; jint _remaining; GLfloat *params = (GLfloat *) 0; if (!params_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -3101,25 +3886,32 @@ android_glGetUniformfv__II_3FI _env->ReleasePrimitiveArrayCritical(params_ref, params_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetUniformfv ( GLuint program, GLint location, GLfloat *params ) */ static void android_glGetUniformfv__IILjava_nio_FloatBuffer_2 (JNIEnv *_env, jobject _this, jint program, jint location, jobject params_buf) { - jint _exception = 0; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfloat *params = (GLfloat *) 0; - params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfloat *) (_paramsBase + _bufferOffset); + } glGetUniformfv( (GLuint)program, (GLint)location, (GLfloat *)params ); if (_array) { - releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + releasePointer(_env, _array, params, JNI_TRUE); } } @@ -3128,18 +3920,22 @@ static void android_glGetUniformiv__II_3II (JNIEnv *_env, jobject _this, jint program, jint location, jintArray params_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLint *params_base = (GLint *) 0; jint _remaining; GLint *params = (GLint *) 0; if (!params_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -3158,25 +3954,32 @@ android_glGetUniformiv__II_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetUniformiv ( GLuint program, GLint location, GLint *params ) */ static void android_glGetUniformiv__IILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint program, jint location, jobject params_buf) { - jint _exception = 0; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLint *params = (GLint *) 0; - params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLint *) (_paramsBase + _bufferOffset); + } glGetUniformiv( (GLuint)program, (GLint)location, (GLint *)params ); if (_array) { - releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + releasePointer(_env, _array, params, JNI_TRUE); } } @@ -3184,11 +3987,15 @@ android_glGetUniformiv__IILjava_nio_IntBuffer_2 static jint android_glGetUniformLocation__ILjava_lang_String_2 (JNIEnv *_env, jobject _this, jint program, jstring name) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; int _returnValue = 0; const char* _nativename = 0; if (!name) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "name == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "name == null"; goto exit; } _nativename = _env->GetStringUTFChars(name, 0); @@ -3203,6 +4010,9 @@ android_glGetUniformLocation__ILjava_lang_String_2 _env->ReleaseStringUTFChars(name, _nativename); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } return _returnValue; } @@ -3211,18 +4021,22 @@ static void android_glGetVertexAttribfv__II_3FI (JNIEnv *_env, jobject _this, jint index, jint pname, jfloatArray params_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfloat *params_base = (GLfloat *) 0; jint _remaining; GLfloat *params = (GLfloat *) 0; if (!params_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -3241,25 +4055,32 @@ android_glGetVertexAttribfv__II_3FI _env->ReleasePrimitiveArrayCritical(params_ref, params_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetVertexAttribfv ( GLuint index, GLenum pname, GLfloat *params ) */ static void android_glGetVertexAttribfv__IILjava_nio_FloatBuffer_2 (JNIEnv *_env, jobject _this, jint index, jint pname, jobject params_buf) { - jint _exception = 0; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfloat *params = (GLfloat *) 0; - params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfloat *) (_paramsBase + _bufferOffset); + } glGetVertexAttribfv( (GLuint)index, (GLenum)pname, (GLfloat *)params ); if (_array) { - releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + releasePointer(_env, _array, params, JNI_TRUE); } } @@ -3268,18 +4089,22 @@ static void android_glGetVertexAttribiv__II_3II (JNIEnv *_env, jobject _this, jint index, jint pname, jintArray params_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLint *params_base = (GLint *) 0; jint _remaining; GLint *params = (GLint *) 0; if (!params_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -3298,25 +4123,32 @@ android_glGetVertexAttribiv__II_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetVertexAttribiv ( GLuint index, GLenum pname, GLint *params ) */ static void android_glGetVertexAttribiv__IILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint index, jint pname, jobject params_buf) { - jint _exception = 0; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLint *params = (GLint *) 0; - params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLint *) (_paramsBase + _bufferOffset); + } glGetVertexAttribiv( (GLuint)index, (GLenum)pname, (GLint *)params ); if (_array) { - releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + releasePointer(_env, _array, params, JNI_TRUE); } } @@ -3449,12 +4281,16 @@ android_glPolygonOffset__FF static void android_glReadPixels__IIIIIILjava_nio_Buffer_2 (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height, jint format, jint type, jobject pixels_buf) { - jint _exception = 0; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLvoid *pixels = (GLvoid *) 0; - pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining); + pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining, &_bufferOffset); + if (pixels == NULL) { + char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + pixels = (GLvoid *) (_pixelsBase + _bufferOffset); + } glReadPixels( (GLint)x, (GLint)y, @@ -3465,7 +4301,7 @@ android_glReadPixels__IIIIIILjava_nio_Buffer_2 (GLvoid *)pixels ); if (_array) { - releasePointer(_env, _array, pixels, _exception ? JNI_FALSE : JNI_TRUE); + releasePointer(_env, _array, pixels, JNI_TRUE); } } @@ -3514,7 +4350,11 @@ android_glScissor__IIII static void android_glShaderBinary__I_3IIILjava_nio_Buffer_2I (JNIEnv *_env, jobject _this, jint n, jintArray shaders_ref, jint offset, jint binaryformat, jobject binary_buf, jint length) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; GLuint *shaders_base = (GLuint *) 0; jint _shadersRemaining; GLuint *shaders = (GLuint *) 0; @@ -3522,11 +4362,15 @@ android_glShaderBinary__I_3IIILjava_nio_Buffer_2I GLvoid *binary = (GLvoid *) 0; if (!shaders_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "shaders == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "shaders == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _shadersRemaining = _env->GetArrayLength(shaders_ref) - offset; @@ -3534,7 +4378,11 @@ android_glShaderBinary__I_3IIILjava_nio_Buffer_2I _env->GetPrimitiveArrayCritical(shaders_ref, (jboolean *)0); shaders = shaders_base + offset; - binary = (GLvoid *)getPointer(_env, binary_buf, &_array, &_binaryRemaining); + binary = (GLvoid *)getPointer(_env, binary_buf, &_array, &_binaryRemaining, &_bufferOffset); + if (binary == NULL) { + char * _binaryBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + binary = (GLvoid *) (_binaryBase + _bufferOffset); + } glShaderBinary( (GLsizei)n, (GLuint *)shaders, @@ -3551,6 +4399,9 @@ android_glShaderBinary__I_3IIILjava_nio_Buffer_2I _env->ReleasePrimitiveArrayCritical(shaders_ref, shaders_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glShaderBinary ( GLsizei n, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length ) */ @@ -3558,14 +4409,24 @@ static void android_glShaderBinary__ILjava_nio_IntBuffer_2ILjava_nio_Buffer_2I (JNIEnv *_env, jobject _this, jint n, jobject shaders_buf, jint binaryformat, jobject binary_buf, jint length) { jarray _shadersArray = (jarray) 0; + jint _shadersBufferOffset = (jint) 0; jarray _binaryArray = (jarray) 0; + jint _binaryBufferOffset = (jint) 0; jint _shadersRemaining; GLuint *shaders = (GLuint *) 0; jint _binaryRemaining; GLvoid *binary = (GLvoid *) 0; - shaders = (GLuint *)getPointer(_env, shaders_buf, &_shadersArray, &_shadersRemaining); - binary = (GLvoid *)getPointer(_env, binary_buf, &_binaryArray, &_binaryRemaining); + shaders = (GLuint *)getPointer(_env, shaders_buf, &_shadersArray, &_shadersRemaining, &_shadersBufferOffset); + binary = (GLvoid *)getPointer(_env, binary_buf, &_binaryArray, &_binaryRemaining, &_binaryBufferOffset); + if (shaders == NULL) { + char * _shadersBase = (char *)_env->GetPrimitiveArrayCritical(_shadersArray, (jboolean *) 0); + shaders = (GLuint *) (_shadersBase + _shadersBufferOffset); + } + if (binary == NULL) { + char * _binaryBase = (char *)_env->GetPrimitiveArrayCritical(_binaryArray, (jboolean *) 0); + binary = (GLvoid *) (_binaryBase + _binaryBufferOffset); + } glShaderBinary( (GLsizei)n, (GLuint *)shaders, @@ -3573,11 +4434,11 @@ android_glShaderBinary__ILjava_nio_IntBuffer_2ILjava_nio_Buffer_2I (GLvoid *)binary, (GLsizei)length ); - if (_shadersArray) { - releasePointer(_env, _shadersArray, binary, JNI_FALSE); - } if (_binaryArray) { - releasePointer(_env, _binaryArray, shaders, JNI_FALSE); + releasePointer(_env, _binaryArray, binary, JNI_FALSE); + } + if (_shadersArray) { + releasePointer(_env, _shadersArray, shaders, JNI_FALSE); } } @@ -3668,11 +4529,16 @@ static void android_glTexImage2D__IIIIIIIILjava_nio_Buffer_2 (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint width, jint height, jint border, jint format, jint type, jobject pixels_buf) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLvoid *pixels = (GLvoid *) 0; if (pixels_buf) { - pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining); + pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining, &_bufferOffset); + } + if (pixels_buf && pixels == NULL) { + char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + pixels = (GLvoid *) (_pixelsBase + _bufferOffset); } glTexImage2D( (GLenum)target, @@ -3705,21 +4571,30 @@ android_glTexParameterf__IIF static void android_glTexParameterfv__II_3FI (JNIEnv *_env, jobject _this, jint target, jint pname, jfloatArray params_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfloat *params_base = (GLfloat *) 0; jint _remaining; GLfloat *params = (GLfloat *) 0; if (!params_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; if (_remaining < 1) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < 1"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < 1 < needed"; goto exit; } params_base = (GLfloat *) @@ -3737,21 +4612,34 @@ android_glTexParameterfv__II_3FI _env->ReleasePrimitiveArrayCritical(params_ref, params_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params ) */ static void android_glTexParameterfv__IILjava_nio_FloatBuffer_2 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfloat *params = (GLfloat *) 0; - params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < 1) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < 1"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < 1 < needed"; goto exit; } + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfloat *) (_paramsBase + _bufferOffset); + } glTexParameterfv( (GLenum)target, (GLenum)pname, @@ -3762,6 +4650,9 @@ android_glTexParameterfv__IILjava_nio_FloatBuffer_2 if (_array) { releasePointer(_env, _array, params, JNI_FALSE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glTexParameteri ( GLenum target, GLenum pname, GLint param ) */ @@ -3779,21 +4670,30 @@ android_glTexParameteri__III static void android_glTexParameteriv__II_3II (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLint *params_base = (GLint *) 0; jint _remaining; GLint *params = (GLint *) 0; if (!params_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; if (_remaining < 1) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < 1"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < 1 < needed"; goto exit; } params_base = (GLint *) @@ -3811,21 +4711,34 @@ android_glTexParameteriv__II_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params ) */ static void android_glTexParameteriv__IILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLint *params = (GLint *) 0; - params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < 1) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < 1"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < 1 < needed"; goto exit; } + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLint *) (_paramsBase + _bufferOffset); + } glTexParameteriv( (GLenum)target, (GLenum)pname, @@ -3836,6 +4749,9 @@ android_glTexParameteriv__IILjava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, params, JNI_FALSE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels ) */ @@ -3843,11 +4759,16 @@ static void android_glTexSubImage2D__IIIIIIIILjava_nio_Buffer_2 (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint width, jint height, jint format, jint type, jobject pixels_buf) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLvoid *pixels = (GLvoid *) 0; if (pixels_buf) { - pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining); + pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining, &_bufferOffset); + } + if (pixels_buf && pixels == NULL) { + char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + pixels = (GLvoid *) (_pixelsBase + _bufferOffset); } glTexSubImage2D( (GLenum)target, @@ -3879,16 +4800,23 @@ android_glUniform1f__IF static void android_glUniform1fv__II_3FI (JNIEnv *_env, jobject _this, jint location, jint count, jfloatArray v_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfloat *v_base = (GLfloat *) 0; jint _remaining; GLfloat *v = (GLfloat *) 0; if (!v_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "v == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "v == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(v_ref) - offset; @@ -3907,6 +4835,9 @@ android_glUniform1fv__II_3FI _env->ReleasePrimitiveArrayCritical(v_ref, v_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glUniform1fv ( GLint location, GLsizei count, const GLfloat *v ) */ @@ -3914,10 +4845,15 @@ static void android_glUniform1fv__IILjava_nio_FloatBuffer_2 (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfloat *v = (GLfloat *) 0; - v = (GLfloat *)getPointer(_env, v_buf, &_array, &_remaining); + v = (GLfloat *)getPointer(_env, v_buf, &_array, &_remaining, &_bufferOffset); + if (v == NULL) { + char * _vBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + v = (GLfloat *) (_vBase + _bufferOffset); + } glUniform1fv( (GLint)location, (GLsizei)count, @@ -3942,16 +4878,23 @@ android_glUniform1i__II static void android_glUniform1iv__II_3II (JNIEnv *_env, jobject _this, jint location, jint count, jintArray v_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLint *v_base = (GLint *) 0; jint _remaining; GLint *v = (GLint *) 0; if (!v_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "v == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "v == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(v_ref) - offset; @@ -3970,6 +4913,9 @@ android_glUniform1iv__II_3II _env->ReleasePrimitiveArrayCritical(v_ref, v_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glUniform1iv ( GLint location, GLsizei count, const GLint *v ) */ @@ -3977,10 +4923,15 @@ static void android_glUniform1iv__IILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLint *v = (GLint *) 0; - v = (GLint *)getPointer(_env, v_buf, &_array, &_remaining); + v = (GLint *)getPointer(_env, v_buf, &_array, &_remaining, &_bufferOffset); + if (v == NULL) { + char * _vBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + v = (GLint *) (_vBase + _bufferOffset); + } glUniform1iv( (GLint)location, (GLsizei)count, @@ -4006,16 +4957,23 @@ android_glUniform2f__IFF static void android_glUniform2fv__II_3FI (JNIEnv *_env, jobject _this, jint location, jint count, jfloatArray v_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfloat *v_base = (GLfloat *) 0; jint _remaining; GLfloat *v = (GLfloat *) 0; if (!v_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "v == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "v == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(v_ref) - offset; @@ -4034,6 +4992,9 @@ android_glUniform2fv__II_3FI _env->ReleasePrimitiveArrayCritical(v_ref, v_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glUniform2fv ( GLint location, GLsizei count, const GLfloat *v ) */ @@ -4041,10 +5002,15 @@ static void android_glUniform2fv__IILjava_nio_FloatBuffer_2 (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfloat *v = (GLfloat *) 0; - v = (GLfloat *)getPointer(_env, v_buf, &_array, &_remaining); + v = (GLfloat *)getPointer(_env, v_buf, &_array, &_remaining, &_bufferOffset); + if (v == NULL) { + char * _vBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + v = (GLfloat *) (_vBase + _bufferOffset); + } glUniform2fv( (GLint)location, (GLsizei)count, @@ -4070,16 +5036,23 @@ android_glUniform2i__III static void android_glUniform2iv__II_3II (JNIEnv *_env, jobject _this, jint location, jint count, jintArray v_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLint *v_base = (GLint *) 0; jint _remaining; GLint *v = (GLint *) 0; if (!v_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "v == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "v == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(v_ref) - offset; @@ -4098,6 +5071,9 @@ android_glUniform2iv__II_3II _env->ReleasePrimitiveArrayCritical(v_ref, v_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glUniform2iv ( GLint location, GLsizei count, const GLint *v ) */ @@ -4105,10 +5081,15 @@ static void android_glUniform2iv__IILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLint *v = (GLint *) 0; - v = (GLint *)getPointer(_env, v_buf, &_array, &_remaining); + v = (GLint *)getPointer(_env, v_buf, &_array, &_remaining, &_bufferOffset); + if (v == NULL) { + char * _vBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + v = (GLint *) (_vBase + _bufferOffset); + } glUniform2iv( (GLint)location, (GLsizei)count, @@ -4135,16 +5116,23 @@ android_glUniform3f__IFFF static void android_glUniform3fv__II_3FI (JNIEnv *_env, jobject _this, jint location, jint count, jfloatArray v_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfloat *v_base = (GLfloat *) 0; jint _remaining; GLfloat *v = (GLfloat *) 0; if (!v_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "v == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "v == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(v_ref) - offset; @@ -4163,6 +5151,9 @@ android_glUniform3fv__II_3FI _env->ReleasePrimitiveArrayCritical(v_ref, v_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glUniform3fv ( GLint location, GLsizei count, const GLfloat *v ) */ @@ -4170,10 +5161,15 @@ static void android_glUniform3fv__IILjava_nio_FloatBuffer_2 (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfloat *v = (GLfloat *) 0; - v = (GLfloat *)getPointer(_env, v_buf, &_array, &_remaining); + v = (GLfloat *)getPointer(_env, v_buf, &_array, &_remaining, &_bufferOffset); + if (v == NULL) { + char * _vBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + v = (GLfloat *) (_vBase + _bufferOffset); + } glUniform3fv( (GLint)location, (GLsizei)count, @@ -4200,16 +5196,23 @@ android_glUniform3i__IIII static void android_glUniform3iv__II_3II (JNIEnv *_env, jobject _this, jint location, jint count, jintArray v_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLint *v_base = (GLint *) 0; jint _remaining; GLint *v = (GLint *) 0; if (!v_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "v == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "v == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(v_ref) - offset; @@ -4228,6 +5231,9 @@ android_glUniform3iv__II_3II _env->ReleasePrimitiveArrayCritical(v_ref, v_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glUniform3iv ( GLint location, GLsizei count, const GLint *v ) */ @@ -4235,10 +5241,15 @@ static void android_glUniform3iv__IILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLint *v = (GLint *) 0; - v = (GLint *)getPointer(_env, v_buf, &_array, &_remaining); + v = (GLint *)getPointer(_env, v_buf, &_array, &_remaining, &_bufferOffset); + if (v == NULL) { + char * _vBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + v = (GLint *) (_vBase + _bufferOffset); + } glUniform3iv( (GLint)location, (GLsizei)count, @@ -4266,16 +5277,23 @@ android_glUniform4f__IFFFF static void android_glUniform4fv__II_3FI (JNIEnv *_env, jobject _this, jint location, jint count, jfloatArray v_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfloat *v_base = (GLfloat *) 0; jint _remaining; GLfloat *v = (GLfloat *) 0; if (!v_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "v == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "v == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(v_ref) - offset; @@ -4294,6 +5312,9 @@ android_glUniform4fv__II_3FI _env->ReleasePrimitiveArrayCritical(v_ref, v_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glUniform4fv ( GLint location, GLsizei count, const GLfloat *v ) */ @@ -4301,10 +5322,15 @@ static void android_glUniform4fv__IILjava_nio_FloatBuffer_2 (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfloat *v = (GLfloat *) 0; - v = (GLfloat *)getPointer(_env, v_buf, &_array, &_remaining); + v = (GLfloat *)getPointer(_env, v_buf, &_array, &_remaining, &_bufferOffset); + if (v == NULL) { + char * _vBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + v = (GLfloat *) (_vBase + _bufferOffset); + } glUniform4fv( (GLint)location, (GLsizei)count, @@ -4332,16 +5358,23 @@ android_glUniform4i__IIIII static void android_glUniform4iv__II_3II (JNIEnv *_env, jobject _this, jint location, jint count, jintArray v_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLint *v_base = (GLint *) 0; jint _remaining; GLint *v = (GLint *) 0; if (!v_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "v == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "v == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(v_ref) - offset; @@ -4360,6 +5393,9 @@ android_glUniform4iv__II_3II _env->ReleasePrimitiveArrayCritical(v_ref, v_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glUniform4iv ( GLint location, GLsizei count, const GLint *v ) */ @@ -4367,10 +5403,15 @@ static void android_glUniform4iv__IILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLint *v = (GLint *) 0; - v = (GLint *)getPointer(_env, v_buf, &_array, &_remaining); + v = (GLint *)getPointer(_env, v_buf, &_array, &_remaining, &_bufferOffset); + if (v == NULL) { + char * _vBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + v = (GLint *) (_vBase + _bufferOffset); + } glUniform4iv( (GLint)location, (GLsizei)count, @@ -4385,16 +5426,23 @@ android_glUniform4iv__IILjava_nio_IntBuffer_2 static void android_glUniformMatrix2fv__IIZ_3FI (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jfloatArray value_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfloat *value_base = (GLfloat *) 0; jint _remaining; GLfloat *value = (GLfloat *) 0; if (!value_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "value == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "value == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(value_ref) - offset; @@ -4414,6 +5462,9 @@ android_glUniformMatrix2fv__IIZ_3FI _env->ReleasePrimitiveArrayCritical(value_ref, value_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glUniformMatrix2fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */ @@ -4421,10 +5472,15 @@ static void android_glUniformMatrix2fv__IIZLjava_nio_FloatBuffer_2 (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jobject value_buf) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfloat *value = (GLfloat *) 0; - value = (GLfloat *)getPointer(_env, value_buf, &_array, &_remaining); + value = (GLfloat *)getPointer(_env, value_buf, &_array, &_remaining, &_bufferOffset); + if (value == NULL) { + char * _valueBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + value = (GLfloat *) (_valueBase + _bufferOffset); + } glUniformMatrix2fv( (GLint)location, (GLsizei)count, @@ -4440,16 +5496,23 @@ android_glUniformMatrix2fv__IIZLjava_nio_FloatBuffer_2 static void android_glUniformMatrix3fv__IIZ_3FI (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jfloatArray value_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfloat *value_base = (GLfloat *) 0; jint _remaining; GLfloat *value = (GLfloat *) 0; if (!value_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "value == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "value == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(value_ref) - offset; @@ -4469,6 +5532,9 @@ android_glUniformMatrix3fv__IIZ_3FI _env->ReleasePrimitiveArrayCritical(value_ref, value_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glUniformMatrix3fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */ @@ -4476,10 +5542,15 @@ static void android_glUniformMatrix3fv__IIZLjava_nio_FloatBuffer_2 (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jobject value_buf) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfloat *value = (GLfloat *) 0; - value = (GLfloat *)getPointer(_env, value_buf, &_array, &_remaining); + value = (GLfloat *)getPointer(_env, value_buf, &_array, &_remaining, &_bufferOffset); + if (value == NULL) { + char * _valueBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + value = (GLfloat *) (_valueBase + _bufferOffset); + } glUniformMatrix3fv( (GLint)location, (GLsizei)count, @@ -4495,16 +5566,23 @@ android_glUniformMatrix3fv__IIZLjava_nio_FloatBuffer_2 static void android_glUniformMatrix4fv__IIZ_3FI (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jfloatArray value_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfloat *value_base = (GLfloat *) 0; jint _remaining; GLfloat *value = (GLfloat *) 0; if (!value_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "value == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "value == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(value_ref) - offset; @@ -4524,6 +5602,9 @@ android_glUniformMatrix4fv__IIZ_3FI _env->ReleasePrimitiveArrayCritical(value_ref, value_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glUniformMatrix4fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */ @@ -4531,10 +5612,15 @@ static void android_glUniformMatrix4fv__IIZLjava_nio_FloatBuffer_2 (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jobject value_buf) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfloat *value = (GLfloat *) 0; - value = (GLfloat *)getPointer(_env, value_buf, &_array, &_remaining); + value = (GLfloat *)getPointer(_env, value_buf, &_array, &_remaining, &_bufferOffset); + if (value == NULL) { + char * _valueBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + value = (GLfloat *) (_valueBase + _bufferOffset); + } glUniformMatrix4fv( (GLint)location, (GLsizei)count, @@ -4578,16 +5664,23 @@ android_glVertexAttrib1f__IF static void android_glVertexAttrib1fv__I_3FI (JNIEnv *_env, jobject _this, jint indx, jfloatArray values_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfloat *values_base = (GLfloat *) 0; jint _remaining; GLfloat *values = (GLfloat *) 0; if (!values_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "values == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "values == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(values_ref) - offset; @@ -4605,6 +5698,9 @@ android_glVertexAttrib1fv__I_3FI _env->ReleasePrimitiveArrayCritical(values_ref, values_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glVertexAttrib1fv ( GLuint indx, const GLfloat *values ) */ @@ -4612,10 +5708,15 @@ static void android_glVertexAttrib1fv__ILjava_nio_FloatBuffer_2 (JNIEnv *_env, jobject _this, jint indx, jobject values_buf) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfloat *values = (GLfloat *) 0; - values = (GLfloat *)getPointer(_env, values_buf, &_array, &_remaining); + values = (GLfloat *)getPointer(_env, values_buf, &_array, &_remaining, &_bufferOffset); + if (values == NULL) { + char * _valuesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + values = (GLfloat *) (_valuesBase + _bufferOffset); + } glVertexAttrib1fv( (GLuint)indx, (GLfloat *)values @@ -4640,16 +5741,23 @@ android_glVertexAttrib2f__IFF static void android_glVertexAttrib2fv__I_3FI (JNIEnv *_env, jobject _this, jint indx, jfloatArray values_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfloat *values_base = (GLfloat *) 0; jint _remaining; GLfloat *values = (GLfloat *) 0; if (!values_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "values == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "values == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(values_ref) - offset; @@ -4667,6 +5775,9 @@ android_glVertexAttrib2fv__I_3FI _env->ReleasePrimitiveArrayCritical(values_ref, values_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glVertexAttrib2fv ( GLuint indx, const GLfloat *values ) */ @@ -4674,10 +5785,15 @@ static void android_glVertexAttrib2fv__ILjava_nio_FloatBuffer_2 (JNIEnv *_env, jobject _this, jint indx, jobject values_buf) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfloat *values = (GLfloat *) 0; - values = (GLfloat *)getPointer(_env, values_buf, &_array, &_remaining); + values = (GLfloat *)getPointer(_env, values_buf, &_array, &_remaining, &_bufferOffset); + if (values == NULL) { + char * _valuesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + values = (GLfloat *) (_valuesBase + _bufferOffset); + } glVertexAttrib2fv( (GLuint)indx, (GLfloat *)values @@ -4703,16 +5819,23 @@ android_glVertexAttrib3f__IFFF static void android_glVertexAttrib3fv__I_3FI (JNIEnv *_env, jobject _this, jint indx, jfloatArray values_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfloat *values_base = (GLfloat *) 0; jint _remaining; GLfloat *values = (GLfloat *) 0; if (!values_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "values == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "values == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(values_ref) - offset; @@ -4730,6 +5853,9 @@ android_glVertexAttrib3fv__I_3FI _env->ReleasePrimitiveArrayCritical(values_ref, values_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glVertexAttrib3fv ( GLuint indx, const GLfloat *values ) */ @@ -4737,10 +5863,15 @@ static void android_glVertexAttrib3fv__ILjava_nio_FloatBuffer_2 (JNIEnv *_env, jobject _this, jint indx, jobject values_buf) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfloat *values = (GLfloat *) 0; - values = (GLfloat *)getPointer(_env, values_buf, &_array, &_remaining); + values = (GLfloat *)getPointer(_env, values_buf, &_array, &_remaining, &_bufferOffset); + if (values == NULL) { + char * _valuesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + values = (GLfloat *) (_valuesBase + _bufferOffset); + } glVertexAttrib3fv( (GLuint)indx, (GLfloat *)values @@ -4767,16 +5898,23 @@ android_glVertexAttrib4f__IFFFF static void android_glVertexAttrib4fv__I_3FI (JNIEnv *_env, jobject _this, jint indx, jfloatArray values_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfloat *values_base = (GLfloat *) 0; jint _remaining; GLfloat *values = (GLfloat *) 0; if (!values_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "values == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "values == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(values_ref) - offset; @@ -4794,6 +5932,9 @@ android_glVertexAttrib4fv__I_3FI _env->ReleasePrimitiveArrayCritical(values_ref, values_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glVertexAttrib4fv ( GLuint indx, const GLfloat *values ) */ @@ -4801,10 +5942,15 @@ static void android_glVertexAttrib4fv__ILjava_nio_FloatBuffer_2 (JNIEnv *_env, jobject _this, jint indx, jobject values_buf) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfloat *values = (GLfloat *) 0; - values = (GLfloat *)getPointer(_env, values_buf, &_array, &_remaining); + values = (GLfloat *)getPointer(_env, values_buf, &_array, &_remaining, &_bufferOffset); + if (values == NULL) { + char * _valuesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + values = (GLfloat *) (_valuesBase + _bufferOffset); + } glVertexAttrib4fv( (GLuint)indx, (GLfloat *)values @@ -4833,6 +5979,7 @@ static void android_glVertexAttribPointerBounds__IIIZILjava_nio_Buffer_2I (JNIEnv *_env, jobject _this, jint indx, jint size, jint type, jboolean normalized, jint stride, jobject ptr_buf, jint remaining) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLvoid *ptr = (GLvoid *) 0; @@ -4934,8 +6081,12 @@ static JNINativeMethod methods[] = { {"glGenTextures", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenTextures__ILjava_nio_IntBuffer_2 }, {"glGetActiveAttrib", "(III[II[II[II[BI)V", (void *) android_glGetActiveAttrib__III_3II_3II_3II_3BI }, {"glGetActiveAttrib", "(IIILjava/nio/IntBuffer;Ljava/nio/IntBuffer;Ljava/nio/IntBuffer;B)V", (void *) android_glGetActiveAttrib__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B }, +{"glGetActiveAttrib", "(II[II[II)Ljava/lang/String;", (void *) android_glGetActiveAttrib1 }, +{"glGetActiveAttrib", "(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)Ljava/lang/String;", (void *) android_glGetActiveAttrib2 }, {"glGetActiveUniform", "(III[II[II[II[BI)V", (void *) android_glGetActiveUniform__III_3II_3II_3II_3BI }, +{"glGetActiveUniform", "(II[II[II)Ljava/lang/String;", (void *) android_glGetActiveUniform1 }, {"glGetActiveUniform", "(IIILjava/nio/IntBuffer;Ljava/nio/IntBuffer;Ljava/nio/IntBuffer;B)V", (void *) android_glGetActiveUniform__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B }, +{"glGetActiveUniform", "(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)Ljava/lang/String;", (void *) android_glGetActiveUniform2 }, {"glGetAttachedShaders", "(II[II[II)V", (void *) android_glGetAttachedShaders__II_3II_3II }, {"glGetAttachedShaders", "(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)V", (void *) android_glGetAttachedShaders__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2 }, {"glGetAttribLocation", "(ILjava/lang/String;)I", (void *) android_glGetAttribLocation__ILjava_lang_String_2 }, @@ -4962,6 +6113,7 @@ static JNINativeMethod methods[] = { {"glGetShaderPrecisionFormat", "(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)V", (void *) android_glGetShaderPrecisionFormat__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2 }, {"glGetShaderSource", "(II[II[BI)V", (void *) android_glGetShaderSource__II_3II_3BI }, {"glGetShaderSource", "(IILjava/nio/IntBuffer;B)V", (void *) android_glGetShaderSource__IILjava_nio_IntBuffer_2B }, +{"glGetShaderSource", "(I)Ljava/lang/String;", (void *) android_glGetShaderSource }, {"glGetString", "(I)Ljava/lang/String;", (void *) android_glGetString }, {"glGetTexParameterfv", "(II[FI)V", (void *) android_glGetTexParameterfv__II_3FI }, {"glGetTexParameterfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetTexParameterfv__IILjava_nio_FloatBuffer_2 }, diff --git a/core/jni/android_os_FileUtils.cpp b/core/jni/android_os_FileUtils.cpp index 8d65cbcf74a79..a07f5b770b12d 100644 --- a/core/jni/android_os_FileUtils.cpp +++ b/core/jni/android_os_FileUtils.cpp @@ -33,19 +33,6 @@ namespace android { -static jfieldID gFileStatusDevFieldID; -static jfieldID gFileStatusInoFieldID; -static jfieldID gFileStatusModeFieldID; -static jfieldID gFileStatusNlinkFieldID; -static jfieldID gFileStatusUidFieldID; -static jfieldID gFileStatusGidFieldID; -static jfieldID gFileStatusSizeFieldID; -static jfieldID gFileStatusBlksizeFieldID; -static jfieldID gFileStatusBlocksFieldID; -static jfieldID gFileStatusAtimeFieldID; -static jfieldID gFileStatusMtimeFieldID; -static jfieldID gFileStatusCtimeFieldID; - jint android_os_FileUtils_setPermissions(JNIEnv* env, jobject clazz, jstring file, jint mode, jint uid, jint gid) @@ -68,44 +55,6 @@ jint android_os_FileUtils_setPermissions(JNIEnv* env, jobject clazz, return chmod(file8.string(), mode) == 0 ? 0 : errno; } -jint android_os_FileUtils_getPermissions(JNIEnv* env, jobject clazz, - jstring file, jintArray outArray) -{ - const jchar* str = env->GetStringCritical(file, 0); - String8 file8; - if (str) { - file8 = String8(str, env->GetStringLength(file)); - env->ReleaseStringCritical(file, str); - } - if (file8.size() <= 0) { - return ENOENT; - } - struct stat st; - if (stat(file8.string(), &st) != 0) { - return errno; - } - jint* array = (jint*)env->GetPrimitiveArrayCritical(outArray, 0); - if (array) { - int len = env->GetArrayLength(outArray); - if (len >= 1) { - array[0] = st.st_mode; - } - if (len >= 2) { - array[1] = st.st_uid; - } - if (len >= 3) { - array[2] = st.st_gid; - } - } - env->ReleasePrimitiveArrayCritical(outArray, array, 0); - return 0; -} - -jint android_os_FileUtils_setUMask(JNIEnv* env, jobject clazz, jint mask) -{ - return umask(mask); -} - jint android_os_FileUtils_getFatVolumeId(JNIEnv* env, jobject clazz, jstring path) { if (path == NULL) { @@ -127,63 +76,15 @@ jint android_os_FileUtils_getFatVolumeId(JNIEnv* env, jobject clazz, jstring pat return result; } -jboolean android_os_FileUtils_getFileStatus(JNIEnv* env, jobject clazz, jstring path, jobject fileStatus) { - const char* pathStr = env->GetStringUTFChars(path, NULL); - jboolean ret = false; - - struct stat s; - int res = stat(pathStr, &s); - if (res == 0) { - ret = true; - if (fileStatus != NULL) { - env->SetIntField(fileStatus, gFileStatusDevFieldID, s.st_dev); - env->SetIntField(fileStatus, gFileStatusInoFieldID, s.st_ino); - env->SetIntField(fileStatus, gFileStatusModeFieldID, s.st_mode); - env->SetIntField(fileStatus, gFileStatusNlinkFieldID, s.st_nlink); - env->SetIntField(fileStatus, gFileStatusUidFieldID, s.st_uid); - env->SetIntField(fileStatus, gFileStatusGidFieldID, s.st_gid); - env->SetLongField(fileStatus, gFileStatusSizeFieldID, s.st_size); - env->SetIntField(fileStatus, gFileStatusBlksizeFieldID, s.st_blksize); - env->SetLongField(fileStatus, gFileStatusBlocksFieldID, s.st_blocks); - env->SetLongField(fileStatus, gFileStatusAtimeFieldID, s.st_atime); - env->SetLongField(fileStatus, gFileStatusMtimeFieldID, s.st_mtime); - env->SetLongField(fileStatus, gFileStatusCtimeFieldID, s.st_ctime); - } - } - - env->ReleaseStringUTFChars(path, pathStr); - - return ret; -} - static const JNINativeMethod methods[] = { {"setPermissions", "(Ljava/lang/String;III)I", (void*)android_os_FileUtils_setPermissions}, - {"getPermissions", "(Ljava/lang/String;[I)I", (void*)android_os_FileUtils_getPermissions}, - {"setUMask", "(I)I", (void*)android_os_FileUtils_setUMask}, {"getFatVolumeId", "(Ljava/lang/String;)I", (void*)android_os_FileUtils_getFatVolumeId}, - {"getFileStatusNative", "(Ljava/lang/String;Landroid/os/FileUtils$FileStatus;)Z", (void*)android_os_FileUtils_getFileStatus}, }; static const char* const kFileUtilsPathName = "android/os/FileUtils"; int register_android_os_FileUtils(JNIEnv* env) { - jclass fileStatusClass = env->FindClass("android/os/FileUtils$FileStatus"); - LOG_FATAL_IF(fileStatusClass == NULL, "Unable to find class android.os.FileUtils$FileStatus"); - - gFileStatusDevFieldID = env->GetFieldID(fileStatusClass, "dev", "I"); - gFileStatusInoFieldID = env->GetFieldID(fileStatusClass, "ino", "I"); - gFileStatusModeFieldID = env->GetFieldID(fileStatusClass, "mode", "I"); - gFileStatusNlinkFieldID = env->GetFieldID(fileStatusClass, "nlink", "I"); - gFileStatusUidFieldID = env->GetFieldID(fileStatusClass, "uid", "I"); - gFileStatusGidFieldID = env->GetFieldID(fileStatusClass, "gid", "I"); - gFileStatusSizeFieldID = env->GetFieldID(fileStatusClass, "size", "J"); - gFileStatusBlksizeFieldID = env->GetFieldID(fileStatusClass, "blksize", "I"); - gFileStatusBlocksFieldID = env->GetFieldID(fileStatusClass, "blocks", "J"); - gFileStatusAtimeFieldID = env->GetFieldID(fileStatusClass, "atime", "J"); - gFileStatusMtimeFieldID = env->GetFieldID(fileStatusClass, "mtime", "J"); - gFileStatusCtimeFieldID = env->GetFieldID(fileStatusClass, "ctime", "J"); - return AndroidRuntime::registerNativeMethods( env, kFileUtilsPathName, methods, NELEM(methods)); diff --git a/core/jni/android_os_SELinux.cpp b/core/jni/android_os_SELinux.cpp new file mode 100644 index 0000000000000..e813c38475894 --- /dev/null +++ b/core/jni/android_os_SELinux.cpp @@ -0,0 +1,541 @@ +/* + * 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 "SELinuxJNI" +#include + +#include "JNIHelp.h" +#include "jni.h" +#include "android_runtime/AndroidRuntime.h" +#ifdef HAVE_SELINUX +#include "selinux/selinux.h" +#include "selinux/android.h" +#endif +#include + +namespace android { + + static jboolean isSELinuxDisabled = true; + + static void throw_NullPointerException(JNIEnv *env, const char* msg) { + jclass clazz; + clazz = env->FindClass("java/lang/NullPointerException"); + env->ThrowNew(clazz, msg); + } + + /* + * Function: isSELinuxEnabled + * Purpose: checks whether SELinux is enabled/disbaled + * Parameters: none + * Return value : true (enabled) or false (disabled) + * Exceptions: none + */ + static jboolean isSELinuxEnabled(JNIEnv *env, jobject classz) { + + return !isSELinuxDisabled; + } + + /* + * Function: isSELinuxEnforced + * Purpose: return the current SELinux enforce mode + * Parameters: none + * Return value: true (enforcing) or false (permissive) + * Exceptions: none + */ + static jboolean isSELinuxEnforced(JNIEnv *env, jobject clazz) { +#ifdef HAVE_SELINUX + return (security_getenforce() == 1) ? true : false; +#else + return false; +#endif + } + + /* + * Function: setSELinuxEnforce + * Purpose: set the SE Linux enforcing mode + * Parameters: true (enforcing) or false (permissive) + * Return value: true (success) or false (fail) + * Exceptions: none + */ + static jboolean setSELinuxEnforce(JNIEnv *env, jobject clazz, jboolean value) { +#ifdef HAVE_SELINUX + if (isSELinuxDisabled) + return false; + + int enforce = (value) ? 1 : 0; + + return (security_setenforce(enforce) != -1) ? true : false; +#else + return false; +#endif + } + + /* + * Function: getPeerCon + * Purpose: retrieves security context of peer socket + * Parameters: + * fileDescriptor: peer socket file as a FileDescriptor object + * Returns: jstring representing the security_context of socket or NULL if error + * Exceptions: NullPointerException if fileDescriptor object is NULL + */ + static jstring getPeerCon(JNIEnv *env, jobject clazz, jobject fileDescriptor) { +#ifdef HAVE_SELINUX + if (isSELinuxDisabled) + return NULL; + + if (fileDescriptor == NULL) { + throw_NullPointerException(env, "Trying to check security context of a null peer socket."); + return NULL; + } + + security_context_t context = NULL; + jstring securityString = NULL; + + int fd = jniGetFDFromFileDescriptor(env, fileDescriptor); + + if (env->ExceptionOccurred() != NULL) { + ALOGE("There was an issue with retrieving the file descriptor"); + goto bail; + } + + if (getpeercon(fd, &context) == -1) + goto bail; + + ALOGV("getPeerCon: Successfully retrived context of peer socket '%s'", context); + + securityString = env->NewStringUTF(context); + + bail: + if (context != NULL) + freecon(context); + + return securityString; +#else + return NULL; +#endif + } + + /* + * Function: setFSCreateCon + * Purpose: set security context used for creating a new file system object + * Parameters: + * context: security_context_t representing the new context of a file system object, + * set to NULL to return to the default policy behavior + * Returns: true on success, false on error + * Exception: none + */ + static jboolean setFSCreateCon(JNIEnv *env, jobject clazz, jstring context) { +#ifdef HAVE_SELINUX + if (isSELinuxDisabled) + return false; + + char * securityContext = NULL; + const char *constant_securityContext = NULL; + + if (context != NULL) { + constant_securityContext = env->GetStringUTFChars(context, NULL); + + // GetStringUTFChars returns const char * yet setfscreatecon needs char * + securityContext = const_cast(constant_securityContext); + } + + int ret; + if ((ret = setfscreatecon(securityContext)) == -1) + goto bail; + + ALOGV("setFSCreateCon: set new security context to '%s' ", context == NULL ? "default", context); + + bail: + if (constant_securityContext != NULL) + env->ReleaseStringUTFChars(context, constant_securityContext); + + return (ret == 0) ? true : false; +#else + return false; +#endif + } + + /* + * Function: setFileCon + * Purpose: set the security context of a file object + * Parameters: + * path: the location of the file system object + * con: the new security context of the file system object + * Returns: true on success, false on error + * Exception: NullPointerException is thrown if either path or context strign are NULL + */ + static jboolean setFileCon(JNIEnv *env, jobject clazz, jstring path, jstring con) { +#ifdef HAVE_SELINUX + if (isSELinuxDisabled) + return false; + + if (path == NULL) { + throw_NullPointerException(env, "Trying to change the security context of a NULL file object."); + return false; + } + + if (con == NULL) { + throw_NullPointerException(env, "Trying to set the security context of a file object with NULL."); + return false; + } + + const char *objectPath = env->GetStringUTFChars(path, NULL); + const char *constant_con = env->GetStringUTFChars(con, NULL); + + // GetStringUTFChars returns const char * yet setfilecon needs char * + char *newCon = const_cast(constant_con); + + int ret; + if ((ret = setfilecon(objectPath, newCon)) == -1) + goto bail; + + ALOGV("setFileCon: Succesfully set security context '%s' for '%s'", newCon, objectPath); + + bail: + env->ReleaseStringUTFChars(path, objectPath); + env->ReleaseStringUTFChars(con, constant_con); + return (ret == 0) ? true : false; +#else + return false; +#endif + } + + /* + * Function: getFileCon + * Purpose: retrieves the context associated with the given path in the file system + * Parameters: + * path: given path in the file system + * Returns: + * string representing the security context string of the file object + * the string may be NULL if an error occured + * Exceptions: NullPointerException if the path object is null + */ + static jstring getFileCon(JNIEnv *env, jobject clazz, jstring path) { +#ifdef HAVE_SELINUX + if (isSELinuxDisabled) + return NULL; + + if (path == NULL) { + throw_NullPointerException(env, "Trying to check security context of a null path."); + return NULL; + } + + const char *objectPath = env->GetStringUTFChars(path, NULL); + + security_context_t context = NULL; + jstring securityString = NULL; + + if (getfilecon(objectPath, &context) == -1) + goto bail; + + ALOGV("getFileCon: Successfully retrived context '%s' for file '%s'", context, objectPath); + + securityString = env->NewStringUTF(context); + + bail: + if (context != NULL) + freecon(context); + + env->ReleaseStringUTFChars(path, objectPath); + + return securityString; +#else + return NULL; +#endif + } + + /* + * Function: getCon + * Purpose: Get the context of the current process. + * Parameters: none + * Returns: a jstring representing the security context of the process, + * the jstring may be NULL if there was an error + * Exceptions: none + */ + static jstring getCon(JNIEnv *env, jobject clazz) { +#ifdef HAVE_SELINUX + if (isSELinuxDisabled) + return NULL; + + security_context_t context = NULL; + jstring securityString = NULL; + + if (getcon(&context) == -1) + goto bail; + + ALOGV("getCon: Successfully retrieved context '%s'", context); + + securityString = env->NewStringUTF(context); + + bail: + if (context != NULL) + freecon(context); + + return securityString; +#else + return NULL; +#endif + } + + /* + * Function: getPidCon + * Purpose: Get the context of a process identified by its pid + * Parameters: + * pid: a jint representing the process + * Returns: a jstring representing the security context of the pid, + * the jstring may be NULL if there was an error + * Exceptions: none + */ + static jstring getPidCon(JNIEnv *env, jobject clazz, jint pid) { +#ifdef HAVE_SELINUX + if (isSELinuxDisabled) + return NULL; + + security_context_t context = NULL; + jstring securityString = NULL; + + pid_t checkPid = (pid_t)pid; + + if (getpidcon(checkPid, &context) == -1) + goto bail; + + ALOGV("getPidCon: Successfully retrived context '%s' for pid '%d'", context, checkPid); + + securityString = env->NewStringUTF(context); + + bail: + if (context != NULL) + freecon(context); + + return securityString; +#else + return NULL; +#endif + } + + /* + * Function: getBooleanNames + * Purpose: Gets a list of the SELinux boolean names. + * Parameters: None + * Returns: an array of strings containing the SELinux boolean names. + * returns NULL string on error + * Exceptions: None + */ + static jobjectArray getBooleanNames(JNIEnv *env, JNIEnv clazz) { +#ifdef HAVE_SELINUX + if (isSELinuxDisabled) + return NULL; + + char **list; + int i, len, ret; + jclass stringClass; + jobjectArray stringArray = NULL; + + if (security_get_boolean_names(&list, &len) == -1) + return NULL; + + stringClass = env->FindClass("java/lang/String"); + stringArray = env->NewObjectArray(len, stringClass, env->NewStringUTF("")); + for (i = 0; i < len; i++) { + jstring obj; + obj = env->NewStringUTF(list[i]); + env->SetObjectArrayElement(stringArray, i, obj); + env->DeleteLocalRef(obj); + free(list[i]); + } + free(list); + + return stringArray; +#else + return NULL; +#endif + } + + /* + * Function: getBooleanValue + * Purpose: Gets the value for the given SELinux boolean name. + * Parameters: + * String: The name of the SELinux boolean. + * Returns: a boolean: (true) boolean is set or (false) it is not. + * Exceptions: None + */ + static jboolean getBooleanValue(JNIEnv *env, jobject clazz, jstring name) { +#ifdef HAVE_SELINUX + if (isSELinuxDisabled) + return false; + + const char *boolean_name; + int ret; + + if (name == NULL) + return false; + boolean_name = env->GetStringUTFChars(name, NULL); + ret = security_get_boolean_active(boolean_name); + env->ReleaseStringUTFChars(name, boolean_name); + return (ret == 1) ? true : false; +#else + return false; +#endif + } + + /* + * Function: setBooleanNames + * Purpose: Sets the value for the given SELinux boolean name. + * Parameters: + * String: The name of the SELinux boolean. + * Boolean: The new value of the SELinux boolean. + * Returns: a boolean indicating whether or not the operation succeeded. + * Exceptions: None + */ + static jboolean setBooleanValue(JNIEnv *env, jobject clazz, jstring name, jboolean value) { +#ifdef HAVE_SELINUX + if (isSELinuxDisabled) + return false; + + const char *boolean_name = NULL; + int ret; + + if (name == NULL) + return false; + boolean_name = env->GetStringUTFChars(name, NULL); + ret = security_set_boolean(boolean_name, (value) ? 1 : 0); + env->ReleaseStringUTFChars(name, boolean_name); + if (ret) + return false; + + if (security_commit_booleans() == -1) + return false; + + return true; +#else + return false; +#endif + } + + /* + * Function: checkSELinuxAccess + * Purpose: Check permissions between two security contexts. + * Parameters: scon: subject security context as a string + * tcon: object security context as a string + * tclass: object's security class name as a string + * perm: permission name as a string + * Returns: boolean: (true) if permission was granted, (false) otherwise + * Exceptions: None + */ + static jboolean checkSELinuxAccess(JNIEnv *env, jobject clazz, jstring scon, jstring tcon, jstring tclass, jstring perm) { +#ifdef HAVE_SELINUX + if (isSELinuxDisabled) + return true; + + int accessGranted = -1; + + const char *const_scon, *const_tcon, *mytclass, *myperm; + char *myscon, *mytcon; + + if (scon == NULL || tcon == NULL || tclass == NULL || perm == NULL) + goto bail; + + const_scon = env->GetStringUTFChars(scon, NULL); + const_tcon = env->GetStringUTFChars(tcon, NULL); + mytclass = env->GetStringUTFChars(tclass, NULL); + myperm = env->GetStringUTFChars(perm, NULL); + + // selinux_check_access needs char* for some + myscon = const_cast(const_scon); + mytcon = const_cast(const_tcon); + + accessGranted = selinux_check_access(myscon, mytcon, mytclass, myperm, NULL); + + ALOGV("selinux_check_access returned %d", accessGranted); + + env->ReleaseStringUTFChars(scon, const_scon); + env->ReleaseStringUTFChars(tcon, const_tcon); + env->ReleaseStringUTFChars(tclass, mytclass); + env->ReleaseStringUTFChars(perm, myperm); + + bail: + return (accessGranted == 0) ? true : false; + +#else + return true; +#endif + } + + /* + * Function: native_restorecon + * Purpose: restore default SELinux security context + * Parameters: pathname: the pathname for the file to be relabeled + * Returns: boolean: (true) file label successfully restored, (false) otherwise + * Exceptions: none + */ + static jboolean native_restorecon(JNIEnv *env, jobject clazz, jstring pathname) { +#ifdef HAVE_SELINUX + if (isSELinuxDisabled) + return true; + + const char *file = const_cast(env->GetStringUTFChars(pathname, NULL)); + int ret = selinux_android_restorecon(file); + env->ReleaseStringUTFChars(pathname, file); + return (ret == 0); +#else + return true; +#endif + } + + /* + * JNI registration. + */ + static JNINativeMethod method_table[] = { + + /* name, signature, funcPtr */ + { "checkSELinuxAccess" , "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Z" , (void*)checkSELinuxAccess }, + { "getBooleanNames" , "()[Ljava/lang/String;" , (void*)getBooleanNames }, + { "getBooleanValue" , "(Ljava/lang/String;)Z" , (void*)getBooleanValue }, + { "getContext" , "()Ljava/lang/String;" , (void*)getCon }, + { "getFileContext" , "(Ljava/lang/String;)Ljava/lang/String;" , (void*)getFileCon }, + { "getPeerContext" , "(Ljava/io/FileDescriptor;)Ljava/lang/String;" , (void*)getPeerCon }, + { "getPidContext" , "(I)Ljava/lang/String;" , (void*)getPidCon }, + { "isSELinuxEnforced" , "()Z" , (void*)isSELinuxEnforced}, + { "isSELinuxEnabled" , "()Z" , (void*)isSELinuxEnabled }, + { "native_restorecon" , "(Ljava/lang/String;)Z" , (void*)native_restorecon}, + { "setBooleanValue" , "(Ljava/lang/String;Z)Z" , (void*)setBooleanValue }, + { "setFileContext" , "(Ljava/lang/String;Ljava/lang/String;)Z" , (void*)setFileCon }, + { "setFSCreateContext" , "(Ljava/lang/String;)Z" , (void*)setFSCreateCon }, + { "setSELinuxEnforce" , "(Z)Z" , (void*)setSELinuxEnforce}, + }; + + static int log_callback(int type, const char *fmt, ...) { + va_list ap; + va_start(ap, fmt); + LOG_PRI_VA(ANDROID_LOG_ERROR, "SELinux", fmt, ap); + va_end(ap); + return 0; + } + + int register_android_os_SELinux(JNIEnv *env) { +#ifdef HAVE_SELINUX + union selinux_callback cb; + cb.func_log = log_callback; + selinux_set_callback(SELINUX_CB_LOG, cb); + + isSELinuxDisabled = (is_selinux_enabled() != 1) ? true : false; + +#endif + return AndroidRuntime::registerNativeMethods( + env, "android/os/SELinux", + method_table, NELEM(method_table)); + } +} diff --git a/core/jni/android_os_StatFs.cpp b/core/jni/android_os_StatFs.cpp deleted file mode 100644 index 79d8fef12862e..0000000000000 --- a/core/jni/android_os_StatFs.cpp +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright 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. - */ - -#if INCLUDE_SYS_MOUNT_FOR_STATFS -#include -#else -#include -#endif - -#include - -#include "jni.h" -#include "JNIHelp.h" -#include "android_runtime/AndroidRuntime.h" - - -namespace android -{ - -// ---------------------------------------------------------------------------- - -struct fields_t { - jfieldID context; -}; -static fields_t fields; - -// ---------------------------------------------------------------------------- - -static jint -android_os_StatFs_getBlockSize(JNIEnv *env, jobject thiz) -{ - struct statfs *stat = (struct statfs *)env->GetIntField(thiz, fields.context); - return stat->f_bsize; -} - -static jint -android_os_StatFs_getBlockCount(JNIEnv *env, jobject thiz) -{ - struct statfs *stat = (struct statfs *)env->GetIntField(thiz, fields.context); - return stat->f_blocks; -} - -static jint -android_os_StatFs_getFreeBlocks(JNIEnv *env, jobject thiz) -{ - struct statfs *stat = (struct statfs *)env->GetIntField(thiz, fields.context); - return stat->f_bfree; -} - -static jint -android_os_StatFs_getAvailableBlocks(JNIEnv *env, jobject thiz) -{ - struct statfs *stat = (struct statfs *)env->GetIntField(thiz, fields.context); - return stat->f_bavail; -} - -static void -android_os_StatFs_native_restat(JNIEnv *env, jobject thiz, jstring path) -{ - if (path == NULL) { - jniThrowException(env, "java/lang/IllegalArgumentException", NULL); - return; - } - - // get the object handle - struct statfs *stat = (struct statfs *)env->GetIntField(thiz, fields.context); - if (stat == NULL) { - jniThrowException(env, "java/lang/NoSuchFieldException", NULL); - return; - } - - const char* pathstr = env->GetStringUTFChars(path, NULL); - if (pathstr == NULL) { - jniThrowException(env, "java/lang/RuntimeException", "Out of memory"); - return; - } - - // note that stat will contain the new file data corresponding to - // pathstr - if (statfs(pathstr, stat) != 0) { - ALOGE("statfs %s failed, errno: %d", pathstr, errno); - delete stat; - env->SetIntField(thiz, fields.context, 0); - jniThrowException(env, "java/lang/IllegalArgumentException", NULL); - } - // Release pathstr - env->ReleaseStringUTFChars(path, pathstr); -} - -static void -android_os_StatFs_native_setup(JNIEnv *env, jobject thiz, jstring path) -{ - if (path == NULL) { - jniThrowException(env, "java/lang/IllegalArgumentException", NULL); - return; - } - - struct statfs* stat = new struct statfs; - if (stat == NULL) { - jniThrowException(env, "java/lang/RuntimeException", "Out of memory"); - return; - } - env->SetIntField(thiz, fields.context, (int)stat); - android_os_StatFs_native_restat(env, thiz, path); -} - -static void -android_os_StatFs_native_finalize(JNIEnv *env, jobject thiz) -{ - struct statfs *stat = (struct statfs *)env->GetIntField(thiz, fields.context); - if (stat != NULL) { - delete stat; - env->SetIntField(thiz, fields.context, 0); - } -} - -// ---------------------------------------------------------------------------- - -static JNINativeMethod gMethods[] = { - {"getBlockSize", "()I", (void *)android_os_StatFs_getBlockSize}, - {"getBlockCount", "()I", (void *)android_os_StatFs_getBlockCount}, - {"getFreeBlocks", "()I", (void *)android_os_StatFs_getFreeBlocks}, - {"getAvailableBlocks", "()I", (void *)android_os_StatFs_getAvailableBlocks}, - {"native_setup", "(Ljava/lang/String;)V", (void *)android_os_StatFs_native_setup}, - {"native_finalize", "()V", (void *)android_os_StatFs_native_finalize}, - {"native_restat", "(Ljava/lang/String;)V", (void *)android_os_StatFs_native_restat}, -}; - - -int register_android_os_StatFs(JNIEnv *env) -{ - jclass clazz; - - clazz = env->FindClass("android/os/StatFs"); - if (clazz == NULL) { - ALOGE("Can't find android/os/StatFs"); - return -1; - } - - fields.context = env->GetFieldID(clazz, "mNativeContext", "I"); - if (fields.context == NULL) { - ALOGE("Can't find StatFs.mNativeContext"); - return -1; - } - - return AndroidRuntime::registerNativeMethods(env, - "android/os/StatFs", gMethods, NELEM(gMethods)); -} - -} // namespace android diff --git a/core/jni/android_os_SystemClock.cpp b/core/jni/android_os_SystemClock.cpp index 66d58cd4a4704..5c135eeeb682a 100644 --- a/core/jni/android_os_SystemClock.cpp +++ b/core/jni/android_os_SystemClock.cpp @@ -111,6 +111,15 @@ static jlong android_os_SystemClock_currentTimeMicro(JNIEnv* env, return tv.tv_sec * 1000000LL + tv.tv_usec; } +/* + * public static native long elapsedRealtimeNano(); + */ +static jlong android_os_SystemClock_elapsedRealtimeNano(JNIEnv* env, + jobject clazz) +{ + return (jlong)elapsedRealtimeNano(); +} + /* * JNI registration. */ @@ -128,6 +137,8 @@ static JNINativeMethod gMethods[] = { (void*) android_os_SystemClock_currentThreadTimeMicro }, { "currentTimeMicro", "()J", (void*) android_os_SystemClock_currentTimeMicro }, + { "elapsedRealtimeNanos", "()J", + (void*) android_os_SystemClock_elapsedRealtimeNano }, }; int register_android_os_SystemClock(JNIEnv* env) { diff --git a/core/jni/android_os_Trace.cpp b/core/jni/android_os_Trace.cpp index af8edaecbb099..31a8974d5b57d 100644 --- a/core/jni/android_os_Trace.cpp +++ b/core/jni/android_os_Trace.cpp @@ -25,7 +25,7 @@ namespace android { static jlong android_os_Trace_nativeGetEnabledTags(JNIEnv* env, jclass clazz) { - return Tracer::getEnabledTags(); + return 0;//Tracer::getEnabledTags(); } static void android_os_Trace_nativeTraceCounter(JNIEnv* env, jclass clazz, diff --git a/core/jni/android_os_UEventObserver.cpp b/core/jni/android_os_UEventObserver.cpp index 5639f4f8a01f0..3f7c7d28f8b53 100644 --- a/core/jni/android_os_UEventObserver.cpp +++ b/core/jni/android_os_UEventObserver.cpp @@ -15,6 +15,8 @@ */ #define LOG_TAG "UEventObserver" +//#define LOG_NDEBUG 0 + #include "utils/Log.h" #include "hardware_legacy/uevent.h" @@ -22,34 +24,94 @@ #include "JNIHelp.h" #include "android_runtime/AndroidRuntime.h" -namespace android -{ +#include +#include +#include +#include -static void -android_os_UEventObserver_native_setup(JNIEnv *env, jclass clazz) -{ +namespace android { + +static Mutex gMatchesMutex; +static Vector gMatches; + +static void nativeSetup(JNIEnv *env, jclass clazz) { if (!uevent_init()) { jniThrowException(env, "java/lang/RuntimeException", - "Unable to open socket for UEventObserver"); + "Unable to open socket for UEventObserver"); } } -static int -android_os_UEventObserver_next_event(JNIEnv *env, jclass clazz, jbyteArray jbuffer) -{ - int buf_sz = env->GetArrayLength(jbuffer); - char *buffer = (char*)env->GetByteArrayElements(jbuffer, NULL); +static bool isMatch(const char* buffer, size_t length) { + AutoMutex _l(gMatchesMutex); + + for (size_t i = 0; i < gMatches.size(); i++) { + const String8& match = gMatches.itemAt(i); + + // Consider all zero-delimited fields of the buffer. + const char* field = buffer; + const char* end = buffer + length + 1; + do { + if (strstr(field, match.string())) { + ALOGV("Matched uevent message with pattern: %s", match.string()); + return true; + } + field += strlen(field) + 1; + } while (field != end); + } + return false; +} - int length = uevent_next_event(buffer, buf_sz - 1); +static jstring nativeWaitForNextEvent(JNIEnv *env, jclass clazz) { + char buffer[1024]; - env->ReleaseByteArrayElements(jbuffer, (jbyte*)buffer, 0); + for (;;) { + int length = uevent_next_event(buffer, sizeof(buffer) - 1); + if (length <= 0) { + return NULL; + } + buffer[length] = '\0'; - return length; + ALOGV("Received uevent message: %s", buffer); + + if (isMatch(buffer, length)) { + // Assume the message is ASCII. + jchar message[length]; + for (int i = 0; i < length; i++) { + message[i] = buffer[i]; + } + return env->NewString(message, length); + } + } +} + +static void nativeAddMatch(JNIEnv* env, jclass clazz, jstring matchStr) { + ScopedUtfChars match(env, matchStr); + + AutoMutex _l(gMatchesMutex); + gMatches.add(String8(match.c_str())); +} + +static void nativeRemoveMatch(JNIEnv* env, jclass clazz, jstring matchStr) { + ScopedUtfChars match(env, matchStr); + + AutoMutex _l(gMatchesMutex); + for (size_t i = 0; i < gMatches.size(); i++) { + if (gMatches.itemAt(i) == match.c_str()) { + gMatches.removeAt(i); + break; // only remove first occurrence + } + } } static JNINativeMethod gMethods[] = { - {"native_setup", "()V", (void *)android_os_UEventObserver_native_setup}, - {"next_event", "([B)I", (void *)android_os_UEventObserver_next_event}, + { "nativeSetup", "()V", + (void *)nativeSetup }, + { "nativeWaitForNextEvent", "()Ljava/lang/String;", + (void *)nativeWaitForNextEvent }, + { "nativeAddMatch", "(Ljava/lang/String;)V", + (void *)nativeAddMatch }, + { "nativeRemoveMatch", "(Ljava/lang/String;)V", + (void *)nativeRemoveMatch }, }; @@ -64,7 +126,7 @@ int register_android_os_UEventObserver(JNIEnv *env) } return AndroidRuntime::registerNativeMethods(env, - "android/os/UEventObserver", gMethods, NELEM(gMethods)); + "android/os/UEventObserver", gMethods, NELEM(gMethods)); } } // namespace android diff --git a/core/jni/android_server_BluetoothA2dpService.cpp b/core/jni/android_server_BluetoothA2dpService.cpp deleted file mode 100644 index d065a9e1ecaf3..0000000000000 --- a/core/jni/android_server_BluetoothA2dpService.cpp +++ /dev/null @@ -1,344 +0,0 @@ -/* -** Copyright 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. -*/ - -#define LOG_TAG "BluetoothA2dpService.cpp" - -#include "android_bluetooth_common.h" -#include "android_runtime/AndroidRuntime.h" -#include "JNIHelp.h" -#include "jni.h" -#include "utils/Log.h" -#include "utils/misc.h" - -#include -#include -#include -#include -#include -#include - -#ifdef HAVE_BLUETOOTH -#include -#endif - -namespace android { - -#ifdef HAVE_BLUETOOTH -static jmethodID method_onSinkPropertyChanged; -static jmethodID method_onConnectSinkResult; - -typedef struct { - JavaVM *vm; - int envVer; - DBusConnection *conn; - jobject me; // for callbacks to java -} native_data_t; - -static native_data_t *nat = NULL; // global native data -static void onConnectSinkResult(DBusMessage *msg, void *user, void *n); - -static Properties sink_properties[] = { - {"State", DBUS_TYPE_STRING}, - {"Connected", DBUS_TYPE_BOOLEAN}, - {"Playing", DBUS_TYPE_BOOLEAN}, - }; -#endif - -/* Returns true on success (even if adapter is present but disabled). - * Return false if dbus is down, or another serious error (out of memory) -*/ -static bool initNative(JNIEnv* env, jobject object) { - ALOGV("%s", __FUNCTION__); -#ifdef HAVE_BLUETOOTH - nat = (native_data_t *)calloc(1, sizeof(native_data_t)); - if (NULL == nat) { - ALOGE("%s: out of memory!", __FUNCTION__); - return false; - } - env->GetJavaVM( &(nat->vm) ); - nat->envVer = env->GetVersion(); - nat->me = env->NewGlobalRef(object); - - DBusError err; - dbus_error_init(&err); - dbus_threads_init_default(); - nat->conn = dbus_bus_get(DBUS_BUS_SYSTEM, &err); - if (dbus_error_is_set(&err)) { - ALOGE("Could not get onto the system bus: %s", err.message); - dbus_error_free(&err); - return false; - } - dbus_connection_set_exit_on_disconnect(nat->conn, FALSE); -#endif /*HAVE_BLUETOOTH*/ - return true; -} - -static void cleanupNative(JNIEnv* env, jobject object) { -#ifdef HAVE_BLUETOOTH - ALOGV("%s", __FUNCTION__); - if (nat) { - dbus_connection_close(nat->conn); - env->DeleteGlobalRef(nat->me); - free(nat); - nat = NULL; - } -#endif -} - -static jobjectArray getSinkPropertiesNative(JNIEnv *env, jobject object, - jstring path) { -#ifdef HAVE_BLUETOOTH - ALOGV("%s", __FUNCTION__); - if (nat) { - DBusMessage *msg, *reply; - DBusError err; - dbus_error_init(&err); - - const char *c_path = env->GetStringUTFChars(path, NULL); - reply = dbus_func_args_timeout(env, - nat->conn, -1, c_path, - "org.bluez.AudioSink", "GetProperties", - DBUS_TYPE_INVALID); - env->ReleaseStringUTFChars(path, c_path); - if (!reply && dbus_error_is_set(&err)) { - LOG_AND_FREE_DBUS_ERROR_WITH_MSG(&err, reply); - return NULL; - } else if (!reply) { - ALOGE("DBus reply is NULL in function %s", __FUNCTION__); - return NULL; - } - DBusMessageIter iter; - if (dbus_message_iter_init(reply, &iter)) - return parse_properties(env, &iter, (Properties *)&sink_properties, - sizeof(sink_properties) / sizeof(Properties)); - } -#endif - return NULL; -} - - -static jboolean connectSinkNative(JNIEnv *env, jobject object, jstring path) { -#ifdef HAVE_BLUETOOTH - ALOGV("%s", __FUNCTION__); - if (nat) { - const char *c_path = env->GetStringUTFChars(path, NULL); - int len = env->GetStringLength(path) + 1; - char *context_path = (char *)calloc(len, sizeof(char)); - strlcpy(context_path, c_path, len); // for callback - - bool ret = dbus_func_args_async(env, nat->conn, -1, onConnectSinkResult, context_path, - nat, c_path, "org.bluez.AudioSink", "Connect", - DBUS_TYPE_INVALID); - - env->ReleaseStringUTFChars(path, c_path); - return ret ? JNI_TRUE : JNI_FALSE; - } -#endif - return JNI_FALSE; -} - -static jboolean disconnectSinkNative(JNIEnv *env, jobject object, - jstring path) { -#ifdef HAVE_BLUETOOTH - ALOGV("%s", __FUNCTION__); - if (nat) { - const char *c_path = env->GetStringUTFChars(path, NULL); - - bool ret = dbus_func_args_async(env, nat->conn, -1, NULL, NULL, nat, - c_path, "org.bluez.AudioSink", "Disconnect", - DBUS_TYPE_INVALID); - - env->ReleaseStringUTFChars(path, c_path); - return ret ? JNI_TRUE : JNI_FALSE; - } -#endif - return JNI_FALSE; -} - -static jboolean suspendSinkNative(JNIEnv *env, jobject object, - jstring path) { -#ifdef HAVE_BLUETOOTH - ALOGV("%s", __FUNCTION__); - if (nat) { - const char *c_path = env->GetStringUTFChars(path, NULL); - bool ret = dbus_func_args_async(env, nat->conn, -1, NULL, NULL, nat, - c_path, "org.bluez.audio.Sink", "Suspend", - DBUS_TYPE_INVALID); - env->ReleaseStringUTFChars(path, c_path); - return ret ? JNI_TRUE : JNI_FALSE; - } -#endif - return JNI_FALSE; -} - -static jboolean resumeSinkNative(JNIEnv *env, jobject object, - jstring path) { -#ifdef HAVE_BLUETOOTH - ALOGV("%s", __FUNCTION__); - if (nat) { - const char *c_path = env->GetStringUTFChars(path, NULL); - bool ret = dbus_func_args_async(env, nat->conn, -1, NULL, NULL, nat, - c_path, "org.bluez.audio.Sink", "Resume", - DBUS_TYPE_INVALID); - env->ReleaseStringUTFChars(path, c_path); - return ret ? JNI_TRUE : JNI_FALSE; - } -#endif - return JNI_FALSE; -} - -static jboolean avrcpVolumeUpNative(JNIEnv *env, jobject object, - jstring path) { -#ifdef HAVE_BLUETOOTH - ALOGV("%s", __FUNCTION__); - if (nat) { - const char *c_path = env->GetStringUTFChars(path, NULL); - bool ret = dbus_func_args_async(env, nat->conn, -1, NULL, NULL, nat, - c_path, "org.bluez.Control", "VolumeUp", - DBUS_TYPE_INVALID); - env->ReleaseStringUTFChars(path, c_path); - return ret ? JNI_TRUE : JNI_FALSE; - } -#endif - return JNI_FALSE; -} - -static jboolean avrcpVolumeDownNative(JNIEnv *env, jobject object, - jstring path) { -#ifdef HAVE_BLUETOOTH - ALOGV("%s", __FUNCTION__); - if (nat) { - const char *c_path = env->GetStringUTFChars(path, NULL); - bool ret = dbus_func_args_async(env, nat->conn, -1, NULL, NULL, nat, - c_path, "org.bluez.Control", "VolumeDown", - DBUS_TYPE_INVALID); - env->ReleaseStringUTFChars(path, c_path); - return ret ? JNI_TRUE : JNI_FALSE; - } -#endif - return JNI_FALSE; -} - -#ifdef HAVE_BLUETOOTH -DBusHandlerResult a2dp_event_filter(DBusMessage *msg, JNIEnv *env) { - DBusError err; - - if (!nat) { - ALOGV("... skipping %s\n", __FUNCTION__); - ALOGV("... ignored\n"); - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; - } - - dbus_error_init(&err); - - if (dbus_message_get_type(msg) != DBUS_MESSAGE_TYPE_SIGNAL) { - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; - } - - DBusHandlerResult result = DBUS_HANDLER_RESULT_NOT_YET_HANDLED; - - if (dbus_message_is_signal(msg, "org.bluez.AudioSink", - "PropertyChanged")) { - jobjectArray str_array = - parse_property_change(env, msg, (Properties *)&sink_properties, - sizeof(sink_properties) / sizeof(Properties)); - const char *c_path = dbus_message_get_path(msg); - jstring path = env->NewStringUTF(c_path); - env->CallVoidMethod(nat->me, - method_onSinkPropertyChanged, - path, - str_array); - env->DeleteLocalRef(path); - result = DBUS_HANDLER_RESULT_HANDLED; - return result; - } else { - ALOGV("... ignored"); - } - if (env->ExceptionCheck()) { - ALOGE("VM Exception occurred while handling %s.%s (%s) in %s," - " leaving for VM", - dbus_message_get_interface(msg), dbus_message_get_member(msg), - dbus_message_get_path(msg), __FUNCTION__); - } - - return result; -} - -void onConnectSinkResult(DBusMessage *msg, void *user, void *n) { - ALOGV("%s", __FUNCTION__); - - native_data_t *nat = (native_data_t *)n; - const char *path = (const char *)user; - DBusError err; - dbus_error_init(&err); - JNIEnv *env; - nat->vm->GetEnv((void**)&env, nat->envVer); - - - bool result = JNI_TRUE; - if (dbus_set_error_from_message(&err, msg)) { - LOG_AND_FREE_DBUS_ERROR(&err); - result = JNI_FALSE; - } - ALOGV("... Device Path = %s, result = %d", path, result); - - jstring jPath = env->NewStringUTF(path); - env->CallVoidMethod(nat->me, - method_onConnectSinkResult, - jPath, - result); - env->DeleteLocalRef(jPath); - free(user); -} - - -#endif - - -static JNINativeMethod sMethods[] = { - {"initNative", "()Z", (void *)initNative}, - {"cleanupNative", "()V", (void *)cleanupNative}, - - /* Bluez audio 4.47 API */ - {"connectSinkNative", "(Ljava/lang/String;)Z", (void *)connectSinkNative}, - {"disconnectSinkNative", "(Ljava/lang/String;)Z", (void *)disconnectSinkNative}, - {"suspendSinkNative", "(Ljava/lang/String;)Z", (void*)suspendSinkNative}, - {"resumeSinkNative", "(Ljava/lang/String;)Z", (void*)resumeSinkNative}, - {"getSinkPropertiesNative", "(Ljava/lang/String;)[Ljava/lang/Object;", - (void *)getSinkPropertiesNative}, - {"avrcpVolumeUpNative", "(Ljava/lang/String;)Z", (void*)avrcpVolumeUpNative}, - {"avrcpVolumeDownNative", "(Ljava/lang/String;)Z", (void*)avrcpVolumeDownNative}, -}; - -int register_android_server_BluetoothA2dpService(JNIEnv *env) { - jclass clazz = env->FindClass("android/server/BluetoothA2dpService"); - if (clazz == NULL) { - ALOGE("Can't find android/server/BluetoothA2dpService"); - return -1; - } - -#ifdef HAVE_BLUETOOTH - method_onSinkPropertyChanged = env->GetMethodID(clazz, "onSinkPropertyChanged", - "(Ljava/lang/String;[Ljava/lang/String;)V"); - method_onConnectSinkResult = env->GetMethodID(clazz, "onConnectSinkResult", - "(Ljava/lang/String;Z)V"); -#endif - - return AndroidRuntime::registerNativeMethods(env, - "android/server/BluetoothA2dpService", sMethods, NELEM(sMethods)); -} - -} /* namespace android */ diff --git a/core/jni/android_server_BluetoothEventLoop.cpp b/core/jni/android_server_BluetoothEventLoop.cpp deleted file mode 100644 index 8a69ba4384603..0000000000000 --- a/core/jni/android_server_BluetoothEventLoop.cpp +++ /dev/null @@ -1,1585 +0,0 @@ -/* -** Copyright 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. -*/ - -#define LOG_TAG "BluetoothEventLoop.cpp" - -#include "android_bluetooth_common.h" -#include "android_runtime/AndroidRuntime.h" -#include "cutils/sockets.h" -#include "JNIHelp.h" -#include "jni.h" -#include "utils/Log.h" -#include "utils/misc.h" - -#include -#include -#include -#include -#include - -#ifdef HAVE_BLUETOOTH -#include -#endif - -namespace android { - -#define CREATE_DEVICE_ALREADY_EXISTS 1 -#define CREATE_DEVICE_SUCCESS 0 -#define CREATE_DEVICE_FAILED -1 - -#ifdef HAVE_BLUETOOTH -static jfieldID field_mNativeData; - -static jmethodID method_onPropertyChanged; -static jmethodID method_onDevicePropertyChanged; -static jmethodID method_onDeviceFound; -static jmethodID method_onDeviceDisappeared; -static jmethodID method_onDeviceCreated; -static jmethodID method_onDeviceRemoved; -static jmethodID method_onDeviceDisconnectRequested; -static jmethodID method_onNetworkDeviceDisconnected; -static jmethodID method_onNetworkDeviceConnected; - -static jmethodID method_onCreatePairedDeviceResult; -static jmethodID method_onCreateDeviceResult; -static jmethodID method_onDiscoverServicesResult; -static jmethodID method_onGetDeviceServiceChannelResult; - -static jmethodID method_onRequestPinCode; -static jmethodID method_onRequestPasskey; -static jmethodID method_onRequestPasskeyConfirmation; -static jmethodID method_onRequestPairingConsent; -static jmethodID method_onDisplayPasskey; -static jmethodID method_onRequestOobData; -static jmethodID method_onAgentOutOfBandDataAvailable; -static jmethodID method_onAgentAuthorize; -static jmethodID method_onAgentCancel; - -static jmethodID method_onInputDevicePropertyChanged; -static jmethodID method_onInputDeviceConnectionResult; -static jmethodID method_onPanDevicePropertyChanged; -static jmethodID method_onPanDeviceConnectionResult; -static jmethodID method_onHealthDevicePropertyChanged; -static jmethodID method_onHealthDeviceChannelChanged; -static jmethodID method_onHealthDeviceConnectionResult; - -typedef event_loop_native_data_t native_data_t; - -#define EVENT_LOOP_REFS 10 - -static inline native_data_t * get_native_data(JNIEnv *env, jobject object) { - return (native_data_t *)(env->GetIntField(object, - field_mNativeData)); -} - -native_data_t *get_EventLoop_native_data(JNIEnv *env, jobject object) { - return get_native_data(env, object); -} - -#endif -static void classInitNative(JNIEnv* env, jclass clazz) { - ALOGV("%s", __FUNCTION__); - -#ifdef HAVE_BLUETOOTH - method_onPropertyChanged = env->GetMethodID(clazz, "onPropertyChanged", - "([Ljava/lang/String;)V"); - method_onDevicePropertyChanged = env->GetMethodID(clazz, - "onDevicePropertyChanged", - "(Ljava/lang/String;[Ljava/lang/String;)V"); - method_onDeviceFound = env->GetMethodID(clazz, "onDeviceFound", - "(Ljava/lang/String;[Ljava/lang/String;)V"); - method_onDeviceDisappeared = env->GetMethodID(clazz, "onDeviceDisappeared", - "(Ljava/lang/String;)V"); - method_onDeviceCreated = env->GetMethodID(clazz, "onDeviceCreated", "(Ljava/lang/String;)V"); - method_onDeviceRemoved = env->GetMethodID(clazz, "onDeviceRemoved", "(Ljava/lang/String;)V"); - method_onDeviceDisconnectRequested = env->GetMethodID(clazz, "onDeviceDisconnectRequested", - "(Ljava/lang/String;)V"); - method_onNetworkDeviceConnected = env->GetMethodID(clazz, "onNetworkDeviceConnected", - "(Ljava/lang/String;Ljava/lang/String;I)V"); - method_onNetworkDeviceDisconnected = env->GetMethodID(clazz, "onNetworkDeviceDisconnected", - "(Ljava/lang/String;)V"); - - method_onCreatePairedDeviceResult = env->GetMethodID(clazz, "onCreatePairedDeviceResult", - "(Ljava/lang/String;I)V"); - method_onCreateDeviceResult = env->GetMethodID(clazz, "onCreateDeviceResult", - "(Ljava/lang/String;I)V"); - method_onDiscoverServicesResult = env->GetMethodID(clazz, "onDiscoverServicesResult", - "(Ljava/lang/String;Z)V"); - - method_onAgentAuthorize = env->GetMethodID(clazz, "onAgentAuthorize", - "(Ljava/lang/String;Ljava/lang/String;I)V"); - method_onAgentOutOfBandDataAvailable = env->GetMethodID(clazz, "onAgentOutOfBandDataAvailable", - "(Ljava/lang/String;)Z"); - method_onAgentCancel = env->GetMethodID(clazz, "onAgentCancel", "()V"); - method_onRequestPinCode = env->GetMethodID(clazz, "onRequestPinCode", - "(Ljava/lang/String;I)V"); - method_onRequestPasskey = env->GetMethodID(clazz, "onRequestPasskey", - "(Ljava/lang/String;I)V"); - method_onRequestPasskeyConfirmation = env->GetMethodID(clazz, "onRequestPasskeyConfirmation", - "(Ljava/lang/String;II)V"); - method_onRequestPairingConsent = env->GetMethodID(clazz, "onRequestPairingConsent", - "(Ljava/lang/String;I)V"); - method_onDisplayPasskey = env->GetMethodID(clazz, "onDisplayPasskey", - "(Ljava/lang/String;II)V"); - method_onInputDevicePropertyChanged = env->GetMethodID(clazz, "onInputDevicePropertyChanged", - "(Ljava/lang/String;[Ljava/lang/String;)V"); - method_onInputDeviceConnectionResult = env->GetMethodID(clazz, "onInputDeviceConnectionResult", - "(Ljava/lang/String;I)V"); - method_onPanDevicePropertyChanged = env->GetMethodID(clazz, "onPanDevicePropertyChanged", - "(Ljava/lang/String;[Ljava/lang/String;)V"); - method_onPanDeviceConnectionResult = env->GetMethodID(clazz, "onPanDeviceConnectionResult", - "(Ljava/lang/String;I)V"); - method_onHealthDeviceConnectionResult = env->GetMethodID(clazz, - "onHealthDeviceConnectionResult", - "(II)V"); - method_onHealthDevicePropertyChanged = env->GetMethodID(clazz, "onHealthDevicePropertyChanged", - "(Ljava/lang/String;[Ljava/lang/String;)V"); - method_onHealthDeviceChannelChanged = env->GetMethodID(clazz, "onHealthDeviceChannelChanged", - "(Ljava/lang/String;Ljava/lang/String;Z)V"); - method_onRequestOobData = env->GetMethodID(clazz, "onRequestOobData", - "(Ljava/lang/String;I)V"); - - field_mNativeData = env->GetFieldID(clazz, "mNativeData", "I"); -#endif -} - -static void initializeNativeDataNative(JNIEnv* env, jobject object) { - ALOGV("%s", __FUNCTION__); -#ifdef HAVE_BLUETOOTH - native_data_t *nat = (native_data_t *)calloc(1, sizeof(native_data_t)); - if (NULL == nat) { - ALOGE("%s: out of memory!", __FUNCTION__); - return; - } - - pthread_mutex_init(&(nat->thread_mutex), NULL); - - env->SetIntField(object, field_mNativeData, (jint)nat); - - { - DBusError err; - dbus_error_init(&err); - dbus_threads_init_default(); - nat->conn = dbus_bus_get(DBUS_BUS_SYSTEM, &err); - if (dbus_error_is_set(&err)) { - ALOGE("%s: Could not get onto the system bus!", __FUNCTION__); - dbus_error_free(&err); - } - dbus_connection_set_exit_on_disconnect(nat->conn, FALSE); - } -#endif -} - -static void cleanupNativeDataNative(JNIEnv* env, jobject object) { - ALOGV("%s", __FUNCTION__); -#ifdef HAVE_BLUETOOTH - native_data_t *nat = - (native_data_t *)env->GetIntField(object, field_mNativeData); - - pthread_mutex_destroy(&(nat->thread_mutex)); - - if (nat) { - free(nat); - } -#endif -} - -#ifdef HAVE_BLUETOOTH -static DBusHandlerResult event_filter(DBusConnection *conn, DBusMessage *msg, - void *data); -DBusHandlerResult agent_event_filter(DBusConnection *conn, - DBusMessage *msg, - void *data); -static int register_agent(native_data_t *nat, - const char *agent_path, const char *capabilities); - -static const DBusObjectPathVTable agent_vtable = { - NULL, agent_event_filter, NULL, NULL, NULL, NULL -}; - -static unsigned int unix_events_to_dbus_flags(short events) { - return (events & DBUS_WATCH_READABLE ? POLLIN : 0) | - (events & DBUS_WATCH_WRITABLE ? POLLOUT : 0) | - (events & DBUS_WATCH_ERROR ? POLLERR : 0) | - (events & DBUS_WATCH_HANGUP ? POLLHUP : 0); -} - -static short dbus_flags_to_unix_events(unsigned int flags) { - return (flags & POLLIN ? DBUS_WATCH_READABLE : 0) | - (flags & POLLOUT ? DBUS_WATCH_WRITABLE : 0) | - (flags & POLLERR ? DBUS_WATCH_ERROR : 0) | - (flags & POLLHUP ? DBUS_WATCH_HANGUP : 0); -} - -static jboolean setUpEventLoop(native_data_t *nat) { - ALOGV("%s", __FUNCTION__); - - if (nat != NULL && nat->conn != NULL) { - dbus_threads_init_default(); - DBusError err; - dbus_error_init(&err); - - const char *agent_path = "/android/bluetooth/agent"; - const char *capabilities = "DisplayYesNo"; - if (register_agent(nat, agent_path, capabilities) < 0) { - dbus_connection_unregister_object_path (nat->conn, agent_path); - return JNI_FALSE; - } - - // Add a filter for all incoming messages - if (!dbus_connection_add_filter(nat->conn, event_filter, nat, NULL)){ - return JNI_FALSE; - } - - // Set which messages will be processed by this dbus connection - dbus_bus_add_match(nat->conn, - "type='signal',interface='org.freedesktop.DBus'", - &err); - if (dbus_error_is_set(&err)) { - LOG_AND_FREE_DBUS_ERROR(&err); - return JNI_FALSE; - } - dbus_bus_add_match(nat->conn, - "type='signal',interface='"BLUEZ_DBUS_BASE_IFC".Adapter'", - &err); - if (dbus_error_is_set(&err)) { - LOG_AND_FREE_DBUS_ERROR(&err); - return JNI_FALSE; - } - dbus_bus_add_match(nat->conn, - "type='signal',interface='"BLUEZ_DBUS_BASE_IFC".Device'", - &err); - if (dbus_error_is_set(&err)) { - LOG_AND_FREE_DBUS_ERROR(&err); - return JNI_FALSE; - } - dbus_bus_add_match(nat->conn, - "type='signal',interface='"BLUEZ_DBUS_BASE_IFC".Input'", - &err); - if (dbus_error_is_set(&err)) { - LOG_AND_FREE_DBUS_ERROR(&err); - return JNI_FALSE; - } - dbus_bus_add_match(nat->conn, - "type='signal',interface='"BLUEZ_DBUS_BASE_IFC".Network'", - &err); - if (dbus_error_is_set(&err)) { - LOG_AND_FREE_DBUS_ERROR(&err); - return JNI_FALSE; - } - dbus_bus_add_match(nat->conn, - "type='signal',interface='"BLUEZ_DBUS_BASE_IFC".NetworkServer'", - &err); - if (dbus_error_is_set(&err)) { - LOG_AND_FREE_DBUS_ERROR(&err); - return JNI_FALSE; - } - - dbus_bus_add_match(nat->conn, - "type='signal',interface='"BLUEZ_DBUS_BASE_IFC".HealthDevice'", - &err); - if (dbus_error_is_set(&err)) { - LOG_AND_FREE_DBUS_ERROR(&err); - return JNI_FALSE; - } - - dbus_bus_add_match(nat->conn, - "type='signal',interface='org.bluez.AudioSink'", - &err); - if (dbus_error_is_set(&err)) { - LOG_AND_FREE_DBUS_ERROR(&err); - return JNI_FALSE; - } - - return JNI_TRUE; - } - return JNI_FALSE; -} - - -const char * get_adapter_path(DBusConnection *conn) { - DBusMessage *msg = NULL, *reply = NULL; - DBusError err; - const char *device_path = NULL; - int attempt = 0; - - for (attempt = 0; attempt < 1000 && reply == NULL; attempt ++) { - msg = dbus_message_new_method_call("org.bluez", "/", - "org.bluez.Manager", "DefaultAdapter"); - if (!msg) { - ALOGE("%s: Can't allocate new method call for get_adapter_path!", - __FUNCTION__); - return NULL; - } - dbus_message_append_args(msg, DBUS_TYPE_INVALID); - dbus_error_init(&err); - reply = dbus_connection_send_with_reply_and_block(conn, msg, -1, &err); - - if (!reply) { - if (dbus_error_is_set(&err)) { - if (dbus_error_has_name(&err, - "org.freedesktop.DBus.Error.ServiceUnknown")) { - // bluetoothd is still down, retry - LOG_AND_FREE_DBUS_ERROR(&err); - usleep(10000); // 10 ms - continue; - } else { - // Some other error we weren't expecting - LOG_AND_FREE_DBUS_ERROR(&err); - } - } - goto failed; - } - } - if (attempt == 1000) { - ALOGE("Time out while trying to get Adapter path, is bluetoothd up ?"); - goto failed; - } - - if (!dbus_message_get_args(reply, &err, DBUS_TYPE_OBJECT_PATH, - &device_path, DBUS_TYPE_INVALID) - || !device_path){ - if (dbus_error_is_set(&err)) { - LOG_AND_FREE_DBUS_ERROR(&err); - } - goto failed; - } - dbus_message_unref(msg); - return device_path; - -failed: - dbus_message_unref(msg); - return NULL; -} - -static int register_agent(native_data_t *nat, - const char * agent_path, const char * capabilities) -{ - DBusMessage *msg, *reply; - DBusError err; - dbus_bool_t oob = TRUE; - - if (!dbus_connection_register_object_path(nat->conn, agent_path, - &agent_vtable, nat)) { - ALOGE("%s: Can't register object path %s for agent!", - __FUNCTION__, agent_path); - return -1; - } - - nat->adapter = get_adapter_path(nat->conn); - if (nat->adapter == NULL) { - return -1; - } - msg = dbus_message_new_method_call("org.bluez", nat->adapter, - "org.bluez.Adapter", "RegisterAgent"); - if (!msg) { - ALOGE("%s: Can't allocate new method call for agent!", - __FUNCTION__); - return -1; - } - dbus_message_append_args(msg, DBUS_TYPE_OBJECT_PATH, &agent_path, - DBUS_TYPE_STRING, &capabilities, - DBUS_TYPE_INVALID); - - dbus_error_init(&err); - reply = dbus_connection_send_with_reply_and_block(nat->conn, msg, -1, &err); - dbus_message_unref(msg); - - if (!reply) { - ALOGE("%s: Can't register agent!", __FUNCTION__); - if (dbus_error_is_set(&err)) { - LOG_AND_FREE_DBUS_ERROR(&err); - } - return -1; - } - - dbus_message_unref(reply); - dbus_connection_flush(nat->conn); - - return 0; -} - -static void tearDownEventLoop(native_data_t *nat) { - ALOGV("%s", __FUNCTION__); - if (nat != NULL && nat->conn != NULL) { - - DBusMessage *msg, *reply; - DBusError err; - dbus_error_init(&err); - const char * agent_path = "/android/bluetooth/agent"; - - msg = dbus_message_new_method_call("org.bluez", - nat->adapter, - "org.bluez.Adapter", - "UnregisterAgent"); - if (msg != NULL) { - dbus_message_append_args(msg, DBUS_TYPE_OBJECT_PATH, &agent_path, - DBUS_TYPE_INVALID); - reply = dbus_connection_send_with_reply_and_block(nat->conn, - msg, -1, &err); - - if (!reply) { - if (dbus_error_is_set(&err)) { - LOG_AND_FREE_DBUS_ERROR(&err); - dbus_error_free(&err); - } - } else { - dbus_message_unref(reply); - } - dbus_message_unref(msg); - } else { - ALOGE("%s: Can't create new method call!", __FUNCTION__); - } - - dbus_connection_flush(nat->conn); - dbus_connection_unregister_object_path(nat->conn, agent_path); - - dbus_bus_remove_match(nat->conn, - "type='signal',interface='"BLUEZ_DBUS_BASE_IFC".AudioSink'", - &err); - if (dbus_error_is_set(&err)) { - LOG_AND_FREE_DBUS_ERROR(&err); - } - dbus_bus_remove_match(nat->conn, - "type='signal',interface='"BLUEZ_DBUS_BASE_IFC".Device'", - &err); - if (dbus_error_is_set(&err)) { - LOG_AND_FREE_DBUS_ERROR(&err); - } - dbus_bus_remove_match(nat->conn, - "type='signal',interface='"BLUEZ_DBUS_BASE_IFC".Input'", - &err); - if (dbus_error_is_set(&err)) { - LOG_AND_FREE_DBUS_ERROR(&err); - } - dbus_bus_remove_match(nat->conn, - "type='signal',interface='"BLUEZ_DBUS_BASE_IFC".Network'", - &err); - if (dbus_error_is_set(&err)) { - LOG_AND_FREE_DBUS_ERROR(&err); - } - dbus_bus_remove_match(nat->conn, - "type='signal',interface='"BLUEZ_DBUS_BASE_IFC".NetworkServer'", - &err); - if (dbus_error_is_set(&err)) { - LOG_AND_FREE_DBUS_ERROR(&err); - } - dbus_bus_remove_match(nat->conn, - "type='signal',interface='"BLUEZ_DBUS_BASE_IFC".HealthDevice'", - &err); - if (dbus_error_is_set(&err)) { - LOG_AND_FREE_DBUS_ERROR(&err); - } - dbus_bus_remove_match(nat->conn, - "type='signal',interface='org.bluez.audio.Manager'", - &err); - if (dbus_error_is_set(&err)) { - LOG_AND_FREE_DBUS_ERROR(&err); - } - dbus_bus_remove_match(nat->conn, - "type='signal',interface='"BLUEZ_DBUS_BASE_IFC".Adapter'", - &err); - if (dbus_error_is_set(&err)) { - LOG_AND_FREE_DBUS_ERROR(&err); - } - dbus_bus_remove_match(nat->conn, - "type='signal',interface='org.freedesktop.DBus'", - &err); - if (dbus_error_is_set(&err)) { - LOG_AND_FREE_DBUS_ERROR(&err); - } - - dbus_connection_remove_filter(nat->conn, event_filter, nat); - } -} - - -#define EVENT_LOOP_EXIT 1 -#define EVENT_LOOP_ADD 2 -#define EVENT_LOOP_REMOVE 3 -#define EVENT_LOOP_WAKEUP 4 - -dbus_bool_t dbusAddWatch(DBusWatch *watch, void *data) { - native_data_t *nat = (native_data_t *)data; - - if (dbus_watch_get_enabled(watch)) { - // note that we can't just send the watch and inspect it later - // because we may get a removeWatch call before this data is reacted - // to by our eventloop and remove this watch.. reading the add first - // and then inspecting the recently deceased watch would be bad. - char control = EVENT_LOOP_ADD; - write(nat->controlFdW, &control, sizeof(char)); - - int fd = dbus_watch_get_fd(watch); - write(nat->controlFdW, &fd, sizeof(int)); - - unsigned int flags = dbus_watch_get_flags(watch); - write(nat->controlFdW, &flags, sizeof(unsigned int)); - - write(nat->controlFdW, &watch, sizeof(DBusWatch*)); - } - return true; -} - -void dbusRemoveWatch(DBusWatch *watch, void *data) { - native_data_t *nat = (native_data_t *)data; - - char control = EVENT_LOOP_REMOVE; - write(nat->controlFdW, &control, sizeof(char)); - - int fd = dbus_watch_get_fd(watch); - write(nat->controlFdW, &fd, sizeof(int)); - - unsigned int flags = dbus_watch_get_flags(watch); - write(nat->controlFdW, &flags, sizeof(unsigned int)); -} - -void dbusToggleWatch(DBusWatch *watch, void *data) { - if (dbus_watch_get_enabled(watch)) { - dbusAddWatch(watch, data); - } else { - dbusRemoveWatch(watch, data); - } -} - -void dbusWakeup(void *data) { - native_data_t *nat = (native_data_t *)data; - - char control = EVENT_LOOP_WAKEUP; - write(nat->controlFdW, &control, sizeof(char)); -} - -static void handleWatchAdd(native_data_t *nat) { - DBusWatch *watch; - int newFD; - unsigned int flags; - - read(nat->controlFdR, &newFD, sizeof(int)); - read(nat->controlFdR, &flags, sizeof(unsigned int)); - read(nat->controlFdR, &watch, sizeof(DBusWatch *)); - short events = dbus_flags_to_unix_events(flags); - - for (int y = 0; ypollMemberCount; y++) { - if ((nat->pollData[y].fd == newFD) && - (nat->pollData[y].events == events)) { - ALOGV("DBusWatch duplicate add"); - return; - } - } - if (nat->pollMemberCount == nat->pollDataSize) { - ALOGV("Bluetooth EventLoop poll struct growing"); - struct pollfd *temp = (struct pollfd *)malloc( - sizeof(struct pollfd) * (nat->pollMemberCount+1)); - if (!temp) { - return; - } - memcpy(temp, nat->pollData, sizeof(struct pollfd) * - nat->pollMemberCount); - free(nat->pollData); - nat->pollData = temp; - DBusWatch **temp2 = (DBusWatch **)malloc(sizeof(DBusWatch *) * - (nat->pollMemberCount+1)); - if (!temp2) { - return; - } - memcpy(temp2, nat->watchData, sizeof(DBusWatch *) * - nat->pollMemberCount); - free(nat->watchData); - nat->watchData = temp2; - nat->pollDataSize++; - } - nat->pollData[nat->pollMemberCount].fd = newFD; - nat->pollData[nat->pollMemberCount].revents = 0; - nat->pollData[nat->pollMemberCount].events = events; - nat->watchData[nat->pollMemberCount] = watch; - nat->pollMemberCount++; -} - -static void handleWatchRemove(native_data_t *nat) { - int removeFD; - unsigned int flags; - - read(nat->controlFdR, &removeFD, sizeof(int)); - read(nat->controlFdR, &flags, sizeof(unsigned int)); - short events = dbus_flags_to_unix_events(flags); - - for (int y = 0; y < nat->pollMemberCount; y++) { - if ((nat->pollData[y].fd == removeFD) && - (nat->pollData[y].events == events)) { - int newCount = --nat->pollMemberCount; - // copy the last live member over this one - nat->pollData[y].fd = nat->pollData[newCount].fd; - nat->pollData[y].events = nat->pollData[newCount].events; - nat->pollData[y].revents = nat->pollData[newCount].revents; - nat->watchData[y] = nat->watchData[newCount]; - return; - } - } - ALOGW("WatchRemove given with unknown watch"); -} - -static void *eventLoopMain(void *ptr) { - native_data_t *nat = (native_data_t *)ptr; - JNIEnv *env; - - JavaVMAttachArgs args; - char name[] = "BT EventLoop"; - args.version = nat->envVer; - args.name = name; - args.group = NULL; - - nat->vm->AttachCurrentThread(&env, &args); - - dbus_connection_set_watch_functions(nat->conn, dbusAddWatch, - dbusRemoveWatch, dbusToggleWatch, ptr, NULL); - dbus_connection_set_wakeup_main_function(nat->conn, dbusWakeup, ptr, NULL); - - nat->running = true; - - while (1) { - for (int i = 0; i < nat->pollMemberCount; i++) { - if (!nat->pollData[i].revents) { - continue; - } - if (nat->pollData[i].fd == nat->controlFdR) { - char data; - while (recv(nat->controlFdR, &data, sizeof(char), MSG_DONTWAIT) - != -1) { - switch (data) { - case EVENT_LOOP_EXIT: - { - dbus_connection_set_watch_functions(nat->conn, - NULL, NULL, NULL, NULL, NULL); - tearDownEventLoop(nat); - nat->vm->DetachCurrentThread(); - - int fd = nat->controlFdR; - nat->controlFdR = 0; - close(fd); - return NULL; - } - case EVENT_LOOP_ADD: - { - handleWatchAdd(nat); - break; - } - case EVENT_LOOP_REMOVE: - { - handleWatchRemove(nat); - break; - } - case EVENT_LOOP_WAKEUP: - { - // noop - break; - } - } - } - } else { - short events = nat->pollData[i].revents; - unsigned int flags = unix_events_to_dbus_flags(events); - dbus_watch_handle(nat->watchData[i], flags); - nat->pollData[i].revents = 0; - // can only do one - it may have caused a 'remove' - break; - } - } - while (dbus_connection_dispatch(nat->conn) == - DBUS_DISPATCH_DATA_REMAINS) { - } - - poll(nat->pollData, nat->pollMemberCount, -1); - } -} -#endif // HAVE_BLUETOOTH - -static jboolean startEventLoopNative(JNIEnv *env, jobject object) { - jboolean result = JNI_FALSE; -#ifdef HAVE_BLUETOOTH - event_loop_native_data_t *nat = get_native_data(env, object); - - pthread_mutex_lock(&(nat->thread_mutex)); - - nat->running = false; - - if (nat->pollData) { - ALOGW("trying to start EventLoop a second time!"); - pthread_mutex_unlock( &(nat->thread_mutex) ); - return JNI_FALSE; - } - - nat->pollData = (struct pollfd *)calloc( - DEFAULT_INITIAL_POLLFD_COUNT, sizeof(struct pollfd)); - if (!nat->pollData) { - ALOGE("out of memory error starting EventLoop!"); - goto done; - } - - nat->watchData = (DBusWatch **)calloc( - DEFAULT_INITIAL_POLLFD_COUNT, sizeof(DBusWatch *)); - if (!nat->watchData) { - ALOGE("out of memory error starting EventLoop!"); - goto done; - } - - nat->pollDataSize = DEFAULT_INITIAL_POLLFD_COUNT; - nat->pollMemberCount = 1; - - if (socketpair(AF_LOCAL, SOCK_STREAM, 0, &(nat->controlFdR))) { - ALOGE("Error getting BT control socket"); - goto done; - } - nat->pollData[0].fd = nat->controlFdR; - nat->pollData[0].events = POLLIN; - - env->GetJavaVM( &(nat->vm) ); - nat->envVer = env->GetVersion(); - - nat->me = env->NewGlobalRef(object); - - if (setUpEventLoop(nat) != JNI_TRUE) { - ALOGE("failure setting up Event Loop!"); - goto done; - } - - pthread_create(&(nat->thread), NULL, eventLoopMain, nat); - result = JNI_TRUE; - -done: - if (JNI_FALSE == result) { - if (nat->controlFdW) { - close(nat->controlFdW); - nat->controlFdW = 0; - } - if (nat->controlFdR) { - close(nat->controlFdR); - nat->controlFdR = 0; - } - if (nat->me) env->DeleteGlobalRef(nat->me); - nat->me = NULL; - if (nat->pollData) free(nat->pollData); - nat->pollData = NULL; - if (nat->watchData) free(nat->watchData); - nat->watchData = NULL; - nat->pollDataSize = 0; - nat->pollMemberCount = 0; - } - - pthread_mutex_unlock(&(nat->thread_mutex)); -#endif // HAVE_BLUETOOTH - return result; -} - -static void stopEventLoopNative(JNIEnv *env, jobject object) { -#ifdef HAVE_BLUETOOTH - native_data_t *nat = get_native_data(env, object); - - pthread_mutex_lock(&(nat->thread_mutex)); - if (nat->pollData) { - char data = EVENT_LOOP_EXIT; - ssize_t t = write(nat->controlFdW, &data, sizeof(char)); - void *ret; - pthread_join(nat->thread, &ret); - - env->DeleteGlobalRef(nat->me); - nat->me = NULL; - free(nat->pollData); - nat->pollData = NULL; - free(nat->watchData); - nat->watchData = NULL; - nat->pollDataSize = 0; - nat->pollMemberCount = 0; - - int fd = nat->controlFdW; - nat->controlFdW = 0; - close(fd); - } - nat->running = false; - pthread_mutex_unlock(&(nat->thread_mutex)); -#endif // HAVE_BLUETOOTH -} - -static jboolean isEventLoopRunningNative(JNIEnv *env, jobject object) { - jboolean result = JNI_FALSE; -#ifdef HAVE_BLUETOOTH - native_data_t *nat = get_native_data(env, object); - - pthread_mutex_lock(&(nat->thread_mutex)); - if (nat->running) { - result = JNI_TRUE; - } - pthread_mutex_unlock(&(nat->thread_mutex)); - -#endif // HAVE_BLUETOOTH - return result; -} - -#ifdef HAVE_BLUETOOTH -extern DBusHandlerResult a2dp_event_filter(DBusMessage *msg, JNIEnv *env); - -// Called by dbus during WaitForAndDispatchEventNative() -static DBusHandlerResult event_filter(DBusConnection *conn, DBusMessage *msg, - void *data) { - native_data_t *nat; - JNIEnv *env; - DBusError err; - DBusHandlerResult ret; - - dbus_error_init(&err); - - nat = (native_data_t *)data; - nat->vm->GetEnv((void**)&env, nat->envVer); - if (dbus_message_get_type(msg) != DBUS_MESSAGE_TYPE_SIGNAL) { - ALOGV("%s: not interested (not a signal).", __FUNCTION__); - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; - } - - ALOGV("%s: Received signal %s:%s from %s", __FUNCTION__, - dbus_message_get_interface(msg), dbus_message_get_member(msg), - dbus_message_get_path(msg)); - - env->PushLocalFrame(EVENT_LOOP_REFS); - if (dbus_message_is_signal(msg, - "org.bluez.Adapter", - "DeviceFound")) { - char *c_address; - DBusMessageIter iter; - jobjectArray str_array = NULL; - if (dbus_message_iter_init(msg, &iter)) { - dbus_message_iter_get_basic(&iter, &c_address); - if (dbus_message_iter_next(&iter)) - str_array = - parse_remote_device_properties(env, &iter); - } - if (str_array != NULL) { - env->CallVoidMethod(nat->me, - method_onDeviceFound, - env->NewStringUTF(c_address), - str_array); - } else - LOG_AND_FREE_DBUS_ERROR_WITH_MSG(&err, msg); - goto success; - } else if (dbus_message_is_signal(msg, - "org.bluez.Adapter", - "DeviceDisappeared")) { - char *c_address; - if (dbus_message_get_args(msg, &err, - DBUS_TYPE_STRING, &c_address, - DBUS_TYPE_INVALID)) { - ALOGV("... address = %s", c_address); - env->CallVoidMethod(nat->me, method_onDeviceDisappeared, - env->NewStringUTF(c_address)); - } else LOG_AND_FREE_DBUS_ERROR_WITH_MSG(&err, msg); - goto success; - } else if (dbus_message_is_signal(msg, - "org.bluez.Adapter", - "DeviceCreated")) { - char *c_object_path; - if (dbus_message_get_args(msg, &err, - DBUS_TYPE_OBJECT_PATH, &c_object_path, - DBUS_TYPE_INVALID)) { - ALOGV("... address = %s", c_object_path); - env->CallVoidMethod(nat->me, - method_onDeviceCreated, - env->NewStringUTF(c_object_path)); - } else LOG_AND_FREE_DBUS_ERROR_WITH_MSG(&err, msg); - goto success; - } else if (dbus_message_is_signal(msg, - "org.bluez.Adapter", - "DeviceRemoved")) { - char *c_object_path; - if (dbus_message_get_args(msg, &err, - DBUS_TYPE_OBJECT_PATH, &c_object_path, - DBUS_TYPE_INVALID)) { - ALOGV("... Object Path = %s", c_object_path); - env->CallVoidMethod(nat->me, - method_onDeviceRemoved, - env->NewStringUTF(c_object_path)); - } else LOG_AND_FREE_DBUS_ERROR_WITH_MSG(&err, msg); - goto success; - } else if (dbus_message_is_signal(msg, - "org.bluez.Adapter", - "PropertyChanged")) { - jobjectArray str_array = parse_adapter_property_change(env, msg); - if (str_array != NULL) { - /* Check if bluetoothd has (re)started, if so update the path. */ - jstring property =(jstring) env->GetObjectArrayElement(str_array, 0); - const char *c_property = env->GetStringUTFChars(property, NULL); - if (!strncmp(c_property, "Powered", strlen("Powered"))) { - jstring value = - (jstring) env->GetObjectArrayElement(str_array, 1); - const char *c_value = env->GetStringUTFChars(value, NULL); - if (!strncmp(c_value, "true", strlen("true"))) - nat->adapter = get_adapter_path(nat->conn); - env->ReleaseStringUTFChars(value, c_value); - } - env->ReleaseStringUTFChars(property, c_property); - - env->CallVoidMethod(nat->me, - method_onPropertyChanged, - str_array); - } else LOG_AND_FREE_DBUS_ERROR_WITH_MSG(&err, msg); - goto success; - } else if (dbus_message_is_signal(msg, - "org.bluez.Device", - "PropertyChanged")) { - jobjectArray str_array = parse_remote_device_property_change(env, msg); - if (str_array != NULL) { - const char *remote_device_path = dbus_message_get_path(msg); - env->CallVoidMethod(nat->me, - method_onDevicePropertyChanged, - env->NewStringUTF(remote_device_path), - str_array); - } else LOG_AND_FREE_DBUS_ERROR_WITH_MSG(&err, msg); - goto success; - } else if (dbus_message_is_signal(msg, - "org.bluez.Device", - "DisconnectRequested")) { - const char *remote_device_path = dbus_message_get_path(msg); - env->CallVoidMethod(nat->me, - method_onDeviceDisconnectRequested, - env->NewStringUTF(remote_device_path)); - goto success; - } else if (dbus_message_is_signal(msg, - "org.bluez.Input", - "PropertyChanged")) { - - jobjectArray str_array = - parse_input_property_change(env, msg); - if (str_array != NULL) { - const char *c_path = dbus_message_get_path(msg); - env->CallVoidMethod(nat->me, - method_onInputDevicePropertyChanged, - env->NewStringUTF(c_path), - str_array); - } else { - LOG_AND_FREE_DBUS_ERROR_WITH_MSG(&err, msg); - } - goto success; - } else if (dbus_message_is_signal(msg, - "org.bluez.Network", - "PropertyChanged")) { - - jobjectArray str_array = - parse_pan_property_change(env, msg); - if (str_array != NULL) { - const char *c_path = dbus_message_get_path(msg); - env->CallVoidMethod(nat->me, - method_onPanDevicePropertyChanged, - env->NewStringUTF(c_path), - str_array); - } else { - LOG_AND_FREE_DBUS_ERROR_WITH_MSG(&err, msg); - } - goto success; - } else if (dbus_message_is_signal(msg, - "org.bluez.NetworkServer", - "DeviceDisconnected")) { - char *c_address; - if (dbus_message_get_args(msg, &err, - DBUS_TYPE_STRING, &c_address, - DBUS_TYPE_INVALID)) { - env->CallVoidMethod(nat->me, - method_onNetworkDeviceDisconnected, - env->NewStringUTF(c_address)); - } else { - LOG_AND_FREE_DBUS_ERROR_WITH_MSG(&err, msg); - } - goto success; - } else if (dbus_message_is_signal(msg, - "org.bluez.NetworkServer", - "DeviceConnected")) { - char *c_address; - char *c_iface; - uint16_t uuid; - - if (dbus_message_get_args(msg, &err, - DBUS_TYPE_STRING, &c_address, - DBUS_TYPE_STRING, &c_iface, - DBUS_TYPE_UINT16, &uuid, - DBUS_TYPE_INVALID)) { - env->CallVoidMethod(nat->me, - method_onNetworkDeviceConnected, - env->NewStringUTF(c_address), - env->NewStringUTF(c_iface), - uuid); - } else { - LOG_AND_FREE_DBUS_ERROR_WITH_MSG(&err, msg); - } - goto success; - } else if (dbus_message_is_signal(msg, - "org.bluez.HealthDevice", - "ChannelConnected")) { - const char *c_path = dbus_message_get_path(msg); - const char *c_channel_path; - jboolean exists = JNI_TRUE; - if (dbus_message_get_args(msg, &err, - DBUS_TYPE_OBJECT_PATH, &c_channel_path, - DBUS_TYPE_INVALID)) { - env->CallVoidMethod(nat->me, - method_onHealthDeviceChannelChanged, - env->NewStringUTF(c_path), - env->NewStringUTF(c_channel_path), - exists); - } else { - LOG_AND_FREE_DBUS_ERROR_WITH_MSG(&err, msg); - } - goto success; - } else if (dbus_message_is_signal(msg, - "org.bluez.HealthDevice", - "ChannelDeleted")) { - - const char *c_path = dbus_message_get_path(msg); - const char *c_channel_path; - jboolean exists = JNI_FALSE; - if (dbus_message_get_args(msg, &err, - DBUS_TYPE_OBJECT_PATH, &c_channel_path, - DBUS_TYPE_INVALID)) { - env->CallVoidMethod(nat->me, - method_onHealthDeviceChannelChanged, - env->NewStringUTF(c_path), - env->NewStringUTF(c_channel_path), - exists); - } else { - LOG_AND_FREE_DBUS_ERROR_WITH_MSG(&err, msg); - } - goto success; - } else if (dbus_message_is_signal(msg, - "org.bluez.HealthDevice", - "PropertyChanged")) { - jobjectArray str_array = - parse_health_device_property_change(env, msg); - if (str_array != NULL) { - const char *c_path = dbus_message_get_path(msg); - env->CallVoidMethod(nat->me, - method_onHealthDevicePropertyChanged, - env->NewStringUTF(c_path), - str_array); - } else { - LOG_AND_FREE_DBUS_ERROR_WITH_MSG(&err, msg); - } - goto success; - } - - ret = a2dp_event_filter(msg, env); - env->PopLocalFrame(NULL); - return ret; - -success: - env->PopLocalFrame(NULL); - return DBUS_HANDLER_RESULT_HANDLED; -} - -// Called by dbus during WaitForAndDispatchEventNative() -DBusHandlerResult agent_event_filter(DBusConnection *conn, - DBusMessage *msg, void *data) { - native_data_t *nat = (native_data_t *)data; - JNIEnv *env; - if (dbus_message_get_type(msg) != DBUS_MESSAGE_TYPE_METHOD_CALL) { - ALOGV("%s: not interested (not a method call).", __FUNCTION__); - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; - } - ALOGI("%s: Received method %s:%s", __FUNCTION__, - dbus_message_get_interface(msg), dbus_message_get_member(msg)); - - if (nat == NULL) return DBUS_HANDLER_RESULT_HANDLED; - - nat->vm->GetEnv((void**)&env, nat->envVer); - env->PushLocalFrame(EVENT_LOOP_REFS); - - if (dbus_message_is_method_call(msg, - "org.bluez.Agent", "Cancel")) { - env->CallVoidMethod(nat->me, method_onAgentCancel); - // reply - DBusMessage *reply = dbus_message_new_method_return(msg); - if (!reply) { - ALOGE("%s: Cannot create message reply\n", __FUNCTION__); - goto failure; - } - dbus_connection_send(nat->conn, reply, NULL); - dbus_message_unref(reply); - goto success; - - } else if (dbus_message_is_method_call(msg, - "org.bluez.Agent", "Authorize")) { - char *object_path; - const char *uuid; - if (!dbus_message_get_args(msg, NULL, - DBUS_TYPE_OBJECT_PATH, &object_path, - DBUS_TYPE_STRING, &uuid, - DBUS_TYPE_INVALID)) { - ALOGE("%s: Invalid arguments for Authorize() method", __FUNCTION__); - goto failure; - } - - ALOGV("... object_path = %s", object_path); - ALOGV("... uuid = %s", uuid); - - dbus_message_ref(msg); // increment refcount because we pass to java - env->CallVoidMethod(nat->me, method_onAgentAuthorize, - env->NewStringUTF(object_path), env->NewStringUTF(uuid), - int(msg)); - - goto success; - } else if (dbus_message_is_method_call(msg, - "org.bluez.Agent", "OutOfBandAvailable")) { - char *object_path; - if (!dbus_message_get_args(msg, NULL, - DBUS_TYPE_OBJECT_PATH, &object_path, - DBUS_TYPE_INVALID)) { - ALOGE("%s: Invalid arguments for OutOfBandData available() method", __FUNCTION__); - goto failure; - } - - ALOGV("... object_path = %s", object_path); - - bool available = - env->CallBooleanMethod(nat->me, method_onAgentOutOfBandDataAvailable, - env->NewStringUTF(object_path)); - - - // reply - if (available) { - DBusMessage *reply = dbus_message_new_method_return(msg); - if (!reply) { - ALOGE("%s: Cannot create message reply\n", __FUNCTION__); - goto failure; - } - dbus_connection_send(nat->conn, reply, NULL); - dbus_message_unref(reply); - } else { - DBusMessage *reply = dbus_message_new_error(msg, - "org.bluez.Error.DoesNotExist", "OutofBand data not available"); - if (!reply) { - ALOGE("%s: Cannot create message reply\n", __FUNCTION__); - goto failure; - } - dbus_connection_send(nat->conn, reply, NULL); - dbus_message_unref(reply); - } - goto success; - } else if (dbus_message_is_method_call(msg, - "org.bluez.Agent", "RequestPinCode")) { - char *object_path; - if (!dbus_message_get_args(msg, NULL, - DBUS_TYPE_OBJECT_PATH, &object_path, - DBUS_TYPE_INVALID)) { - ALOGE("%s: Invalid arguments for RequestPinCode() method", __FUNCTION__); - goto failure; - } - - dbus_message_ref(msg); // increment refcount because we pass to java - env->CallVoidMethod(nat->me, method_onRequestPinCode, - env->NewStringUTF(object_path), - int(msg)); - goto success; - } else if (dbus_message_is_method_call(msg, - "org.bluez.Agent", "RequestPasskey")) { - char *object_path; - if (!dbus_message_get_args(msg, NULL, - DBUS_TYPE_OBJECT_PATH, &object_path, - DBUS_TYPE_INVALID)) { - ALOGE("%s: Invalid arguments for RequestPasskey() method", __FUNCTION__); - goto failure; - } - - dbus_message_ref(msg); // increment refcount because we pass to java - env->CallVoidMethod(nat->me, method_onRequestPasskey, - env->NewStringUTF(object_path), - int(msg)); - goto success; - } else if (dbus_message_is_method_call(msg, - "org.bluez.Agent", "RequestOobData")) { - char *object_path; - if (!dbus_message_get_args(msg, NULL, - DBUS_TYPE_OBJECT_PATH, &object_path, - DBUS_TYPE_INVALID)) { - ALOGE("%s: Invalid arguments for RequestOobData() method", __FUNCTION__); - goto failure; - } - - dbus_message_ref(msg); // increment refcount because we pass to java - env->CallVoidMethod(nat->me, method_onRequestOobData, - env->NewStringUTF(object_path), - int(msg)); - goto success; - } else if (dbus_message_is_method_call(msg, - "org.bluez.Agent", "DisplayPasskey")) { - char *object_path; - uint32_t passkey; - if (!dbus_message_get_args(msg, NULL, - DBUS_TYPE_OBJECT_PATH, &object_path, - DBUS_TYPE_UINT32, &passkey, - DBUS_TYPE_INVALID)) { - ALOGE("%s: Invalid arguments for RequestPasskey() method", __FUNCTION__); - goto failure; - } - - dbus_message_ref(msg); // increment refcount because we pass to java - env->CallVoidMethod(nat->me, method_onDisplayPasskey, - env->NewStringUTF(object_path), - passkey, - int(msg)); - goto success; - } else if (dbus_message_is_method_call(msg, - "org.bluez.Agent", "RequestConfirmation")) { - char *object_path; - uint32_t passkey; - if (!dbus_message_get_args(msg, NULL, - DBUS_TYPE_OBJECT_PATH, &object_path, - DBUS_TYPE_UINT32, &passkey, - DBUS_TYPE_INVALID)) { - ALOGE("%s: Invalid arguments for RequestConfirmation() method", __FUNCTION__); - goto failure; - } - - dbus_message_ref(msg); // increment refcount because we pass to java - env->CallVoidMethod(nat->me, method_onRequestPasskeyConfirmation, - env->NewStringUTF(object_path), - passkey, - int(msg)); - goto success; - } else if (dbus_message_is_method_call(msg, - "org.bluez.Agent", "RequestPairingConsent")) { - char *object_path; - if (!dbus_message_get_args(msg, NULL, - DBUS_TYPE_OBJECT_PATH, &object_path, - DBUS_TYPE_INVALID)) { - ALOGE("%s: Invalid arguments for RequestPairingConsent() method", __FUNCTION__); - goto failure; - } - - dbus_message_ref(msg); // increment refcount because we pass to java - env->CallVoidMethod(nat->me, method_onRequestPairingConsent, - env->NewStringUTF(object_path), - int(msg)); - goto success; - } else if (dbus_message_is_method_call(msg, - "org.bluez.Agent", "Release")) { - // reply - DBusMessage *reply = dbus_message_new_method_return(msg); - if (!reply) { - ALOGE("%s: Cannot create message reply\n", __FUNCTION__); - goto failure; - } - dbus_connection_send(nat->conn, reply, NULL); - dbus_message_unref(reply); - goto success; - } else { - ALOGV("%s:%s is ignored", dbus_message_get_interface(msg), dbus_message_get_member(msg)); - } - -failure: - env->PopLocalFrame(NULL); - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; - -success: - env->PopLocalFrame(NULL); - return DBUS_HANDLER_RESULT_HANDLED; - -} -#endif - - -#ifdef HAVE_BLUETOOTH - -void onCreatePairedDeviceResult(DBusMessage *msg, void *user, void *n) { - ALOGV("%s", __FUNCTION__); - - native_data_t *nat = (native_data_t *)n; - const char *address = (const char *)user; - DBusError err; - dbus_error_init(&err); - JNIEnv *env; - jstring addr; - - nat->vm->GetEnv((void**)&env, nat->envVer); - - ALOGV("... address = %s", address); - - jint result = BOND_RESULT_SUCCESS; - if (dbus_set_error_from_message(&err, msg)) { - if (!strcmp(err.name, BLUEZ_DBUS_BASE_IFC ".Error.AuthenticationFailed")) { - // Pins did not match, or remote device did not respond to pin - // request in time - ALOGV("... error = %s (%s)\n", err.name, err.message); - result = BOND_RESULT_AUTH_FAILED; - } else if (!strcmp(err.name, BLUEZ_DBUS_BASE_IFC ".Error.AuthenticationRejected")) { - // We rejected pairing, or the remote side rejected pairing. This - // happens if either side presses 'cancel' at the pairing dialog. - ALOGV("... error = %s (%s)\n", err.name, err.message); - result = BOND_RESULT_AUTH_REJECTED; - } else if (!strcmp(err.name, BLUEZ_DBUS_BASE_IFC ".Error.AuthenticationCanceled")) { - // Not sure if this happens - ALOGV("... error = %s (%s)\n", err.name, err.message); - result = BOND_RESULT_AUTH_CANCELED; - } else if (!strcmp(err.name, BLUEZ_DBUS_BASE_IFC ".Error.ConnectionAttemptFailed")) { - // Other device is not responding at all - ALOGV("... error = %s (%s)\n", err.name, err.message); - result = BOND_RESULT_REMOTE_DEVICE_DOWN; - } else if (!strcmp(err.name, BLUEZ_DBUS_BASE_IFC ".Error.AlreadyExists")) { - // already bonded - ALOGV("... error = %s (%s)\n", err.name, err.message); - result = BOND_RESULT_SUCCESS; - } else if (!strcmp(err.name, BLUEZ_DBUS_BASE_IFC ".Error.InProgress") && - !strcmp(err.message, "Bonding in progress")) { - ALOGV("... error = %s (%s)\n", err.name, err.message); - goto done; - } else if (!strcmp(err.name, BLUEZ_DBUS_BASE_IFC ".Error.InProgress") && - !strcmp(err.message, "Discover in progress")) { - ALOGV("... error = %s (%s)\n", err.name, err.message); - result = BOND_RESULT_DISCOVERY_IN_PROGRESS; - } else if (!strcmp(err.name, BLUEZ_DBUS_BASE_IFC ".Error.RepeatedAttempts")) { - ALOGV("... error = %s (%s)\n", err.name, err.message); - result = BOND_RESULT_REPEATED_ATTEMPTS; - } else if (!strcmp(err.name, BLUEZ_DBUS_BASE_IFC ".Error.AuthenticationTimeout")) { - ALOGV("... error = %s (%s)\n", err.name, err.message); - result = BOND_RESULT_AUTH_TIMEOUT; - } else { - ALOGE("%s: D-Bus error: %s (%s)\n", __FUNCTION__, err.name, err.message); - result = BOND_RESULT_ERROR; - } - } - - addr = env->NewStringUTF(address); - env->CallVoidMethod(nat->me, - method_onCreatePairedDeviceResult, - addr, - result); - env->DeleteLocalRef(addr); -done: - dbus_error_free(&err); - free(user); -} - -void onCreateDeviceResult(DBusMessage *msg, void *user, void *n) { - ALOGV("%s", __FUNCTION__); - - native_data_t *nat = (native_data_t *)n; - const char *address= (const char *)user; - DBusError err; - dbus_error_init(&err); - JNIEnv *env; - nat->vm->GetEnv((void**)&env, nat->envVer); - - ALOGV("... Address = %s", address); - - jint result = CREATE_DEVICE_SUCCESS; - if (dbus_set_error_from_message(&err, msg)) { - if (dbus_error_has_name(&err, "org.bluez.Error.AlreadyExists")) { - result = CREATE_DEVICE_ALREADY_EXISTS; - } else { - result = CREATE_DEVICE_FAILED; - } - LOG_AND_FREE_DBUS_ERROR(&err); - } - jstring addr = env->NewStringUTF(address); - env->CallVoidMethod(nat->me, - method_onCreateDeviceResult, - addr, - result); - env->DeleteLocalRef(addr); - free(user); -} - -void onDiscoverServicesResult(DBusMessage *msg, void *user, void *n) { - ALOGV("%s", __FUNCTION__); - - native_data_t *nat = (native_data_t *)n; - const char *path = (const char *)user; - DBusError err; - dbus_error_init(&err); - JNIEnv *env; - nat->vm->GetEnv((void**)&env, nat->envVer); - - ALOGV("... Device Path = %s", path); - - bool result = JNI_TRUE; - if (dbus_set_error_from_message(&err, msg)) { - LOG_AND_FREE_DBUS_ERROR(&err); - result = JNI_FALSE; - } - jstring jPath = env->NewStringUTF(path); - env->CallVoidMethod(nat->me, - method_onDiscoverServicesResult, - jPath, - result); - env->DeleteLocalRef(jPath); - free(user); -} - -void onGetDeviceServiceChannelResult(DBusMessage *msg, void *user, void *n) { - ALOGV("%s", __FUNCTION__); - - const char *address = (const char *) user; - native_data_t *nat = (native_data_t *) n; - - DBusError err; - dbus_error_init(&err); - JNIEnv *env; - nat->vm->GetEnv((void**)&env, nat->envVer); - - jint channel = -2; - - ALOGV("... address = %s", address); - - if (dbus_set_error_from_message(&err, msg) || - !dbus_message_get_args(msg, &err, - DBUS_TYPE_INT32, &channel, - DBUS_TYPE_INVALID)) { - ALOGE("%s: D-Bus error: %s (%s)\n", __FUNCTION__, err.name, err.message); - dbus_error_free(&err); - } - -done: - jstring addr = env->NewStringUTF(address); - env->CallVoidMethod(nat->me, - method_onGetDeviceServiceChannelResult, - addr, - channel); - env->DeleteLocalRef(addr); - free(user); -} - -void onInputDeviceConnectionResult(DBusMessage *msg, void *user, void *n) { - ALOGV("%s", __FUNCTION__); - - native_data_t *nat = (native_data_t *)n; - const char *path = (const char *)user; - DBusError err; - dbus_error_init(&err); - JNIEnv *env; - nat->vm->GetEnv((void**)&env, nat->envVer); - - jint result = INPUT_OPERATION_SUCCESS; - if (dbus_set_error_from_message(&err, msg)) { - if (!strcmp(err.name, BLUEZ_ERROR_IFC ".ConnectionAttemptFailed")) { - result = INPUT_CONNECT_FAILED_ATTEMPT_FAILED; - } else if (!strcmp(err.name, BLUEZ_ERROR_IFC ".AlreadyConnected")) { - result = INPUT_CONNECT_FAILED_ALREADY_CONNECTED; - } else if (!strcmp(err.name, BLUEZ_ERROR_IFC ".Failed")) { - // TODO():This is flaky, need to change Bluez to add new error codes - if (!strcmp(err.message, "Transport endpoint is not connected")) { - result = INPUT_DISCONNECT_FAILED_NOT_CONNECTED; - } else { - result = INPUT_OPERATION_GENERIC_FAILURE; - } - } else { - result = INPUT_OPERATION_GENERIC_FAILURE; - } - LOG_AND_FREE_DBUS_ERROR(&err); - } - - ALOGV("... Device Path = %s, result = %d", path, result); - jstring jPath = env->NewStringUTF(path); - env->CallVoidMethod(nat->me, - method_onInputDeviceConnectionResult, - jPath, - result); - env->DeleteLocalRef(jPath); - free(user); -} - -void onPanDeviceConnectionResult(DBusMessage *msg, void *user, void *n) { - ALOGV("%s", __FUNCTION__); - - native_data_t *nat = (native_data_t *)n; - const char *path = (const char *)user; - DBusError err; - dbus_error_init(&err); - JNIEnv *env; - nat->vm->GetEnv((void**)&env, nat->envVer); - - jint result = PAN_OPERATION_SUCCESS; - if (dbus_set_error_from_message(&err, msg)) { - if (!strcmp(err.name, BLUEZ_ERROR_IFC ".ConnectionAttemptFailed")) { - result = PAN_CONNECT_FAILED_ATTEMPT_FAILED; - } else if (!strcmp(err.name, BLUEZ_ERROR_IFC ".Failed")) { - // TODO():This is flaky, need to change Bluez to add new error codes - if (!strcmp(err.message, "Device already connected")) { - result = PAN_CONNECT_FAILED_ALREADY_CONNECTED; - } else if (!strcmp(err.message, "Device not connected")) { - result = PAN_DISCONNECT_FAILED_NOT_CONNECTED; - } else { - result = PAN_OPERATION_GENERIC_FAILURE; - } - } else { - result = PAN_OPERATION_GENERIC_FAILURE; - } - LOG_AND_FREE_DBUS_ERROR(&err); - } - - ALOGV("... Pan Device Path = %s, result = %d", path, result); - jstring jPath = env->NewStringUTF(path); - env->CallVoidMethod(nat->me, - method_onPanDeviceConnectionResult, - jPath, - result); - env->DeleteLocalRef(jPath); - free(user); -} - -void onHealthDeviceConnectionResult(DBusMessage *msg, void *user, void *n) { - ALOGV("%s", __FUNCTION__); - - native_data_t *nat = (native_data_t *)n; - DBusError err; - dbus_error_init(&err); - JNIEnv *env; - nat->vm->GetEnv((void**)&env, nat->envVer); - - jint result = HEALTH_OPERATION_SUCCESS; - if (dbus_set_error_from_message(&err, msg)) { - if (!strcmp(err.name, BLUEZ_ERROR_IFC ".InvalidArgs")) { - result = HEALTH_OPERATION_INVALID_ARGS; - } else if (!strcmp(err.name, BLUEZ_ERROR_IFC ".HealthError")) { - result = HEALTH_OPERATION_ERROR; - } else if (!strcmp(err.name, BLUEZ_ERROR_IFC ".NotFound")) { - result = HEALTH_OPERATION_NOT_FOUND; - } else if (!strcmp(err.name, BLUEZ_ERROR_IFC ".NotAllowed")) { - result = HEALTH_OPERATION_NOT_ALLOWED; - } else { - result = HEALTH_OPERATION_GENERIC_FAILURE; - } - LOG_AND_FREE_DBUS_ERROR(&err); - } - - jint code = *(int *) user; - ALOGV("... Health Device Code = %d, result = %d", code, result); - env->CallVoidMethod(nat->me, - method_onHealthDeviceConnectionResult, - code, - result); - free(user); -} -#endif - -static JNINativeMethod sMethods[] = { - /* name, signature, funcPtr */ - {"classInitNative", "()V", (void *)classInitNative}, - {"initializeNativeDataNative", "()V", (void *)initializeNativeDataNative}, - {"cleanupNativeDataNative", "()V", (void *)cleanupNativeDataNative}, - {"startEventLoopNative", "()V", (void *)startEventLoopNative}, - {"stopEventLoopNative", "()V", (void *)stopEventLoopNative}, - {"isEventLoopRunningNative", "()Z", (void *)isEventLoopRunningNative} -}; - -int register_android_server_BluetoothEventLoop(JNIEnv *env) { - return AndroidRuntime::registerNativeMethods(env, - "android/server/BluetoothEventLoop", sMethods, NELEM(sMethods)); -} - -} /* namespace android */ diff --git a/core/jni/android_server_BluetoothService.cpp b/core/jni/android_server_BluetoothService.cpp deleted file mode 100644 index 6c1112186fe1c..0000000000000 --- a/core/jni/android_server_BluetoothService.cpp +++ /dev/null @@ -1,1785 +0,0 @@ -/* -** Copyright 2006, 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 DBUS_ADAPTER_IFACE BLUEZ_DBUS_BASE_IFC ".Adapter" -#define DBUS_DEVICE_IFACE BLUEZ_DBUS_BASE_IFC ".Device" -#define DBUS_INPUT_IFACE BLUEZ_DBUS_BASE_IFC ".Input" -#define DBUS_NETWORK_IFACE BLUEZ_DBUS_BASE_IFC ".Network" -#define DBUS_NETWORKSERVER_IFACE BLUEZ_DBUS_BASE_IFC ".NetworkServer" -#define DBUS_HEALTH_MANAGER_PATH "/org/bluez" -#define DBUS_HEALTH_MANAGER_IFACE BLUEZ_DBUS_BASE_IFC ".HealthManager" -#define DBUS_HEALTH_DEVICE_IFACE BLUEZ_DBUS_BASE_IFC ".HealthDevice" -#define DBUS_HEALTH_CHANNEL_IFACE BLUEZ_DBUS_BASE_IFC ".HealthChannel" - -#define LOG_TAG "BluetoothService.cpp" - -#include "android_bluetooth_common.h" -#include "android_runtime/AndroidRuntime.h" -#include "android_util_Binder.h" -#include "JNIHelp.h" -#include "jni.h" -#include "utils/Log.h" -#include "utils/misc.h" - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#ifdef HAVE_BLUETOOTH -#include -#include -#endif - -#include - -namespace android { - -#define BLUETOOTH_CLASS_ERROR 0xFF000000 -#define PROPERTIES_NREFS 10 - -#ifdef HAVE_BLUETOOTH -// We initialize these variables when we load class -// android.server.BluetoothService -static jfieldID field_mNativeData; -static jfieldID field_mEventLoop; - -typedef struct { - JNIEnv *env; - DBusConnection *conn; - const char *adapter; // dbus object name of the local adapter -} native_data_t; - -extern event_loop_native_data_t *get_EventLoop_native_data(JNIEnv *, - jobject); -extern DBusHandlerResult agent_event_filter(DBusConnection *conn, - DBusMessage *msg, - void *data); -void onCreatePairedDeviceResult(DBusMessage *msg, void *user, void *nat); -void onDiscoverServicesResult(DBusMessage *msg, void *user, void *nat); -void onCreateDeviceResult(DBusMessage *msg, void *user, void *nat); -void onInputDeviceConnectionResult(DBusMessage *msg, void *user, void *nat); -void onPanDeviceConnectionResult(DBusMessage *msg, void *user, void *nat); -void onHealthDeviceConnectionResult(DBusMessage *msg, void *user, void *nat); - - -/** Get native data stored in the opaque (Java code maintained) pointer mNativeData - * Perform quick sanity check, if there are any problems return NULL - */ -static inline native_data_t * get_native_data(JNIEnv *env, jobject object) { - native_data_t *nat = - (native_data_t *)(env->GetIntField(object, field_mNativeData)); - if (nat == NULL || nat->conn == NULL) { - ALOGE("Uninitialized native data\n"); - return NULL; - } - return nat; -} -#endif - -static void classInitNative(JNIEnv* env, jclass clazz) { - ALOGV("%s", __FUNCTION__); -#ifdef HAVE_BLUETOOTH - field_mNativeData = get_field(env, clazz, "mNativeData", "I"); - field_mEventLoop = get_field(env, clazz, "mEventLoop", - "Landroid/server/BluetoothEventLoop;"); -#endif -} - -/* Returns true on success (even if adapter is present but disabled). - * Return false if dbus is down, or another serious error (out of memory) -*/ -static bool initializeNativeDataNative(JNIEnv* env, jobject object) { - ALOGV("%s", __FUNCTION__); -#ifdef HAVE_BLUETOOTH - native_data_t *nat = (native_data_t *)calloc(1, sizeof(native_data_t)); - if (NULL == nat) { - ALOGE("%s: out of memory!", __FUNCTION__); - return false; - } - nat->env = env; - - env->SetIntField(object, field_mNativeData, (jint)nat); - DBusError err; - dbus_error_init(&err); - dbus_threads_init_default(); - nat->conn = dbus_bus_get(DBUS_BUS_SYSTEM, &err); - if (dbus_error_is_set(&err)) { - ALOGE("Could not get onto the system bus: %s", err.message); - dbus_error_free(&err); - return false; - } - dbus_connection_set_exit_on_disconnect(nat->conn, FALSE); -#endif /*HAVE_BLUETOOTH*/ - return true; -} - -static const char *get_adapter_path(JNIEnv* env, jobject object) { -#ifdef HAVE_BLUETOOTH - event_loop_native_data_t *event_nat = - get_EventLoop_native_data(env, env->GetObjectField(object, - field_mEventLoop)); - if (event_nat == NULL) - return NULL; - return event_nat->adapter; -#else - return NULL; -#endif -} - -// This function is called when the adapter is enabled. -static jboolean setupNativeDataNative(JNIEnv* env, jobject object) { - ALOGV("%s", __FUNCTION__); -#ifdef HAVE_BLUETOOTH - native_data_t *nat = - (native_data_t *)env->GetIntField(object, field_mNativeData); - event_loop_native_data_t *event_nat = - get_EventLoop_native_data(env, env->GetObjectField(object, - field_mEventLoop)); - // Register agent for remote devices. - const char *device_agent_path = "/android/bluetooth/remote_device_agent"; - static const DBusObjectPathVTable agent_vtable = { - NULL, agent_event_filter, NULL, NULL, NULL, NULL }; - - if (!dbus_connection_register_object_path(nat->conn, device_agent_path, - &agent_vtable, event_nat)) { - ALOGE("%s: Can't register object path %s for remote device agent!", - __FUNCTION__, device_agent_path); - return JNI_FALSE; - } -#endif /*HAVE_BLUETOOTH*/ - return JNI_TRUE; -} - -static jboolean tearDownNativeDataNative(JNIEnv *env, jobject object) { - ALOGV("%s", __FUNCTION__); -#ifdef HAVE_BLUETOOTH - native_data_t *nat = - (native_data_t *)env->GetIntField(object, field_mNativeData); - if (nat != NULL) { - const char *device_agent_path = - "/android/bluetooth/remote_device_agent"; - dbus_connection_unregister_object_path (nat->conn, device_agent_path); - } -#endif /*HAVE_BLUETOOTH*/ - return JNI_TRUE; -} - -static void cleanupNativeDataNative(JNIEnv* env, jobject object) { - ALOGV("%s", __FUNCTION__); -#ifdef HAVE_BLUETOOTH - native_data_t *nat = - (native_data_t *)env->GetIntField(object, field_mNativeData); - if (nat) { - free(nat); - nat = NULL; - } -#endif -} - -static jstring getAdapterPathNative(JNIEnv *env, jobject object) { - ALOGV("%s", __FUNCTION__); -#ifdef HAVE_BLUETOOTH - native_data_t *nat = get_native_data(env, object); - if (nat) { - return (env->NewStringUTF(get_adapter_path(env, object))); - } -#endif - return NULL; -} - - -static jboolean startDiscoveryNative(JNIEnv *env, jobject object) { - ALOGV("%s", __FUNCTION__); -#ifdef HAVE_BLUETOOTH - DBusMessage *msg = NULL; - DBusMessage *reply = NULL; - DBusError err; - const char *name; - jboolean ret = JNI_FALSE; - - native_data_t *nat = get_native_data(env, object); - if (nat == NULL) { - goto done; - } - - dbus_error_init(&err); - - /* Compose the command */ - msg = dbus_message_new_method_call(BLUEZ_DBUS_BASE_IFC, - get_adapter_path(env, object), - DBUS_ADAPTER_IFACE, "StartDiscovery"); - - if (msg == NULL) { - if (dbus_error_is_set(&err)) { - LOG_AND_FREE_DBUS_ERROR_WITH_MSG(&err, msg); - } - goto done; - } - - /* Send the command. */ - reply = dbus_connection_send_with_reply_and_block(nat->conn, msg, -1, &err); - if (dbus_error_is_set(&err)) { - LOG_AND_FREE_DBUS_ERROR_WITH_MSG(&err, msg); - ret = JNI_FALSE; - goto done; - } - - ret = JNI_TRUE; -done: - if (reply) dbus_message_unref(reply); - if (msg) dbus_message_unref(msg); - return ret; -#else - return JNI_FALSE; -#endif -} - -static jboolean stopDiscoveryNative(JNIEnv *env, jobject object) { - ALOGV("%s", __FUNCTION__); -#ifdef HAVE_BLUETOOTH - DBusMessage *msg = NULL; - DBusMessage *reply = NULL; - DBusError err; - const char *name; - native_data_t *nat; - jboolean ret = JNI_FALSE; - - dbus_error_init(&err); - - nat = get_native_data(env, object); - if (nat == NULL) { - goto done; - } - - /* Compose the command */ - msg = dbus_message_new_method_call(BLUEZ_DBUS_BASE_IFC, - get_adapter_path(env, object), - DBUS_ADAPTER_IFACE, "StopDiscovery"); - if (msg == NULL) { - if (dbus_error_is_set(&err)) - LOG_AND_FREE_DBUS_ERROR_WITH_MSG(&err, msg); - goto done; - } - - /* Send the command. */ - reply = dbus_connection_send_with_reply_and_block(nat->conn, msg, -1, &err); - if (dbus_error_is_set(&err)) { - if(strncmp(err.name, BLUEZ_DBUS_BASE_IFC ".Error.NotAuthorized", - strlen(BLUEZ_DBUS_BASE_IFC ".Error.NotAuthorized")) == 0) { - // hcid sends this if there is no active discovery to cancel - ALOGV("%s: There was no active discovery to cancel", __FUNCTION__); - dbus_error_free(&err); - } else { - LOG_AND_FREE_DBUS_ERROR_WITH_MSG(&err, msg); - } - goto done; - } - - ret = JNI_TRUE; -done: - if (msg) dbus_message_unref(msg); - if (reply) dbus_message_unref(reply); - return ret; -#else - return JNI_FALSE; -#endif -} - -static jbyteArray readAdapterOutOfBandDataNative(JNIEnv *env, jobject object) { - ALOGV("%s", __FUNCTION__); -#ifdef HAVE_BLUETOOTH - native_data_t *nat = get_native_data(env, object); - DBusError err; - jbyte *hash, *randomizer; - jbyteArray byteArray = NULL; - int hash_len, r_len; - if (nat) { - DBusMessage *reply = dbus_func_args(env, nat->conn, - get_adapter_path(env, object), - DBUS_ADAPTER_IFACE, "ReadLocalOutOfBandData", - DBUS_TYPE_INVALID); - if (!reply) return NULL; - - dbus_error_init(&err); - if (dbus_message_get_args(reply, &err, - DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE, &hash, &hash_len, - DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE, &randomizer, &r_len, - DBUS_TYPE_INVALID)) { - if (hash_len == 16 && r_len == 16) { - byteArray = env->NewByteArray(32); - if (byteArray) { - env->SetByteArrayRegion(byteArray, 0, 16, hash); - env->SetByteArrayRegion(byteArray, 16, 16, randomizer); - } - } else { - ALOGE("readAdapterOutOfBandDataNative: Hash len = %d, R len = %d", - hash_len, r_len); - } - } else { - LOG_AND_FREE_DBUS_ERROR(&err); - } - dbus_message_unref(reply); - return byteArray; - } -#endif - return NULL; -} - -static jboolean createPairedDeviceNative(JNIEnv *env, jobject object, - jstring address, jint timeout_ms) { - ALOGV("%s", __FUNCTION__); -#ifdef HAVE_BLUETOOTH - native_data_t *nat = get_native_data(env, object); - jobject eventLoop = env->GetObjectField(object, field_mEventLoop); - struct event_loop_native_data_t *eventLoopNat = - get_EventLoop_native_data(env, eventLoop); - - if (nat && eventLoopNat) { - const char *c_address = env->GetStringUTFChars(address, NULL); - ALOGV("... address = %s", c_address); - char *context_address = (char *)calloc(BTADDR_SIZE, sizeof(char)); - const char *capabilities = "DisplayYesNo"; - const char *agent_path = "/android/bluetooth/remote_device_agent"; - - strlcpy(context_address, c_address, BTADDR_SIZE); // for callback - bool ret = dbus_func_args_async(env, nat->conn, (int)timeout_ms, - onCreatePairedDeviceResult, // callback - context_address, - eventLoopNat, - get_adapter_path(env, object), - DBUS_ADAPTER_IFACE, - "CreatePairedDevice", - DBUS_TYPE_STRING, &c_address, - DBUS_TYPE_OBJECT_PATH, &agent_path, - DBUS_TYPE_STRING, &capabilities, - DBUS_TYPE_INVALID); - env->ReleaseStringUTFChars(address, c_address); - return ret ? JNI_TRUE : JNI_FALSE; - - } -#endif - return JNI_FALSE; -} - -static jboolean createPairedDeviceOutOfBandNative(JNIEnv *env, jobject object, - jstring address, jint timeout_ms) { - ALOGV("%s", __FUNCTION__); -#ifdef HAVE_BLUETOOTH - native_data_t *nat = get_native_data(env, object); - jobject eventLoop = env->GetObjectField(object, field_mEventLoop); - struct event_loop_native_data_t *eventLoopNat = - get_EventLoop_native_data(env, eventLoop); - - if (nat && eventLoopNat) { - const char *c_address = env->GetStringUTFChars(address, NULL); - ALOGV("... address = %s", c_address); - char *context_address = (char *)calloc(BTADDR_SIZE, sizeof(char)); - const char *capabilities = "DisplayYesNo"; - const char *agent_path = "/android/bluetooth/remote_device_agent"; - - strlcpy(context_address, c_address, BTADDR_SIZE); // for callback - bool ret = dbus_func_args_async(env, nat->conn, (int)timeout_ms, - onCreatePairedDeviceResult, // callback - context_address, - eventLoopNat, - get_adapter_path(env, object), - DBUS_ADAPTER_IFACE, - "CreatePairedDeviceOutOfBand", - DBUS_TYPE_STRING, &c_address, - DBUS_TYPE_OBJECT_PATH, &agent_path, - DBUS_TYPE_STRING, &capabilities, - DBUS_TYPE_INVALID); - env->ReleaseStringUTFChars(address, c_address); - return ret ? JNI_TRUE : JNI_FALSE; - } -#endif - return JNI_FALSE; -} - -static jint getDeviceServiceChannelNative(JNIEnv *env, jobject object, - jstring path, - jstring pattern, jint attr_id) { -#ifdef HAVE_BLUETOOTH - ALOGV("%s", __FUNCTION__); - native_data_t *nat = get_native_data(env, object); - jobject eventLoop = env->GetObjectField(object, field_mEventLoop); - struct event_loop_native_data_t *eventLoopNat = - get_EventLoop_native_data(env, eventLoop); - if (nat && eventLoopNat) { - const char *c_pattern = env->GetStringUTFChars(pattern, NULL); - const char *c_path = env->GetStringUTFChars(path, NULL); - ALOGV("... pattern = %s", c_pattern); - ALOGV("... attr_id = %#X", attr_id); - DBusMessage *reply = - dbus_func_args(env, nat->conn, c_path, - DBUS_DEVICE_IFACE, "GetServiceAttributeValue", - DBUS_TYPE_STRING, &c_pattern, - DBUS_TYPE_UINT16, &attr_id, - DBUS_TYPE_INVALID); - env->ReleaseStringUTFChars(pattern, c_pattern); - env->ReleaseStringUTFChars(path, c_path); - return reply ? dbus_returns_int32(env, reply) : -1; - } -#endif - return -1; -} - -static jboolean cancelDeviceCreationNative(JNIEnv *env, jobject object, - jstring address) { - ALOGV("%s", __FUNCTION__); - jboolean result = JNI_FALSE; -#ifdef HAVE_BLUETOOTH - native_data_t *nat = get_native_data(env, object); - if (nat) { - const char *c_address = env->GetStringUTFChars(address, NULL); - DBusError err; - dbus_error_init(&err); - ALOGV("... address = %s", c_address); - DBusMessage *reply = - dbus_func_args_timeout(env, nat->conn, -1, - get_adapter_path(env, object), - DBUS_ADAPTER_IFACE, "CancelDeviceCreation", - DBUS_TYPE_STRING, &c_address, - DBUS_TYPE_INVALID); - env->ReleaseStringUTFChars(address, c_address); - if (!reply) { - if (dbus_error_is_set(&err)) { - LOG_AND_FREE_DBUS_ERROR(&err); - } else - ALOGE("DBus reply is NULL in function %s", __FUNCTION__); - return JNI_FALSE; - } else { - result = JNI_TRUE; - } - dbus_message_unref(reply); - } -#endif - return JNI_FALSE; -} - -static jboolean removeDeviceNative(JNIEnv *env, jobject object, jstring object_path) { - ALOGV("%s", __FUNCTION__); -#ifdef HAVE_BLUETOOTH - native_data_t *nat = get_native_data(env, object); - if (nat) { - const char *c_object_path = env->GetStringUTFChars(object_path, NULL); - bool ret = dbus_func_args_async(env, nat->conn, -1, - NULL, - NULL, - NULL, - get_adapter_path(env, object), - DBUS_ADAPTER_IFACE, - "RemoveDevice", - DBUS_TYPE_OBJECT_PATH, &c_object_path, - DBUS_TYPE_INVALID); - env->ReleaseStringUTFChars(object_path, c_object_path); - return ret ? JNI_TRUE : JNI_FALSE; - } -#endif - return JNI_FALSE; -} - -static jint enableNative(JNIEnv *env, jobject object) { -#ifdef HAVE_BLUETOOTH - ALOGV("%s", __FUNCTION__); - return bt_enable(); -#endif - return -1; -} - -static jint disableNative(JNIEnv *env, jobject object) { -#ifdef HAVE_BLUETOOTH - ALOGV("%s", __FUNCTION__); - return bt_disable(); -#endif - return -1; -} - -static jint isEnabledNative(JNIEnv *env, jobject object) { -#ifdef HAVE_BLUETOOTH - ALOGV("%s", __FUNCTION__); - return bt_is_enabled(); -#endif - return -1; -} - -static jboolean setPairingConfirmationNative(JNIEnv *env, jobject object, - jstring address, bool confirm, - int nativeData) { -#ifdef HAVE_BLUETOOTH - ALOGV("%s", __FUNCTION__); - native_data_t *nat = get_native_data(env, object); - if (nat) { - DBusMessage *msg = (DBusMessage *)nativeData; - DBusMessage *reply; - if (confirm) { - reply = dbus_message_new_method_return(msg); - } else { - reply = dbus_message_new_error(msg, - "org.bluez.Error.Rejected", "User rejected confirmation"); - } - - if (!reply) { - ALOGE("%s: Cannot create message reply to RequestPasskeyConfirmation or" - "RequestPairingConsent to D-Bus\n", __FUNCTION__); - dbus_message_unref(msg); - return JNI_FALSE; - } - - dbus_connection_send(nat->conn, reply, NULL); - dbus_message_unref(msg); - dbus_message_unref(reply); - return JNI_TRUE; - } -#endif - return JNI_FALSE; -} - -static jboolean setPasskeyNative(JNIEnv *env, jobject object, jstring address, - int passkey, int nativeData) { -#ifdef HAVE_BLUETOOTH - ALOGV("%s", __FUNCTION__); - native_data_t *nat = get_native_data(env, object); - if (nat) { - DBusMessage *msg = (DBusMessage *)nativeData; - DBusMessage *reply = dbus_message_new_method_return(msg); - if (!reply) { - ALOGE("%s: Cannot create message reply to return Passkey code to " - "D-Bus\n", __FUNCTION__); - dbus_message_unref(msg); - return JNI_FALSE; - } - - dbus_message_append_args(reply, DBUS_TYPE_UINT32, (uint32_t *)&passkey, - DBUS_TYPE_INVALID); - - dbus_connection_send(nat->conn, reply, NULL); - dbus_message_unref(msg); - dbus_message_unref(reply); - return JNI_TRUE; - } -#endif - return JNI_FALSE; -} - -static jboolean setRemoteOutOfBandDataNative(JNIEnv *env, jobject object, jstring address, - jbyteArray hash, jbyteArray randomizer, int nativeData) { -#ifdef HAVE_BLUETOOTH - ALOGV("%s", __FUNCTION__); - native_data_t *nat = get_native_data(env, object); - if (nat) { - DBusMessage *msg = (DBusMessage *)nativeData; - DBusMessage *reply = dbus_message_new_method_return(msg); - jbyte *h_ptr = env->GetByteArrayElements(hash, NULL); - jbyte *r_ptr = env->GetByteArrayElements(randomizer, NULL); - if (!reply) { - ALOGE("%s: Cannot create message reply to return remote OOB data to " - "D-Bus\n", __FUNCTION__); - dbus_message_unref(msg); - return JNI_FALSE; - } - - dbus_message_append_args(reply, - DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE, &h_ptr, 16, - DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE, &r_ptr, 16, - DBUS_TYPE_INVALID); - - env->ReleaseByteArrayElements(hash, h_ptr, 0); - env->ReleaseByteArrayElements(randomizer, r_ptr, 0); - - dbus_connection_send(nat->conn, reply, NULL); - dbus_message_unref(msg); - dbus_message_unref(reply); - return JNI_TRUE; - } -#endif - return JNI_FALSE; -} - -static jboolean setAuthorizationNative(JNIEnv *env, jobject object, jstring address, - jboolean val, int nativeData) { -#ifdef HAVE_BLUETOOTH - ALOGV("%s", __FUNCTION__); - native_data_t *nat = get_native_data(env, object); - if (nat) { - DBusMessage *msg = (DBusMessage *)nativeData; - DBusMessage *reply; - if (val) { - reply = dbus_message_new_method_return(msg); - } else { - reply = dbus_message_new_error(msg, - "org.bluez.Error.Rejected", "Authorization rejected"); - } - if (!reply) { - ALOGE("%s: Cannot create message reply D-Bus\n", __FUNCTION__); - dbus_message_unref(msg); - return JNI_FALSE; - } - - dbus_connection_send(nat->conn, reply, NULL); - dbus_message_unref(msg); - dbus_message_unref(reply); - return JNI_TRUE; - } -#endif - return JNI_FALSE; -} - -static jboolean setPinNative(JNIEnv *env, jobject object, jstring address, - jstring pin, int nativeData) { -#ifdef HAVE_BLUETOOTH - ALOGV("%s", __FUNCTION__); - native_data_t *nat = get_native_data(env, object); - if (nat) { - DBusMessage *msg = (DBusMessage *)nativeData; - DBusMessage *reply = dbus_message_new_method_return(msg); - if (!reply) { - ALOGE("%s: Cannot create message reply to return PIN code to " - "D-Bus\n", __FUNCTION__); - dbus_message_unref(msg); - return JNI_FALSE; - } - - const char *c_pin = env->GetStringUTFChars(pin, NULL); - - dbus_message_append_args(reply, DBUS_TYPE_STRING, &c_pin, - DBUS_TYPE_INVALID); - - dbus_connection_send(nat->conn, reply, NULL); - dbus_message_unref(msg); - dbus_message_unref(reply); - env->ReleaseStringUTFChars(pin, c_pin); - return JNI_TRUE; - } -#endif - return JNI_FALSE; -} - -static jboolean cancelPairingUserInputNative(JNIEnv *env, jobject object, - jstring address, int nativeData) { -#ifdef HAVE_BLUETOOTH - ALOGV("%s", __FUNCTION__); - native_data_t *nat = get_native_data(env, object); - if (nat) { - DBusMessage *msg = (DBusMessage *)nativeData; - DBusMessage *reply = dbus_message_new_error(msg, - "org.bluez.Error.Canceled", "Pairing User Input was canceled"); - if (!reply) { - ALOGE("%s: Cannot create message reply to return cancelUserInput to" - "D-BUS\n", __FUNCTION__); - dbus_message_unref(msg); - return JNI_FALSE; - } - - dbus_connection_send(nat->conn, reply, NULL); - dbus_message_unref(msg); - dbus_message_unref(reply); - return JNI_TRUE; - } -#endif - return JNI_FALSE; -} - -static jobjectArray getDevicePropertiesNative(JNIEnv *env, jobject object, - jstring path) -{ -#ifdef HAVE_BLUETOOTH - ALOGV("%s", __FUNCTION__); - native_data_t *nat = get_native_data(env, object); - if (nat) { - DBusMessage *msg, *reply; - DBusError err; - dbus_error_init(&err); - - const char *c_path = env->GetStringUTFChars(path, NULL); - reply = dbus_func_args_timeout(env, - nat->conn, -1, c_path, - DBUS_DEVICE_IFACE, "GetProperties", - DBUS_TYPE_INVALID); - env->ReleaseStringUTFChars(path, c_path); - - if (!reply) { - if (dbus_error_is_set(&err)) { - LOG_AND_FREE_DBUS_ERROR(&err); - } else - ALOGE("DBus reply is NULL in function %s", __FUNCTION__); - return NULL; - } - env->PushLocalFrame(PROPERTIES_NREFS); - - DBusMessageIter iter; - jobjectArray str_array = NULL; - if (dbus_message_iter_init(reply, &iter)) - str_array = parse_remote_device_properties(env, &iter); - dbus_message_unref(reply); - - return (jobjectArray) env->PopLocalFrame(str_array); - } -#endif - return NULL; -} - -static jobjectArray getAdapterPropertiesNative(JNIEnv *env, jobject object) { -#ifdef HAVE_BLUETOOTH - ALOGV("%s", __FUNCTION__); - native_data_t *nat = get_native_data(env, object); - if (nat) { - DBusMessage *msg, *reply; - DBusError err; - dbus_error_init(&err); - - reply = dbus_func_args_timeout(env, - nat->conn, -1, get_adapter_path(env, object), - DBUS_ADAPTER_IFACE, "GetProperties", - DBUS_TYPE_INVALID); - if (!reply) { - if (dbus_error_is_set(&err)) { - LOG_AND_FREE_DBUS_ERROR(&err); - } else - ALOGE("DBus reply is NULL in function %s", __FUNCTION__); - return NULL; - } - env->PushLocalFrame(PROPERTIES_NREFS); - - DBusMessageIter iter; - jobjectArray str_array = NULL; - if (dbus_message_iter_init(reply, &iter)) - str_array = parse_adapter_properties(env, &iter); - dbus_message_unref(reply); - - return (jobjectArray) env->PopLocalFrame(str_array); - } -#endif - return NULL; -} - -static jboolean setAdapterPropertyNative(JNIEnv *env, jobject object, jstring key, - void *value, jint type) { -#ifdef HAVE_BLUETOOTH - ALOGV("%s", __FUNCTION__); - native_data_t *nat = get_native_data(env, object); - if (nat) { - DBusMessage *msg; - DBusMessageIter iter; - dbus_bool_t reply = JNI_FALSE; - const char *c_key = env->GetStringUTFChars(key, NULL); - - msg = dbus_message_new_method_call(BLUEZ_DBUS_BASE_IFC, - get_adapter_path(env, object), - DBUS_ADAPTER_IFACE, "SetProperty"); - if (!msg) { - ALOGE("%s: Can't allocate new method call for GetProperties!", - __FUNCTION__); - env->ReleaseStringUTFChars(key, c_key); - return JNI_FALSE; - } - - dbus_message_append_args(msg, DBUS_TYPE_STRING, &c_key, DBUS_TYPE_INVALID); - dbus_message_iter_init_append(msg, &iter); - append_variant(&iter, type, value); - - // Asynchronous call - the callbacks come via propertyChange - reply = dbus_connection_send_with_reply(nat->conn, msg, NULL, -1); - dbus_message_unref(msg); - - env->ReleaseStringUTFChars(key, c_key); - return reply ? JNI_TRUE : JNI_FALSE; - - } -#endif - return JNI_FALSE; -} - -static jboolean setAdapterPropertyStringNative(JNIEnv *env, jobject object, jstring key, - jstring value) { -#ifdef HAVE_BLUETOOTH - const char *c_value = env->GetStringUTFChars(value, NULL); - jboolean ret = setAdapterPropertyNative(env, object, key, (void *)&c_value, DBUS_TYPE_STRING); - env->ReleaseStringUTFChars(value, (char *)c_value); - return ret; -#else - return JNI_FALSE; -#endif -} - -static jboolean setAdapterPropertyIntegerNative(JNIEnv *env, jobject object, jstring key, - jint value) { -#ifdef HAVE_BLUETOOTH - return setAdapterPropertyNative(env, object, key, (void *)&value, DBUS_TYPE_UINT32); -#else - return JNI_FALSE; -#endif -} - -static jboolean setAdapterPropertyBooleanNative(JNIEnv *env, jobject object, jstring key, - jint value) { -#ifdef HAVE_BLUETOOTH - return setAdapterPropertyNative(env, object, key, (void *)&value, DBUS_TYPE_BOOLEAN); -#else - return JNI_FALSE; -#endif -} - -static jboolean setDevicePropertyNative(JNIEnv *env, jobject object, jstring path, - jstring key, void *value, jint type) { -#ifdef HAVE_BLUETOOTH - ALOGV("%s", __FUNCTION__); - native_data_t *nat = get_native_data(env, object); - if (nat) { - DBusMessage *msg; - DBusMessageIter iter; - dbus_bool_t reply = JNI_FALSE; - - const char *c_key = env->GetStringUTFChars(key, NULL); - const char *c_path = env->GetStringUTFChars(path, NULL); - - msg = dbus_message_new_method_call(BLUEZ_DBUS_BASE_IFC, - c_path, DBUS_DEVICE_IFACE, "SetProperty"); - if (!msg) { - ALOGE("%s: Can't allocate new method call for device SetProperty!", __FUNCTION__); - env->ReleaseStringUTFChars(key, c_key); - env->ReleaseStringUTFChars(path, c_path); - return JNI_FALSE; - } - - dbus_message_append_args(msg, DBUS_TYPE_STRING, &c_key, DBUS_TYPE_INVALID); - dbus_message_iter_init_append(msg, &iter); - append_variant(&iter, type, value); - - // Asynchronous call - the callbacks come via Device propertyChange - reply = dbus_connection_send_with_reply(nat->conn, msg, NULL, -1); - dbus_message_unref(msg); - - env->ReleaseStringUTFChars(path, c_path); - env->ReleaseStringUTFChars(key, c_key); - - return reply ? JNI_TRUE : JNI_FALSE; - } -#endif - return JNI_FALSE; -} - -static jboolean setDevicePropertyBooleanNative(JNIEnv *env, jobject object, - jstring path, jstring key, jint value) { -#ifdef HAVE_BLUETOOTH - return setDevicePropertyNative(env, object, path, key, - (void *)&value, DBUS_TYPE_BOOLEAN); -#else - return JNI_FALSE; -#endif -} - -static jboolean setDevicePropertyStringNative(JNIEnv *env, jobject object, - jstring path, jstring key, jstring value) { -#ifdef HAVE_BLUETOOTH - const char *c_value = env->GetStringUTFChars(value, NULL); - jboolean ret = setDevicePropertyNative(env, object, path, key, - (void *)&c_value, DBUS_TYPE_STRING); - env->ReleaseStringUTFChars(value, (char *)c_value); - return ret; -#else - return JNI_FALSE; -#endif -} - -static jboolean createDeviceNative(JNIEnv *env, jobject object, - jstring address) { - ALOGV("%s", __FUNCTION__); -#ifdef HAVE_BLUETOOTH - native_data_t *nat = get_native_data(env, object); - jobject eventLoop = env->GetObjectField(object, field_mEventLoop); - struct event_loop_native_data_t *eventLoopNat = - get_EventLoop_native_data(env, eventLoop); - - if (nat && eventLoopNat) { - const char *c_address = env->GetStringUTFChars(address, NULL); - ALOGV("... address = %s", c_address); - char *context_address = (char *)calloc(BTADDR_SIZE, sizeof(char)); - strlcpy(context_address, c_address, BTADDR_SIZE); // for callback - - bool ret = dbus_func_args_async(env, nat->conn, -1, - onCreateDeviceResult, - context_address, - eventLoopNat, - get_adapter_path(env, object), - DBUS_ADAPTER_IFACE, - "CreateDevice", - DBUS_TYPE_STRING, &c_address, - DBUS_TYPE_INVALID); - env->ReleaseStringUTFChars(address, c_address); - return ret ? JNI_TRUE : JNI_FALSE; - } -#endif - return JNI_FALSE; -} - -static jboolean discoverServicesNative(JNIEnv *env, jobject object, - jstring path, jstring pattern) { - ALOGV("%s", __FUNCTION__); -#ifdef HAVE_BLUETOOTH - native_data_t *nat = get_native_data(env, object); - jobject eventLoop = env->GetObjectField(object, field_mEventLoop); - struct event_loop_native_data_t *eventLoopNat = - get_EventLoop_native_data(env, eventLoop); - - if (nat && eventLoopNat) { - const char *c_path = env->GetStringUTFChars(path, NULL); - const char *c_pattern = env->GetStringUTFChars(pattern, NULL); - int len = env->GetStringLength(path) + 1; - char *context_path = (char *)calloc(len, sizeof(char)); - strlcpy(context_path, c_path, len); // for callback - - ALOGV("... Object Path = %s", c_path); - ALOGV("... Pattern = %s, strlen = %d", c_pattern, strlen(c_pattern)); - - bool ret = dbus_func_args_async(env, nat->conn, -1, - onDiscoverServicesResult, - context_path, - eventLoopNat, - c_path, - DBUS_DEVICE_IFACE, - "DiscoverServices", - DBUS_TYPE_STRING, &c_pattern, - DBUS_TYPE_INVALID); - env->ReleaseStringUTFChars(path, c_path); - env->ReleaseStringUTFChars(pattern, c_pattern); - return ret ? JNI_TRUE : JNI_FALSE; - } -#endif - return JNI_FALSE; -} - -#ifdef HAVE_BLUETOOTH -static jintArray extract_handles(JNIEnv *env, DBusMessage *reply) { - jint *handles; - jintArray handleArray = NULL; - int len; - - DBusError err; - dbus_error_init(&err); - - if (dbus_message_get_args(reply, &err, - DBUS_TYPE_ARRAY, DBUS_TYPE_UINT32, &handles, &len, - DBUS_TYPE_INVALID)) { - handleArray = env->NewIntArray(len); - if (handleArray) { - env->SetIntArrayRegion(handleArray, 0, len, handles); - } else { - ALOGE("Null array in extract_handles"); - } - } else { - LOG_AND_FREE_DBUS_ERROR(&err); - } - return handleArray; -} -#endif - -static jintArray addReservedServiceRecordsNative(JNIEnv *env, jobject object, - jintArray uuids) { - ALOGV("%s", __FUNCTION__); -#ifdef HAVE_BLUETOOTH - DBusMessage *reply = NULL; - - native_data_t *nat = get_native_data(env, object); - - jint* svc_classes = env->GetIntArrayElements(uuids, NULL); - if (!svc_classes) return NULL; - - int len = env->GetArrayLength(uuids); - reply = dbus_func_args(env, nat->conn, - get_adapter_path(env, object), - DBUS_ADAPTER_IFACE, "AddReservedServiceRecords", - DBUS_TYPE_ARRAY, DBUS_TYPE_UINT32, - &svc_classes, len, DBUS_TYPE_INVALID); - env->ReleaseIntArrayElements(uuids, svc_classes, 0); - return reply ? extract_handles(env, reply) : NULL; - -#endif - return NULL; -} - -static jboolean removeReservedServiceRecordsNative(JNIEnv *env, jobject object, - jintArray handles) { - ALOGV("%s", __FUNCTION__); -#ifdef HAVE_BLUETOOTH - native_data_t *nat = get_native_data(env, object); - jint *values = env->GetIntArrayElements(handles, NULL); - DBusMessage *msg = NULL; - DBusMessage *reply = NULL; - if (values == NULL) return JNI_FALSE; - - jsize len = env->GetArrayLength(handles); - - reply = dbus_func_args(env, nat->conn, - get_adapter_path(env, object), - DBUS_ADAPTER_IFACE, "RemoveReservedServiceRecords", - DBUS_TYPE_ARRAY, DBUS_TYPE_UINT32, - &values, len, DBUS_TYPE_INVALID); - env->ReleaseIntArrayElements(handles, values, 0); - return reply ? JNI_TRUE : JNI_FALSE; -#endif - return JNI_FALSE; -} - -static jint addRfcommServiceRecordNative(JNIEnv *env, jobject object, - jstring name, jlong uuidMsb, jlong uuidLsb, jshort channel) { - ALOGV("%s", __FUNCTION__); -#ifdef HAVE_BLUETOOTH - native_data_t *nat = get_native_data(env, object); - if (nat) { - const char *c_name = env->GetStringUTFChars(name, NULL); - ALOGV("... name = %s", c_name); - ALOGV("... uuid1 = %llX", uuidMsb); - ALOGV("... uuid2 = %llX", uuidLsb); - ALOGV("... channel = %d", channel); - DBusMessage *reply = dbus_func_args(env, nat->conn, - get_adapter_path(env, object), - DBUS_ADAPTER_IFACE, "AddRfcommServiceRecord", - DBUS_TYPE_STRING, &c_name, - DBUS_TYPE_UINT64, &uuidMsb, - DBUS_TYPE_UINT64, &uuidLsb, - DBUS_TYPE_UINT16, &channel, - DBUS_TYPE_INVALID); - env->ReleaseStringUTFChars(name, c_name); - return reply ? dbus_returns_uint32(env, reply) : -1; - } -#endif - return -1; -} - -static jboolean removeServiceRecordNative(JNIEnv *env, jobject object, jint handle) { - ALOGV("%s", __FUNCTION__); -#ifdef HAVE_BLUETOOTH - native_data_t *nat = get_native_data(env, object); - if (nat) { - ALOGV("... handle = %X", handle); - DBusMessage *reply = dbus_func_args(env, nat->conn, - get_adapter_path(env, object), - DBUS_ADAPTER_IFACE, "RemoveServiceRecord", - DBUS_TYPE_UINT32, &handle, - DBUS_TYPE_INVALID); - return reply ? JNI_TRUE : JNI_FALSE; - } -#endif - return JNI_FALSE; -} - -static jboolean setLinkTimeoutNative(JNIEnv *env, jobject object, jstring object_path, - jint num_slots) { - ALOGV("%s", __FUNCTION__); -#ifdef HAVE_BLUETOOTH - native_data_t *nat = get_native_data(env, object); - if (nat) { - const char *c_object_path = env->GetStringUTFChars(object_path, NULL); - DBusMessage *reply = dbus_func_args(env, nat->conn, - get_adapter_path(env, object), - DBUS_ADAPTER_IFACE, "SetLinkTimeout", - DBUS_TYPE_OBJECT_PATH, &c_object_path, - DBUS_TYPE_UINT32, &num_slots, - DBUS_TYPE_INVALID); - env->ReleaseStringUTFChars(object_path, c_object_path); - return reply ? JNI_TRUE : JNI_FALSE; - } -#endif - return JNI_FALSE; -} - -static jboolean connectInputDeviceNative(JNIEnv *env, jobject object, jstring path) { - ALOGV("%s", __FUNCTION__); -#ifdef HAVE_BLUETOOTH - native_data_t *nat = get_native_data(env, object); - jobject eventLoop = env->GetObjectField(object, field_mEventLoop); - struct event_loop_native_data_t *eventLoopNat = - get_EventLoop_native_data(env, eventLoop); - - if (nat && eventLoopNat) { - const char *c_path = env->GetStringUTFChars(path, NULL); - - int len = env->GetStringLength(path) + 1; - char *context_path = (char *)calloc(len, sizeof(char)); - strlcpy(context_path, c_path, len); // for callback - - bool ret = dbus_func_args_async(env, nat->conn, -1, onInputDeviceConnectionResult, - context_path, eventLoopNat, c_path, DBUS_INPUT_IFACE, - "Connect", - DBUS_TYPE_INVALID); - - env->ReleaseStringUTFChars(path, c_path); - return ret ? JNI_TRUE : JNI_FALSE; - } -#endif - return JNI_FALSE; -} - -static jboolean disconnectInputDeviceNative(JNIEnv *env, jobject object, - jstring path) { - ALOGV("%s", __FUNCTION__); -#ifdef HAVE_BLUETOOTH - native_data_t *nat = get_native_data(env, object); - jobject eventLoop = env->GetObjectField(object, field_mEventLoop); - struct event_loop_native_data_t *eventLoopNat = - get_EventLoop_native_data(env, eventLoop); - - if (nat && eventLoopNat) { - const char *c_path = env->GetStringUTFChars(path, NULL); - - int len = env->GetStringLength(path) + 1; - char *context_path = (char *)calloc(len, sizeof(char)); - strlcpy(context_path, c_path, len); // for callback - - bool ret = dbus_func_args_async(env, nat->conn, -1, onInputDeviceConnectionResult, - context_path, eventLoopNat, c_path, DBUS_INPUT_IFACE, - "Disconnect", - DBUS_TYPE_INVALID); - - env->ReleaseStringUTFChars(path, c_path); - return ret ? JNI_TRUE : JNI_FALSE; - } -#endif - return JNI_FALSE; -} - -static jboolean setBluetoothTetheringNative(JNIEnv *env, jobject object, jboolean value, - jstring src_role, jstring bridge) { - ALOGV("%s", __FUNCTION__); -#ifdef HAVE_BLUETOOTH - native_data_t *nat = get_native_data(env, object); - if (nat) { - DBusMessage *reply; - const char *c_role = env->GetStringUTFChars(src_role, NULL); - const char *c_bridge = env->GetStringUTFChars(bridge, NULL); - if (value) { - ALOGE("setBluetoothTetheringNative true"); - reply = dbus_func_args(env, nat->conn, - get_adapter_path(env, object), - DBUS_NETWORKSERVER_IFACE, - "Register", - DBUS_TYPE_STRING, &c_role, - DBUS_TYPE_STRING, &c_bridge, - DBUS_TYPE_INVALID); - } else { - ALOGE("setBluetoothTetheringNative false"); - reply = dbus_func_args(env, nat->conn, - get_adapter_path(env, object), - DBUS_NETWORKSERVER_IFACE, - "Unregister", - DBUS_TYPE_STRING, &c_role, - DBUS_TYPE_INVALID); - } - env->ReleaseStringUTFChars(src_role, c_role); - env->ReleaseStringUTFChars(bridge, c_bridge); - return reply ? JNI_TRUE : JNI_FALSE; - } -#endif - return JNI_FALSE; -} - -static jboolean connectPanDeviceNative(JNIEnv *env, jobject object, jstring path, - jstring dstRole) { - ALOGV("%s", __FUNCTION__); -#ifdef HAVE_BLUETOOTH - ALOGE("connectPanDeviceNative"); - native_data_t *nat = get_native_data(env, object); - jobject eventLoop = env->GetObjectField(object, field_mEventLoop); - struct event_loop_native_data_t *eventLoopNat = - get_EventLoop_native_data(env, eventLoop); - - if (nat && eventLoopNat) { - const char *c_path = env->GetStringUTFChars(path, NULL); - const char *dst = env->GetStringUTFChars(dstRole, NULL); - - int len = env->GetStringLength(path) + 1; - char *context_path = (char *)calloc(len, sizeof(char)); - strlcpy(context_path, c_path, len); // for callback - - bool ret = dbus_func_args_async(env, nat->conn, -1,onPanDeviceConnectionResult, - context_path, eventLoopNat, c_path, - DBUS_NETWORK_IFACE, "Connect", - DBUS_TYPE_STRING, &dst, - DBUS_TYPE_INVALID); - - env->ReleaseStringUTFChars(path, c_path); - env->ReleaseStringUTFChars(dstRole, dst); - return ret ? JNI_TRUE : JNI_FALSE; - } -#endif - return JNI_FALSE; -} - -static jboolean disconnectPanDeviceNative(JNIEnv *env, jobject object, - jstring path) { - ALOGV("%s", __FUNCTION__); -#ifdef HAVE_BLUETOOTH - ALOGE("disconnectPanDeviceNative"); - native_data_t *nat = get_native_data(env, object); - jobject eventLoop = env->GetObjectField(object, field_mEventLoop); - struct event_loop_native_data_t *eventLoopNat = - get_EventLoop_native_data(env, eventLoop); - - if (nat && eventLoopNat) { - const char *c_path = env->GetStringUTFChars(path, NULL); - - int len = env->GetStringLength(path) + 1; - char *context_path = (char *)calloc(len, sizeof(char)); - strlcpy(context_path, c_path, len); // for callback - - bool ret = dbus_func_args_async(env, nat->conn, -1,onPanDeviceConnectionResult, - context_path, eventLoopNat, c_path, - DBUS_NETWORK_IFACE, "Disconnect", - DBUS_TYPE_INVALID); - - env->ReleaseStringUTFChars(path, c_path); - return ret ? JNI_TRUE : JNI_FALSE; - } -#endif - return JNI_FALSE; -} - -static jboolean disconnectPanServerDeviceNative(JNIEnv *env, jobject object, - jstring path, jstring address, - jstring iface) { - ALOGV("%s", __FUNCTION__); -#ifdef HAVE_BLUETOOTH - ALOGE("disconnectPanServerDeviceNative"); - native_data_t *nat = get_native_data(env, object); - jobject eventLoop = env->GetObjectField(object, field_mEventLoop); - struct event_loop_native_data_t *eventLoopNat = - get_EventLoop_native_data(env, eventLoop); - - if (nat && eventLoopNat) { - const char *c_address = env->GetStringUTFChars(address, NULL); - const char *c_path = env->GetStringUTFChars(path, NULL); - const char *c_iface = env->GetStringUTFChars(iface, NULL); - - int len = env->GetStringLength(path) + 1; - char *context_path = (char *)calloc(len, sizeof(char)); - strlcpy(context_path, c_path, len); // for callback - - bool ret = dbus_func_args_async(env, nat->conn, -1, - onPanDeviceConnectionResult, - context_path, eventLoopNat, - get_adapter_path(env, object), - DBUS_NETWORKSERVER_IFACE, - "DisconnectDevice", - DBUS_TYPE_STRING, &c_address, - DBUS_TYPE_STRING, &c_iface, - DBUS_TYPE_INVALID); - - env->ReleaseStringUTFChars(address, c_address); - env->ReleaseStringUTFChars(iface, c_iface); - env->ReleaseStringUTFChars(path, c_path); - return ret ? JNI_TRUE : JNI_FALSE; - } -#endif - return JNI_FALSE; -} - -static jstring registerHealthApplicationNative(JNIEnv *env, jobject object, - jint dataType, jstring role, - jstring name, jstring channelType) { - ALOGV("%s", __FUNCTION__); - jstring path = NULL; -#ifdef HAVE_BLUETOOTH - native_data_t *nat = get_native_data(env, object); - if (nat) { - const char *c_role = env->GetStringUTFChars(role, NULL); - const char *c_name = env->GetStringUTFChars(name, NULL); - const char *c_channel_type = env->GetStringUTFChars(channelType, NULL); - char *c_path; - DBusMessage *msg, *reply; - DBusError err; - dbus_error_init(&err); - - msg = dbus_message_new_method_call(BLUEZ_DBUS_BASE_IFC, - DBUS_HEALTH_MANAGER_PATH, - DBUS_HEALTH_MANAGER_IFACE, - "CreateApplication"); - - if (msg == NULL) { - ALOGE("Could not allocate D-Bus message object!"); - return NULL; - } - - /* append arguments */ - append_dict_args(msg, - "DataType", DBUS_TYPE_UINT16, &dataType, - "Role", DBUS_TYPE_STRING, &c_role, - "Description", DBUS_TYPE_STRING, &c_name, - "ChannelType", DBUS_TYPE_STRING, &c_channel_type, - DBUS_TYPE_INVALID); - - - /* Make the call. */ - reply = dbus_connection_send_with_reply_and_block(nat->conn, msg, -1, &err); - - env->ReleaseStringUTFChars(role, c_role); - env->ReleaseStringUTFChars(name, c_name); - env->ReleaseStringUTFChars(channelType, c_channel_type); - - if (!reply) { - if (dbus_error_is_set(&err)) { - LOG_AND_FREE_DBUS_ERROR(&err); - } - } else { - if (!dbus_message_get_args(reply, &err, - DBUS_TYPE_OBJECT_PATH, &c_path, - DBUS_TYPE_INVALID)) { - if (dbus_error_is_set(&err)) { - LOG_AND_FREE_DBUS_ERROR(&err); - } - } else { - path = env->NewStringUTF(c_path); - } - dbus_message_unref(reply); - } - } -#endif - return path; -} - -static jstring registerSinkHealthApplicationNative(JNIEnv *env, jobject object, - jint dataType, jstring role, - jstring name) { - ALOGV("%s", __FUNCTION__); - jstring path = NULL; -#ifdef HAVE_BLUETOOTH - native_data_t *nat = get_native_data(env, object); - if (nat) { - const char *c_role = env->GetStringUTFChars(role, NULL); - const char *c_name = env->GetStringUTFChars(name, NULL); - char *c_path; - - DBusMessage *msg, *reply; - DBusError err; - dbus_error_init(&err); - - msg = dbus_message_new_method_call(BLUEZ_DBUS_BASE_IFC, - DBUS_HEALTH_MANAGER_PATH, - DBUS_HEALTH_MANAGER_IFACE, - "CreateApplication"); - - if (msg == NULL) { - ALOGE("Could not allocate D-Bus message object!"); - return NULL; - } - - /* append arguments */ - append_dict_args(msg, - "DataType", DBUS_TYPE_UINT16, &dataType, - "Role", DBUS_TYPE_STRING, &c_role, - "Description", DBUS_TYPE_STRING, &c_name, - DBUS_TYPE_INVALID); - - - /* Make the call. */ - reply = dbus_connection_send_with_reply_and_block(nat->conn, msg, -1, &err); - - env->ReleaseStringUTFChars(role, c_role); - env->ReleaseStringUTFChars(name, c_name); - - if (!reply) { - if (dbus_error_is_set(&err)) { - LOG_AND_FREE_DBUS_ERROR(&err); - } - } else { - if (!dbus_message_get_args(reply, &err, - DBUS_TYPE_OBJECT_PATH, &c_path, - DBUS_TYPE_INVALID)) { - if (dbus_error_is_set(&err)) { - LOG_AND_FREE_DBUS_ERROR(&err); - } - } else { - path = env->NewStringUTF(c_path); - } - dbus_message_unref(reply); - } - } -#endif - return path; -} - -static jboolean unregisterHealthApplicationNative(JNIEnv *env, jobject object, - jstring path) { - ALOGV("%s", __FUNCTION__); - jboolean result = JNI_FALSE; -#ifdef HAVE_BLUETOOTH - native_data_t *nat = get_native_data(env, object); - if (nat) { - const char *c_path = env->GetStringUTFChars(path, NULL); - DBusError err; - dbus_error_init(&err); - DBusMessage *reply = - dbus_func_args_timeout(env, nat->conn, -1, - DBUS_HEALTH_MANAGER_PATH, - DBUS_HEALTH_MANAGER_IFACE, "DestroyApplication", - DBUS_TYPE_OBJECT_PATH, &c_path, - DBUS_TYPE_INVALID); - - env->ReleaseStringUTFChars(path, c_path); - - if (!reply) { - if (dbus_error_is_set(&err)) { - LOG_AND_FREE_DBUS_ERROR(&err); - } - } else { - result = JNI_TRUE; - } - } -#endif - return result; -} - -static jboolean createChannelNative(JNIEnv *env, jobject object, - jstring devicePath, jstring appPath, jstring config, - jint code) { - ALOGV("%s", __FUNCTION__); -#ifdef HAVE_BLUETOOTH - native_data_t *nat = get_native_data(env, object); - jobject eventLoop = env->GetObjectField(object, field_mEventLoop); - struct event_loop_native_data_t *eventLoopNat = - get_EventLoop_native_data(env, eventLoop); - - if (nat && eventLoopNat) { - const char *c_device_path = env->GetStringUTFChars(devicePath, NULL); - const char *c_app_path = env->GetStringUTFChars(appPath, NULL); - const char *c_config = env->GetStringUTFChars(config, NULL); - int *data = (int *) malloc(sizeof(int)); - if (data == NULL) return JNI_FALSE; - - *data = code; - bool ret = dbus_func_args_async(env, nat->conn, -1, onHealthDeviceConnectionResult, - data, eventLoopNat, c_device_path, - DBUS_HEALTH_DEVICE_IFACE, "CreateChannel", - DBUS_TYPE_OBJECT_PATH, &c_app_path, - DBUS_TYPE_STRING, &c_config, - DBUS_TYPE_INVALID); - - - env->ReleaseStringUTFChars(devicePath, c_device_path); - env->ReleaseStringUTFChars(appPath, c_app_path); - env->ReleaseStringUTFChars(config, c_config); - - return ret ? JNI_TRUE : JNI_FALSE; - } -#endif - return JNI_FALSE; -} - -static jboolean destroyChannelNative(JNIEnv *env, jobject object, jstring devicePath, - jstring channelPath, jint code) { - ALOGE("%s", __FUNCTION__); -#ifdef HAVE_BLUETOOTH - native_data_t *nat = get_native_data(env, object); - jobject eventLoop = env->GetObjectField(object, field_mEventLoop); - struct event_loop_native_data_t *eventLoopNat = - get_EventLoop_native_data(env, eventLoop); - - if (nat && eventLoopNat) { - const char *c_device_path = env->GetStringUTFChars(devicePath, NULL); - const char *c_channel_path = env->GetStringUTFChars(channelPath, NULL); - int *data = (int *) malloc(sizeof(int)); - if (data == NULL) return JNI_FALSE; - - *data = code; - bool ret = dbus_func_args_async(env, nat->conn, -1, onHealthDeviceConnectionResult, - data, eventLoopNat, c_device_path, - DBUS_HEALTH_DEVICE_IFACE, "DestroyChannel", - DBUS_TYPE_OBJECT_PATH, &c_channel_path, - DBUS_TYPE_INVALID); - - env->ReleaseStringUTFChars(devicePath, c_device_path); - env->ReleaseStringUTFChars(channelPath, c_channel_path); - - return ret ? JNI_TRUE : JNI_FALSE; - } -#endif - return JNI_FALSE; -} - -static jstring getMainChannelNative(JNIEnv *env, jobject object, jstring devicePath) { - ALOGE("%s", __FUNCTION__); -#ifdef HAVE_BLUETOOTH - native_data_t *nat = get_native_data(env, object); - if (nat) { - const char *c_device_path = env->GetStringUTFChars(devicePath, NULL); - DBusError err; - dbus_error_init(&err); - - DBusMessage *reply = dbus_func_args(env, nat->conn, - c_device_path, - DBUS_HEALTH_DEVICE_IFACE, "GetProperties", - DBUS_TYPE_INVALID); - env->ReleaseStringUTFChars(devicePath, c_device_path); - - if (!reply) { - if (dbus_error_is_set(&err)) { - LOG_AND_FREE_DBUS_ERROR(&err); - } - } else { - DBusMessageIter iter; - jobjectArray str_array = NULL; - if (dbus_message_iter_init(reply, &iter)) - str_array = parse_health_device_properties(env, &iter); - dbus_message_unref(reply); - jstring path = (jstring) env->GetObjectArrayElement(str_array, 1); - - return path; - } - } -#endif - return NULL; -} - -static jstring getChannelApplicationNative(JNIEnv *env, jobject object, jstring channelPath) { - ALOGE("%s", __FUNCTION__); -#ifdef HAVE_BLUETOOTH - native_data_t *nat = get_native_data(env, object); - if (nat) { - const char *c_channel_path = env->GetStringUTFChars(channelPath, NULL); - DBusError err; - dbus_error_init(&err); - - DBusMessage *reply = dbus_func_args(env, nat->conn, - c_channel_path, - DBUS_HEALTH_CHANNEL_IFACE, "GetProperties", - DBUS_TYPE_INVALID); - env->ReleaseStringUTFChars(channelPath, c_channel_path); - - if (!reply) { - if (dbus_error_is_set(&err)) { - LOG_AND_FREE_DBUS_ERROR(&err); - } - } else { - DBusMessageIter iter; - jobjectArray str_array = NULL; - if (dbus_message_iter_init(reply, &iter)) - str_array = parse_health_channel_properties(env, &iter); - dbus_message_unref(reply); - - jint len = env->GetArrayLength(str_array); - - jstring name, path; - const char *c_name; - - for (int i = 0; i < len; i+=2) { - name = (jstring) env->GetObjectArrayElement(str_array, i); - c_name = env->GetStringUTFChars(name, NULL); - - if (!strcmp(c_name, "Application")) { - path = (jstring) env->GetObjectArrayElement(str_array, i+1); - env->ReleaseStringUTFChars(name, c_name); - return path; - } - env->ReleaseStringUTFChars(name, c_name); - } - } - } -#endif - return NULL; -} - -static jboolean releaseChannelFdNative(JNIEnv *env, jobject object, jstring channelPath) { - ALOGV("%s", __FUNCTION__); -#ifdef HAVE_BLUETOOTH - native_data_t *nat = get_native_data(env, object); - if (nat) { - const char *c_channel_path = env->GetStringUTFChars(channelPath, NULL); - DBusError err; - dbus_error_init(&err); - - DBusMessage *reply = dbus_func_args(env, nat->conn, - c_channel_path, - DBUS_HEALTH_CHANNEL_IFACE, "Release", - DBUS_TYPE_INVALID); - env->ReleaseStringUTFChars(channelPath, c_channel_path); - - return reply ? JNI_TRUE : JNI_FALSE; - } -#endif - return JNI_FALSE; -} - -static jobject getChannelFdNative(JNIEnv *env, jobject object, jstring channelPath) { - ALOGV("%s", __FUNCTION__); -#ifdef HAVE_BLUETOOTH - native_data_t *nat = get_native_data(env, object); - if (nat) { - const char *c_channel_path = env->GetStringUTFChars(channelPath, NULL); - int32_t fd; - DBusError err; - dbus_error_init(&err); - - DBusMessage *reply = dbus_func_args(env, nat->conn, - c_channel_path, - DBUS_HEALTH_CHANNEL_IFACE, "Acquire", - DBUS_TYPE_INVALID); - env->ReleaseStringUTFChars(channelPath, c_channel_path); - - if (!reply) { - if (dbus_error_is_set(&err)) { - LOG_AND_FREE_DBUS_ERROR(&err); - } - return NULL; - } - - fd = dbus_returns_unixfd(env, reply); - if (fd == -1) return NULL; - - int flags = fcntl(fd, F_GETFL); - if (flags < 0) { - ALOGE("Can't get flags with fcntl(): %s (%d)", - strerror(errno), errno); - releaseChannelFdNative(env, object, channelPath); - close(fd); - return NULL; - } - - flags &= ~O_NONBLOCK; - int status = fcntl(fd, F_SETFL, flags); - if (status < 0) { - ALOGE("Can't set flags with fcntl(): %s (%d)", - strerror(errno), errno); - releaseChannelFdNative(env, object, channelPath); - close(fd); - return NULL; - } - - // Create FileDescriptor object - jobject fileDesc = jniCreateFileDescriptor(env, fd); - if (fileDesc == NULL) { - // FileDescriptor constructor has thrown an exception - releaseChannelFdNative(env, object, channelPath); - close(fd); - return NULL; - } - - // Wrap it in a ParcelFileDescriptor - jobject parcelFileDesc = newParcelFileDescriptor(env, fileDesc); - if (parcelFileDesc == NULL) { - // ParcelFileDescriptor constructor has thrown an exception - releaseChannelFdNative(env, object, channelPath); - close(fd); - return NULL; - } - - return parcelFileDesc; - } -#endif - return NULL; -} - - - -static JNINativeMethod sMethods[] = { - /* name, signature, funcPtr */ - {"classInitNative", "()V", (void*)classInitNative}, - {"initializeNativeDataNative", "()V", (void *)initializeNativeDataNative}, - {"setupNativeDataNative", "()Z", (void *)setupNativeDataNative}, - {"tearDownNativeDataNative", "()Z", (void *)tearDownNativeDataNative}, - {"cleanupNativeDataNative", "()V", (void *)cleanupNativeDataNative}, - {"getAdapterPathNative", "()Ljava/lang/String;", (void*)getAdapterPathNative}, - - {"isEnabledNative", "()I", (void *)isEnabledNative}, - {"enableNative", "()I", (void *)enableNative}, - {"disableNative", "()I", (void *)disableNative}, - - {"getAdapterPropertiesNative", "()[Ljava/lang/Object;", (void *)getAdapterPropertiesNative}, - {"getDevicePropertiesNative", "(Ljava/lang/String;)[Ljava/lang/Object;", - (void *)getDevicePropertiesNative}, - {"setAdapterPropertyStringNative", "(Ljava/lang/String;Ljava/lang/String;)Z", - (void *)setAdapterPropertyStringNative}, - {"setAdapterPropertyBooleanNative", "(Ljava/lang/String;I)Z", - (void *)setAdapterPropertyBooleanNative}, - {"setAdapterPropertyIntegerNative", "(Ljava/lang/String;I)Z", - (void *)setAdapterPropertyIntegerNative}, - - {"startDiscoveryNative", "()Z", (void*)startDiscoveryNative}, - {"stopDiscoveryNative", "()Z", (void *)stopDiscoveryNative}, - - {"readAdapterOutOfBandDataNative", "()[B", (void *)readAdapterOutOfBandDataNative}, - {"createPairedDeviceNative", "(Ljava/lang/String;I)Z", (void *)createPairedDeviceNative}, - {"createPairedDeviceOutOfBandNative", "(Ljava/lang/String;I)Z", - (void *)createPairedDeviceOutOfBandNative}, - {"cancelDeviceCreationNative", "(Ljava/lang/String;)Z", (void *)cancelDeviceCreationNative}, - {"removeDeviceNative", "(Ljava/lang/String;)Z", (void *)removeDeviceNative}, - {"getDeviceServiceChannelNative", "(Ljava/lang/String;Ljava/lang/String;I)I", - (void *)getDeviceServiceChannelNative}, - - {"setPairingConfirmationNative", "(Ljava/lang/String;ZI)Z", - (void *)setPairingConfirmationNative}, - {"setPasskeyNative", "(Ljava/lang/String;II)Z", (void *)setPasskeyNative}, - {"setRemoteOutOfBandDataNative", "(Ljava/lang/String;[B[BI)Z", (void *)setRemoteOutOfBandDataNative}, - {"setAuthorizationNative", "(Ljava/lang/String;ZI)Z", (void *)setAuthorizationNative}, - {"setPinNative", "(Ljava/lang/String;Ljava/lang/String;I)Z", (void *)setPinNative}, - {"cancelPairingUserInputNative", "(Ljava/lang/String;I)Z", - (void *)cancelPairingUserInputNative}, - {"setDevicePropertyBooleanNative", "(Ljava/lang/String;Ljava/lang/String;I)Z", - (void *)setDevicePropertyBooleanNative}, - {"setDevicePropertyStringNative", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Z", - (void *)setDevicePropertyStringNative}, - {"createDeviceNative", "(Ljava/lang/String;)Z", (void *)createDeviceNative}, - {"discoverServicesNative", "(Ljava/lang/String;Ljava/lang/String;)Z", (void *)discoverServicesNative}, - {"addRfcommServiceRecordNative", "(Ljava/lang/String;JJS)I", (void *)addRfcommServiceRecordNative}, - {"removeServiceRecordNative", "(I)Z", (void *)removeServiceRecordNative}, - {"addReservedServiceRecordsNative", "([I)[I", (void *) addReservedServiceRecordsNative}, - {"removeReservedServiceRecordsNative", "([I)Z", (void *) removeReservedServiceRecordsNative}, - {"setLinkTimeoutNative", "(Ljava/lang/String;I)Z", (void *)setLinkTimeoutNative}, - // HID functions - {"connectInputDeviceNative", "(Ljava/lang/String;)Z", (void *)connectInputDeviceNative}, - {"disconnectInputDeviceNative", "(Ljava/lang/String;)Z", (void *)disconnectInputDeviceNative}, - - {"setBluetoothTetheringNative", "(ZLjava/lang/String;Ljava/lang/String;)Z", - (void *)setBluetoothTetheringNative}, - {"connectPanDeviceNative", "(Ljava/lang/String;Ljava/lang/String;)Z", - (void *)connectPanDeviceNative}, - {"disconnectPanDeviceNative", "(Ljava/lang/String;)Z", (void *)disconnectPanDeviceNative}, - {"disconnectPanServerDeviceNative", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Z", - (void *)disconnectPanServerDeviceNative}, - // Health function - {"registerHealthApplicationNative", - "(ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;", - (void *)registerHealthApplicationNative}, - {"registerHealthApplicationNative", - "(ILjava/lang/String;Ljava/lang/String;)Ljava/lang/String;", - (void *)registerSinkHealthApplicationNative}, - - {"unregisterHealthApplicationNative", "(Ljava/lang/String;)Z", - (void *)unregisterHealthApplicationNative}, - {"createChannelNative", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;I)Z", - (void *)createChannelNative}, - {"destroyChannelNative", "(Ljava/lang/String;Ljava/lang/String;I)Z", - (void *)destroyChannelNative}, - {"getMainChannelNative", "(Ljava/lang/String;)Ljava/lang/String;", (void *)getMainChannelNative}, - {"getChannelApplicationNative", "(Ljava/lang/String;)Ljava/lang/String;", - (void *)getChannelApplicationNative}, - {"getChannelFdNative", "(Ljava/lang/String;)Landroid/os/ParcelFileDescriptor;", (void *)getChannelFdNative}, - {"releaseChannelFdNative", "(Ljava/lang/String;)Z", (void *)releaseChannelFdNative}, -}; - - -int register_android_server_BluetoothService(JNIEnv *env) { - return AndroidRuntime::registerNativeMethods(env, - "android/server/BluetoothService", sMethods, NELEM(sMethods)); -} - -} /* namespace android */ diff --git a/core/jni/android_text_AndroidCharacter.cpp b/core/jni/android_text_AndroidCharacter.cpp index dacbe41c3a964..8b85a7b7848c8 100644 --- a/core/jni/android_text_AndroidCharacter.cpp +++ b/core/jni/android_text_AndroidCharacter.cpp @@ -157,6 +157,7 @@ static jboolean mirror(JNIEnv* env, jobject obj, jcharArray charArray, int start return false; } + bool ret = false; for (int i = start; i < start + count; i++) { // XXX this thinks it knows that surrogates are never mirrored @@ -165,10 +166,10 @@ static jboolean mirror(JNIEnv* env, jobject obj, jcharArray charArray, int start if (c1 != c2) { data[i] = c2; - return true; + ret = true; } } - return false; + return ret; } static jchar getMirror(JNIEnv* env, jobject obj, jchar c) diff --git a/core/jni/android_text_format_Time.cpp b/core/jni/android_text_format_Time.cpp index 776733caf50d3..aa2c5f39ba8ee 100644 --- a/core/jni/android_text_format_Time.cpp +++ b/core/jni/android_text_format_Time.cpp @@ -23,6 +23,7 @@ #include "jni.h" #include "utils/misc.h" #include "android_runtime/AndroidRuntime.h" +#include "ScopedStringChars.h" #include "TimeUtils.h" #include #include @@ -71,11 +72,10 @@ static inline bool java2time(JNIEnv* env, Time* t, jobject o) t->t.tm_gmtoff = env->GetLongField(o, g_gmtoffField); bool allDay = env->GetBooleanField(o, g_allDayField); if (allDay && - ((t->t.tm_sec !=0) || (t->t.tm_min != 0) || (t->t.tm_hour != 0))) { - char msg[100]; - sprintf(msg, "allDay is true but sec, min, hour are not 0."); - jniThrowException(env, "java/lang/IllegalArgumentException", msg); - return false; + ((t->t.tm_sec !=0) || (t->t.tm_min != 0) || (t->t.tm_hour != 0))) { + jniThrowException(env, "java/lang/IllegalArgumentException", + "allDay is true but sec, min, hour are not 0."); + return false; } return true; } @@ -239,31 +239,36 @@ static jstring android_text_format_Time_format(JNIEnv* env, jobject This, jobjectArray ja; ja = (jobjectArray) env->GetStaticObjectField(timeClass, g_shortMonthsField); for (int i = 0; i < 12; i++) { + // Calendar.JANUARY == 0. js_mon[i] = (jstring) env->NewGlobalRef(env->GetObjectArrayElement(ja, i)); locale.mon[i] = env->GetStringUTFChars(js_mon[i], NULL); } ja = (jobjectArray) env->GetStaticObjectField(timeClass, g_longMonthsField); for (int i = 0; i < 12; i++) { + // Calendar.JANUARY == 0. js_month[i] = (jstring) env->NewGlobalRef(env->GetObjectArrayElement(ja, i)); locale.month[i] = env->GetStringUTFChars(js_month[i], NULL); } ja = (jobjectArray) env->GetStaticObjectField(timeClass, g_longStandaloneMonthsField); for (int i = 0; i < 12; i++) { + // Calendar.JANUARY == 0. js_standalone_month[i] = (jstring) env->NewGlobalRef(env->GetObjectArrayElement(ja, i)); locale.standalone_month[i] = env->GetStringUTFChars(js_standalone_month[i], NULL); } ja = (jobjectArray) env->GetStaticObjectField(timeClass, g_shortWeekdaysField); for (int i = 0; i < 7; i++) { - js_wday[i] = (jstring) env->NewGlobalRef(env->GetObjectArrayElement(ja, i)); + // Calendar.SUNDAY == 1, and there's an empty string in element 0. + js_wday[i] = (jstring) env->NewGlobalRef(env->GetObjectArrayElement(ja, i + 1)); locale.wday[i] = env->GetStringUTFChars(js_wday[i], NULL); } ja = (jobjectArray) env->GetStaticObjectField(timeClass, g_longWeekdaysField); for (int i = 0; i < 7; i++) { - js_weekday[i] = (jstring) env->NewGlobalRef(env->GetObjectArrayElement(ja, i)); + // Calendar.SUNDAY == 1, and there's an empty string in element 0. + js_weekday[i] = (jstring) env->NewGlobalRef(env->GetObjectArrayElement(ja, i + 1)); locale.weekday[i] = env->GetStringUTFChars(js_weekday[i], NULL); } @@ -308,7 +313,7 @@ static jstring android_text_format_Time_format(JNIEnv* env, jobject This, static jstring android_text_format_Time_toString(JNIEnv* env, jobject This) { Time t; - if (!java2time(env, &t, This)) return env->NewStringUTF("");; + if (!java2time(env, &t, This)) return env->NewStringUTF(""); ACQUIRE_TIMEZONE(This, t) String8 r = t.toString(); @@ -360,32 +365,30 @@ static void android_text_format_Time_set(JNIEnv* env, jobject This, jlong millis // ============================================================================ // Just do this here because it's not worth recreating the strings -static int get_char(JNIEnv* env, const jchar *s, int spos, int mul, - bool *thrown) +static int get_char(JNIEnv* env, const ScopedStringChars& s, int spos, int mul, + bool* thrown) { jchar c = s[spos]; if (c >= '0' && c <= '9') { return (c - '0') * mul; } else { if (!*thrown) { - char msg[100]; - sprintf(msg, "Parse error at pos=%d", spos); - jniThrowException(env, "android/util/TimeFormatException", msg); + jniThrowExceptionFmt(env, "android/util/TimeFormatException", + "Parse error at pos=%d", spos); *thrown = true; } return 0; } } -static bool check_char(JNIEnv* env, const jchar *s, int spos, jchar expected) +static bool check_char(JNIEnv* env, const ScopedStringChars& s, int spos, jchar expected) { jchar c = s[spos]; if (c != expected) { - char msg[100]; - sprintf(msg, "Unexpected character 0x%02x at pos=%d. Expected %c.", c, spos, - expected); - jniThrowException(env, "android/util/TimeFormatException", msg); - return false; + jniThrowExceptionFmt(env, "android/util/TimeFormatException", + "Unexpected character 0x%02x at pos=%d. Expected %c.", + c, spos, expected); + return false; } return true; } @@ -394,20 +397,19 @@ static bool check_char(JNIEnv* env, const jchar *s, int spos, jchar expected) static jboolean android_text_format_Time_parse(JNIEnv* env, jobject This, jstring strObj) { jsize len = env->GetStringLength(strObj); - const jchar *s = env->GetStringChars(strObj, NULL); + if (len < 8) { + jniThrowException(env, "android/util/TimeFormatException", + "String too short -- expected at least 8 characters."); + return false; + } - bool thrown = false; - int n; jboolean inUtc = false; - if (len < 8) { - char msg[100]; - sprintf(msg, "String too short -- expected at least 8 characters."); - jniThrowException(env, "android/util/TimeFormatException", msg); - return false; - } + ScopedStringChars s(env, strObj); // year + int n; + bool thrown = false; n = get_char(env, s, 0, 1000, &thrown); n += get_char(env, s, 1, 100, &thrown); n += get_char(env, s, 2, 10, &thrown); @@ -454,7 +456,7 @@ static jboolean android_text_format_Time_parse(JNIEnv* env, jobject This, jstrin if (len > 15) { // Z if (!check_char(env, s, 15, 'Z')) return false; - inUtc = true; + inUtc = true; } } else { env->SetBooleanField(This, g_allDayField, JNI_TRUE); @@ -467,8 +469,7 @@ static jboolean android_text_format_Time_parse(JNIEnv* env, jobject This, jstrin env->SetIntField(This, g_ydayField, 0); env->SetIntField(This, g_isdstField, -1); env->SetLongField(This, g_gmtoffField, 0); - - env->ReleaseStringChars(strObj, s); + return inUtc; } @@ -477,19 +478,19 @@ static jboolean android_text_format_Time_parse3339(JNIEnv* env, jstring strObj) { jsize len = env->GetStringLength(strObj); - const jchar *s = env->GetStringChars(strObj, NULL); - - bool thrown = false; - int n; - jboolean inUtc = false; - if (len < 10) { jniThrowException(env, "android/util/TimeFormatException", - "Time input is too short; must be at least 10 characters"); + "String too short --- expected at least 10 characters."); return false; } + jboolean inUtc = false; + + ScopedStringChars s(env, strObj); + // year + int n; + bool thrown = false; n = get_char(env, s, 0, 1000, &thrown); n += get_char(env, s, 1, 100, &thrown); n += get_char(env, s, 2, 10, &thrown); @@ -520,28 +521,28 @@ static jboolean android_text_format_Time_parse3339(JNIEnv* env, // T if (!check_char(env, s, 10, 'T')) return false; - env->SetBooleanField(This, g_allDayField, JNI_FALSE); + env->SetBooleanField(This, g_allDayField, JNI_FALSE); // hour n = get_char(env, s, 11, 10, &thrown); n += get_char(env, s, 12, 1, &thrown); if (thrown) return false; - int hour = n; + int hour = n; // env->SetIntField(This, g_hourField, n); - - // : - if (!check_char(env, s, 13, ':')) return false; - // minute + // : + if (!check_char(env, s, 13, ':')) return false; + + // minute n = get_char(env, s, 14, 10, &thrown); n += get_char(env, s, 15, 1, &thrown); if (thrown) return false; - int minute = n; + int minute = n; // env->SetIntField(This, g_minField, n); - // : - if (!check_char(env, s, 16, ':')) return false; + // : + if (!check_char(env, s, 16, ':')) return false; - // second + // second n = get_char(env, s, 17, 10, &thrown); n += get_char(env, s, 18, 1, &thrown); if (thrown) return false; @@ -561,64 +562,63 @@ static jboolean android_text_format_Time_parse3339(JNIEnv* env, if (len > tz_index) { char c = s[tz_index]; - // NOTE: the offset is meant to be subtracted to get from local time - // to UTC. we therefore use 1 for '-' and -1 for '+'. - switch (c) { - case 'Z': - // Zulu time -- UTC - offset = 0; - break; - case '-': + // NOTE: the offset is meant to be subtracted to get from local time + // to UTC. we therefore use 1 for '-' and -1 for '+'. + switch (c) { + case 'Z': + // Zulu time -- UTC + offset = 0; + break; + case '-': offset = 1; - break; - case '+': + break; + case '+': offset = -1; - break; - default: - char msg[100]; - sprintf(msg, "Unexpected character 0x%02x at position %d. Expected + or -", - c, tz_index); - jniThrowException(env, "android/util/TimeFormatException", msg); - return false; - } + break; + default: + jniThrowExceptionFmt(env, "android/util/TimeFormatException", + "Unexpected character 0x%02x at position %d. Expected + or -", + c, tz_index); + return false; + } inUtc = true; - if (offset != 0) { - if (len < tz_index + 6) { - char msg[100]; - sprintf(msg, "Unexpected length; should be %d characters", tz_index + 6); - jniThrowException(env, "android/util/TimeFormatException", msg); - return false; - } - - // hour - n = get_char(env, s, tz_index + 1, 10, &thrown); - n += get_char(env, s, tz_index + 2, 1, &thrown); - if (thrown) return false; - n *= offset; - hour += n; - - // : - if (!check_char(env, s, tz_index + 3, ':')) return false; - - // minute - n = get_char(env, s, tz_index + 4, 10, &thrown); - n += get_char(env, s, tz_index + 5, 1, &thrown); - if (thrown) return false; - n *= offset; - minute += n; - } - } - env->SetIntField(This, g_hourField, hour); + if (offset != 0) { + if (len < tz_index + 6) { + jniThrowExceptionFmt(env, "android/util/TimeFormatException", + "Unexpected length; should be %d characters", + tz_index + 6); + return false; + } + + // hour + n = get_char(env, s, tz_index + 1, 10, &thrown); + n += get_char(env, s, tz_index + 2, 1, &thrown); + if (thrown) return false; + n *= offset; + hour += n; + + // : + if (!check_char(env, s, tz_index + 3, ':')) return false; + + // minute + n = get_char(env, s, tz_index + 4, 10, &thrown); + n += get_char(env, s, tz_index + 5, 1, &thrown); + if (thrown) return false; + n *= offset; + minute += n; + } + } + env->SetIntField(This, g_hourField, hour); env->SetIntField(This, g_minField, minute); - if (offset != 0) { - // we need to normalize after applying the hour and minute offsets - android_text_format_Time_normalize(env, This, false /* use isdst */); - // The timezone is set to UTC in the calling Java code. - } + if (offset != 0) { + // we need to normalize after applying the hour and minute offsets + android_text_format_Time_normalize(env, This, false /* use isdst */); + // The timezone is set to UTC in the calling Java code. + } } else { - env->SetBooleanField(This, g_allDayField, JNI_TRUE); + env->SetBooleanField(This, g_allDayField, JNI_TRUE); env->SetIntField(This, g_hourField, 0); env->SetIntField(This, g_minField, 0); env->SetIntField(This, g_secField, 0); @@ -628,8 +628,7 @@ static jboolean android_text_format_Time_parse3339(JNIEnv* env, env->SetIntField(This, g_ydayField, 0); env->SetIntField(This, g_isdstField, -1); env->SetLongField(This, g_gmtoffField, 0); - - env->ReleaseStringChars(strObj, s); + return inUtc; } diff --git a/core/jni/android_util_AssetManager.cpp b/core/jni/android_util_AssetManager.cpp index d422951039e86..e29ea707d4d82 100644 --- a/core/jni/android_util_AssetManager.cpp +++ b/core/jni/android_util_AssetManager.cpp @@ -1,6 +1,7 @@ /* //device/libs/android_runtime/android_util_AssetManager.cpp ** ** Copyright 2006, The Android Open Source Project +** This code has been modified. Portions copyright (C) 2010, T-Mobile USA, Inc. ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. @@ -34,9 +35,13 @@ #include #include #include +#include +#include #include +#define REDIRECT_NOISY(x) //x + namespace android { // ---------------------------------------------------------------------------- @@ -691,17 +696,23 @@ static jint android_content_AssetManager_loadResourceValue(JNIEnv* env, jobject } const ResTable& res(am->getResources()); + uint32_t ref = res.lookupRedirectionMap(ident); + if (ref == 0) { + ref = ident; + } else { + REDIRECT_NOISY(ALOGW("PERFORMED REDIRECT OF ident=0x%08x FOR ref=0x%08x\n", ident, ref)); + } + Res_value value; ResTable_config config; uint32_t typeSpecFlags; - ssize_t block = res.getResource(ident, &value, false, density, &typeSpecFlags, &config); + ssize_t block = res.getResource(ref, &value, false, density, &typeSpecFlags, &config); #if THROW_ON_BAD_ID if (block == BAD_INDEX) { jniThrowException(env, "java/lang/IllegalStateException", "Bad resource!"); return 0; } #endif - uint32_t ref = ident; if (resolve) { block = res.resolveReference(&value, block, &ref, &typeSpecFlags, &config); #if THROW_ON_BAD_ID @@ -885,7 +896,7 @@ static jboolean android_content_AssetManager_applyStyle(JNIEnv* env, jobject cla return JNI_FALSE; } - DEBUG_STYLES(LOGI("APPLY STYLE: theme=0x%x defStyleAttr=0x%x defStyleRes=0x%x xml=0x%x", + DEBUG_STYLES(ALOGI("APPLY STYLE: theme=0x%x defStyleAttr=0x%x defStyleRes=0x%x xml=0x%x", themeToken, defStyleAttr, defStyleRes, xmlParserToken)); ResTable::Theme* theme = (ResTable::Theme*)themeToken; @@ -952,6 +963,20 @@ static jboolean android_content_AssetManager_applyStyle(JNIEnv* env, jobject cla // Now lock down the resource object and start pulling stuff from it. res.lock(); + // Apply theme redirections to the referenced styles. + if (defStyleRes != 0) { + uint32_t ref = res.lookupRedirectionMap(defStyleRes); + if (ref != 0) { + defStyleRes = ref; + } + } + if (style != 0) { + uint32_t ref = res.lookupRedirectionMap(style); + if (ref != 0) { + style = ref; + } + } + // Retrieve the default style bag, if requested. const ResTable::bag_entry* defStyleEnt = NULL; uint32_t defStyleTypeSetFlags = 0; @@ -983,7 +1008,7 @@ static jboolean android_content_AssetManager_applyStyle(JNIEnv* env, jobject cla for (jsize ii=0; iigetAttributeValue(ix, &value); ix++; curXmlAttr = xmlParser->getAttributeNameResID(ix); - DEBUG_STYLES(LOGI("-> From XML: type=0x%x, data=0x%08x", + DEBUG_STYLES(ALOGI("-> From XML: type=0x%x, data=0x%08x", value.dataType, value.data)); } @@ -1018,7 +1043,7 @@ static jboolean android_content_AssetManager_applyStyle(JNIEnv* env, jobject cla block = styleEnt->stringBlock; typeSetFlags = styleTypeSetFlags; value = styleEnt->map.value; - DEBUG_STYLES(LOGI("-> From style: type=0x%x, data=0x%08x", + DEBUG_STYLES(ALOGI("-> From style: type=0x%x, data=0x%08x", value.dataType, value.data)); } styleEnt++; @@ -1034,7 +1059,7 @@ static jboolean android_content_AssetManager_applyStyle(JNIEnv* env, jobject cla block = defStyleEnt->stringBlock; typeSetFlags = defStyleTypeSetFlags; value = defStyleEnt->map.value; - DEBUG_STYLES(LOGI("-> From def style: type=0x%x, data=0x%08x", + DEBUG_STYLES(ALOGI("-> From def style: type=0x%x, data=0x%08x", value.dataType, value.data)); } defStyleEnt++; @@ -1046,14 +1071,14 @@ static jboolean android_content_AssetManager_applyStyle(JNIEnv* env, jobject cla ssize_t newBlock = theme->resolveAttributeReference(&value, block, &resid, &typeSetFlags, &config); if (newBlock >= 0) block = newBlock; - DEBUG_STYLES(LOGI("-> Resolved attr: type=0x%x, data=0x%08x", + DEBUG_STYLES(ALOGI("-> Resolved attr: type=0x%x, data=0x%08x", value.dataType, value.data)); } else { // If we still don't have a value for this attribute, try to find // it in the theme! ssize_t newBlock = theme->getAttribute(curIdent, &value, &typeSetFlags); if (newBlock >= 0) { - DEBUG_STYLES(LOGI("-> From theme: type=0x%x, data=0x%08x", + DEBUG_STYLES(ALOGI("-> From theme: type=0x%x, data=0x%08x", value.dataType, value.data)); newBlock = res.resolveReference(&value, block, &resid, &typeSetFlags, &config); @@ -1064,19 +1089,44 @@ static jboolean android_content_AssetManager_applyStyle(JNIEnv* env, jobject cla } #endif if (newBlock >= 0) block = newBlock; - DEBUG_STYLES(LOGI("-> Resolved theme: type=0x%x, data=0x%08x", + DEBUG_STYLES(ALOGI("-> Resolved theme: type=0x%x, data=0x%08x", value.dataType, value.data)); } } // Deal with the special @null value -- it turns back to TYPE_NULL. if (value.dataType == Res_value::TYPE_REFERENCE && value.data == 0) { - DEBUG_STYLES(LOGI("-> Setting to @null!")); + DEBUG_STYLES(ALOGI("-> Setting to @null!")); value.dataType = Res_value::TYPE_NULL; block = kXmlBlock; } - DEBUG_STYLES(LOGI("Attribute 0x%08x: type=0x%x, data=0x%08x", + // One final test for a resource redirection from the applied theme. + if (resid != 0) { + uint32_t redirect = res.lookupRedirectionMap(resid); + if (redirect != 0) { + REDIRECT_NOISY(ALOGW("deep REDIRECT 0x%08x => 0x%08x\n", resid, redirect)); + ssize_t newBlock = res.getResource(redirect, &value, true, config.density, &typeSetFlags, &config); + if (newBlock >= 0) { + newBlock = res.resolveReference(&value, newBlock, &redirect, &typeSetFlags, &config); +#if THROW_ON_BAD_ID + if (newBlock == BAD_INDEX) { + jniThrowException(env, "java/lang/IllegalStateException", "Bad resource!"); + return JNI_FALSE; + } +#endif + if (newBlock >= 0) { + block = newBlock; + resid = redirect; + } + } + if (resid != redirect) { + ALOGW("deep redirect failure from 0x%08x => 0x%08x, defStyleAttr=0x%08x, defStyleRes=0x%08x, style=0x%08x\n", resid, redirect, defStyleAttr, defStyleRes, style); + } + } + } + + DEBUG_STYLES(ALOGI("Attribute 0x%08x: type=0x%x, data=0x%08x", curIdent, value.dataType, value.data)); // Write the final value back to Java. @@ -1333,6 +1383,31 @@ static jint android_content_AssetManager_retrieveArray(JNIEnv* env, jobject claz value.dataType = Res_value::TYPE_NULL; } + // One final test for a resource redirection from the applied theme. + if (resid != 0) { + uint32_t redirect = res.lookupRedirectionMap(resid); + if (redirect != 0) { + REDIRECT_NOISY(ALOGW("array REDIRECT 0x%08x => 0x%08x\n", resid, redirect)); + ssize_t newBlock = res.getResource(redirect, &value, true, config.density, &typeSetFlags, &config); + if (newBlock >= 0) { + newBlock = res.resolveReference(&value, newBlock, &redirect, &typeSetFlags, &config); +#if THROW_ON_BAD_ID + if (newBlock == BAD_INDEX) { + jniThrowException(env, "java/lang/IllegalStateException", "Bad resource!"); + return JNI_FALSE; + } +#endif + if (newBlock >= 0) { + block = newBlock; + resid = redirect; + } + } + if (resid != redirect) { + ALOGW("array redirect failure from 0x%08x => 0x%08x, array id=0x%08x", resid, redirect, id); + } + } + } + //printf("Attribute 0x%08x: final type=0x%x, data=0x%08x\n", curIdent, value.dataType, value.data); // Write the final value back to Java. @@ -1561,6 +1636,84 @@ static jintArray android_content_AssetManager_getArrayIntResource(JNIEnv* env, j return array; } +static jint android_content_AssetManager_splitThemePackage(JNIEnv* env, jobject clazz, + jstring srcFileName, jstring dstFileName, jobjectArray drmProtectedAssetNames) +{ + AssetManager* am = assetManagerForJavaObject(env, clazz); + if (am == NULL) { + return -1; + } + + ALOGV("splitThemePackage in %p (Java object %p)\n", am, clazz); + + if (srcFileName == NULL || dstFileName == NULL) { + jniThrowException(env, "java/lang/NullPointerException", srcFileName == NULL ? "srcFileName" : "dstFileName"); + return -2; + } + + jsize size = env->GetArrayLength(drmProtectedAssetNames); + if (size == 0) { + jniThrowException(env, "java/lang/IllegalArgumentException", "drmProtectedAssetNames"); + return -3; + } + + const char* srcFileName8 = env->GetStringUTFChars(srcFileName, NULL); + ZipFile* srcZip = new ZipFile; + status_t err = srcZip->open(srcFileName8, ZipFile::kOpenReadWrite); + if (err != NO_ERROR) { + ALOGV("error opening zip file %s\n", srcFileName8); + delete srcZip; + env->ReleaseStringUTFChars(srcFileName, srcFileName8); + return -4; + } + + const char* dstFileName8 = env->GetStringUTFChars(dstFileName, NULL); + ZipFile* dstZip = new ZipFile; + err = dstZip->open(dstFileName8, ZipFile::kOpenReadWrite | ZipFile::kOpenTruncate | ZipFile::kOpenCreate); + + if (err != NO_ERROR) { + ALOGV("error opening zip file %s\n", dstFileName8); + delete srcZip; + delete dstZip; + env->ReleaseStringUTFChars(srcFileName, srcFileName8); + env->ReleaseStringUTFChars(dstFileName, dstFileName8); + return -5; + } + + int result = 0; + for (int i = 0; i < size; i++) { + jstring javaString = (jstring)env->GetObjectArrayElement(drmProtectedAssetNames, i); + const char* drmProtectedAssetFileName8 = env->GetStringUTFChars(javaString, NULL); + ZipEntry *assetEntry = srcZip->getEntryByName(drmProtectedAssetFileName8); + if (assetEntry == NULL) { + result = 1; + ALOGV("Invalid asset entry %s\n", drmProtectedAssetFileName8); + } else { + status_t loc_result = dstZip->add(srcZip, assetEntry, 0, NULL); + if (loc_result != NO_ERROR) { + ALOGV("error copying zip entry %s\n", drmProtectedAssetFileName8); + result = result | 2; + } else { + loc_result = srcZip->remove(assetEntry); + if (loc_result != NO_ERROR) { + ALOGV("error removing zip entry %s\n", drmProtectedAssetFileName8); + result = result | 4; + } + } + } + env->ReleaseStringUTFChars(javaString, drmProtectedAssetFileName8); + } + srcZip->flush(); + dstZip->flush(); + + delete srcZip; + delete dstZip; + env->ReleaseStringUTFChars(srcFileName, srcFileName8); + env->ReleaseStringUTFChars(dstFileName, dstFileName8); + + return (jint)result; +} + static void android_content_AssetManager_init(JNIEnv* env, jobject clazz) { AssetManager* am = new AssetManager(); @@ -1607,6 +1760,173 @@ static jint android_content_AssetManager_getGlobalAssetManagerCount(JNIEnv* env, return AssetManager::getGlobalCount(); } +static jint android_content_AssetManager_getBasePackageCount(JNIEnv* env, jobject clazz) +{ + AssetManager* am = assetManagerForJavaObject(env, clazz); + if (am == NULL) { + return JNI_FALSE; + } + + return am->getResources().getBasePackageCount(); +} + +static jstring android_content_AssetManager_getBasePackageName(JNIEnv* env, jobject clazz, jint index) +{ + AssetManager* am = assetManagerForJavaObject(env, clazz); + if (am == NULL) { + return JNI_FALSE; + } + + String16 packageName(am->getResources().getBasePackageName(index)); + return env->NewString((const jchar*)packageName.string(), packageName.size()); +} + +static jint android_content_AssetManager_getBasePackageId(JNIEnv* env, jobject clazz, jint index) +{ + AssetManager* am = assetManagerForJavaObject(env, clazz); + if (am == NULL) { + return JNI_FALSE; + } + + return am->getResources().getBasePackageId(index); +} + +static void android_content_AssetManager_addRedirectionsNative(JNIEnv* env, jobject clazz, + PackageRedirectionMap* resMap) +{ + AssetManager* am = assetManagerForJavaObject(env, clazz); + if (am == NULL) { + return; + } + + am->addRedirections(resMap); +} + +static void android_content_AssetManager_clearRedirectionsNative(JNIEnv* env, jobject clazz) +{ + AssetManager* am = assetManagerForJavaObject(env, clazz); + if (am == NULL) { + return; + } + + am->clearRedirections(); +} + +static jboolean android_content_AssetManager_generateStyleRedirections(JNIEnv* env, jobject clazz, + PackageRedirectionMap* resMap, jint sourceStyle, jint destStyle) +{ + AssetManager* am = assetManagerForJavaObject(env, clazz); + if (am == NULL) { + return JNI_FALSE; + } + + const ResTable& res(am->getResources()); + + res.lock(); + + // Load up a bag for the user-supplied theme. + const ResTable::bag_entry* themeEnt = NULL; + ssize_t N = res.getBagLocked(destStyle, &themeEnt); + const ResTable::bag_entry* endThemeEnt = themeEnt + (N >= 0 ? N : 0); + + // ...and a bag for the framework default. + const ResTable::bag_entry* frameworkEnt = NULL; + N = res.getBagLocked(sourceStyle, &frameworkEnt); + const ResTable::bag_entry* endFrameworkEnt = frameworkEnt + (N >= 0 ? N : 0); + + // Add the source => dest style redirection first. + jboolean ret = JNI_FALSE; + if (themeEnt < endThemeEnt && frameworkEnt < endFrameworkEnt) { + resMap->addRedirection(sourceStyle, destStyle); + ret = JNI_TRUE; + } + + // Now compare them and infer resource redirections for attributes that + // remap to different styles. This works by essentially lining up all the + // sorted attributes from each theme and detected TYPE_REFERENCE entries + // that point to different resources. When we find such a mismatch, we'll + // create a resource redirection from the original framework resource ID to + // the one in the theme. This lets us do things like automatically find + // redirections for @android:style/Widget.Button by looking at how the + // theme overrides the android:attr/buttonStyle attribute. + REDIRECT_NOISY(ALOGW("delta between 0x%08x and 0x%08x:\n", sourceStyle, destStyle)); + for (; frameworkEnt < endFrameworkEnt; frameworkEnt++) { + if (frameworkEnt->map.value.dataType != Res_value::TYPE_REFERENCE) { + continue; + } + + uint32_t curIdent = frameworkEnt->map.name.ident; + + // Walk along the theme entry looking for a match. + while (themeEnt < endThemeEnt && curIdent > themeEnt->map.name.ident) { + themeEnt++; + } + // Match found, compare the references. + if (themeEnt < endThemeEnt && curIdent == themeEnt->map.name.ident) { + if (themeEnt->map.value.data != frameworkEnt->map.value.data) { + uint32_t fromIdent = frameworkEnt->map.value.data; + uint32_t toIdent = themeEnt->map.value.data; + REDIRECT_NOISY(ALOGW(" generated mapping from 0x%08x => 0x%08x (by attr 0x%08x)\n", + fromIdent, toIdent, curIdent)); + resMap->addRedirection(fromIdent, toIdent); + } + themeEnt++; + } + + // Exhausted the theme, bail early. + if (themeEnt >= endThemeEnt) { + break; + } + } + + res.unlock(); + + return ret; +} + +static jboolean android_content_AssetManager_detachThemePath(JNIEnv* env, jobject clazz, + jstring packageName, jint cookie) +{ + if (packageName == NULL) { + jniThrowException(env, "java/lang/NullPointerException", "packageName"); + return JNI_FALSE; + } + + AssetManager* am = assetManagerForJavaObject(env, clazz); + if (am == NULL) { + return JNI_FALSE; + } + + const char* name8 = env->GetStringUTFChars(packageName, NULL); + bool res = am->detachThemePath(String8(name8), (void *)cookie); + env->ReleaseStringUTFChars(packageName, name8); + + return res; +} + +static jint android_content_AssetManager_attachThemePath( + JNIEnv* env, jobject clazz, jstring path) +{ + if (path == NULL) { + jniThrowException(env, "java/lang/NullPointerException", "path"); + return JNI_FALSE; + } + + AssetManager* am = assetManagerForJavaObject(env, clazz); + if (am == NULL) { + return JNI_FALSE; + } + + const char* path8 = env->GetStringUTFChars(path, NULL); + + void* cookie; + bool res = am->attachThemePath(String8(path8), &cookie); + + env->ReleaseStringUTFChars(path, path8); + + return (res) ? (jint)cookie : 0; +} + // ---------------------------------------------------------------------------- /* @@ -1716,6 +2036,28 @@ static JNINativeMethod gAssetManagerMethods[] = { (void*) android_content_AssetManager_getAssetAllocations }, { "getGlobalAssetManagerCount", "()I", (void*) android_content_AssetManager_getGlobalAssetCount }, + + // Split theme package apk into two. + { "splitThemePackage","(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;)I", + (void*) android_content_AssetManager_splitThemePackage }, + + // Dynamic theme package support. + { "detachThemePath", "(Ljava/lang/String;I)Z", + (void*) android_content_AssetManager_detachThemePath }, + { "attachThemePath", "(Ljava/lang/String;)I", + (void*) android_content_AssetManager_attachThemePath }, + { "getBasePackageCount", "()I", + (void*) android_content_AssetManager_getBasePackageCount }, + { "getBasePackageName", "(I)Ljava/lang/String;", + (void*) android_content_AssetManager_getBasePackageName }, + { "getBasePackageId", "(I)I", + (void*) android_content_AssetManager_getBasePackageId }, + { "addRedirectionsNative", "(I)V", + (void*) android_content_AssetManager_addRedirectionsNative }, + { "clearRedirectionsNative", "()V", + (void*) android_content_AssetManager_clearRedirectionsNative }, + { "generateStyleRedirections", "(III)Z", + (void*) android_content_AssetManager_generateStyleRedirections }, }; int register_android_content_AssetManager(JNIEnv* env) diff --git a/core/jni/android_util_Binder.cpp b/core/jni/android_util_Binder.cpp index 04dc49fe31369..881d9a0a3526c 100644 --- a/core/jni/android_util_Binder.cpp +++ b/core/jni/android_util_Binder.cpp @@ -729,11 +729,6 @@ static jint android_os_Binder_getCallingUid(JNIEnv* env, jobject clazz) return IPCThreadState::self()->getCallingUid(); } -static jint android_os_Binder_getOrigCallingUid(JNIEnv* env, jobject clazz) -{ - return IPCThreadState::self()->getOrigCallingUid(); -} - static jlong android_os_Binder_clearCallingIdentity(JNIEnv* env, jobject clazz) { return IPCThreadState::self()->clearCallingIdentity(); @@ -805,7 +800,6 @@ static const JNINativeMethod gBinderMethods[] = { /* name, signature, funcPtr */ { "getCallingPid", "()I", (void*)android_os_Binder_getCallingPid }, { "getCallingUid", "()I", (void*)android_os_Binder_getCallingUid }, - { "getOrigCallingUidNative", "()I", (void*)android_os_Binder_getOrigCallingUid }, { "clearCallingIdentity", "()J", (void*)android_os_Binder_clearCallingIdentity }, { "restoreCallingIdentity", "(J)V", (void*)android_os_Binder_restoreCallingIdentity }, { "setThreadStrictModePolicy", "(I)V", (void*)android_os_Binder_setThreadStrictModePolicy }, diff --git a/core/jni/android_util_FloatMath.cpp b/core/jni/android_util_FloatMath.cpp index f38faa998bfa8..73b7a6fc310c1 100644 --- a/core/jni/android_util_FloatMath.cpp +++ b/core/jni/android_util_FloatMath.cpp @@ -25,6 +25,18 @@ class MathUtilsGlue { static float SqrtF(JNIEnv* env, jobject clazz, float x) { return sqrtf(x); } + + static float ExpF(JNIEnv* env, jobject clazz, float x) { + return expf(x); + } + + static float PowF(JNIEnv* env, jobject clazz, float x, float y) { + return powf(x, y); + } + + static float HypotF(JNIEnv* env, jobject clazz, float x, float y) { + return hypotf(x, y); + } }; static JNINativeMethod gMathUtilsMethods[] = { @@ -32,7 +44,10 @@ static JNINativeMethod gMathUtilsMethods[] = { {"ceil", "(F)F", (void*) MathUtilsGlue::CeilF}, {"sin", "(F)F", (void*) MathUtilsGlue::SinF}, {"cos", "(F)F", (void*) MathUtilsGlue::CosF}, - {"sqrt", "(F)F", (void*) MathUtilsGlue::SqrtF} + {"sqrt", "(F)F", (void*) MathUtilsGlue::SqrtF}, + {"exp", "(F)F", (void*) MathUtilsGlue::ExpF}, + {"pow", "(FF)F", (void*) MathUtilsGlue::PowF}, + {"hypot", "(FF)F", (void*) MathUtilsGlue::HypotF}, }; int register_android_util_FloatMath(JNIEnv* env) diff --git a/core/jni/android_util_PackageRedirectionMap.cpp b/core/jni/android_util_PackageRedirectionMap.cpp new file mode 100644 index 0000000000000..97380f31956ed --- /dev/null +++ b/core/jni/android_util_PackageRedirectionMap.cpp @@ -0,0 +1,176 @@ +/* + * Copyright (C) 2011, T-Mobile USA, Inc. + * + * 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 + +#include "jni.h" +#include "JNIHelp.h" +#include +#include + +#include "android_os_Parcel.h" +#include + +#include + +#include + +namespace android { + +// ---------------------------------------------------------------------------- + +static PackageRedirectionMap* PackageRedirectionMap_constructor(JNIEnv* env, jobject clazz) +{ + return new PackageRedirectionMap; +} + +static void PackageRedirectionMap_destructor(JNIEnv* env, jobject clazz, + PackageRedirectionMap* resMap) +{ + delete resMap; +} + +static PackageRedirectionMap* PackageRedirectionMap_createFromParcel(JNIEnv* env, jobject clazz, + jobject parcel) +{ + if (parcel == NULL) { + return NULL; + } + + Parcel* p = parcelForJavaObject(env, parcel); + PackageRedirectionMap* resMap = new PackageRedirectionMap; + + int32_t entryCount = p->readInt32(); + while (entryCount-- > 0) { + uint32_t fromIdent = (uint32_t)p->readInt32(); + uint32_t toIdent = (uint32_t)p->readInt32(); + resMap->addRedirection(fromIdent, toIdent); + } + + return resMap; +} + +static jboolean PackageRedirectionMap_writeToParcel(JNIEnv* env, jobject clazz, + PackageRedirectionMap* resMap, jobject parcel) +{ + if (parcel == NULL) { + return JNI_FALSE; + } + + Parcel* p = parcelForJavaObject(env, parcel); + + int package = resMap->getPackage(); + size_t nTypes = resMap->getNumberOfTypes(); + size_t entryCount = 0; + for (size_t type=0; typegetNumberOfUsedEntries(type); + } + p->writeInt32(entryCount); + for (size_t type=0; typegetNumberOfEntries(type); + for (size_t entry=0; entrygetEntry(type, entry); + if (toIdent != 0) { + uint32_t fromIdent = Res_MAKEID(package-1, type, entry); + p->writeInt32(fromIdent); + p->writeInt32(toIdent); + } + } + } + + return JNI_TRUE; +} + +static void PackageRedirectionMap_addRedirection(JNIEnv* env, jobject clazz, + PackageRedirectionMap* resMap, jint fromIdent, jint toIdent) +{ + resMap->addRedirection(fromIdent, toIdent); +} + +static jint PackageRedirectionMap_getPackageId(JNIEnv* env, jobject clazz, + PackageRedirectionMap* resMap) +{ + return resMap->getPackage(); +} + +static jint PackageRedirectionMap_lookupRedirection(JNIEnv* env, jobject clazz, + PackageRedirectionMap* resMap, jint fromIdent) +{ + return resMap->lookupRedirection(fromIdent); +} + +static jintArray PackageRedirectionMap_getRedirectionKeys(JNIEnv* env, jobject clazz, + PackageRedirectionMap* resMap) +{ + int package = resMap->getPackage(); + size_t nTypes = resMap->getNumberOfTypes(); + size_t entryCount = 0; + for (size_t type=0; typegetNumberOfUsedEntries(type); + entryCount += usedEntries; + } + jintArray array = env->NewIntArray(entryCount); + if (array == NULL) { + jniThrowException(env, "java/lang/OutOfMemoryError", ""); + return NULL; + } + jsize index = 0; + for (size_t type=0; typegetNumberOfEntries(type); + for (size_t entry=0; entrygetEntry(type, entry); + if (toIdent != 0) { + jint fromIdent = (jint)Res_MAKEID(package-1, type, entry); + env->SetIntArrayRegion(array, index++, 1, &fromIdent); + } + } + } + return array; +} + +// ---------------------------------------------------------------------------- + +/* + * JNI registration. + */ +static JNINativeMethod gPackageRedirectionMapMethods[] = { + { "nativeConstructor", "()I", + (void*) PackageRedirectionMap_constructor }, + { "nativeDestructor", "(I)V", + (void*) PackageRedirectionMap_destructor }, + { "nativeCreateFromParcel", "(Landroid/os/Parcel;)I", + (void*) PackageRedirectionMap_createFromParcel }, + { "nativeWriteToParcel", "(ILandroid/os/Parcel;)Z", + (void*) PackageRedirectionMap_writeToParcel }, + { "nativeAddRedirection", "(III)V", + (void*) PackageRedirectionMap_addRedirection }, + { "nativeGetPackageId", "(I)I", + (void*) PackageRedirectionMap_getPackageId }, + { "nativeLookupRedirection", "(II)I", + (void*) PackageRedirectionMap_lookupRedirection }, + { "nativeGetRedirectionKeys", "(I)[I", + (void*) PackageRedirectionMap_getRedirectionKeys }, +}; + +int register_android_content_res_PackageRedirectionMap(JNIEnv* env) +{ + return AndroidRuntime::registerNativeMethods(env, + "android/content/res/PackageRedirectionMap", + gPackageRedirectionMapMethods, + NELEM(gPackageRedirectionMapMethods)); +} + +}; // namespace android diff --git a/core/jni/android_view_Display.cpp b/core/jni/android_view_Display.cpp deleted file mode 100644 index aedf1e42cf730..0000000000000 --- 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 -#include - -#include - -#include -#include -#include - -#include "jni.h" -#include "JNIHelp.h" -#include -#include -#include -#include - -// ---------------------------------------------------------------------------- - -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_DisplayEventReceiver.cpp b/core/jni/android_view_DisplayEventReceiver.cpp index 89058a741e5cb..3d9d005637a36 100644 --- a/core/jni/android_view_DisplayEventReceiver.cpp +++ b/core/jni/android_view_DisplayEventReceiver.cpp @@ -39,6 +39,7 @@ static struct { jclass clazz; jmethodID dispatchVsync; + jmethodID dispatchHotplug; } gDisplayEventReceiverClassInfo; @@ -61,7 +62,9 @@ class NativeDisplayEventReceiver : public LooperCallback { bool mWaitingForVsync; virtual int handleEvent(int receiveFd, int events, void* data); - bool readLastVsyncMessage(nsecs_t* outTimestamp, uint32_t* outCount); + bool readLastVsyncMessage(nsecs_t* outTimestamp, int32_t* id, uint32_t* outCount); + void dispatchVsync(nsecs_t timestamp, int32_t id, uint32_t count); + void dispatchHotplug(nsecs_t timestamp, int32_t id, bool connected); }; @@ -106,8 +109,9 @@ status_t NativeDisplayEventReceiver::scheduleVsync() { // Drain all pending events. nsecs_t vsyncTimestamp; + int32_t vsyncDisplayId; uint32_t vsyncCount; - readLastVsyncMessage(&vsyncTimestamp, &vsyncCount); + readLastVsyncMessage(&vsyncTimestamp, &vsyncDisplayId, &vsyncCount); status_t status = mReceiver.requestNextVsync(); if (status) { @@ -135,39 +139,39 @@ int NativeDisplayEventReceiver::handleEvent(int receiveFd, int events, void* dat // Drain all pending events, keep the last vsync. nsecs_t vsyncTimestamp; + int32_t vsyncDisplayId; uint32_t vsyncCount; - if (!readLastVsyncMessage(&vsyncTimestamp, &vsyncCount)) { + if (!readLastVsyncMessage(&vsyncTimestamp, &vsyncDisplayId, &vsyncCount)) { ALOGV("receiver %p ~ Woke up but there was no vsync pulse!", this); return 1; // keep the callback, did not obtain a vsync pulse } - ALOGV("receiver %p ~ Vsync pulse: timestamp=%lld, count=%d", - this, vsyncTimestamp, vsyncCount); + ALOGV("receiver %p ~ Vsync pulse: timestamp=%lld, id=%d, count=%d", + this, vsyncTimestamp, vsyncDisplayId, vsyncCount); mWaitingForVsync = false; - JNIEnv* env = AndroidRuntime::getJNIEnv(); - - ALOGV("receiver %p ~ Invoking vsync handler.", this); - env->CallVoidMethod(mReceiverObjGlobal, - gDisplayEventReceiverClassInfo.dispatchVsync, vsyncTimestamp, vsyncCount); - ALOGV("receiver %p ~ Returned from vsync handler.", this); - - mMessageQueue->raiseAndClearException(env, "dispatchVsync"); + dispatchVsync(vsyncTimestamp, vsyncDisplayId, vsyncCount); return 1; // keep the callback } bool NativeDisplayEventReceiver::readLastVsyncMessage( - nsecs_t* outTimestamp, uint32_t* outCount) { + nsecs_t* outTimestamp, int32_t* outId, uint32_t* outCount) { DisplayEventReceiver::Event buf[EVENT_BUFFER_SIZE]; ssize_t n; while ((n = mReceiver.getEvents(buf, EVENT_BUFFER_SIZE)) > 0) { ALOGV("receiver %p ~ Read %d events.", this, int(n)); while (n-- > 0) { - if (buf[n].header.type == DisplayEventReceiver::DISPLAY_EVENT_VSYNC) { - *outTimestamp = buf[n].header.timestamp; - *outCount = buf[n].vsync.count; + const DisplayEventReceiver::Event& ev = buf[n]; + if (ev.header.type == DisplayEventReceiver::DISPLAY_EVENT_VSYNC) { + *outTimestamp = ev.header.timestamp; + *outId = ev.header.id; + *outCount = ev.vsync.count; return true; // stop at last vsync in the buffer } + + if (ev.header.type == DisplayEventReceiver::DISPLAY_EVENT_HOTPLUG) { + dispatchHotplug(ev.header.timestamp, ev.header.id, ev.hotplug.connected); + } } } if (n < 0) { @@ -176,6 +180,28 @@ bool NativeDisplayEventReceiver::readLastVsyncMessage( return false; } +void NativeDisplayEventReceiver::dispatchVsync(nsecs_t timestamp, int32_t id, uint32_t count) { + JNIEnv* env = AndroidRuntime::getJNIEnv(); + + ALOGV("receiver %p ~ Invoking vsync handler.", this); + env->CallVoidMethod(mReceiverObjGlobal, + gDisplayEventReceiverClassInfo.dispatchVsync, timestamp, id, count); + ALOGV("receiver %p ~ Returned from vsync handler.", this); + + mMessageQueue->raiseAndClearException(env, "dispatchVsync"); +} + +void NativeDisplayEventReceiver::dispatchHotplug(nsecs_t timestamp, int32_t id, bool connected) { + JNIEnv* env = AndroidRuntime::getJNIEnv(); + + ALOGV("receiver %p ~ Invoking hotplug handler.", this); + env->CallVoidMethod(mReceiverObjGlobal, + gDisplayEventReceiverClassInfo.dispatchHotplug, timestamp, id, connected); + ALOGV("receiver %p ~ Returned from hotplug handler.", this); + + mMessageQueue->raiseAndClearException(env, "dispatchHotplug"); +} + static jint nativeInit(JNIEnv* env, jclass clazz, jobject receiverObj, jobject messageQueueObj) { @@ -248,7 +274,10 @@ int register_android_view_DisplayEventReceiver(JNIEnv* env) { GET_METHOD_ID(gDisplayEventReceiverClassInfo.dispatchVsync, gDisplayEventReceiverClassInfo.clazz, - "dispatchVsync", "(JI)V"); + "dispatchVsync", "(JII)V"); + GET_METHOD_ID(gDisplayEventReceiverClassInfo.dispatchHotplug, + gDisplayEventReceiverClassInfo.clazz, + "dispatchHotplug", "(JIZ)V"); return 0; } diff --git a/core/jni/android_view_GLES20Canvas.cpp b/core/jni/android_view_GLES20Canvas.cpp index a51b77e712e1d..5d306d20323d0 100644 --- a/core/jni/android_view_GLES20Canvas.cpp +++ b/core/jni/android_view_GLES20Canvas.cpp @@ -46,6 +46,7 @@ #include #include #include +#include #include #include @@ -115,7 +116,9 @@ static void android_view_GLES20Canvas_terminateCaches(JNIEnv* env, jobject clazz static OpenGLRenderer* android_view_GLES20Canvas_createRenderer(JNIEnv* env, jobject clazz) { RENDERER_LOGD("Create OpenGLRenderer"); - return new OpenGLRenderer; + OpenGLRenderer* renderer = new OpenGLRenderer(); + renderer->initProperties(); + return renderer; } static void android_view_GLES20Canvas_destroyRenderer(JNIEnv* env, jobject clazz, @@ -150,7 +153,7 @@ static void android_view_GLES20Canvas_finish(JNIEnv* env, jobject clazz, } static jint android_view_GLES20Canvas_getStencilSize(JNIEnv* env, jobject clazz) { - return OpenGLRenderer::getStencilSize(); + return Stencil::getStencilSize(); } // ---------------------------------------------------------------------------- @@ -528,8 +531,11 @@ static void renderText(OpenGLRenderer* renderer, const jchar* text, int count, } const jchar* glyphs = value->getGlyphs(); size_t glyphsCount = value->getGlyphsCount(); + jfloat totalAdvance = value->getTotalAdvance(); + const float* positions = value->getPos(); int bytesCount = glyphsCount * sizeof(jchar); - renderer->drawText((const char*) glyphs, bytesCount, glyphsCount, x, y, paint); + renderer->drawText((const char*) glyphs, bytesCount, glyphsCount, x, y, + positions, paint, totalAdvance); } static void renderTextOnPath(OpenGLRenderer* renderer, const jchar* text, int count, @@ -556,8 +562,11 @@ static void renderTextRun(OpenGLRenderer* renderer, const jchar* text, } const jchar* glyphs = value->getGlyphs(); size_t glyphsCount = value->getGlyphsCount(); + jfloat totalAdvance = value->getTotalAdvance(); + const float* positions = value->getPos(); int bytesCount = glyphsCount * sizeof(jchar); - renderer->drawText((const char*) glyphs, bytesCount, glyphsCount, x, y, paint); + renderer->drawText((const char*) glyphs, bytesCount, glyphsCount, x, y, + positions, paint, totalAdvance); } static void android_view_GLES20Canvas_drawTextArray(JNIEnv* env, jobject clazz, @@ -727,7 +736,9 @@ static void android_view_GLES20Canvas_resume(JNIEnv* env, jobject clazz, static OpenGLRenderer* android_view_GLES20Canvas_createLayerRenderer(JNIEnv* env, jobject clazz, Layer* layer) { if (layer) { - return new LayerRenderer(layer); + OpenGLRenderer* renderer = new LayerRenderer(layer); + renderer->initProperties(); + return renderer; } return NULL; } @@ -759,14 +770,37 @@ static Layer* android_view_GLES20Canvas_createLayer(JNIEnv* env, jobject clazz, return layer; } -static void android_view_GLES20Canvas_resizeLayer(JNIEnv* env, jobject clazz, +static bool android_view_GLES20Canvas_resizeLayer(JNIEnv* env, jobject clazz, Layer* layer, jint width, jint height, jintArray layerInfo) { - LayerRenderer::resizeLayer(layer, width, height); + if (LayerRenderer::resizeLayer(layer, width, height)) { + jint* storage = env->GetIntArrayElements(layerInfo, NULL); + storage[0] = layer->getWidth(); + storage[1] = layer->getHeight(); + env->ReleaseIntArrayElements(layerInfo, storage, 0); + return true; + } + return false; +} + +static void android_view_GLES20Canvas_setLayerPaint(JNIEnv* env, jobject clazz, + Layer* layer, SkPaint* paint) { + if (layer) { + layer->setPaint(paint); + } +} + +static void android_view_GLES20Canvas_setLayerColorFilter(JNIEnv* env, jobject clazz, + Layer* layer, SkiaColorFilter* colorFilter) { + if (layer) { + layer->setColorFilter(colorFilter); + } +} - jint* storage = env->GetIntArrayElements(layerInfo, NULL); - storage[0] = layer->getWidth(); - storage[1] = layer->getHeight(); - env->ReleaseIntArrayElements(layerInfo, storage, 0); +static void android_view_GLES20Canvas_setOpaqueLayer(JNIEnv* env, jobject clazz, + Layer* layer, jboolean isOpaque) { + if (layer) { + layer->setBlend(!isOpaque); + } } static void android_view_GLES20Canvas_updateTextureLayer(JNIEnv* env, jobject clazz, @@ -788,9 +822,13 @@ static void android_view_GLES20Canvas_updateRenderLayer(JNIEnv* env, jobject cla layer->updateDeferred(renderer, displayList, left, top, right, bottom); } +static void android_view_GLES20Canvas_clearLayerTexture(JNIEnv* env, jobject clazz, + Layer* layer) { + layer->clearTexture(); +} + static void android_view_GLES20Canvas_setTextureLayerTransform(JNIEnv* env, jobject clazz, Layer* layer, SkMatrix* matrix) { - layer->getTransform().load(*matrix); } @@ -803,10 +841,6 @@ static void android_view_GLES20Canvas_destroyLayerDeferred(JNIEnv* env, LayerRenderer::destroyLayerDeferred(layer); } -static void android_view_GLES20Canvas_flushLayer(JNIEnv* env, jobject clazz, Layer* layer) { - LayerRenderer::flushLayer(layer); -} - static void android_view_GLES20Canvas_drawLayer(JNIEnv* env, jobject clazz, OpenGLRenderer* renderer, Layer* layer, jfloat x, jfloat y, SkPaint* paint) { renderer->drawLayer(layer, x, y, paint); @@ -817,6 +851,16 @@ static jboolean android_view_GLES20Canvas_copyLayer(JNIEnv* env, jobject clazz, return LayerRenderer::copyLayer(layer, bitmap); } +static void android_view_GLES20Canvas_pushLayerUpdate(JNIEnv* env, jobject clazz, + OpenGLRenderer* renderer, Layer* layer) { + renderer->pushLayerUpdate(layer); +} + +static void android_view_GLES20Canvas_clearLayerUpdates(JNIEnv* env, jobject clazz, + OpenGLRenderer* renderer) { + renderer->clearLayerUpdates(); +} + #endif // USE_OPENGL_RENDERER // ---------------------------------------------------------------------------- @@ -968,16 +1012,21 @@ static JNINativeMethod gMethods[] = { { "nCreateLayerRenderer", "(I)I", (void*) android_view_GLES20Canvas_createLayerRenderer }, { "nCreateLayer", "(IIZ[I)I", (void*) android_view_GLES20Canvas_createLayer }, - { "nResizeLayer", "(III[I)V" , (void*) android_view_GLES20Canvas_resizeLayer }, + { "nResizeLayer", "(III[I)Z" , (void*) android_view_GLES20Canvas_resizeLayer }, + { "nSetLayerPaint", "(II)V", (void*) android_view_GLES20Canvas_setLayerPaint }, + { "nSetLayerColorFilter", "(II)V", (void*) android_view_GLES20Canvas_setLayerColorFilter }, + { "nSetOpaqueLayer", "(IZ)V", (void*) android_view_GLES20Canvas_setOpaqueLayer }, { "nCreateTextureLayer", "(Z[I)I", (void*) android_view_GLES20Canvas_createTextureLayer }, { "nUpdateTextureLayer", "(IIIZLandroid/graphics/SurfaceTexture;)V", (void*) android_view_GLES20Canvas_updateTextureLayer }, { "nUpdateRenderLayer", "(IIIIIII)V", (void*) android_view_GLES20Canvas_updateRenderLayer }, + { "nClearLayerTexture", "(I)V", (void*) android_view_GLES20Canvas_clearLayerTexture }, { "nDestroyLayer", "(I)V", (void*) android_view_GLES20Canvas_destroyLayer }, { "nDestroyLayerDeferred", "(I)V", (void*) android_view_GLES20Canvas_destroyLayerDeferred }, - { "nFlushLayer", "(I)V", (void*) android_view_GLES20Canvas_flushLayer }, { "nDrawLayer", "(IIFFI)V", (void*) android_view_GLES20Canvas_drawLayer }, { "nCopyLayer", "(II)Z", (void*) android_view_GLES20Canvas_copyLayer }, + { "nClearLayerUpdates", "(I)V", (void*) android_view_GLES20Canvas_clearLayerUpdates }, + { "nPushLayerUpdate", "(II)V", (void*) android_view_GLES20Canvas_pushLayerUpdate }, { "nSetTextureLayerTransform", "(II)V", (void*) android_view_GLES20Canvas_setTextureLayerTransform }, diff --git a/core/jni/android_view_GLES20DisplayList.cpp b/core/jni/android_view_GLES20DisplayList.cpp index b307a2f9d8f90..c5f52df5ad4e5 100644 --- a/core/jni/android_view_GLES20DisplayList.cpp +++ b/core/jni/android_view_GLES20DisplayList.cpp @@ -36,6 +36,11 @@ using namespace uirenderer; */ #ifdef USE_OPENGL_RENDERER +static void android_view_GLES20DisplayList_reset(JNIEnv* env, + jobject clazz, DisplayList* displayList) { + displayList->reset(); +} + // ---------------------------------------------------------------------------- // DisplayList view properties // ---------------------------------------------------------------------------- @@ -185,6 +190,7 @@ const char* const kClassPathName = "android/view/GLES20DisplayList"; static JNINativeMethod gMethods[] = { #ifdef USE_OPENGL_RENDERER + { "nReset", "(I)V", (void*) android_view_GLES20DisplayList_reset }, { "nSetCaching", "(IZ)V", (void*) android_view_GLES20DisplayList_setCaching }, { "nSetStaticMatrix", "(II)V", (void*) android_view_GLES20DisplayList_setStaticMatrix }, { "nSetAnimationMatrix", "(II)V", (void*) android_view_GLES20DisplayList_setAnimationMatrix }, diff --git a/core/jni/android_view_Surface.cpp b/core/jni/android_view_Surface.cpp index 5739cbeb1cbf2..2767e9455250e 100644 --- a/core/jni/android_view_Surface.cpp +++ b/core/jni/android_view_Surface.cpp @@ -18,15 +18,19 @@ #include +#include "android_os_Parcel.h" #include "android_util_Binder.h" #include "android/graphics/GraphicsJNI.h" +#include "android/graphics/Region.h" #include +#include #include #include #include +#include #include #include @@ -41,127 +45,138 @@ #include "JNIHelp.h" #include #include +#include #include #include +#include + +#include // ---------------------------------------------------------------------------- namespace android { -enum { - // should match Parcelable.java - PARCELABLE_WRITE_RETURN_VALUE = 0x0001 -}; - -// ---------------------------------------------------------------------------- - static const char* const OutOfResourcesException = "android/view/Surface$OutOfResourcesException"; -const char* const kSurfaceSessionClassPathName = "android/view/SurfaceSession"; -const char* const kSurfaceClassPathName = "android/view/Surface"; +static struct { + jclass clazz; + jfieldID mNativeSurface; + jfieldID mNativeSurfaceControl; + jfieldID mGenerationId; + jfieldID mCanvas; + jfieldID mCanvasSaveCount; + jmethodID ctor; +} gSurfaceClassInfo; + +static struct { + jfieldID left; + jfieldID top; + jfieldID right; + jfieldID bottom; +} gRectClassInfo; + +static struct { + jfieldID mNativeCanvas; + jfieldID mSurfaceFormat; +} gCanvasClassInfo; + +static struct { + jfieldID width; + jfieldID height; + jfieldID refreshRate; + jfieldID density; + jfieldID xDpi; + jfieldID yDpi; + jfieldID secure; +} gPhysicalDisplayInfoClassInfo; -struct sso_t { - jfieldID client; -}; -static sso_t sso; - -struct so_t { - jfieldID surfaceControl; - jfieldID surfaceGenerationId; - jfieldID surface; - jfieldID saveCount; - jfieldID canvas; -}; -static so_t so; -struct ro_t { - jfieldID l; - jfieldID t; - jfieldID r; - jfieldID b; -}; -static ro_t ro; +class ScreenshotPixelRef : public SkPixelRef { +public: + ScreenshotPixelRef(SkColorTable* ctable) { + fCTable = ctable; + SkSafeRef(ctable); + setImmutable(); + } -struct po_t { - jfieldID x; - jfieldID y; -}; -static po_t po; + virtual ~ScreenshotPixelRef() { + SkSafeUnref(fCTable); + } -struct co_t { - jfieldID surfaceFormat; -}; -static co_t co; + status_t update(const sp& display, int width, int height, + int minLayer, int maxLayer, bool allLayers) { + status_t res = (width > 0 && height > 0) + ? (allLayers + ? mScreenshot.update(display, width, height) + : mScreenshot.update(display, width, height, minLayer, maxLayer)) + : mScreenshot.update(display); + if (res != NO_ERROR) { + return res; + } -struct no_t { - jfieldID native_canvas; - jfieldID native_region; - jfieldID native_parcel; -}; -static no_t no; + return NO_ERROR; + } + uint32_t getWidth() const { + return mScreenshot.getWidth(); + } -// ---------------------------------------------------------------------------- -// ---------------------------------------------------------------------------- -// ---------------------------------------------------------------------------- + uint32_t getHeight() const { + return mScreenshot.getHeight(); + } -static void SurfaceSession_init(JNIEnv* env, jobject clazz) -{ - sp client = new SurfaceComposerClient; - client->incStrong(clazz); - env->SetIntField(clazz, sso.client, (int)client.get()); -} + uint32_t getStride() const { + return mScreenshot.getStride(); + } -static void SurfaceSession_destroy(JNIEnv* env, jobject clazz) -{ - SurfaceComposerClient* client = - (SurfaceComposerClient*)env->GetIntField(clazz, sso.client); - if (client != 0) { - client->decStrong(clazz); - env->SetIntField(clazz, sso.client, 0); + uint32_t getFormat() const { + return mScreenshot.getFormat(); } -} -static void SurfaceSession_kill(JNIEnv* env, jobject clazz) -{ - SurfaceComposerClient* client = - (SurfaceComposerClient*)env->GetIntField(clazz, sso.client); - if (client != 0) { - client->dispose(); - client->decStrong(clazz); - env->SetIntField(clazz, sso.client, 0); +protected: + // overrides from SkPixelRef + virtual void* onLockPixels(SkColorTable** ct) { + *ct = fCTable; + return (void*)mScreenshot.getPixels(); } -} + + virtual void onUnlockPixels() { + } + +private: + ScreenshotClient mScreenshot; + SkColorTable* fCTable; + + typedef SkPixelRef INHERITED; +}; + // ---------------------------------------------------------------------------- -static sp getSurfaceControl(JNIEnv* env, jobject clazz) -{ - SurfaceControl* const p = - (SurfaceControl*)env->GetIntField(clazz, so.surfaceControl); - return sp(p); +static sp getSurfaceControl(JNIEnv* env, jobject surfaceObj) { + return reinterpret_cast( + env->GetIntField(surfaceObj, gSurfaceClassInfo.mNativeSurfaceControl)); } -static void setSurfaceControl(JNIEnv* env, jobject clazz, - const sp& surface) -{ - SurfaceControl* const p = - (SurfaceControl*)env->GetIntField(clazz, so.surfaceControl); +static void setSurfaceControl(JNIEnv* env, jobject surfaceObj, + const sp& surface) { + SurfaceControl* const p = reinterpret_cast( + env->GetIntField(surfaceObj, gSurfaceClassInfo.mNativeSurfaceControl)); if (surface.get()) { - surface->incStrong(clazz); + surface->incStrong(surfaceObj); } if (p) { - p->decStrong(clazz); + p->decStrong(surfaceObj); } - env->SetIntField(clazz, so.surfaceControl, (int)surface.get()); + env->SetIntField(surfaceObj, gSurfaceClassInfo.mNativeSurfaceControl, + reinterpret_cast(surface.get())); } -static sp getSurface(JNIEnv* env, jobject clazz) -{ - sp result(Surface_getSurface(env, clazz)); - if (result == 0) { +static sp getSurface(JNIEnv* env, jobject surfaceObj) { + sp result(android_view_Surface_getSurface(env, surfaceObj)); + if (result == NULL) { /* * if this method is called from the WindowManager's process, it means * the client is is not remote, and therefore is allowed to have @@ -170,94 +185,117 @@ static sp getSurface(JNIEnv* env, jobject clazz) * process. */ - SurfaceControl* const control = - (SurfaceControl*)env->GetIntField(clazz, so.surfaceControl); + SurfaceControl* const control = reinterpret_cast( + env->GetIntField(surfaceObj, gSurfaceClassInfo.mNativeSurfaceControl)); if (control) { result = control->getSurface(); - if (result != 0) { - result->incStrong(clazz); - env->SetIntField(clazz, so.surface, (int)result.get()); + if (result != NULL) { + result->incStrong(surfaceObj); + env->SetIntField(surfaceObj, gSurfaceClassInfo.mNativeSurface, + reinterpret_cast(result.get())); } } } return result; } -sp android_Surface_getNativeWindow( - JNIEnv* env, jobject clazz) { - return getSurface(env, clazz); +sp android_view_Surface_getNativeWindow(JNIEnv* env, jobject surfaceObj) { + return getSurface(env, surfaceObj); } -bool android_Surface_isInstanceOf(JNIEnv* env, jobject obj) { - jclass surfaceClass = env->FindClass(kSurfaceClassPathName); - return env->IsInstanceOf(obj, surfaceClass); +bool android_view_Surface_isInstanceOf(JNIEnv* env, jobject obj) { + return env->IsInstanceOf(obj, gSurfaceClassInfo.clazz); } -sp Surface_getSurface(JNIEnv* env, jobject clazz) { - sp surface((Surface*)env->GetIntField(clazz, so.surface)); - return surface; +sp android_view_Surface_getSurface(JNIEnv* env, jobject surfaceObj) { + return reinterpret_cast( + env->GetIntField(surfaceObj, gSurfaceClassInfo.mNativeSurface)); } -void setSurface(JNIEnv* env, jobject clazz, const sp& surface) -{ - Surface* const p = (Surface*)env->GetIntField(clazz, so.surface); +static void setSurface(JNIEnv* env, jobject surfaceObj, const sp& surface) { + Surface* const p = reinterpret_cast( + env->GetIntField(surfaceObj, gSurfaceClassInfo.mNativeSurface)); if (surface.get()) { - surface->incStrong(clazz); + surface->incStrong(surfaceObj); } if (p) { - p->decStrong(clazz); + p->decStrong(surfaceObj); } - env->SetIntField(clazz, so.surface, (int)surface.get()); + env->SetIntField(surfaceObj, gSurfaceClassInfo.mNativeSurface, + reinterpret_cast(surface.get())); + // This test is conservative and it would be better to compare the ISurfaces if (p && p != surface.get()) { - jint generationId = env->GetIntField(clazz, so.surfaceGenerationId); + jint generationId = env->GetIntField(surfaceObj, + gSurfaceClassInfo.mGenerationId); generationId++; - env->SetIntField(clazz, so.surfaceGenerationId, generationId); + env->SetIntField(surfaceObj, + gSurfaceClassInfo.mGenerationId, generationId); } } -// ---------------------------------------------------------------------------- +static sp getISurfaceTexture(JNIEnv* env, jobject surfaceObj) { + if (surfaceObj) { + sp surface(getSurface(env, surfaceObj)); + if (surface != NULL) { + return surface->getSurfaceTexture(); + } + } + return NULL; +} -static void Surface_init( - JNIEnv* env, jobject clazz, - jobject session, - jint, jstring jname, jint dpy, jint w, jint h, jint format, jint flags) -{ - if (session == NULL) { - doThrowNPE(env); - return; +jobject android_view_Surface_createFromISurfaceTexture(JNIEnv* env, + const sp& surfaceTexture) { + if (surfaceTexture == NULL) { + return NULL; } - SurfaceComposerClient* client = - (SurfaceComposerClient*)env->GetIntField(session, sso.client); + sp surface(new Surface(surfaceTexture)); + if (surface == NULL) { + return NULL; + } - sp surface; - if (jname == NULL) { - surface = client->createSurface(dpy, w, h, format, flags); - } else { - const jchar* str = env->GetStringCritical(jname, 0); - const String8 name(str, env->GetStringLength(jname)); - env->ReleaseStringCritical(jname, str); - surface = client->createSurface(name, dpy, w, h, format, flags); + jobject surfaceObj = env->NewObject(gSurfaceClassInfo.clazz, gSurfaceClassInfo.ctor); + if (surfaceObj == NULL) { + if (env->ExceptionCheck()) { + ALOGE("Could not create instance of Surface from ISurfaceTexture."); + LOGE_EX(env); + env->ExceptionClear(); + } + return NULL; } - if (surface == 0) { + setSurface(env, surfaceObj, surface); + return surfaceObj; +} + + +// ---------------------------------------------------------------------------- + +static void nativeCreate(JNIEnv* env, jobject surfaceObj, jobject sessionObj, + jstring nameStr, jint w, jint h, jint format, jint flags) { + ScopedUtfChars name(env, nameStr); + sp client(android_view_SurfaceSession_getClient(env, sessionObj)); + + sp surface = client->createSurface( + String8(name.c_str()), w, h, format, flags); + if (surface == NULL) { jniThrowException(env, OutOfResourcesException, NULL); return; } - setSurfaceControl(env, clazz, surface); -} -static void Surface_initFromSurfaceTexture( - JNIEnv* env, jobject clazz, jobject jst) -{ - sp st(SurfaceTexture_getSurfaceTexture(env, jst)); + setSurfaceControl(env, surfaceObj, surface); +} +static void nativeCreateFromSurfaceTexture(JNIEnv* env, jobject surfaceObj, + jobject surfaceTextureObj) { + sp st(SurfaceTexture_getSurfaceTexture(env, surfaceTextureObj)); if (st == NULL) { jniThrowException(env, "java/lang/IllegalArgumentException", "SurfaceTexture has already been released"); return; } + sp bq = st->getBufferQueue(); sp surface(new Surface(bq)); @@ -265,72 +303,62 @@ static void Surface_initFromSurfaceTexture( jniThrowException(env, OutOfResourcesException, NULL); return; } - setSurfaceControl(env, clazz, NULL); - setSurface(env, clazz, surface); -} - -static void Surface_initParcel(JNIEnv* env, jobject clazz, jobject argParcel) -{ - Parcel* parcel = (Parcel*)env->GetIntField(argParcel, no.native_parcel); - if (parcel == NULL) { - doThrowNPE(env); - return; - } - sp sur(Surface::readFromParcel(*parcel)); - setSurface(env, clazz, sur); + setSurface(env, surfaceObj, surface); } -static jint Surface_getIdentity(JNIEnv* env, jobject clazz) -{ - const sp& control(getSurfaceControl(env, clazz)); - if (control != 0) return (jint) control->getIdentity(); - const sp& surface(getSurface(env, clazz)); - if (surface != 0) return (jint) surface->getIdentity(); - return -1; +static void nativeRelease(JNIEnv* env, jobject surfaceObj) { + setSurfaceControl(env, surfaceObj, NULL); + setSurface(env, surfaceObj, NULL); } -static void Surface_destroy(JNIEnv* env, jobject clazz, uintptr_t *ostack) -{ - const sp& surface(getSurfaceControl(env, clazz)); - if (SurfaceControl::isValid(surface)) { - surface->clear(); +static void nativeDestroy(JNIEnv* env, jobject surfaceObj) { + sp surfaceControl(getSurfaceControl(env, surfaceObj)); + if (SurfaceControl::isValid(surfaceControl)) { + surfaceControl->clear(); } - setSurfaceControl(env, clazz, 0); - setSurface(env, clazz, 0); + setSurfaceControl(env, surfaceObj, NULL); + setSurface(env, surfaceObj, NULL); } -static void Surface_release(JNIEnv* env, jobject clazz, uintptr_t *ostack) -{ - setSurfaceControl(env, clazz, 0); - setSurface(env, clazz, 0); -} - -static jboolean Surface_isValid(JNIEnv* env, jobject clazz) -{ - const sp& surfaceControl(getSurfaceControl(env, clazz)); - if (surfaceControl != 0) { +static jboolean nativeIsValid(JNIEnv* env, jobject surfaceObj) { + sp surfaceControl(getSurfaceControl(env, surfaceObj)); + if (surfaceControl != NULL) { return SurfaceControl::isValid(surfaceControl) ? JNI_TRUE : JNI_FALSE; } - const sp& surface(getSurface(env, clazz)); + + sp surface(getSurface(env, surfaceObj)); return Surface::isValid(surface) ? JNI_TRUE : JNI_FALSE; } -static jboolean Surface_isConsumerRunningBehind(JNIEnv* env, jobject clazz) -{ - int value = 0; - const sp& surface(getSurface(env, clazz)); +static jint nativeGetIdentity(JNIEnv* env, jobject surfaceObj) { + sp control(getSurfaceControl(env, surfaceObj)); + if (control != NULL) { + return jint(control->getIdentity()); + } + + sp surface(getSurface(env, surfaceObj)); + if (surface != NULL) { + return jint(surface->getIdentity()); + } + + return -1; +} + +static jboolean nativeIsConsumerRunningBehind(JNIEnv* env, jobject surfaceObj) { + sp surface(getSurface(env, surfaceObj)); if (!Surface::isValid(surface)) { doThrowIAE(env); - return 0; + return JNI_FALSE; } - ANativeWindow* anw = static_cast(surface.get()); + + int value = 0; + ANativeWindow* anw = static_cast(surface.get()); anw->query(anw, NATIVE_WINDOW_CONSUMER_RUNNING_BEHIND, &value); - return (jboolean)value; + return value; } -static inline SkBitmap::Config convertPixelFormat(PixelFormat format) -{ +static inline SkBitmap::Config convertPixelFormat(PixelFormat format) { /* note: if PIXEL_FORMAT_RGBX_8888 means that all alpha bytes are 0xFF, then we can map to SkBitmap::kARGB_8888_Config, and optionally call bitmap.setIsOpaque(true) on the resulting SkBitmap (as an accelerator) @@ -345,44 +373,44 @@ static inline SkBitmap::Config convertPixelFormat(PixelFormat format) } } -static jobject Surface_lockCanvas(JNIEnv* env, jobject clazz, jobject dirtyRect) -{ - const sp& surface(getSurface(env, clazz)); +static jobject nativeLockCanvas(JNIEnv* env, jobject surfaceObj, jobject dirtyRectObj) { + sp surface(getSurface(env, surfaceObj)); if (!Surface::isValid(surface)) { doThrowIAE(env); - return 0; + return NULL; } // get dirty region Region dirtyRegion; - if (dirtyRect) { + if (dirtyRectObj) { Rect dirty; - dirty.left = env->GetIntField(dirtyRect, ro.l); - dirty.top = env->GetIntField(dirtyRect, ro.t); - dirty.right = env->GetIntField(dirtyRect, ro.r); - dirty.bottom= env->GetIntField(dirtyRect, ro.b); + dirty.left = env->GetIntField(dirtyRectObj, gRectClassInfo.left); + dirty.top = env->GetIntField(dirtyRectObj, gRectClassInfo.top); + dirty.right = env->GetIntField(dirtyRectObj, gRectClassInfo.right); + dirty.bottom = env->GetIntField(dirtyRectObj, gRectClassInfo.bottom); if (!dirty.isEmpty()) { dirtyRegion.set(dirty); } } else { - dirtyRegion.set(Rect(0x3FFF,0x3FFF)); + dirtyRegion.set(Rect(0x3FFF, 0x3FFF)); } Surface::SurfaceInfo info; status_t err = surface->lock(&info, &dirtyRegion); if (err < 0) { const char* const exception = (err == NO_MEMORY) ? - OutOfResourcesException : - "java/lang/IllegalArgumentException"; + OutOfResourcesException : + "java/lang/IllegalArgumentException"; jniThrowException(env, exception, NULL); - return 0; + return NULL; } // Associate a SkCanvas object to this surface - jobject canvas = env->GetObjectField(clazz, so.canvas); - env->SetIntField(canvas, co.surfaceFormat, info.format); + jobject canvasObj = env->GetObjectField(surfaceObj, gSurfaceClassInfo.mCanvas); + env->SetIntField(canvasObj, gCanvasClassInfo.mSurfaceFormat, info.format); - SkCanvas* nativeCanvas = (SkCanvas*)env->GetIntField(canvas, no.native_canvas); + SkCanvas* nativeCanvas = reinterpret_cast( + env->GetIntField(canvasObj, gCanvasClassInfo.mNativeCanvas)); SkBitmap bitmap; ssize_t bpr = info.s * bytesPerPixel(info.format); bitmap.setConfig(convertPixelFormat(info.format), info.w, info.h, bpr); @@ -413,38 +441,38 @@ static jobject Surface_lockCanvas(JNIEnv* env, jobject clazz, jobject dirtyRect) nativeCanvas->clipRegion(clipReg); int saveCount = nativeCanvas->save(); - env->SetIntField(clazz, so.saveCount, saveCount); + env->SetIntField(surfaceObj, gSurfaceClassInfo.mCanvasSaveCount, saveCount); - if (dirtyRect) { + if (dirtyRectObj) { const Rect& bounds(dirtyRegion.getBounds()); - env->SetIntField(dirtyRect, ro.l, bounds.left); - env->SetIntField(dirtyRect, ro.t, bounds.top); - env->SetIntField(dirtyRect, ro.r, bounds.right); - env->SetIntField(dirtyRect, ro.b, bounds.bottom); + env->SetIntField(dirtyRectObj, gRectClassInfo.left, bounds.left); + env->SetIntField(dirtyRectObj, gRectClassInfo.top, bounds.top); + env->SetIntField(dirtyRectObj, gRectClassInfo.right, bounds.right); + env->SetIntField(dirtyRectObj, gRectClassInfo.bottom, bounds.bottom); } - return canvas; + return canvasObj; } -static void Surface_unlockCanvasAndPost( - JNIEnv* env, jobject clazz, jobject argCanvas) -{ - jobject canvas = env->GetObjectField(clazz, so.canvas); - if (env->IsSameObject(canvas, argCanvas) == JNI_FALSE) { +static void nativeUnlockCanvasAndPost(JNIEnv* env, jobject surfaceObj, jobject canvasObj) { + jobject ownCanvasObj = env->GetObjectField(surfaceObj, gSurfaceClassInfo.mCanvas); + if (!env->IsSameObject(ownCanvasObj, canvasObj)) { doThrowIAE(env); return; } - const sp& surface(getSurface(env, clazz)); - if (!Surface::isValid(surface)) + sp surface(getSurface(env, surfaceObj)); + if (!Surface::isValid(surface)) { return; + } // detach the canvas from the surface - SkCanvas* nativeCanvas = (SkCanvas*)env->GetIntField(canvas, no.native_canvas); - int saveCount = env->GetIntField(clazz, so.saveCount); + SkCanvas* nativeCanvas = reinterpret_cast( + env->GetIntField(canvasObj, gCanvasClassInfo.mNativeCanvas)); + int saveCount = env->GetIntField(surfaceObj, gSurfaceClassInfo.mCanvasSaveCount); nativeCanvas->restoreToCount(saveCount); nativeCanvas->setBitmapDevice(SkBitmap()); - env->SetIntField(clazz, so.saveCount, 0); + env->SetIntField(surfaceObj, gSurfaceClassInfo.mCanvasSaveCount, 0); // unlock surface status_t err = surface->unlockAndPost(); @@ -453,116 +481,18 @@ static void Surface_unlockCanvasAndPost( } } -static void Surface_unlockCanvas( - JNIEnv* env, jobject clazz, jobject argCanvas) -{ - // XXX: this API has been removed - doThrowIAE(env); -} - -static void Surface_openTransaction( - JNIEnv* env, jobject clazz) -{ - SurfaceComposerClient::openGlobalTransaction(); -} - -static void Surface_closeTransaction( - JNIEnv* env, jobject clazz) -{ - SurfaceComposerClient::closeGlobalTransaction(); -} - -static void Surface_setOrientation( - JNIEnv* env, jobject clazz, jint display, jint orientation, jint flags) -{ - int err = SurfaceComposerClient::setOrientation(display, orientation, flags); - if (err < 0) { - doThrowIAE(env); - } -} - -static void Surface_freezeDisplay( - JNIEnv* env, jobject clazz, jint display) -{ - int err = SurfaceComposerClient::freezeDisplay(display, 0); - if (err < 0) { - doThrowIAE(env); - } -} - -static void Surface_unfreezeDisplay( - JNIEnv* env, jobject clazz, jint display) -{ - int err = SurfaceComposerClient::unfreezeDisplay(display, 0); - if (err < 0) { - doThrowIAE(env); - } -} - -class ScreenshotPixelRef : public SkPixelRef { -public: - ScreenshotPixelRef(SkColorTable* ctable) { - fCTable = ctable; - SkSafeRef(ctable); - setImmutable(); - } - virtual ~ScreenshotPixelRef() { - SkSafeUnref(fCTable); - } - - status_t update(int width, int height, int minLayer, int maxLayer, bool allLayers) { - status_t res = (width > 0 && height > 0) - ? (allLayers - ? mScreenshot.update(width, height) - : mScreenshot.update(width, height, minLayer, maxLayer)) - : mScreenshot.update(); - if (res != NO_ERROR) { - return res; - } - - return NO_ERROR; +static jobject nativeScreenshot(JNIEnv* env, jclass clazz, jobject displayTokenObj, + jint width, jint height, jint minLayer, jint maxLayer, bool allLayers) { + sp displayToken = ibinderForJavaObject(env, displayTokenObj); + if (displayToken == NULL) { + return NULL; } - uint32_t getWidth() const { - return mScreenshot.getWidth(); - } - - uint32_t getHeight() const { - return mScreenshot.getHeight(); - } - - uint32_t getStride() const { - return mScreenshot.getStride(); - } - - uint32_t getFormat() const { - return mScreenshot.getFormat(); - } - -protected: - // overrides from SkPixelRef - virtual void* onLockPixels(SkColorTable** ct) { - *ct = fCTable; - return (void*)mScreenshot.getPixels(); - } - - virtual void onUnlockPixels() { - } - -private: - ScreenshotClient mScreenshot; - SkColorTable* fCTable; - - typedef SkPixelRef INHERITED; -}; - -static jobject doScreenshot(JNIEnv* env, jobject clazz, jint width, jint height, - jint minLayer, jint maxLayer, bool allLayers) -{ ScreenshotPixelRef* pixels = new ScreenshotPixelRef(NULL); - if (pixels->update(width, height, minLayer, maxLayer, allLayers) != NO_ERROR) { + if (pixels->update(displayToken, width, height, + minLayer, maxLayer, allLayers) != NO_ERROR) { delete pixels; - return 0; + return NULL; } uint32_t w = pixels->getWidth(); @@ -589,116 +519,72 @@ static jobject doScreenshot(JNIEnv* env, jobject clazz, jint width, jint height, return GraphicsJNI::createBitmap(env, bitmap, false, NULL); } -static jobject Surface_screenshotAll(JNIEnv* env, jobject clazz, jint width, jint height) -{ - return doScreenshot(env, clazz, width, height, 0, 0, true); +static void nativeOpenTransaction(JNIEnv* env, jclass clazz) { + SurfaceComposerClient::openGlobalTransaction(); } -static jobject Surface_screenshot(JNIEnv* env, jobject clazz, jint width, jint height, - jint minLayer, jint maxLayer) -{ - return doScreenshot(env, clazz, width, height, minLayer, maxLayer, false); +static void nativeCloseTransaction(JNIEnv* env, jclass clazz) { + SurfaceComposerClient::closeGlobalTransaction(); } -static void Surface_setLayer( - JNIEnv* env, jobject clazz, jint zorder) -{ - const sp& surface(getSurfaceControl(env, clazz)); - if (surface == 0) return; +static void nativeSetAnimationTransaction(JNIEnv* env, jclass clazz) { + SurfaceComposerClient::setAnimationTransaction(); +} + +static void nativeSetLayer(JNIEnv* env, jobject surfaceObj, jint zorder) { + sp surface(getSurfaceControl(env, surfaceObj)); + if (surface == NULL) return; + status_t err = surface->setLayer(zorder); - if (err<0 && err!=NO_INIT) { + if (err < 0 && err != NO_INIT) { doThrowIAE(env); } } -static void Surface_setPosition( - JNIEnv* env, jobject clazz, jfloat x, jfloat y) -{ - const sp& surface(getSurfaceControl(env, clazz)); - if (surface == 0) return; +static void nativeSetPosition(JNIEnv* env, jobject surfaceObj, jfloat x, jfloat y) { + sp surface(getSurfaceControl(env, surfaceObj)); + if (surface == NULL) return; + status_t err = surface->setPosition(x, y); - if (err<0 && err!=NO_INIT) { + if (err < 0 && err != NO_INIT) { doThrowIAE(env); } } -static void Surface_setSize( - JNIEnv* env, jobject clazz, jint w, jint h) -{ - const sp& surface(getSurfaceControl(env, clazz)); - if (surface == 0) return; +static void nativeSetSize(JNIEnv* env, jobject surfaceObj, jint w, jint h) { + sp surface(getSurfaceControl(env, surfaceObj)); + if (surface == NULL) return; + status_t err = surface->setSize(w, h); - if (err<0 && err!=NO_INIT) { + if (err < 0 && err != NO_INIT) { doThrowIAE(env); } } -static void Surface_hide( - JNIEnv* env, jobject clazz) -{ - const sp& surface(getSurfaceControl(env, clazz)); - if (surface == 0) return; - status_t err = surface->hide(); - if (err<0 && err!=NO_INIT) { - doThrowIAE(env); - } -} +static void nativeSetFlags(JNIEnv* env, jobject surfaceObj, jint flags, jint mask) { + sp surface(getSurfaceControl(env, surfaceObj)); + if (surface == NULL) return; -static void Surface_show( - JNIEnv* env, jobject clazz) -{ - const sp& surface(getSurfaceControl(env, clazz)); - if (surface == 0) return; - status_t err = surface->show(); - if (err<0 && err!=NO_INIT) { + status_t err = surface->setFlags(flags, mask); + if (err < 0 && err != NO_INIT) { doThrowIAE(env); } } -static void Surface_freeze( - JNIEnv* env, jobject clazz) -{ - const sp& surface(getSurfaceControl(env, clazz)); - if (surface == 0) return; - status_t err = surface->freeze(); - if (err<0 && err!=NO_INIT) { - doThrowIAE(env); - } -} +static void nativeSetTransparentRegionHint(JNIEnv* env, jobject surfaceObj, jobject regionObj) { + sp surface(getSurfaceControl(env, surfaceObj)); + if (surface == NULL) return; -static void Surface_unfreeze( - JNIEnv* env, jobject clazz) -{ - const sp& surface(getSurfaceControl(env, clazz)); - if (surface == 0) return; - status_t err = surface->unfreeze(); - if (err<0 && err!=NO_INIT) { - doThrowIAE(env); - } -} - -static void Surface_setFlags( - JNIEnv* env, jobject clazz, jint flags, jint mask) -{ - const sp& surface(getSurfaceControl(env, clazz)); - if (surface == 0) return; - status_t err = surface->setFlags(flags, mask); - if (err<0 && err!=NO_INIT) { + SkRegion* region = android_graphics_Region_getSkRegion(env, regionObj); + if (!region) { doThrowIAE(env); + return; } -} - -static void Surface_setTransparentRegion( - JNIEnv* env, jobject clazz, jobject argRegion) -{ - const sp& surface(getSurfaceControl(env, clazz)); - if (surface == 0) return; - SkRegion* nativeRegion = (SkRegion*)env->GetIntField(argRegion, no.native_region); - const SkIRect& b(nativeRegion->getBounds()); + const SkIRect& b(region->getBounds()); Region reg(Rect(b.fLeft, b.fTop, b.fRight, b.fBottom)); - if (nativeRegion->isComplex()) { - SkRegion::Iterator it(*nativeRegion); + if (region->isComplex()) { + SkRegion::Iterator it(*region); while (!it.done()) { const SkIRect& r(it.rect()); reg.addRectUnchecked(r.fLeft, r.fTop, r.fRight, r.fBottom); @@ -707,134 +593,189 @@ static void Surface_setTransparentRegion( } status_t err = surface->setTransparentRegionHint(reg); - if (err<0 && err!=NO_INIT) { + if (err < 0 && err != NO_INIT) { doThrowIAE(env); } } -static void Surface_setAlpha( - JNIEnv* env, jobject clazz, jfloat alpha) -{ - const sp& surface(getSurfaceControl(env, clazz)); - if (surface == 0) return; +static void nativeSetAlpha(JNIEnv* env, jobject surfaceObj, jfloat alpha) { + sp surface(getSurfaceControl(env, surfaceObj)); + if (surface == NULL) return; + status_t err = surface->setAlpha(alpha); - if (err<0 && err!=NO_INIT) { + if (err < 0 && err != NO_INIT) { doThrowIAE(env); } } -static void Surface_setMatrix( - JNIEnv* env, jobject clazz, - jfloat dsdx, jfloat dtdx, jfloat dsdy, jfloat dtdy) -{ - const sp& surface(getSurfaceControl(env, clazz)); - if (surface == 0) return; +static void nativeSetMatrix(JNIEnv* env, jobject surfaceObj, + jfloat dsdx, jfloat dtdx, jfloat dsdy, jfloat dtdy) { + sp surface(getSurfaceControl(env, surfaceObj)); + if (surface == NULL) return; + status_t err = surface->setMatrix(dsdx, dtdx, dsdy, dtdy); - if (err<0 && err!=NO_INIT) { + if (err < 0 && err != NO_INIT) { doThrowIAE(env); } } -static void Surface_setFreezeTint( - JNIEnv* env, jobject clazz, - jint tint) -{ - const sp& surface(getSurfaceControl(env, clazz)); - if (surface == 0) return; - status_t err = surface->setFreezeTint(tint); - if (err<0 && err!=NO_INIT) { +static void nativeSetWindowCrop(JNIEnv* env, jobject surfaceObj, jobject cropObj) { + const sp& surface(getSurfaceControl(env, surfaceObj)); + if (surface == NULL) return; + + Rect crop; + if (cropObj) { + crop.left = env->GetIntField(cropObj, gRectClassInfo.left); + crop.top = env->GetIntField(cropObj, gRectClassInfo.top); + crop.right = env->GetIntField(cropObj, gRectClassInfo.right); + crop.bottom = env->GetIntField(cropObj, gRectClassInfo.bottom); + } else { + crop.left = crop.top = crop.right = crop.bottom = 0; + } + + status_t err = surface->setCrop(crop); + if (err < 0 && err != NO_INIT) { doThrowIAE(env); } } -static void Surface_setWindowCrop(JNIEnv* env, jobject thiz, jobject crop) -{ - const sp& surface(getSurfaceControl(env, thiz)); - if (surface == 0) return; - - Rect nativeCrop; - if (crop) { - nativeCrop.left = env->GetIntField(crop, ro.l); - nativeCrop.top = env->GetIntField(crop, ro.t); - nativeCrop.right = env->GetIntField(crop, ro.r); - nativeCrop.bottom= env->GetIntField(crop, ro.b); - } else { - nativeCrop.left = nativeCrop.top = nativeCrop.right = - nativeCrop.bottom = 0; - } +static void nativeSetLayerStack(JNIEnv* env, jobject surfaceObj, jint layerStack) { + sp surface(getSurfaceControl(env, surfaceObj)); + if (surface == NULL) return; - status_t err = surface->setCrop(nativeCrop); - if (err<0 && err!=NO_INIT) { + status_t err = surface->setLayerStack(layerStack); + if (err < 0 && err != NO_INIT) { doThrowIAE(env); } } -// ---------------------------------------------------------------------------- +static jobject nativeGetBuiltInDisplay(JNIEnv* env, jclass clazz, jint id) { + sp token(SurfaceComposerClient::getBuiltInDisplay(id)); + return javaObjectForIBinder(env, token); +} -static void Surface_copyFrom( - JNIEnv* env, jobject clazz, jobject other) -{ - if (clazz == other) - return; +static jobject nativeCreateDisplay(JNIEnv* env, jclass clazz, jstring nameObj, + jboolean secure) { + ScopedUtfChars name(env, nameObj); + sp token(SurfaceComposerClient::createDisplay( + String8(name.c_str()), bool(secure))); + return javaObjectForIBinder(env, token); +} - if (other == NULL) { - doThrowNPE(env); - return; +static void nativeSetDisplaySurface(JNIEnv* env, jclass clazz, + jobject tokenObj, jobject surfaceObj) { + sp token(ibinderForJavaObject(env, tokenObj)); + if (token == NULL) return; + + sp surfaceTexture(getISurfaceTexture(env, surfaceObj)); + SurfaceComposerClient::setDisplaySurface(token, surfaceTexture); +} + +static void nativeSetDisplayLayerStack(JNIEnv* env, jclass clazz, + jobject tokenObj, jint layerStack) { + sp token(ibinderForJavaObject(env, tokenObj)); + if (token == NULL) return; + + SurfaceComposerClient::setDisplayLayerStack(token, layerStack); +} + +static void nativeSetDisplayProjection(JNIEnv* env, jclass clazz, + jobject tokenObj, jint orientation, jobject layerStackRectObj, jobject displayRectObj) { + sp token(ibinderForJavaObject(env, tokenObj)); + if (token == NULL) return; + + Rect layerStackRect; + layerStackRect.left = env->GetIntField(layerStackRectObj, gRectClassInfo.left); + layerStackRect.top = env->GetIntField(layerStackRectObj, gRectClassInfo.top); + layerStackRect.right = env->GetIntField(layerStackRectObj, gRectClassInfo.right); + layerStackRect.bottom = env->GetIntField(layerStackRectObj, gRectClassInfo.bottom); + + Rect displayRect; + displayRect.left = env->GetIntField(displayRectObj, gRectClassInfo.left); + displayRect.top = env->GetIntField(displayRectObj, gRectClassInfo.top); + displayRect.right = env->GetIntField(displayRectObj, gRectClassInfo.right); + displayRect.bottom = env->GetIntField(displayRectObj, gRectClassInfo.bottom); + + SurfaceComposerClient::setDisplayProjection(token, orientation, layerStackRect, displayRect); +} + +static jboolean nativeGetDisplayInfo(JNIEnv* env, jclass clazz, + jobject tokenObj, jobject infoObj) { + sp token(ibinderForJavaObject(env, tokenObj)); + if (token == NULL) return JNI_FALSE; + + DisplayInfo info; + if (SurfaceComposerClient::getDisplayInfo(token, &info)) { + return JNI_FALSE; } + env->SetIntField(infoObj, gPhysicalDisplayInfoClassInfo.width, info.w); + env->SetIntField(infoObj, gPhysicalDisplayInfoClassInfo.height, info.h); + env->SetFloatField(infoObj, gPhysicalDisplayInfoClassInfo.refreshRate, info.fps); + env->SetFloatField(infoObj, gPhysicalDisplayInfoClassInfo.density, info.density); + env->SetFloatField(infoObj, gPhysicalDisplayInfoClassInfo.xDpi, info.xdpi); + env->SetFloatField(infoObj, gPhysicalDisplayInfoClassInfo.yDpi, info.ydpi); + env->SetBooleanField(infoObj, gPhysicalDisplayInfoClassInfo.secure, info.secure); + return JNI_TRUE; +} + +static void nativeBlankDisplay(JNIEnv* env, jclass clazz, jobject tokenObj) { + sp token(ibinderForJavaObject(env, tokenObj)); + if (token == NULL) return; + + ALOGD_IF_SLOW(100, "Excessive delay in blankDisplay() while turning screen off"); + SurfaceComposerClient::blankDisplay(token); +} + +static void nativeUnblankDisplay(JNIEnv* env, jclass clazz, jobject tokenObj) { + sp token(ibinderForJavaObject(env, tokenObj)); + if (token == NULL) return; + + ALOGD_IF_SLOW(100, "Excessive delay in unblankDisplay() while turning screen on"); + SurfaceComposerClient::unblankDisplay(token); +} + +// ---------------------------------------------------------------------------- + +static void nativeCopyFrom(JNIEnv* env, jobject surfaceObj, jobject otherObj) { /* * This is used by the WindowManagerService just after constructing * a Surface and is necessary for returning the Surface reference to * the caller. At this point, we should only have a SurfaceControl. */ - const sp& surface = getSurfaceControl(env, clazz); - const sp& rhs = getSurfaceControl(env, other); - if (!SurfaceControl::isSameSurface(surface, rhs)) { + sp surface(getSurfaceControl(env, surfaceObj)); + sp other(getSurfaceControl(env, otherObj)); + if (!SurfaceControl::isSameSurface(surface, other)) { // we reassign the surface only if it's a different one // otherwise we would loose our client-side state. - setSurfaceControl(env, clazz, rhs); + setSurfaceControl(env, surfaceObj, other); } } -static void Surface_transferFrom( - JNIEnv* env, jobject clazz, jobject other) -{ - if (clazz == other) - return; - - if (other == NULL) { - doThrowNPE(env); - return; - } - - sp control(getSurfaceControl(env, other)); - sp surface(Surface_getSurface(env, other)); - setSurfaceControl(env, clazz, control); - setSurface(env, clazz, surface); - setSurfaceControl(env, other, 0); - setSurface(env, other, 0); +static void nativeTransferFrom(JNIEnv* env, jobject surfaceObj, jobject otherObj) { + sp control(getSurfaceControl(env, otherObj)); + sp surface(android_view_Surface_getSurface(env, otherObj)); + setSurfaceControl(env, surfaceObj, control); + setSurface(env, surfaceObj, surface); + setSurfaceControl(env, otherObj, NULL); + setSurface(env, otherObj, NULL); } -static void Surface_readFromParcel( - JNIEnv* env, jobject clazz, jobject argParcel) -{ - Parcel* parcel = (Parcel*)env->GetIntField( argParcel, no.native_parcel); +static void nativeReadFromParcel(JNIEnv* env, jobject surfaceObj, jobject parcelObj) { + Parcel* parcel = parcelForJavaObject(env, parcelObj); if (parcel == NULL) { doThrowNPE(env); return; } - sp sur(Surface::readFromParcel(*parcel)); - setSurface(env, clazz, sur); + sp surface(Surface::readFromParcel(*parcel)); + setSurfaceControl(env, surfaceObj, NULL); + setSurface(env, surfaceObj, surface); } -static void Surface_writeToParcel( - JNIEnv* env, jobject clazz, jobject argParcel, jint flags) -{ - Parcel* parcel = (Parcel*)env->GetIntField( - argParcel, no.native_parcel); - +static void nativeWriteToParcel(JNIEnv* env, jobject surfaceObj, jobject parcelObj) { + Parcel* parcel = parcelForJavaObject(env, parcelObj); if (parcel == NULL) { doThrowNPE(env); return; @@ -846,114 +787,129 @@ static void Surface_writeToParcel( // available we let it parcel itself. Finally, if the Surface is also // NULL we fall back to using the SurfaceControl path which sends an // empty surface; this matches legacy behavior. - const sp& control(getSurfaceControl(env, clazz)); + sp control(getSurfaceControl(env, surfaceObj)); if (control != NULL) { SurfaceControl::writeSurfaceToParcel(control, parcel); } else { - sp surface(Surface_getSurface(env, clazz)); + sp surface(android_view_Surface_getSurface(env, surfaceObj)); if (surface != NULL) { Surface::writeToParcel(surface, parcel); } else { SurfaceControl::writeSurfaceToParcel(NULL, parcel); } } - if (flags & PARCELABLE_WRITE_RETURN_VALUE) { - setSurfaceControl(env, clazz, NULL); - setSurface(env, clazz, NULL); - } } -// ---------------------------------------------------------------------------- -// ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- -static void nativeClassInit(JNIEnv* env, jclass clazz); - -static JNINativeMethod gSurfaceSessionMethods[] = { - {"init", "()V", (void*)SurfaceSession_init }, - {"destroy", "()V", (void*)SurfaceSession_destroy }, - {"kill", "()V", (void*)SurfaceSession_kill }, -}; - static JNINativeMethod gSurfaceMethods[] = { - {"nativeClassInit", "()V", (void*)nativeClassInit }, - {"init", "(Landroid/view/SurfaceSession;ILjava/lang/String;IIIII)V", (void*)Surface_init }, - {"init", "(Landroid/os/Parcel;)V", (void*)Surface_initParcel }, - {"initFromSurfaceTexture", "(Landroid/graphics/SurfaceTexture;)V", (void*)Surface_initFromSurfaceTexture }, - {"getIdentity", "()I", (void*)Surface_getIdentity }, - {"destroy", "()V", (void*)Surface_destroy }, - {"release", "()V", (void*)Surface_release }, - {"copyFrom", "(Landroid/view/Surface;)V", (void*)Surface_copyFrom }, - {"transferFrom", "(Landroid/view/Surface;)V", (void*)Surface_transferFrom }, - {"isValid", "()Z", (void*)Surface_isValid }, - {"lockCanvasNative", "(Landroid/graphics/Rect;)Landroid/graphics/Canvas;", (void*)Surface_lockCanvas }, - {"unlockCanvasAndPost", "(Landroid/graphics/Canvas;)V", (void*)Surface_unlockCanvasAndPost }, - {"unlockCanvas", "(Landroid/graphics/Canvas;)V", (void*)Surface_unlockCanvas }, - {"openTransaction", "()V", (void*)Surface_openTransaction }, - {"closeTransaction", "()V", (void*)Surface_closeTransaction }, - {"setOrientation", "(III)V", (void*)Surface_setOrientation }, - {"freezeDisplay", "(I)V", (void*)Surface_freezeDisplay }, - {"unfreezeDisplay", "(I)V", (void*)Surface_unfreezeDisplay }, - {"screenshot", "(II)Landroid/graphics/Bitmap;", (void*)Surface_screenshotAll }, - {"screenshot", "(IIII)Landroid/graphics/Bitmap;", (void*)Surface_screenshot }, - {"setLayer", "(I)V", (void*)Surface_setLayer }, - {"setPosition", "(FF)V",(void*)Surface_setPosition }, - {"setSize", "(II)V",(void*)Surface_setSize }, - {"hide", "()V", (void*)Surface_hide }, - {"show", "()V", (void*)Surface_show }, - {"freeze", "()V", (void*)Surface_freeze }, - {"unfreeze", "()V", (void*)Surface_unfreeze }, - {"setFlags", "(II)V",(void*)Surface_setFlags }, - {"setTransparentRegionHint","(Landroid/graphics/Region;)V", (void*)Surface_setTransparentRegion }, - {"setAlpha", "(F)V", (void*)Surface_setAlpha }, - {"setMatrix", "(FFFF)V", (void*)Surface_setMatrix }, - {"setFreezeTint", "(I)V", (void*)Surface_setFreezeTint }, - {"readFromParcel", "(Landroid/os/Parcel;)V", (void*)Surface_readFromParcel }, - {"writeToParcel", "(Landroid/os/Parcel;I)V", (void*)Surface_writeToParcel }, - {"isConsumerRunningBehind", "()Z", (void*)Surface_isConsumerRunningBehind }, - {"setWindowCrop", "(Landroid/graphics/Rect;)V", (void*)Surface_setWindowCrop }, + {"nativeCreate", "(Landroid/view/SurfaceSession;Ljava/lang/String;IIII)V", + (void*)nativeCreate }, + {"nativeCreateFromSurfaceTexture", "(Landroid/graphics/SurfaceTexture;)V", + (void*)nativeCreateFromSurfaceTexture }, + {"nativeRelease", "()V", + (void*)nativeRelease }, + {"nativeDestroy", "()V", + (void*)nativeDestroy }, + {"nativeIsValid", "()Z", + (void*)nativeIsValid }, + {"nativeGetIdentity", "()I", + (void*)nativeGetIdentity }, + {"nativeIsConsumerRunningBehind", "()Z", + (void*)nativeIsConsumerRunningBehind }, + {"nativeLockCanvas", "(Landroid/graphics/Rect;)Landroid/graphics/Canvas;", + (void*)nativeLockCanvas }, + {"nativeUnlockCanvasAndPost", "(Landroid/graphics/Canvas;)V", + (void*)nativeUnlockCanvasAndPost }, + {"nativeScreenshot", "(Landroid/os/IBinder;IIIIZ)Landroid/graphics/Bitmap;", + (void*)nativeScreenshot }, + {"nativeOpenTransaction", "()V", + (void*)nativeOpenTransaction }, + {"nativeCloseTransaction", "()V", + (void*)nativeCloseTransaction }, + {"nativeSetAnimationTransaction", "()V", + (void*)nativeSetAnimationTransaction }, + {"nativeSetLayer", "(I)V", + (void*)nativeSetLayer }, + {"nativeSetPosition", "(FF)V", + (void*)nativeSetPosition }, + {"nativeSetSize", "(II)V", + (void*)nativeSetSize }, + {"nativeSetTransparentRegionHint", "(Landroid/graphics/Region;)V", + (void*)nativeSetTransparentRegionHint }, + {"nativeSetAlpha", "(F)V", + (void*)nativeSetAlpha }, + {"nativeSetMatrix", "(FFFF)V", + (void*)nativeSetMatrix }, + {"nativeSetFlags", "(II)V", + (void*)nativeSetFlags }, + {"nativeSetWindowCrop", "(Landroid/graphics/Rect;)V", + (void*)nativeSetWindowCrop }, + {"nativeSetLayerStack", "(I)V", + (void*)nativeSetLayerStack }, + {"nativeGetBuiltInDisplay", "(I)Landroid/os/IBinder;", + (void*)nativeGetBuiltInDisplay }, + {"nativeCreateDisplay", "(Ljava/lang/String;Z)Landroid/os/IBinder;", + (void*)nativeCreateDisplay }, + {"nativeSetDisplaySurface", "(Landroid/os/IBinder;Landroid/view/Surface;)V", + (void*)nativeSetDisplaySurface }, + {"nativeSetDisplayLayerStack", "(Landroid/os/IBinder;I)V", + (void*)nativeSetDisplayLayerStack }, + {"nativeSetDisplayProjection", "(Landroid/os/IBinder;ILandroid/graphics/Rect;Landroid/graphics/Rect;)V", + (void*)nativeSetDisplayProjection }, + {"nativeGetDisplayInfo", "(Landroid/os/IBinder;Landroid/view/Surface$PhysicalDisplayInfo;)Z", + (void*)nativeGetDisplayInfo }, + {"nativeBlankDisplay", "(Landroid/os/IBinder;)V", + (void*)nativeBlankDisplay }, + {"nativeUnblankDisplay", "(Landroid/os/IBinder;)V", + (void*)nativeUnblankDisplay }, + {"nativeCopyFrom", "(Landroid/view/Surface;)V", + (void*)nativeCopyFrom }, + {"nativeTransferFrom", "(Landroid/view/Surface;)V", + (void*)nativeTransferFrom }, + {"nativeReadFromParcel", "(Landroid/os/Parcel;)V", + (void*)nativeReadFromParcel }, + {"nativeWriteToParcel", "(Landroid/os/Parcel;)V", + (void*)nativeWriteToParcel }, }; -void nativeClassInit(JNIEnv* env, jclass clazz) -{ - so.surface = env->GetFieldID(clazz, ANDROID_VIEW_SURFACE_JNI_ID, "I"); - so.surfaceGenerationId = env->GetFieldID(clazz, "mSurfaceGenerationId", "I"); - so.surfaceControl = env->GetFieldID(clazz, "mSurfaceControl", "I"); - so.saveCount = env->GetFieldID(clazz, "mSaveCount", "I"); - so.canvas = env->GetFieldID(clazz, "mCanvas", "Landroid/graphics/Canvas;"); - - jclass surfaceSession = env->FindClass("android/view/SurfaceSession"); - sso.client = env->GetFieldID(surfaceSession, "mClient", "I"); - - jclass canvas = env->FindClass("android/graphics/Canvas"); - no.native_canvas = env->GetFieldID(canvas, "mNativeCanvas", "I"); - co.surfaceFormat = env->GetFieldID(canvas, "mSurfaceFormat", "I"); - - jclass region = env->FindClass("android/graphics/Region"); - no.native_region = env->GetFieldID(region, "mNativeRegion", "I"); - - jclass parcel = env->FindClass("android/os/Parcel"); - no.native_parcel = env->GetFieldID(parcel, "mNativePtr", "I"); - - jclass rect = env->FindClass("android/graphics/Rect"); - ro.l = env->GetFieldID(rect, "left", "I"); - ro.t = env->GetFieldID(rect, "top", "I"); - ro.r = env->GetFieldID(rect, "right", "I"); - ro.b = env->GetFieldID(rect, "bottom", "I"); - - jclass point = env->FindClass("android/graphics/Point"); - po.x = env->GetFieldID(point, "x", "I"); - po.y = env->GetFieldID(point, "y", "I"); -} - int register_android_view_Surface(JNIEnv* env) { - int err; - err = AndroidRuntime::registerNativeMethods(env, kSurfaceSessionClassPathName, - gSurfaceSessionMethods, NELEM(gSurfaceSessionMethods)); - - err |= AndroidRuntime::registerNativeMethods(env, kSurfaceClassPathName, + int err = AndroidRuntime::registerNativeMethods(env, "android/view/Surface", gSurfaceMethods, NELEM(gSurfaceMethods)); + + jclass clazz = env->FindClass("android/view/Surface"); + gSurfaceClassInfo.clazz = jclass(env->NewGlobalRef(clazz)); + gSurfaceClassInfo.mNativeSurface = + env->GetFieldID(gSurfaceClassInfo.clazz, ANDROID_VIEW_SURFACE_JNI_ID, "I"); + gSurfaceClassInfo.mNativeSurfaceControl = + env->GetFieldID(gSurfaceClassInfo.clazz, "mNativeSurfaceControl", "I"); + gSurfaceClassInfo.mGenerationId = + env->GetFieldID(gSurfaceClassInfo.clazz, "mGenerationId", "I"); + gSurfaceClassInfo.mCanvas = + env->GetFieldID(gSurfaceClassInfo.clazz, "mCanvas", "Landroid/graphics/Canvas;"); + gSurfaceClassInfo.mCanvasSaveCount = + env->GetFieldID(gSurfaceClassInfo.clazz, "mCanvasSaveCount", "I"); + gSurfaceClassInfo.ctor = env->GetMethodID(gSurfaceClassInfo.clazz, "", "()V"); + + clazz = env->FindClass("android/graphics/Canvas"); + gCanvasClassInfo.mNativeCanvas = env->GetFieldID(clazz, "mNativeCanvas", "I"); + gCanvasClassInfo.mSurfaceFormat = env->GetFieldID(clazz, "mSurfaceFormat", "I"); + + clazz = env->FindClass("android/graphics/Rect"); + gRectClassInfo.left = env->GetFieldID(clazz, "left", "I"); + gRectClassInfo.top = env->GetFieldID(clazz, "top", "I"); + gRectClassInfo.right = env->GetFieldID(clazz, "right", "I"); + gRectClassInfo.bottom = env->GetFieldID(clazz, "bottom", "I"); + + clazz = env->FindClass("android/view/Surface$PhysicalDisplayInfo"); + gPhysicalDisplayInfoClassInfo.width = env->GetFieldID(clazz, "width", "I"); + gPhysicalDisplayInfoClassInfo.height = env->GetFieldID(clazz, "height", "I"); + gPhysicalDisplayInfoClassInfo.refreshRate = env->GetFieldID(clazz, "refreshRate", "F"); + gPhysicalDisplayInfoClassInfo.density = env->GetFieldID(clazz, "density", "F"); + gPhysicalDisplayInfoClassInfo.xDpi = env->GetFieldID(clazz, "xDpi", "F"); + gPhysicalDisplayInfoClassInfo.yDpi = env->GetFieldID(clazz, "yDpi", "F"); + gPhysicalDisplayInfoClassInfo.secure = env->GetFieldID(clazz, "secure", "Z"); return err; } diff --git a/core/jni/android_view_SurfaceSession.cpp b/core/jni/android_view_SurfaceSession.cpp new file mode 100644 index 0000000000000..1494bc517fb48 --- /dev/null +++ b/core/jni/android_view_SurfaceSession.cpp @@ -0,0 +1,79 @@ +/* + * 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 "SurfaceSession" + +#include "JNIHelp.h" + +#include +#include +#include +#include + +#include + +namespace android { + +static struct { + jfieldID mNativeClient; +} gSurfaceSessionClassInfo; + + +sp android_view_SurfaceSession_getClient( + JNIEnv* env, jobject surfaceSessionObj) { + return reinterpret_cast( + env->GetIntField(surfaceSessionObj, gSurfaceSessionClassInfo.mNativeClient)); +} + + +static jint nativeCreate(JNIEnv* env, jclass clazz) { + SurfaceComposerClient* client = new SurfaceComposerClient(); + client->incStrong(clazz); + return reinterpret_cast(client); +} + +static void nativeDestroy(JNIEnv* env, jclass clazz, jint ptr) { + SurfaceComposerClient* client = reinterpret_cast(ptr); + client->decStrong(clazz); +} + +static void nativeKill(JNIEnv* env, jclass clazz, jint ptr) { + SurfaceComposerClient* client = reinterpret_cast(ptr); + client->dispose(); +} + + +static JNINativeMethod gMethods[] = { + /* name, signature, funcPtr */ + { "nativeCreate", "()I", + (void*)nativeCreate }, + { "nativeDestroy", "(I)V", + (void*)nativeDestroy }, + { "nativeKill", "(I)V", + (void*)nativeKill } +}; + +int register_android_view_SurfaceSession(JNIEnv* env) { + int res = jniRegisterNativeMethods(env, "android/view/SurfaceSession", + gMethods, NELEM(gMethods)); + LOG_ALWAYS_FATAL_IF(res < 0, "Unable to register native methods."); + + jclass clazz = env->FindClass("android/view/SurfaceSession"); + gSurfaceSessionClassInfo.mNativeClient = env->GetFieldID(clazz, "mNativeClient", "I"); + return 0; +} + +} // namespace android diff --git a/core/jni/com_android_internal_app_ActivityTrigger.cpp b/core/jni/com_android_internal_app_ActivityTrigger.cpp new file mode 100644 index 0000000000000..93b19faa37f71 --- /dev/null +++ b/core/jni/com_android_internal_app_ActivityTrigger.cpp @@ -0,0 +1,167 @@ +/* + * Copyright (c) 2011, Code Aurora Forum. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Code Aurora nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#define LOG_TAG "ActTriggerJNI" + +#include "jni.h" +#include "JNIHelp.h" +#include + +#include +#include +#include + +#include +#include + +#define LIBRARY_PATH_PREFIX "/system/lib/" + +namespace android +{ + +// ---------------------------------------------------------------------------- + +static void (*startActivity)(const char *) = NULL; +static void (*resumeActivity)(const char *) = NULL; +static void *dlhandle = NULL; + +// ---------------------------------------------------------------------------- + +static void +com_android_internal_app_ActivityTrigger_native_at_init() +{ + const char *rc; + void (*init)(void); + char buf[PROPERTY_VALUE_MAX]; + int len; + + /* Retrieve name of vendor extension library */ + if (property_get("ro.vendor.extension_library", buf, NULL) <= 0) { + return; + } + + /* Sanity check - ensure */ + buf[PROPERTY_VALUE_MAX-1] = '\0'; + if ((strncmp(buf, LIBRARY_PATH_PREFIX, sizeof(LIBRARY_PATH_PREFIX) - 1) != 0) + || + (strstr(buf, "..") != NULL)) { + return; + } + + dlhandle = dlopen(buf, RTLD_NOW | RTLD_LOCAL); + if (dlhandle == NULL) { + return; + } + + dlerror(); + + *(void **) (&startActivity) = dlsym(dlhandle, "activity_trigger_start"); + if ((rc = dlerror()) != NULL) { + goto cleanup; + } + *(void **) (&resumeActivity) = dlsym(dlhandle, "activity_trigger_resume"); + if ((rc = dlerror()) != NULL) { + goto cleanup; + } + *(void **) (&init) = dlsym(dlhandle, "activity_trigger_init"); + if ((rc = dlerror()) != NULL) { + goto cleanup; + } + (*init)(); + return; + +cleanup: + startActivity = NULL; + resumeActivity = NULL; + if (dlhandle) { + dlclose(dlhandle); + dlhandle = NULL; + } +} + +static void +com_android_internal_app_ActivityTrigger_native_at_deinit(JNIEnv *env, jobject clazz) +{ + void (*deinit)(void); + + if (dlhandle) { + startActivity = NULL; + resumeActivity = NULL; + + *(void **) (&deinit) = dlsym(dlhandle, "activity_trigger_deinit"); + if (deinit) { + (*deinit)(); + } + + dlclose(dlhandle); + dlhandle = NULL; + } +} + +static void +com_android_internal_app_ActivityTrigger_native_at_startActivity(JNIEnv *env, jobject clazz, jstring activity) +{ + if (startActivity && activity) { + const char *actStr = env->GetStringUTFChars(activity, NULL); + if (actStr) { + (*startActivity)(actStr); + env->ReleaseStringUTFChars(activity, actStr); + } + } +} + +static void +com_android_internal_app_ActivityTrigger_native_at_resumeActivity(JNIEnv *env, jobject clazz, jstring activity) +{ + if (resumeActivity && activity) { + const char *actStr = env->GetStringUTFChars(activity, NULL); + if (actStr) { + (*resumeActivity)(actStr); + env->ReleaseStringUTFChars(activity, actStr); + } + } +} + +// ---------------------------------------------------------------------------- + +static JNINativeMethod gMethods[] = { + {"native_at_startActivity", "(Ljava/lang/String;)V", (void *)com_android_internal_app_ActivityTrigger_native_at_startActivity}, + {"native_at_resumeActivity", "(Ljava/lang/String;)V", (void *)com_android_internal_app_ActivityTrigger_native_at_resumeActivity}, + {"native_at_deinit", "()V", (void *)com_android_internal_app_ActivityTrigger_native_at_deinit}, +}; + + +int register_com_android_internal_app_ActivityTrigger(JNIEnv *env) +{ + com_android_internal_app_ActivityTrigger_native_at_init(); + + return AndroidRuntime::registerNativeMethods(env, + "com/android/internal/app/ActivityTrigger", gMethods, NELEM(gMethods)); +} + +} // namespace android diff --git a/core/jni/com_google_android_gles_jni_EGLImpl.cpp b/core/jni/com_google_android_gles_jni_EGLImpl.cpp index 9c6c7ded9eb89..f8904bd243da8 100644 --- a/core/jni/com_google_android_gles_jni_EGLImpl.cpp +++ b/core/jni/com_google_android_gles_jni_EGLImpl.cpp @@ -326,7 +326,7 @@ static jint jni_eglCreateWindowSurface(JNIEnv *_env, jobject _this, jobject disp return 0; } - window = android_Surface_getNativeWindow(_env, native_window); + window = android_view_Surface_getNativeWindow(_env, native_window); if (window == NULL) goto not_valid_surface; diff --git a/core/jni/com_google_android_gles_jni_GLImpl.cpp b/core/jni/com_google_android_gles_jni_GLImpl.cpp index 8777131f2dba2..3f9942e686338 100644 --- a/core/jni/com_google_android_gles_jni_GLImpl.cpp +++ b/core/jni/com_google_android_gles_jni_GLImpl.cpp @@ -114,14 +114,12 @@ nativeClassInit(JNIEnv *_env, jclass glImplClass) } static void * -getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining) +getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining, jint *offset) { jint position; jint limit; jint elementSizeShift; jlong pointer; - jint offset; - void *data; position = _env->GetIntField(buffer, positionID); limit = _env->GetIntField(buffer, limitID); @@ -139,11 +137,10 @@ getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining) if (*array == NULL) { return (void*) NULL; } - offset = _env->CallStaticIntMethod(nioAccessClass, + *offset = _env->CallStaticIntMethod(nioAccessClass, getBaseArrayOffsetID, buffer); - data = _env->GetPrimitiveArrayCritical(*array, (jboolean *) 0); - return (void *) ((char *) data + offset); + return NULL; } static void @@ -181,10 +178,12 @@ getDirectBufferPointer(JNIEnv *_env, jobject buffer) { if (allowIndirectBuffers(_env)) { jarray array = 0; jint remaining; - buf = getPointer(_env, buffer, &array, &remaining); + jint offset; + buf = getPointer(_env, buffer, &array, &remaining, &offset); if (array) { releasePointer(_env, array, buf, 0); } + buf = buf + offset; } else { jniThrowException(_env, "java/lang/IllegalArgumentException", "Must use a native order direct Buffer"); @@ -418,6 +417,7 @@ static void android_glColorPointerBounds__IIILjava_nio_Buffer_2I (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jobject pointer_buf, jint remaining) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLvoid *pointer = (GLvoid *) 0; @@ -441,10 +441,15 @@ static void android_glCompressedTexImage2D__IIIIIIILjava_nio_Buffer_2 (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint width, jint height, jint border, jint imageSize, jobject data_buf) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLvoid *data = (GLvoid *) 0; - data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining); + data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining, &_bufferOffset); + if (data == NULL) { + char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + data = (GLvoid *) (_dataBase + _bufferOffset); + } glCompressedTexImage2D( (GLenum)target, (GLint)level, @@ -465,10 +470,15 @@ static void android_glCompressedTexSubImage2D__IIIIIIIILjava_nio_Buffer_2 (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint width, jint height, jint format, jint imageSize, jobject data_buf) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLvoid *data = (GLvoid *) 0; - data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining); + data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining, &_bufferOffset); + if (data == NULL) { + char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + data = (GLvoid *) (_dataBase + _bufferOffset); + } glCompressedTexSubImage2D( (GLenum)target, (GLint)level, @@ -530,21 +540,30 @@ android_glCullFace__I static void android_glDeleteTextures__I_3II (JNIEnv *_env, jobject _this, jint n, jintArray textures_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLuint *textures_base = (GLuint *) 0; jint _remaining; GLuint *textures = (GLuint *) 0; if (!textures_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "textures == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "textures == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(textures_ref) - offset; if (_remaining < n) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < n"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < n < needed"; goto exit; } textures_base = (GLuint *) @@ -561,21 +580,34 @@ android_glDeleteTextures__I_3II _env->ReleasePrimitiveArrayCritical(textures_ref, textures_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glDeleteTextures ( GLsizei n, const GLuint *textures ) */ static void android_glDeleteTextures__ILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint n, jobject textures_buf) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLuint *textures = (GLuint *) 0; - textures = (GLuint *)getPointer(_env, textures_buf, &_array, &_remaining); + textures = (GLuint *)getPointer(_env, textures_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < n) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < n"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < n < needed"; goto exit; } + if (textures == NULL) { + char * _texturesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + textures = (GLuint *) (_texturesBase + _bufferOffset); + } glDeleteTextures( (GLsizei)n, (GLuint *)textures @@ -585,6 +617,9 @@ android_glDeleteTextures__ILjava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, textures, JNI_FALSE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glDepthFunc ( GLenum func ) */ @@ -658,15 +693,25 @@ android_glDrawArrays__III static void android_glDrawElements__IIILjava_nio_Buffer_2 (JNIEnv *_env, jobject _this, jint mode, jint count, jint type, jobject indices_buf) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLvoid *indices = (GLvoid *) 0; - indices = (GLvoid *)getPointer(_env, indices_buf, &_array, &_remaining); + indices = (GLvoid *)getPointer(_env, indices_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < count) { - jniThrowException(_env, "java/lang/ArrayIndexOutOfBoundsException", "remaining() < count"); + _exception = 1; + _exceptionType = "java/lang/ArrayIndexOutOfBoundsException"; + _exceptionMessage = "remaining() < count < needed"; goto exit; } + if (indices == NULL) { + char * _indicesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + indices = (GLvoid *) (_indicesBase + _bufferOffset); + } glDrawElements( (GLenum)mode, (GLsizei)count, @@ -678,6 +723,9 @@ android_glDrawElements__IIILjava_nio_Buffer_2 if (_array) { releasePointer(_env, _array, indices, JNI_FALSE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glEnable ( GLenum cap ) */ @@ -726,16 +774,23 @@ android_glFogf__IF static void android_glFogfv__I_3FI (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfloat *params_base = (GLfloat *) 0; jint _remaining; GLfloat *params = (GLfloat *) 0; if (!params_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -765,7 +820,9 @@ android_glFogfv__I_3FI break; } if (_remaining < _needed) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < needed"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < needed"; goto exit; } params_base = (GLfloat *) @@ -782,17 +839,24 @@ android_glFogfv__I_3FI _env->ReleasePrimitiveArrayCritical(params_ref, params_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glFogfv ( GLenum pname, const GLfloat *params ) */ static void android_glFogfv__ILjava_nio_FloatBuffer_2 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfloat *params = (GLfloat *) 0; - params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); int _needed; switch (pname) { #if defined(GL_FOG_MODE) @@ -819,9 +883,15 @@ android_glFogfv__ILjava_nio_FloatBuffer_2 break; } if (_remaining < _needed) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < needed"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < needed"; goto exit; } + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfloat *) (_paramsBase + _bufferOffset); + } glFogfv( (GLenum)pname, (GLfloat *)params @@ -831,6 +901,9 @@ android_glFogfv__ILjava_nio_FloatBuffer_2 if (_array) { releasePointer(_env, _array, params, JNI_FALSE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glFogx ( GLenum pname, GLfixed param ) */ @@ -847,16 +920,23 @@ android_glFogx__II static void android_glFogxv__I_3II (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfixed *params_base = (GLfixed *) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; if (!params_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -886,7 +966,9 @@ android_glFogxv__I_3II break; } if (_remaining < _needed) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < needed"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < needed"; goto exit; } params_base = (GLfixed *) @@ -903,17 +985,24 @@ android_glFogxv__I_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glFogxv ( GLenum pname, const GLfixed *params ) */ static void android_glFogxv__ILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; - params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); int _needed; switch (pname) { #if defined(GL_FOG_MODE) @@ -940,9 +1029,15 @@ android_glFogxv__ILjava_nio_IntBuffer_2 break; } if (_remaining < _needed) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < needed"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < needed"; goto exit; } + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfixed *) (_paramsBase + _bufferOffset); + } glFogxv( (GLenum)pname, (GLfixed *)params @@ -952,6 +1047,9 @@ android_glFogxv__ILjava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, params, JNI_FALSE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glFrontFace ( GLenum mode ) */ @@ -996,24 +1094,29 @@ static void android_glGenTextures__I_3II (JNIEnv *_env, jobject _this, jint n, jintArray textures_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLuint *textures_base = (GLuint *) 0; jint _remaining; GLuint *textures = (GLuint *) 0; if (!textures_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "textures == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "textures == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(textures_ref) - offset; if (_remaining < n) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < n"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < n < needed"; goto exit; } textures_base = (GLuint *) @@ -1030,6 +1133,9 @@ android_glGenTextures__I_3II _env->ReleasePrimitiveArrayCritical(textures_ref, textures_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGenTextures ( GLsizei n, GLuint *textures ) */ @@ -1037,16 +1143,24 @@ static void android_glGenTextures__ILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint n, jobject textures_buf) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLuint *textures = (GLuint *) 0; - textures = (GLuint *)getPointer(_env, textures_buf, &_array, &_remaining); + textures = (GLuint *)getPointer(_env, textures_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < n) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < n"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < n < needed"; goto exit; } + if (textures == NULL) { + char * _texturesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + textures = (GLuint *) (_texturesBase + _bufferOffset); + } glGenTextures( (GLsizei)n, (GLuint *)textures @@ -1056,6 +1170,9 @@ android_glGenTextures__ILjava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, textures, _exception ? JNI_FALSE : JNI_TRUE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* GLenum glGetError ( void ) */ @@ -1072,18 +1189,22 @@ static void android_glGetIntegerv__I_3II (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLint *params_base = (GLint *) 0; jint _remaining; GLint *params = (GLint *) 0; if (!params_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -1420,7 +1541,8 @@ android_glGetIntegerv__I_3II } if (_remaining < _needed) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < needed"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < needed"; goto exit; } params_base = (GLint *) @@ -1437,6 +1559,9 @@ android_glGetIntegerv__I_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetIntegerv ( GLenum pname, GLint *params ) */ @@ -1444,11 +1569,14 @@ static void android_glGetIntegerv__ILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLint *params = (GLint *) 0; - params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); int _needed; switch (pname) { #if defined(GL_ALPHA_BITS) @@ -1782,9 +1910,14 @@ android_glGetIntegerv__ILjava_nio_IntBuffer_2 } if (_remaining < _needed) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < needed"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < needed"; goto exit; } + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLint *) (_paramsBase + _bufferOffset); + } glGetIntegerv( (GLenum)pname, (GLint *)params @@ -1794,6 +1927,9 @@ android_glGetIntegerv__ILjava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* const GLubyte * glGetString ( GLenum name ) */ @@ -1825,16 +1961,23 @@ android_glLightModelf__IF static void android_glLightModelfv__I_3FI (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfloat *params_base = (GLfloat *) 0; jint _remaining; GLfloat *params = (GLfloat *) 0; if (!params_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -1855,7 +1998,9 @@ android_glLightModelfv__I_3FI break; } if (_remaining < _needed) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < needed"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < needed"; goto exit; } params_base = (GLfloat *) @@ -1872,17 +2017,24 @@ android_glLightModelfv__I_3FI _env->ReleasePrimitiveArrayCritical(params_ref, params_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glLightModelfv ( GLenum pname, const GLfloat *params ) */ static void android_glLightModelfv__ILjava_nio_FloatBuffer_2 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfloat *params = (GLfloat *) 0; - params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); int _needed; switch (pname) { #if defined(GL_LIGHT_MODEL_TWO_SIDE) @@ -1900,9 +2052,15 @@ android_glLightModelfv__ILjava_nio_FloatBuffer_2 break; } if (_remaining < _needed) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < needed"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < needed"; goto exit; } + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfloat *) (_paramsBase + _bufferOffset); + } glLightModelfv( (GLenum)pname, (GLfloat *)params @@ -1912,6 +2070,9 @@ android_glLightModelfv__ILjava_nio_FloatBuffer_2 if (_array) { releasePointer(_env, _array, params, JNI_FALSE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glLightModelx ( GLenum pname, GLfixed param ) */ @@ -1928,16 +2089,23 @@ android_glLightModelx__II static void android_glLightModelxv__I_3II (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfixed *params_base = (GLfixed *) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; if (!params_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -1958,7 +2126,9 @@ android_glLightModelxv__I_3II break; } if (_remaining < _needed) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < needed"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < needed"; goto exit; } params_base = (GLfixed *) @@ -1975,17 +2145,24 @@ android_glLightModelxv__I_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glLightModelxv ( GLenum pname, const GLfixed *params ) */ static void android_glLightModelxv__ILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; - params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); int _needed; switch (pname) { #if defined(GL_LIGHT_MODEL_TWO_SIDE) @@ -2003,9 +2180,15 @@ android_glLightModelxv__ILjava_nio_IntBuffer_2 break; } if (_remaining < _needed) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < needed"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < needed"; goto exit; } + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfixed *) (_paramsBase + _bufferOffset); + } glLightModelxv( (GLenum)pname, (GLfixed *)params @@ -2015,6 +2198,9 @@ android_glLightModelxv__ILjava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, params, JNI_FALSE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glLightf ( GLenum light, GLenum pname, GLfloat param ) */ @@ -2032,16 +2218,23 @@ android_glLightf__IIF static void android_glLightfv__II_3FI (JNIEnv *_env, jobject _this, jint light, jint pname, jfloatArray params_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfloat *params_base = (GLfloat *) 0; jint _remaining; GLfloat *params = (GLfloat *) 0; if (!params_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -2088,7 +2281,9 @@ android_glLightfv__II_3FI break; } if (_remaining < _needed) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < needed"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < needed"; goto exit; } params_base = (GLfloat *) @@ -2106,17 +2301,24 @@ android_glLightfv__II_3FI _env->ReleasePrimitiveArrayCritical(params_ref, params_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glLightfv ( GLenum light, GLenum pname, const GLfloat *params ) */ static void android_glLightfv__IILjava_nio_FloatBuffer_2 (JNIEnv *_env, jobject _this, jint light, jint pname, jobject params_buf) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfloat *params = (GLfloat *) 0; - params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); int _needed; switch (pname) { #if defined(GL_SPOT_EXPONENT) @@ -2160,9 +2362,15 @@ android_glLightfv__IILjava_nio_FloatBuffer_2 break; } if (_remaining < _needed) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < needed"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < needed"; goto exit; } + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfloat *) (_paramsBase + _bufferOffset); + } glLightfv( (GLenum)light, (GLenum)pname, @@ -2173,6 +2381,9 @@ android_glLightfv__IILjava_nio_FloatBuffer_2 if (_array) { releasePointer(_env, _array, params, JNI_FALSE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glLightx ( GLenum light, GLenum pname, GLfixed param ) */ @@ -2190,16 +2401,23 @@ android_glLightx__III static void android_glLightxv__II_3II (JNIEnv *_env, jobject _this, jint light, jint pname, jintArray params_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfixed *params_base = (GLfixed *) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; if (!params_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -2246,7 +2464,9 @@ android_glLightxv__II_3II break; } if (_remaining < _needed) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < needed"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < needed"; goto exit; } params_base = (GLfixed *) @@ -2264,17 +2484,24 @@ android_glLightxv__II_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glLightxv ( GLenum light, GLenum pname, const GLfixed *params ) */ static void android_glLightxv__IILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint light, jint pname, jobject params_buf) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; - params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); int _needed; switch (pname) { #if defined(GL_SPOT_EXPONENT) @@ -2318,9 +2545,15 @@ android_glLightxv__IILjava_nio_IntBuffer_2 break; } if (_remaining < _needed) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < needed"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < needed"; goto exit; } + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfixed *) (_paramsBase + _bufferOffset); + } glLightxv( (GLenum)light, (GLenum)pname, @@ -2331,6 +2564,9 @@ android_glLightxv__IILjava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, params, JNI_FALSE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glLineWidth ( GLfloat width ) */ @@ -2362,16 +2598,23 @@ android_glLoadIdentity__ static void android_glLoadMatrixf___3FI (JNIEnv *_env, jobject _this, jfloatArray m_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfloat *m_base = (GLfloat *) 0; jint _remaining; GLfloat *m = (GLfloat *) 0; if (!m_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "m == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "m == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(m_ref) - offset; @@ -2388,6 +2631,9 @@ android_glLoadMatrixf___3FI _env->ReleasePrimitiveArrayCritical(m_ref, m_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glLoadMatrixf ( const GLfloat *m ) */ @@ -2395,10 +2641,15 @@ static void android_glLoadMatrixf__Ljava_nio_FloatBuffer_2 (JNIEnv *_env, jobject _this, jobject m_buf) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfloat *m = (GLfloat *) 0; - m = (GLfloat *)getPointer(_env, m_buf, &_array, &_remaining); + m = (GLfloat *)getPointer(_env, m_buf, &_array, &_remaining, &_bufferOffset); + if (m == NULL) { + char * _mBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + m = (GLfloat *) (_mBase + _bufferOffset); + } glLoadMatrixf( (GLfloat *)m ); @@ -2411,16 +2662,23 @@ android_glLoadMatrixf__Ljava_nio_FloatBuffer_2 static void android_glLoadMatrixx___3II (JNIEnv *_env, jobject _this, jintArray m_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfixed *m_base = (GLfixed *) 0; jint _remaining; GLfixed *m = (GLfixed *) 0; if (!m_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "m == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "m == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(m_ref) - offset; @@ -2437,6 +2695,9 @@ android_glLoadMatrixx___3II _env->ReleasePrimitiveArrayCritical(m_ref, m_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glLoadMatrixx ( const GLfixed *m ) */ @@ -2444,10 +2705,15 @@ static void android_glLoadMatrixx__Ljava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jobject m_buf) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfixed *m = (GLfixed *) 0; - m = (GLfixed *)getPointer(_env, m_buf, &_array, &_remaining); + m = (GLfixed *)getPointer(_env, m_buf, &_array, &_remaining, &_bufferOffset); + if (m == NULL) { + char * _mBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + m = (GLfixed *) (_mBase + _bufferOffset); + } glLoadMatrixx( (GLfixed *)m ); @@ -2480,16 +2746,23 @@ android_glMaterialf__IIF static void android_glMaterialfv__II_3FI (JNIEnv *_env, jobject _this, jint face, jint pname, jfloatArray params_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfloat *params_base = (GLfloat *) 0; jint _remaining; GLfloat *params = (GLfloat *) 0; if (!params_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -2522,7 +2795,9 @@ android_glMaterialfv__II_3FI break; } if (_remaining < _needed) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < needed"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < needed"; goto exit; } params_base = (GLfloat *) @@ -2540,17 +2815,24 @@ android_glMaterialfv__II_3FI _env->ReleasePrimitiveArrayCritical(params_ref, params_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glMaterialfv ( GLenum face, GLenum pname, const GLfloat *params ) */ static void android_glMaterialfv__IILjava_nio_FloatBuffer_2 (JNIEnv *_env, jobject _this, jint face, jint pname, jobject params_buf) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfloat *params = (GLfloat *) 0; - params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); int _needed; switch (pname) { #if defined(GL_SHININESS) @@ -2580,9 +2862,15 @@ android_glMaterialfv__IILjava_nio_FloatBuffer_2 break; } if (_remaining < _needed) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < needed"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < needed"; goto exit; } + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfloat *) (_paramsBase + _bufferOffset); + } glMaterialfv( (GLenum)face, (GLenum)pname, @@ -2593,6 +2881,9 @@ android_glMaterialfv__IILjava_nio_FloatBuffer_2 if (_array) { releasePointer(_env, _array, params, JNI_FALSE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glMaterialx ( GLenum face, GLenum pname, GLfixed param ) */ @@ -2610,16 +2901,23 @@ android_glMaterialx__III static void android_glMaterialxv__II_3II (JNIEnv *_env, jobject _this, jint face, jint pname, jintArray params_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfixed *params_base = (GLfixed *) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; if (!params_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -2652,7 +2950,9 @@ android_glMaterialxv__II_3II break; } if (_remaining < _needed) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < needed"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < needed"; goto exit; } params_base = (GLfixed *) @@ -2670,17 +2970,24 @@ android_glMaterialxv__II_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glMaterialxv ( GLenum face, GLenum pname, const GLfixed *params ) */ static void android_glMaterialxv__IILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint face, jint pname, jobject params_buf) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; - params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); int _needed; switch (pname) { #if defined(GL_SHININESS) @@ -2710,9 +3017,15 @@ android_glMaterialxv__IILjava_nio_IntBuffer_2 break; } if (_remaining < _needed) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < needed"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < needed"; goto exit; } + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfixed *) (_paramsBase + _bufferOffset); + } glMaterialxv( (GLenum)face, (GLenum)pname, @@ -2723,6 +3036,9 @@ android_glMaterialxv__IILjava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, params, JNI_FALSE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glMatrixMode ( GLenum mode ) */ @@ -2738,16 +3054,23 @@ android_glMatrixMode__I static void android_glMultMatrixf___3FI (JNIEnv *_env, jobject _this, jfloatArray m_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfloat *m_base = (GLfloat *) 0; jint _remaining; GLfloat *m = (GLfloat *) 0; if (!m_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "m == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "m == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(m_ref) - offset; @@ -2764,6 +3087,9 @@ android_glMultMatrixf___3FI _env->ReleasePrimitiveArrayCritical(m_ref, m_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glMultMatrixf ( const GLfloat *m ) */ @@ -2771,10 +3097,15 @@ static void android_glMultMatrixf__Ljava_nio_FloatBuffer_2 (JNIEnv *_env, jobject _this, jobject m_buf) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfloat *m = (GLfloat *) 0; - m = (GLfloat *)getPointer(_env, m_buf, &_array, &_remaining); + m = (GLfloat *)getPointer(_env, m_buf, &_array, &_remaining, &_bufferOffset); + if (m == NULL) { + char * _mBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + m = (GLfloat *) (_mBase + _bufferOffset); + } glMultMatrixf( (GLfloat *)m ); @@ -2787,16 +3118,23 @@ android_glMultMatrixf__Ljava_nio_FloatBuffer_2 static void android_glMultMatrixx___3II (JNIEnv *_env, jobject _this, jintArray m_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfixed *m_base = (GLfixed *) 0; jint _remaining; GLfixed *m = (GLfixed *) 0; if (!m_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "m == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "m == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(m_ref) - offset; @@ -2813,6 +3151,9 @@ android_glMultMatrixx___3II _env->ReleasePrimitiveArrayCritical(m_ref, m_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glMultMatrixx ( const GLfixed *m ) */ @@ -2820,10 +3161,15 @@ static void android_glMultMatrixx__Ljava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jobject m_buf) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfixed *m = (GLfixed *) 0; - m = (GLfixed *)getPointer(_env, m_buf, &_array, &_remaining); + m = (GLfixed *)getPointer(_env, m_buf, &_array, &_remaining, &_bufferOffset); + if (m == NULL) { + char * _mBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + m = (GLfixed *) (_mBase + _bufferOffset); + } glMultMatrixx( (GLfixed *)m ); @@ -2885,6 +3231,7 @@ static void android_glNormalPointerBounds__IILjava_nio_Buffer_2I (JNIEnv *_env, jobject _this, jint type, jint stride, jobject pointer_buf, jint remaining) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLvoid *pointer = (GLvoid *) 0; @@ -2996,12 +3343,16 @@ android_glPushMatrix__ static void android_glReadPixels__IIIIIILjava_nio_Buffer_2 (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height, jint format, jint type, jobject pixels_buf) { - jint _exception = 0; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLvoid *pixels = (GLvoid *) 0; - pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining); + pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining, &_bufferOffset); + if (pixels == NULL) { + char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + pixels = (GLvoid *) (_pixelsBase + _bufferOffset); + } glReadPixels( (GLint)x, (GLint)y, @@ -3012,7 +3363,7 @@ android_glReadPixels__IIIIIILjava_nio_Buffer_2 (GLvoid *)pixels ); if (_array) { - releasePointer(_env, _array, pixels, _exception ? JNI_FALSE : JNI_TRUE); + releasePointer(_env, _array, pixels, JNI_TRUE); } } @@ -3139,6 +3490,7 @@ static void android_glTexCoordPointerBounds__IIILjava_nio_Buffer_2I (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jobject pointer_buf, jint remaining) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLvoid *pointer = (GLvoid *) 0; @@ -3172,16 +3524,23 @@ android_glTexEnvf__IIF static void android_glTexEnvfv__II_3FI (JNIEnv *_env, jobject _this, jint target, jint pname, jfloatArray params_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfloat *params_base = (GLfloat *) 0; jint _remaining; GLfloat *params = (GLfloat *) 0; if (!params_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -3208,7 +3567,9 @@ android_glTexEnvfv__II_3FI break; } if (_remaining < _needed) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < needed"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < needed"; goto exit; } params_base = (GLfloat *) @@ -3226,17 +3587,24 @@ android_glTexEnvfv__II_3FI _env->ReleasePrimitiveArrayCritical(params_ref, params_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glTexEnvfv ( GLenum target, GLenum pname, const GLfloat *params ) */ static void android_glTexEnvfv__IILjava_nio_FloatBuffer_2 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfloat *params = (GLfloat *) 0; - params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); int _needed; switch (pname) { #if defined(GL_TEXTURE_ENV_MODE) @@ -3260,9 +3628,15 @@ android_glTexEnvfv__IILjava_nio_FloatBuffer_2 break; } if (_remaining < _needed) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < needed"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < needed"; goto exit; } + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfloat *) (_paramsBase + _bufferOffset); + } glTexEnvfv( (GLenum)target, (GLenum)pname, @@ -3273,6 +3647,9 @@ android_glTexEnvfv__IILjava_nio_FloatBuffer_2 if (_array) { releasePointer(_env, _array, params, JNI_FALSE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glTexEnvx ( GLenum target, GLenum pname, GLfixed param ) */ @@ -3290,16 +3667,23 @@ android_glTexEnvx__III static void android_glTexEnvxv__II_3II (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfixed *params_base = (GLfixed *) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; if (!params_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -3326,7 +3710,9 @@ android_glTexEnvxv__II_3II break; } if (_remaining < _needed) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < needed"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < needed"; goto exit; } params_base = (GLfixed *) @@ -3344,17 +3730,24 @@ android_glTexEnvxv__II_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glTexEnvxv ( GLenum target, GLenum pname, const GLfixed *params ) */ static void android_glTexEnvxv__IILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; - params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); int _needed; switch (pname) { #if defined(GL_TEXTURE_ENV_MODE) @@ -3378,9 +3771,15 @@ android_glTexEnvxv__IILjava_nio_IntBuffer_2 break; } if (_remaining < _needed) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < needed"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < needed"; goto exit; } + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfixed *) (_paramsBase + _bufferOffset); + } glTexEnvxv( (GLenum)target, (GLenum)pname, @@ -3391,6 +3790,9 @@ android_glTexEnvxv__IILjava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, params, JNI_FALSE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glTexImage2D ( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels ) */ @@ -3398,11 +3800,16 @@ static void android_glTexImage2D__IIIIIIIILjava_nio_Buffer_2 (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint width, jint height, jint border, jint format, jint type, jobject pixels_buf) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLvoid *pixels = (GLvoid *) 0; if (pixels_buf) { - pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining); + pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining, &_bufferOffset); + } + if (pixels_buf && pixels == NULL) { + char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + pixels = (GLvoid *) (_pixelsBase + _bufferOffset); } glTexImage2D( (GLenum)target, @@ -3447,11 +3854,16 @@ static void android_glTexSubImage2D__IIIIIIIILjava_nio_Buffer_2 (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint width, jint height, jint format, jint type, jobject pixels_buf) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLvoid *pixels = (GLvoid *) 0; if (pixels_buf) { - pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining); + pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining, &_bufferOffset); + } + if (pixels_buf && pixels == NULL) { + char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + pixels = (GLvoid *) (_pixelsBase + _bufferOffset); } glTexSubImage2D( (GLenum)target, @@ -3496,6 +3908,7 @@ static void android_glVertexPointerBounds__IIILjava_nio_Buffer_2I (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jobject pointer_buf, jint remaining) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLvoid *pointer = (GLvoid *) 0; @@ -3531,6 +3944,8 @@ static jint android_glQueryMatrixxOES___3II_3II (JNIEnv *_env, jobject _this, jintArray mantissa_ref, jint mantissaOffset, jintArray exponent_ref, jint exponentOffset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLbitfield _returnValue = -1; GLfixed *mantissa_base = (GLfixed *) 0; jint _mantissaRemaining; @@ -3541,18 +3956,21 @@ android_glQueryMatrixxOES___3II_3II if (!mantissa_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "mantissa == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "mantissa == null"; goto exit; } if (mantissaOffset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "mantissaOffset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "mantissaOffset < 0"; goto exit; } _mantissaRemaining = _env->GetArrayLength(mantissa_ref) - mantissaOffset; if (_mantissaRemaining < 16) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - mantissaOffset < 16"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - mantissaOffset < 16 < needed"; goto exit; } mantissa_base = (GLfixed *) @@ -3561,18 +3979,21 @@ android_glQueryMatrixxOES___3II_3II if (!exponent_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "exponent == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "exponent == null"; goto exit; } if (exponentOffset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "exponentOffset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "exponentOffset < 0"; goto exit; } _exponentRemaining = _env->GetArrayLength(exponent_ref) - exponentOffset; if (_exponentRemaining < 16) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - exponentOffset < 16"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - exponentOffset < 16 < needed"; goto exit; } exponent_base = (GLint *) @@ -3593,6 +4014,9 @@ android_glQueryMatrixxOES___3II_3II _env->ReleasePrimitiveArrayCritical(mantissa_ref, mantissa_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } return _returnValue; } @@ -3601,37 +4025,54 @@ static jint android_glQueryMatrixxOES__Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jobject mantissa_buf, jobject exponent_buf) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _mantissaArray = (jarray) 0; + jint _mantissaBufferOffset = (jint) 0; jarray _exponentArray = (jarray) 0; + jint _exponentBufferOffset = (jint) 0; GLbitfield _returnValue = -1; jint _mantissaRemaining; GLfixed *mantissa = (GLfixed *) 0; jint _exponentRemaining; GLint *exponent = (GLint *) 0; - mantissa = (GLfixed *)getPointer(_env, mantissa_buf, &_mantissaArray, &_mantissaRemaining); + mantissa = (GLfixed *)getPointer(_env, mantissa_buf, &_mantissaArray, &_mantissaRemaining, &_mantissaBufferOffset); if (_mantissaRemaining < 16) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < 16"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < 16 < needed"; goto exit; } - exponent = (GLint *)getPointer(_env, exponent_buf, &_exponentArray, &_exponentRemaining); + exponent = (GLint *)getPointer(_env, exponent_buf, &_exponentArray, &_exponentRemaining, &_exponentBufferOffset); if (_exponentRemaining < 16) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < 16"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < 16 < needed"; goto exit; } + if (mantissa == NULL) { + char * _mantissaBase = (char *)_env->GetPrimitiveArrayCritical(_mantissaArray, (jboolean *) 0); + mantissa = (GLfixed *) (_mantissaBase + _mantissaBufferOffset); + } + if (exponent == NULL) { + char * _exponentBase = (char *)_env->GetPrimitiveArrayCritical(_exponentArray, (jboolean *) 0); + exponent = (GLint *) (_exponentBase + _exponentBufferOffset); + } _returnValue = glQueryMatrixxOES( (GLfixed *)mantissa, (GLint *)exponent ); exit: + if (_exponentArray) { + releasePointer(_env, _exponentArray, exponent, _exception ? JNI_FALSE : JNI_TRUE); + } if (_mantissaArray) { - releasePointer(_env, _mantissaArray, exponent, _exception ? JNI_FALSE : JNI_TRUE); + releasePointer(_env, _mantissaArray, mantissa, _exception ? JNI_FALSE : JNI_TRUE); } - if (_exponentArray) { - releasePointer(_env, _exponentArray, mantissa, _exception ? JNI_FALSE : JNI_TRUE); + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); } return _returnValue; } @@ -3650,17 +4091,27 @@ android_glBindBuffer__II static void android_glBufferData__IILjava_nio_Buffer_2I (JNIEnv *_env, jobject _this, jint target, jint size, jobject data_buf, jint usage) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLvoid *data = (GLvoid *) 0; if (data_buf) { - data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining); + data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < size) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < size"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < size < needed"; goto exit; } } + if (data_buf && data == NULL) { + char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + data = (GLvoid *) (_dataBase + _bufferOffset); + } glBufferData( (GLenum)target, (GLsizeiptr)size, @@ -3672,21 +4123,34 @@ android_glBufferData__IILjava_nio_Buffer_2I if (_array) { releasePointer(_env, _array, data, JNI_FALSE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glBufferSubData ( GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data ) */ static void android_glBufferSubData__IIILjava_nio_Buffer_2 (JNIEnv *_env, jobject _this, jint target, jint offset, jint size, jobject data_buf) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLvoid *data = (GLvoid *) 0; - data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining); + data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < size) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < size"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < size < needed"; goto exit; } + if (data == NULL) { + char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + data = (GLvoid *) (_dataBase + _bufferOffset); + } glBufferSubData( (GLenum)target, (GLintptr)offset, @@ -3698,27 +4162,39 @@ android_glBufferSubData__IIILjava_nio_Buffer_2 if (_array) { releasePointer(_env, _array, data, JNI_FALSE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glClipPlanef ( GLenum plane, const GLfloat *equation ) */ static void android_glClipPlanef__I_3FI (JNIEnv *_env, jobject _this, jint plane, jfloatArray equation_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfloat *equation_base = (GLfloat *) 0; jint _remaining; GLfloat *equation = (GLfloat *) 0; if (!equation_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "equation == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "equation == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(equation_ref) - offset; if (_remaining < 4) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < 4"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < 4 < needed"; goto exit; } equation_base = (GLfloat *) @@ -3735,21 +4211,34 @@ android_glClipPlanef__I_3FI _env->ReleasePrimitiveArrayCritical(equation_ref, equation_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glClipPlanef ( GLenum plane, const GLfloat *equation ) */ static void android_glClipPlanef__ILjava_nio_FloatBuffer_2 (JNIEnv *_env, jobject _this, jint plane, jobject equation_buf) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfloat *equation = (GLfloat *) 0; - equation = (GLfloat *)getPointer(_env, equation_buf, &_array, &_remaining); + equation = (GLfloat *)getPointer(_env, equation_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < 4) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < 4"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < 4 < needed"; goto exit; } + if (equation == NULL) { + char * _equationBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + equation = (GLfloat *) (_equationBase + _bufferOffset); + } glClipPlanef( (GLenum)plane, (GLfloat *)equation @@ -3759,27 +4248,39 @@ android_glClipPlanef__ILjava_nio_FloatBuffer_2 if (_array) { releasePointer(_env, _array, equation, JNI_FALSE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glClipPlanex ( GLenum plane, const GLfixed *equation ) */ static void android_glClipPlanex__I_3II (JNIEnv *_env, jobject _this, jint plane, jintArray equation_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfixed *equation_base = (GLfixed *) 0; jint _remaining; GLfixed *equation = (GLfixed *) 0; if (!equation_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "equation == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "equation == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(equation_ref) - offset; if (_remaining < 4) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < 4"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < 4 < needed"; goto exit; } equation_base = (GLfixed *) @@ -3796,21 +4297,34 @@ android_glClipPlanex__I_3II _env->ReleasePrimitiveArrayCritical(equation_ref, equation_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glClipPlanex ( GLenum plane, const GLfixed *equation ) */ static void android_glClipPlanex__ILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint plane, jobject equation_buf) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfixed *equation = (GLfixed *) 0; - equation = (GLfixed *)getPointer(_env, equation_buf, &_array, &_remaining); + equation = (GLfixed *)getPointer(_env, equation_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < 4) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < 4"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < 4 < needed"; goto exit; } + if (equation == NULL) { + char * _equationBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + equation = (GLfixed *) (_equationBase + _bufferOffset); + } glClipPlanex( (GLenum)plane, (GLfixed *)equation @@ -3820,6 +4334,9 @@ android_glClipPlanex__ILjava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, equation, JNI_FALSE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glColor4ub ( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha ) */ @@ -3850,21 +4367,30 @@ android_glColorPointer__IIII static void android_glDeleteBuffers__I_3II (JNIEnv *_env, jobject _this, jint n, jintArray buffers_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLuint *buffers_base = (GLuint *) 0; jint _remaining; GLuint *buffers = (GLuint *) 0; if (!buffers_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "buffers == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "buffers == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(buffers_ref) - offset; if (_remaining < n) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < n"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < n < needed"; goto exit; } buffers_base = (GLuint *) @@ -3881,21 +4407,34 @@ android_glDeleteBuffers__I_3II _env->ReleasePrimitiveArrayCritical(buffers_ref, buffers_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glDeleteBuffers ( GLsizei n, const GLuint *buffers ) */ static void android_glDeleteBuffers__ILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint n, jobject buffers_buf) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLuint *buffers = (GLuint *) 0; - buffers = (GLuint *)getPointer(_env, buffers_buf, &_array, &_remaining); + buffers = (GLuint *)getPointer(_env, buffers_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < n) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < n"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < n < needed"; goto exit; } + if (buffers == NULL) { + char * _buffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + buffers = (GLuint *) (_buffersBase + _bufferOffset); + } glDeleteBuffers( (GLsizei)n, (GLuint *)buffers @@ -3905,18 +4444,27 @@ android_glDeleteBuffers__ILjava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, buffers, JNI_FALSE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glDrawElements ( GLenum mode, GLsizei count, GLenum type, GLint offset ) */ static void android_glDrawElements__IIII (JNIEnv *_env, jobject _this, jint mode, jint count, jint type, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; glDrawElements( (GLenum)mode, (GLsizei)count, (GLenum)type, (const GLvoid *)offset ); + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGenBuffers ( GLsizei n, GLuint *buffers ) */ @@ -3924,24 +4472,29 @@ static void android_glGenBuffers__I_3II (JNIEnv *_env, jobject _this, jint n, jintArray buffers_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLuint *buffers_base = (GLuint *) 0; jint _remaining; GLuint *buffers = (GLuint *) 0; if (!buffers_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "buffers == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "buffers == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(buffers_ref) - offset; if (_remaining < n) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < n"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < n < needed"; goto exit; } buffers_base = (GLuint *) @@ -3958,6 +4511,9 @@ android_glGenBuffers__I_3II _env->ReleasePrimitiveArrayCritical(buffers_ref, buffers_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGenBuffers ( GLsizei n, GLuint *buffers ) */ @@ -3965,16 +4521,24 @@ static void android_glGenBuffers__ILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint n, jobject buffers_buf) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLuint *buffers = (GLuint *) 0; - buffers = (GLuint *)getPointer(_env, buffers_buf, &_array, &_remaining); + buffers = (GLuint *)getPointer(_env, buffers_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < n) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < n"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < n < needed"; goto exit; } + if (buffers == NULL) { + char * _buffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + buffers = (GLuint *) (_buffersBase + _bufferOffset); + } glGenBuffers( (GLsizei)n, (GLuint *)buffers @@ -3984,6 +4548,9 @@ android_glGenBuffers__ILjava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, buffers, _exception ? JNI_FALSE : JNI_TRUE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetBooleanv ( GLenum pname, GLboolean *params ) */ @@ -3991,18 +4558,22 @@ static void android_glGetBooleanv__I_3ZI (JNIEnv *_env, jobject _this, jint pname, jbooleanArray params_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLboolean *params_base = (GLboolean *) 0; jint _remaining; GLboolean *params = (GLboolean *) 0; if (!params_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -4020,24 +4591,31 @@ android_glGetBooleanv__I_3ZI _env->ReleasePrimitiveArrayCritical(params_ref, params_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetBooleanv ( GLenum pname, GLboolean *params ) */ static void android_glGetBooleanv__ILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { - jint _exception = 0; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLboolean *params = (GLboolean *) 0; - params = (GLboolean *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLboolean *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLboolean *) (_paramsBase + _bufferOffset); + } glGetBooleanv( (GLenum)pname, (GLboolean *)params ); if (_array) { - releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + releasePointer(_env, _array, params, JNI_TRUE); } } @@ -4062,18 +4640,22 @@ static void android_glGetClipPlanef__I_3FI (JNIEnv *_env, jobject _this, jint pname, jfloatArray eqn_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfloat *eqn_base = (GLfloat *) 0; jint _remaining; GLfloat *eqn = (GLfloat *) 0; if (!eqn_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "eqn == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "eqn == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(eqn_ref) - offset; @@ -4091,24 +4673,31 @@ android_glGetClipPlanef__I_3FI _env->ReleasePrimitiveArrayCritical(eqn_ref, eqn_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetClipPlanef ( GLenum pname, GLfloat *eqn ) */ static void android_glGetClipPlanef__ILjava_nio_FloatBuffer_2 (JNIEnv *_env, jobject _this, jint pname, jobject eqn_buf) { - jint _exception = 0; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfloat *eqn = (GLfloat *) 0; - eqn = (GLfloat *)getPointer(_env, eqn_buf, &_array, &_remaining); + eqn = (GLfloat *)getPointer(_env, eqn_buf, &_array, &_remaining, &_bufferOffset); + if (eqn == NULL) { + char * _eqnBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + eqn = (GLfloat *) (_eqnBase + _bufferOffset); + } glGetClipPlanef( (GLenum)pname, (GLfloat *)eqn ); if (_array) { - releasePointer(_env, _array, eqn, _exception ? JNI_FALSE : JNI_TRUE); + releasePointer(_env, _array, eqn, JNI_TRUE); } } @@ -4117,18 +4706,22 @@ static void android_glGetClipPlanex__I_3II (JNIEnv *_env, jobject _this, jint pname, jintArray eqn_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfixed *eqn_base = (GLfixed *) 0; jint _remaining; GLfixed *eqn = (GLfixed *) 0; if (!eqn_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "eqn == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "eqn == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(eqn_ref) - offset; @@ -4146,24 +4739,31 @@ android_glGetClipPlanex__I_3II _env->ReleasePrimitiveArrayCritical(eqn_ref, eqn_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetClipPlanex ( GLenum pname, GLfixed *eqn ) */ static void android_glGetClipPlanex__ILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint pname, jobject eqn_buf) { - jint _exception = 0; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfixed *eqn = (GLfixed *) 0; - eqn = (GLfixed *)getPointer(_env, eqn_buf, &_array, &_remaining); + eqn = (GLfixed *)getPointer(_env, eqn_buf, &_array, &_remaining, &_bufferOffset); + if (eqn == NULL) { + char * _eqnBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + eqn = (GLfixed *) (_eqnBase + _bufferOffset); + } glGetClipPlanex( (GLenum)pname, (GLfixed *)eqn ); if (_array) { - releasePointer(_env, _array, eqn, _exception ? JNI_FALSE : JNI_TRUE); + releasePointer(_env, _array, eqn, JNI_TRUE); } } @@ -4172,18 +4772,22 @@ static void android_glGetFixedv__I_3II (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfixed *params_base = (GLfixed *) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; if (!params_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -4201,24 +4805,31 @@ android_glGetFixedv__I_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetFixedv ( GLenum pname, GLfixed *params ) */ static void android_glGetFixedv__ILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { - jint _exception = 0; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; - params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfixed *) (_paramsBase + _bufferOffset); + } glGetFixedv( (GLenum)pname, (GLfixed *)params ); if (_array) { - releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + releasePointer(_env, _array, params, JNI_TRUE); } } @@ -4227,18 +4838,22 @@ static void android_glGetFloatv__I_3FI (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfloat *params_base = (GLfloat *) 0; jint _remaining; GLfloat *params = (GLfloat *) 0; if (!params_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -4256,24 +4871,31 @@ android_glGetFloatv__I_3FI _env->ReleasePrimitiveArrayCritical(params_ref, params_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetFloatv ( GLenum pname, GLfloat *params ) */ static void android_glGetFloatv__ILjava_nio_FloatBuffer_2 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { - jint _exception = 0; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfloat *params = (GLfloat *) 0; - params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfloat *) (_paramsBase + _bufferOffset); + } glGetFloatv( (GLenum)pname, (GLfloat *)params ); if (_array) { - releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + releasePointer(_env, _array, params, JNI_TRUE); } } @@ -4282,18 +4904,22 @@ static void android_glGetLightfv__II_3FI (JNIEnv *_env, jobject _this, jint light, jint pname, jfloatArray params_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfloat *params_base = (GLfloat *) 0; jint _remaining; GLfloat *params = (GLfloat *) 0; if (!params_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -4341,7 +4967,8 @@ android_glGetLightfv__II_3FI } if (_remaining < _needed) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < needed"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < needed"; goto exit; } params_base = (GLfloat *) @@ -4359,6 +4986,9 @@ android_glGetLightfv__II_3FI _env->ReleasePrimitiveArrayCritical(params_ref, params_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetLightfv ( GLenum light, GLenum pname, GLfloat *params ) */ @@ -4366,11 +4996,14 @@ static void android_glGetLightfv__IILjava_nio_FloatBuffer_2 (JNIEnv *_env, jobject _this, jint light, jint pname, jobject params_buf) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfloat *params = (GLfloat *) 0; - params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); int _needed; switch (pname) { #if defined(GL_SPOT_EXPONENT) @@ -4415,9 +5048,14 @@ android_glGetLightfv__IILjava_nio_FloatBuffer_2 } if (_remaining < _needed) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < needed"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < needed"; goto exit; } + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfloat *) (_paramsBase + _bufferOffset); + } glGetLightfv( (GLenum)light, (GLenum)pname, @@ -4428,6 +5066,9 @@ android_glGetLightfv__IILjava_nio_FloatBuffer_2 if (_array) { releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetLightxv ( GLenum light, GLenum pname, GLfixed *params ) */ @@ -4435,18 +5076,22 @@ static void android_glGetLightxv__II_3II (JNIEnv *_env, jobject _this, jint light, jint pname, jintArray params_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfixed *params_base = (GLfixed *) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; if (!params_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -4494,7 +5139,8 @@ android_glGetLightxv__II_3II } if (_remaining < _needed) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < needed"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < needed"; goto exit; } params_base = (GLfixed *) @@ -4512,6 +5158,9 @@ android_glGetLightxv__II_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetLightxv ( GLenum light, GLenum pname, GLfixed *params ) */ @@ -4519,11 +5168,14 @@ static void android_glGetLightxv__IILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint light, jint pname, jobject params_buf) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; - params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); int _needed; switch (pname) { #if defined(GL_SPOT_EXPONENT) @@ -4568,9 +5220,14 @@ android_glGetLightxv__IILjava_nio_IntBuffer_2 } if (_remaining < _needed) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < needed"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < needed"; goto exit; } + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfixed *) (_paramsBase + _bufferOffset); + } glGetLightxv( (GLenum)light, (GLenum)pname, @@ -4581,6 +5238,9 @@ android_glGetLightxv__IILjava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetMaterialfv ( GLenum face, GLenum pname, GLfloat *params ) */ @@ -4588,18 +5248,22 @@ static void android_glGetMaterialfv__II_3FI (JNIEnv *_env, jobject _this, jint face, jint pname, jfloatArray params_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfloat *params_base = (GLfloat *) 0; jint _remaining; GLfloat *params = (GLfloat *) 0; if (!params_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -4633,7 +5297,8 @@ android_glGetMaterialfv__II_3FI } if (_remaining < _needed) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < needed"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < needed"; goto exit; } params_base = (GLfloat *) @@ -4651,6 +5316,9 @@ android_glGetMaterialfv__II_3FI _env->ReleasePrimitiveArrayCritical(params_ref, params_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetMaterialfv ( GLenum face, GLenum pname, GLfloat *params ) */ @@ -4658,11 +5326,14 @@ static void android_glGetMaterialfv__IILjava_nio_FloatBuffer_2 (JNIEnv *_env, jobject _this, jint face, jint pname, jobject params_buf) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfloat *params = (GLfloat *) 0; - params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); int _needed; switch (pname) { #if defined(GL_SHININESS) @@ -4693,9 +5364,14 @@ android_glGetMaterialfv__IILjava_nio_FloatBuffer_2 } if (_remaining < _needed) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < needed"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < needed"; goto exit; } + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfloat *) (_paramsBase + _bufferOffset); + } glGetMaterialfv( (GLenum)face, (GLenum)pname, @@ -4706,6 +5382,9 @@ android_glGetMaterialfv__IILjava_nio_FloatBuffer_2 if (_array) { releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetMaterialxv ( GLenum face, GLenum pname, GLfixed *params ) */ @@ -4713,18 +5392,22 @@ static void android_glGetMaterialxv__II_3II (JNIEnv *_env, jobject _this, jint face, jint pname, jintArray params_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfixed *params_base = (GLfixed *) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; if (!params_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -4758,7 +5441,8 @@ android_glGetMaterialxv__II_3II } if (_remaining < _needed) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < needed"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < needed"; goto exit; } params_base = (GLfixed *) @@ -4776,6 +5460,9 @@ android_glGetMaterialxv__II_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetMaterialxv ( GLenum face, GLenum pname, GLfixed *params ) */ @@ -4783,11 +5470,14 @@ static void android_glGetMaterialxv__IILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint face, jint pname, jobject params_buf) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; - params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); int _needed; switch (pname) { #if defined(GL_SHININESS) @@ -4818,9 +5508,14 @@ android_glGetMaterialxv__IILjava_nio_IntBuffer_2 } if (_remaining < _needed) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < needed"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < needed"; goto exit; } + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfixed *) (_paramsBase + _bufferOffset); + } glGetMaterialxv( (GLenum)face, (GLenum)pname, @@ -4831,6 +5526,9 @@ android_glGetMaterialxv__IILjava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetTexEnviv ( GLenum env, GLenum pname, GLint *params ) */ @@ -4838,18 +5536,22 @@ static void android_glGetTexEnviv__II_3II (JNIEnv *_env, jobject _this, jint env, jint pname, jintArray params_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLint *params_base = (GLint *) 0; jint _remaining; GLint *params = (GLint *) 0; if (!params_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -4877,7 +5579,8 @@ android_glGetTexEnviv__II_3II } if (_remaining < _needed) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < needed"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < needed"; goto exit; } params_base = (GLint *) @@ -4895,6 +5598,9 @@ android_glGetTexEnviv__II_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetTexEnviv ( GLenum env, GLenum pname, GLint *params ) */ @@ -4902,11 +5608,14 @@ static void android_glGetTexEnviv__IILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint env, jint pname, jobject params_buf) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLint *params = (GLint *) 0; - params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); int _needed; switch (pname) { #if defined(GL_TEXTURE_ENV_MODE) @@ -4931,9 +5640,14 @@ android_glGetTexEnviv__IILjava_nio_IntBuffer_2 } if (_remaining < _needed) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < needed"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < needed"; goto exit; } + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLint *) (_paramsBase + _bufferOffset); + } glGetTexEnviv( (GLenum)env, (GLenum)pname, @@ -4944,6 +5658,9 @@ android_glGetTexEnviv__IILjava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetTexEnvxv ( GLenum env, GLenum pname, GLfixed *params ) */ @@ -4951,18 +5668,22 @@ static void android_glGetTexEnvxv__II_3II (JNIEnv *_env, jobject _this, jint env, jint pname, jintArray params_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfixed *params_base = (GLfixed *) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; if (!params_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -4990,7 +5711,8 @@ android_glGetTexEnvxv__II_3II } if (_remaining < _needed) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < needed"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < needed"; goto exit; } params_base = (GLfixed *) @@ -5008,6 +5730,9 @@ android_glGetTexEnvxv__II_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetTexEnvxv ( GLenum env, GLenum pname, GLfixed *params ) */ @@ -5015,11 +5740,14 @@ static void android_glGetTexEnvxv__IILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint env, jint pname, jobject params_buf) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; - params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); int _needed; switch (pname) { #if defined(GL_TEXTURE_ENV_MODE) @@ -5044,9 +5772,14 @@ android_glGetTexEnvxv__IILjava_nio_IntBuffer_2 } if (_remaining < _needed) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < needed"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < needed"; goto exit; } + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfixed *) (_paramsBase + _bufferOffset); + } glGetTexEnvxv( (GLenum)env, (GLenum)pname, @@ -5057,6 +5790,9 @@ android_glGetTexEnvxv__IILjava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) */ @@ -5064,24 +5800,29 @@ static void android_glGetTexParameterfv__II_3FI (JNIEnv *_env, jobject _this, jint target, jint pname, jfloatArray params_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfloat *params_base = (GLfloat *) 0; jint _remaining; GLfloat *params = (GLfloat *) 0; if (!params_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; if (_remaining < 1) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < 1"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < 1 < needed"; goto exit; } params_base = (GLfloat *) @@ -5099,6 +5840,9 @@ android_glGetTexParameterfv__II_3FI _env->ReleasePrimitiveArrayCritical(params_ref, params_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) */ @@ -5106,16 +5850,24 @@ static void android_glGetTexParameterfv__IILjava_nio_FloatBuffer_2 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfloat *params = (GLfloat *) 0; - params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < 1) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < 1"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < 1 < needed"; goto exit; } + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfloat *) (_paramsBase + _bufferOffset); + } glGetTexParameterfv( (GLenum)target, (GLenum)pname, @@ -5126,6 +5878,9 @@ android_glGetTexParameterfv__IILjava_nio_FloatBuffer_2 if (_array) { releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) */ @@ -5133,24 +5888,29 @@ static void android_glGetTexParameteriv__II_3II (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLint *params_base = (GLint *) 0; jint _remaining; GLint *params = (GLint *) 0; if (!params_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; if (_remaining < 1) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < 1"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < 1 < needed"; goto exit; } params_base = (GLint *) @@ -5168,6 +5928,9 @@ android_glGetTexParameteriv__II_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) */ @@ -5175,16 +5938,24 @@ static void android_glGetTexParameteriv__IILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLint *params = (GLint *) 0; - params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < 1) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < 1"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < 1 < needed"; goto exit; } + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLint *) (_paramsBase + _bufferOffset); + } glGetTexParameteriv( (GLenum)target, (GLenum)pname, @@ -5195,6 +5966,9 @@ android_glGetTexParameteriv__IILjava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetTexParameterxv ( GLenum target, GLenum pname, GLfixed *params ) */ @@ -5202,24 +5976,29 @@ static void android_glGetTexParameterxv__II_3II (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfixed *params_base = (GLfixed *) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; if (!params_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; if (_remaining < 1) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < 1"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < 1 < needed"; goto exit; } params_base = (GLfixed *) @@ -5237,6 +6016,9 @@ android_glGetTexParameterxv__II_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetTexParameterxv ( GLenum target, GLenum pname, GLfixed *params ) */ @@ -5244,16 +6026,24 @@ static void android_glGetTexParameterxv__IILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; - params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < 1) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < 1"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < 1 < needed"; goto exit; } + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfixed *) (_paramsBase + _bufferOffset); + } glGetTexParameterxv( (GLenum)target, (GLenum)pname, @@ -5264,6 +6054,9 @@ android_glGetTexParameterxv__IILjava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* GLboolean glIsBuffer ( GLuint buffer ) */ @@ -5324,21 +6117,30 @@ android_glPointParameterf__IF static void android_glPointParameterfv__I_3FI (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfloat *params_base = (GLfloat *) 0; jint _remaining; GLfloat *params = (GLfloat *) 0; if (!params_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; if (_remaining < 1) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < 1"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < 1 < needed"; goto exit; } params_base = (GLfloat *) @@ -5355,21 +6157,34 @@ android_glPointParameterfv__I_3FI _env->ReleasePrimitiveArrayCritical(params_ref, params_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glPointParameterfv ( GLenum pname, const GLfloat *params ) */ static void android_glPointParameterfv__ILjava_nio_FloatBuffer_2 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfloat *params = (GLfloat *) 0; - params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < 1) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < 1"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < 1 < needed"; goto exit; } + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfloat *) (_paramsBase + _bufferOffset); + } glPointParameterfv( (GLenum)pname, (GLfloat *)params @@ -5379,6 +6194,9 @@ android_glPointParameterfv__ILjava_nio_FloatBuffer_2 if (_array) { releasePointer(_env, _array, params, JNI_FALSE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glPointParameterx ( GLenum pname, GLfixed param ) */ @@ -5395,21 +6213,30 @@ android_glPointParameterx__II static void android_glPointParameterxv__I_3II (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfixed *params_base = (GLfixed *) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; if (!params_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; if (_remaining < 1) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < 1"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < 1 < needed"; goto exit; } params_base = (GLfixed *) @@ -5426,21 +6253,34 @@ android_glPointParameterxv__I_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glPointParameterxv ( GLenum pname, const GLfixed *params ) */ static void android_glPointParameterxv__ILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; - params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < 1) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < 1"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < 1 < needed"; goto exit; } + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfixed *) (_paramsBase + _bufferOffset); + } glPointParameterxv( (GLenum)pname, (GLfixed *)params @@ -5450,6 +6290,9 @@ android_glPointParameterxv__ILjava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, params, JNI_FALSE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glPointSizePointerOES ( GLenum type, GLsizei stride, const GLvoid *pointer ) */ @@ -5457,6 +6300,7 @@ static void android_glPointSizePointerOESBounds__IILjava_nio_Buffer_2I (JNIEnv *_env, jobject _this, jint type, jint stride, jobject pointer_buf, jint remaining) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLvoid *pointer = (GLvoid *) 0; @@ -5501,16 +6345,23 @@ android_glTexEnvi__III static void android_glTexEnviv__II_3II (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLint *params_base = (GLint *) 0; jint _remaining; GLint *params = (GLint *) 0; if (!params_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -5537,7 +6388,9 @@ android_glTexEnviv__II_3II break; } if (_remaining < _needed) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < needed"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < needed"; goto exit; } params_base = (GLint *) @@ -5555,17 +6408,24 @@ android_glTexEnviv__II_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glTexEnviv ( GLenum target, GLenum pname, const GLint *params ) */ static void android_glTexEnviv__IILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLint *params = (GLint *) 0; - params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); int _needed; switch (pname) { #if defined(GL_TEXTURE_ENV_MODE) @@ -5589,9 +6449,15 @@ android_glTexEnviv__IILjava_nio_IntBuffer_2 break; } if (_remaining < _needed) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < needed"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < needed"; goto exit; } + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLint *) (_paramsBase + _bufferOffset); + } glTexEnviv( (GLenum)target, (GLenum)pname, @@ -5602,27 +6468,39 @@ android_glTexEnviv__IILjava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, params, JNI_FALSE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params ) */ static void android_glTexParameterfv__II_3FI (JNIEnv *_env, jobject _this, jint target, jint pname, jfloatArray params_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfloat *params_base = (GLfloat *) 0; jint _remaining; GLfloat *params = (GLfloat *) 0; if (!params_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; if (_remaining < 1) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < 1"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < 1 < needed"; goto exit; } params_base = (GLfloat *) @@ -5640,21 +6518,34 @@ android_glTexParameterfv__II_3FI _env->ReleasePrimitiveArrayCritical(params_ref, params_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params ) */ static void android_glTexParameterfv__IILjava_nio_FloatBuffer_2 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfloat *params = (GLfloat *) 0; - params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < 1) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < 1"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < 1 < needed"; goto exit; } + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfloat *) (_paramsBase + _bufferOffset); + } glTexParameterfv( (GLenum)target, (GLenum)pname, @@ -5665,6 +6556,9 @@ android_glTexParameterfv__IILjava_nio_FloatBuffer_2 if (_array) { releasePointer(_env, _array, params, JNI_FALSE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glTexParameteri ( GLenum target, GLenum pname, GLint param ) */ @@ -5682,21 +6576,30 @@ android_glTexParameteri__III static void android_glTexParameteriv__II_3II (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLint *params_base = (GLint *) 0; jint _remaining; GLint *params = (GLint *) 0; if (!params_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; if (_remaining < 1) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < 1"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < 1 < needed"; goto exit; } params_base = (GLint *) @@ -5714,21 +6617,34 @@ android_glTexParameteriv__II_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params ) */ static void android_glTexParameteriv__IILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLint *params = (GLint *) 0; - params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < 1) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < 1"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < 1 < needed"; goto exit; } + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLint *) (_paramsBase + _bufferOffset); + } glTexParameteriv( (GLenum)target, (GLenum)pname, @@ -5739,27 +6655,39 @@ android_glTexParameteriv__IILjava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, params, JNI_FALSE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glTexParameterxv ( GLenum target, GLenum pname, const GLfixed *params ) */ static void android_glTexParameterxv__II_3II (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfixed *params_base = (GLfixed *) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; if (!params_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; if (_remaining < 1) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < 1"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < 1 < needed"; goto exit; } params_base = (GLfixed *) @@ -5777,21 +6705,34 @@ android_glTexParameterxv__II_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glTexParameterxv ( GLenum target, GLenum pname, const GLfixed *params ) */ static void android_glTexParameterxv__IILjava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfixed *params = (GLfixed *) 0; - params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < 1) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < 1"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < 1 < needed"; goto exit; } + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfixed *) (_paramsBase + _bufferOffset); + } glTexParameterxv( (GLenum)target, (GLenum)pname, @@ -5802,6 +6743,9 @@ android_glTexParameterxv__IILjava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, params, JNI_FALSE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glVertexPointer ( GLint size, GLenum type, GLsizei stride, GLint offset ) */ @@ -5842,21 +6786,30 @@ android_glDrawTexfOES__FFFFF static void android_glDrawTexfvOES___3FI (JNIEnv *_env, jobject _this, jfloatArray coords_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfloat *coords_base = (GLfloat *) 0; jint _remaining; GLfloat *coords = (GLfloat *) 0; if (!coords_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "coords == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "coords == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(coords_ref) - offset; if (_remaining < 5) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < 5"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < 5 < needed"; goto exit; } coords_base = (GLfloat *) @@ -5872,21 +6825,34 @@ android_glDrawTexfvOES___3FI _env->ReleasePrimitiveArrayCritical(coords_ref, coords_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glDrawTexfvOES ( const GLfloat *coords ) */ static void android_glDrawTexfvOES__Ljava_nio_FloatBuffer_2 (JNIEnv *_env, jobject _this, jobject coords_buf) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfloat *coords = (GLfloat *) 0; - coords = (GLfloat *)getPointer(_env, coords_buf, &_array, &_remaining); + coords = (GLfloat *)getPointer(_env, coords_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < 5) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < 5"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < 5 < needed"; goto exit; } + if (coords == NULL) { + char * _coordsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + coords = (GLfloat *) (_coordsBase + _bufferOffset); + } glDrawTexfvOES( (GLfloat *)coords ); @@ -5895,6 +6861,9 @@ android_glDrawTexfvOES__Ljava_nio_FloatBuffer_2 if (_array) { releasePointer(_env, _array, coords, JNI_FALSE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glDrawTexiOES ( GLint x, GLint y, GLint z, GLint width, GLint height ) */ @@ -5914,21 +6883,30 @@ android_glDrawTexiOES__IIIII static void android_glDrawTexivOES___3II (JNIEnv *_env, jobject _this, jintArray coords_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLint *coords_base = (GLint *) 0; jint _remaining; GLint *coords = (GLint *) 0; if (!coords_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "coords == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "coords == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(coords_ref) - offset; if (_remaining < 5) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < 5"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < 5 < needed"; goto exit; } coords_base = (GLint *) @@ -5944,21 +6922,34 @@ android_glDrawTexivOES___3II _env->ReleasePrimitiveArrayCritical(coords_ref, coords_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glDrawTexivOES ( const GLint *coords ) */ static void android_glDrawTexivOES__Ljava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jobject coords_buf) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLint *coords = (GLint *) 0; - coords = (GLint *)getPointer(_env, coords_buf, &_array, &_remaining); + coords = (GLint *)getPointer(_env, coords_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < 5) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < 5"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < 5 < needed"; goto exit; } + if (coords == NULL) { + char * _coordsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + coords = (GLint *) (_coordsBase + _bufferOffset); + } glDrawTexivOES( (GLint *)coords ); @@ -5967,6 +6958,9 @@ android_glDrawTexivOES__Ljava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, coords, JNI_FALSE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glDrawTexsOES ( GLshort x, GLshort y, GLshort z, GLshort width, GLshort height ) */ @@ -5986,21 +6980,30 @@ android_glDrawTexsOES__SSSSS static void android_glDrawTexsvOES___3SI (JNIEnv *_env, jobject _this, jshortArray coords_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLshort *coords_base = (GLshort *) 0; jint _remaining; GLshort *coords = (GLshort *) 0; if (!coords_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "coords == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "coords == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(coords_ref) - offset; if (_remaining < 5) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < 5"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < 5 < needed"; goto exit; } coords_base = (GLshort *) @@ -6016,21 +7019,34 @@ android_glDrawTexsvOES___3SI _env->ReleasePrimitiveArrayCritical(coords_ref, coords_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glDrawTexsvOES ( const GLshort *coords ) */ static void android_glDrawTexsvOES__Ljava_nio_ShortBuffer_2 (JNIEnv *_env, jobject _this, jobject coords_buf) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLshort *coords = (GLshort *) 0; - coords = (GLshort *)getPointer(_env, coords_buf, &_array, &_remaining); + coords = (GLshort *)getPointer(_env, coords_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < 5) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < 5"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < 5 < needed"; goto exit; } + if (coords == NULL) { + char * _coordsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + coords = (GLshort *) (_coordsBase + _bufferOffset); + } glDrawTexsvOES( (GLshort *)coords ); @@ -6039,6 +7055,9 @@ android_glDrawTexsvOES__Ljava_nio_ShortBuffer_2 if (_array) { releasePointer(_env, _array, coords, JNI_FALSE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glDrawTexxOES ( GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height ) */ @@ -6058,21 +7077,30 @@ android_glDrawTexxOES__IIIII static void android_glDrawTexxvOES___3II (JNIEnv *_env, jobject _this, jintArray coords_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfixed *coords_base = (GLfixed *) 0; jint _remaining; GLfixed *coords = (GLfixed *) 0; if (!coords_ref) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "coords == null"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "coords == null"; goto exit; } if (offset < 0) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(coords_ref) - offset; if (_remaining < 5) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < 5"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < 5 < needed"; goto exit; } coords_base = (GLfixed *) @@ -6088,21 +7116,34 @@ android_glDrawTexxvOES___3II _env->ReleasePrimitiveArrayCritical(coords_ref, coords_base, JNI_ABORT); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glDrawTexxvOES ( const GLfixed *coords ) */ static void android_glDrawTexxvOES__Ljava_nio_IntBuffer_2 (JNIEnv *_env, jobject _this, jobject coords_buf) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfixed *coords = (GLfixed *) 0; - coords = (GLfixed *)getPointer(_env, coords_buf, &_array, &_remaining); + coords = (GLfixed *)getPointer(_env, coords_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < 5) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < 5"); + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < 5 < needed"; goto exit; } + if (coords == NULL) { + char * _coordsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + coords = (GLfixed *) (_coordsBase + _bufferOffset); + } glDrawTexxvOES( (GLfixed *)coords ); @@ -6111,6 +7152,9 @@ android_glDrawTexxvOES__Ljava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, coords, JNI_FALSE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glLoadPaletteFromModelViewMatrixOES ( void ) */ @@ -6125,6 +7169,7 @@ static void android_glMatrixIndexPointerOESBounds__IIILjava_nio_Buffer_2I (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jobject pointer_buf, jint remaining) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLvoid *pointer = (GLvoid *) 0; @@ -6160,6 +7205,7 @@ static void android_glWeightPointerOESBounds__IIILjava_nio_Buffer_2I (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jobject pointer_buf, jint remaining) { jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLvoid *pointer = (GLvoid *) 0; @@ -6273,7 +7319,7 @@ android_glCheckFramebufferStatusOES__I if (! supportsExtension(_env, _this, have_OES_framebuffer_objectID)) { jniThrowException(_env, "java/lang/UnsupportedOperationException", "glCheckFramebufferStatusOES"); - return 0; + return 0; } GLint _returnValue = 0; _returnValue = glCheckFramebufferStatusOES( @@ -6292,24 +7338,29 @@ android_glDeleteFramebuffersOES__I_3II return; } jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLuint *framebuffers_base = (GLuint *) 0; jint _remaining; GLuint *framebuffers = (GLuint *) 0; if (!framebuffers_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "framebuffers == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "framebuffers == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(framebuffers_ref) - offset; if (_remaining < n) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < n"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < n < needed"; goto exit; } framebuffers_base = (GLuint *) @@ -6326,6 +7377,9 @@ android_glDeleteFramebuffersOES__I_3II _env->ReleasePrimitiveArrayCritical(framebuffers_ref, framebuffers_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glDeleteFramebuffersOES ( GLint n, GLuint *framebuffers ) */ @@ -6338,16 +7392,24 @@ android_glDeleteFramebuffersOES__ILjava_nio_IntBuffer_2 return; } jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLuint *framebuffers = (GLuint *) 0; - framebuffers = (GLuint *)getPointer(_env, framebuffers_buf, &_array, &_remaining); + framebuffers = (GLuint *)getPointer(_env, framebuffers_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < n) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < n"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < n < needed"; goto exit; } + if (framebuffers == NULL) { + char * _framebuffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + framebuffers = (GLuint *) (_framebuffersBase + _bufferOffset); + } glDeleteFramebuffersOES( (GLint)n, (GLuint *)framebuffers @@ -6357,6 +7419,9 @@ android_glDeleteFramebuffersOES__ILjava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, framebuffers, _exception ? JNI_FALSE : JNI_TRUE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glDeleteRenderbuffersOES ( GLint n, GLuint *renderbuffers ) */ @@ -6369,24 +7434,29 @@ android_glDeleteRenderbuffersOES__I_3II return; } jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLuint *renderbuffers_base = (GLuint *) 0; jint _remaining; GLuint *renderbuffers = (GLuint *) 0; if (!renderbuffers_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "renderbuffers == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "renderbuffers == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(renderbuffers_ref) - offset; if (_remaining < n) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < n"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < n < needed"; goto exit; } renderbuffers_base = (GLuint *) @@ -6403,6 +7473,9 @@ android_glDeleteRenderbuffersOES__I_3II _env->ReleasePrimitiveArrayCritical(renderbuffers_ref, renderbuffers_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glDeleteRenderbuffersOES ( GLint n, GLuint *renderbuffers ) */ @@ -6415,16 +7488,24 @@ android_glDeleteRenderbuffersOES__ILjava_nio_IntBuffer_2 return; } jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLuint *renderbuffers = (GLuint *) 0; - renderbuffers = (GLuint *)getPointer(_env, renderbuffers_buf, &_array, &_remaining); + renderbuffers = (GLuint *)getPointer(_env, renderbuffers_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < n) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < n"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < n < needed"; goto exit; } + if (renderbuffers == NULL) { + char * _renderbuffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + renderbuffers = (GLuint *) (_renderbuffersBase + _bufferOffset); + } glDeleteRenderbuffersOES( (GLint)n, (GLuint *)renderbuffers @@ -6434,6 +7515,9 @@ android_glDeleteRenderbuffersOES__ILjava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, renderbuffers, _exception ? JNI_FALSE : JNI_TRUE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glFramebufferRenderbufferOES ( GLint target, GLint attachment, GLint renderbuffertarget, GLint renderbuffer ) */ @@ -6495,24 +7579,29 @@ android_glGenFramebuffersOES__I_3II return; } jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLuint *framebuffers_base = (GLuint *) 0; jint _remaining; GLuint *framebuffers = (GLuint *) 0; if (!framebuffers_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "framebuffers == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "framebuffers == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(framebuffers_ref) - offset; if (_remaining < n) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < n"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < n < needed"; goto exit; } framebuffers_base = (GLuint *) @@ -6529,6 +7618,9 @@ android_glGenFramebuffersOES__I_3II _env->ReleasePrimitiveArrayCritical(framebuffers_ref, framebuffers_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGenFramebuffersOES ( GLint n, GLuint *framebuffers ) */ @@ -6541,16 +7633,24 @@ android_glGenFramebuffersOES__ILjava_nio_IntBuffer_2 return; } jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLuint *framebuffers = (GLuint *) 0; - framebuffers = (GLuint *)getPointer(_env, framebuffers_buf, &_array, &_remaining); + framebuffers = (GLuint *)getPointer(_env, framebuffers_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < n) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < n"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < n < needed"; goto exit; } + if (framebuffers == NULL) { + char * _framebuffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + framebuffers = (GLuint *) (_framebuffersBase + _bufferOffset); + } glGenFramebuffersOES( (GLint)n, (GLuint *)framebuffers @@ -6560,6 +7660,9 @@ android_glGenFramebuffersOES__ILjava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, framebuffers, _exception ? JNI_FALSE : JNI_TRUE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGenRenderbuffersOES ( GLint n, GLuint *renderbuffers ) */ @@ -6572,24 +7675,29 @@ android_glGenRenderbuffersOES__I_3II return; } jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLuint *renderbuffers_base = (GLuint *) 0; jint _remaining; GLuint *renderbuffers = (GLuint *) 0; if (!renderbuffers_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "renderbuffers == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "renderbuffers == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(renderbuffers_ref) - offset; if (_remaining < n) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "length - offset < n"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < n < needed"; goto exit; } renderbuffers_base = (GLuint *) @@ -6606,6 +7714,9 @@ android_glGenRenderbuffersOES__I_3II _env->ReleasePrimitiveArrayCritical(renderbuffers_ref, renderbuffers_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGenRenderbuffersOES ( GLint n, GLuint *renderbuffers ) */ @@ -6618,16 +7729,24 @@ android_glGenRenderbuffersOES__ILjava_nio_IntBuffer_2 return; } jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLuint *renderbuffers = (GLuint *) 0; - renderbuffers = (GLuint *)getPointer(_env, renderbuffers_buf, &_array, &_remaining); + renderbuffers = (GLuint *)getPointer(_env, renderbuffers_buf, &_array, &_remaining, &_bufferOffset); if (_remaining < n) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "remaining() < n"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < n < needed"; goto exit; } + if (renderbuffers == NULL) { + char * _renderbuffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + renderbuffers = (GLuint *) (_renderbuffersBase + _bufferOffset); + } glGenRenderbuffersOES( (GLint)n, (GLuint *)renderbuffers @@ -6637,6 +7756,9 @@ android_glGenRenderbuffersOES__ILjava_nio_IntBuffer_2 if (_array) { releasePointer(_env, _array, renderbuffers, _exception ? JNI_FALSE : JNI_TRUE); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetFramebufferAttachmentParameterivOES ( GLint target, GLint attachment, GLint pname, GLint *params ) */ @@ -6649,18 +7771,22 @@ android_glGetFramebufferAttachmentParameterivOES__III_3II return; } jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLint *params_base = (GLint *) 0; jint _remaining; GLint *params = (GLint *) 0; if (!params_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -6680,6 +7806,9 @@ android_glGetFramebufferAttachmentParameterivOES__III_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetFramebufferAttachmentParameterivOES ( GLint target, GLint attachment, GLint pname, GLint *params ) */ @@ -6691,12 +7820,16 @@ android_glGetFramebufferAttachmentParameterivOES__IIILjava_nio_IntBuffer_2 "glGetFramebufferAttachmentParameterivOES"); return; } - jint _exception = 0; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLint *params = (GLint *) 0; - params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLint *) (_paramsBase + _bufferOffset); + } glGetFramebufferAttachmentParameterivOES( (GLint)target, (GLint)attachment, @@ -6704,7 +7837,7 @@ android_glGetFramebufferAttachmentParameterivOES__IIILjava_nio_IntBuffer_2 (GLint *)params ); if (_array) { - releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + releasePointer(_env, _array, params, JNI_TRUE); } } @@ -6718,18 +7851,22 @@ android_glGetRenderbufferParameterivOES__II_3II return; } jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLint *params_base = (GLint *) 0; jint _remaining; GLint *params = (GLint *) 0; if (!params_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -6748,6 +7885,9 @@ android_glGetRenderbufferParameterivOES__II_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetRenderbufferParameterivOES ( GLint target, GLint pname, GLint *params ) */ @@ -6759,19 +7899,23 @@ android_glGetRenderbufferParameterivOES__IILjava_nio_IntBuffer_2 "glGetRenderbufferParameterivOES"); return; } - jint _exception = 0; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLint *params = (GLint *) 0; - params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLint *) (_paramsBase + _bufferOffset); + } glGetRenderbufferParameterivOES( (GLint)target, (GLint)pname, (GLint *)params ); if (_array) { - releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + releasePointer(_env, _array, params, JNI_TRUE); } } @@ -6785,18 +7929,22 @@ android_glGetTexGenfv__II_3FI return; } jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfloat *params_base = (GLfloat *) 0; jint _remaining; GLfloat *params = (GLfloat *) 0; if (!params_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -6815,6 +7963,9 @@ android_glGetTexGenfv__II_3FI _env->ReleasePrimitiveArrayCritical(params_ref, params_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetTexGenfv ( GLint coord, GLint pname, GLfloat *params ) */ @@ -6826,19 +7977,23 @@ android_glGetTexGenfv__IILjava_nio_FloatBuffer_2 "glGetTexGenfv"); return; } - jint _exception = 0; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfloat *params = (GLfloat *) 0; - params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfloat *) (_paramsBase + _bufferOffset); + } glGetTexGenfv( (GLint)coord, (GLint)pname, (GLfloat *)params ); if (_array) { - releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + releasePointer(_env, _array, params, JNI_TRUE); } } @@ -6852,18 +8007,22 @@ android_glGetTexGeniv__II_3II return; } jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLint *params_base = (GLint *) 0; jint _remaining; GLint *params = (GLint *) 0; if (!params_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -6882,6 +8041,9 @@ android_glGetTexGeniv__II_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetTexGeniv ( GLint coord, GLint pname, GLint *params ) */ @@ -6893,19 +8055,23 @@ android_glGetTexGeniv__IILjava_nio_IntBuffer_2 "glGetTexGeniv"); return; } - jint _exception = 0; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLint *params = (GLint *) 0; - params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLint *) (_paramsBase + _bufferOffset); + } glGetTexGeniv( (GLint)coord, (GLint)pname, (GLint *)params ); if (_array) { - releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + releasePointer(_env, _array, params, JNI_TRUE); } } @@ -6919,18 +8085,22 @@ android_glGetTexGenxv__II_3II return; } jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLint *params_base = (GLint *) 0; jint _remaining; GLint *params = (GLint *) 0; if (!params_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -6949,6 +8119,9 @@ android_glGetTexGenxv__II_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glGetTexGenxv ( GLint coord, GLint pname, GLint *params ) */ @@ -6960,19 +8133,23 @@ android_glGetTexGenxv__IILjava_nio_IntBuffer_2 "glGetTexGenxv"); return; } - jint _exception = 0; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLint *params = (GLint *) 0; - params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLint *) (_paramsBase + _bufferOffset); + } glGetTexGenxv( (GLint)coord, (GLint)pname, (GLint *)params ); if (_array) { - releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + releasePointer(_env, _array, params, JNI_TRUE); } } @@ -6983,7 +8160,7 @@ android_glIsFramebufferOES__I if (! supportsExtension(_env, _this, have_OES_framebuffer_objectID)) { jniThrowException(_env, "java/lang/UnsupportedOperationException", "glIsFramebufferOES"); - return JNI_FALSE; + return JNI_FALSE; } GLboolean _returnValue = JNI_FALSE; _returnValue = glIsFramebufferOES( @@ -6999,7 +8176,7 @@ android_glIsRenderbufferOES__I if (! supportsExtension(_env, _this, have_OES_framebuffer_objectID)) { jniThrowException(_env, "java/lang/UnsupportedOperationException", "glIsRenderbufferOES"); - return JNI_FALSE; + return JNI_FALSE; } GLboolean _returnValue = JNI_FALSE; _returnValue = glIsRenderbufferOES( @@ -7051,18 +8228,22 @@ android_glTexGenfv__II_3FI return; } jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLfloat *params_base = (GLfloat *) 0; jint _remaining; GLfloat *params = (GLfloat *) 0; if (!params_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -7081,6 +8262,9 @@ android_glTexGenfv__II_3FI _env->ReleasePrimitiveArrayCritical(params_ref, params_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glTexGenfv ( GLint coord, GLint pname, GLfloat *params ) */ @@ -7092,19 +8276,23 @@ android_glTexGenfv__IILjava_nio_FloatBuffer_2 "glTexGenfv"); return; } - jint _exception = 0; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLfloat *params = (GLfloat *) 0; - params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLfloat *) (_paramsBase + _bufferOffset); + } glTexGenfv( (GLint)coord, (GLint)pname, (GLfloat *)params ); if (_array) { - releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + releasePointer(_env, _array, params, JNI_TRUE); } } @@ -7134,18 +8322,22 @@ android_glTexGeniv__II_3II return; } jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLint *params_base = (GLint *) 0; jint _remaining; GLint *params = (GLint *) 0; if (!params_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -7164,6 +8356,9 @@ android_glTexGeniv__II_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glTexGeniv ( GLint coord, GLint pname, GLint *params ) */ @@ -7175,19 +8370,23 @@ android_glTexGeniv__IILjava_nio_IntBuffer_2 "glTexGeniv"); return; } - jint _exception = 0; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLint *params = (GLint *) 0; - params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLint *) (_paramsBase + _bufferOffset); + } glTexGeniv( (GLint)coord, (GLint)pname, (GLint *)params ); if (_array) { - releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + releasePointer(_env, _array, params, JNI_TRUE); } } @@ -7217,18 +8416,22 @@ android_glTexGenxv__II_3II return; } jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; GLint *params_base = (GLint *) 0; jint _remaining; GLint *params = (GLint *) 0; if (!params_ref) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "params == null"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; goto exit; } if (offset < 0) { _exception = 1; - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset < 0"); + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(params_ref) - offset; @@ -7247,6 +8450,9 @@ android_glTexGenxv__II_3II _env->ReleasePrimitiveArrayCritical(params_ref, params_base, _exception ? JNI_ABORT: 0); } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } } /* void glTexGenxv ( GLint coord, GLint pname, GLint *params ) */ @@ -7258,19 +8464,23 @@ android_glTexGenxv__IILjava_nio_IntBuffer_2 "glTexGenxv"); return; } - jint _exception = 0; jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; jint _remaining; GLint *params = (GLint *) 0; - params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining); + params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (GLint *) (_paramsBase + _bufferOffset); + } glTexGenxv( (GLint)coord, (GLint)pname, (GLint *)params ); if (_array) { - releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + releasePointer(_env, _array, params, JNI_TRUE); } } diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index 6546fedc18e0c..3c083acc0225b 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -18,6 +18,7 @@ */ --> @@ -43,7 +44,9 @@ + + @@ -62,6 +65,9 @@ + + + @@ -106,6 +112,8 @@ + + @@ -121,6 +129,7 @@ + @@ -133,24 +142,41 @@ + + + + without their direct involvement. --> + + + + + + + - + @@ -158,33 +184,11 @@ input or confirmation. @hide --> - - - - - - - - - - - - + - - + @@ -272,26 +279,82 @@ - - + + + + + + contacts data. +

          Note: If your app uses the + {@link #WRITE_CONTACTS} permission and both your {@code + minSdkVersion} and {@code + targetSdkVersion} values are set to 15 or lower, the system implicitly + grants your app this permission. If you don't need this permission, be sure your {@code + targetSdkVersion} is 16 or higher.

          --> + + + + + + + + + + + + + + - - + + + + - - + + + + + + + + + + + + + + + + + + + + + @@ -364,23 +462,48 @@ + + + + + + + + + + + + + + + @@ -395,16 +518,20 @@ + android:description="@string/permgroupdesc_location" + android:permissionGroupFlags="personalInfo" + android:priority="330" /> - + - + @@ -442,7 +569,9 @@ or other related network operations. --> + android:icon="@drawable/perm_group_network" + android:description="@string/permgroupdesc_network" + android:priority="270" /> + + + - - + + + + + + + + + + + + + + + + + + - - - - - - - + + + @@ -517,7 +675,10 @@ by the Account Manager. --> + android:icon="@drawable/perm_group_accounts" + android:description="@string/permgroupdesc_accounts" + android:permissionGroupFlags="personalInfo" + android:priority="200" /> + + + - + - - + the device that has an effect on battery life. This includes vibrator, + flashlight, etc. --> - - + - - + + android:description="@string/permdesc_changeWifiMulticastState" + android:label="@string/permlab_changeWifiMulticastState" /> - - + + android:protectionLevel="signatureOrSystem" + android:label="@string/permlab_preventpower" + android:description="@string/permdesc_preventpower" /> - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + telephony state: placing calls, intercepting outgoing calls, reading + and modifying the phone state. --> + android:icon="@drawable/perm_group_phone_calls" + android:description="@string/permgroupdesc_phoneCalls" + android:permissionGroupFlags="personalInfo" + android:priority="370" /> @@ -666,7 +915,15 @@ android:label="@string/permlab_modifyPhoneState" android:description="@string/permdesc_modifyPhoneState" /> - + + + + + + + @@ -687,29 +961,303 @@ - - + android:icon="@drawable/perm_group_storage" + android:description="@string/permgroupdesc_storage" + android:permissionGroupFlags="personalInfo" + android:priority="240" /> + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -724,12 +1272,36 @@ such as writing the global system settings. --> + android:icon="@drawable/perm_group_system_tools" + android:description="@string/permgroupdesc_systemTools" + android:priority="100" /> + + + + + + + + + @@ -739,52 +1311,6 @@ android:label="@string/permlab_writeGservices" android:description="@string/permdesc_writeGservices" /> - - - - - - - - - - - - - - - - - - - - - - - - @@ -833,17 +1343,6 @@ android:label="@string/permlab_retrieve_window_content" android:description="@string/permdesc_retrieve_window_content" /> - - - @@ -887,7 +1386,7 @@ explicitly declare your use of this facility to make that visible to the user. --> @@ -902,52 +1401,17 @@ android:label="@string/permlab_broadcastSticky" android:description="@string/permdesc_broadcastSticky" /> - - - - - - - - - - - - - - - @@ -991,34 +1455,6 @@ android:label="@string/permlab_asec_rename" android:description="@string/permdesc_asec_rename" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - + android:description="@string/permgroupdesc_developmentTools" + android:priority="310" /> + + + + + + + + + + + + + @@ -1378,6 +1816,22 @@ android:description="@string/permdesc_readFrameBuffer" android:protectionLevel="signature|system" /> + + + + + + + + + + android:protectionLevel="dangerous" /> @@ -1505,6 +1965,13 @@ android:description="@string/permdesc_bindGadget" android:protectionLevel="signature|system" /> + + + @@ -1550,6 +2017,18 @@ android:permissionGroup="android.permission-group.SYSTEM_TOOLS" android:protectionLevel="signature|system" /> + + + + + + - + android:protectionLevel="signature|system" /> + + + + + + + diff --git a/core/res/res/anim/keyguard_action_assist_exit.xml b/core/res/res/anim/keyguard_action_assist_exit.xml new file mode 100644 index 0000000000000..b4ed2789930e1 --- /dev/null +++ b/core/res/res/anim/keyguard_action_assist_exit.xml @@ -0,0 +1,23 @@ + + + + diff --git a/core/res/res/anim/keyguard_security_animate_in.xml b/core/res/res/anim/keyguard_security_animate_in.xml new file mode 100644 index 0000000000000..4ee30c363599c --- /dev/null +++ b/core/res/res/anim/keyguard_security_animate_in.xml @@ -0,0 +1,33 @@ + + + + + + + + + diff --git a/core/res/res/anim/keyguard_security_animate_out.xml b/core/res/res/anim/keyguard_security_animate_out.xml new file mode 100644 index 0000000000000..76d065c74f66d --- /dev/null +++ b/core/res/res/anim/keyguard_security_animate_out.xml @@ -0,0 +1,32 @@ + + + + + + + + + diff --git a/core/res/res/anim/keyguard_security_fade_in.xml b/core/res/res/anim/keyguard_security_fade_in.xml new file mode 100644 index 0000000000000..6293432c7ccc0 --- /dev/null +++ b/core/res/res/anim/keyguard_security_fade_in.xml @@ -0,0 +1,22 @@ + + + + + + diff --git a/core/res/res/anim/keyguard_security_fade_out.xml b/core/res/res/anim/keyguard_security_fade_out.xml new file mode 100644 index 0000000000000..4ab0229e2092f --- /dev/null +++ b/core/res/res/anim/keyguard_security_fade_out.xml @@ -0,0 +1,21 @@ + + + diff --git a/core/res/res/anim/screen_user_enter.xml b/core/res/res/anim/screen_user_enter.xml new file mode 100644 index 0000000000000..cb0a634270895 --- /dev/null +++ b/core/res/res/anim/screen_user_enter.xml @@ -0,0 +1,23 @@ + + + + + + diff --git a/core/res/res/anim/screen_user_exit.xml b/core/res/res/anim/screen_user_exit.xml new file mode 100644 index 0000000000000..3d465be060073 --- /dev/null +++ b/core/res/res/anim/screen_user_exit.xml @@ -0,0 +1,23 @@ + + + + + + diff --git a/core/res/res/anim-port/task_close_enter.xml b/core/res/res/anim/task_close_enter.xml similarity index 100% rename from core/res/res/anim-port/task_close_enter.xml rename to core/res/res/anim/task_close_enter.xml diff --git a/core/res/res/anim-port/task_close_exit.xml b/core/res/res/anim/task_close_exit.xml similarity index 100% rename from core/res/res/anim-port/task_close_exit.xml rename to core/res/res/anim/task_close_exit.xml diff --git a/core/res/res/anim-port/task_open_enter.xml b/core/res/res/anim/task_open_enter.xml similarity index 100% rename from core/res/res/anim-port/task_open_enter.xml rename to core/res/res/anim/task_open_enter.xml diff --git a/core/res/res/anim-port/task_open_exit.xml b/core/res/res/anim/task_open_exit.xml similarity index 100% rename from core/res/res/anim-port/task_open_exit.xml rename to core/res/res/anim/task_open_exit.xml diff --git a/core/res/res/anim/wallpaper_enter.xml b/core/res/res/anim/wallpaper_enter.xml index 2993a2d9a0ed9..eb826b8e0c009 100644 --- a/core/res/res/anim/wallpaper_enter.xml +++ b/core/res/res/anim/wallpaper_enter.xml @@ -19,10 +19,12 @@ + \ No newline at end of file diff --git a/core/res/res/anim/wallpaper_exit.xml b/core/res/res/anim/wallpaper_exit.xml index 5d5b38aef63be..d675afbe495d0 100644 --- a/core/res/res/anim/wallpaper_exit.xml +++ b/core/res/res/anim/wallpaper_exit.xml @@ -19,10 +19,12 @@ + \ No newline at end of file diff --git a/core/res/res/drawable-hdpi/btn_default_disabled_focused_holo_dark.9.png b/core/res/res/drawable-hdpi/btn_default_disabled_focused_holo_dark.9.png index 13ab8f7dabb22..3b64f4781e70f 100644 Binary files a/core/res/res/drawable-hdpi/btn_default_disabled_focused_holo_dark.9.png and b/core/res/res/drawable-hdpi/btn_default_disabled_focused_holo_dark.9.png differ diff --git a/core/res/res/drawable-hdpi/btn_default_disabled_focused_holo_light.9.png b/core/res/res/drawable-hdpi/btn_default_disabled_focused_holo_light.9.png index 13ab8f7dabb22..3b64f4781e70f 100644 Binary files a/core/res/res/drawable-hdpi/btn_default_disabled_focused_holo_light.9.png and b/core/res/res/drawable-hdpi/btn_default_disabled_focused_holo_light.9.png differ diff --git a/core/res/res/drawable-hdpi/btn_default_disabled_holo.9.png b/core/res/res/drawable-hdpi/btn_default_disabled_holo.9.png index 1d76bb5aa80b8..0437c31dd7434 100644 Binary files a/core/res/res/drawable-hdpi/btn_default_disabled_holo.9.png and b/core/res/res/drawable-hdpi/btn_default_disabled_holo.9.png differ diff --git a/core/res/res/drawable-hdpi/btn_default_disabled_holo_dark.9.png b/core/res/res/drawable-hdpi/btn_default_disabled_holo_dark.9.png index 8ebd761cc1e1a..6a2a92cceda58 100644 Binary files a/core/res/res/drawable-hdpi/btn_default_disabled_holo_dark.9.png and b/core/res/res/drawable-hdpi/btn_default_disabled_holo_dark.9.png differ diff --git a/core/res/res/drawable-hdpi/btn_default_disabled_holo_light.9.png b/core/res/res/drawable-hdpi/btn_default_disabled_holo_light.9.png index 8ebd761cc1e1a..6a2a92cceda58 100644 Binary files a/core/res/res/drawable-hdpi/btn_default_disabled_holo_light.9.png and b/core/res/res/drawable-hdpi/btn_default_disabled_holo_light.9.png differ diff --git a/core/res/res/drawable-hdpi/btn_default_focused_holo.9.png b/core/res/res/drawable-hdpi/btn_default_focused_holo.9.png index b405d81c3e851..882ed617a75d2 100644 Binary files a/core/res/res/drawable-hdpi/btn_default_focused_holo.9.png and b/core/res/res/drawable-hdpi/btn_default_focused_holo.9.png differ diff --git a/core/res/res/drawable-hdpi/btn_default_focused_holo_dark.9.png b/core/res/res/drawable-hdpi/btn_default_focused_holo_dark.9.png index fee599ae9940e..b9266a65c9d01 100644 Binary files a/core/res/res/drawable-hdpi/btn_default_focused_holo_dark.9.png and b/core/res/res/drawable-hdpi/btn_default_focused_holo_dark.9.png differ diff --git a/core/res/res/drawable-hdpi/btn_default_focused_holo_light.9.png b/core/res/res/drawable-hdpi/btn_default_focused_holo_light.9.png index fee599ae9940e..b9266a65c9d01 100644 Binary files a/core/res/res/drawable-hdpi/btn_default_focused_holo_light.9.png and b/core/res/res/drawable-hdpi/btn_default_focused_holo_light.9.png differ diff --git a/core/res/res/drawable-hdpi/btn_default_normal_holo.9.png b/core/res/res/drawable-hdpi/btn_default_normal_holo.9.png index dddfc26c37dd1..dbcede79b91a1 100644 Binary files a/core/res/res/drawable-hdpi/btn_default_normal_holo.9.png and b/core/res/res/drawable-hdpi/btn_default_normal_holo.9.png differ diff --git a/core/res/res/drawable-hdpi/btn_default_normal_holo_dark.9.png b/core/res/res/drawable-hdpi/btn_default_normal_holo_dark.9.png index ab40fa7ab944c..42fc83cdee2d9 100644 Binary files a/core/res/res/drawable-hdpi/btn_default_normal_holo_dark.9.png and b/core/res/res/drawable-hdpi/btn_default_normal_holo_dark.9.png differ diff --git a/core/res/res/drawable-hdpi/btn_default_normal_holo_light.9.png b/core/res/res/drawable-hdpi/btn_default_normal_holo_light.9.png index 807792183fd5d..42fc83cdee2d9 100644 Binary files a/core/res/res/drawable-hdpi/btn_default_normal_holo_light.9.png and b/core/res/res/drawable-hdpi/btn_default_normal_holo_light.9.png differ diff --git a/core/res/res/drawable-hdpi/btn_default_pressed_holo.9.png b/core/res/res/drawable-hdpi/btn_default_pressed_holo.9.png index 0d8f8ba49c28e..958d0230dc2ed 100644 Binary files a/core/res/res/drawable-hdpi/btn_default_pressed_holo.9.png and b/core/res/res/drawable-hdpi/btn_default_pressed_holo.9.png differ diff --git a/core/res/res/drawable-hdpi/btn_default_pressed_holo_dark.9.png b/core/res/res/drawable-hdpi/btn_default_pressed_holo_dark.9.png index baf7018a443ee..3464f3d47e59e 100644 Binary files a/core/res/res/drawable-hdpi/btn_default_pressed_holo_dark.9.png and b/core/res/res/drawable-hdpi/btn_default_pressed_holo_dark.9.png differ diff --git a/core/res/res/drawable-hdpi/btn_default_pressed_holo_light.9.png b/core/res/res/drawable-hdpi/btn_default_pressed_holo_light.9.png index baf7018a443ee..3464f3d47e59e 100644 Binary files a/core/res/res/drawable-hdpi/btn_default_pressed_holo_light.9.png and b/core/res/res/drawable-hdpi/btn_default_pressed_holo_light.9.png differ diff --git a/core/res/res/drawable-hdpi/btn_toggle_off_disabled_focused_holo_dark.9.png b/core/res/res/drawable-hdpi/btn_toggle_off_disabled_focused_holo_dark.9.png index 7a24c9b6d61b2..17acfc52914a9 100644 Binary files a/core/res/res/drawable-hdpi/btn_toggle_off_disabled_focused_holo_dark.9.png and b/core/res/res/drawable-hdpi/btn_toggle_off_disabled_focused_holo_dark.9.png differ diff --git a/core/res/res/drawable-hdpi/btn_toggle_off_disabled_focused_holo_light.9.png b/core/res/res/drawable-hdpi/btn_toggle_off_disabled_focused_holo_light.9.png index 7a24c9b6d61b2..17acfc52914a9 100644 Binary files a/core/res/res/drawable-hdpi/btn_toggle_off_disabled_focused_holo_light.9.png and b/core/res/res/drawable-hdpi/btn_toggle_off_disabled_focused_holo_light.9.png differ diff --git a/core/res/res/drawable-hdpi/btn_toggle_off_disabled_holo_dark.9.png b/core/res/res/drawable-hdpi/btn_toggle_off_disabled_holo_dark.9.png index 93c6d1bdec362..9b8ca22720c20 100644 Binary files a/core/res/res/drawable-hdpi/btn_toggle_off_disabled_holo_dark.9.png and b/core/res/res/drawable-hdpi/btn_toggle_off_disabled_holo_dark.9.png differ diff --git a/core/res/res/drawable-hdpi/btn_toggle_off_disabled_holo_light.9.png b/core/res/res/drawable-hdpi/btn_toggle_off_disabled_holo_light.9.png index 93c6d1bdec362..9b8ca22720c20 100644 Binary files a/core/res/res/drawable-hdpi/btn_toggle_off_disabled_holo_light.9.png and b/core/res/res/drawable-hdpi/btn_toggle_off_disabled_holo_light.9.png differ diff --git a/core/res/res/drawable-hdpi/btn_toggle_off_focused_holo_dark.9.png b/core/res/res/drawable-hdpi/btn_toggle_off_focused_holo_dark.9.png index 120f963a396a7..bc20f6c38dcbd 100644 Binary files a/core/res/res/drawable-hdpi/btn_toggle_off_focused_holo_dark.9.png and b/core/res/res/drawable-hdpi/btn_toggle_off_focused_holo_dark.9.png differ diff --git a/core/res/res/drawable-hdpi/btn_toggle_off_focused_holo_light.9.png b/core/res/res/drawable-hdpi/btn_toggle_off_focused_holo_light.9.png index 120f963a396a7..bc20f6c38dcbd 100644 Binary files a/core/res/res/drawable-hdpi/btn_toggle_off_focused_holo_light.9.png and b/core/res/res/drawable-hdpi/btn_toggle_off_focused_holo_light.9.png differ diff --git a/core/res/res/drawable-hdpi/btn_toggle_off_normal_holo_dark.9.png b/core/res/res/drawable-hdpi/btn_toggle_off_normal_holo_dark.9.png index 6b106fb6a9cfc..571819b9fcd33 100644 Binary files a/core/res/res/drawable-hdpi/btn_toggle_off_normal_holo_dark.9.png and b/core/res/res/drawable-hdpi/btn_toggle_off_normal_holo_dark.9.png differ diff --git a/core/res/res/drawable-hdpi/btn_toggle_off_normal_holo_light.9.png b/core/res/res/drawable-hdpi/btn_toggle_off_normal_holo_light.9.png index 6b106fb6a9cfc..571819b9fcd33 100644 Binary files a/core/res/res/drawable-hdpi/btn_toggle_off_normal_holo_light.9.png and b/core/res/res/drawable-hdpi/btn_toggle_off_normal_holo_light.9.png differ diff --git a/core/res/res/drawable-hdpi/btn_toggle_off_pressed_holo_dark.9.png b/core/res/res/drawable-hdpi/btn_toggle_off_pressed_holo_dark.9.png index a1b7003040e0e..677069a47ee5f 100644 Binary files a/core/res/res/drawable-hdpi/btn_toggle_off_pressed_holo_dark.9.png and b/core/res/res/drawable-hdpi/btn_toggle_off_pressed_holo_dark.9.png differ diff --git a/core/res/res/drawable-hdpi/btn_toggle_off_pressed_holo_light.9.png b/core/res/res/drawable-hdpi/btn_toggle_off_pressed_holo_light.9.png index a1b7003040e0e..677069a47ee5f 100644 Binary files a/core/res/res/drawable-hdpi/btn_toggle_off_pressed_holo_light.9.png and b/core/res/res/drawable-hdpi/btn_toggle_off_pressed_holo_light.9.png differ diff --git a/core/res/res/drawable-hdpi/btn_toggle_on_disabled_focused_holo_dark.9.png b/core/res/res/drawable-hdpi/btn_toggle_on_disabled_focused_holo_dark.9.png index 7176a6b3e6a40..1f83b5a500b8b 100644 Binary files a/core/res/res/drawable-hdpi/btn_toggle_on_disabled_focused_holo_dark.9.png and b/core/res/res/drawable-hdpi/btn_toggle_on_disabled_focused_holo_dark.9.png differ diff --git a/core/res/res/drawable-hdpi/btn_toggle_on_disabled_focused_holo_light.9.png b/core/res/res/drawable-hdpi/btn_toggle_on_disabled_focused_holo_light.9.png index 7176a6b3e6a40..1f83b5a500b8b 100644 Binary files a/core/res/res/drawable-hdpi/btn_toggle_on_disabled_focused_holo_light.9.png and b/core/res/res/drawable-hdpi/btn_toggle_on_disabled_focused_holo_light.9.png differ diff --git a/core/res/res/drawable-hdpi/btn_toggle_on_disabled_holo_dark.9.png b/core/res/res/drawable-hdpi/btn_toggle_on_disabled_holo_dark.9.png index 7fba6a5dbc162..733cf45941807 100644 Binary files a/core/res/res/drawable-hdpi/btn_toggle_on_disabled_holo_dark.9.png and b/core/res/res/drawable-hdpi/btn_toggle_on_disabled_holo_dark.9.png differ diff --git a/core/res/res/drawable-hdpi/btn_toggle_on_disabled_holo_light.9.png b/core/res/res/drawable-hdpi/btn_toggle_on_disabled_holo_light.9.png index 7fba6a5dbc162..733cf45941807 100644 Binary files a/core/res/res/drawable-hdpi/btn_toggle_on_disabled_holo_light.9.png and b/core/res/res/drawable-hdpi/btn_toggle_on_disabled_holo_light.9.png differ diff --git a/core/res/res/drawable-hdpi/btn_toggle_on_focused_holo_dark.9.png b/core/res/res/drawable-hdpi/btn_toggle_on_focused_holo_dark.9.png index 8bbfe9f0a664b..2265de4679f0c 100644 Binary files a/core/res/res/drawable-hdpi/btn_toggle_on_focused_holo_dark.9.png and b/core/res/res/drawable-hdpi/btn_toggle_on_focused_holo_dark.9.png differ diff --git a/core/res/res/drawable-hdpi/btn_toggle_on_focused_holo_light.9.png b/core/res/res/drawable-hdpi/btn_toggle_on_focused_holo_light.9.png index 8bbfe9f0a664b..2265de4679f0c 100644 Binary files a/core/res/res/drawable-hdpi/btn_toggle_on_focused_holo_light.9.png and b/core/res/res/drawable-hdpi/btn_toggle_on_focused_holo_light.9.png differ diff --git a/core/res/res/drawable-hdpi/btn_toggle_on_normal_holo_dark.9.png b/core/res/res/drawable-hdpi/btn_toggle_on_normal_holo_dark.9.png index 28f0ee62749c7..f3ada58e88692 100644 Binary files a/core/res/res/drawable-hdpi/btn_toggle_on_normal_holo_dark.9.png and b/core/res/res/drawable-hdpi/btn_toggle_on_normal_holo_dark.9.png differ diff --git a/core/res/res/drawable-hdpi/btn_toggle_on_normal_holo_light.9.png b/core/res/res/drawable-hdpi/btn_toggle_on_normal_holo_light.9.png index 28f0ee62749c7..f3ada58e88692 100644 Binary files a/core/res/res/drawable-hdpi/btn_toggle_on_normal_holo_light.9.png and b/core/res/res/drawable-hdpi/btn_toggle_on_normal_holo_light.9.png differ diff --git a/core/res/res/drawable-hdpi/btn_toggle_on_pressed_holo_dark.9.png b/core/res/res/drawable-hdpi/btn_toggle_on_pressed_holo_dark.9.png index c4c41a3183cd5..6b5fa5afc5060 100644 Binary files a/core/res/res/drawable-hdpi/btn_toggle_on_pressed_holo_dark.9.png and b/core/res/res/drawable-hdpi/btn_toggle_on_pressed_holo_dark.9.png differ diff --git a/core/res/res/drawable-hdpi/btn_toggle_on_pressed_holo_light.9.png b/core/res/res/drawable-hdpi/btn_toggle_on_pressed_holo_light.9.png index c4c41a3183cd5..6b5fa5afc5060 100644 Binary files a/core/res/res/drawable-hdpi/btn_toggle_on_pressed_holo_light.9.png and b/core/res/res/drawable-hdpi/btn_toggle_on_pressed_holo_light.9.png differ diff --git a/core/res/res/drawable-hdpi/dialog_bottom_holo_dark.9.png b/core/res/res/drawable-hdpi/dialog_bottom_holo_dark.9.png index 256067dea3e3a..9eaf9d58b8b7e 100644 Binary files a/core/res/res/drawable-hdpi/dialog_bottom_holo_dark.9.png and b/core/res/res/drawable-hdpi/dialog_bottom_holo_dark.9.png differ diff --git a/core/res/res/drawable-hdpi/dialog_bottom_holo_light.9.png b/core/res/res/drawable-hdpi/dialog_bottom_holo_light.9.png index 233817500a409..55a125ed87f88 100644 Binary files a/core/res/res/drawable-hdpi/dialog_bottom_holo_light.9.png and b/core/res/res/drawable-hdpi/dialog_bottom_holo_light.9.png differ diff --git a/core/res/res/drawable-hdpi/dialog_full_holo_dark.9.png b/core/res/res/drawable-hdpi/dialog_full_holo_dark.9.png index 79e56f522b283..13205f05b1359 100644 Binary files a/core/res/res/drawable-hdpi/dialog_full_holo_dark.9.png and b/core/res/res/drawable-hdpi/dialog_full_holo_dark.9.png differ diff --git a/core/res/res/drawable-hdpi/dialog_full_holo_light.9.png b/core/res/res/drawable-hdpi/dialog_full_holo_light.9.png index e029f210b9a81..6f5dcc123cada 100644 Binary files a/core/res/res/drawable-hdpi/dialog_full_holo_light.9.png and b/core/res/res/drawable-hdpi/dialog_full_holo_light.9.png differ diff --git a/core/res/res/drawable-hdpi/dialog_middle_holo_dark.9.png b/core/res/res/drawable-hdpi/dialog_middle_holo_dark.9.png index 8ee0072faf8b7..be3f7a1368a5c 100644 Binary files a/core/res/res/drawable-hdpi/dialog_middle_holo_dark.9.png and b/core/res/res/drawable-hdpi/dialog_middle_holo_dark.9.png differ diff --git a/core/res/res/drawable-hdpi/dialog_middle_holo_light.9.png b/core/res/res/drawable-hdpi/dialog_middle_holo_light.9.png index df030c1a578ce..2e92a6d5a9768 100644 Binary files a/core/res/res/drawable-hdpi/dialog_middle_holo_light.9.png and b/core/res/res/drawable-hdpi/dialog_middle_holo_light.9.png differ diff --git a/core/res/res/drawable-hdpi/dialog_top_holo_dark.9.png b/core/res/res/drawable-hdpi/dialog_top_holo_dark.9.png index 50534a1eaa140..0e5444b1c1db6 100644 Binary files a/core/res/res/drawable-hdpi/dialog_top_holo_dark.9.png and b/core/res/res/drawable-hdpi/dialog_top_holo_dark.9.png differ diff --git a/core/res/res/drawable-hdpi/dialog_top_holo_light.9.png b/core/res/res/drawable-hdpi/dialog_top_holo_light.9.png index 0b841553bb9c2..32ca2050c43b4 100644 Binary files a/core/res/res/drawable-hdpi/dialog_top_holo_light.9.png and b/core/res/res/drawable-hdpi/dialog_top_holo_light.9.png differ diff --git a/core/res/res/drawable-hdpi/ic_coins_s.png b/core/res/res/drawable-hdpi/ic_coins_s.png new file mode 100644 index 0000000000000..0ada1d0081035 Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_coins_s.png differ diff --git a/core/res/res/drawable-hdpi/ic_lock_expanded_desktop.png b/core/res/res/drawable-hdpi/ic_lock_expanded_desktop.png new file mode 100644 index 0000000000000..01f5b89cbc75d Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_lock_expanded_desktop.png differ diff --git a/core/res/res/drawable-hdpi/ic_lock_idle_calendar.png b/core/res/res/drawable-hdpi/ic_lock_idle_calendar.png new file mode 100644 index 0000000000000..05b68b1336fb2 Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_lock_idle_calendar.png differ diff --git a/core/res/res/drawable-hdpi/ic_lock_profile.png b/core/res/res/drawable-hdpi/ic_lock_profile.png new file mode 100644 index 0000000000000..7fc4cec23467d Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_lock_profile.png differ diff --git a/core/res/res/drawable-hdpi/ic_lock_reboot.png b/core/res/res/drawable-hdpi/ic_lock_reboot.png new file mode 100644 index 0000000000000..ca00936e5406a Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_lock_reboot.png differ diff --git a/core/res/res/drawable-hdpi/ic_lock_screenshot.png b/core/res/res/drawable-hdpi/ic_lock_screenshot.png new file mode 100644 index 0000000000000..5ef76f7733355 Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_lock_screenshot.png differ diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_alarm.png b/core/res/res/drawable-hdpi/ic_lockscreen_alarm.png new file mode 100644 index 0000000000000..d7a8cfcba3c35 Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_lockscreen_alarm.png differ diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_alarm_activated.png b/core/res/res/drawable-hdpi/ic_lockscreen_alarm_activated.png new file mode 100644 index 0000000000000..7fc4e3f05a358 Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_lockscreen_alarm_activated.png differ diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_alarm_normal.png b/core/res/res/drawable-hdpi/ic_lockscreen_alarm_normal.png new file mode 100644 index 0000000000000..af87580b3eadc Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_lockscreen_alarm_normal.png differ diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_answer_active.png b/core/res/res/drawable-hdpi/ic_lockscreen_answer_active.png new file mode 100644 index 0000000000000..d201bfb7542f7 Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_lockscreen_answer_active.png differ diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_answer_focused.png b/core/res/res/drawable-hdpi/ic_lockscreen_answer_focused.png new file mode 100644 index 0000000000000..efb29f1e1b04b Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_lockscreen_answer_focused.png differ diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_answer_normal.png b/core/res/res/drawable-hdpi/ic_lockscreen_answer_normal.png new file mode 100644 index 0000000000000..176d4489685a5 Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_lockscreen_answer_normal.png differ diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_browser_activated.png b/core/res/res/drawable-hdpi/ic_lockscreen_browser_activated.png new file mode 100644 index 0000000000000..559af17218abe Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_lockscreen_browser_activated.png differ diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_browser_normal.png b/core/res/res/drawable-hdpi/ic_lockscreen_browser_normal.png new file mode 100644 index 0000000000000..24d339812e416 Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_lockscreen_browser_normal.png differ diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_calendar_activated.png b/core/res/res/drawable-hdpi/ic_lockscreen_calendar_activated.png new file mode 100644 index 0000000000000..f4972e75a21f5 Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_lockscreen_calendar_activated.png differ diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_calendar_normal.png b/core/res/res/drawable-hdpi/ic_lockscreen_calendar_normal.png new file mode 100644 index 0000000000000..9a5c37ea7491f Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_lockscreen_calendar_normal.png differ diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_camera_activated.png b/core/res/res/drawable-hdpi/ic_lockscreen_camera_activated.png index 19c8eb29e2739..1e779308d8df3 100644 Binary files a/core/res/res/drawable-hdpi/ic_lockscreen_camera_activated.png and b/core/res/res/drawable-hdpi/ic_lockscreen_camera_activated.png differ diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_camera_normal.png b/core/res/res/drawable-hdpi/ic_lockscreen_camera_normal.png index c79a245580cbd..c1a60470a0515 100644 Binary files a/core/res/res/drawable-hdpi/ic_lockscreen_camera_normal.png and b/core/res/res/drawable-hdpi/ic_lockscreen_camera_normal.png differ diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_chevron_down.png b/core/res/res/drawable-hdpi/ic_lockscreen_chevron_down.png deleted file mode 100644 index bc718b57b43c1..0000000000000 Binary files a/core/res/res/drawable-hdpi/ic_lockscreen_chevron_down.png and /dev/null differ diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_chevron_left.png b/core/res/res/drawable-hdpi/ic_lockscreen_chevron_left.png deleted file mode 100644 index 0892c31863b25..0000000000000 Binary files a/core/res/res/drawable-hdpi/ic_lockscreen_chevron_left.png and /dev/null differ diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_chevron_right.png b/core/res/res/drawable-hdpi/ic_lockscreen_chevron_right.png deleted file mode 100644 index 04cc0a23b4aae..0000000000000 Binary files a/core/res/res/drawable-hdpi/ic_lockscreen_chevron_right.png and /dev/null differ diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_chevron_up.png b/core/res/res/drawable-hdpi/ic_lockscreen_chevron_up.png deleted file mode 100644 index bb553b1fc2a19..0000000000000 Binary files a/core/res/res/drawable-hdpi/ic_lockscreen_chevron_up.png and /dev/null differ diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_chrome_activated.png b/core/res/res/drawable-hdpi/ic_lockscreen_chrome_activated.png new file mode 100644 index 0000000000000..75357a048f14c Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_lockscreen_chrome_activated.png differ diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_chrome_normal.png b/core/res/res/drawable-hdpi/ic_lockscreen_chrome_normal.png new file mode 100644 index 0000000000000..f6f29d11a045b Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_lockscreen_chrome_normal.png differ diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_decline_activated.png b/core/res/res/drawable-hdpi/ic_lockscreen_decline_activated.png new file mode 100644 index 0000000000000..98667697085f0 Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_lockscreen_decline_activated.png differ diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_decline_focused.png b/core/res/res/drawable-hdpi/ic_lockscreen_decline_focused.png new file mode 100644 index 0000000000000..f37b16a95ce94 Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_lockscreen_decline_focused.png differ diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_decline_normal.png b/core/res/res/drawable-hdpi/ic_lockscreen_decline_normal.png new file mode 100644 index 0000000000000..d88087b44a376 Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_lockscreen_decline_normal.png differ diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_email2_activated.png b/core/res/res/drawable-hdpi/ic_lockscreen_email2_activated.png new file mode 100644 index 0000000000000..018a7cb4f1dc3 Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_lockscreen_email2_activated.png differ diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_email2_normal.png b/core/res/res/drawable-hdpi/ic_lockscreen_email2_normal.png new file mode 100644 index 0000000000000..324efd4b3ef73 Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_lockscreen_email2_normal.png differ diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_email_activated.png b/core/res/res/drawable-hdpi/ic_lockscreen_email_activated.png new file mode 100644 index 0000000000000..17aeaa769ecb6 Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_lockscreen_email_activated.png differ diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_email_normal.png b/core/res/res/drawable-hdpi/ic_lockscreen_email_normal.png new file mode 100644 index 0000000000000..1aaf27a438d8d Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_lockscreen_email_normal.png differ diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_facebook_activated.png b/core/res/res/drawable-hdpi/ic_lockscreen_facebook_activated.png new file mode 100644 index 0000000000000..37b4c12853a9e Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_lockscreen_facebook_activated.png differ diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_facebook_normal.png b/core/res/res/drawable-hdpi/ic_lockscreen_facebook_normal.png new file mode 100644 index 0000000000000..6f967d0d34044 Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_lockscreen_facebook_normal.png differ diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_gallery_activated.png b/core/res/res/drawable-hdpi/ic_lockscreen_gallery_activated.png new file mode 100644 index 0000000000000..013c908c4c43e Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_lockscreen_gallery_activated.png differ diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_gallery_normal.png b/core/res/res/drawable-hdpi/ic_lockscreen_gallery_normal.png new file mode 100644 index 0000000000000..9fd4315f8f892 Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_lockscreen_gallery_normal.png differ diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_google_activated.png b/core/res/res/drawable-hdpi/ic_lockscreen_google_activated.png index 2c4847c531793..7c105e6687990 100644 Binary files a/core/res/res/drawable-hdpi/ic_lockscreen_google_activated.png and b/core/res/res/drawable-hdpi/ic_lockscreen_google_activated.png differ diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_google_normal.png b/core/res/res/drawable-hdpi/ic_lockscreen_google_normal.png index 656f3ba17e0da..5daf9ed014357 100644 Binary files a/core/res/res/drawable-hdpi/ic_lockscreen_google_normal.png and b/core/res/res/drawable-hdpi/ic_lockscreen_google_normal.png differ diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_google_small_activated.png b/core/res/res/drawable-hdpi/ic_lockscreen_google_small_activated.png new file mode 100644 index 0000000000000..4449857060d02 Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_lockscreen_google_small_activated.png differ diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_google_small_normal.png b/core/res/res/drawable-hdpi/ic_lockscreen_google_small_normal.png new file mode 100644 index 0000000000000..44460e84d862e Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_lockscreen_google_small_normal.png differ diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_gplus_activated.png b/core/res/res/drawable-hdpi/ic_lockscreen_gplus_activated.png new file mode 100644 index 0000000000000..a526ab7a4b869 Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_lockscreen_gplus_activated.png differ diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_gplus_normal.png b/core/res/res/drawable-hdpi/ic_lockscreen_gplus_normal.png new file mode 100644 index 0000000000000..8187db46a28d0 Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_lockscreen_gplus_normal.png differ diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_gtalk_activated.png b/core/res/res/drawable-hdpi/ic_lockscreen_gtalk_activated.png new file mode 100644 index 0000000000000..eb4aa82038f26 Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_lockscreen_gtalk_activated.png differ diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_gtalk_normal.png b/core/res/res/drawable-hdpi/ic_lockscreen_gtalk_normal.png new file mode 100644 index 0000000000000..d86b90eb6a882 Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_lockscreen_gtalk_normal.png differ diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_lock_pressed.png b/core/res/res/drawable-hdpi/ic_lockscreen_lock_pressed.png index 0bbf62fd1231c..1e2d3cabb6344 100644 Binary files a/core/res/res/drawable-hdpi/ic_lockscreen_lock_pressed.png and b/core/res/res/drawable-hdpi/ic_lockscreen_lock_pressed.png differ diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_maps_activated.png b/core/res/res/drawable-hdpi/ic_lockscreen_maps_activated.png new file mode 100644 index 0000000000000..6e070e4fe68ac Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_lockscreen_maps_activated.png differ diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_maps_normal.png b/core/res/res/drawable-hdpi/ic_lockscreen_maps_normal.png new file mode 100644 index 0000000000000..15ea525885c58 Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_lockscreen_maps_normal.png differ diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_movie_activated.png b/core/res/res/drawable-hdpi/ic_lockscreen_movie_activated.png new file mode 100644 index 0000000000000..1fecc76b482da Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_lockscreen_movie_activated.png differ diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_movie_normal.png b/core/res/res/drawable-hdpi/ic_lockscreen_movie_normal.png new file mode 100644 index 0000000000000..e020698f56a9f Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_lockscreen_movie_normal.png differ diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_music_activated.png b/core/res/res/drawable-hdpi/ic_lockscreen_music_activated.png new file mode 100644 index 0000000000000..9b1f39c86c16d Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_lockscreen_music_activated.png differ diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_music_normal.png b/core/res/res/drawable-hdpi/ic_lockscreen_music_normal.png new file mode 100644 index 0000000000000..1af9ba6389e53 Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_lockscreen_music_normal.png differ diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_nav_activated.png b/core/res/res/drawable-hdpi/ic_lockscreen_nav_activated.png new file mode 100644 index 0000000000000..0dead7ceb8dd1 Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_lockscreen_nav_activated.png differ diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_nav_normal.png b/core/res/res/drawable-hdpi/ic_lockscreen_nav_normal.png new file mode 100644 index 0000000000000..8284c0112844b Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_lockscreen_nav_normal.png differ diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_phone_activated.png b/core/res/res/drawable-hdpi/ic_lockscreen_phone_activated.png new file mode 100644 index 0000000000000..1a2f90c147ab9 Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_lockscreen_phone_activated.png differ diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_phone_normal.png b/core/res/res/drawable-hdpi/ic_lockscreen_phone_normal.png new file mode 100644 index 0000000000000..eade8f5bb1bfe Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_lockscreen_phone_normal.png differ diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_podcast_activated.png b/core/res/res/drawable-hdpi/ic_lockscreen_podcast_activated.png new file mode 100644 index 0000000000000..c7d587ce16eba Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_lockscreen_podcast_activated.png differ diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_podcast_normal.png b/core/res/res/drawable-hdpi/ic_lockscreen_podcast_normal.png new file mode 100644 index 0000000000000..0c0608da90e58 Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_lockscreen_podcast_normal.png differ diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_rss_activated.png b/core/res/res/drawable-hdpi/ic_lockscreen_rss_activated.png new file mode 100644 index 0000000000000..1cf791e6fbbe3 Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_lockscreen_rss_activated.png differ diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_rss_normal.png b/core/res/res/drawable-hdpi/ic_lockscreen_rss_normal.png new file mode 100644 index 0000000000000..b7478dd64afd5 Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_lockscreen_rss_normal.png differ diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_sim.png b/core/res/res/drawable-hdpi/ic_lockscreen_sim.png new file mode 100644 index 0000000000000..7cf9e3699ceb1 Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_lockscreen_sim.png differ diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_sms_activated.png b/core/res/res/drawable-hdpi/ic_lockscreen_sms_activated.png new file mode 100644 index 0000000000000..2497315da5cfd Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_lockscreen_sms_activated.png differ diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_sms_normal.png b/core/res/res/drawable-hdpi/ic_lockscreen_sms_normal.png new file mode 100644 index 0000000000000..e2c126c37557c Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_lockscreen_sms_normal.png differ diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_soundon_normal.png b/core/res/res/drawable-hdpi/ic_lockscreen_soundon_normal.png index 0dd81c021791e..74c92575e6830 100644 Binary files a/core/res/res/drawable-hdpi/ic_lockscreen_soundon_normal.png and b/core/res/res/drawable-hdpi/ic_lockscreen_soundon_normal.png differ diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_target_activated.png b/core/res/res/drawable-hdpi/ic_lockscreen_target_activated.png new file mode 100644 index 0000000000000..c5810bf392408 Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_lockscreen_target_activated.png differ diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_twitter_activated.png b/core/res/res/drawable-hdpi/ic_lockscreen_twitter_activated.png new file mode 100644 index 0000000000000..42a4b27ca209e Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_lockscreen_twitter_activated.png differ diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_twitter_normal.png b/core/res/res/drawable-hdpi/ic_lockscreen_twitter_normal.png new file mode 100644 index 0000000000000..b716c3892b148 Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_lockscreen_twitter_normal.png differ diff --git a/core/res/res/drawable-hdpi/ic_media_route_on_0_holo_dark.png b/core/res/res/drawable-hdpi/ic_media_route_on_0_holo_dark.png new file mode 100644 index 0000000000000..10fc8dac3b651 Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_media_route_on_0_holo_dark.png differ diff --git a/core/res/res/drawable-hdpi/ic_media_route_on_0_holo_light.png b/core/res/res/drawable-hdpi/ic_media_route_on_0_holo_light.png new file mode 100644 index 0000000000000..a0e5060727c49 Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_media_route_on_0_holo_light.png differ diff --git a/core/res/res/drawable-hdpi/ic_media_route_on_1_holo_dark.png b/core/res/res/drawable-hdpi/ic_media_route_on_1_holo_dark.png new file mode 100644 index 0000000000000..8364a3672b16d Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_media_route_on_1_holo_dark.png differ diff --git a/core/res/res/drawable-hdpi/ic_media_route_on_1_holo_light.png b/core/res/res/drawable-hdpi/ic_media_route_on_1_holo_light.png new file mode 100644 index 0000000000000..44b89e1ae8c75 Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_media_route_on_1_holo_light.png differ diff --git a/core/res/res/drawable-hdpi/ic_media_route_on_2_holo_dark.png b/core/res/res/drawable-hdpi/ic_media_route_on_2_holo_dark.png new file mode 100644 index 0000000000000..770bf78d13673 Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_media_route_on_2_holo_dark.png differ diff --git a/core/res/res/drawable-hdpi/ic_media_route_on_2_holo_light.png b/core/res/res/drawable-hdpi/ic_media_route_on_2_holo_light.png new file mode 100644 index 0000000000000..2a2467b8c3cee Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_media_route_on_2_holo_light.png differ diff --git a/core/res/res/drawable-hdpi/ic_notify_wifidisplay.png b/core/res/res/drawable-hdpi/ic_notify_wifidisplay.png new file mode 100644 index 0000000000000..35f27df17260c Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_notify_wifidisplay.png differ diff --git a/core/res/res/drawable-hdpi/ic_suggestions_add.png b/core/res/res/drawable-hdpi/ic_suggestions_add.png deleted file mode 100644 index 919872c1e9b28..0000000000000 Binary files a/core/res/res/drawable-hdpi/ic_suggestions_add.png and /dev/null differ diff --git a/core/res/res/drawable-hdpi/ic_suggestions_delete.png b/core/res/res/drawable-hdpi/ic_suggestions_delete.png deleted file mode 100644 index fa42db0941785..0000000000000 Binary files a/core/res/res/drawable-hdpi/ic_suggestions_delete.png and /dev/null differ diff --git a/core/res/res/drawable-hdpi/kg_add_widget.png b/core/res/res/drawable-hdpi/kg_add_widget.png new file mode 100644 index 0000000000000..723d97a3a9816 Binary files /dev/null and b/core/res/res/drawable-hdpi/kg_add_widget.png differ diff --git a/core/res/res/drawable-hdpi/kg_bouncer_bg_white.9.png b/core/res/res/drawable-hdpi/kg_bouncer_bg_white.9.png new file mode 100644 index 0000000000000..cfd5db357dc4e Binary files /dev/null and b/core/res/res/drawable-hdpi/kg_bouncer_bg_white.9.png differ diff --git a/core/res/res/drawable-hdpi/kg_security_grip.9.png b/core/res/res/drawable-hdpi/kg_security_grip.9.png new file mode 100644 index 0000000000000..1e40aef336997 Binary files /dev/null and b/core/res/res/drawable-hdpi/kg_security_grip.9.png differ diff --git a/core/res/res/drawable-hdpi/kg_security_lock.png b/core/res/res/drawable-hdpi/kg_security_lock.png new file mode 100644 index 0000000000000..c3c94c464bf89 Binary files /dev/null and b/core/res/res/drawable-hdpi/kg_security_lock.png differ diff --git a/core/res/res/drawable-hdpi/kg_security_lock_focused.png b/core/res/res/drawable-hdpi/kg_security_lock_focused.png new file mode 100644 index 0000000000000..abcf6837a722a Binary files /dev/null and b/core/res/res/drawable-hdpi/kg_security_lock_focused.png differ diff --git a/core/res/res/drawable-hdpi/kg_security_lock_normal.png b/core/res/res/drawable-hdpi/kg_security_lock_normal.png new file mode 100644 index 0000000000000..e8cff24a4255e Binary files /dev/null and b/core/res/res/drawable-hdpi/kg_security_lock_normal.png differ diff --git a/core/res/res/drawable-hdpi/kg_security_lock_pressed.png b/core/res/res/drawable-hdpi/kg_security_lock_pressed.png new file mode 100644 index 0000000000000..3214dcbcdbfc5 Binary files /dev/null and b/core/res/res/drawable-hdpi/kg_security_lock_pressed.png differ diff --git a/core/res/res/drawable-hdpi/kg_widget_bg_padded.9.png b/core/res/res/drawable-hdpi/kg_widget_bg_padded.9.png new file mode 100644 index 0000000000000..dff1dfaf9d27a Binary files /dev/null and b/core/res/res/drawable-hdpi/kg_widget_bg_padded.9.png differ diff --git a/core/res/res/drawable-hdpi/kg_widget_delete_drop_target.png b/core/res/res/drawable-hdpi/kg_widget_delete_drop_target.png new file mode 100644 index 0000000000000..84549ff946a7d Binary files /dev/null and b/core/res/res/drawable-hdpi/kg_widget_delete_drop_target.png differ diff --git a/core/res/res/drawable-hdpi/lockscreen_protection_pattern.png b/core/res/res/drawable-hdpi/lockscreen_protection_pattern.png new file mode 100644 index 0000000000000..681d8be1f8c63 Binary files /dev/null and b/core/res/res/drawable-hdpi/lockscreen_protection_pattern.png differ diff --git a/core/res/res/drawable-hdpi/magnified_region_frame.9.png b/core/res/res/drawable-hdpi/magnified_region_frame.9.png new file mode 100644 index 0000000000000..29bdc42e82072 Binary files /dev/null and b/core/res/res/drawable-hdpi/magnified_region_frame.9.png differ diff --git a/core/res/res/drawable-hdpi/menu_dropdown_panel_holo_dark.9.png b/core/res/res/drawable-hdpi/menu_dropdown_panel_holo_dark.9.png index 4d3d208578c61..e83b3466ee8c4 100644 Binary files a/core/res/res/drawable-hdpi/menu_dropdown_panel_holo_dark.9.png and b/core/res/res/drawable-hdpi/menu_dropdown_panel_holo_dark.9.png differ diff --git a/core/res/res/drawable-hdpi/menu_dropdown_panel_holo_light.9.png b/core/res/res/drawable-hdpi/menu_dropdown_panel_holo_light.9.png index 924a99d173082..fd4fbf8f3c1f1 100644 Binary files a/core/res/res/drawable-hdpi/menu_dropdown_panel_holo_light.9.png and b/core/res/res/drawable-hdpi/menu_dropdown_panel_holo_light.9.png differ diff --git a/core/res/res/drawable-hdpi/menu_hardkey_panel_holo_dark.9.png b/core/res/res/drawable-hdpi/menu_hardkey_panel_holo_dark.9.png index 53871a0515737..8aee55a8d2825 100644 Binary files a/core/res/res/drawable-hdpi/menu_hardkey_panel_holo_dark.9.png and b/core/res/res/drawable-hdpi/menu_hardkey_panel_holo_dark.9.png differ diff --git a/core/res/res/drawable-hdpi/menu_hardkey_panel_holo_light.9.png b/core/res/res/drawable-hdpi/menu_hardkey_panel_holo_light.9.png index e3a031357fce5..2ebb7a2f76358 100644 Binary files a/core/res/res/drawable-hdpi/menu_hardkey_panel_holo_light.9.png and b/core/res/res/drawable-hdpi/menu_hardkey_panel_holo_light.9.png differ diff --git a/core/res/res/drawable-hdpi/panel_bg_holo_dark.9.png b/core/res/res/drawable-hdpi/panel_bg_holo_dark.9.png index 1b4fed88c4628..a5ac279767b70 100644 Binary files a/core/res/res/drawable-hdpi/panel_bg_holo_dark.9.png and b/core/res/res/drawable-hdpi/panel_bg_holo_dark.9.png differ diff --git a/core/res/res/drawable-hdpi/panel_bg_holo_light.9.png b/core/res/res/drawable-hdpi/panel_bg_holo_light.9.png index c8b3177ceabd8..583865e78f1d2 100644 Binary files a/core/res/res/drawable-hdpi/panel_bg_holo_light.9.png and b/core/res/res/drawable-hdpi/panel_bg_holo_light.9.png differ diff --git a/core/res/res/drawable-hdpi/spinner_ab_default_holo_dark.9.png b/core/res/res/drawable-hdpi/spinner_ab_default_holo_dark.9.png index eb28ff9a5516c..88f8765cd06ab 100644 Binary files a/core/res/res/drawable-hdpi/spinner_ab_default_holo_dark.9.png and b/core/res/res/drawable-hdpi/spinner_ab_default_holo_dark.9.png differ diff --git a/core/res/res/drawable-hdpi/spinner_ab_default_holo_light.9.png b/core/res/res/drawable-hdpi/spinner_ab_default_holo_light.9.png index d281adb553af8..fa68a137f3558 100644 Binary files a/core/res/res/drawable-hdpi/spinner_ab_default_holo_light.9.png and b/core/res/res/drawable-hdpi/spinner_ab_default_holo_light.9.png differ diff --git a/core/res/res/drawable-hdpi/spinner_ab_disabled_holo_dark.9.png b/core/res/res/drawable-hdpi/spinner_ab_disabled_holo_dark.9.png index b2985860907ac..78c63cba8e01e 100644 Binary files a/core/res/res/drawable-hdpi/spinner_ab_disabled_holo_dark.9.png and b/core/res/res/drawable-hdpi/spinner_ab_disabled_holo_dark.9.png differ diff --git a/core/res/res/drawable-hdpi/spinner_ab_disabled_holo_light.9.png b/core/res/res/drawable-hdpi/spinner_ab_disabled_holo_light.9.png index 4215396dd4e51..e13a9f801133a 100644 Binary files a/core/res/res/drawable-hdpi/spinner_ab_disabled_holo_light.9.png and b/core/res/res/drawable-hdpi/spinner_ab_disabled_holo_light.9.png differ diff --git a/core/res/res/drawable-hdpi/spinner_ab_focused_holo_dark.9.png b/core/res/res/drawable-hdpi/spinner_ab_focused_holo_dark.9.png index a280eabf59b5e..26d2e168c2c49 100644 Binary files a/core/res/res/drawable-hdpi/spinner_ab_focused_holo_dark.9.png and b/core/res/res/drawable-hdpi/spinner_ab_focused_holo_dark.9.png differ diff --git a/core/res/res/drawable-hdpi/spinner_ab_focused_holo_light.9.png b/core/res/res/drawable-hdpi/spinner_ab_focused_holo_light.9.png index f8d619b4d47ab..00ae92afe4d41 100644 Binary files a/core/res/res/drawable-hdpi/spinner_ab_focused_holo_light.9.png and b/core/res/res/drawable-hdpi/spinner_ab_focused_holo_light.9.png differ diff --git a/core/res/res/drawable-hdpi/spinner_ab_pressed_holo_dark.9.png b/core/res/res/drawable-hdpi/spinner_ab_pressed_holo_dark.9.png index 955a2f34061ae..dc20a8d6ec048 100644 Binary files a/core/res/res/drawable-hdpi/spinner_ab_pressed_holo_dark.9.png and b/core/res/res/drawable-hdpi/spinner_ab_pressed_holo_dark.9.png differ diff --git a/core/res/res/drawable-hdpi/spinner_ab_pressed_holo_light.9.png b/core/res/res/drawable-hdpi/spinner_ab_pressed_holo_light.9.png index 6c22e223acd3a..272a2a11c5c9b 100644 Binary files a/core/res/res/drawable-hdpi/spinner_ab_pressed_holo_light.9.png and b/core/res/res/drawable-hdpi/spinner_ab_pressed_holo_light.9.png differ diff --git a/core/res/res/drawable-hdpi/spinner_default_holo_dark.9.png b/core/res/res/drawable-hdpi/spinner_default_holo_dark.9.png index 34a88dfa8f87e..78e583ce26f72 100644 Binary files a/core/res/res/drawable-hdpi/spinner_default_holo_dark.9.png and b/core/res/res/drawable-hdpi/spinner_default_holo_dark.9.png differ diff --git a/core/res/res/drawable-hdpi/spinner_default_holo_light.9.png b/core/res/res/drawable-hdpi/spinner_default_holo_light.9.png index b03842dfa265e..fb54f2299bca3 100644 Binary files a/core/res/res/drawable-hdpi/spinner_default_holo_light.9.png and b/core/res/res/drawable-hdpi/spinner_default_holo_light.9.png differ diff --git a/core/res/res/drawable-hdpi/spinner_disabled_holo_dark.9.png b/core/res/res/drawable-hdpi/spinner_disabled_holo_dark.9.png index 2d306d984149b..210832cd3bfaa 100644 Binary files a/core/res/res/drawable-hdpi/spinner_disabled_holo_dark.9.png and b/core/res/res/drawable-hdpi/spinner_disabled_holo_dark.9.png differ diff --git a/core/res/res/drawable-hdpi/spinner_disabled_holo_light.9.png b/core/res/res/drawable-hdpi/spinner_disabled_holo_light.9.png index 720c4175c605f..d0d94197b9cfc 100644 Binary files a/core/res/res/drawable-hdpi/spinner_disabled_holo_light.9.png and b/core/res/res/drawable-hdpi/spinner_disabled_holo_light.9.png differ diff --git a/core/res/res/drawable-hdpi/spinner_focused_holo_dark.9.png b/core/res/res/drawable-hdpi/spinner_focused_holo_dark.9.png index b038fba6150a2..be365ec057293 100644 Binary files a/core/res/res/drawable-hdpi/spinner_focused_holo_dark.9.png and b/core/res/res/drawable-hdpi/spinner_focused_holo_dark.9.png differ diff --git a/core/res/res/drawable-hdpi/spinner_focused_holo_light.9.png b/core/res/res/drawable-hdpi/spinner_focused_holo_light.9.png index ccffda98dbcde..cd7b803bb122c 100644 Binary files a/core/res/res/drawable-hdpi/spinner_focused_holo_light.9.png and b/core/res/res/drawable-hdpi/spinner_focused_holo_light.9.png differ diff --git a/core/res/res/drawable-hdpi/spinner_pressed_holo_dark.9.png b/core/res/res/drawable-hdpi/spinner_pressed_holo_dark.9.png index f638d5e7965e3..84560c52183b3 100644 Binary files a/core/res/res/drawable-hdpi/spinner_pressed_holo_dark.9.png and b/core/res/res/drawable-hdpi/spinner_pressed_holo_dark.9.png differ diff --git a/core/res/res/drawable-hdpi/spinner_pressed_holo_light.9.png b/core/res/res/drawable-hdpi/spinner_pressed_holo_light.9.png index 0aedd25de2cca..e101d504dcb93 100644 Binary files a/core/res/res/drawable-hdpi/spinner_pressed_holo_light.9.png and b/core/res/res/drawable-hdpi/spinner_pressed_holo_light.9.png differ diff --git a/core/res/res/drawable-hdpi/stat_notify_rssi_in_range.png b/core/res/res/drawable-hdpi/stat_notify_rssi_in_range.png new file mode 100644 index 0000000000000..74977e6aefffb Binary files /dev/null and b/core/res/res/drawable-hdpi/stat_notify_rssi_in_range.png differ diff --git a/core/res/res/drawable-hdpi/stat_sys_adb.png b/core/res/res/drawable-hdpi/stat_sys_adb.png index cfbbd8d2d646e..6c1bd0eaf0b24 100644 Binary files a/core/res/res/drawable-hdpi/stat_sys_adb.png and b/core/res/res/drawable-hdpi/stat_sys_adb.png differ diff --git a/core/res/res/drawable-hdpi/stat_sys_tether_bluetooth.png b/core/res/res/drawable-hdpi/stat_sys_tether_bluetooth.png index 9451174d65d7c..ab5208e985b0c 100644 Binary files a/core/res/res/drawable-hdpi/stat_sys_tether_bluetooth.png and b/core/res/res/drawable-hdpi/stat_sys_tether_bluetooth.png differ diff --git a/core/res/res/drawable-hdpi/stat_sys_tether_usb.png b/core/res/res/drawable-hdpi/stat_sys_tether_usb.png index cae1bd1b2574c..b40f8d9d2486f 100644 Binary files a/core/res/res/drawable-hdpi/stat_sys_tether_usb.png and b/core/res/res/drawable-hdpi/stat_sys_tether_usb.png differ diff --git a/core/res/res/drawable-hdpi/stat_sys_tether_wifi.png b/core/res/res/drawable-hdpi/stat_sys_tether_wifi.png index 7d4df504edfe5..86c3df3b696fb 100644 Binary files a/core/res/res/drawable-hdpi/stat_sys_tether_wifi.png and b/core/res/res/drawable-hdpi/stat_sys_tether_wifi.png differ diff --git a/core/res/res/drawable-hdpi/sym_keyboard_delete.png b/core/res/res/drawable-hdpi/sym_keyboard_delete.png old mode 100755 new mode 100644 index 59d78bec06339..476d90238aa6e Binary files a/core/res/res/drawable-hdpi/sym_keyboard_delete.png and b/core/res/res/drawable-hdpi/sym_keyboard_delete.png differ diff --git a/core/res/res/drawable-hdpi/sym_keyboard_enter.png b/core/res/res/drawable-hdpi/sym_keyboard_enter.png new file mode 100644 index 0000000000000..d118af289663b Binary files /dev/null and b/core/res/res/drawable-hdpi/sym_keyboard_enter.png differ diff --git a/core/res/res/drawable-hdpi/sym_keyboard_num0_no_plus.png b/core/res/res/drawable-hdpi/sym_keyboard_num0_no_plus.png index 0e5f1e2979d67..ad81bb3ed795d 100644 Binary files a/core/res/res/drawable-hdpi/sym_keyboard_num0_no_plus.png and b/core/res/res/drawable-hdpi/sym_keyboard_num0_no_plus.png differ diff --git a/core/res/res/drawable-hdpi/sym_keyboard_num1.png b/core/res/res/drawable-hdpi/sym_keyboard_num1.png old mode 100755 new mode 100644 index 0fc03efa51f52..8d2468c5e4563 Binary files a/core/res/res/drawable-hdpi/sym_keyboard_num1.png and b/core/res/res/drawable-hdpi/sym_keyboard_num1.png differ diff --git a/core/res/res/drawable-hdpi/sym_keyboard_num2.png b/core/res/res/drawable-hdpi/sym_keyboard_num2.png old mode 100755 new mode 100644 index 283560b353437..cfa972b31d53c Binary files a/core/res/res/drawable-hdpi/sym_keyboard_num2.png and b/core/res/res/drawable-hdpi/sym_keyboard_num2.png differ diff --git a/core/res/res/drawable-hdpi/sym_keyboard_num3.png b/core/res/res/drawable-hdpi/sym_keyboard_num3.png old mode 100755 new mode 100644 index 9a3b3294b90d5..141833ac15260 Binary files a/core/res/res/drawable-hdpi/sym_keyboard_num3.png and b/core/res/res/drawable-hdpi/sym_keyboard_num3.png differ diff --git a/core/res/res/drawable-hdpi/sym_keyboard_num4.png b/core/res/res/drawable-hdpi/sym_keyboard_num4.png old mode 100755 new mode 100644 index f13ff1ae91dbd..07df14d3c98a9 Binary files a/core/res/res/drawable-hdpi/sym_keyboard_num4.png and b/core/res/res/drawable-hdpi/sym_keyboard_num4.png differ diff --git a/core/res/res/drawable-hdpi/sym_keyboard_num5.png b/core/res/res/drawable-hdpi/sym_keyboard_num5.png old mode 100755 new mode 100644 index c251329fa4ed1..fbcc9bffbf92e Binary files a/core/res/res/drawable-hdpi/sym_keyboard_num5.png and b/core/res/res/drawable-hdpi/sym_keyboard_num5.png differ diff --git a/core/res/res/drawable-hdpi/sym_keyboard_num6.png b/core/res/res/drawable-hdpi/sym_keyboard_num6.png old mode 100755 new mode 100644 index 4acba4c9103d5..9513b331dea8c Binary files a/core/res/res/drawable-hdpi/sym_keyboard_num6.png and b/core/res/res/drawable-hdpi/sym_keyboard_num6.png differ diff --git a/core/res/res/drawable-hdpi/sym_keyboard_num7.png b/core/res/res/drawable-hdpi/sym_keyboard_num7.png old mode 100755 new mode 100644 index 14931c18c53f6..5ad25d8e10e57 Binary files a/core/res/res/drawable-hdpi/sym_keyboard_num7.png and b/core/res/res/drawable-hdpi/sym_keyboard_num7.png differ diff --git a/core/res/res/drawable-hdpi/sym_keyboard_num8.png b/core/res/res/drawable-hdpi/sym_keyboard_num8.png old mode 100755 new mode 100644 index d4973fdc900ff..97d5c0e1d79f4 Binary files a/core/res/res/drawable-hdpi/sym_keyboard_num8.png and b/core/res/res/drawable-hdpi/sym_keyboard_num8.png differ diff --git a/core/res/res/drawable-hdpi/sym_keyboard_num9.png b/core/res/res/drawable-hdpi/sym_keyboard_num9.png old mode 100755 new mode 100644 index 49cec66f4d277..a7d6a836c7a7c Binary files a/core/res/res/drawable-hdpi/sym_keyboard_num9.png and b/core/res/res/drawable-hdpi/sym_keyboard_num9.png differ diff --git a/core/res/res/drawable-hdpi/sym_keyboard_return_holo.png b/core/res/res/drawable-hdpi/sym_keyboard_return_holo.png new file mode 100644 index 0000000000000..f1bcf487c5f1e Binary files /dev/null and b/core/res/res/drawable-hdpi/sym_keyboard_return_holo.png differ diff --git a/core/res/res/drawable-hdpi/textfield_activated_holo_dark.9.png b/core/res/res/drawable-hdpi/textfield_activated_holo_dark.9.png index 56481ced24a77..b7c5dcda44bcc 100644 Binary files a/core/res/res/drawable-hdpi/textfield_activated_holo_dark.9.png and b/core/res/res/drawable-hdpi/textfield_activated_holo_dark.9.png differ diff --git a/core/res/res/drawable-hdpi/textfield_activated_holo_light.9.png b/core/res/res/drawable-hdpi/textfield_activated_holo_light.9.png index 56481ced24a77..1aaa9aea3670e 100644 Binary files a/core/res/res/drawable-hdpi/textfield_activated_holo_light.9.png and b/core/res/res/drawable-hdpi/textfield_activated_holo_light.9.png differ diff --git a/core/res/res/drawable-hdpi/textfield_default_holo_dark.9.png b/core/res/res/drawable-hdpi/textfield_default_holo_dark.9.png index d15f9a674306c..e6ef29601e453 100644 Binary files a/core/res/res/drawable-hdpi/textfield_default_holo_dark.9.png and b/core/res/res/drawable-hdpi/textfield_default_holo_dark.9.png differ diff --git a/core/res/res/drawable-hdpi/textfield_default_holo_light.9.png b/core/res/res/drawable-hdpi/textfield_default_holo_light.9.png index 073f91e1f481b..7368261d29e4a 100644 Binary files a/core/res/res/drawable-hdpi/textfield_default_holo_light.9.png and b/core/res/res/drawable-hdpi/textfield_default_holo_light.9.png differ diff --git a/core/res/res/drawable-hdpi/textfield_disabled_focused_holo_dark.9.png b/core/res/res/drawable-hdpi/textfield_disabled_focused_holo_dark.9.png index fe753154c918b..29e33e3746f54 100644 Binary files a/core/res/res/drawable-hdpi/textfield_disabled_focused_holo_dark.9.png and b/core/res/res/drawable-hdpi/textfield_disabled_focused_holo_dark.9.png differ diff --git a/core/res/res/drawable-hdpi/textfield_disabled_focused_holo_light.9.png b/core/res/res/drawable-hdpi/textfield_disabled_focused_holo_light.9.png index d7f78ab7026cf..b70db4e101a8f 100644 Binary files a/core/res/res/drawable-hdpi/textfield_disabled_focused_holo_light.9.png and b/core/res/res/drawable-hdpi/textfield_disabled_focused_holo_light.9.png differ diff --git a/core/res/res/drawable-hdpi/textfield_disabled_holo_dark.9.png b/core/res/res/drawable-hdpi/textfield_disabled_holo_dark.9.png index 769bc0a1b8964..73ec37cf47589 100644 Binary files a/core/res/res/drawable-hdpi/textfield_disabled_holo_dark.9.png and b/core/res/res/drawable-hdpi/textfield_disabled_holo_dark.9.png differ diff --git a/core/res/res/drawable-hdpi/textfield_disabled_holo_light.9.png b/core/res/res/drawable-hdpi/textfield_disabled_holo_light.9.png index 312a0f48cd53a..a77d66d990371 100644 Binary files a/core/res/res/drawable-hdpi/textfield_disabled_holo_light.9.png and b/core/res/res/drawable-hdpi/textfield_disabled_holo_light.9.png differ diff --git a/core/res/res/drawable-hdpi/textfield_multiline_activated_holo_dark.9.png b/core/res/res/drawable-hdpi/textfield_multiline_activated_holo_dark.9.png index 56481ced24a77..3141caf425848 100644 Binary files a/core/res/res/drawable-hdpi/textfield_multiline_activated_holo_dark.9.png and b/core/res/res/drawable-hdpi/textfield_multiline_activated_holo_dark.9.png differ diff --git a/core/res/res/drawable-hdpi/textfield_multiline_activated_holo_light.9.png b/core/res/res/drawable-hdpi/textfield_multiline_activated_holo_light.9.png index 56481ced24a77..df7f7708644be 100644 Binary files a/core/res/res/drawable-hdpi/textfield_multiline_activated_holo_light.9.png and b/core/res/res/drawable-hdpi/textfield_multiline_activated_holo_light.9.png differ diff --git a/core/res/res/drawable-hdpi/textfield_multiline_default_holo_dark.9.png b/core/res/res/drawable-hdpi/textfield_multiline_default_holo_dark.9.png index e27b409b7452c..ab381a6c57776 100644 Binary files a/core/res/res/drawable-hdpi/textfield_multiline_default_holo_dark.9.png and b/core/res/res/drawable-hdpi/textfield_multiline_default_holo_dark.9.png differ diff --git a/core/res/res/drawable-hdpi/textfield_multiline_default_holo_light.9.png b/core/res/res/drawable-hdpi/textfield_multiline_default_holo_light.9.png index 073f91e1f481b..ed1306cb89d15 100644 Binary files a/core/res/res/drawable-hdpi/textfield_multiline_default_holo_light.9.png and b/core/res/res/drawable-hdpi/textfield_multiline_default_holo_light.9.png differ diff --git a/core/res/res/drawable-hdpi/textfield_multiline_disabled_focused_holo_dark.9.png b/core/res/res/drawable-hdpi/textfield_multiline_disabled_focused_holo_dark.9.png index f33763b874e6e..269e6b3a358dd 100644 Binary files a/core/res/res/drawable-hdpi/textfield_multiline_disabled_focused_holo_dark.9.png and b/core/res/res/drawable-hdpi/textfield_multiline_disabled_focused_holo_dark.9.png differ diff --git a/core/res/res/drawable-hdpi/textfield_multiline_disabled_focused_holo_light.9.png b/core/res/res/drawable-hdpi/textfield_multiline_disabled_focused_holo_light.9.png index d7f78ab7026cf..e0a83fea18acd 100644 Binary files a/core/res/res/drawable-hdpi/textfield_multiline_disabled_focused_holo_light.9.png and b/core/res/res/drawable-hdpi/textfield_multiline_disabled_focused_holo_light.9.png differ diff --git a/core/res/res/drawable-hdpi/textfield_multiline_disabled_holo_dark.9.png b/core/res/res/drawable-hdpi/textfield_multiline_disabled_holo_dark.9.png index 2e50f72974c4c..9f14a0698e7d3 100644 Binary files a/core/res/res/drawable-hdpi/textfield_multiline_disabled_holo_dark.9.png and b/core/res/res/drawable-hdpi/textfield_multiline_disabled_holo_dark.9.png differ diff --git a/core/res/res/drawable-hdpi/textfield_multiline_disabled_holo_light.9.png b/core/res/res/drawable-hdpi/textfield_multiline_disabled_holo_light.9.png index 312a0f48cd53a..c458698d74db1 100644 Binary files a/core/res/res/drawable-hdpi/textfield_multiline_disabled_holo_light.9.png and b/core/res/res/drawable-hdpi/textfield_multiline_disabled_holo_light.9.png differ diff --git a/core/res/res/drawable-hdpi/textfield_multiline_focused_holo_dark.9.png b/core/res/res/drawable-hdpi/textfield_multiline_focused_holo_dark.9.png index 6784032ce18c8..180d85c3dcba6 100644 Binary files a/core/res/res/drawable-hdpi/textfield_multiline_focused_holo_dark.9.png and b/core/res/res/drawable-hdpi/textfield_multiline_focused_holo_dark.9.png differ diff --git a/core/res/res/drawable-hdpi/textfield_multiline_focused_holo_light.9.png b/core/res/res/drawable-hdpi/textfield_multiline_focused_holo_light.9.png index 74746cb0da063..e075149bc41c7 100644 Binary files a/core/res/res/drawable-hdpi/textfield_multiline_focused_holo_light.9.png and b/core/res/res/drawable-hdpi/textfield_multiline_focused_holo_light.9.png differ diff --git a/core/res/res/drawable-ldrtl-hdpi/ic_ab_back_holo_dark.png b/core/res/res/drawable-ldrtl-hdpi/ic_ab_back_holo_dark.png new file mode 100644 index 0000000000000..9beeb0fd5bd8f Binary files /dev/null and b/core/res/res/drawable-ldrtl-hdpi/ic_ab_back_holo_dark.png differ diff --git a/core/res/res/drawable-ldrtl-hdpi/ic_ab_back_holo_light.png b/core/res/res/drawable-ldrtl-hdpi/ic_ab_back_holo_light.png new file mode 100644 index 0000000000000..844e38be65a59 Binary files /dev/null and b/core/res/res/drawable-ldrtl-hdpi/ic_ab_back_holo_light.png differ diff --git a/core/res/res/drawable-ldrtl-mdpi/ic_ab_back_holo_dark.png b/core/res/res/drawable-ldrtl-mdpi/ic_ab_back_holo_dark.png new file mode 100644 index 0000000000000..c22dc9035e5de Binary files /dev/null and b/core/res/res/drawable-ldrtl-mdpi/ic_ab_back_holo_dark.png differ diff --git a/core/res/res/drawable-ldrtl-mdpi/ic_ab_back_holo_light.png b/core/res/res/drawable-ldrtl-mdpi/ic_ab_back_holo_light.png new file mode 100644 index 0000000000000..f49b715f3418e Binary files /dev/null and b/core/res/res/drawable-ldrtl-mdpi/ic_ab_back_holo_light.png differ diff --git a/core/res/res/drawable-ldrtl-xhdpi/ic_ab_back_holo_dark.png b/core/res/res/drawable-ldrtl-xhdpi/ic_ab_back_holo_dark.png new file mode 100644 index 0000000000000..8dfb7d8281418 Binary files /dev/null and b/core/res/res/drawable-ldrtl-xhdpi/ic_ab_back_holo_dark.png differ diff --git a/core/res/res/drawable-ldrtl-xhdpi/ic_ab_back_holo_light.png b/core/res/res/drawable-ldrtl-xhdpi/ic_ab_back_holo_light.png new file mode 100644 index 0000000000000..29852ad5dacda Binary files /dev/null and b/core/res/res/drawable-ldrtl-xhdpi/ic_ab_back_holo_light.png differ diff --git a/core/res/res/drawable-mdpi/btn_default_disabled_focused_holo_dark.9.png b/core/res/res/drawable-mdpi/btn_default_disabled_focused_holo_dark.9.png index 38d00db5ced48..87933fa4ddc90 100644 Binary files a/core/res/res/drawable-mdpi/btn_default_disabled_focused_holo_dark.9.png and b/core/res/res/drawable-mdpi/btn_default_disabled_focused_holo_dark.9.png differ diff --git a/core/res/res/drawable-mdpi/btn_default_disabled_focused_holo_light.9.png b/core/res/res/drawable-mdpi/btn_default_disabled_focused_holo_light.9.png index 38d00db5ced48..87933fa4ddc90 100644 Binary files a/core/res/res/drawable-mdpi/btn_default_disabled_focused_holo_light.9.png and b/core/res/res/drawable-mdpi/btn_default_disabled_focused_holo_light.9.png differ diff --git a/core/res/res/drawable-mdpi/btn_default_disabled_holo.9.png b/core/res/res/drawable-mdpi/btn_default_disabled_holo.9.png index 85c2c4f8ed6e7..77f6492013f1d 100644 Binary files a/core/res/res/drawable-mdpi/btn_default_disabled_holo.9.png and b/core/res/res/drawable-mdpi/btn_default_disabled_holo.9.png differ diff --git a/core/res/res/drawable-mdpi/btn_default_disabled_holo_dark.9.png b/core/res/res/drawable-mdpi/btn_default_disabled_holo_dark.9.png index 4a6351a45d642..d424a0e77e9b9 100644 Binary files a/core/res/res/drawable-mdpi/btn_default_disabled_holo_dark.9.png and b/core/res/res/drawable-mdpi/btn_default_disabled_holo_dark.9.png differ diff --git a/core/res/res/drawable-mdpi/btn_default_disabled_holo_light.9.png b/core/res/res/drawable-mdpi/btn_default_disabled_holo_light.9.png index 4a6351a45d642..d424a0e77e9b9 100644 Binary files a/core/res/res/drawable-mdpi/btn_default_disabled_holo_light.9.png and b/core/res/res/drawable-mdpi/btn_default_disabled_holo_light.9.png differ diff --git a/core/res/res/drawable-mdpi/btn_default_focused_holo.9.png b/core/res/res/drawable-mdpi/btn_default_focused_holo.9.png index 89d7a0e66d538..683f12890b7e7 100644 Binary files a/core/res/res/drawable-mdpi/btn_default_focused_holo.9.png and b/core/res/res/drawable-mdpi/btn_default_focused_holo.9.png differ diff --git a/core/res/res/drawable-mdpi/btn_default_focused_holo_dark.9.png b/core/res/res/drawable-mdpi/btn_default_focused_holo_dark.9.png index 39950f6cad1d2..076386849f2ff 100644 Binary files a/core/res/res/drawable-mdpi/btn_default_focused_holo_dark.9.png and b/core/res/res/drawable-mdpi/btn_default_focused_holo_dark.9.png differ diff --git a/core/res/res/drawable-mdpi/btn_default_focused_holo_light.9.png b/core/res/res/drawable-mdpi/btn_default_focused_holo_light.9.png index 39950f6cad1d2..076386849f2ff 100644 Binary files a/core/res/res/drawable-mdpi/btn_default_focused_holo_light.9.png and b/core/res/res/drawable-mdpi/btn_default_focused_holo_light.9.png differ diff --git a/core/res/res/drawable-mdpi/btn_default_normal_holo.9.png b/core/res/res/drawable-mdpi/btn_default_normal_holo.9.png index 0895d57e89eca..0e0da34a31f88 100644 Binary files a/core/res/res/drawable-mdpi/btn_default_normal_holo.9.png and b/core/res/res/drawable-mdpi/btn_default_normal_holo.9.png differ diff --git a/core/res/res/drawable-mdpi/btn_default_normal_holo_dark.9.png b/core/res/res/drawable-mdpi/btn_default_normal_holo_dark.9.png index 54c635490834c..accc761582d5a 100644 Binary files a/core/res/res/drawable-mdpi/btn_default_normal_holo_dark.9.png and b/core/res/res/drawable-mdpi/btn_default_normal_holo_dark.9.png differ diff --git a/core/res/res/drawable-mdpi/btn_default_normal_holo_light.9.png b/core/res/res/drawable-mdpi/btn_default_normal_holo_light.9.png index 50070ed45910d..accc761582d5a 100644 Binary files a/core/res/res/drawable-mdpi/btn_default_normal_holo_light.9.png and b/core/res/res/drawable-mdpi/btn_default_normal_holo_light.9.png differ diff --git a/core/res/res/drawable-mdpi/btn_default_pressed_holo.9.png b/core/res/res/drawable-mdpi/btn_default_pressed_holo.9.png index 6a1b6a139abb1..eb7a1fd117c0b 100644 Binary files a/core/res/res/drawable-mdpi/btn_default_pressed_holo.9.png and b/core/res/res/drawable-mdpi/btn_default_pressed_holo.9.png differ diff --git a/core/res/res/drawable-mdpi/btn_default_pressed_holo_dark.9.png b/core/res/res/drawable-mdpi/btn_default_pressed_holo_dark.9.png index 13a1fdd311674..7e4eb5ee75d1a 100644 Binary files a/core/res/res/drawable-mdpi/btn_default_pressed_holo_dark.9.png and b/core/res/res/drawable-mdpi/btn_default_pressed_holo_dark.9.png differ diff --git a/core/res/res/drawable-mdpi/btn_default_pressed_holo_light.9.png b/core/res/res/drawable-mdpi/btn_default_pressed_holo_light.9.png index 13a1fdd311674..7e4eb5ee75d1a 100644 Binary files a/core/res/res/drawable-mdpi/btn_default_pressed_holo_light.9.png and b/core/res/res/drawable-mdpi/btn_default_pressed_holo_light.9.png differ diff --git a/core/res/res/drawable-mdpi/btn_toggle_off_disabled_focused_holo_dark.9.png b/core/res/res/drawable-mdpi/btn_toggle_off_disabled_focused_holo_dark.9.png index 88da06e1d7def..3fdd3bc5df97a 100644 Binary files a/core/res/res/drawable-mdpi/btn_toggle_off_disabled_focused_holo_dark.9.png and b/core/res/res/drawable-mdpi/btn_toggle_off_disabled_focused_holo_dark.9.png differ diff --git a/core/res/res/drawable-mdpi/btn_toggle_off_disabled_focused_holo_light.9.png b/core/res/res/drawable-mdpi/btn_toggle_off_disabled_focused_holo_light.9.png index 88da06e1d7def..3fdd3bc5df97a 100644 Binary files a/core/res/res/drawable-mdpi/btn_toggle_off_disabled_focused_holo_light.9.png and b/core/res/res/drawable-mdpi/btn_toggle_off_disabled_focused_holo_light.9.png differ diff --git a/core/res/res/drawable-mdpi/btn_toggle_off_disabled_holo_dark.9.png b/core/res/res/drawable-mdpi/btn_toggle_off_disabled_holo_dark.9.png index ae2c2c4bfc4b8..eaa02b332c4dc 100644 Binary files a/core/res/res/drawable-mdpi/btn_toggle_off_disabled_holo_dark.9.png and b/core/res/res/drawable-mdpi/btn_toggle_off_disabled_holo_dark.9.png differ diff --git a/core/res/res/drawable-mdpi/btn_toggle_off_disabled_holo_light.9.png b/core/res/res/drawable-mdpi/btn_toggle_off_disabled_holo_light.9.png index ae2c2c4bfc4b8..eaa02b332c4dc 100644 Binary files a/core/res/res/drawable-mdpi/btn_toggle_off_disabled_holo_light.9.png and b/core/res/res/drawable-mdpi/btn_toggle_off_disabled_holo_light.9.png differ diff --git a/core/res/res/drawable-mdpi/btn_toggle_off_focused_holo_dark.9.png b/core/res/res/drawable-mdpi/btn_toggle_off_focused_holo_dark.9.png index db0f9ab68882c..28c8b944fc5fe 100644 Binary files a/core/res/res/drawable-mdpi/btn_toggle_off_focused_holo_dark.9.png and b/core/res/res/drawable-mdpi/btn_toggle_off_focused_holo_dark.9.png differ diff --git a/core/res/res/drawable-mdpi/btn_toggle_off_focused_holo_light.9.png b/core/res/res/drawable-mdpi/btn_toggle_off_focused_holo_light.9.png index db0f9ab68882c..28c8b944fc5fe 100644 Binary files a/core/res/res/drawable-mdpi/btn_toggle_off_focused_holo_light.9.png and b/core/res/res/drawable-mdpi/btn_toggle_off_focused_holo_light.9.png differ diff --git a/core/res/res/drawable-mdpi/btn_toggle_off_normal_holo_dark.9.png b/core/res/res/drawable-mdpi/btn_toggle_off_normal_holo_dark.9.png index 7abaf3ed0ad9c..6090cce2d4fb9 100644 Binary files a/core/res/res/drawable-mdpi/btn_toggle_off_normal_holo_dark.9.png and b/core/res/res/drawable-mdpi/btn_toggle_off_normal_holo_dark.9.png differ diff --git a/core/res/res/drawable-mdpi/btn_toggle_off_normal_holo_light.9.png b/core/res/res/drawable-mdpi/btn_toggle_off_normal_holo_light.9.png index 7abaf3ed0ad9c..6090cce2d4fb9 100644 Binary files a/core/res/res/drawable-mdpi/btn_toggle_off_normal_holo_light.9.png and b/core/res/res/drawable-mdpi/btn_toggle_off_normal_holo_light.9.png differ diff --git a/core/res/res/drawable-mdpi/btn_toggle_off_pressed_holo_dark.9.png b/core/res/res/drawable-mdpi/btn_toggle_off_pressed_holo_dark.9.png index 354fd0e2c48fa..045dc9a1f8cf4 100644 Binary files a/core/res/res/drawable-mdpi/btn_toggle_off_pressed_holo_dark.9.png and b/core/res/res/drawable-mdpi/btn_toggle_off_pressed_holo_dark.9.png differ diff --git a/core/res/res/drawable-mdpi/btn_toggle_off_pressed_holo_light.9.png b/core/res/res/drawable-mdpi/btn_toggle_off_pressed_holo_light.9.png index 354fd0e2c48fa..045dc9a1f8cf4 100644 Binary files a/core/res/res/drawable-mdpi/btn_toggle_off_pressed_holo_light.9.png and b/core/res/res/drawable-mdpi/btn_toggle_off_pressed_holo_light.9.png differ diff --git a/core/res/res/drawable-mdpi/btn_toggle_on_disabled_focused_holo_dark.9.png b/core/res/res/drawable-mdpi/btn_toggle_on_disabled_focused_holo_dark.9.png index d311c8077ad68..3f2e982edda43 100644 Binary files a/core/res/res/drawable-mdpi/btn_toggle_on_disabled_focused_holo_dark.9.png and b/core/res/res/drawable-mdpi/btn_toggle_on_disabled_focused_holo_dark.9.png differ diff --git a/core/res/res/drawable-mdpi/btn_toggle_on_disabled_focused_holo_light.9.png b/core/res/res/drawable-mdpi/btn_toggle_on_disabled_focused_holo_light.9.png index d311c8077ad68..3f2e982edda43 100644 Binary files a/core/res/res/drawable-mdpi/btn_toggle_on_disabled_focused_holo_light.9.png and b/core/res/res/drawable-mdpi/btn_toggle_on_disabled_focused_holo_light.9.png differ diff --git a/core/res/res/drawable-mdpi/btn_toggle_on_disabled_holo_dark.9.png b/core/res/res/drawable-mdpi/btn_toggle_on_disabled_holo_dark.9.png index d0fd585c6027d..14b958b5a1b99 100644 Binary files a/core/res/res/drawable-mdpi/btn_toggle_on_disabled_holo_dark.9.png and b/core/res/res/drawable-mdpi/btn_toggle_on_disabled_holo_dark.9.png differ diff --git a/core/res/res/drawable-mdpi/btn_toggle_on_disabled_holo_light.9.png b/core/res/res/drawable-mdpi/btn_toggle_on_disabled_holo_light.9.png index d0fd585c6027d..14b958b5a1b99 100644 Binary files a/core/res/res/drawable-mdpi/btn_toggle_on_disabled_holo_light.9.png and b/core/res/res/drawable-mdpi/btn_toggle_on_disabled_holo_light.9.png differ diff --git a/core/res/res/drawable-mdpi/btn_toggle_on_focused_holo_dark.9.png b/core/res/res/drawable-mdpi/btn_toggle_on_focused_holo_dark.9.png index e27b3ded920e1..4db22d4de82c6 100644 Binary files a/core/res/res/drawable-mdpi/btn_toggle_on_focused_holo_dark.9.png and b/core/res/res/drawable-mdpi/btn_toggle_on_focused_holo_dark.9.png differ diff --git a/core/res/res/drawable-mdpi/btn_toggle_on_focused_holo_light.9.png b/core/res/res/drawable-mdpi/btn_toggle_on_focused_holo_light.9.png index e27b3ded920e1..4db22d4de82c6 100644 Binary files a/core/res/res/drawable-mdpi/btn_toggle_on_focused_holo_light.9.png and b/core/res/res/drawable-mdpi/btn_toggle_on_focused_holo_light.9.png differ diff --git a/core/res/res/drawable-mdpi/btn_toggle_on_normal_holo_dark.9.png b/core/res/res/drawable-mdpi/btn_toggle_on_normal_holo_dark.9.png index cbed62f41d98e..a11e1c770bf1d 100644 Binary files a/core/res/res/drawable-mdpi/btn_toggle_on_normal_holo_dark.9.png and b/core/res/res/drawable-mdpi/btn_toggle_on_normal_holo_dark.9.png differ diff --git a/core/res/res/drawable-mdpi/btn_toggle_on_normal_holo_light.9.png b/core/res/res/drawable-mdpi/btn_toggle_on_normal_holo_light.9.png index cbed62f41d98e..a11e1c770bf1d 100644 Binary files a/core/res/res/drawable-mdpi/btn_toggle_on_normal_holo_light.9.png and b/core/res/res/drawable-mdpi/btn_toggle_on_normal_holo_light.9.png differ diff --git a/core/res/res/drawable-mdpi/btn_toggle_on_pressed_holo_dark.9.png b/core/res/res/drawable-mdpi/btn_toggle_on_pressed_holo_dark.9.png index 16fa3320f7cc3..6c4aa16f93668 100644 Binary files a/core/res/res/drawable-mdpi/btn_toggle_on_pressed_holo_dark.9.png and b/core/res/res/drawable-mdpi/btn_toggle_on_pressed_holo_dark.9.png differ diff --git a/core/res/res/drawable-mdpi/btn_toggle_on_pressed_holo_light.9.png b/core/res/res/drawable-mdpi/btn_toggle_on_pressed_holo_light.9.png index 16fa3320f7cc3..6c4aa16f93668 100644 Binary files a/core/res/res/drawable-mdpi/btn_toggle_on_pressed_holo_light.9.png and b/core/res/res/drawable-mdpi/btn_toggle_on_pressed_holo_light.9.png differ diff --git a/core/res/res/drawable-mdpi/dialog_bottom_holo_dark.9.png b/core/res/res/drawable-mdpi/dialog_bottom_holo_dark.9.png index 611d538906ce7..f874d663014b2 100644 Binary files a/core/res/res/drawable-mdpi/dialog_bottom_holo_dark.9.png and b/core/res/res/drawable-mdpi/dialog_bottom_holo_dark.9.png differ diff --git a/core/res/res/drawable-mdpi/dialog_bottom_holo_light.9.png b/core/res/res/drawable-mdpi/dialog_bottom_holo_light.9.png index cf2f01b1f4568..0d6c7153decc6 100644 Binary files a/core/res/res/drawable-mdpi/dialog_bottom_holo_light.9.png and b/core/res/res/drawable-mdpi/dialog_bottom_holo_light.9.png differ diff --git a/core/res/res/drawable-mdpi/dialog_full_holo_dark.9.png b/core/res/res/drawable-mdpi/dialog_full_holo_dark.9.png index fb3660eab1c5c..63144ae128635 100644 Binary files a/core/res/res/drawable-mdpi/dialog_full_holo_dark.9.png and b/core/res/res/drawable-mdpi/dialog_full_holo_dark.9.png differ diff --git a/core/res/res/drawable-mdpi/dialog_full_holo_light.9.png b/core/res/res/drawable-mdpi/dialog_full_holo_light.9.png index f18050ea589ea..953ba78334c75 100644 Binary files a/core/res/res/drawable-mdpi/dialog_full_holo_light.9.png and b/core/res/res/drawable-mdpi/dialog_full_holo_light.9.png differ diff --git a/core/res/res/drawable-mdpi/dialog_middle_holo_dark.9.png b/core/res/res/drawable-mdpi/dialog_middle_holo_dark.9.png index b620341bf29e9..0c57ffcb8db7a 100644 Binary files a/core/res/res/drawable-mdpi/dialog_middle_holo_dark.9.png and b/core/res/res/drawable-mdpi/dialog_middle_holo_dark.9.png differ diff --git a/core/res/res/drawable-mdpi/dialog_middle_holo_light.9.png b/core/res/res/drawable-mdpi/dialog_middle_holo_light.9.png index 4035428e7ae8b..c6be52eb5f37a 100644 Binary files a/core/res/res/drawable-mdpi/dialog_middle_holo_light.9.png and b/core/res/res/drawable-mdpi/dialog_middle_holo_light.9.png differ diff --git a/core/res/res/drawable-mdpi/dialog_top_holo_dark.9.png b/core/res/res/drawable-mdpi/dialog_top_holo_dark.9.png index 4d9974879373c..7e9f2584672a7 100644 Binary files a/core/res/res/drawable-mdpi/dialog_top_holo_dark.9.png and b/core/res/res/drawable-mdpi/dialog_top_holo_dark.9.png differ diff --git a/core/res/res/drawable-mdpi/dialog_top_holo_light.9.png b/core/res/res/drawable-mdpi/dialog_top_holo_light.9.png index 6f5f149c2b239..11cc5a4fc6dbf 100644 Binary files a/core/res/res/drawable-mdpi/dialog_top_holo_light.9.png and b/core/res/res/drawable-mdpi/dialog_top_holo_light.9.png differ diff --git a/core/res/res/drawable-mdpi/ic_coins_s.png b/core/res/res/drawable-mdpi/ic_coins_s.png new file mode 100644 index 0000000000000..3b8fd8abd5277 Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_coins_s.png differ diff --git a/core/res/res/drawable-mdpi/ic_lock_expanded_desktop.png b/core/res/res/drawable-mdpi/ic_lock_expanded_desktop.png new file mode 100644 index 0000000000000..bffad732e8f0c Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_lock_expanded_desktop.png differ diff --git a/core/res/res/drawable-mdpi/ic_lock_idle_calendar.png b/core/res/res/drawable-mdpi/ic_lock_idle_calendar.png new file mode 100644 index 0000000000000..2834c8f7fcd2f Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_lock_idle_calendar.png differ diff --git a/core/res/res/drawable-mdpi/ic_lock_profile.png b/core/res/res/drawable-mdpi/ic_lock_profile.png new file mode 100644 index 0000000000000..d47ba1631cf10 Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_lock_profile.png differ diff --git a/core/res/res/drawable-mdpi/ic_lock_reboot.png b/core/res/res/drawable-mdpi/ic_lock_reboot.png new file mode 100644 index 0000000000000..2b125b98f4cba Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_lock_reboot.png differ diff --git a/core/res/res/drawable-mdpi/ic_lock_screenshot.png b/core/res/res/drawable-mdpi/ic_lock_screenshot.png new file mode 100644 index 0000000000000..9996e726df3c8 Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_lock_screenshot.png differ diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_alarm.png b/core/res/res/drawable-mdpi/ic_lockscreen_alarm.png new file mode 100644 index 0000000000000..330ade15fb78d Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_lockscreen_alarm.png differ diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_alarm_activated.png b/core/res/res/drawable-mdpi/ic_lockscreen_alarm_activated.png new file mode 100644 index 0000000000000..3e6bf27f29e37 Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_lockscreen_alarm_activated.png differ diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_alarm_normal.png b/core/res/res/drawable-mdpi/ic_lockscreen_alarm_normal.png new file mode 100644 index 0000000000000..e7cd0fe5e239f Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_lockscreen_alarm_normal.png differ diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_answer_active.png b/core/res/res/drawable-mdpi/ic_lockscreen_answer_active.png new file mode 100644 index 0000000000000..0ad03c0f211eb Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_lockscreen_answer_active.png differ diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_answer_focused.png b/core/res/res/drawable-mdpi/ic_lockscreen_answer_focused.png new file mode 100644 index 0000000000000..f46e8bd0b993e Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_lockscreen_answer_focused.png differ diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_answer_normal.png b/core/res/res/drawable-mdpi/ic_lockscreen_answer_normal.png new file mode 100644 index 0000000000000..ddeeb18fc0e59 Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_lockscreen_answer_normal.png differ diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_browser_activated.png b/core/res/res/drawable-mdpi/ic_lockscreen_browser_activated.png new file mode 100644 index 0000000000000..53a97b9108126 Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_lockscreen_browser_activated.png differ diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_browser_normal.png b/core/res/res/drawable-mdpi/ic_lockscreen_browser_normal.png new file mode 100644 index 0000000000000..c9e4e2c8e113b Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_lockscreen_browser_normal.png differ diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_calendar_activated.png b/core/res/res/drawable-mdpi/ic_lockscreen_calendar_activated.png new file mode 100644 index 0000000000000..19ec569c12d25 Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_lockscreen_calendar_activated.png differ diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_calendar_normal.png b/core/res/res/drawable-mdpi/ic_lockscreen_calendar_normal.png new file mode 100644 index 0000000000000..d1f274cfde24a Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_lockscreen_calendar_normal.png differ diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_camera_activated.png b/core/res/res/drawable-mdpi/ic_lockscreen_camera_activated.png index 862f33bffe6bf..69f254ef913be 100644 Binary files a/core/res/res/drawable-mdpi/ic_lockscreen_camera_activated.png and b/core/res/res/drawable-mdpi/ic_lockscreen_camera_activated.png differ diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_camera_normal.png b/core/res/res/drawable-mdpi/ic_lockscreen_camera_normal.png index 30df0a328ca56..bc179d1d325e2 100644 Binary files a/core/res/res/drawable-mdpi/ic_lockscreen_camera_normal.png and b/core/res/res/drawable-mdpi/ic_lockscreen_camera_normal.png differ diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_chevron_down.png b/core/res/res/drawable-mdpi/ic_lockscreen_chevron_down.png deleted file mode 100644 index 308fe8a29321a..0000000000000 Binary files a/core/res/res/drawable-mdpi/ic_lockscreen_chevron_down.png and /dev/null differ diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_chevron_left.png b/core/res/res/drawable-mdpi/ic_lockscreen_chevron_left.png deleted file mode 100644 index 9a2563433d1f4..0000000000000 Binary files a/core/res/res/drawable-mdpi/ic_lockscreen_chevron_left.png and /dev/null differ diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_chevron_right.png b/core/res/res/drawable-mdpi/ic_lockscreen_chevron_right.png deleted file mode 100644 index 77240d03453f2..0000000000000 Binary files a/core/res/res/drawable-mdpi/ic_lockscreen_chevron_right.png and /dev/null differ diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_chevron_up.png b/core/res/res/drawable-mdpi/ic_lockscreen_chevron_up.png deleted file mode 100644 index e0b013425e7c9..0000000000000 Binary files a/core/res/res/drawable-mdpi/ic_lockscreen_chevron_up.png and /dev/null differ diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_chrome_activated.png b/core/res/res/drawable-mdpi/ic_lockscreen_chrome_activated.png new file mode 100644 index 0000000000000..52a4221e0c681 Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_lockscreen_chrome_activated.png differ diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_chrome_normal.png b/core/res/res/drawable-mdpi/ic_lockscreen_chrome_normal.png new file mode 100644 index 0000000000000..1abda2f10caa2 Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_lockscreen_chrome_normal.png differ diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_decline_activated.png b/core/res/res/drawable-mdpi/ic_lockscreen_decline_activated.png new file mode 100644 index 0000000000000..d1aae183448f0 Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_lockscreen_decline_activated.png differ diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_decline_focused.png b/core/res/res/drawable-mdpi/ic_lockscreen_decline_focused.png new file mode 100644 index 0000000000000..b52c844d24732 Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_lockscreen_decline_focused.png differ diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_decline_normal.png b/core/res/res/drawable-mdpi/ic_lockscreen_decline_normal.png new file mode 100644 index 0000000000000..722027ec086e7 Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_lockscreen_decline_normal.png differ diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_email2_activated.png b/core/res/res/drawable-mdpi/ic_lockscreen_email2_activated.png new file mode 100644 index 0000000000000..8b5c9b87981f0 Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_lockscreen_email2_activated.png differ diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_email2_normal.png b/core/res/res/drawable-mdpi/ic_lockscreen_email2_normal.png new file mode 100644 index 0000000000000..601a6ee947be0 Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_lockscreen_email2_normal.png differ diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_email_activated.png b/core/res/res/drawable-mdpi/ic_lockscreen_email_activated.png new file mode 100644 index 0000000000000..e411398ca90c1 Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_lockscreen_email_activated.png differ diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_email_normal.png b/core/res/res/drawable-mdpi/ic_lockscreen_email_normal.png new file mode 100644 index 0000000000000..b44ac5f29aaac Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_lockscreen_email_normal.png differ diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_facebook_activated.png b/core/res/res/drawable-mdpi/ic_lockscreen_facebook_activated.png new file mode 100644 index 0000000000000..db3ba3307b286 Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_lockscreen_facebook_activated.png differ diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_facebook_normal.png b/core/res/res/drawable-mdpi/ic_lockscreen_facebook_normal.png new file mode 100644 index 0000000000000..2753b44eb4ba5 Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_lockscreen_facebook_normal.png differ diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_gallery_activated.png b/core/res/res/drawable-mdpi/ic_lockscreen_gallery_activated.png new file mode 100644 index 0000000000000..2fe369d573b35 Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_lockscreen_gallery_activated.png differ diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_gallery_normal.png b/core/res/res/drawable-mdpi/ic_lockscreen_gallery_normal.png new file mode 100644 index 0000000000000..8342819ae996d Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_lockscreen_gallery_normal.png differ diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_google_activated.png b/core/res/res/drawable-mdpi/ic_lockscreen_google_activated.png index 32a68e0f28c19..35a3ad5655359 100644 Binary files a/core/res/res/drawable-mdpi/ic_lockscreen_google_activated.png and b/core/res/res/drawable-mdpi/ic_lockscreen_google_activated.png differ diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_google_normal.png b/core/res/res/drawable-mdpi/ic_lockscreen_google_normal.png index 2f7efcf5e80bf..292b0ced96ea9 100644 Binary files a/core/res/res/drawable-mdpi/ic_lockscreen_google_normal.png and b/core/res/res/drawable-mdpi/ic_lockscreen_google_normal.png differ diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_google_small_activated.png b/core/res/res/drawable-mdpi/ic_lockscreen_google_small_activated.png new file mode 100644 index 0000000000000..2b903baf28211 Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_lockscreen_google_small_activated.png differ diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_google_small_normal.png b/core/res/res/drawable-mdpi/ic_lockscreen_google_small_normal.png new file mode 100644 index 0000000000000..103d40e7d6392 Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_lockscreen_google_small_normal.png differ diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_gplus_activated.png b/core/res/res/drawable-mdpi/ic_lockscreen_gplus_activated.png new file mode 100644 index 0000000000000..9b0c0cc90e56b Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_lockscreen_gplus_activated.png differ diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_gplus_normal.png b/core/res/res/drawable-mdpi/ic_lockscreen_gplus_normal.png new file mode 100644 index 0000000000000..acc280e787e2e Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_lockscreen_gplus_normal.png differ diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_gtalk_activated.png b/core/res/res/drawable-mdpi/ic_lockscreen_gtalk_activated.png new file mode 100644 index 0000000000000..26687758d552c Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_lockscreen_gtalk_activated.png differ diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_gtalk_normal.png b/core/res/res/drawable-mdpi/ic_lockscreen_gtalk_normal.png new file mode 100644 index 0000000000000..7521ee98d7966 Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_lockscreen_gtalk_normal.png differ diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_lock_pressed.png b/core/res/res/drawable-mdpi/ic_lockscreen_lock_pressed.png index aab2f6b065b6f..d9f5e040db39e 100644 Binary files a/core/res/res/drawable-mdpi/ic_lockscreen_lock_pressed.png and b/core/res/res/drawable-mdpi/ic_lockscreen_lock_pressed.png differ diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_maps_activated.png b/core/res/res/drawable-mdpi/ic_lockscreen_maps_activated.png new file mode 100644 index 0000000000000..3368e95a5fa24 Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_lockscreen_maps_activated.png differ diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_maps_normal.png b/core/res/res/drawable-mdpi/ic_lockscreen_maps_normal.png new file mode 100644 index 0000000000000..67bc22f3db1db Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_lockscreen_maps_normal.png differ diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_movie_activated.png b/core/res/res/drawable-mdpi/ic_lockscreen_movie_activated.png new file mode 100644 index 0000000000000..ff07877c09921 Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_lockscreen_movie_activated.png differ diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_movie_normal.png b/core/res/res/drawable-mdpi/ic_lockscreen_movie_normal.png new file mode 100644 index 0000000000000..2ad3588f651d4 Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_lockscreen_movie_normal.png differ diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_music_activated.png b/core/res/res/drawable-mdpi/ic_lockscreen_music_activated.png new file mode 100644 index 0000000000000..15037f7447dad Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_lockscreen_music_activated.png differ diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_music_normal.png b/core/res/res/drawable-mdpi/ic_lockscreen_music_normal.png new file mode 100644 index 0000000000000..4f2571219ca27 Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_lockscreen_music_normal.png differ diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_nav_activated.png b/core/res/res/drawable-mdpi/ic_lockscreen_nav_activated.png new file mode 100644 index 0000000000000..300e8854f9f5d Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_lockscreen_nav_activated.png differ diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_nav_normal.png b/core/res/res/drawable-mdpi/ic_lockscreen_nav_normal.png new file mode 100644 index 0000000000000..04e5bab437ab4 Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_lockscreen_nav_normal.png differ diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_phone_activated.png b/core/res/res/drawable-mdpi/ic_lockscreen_phone_activated.png new file mode 100644 index 0000000000000..5c75455c55d65 Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_lockscreen_phone_activated.png differ diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_phone_normal.png b/core/res/res/drawable-mdpi/ic_lockscreen_phone_normal.png new file mode 100644 index 0000000000000..04fcb461a4461 Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_lockscreen_phone_normal.png differ diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_podcast_activated.png b/core/res/res/drawable-mdpi/ic_lockscreen_podcast_activated.png new file mode 100644 index 0000000000000..f2a3109477f7d Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_lockscreen_podcast_activated.png differ diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_podcast_normal.png b/core/res/res/drawable-mdpi/ic_lockscreen_podcast_normal.png new file mode 100644 index 0000000000000..c6abe65bdae28 Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_lockscreen_podcast_normal.png differ diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_rss_activated.png b/core/res/res/drawable-mdpi/ic_lockscreen_rss_activated.png new file mode 100644 index 0000000000000..30e69c82b3738 Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_lockscreen_rss_activated.png differ diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_rss_normal.png b/core/res/res/drawable-mdpi/ic_lockscreen_rss_normal.png new file mode 100644 index 0000000000000..1a02883e9a8a3 Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_lockscreen_rss_normal.png differ diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_sim.png b/core/res/res/drawable-mdpi/ic_lockscreen_sim.png new file mode 100644 index 0000000000000..2e259c3e17c17 Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_lockscreen_sim.png differ diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_sms_activated.png b/core/res/res/drawable-mdpi/ic_lockscreen_sms_activated.png new file mode 100644 index 0000000000000..b34b71eea56c7 Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_lockscreen_sms_activated.png differ diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_sms_normal.png b/core/res/res/drawable-mdpi/ic_lockscreen_sms_normal.png new file mode 100644 index 0000000000000..47d205646a785 Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_lockscreen_sms_normal.png differ diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_soundon_normal.png b/core/res/res/drawable-mdpi/ic_lockscreen_soundon_normal.png index eb6ceedb81852..c82e12653a8e4 100644 Binary files a/core/res/res/drawable-mdpi/ic_lockscreen_soundon_normal.png and b/core/res/res/drawable-mdpi/ic_lockscreen_soundon_normal.png differ diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_target_activated.png b/core/res/res/drawable-mdpi/ic_lockscreen_target_activated.png new file mode 100644 index 0000000000000..f2a3109477f7d Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_lockscreen_target_activated.png differ diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_twitter_activated.png b/core/res/res/drawable-mdpi/ic_lockscreen_twitter_activated.png new file mode 100644 index 0000000000000..b33b07890d5d7 Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_lockscreen_twitter_activated.png differ diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_twitter_normal.png b/core/res/res/drawable-mdpi/ic_lockscreen_twitter_normal.png new file mode 100644 index 0000000000000..10817f0e39a79 Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_lockscreen_twitter_normal.png differ diff --git a/core/res/res/drawable-mdpi/ic_media_route_on_0_holo_dark.png b/core/res/res/drawable-mdpi/ic_media_route_on_0_holo_dark.png new file mode 100644 index 0000000000000..fb2ac25a5edc5 Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_media_route_on_0_holo_dark.png differ diff --git a/core/res/res/drawable-mdpi/ic_media_route_on_0_holo_light.png b/core/res/res/drawable-mdpi/ic_media_route_on_0_holo_light.png new file mode 100644 index 0000000000000..0c200910a0a3e Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_media_route_on_0_holo_light.png differ diff --git a/core/res/res/drawable-mdpi/ic_media_route_on_1_holo_dark.png b/core/res/res/drawable-mdpi/ic_media_route_on_1_holo_dark.png new file mode 100644 index 0000000000000..2f70ceef3b7e1 Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_media_route_on_1_holo_dark.png differ diff --git a/core/res/res/drawable-mdpi/ic_media_route_on_1_holo_light.png b/core/res/res/drawable-mdpi/ic_media_route_on_1_holo_light.png new file mode 100644 index 0000000000000..0b76d8e08fe78 Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_media_route_on_1_holo_light.png differ diff --git a/core/res/res/drawable-mdpi/ic_media_route_on_2_holo_dark.png b/core/res/res/drawable-mdpi/ic_media_route_on_2_holo_dark.png new file mode 100644 index 0000000000000..ae7b10534ef00 Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_media_route_on_2_holo_dark.png differ diff --git a/core/res/res/drawable-mdpi/ic_media_route_on_2_holo_light.png b/core/res/res/drawable-mdpi/ic_media_route_on_2_holo_light.png new file mode 100644 index 0000000000000..8d37b9940a188 Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_media_route_on_2_holo_light.png differ diff --git a/core/res/res/drawable-mdpi/ic_notify_wifidisplay.png b/core/res/res/drawable-mdpi/ic_notify_wifidisplay.png new file mode 100644 index 0000000000000..f9c8678f7f644 Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_notify_wifidisplay.png differ diff --git a/core/res/res/drawable-mdpi/ic_suggestions_add.png b/core/res/res/drawable-mdpi/ic_suggestions_add.png deleted file mode 100644 index e98bdf8f04979..0000000000000 Binary files a/core/res/res/drawable-mdpi/ic_suggestions_add.png and /dev/null differ diff --git a/core/res/res/drawable-mdpi/ic_suggestions_delete.png b/core/res/res/drawable-mdpi/ic_suggestions_delete.png deleted file mode 100644 index 78e6ec18e618e..0000000000000 Binary files a/core/res/res/drawable-mdpi/ic_suggestions_delete.png and /dev/null differ diff --git a/core/res/res/drawable-mdpi/kg_add_widget.png b/core/res/res/drawable-mdpi/kg_add_widget.png new file mode 100644 index 0000000000000..5b0a5a485450b Binary files /dev/null and b/core/res/res/drawable-mdpi/kg_add_widget.png differ diff --git a/core/res/res/drawable-mdpi/kg_bouncer_bg_white.9.png b/core/res/res/drawable-mdpi/kg_bouncer_bg_white.9.png new file mode 100644 index 0000000000000..e3cb6db097360 Binary files /dev/null and b/core/res/res/drawable-mdpi/kg_bouncer_bg_white.9.png differ diff --git a/core/res/res/drawable-mdpi/kg_security_grip.9.png b/core/res/res/drawable-mdpi/kg_security_grip.9.png new file mode 100644 index 0000000000000..334a39b5c9a20 Binary files /dev/null and b/core/res/res/drawable-mdpi/kg_security_grip.9.png differ diff --git a/core/res/res/drawable-mdpi/kg_security_lock.png b/core/res/res/drawable-mdpi/kg_security_lock.png new file mode 100644 index 0000000000000..a39f38002e5d1 Binary files /dev/null and b/core/res/res/drawable-mdpi/kg_security_lock.png differ diff --git a/core/res/res/drawable-mdpi/kg_security_lock_focused.png b/core/res/res/drawable-mdpi/kg_security_lock_focused.png new file mode 100644 index 0000000000000..c567a82396a13 Binary files /dev/null and b/core/res/res/drawable-mdpi/kg_security_lock_focused.png differ diff --git a/core/res/res/drawable-mdpi/kg_security_lock_normal.png b/core/res/res/drawable-mdpi/kg_security_lock_normal.png new file mode 100644 index 0000000000000..6fbecc187d3a5 Binary files /dev/null and b/core/res/res/drawable-mdpi/kg_security_lock_normal.png differ diff --git a/core/res/res/drawable-mdpi/kg_security_lock_pressed.png b/core/res/res/drawable-mdpi/kg_security_lock_pressed.png new file mode 100644 index 0000000000000..a88325897837c Binary files /dev/null and b/core/res/res/drawable-mdpi/kg_security_lock_pressed.png differ diff --git a/core/res/res/drawable-mdpi/kg_widget_bg_padded.9.png b/core/res/res/drawable-mdpi/kg_widget_bg_padded.9.png new file mode 100644 index 0000000000000..c313df12f4aa4 Binary files /dev/null and b/core/res/res/drawable-mdpi/kg_widget_bg_padded.9.png differ diff --git a/core/res/res/drawable-mdpi/kg_widget_delete_drop_target.png b/core/res/res/drawable-mdpi/kg_widget_delete_drop_target.png new file mode 100644 index 0000000000000..219f3e5cfd6dd Binary files /dev/null and b/core/res/res/drawable-mdpi/kg_widget_delete_drop_target.png differ diff --git a/core/res/res/drawable-mdpi/lockscreen_protection_pattern.png b/core/res/res/drawable-mdpi/lockscreen_protection_pattern.png new file mode 100644 index 0000000000000..30bcea537afd6 Binary files /dev/null and b/core/res/res/drawable-mdpi/lockscreen_protection_pattern.png differ diff --git a/core/res/res/drawable-mdpi/magnified_region_frame.9.png b/core/res/res/drawable-mdpi/magnified_region_frame.9.png new file mode 100644 index 0000000000000..a61cbea769b73 Binary files /dev/null and b/core/res/res/drawable-mdpi/magnified_region_frame.9.png differ diff --git a/core/res/res/drawable-mdpi/menu_dropdown_panel_holo_dark.9.png b/core/res/res/drawable-mdpi/menu_dropdown_panel_holo_dark.9.png index 460ec46eb0786..9583c9bf6b4de 100644 Binary files a/core/res/res/drawable-mdpi/menu_dropdown_panel_holo_dark.9.png and b/core/res/res/drawable-mdpi/menu_dropdown_panel_holo_dark.9.png differ diff --git a/core/res/res/drawable-mdpi/menu_dropdown_panel_holo_light.9.png b/core/res/res/drawable-mdpi/menu_dropdown_panel_holo_light.9.png index e84adf2d41604..54d2cd06d7ba8 100644 Binary files a/core/res/res/drawable-mdpi/menu_dropdown_panel_holo_light.9.png and b/core/res/res/drawable-mdpi/menu_dropdown_panel_holo_light.9.png differ diff --git a/core/res/res/drawable-mdpi/menu_hardkey_panel_holo_dark.9.png b/core/res/res/drawable-mdpi/menu_hardkey_panel_holo_dark.9.png index 9d80b7762def1..ce48b33da2647 100644 Binary files a/core/res/res/drawable-mdpi/menu_hardkey_panel_holo_dark.9.png and b/core/res/res/drawable-mdpi/menu_hardkey_panel_holo_dark.9.png differ diff --git a/core/res/res/drawable-mdpi/menu_hardkey_panel_holo_light.9.png b/core/res/res/drawable-mdpi/menu_hardkey_panel_holo_light.9.png index efa43256dfb1a..1f313af1362e1 100644 Binary files a/core/res/res/drawable-mdpi/menu_hardkey_panel_holo_light.9.png and b/core/res/res/drawable-mdpi/menu_hardkey_panel_holo_light.9.png differ diff --git a/core/res/res/drawable-mdpi/panel_bg_holo_dark.9.png b/core/res/res/drawable-mdpi/panel_bg_holo_dark.9.png index 8c51b013d22c8..588eb3c087199 100644 Binary files a/core/res/res/drawable-mdpi/panel_bg_holo_dark.9.png and b/core/res/res/drawable-mdpi/panel_bg_holo_dark.9.png differ diff --git a/core/res/res/drawable-mdpi/panel_bg_holo_light.9.png b/core/res/res/drawable-mdpi/panel_bg_holo_light.9.png index f4a25bc007dba..c1cdbc75fc0b8 100644 Binary files a/core/res/res/drawable-mdpi/panel_bg_holo_light.9.png and b/core/res/res/drawable-mdpi/panel_bg_holo_light.9.png differ diff --git a/core/res/res/drawable-mdpi/spinner_ab_default_holo_dark.9.png b/core/res/res/drawable-mdpi/spinner_ab_default_holo_dark.9.png index 29aff4d43f71a..8d759468574ac 100644 Binary files a/core/res/res/drawable-mdpi/spinner_ab_default_holo_dark.9.png and b/core/res/res/drawable-mdpi/spinner_ab_default_holo_dark.9.png differ diff --git a/core/res/res/drawable-mdpi/spinner_ab_default_holo_light.9.png b/core/res/res/drawable-mdpi/spinner_ab_default_holo_light.9.png index 4055f70539b60..716560bb1c9b3 100644 Binary files a/core/res/res/drawable-mdpi/spinner_ab_default_holo_light.9.png and b/core/res/res/drawable-mdpi/spinner_ab_default_holo_light.9.png differ diff --git a/core/res/res/drawable-mdpi/spinner_ab_disabled_holo_dark.9.png b/core/res/res/drawable-mdpi/spinner_ab_disabled_holo_dark.9.png index ea4ee042eaf5c..c3ba89c1f06b6 100644 Binary files a/core/res/res/drawable-mdpi/spinner_ab_disabled_holo_dark.9.png and b/core/res/res/drawable-mdpi/spinner_ab_disabled_holo_dark.9.png differ diff --git a/core/res/res/drawable-mdpi/spinner_ab_disabled_holo_light.9.png b/core/res/res/drawable-mdpi/spinner_ab_disabled_holo_light.9.png index f74c02b9e18c2..67c5358f53846 100644 Binary files a/core/res/res/drawable-mdpi/spinner_ab_disabled_holo_light.9.png and b/core/res/res/drawable-mdpi/spinner_ab_disabled_holo_light.9.png differ diff --git a/core/res/res/drawable-mdpi/spinner_ab_focused_holo_dark.9.png b/core/res/res/drawable-mdpi/spinner_ab_focused_holo_dark.9.png index 09a2992ccaef6..c015f43b20ebe 100644 Binary files a/core/res/res/drawable-mdpi/spinner_ab_focused_holo_dark.9.png and b/core/res/res/drawable-mdpi/spinner_ab_focused_holo_dark.9.png differ diff --git a/core/res/res/drawable-mdpi/spinner_ab_focused_holo_light.9.png b/core/res/res/drawable-mdpi/spinner_ab_focused_holo_light.9.png index 6536ee63329bb..487edc222ddf6 100644 Binary files a/core/res/res/drawable-mdpi/spinner_ab_focused_holo_light.9.png and b/core/res/res/drawable-mdpi/spinner_ab_focused_holo_light.9.png differ diff --git a/core/res/res/drawable-mdpi/spinner_ab_pressed_holo_dark.9.png b/core/res/res/drawable-mdpi/spinner_ab_pressed_holo_dark.9.png index 202b5b72ee8ef..2fa15e7649c00 100644 Binary files a/core/res/res/drawable-mdpi/spinner_ab_pressed_holo_dark.9.png and b/core/res/res/drawable-mdpi/spinner_ab_pressed_holo_dark.9.png differ diff --git a/core/res/res/drawable-mdpi/spinner_ab_pressed_holo_light.9.png b/core/res/res/drawable-mdpi/spinner_ab_pressed_holo_light.9.png index 6de0ba8841d25..a964b2228ba54 100644 Binary files a/core/res/res/drawable-mdpi/spinner_ab_pressed_holo_light.9.png and b/core/res/res/drawable-mdpi/spinner_ab_pressed_holo_light.9.png differ diff --git a/core/res/res/drawable-mdpi/spinner_default_holo_dark.9.png b/core/res/res/drawable-mdpi/spinner_default_holo_dark.9.png index 48af19222ecce..5ac84dd14108e 100644 Binary files a/core/res/res/drawable-mdpi/spinner_default_holo_dark.9.png and b/core/res/res/drawable-mdpi/spinner_default_holo_dark.9.png differ diff --git a/core/res/res/drawable-mdpi/spinner_default_holo_light.9.png b/core/res/res/drawable-mdpi/spinner_default_holo_light.9.png index b3180cbb69eef..3eeebc4bd99a2 100644 Binary files a/core/res/res/drawable-mdpi/spinner_default_holo_light.9.png and b/core/res/res/drawable-mdpi/spinner_default_holo_light.9.png differ diff --git a/core/res/res/drawable-mdpi/spinner_disabled_holo_dark.9.png b/core/res/res/drawable-mdpi/spinner_disabled_holo_dark.9.png index 22eddd8ae0b22..2734f20bf18d1 100644 Binary files a/core/res/res/drawable-mdpi/spinner_disabled_holo_dark.9.png and b/core/res/res/drawable-mdpi/spinner_disabled_holo_dark.9.png differ diff --git a/core/res/res/drawable-mdpi/spinner_disabled_holo_light.9.png b/core/res/res/drawable-mdpi/spinner_disabled_holo_light.9.png index dad0ec9a263d8..a78d6c082d41e 100644 Binary files a/core/res/res/drawable-mdpi/spinner_disabled_holo_light.9.png and b/core/res/res/drawable-mdpi/spinner_disabled_holo_light.9.png differ diff --git a/core/res/res/drawable-mdpi/spinner_focused_holo_dark.9.png b/core/res/res/drawable-mdpi/spinner_focused_holo_dark.9.png index 2cdd273bc8d0a..7d9191505c0a5 100644 Binary files a/core/res/res/drawable-mdpi/spinner_focused_holo_dark.9.png and b/core/res/res/drawable-mdpi/spinner_focused_holo_dark.9.png differ diff --git a/core/res/res/drawable-mdpi/spinner_focused_holo_light.9.png b/core/res/res/drawable-mdpi/spinner_focused_holo_light.9.png index f605db8959428..d7c4b87a45bd7 100644 Binary files a/core/res/res/drawable-mdpi/spinner_focused_holo_light.9.png and b/core/res/res/drawable-mdpi/spinner_focused_holo_light.9.png differ diff --git a/core/res/res/drawable-mdpi/spinner_pressed_holo_dark.9.png b/core/res/res/drawable-mdpi/spinner_pressed_holo_dark.9.png index a699924830583..b82d1ac81f038 100644 Binary files a/core/res/res/drawable-mdpi/spinner_pressed_holo_dark.9.png and b/core/res/res/drawable-mdpi/spinner_pressed_holo_dark.9.png differ diff --git a/core/res/res/drawable-mdpi/spinner_pressed_holo_light.9.png b/core/res/res/drawable-mdpi/spinner_pressed_holo_light.9.png index f3c12d7928035..f9b5f647e4b7c 100644 Binary files a/core/res/res/drawable-mdpi/spinner_pressed_holo_light.9.png and b/core/res/res/drawable-mdpi/spinner_pressed_holo_light.9.png differ diff --git a/core/res/res/drawable-mdpi/stat_notify_rssi_in_range.png b/core/res/res/drawable-mdpi/stat_notify_rssi_in_range.png new file mode 100644 index 0000000000000..62e4fe94a35c1 Binary files /dev/null and b/core/res/res/drawable-mdpi/stat_notify_rssi_in_range.png differ diff --git a/core/res/res/drawable-mdpi/stat_sys_adb.png b/core/res/res/drawable-mdpi/stat_sys_adb.png index 4862919cacb77..529298bce4a9d 100644 Binary files a/core/res/res/drawable-mdpi/stat_sys_adb.png and b/core/res/res/drawable-mdpi/stat_sys_adb.png differ diff --git a/core/res/res/drawable-mdpi/stat_sys_tether_bluetooth.png b/core/res/res/drawable-mdpi/stat_sys_tether_bluetooth.png index f42dae0fdcb90..fc620b8a4dc0f 100644 Binary files a/core/res/res/drawable-mdpi/stat_sys_tether_bluetooth.png and b/core/res/res/drawable-mdpi/stat_sys_tether_bluetooth.png differ diff --git a/core/res/res/drawable-mdpi/stat_sys_tether_usb.png b/core/res/res/drawable-mdpi/stat_sys_tether_usb.png index 2e2b8ca2e9cb0..09158094e8321 100644 Binary files a/core/res/res/drawable-mdpi/stat_sys_tether_usb.png and b/core/res/res/drawable-mdpi/stat_sys_tether_usb.png differ diff --git a/core/res/res/drawable-mdpi/stat_sys_tether_wifi.png b/core/res/res/drawable-mdpi/stat_sys_tether_wifi.png index 869ad35f16c08..584dc1f4cb720 100644 Binary files a/core/res/res/drawable-mdpi/stat_sys_tether_wifi.png and b/core/res/res/drawable-mdpi/stat_sys_tether_wifi.png differ diff --git a/core/res/res/drawable-mdpi/sym_keyboard_delete.png b/core/res/res/drawable-mdpi/sym_keyboard_delete.png index 43a033ead97df..74b836a12da0f 100644 Binary files a/core/res/res/drawable-mdpi/sym_keyboard_delete.png and b/core/res/res/drawable-mdpi/sym_keyboard_delete.png differ diff --git a/core/res/res/drawable-mdpi/sym_keyboard_enter.png b/core/res/res/drawable-mdpi/sym_keyboard_enter.png new file mode 100644 index 0000000000000..0fa53acfe8683 Binary files /dev/null and b/core/res/res/drawable-mdpi/sym_keyboard_enter.png differ diff --git a/core/res/res/drawable-mdpi/sym_keyboard_num0_no_plus.png b/core/res/res/drawable-mdpi/sym_keyboard_num0_no_plus.png index d23114daebd79..9fefaeafaab36 100644 Binary files a/core/res/res/drawable-mdpi/sym_keyboard_num0_no_plus.png and b/core/res/res/drawable-mdpi/sym_keyboard_num0_no_plus.png differ diff --git a/core/res/res/drawable-mdpi/sym_keyboard_num1.png b/core/res/res/drawable-mdpi/sym_keyboard_num1.png index aaac11b0c7f49..1f37e32ff67a1 100644 Binary files a/core/res/res/drawable-mdpi/sym_keyboard_num1.png and b/core/res/res/drawable-mdpi/sym_keyboard_num1.png differ diff --git a/core/res/res/drawable-mdpi/sym_keyboard_num2.png b/core/res/res/drawable-mdpi/sym_keyboard_num2.png index 4372eb8f08c4c..f899f78083f3e 100644 Binary files a/core/res/res/drawable-mdpi/sym_keyboard_num2.png and b/core/res/res/drawable-mdpi/sym_keyboard_num2.png differ diff --git a/core/res/res/drawable-mdpi/sym_keyboard_num3.png b/core/res/res/drawable-mdpi/sym_keyboard_num3.png index 6f54c850f5aeb..6a0f5ef98ad0e 100644 Binary files a/core/res/res/drawable-mdpi/sym_keyboard_num3.png and b/core/res/res/drawable-mdpi/sym_keyboard_num3.png differ diff --git a/core/res/res/drawable-mdpi/sym_keyboard_num4.png b/core/res/res/drawable-mdpi/sym_keyboard_num4.png index 3e50bb957cec0..3a25bcd33545c 100644 Binary files a/core/res/res/drawable-mdpi/sym_keyboard_num4.png and b/core/res/res/drawable-mdpi/sym_keyboard_num4.png differ diff --git a/core/res/res/drawable-mdpi/sym_keyboard_num5.png b/core/res/res/drawable-mdpi/sym_keyboard_num5.png index c39ef4404fc11..064d4bf38b722 100644 Binary files a/core/res/res/drawable-mdpi/sym_keyboard_num5.png and b/core/res/res/drawable-mdpi/sym_keyboard_num5.png differ diff --git a/core/res/res/drawable-mdpi/sym_keyboard_num6.png b/core/res/res/drawable-mdpi/sym_keyboard_num6.png index ea88ceb94ea9b..61ee0a650b479 100644 Binary files a/core/res/res/drawable-mdpi/sym_keyboard_num6.png and b/core/res/res/drawable-mdpi/sym_keyboard_num6.png differ diff --git a/core/res/res/drawable-mdpi/sym_keyboard_num7.png b/core/res/res/drawable-mdpi/sym_keyboard_num7.png index ce800ba429808..b931d7bfffeeb 100644 Binary files a/core/res/res/drawable-mdpi/sym_keyboard_num7.png and b/core/res/res/drawable-mdpi/sym_keyboard_num7.png differ diff --git a/core/res/res/drawable-mdpi/sym_keyboard_num8.png b/core/res/res/drawable-mdpi/sym_keyboard_num8.png index 1a8ff94bf73aa..f8d2891589e07 100644 Binary files a/core/res/res/drawable-mdpi/sym_keyboard_num8.png and b/core/res/res/drawable-mdpi/sym_keyboard_num8.png differ diff --git a/core/res/res/drawable-mdpi/sym_keyboard_num9.png b/core/res/res/drawable-mdpi/sym_keyboard_num9.png index 8b344c0a6861b..056d06761660d 100644 Binary files a/core/res/res/drawable-mdpi/sym_keyboard_num9.png and b/core/res/res/drawable-mdpi/sym_keyboard_num9.png differ diff --git a/core/res/res/drawable-mdpi/sym_keyboard_return_holo.png b/core/res/res/drawable-mdpi/sym_keyboard_return_holo.png new file mode 100644 index 0000000000000..d5a7708ca0828 Binary files /dev/null and b/core/res/res/drawable-mdpi/sym_keyboard_return_holo.png differ diff --git a/core/res/res/drawable-mdpi/textfield_activated_holo_dark.9.png b/core/res/res/drawable-mdpi/textfield_activated_holo_dark.9.png index b69c3f0c91c78..33f798d4a5af0 100644 Binary files a/core/res/res/drawable-mdpi/textfield_activated_holo_dark.9.png and b/core/res/res/drawable-mdpi/textfield_activated_holo_dark.9.png differ diff --git a/core/res/res/drawable-mdpi/textfield_activated_holo_light.9.png b/core/res/res/drawable-mdpi/textfield_activated_holo_light.9.png index b69c3f0c91c78..622c6849034a7 100644 Binary files a/core/res/res/drawable-mdpi/textfield_activated_holo_light.9.png and b/core/res/res/drawable-mdpi/textfield_activated_holo_light.9.png differ diff --git a/core/res/res/drawable-mdpi/textfield_default_holo_dark.9.png b/core/res/res/drawable-mdpi/textfield_default_holo_dark.9.png index 6b4bba02ce4db..82fea5e66a145 100644 Binary files a/core/res/res/drawable-mdpi/textfield_default_holo_dark.9.png and b/core/res/res/drawable-mdpi/textfield_default_holo_dark.9.png differ diff --git a/core/res/res/drawable-mdpi/textfield_default_holo_light.9.png b/core/res/res/drawable-mdpi/textfield_default_holo_light.9.png index 3d8898e906108..c780d7da57adc 100644 Binary files a/core/res/res/drawable-mdpi/textfield_default_holo_light.9.png and b/core/res/res/drawable-mdpi/textfield_default_holo_light.9.png differ diff --git a/core/res/res/drawable-mdpi/textfield_disabled_focused_holo_dark.9.png b/core/res/res/drawable-mdpi/textfield_disabled_focused_holo_dark.9.png index e922f714d507e..24bdf71084bec 100644 Binary files a/core/res/res/drawable-mdpi/textfield_disabled_focused_holo_dark.9.png and b/core/res/res/drawable-mdpi/textfield_disabled_focused_holo_dark.9.png differ diff --git a/core/res/res/drawable-mdpi/textfield_disabled_focused_holo_light.9.png b/core/res/res/drawable-mdpi/textfield_disabled_focused_holo_light.9.png index 3b928944874b0..0d5ea839d159c 100644 Binary files a/core/res/res/drawable-mdpi/textfield_disabled_focused_holo_light.9.png and b/core/res/res/drawable-mdpi/textfield_disabled_focused_holo_light.9.png differ diff --git a/core/res/res/drawable-mdpi/textfield_disabled_holo_dark.9.png b/core/res/res/drawable-mdpi/textfield_disabled_holo_dark.9.png index 7e44919a72e52..709f5ef91ba6e 100644 Binary files a/core/res/res/drawable-mdpi/textfield_disabled_holo_dark.9.png and b/core/res/res/drawable-mdpi/textfield_disabled_holo_dark.9.png differ diff --git a/core/res/res/drawable-mdpi/textfield_disabled_holo_light.9.png b/core/res/res/drawable-mdpi/textfield_disabled_holo_light.9.png index 09b5616424b9c..ea6d2f74b3998 100644 Binary files a/core/res/res/drawable-mdpi/textfield_disabled_holo_light.9.png and b/core/res/res/drawable-mdpi/textfield_disabled_holo_light.9.png differ diff --git a/core/res/res/drawable-mdpi/textfield_focused_holo_dark.9.png b/core/res/res/drawable-mdpi/textfield_focused_holo_dark.9.png index efbaef8b47edd..2d8dd230e900b 100644 Binary files a/core/res/res/drawable-mdpi/textfield_focused_holo_dark.9.png and b/core/res/res/drawable-mdpi/textfield_focused_holo_dark.9.png differ diff --git a/core/res/res/drawable-mdpi/textfield_focused_holo_light.9.png b/core/res/res/drawable-mdpi/textfield_focused_holo_light.9.png index efbaef8b47edd..2d8dd230e900b 100644 Binary files a/core/res/res/drawable-mdpi/textfield_focused_holo_light.9.png and b/core/res/res/drawable-mdpi/textfield_focused_holo_light.9.png differ diff --git a/core/res/res/drawable-mdpi/textfield_multiline_activated_holo_dark.9.png b/core/res/res/drawable-mdpi/textfield_multiline_activated_holo_dark.9.png index b69c3f0c91c78..371d6e949a114 100644 Binary files a/core/res/res/drawable-mdpi/textfield_multiline_activated_holo_dark.9.png and b/core/res/res/drawable-mdpi/textfield_multiline_activated_holo_dark.9.png differ diff --git a/core/res/res/drawable-mdpi/textfield_multiline_activated_holo_light.9.png b/core/res/res/drawable-mdpi/textfield_multiline_activated_holo_light.9.png index b69c3f0c91c78..225317f195ef7 100644 Binary files a/core/res/res/drawable-mdpi/textfield_multiline_activated_holo_light.9.png and b/core/res/res/drawable-mdpi/textfield_multiline_activated_holo_light.9.png differ diff --git a/core/res/res/drawable-mdpi/textfield_multiline_default_holo_dark.9.png b/core/res/res/drawable-mdpi/textfield_multiline_default_holo_dark.9.png index 6b4bba02ce4db..4bd6f9f1028d0 100644 Binary files a/core/res/res/drawable-mdpi/textfield_multiline_default_holo_dark.9.png and b/core/res/res/drawable-mdpi/textfield_multiline_default_holo_dark.9.png differ diff --git a/core/res/res/drawable-mdpi/textfield_multiline_default_holo_light.9.png b/core/res/res/drawable-mdpi/textfield_multiline_default_holo_light.9.png index 3d8898e906108..4b837b0d2e0c8 100644 Binary files a/core/res/res/drawable-mdpi/textfield_multiline_default_holo_light.9.png and b/core/res/res/drawable-mdpi/textfield_multiline_default_holo_light.9.png differ diff --git a/core/res/res/drawable-mdpi/textfield_multiline_disabled_focused_holo_dark.9.png b/core/res/res/drawable-mdpi/textfield_multiline_disabled_focused_holo_dark.9.png index e922f714d507e..51cf919d3cc4f 100644 Binary files a/core/res/res/drawable-mdpi/textfield_multiline_disabled_focused_holo_dark.9.png and b/core/res/res/drawable-mdpi/textfield_multiline_disabled_focused_holo_dark.9.png differ diff --git a/core/res/res/drawable-mdpi/textfield_multiline_disabled_focused_holo_light.9.png b/core/res/res/drawable-mdpi/textfield_multiline_disabled_focused_holo_light.9.png index 3b928944874b0..af8d7e14006ce 100644 Binary files a/core/res/res/drawable-mdpi/textfield_multiline_disabled_focused_holo_light.9.png and b/core/res/res/drawable-mdpi/textfield_multiline_disabled_focused_holo_light.9.png differ diff --git a/core/res/res/drawable-mdpi/textfield_multiline_disabled_holo_dark.9.png b/core/res/res/drawable-mdpi/textfield_multiline_disabled_holo_dark.9.png index 7e44919a72e52..d0fb869f5766b 100644 Binary files a/core/res/res/drawable-mdpi/textfield_multiline_disabled_holo_dark.9.png and b/core/res/res/drawable-mdpi/textfield_multiline_disabled_holo_dark.9.png differ diff --git a/core/res/res/drawable-mdpi/textfield_multiline_disabled_holo_light.9.png b/core/res/res/drawable-mdpi/textfield_multiline_disabled_holo_light.9.png index 09b5616424b9c..a0e233e3b7eb0 100644 Binary files a/core/res/res/drawable-mdpi/textfield_multiline_disabled_holo_light.9.png and b/core/res/res/drawable-mdpi/textfield_multiline_disabled_holo_light.9.png differ diff --git a/core/res/res/drawable-mdpi/textfield_multiline_focused_holo_dark.9.png b/core/res/res/drawable-mdpi/textfield_multiline_focused_holo_dark.9.png index 2a78e8c509ecc..2ed4985c04d2b 100644 Binary files a/core/res/res/drawable-mdpi/textfield_multiline_focused_holo_dark.9.png and b/core/res/res/drawable-mdpi/textfield_multiline_focused_holo_dark.9.png differ diff --git a/core/res/res/drawable-mdpi/textfield_multiline_focused_holo_light.9.png b/core/res/res/drawable-mdpi/textfield_multiline_focused_holo_light.9.png index 632d9fc7a9918..0603348a42ff5 100644 Binary files a/core/res/res/drawable-mdpi/textfield_multiline_focused_holo_light.9.png and b/core/res/res/drawable-mdpi/textfield_multiline_focused_holo_light.9.png differ diff --git a/core/res/res/drawable-nodpi/background_holo_dark.png b/core/res/res/drawable-nodpi/background_holo_dark.png deleted file mode 100644 index 85bd6f7e404b3..0000000000000 Binary files a/core/res/res/drawable-nodpi/background_holo_dark.png and /dev/null differ diff --git a/core/res/res/drawable-nodpi/background_holo_light.png b/core/res/res/drawable-nodpi/background_holo_light.png deleted file mode 100644 index 5fb4a9dc0b1f7..0000000000000 Binary files a/core/res/res/drawable-nodpi/background_holo_light.png and /dev/null differ diff --git a/core/res/res/drawable-nodpi/cidlogo.png b/core/res/res/drawable-nodpi/cidlogo.png new file mode 100644 index 0000000000000..ceb2246a7aa92 Binary files /dev/null and b/core/res/res/drawable-nodpi/cidlogo.png differ diff --git a/core/res/res/drawable-nodpi/cidlogo_alt.png b/core/res/res/drawable-nodpi/cidlogo_alt.png new file mode 100644 index 0000000000000..e5c03ed1c388d Binary files /dev/null and b/core/res/res/drawable-nodpi/cidlogo_alt.png differ diff --git a/core/res/res/drawable-sw600dp-hdpi/sym_keyboard_return_holo.png b/core/res/res/drawable-sw600dp-hdpi/sym_keyboard_return_holo.png new file mode 100644 index 0000000000000..f1bcf487c5f1e Binary files /dev/null and b/core/res/res/drawable-sw600dp-hdpi/sym_keyboard_return_holo.png differ diff --git a/core/res/res/drawable-sw600dp-mdpi/sym_keyboard_return_holo.png b/core/res/res/drawable-sw600dp-mdpi/sym_keyboard_return_holo.png new file mode 100644 index 0000000000000..d5a7708ca0828 Binary files /dev/null and b/core/res/res/drawable-sw600dp-mdpi/sym_keyboard_return_holo.png differ diff --git a/core/res/res/drawable-sw600dp-xhdpi/ic_lock_expanded_desktop.png b/core/res/res/drawable-sw600dp-xhdpi/ic_lock_expanded_desktop.png new file mode 100644 index 0000000000000..e0c99e5bcbdef Binary files /dev/null and b/core/res/res/drawable-sw600dp-xhdpi/ic_lock_expanded_desktop.png differ diff --git a/core/res/res/drawable-sw600dp-xhdpi/sym_keyboard_return_holo.png b/core/res/res/drawable-sw600dp-xhdpi/sym_keyboard_return_holo.png new file mode 100644 index 0000000000000..55174e0767653 Binary files /dev/null and b/core/res/res/drawable-sw600dp-xhdpi/sym_keyboard_return_holo.png differ diff --git a/core/res/res/drawable-xhdpi/btn_default_disabled_focused_holo_dark.9.png b/core/res/res/drawable-xhdpi/btn_default_disabled_focused_holo_dark.9.png index b7707c6f3371c..d591bf8c503a6 100644 Binary files a/core/res/res/drawable-xhdpi/btn_default_disabled_focused_holo_dark.9.png and b/core/res/res/drawable-xhdpi/btn_default_disabled_focused_holo_dark.9.png differ diff --git a/core/res/res/drawable-xhdpi/btn_default_disabled_focused_holo_light.9.png b/core/res/res/drawable-xhdpi/btn_default_disabled_focused_holo_light.9.png index b7707c6f3371c..d591bf8c503a6 100644 Binary files a/core/res/res/drawable-xhdpi/btn_default_disabled_focused_holo_light.9.png and b/core/res/res/drawable-xhdpi/btn_default_disabled_focused_holo_light.9.png differ diff --git a/core/res/res/drawable-xhdpi/btn_default_disabled_holo.9.png b/core/res/res/drawable-xhdpi/btn_default_disabled_holo.9.png index 2ed63865a8444..df2a621fc3ae5 100644 Binary files a/core/res/res/drawable-xhdpi/btn_default_disabled_holo.9.png and b/core/res/res/drawable-xhdpi/btn_default_disabled_holo.9.png differ diff --git a/core/res/res/drawable-xhdpi/btn_default_disabled_holo_dark.9.png b/core/res/res/drawable-xhdpi/btn_default_disabled_holo_dark.9.png index ffee5e2d03ea7..b410d238e50cc 100644 Binary files a/core/res/res/drawable-xhdpi/btn_default_disabled_holo_dark.9.png and b/core/res/res/drawable-xhdpi/btn_default_disabled_holo_dark.9.png differ diff --git a/core/res/res/drawable-xhdpi/btn_default_disabled_holo_light.9.png b/core/res/res/drawable-xhdpi/btn_default_disabled_holo_light.9.png index ffee5e2d03ea7..b410d238e50cc 100644 Binary files a/core/res/res/drawable-xhdpi/btn_default_disabled_holo_light.9.png and b/core/res/res/drawable-xhdpi/btn_default_disabled_holo_light.9.png differ diff --git a/core/res/res/drawable-xhdpi/btn_default_focused_holo.9.png b/core/res/res/drawable-xhdpi/btn_default_focused_holo.9.png index 702ebc65af14f..392cee4999967 100644 Binary files a/core/res/res/drawable-xhdpi/btn_default_focused_holo.9.png and b/core/res/res/drawable-xhdpi/btn_default_focused_holo.9.png differ diff --git a/core/res/res/drawable-xhdpi/btn_default_focused_holo_dark.9.png b/core/res/res/drawable-xhdpi/btn_default_focused_holo_dark.9.png index 30bfa30ac3b7d..aed57c6036437 100644 Binary files a/core/res/res/drawable-xhdpi/btn_default_focused_holo_dark.9.png and b/core/res/res/drawable-xhdpi/btn_default_focused_holo_dark.9.png differ diff --git a/core/res/res/drawable-xhdpi/btn_default_focused_holo_light.9.png b/core/res/res/drawable-xhdpi/btn_default_focused_holo_light.9.png index 30bfa30ac3b7d..aed57c6036437 100644 Binary files a/core/res/res/drawable-xhdpi/btn_default_focused_holo_light.9.png and b/core/res/res/drawable-xhdpi/btn_default_focused_holo_light.9.png differ diff --git a/core/res/res/drawable-xhdpi/btn_default_normal_holo.9.png b/core/res/res/drawable-xhdpi/btn_default_normal_holo.9.png index 89ce2df5bc3ae..92a49db432426 100644 Binary files a/core/res/res/drawable-xhdpi/btn_default_normal_holo.9.png and b/core/res/res/drawable-xhdpi/btn_default_normal_holo.9.png differ diff --git a/core/res/res/drawable-xhdpi/btn_default_normal_holo_dark.9.png b/core/res/res/drawable-xhdpi/btn_default_normal_holo_dark.9.png index 745d53e7a9eb2..38f8c013f45ae 100644 Binary files a/core/res/res/drawable-xhdpi/btn_default_normal_holo_dark.9.png and b/core/res/res/drawable-xhdpi/btn_default_normal_holo_dark.9.png differ diff --git a/core/res/res/drawable-xhdpi/btn_default_normal_holo_light.9.png b/core/res/res/drawable-xhdpi/btn_default_normal_holo_light.9.png index c509934f5adaf..38f8c013f45ae 100644 Binary files a/core/res/res/drawable-xhdpi/btn_default_normal_holo_light.9.png and b/core/res/res/drawable-xhdpi/btn_default_normal_holo_light.9.png differ diff --git a/core/res/res/drawable-xhdpi/btn_default_pressed_holo.9.png b/core/res/res/drawable-xhdpi/btn_default_pressed_holo.9.png index b1eab7977039a..a0d64a385019d 100644 Binary files a/core/res/res/drawable-xhdpi/btn_default_pressed_holo.9.png and b/core/res/res/drawable-xhdpi/btn_default_pressed_holo.9.png differ diff --git a/core/res/res/drawable-xhdpi/btn_default_pressed_holo_dark.9.png b/core/res/res/drawable-xhdpi/btn_default_pressed_holo_dark.9.png index 417152b4f63e5..930b5f2d6387e 100644 Binary files a/core/res/res/drawable-xhdpi/btn_default_pressed_holo_dark.9.png and b/core/res/res/drawable-xhdpi/btn_default_pressed_holo_dark.9.png differ diff --git a/core/res/res/drawable-xhdpi/btn_default_pressed_holo_light.9.png b/core/res/res/drawable-xhdpi/btn_default_pressed_holo_light.9.png index 417152b4f63e5..930b5f2d6387e 100644 Binary files a/core/res/res/drawable-xhdpi/btn_default_pressed_holo_light.9.png and b/core/res/res/drawable-xhdpi/btn_default_pressed_holo_light.9.png differ diff --git a/core/res/res/drawable-xhdpi/btn_toggle_off_disabled_focused_holo_dark.9.png b/core/res/res/drawable-xhdpi/btn_toggle_off_disabled_focused_holo_dark.9.png index c271216c32232..c08deab0b9fe5 100644 Binary files a/core/res/res/drawable-xhdpi/btn_toggle_off_disabled_focused_holo_dark.9.png and b/core/res/res/drawable-xhdpi/btn_toggle_off_disabled_focused_holo_dark.9.png differ diff --git a/core/res/res/drawable-xhdpi/btn_toggle_off_disabled_focused_holo_light.9.png b/core/res/res/drawable-xhdpi/btn_toggle_off_disabled_focused_holo_light.9.png index c271216c32232..c08deab0b9fe5 100644 Binary files a/core/res/res/drawable-xhdpi/btn_toggle_off_disabled_focused_holo_light.9.png and b/core/res/res/drawable-xhdpi/btn_toggle_off_disabled_focused_holo_light.9.png differ diff --git a/core/res/res/drawable-xhdpi/btn_toggle_off_disabled_holo_dark.9.png b/core/res/res/drawable-xhdpi/btn_toggle_off_disabled_holo_dark.9.png index a2d3ecd7efb0b..8b1a55c30fc13 100644 Binary files a/core/res/res/drawable-xhdpi/btn_toggle_off_disabled_holo_dark.9.png and b/core/res/res/drawable-xhdpi/btn_toggle_off_disabled_holo_dark.9.png differ diff --git a/core/res/res/drawable-xhdpi/btn_toggle_off_disabled_holo_light.9.png b/core/res/res/drawable-xhdpi/btn_toggle_off_disabled_holo_light.9.png index a2d3ecd7efb0b..8b1a55c30fc13 100644 Binary files a/core/res/res/drawable-xhdpi/btn_toggle_off_disabled_holo_light.9.png and b/core/res/res/drawable-xhdpi/btn_toggle_off_disabled_holo_light.9.png differ diff --git a/core/res/res/drawable-xhdpi/btn_toggle_off_focused_holo_dark.9.png b/core/res/res/drawable-xhdpi/btn_toggle_off_focused_holo_dark.9.png index 80cbb053bcee0..77cd1fad4ba95 100644 Binary files a/core/res/res/drawable-xhdpi/btn_toggle_off_focused_holo_dark.9.png and b/core/res/res/drawable-xhdpi/btn_toggle_off_focused_holo_dark.9.png differ diff --git a/core/res/res/drawable-xhdpi/btn_toggle_off_focused_holo_light.9.png b/core/res/res/drawable-xhdpi/btn_toggle_off_focused_holo_light.9.png index 80cbb053bcee0..77cd1fad4ba95 100644 Binary files a/core/res/res/drawable-xhdpi/btn_toggle_off_focused_holo_light.9.png and b/core/res/res/drawable-xhdpi/btn_toggle_off_focused_holo_light.9.png differ diff --git a/core/res/res/drawable-xhdpi/btn_toggle_off_normal_holo_dark.9.png b/core/res/res/drawable-xhdpi/btn_toggle_off_normal_holo_dark.9.png index db2cfc564f3fc..e0e354010e2ba 100644 Binary files a/core/res/res/drawable-xhdpi/btn_toggle_off_normal_holo_dark.9.png and b/core/res/res/drawable-xhdpi/btn_toggle_off_normal_holo_dark.9.png differ diff --git a/core/res/res/drawable-xhdpi/btn_toggle_off_normal_holo_light.9.png b/core/res/res/drawable-xhdpi/btn_toggle_off_normal_holo_light.9.png index db2cfc564f3fc..e0e354010e2ba 100644 Binary files a/core/res/res/drawable-xhdpi/btn_toggle_off_normal_holo_light.9.png and b/core/res/res/drawable-xhdpi/btn_toggle_off_normal_holo_light.9.png differ diff --git a/core/res/res/drawable-xhdpi/btn_toggle_off_pressed_holo_dark.9.png b/core/res/res/drawable-xhdpi/btn_toggle_off_pressed_holo_dark.9.png index 5086f46094326..9d16f321c4619 100644 Binary files a/core/res/res/drawable-xhdpi/btn_toggle_off_pressed_holo_dark.9.png and b/core/res/res/drawable-xhdpi/btn_toggle_off_pressed_holo_dark.9.png differ diff --git a/core/res/res/drawable-xhdpi/btn_toggle_off_pressed_holo_light.9.png b/core/res/res/drawable-xhdpi/btn_toggle_off_pressed_holo_light.9.png index 5086f46094326..9d16f321c4619 100644 Binary files a/core/res/res/drawable-xhdpi/btn_toggle_off_pressed_holo_light.9.png and b/core/res/res/drawable-xhdpi/btn_toggle_off_pressed_holo_light.9.png differ diff --git a/core/res/res/drawable-xhdpi/btn_toggle_on_disabled_focused_holo_dark.9.png b/core/res/res/drawable-xhdpi/btn_toggle_on_disabled_focused_holo_dark.9.png index 0f5851b6880f6..324e490b780c7 100644 Binary files a/core/res/res/drawable-xhdpi/btn_toggle_on_disabled_focused_holo_dark.9.png and b/core/res/res/drawable-xhdpi/btn_toggle_on_disabled_focused_holo_dark.9.png differ diff --git a/core/res/res/drawable-xhdpi/btn_toggle_on_disabled_focused_holo_light.9.png b/core/res/res/drawable-xhdpi/btn_toggle_on_disabled_focused_holo_light.9.png index 0f5851b6880f6..324e490b780c7 100644 Binary files a/core/res/res/drawable-xhdpi/btn_toggle_on_disabled_focused_holo_light.9.png and b/core/res/res/drawable-xhdpi/btn_toggle_on_disabled_focused_holo_light.9.png differ diff --git a/core/res/res/drawable-xhdpi/btn_toggle_on_disabled_holo_dark.9.png b/core/res/res/drawable-xhdpi/btn_toggle_on_disabled_holo_dark.9.png index 74c853f2e53f8..e126cc64456b7 100644 Binary files a/core/res/res/drawable-xhdpi/btn_toggle_on_disabled_holo_dark.9.png and b/core/res/res/drawable-xhdpi/btn_toggle_on_disabled_holo_dark.9.png differ diff --git a/core/res/res/drawable-xhdpi/btn_toggle_on_disabled_holo_light.9.png b/core/res/res/drawable-xhdpi/btn_toggle_on_disabled_holo_light.9.png index 74c853f2e53f8..e126cc64456b7 100644 Binary files a/core/res/res/drawable-xhdpi/btn_toggle_on_disabled_holo_light.9.png and b/core/res/res/drawable-xhdpi/btn_toggle_on_disabled_holo_light.9.png differ diff --git a/core/res/res/drawable-xhdpi/btn_toggle_on_focused_holo_dark.9.png b/core/res/res/drawable-xhdpi/btn_toggle_on_focused_holo_dark.9.png index 7bd7af5b6b85c..4c1f1b97c233b 100644 Binary files a/core/res/res/drawable-xhdpi/btn_toggle_on_focused_holo_dark.9.png and b/core/res/res/drawable-xhdpi/btn_toggle_on_focused_holo_dark.9.png differ diff --git a/core/res/res/drawable-xhdpi/btn_toggle_on_focused_holo_light.9.png b/core/res/res/drawable-xhdpi/btn_toggle_on_focused_holo_light.9.png index 7bd7af5b6b85c..4c1f1b97c233b 100644 Binary files a/core/res/res/drawable-xhdpi/btn_toggle_on_focused_holo_light.9.png and b/core/res/res/drawable-xhdpi/btn_toggle_on_focused_holo_light.9.png differ diff --git a/core/res/res/drawable-xhdpi/btn_toggle_on_normal_holo_dark.9.png b/core/res/res/drawable-xhdpi/btn_toggle_on_normal_holo_dark.9.png index 71dad92384a8a..219d37b50b614 100644 Binary files a/core/res/res/drawable-xhdpi/btn_toggle_on_normal_holo_dark.9.png and b/core/res/res/drawable-xhdpi/btn_toggle_on_normal_holo_dark.9.png differ diff --git a/core/res/res/drawable-xhdpi/btn_toggle_on_normal_holo_light.9.png b/core/res/res/drawable-xhdpi/btn_toggle_on_normal_holo_light.9.png index 71dad92384a8a..219d37b50b614 100644 Binary files a/core/res/res/drawable-xhdpi/btn_toggle_on_normal_holo_light.9.png and b/core/res/res/drawable-xhdpi/btn_toggle_on_normal_holo_light.9.png differ diff --git a/core/res/res/drawable-xhdpi/btn_toggle_on_pressed_holo_dark.9.png b/core/res/res/drawable-xhdpi/btn_toggle_on_pressed_holo_dark.9.png index 1f62eff00d4a7..fde3ac3ffb6f5 100644 Binary files a/core/res/res/drawable-xhdpi/btn_toggle_on_pressed_holo_dark.9.png and b/core/res/res/drawable-xhdpi/btn_toggle_on_pressed_holo_dark.9.png differ diff --git a/core/res/res/drawable-xhdpi/btn_toggle_on_pressed_holo_light.9.png b/core/res/res/drawable-xhdpi/btn_toggle_on_pressed_holo_light.9.png index 1f62eff00d4a7..fde3ac3ffb6f5 100644 Binary files a/core/res/res/drawable-xhdpi/btn_toggle_on_pressed_holo_light.9.png and b/core/res/res/drawable-xhdpi/btn_toggle_on_pressed_holo_light.9.png differ diff --git a/core/res/res/drawable-xhdpi/default_wallpaper.jpg b/core/res/res/drawable-xhdpi/default_wallpaper.jpg index 5b8d1d59833e9..da9fa91fae700 100644 Binary files a/core/res/res/drawable-xhdpi/default_wallpaper.jpg and b/core/res/res/drawable-xhdpi/default_wallpaper.jpg differ diff --git a/core/res/res/drawable-xhdpi/dialog_bottom_holo_dark.9.png b/core/res/res/drawable-xhdpi/dialog_bottom_holo_dark.9.png index 94bb8e140facc..467ea1f8cf78d 100644 Binary files a/core/res/res/drawable-xhdpi/dialog_bottom_holo_dark.9.png and b/core/res/res/drawable-xhdpi/dialog_bottom_holo_dark.9.png differ diff --git a/core/res/res/drawable-xhdpi/dialog_bottom_holo_light.9.png b/core/res/res/drawable-xhdpi/dialog_bottom_holo_light.9.png index ef58e29240080..74929a3c6f33b 100644 Binary files a/core/res/res/drawable-xhdpi/dialog_bottom_holo_light.9.png and b/core/res/res/drawable-xhdpi/dialog_bottom_holo_light.9.png differ diff --git a/core/res/res/drawable-xhdpi/dialog_full_holo_dark.9.png b/core/res/res/drawable-xhdpi/dialog_full_holo_dark.9.png index f4970ad1c3278..a8ab305f04d67 100644 Binary files a/core/res/res/drawable-xhdpi/dialog_full_holo_dark.9.png and b/core/res/res/drawable-xhdpi/dialog_full_holo_dark.9.png differ diff --git a/core/res/res/drawable-xhdpi/dialog_full_holo_light.9.png b/core/res/res/drawable-xhdpi/dialog_full_holo_light.9.png index 172fc3b5e3caf..a8f02d664f041 100644 Binary files a/core/res/res/drawable-xhdpi/dialog_full_holo_light.9.png and b/core/res/res/drawable-xhdpi/dialog_full_holo_light.9.png differ diff --git a/core/res/res/drawable-xhdpi/dialog_middle_holo_dark.9.png b/core/res/res/drawable-xhdpi/dialog_middle_holo_dark.9.png index 2bab67a5ad2d0..97eb217e74eb4 100644 Binary files a/core/res/res/drawable-xhdpi/dialog_middle_holo_dark.9.png and b/core/res/res/drawable-xhdpi/dialog_middle_holo_dark.9.png differ diff --git a/core/res/res/drawable-xhdpi/dialog_middle_holo_light.9.png b/core/res/res/drawable-xhdpi/dialog_middle_holo_light.9.png index 6b5f467f70aae..1300c1918e4ff 100644 Binary files a/core/res/res/drawable-xhdpi/dialog_middle_holo_light.9.png and b/core/res/res/drawable-xhdpi/dialog_middle_holo_light.9.png differ diff --git a/core/res/res/drawable-xhdpi/dialog_top_holo_dark.9.png b/core/res/res/drawable-xhdpi/dialog_top_holo_dark.9.png index e1c602fbc09e6..f82e26b1c615e 100644 Binary files a/core/res/res/drawable-xhdpi/dialog_top_holo_dark.9.png and b/core/res/res/drawable-xhdpi/dialog_top_holo_dark.9.png differ diff --git a/core/res/res/drawable-xhdpi/dialog_top_holo_light.9.png b/core/res/res/drawable-xhdpi/dialog_top_holo_light.9.png index 59db99c1d6987..8bd32a3b49380 100644 Binary files a/core/res/res/drawable-xhdpi/dialog_top_holo_light.9.png and b/core/res/res/drawable-xhdpi/dialog_top_holo_light.9.png differ diff --git a/core/res/res/drawable-xhdpi/ic_coins_s.png b/core/res/res/drawable-xhdpi/ic_coins_s.png new file mode 100644 index 0000000000000..13d134e6b64e2 Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_coins_s.png differ diff --git a/core/res/res/drawable-xhdpi/ic_lock_expanded_desktop.png b/core/res/res/drawable-xhdpi/ic_lock_expanded_desktop.png new file mode 100644 index 0000000000000..e0c99e5bcbdef Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_lock_expanded_desktop.png differ diff --git a/core/res/res/drawable-xhdpi/ic_lock_idle_calendar.png b/core/res/res/drawable-xhdpi/ic_lock_idle_calendar.png new file mode 100644 index 0000000000000..5ae7782d5d5e9 Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_lock_idle_calendar.png differ diff --git a/core/res/res/drawable-xhdpi/ic_lock_profile.png b/core/res/res/drawable-xhdpi/ic_lock_profile.png new file mode 100644 index 0000000000000..4c9472c24d2dd Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_lock_profile.png differ diff --git a/core/res/res/drawable-xhdpi/ic_lock_reboot.png b/core/res/res/drawable-xhdpi/ic_lock_reboot.png new file mode 100644 index 0000000000000..653970f226006 Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_lock_reboot.png differ diff --git a/core/res/res/drawable-xhdpi/ic_lock_screenshot.png b/core/res/res/drawable-xhdpi/ic_lock_screenshot.png new file mode 100644 index 0000000000000..7e4c0ee129b1f Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_lock_screenshot.png differ diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_alarm.png b/core/res/res/drawable-xhdpi/ic_lockscreen_alarm.png new file mode 100644 index 0000000000000..e6cceefe6a5bf Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_lockscreen_alarm.png differ diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_alarm_activated.png b/core/res/res/drawable-xhdpi/ic_lockscreen_alarm_activated.png new file mode 100644 index 0000000000000..9ce624ebd448a Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_lockscreen_alarm_activated.png differ diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_alarm_normal.png b/core/res/res/drawable-xhdpi/ic_lockscreen_alarm_normal.png new file mode 100644 index 0000000000000..07442277999ce Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_lockscreen_alarm_normal.png differ diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_answer_active.png b/core/res/res/drawable-xhdpi/ic_lockscreen_answer_active.png new file mode 100644 index 0000000000000..8edf62dd2e898 Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_lockscreen_answer_active.png differ diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_answer_focused.png b/core/res/res/drawable-xhdpi/ic_lockscreen_answer_focused.png new file mode 100644 index 0000000000000..2a47e9b6939c9 Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_lockscreen_answer_focused.png differ diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_answer_normal.png b/core/res/res/drawable-xhdpi/ic_lockscreen_answer_normal.png new file mode 100644 index 0000000000000..f049dc9966b24 Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_lockscreen_answer_normal.png differ diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_browser_activated.png b/core/res/res/drawable-xhdpi/ic_lockscreen_browser_activated.png new file mode 100644 index 0000000000000..a548cd58762ad Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_lockscreen_browser_activated.png differ diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_browser_normal.png b/core/res/res/drawable-xhdpi/ic_lockscreen_browser_normal.png new file mode 100644 index 0000000000000..cd5d76c6b2d03 Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_lockscreen_browser_normal.png differ diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_calendar_activated.png b/core/res/res/drawable-xhdpi/ic_lockscreen_calendar_activated.png new file mode 100644 index 0000000000000..31cc06fb0aadc Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_lockscreen_calendar_activated.png differ diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_calendar_normal.png b/core/res/res/drawable-xhdpi/ic_lockscreen_calendar_normal.png new file mode 100644 index 0000000000000..d536058c81ef2 Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_lockscreen_calendar_normal.png differ diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_camera_activated.png b/core/res/res/drawable-xhdpi/ic_lockscreen_camera_activated.png index 760ef2d9ed492..1cb37f92437c5 100644 Binary files a/core/res/res/drawable-xhdpi/ic_lockscreen_camera_activated.png and b/core/res/res/drawable-xhdpi/ic_lockscreen_camera_activated.png differ diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_camera_normal.png b/core/res/res/drawable-xhdpi/ic_lockscreen_camera_normal.png index 093bc055081c5..b468d5a017f74 100644 Binary files a/core/res/res/drawable-xhdpi/ic_lockscreen_camera_normal.png and b/core/res/res/drawable-xhdpi/ic_lockscreen_camera_normal.png differ diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_chevron_down.png b/core/res/res/drawable-xhdpi/ic_lockscreen_chevron_down.png deleted file mode 100644 index b8e5733522ef9..0000000000000 Binary files a/core/res/res/drawable-xhdpi/ic_lockscreen_chevron_down.png and /dev/null differ diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_chevron_left.png b/core/res/res/drawable-xhdpi/ic_lockscreen_chevron_left.png deleted file mode 100644 index ce5da43fc6502..0000000000000 Binary files a/core/res/res/drawable-xhdpi/ic_lockscreen_chevron_left.png and /dev/null differ diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_chevron_right.png b/core/res/res/drawable-xhdpi/ic_lockscreen_chevron_right.png deleted file mode 100644 index c16f1431125d5..0000000000000 Binary files a/core/res/res/drawable-xhdpi/ic_lockscreen_chevron_right.png and /dev/null differ diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_chevron_up.png b/core/res/res/drawable-xhdpi/ic_lockscreen_chevron_up.png deleted file mode 100644 index 9bed39a3e3e07..0000000000000 Binary files a/core/res/res/drawable-xhdpi/ic_lockscreen_chevron_up.png and /dev/null differ diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_chrome_activated.png b/core/res/res/drawable-xhdpi/ic_lockscreen_chrome_activated.png new file mode 100644 index 0000000000000..ea90ef5ef3223 Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_lockscreen_chrome_activated.png differ diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_chrome_normal.png b/core/res/res/drawable-xhdpi/ic_lockscreen_chrome_normal.png new file mode 100644 index 0000000000000..e49b962bd6d5e Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_lockscreen_chrome_normal.png differ diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_decline_activated.png b/core/res/res/drawable-xhdpi/ic_lockscreen_decline_activated.png new file mode 100644 index 0000000000000..4244ca08865dd Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_lockscreen_decline_activated.png differ diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_decline_focused.png b/core/res/res/drawable-xhdpi/ic_lockscreen_decline_focused.png new file mode 100644 index 0000000000000..a98a379ba8bca Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_lockscreen_decline_focused.png differ diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_decline_normal.png b/core/res/res/drawable-xhdpi/ic_lockscreen_decline_normal.png new file mode 100644 index 0000000000000..fa2a0f466ec34 Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_lockscreen_decline_normal.png differ diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_email2_activated.png b/core/res/res/drawable-xhdpi/ic_lockscreen_email2_activated.png new file mode 100644 index 0000000000000..13d79a10acb4a Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_lockscreen_email2_activated.png differ diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_email2_normal.png b/core/res/res/drawable-xhdpi/ic_lockscreen_email2_normal.png new file mode 100644 index 0000000000000..3f1d2ba4accd2 Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_lockscreen_email2_normal.png differ diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_email_activated.png b/core/res/res/drawable-xhdpi/ic_lockscreen_email_activated.png new file mode 100644 index 0000000000000..da7a20fa0dbf2 Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_lockscreen_email_activated.png differ diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_email_normal.png b/core/res/res/drawable-xhdpi/ic_lockscreen_email_normal.png new file mode 100644 index 0000000000000..f27b0ef13c675 Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_lockscreen_email_normal.png differ diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_facebook_activated.png b/core/res/res/drawable-xhdpi/ic_lockscreen_facebook_activated.png new file mode 100644 index 0000000000000..583bb51f06def Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_lockscreen_facebook_activated.png differ diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_facebook_normal.png b/core/res/res/drawable-xhdpi/ic_lockscreen_facebook_normal.png new file mode 100644 index 0000000000000..1cca26c246a7d Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_lockscreen_facebook_normal.png differ diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_gallery_activated.png b/core/res/res/drawable-xhdpi/ic_lockscreen_gallery_activated.png new file mode 100644 index 0000000000000..91acdd6e10e29 Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_lockscreen_gallery_activated.png differ diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_gallery_normal.png b/core/res/res/drawable-xhdpi/ic_lockscreen_gallery_normal.png new file mode 100644 index 0000000000000..cdb947b246471 Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_lockscreen_gallery_normal.png differ diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_google_activated.png b/core/res/res/drawable-xhdpi/ic_lockscreen_google_activated.png index d643f83b36a83..de9eec8f1b25a 100644 Binary files a/core/res/res/drawable-xhdpi/ic_lockscreen_google_activated.png and b/core/res/res/drawable-xhdpi/ic_lockscreen_google_activated.png differ diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_google_normal.png b/core/res/res/drawable-xhdpi/ic_lockscreen_google_normal.png index 9a9bf6800777b..f45db747c7992 100644 Binary files a/core/res/res/drawable-xhdpi/ic_lockscreen_google_normal.png and b/core/res/res/drawable-xhdpi/ic_lockscreen_google_normal.png differ diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_google_small_activated.png b/core/res/res/drawable-xhdpi/ic_lockscreen_google_small_activated.png new file mode 100644 index 0000000000000..08ca94270b906 Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_lockscreen_google_small_activated.png differ diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_google_small_normal.png b/core/res/res/drawable-xhdpi/ic_lockscreen_google_small_normal.png new file mode 100644 index 0000000000000..75deb64e50ab9 Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_lockscreen_google_small_normal.png differ diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_gplus_activated.png b/core/res/res/drawable-xhdpi/ic_lockscreen_gplus_activated.png new file mode 100644 index 0000000000000..3c04e0d31f297 Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_lockscreen_gplus_activated.png differ diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_gplus_normal.png b/core/res/res/drawable-xhdpi/ic_lockscreen_gplus_normal.png new file mode 100644 index 0000000000000..9ec36bfc5ab09 Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_lockscreen_gplus_normal.png differ diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_gtalk_activated.png b/core/res/res/drawable-xhdpi/ic_lockscreen_gtalk_activated.png new file mode 100644 index 0000000000000..63ed20b68adf3 Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_lockscreen_gtalk_activated.png differ diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_gtalk_normal.png b/core/res/res/drawable-xhdpi/ic_lockscreen_gtalk_normal.png new file mode 100644 index 0000000000000..a1f0c810dc488 Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_lockscreen_gtalk_normal.png differ diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_lock_pressed.png b/core/res/res/drawable-xhdpi/ic_lockscreen_lock_pressed.png index 2264dc3fc9d7f..fb1af78f7ea4c 100644 Binary files a/core/res/res/drawable-xhdpi/ic_lockscreen_lock_pressed.png and b/core/res/res/drawable-xhdpi/ic_lockscreen_lock_pressed.png differ diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_maps_activated.png b/core/res/res/drawable-xhdpi/ic_lockscreen_maps_activated.png new file mode 100644 index 0000000000000..bed705f89c004 Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_lockscreen_maps_activated.png differ diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_maps_normal.png b/core/res/res/drawable-xhdpi/ic_lockscreen_maps_normal.png new file mode 100644 index 0000000000000..65f0a1f236bdc Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_lockscreen_maps_normal.png differ diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_movie_activated.png b/core/res/res/drawable-xhdpi/ic_lockscreen_movie_activated.png new file mode 100644 index 0000000000000..ea8dc6ab7e618 Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_lockscreen_movie_activated.png differ diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_movie_normal.png b/core/res/res/drawable-xhdpi/ic_lockscreen_movie_normal.png new file mode 100644 index 0000000000000..3493895e327a1 Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_lockscreen_movie_normal.png differ diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_music_activated.png b/core/res/res/drawable-xhdpi/ic_lockscreen_music_activated.png new file mode 100644 index 0000000000000..dd3634b6dc9bd Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_lockscreen_music_activated.png differ diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_music_normal.png b/core/res/res/drawable-xhdpi/ic_lockscreen_music_normal.png new file mode 100644 index 0000000000000..781f8c79f9da8 Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_lockscreen_music_normal.png differ diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_nav_activated.png b/core/res/res/drawable-xhdpi/ic_lockscreen_nav_activated.png new file mode 100644 index 0000000000000..aa2ff3da6e60f Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_lockscreen_nav_activated.png differ diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_nav_normal.png b/core/res/res/drawable-xhdpi/ic_lockscreen_nav_normal.png new file mode 100644 index 0000000000000..f0802c8c108b7 Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_lockscreen_nav_normal.png differ diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_phone_activated.png b/core/res/res/drawable-xhdpi/ic_lockscreen_phone_activated.png new file mode 100644 index 0000000000000..8365b44a0b5b9 Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_lockscreen_phone_activated.png differ diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_phone_normal.png b/core/res/res/drawable-xhdpi/ic_lockscreen_phone_normal.png new file mode 100644 index 0000000000000..8eac8601dae38 Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_lockscreen_phone_normal.png differ diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_podcast_activated.png b/core/res/res/drawable-xhdpi/ic_lockscreen_podcast_activated.png new file mode 100644 index 0000000000000..fa0ae47dd776f Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_lockscreen_podcast_activated.png differ diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_podcast_normal.png b/core/res/res/drawable-xhdpi/ic_lockscreen_podcast_normal.png new file mode 100644 index 0000000000000..dd7f4703cdb00 Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_lockscreen_podcast_normal.png differ diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_rss_activated.png b/core/res/res/drawable-xhdpi/ic_lockscreen_rss_activated.png new file mode 100644 index 0000000000000..4d0a020df8c27 Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_lockscreen_rss_activated.png differ diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_rss_normal.png b/core/res/res/drawable-xhdpi/ic_lockscreen_rss_normal.png new file mode 100644 index 0000000000000..7d32abf8c6040 Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_lockscreen_rss_normal.png differ diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_sim.png b/core/res/res/drawable-xhdpi/ic_lockscreen_sim.png new file mode 100644 index 0000000000000..f4de96adae303 Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_lockscreen_sim.png differ diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_sms_activated.png b/core/res/res/drawable-xhdpi/ic_lockscreen_sms_activated.png new file mode 100644 index 0000000000000..efec4bc1b77ce Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_lockscreen_sms_activated.png differ diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_sms_normal.png b/core/res/res/drawable-xhdpi/ic_lockscreen_sms_normal.png new file mode 100644 index 0000000000000..302344dc64334 Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_lockscreen_sms_normal.png differ diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_soundon_normal.png b/core/res/res/drawable-xhdpi/ic_lockscreen_soundon_normal.png index 6af5375b919bc..01ad7810996dd 100644 Binary files a/core/res/res/drawable-xhdpi/ic_lockscreen_soundon_normal.png and b/core/res/res/drawable-xhdpi/ic_lockscreen_soundon_normal.png differ diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_target_activated.png b/core/res/res/drawable-xhdpi/ic_lockscreen_target_activated.png new file mode 100644 index 0000000000000..6f84ff2396a6b Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_lockscreen_target_activated.png differ diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_twitter_activated.png b/core/res/res/drawable-xhdpi/ic_lockscreen_twitter_activated.png new file mode 100644 index 0000000000000..b8da99418724e Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_lockscreen_twitter_activated.png differ diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_twitter_normal.png b/core/res/res/drawable-xhdpi/ic_lockscreen_twitter_normal.png new file mode 100644 index 0000000000000..b084153db4a43 Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_lockscreen_twitter_normal.png differ diff --git a/core/res/res/drawable-xhdpi/ic_media_route_on_0_holo_dark.png b/core/res/res/drawable-xhdpi/ic_media_route_on_0_holo_dark.png new file mode 100644 index 0000000000000..483b61270a0ea Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_media_route_on_0_holo_dark.png differ diff --git a/core/res/res/drawable-xhdpi/ic_media_route_on_0_holo_light.png b/core/res/res/drawable-xhdpi/ic_media_route_on_0_holo_light.png new file mode 100644 index 0000000000000..c3507dc30cea3 Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_media_route_on_0_holo_light.png differ diff --git a/core/res/res/drawable-xhdpi/ic_media_route_on_1_holo_dark.png b/core/res/res/drawable-xhdpi/ic_media_route_on_1_holo_dark.png new file mode 100644 index 0000000000000..24c65198f21a3 Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_media_route_on_1_holo_dark.png differ diff --git a/core/res/res/drawable-xhdpi/ic_media_route_on_1_holo_light.png b/core/res/res/drawable-xhdpi/ic_media_route_on_1_holo_light.png new file mode 100644 index 0000000000000..2be0380fdbfce Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_media_route_on_1_holo_light.png differ diff --git a/core/res/res/drawable-xhdpi/ic_media_route_on_2_holo_dark.png b/core/res/res/drawable-xhdpi/ic_media_route_on_2_holo_dark.png new file mode 100644 index 0000000000000..4fd69bd765cb1 Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_media_route_on_2_holo_dark.png differ diff --git a/core/res/res/drawable-xhdpi/ic_media_route_on_2_holo_light.png b/core/res/res/drawable-xhdpi/ic_media_route_on_2_holo_light.png new file mode 100644 index 0000000000000..51588564da424 Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_media_route_on_2_holo_light.png differ diff --git a/core/res/res/drawable-xhdpi/ic_notify_wifidisplay.png b/core/res/res/drawable-xhdpi/ic_notify_wifidisplay.png new file mode 100644 index 0000000000000..4cc0ee83faf89 Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_notify_wifidisplay.png differ diff --git a/core/res/res/drawable-xhdpi/ic_suggestions_add.png b/core/res/res/drawable-xhdpi/ic_suggestions_add.png deleted file mode 100644 index b1edef7ea550c..0000000000000 Binary files a/core/res/res/drawable-xhdpi/ic_suggestions_add.png and /dev/null differ diff --git a/core/res/res/drawable-xhdpi/ic_suggestions_delete.png b/core/res/res/drawable-xhdpi/ic_suggestions_delete.png deleted file mode 100644 index 6b1f447545514..0000000000000 Binary files a/core/res/res/drawable-xhdpi/ic_suggestions_delete.png and /dev/null differ diff --git a/core/res/res/drawable-xhdpi/kg_add_widget.png b/core/res/res/drawable-xhdpi/kg_add_widget.png new file mode 100644 index 0000000000000..9c84de2e1d40a Binary files /dev/null and b/core/res/res/drawable-xhdpi/kg_add_widget.png differ diff --git a/core/res/res/drawable-xhdpi/kg_bouncer_bg_white.9.png b/core/res/res/drawable-xhdpi/kg_bouncer_bg_white.9.png new file mode 100644 index 0000000000000..b9e30e20a9528 Binary files /dev/null and b/core/res/res/drawable-xhdpi/kg_bouncer_bg_white.9.png differ diff --git a/core/res/res/drawable-xhdpi/kg_security_grip.9.png b/core/res/res/drawable-xhdpi/kg_security_grip.9.png new file mode 100644 index 0000000000000..c33b9d3471bcb Binary files /dev/null and b/core/res/res/drawable-xhdpi/kg_security_grip.9.png differ diff --git a/core/res/res/drawable-xhdpi/kg_security_lock.png b/core/res/res/drawable-xhdpi/kg_security_lock.png new file mode 100644 index 0000000000000..81d577e328d64 Binary files /dev/null and b/core/res/res/drawable-xhdpi/kg_security_lock.png differ diff --git a/core/res/res/drawable-xhdpi/kg_security_lock_focused.png b/core/res/res/drawable-xhdpi/kg_security_lock_focused.png new file mode 100644 index 0000000000000..ee21647399e2a Binary files /dev/null and b/core/res/res/drawable-xhdpi/kg_security_lock_focused.png differ diff --git a/core/res/res/drawable-xhdpi/kg_security_lock_normal.png b/core/res/res/drawable-xhdpi/kg_security_lock_normal.png new file mode 100644 index 0000000000000..eae7d8c55e3db Binary files /dev/null and b/core/res/res/drawable-xhdpi/kg_security_lock_normal.png differ diff --git a/core/res/res/drawable-xhdpi/kg_security_lock_pressed.png b/core/res/res/drawable-xhdpi/kg_security_lock_pressed.png new file mode 100644 index 0000000000000..5e9a52b6b5040 Binary files /dev/null and b/core/res/res/drawable-xhdpi/kg_security_lock_pressed.png differ diff --git a/core/res/res/drawable-xhdpi/kg_widget_bg_padded.9.png b/core/res/res/drawable-xhdpi/kg_widget_bg_padded.9.png new file mode 100644 index 0000000000000..a84bfa39ce6cd Binary files /dev/null and b/core/res/res/drawable-xhdpi/kg_widget_bg_padded.9.png differ diff --git a/core/res/res/drawable-xhdpi/kg_widget_delete_drop_target.png b/core/res/res/drawable-xhdpi/kg_widget_delete_drop_target.png new file mode 100644 index 0000000000000..d4965d9f804e2 Binary files /dev/null and b/core/res/res/drawable-xhdpi/kg_widget_delete_drop_target.png differ diff --git a/core/res/res/drawable-xhdpi/lockscreen_protection_pattern.png b/core/res/res/drawable-xhdpi/lockscreen_protection_pattern.png new file mode 100644 index 0000000000000..c13afe2b795c3 Binary files /dev/null and b/core/res/res/drawable-xhdpi/lockscreen_protection_pattern.png differ diff --git a/core/res/res/drawable-xhdpi/magnified_region_frame.9.png b/core/res/res/drawable-xhdpi/magnified_region_frame.9.png new file mode 100644 index 0000000000000..424b3d97313ad Binary files /dev/null and b/core/res/res/drawable-xhdpi/magnified_region_frame.9.png differ diff --git a/core/res/res/drawable-xhdpi/menu_dropdown_panel_holo_dark.9.png b/core/res/res/drawable-xhdpi/menu_dropdown_panel_holo_dark.9.png index e2aff72f483ce..f67e6095ec739 100644 Binary files a/core/res/res/drawable-xhdpi/menu_dropdown_panel_holo_dark.9.png and b/core/res/res/drawable-xhdpi/menu_dropdown_panel_holo_dark.9.png differ diff --git a/core/res/res/drawable-xhdpi/menu_dropdown_panel_holo_light.9.png b/core/res/res/drawable-xhdpi/menu_dropdown_panel_holo_light.9.png index 93066c8403dda..ed71eda0aeb9c 100644 Binary files a/core/res/res/drawable-xhdpi/menu_dropdown_panel_holo_light.9.png and b/core/res/res/drawable-xhdpi/menu_dropdown_panel_holo_light.9.png differ diff --git a/core/res/res/drawable-xhdpi/menu_hardkey_panel_holo_dark.9.png b/core/res/res/drawable-xhdpi/menu_hardkey_panel_holo_dark.9.png index 521e2d9d090a5..585bccc5451cd 100644 Binary files a/core/res/res/drawable-xhdpi/menu_hardkey_panel_holo_dark.9.png and b/core/res/res/drawable-xhdpi/menu_hardkey_panel_holo_dark.9.png differ diff --git a/core/res/res/drawable-xhdpi/menu_hardkey_panel_holo_light.9.png b/core/res/res/drawable-xhdpi/menu_hardkey_panel_holo_light.9.png index 92e117d41c60c..a0669b9fce27c 100644 Binary files a/core/res/res/drawable-xhdpi/menu_hardkey_panel_holo_light.9.png and b/core/res/res/drawable-xhdpi/menu_hardkey_panel_holo_light.9.png differ diff --git a/core/res/res/drawable-xhdpi/panel_bg_holo_dark.9.png b/core/res/res/drawable-xhdpi/panel_bg_holo_dark.9.png index 0cf7ac83dff22..aaf6d8b19774f 100644 Binary files a/core/res/res/drawable-xhdpi/panel_bg_holo_dark.9.png and b/core/res/res/drawable-xhdpi/panel_bg_holo_dark.9.png differ diff --git a/core/res/res/drawable-xhdpi/panel_bg_holo_light.9.png b/core/res/res/drawable-xhdpi/panel_bg_holo_light.9.png index 9bdf3f1665c7e..6ea76159c9b08 100644 Binary files a/core/res/res/drawable-xhdpi/panel_bg_holo_light.9.png and b/core/res/res/drawable-xhdpi/panel_bg_holo_light.9.png differ diff --git a/core/res/res/drawable-xhdpi/spinner_ab_default_holo_dark.9.png b/core/res/res/drawable-xhdpi/spinner_ab_default_holo_dark.9.png index d8929fcd1864e..c43293d5ccdc9 100644 Binary files a/core/res/res/drawable-xhdpi/spinner_ab_default_holo_dark.9.png and b/core/res/res/drawable-xhdpi/spinner_ab_default_holo_dark.9.png differ diff --git a/core/res/res/drawable-xhdpi/spinner_ab_default_holo_light.9.png b/core/res/res/drawable-xhdpi/spinner_ab_default_holo_light.9.png index 9174c4e4bc984..3dc481e54305d 100644 Binary files a/core/res/res/drawable-xhdpi/spinner_ab_default_holo_light.9.png and b/core/res/res/drawable-xhdpi/spinner_ab_default_holo_light.9.png differ diff --git a/core/res/res/drawable-xhdpi/spinner_ab_disabled_holo_dark.9.png b/core/res/res/drawable-xhdpi/spinner_ab_disabled_holo_dark.9.png index 3015d307088f1..9a7b1731d5e42 100644 Binary files a/core/res/res/drawable-xhdpi/spinner_ab_disabled_holo_dark.9.png and b/core/res/res/drawable-xhdpi/spinner_ab_disabled_holo_dark.9.png differ diff --git a/core/res/res/drawable-xhdpi/spinner_ab_disabled_holo_light.9.png b/core/res/res/drawable-xhdpi/spinner_ab_disabled_holo_light.9.png index 126637d1194f1..6888fdc025ab5 100644 Binary files a/core/res/res/drawable-xhdpi/spinner_ab_disabled_holo_light.9.png and b/core/res/res/drawable-xhdpi/spinner_ab_disabled_holo_light.9.png differ diff --git a/core/res/res/drawable-xhdpi/spinner_ab_focused_holo_dark.9.png b/core/res/res/drawable-xhdpi/spinner_ab_focused_holo_dark.9.png index d45c7a864d9b3..9408b474cdb7d 100644 Binary files a/core/res/res/drawable-xhdpi/spinner_ab_focused_holo_dark.9.png and b/core/res/res/drawable-xhdpi/spinner_ab_focused_holo_dark.9.png differ diff --git a/core/res/res/drawable-xhdpi/spinner_ab_focused_holo_light.9.png b/core/res/res/drawable-xhdpi/spinner_ab_focused_holo_light.9.png index 29036b907a231..1cb95d161219b 100644 Binary files a/core/res/res/drawable-xhdpi/spinner_ab_focused_holo_light.9.png and b/core/res/res/drawable-xhdpi/spinner_ab_focused_holo_light.9.png differ diff --git a/core/res/res/drawable-xhdpi/spinner_ab_pressed_holo_dark.9.png b/core/res/res/drawable-xhdpi/spinner_ab_pressed_holo_dark.9.png index 2cb34d7f60401..a3c771162ea94 100644 Binary files a/core/res/res/drawable-xhdpi/spinner_ab_pressed_holo_dark.9.png and b/core/res/res/drawable-xhdpi/spinner_ab_pressed_holo_dark.9.png differ diff --git a/core/res/res/drawable-xhdpi/spinner_ab_pressed_holo_light.9.png b/core/res/res/drawable-xhdpi/spinner_ab_pressed_holo_light.9.png index 82f752fdc2839..2a21210176251 100644 Binary files a/core/res/res/drawable-xhdpi/spinner_ab_pressed_holo_light.9.png and b/core/res/res/drawable-xhdpi/spinner_ab_pressed_holo_light.9.png differ diff --git a/core/res/res/drawable-xhdpi/spinner_default_holo_dark.9.png b/core/res/res/drawable-xhdpi/spinner_default_holo_dark.9.png index e94ce80c93052..fadfb5d01c09e 100644 Binary files a/core/res/res/drawable-xhdpi/spinner_default_holo_dark.9.png and b/core/res/res/drawable-xhdpi/spinner_default_holo_dark.9.png differ diff --git a/core/res/res/drawable-xhdpi/spinner_default_holo_light.9.png b/core/res/res/drawable-xhdpi/spinner_default_holo_light.9.png index f006541bb9150..5a4ec3b5ed795 100644 Binary files a/core/res/res/drawable-xhdpi/spinner_default_holo_light.9.png and b/core/res/res/drawable-xhdpi/spinner_default_holo_light.9.png differ diff --git a/core/res/res/drawable-xhdpi/spinner_disabled_holo_dark.9.png b/core/res/res/drawable-xhdpi/spinner_disabled_holo_dark.9.png index 7bfab99ae0d61..7c3c49baf4971 100644 Binary files a/core/res/res/drawable-xhdpi/spinner_disabled_holo_dark.9.png and b/core/res/res/drawable-xhdpi/spinner_disabled_holo_dark.9.png differ diff --git a/core/res/res/drawable-xhdpi/spinner_disabled_holo_light.9.png b/core/res/res/drawable-xhdpi/spinner_disabled_holo_light.9.png index 1edcc81e4b6bc..fe541269ede8c 100644 Binary files a/core/res/res/drawable-xhdpi/spinner_disabled_holo_light.9.png and b/core/res/res/drawable-xhdpi/spinner_disabled_holo_light.9.png differ diff --git a/core/res/res/drawable-xhdpi/spinner_focused_holo_dark.9.png b/core/res/res/drawable-xhdpi/spinner_focused_holo_dark.9.png index ff7b959a050ae..9ea957e495ec7 100644 Binary files a/core/res/res/drawable-xhdpi/spinner_focused_holo_dark.9.png and b/core/res/res/drawable-xhdpi/spinner_focused_holo_dark.9.png differ diff --git a/core/res/res/drawable-xhdpi/spinner_focused_holo_light.9.png b/core/res/res/drawable-xhdpi/spinner_focused_holo_light.9.png index 156b5ab377cbd..8cb2fd8c0bc1e 100644 Binary files a/core/res/res/drawable-xhdpi/spinner_focused_holo_light.9.png and b/core/res/res/drawable-xhdpi/spinner_focused_holo_light.9.png differ diff --git a/core/res/res/drawable-xhdpi/spinner_pressed_holo_dark.9.png b/core/res/res/drawable-xhdpi/spinner_pressed_holo_dark.9.png index d0ce6e4cf05b5..aecf6bda9140e 100644 Binary files a/core/res/res/drawable-xhdpi/spinner_pressed_holo_dark.9.png and b/core/res/res/drawable-xhdpi/spinner_pressed_holo_dark.9.png differ diff --git a/core/res/res/drawable-xhdpi/spinner_pressed_holo_light.9.png b/core/res/res/drawable-xhdpi/spinner_pressed_holo_light.9.png index 9e9617ee7f28b..3273a22422c77 100644 Binary files a/core/res/res/drawable-xhdpi/spinner_pressed_holo_light.9.png and b/core/res/res/drawable-xhdpi/spinner_pressed_holo_light.9.png differ diff --git a/core/res/res/drawable-xhdpi/stat_notify_rssi_in_range.png b/core/res/res/drawable-xhdpi/stat_notify_rssi_in_range.png new file mode 100644 index 0000000000000..c0586d8bc21ee Binary files /dev/null and b/core/res/res/drawable-xhdpi/stat_notify_rssi_in_range.png differ diff --git a/core/res/res/drawable-xhdpi/stat_sys_adb.png b/core/res/res/drawable-xhdpi/stat_sys_adb.png index 576ae242a3386..2f4d755505176 100644 Binary files a/core/res/res/drawable-xhdpi/stat_sys_adb.png and b/core/res/res/drawable-xhdpi/stat_sys_adb.png differ diff --git a/core/res/res/drawable-xhdpi/stat_sys_tether_bluetooth.png b/core/res/res/drawable-xhdpi/stat_sys_tether_bluetooth.png index 3f57d1c76ccb1..16c0d2dafc4c2 100644 Binary files a/core/res/res/drawable-xhdpi/stat_sys_tether_bluetooth.png and b/core/res/res/drawable-xhdpi/stat_sys_tether_bluetooth.png differ diff --git a/core/res/res/drawable-xhdpi/stat_sys_tether_usb.png b/core/res/res/drawable-xhdpi/stat_sys_tether_usb.png index 36afe485b5bb6..633b1818ab9e7 100644 Binary files a/core/res/res/drawable-xhdpi/stat_sys_tether_usb.png and b/core/res/res/drawable-xhdpi/stat_sys_tether_usb.png differ diff --git a/core/res/res/drawable-xhdpi/stat_sys_tether_wifi.png b/core/res/res/drawable-xhdpi/stat_sys_tether_wifi.png index dc48646b64f7c..d381c202a3ebb 100644 Binary files a/core/res/res/drawable-xhdpi/stat_sys_tether_wifi.png and b/core/res/res/drawable-xhdpi/stat_sys_tether_wifi.png differ diff --git a/core/res/res/drawable-xhdpi/sym_keyboard_delete.png b/core/res/res/drawable-xhdpi/sym_keyboard_delete.png index ca936d1985c6d..45c14aa78c1e0 100644 Binary files a/core/res/res/drawable-xhdpi/sym_keyboard_delete.png and b/core/res/res/drawable-xhdpi/sym_keyboard_delete.png differ diff --git a/core/res/res/drawable-xhdpi/sym_keyboard_enter.png b/core/res/res/drawable-xhdpi/sym_keyboard_enter.png new file mode 100644 index 0000000000000..3b034fd89e315 Binary files /dev/null and b/core/res/res/drawable-xhdpi/sym_keyboard_enter.png differ diff --git a/core/res/res/drawable-xhdpi/sym_keyboard_num0_no_plus.png b/core/res/res/drawable-xhdpi/sym_keyboard_num0_no_plus.png index 95b542d11d070..cdd256d7179de 100644 Binary files a/core/res/res/drawable-xhdpi/sym_keyboard_num0_no_plus.png and b/core/res/res/drawable-xhdpi/sym_keyboard_num0_no_plus.png differ diff --git a/core/res/res/drawable-xhdpi/sym_keyboard_num1.png b/core/res/res/drawable-xhdpi/sym_keyboard_num1.png index decd5843838c6..d81d4b58f74a4 100644 Binary files a/core/res/res/drawable-xhdpi/sym_keyboard_num1.png and b/core/res/res/drawable-xhdpi/sym_keyboard_num1.png differ diff --git a/core/res/res/drawable-xhdpi/sym_keyboard_num2.png b/core/res/res/drawable-xhdpi/sym_keyboard_num2.png index 37948fbfcd3b2..8ae9fafae3f6b 100644 Binary files a/core/res/res/drawable-xhdpi/sym_keyboard_num2.png and b/core/res/res/drawable-xhdpi/sym_keyboard_num2.png differ diff --git a/core/res/res/drawable-xhdpi/sym_keyboard_num3.png b/core/res/res/drawable-xhdpi/sym_keyboard_num3.png index 0e36ff2bf6cb3..ed6e90ab727c6 100644 Binary files a/core/res/res/drawable-xhdpi/sym_keyboard_num3.png and b/core/res/res/drawable-xhdpi/sym_keyboard_num3.png differ diff --git a/core/res/res/drawable-xhdpi/sym_keyboard_num4.png b/core/res/res/drawable-xhdpi/sym_keyboard_num4.png index f469a4a8d44bc..5cff39f925d64 100644 Binary files a/core/res/res/drawable-xhdpi/sym_keyboard_num4.png and b/core/res/res/drawable-xhdpi/sym_keyboard_num4.png differ diff --git a/core/res/res/drawable-xhdpi/sym_keyboard_num5.png b/core/res/res/drawable-xhdpi/sym_keyboard_num5.png index 941f877360345..1c9358efd393c 100644 Binary files a/core/res/res/drawable-xhdpi/sym_keyboard_num5.png and b/core/res/res/drawable-xhdpi/sym_keyboard_num5.png differ diff --git a/core/res/res/drawable-xhdpi/sym_keyboard_num6.png b/core/res/res/drawable-xhdpi/sym_keyboard_num6.png index eceec55334e7b..9a5cb6fac58f7 100644 Binary files a/core/res/res/drawable-xhdpi/sym_keyboard_num6.png and b/core/res/res/drawable-xhdpi/sym_keyboard_num6.png differ diff --git a/core/res/res/drawable-xhdpi/sym_keyboard_num7.png b/core/res/res/drawable-xhdpi/sym_keyboard_num7.png index 5b5d2055f22c3..1bd5c6b6dc4ac 100644 Binary files a/core/res/res/drawable-xhdpi/sym_keyboard_num7.png and b/core/res/res/drawable-xhdpi/sym_keyboard_num7.png differ diff --git a/core/res/res/drawable-xhdpi/sym_keyboard_num8.png b/core/res/res/drawable-xhdpi/sym_keyboard_num8.png index ea776ebf8d3fe..9a3315258a400 100644 Binary files a/core/res/res/drawable-xhdpi/sym_keyboard_num8.png and b/core/res/res/drawable-xhdpi/sym_keyboard_num8.png differ diff --git a/core/res/res/drawable-xhdpi/sym_keyboard_num9.png b/core/res/res/drawable-xhdpi/sym_keyboard_num9.png index 29047fb01021f..caa3113d170ce 100644 Binary files a/core/res/res/drawable-xhdpi/sym_keyboard_num9.png and b/core/res/res/drawable-xhdpi/sym_keyboard_num9.png differ diff --git a/core/res/res/drawable-xhdpi/sym_keyboard_return_holo.png b/core/res/res/drawable-xhdpi/sym_keyboard_return_holo.png new file mode 100644 index 0000000000000..55174e0767653 Binary files /dev/null and b/core/res/res/drawable-xhdpi/sym_keyboard_return_holo.png differ diff --git a/core/res/res/drawable-xhdpi/textfield_activated_holo_dark.9.png b/core/res/res/drawable-xhdpi/textfield_activated_holo_dark.9.png index b3f8cd6a06e99..653b7dc73ec07 100644 Binary files a/core/res/res/drawable-xhdpi/textfield_activated_holo_dark.9.png and b/core/res/res/drawable-xhdpi/textfield_activated_holo_dark.9.png differ diff --git a/core/res/res/drawable-xhdpi/textfield_activated_holo_light.9.png b/core/res/res/drawable-xhdpi/textfield_activated_holo_light.9.png index b3f8cd6a06e99..08fcc5e52d98a 100644 Binary files a/core/res/res/drawable-xhdpi/textfield_activated_holo_light.9.png and b/core/res/res/drawable-xhdpi/textfield_activated_holo_light.9.png differ diff --git a/core/res/res/drawable-xhdpi/textfield_default_holo_dark.9.png b/core/res/res/drawable-xhdpi/textfield_default_holo_dark.9.png index b5c5907ef7d13..3f63c3fc90be8 100644 Binary files a/core/res/res/drawable-xhdpi/textfield_default_holo_dark.9.png and b/core/res/res/drawable-xhdpi/textfield_default_holo_dark.9.png differ diff --git a/core/res/res/drawable-xhdpi/textfield_default_holo_light.9.png b/core/res/res/drawable-xhdpi/textfield_default_holo_light.9.png index 30052e9ac918a..dbb9924827606 100644 Binary files a/core/res/res/drawable-xhdpi/textfield_default_holo_light.9.png and b/core/res/res/drawable-xhdpi/textfield_default_holo_light.9.png differ diff --git a/core/res/res/drawable-xhdpi/textfield_disabled_focused_holo_dark.9.png b/core/res/res/drawable-xhdpi/textfield_disabled_focused_holo_dark.9.png index 16be83999b6ba..a9767fc7ed42c 100644 Binary files a/core/res/res/drawable-xhdpi/textfield_disabled_focused_holo_dark.9.png and b/core/res/res/drawable-xhdpi/textfield_disabled_focused_holo_dark.9.png differ diff --git a/core/res/res/drawable-xhdpi/textfield_disabled_focused_holo_light.9.png b/core/res/res/drawable-xhdpi/textfield_disabled_focused_holo_light.9.png index ddd05596cc489..40a28cf70218e 100644 Binary files a/core/res/res/drawable-xhdpi/textfield_disabled_focused_holo_light.9.png and b/core/res/res/drawable-xhdpi/textfield_disabled_focused_holo_light.9.png differ diff --git a/core/res/res/drawable-xhdpi/textfield_disabled_holo_dark.9.png b/core/res/res/drawable-xhdpi/textfield_disabled_holo_dark.9.png index 3d143b9d14524..d78b10d67c44b 100644 Binary files a/core/res/res/drawable-xhdpi/textfield_disabled_holo_dark.9.png and b/core/res/res/drawable-xhdpi/textfield_disabled_holo_dark.9.png differ diff --git a/core/res/res/drawable-xhdpi/textfield_disabled_holo_light.9.png b/core/res/res/drawable-xhdpi/textfield_disabled_holo_light.9.png index dfb218564d7fd..4ffdd869e10d4 100644 Binary files a/core/res/res/drawable-xhdpi/textfield_disabled_holo_light.9.png and b/core/res/res/drawable-xhdpi/textfield_disabled_holo_light.9.png differ diff --git a/core/res/res/drawable-xhdpi/textfield_multiline_activated_holo_dark.9.png b/core/res/res/drawable-xhdpi/textfield_multiline_activated_holo_dark.9.png index b3f8cd6a06e99..e12da1b0a6c39 100644 Binary files a/core/res/res/drawable-xhdpi/textfield_multiline_activated_holo_dark.9.png and b/core/res/res/drawable-xhdpi/textfield_multiline_activated_holo_dark.9.png differ diff --git a/core/res/res/drawable-xhdpi/textfield_multiline_activated_holo_light.9.png b/core/res/res/drawable-xhdpi/textfield_multiline_activated_holo_light.9.png index b3f8cd6a06e99..557788bc13b0b 100644 Binary files a/core/res/res/drawable-xhdpi/textfield_multiline_activated_holo_light.9.png and b/core/res/res/drawable-xhdpi/textfield_multiline_activated_holo_light.9.png differ diff --git a/core/res/res/drawable-xhdpi/textfield_multiline_default_holo_dark.9.png b/core/res/res/drawable-xhdpi/textfield_multiline_default_holo_dark.9.png index b5c5907ef7d13..9a367c9be58f5 100644 Binary files a/core/res/res/drawable-xhdpi/textfield_multiline_default_holo_dark.9.png and b/core/res/res/drawable-xhdpi/textfield_multiline_default_holo_dark.9.png differ diff --git a/core/res/res/drawable-xhdpi/textfield_multiline_default_holo_light.9.png b/core/res/res/drawable-xhdpi/textfield_multiline_default_holo_light.9.png index 30052e9ac918a..147ac589d3e0f 100644 Binary files a/core/res/res/drawable-xhdpi/textfield_multiline_default_holo_light.9.png and b/core/res/res/drawable-xhdpi/textfield_multiline_default_holo_light.9.png differ diff --git a/core/res/res/drawable-xhdpi/textfield_multiline_disabled_focused_holo_dark.9.png b/core/res/res/drawable-xhdpi/textfield_multiline_disabled_focused_holo_dark.9.png index 16be83999b6ba..f89316a9bd010 100644 Binary files a/core/res/res/drawable-xhdpi/textfield_multiline_disabled_focused_holo_dark.9.png and b/core/res/res/drawable-xhdpi/textfield_multiline_disabled_focused_holo_dark.9.png differ diff --git a/core/res/res/drawable-xhdpi/textfield_multiline_disabled_focused_holo_light.9.png b/core/res/res/drawable-xhdpi/textfield_multiline_disabled_focused_holo_light.9.png index ddd05596cc489..06173a4125704 100644 Binary files a/core/res/res/drawable-xhdpi/textfield_multiline_disabled_focused_holo_light.9.png and b/core/res/res/drawable-xhdpi/textfield_multiline_disabled_focused_holo_light.9.png differ diff --git a/core/res/res/drawable-xhdpi/textfield_multiline_disabled_holo_dark.9.png b/core/res/res/drawable-xhdpi/textfield_multiline_disabled_holo_dark.9.png index 3d143b9d14524..1463e5d20e7fb 100644 Binary files a/core/res/res/drawable-xhdpi/textfield_multiline_disabled_holo_dark.9.png and b/core/res/res/drawable-xhdpi/textfield_multiline_disabled_holo_dark.9.png differ diff --git a/core/res/res/drawable-xhdpi/textfield_multiline_disabled_holo_light.9.png b/core/res/res/drawable-xhdpi/textfield_multiline_disabled_holo_light.9.png index dfb218564d7fd..e1c7e8cfea6b5 100644 Binary files a/core/res/res/drawable-xhdpi/textfield_multiline_disabled_holo_light.9.png and b/core/res/res/drawable-xhdpi/textfield_multiline_disabled_holo_light.9.png differ diff --git a/core/res/res/drawable-xhdpi/textfield_multiline_focused_holo_dark.9.png b/core/res/res/drawable-xhdpi/textfield_multiline_focused_holo_dark.9.png index 7f0dc654849f1..924735307d6f0 100644 Binary files a/core/res/res/drawable-xhdpi/textfield_multiline_focused_holo_dark.9.png and b/core/res/res/drawable-xhdpi/textfield_multiline_focused_holo_dark.9.png differ diff --git a/core/res/res/drawable-xhdpi/textfield_multiline_focused_holo_light.9.png b/core/res/res/drawable-xhdpi/textfield_multiline_focused_holo_light.9.png index 7f0dc654849f1..cab8e9ff016be 100644 Binary files a/core/res/res/drawable-xhdpi/textfield_multiline_focused_holo_light.9.png and b/core/res/res/drawable-xhdpi/textfield_multiline_focused_holo_light.9.png differ diff --git a/core/res/res/drawable/background_holo_dark.xml b/core/res/res/drawable/background_holo_dark.xml new file mode 100644 index 0000000000000..7cfae4dc740ed --- /dev/null +++ b/core/res/res/drawable/background_holo_dark.xml @@ -0,0 +1,22 @@ + + + + + + diff --git a/core/res/res/drawable/background_holo_light.xml b/core/res/res/drawable/background_holo_light.xml new file mode 100644 index 0000000000000..4e863ea2b205f --- /dev/null +++ b/core/res/res/drawable/background_holo_light.xml @@ -0,0 +1,22 @@ + + + + + + diff --git a/core/res/res/drawable/ic_media_route_connecting_holo_dark.xml b/core/res/res/drawable/ic_media_route_connecting_holo_dark.xml new file mode 100644 index 0000000000000..36e01f6ef7d38 --- /dev/null +++ b/core/res/res/drawable/ic_media_route_connecting_holo_dark.xml @@ -0,0 +1,28 @@ + + + + + + + + + + diff --git a/core/res/res/drawable/ic_media_route_connecting_holo_light.xml b/core/res/res/drawable/ic_media_route_connecting_holo_light.xml new file mode 100644 index 0000000000000..6683db84bd0d0 --- /dev/null +++ b/core/res/res/drawable/ic_media_route_connecting_holo_light.xml @@ -0,0 +1,28 @@ + + + + + + + + + + diff --git a/core/res/res/drawable/ic_media_route_holo_dark.xml b/core/res/res/drawable/ic_media_route_holo_dark.xml index 0b267d7cff959..b4c1fac9cca9c 100644 --- a/core/res/res/drawable/ic_media_route_holo_dark.xml +++ b/core/res/res/drawable/ic_media_route_holo_dark.xml @@ -15,6 +15,7 @@ --> + diff --git a/core/res/res/drawable/ic_media_route_holo_light.xml b/core/res/res/drawable/ic_media_route_holo_light.xml index 377253a2e077e..553721d6678c5 100644 --- a/core/res/res/drawable/ic_media_route_holo_light.xml +++ b/core/res/res/drawable/ic_media_route_holo_light.xml @@ -15,6 +15,7 @@ --> + diff --git a/core/res/res/drawable/keyguard_expand_challenge_handle.xml b/core/res/res/drawable/keyguard_expand_challenge_handle.xml new file mode 100644 index 0000000000000..3e0780bedcafb --- /dev/null +++ b/core/res/res/drawable/keyguard_expand_challenge_handle.xml @@ -0,0 +1,21 @@ + + + + + + + + diff --git a/core/res/res/drawable/progress_large.xml b/core/res/res/drawable/progress_large.xml index 4f016bcc2e83e..44b410393182f 100644 --- a/core/res/res/drawable/progress_large.xml +++ b/core/res/res/drawable/progress_large.xml @@ -21,5 +21,5 @@ android:drawable="@drawable/spinner_black_76" android:pivotX="50%" android:pivotY="50%" - android:framesCount="12" - android:frameDuration="100" /> + android:framesCount="48" + android:frameDuration="25" /> diff --git a/core/res/res/drawable/progress_large_white.xml b/core/res/res/drawable/progress_large_white.xml index c690ed4e0e9ae..6c2388c680a3f 100644 --- a/core/res/res/drawable/progress_large_white.xml +++ b/core/res/res/drawable/progress_large_white.xml @@ -21,5 +21,5 @@ android:drawable="@drawable/spinner_white_76" android:pivotX="50%" android:pivotY="50%" - android:framesCount="12" - android:frameDuration="100" /> + android:framesCount="48" + android:frameDuration="25" /> diff --git a/core/res/res/drawable/progress_medium.xml b/core/res/res/drawable/progress_medium.xml index eb1bd50d17d73..82ad686b67390 100644 --- a/core/res/res/drawable/progress_medium.xml +++ b/core/res/res/drawable/progress_medium.xml @@ -21,5 +21,5 @@ android:drawable="@drawable/spinner_black_48" android:pivotX="50%" android:pivotY="50%" - android:framesCount="12" - android:frameDuration="100" /> + android:framesCount="48" + android:frameDuration="25" /> diff --git a/core/res/res/drawable/progress_medium_white.xml b/core/res/res/drawable/progress_medium_white.xml index b4f9b318a902a..886ee05bc9c78 100644 --- a/core/res/res/drawable/progress_medium_white.xml +++ b/core/res/res/drawable/progress_medium_white.xml @@ -21,5 +21,5 @@ android:drawable="@drawable/spinner_white_48" android:pivotX="50%" android:pivotY="50%" - android:framesCount="12" - android:frameDuration="100" /> + android:framesCount="48" + android:frameDuration="25" /> diff --git a/core/res/res/drawable/progress_small.xml b/core/res/res/drawable/progress_small.xml index e0ee5e47d8305..1881da3848924 100644 --- a/core/res/res/drawable/progress_small.xml +++ b/core/res/res/drawable/progress_small.xml @@ -21,5 +21,5 @@ android:drawable="@drawable/spinner_black_16" android:pivotX="50%" android:pivotY="50%" - android:framesCount="12" - android:frameDuration="100" /> + android:framesCount="48" + android:frameDuration="25" /> diff --git a/core/res/res/drawable/progress_small_titlebar.xml b/core/res/res/drawable/progress_small_titlebar.xml index 8cfba864b5b2c..5bb5cf8749dc4 100644 --- a/core/res/res/drawable/progress_small_titlebar.xml +++ b/core/res/res/drawable/progress_small_titlebar.xml @@ -21,5 +21,5 @@ android:drawable="@drawable/spinner_white_16" android:pivotX="50%" android:pivotY="50%" - android:framesCount="12" - android:frameDuration="100" /> + android:framesCount="48" + android:frameDuration="25" /> diff --git a/core/res/res/drawable/progress_small_white.xml b/core/res/res/drawable/progress_small_white.xml index 8cfba864b5b2c..5bb5cf8749dc4 100644 --- a/core/res/res/drawable/progress_small_white.xml +++ b/core/res/res/drawable/progress_small_white.xml @@ -21,5 +21,5 @@ android:drawable="@drawable/spinner_white_16" android:pivotX="50%" android:pivotY="50%" - android:framesCount="12" - android:frameDuration="100" /> + android:framesCount="48" + android:frameDuration="25" /> diff --git a/core/res/res/drawable/scrubber_progress_horizontal_holo_dark.xml b/core/res/res/drawable/scrubber_progress_horizontal_holo_dark.xml index b117bb8cbe1d6..97cd5135c5be3 100644 --- a/core/res/res/drawable/scrubber_progress_horizontal_holo_dark.xml +++ b/core/res/res/drawable/scrubber_progress_horizontal_holo_dark.xml @@ -19,10 +19,10 @@ android:drawable="@android:drawable/scrubber_track_holo_dark" /> + android:drawable="@android:drawable/scrubber_secondary_holo" /> + android:drawable="@android:drawable/scrubber_primary_holo" /> diff --git a/core/res/res/drawable/scrubber_progress_horizontal_holo_light.xml b/core/res/res/drawable/scrubber_progress_horizontal_holo_light.xml index 6cd08ea0c229c..14e19f432b7b4 100644 --- a/core/res/res/drawable/scrubber_progress_horizontal_holo_light.xml +++ b/core/res/res/drawable/scrubber_progress_horizontal_holo_light.xml @@ -19,10 +19,10 @@ android:drawable="@android:drawable/scrubber_track_holo_light" /> + android:drawable="@android:drawable/scrubber_secondary_holo" /> + android:drawable="@android:drawable/scrubber_primary_holo" /> diff --git a/core/res/res/drawable/search_spinner.xml b/core/res/res/drawable/search_spinner.xml index 31a77c30cf2a6..b8c8b09fa882e 100644 --- a/core/res/res/drawable/search_spinner.xml +++ b/core/res/res/drawable/search_spinner.xml @@ -21,5 +21,5 @@ android:drawable="@drawable/spinner_black_20" android:pivotX="50%" android:pivotY="50%" - android:framesCount="12" - android:frameDuration="100" /> + android:framesCount="48" + android:frameDuration="25" /> diff --git a/core/res/res/layout-land/keyguard_glow_pad_container.xml b/core/res/res/layout-land/keyguard_glow_pad_container.xml new file mode 100644 index 0000000000000..f8364f1ee411e --- /dev/null +++ b/core/res/res/layout-land/keyguard_glow_pad_container.xml @@ -0,0 +1,25 @@ + + + + + + \ No newline at end of file diff --git a/core/res/res/layout-land/keyguard_host_view.xml b/core/res/res/layout-land/keyguard_host_view.xml new file mode 100644 index 0000000000000..6b36235695262 --- /dev/null +++ b/core/res/res/layout-land/keyguard_host_view.xml @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/res/res/layout-land/keyguard_status_area.xml b/core/res/res/layout-land/keyguard_status_area.xml new file mode 100644 index 0000000000000..51ee740befa19 --- /dev/null +++ b/core/res/res/layout-land/keyguard_status_area.xml @@ -0,0 +1,56 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/core/res/res/layout-land/keyguard_widget_pager.xml b/core/res/res/layout-land/keyguard_widget_pager.xml new file mode 100644 index 0000000000000..02c6d0e8d2768 --- /dev/null +++ b/core/res/res/layout-land/keyguard_widget_pager.xml @@ -0,0 +1,30 @@ + + + + + + \ No newline at end of file diff --git a/core/res/res/layout-land/ssl_certificate.xml b/core/res/res/layout-land/ssl_certificate.xml index 4f8bd8e98f07d..c6c8dd4e16a8b 100644 --- a/core/res/res/layout-land/ssl_certificate.xml +++ b/core/res/res/layout-land/ssl_certificate.xml @@ -23,7 +23,7 @@ android:id="@+id/body" android:layout_width="match_parent" android:layout_height="wrap_content" - android:gravity="left" + android:gravity="start" android:orientation="vertical" > @@ -43,8 +43,8 @@ android:scaleType="fitXY" android:layout_weight="1" android:gravity="fill_horizontal" - android:layout_marginLeft="20dip" - android:layout_marginRight="20dip"/> + android:layout_marginStart="20dip" + android:layout_marginEnd="20dip"/> @@ -69,12 +69,12 @@ + android:layout_marginStart="20dip" /> @@ -83,12 +83,12 @@ + android:layout_marginStart="20dip" /> @@ -97,12 +97,12 @@ + android:layout_marginStart="20dip" /> @@ -111,12 +111,12 @@ + android:layout_marginStart="20dip" /> @@ -128,8 +128,8 @@ android:layout_height="wrap_content" android:layout_width="match_parent" android:layout_marginTop="12dip" - android:layout_marginLeft="20dip" - android:layout_marginRight="20dip" + android:layout_marginStart="20dip" + android:layout_marginEnd="20dip" android:layout_marginBottom="7dip" /> @@ -137,12 +137,12 @@ + android:layout_marginStart="20dip" /> @@ -151,12 +151,12 @@ + android:layout_marginStart="20dip" /> @@ -165,12 +165,12 @@ + android:layout_marginStart="20dip" /> @@ -182,8 +182,8 @@ android:text="@string/validity_period" android:textStyle="bold" android:layout_marginTop="12dip" - android:layout_marginLeft="20dip" - android:layout_marginRight="20dip" + android:layout_marginStart="20dip" + android:layout_marginEnd="20dip" android:layout_marginBottom="7dip" /> @@ -193,14 +193,14 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/issued_on" - android:layout_marginLeft="20dip" /> + android:layout_marginStart="20dip" /> @@ -212,14 +212,14 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/expires_on" - android:layout_marginLeft="20dip" /> + android:layout_marginStart="20dip" /> @@ -231,8 +231,8 @@ android:text="@string/fingerprints" android:textStyle="bold" android:layout_marginTop="12dip" - android:layout_marginLeft="20dip" - android:layout_marginRight="20dip" + android:layout_marginStart="20dip" + android:layout_marginEnd="20dip" android:layout_marginBottom="7dip" /> @@ -242,14 +242,14 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/sha256_fingerprint" - android:layout_marginLeft="20dip" /> + android:layout_marginStart="20dip" /> @@ -261,14 +261,14 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/sha1_fingerprint" - android:layout_marginLeft="20dip" /> + android:layout_marginStart="20dip" /> diff --git a/core/res/res/layout-land/usb_storage_activity.xml b/core/res/res/layout-land/usb_storage_activity.xml index 50ca569c69459..d52f0a5b2e196 100644 --- a/core/res/res/layout-land/usb_storage_activity.xml +++ b/core/res/res/layout-land/usb_storage_activity.xml @@ -52,16 +52,16 @@

          For more details, review the implementations of these methods in the {@code clock.ino} @@ -604,8 +607,8 @@ implementation details.

          One of the important new features introduced with the ADK 2012 is the ability to play audio over a USB connection. This innovation was introduced as an update to Android Open Accessory (AOA) -protocol 2.0 and is available on devices running Android 4.1 (API Level 16) -and higher.

          +protocol 2.0 and is +available on devices running Android 4.1 (API Level 16) and higher.

          The ADK 2012 provides a reference implementation of this functionality for accessory developers. No software application is required to be installed on the connected Android device, accessory diff --git a/docs/html/tools/adk/aoa.jd b/docs/html/tools/adk/aoa.jd deleted file mode 100644 index 7884d6ecef821..0000000000000 --- a/docs/html/tools/adk/aoa.jd +++ /dev/null @@ -1,186 +0,0 @@ -page.title=Android Open Accessory Protocol -@jd:body - -

          - -

          With Android 3.1, the platform introduces Android Open Accessory - support, which allows external USB hardware (an Android USB accessory) to interact with an - Android-powered device in a special accessory mode. When an Android-powered powered device is - in accessory mode, the connected accessory acts as the USB host (powers the bus and enumerates - devices) and the Android-powered device acts as the USB device. Android USB accessories are - specifically designed to attach to Android-powered devices and adhere to a simple protocol - (Android accessory protocol) that allows them to detect Android-powered devices that support - accessory mode. Accessories must also provide 500mA at 5V for charging power. Many previously - released Android-powered devices are only capable of acting as a USB device and cannot initiate - connections with external USB devices. Android Open Accessory support overcomes this limitation - and allows you to build accessories that can interact with an assortment of Android-powered - devices by allowing the accessory to initiate the connection.

          - -

          Note: Accessory mode is ultimately dependent on the device's - hardware and not all devices support accessory mode. Devices that support accessory mode can - be filtered using a <uses-feature> element in your corresponding application's - Android manifest. For more information, see the USB Accessory developer -guide.

          - -

          Implementing the Android Accessory Protocol

          - -

          An Android USB accessory must adhere to Android Accessory Protocol, which defines how - an accessory detects and sets up communication with an Android-powered device. In general, an - accessory should carry out the following steps:

          - -
            -
          1. Wait for and detect connected devices
          2. - -
          3. Determine the device's accessory mode support
          4. - -
          5. Attempt to start the device in accessory mode if needed
          6. - -
          7. Establish communication with the device if it supports the Android accessory protocol
          8. -
          - -

          The following sections go into depth about how to implement these steps.

          - -

          Wait for and detect connected devices

          - -

          Your accessory should have logic to continuously check - for connected Android-powered devices. When a device is connected, your accessory should - determine if the device supports accessory mode.

          - -

          Determine the device's accessory mode support

          - - -

          When an Android-powered device is connected, it can be in one of three states:

          - -
            -
          1. The attached device supports Android accessory mode and is already in accessory mode.
          2. - -
          3. The attached device supports Android accessory mode, but it is not in accessory mode.
          4. - -
          5. The attached device does not support Android accessory mode.
          6. -
          - -

          During the initial connection, the accessory should check the vendor and product IDs of the - connected device's USB device descriptor. The vendor ID should match Google's ID (0x18D1) and the - product ID should be 0x2D00 or 0x2D01 if the device is already in accessory mode (case A). If so, - the accessory can now establish communication with the device through - bulk transfer endpoints with its own communication protocol. There is no need to start the device - in accessory mode.

          - -

          Note: 0x2D00 is reserved for Android-powered devices that - support accessory mode. 0x2D01 is reserved for devices that support accessory mode as well as the - ADB (Android Debug Bridge) protocol, which exposes a second interface with two bulk endpoints for - ADB. You can use these endpoints for debugging the accessory application if you are simulating - the accessory on a computer. In general, do not use this interface unless your accessory is - implementing a passthrough to ADB on the device.

          - -

          If the vendor and product ID do not match, there is no way to distinguish between states b and - c, so the accessory attempts to start the device in accessory mode to figure - out if the device is supported.

          - -

          Attempt to start the device in accessory mode

          - -

          If the vendor and product IDs do not correspond to an Android-powered device in accessory - mode, the accessory cannot discern whether the device supports accessory mode and is not in that - state, or if the device does not support accessory mode at all. This is because devices that - support accessory mode but aren't in it initially report the device's manufacturer vendor ID and - product ID, and not the special Android Open Accessory ones. In either case, the accessory should -try to start - the device into accessory mode to figure out if the device supports it. The following steps - explain how to do this:

          - -
            -
          1. Send a 51 control request ("Get Protocol") to figure out if the device supports the Android - accessory protocol. A non-zero number is returned if the protocol is supported, which - represents the version of the protocol that the device supports (currently, only version 1 - exists). This request is a control request on endpoint 0 with the following characteristics: -
            -requestType:    USB_DIR_IN | USB_TYPE_VENDOR
            -request:        51
            -value:          0
            -index:          0
            -data:           protocol version number (16 bits little endian sent from the device to the
            -accessory)
            -
            -
          2. - -
          3. If the device returns a proper protocol version, send identifying string information to the - device. This information allows the device to figure out an appropriate application for this - accessory and also present the user with a URL if an appropriate application does not exist. - These requests are control requests on endpoint 0 (for each string ID) with the following - characteristics: -
            -requestType:    USB_DIR_OUT | USB_TYPE_VENDOR
            -request:        52
            -value:          0
            -index:          string ID
            -data            zero terminated UTF8 string sent from accessory to device
            -
            - -

            The following string IDs are supported, with a maximum size of 256 bytes for each string - (must be zero terminated with \0).

            -
            -manufacturer name:  0
            -model name:         1
            -description:        2
            -version:            3
            -URI:                4
            -serial number:      5
            -
            -
          4. - -
          5. When the identifying strings are sent, request the device start up in accessory mode. This - request is a control request on endpoint 0 with the following characteristics: -
            -requestType:    USB_DIR_OUT | USB_TYPE_VENDOR
            -request:        53
            -value:          0
            -index:          0
            -data:           none
            -
            -
          6. -
          - -

          After sending the final control request, the connected USB device should re-introduce itself - on the bus in accessory mode and the accessory can re-enumerate the connected devices. The - algorithm jumps back to determining the device's accessory mode support - to check for the vendor and product ID. The vendor ID and product ID of the device will be - different if the device successfully switched to accessory mode and will now correspond to - Google's vendor and product IDs instead of the device manufacturer's IDs. The accessory can now - establish communication with the device.

          - -

          If at any point these steps fail, the device does not support Android accessory mode and the - accessory should wait for the next device to be connected.

          - -

          Establish communication with the device

          - -

          If an Android-powered device in accessory mode is detected, the accessory can query the - device's interface and endpoint descriptors to obtain the bulk endpoints to communicate with the - device. An Android-powered device that has a product ID of 0x2D00 has one interface with two bulk - endpoints for input and output communication. A device with product ID of 0x2D01 has two - interfaces with two bulk endpoints each for input and output communication. The first interface - is for standard communication while the second interface is for ADB communication. To communicate - on an interface, all you need to do is find the first bulk input and output endpoints, set the - device's configuration to a value of 1 with a SET_CONFIGURATION (0x09) device request, then - communicate using the endpoints.

          - diff --git a/docs/html/tools/adk/aoa2.jd b/docs/html/tools/adk/aoa2.jd deleted file mode 100644 index bbccfc386790b..0000000000000 --- a/docs/html/tools/adk/aoa2.jd +++ /dev/null @@ -1,227 +0,0 @@ -page.title=Android Open Accessory Protocol 2.0 -@jd:body - - - -

          This document describes the changes to the Android Open Accessory (AOA) protocol since its -initial release, and is a supplement to the documentation of the first -release of AOA.

          - -

          The Android Open Accessory Protocol 2.0 adds two new features: audio output (from the Android -device to the accessory) and support for the accessory acting as one or more human interface devices -(HID) to the Android device. The Android SDK APIs available to Android application developers -remain unchanged.

          - -

          Detecting Android Open Accessory 2.0 Support

          - -

          In order for an accessory to determine if a connected Android device supports accessories and at -what protocol level, the accessory must send a {@code getProtocol()} command and check the result. -Android devices supporting the initial version of the Android Open Accessory protocol return a -{@code 1}, representing the protocol version number. Devices that support the new features described -in this document must return {@code 2} for the protocol version. Version 2.0 of the protocol is -upwardly compatible, so accessories designed for the original accessory protocol still work -with newer Android devices. The following code from the Android Development Kit -2011 {@code AndroidAccessory} library demonstrates this protocol check:

          - -
          -bool AndroidAccessory::switchDevice(byte addr)
          -{
          -    int protocol = getProtocol(addr);
          -    if (protocol >= 1) {
          -        Serial.print("device supports protocol 1 or higher\n");
          -    } else {
          -        Serial.print("could not read device protocol version\n");
          -        return false;
          -    }
          -
          -    sendString(addr, ACCESSORY_STRING_MANUFACTURER, manufacturer);
          -    sendString(addr, ACCESSORY_STRING_MODEL, model);
          -    sendString(addr, ACCESSORY_STRING_DESCRIPTION, description);
          -    sendString(addr, ACCESSORY_STRING_VERSION, version);
          -    sendString(addr, ACCESSORY_STRING_URI, uri);
          -    sendString(addr, ACCESSORY_STRING_SERIAL, serial);
          -
          -    usb.ctrlReq(addr, 0, USB_SETUP_HOST_TO_DEVICE | USB_SETUP_TYPE_VENDOR |
          -USB_SETUP_RECIPIENT_DEVICE,
          -                ACCESSORY_START, 0, 0, 0, 0, NULL);
          -    return true;
          -}
          -
          - -

          AOA 2.0 includes new USB product IDs, one for each combination of USB interfaces available when -in accessory mode. The possible USB interfaces are:

          - -
            -
          • accessory - An interface providing 2 bulk endpoints for communicating with an -Android application.
          • -
          • audio -A new standard USB audio class interface for streaming audio -from an Android device to an accessory.
          • -
          • adb - An interface intended only for debugging purposes while developing an -accessory. Only enabled if the user has USB Debugging enabled in Settings on the Android device. -
          • -
          - -

          In AOA 1.0, there are only two USB product IDs:

          - -
            -
          • {@code 0x2D00} - accessory
          • -
          • {@code 0x2D01} - accessory + adb
          • -
          - -

          AOA 2.0 adds an optional USB audio interface and, therefore, includes product IDs for the new -combinations of USB interfaces:

          - -
            -
          • {@code 0x2D02} - audio
          • -
          • {@code 0x2D03} - audio + adb
          • -
          • {@code 0x2D04} - accessory + audio
          • -
          • {@code 0x2D05} - accessory + audio + adb
          • -
          - -

          Audio Support

          - -

          AOA 2.0 includes optional support for audio output from an Android device to an accessory. This -version of the protocol supports a standard USB audio class interface that is capable of 2 channel -16-bit PCM audio with a bit rate of 44100 Khz. AOA 2.0 is currently limited to this output mode, but -additional audio modes may be added in the future.

          - -

          To enable the audio support, the accessory must send a new USB control request:

          - -
          -SET_AUDIO_MODE
          -requestType:    USB_DIR_OUT | USB_TYPE_VENDOR
          -request:        58
          -value:          0 for no audio (default),
          -                1 for 2 channel, 16-bit PCM at 44100 KHz
          -index:          0
          -data            none
          -
          - -

          This command must be sent before sending the {@code ACCESSORY_START} command for -entering accessory mode.

          - -

          HID Support

          - -

          AOA 2.0 allows the accessory to register one or more HID devices with -an Android device. This approach reverses the direction of communication for typical USB HID -devices like USB mice and keyboards. Normally, the HID device is a peripheral connected to a USB -host like a personal computer. But in the case of the AOA protocol, the USB host acts as one or more -input devices to a USB peripheral.

          - -

          HID support in AOA 2.0 is simply a proxy for standard HID events. The implementation makes no -assumptions about the content or type of events and merely passes it through to the input system, -so an AOA 2.0 accessory can act as any HID device (mouse, keyboard, game controller, etc.). It -can be used for something as simple as the play/pause button on a media dock, or something as -complicated as a docking station with a mouse and full QWERTY keyboard.

          - -

          The AOA 2.0 protocol adds four new USB control requests to allow the accessory to act as one or -more HID input devices to the Android device. Since HID support is done entirely through -control requests on endpoint zero, no new USB interface is needed to provide this support. The -control requests are as follows:

          - -
            -
          • ACCESSORY_REGISTER_HID registers a new HID device with the Android device. -The accessory provides an ID number that is used to identify the HID device for the other three -calls. This ID is valid until USB is disconnected or until the accessory sends -ACCESSORY_UNREGISTER_HID to unregister the HID device.
          • -
          • ACCESSORY_UNREGISTER_HID unregisters a HID device that was previously -registered with ACCESSORY_REGISTER_HID.
          • -
          • ACCESSORY_SET_HID_REPORT_DESC sends a report descriptor for a HID device to -the Android device. This request is used to describe the capabilities of the HID device, and must -be sent before reporting any HID events to the Android device. If the report descriptor is larger -than the maximum packet size for endpoint zero, multiple ACCESSORY_SET_HID_REPORT_DESC commands are -sent in order to transfer the entire descriptor.
          • -
          • ACCESSORY_SEND_HID_EVENT sends input events from the accessory to the Android -device.
          • -
          - -

          The code definitions for these new control requests are as follows:

          - -
          -/* Control request for registering a HID device.
          - * Upon registering, a unique ID is sent by the accessory in the
          - * value parameter. This ID will be used for future commands for
          - * the device
          - *
          - *  requestType:    USB_DIR_OUT | USB_TYPE_VENDOR
          - *  request:        ACCESSORY_REGISTER_HID_DEVICE
          - *  value:          Accessory assigned ID for the HID device
          - *  index:          total length of the HID report descriptor
          - *  data            none
          - */
          -#define ACCESSORY_REGISTER_HID         54
          -
          -/* Control request for unregistering a HID device.
          - *
          - *  requestType:    USB_DIR_OUT | USB_TYPE_VENDOR
          - *  request:        ACCESSORY_REGISTER_HID
          - *  value:          Accessory assigned ID for the HID device
          - *  index:          0
          - *  data            none
          - */
          -#define ACCESSORY_UNREGISTER_HID         55
          -
          -/* Control request for sending the HID report descriptor.
          - * If the HID descriptor is longer than the endpoint zero max packet size,
          - * the descriptor will be sent in multiple ACCESSORY_SET_HID_REPORT_DESC
          - * commands. The data for the descriptor must be sent sequentially
          - * if multiple packets are needed.
          - *
          - *  requestType:    USB_DIR_OUT | USB_TYPE_VENDOR
          - *  request:        ACCESSORY_SET_HID_REPORT_DESC
          - *  value:          Accessory assigned ID for the HID device
          - *  index:          offset of data in descriptor
          - *                      (needed when HID descriptor is too big for one packet)
          - *  data            the HID report descriptor
          - */
          -#define ACCESSORY_SET_HID_REPORT_DESC         56
          -
          -/* Control request for sending HID events.
          - *
          - *  requestType:    USB_DIR_OUT | USB_TYPE_VENDOR
          - *  request:        ACCESSORY_SEND_HID_EVENT
          - *  value:          Accessory assigned ID for the HID device
          - *  index:          0
          - *  data            the HID report for the event
          - */
          -#define ACCESSORY_SEND_HID_EVENT         57
          -
          - -

          Interoperability with AOA 1.0 Features

          - -

          The original AOA protocol provided support for an Android application to -communicate directly with a USB host (accessory) over USB. AOA 2.0 keeps that support, but adds new -features to allow the accessory to communicate with the Android operating system itself -(specifically the audio and input systems). The design of the AOA 2.0 makes it is possible to build -an accessory that also makes use of the new audio and/or HID support in addition to the original -feature set. Simply use the new features described in this document in addition to the original AOA -protocol features.

          - -

          Connecting AOA 2.0 without an Android App

          - -

          It is possible to design an accessory (for example, an audio dock) that uses the new audio and -HID support, but does not need to communicate with an application on the Android device. In that -case, the user would not want to see the dialog prompts related to finding and associating the newly -attached accessory with an Android application that can communicate with it. To prevent these -dialogs from appearing after the device and accessory are connected, the accessory can simply not -send the manufacturer and model names to the Android device. If these strings are not provided to -the Android device, then the accessory is able to make use of the new audio and HID support in AOA -2.0 without the system attempting to find an application to communicate with the accessory. Also, -if these strings are not provided, the accessory USB interface is not present in the Android -device USB configuration after the device enters accessory mode.

          \ No newline at end of file diff --git a/docs/html/tools/adk/index.jd b/docs/html/tools/adk/index.jd index 4b9b042c91bc8..d492e96692522 100644 --- a/docs/html/tools/adk/index.jd +++ b/docs/html/tools/adk/index.jd @@ -11,9 +11,11 @@ devices, weather stations, or any other external hardware device that adds to th Android.

          Accessories use the Android Open Accessory (AOA) protocol to communicate with Android -devices, over USB cable or through a Bluetooth connection. If you are building an accessory for -Android devices, make sure you review the information below to understand about how to implement the -AOA protocol.

          +devices, over a USB cable or through a Bluetooth connection. If you are building an accessory that +uses USB, make sure you understand how to implement the AOA protocol to establish communication +between your accessory hardware and Android. For more information, see the +Android Open Acessory protocol. +

          The following sections provide more information about the Android Accessory Development Kits, how to use them, and how to get started building your own accessories for Android.

          @@ -24,11 +26,4 @@ to use them, and how to get started building your own accessories for Android.ADK 2011 Guide
          Guide to getting started with the original ADK, released at Google I/O 2011.
          - -
          Android Open Accessory Protocol
          -
          Guide to implementing the Android Open Accessory Protocol.
          - -
          Android Open Accessory Protocol 2.0
          -
          A description and guide to implementing the extended Android Open Accessory Protocol which - supports audio dock accessories.
          diff --git a/docs/html/tools/building/building-cmdline.jd b/docs/html/tools/building/building-cmdline.jd index 6154d96e63536..e0d0d3fbcd657 100644 --- a/docs/html/tools/building/building-cmdline.jd +++ b/docs/html/tools/building/building-cmdline.jd @@ -261,8 +261,18 @@ adb -s emulator-5554 install path/to/your/app.apk device:

            -
          • Enable USB Debugging on your device. You can find the setting on most Android devices by - going to Settings > Applications > Development > USB debugging.
          • +
          • Enable USB debugging on your device. +
              +
            • On most devices running Android 3.2 or older, you can find the option under + Settings > Applications > Development.
            • +
            • On Android 4.0 and newer, it's in Settings > Developer options. +

              Note: On Android 4.2 and newer, Developer + options is hidden by default. To make it available, go + to Settings > About phone and tap Build number + seven times. Return to the previous screen to find Developer options.

              +
            • +
            +
          • Ensure that your development computer can detect your device when connected via USB
          diff --git a/docs/html/tools/building/building-eclipse.jd b/docs/html/tools/building/building-eclipse.jd index c73fe974410d8..304aa7e903a15 100644 --- a/docs/html/tools/building/building-eclipse.jd +++ b/docs/html/tools/building/building-eclipse.jd @@ -84,8 +84,18 @@ parent.link=index.html android:debuggable attribute of the <application> element to true. As of ADT 8.0, this is done by default when you build in debug mode. -
        • Enable USB Debugging on your device. You can find the setting on most Android devices by - going to Settings > Applications > Development > USB debugging.
        • +
        • Enable USB debugging on your device. +
            +
          • On most devices running Android 3.2 or older, you can find the option under + Settings > Applications > Development.
          • +
          • On Android 4.0 and newer, it's in Settings > Developer options. +

            Note: On Android 4.2 and newer, Developer + options is hidden by default. To make it available, go + to Settings > About phone and tap Build number + seven times. Return to the previous screen to find Developer options.

            +
          • +
          +
        • Ensure that your development computer can detect your device when connected via USB
        • diff --git a/docs/html/tools/debugging/systrace.jd b/docs/html/tools/debugging/systrace.jd new file mode 100644 index 0000000000000..287abe630b058 --- /dev/null +++ b/docs/html/tools/debugging/systrace.jd @@ -0,0 +1,239 @@ +page.title=Analyzing Display and Performance with Systrace +parent.title=Debugging +parent.link=index.html +@jd:body + + + +

          After building features, eliminating bugs and cleaning up your code, you should spend some + time looking at the performance of your application. The speed and smoothness with which your + application draws pixels and performs operations has an significant impact on your users' + experience.

          + +

          Android applications operate within a shared resource environment, and the performance of + your application can be impacted by how efficiently it interacts with those resources in + the larger system. Applications also operate in a multithreaded environment, competing with other + threaded processes for resources, which can cause performance problems that are hard to diagnose. +

          + +

          The {@code systrace} tool allows you to collect and review code execution data for your + application and the Android system. You can use this data to diagnose execution problems and + improve the performance of your application.

          + + +

          Overview

          + +

          {@code systrace} helps you analyze how the execution of your application fits into the larger + Android environment, letting you see system and applications process execution on a common + timeline. The tool allows you to generate highly detailed, interactive reports from devices + running Android 4.1 and higher, such as the report in figure 1.

          + +Systrace example report +

          + Figure 1. An example {@code systrace} report on 5 seconds of process execution + for a running application and related Android system processes. +

          + + +

          Generating Traces

          + +

          In order to create a trace of your application, you must perform a few setup steps. First, you + must have a device running Android 4.1 or higher. Setup the device for + debugging, connect it to your development + system and install your application. Some types of trace information, specifically disk activity + and kernel work queues, require root access to the device, but most {@code systrace} log data + only requires that the device be enabled for developer debugging.

          + + +

          Limiting trace data

          + +

          The {@code systrace} tool can generate a potentially huge amount of data from applications + and system sources. To limit the amount of data the tool collects and make the data more relevant + to your analysis, use the following options:

          + +
            +
          • Limit the amount of time covered by the trace with the {@code -t, --time} option. The default + length of a trace is 5 seconds.
          • +
          • Limit the size of the data collected by the trace with the {@code -b, --buf-size} option.
          • +
          • Specify what types of processes are traced using the {@code --set-tags} option and the + {@code --disk}, {@code --cpu-freq}, {@code --cpu-idle}, {@code --cpu-load} options.
          • +
          + + +

          Configuring trace data categories

          + +

          To use {@code systrace} effectively, you must specify the types of processes you want to trace. + The tool can gather the following types of process information:

          + +
            +
          • General system processes such as graphics, audio and input processes (selected using trace + Tags).
          • +
          • Low level system information such as CPU, kernel and disk activity (selected using + Options).
          • +
          + +

          To set trace tags for {@code systrace} using the command-line:

          + +
            +
          1. Use the {@code --set-tags} option: +
            +$> python systrace.py --set-tags=gfx,view,wm
            +
            +
          2. +
          3. Stop and restart the {@code adb} shell to enable tracing of these processes. +
            +$> adb shell stop
            +$> adb shell start
            +
          4. +
          + +

          To set trace tags for {@code systrace} using the device user interface:

          + +
            +
          1. On the device connected for tracing, navigate to: Settings > + Developer options > Monitoring > Enable traces.
          2. +
          3. Select the categories of processes to be traced and click OK.
          4. +
          + +

          + Note: The {@code adb} shell does not have to be stopped and restarted when + selecting trace tags using this method. +

          + + +

          Running a trace

          + +

          After you have configured the category tags for your trace, you can start collecting + information for analysis.

          + +

          To run a trace using the current trace tag settings:

          + +
            +
          1. Make sure the device is connected through a USB cable and is + enabled for debugging.
          2. +
          3. Run the trace with the low-level system trace options and limits you want, for example: +
            +$> python systrace.py --cpu-freq --cpu-load --time=10 -o mytracefile.html
            +
            +
          4. +
          5. On the device, execute any user actions you want be included in the trace.
          6. +
          + + +

          Analyzing Traces

          + +

          After you have generated a trace using {@code systrace}, it lists the location of the output + file and you can open the report using a web browser. + How you use the trace data depends on the performance issues you are investigating. However, + this section provides some general instructions on how to analyze a trace.

          + +

          The reports generated by {@code systrace} are interactive, allowing you to zoom into and out of + the process execution details. Use the W key to zoom in, the S + key to zoom out, the A key to pan left and the D key to pan + right. Select a task in timeline using your mouse to get more information about the task. + For more information about the using the keyboard navigation shortcuts and navigation, see the + Systrace reference + documentation.

          + +

          Long running processes

          + +

          A well-behaved application executes many small operations quickly and with a regular rhythm, + with individual operations completing within few milliseconds, depending on the device + and the processes being performed, as shown in figure 2:

          + +Systrace exerpt of app processing +

          + Figure 2. Excerpt from a trace of a smoothly running application with a regular + execution rhythm. +

          + +

          The trace excerpt in figure 2 shows a well-behaved application with + a regular process rhythm (1). The lower section of figure 2 shows a magnified section of + the trace indicated by the dotted outline, which reveals some irregularity in the process + execution. In particular, one of the wider task bars, indicated by (2), is taking slightly + longer (14 milliseconds) than other, similar tasks on this thread, which are averaging between + 9 and 12 milliseconds to complete. This particular task execution length is likely not noticeable + to a user, unless it impacts another process with specific timing, such as a screen update.

          + +

          Long running processes show up as thicker than usual execution bars in a trace. These thicker + bars can indicate a problem in your application performance. When they show up in your + trace, zoom in on the process using the + keyboard navigation shortcuts to + identify the task causing the problem, and click on the task to get more information. You should + also look at other processes running at the same time, looking for a thread in one process that is + being blocked by another process.

          + + +

          Interruptions in display execution

          + +

          The {@code systrace} tool is particularly useful in analyzing application display slowness, + or pauses in animations, because it shows you the execution of your application across multiple + system processes. With display execution, drawing screen frames with a regular rhythm is essential + for good performance. Having a regular rhythm for display ensures that animations and motion are + smooth on screen. If an application drops out of this rhythm, the display can become jerky or slow + from the users perspective.

          + +

          If you are analyzing an application for this type of problem, examine the + SurfaceFlinger process in the {@code systrace} report where your application is + also executing to look for places where it drops out of its regular rhythm.

          + +Systrace exerpt of display processing +

          + Figure 3. Excerpt from a trace of an application showing interruptions in + display processing. +

          + +

          The trace excerpt in figure 3 shows an section of a trace that indicates an interruption in the + device display. The section of the SurfaceFlinger process in top excerpt, + indicated by (1), shows that display frames are being missed. These + dropped frames are potentially causing the display to stutter or halt. Zooming into this problem + area in the lower trace, shows that a memory operation (image buffer dequeuing and allocation) in + the surfaceflinger secondary thread is taking a long time (2). This delay + causes the application to miss the display update window, indicated by the dotted + line. As the developer of this application, you should investigate other threads in your + application that may also be trying to allocate memory at the same time or otherwise blocking + memory allocation with another request or task.

          + +

          Regular, rhythmic execution of the SurfaceFlinger process is essential to smooth + display of screen content, particularly for animations and motion. Interruptions in the regular + execution pattern of this thread is not always an indication of a display problem with your + application. Further testing is required to determine if this is actually a performance problem + from a user perspective. Being able to identify display execution patterns like the example above + can help you detect display problems and build a smooth-running, high-performance application. +

          + +

          + Note: When using {@code systrace} to analyze display problems, make sure + you activate the tracing tags for Graphics and Views. +

          + +

          For more information on the command line options and keyboard controls for {@code systrace}, +see the Systrace reference page.

          \ No newline at end of file diff --git a/docs/html/tools/device.jd b/docs/html/tools/device.jd index d5fd58122e4d2..61cd08a8b0f73 100644 --- a/docs/html/tools/device.jd +++ b/docs/html/tools/device.jd @@ -58,11 +58,17 @@ the <application> element.

          Note: If you manually enable debugging in the manifest file, be sure to disable it before you build for release (your published application should usually not be debuggable).

          -
        • Turn on "USB Debugging" on your device. -

          On the device, go to Settings > Applications > Development - and enable USB debugging - (on an Android 4.0 device, the setting is -located in Settings > Developer options).

          +
        • Enable USB debugging on your device. +
            +
          • On most devices running Android 3.2 or older, you can find the option under + Settings > Applications > Development.
          • +
          • On Android 4.0 and newer, it's in Settings > Developer options. +

            Note: On Android 4.2 and newer, Developer + options is hidden by default. To make it available, go + to Settings > About phone and tap Build number + seven times. Return to the previous screen to find Developer options.

            +
          • +
        • Set up your system to detect your device.
            diff --git a/docs/html/tools/help/index.jd b/docs/html/tools/help/index.jd index 447d39cf50739..0f943956a53db 100644 --- a/docs/html/tools/help/index.jd +++ b/docs/html/tools/help/index.jd @@ -55,6 +55,9 @@ outside of Android code.
            ProGuard
            Shrinks, optimizes, and obfuscates your code by removing unused code and renaming classes, fields, and methods with semantically obscure names.
            +
            Systrace
            +
            Lets you analyze the execution of your application in the context of system processes, + to help diagnose display and performance issues.
            sqlite3
            Lets you access the SQLite data files created and used by Android applications.
            traceview
            diff --git a/docs/html/tools/help/systrace.jd b/docs/html/tools/help/systrace.jd new file mode 100644 index 0000000000000..010cc78d5e9c2 --- /dev/null +++ b/docs/html/tools/help/systrace.jd @@ -0,0 +1,234 @@ +page.title=Systrace +parent.title=Tools +parent.link=index.html +@jd:body + + +

            The {@code systrace} tool helps analyze the performance of your application by capturing and + displaying execution times of your applications processes and other Android system processes. The + tool combines data from the Android kernel such as the CPU scheduler, disk activity and + application threads to generate an HTML report that shows an overall picture of an Android + device’s system processes for a given period of time.

            + +

            The {@code systrace} tool is particularly useful in diagnosing display problems where an + application is slow to draw or stutters while displaying motion or animation. For more information + on how to use {@code systrace}, see Analyzing + Display and Performance with Systrace.

            + + +

            Usage

            + +

            In order to run {@code systrace}, the {@code adb} tool and +Python must be installed and included in your development +computer's execution path. In order to generate a trace, you must connect a device running Android +4.1 (API Level 16) or higher to your development system using a USB debugging connection.

            + +

            The syntax for running {@code systrace} is as follows.

            + +
            +$> python systrace.py [options]
            +
            + +

            Here is an example execution run that sets trace tags and generates a trace from a connected +Android device.

            + +
            +$> cd android-sdk/tools/systrace
            +$> python systrace.py --set-tags gfx,view,wm
            +$> adb shell stop
            +$> adb shell start
            +$> python systrace.py --disk --time=10 -o mynewtrace.html
            +
            + + + +

            Options

            + +

            The table below lists the command line options for {@code systrace}.

            + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
            OptionDescription
            -o <FILE>Write the HTML trace report to the specified file.
            -t N, --time=NTrace activity for N seconds. Default value is 5 seconds.
            -b N, --buf-size=NUse a trace buffer size of N kilobytes. This option lets you limit the total size of the + data collected during a trace.
            -d, --diskTrace disk input and output activity. This option requires root access on the device.
            -f, --cpu-freqTrace CPU frequency changes. Only changes to the CPU frequency are logged, so the initial + frequency of the CPU when tracing starts is not shown.
            -i, --cpu-idleTrace CPU idle events.
            -l, --cpu-loadTrace CPU load. This value is a percentage determined by the interactive CPU frequency + governor.
            -s, --no-cpu-schedPrevent tracing of the CPU scheduler. This option allows for longer trace times by reducing + the rate of data flowing into the trace buffer.
            -w, --workqueueTrace kernel work queues. This option requires root access on the device.
            --set-tags=<TAGS>Set the enabled trace tags in a comma separated list. The available tags are: +
              +
            • gfx - Graphics
            • +
            • input - Input
            • +
            • view - View
            • +
            • webview - WebView
            • +
            • wm - Window Manager
            • +
            • am - Activity Manager
            • +
            • sync - Sync Manager
            • +
            • audio - Audio
            • +
            • video - Video
            • +
            • camera - Camera
            • +
            +

            Note: When setting trace tags from the command line, you + must stop and restart the framework ({@code $> adb shell stop; adb shell start}) for the + tag tracing changes to take effect.

            +
            --link-assetsLink to the original CSS or JS resources instead of embedding them in the HTML trace + report.
            -h, --helpShow the help message.
            + +

            You can set the trace tags for {@code systrace} with your device's user +interface, by navigating to Settings > Developer options > Monitoring > Enable +traces.

            + + +

            Trace Viewing Shortcuts

            + +

            The table below lists the keyboard shortcuts that are available while viewing a {@code systrace} +trace HTML report.

            + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
            KeyDescription
            wZoom into the trace timeline.
            sZoom out of the trace timeline.
            aPan left on the trace timeline.
            dPan right on the trace timeline.
            eCenter the trace timeline on the current mouse location.
            gShow grid at the start of the currently selected task.
            Shift+gShow grid at the end of the currently selected task.
            Right ArrowSelect the next event on the currently selected timeline.
            Left ArrowSelect the previous event on the currently selected timeline.
            Double ClickZoom into the trace timeline.
            Shift+Double ClickZoom out of the trace timeline.
            diff --git a/docs/html/tools/revisions/platforms.jd b/docs/html/tools/revisions/platforms.jd index 62ec422abc546..178ab90a9c699 100644 --- a/docs/html/tools/revisions/platforms.jd +++ b/docs/html/tools/revisions/platforms.jd @@ -22,12 +22,12 @@ Highlights and APIs

            To develop an Android app, you must install at least one Android platform from the SDK Manager against which you can compile your app. Often, any given version of the Android will be revised -with bug fixes or other changes, as denoted by the "revision" number. Below, you'll find the +with bug fixes or other changes, as denoted by the revision number. Below, you'll find the release notes for each version of the platform and the subsequent revisions to the platform version.

            -

            To determine what revision of an Android platform you -have installed, refer to the "Installed Packages" listing in the Android SDK Manager.

            +

            To determine what revision of an Android platform you have installed, refer to the +Installed Packages listing in the Android SDK Manager.

            @@ -45,10 +45,29 @@ have installed, refer to the "Installed Packages" listing in the Android SDK Man SDK tools to revision 20 or later and restart the Android SDK Manager. If you do not, the Android 4.1 system components will not be available for download.

            +

            Revision 3 (October 2012) +

            + +
            + +

            Maintenance update. The system version is 4.1.2.

            +
            +
            Dependencies:
            +
            SDK Tools r20 or higher is required.
            +
            + +
            +
            + +
            + +

            + Revision 2 (July 2012)

            @@ -226,10 +245,10 @@ class="toggle-content-img" alt="" />Revision 1 (December 2011) WVGA854 (480x854 high density, normal screen)
          • - WXGA720 (1280x720, extra-high density, normal screen) + WXGA720 (1280x720, extra-high density, normal screen)
          • - WSVGA (1024x600, medium density, large screen) + WSVGA (1024x600, medium density, large screen)
          • WXGA (1280x800, medium density, xlarge screen) @@ -534,12 +553,12 @@ ADT 12.

            - Android 3.0, Revision 1 (February 2011)

            - +
            Dependencies:
            @@ -592,7 +611,7 @@ the "Installed Packages" listing in the Android SDK and AVD Manager.

            - Android 2.3.4, Revision 1 (May 2011)

            @@ -721,7 +740,7 @@ emulator skins are:

            WVGA854 (480x854 high density, normal screen)
          - + @@ -747,7 +766,7 @@ the "Installed Packages" listing in the Android SDK and AVD Manager.

          - Android 2.3, Revision 1 (December 2010)

          @@ -790,7 +809,7 @@ emulator skins are:

          - + diff --git a/docs/html/tools/testing/testing_accessibility.jd b/docs/html/tools/testing/testing_accessibility.jd new file mode 100644 index 0000000000000..daf9b36363733 --- /dev/null +++ b/docs/html/tools/testing/testing_accessibility.jd @@ -0,0 +1,257 @@ +page.title=Accessibility Testing Checklist +parent.title=Testing +parent.link=index.html +@jd:body + + +

          + Testing is an important part of making your application accessible to users with varying + abilities. Following design and + development guidelines for + accessibility are important steps toward that goal, but testing for accessibility can uncover + problems with user interaction that are not obvious during design and development.

          + +

          This accessibility testing checklist guides you through the important aspects of + accessibility testing, including overall goals, required testing steps, recommended testing and + special considerations. This document also discusses how to enable accessibility features on + Android devices for testing purposes.

          + + +

          Testing Goals

          + +

          Your accessibility testing should have the following, high level goals:

          + +
            +
          • Set up and use the application without sighted assistance
          • +
          • All task workflows in the application can be easily navigated using directional controls and + provide clear and appropriate feedback
          • +
          + + +

          Testing Requirements

          + +

          The following tests must be completed in order to ensure a minimum level of application + accessibility.

          + +
            +
          1. Directional controls: Verify that the application can be operated + without the use of a touch screen. Attempt to use only directional controls to accomplish the + primary tasks in the application. Use the keyboard and directional-pad (D-Pad) controls in the + Android Emulator or use + gesture + navigation on devices with Android 4.1 (API Level 16) or higher. +

            Note: Keyboards and D-pads provide different navigation paths + than accessibility gestures. While gestures allow users to focus on nearly any on-screen + content, keyboard and D-pad navigation only allow focus on input fields and buttons.

            +
          2. +
          3. TalkBack audio prompts: Verify that user interface controls that provide + information (graphics or text) or allow user action have clear and accurate audio descriptions + when TalkBack is enabled and controls are focused. Use + directional controls to move focus between application layout elements.
          4. +
          5. Explore by Touch prompts: Verify that user interface controls that + provide information (graphics or text) or allow user action have appropriate audio descriptions + when Explore by Touch is enabled. There should be no + regions where contents or controls do not provide an audio description.
          6. +
          7. Touchable control sizes: All controls where a user can select or take an + action must be a minimum of 48 dp (approximately 9mm) in length and width, as recommended by + Android Design.
          8. +
          9. Gestures work with TalkBack enabled: Verify that app-specific gestures, + such as zooming images, scrolling lists, swiping between pages or navigating carousel controls + continue to work when TalkBack is enabled. If these gestures do + not function, then an alternative interface for these actions must be provided.
          10. +
          11. No audio-only feedback: Audio feedback must always have a secondary + feedback mechanism to support users who are deaf or hard of hearing, for example: A sound alert + for the arrival of a message should also be accompanied by a system + {@link android.app.Notification}, haptic feedback (if available) or another visual alert.
          12. +
          + + +

          Testing Recommendations

          + +

          The following tests are recommended for ensuring the accessibility of your application. If you + do not test these items, it may impact the overall accessibility and quality of your + application.

          + +
            +
          1. Repetitive audio prompting: Check that closely related controls (such as + items with multiple components in a list) do not simply repeat the same audio prompt. For + example, in a contacts list that contains a contact picture, written name and title, the prompts + should not simply repeat “Bob Smith†for each item.
          2. +
          3. Audio prompt overloading or underloading: Check that closely related + controls provide an appropriate level of audio information that enables users to understand and + act on a screen element. Too little or too much prompting can make it difficult to understand + and use a control.
          4. +
          + + +

          Special Cases and Considerations

          + +

          The following list describes specific situations that should be tested to ensure an + accessible app. Some, none or all of the cases described here may apply to your application. Be + sure to review this list to find out if these special cases apply and take appropriate action.

          + +
            +
          1. Review developer special cases and considerations: Review the list of + special cases + for accessibility development and test your application for the cases that apply.
          2. +
          3. Prompts for controls that change function: Buttons or other controls + that change function due to application context or workflow must provide audio prompts + appropriate to their current function. For example, a button that changes function from play + video to pause video should provide an audio prompt which is appropriate to its current state.
          4. +
          5. Video playback and captioning: If the application provides video + playback, verify that it supports captioning and subtitles to assist users who are deaf or hard + of hearing. The video playback controls must clearly indicate if captioning is available for a + video and provide a clear way of enabling captions.
          6. +
          + + +

          Testing Accessibility Features

          + +

          Testing of accessibility features such as TalkBack, Explore by Touch and accessibility Gestures +requires setup of your testing device. This section describes how to enable these features for +accessibility testing.

          + + +

          Testing audible feedback

          + +

          Audible accessibility feedback features on Android devices provide audio prompts that speaks + the screen content as you move around an application. By enabling these features on an Android + device, you can test the experience of users with blindness or low-vision using your application. +

          + +

          Audible feedback for users on Android is typically provided by TalkBack accessibility service and +the Explore by Touch system feature. The TalkBack accessibility service comes preinstalled on most +Android devices and can also be downloaded for free from +Google +Play. The Explore by Touch system feature is available on devices running Android 4.0 and later. +

          + +

          Testing with TalkBack

          + +

          The TalkBack accessibility service works by speaking the contents of user interface +controls as the user moves focus onto controls. This service should be enabled as part of testing +focus navigation and audible prompts.

          + +

          To enable the TalkBack accessibility service:

          +
            +
          1. Launch the Settings application.
          2. +
          3. Navigate to the Accessibility category and select it.
          4. +
          5. Select Accessibility to enable it.
          6. +
          7. Select TalkBack to enable it.
          8. +
          + +

          + Note: While TalkBack is the most available Android accessibility service for + users with disabilities, other accessibility services are available and may be installed by users. +

          + +

          For more information about using TalkBack, see +Use TalkBack.

          + +

          Testing with Explore by Touch

          + +

          The Explore by Touch system feature is available on devices running Android 4.0 and + later, and works by enabling a special accessibility mode that allows users to drag a finger + around the interface of an application and hear the contents of the screen spoken. This feature + does not require screen elements to be focused using an directional controller, but listens for + hover events over user interface controls. +

          + +

          To enable Explore by Touch on Android 4.0 and later:

          +
            +
          1. Launch the Settings application.
          2. +
          3. Navigate to the Accessibility category and select it.
          4. +
          5. Select the TalkBack to enable it. +

            Note: On Android 4.1 (API Level 16) and higher, the system + provides a popup message to enable Explore by Touch. On older versions, you must follow the + step below.

            +
          6. +
          7. Return to the Accessibility category and select Explore by +Touch to enable it. +

            Note: You must turn on TalkBack first, otherwise this +option is not available.

            +
          8. +
          + +

          For more information about using the Explore by Touch features, see +Use Explore by +Touch.

          + +

          Testing focus navigation

          + +

          Focus navigation is the use of directional controls to navigate between the individual user + interface elements of an application in order to operate it. Users with limited vision or limited + manual dexterity often use this mode of navigation instead of touch navigation. As part of + accessibility testing, you should verify that your application can be operated using only + directional controls.

          + +

          You can test navigation of your application using only focus controls, even if your test devices + does not have a directional controller. The Android + Emulator provides a simulated directional controller that you can use to test navigation. You + can also use a software-based directional controller, such as the one provided by the + Eyes-Free Keyboard to simulate use of a D-pad on a test device that does not have a physical + D-pad.

          + + +

          Testing gesture navigation

          + +

          Gesture navigation is an accessibility navigation mode that allows users to navigate Android + devices and applications using specific + gestures. This + navigation mode is available on Android 4.1 (API Level 16) and higher.

          + +

          Note: Accessibility gestures provide a different navigation path +than keyboards and D-pads. While gestures allow users to focus on nearly any on-screen +content, keyboard and D-pad navigation only allow focus on input fields and buttons.

          + +

          To enable gesture navigation on Android 4.1 and later:

          +
            +
          • Enable both TalkBack and the Explore by Touch feature as described in the + Testing with Explore by Touch. When both of these + features are enabled, accessibility gestures are automatically enabled.
          • +
          • You can change gesture settings using Settings > Accessibility > TalkBack > + Settings > Manage shortcut gestures. +
          + +

          For more information about using Explore by Touch accessibility gestures, see +Accessibility +gestures.

          + +

          + Note: Accessibility services other than TalkBack may map accessibility gestures + to different user actions. If gestures are not producing the expected actions during testing, try + disabling other accessibility services before proceeding.

          \ No newline at end of file diff --git a/docs/html/tools/tools_toc.cs b/docs/html/tools/tools_toc.cs index 850e0ecb55fb4..cca9433bd1925 100644 --- a/docs/html/tools/tools_toc.cs +++ b/docs/html/tools/tools_toc.cs @@ -5,7 +5,7 @@ Developer Tools
        • - + - +
        • Using Hardware Devices
        • @@ -48,16 +48,16 @@ the SDK - + @@ -76,7 +76,7 @@ the SDK
        • From Other IDEs -
        • +
        • Activity Testing @@ -89,6 +89,10 @@ the SDK Content Provider Testing
        • +
        • + + Accessibility Testing +
        • What To Test @@ -110,6 +114,7 @@ the SDK
        • Improving Your Code with lint
        • Optimizing your UI
        • Profiling with Traceview and dmtracedump
        • +
        • Analysing Display and Performance with Systrace
        • Using the Dev Tools App
        • @@ -155,12 +160,13 @@ the SDK
        • ProGuard
        • +
        • Systrace
        • Tracer for OpenGL ES
        • Traceview
        • zipalign
        • - + - - + + - + - + - +