summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--api/current.txt22
-rw-r--r--api/system-current.txt22
-rw-r--r--cmds/hid/Android.mk18
-rw-r--r--cmds/hid/MODULE_LICENSE_APACHE20
-rw-r--r--cmds/hid/NOTICE190
-rwxr-xr-xcmds/hid/hid8
-rw-r--r--cmds/hid/jni/Android.mk23
-rw-r--r--cmds/hid/jni/com_android_commands_hid_Device.cpp253
-rw-r--r--cmds/hid/jni/com_android_commands_hid_Device.h61
-rw-r--r--cmds/hid/src/com/android/commands/hid/Device.java163
-rw-r--r--cmds/hid/src/com/android/commands/hid/Event.java255
-rw-r--r--cmds/hid/src/com/android/commands/hid/Hid.java133
-rw-r--r--cmds/wm/src/com/android/commands/wm/Wm.java31
-rw-r--r--core/java/android/app/Activity.java3
-rw-r--r--core/java/android/app/admin/DevicePolicyManager.java1
-rw-r--r--core/java/android/content/AbstractThreadedSyncAdapter.java45
-rw-r--r--core/java/android/content/pm/IPackageManager.aidl4
-rw-r--r--core/java/android/hardware/camera2/CameraCharacteristics.java19
-rw-r--r--core/java/android/hardware/camera2/CameraMetadata.java56
-rw-r--r--core/java/android/hardware/camera2/CaptureRequest.java15
-rw-r--r--core/java/android/hardware/camera2/CaptureResult.java13
-rw-r--r--core/java/android/hardware/camera2/impl/CameraMetadataNative.java12
-rw-r--r--core/java/android/hardware/camera2/legacy/LegacyCameraDevice.java10
-rw-r--r--core/java/android/hardware/camera2/params/StreamConfigurationMap.java280
-rw-r--r--core/java/android/hardware/camera2/params/TonemapCurve.java2
-rw-r--r--core/java/android/hardware/camera2/utils/HashCodeHelpers.java58
-rw-r--r--core/java/android/hardware/camera2/utils/SurfaceUtils.java26
-rw-r--r--core/java/android/net/ConnectivityManager.java2
-rw-r--r--core/java/android/net/NetworkCapabilities.java1
-rw-r--r--core/java/android/os/StrictMode.java4
-rw-r--r--core/java/android/os/UserManager.java16
-rw-r--r--core/java/android/os/storage/VolumeInfo.java7
-rw-r--r--core/java/android/os/storage/VolumeRecord.java5
-rw-r--r--core/java/android/provider/Settings.java11
-rw-r--r--core/java/android/text/TextUtils.java5
-rw-r--r--core/java/android/text/format/Formatter.java11
-rw-r--r--core/java/android/util/Range.java2
-rw-r--r--core/java/android/view/MotionEvent.java11
-rw-r--r--core/java/android/view/SurfaceControl.java13
-rw-r--r--core/java/android/view/accessibility/CaptioningManager.java36
-rw-r--r--core/java/android/widget/RelativeLayout.java18
-rw-r--r--core/java/android/widget/Spinner.java8
-rw-r--r--core/java/android/widget/TextView.java10
-rw-r--r--core/java/com/android/internal/app/ChooserActivity.java15
-rw-r--r--core/java/com/android/internal/app/ResolverActivity.java93
-rw-r--r--core/java/com/android/internal/statusbar/IStatusBarService.aidl5
-rw-r--r--core/java/com/android/internal/statusbar/NotificationVisibility.aidl20
-rw-r--r--core/java/com/android/internal/statusbar/NotificationVisibility.java161
-rw-r--r--core/java/com/android/internal/widget/ResolverDrawerLayout.java16
-rw-r--r--core/java/com/android/server/backup/PreferredActivityBackupHelper.java71
-rw-r--r--core/jni/android_hardware_SensorManager.cpp2
-rw-r--r--core/jni/android_hardware_camera2_legacy_LegacyCameraDevice.cpp20
-rw-r--r--core/jni/android_view_DisplayEventReceiver.cpp2
-rw-r--r--core/jni/android_view_MotionEvent.cpp9
-rw-r--r--core/res/AndroidManifest.xml1
-rw-r--r--core/res/res/layout-land/time_picker_material.xml29
-rw-r--r--core/res/res/values-ldrtl/dimens.xml20
-rwxr-xr-xcore/res/res/values/config.xml14
-rw-r--r--core/res/res/values/dimens.xml37
-rwxr-xr-xcore/res/res/values/symbols.xml2
-rw-r--r--core/res/res/xml/sms_short_codes.xml6
-rw-r--r--docs/html/distribute/googleplay/about.jd2
-rw-r--r--docs/html/distribute/googleplay/families/about.jd2
-rw-r--r--docs/html/guide/topics/manifest/uses-permission-element.jd1
-rw-r--r--docs/html/images/distribute/hero-IO15-google-play.jpgbin0 -> 117945 bytes
-rw-r--r--docs/html/images/distribute/hero-IO15-growing-games.jpgbin0 -> 316975 bytes
-rw-r--r--docs/html/images/distribute/hero-family-discovery.jpgbin0 -> 107758 bytes
-rw-r--r--docs/html/images/distribute/hero-family.jpgbin282862 -> 0 bytes
-rw-r--r--docs/html/images/distribute/hero-shifty-jelly.jpgbin0 -> 110140 bytes
-rw-r--r--docs/html/images/distribute/hero-store-listing-experience.jpgbin0 -> 80922 bytes
-rw-r--r--docs/html/images/distribute/hero-the-hunt.jpgbin0 -> 134981 bytes
-rw-r--r--docs/html/images/distribute/hero-trello.jpgbin0 -> 146098 bytes
-rw-r--r--docs/html/images/distribute/hero-wooga.jpgbin0 -> 155210 bytes
-rw-r--r--docs/html/index.jd2
-rw-r--r--docs/html/jd_collections.js17
-rw-r--r--docs/html/jd_extras.js113
-rw-r--r--graphics/java/android/graphics/drawable/Drawable.java23
-rw-r--r--keystore/java/android/security/keystore/AndroidKeyStoreKeyFactorySpi.java2
-rw-r--r--keystore/java/android/security/keystore/AndroidKeyStoreKeyPairGeneratorSpi.java15
-rw-r--r--keystore/java/android/security/keystore/KeyGenParameterSpec.java9
-rw-r--r--keystore/java/android/security/keystore/KeyProtection.java11
-rw-r--r--libs/hwui/DisplayListCanvas.cpp6
-rw-r--r--location/java/android/location/LocationManager.java4
-rw-r--r--media/java/android/media/CamcorderProfile.java66
-rw-r--r--packages/SettingsLib/src/com/android/settingslib/wifi/WifiTracker.java2
-rw-r--r--packages/Shell/src/com/android/shell/BugreportReceiver.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/assist/AssistManager.java8
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java81
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java8
-rw-r--r--packages/SystemUI/src/com/android/systemui/tuner/QsTuner.java27
-rw-r--r--services/core/java/com/android/server/EventLogTags.logtags2
-rw-r--r--services/core/java/com/android/server/LocationManagerService.java48
-rw-r--r--services/core/java/com/android/server/MountService.java44
-rw-r--r--services/core/java/com/android/server/am/ActivityManagerService.java22
-rw-r--r--services/core/java/com/android/server/content/SyncManager.java176
-rw-r--r--services/core/java/com/android/server/display/DisplayPowerController.java38
-rw-r--r--services/core/java/com/android/server/notification/NotificationDelegate.java5
-rw-r--r--services/core/java/com/android/server/notification/NotificationManagerService.java19
-rw-r--r--services/core/java/com/android/server/notification/NotificationRecord.java6
-rw-r--r--services/core/java/com/android/server/pm/DefaultPermissionGrantPolicy.java2
-rw-r--r--services/core/java/com/android/server/pm/IntentFilterVerificationState.java4
-rw-r--r--services/core/java/com/android/server/pm/PackageManagerService.java396
-rw-r--r--services/core/java/com/android/server/pm/Settings.java123
-rw-r--r--services/core/java/com/android/server/pm/UserManagerService.java2
-rw-r--r--services/core/java/com/android/server/statusbar/StatusBarManagerService.java4
-rw-r--r--services/core/java/com/android/server/wm/WindowManagerService.java10
-rw-r--r--services/core/java/com/android/server/wm/WindowStateAnimator.java21
-rw-r--r--services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java15
-rw-r--r--telephony/java/android/telephony/TelephonyManager.java11
-rw-r--r--wifi/java/android/net/wifi/ScanResult.java119
-rw-r--r--wifi/java/android/net/wifi/WifiConfiguration.java20
-rw-r--r--wifi/java/android/net/wifi/WifiEnterpriseConfig.java14
-rw-r--r--wifi/java/android/net/wifi/WifiInfo.java41
-rw-r--r--wifi/java/android/net/wifi/WifiManager.java8
114 files changed, 3324 insertions, 633 deletions
diff --git a/api/current.txt b/api/current.txt
index 1287c74e370b..9cb8d59afa74 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -7211,6 +7211,7 @@ package android.content {
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 onSecurityException(android.accounts.Account, android.os.Bundle, java.lang.String, 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
@@ -13505,7 +13506,6 @@ package android.hardware.camera2 {
field public static final int HOT_PIXEL_MODE_HIGH_QUALITY = 2; // 0x2
field public static final int HOT_PIXEL_MODE_OFF = 0; // 0x0
field public static final int INFO_SUPPORTED_HARDWARE_LEVEL_FULL = 1; // 0x1
- field public static final int INFO_SUPPORTED_HARDWARE_LEVEL_HIGH_RESOLUTION = 3; // 0x3
field public static final int INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY = 2; // 0x2
field public static final int INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED = 0; // 0x0
field public static final int LENS_FACING_BACK = 1; // 0x1
@@ -13858,6 +13858,7 @@ package android.hardware.camera2.params {
}
public final class StreamConfigurationMap {
+ method public android.util.Size[] getHighResolutionOutputSizes(int);
method public android.util.Range<java.lang.Integer>[] getHighSpeedVideoFpsRanges();
method public android.util.Range<java.lang.Integer>[] getHighSpeedVideoFpsRangesFor(android.util.Size);
method public android.util.Size[] getHighSpeedVideoSizes();
@@ -18207,7 +18208,6 @@ package android.net {
method public void onLinkPropertiesChanged(android.net.Network, android.net.LinkProperties);
method public void onLosing(android.net.Network, int);
method public void onLost(android.net.Network);
- method public void onPreCheck(android.net.Network);
}
public static abstract interface ConnectivityManager.OnNetworkActiveListener {
@@ -18372,6 +18372,7 @@ package android.net {
field public static final int NET_CAPABILITY_RCS = 8; // 0x8
field public static final int NET_CAPABILITY_SUPL = 1; // 0x1
field public static final int NET_CAPABILITY_TRUSTED = 14; // 0xe
+ field public static final int NET_CAPABILITY_VALIDATED = 16; // 0x10
field public static final int NET_CAPABILITY_WIFI_P2P = 6; // 0x6
field public static final int NET_CAPABILITY_XCAP = 9; // 0x9
field public static final int TRANSPORT_BLUETOOTH = 2; // 0x2
@@ -19085,6 +19086,8 @@ package android.net.wifi {
public class ScanResult implements android.os.Parcelable {
method public int describeContents();
+ method public boolean is80211mcResponder();
+ method public boolean isPasspointNetwork();
method public void writeToParcel(android.os.Parcel, int);
field public java.lang.String BSSID;
field public static final int CHANNEL_WIDTH_160MHZ = 3; // 0x3
@@ -19092,18 +19095,19 @@ package android.net.wifi {
field public static final int CHANNEL_WIDTH_40MHZ = 1; // 0x1
field public static final int CHANNEL_WIDTH_80MHZ = 2; // 0x2
field public static final int CHANNEL_WIDTH_80MHZ_PLUS_MHZ = 4; // 0x4
+ field public static final long FLAG_80211mc_RESPONDER = 2L; // 0x2L
+ field public static final long FLAG_PASSPOINT_NETWORK = 1L; // 0x1L
field public java.lang.String SSID;
field public java.lang.String capabilities;
field public int centerFreq0;
field public int centerFreq1;
field public int channelWidth;
+ field public long flags;
field public int frequency;
- field public boolean is80211McRTTResponder;
field public int level;
- field public java.lang.String operatorFriendlyName;
- field public boolean passpointNetwork;
+ field public java.lang.CharSequence operatorFriendlyName;
field public long timestamp;
- field public java.lang.String venueName;
+ field public java.lang.CharSequence venueName;
}
public final class SupplicantState extends java.lang.Enum implements android.os.Parcelable {
@@ -19146,7 +19150,7 @@ package android.net.wifi {
field public java.lang.String preSharedKey;
field public int priority;
field public java.lang.String providerFriendlyName;
- field public java.util.HashSet<java.lang.Long> roamingConsortiumIds;
+ field public java.lang.Long[] roamingConsortiumIds;
field public int status;
field public java.lang.String[] wepKeys;
field public int wepTxKeyIndex;
@@ -19208,7 +19212,7 @@ package android.net.wifi {
method public java.lang.String getAnonymousIdentity();
method public java.security.cert.X509Certificate getCaCertificate();
method public java.security.cert.X509Certificate getClientCertificate();
- method public java.lang.String getDomainSubjectMatch();
+ method public java.lang.String getDomainSuffixMatch();
method public int getEapMethod();
method public java.lang.String getIdentity();
method public java.lang.String getPassword();
@@ -23663,6 +23667,7 @@ package android.os {
method public deprecated void setUserRestriction(java.lang.String, boolean);
method public deprecated void setUserRestrictions(android.os.Bundle);
method public deprecated void setUserRestrictions(android.os.Bundle, android.os.UserHandle);
+ field public static final java.lang.String ALLOW_PARENT_APP_LINKING = "allow_parent_app_linking";
field public static final java.lang.String DISALLOW_ADD_USER = "no_add_user";
field public static final java.lang.String DISALLOW_ADJUST_VOLUME = "no_adjust_volume";
field public static final java.lang.String DISALLOW_APPS_CONTROL = "no_control_apps";
@@ -26581,6 +26586,7 @@ package android.provider {
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_DEVICE_OWNER_CONFIGS_LOCKDOWN = "wifi_device_owner_configs_lockdown";
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";
diff --git a/api/system-current.txt b/api/system-current.txt
index 1f8f7a39c6c5..9544f5badf16 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -7436,6 +7436,7 @@ package android.content {
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 onSecurityException(android.accounts.Account, android.os.Bundle, java.lang.String, 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
@@ -13836,7 +13837,6 @@ package android.hardware.camera2 {
field public static final int HOT_PIXEL_MODE_HIGH_QUALITY = 2; // 0x2
field public static final int HOT_PIXEL_MODE_OFF = 0; // 0x0
field public static final int INFO_SUPPORTED_HARDWARE_LEVEL_FULL = 1; // 0x1
- field public static final int INFO_SUPPORTED_HARDWARE_LEVEL_HIGH_RESOLUTION = 3; // 0x3
field public static final int INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY = 2; // 0x2
field public static final int INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED = 0; // 0x0
field public static final int LENS_FACING_BACK = 1; // 0x1
@@ -14189,6 +14189,7 @@ package android.hardware.camera2.params {
}
public final class StreamConfigurationMap {
+ method public android.util.Size[] getHighResolutionOutputSizes(int);
method public android.util.Range<java.lang.Integer>[] getHighSpeedVideoFpsRanges();
method public android.util.Range<java.lang.Integer>[] getHighSpeedVideoFpsRangesFor(android.util.Size);
method public android.util.Size[] getHighSpeedVideoSizes();
@@ -19708,7 +19709,6 @@ package android.net {
method public void onLinkPropertiesChanged(android.net.Network, android.net.LinkProperties);
method public void onLosing(android.net.Network, int);
method public void onLost(android.net.Network);
- method public void onPreCheck(android.net.Network);
}
public static abstract interface ConnectivityManager.OnNetworkActiveListener {
@@ -19873,6 +19873,7 @@ package android.net {
field public static final int NET_CAPABILITY_RCS = 8; // 0x8
field public static final int NET_CAPABILITY_SUPL = 1; // 0x1
field public static final int NET_CAPABILITY_TRUSTED = 14; // 0xe
+ field public static final int NET_CAPABILITY_VALIDATED = 16; // 0x10
field public static final int NET_CAPABILITY_WIFI_P2P = 6; // 0x6
field public static final int NET_CAPABILITY_XCAP = 9; // 0x9
field public static final int TRANSPORT_BLUETOOTH = 2; // 0x2
@@ -20827,6 +20828,8 @@ package android.net.wifi {
public class ScanResult implements android.os.Parcelable {
method public int describeContents();
+ method public boolean is80211mcResponder();
+ method public boolean isPasspointNetwork();
method public void writeToParcel(android.os.Parcel, int);
field public java.lang.String BSSID;
field public static final int CHANNEL_WIDTH_160MHZ = 3; // 0x3
@@ -20834,18 +20837,19 @@ package android.net.wifi {
field public static final int CHANNEL_WIDTH_40MHZ = 1; // 0x1
field public static final int CHANNEL_WIDTH_80MHZ = 2; // 0x2
field public static final int CHANNEL_WIDTH_80MHZ_PLUS_MHZ = 4; // 0x4
+ field public static final long FLAG_80211mc_RESPONDER = 2L; // 0x2L
+ field public static final long FLAG_PASSPOINT_NETWORK = 1L; // 0x1L
field public java.lang.String SSID;
field public java.lang.String capabilities;
field public int centerFreq0;
field public int centerFreq1;
field public int channelWidth;
+ field public long flags;
field public int frequency;
- field public boolean is80211McRTTResponder;
field public int level;
- field public java.lang.String operatorFriendlyName;
- field public boolean passpointNetwork;
+ field public java.lang.CharSequence operatorFriendlyName;
field public long timestamp;
- field public java.lang.String venueName;
+ field public java.lang.CharSequence venueName;
}
public final class SupplicantState extends java.lang.Enum implements android.os.Parcelable {
@@ -20895,7 +20899,7 @@ package android.net.wifi {
field public java.lang.String preSharedKey;
field public int priority;
field public java.lang.String providerFriendlyName;
- field public java.util.HashSet<java.lang.Long> roamingConsortiumIds;
+ field public java.lang.Long[] roamingConsortiumIds;
field public int status;
field public java.lang.String[] wepKeys;
field public int wepTxKeyIndex;
@@ -20972,7 +20976,7 @@ package android.net.wifi {
method public java.lang.String getAnonymousIdentity();
method public java.security.cert.X509Certificate getCaCertificate();
method public java.security.cert.X509Certificate getClientCertificate();
- method public java.lang.String getDomainSubjectMatch();
+ method public java.lang.String getDomainSuffixMatch();
method public int getEapMethod();
method public java.lang.String getIdentity();
method public java.lang.String getPassword();
@@ -25608,6 +25612,7 @@ package android.os {
method public deprecated void setUserRestriction(java.lang.String, boolean);
method public deprecated void setUserRestrictions(android.os.Bundle);
method public deprecated void setUserRestrictions(android.os.Bundle, android.os.UserHandle);
+ field public static final java.lang.String ALLOW_PARENT_APP_LINKING = "allow_parent_app_linking";
field public static final java.lang.String DISALLOW_ADD_USER = "no_add_user";
field public static final java.lang.String DISALLOW_ADJUST_VOLUME = "no_adjust_volume";
field public static final java.lang.String DISALLOW_APPS_CONTROL = "no_control_apps";
@@ -28629,6 +28634,7 @@ package android.provider {
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_DEVICE_OWNER_CONFIGS_LOCKDOWN = "wifi_device_owner_configs_lockdown";
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";
diff --git a/cmds/hid/Android.mk b/cmds/hid/Android.mk
new file mode 100644
index 000000000000..ff3691dd51bd
--- /dev/null
+++ b/cmds/hid/Android.mk
@@ -0,0 +1,18 @@
+# Copyright 2015 The Android Open Source Project
+#
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+LOCAL_SRC_FILES := $(call all-subdir-java-files)
+LOCAL_MODULE := hid
+LOCAL_JNI_SHARED_LIBRARIES := libhidcommand_jni
+include $(BUILD_JAVA_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := hid
+LOCAL_SRC_FILES := hid
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_CLASS := EXECUTABLES
+include $(BUILD_PREBUILT)
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/cmds/hid/MODULE_LICENSE_APACHE2 b/cmds/hid/MODULE_LICENSE_APACHE2
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/cmds/hid/MODULE_LICENSE_APACHE2
diff --git a/cmds/hid/NOTICE b/cmds/hid/NOTICE
new file mode 100644
index 000000000000..c5b1efa7aac7
--- /dev/null
+++ b/cmds/hid/NOTICE
@@ -0,0 +1,190 @@
+
+ Copyright (c) 2005-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.
+
+ 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.
+
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
diff --git a/cmds/hid/hid b/cmds/hid/hid
new file mode 100755
index 000000000000..2359fcd738dd
--- /dev/null
+++ b/cmds/hid/hid
@@ -0,0 +1,8 @@
+#!/system/bin/sh
+#
+# Script to start "hid" on the device, which has a very rudimentary
+# shell.
+#
+base=/system
+export CLASSPATH=$base/framework/hid.jar
+exec app_process $base/bin com.android.commands.hid.Hid "$@"
diff --git a/cmds/hid/jni/Android.mk b/cmds/hid/jni/Android.mk
new file mode 100644
index 000000000000..8163a9d764ff
--- /dev/null
+++ b/cmds/hid/jni/Android.mk
@@ -0,0 +1,23 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := \
+ com_android_commands_hid_Device.cpp
+
+LOCAL_C_INCLUDES := \
+ $(JNI_H_INCLUDE) \
+ frameworks/base/core/jni
+
+LOCAL_SHARED_LIBRARIES := \
+ libandroid_runtime \
+ liblog \
+ libnativehelper \
+ libutils
+
+LOCAL_MODULE := libhidcommand_jni
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_CFLAGS += -Wall
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/cmds/hid/jni/com_android_commands_hid_Device.cpp b/cmds/hid/jni/com_android_commands_hid_Device.cpp
new file mode 100644
index 000000000000..4278e7d3ac12
--- /dev/null
+++ b/cmds/hid/jni/com_android_commands_hid_Device.cpp
@@ -0,0 +1,253 @@
+/*
+ * Copyright (C) 2015 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 "HidCommandDevice"
+
+#include "com_android_commands_hid_Device.h"
+
+#include <linux/uhid.h>
+
+#include <fcntl.h>
+#include <cstdio>
+#include <cstring>
+#include <memory>
+#include <unistd.h>
+
+#include <android_runtime/AndroidRuntime.h>
+#include <android_runtime/Log.h>
+#include <android_os_MessageQueue.h>
+#include <core_jni_helpers.h>
+#include <jni.h>
+#include <JNIHelp.h>
+#include <ScopedPrimitiveArray.h>
+#include <ScopedUtfChars.h>
+#include <utils/Log.h>
+#include <utils/Looper.h>
+#include <utils/StrongPointer.h>
+
+namespace android {
+namespace uhid {
+
+static const char* UHID_PATH = "/dev/uhid";
+static const size_t UHID_MAX_NAME_LENGTH = 128;
+
+static struct {
+ jmethodID onDeviceOpen;
+ jmethodID onDeviceError;
+} gDeviceCallbackClassInfo;
+
+static int handleLooperEvents(int fd, int events, void* data) {
+ Device* d = reinterpret_cast<Device*>(data);
+ return d->handleEvents(events);
+}
+
+static void checkAndClearException(JNIEnv* env, const char* methodName) {
+ if (env->ExceptionCheck()) {
+ ALOGE("An exception was thrown by callback '%s'.", methodName);
+ LOGE_EX(env);
+ env->ExceptionClear();
+ }
+}
+
+DeviceCallback::DeviceCallback(JNIEnv* env, jobject callback) :
+ mCallbackObject(env->NewGlobalRef(callback)) { }
+
+DeviceCallback::~DeviceCallback() {
+ JNIEnv* env = AndroidRuntime::getJNIEnv();
+ env->DeleteGlobalRef(mCallbackObject);
+}
+
+void DeviceCallback::onDeviceError() {
+ JNIEnv* env = AndroidRuntime::getJNIEnv();
+ env->CallVoidMethod(mCallbackObject, gDeviceCallbackClassInfo.onDeviceError);
+ checkAndClearException(env, "onDeviceError");
+}
+
+void DeviceCallback::onDeviceOpen() {
+ JNIEnv* env = AndroidRuntime::getJNIEnv();
+ env->CallVoidMethod(mCallbackObject, gDeviceCallbackClassInfo.onDeviceOpen);
+ checkAndClearException(env, "onDeviceOpen");
+}
+
+Device* Device::open(int32_t id, const char* name, int32_t vid, int32_t pid,
+ std::unique_ptr<uint8_t[]> descriptor, size_t descriptorSize,
+ std::unique_ptr<DeviceCallback> callback, sp<Looper> looper) {
+
+ int fd = ::open(UHID_PATH, O_RDWR | O_CLOEXEC);
+ if (fd < 0) {
+ ALOGE("Failed to open uhid: %s", strerror(errno));
+ return nullptr;
+ }
+
+ struct uhid_event ev;
+ memset(&ev, 0, sizeof(ev));
+ ev.type = UHID_CREATE;
+ strncpy((char*)ev.u.create.name, name, UHID_MAX_NAME_LENGTH);
+ ev.u.create.rd_data = descriptor.get();
+ ev.u.create.rd_size = descriptorSize;
+ ev.u.create.bus = BUS_BLUETOOTH;
+ ev.u.create.vendor = vid;
+ ev.u.create.product = pid;
+ ev.u.create.version = 0;
+ ev.u.create.country = 0;
+
+ errno = 0;
+ ssize_t ret = TEMP_FAILURE_RETRY(::write(fd, &ev, sizeof(ev)));
+ if (ret < 0 || ret != sizeof(ev)) {
+ ::close(fd);
+ ALOGE("Failed to create uhid node: %s", strerror(errno));
+ return nullptr;
+ }
+
+ // Wait for the device to actually be created.
+ ret = TEMP_FAILURE_RETRY(::read(fd, &ev, sizeof(ev)));
+ if (ret < 0 || ev.type != UHID_START) {
+ ::close(fd);
+ ALOGE("uhid node failed to start: %s", strerror(errno));
+ return nullptr;
+ }
+
+ return new Device(id, fd, std::move(callback), looper);
+}
+
+Device::Device(int32_t id, int fd, std::unique_ptr<DeviceCallback> callback, sp<Looper> looper) :
+ mId(id), mFd(fd), mDeviceCallback(std::move(callback)), mLooper(looper) {
+ looper->addFd(fd, 0, Looper::EVENT_INPUT, handleLooperEvents, reinterpret_cast<void*>(this));
+}
+
+Device::~Device() {
+ mLooper->removeFd(mFd);
+ struct uhid_event ev;
+ memset(&ev, 0, sizeof(ev));
+ ev.type = UHID_DESTROY;
+ TEMP_FAILURE_RETRY(::write(mFd, &ev, sizeof(ev)));
+ ::close(mFd);
+ mFd = -1;
+}
+
+void Device::sendReport(uint8_t* report, size_t reportSize) {
+ struct uhid_event ev;
+ memset(&ev, 0, sizeof(ev));
+ ev.type = UHID_INPUT;
+ ev.u.input.size = reportSize;
+ memcpy(&ev.u.input.data, report, reportSize);
+ ssize_t ret = TEMP_FAILURE_RETRY(::write(mFd, &ev, sizeof(ev)));
+ if (ret < 0 || ret != sizeof(ev)) {
+ ALOGE("Failed to send hid event: %s", strerror(errno));
+ }
+}
+
+int Device::handleEvents(int events) {
+ if (events & (Looper::EVENT_ERROR | Looper::EVENT_HANGUP)) {
+ ALOGE("uhid node was closed or an error occurred. events=0x%x", events);
+ mDeviceCallback->onDeviceError();
+ return 0;
+ }
+ struct uhid_event ev;
+ ssize_t ret = TEMP_FAILURE_RETRY(::read(mFd, &ev, sizeof(ev)));
+ if (ret < 0) {
+ ALOGE("Failed to read from uhid node: %s", strerror(errno));
+ mDeviceCallback->onDeviceError();
+ return 0;
+ }
+
+ if (ev.type == UHID_OPEN) {
+ mDeviceCallback->onDeviceOpen();
+ }
+
+ return 1;
+}
+
+} // namespace uhid
+
+std::unique_ptr<uint8_t[]> getData(JNIEnv* env, jbyteArray javaArray, size_t& outSize) {
+ ScopedByteArrayRO scopedArray(env, javaArray);
+ outSize = scopedArray.size();
+ std::unique_ptr<uint8_t[]> data(new uint8_t[outSize]);
+ for (size_t i = 0; i < outSize; i++) {
+ data[i] = static_cast<uint8_t>(scopedArray[i]);
+ }
+ return data;
+}
+
+static jlong openDevice(JNIEnv* env, jclass clazz, jstring rawName, jint id, jint vid, jint pid,
+ jbyteArray rawDescriptor, jobject queue, jobject callback) {
+ ScopedUtfChars name(env, rawName);
+ if (name.c_str() == nullptr) {
+ return 0;
+ }
+
+ size_t size;
+ std::unique_ptr<uint8_t[]> desc = getData(env, rawDescriptor, size);
+
+ std::unique_ptr<uhid::DeviceCallback> cb(new uhid::DeviceCallback(env, callback));
+ sp<Looper> looper = android_os_MessageQueue_getMessageQueue(env, queue)->getLooper();
+
+ uhid::Device* d = uhid::Device::open(
+ id, reinterpret_cast<const char*>(name.c_str()), vid, pid,
+ std::move(desc), size, std::move(cb), std::move(looper));
+ return reinterpret_cast<jlong>(d);
+}
+
+static void sendReport(JNIEnv* env, jclass clazz, jlong ptr,jbyteArray rawReport) {
+ size_t size;
+ std::unique_ptr<uint8_t[]> report = getData(env, rawReport, size);
+ uhid::Device* d = reinterpret_cast<uhid::Device*>(ptr);
+ if (d) {
+ d->sendReport(report.get(), size);
+ }
+}
+
+static void closeDevice(JNIEnv* env, jclass clazz, jlong ptr) {
+ uhid::Device* d = reinterpret_cast<uhid::Device*>(ptr);
+ if (d) {
+ delete d;
+ }
+}
+
+static JNINativeMethod sMethods[] = {
+ { "nativeOpenDevice",
+ "(Ljava/lang/String;III[BLandroid/os/MessageQueue;"
+ "Lcom/android/commands/hid/Device$DeviceCallback;)J",
+ reinterpret_cast<void*>(openDevice) },
+ { "nativeSendReport", "(J[B)V", reinterpret_cast<void*>(sendReport) },
+ { "nativeCloseDevice", "(J)V", reinterpret_cast<void*>(closeDevice) },
+};
+
+int register_com_android_commands_hid_Device(JNIEnv* env) {
+ jclass clazz = FindClassOrDie(env, "com/android/commands/hid/Device$DeviceCallback");
+ uhid::gDeviceCallbackClassInfo.onDeviceOpen =
+ GetMethodIDOrDie(env, clazz, "onDeviceOpen", "()V");
+ uhid::gDeviceCallbackClassInfo.onDeviceError=
+ GetMethodIDOrDie(env, clazz, "onDeviceError", "()V");
+ return jniRegisterNativeMethods(env, "com/android/commands/hid/Device",
+ sMethods, NELEM(sMethods));
+}
+
+} // namespace android
+
+jint JNI_OnLoad(JavaVM* jvm, void*) {
+ JNIEnv *env = NULL;
+ if (jvm->GetEnv(reinterpret_cast<void**>(&env), JNI_VERSION_1_6)) {
+ return JNI_ERR;
+ }
+
+ if (android::register_com_android_commands_hid_Device(env) < 0 ){
+ return JNI_ERR;
+ }
+
+ return JNI_VERSION_1_6;
+}
diff --git a/cmds/hid/jni/com_android_commands_hid_Device.h b/cmds/hid/jni/com_android_commands_hid_Device.h
new file mode 100644
index 000000000000..6c5899eeb861
--- /dev/null
+++ b/cmds/hid/jni/com_android_commands_hid_Device.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2015 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 <memory>
+
+#include <jni.h>
+#include <utils/Looper.h>
+#include <utils/StrongPointer.h>
+
+namespace android {
+namespace uhid {
+
+class DeviceCallback {
+public:
+ DeviceCallback(JNIEnv* env, jobject callback);
+ ~DeviceCallback();
+
+ void onDeviceOpen();
+ void onDeviceError();
+
+private:
+ jobject mCallbackObject;
+};
+
+class Device {
+public:
+ static Device* open(int32_t id, const char* name, int32_t vid, int32_t pid,
+ std::unique_ptr<uint8_t[]> descriptor, size_t descriptorSize,
+ std::unique_ptr<DeviceCallback> callback, sp<Looper> looper);
+
+ Device(int32_t id, int fd, std::unique_ptr<DeviceCallback> callback, sp<Looper> looper);
+ ~Device();
+
+ void sendReport(uint8_t* report, size_t reportSize);
+ void close();
+
+ int handleEvents(int events);
+
+private:
+ int32_t mId;
+ int mFd;
+ std::unique_ptr<DeviceCallback> mDeviceCallback;
+ sp<Looper> mLooper;
+};
+
+
+} // namespace uhid
+} // namespace android
diff --git a/cmds/hid/src/com/android/commands/hid/Device.java b/cmds/hid/src/com/android/commands/hid/Device.java
new file mode 100644
index 000000000000..dbe883bd1136
--- /dev/null
+++ b/cmds/hid/src/com/android/commands/hid/Device.java
@@ -0,0 +1,163 @@
+/*
+ * Copyright (C) 2015 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.hid;
+
+import android.os.Handler;
+import android.os.HandlerThread;
+import android.os.Looper;
+import android.os.Message;
+import android.os.MessageQueue;
+import android.os.SystemClock;
+import android.util.Log;
+
+import com.android.internal.os.SomeArgs;
+
+public class Device {
+ private static final String TAG = "HidDevice";
+
+ // Minimum amount of time to wait before sending input events to a device. Even though we're
+ // guaranteed that the device has been created and opened by the input system, there's still a
+ // window in which the system hasn't started reading events out of it. If a stream of events
+ // begins in during this window (like a button down event) and *then* we start reading, we're
+ // liable to ignore the whole stream.
+ private static final int MIN_WAIT_FOR_FIRST_EVENT = 150;
+
+ private static final int MSG_OPEN_DEVICE = 1;
+ private static final int MSG_SEND_REPORT = 2;
+ private static final int MSG_CLOSE_DEVICE = 3;
+
+
+ private final int mId;
+ private final HandlerThread mThread;
+ private final DeviceHandler mHandler;
+ private long mEventTime;
+
+ private final Object mCond = new Object();
+
+ static {
+ System.loadLibrary("hidcommand_jni");
+ }
+
+ private static native long nativeOpenDevice(String name, int id, int vid, int pid,
+ byte[] descriptor, MessageQueue queue, DeviceCallback callback);
+ private static native void nativeSendReport(long ptr, byte[] data);
+ private static native void nativeCloseDevice(long ptr);
+
+ public Device(int id, String name, int vid, int pid, byte[] descriptor, byte[] report) {
+ mId = id;
+ mThread = new HandlerThread("HidDeviceHandler");
+ mThread.start();
+ mHandler = new DeviceHandler(mThread.getLooper());
+ SomeArgs args = SomeArgs.obtain();
+ args.argi1 = id;
+ args.argi2 = vid;
+ args.argi3 = pid;
+ if (name != null) {
+ args.arg1 = name;
+ } else {
+ args.arg1 = id + ":" + vid + ":" + pid;
+ }
+ args.arg2 = descriptor;
+ args.arg3 = report;
+ mHandler.obtainMessage(MSG_OPEN_DEVICE, args).sendToTarget();
+ mEventTime = SystemClock.uptimeMillis() + MIN_WAIT_FOR_FIRST_EVENT;
+ }
+
+ public void sendReport(byte[] report) {
+ Message msg = mHandler.obtainMessage(MSG_SEND_REPORT, report);
+ mHandler.sendMessageAtTime(msg, mEventTime);
+ }
+
+ public void addDelay(int delay) {
+ mEventTime += delay;
+ }
+
+ public void close() {
+ Message msg = mHandler.obtainMessage(MSG_CLOSE_DEVICE);
+ msg.setAsynchronous(true);
+ mHandler.sendMessageAtTime(msg, mEventTime + 1);
+ try {
+ synchronized (mCond) {
+ mCond.wait();
+ }
+ } catch (InterruptedException ignore) {}
+ }
+
+ private class DeviceHandler extends Handler {
+ private long mPtr;
+ private int mBarrierToken;
+
+ public DeviceHandler(Looper looper) {
+ super(looper);
+ }
+
+ @Override
+ public void handleMessage(Message msg) {
+ switch (msg.what) {
+ case MSG_OPEN_DEVICE:
+ SomeArgs args = (SomeArgs) msg.obj;
+ mPtr = nativeOpenDevice((String) args.arg1, args.argi1, args.argi2, args.argi3,
+ (byte[]) args.arg2, getLooper().myQueue(), new DeviceCallback());
+ nativeSendReport(mPtr, (byte[]) args.arg3);
+ pauseEvents();
+ break;
+ case MSG_SEND_REPORT:
+ if (mPtr != 0) {
+ nativeSendReport(mPtr, (byte[]) msg.obj);
+ } else {
+ Log.e(TAG, "Tried to send report to closed device.");
+ }
+ break;
+ case MSG_CLOSE_DEVICE:
+ if (mPtr != 0) {
+ nativeCloseDevice(mPtr);
+ getLooper().quitSafely();
+ mPtr = 0;
+ } else {
+ Log.e(TAG, "Tried to close already closed device.");
+ }
+ synchronized (mCond) {
+ mCond.notify();
+ }
+ break;
+ default:
+ throw new IllegalArgumentException("Unknown device message");
+ }
+ }
+
+ public void pauseEvents() {
+ mBarrierToken = getLooper().myQueue().postSyncBarrier();
+ }
+
+ public void resumeEvents() {
+ getLooper().myQueue().removeSyncBarrier(mBarrierToken);
+ mBarrierToken = 0;
+ }
+ }
+
+ private class DeviceCallback {
+ public void onDeviceOpen() {
+ mHandler.resumeEvents();
+ }
+
+ public void onDeviceError() {
+ Message msg = mHandler.obtainMessage(MSG_CLOSE_DEVICE);
+ msg.setAsynchronous(true);
+ msg.sendToTarget();
+ }
+ }
+}
diff --git a/cmds/hid/src/com/android/commands/hid/Event.java b/cmds/hid/src/com/android/commands/hid/Event.java
new file mode 100644
index 000000000000..c6a37bd3c48f
--- /dev/null
+++ b/cmds/hid/src/com/android/commands/hid/Event.java
@@ -0,0 +1,255 @@
+/*
+ * Copyright (C) 2015 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.hid;
+
+import android.util.JsonReader;
+import android.util.JsonToken;
+import android.util.Log;
+
+import java.io.InputStreamReader;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+
+public class Event {
+ private static final String TAG = "HidEvent";
+
+ public static final String COMMAND_REGISTER = "register";
+ public static final String COMMAND_DELAY = "delay";
+ public static final String COMMAND_REPORT = "report";
+
+ private int mId;
+ private String mCommand;
+ private String mName;
+ private byte[] mDescriptor;
+ private int mVid;
+ private int mPid;
+ private byte[] mReport;
+ private int mDuration;
+
+ public int getId() {
+ return mId;
+ }
+
+ public String getCommand() {
+ return mCommand;
+ }
+
+ public String getName() {
+ return mName;
+ }
+
+ public byte[] getDescriptor() {
+ return mDescriptor;
+ }
+
+ public int getVendorId() {
+ return mVid;
+ }
+
+ public int getProductId() {
+ return mPid;
+ }
+
+ public byte[] getReport() {
+ return mReport;
+ }
+
+ public int getDuration() {
+ return mDuration;
+ }
+
+ public String toString() {
+ return "Event{id=" + mId
+ + ", command=" + String.valueOf(mCommand)
+ + ", name=" + String.valueOf(mName)
+ + ", descriptor=" + Arrays.toString(mDescriptor)
+ + ", vid=" + mVid
+ + ", pid=" + mPid
+ + ", report=" + Arrays.toString(mReport)
+ + ", duration=" + mDuration
+ + "}";
+ }
+
+ private static class Builder {
+ private Event mEvent;
+
+ public Builder() {
+ mEvent = new Event();
+ }
+
+ public void setId(int id) {
+ mEvent.mId = id;
+ }
+
+ private void setCommand(String command) {
+ mEvent.mCommand = command;
+ }
+
+ public void setName(String name) {
+ mEvent.mName = name;
+ }
+
+ public void setDescriptor(byte[] descriptor) {
+ mEvent.mDescriptor = descriptor;
+ }
+
+ public void setReport(byte[] report) {
+ mEvent.mReport = report;
+ }
+
+ public void setVid(int vid) {
+ mEvent.mVid = vid;
+ }
+
+ public void setPid(int pid) {
+ mEvent.mPid = pid;
+ }
+
+ public void setDuration(int duration) {
+ mEvent.mDuration = duration;
+ }
+
+ public Event build() {
+ if (mEvent.mId == -1) {
+ throw new IllegalStateException("No event id");
+ } else if (mEvent.mCommand == null) {
+ throw new IllegalStateException("Event does not contain a command");
+ }
+ if (COMMAND_REGISTER.equals(mEvent.mCommand)) {
+ if (mEvent.mDescriptor == null) {
+ throw new IllegalStateException("Device registration is missing descriptor");
+ }
+ } else if (COMMAND_DELAY.equals(mEvent.mCommand)) {
+ if (mEvent.mDuration <= 0) {
+ throw new IllegalStateException("Delay has missing or invalid duration");
+ }
+ } else if (COMMAND_REPORT.equals(mEvent.mCommand)) {
+ if (mEvent.mReport == null) {
+ throw new IllegalStateException("Report command is missing report data");
+ }
+ }
+ return mEvent;
+ }
+ }
+
+ public static class Reader {
+ private JsonReader mReader;
+
+ public Reader(InputStreamReader in) {
+ mReader = new JsonReader(in);
+ mReader.setLenient(true);
+ }
+
+ public Event getNextEvent() throws IOException {
+ Event e = null;
+ while (e == null && mReader.peek() != JsonToken.END_DOCUMENT) {
+ Event.Builder eb = new Event.Builder();
+ try {
+ mReader.beginObject();
+ while (mReader.hasNext()) {
+ String name = mReader.nextName();
+ switch (name) {
+ case "id":
+ eb.setId(readInt());
+ break;
+ case "command":
+ eb.setCommand(mReader.nextString());
+ break;
+ case "descriptor":
+ eb.setDescriptor(readData());
+ break;
+ case "name":
+ eb.setName(mReader.nextString());
+ break;
+ case "vid":
+ eb.setVid(readInt());
+ break;
+ case "pid":
+ eb.setPid(readInt());
+ break;
+ case "report":
+ eb.setReport(readData());
+ break;
+ case "duration":
+ eb.setDuration(readInt());
+ break;
+ default:
+ mReader.skipValue();
+ }
+ }
+ mReader.endObject();
+ } catch (IllegalStateException ex) {
+ error("Error reading in object, ignoring.", ex);
+ consumeRemainingElements();
+ mReader.endObject();
+ continue;
+ }
+ e = eb.build();
+ }
+
+ return e;
+ }
+
+ private byte[] readData() throws IOException {
+ ArrayList<Integer> data = new ArrayList<Integer>();
+ try {
+ mReader.beginArray();
+ while (mReader.hasNext()) {
+ data.add(Integer.decode(mReader.nextString()));
+ }
+ mReader.endArray();
+ } catch (IllegalStateException|NumberFormatException e) {
+ consumeRemainingElements();
+ mReader.endArray();
+ throw new IllegalStateException("Encountered malformed data.", e);
+ }
+ byte[] rawData = new byte[data.size()];
+ for (int i = 0; i < data.size(); i++) {
+ int d = data.get(i);
+ if ((d & 0xFF) != d) {
+ throw new IllegalStateException("Invalid data, all values must be byte-sized");
+ }
+ rawData[i] = (byte)d;
+ }
+ return rawData;
+ }
+
+ private int readInt() throws IOException {
+ String val = mReader.nextString();
+ return Integer.decode(val);
+ }
+
+ private void consumeRemainingElements() throws IOException {
+ while (mReader.hasNext()) {
+ mReader.skipValue();
+ }
+ }
+ }
+
+ private static void error(String msg) {
+ error(msg, null);
+ }
+
+ private static void error(String msg, Exception e) {
+ System.out.println(msg);
+ Log.e(TAG, msg);
+ if (e != null) {
+ Log.e(TAG, Log.getStackTraceString(e));
+ }
+ }
+}
diff --git a/cmds/hid/src/com/android/commands/hid/Hid.java b/cmds/hid/src/com/android/commands/hid/Hid.java
new file mode 100644
index 000000000000..976a78249bec
--- /dev/null
+++ b/cmds/hid/src/com/android/commands/hid/Hid.java
@@ -0,0 +1,133 @@
+/*
+ * Copyright (C) 2015 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.hid;
+
+import android.os.SystemClock;
+import android.util.JsonReader;
+import android.util.JsonToken;
+import android.util.Log;
+import android.util.SparseArray;
+
+import libcore.io.IoUtils;
+
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+
+public class Hid {
+ private static final String TAG = "HID";
+
+ private final Event.Reader mReader;
+ private final SparseArray<Device> mDevices;
+
+ private static void usage() {
+ error("Usage: hid [FILE]");
+ }
+
+ public static void main(String[] args) {
+ if (args.length != 1) {
+ usage();
+ System.exit(1);
+ }
+
+ InputStream stream = null;
+ try {
+ if (args[0].equals("-")) {
+ stream = System.in;
+ } else {
+ File f = new File(args[0]);
+ stream = new FileInputStream(f);
+ }
+ (new Hid(stream)).run();
+ } catch (Exception e) {
+ error("HID injection failed.", e);
+ System.exit(1);
+ } finally {
+ IoUtils.closeQuietly(stream);
+ }
+ }
+
+ private Hid(InputStream in) {
+ mDevices = new SparseArray<Device>();
+ try {
+ mReader = new Event.Reader(new InputStreamReader(in, "UTF-8"));
+ } catch (UnsupportedEncodingException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private void run() {
+ try {
+ Event e = null;
+ while ((e = mReader.getNextEvent()) != null) {
+ process(e);
+ }
+ } catch (IOException ex) {
+ error("Error reading in events.", ex);
+ }
+
+ for (int i = 0; i < mDevices.size(); i++) {
+ mDevices.valueAt(i).close();
+ }
+ }
+
+
+ private void process(Event e) {
+ final int index = mDevices.indexOfKey(e.getId());
+ if (index >= 0) {
+ Device d = mDevices.valueAt(index);
+ if (Event.COMMAND_DELAY.equals(e.getCommand())) {
+ d.addDelay(e.getDuration());
+ } else if (Event.COMMAND_REPORT.equals(e.getCommand())) {
+ d.sendReport(e.getReport());
+ } else {
+ error("Unknown command \"" + e.getCommand() + "\". Ignoring event.");
+ }
+ } else {
+ registerDevice(e);
+ }
+ }
+
+ private void registerDevice(Event e) {
+ if (!Event.COMMAND_REGISTER.equals(e.getCommand())) {
+ throw new IllegalStateException(
+ "Tried to send command \"" + e.getCommand() + "\" to an unregistered device!");
+ }
+ int id = e.getId();
+ Device d = new Device(id, e.getName(), e.getVendorId(), e.getProductId(),
+ e.getDescriptor(), e.getReport());
+ mDevices.append(id, d);
+ }
+
+ private static void error(String msg) {
+ error(msg, null);
+ }
+
+ private static void error(String msg, Exception e) {
+ System.out.println(msg);
+ Log.e(TAG, msg);
+ if (e != null) {
+ Log.e(TAG, Log.getStackTraceString(e));
+ }
+ }
+}
diff --git a/cmds/wm/src/com/android/commands/wm/Wm.java b/cmds/wm/src/com/android/commands/wm/Wm.java
index 64f023f16abf..fb050e545931 100644
--- a/cmds/wm/src/com/android/commands/wm/Wm.java
+++ b/cmds/wm/src/com/android/commands/wm/Wm.java
@@ -54,6 +54,7 @@ public class Wm extends BaseCommand {
" wm density [reset|DENSITY]\n" +
" wm overscan [reset|LEFT,TOP,RIGHT,BOTTOM]\n" +
" wm scaling [off|auto]\n" +
+ " wm screen-capture [userId] [true|false]\n" +
"\n" +
"wm size: return or override display size.\n" +
" width and height in pixels unless suffixed with 'dp'.\n" +
@@ -62,7 +63,9 @@ public class Wm extends BaseCommand {
"\n" +
"wm overscan: set overscan area for display.\n" +
"\n" +
- "wm scaling: set display scaling mode.\n"
+ "wm scaling: set display scaling mode.\n" +
+ "\n" +
+ "wm screen-capture: enable/disable screen capture.\n"
);
}
@@ -85,16 +88,39 @@ public class Wm extends BaseCommand {
runDisplayOverscan();
} else if (op.equals("scaling")) {
runDisplayScaling();
+ } else if (op.equals("screen-capture")) {
+ runSetScreenCapture();
} else {
showError("Error: unknown command '" + op + "'");
return;
}
}
+ private void runSetScreenCapture() throws Exception {
+ String userIdStr = nextArg();
+ String enableStr = nextArg();
+ int userId;
+ boolean disable;
+
+ try {
+ userId = Integer.parseInt(userIdStr);
+ } catch (NumberFormatException e) {
+ System.err.println("Error: bad number " + e);
+ return;
+ }
+
+ disable = !Boolean.parseBoolean(enableStr);
+
+ try {
+ mWm.setScreenCaptureDisabled(userId, disable);
+ } catch (RemoteException e) {
+ System.err.println("Error: Can't set screen capture " + e);
+ }
+ }
+
private void runDisplaySize() throws Exception {
String size = nextArg();
int w, h;
- boolean scale = true;
if (size == null) {
Point initialSize = new Point();
Point baseSize = new Point();
@@ -181,7 +207,6 @@ public class Wm extends BaseCommand {
private void runDisplayOverscan() throws Exception {
String overscanStr = nextArgRequired();
Rect rect = new Rect();
- int density;
if ("reset".equals(overscanStr)) {
rect.set(0, 0, 0, 0);
} else {
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java
index 1b4ee2ede395..e8ab109f992e 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -2075,6 +2075,9 @@ public class Activity extends ContextThemeWrapper
"by the window decor. Do not request Window.FEATURE_ACTION_BAR and set " +
"android:windowActionBar to false in your theme to use a Toolbar instead.");
}
+ // Clear out the MenuInflater to make sure that it is valid for the new Action Bar
+ mMenuInflater = null;
+
ToolbarActionBar tbab = new ToolbarActionBar(toolbar, getTitle(), this);
mActionBar = tbab;
mWindow.setCallback(tbab.getWrappedWindowCallback());
diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java
index 125708a66249..b859dca4ca34 100644
--- a/core/java/android/app/admin/DevicePolicyManager.java
+++ b/core/java/android/app/admin/DevicePolicyManager.java
@@ -3972,6 +3972,7 @@ public class DevicePolicyManager {
* <li>{@link Settings.Global#STAY_ON_WHILE_PLUGGED_IN}
* This setting is only available from {@link android.os.Build.VERSION_CODES#MNC} onwards
* and can only be set if {@link #setMaximumTimeToLock} is not used to set a timeout.</li>
+ * <li>{@link Settings.Global#WIFI_DEVICE_OWNER_CONFIGS_LOCKDOWN}</li>
* </ul>
*
* @param admin Which {@link DeviceAdminReceiver} this request is associated with.
diff --git a/core/java/android/content/AbstractThreadedSyncAdapter.java b/core/java/android/content/AbstractThreadedSyncAdapter.java
index 809f900222c5..58bd5cda825d 100644
--- a/core/java/android/content/AbstractThreadedSyncAdapter.java
+++ b/core/java/android/content/AbstractThreadedSyncAdapter.java
@@ -28,13 +28,26 @@ import java.util.concurrent.atomic.AtomicInteger;
/**
* An abstract implementation of a SyncAdapter that spawns a thread to invoke a sync operation.
- * If a sync operation is already in progress when a startSync() request is received then an error
- * will be returned to the new request and the existing request will be allowed to continue.
- * When a startSync() is received and there is no sync operation in progress then a thread
- * will be started to run the operation and {@link #onPerformSync} will be invoked on that thread.
- * If a cancelSync() is received that matches an existing sync operation then the thread
- * that is running that sync operation will be interrupted, which will indicate to the thread
- * that the sync has been canceled.
+ * If a sync operation is already in progress when a sync request is received, an error will be
+ * returned to the new request and the existing request will be allowed to continue.
+ * However if there is no sync in progress then a thread will be spawned and {@link #onPerformSync}
+ * will be invoked on that thread.
+ * <p>
+ * Syncs can be cancelled at any time by the framework. For example a sync that was not
+ * user-initiated and lasts longer than 30 minutes will be considered timed-out and cancelled.
+ * Similarly the framework will attempt to determine whether or not an adapter is making progress
+ * by monitoring its network activity over the course of a minute. If the network traffic over this
+ * window is close enough to zero the sync will be cancelled. You can also request the sync be
+ * cancelled via {@link ContentResolver#cancelSync(Account, String)} or
+ * {@link ContentResolver#cancelSync(SyncRequest)}.
+ * <p>
+ * A sync is cancelled by issuing a {@link Thread#interrupt()} on the syncing thread. <strong>Either
+ * your code in {@link #onPerformSync(Account, Bundle, String, ContentProviderClient, SyncResult)}
+ * must check {@link Thread#interrupted()}, or you you must override one of
+ * {@link #onSyncCanceled(Thread)}/{@link #onSyncCanceled()}</strong> (depending on whether or not
+ * your adapter supports syncing of multiple accounts in parallel). If your adapter does not
+ * respect the cancel issued by the framework you run the risk of your app's entire process being
+ * killed.
* <p>
* In order to be a sync adapter one must extend this class, provide implementations for the
* abstract methods and write a service that returns the result of {@link #getSyncAdapterBinder()}
@@ -261,6 +274,10 @@ public abstract class AbstractThreadedSyncAdapter {
} else {
syncResult.databaseError = true;
}
+ } catch (SecurityException e) {
+ AbstractThreadedSyncAdapter.this.onSecurityException(mAccount, mExtras,
+ mAuthority, syncResult);
+ syncResult.databaseError = true;
} finally {
Trace.traceEnd(Trace.TRACE_TAG_SYNC_MANAGER);
@@ -306,6 +323,20 @@ public abstract class AbstractThreadedSyncAdapter {
String authority, ContentProviderClient provider, SyncResult syncResult);
/**
+ * Report that there was a security exception when opening the content provider
+ * prior to calling {@link #onPerformSync}. This will be treated as a sync
+ * database failure.
+ *
+ * @param account the account that attempted to sync
+ * @param extras SyncAdapter-specific parameters
+ * @param authority the authority of the failed sync request
+ * @param syncResult SyncAdapter-specific parameters
+ */
+ public void onSecurityException(Account account, Bundle extras,
+ String authority, SyncResult syncResult) {
+ }
+
+ /**
* Indicates that a sync operation has been canceled. This will be invoked on a separate
* thread than the sync thread and so you must consider the multi-threaded implications
* of the work that you do in this method.
diff --git a/core/java/android/content/pm/IPackageManager.aidl b/core/java/android/content/pm/IPackageManager.aidl
index 0c07bc3ed105..2dbcde9caa5b 100644
--- a/core/java/android/content/pm/IPackageManager.aidl
+++ b/core/java/android/content/pm/IPackageManager.aidl
@@ -282,6 +282,10 @@ interface IPackageManager {
*/
byte[] getPreferredActivityBackup(int userId);
void restorePreferredActivities(in byte[] backup, int userId);
+ byte[] getDefaultAppsBackup(int userId);
+ void restoreDefaultApps(in byte[] backup, int userId);
+ byte[] getIntentFilterVerificationBackup(int userId);
+ void restoreIntentFilterVerification(in byte[] backup, int userId);
/**
* Report the set of 'Home' activity candidates, plus (if any) which of them
diff --git a/core/java/android/hardware/camera2/CameraCharacteristics.java b/core/java/android/hardware/camera2/CameraCharacteristics.java
index 27d14b3bbae5..261ce72bac34 100644
--- a/core/java/android/hardware/camera2/CameraCharacteristics.java
+++ b/core/java/android/hardware/camera2/CameraCharacteristics.java
@@ -2679,9 +2679,7 @@ public final class CameraCharacteristics extends CameraMetadata<CameraCharacteri
* <p>Camera devices will come in three flavors: LEGACY, LIMITED and FULL.</p>
* <p>A FULL device will support below capabilities:</p>
* <ul>
- * <li>30fps operation at maximum resolution (== sensor resolution) is preferred, more than
- * 20fps is required, for at least uncompressed YUV
- * output. ({@link CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES android.request.availableCapabilities} contains BURST_CAPTURE)</li>
+ * <li>BURST_CAPTURE capability ({@link CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES android.request.availableCapabilities} contains BURST_CAPTURE)</li>
* <li>Per frame control ({@link CameraCharacteristics#SYNC_MAX_LATENCY android.sync.maxLatency} <code>==</code> PER_FRAME_CONTROL)</li>
* <li>Manual sensor control ({@link CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES android.request.availableCapabilities} contains MANUAL_SENSOR)</li>
* <li>Manual post-processing control ({@link CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES android.request.availableCapabilities} contains
@@ -2689,7 +2687,7 @@ public final class CameraCharacteristics extends CameraMetadata<CameraCharacteri
* <li>Arbitrary cropping region ({@link CameraCharacteristics#SCALER_CROPPING_TYPE android.scaler.croppingType} <code>==</code> FREEFORM)</li>
* <li>At least 3 processed (but not stalling) format output streams
* ({@link CameraCharacteristics#REQUEST_MAX_NUM_OUTPUT_PROC android.request.maxNumOutputProc} <code>&gt;=</code> 3)</li>
- * <li>The required stream configuration defined in android.scaler.availableStreamConfigurations</li>
+ * <li>The required stream configurations defined in android.scaler.availableStreamConfigurations</li>
* <li>The required exposure time range defined in {@link CameraCharacteristics#SENSOR_INFO_EXPOSURE_TIME_RANGE android.sensor.info.exposureTimeRange}</li>
* <li>The required maxFrameDuration defined in {@link CameraCharacteristics#SENSOR_INFO_MAX_FRAME_DURATION android.sensor.info.maxFrameDuration}</li>
* </ul>
@@ -2709,23 +2707,11 @@ public final class CameraCharacteristics extends CameraMetadata<CameraCharacteri
* post-processing, arbitrary cropping regions, and has relaxed performance constraints.</p>
* <p>Each higher level supports everything the lower level supports
* in this order: FULL <code>&gt;</code> LIMITED <code>&gt;</code> LEGACY.</p>
- * <p>A HIGH_RESOLUTION device is equivalent to a FULL device, except that:</p>
- * <ul>
- * <li>At least one output resolution of 8 megapixels or higher in uncompressed YUV is
- * supported at <code>&gt;=</code> 20 fps.</li>
- * <li>Maximum-size (sensor resolution) uncompressed YUV is supported at <code>&gt;=</code> 10
- * fps.</li>
- * <li>For devices that list the RAW capability and support either RAW10 or RAW12 output,
- * maximum-resolution RAW10 or RAW12 capture will operate at least at the rate of
- * maximum-resolution YUV capture, and at least one supported output resolution of
- * 8 megapixels or higher in RAW10 or RAW12 is supported <code>&gt;=</code> 20 fps.</li>
- * </ul>
* <p><b>Possible values:</b>
* <ul>
* <li>{@link #INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED LIMITED}</li>
* <li>{@link #INFO_SUPPORTED_HARDWARE_LEVEL_FULL FULL}</li>
* <li>{@link #INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY LEGACY}</li>
- * <li>{@link #INFO_SUPPORTED_HARDWARE_LEVEL_HIGH_RESOLUTION HIGH_RESOLUTION}</li>
* </ul></p>
* <p>This key is available on all devices.</p>
*
@@ -2743,7 +2729,6 @@ public final class CameraCharacteristics extends CameraMetadata<CameraCharacteri
* @see #INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED
* @see #INFO_SUPPORTED_HARDWARE_LEVEL_FULL
* @see #INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY
- * @see #INFO_SUPPORTED_HARDWARE_LEVEL_HIGH_RESOLUTION
*/
@PublicKey
public static final Key<Integer> INFO_SUPPORTED_HARDWARE_LEVEL =
diff --git a/core/java/android/hardware/camera2/CameraMetadata.java b/core/java/android/hardware/camera2/CameraMetadata.java
index c656fb8b8352..5a80585cf55e 100644
--- a/core/java/android/hardware/camera2/CameraMetadata.java
+++ b/core/java/android/hardware/camera2/CameraMetadata.java
@@ -531,37 +531,32 @@ public abstract class CameraMetadata<TKey> {
public static final int REQUEST_AVAILABLE_CAPABILITIES_READ_SENSOR_SETTINGS = 5;
/**
- * <p>The camera device supports capturing maximum-resolution
- * images at &gt;= 20 frames per second, in at least the
- * uncompressed YUV format, when post-processing settings
- * are set to FAST.</p>
- * <p>More specifically, this means that a size matching the
- * camera device's active array size is listed as a
- * supported size for the YUV_420_888 format in
- * {@link CameraCharacteristics#SCALER_STREAM_CONFIGURATION_MAP android.scaler.streamConfigurationMap}, the minimum frame
- * duration for that format and size is &lt;= 1/20 s, and
- * the {@link CameraCharacteristics#CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES android.control.aeAvailableTargetFpsRanges} entry
- * lists at least one FPS range where the minimum FPS is</p>
- * <blockquote>
- * <p>= 1 / minimumFrameDuration for the maximum-size
- * YUV_420_888 format.</p>
- * </blockquote>
- * <p>In addition, the {@link CameraCharacteristics#SYNC_MAX_LATENCY android.sync.maxLatency} field is
- * guaranted to have a value between 0 and 4, inclusive.
- * {@link CameraCharacteristics#CONTROL_AE_LOCK_AVAILABLE android.control.aeLockAvailable} and
- * {@link CameraCharacteristics#CONTROL_AWB_LOCK_AVAILABLE android.control.awbLockAvailable} are also guaranteed
- * to be <code>true</code> so burst capture with these two locks ON
- * yields consistent image output.</p>
- * <p>On a camera device that reports the HIGH_RESOLUTION hardware
- * level, meaning the device supports very large capture sizes,
- * BURST_CAPTURE means that at least 8-megapixel images can be
- * captured at <code>&gt;=</code> 20 fps, and maximum-resolution images can be
- * captured at <code>&gt;=</code> 10 fps.</p>
+ * <p>The camera device supports capturing high-resolution images at &gt;= 20 frames per
+ * second, in at least the uncompressed YUV format, when post-processing settings are set
+ * to FAST. Additionally, maximum-resolution images can be captured at &gt;= 10 frames
+ * per second. Here, 'high resolution' means at least 8 megapixels, or the maximum
+ * resolution of the device, whichever is smaller.</p>
+ * <p>More specifically, this means that a size matching the camera device's active array
+ * size is listed as a supported size for the {@link android.graphics.ImageFormat#YUV_420_888 } format in either {@link android.hardware.camera2.params.StreamConfigurationMap#getOutputSizes } or {@link android.hardware.camera2.params.StreamConfigurationMap#getHighResolutionOutputSizes },
+ * with a minimum frame duration for that format and size of either &lt;= 1/20 s, or
+ * &lt;= 1/10 s, respectively; and the {@link CameraCharacteristics#CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES android.control.aeAvailableTargetFpsRanges} entry
+ * lists at least one FPS range where the minimum FPS is &gt;= 1 / minimumFrameDuration
+ * for the maximum-size YUV_420_888 format. If that maximum size is listed in {@link android.hardware.camera2.params.StreamConfigurationMap#getHighResolutionOutputSizes },
+ * then the list of resolutions for YUV_420_888 from {@link android.hardware.camera2.params.StreamConfigurationMap#getOutputSizes } contains at
+ * least one resolution &gt;= 8 megapixels, with a minimum frame duration of &lt;= 1/20
+ * s.</p>
+ * <p>If the device supports the {@link android.graphics.ImageFormat#RAW10 }, {@link android.graphics.ImageFormat#RAW12 }, then those can also be captured at the same rate
+ * as the maximum-size YUV_420_888 resolution is.</p>
+ * <p>If the device supports the PRIVATE_REPROCESSING capability, then the same guarantees
+ * as for the YUV_420_888 format also apply to the {@link android.graphics.ImageFormat#PRIVATE } format.</p>
+ * <p>In addition, the {@link CameraCharacteristics#SYNC_MAX_LATENCY android.sync.maxLatency} field is guaranted to have a value between 0
+ * and 4, inclusive. {@link CameraCharacteristics#CONTROL_AE_LOCK_AVAILABLE android.control.aeLockAvailable} and {@link CameraCharacteristics#CONTROL_AWB_LOCK_AVAILABLE android.control.awbLockAvailable}
+ * are also guaranteed to be <code>true</code> so burst capture with these two locks ON yields
+ * consistent image output.</p>
*
* @see CameraCharacteristics#CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES
* @see CameraCharacteristics#CONTROL_AE_LOCK_AVAILABLE
* @see CameraCharacteristics#CONTROL_AWB_LOCK_AVAILABLE
- * @see CameraCharacteristics#SCALER_STREAM_CONFIGURATION_MAP
* @see CameraCharacteristics#SYNC_MAX_LATENCY
* @see CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES
*/
@@ -954,13 +949,6 @@ public abstract class CameraMetadata<TKey> {
*/
public static final int INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY = 2;
- /**
- * <p>This camera device is capable of supporting advanced imaging applications at full rate,
- * and additional high-resolution outputs at lower rates.</p>
- * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
- */
- public static final int INFO_SUPPORTED_HARDWARE_LEVEL_HIGH_RESOLUTION = 3;
-
//
// Enumeration values for CameraCharacteristics#SYNC_MAX_LATENCY
//
diff --git a/core/java/android/hardware/camera2/CaptureRequest.java b/core/java/android/hardware/camera2/CaptureRequest.java
index 9fa66879629d..75289f762162 100644
--- a/core/java/android/hardware/camera2/CaptureRequest.java
+++ b/core/java/android/hardware/camera2/CaptureRequest.java
@@ -398,7 +398,7 @@ public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>>
@Override
public int hashCode() {
- return HashCodeHelpers.hashCode(mSettings, mSurfaceSet, mUserTag);
+ return HashCodeHelpers.hashCodeGeneric(mSettings, mSurfaceSet, mUserTag);
}
public static final Parcelable.Creator<CaptureRequest> CREATOR =
@@ -1759,11 +1759,24 @@ public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>>
* 16:9 aspect ratio, the primary image will be cropped vertically (letterbox) to
* generate the thumbnail image. The thumbnail image will always have a smaller Field
* Of View (FOV) than the primary image when aspect ratios differ.</p>
+ * <p>When an {@link CaptureRequest#JPEG_ORIENTATION android.jpeg.orientation} of non-zero degree is requested,
+ * the camera device will handle thumbnail rotation in one of the following ways:</p>
+ * <ul>
+ * <li>Set the {@link android.media.ExifInterface#TAG_ORIENTATION EXIF orientation flag}
+ * and keep jpeg and thumbnail image data unrotated.</li>
+ * <li>Rotate the jpeg and thumbnail image data and not set
+ * {@link android.media.ExifInterface#TAG_ORIENTATION EXIF orientation flag}. In this
+ * case, LIMITED or FULL hardware level devices will report rotated thumnail size in
+ * capture result, so the width and height will be interchanged if 90 or 270 degree
+ * orientation is requested. LEGACY device will always report unrotated thumbnail
+ * size.</li>
+ * </ul>
* <p><b>Range of valid values:</b><br>
* {@link CameraCharacteristics#JPEG_AVAILABLE_THUMBNAIL_SIZES android.jpeg.availableThumbnailSizes}</p>
* <p>This key is available on all devices.</p>
*
* @see CameraCharacteristics#JPEG_AVAILABLE_THUMBNAIL_SIZES
+ * @see CaptureRequest#JPEG_ORIENTATION
*/
@PublicKey
public static final Key<android.util.Size> JPEG_THUMBNAIL_SIZE =
diff --git a/core/java/android/hardware/camera2/CaptureResult.java b/core/java/android/hardware/camera2/CaptureResult.java
index b1fb615821c7..1d31109a1e87 100644
--- a/core/java/android/hardware/camera2/CaptureResult.java
+++ b/core/java/android/hardware/camera2/CaptureResult.java
@@ -2314,11 +2314,24 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
* 16:9 aspect ratio, the primary image will be cropped vertically (letterbox) to
* generate the thumbnail image. The thumbnail image will always have a smaller Field
* Of View (FOV) than the primary image when aspect ratios differ.</p>
+ * <p>When an {@link CaptureRequest#JPEG_ORIENTATION android.jpeg.orientation} of non-zero degree is requested,
+ * the camera device will handle thumbnail rotation in one of the following ways:</p>
+ * <ul>
+ * <li>Set the {@link android.media.ExifInterface#TAG_ORIENTATION EXIF orientation flag}
+ * and keep jpeg and thumbnail image data unrotated.</li>
+ * <li>Rotate the jpeg and thumbnail image data and not set
+ * {@link android.media.ExifInterface#TAG_ORIENTATION EXIF orientation flag}. In this
+ * case, LIMITED or FULL hardware level devices will report rotated thumnail size in
+ * capture result, so the width and height will be interchanged if 90 or 270 degree
+ * orientation is requested. LEGACY device will always report unrotated thumbnail
+ * size.</li>
+ * </ul>
* <p><b>Range of valid values:</b><br>
* {@link CameraCharacteristics#JPEG_AVAILABLE_THUMBNAIL_SIZES android.jpeg.availableThumbnailSizes}</p>
* <p>This key is available on all devices.</p>
*
* @see CameraCharacteristics#JPEG_AVAILABLE_THUMBNAIL_SIZES
+ * @see CaptureRequest#JPEG_ORIENTATION
*/
@PublicKey
public static final Key<android.util.Size> JPEG_THUMBNAIL_SIZE =
diff --git a/core/java/android/hardware/camera2/impl/CameraMetadataNative.java b/core/java/android/hardware/camera2/impl/CameraMetadataNative.java
index 10dd8aed631e..7e50fd9f623a 100644
--- a/core/java/android/hardware/camera2/impl/CameraMetadataNative.java
+++ b/core/java/android/hardware/camera2/impl/CameraMetadataNative.java
@@ -842,11 +842,19 @@ public class CameraMetadataNative implements Parcelable {
CameraCharacteristics.CONTROL_AVAILABLE_HIGH_SPEED_VIDEO_CONFIGURATIONS);
ReprocessFormatsMap inputOutputFormatsMap = getBase(
CameraCharacteristics.SCALER_AVAILABLE_INPUT_OUTPUT_FORMATS_MAP);
-
+ int[] capabilities = getBase(CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES);
+ boolean listHighResolution = false;
+ for (int capability : capabilities) {
+ if (capability == CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES_BURST_CAPTURE) {
+ listHighResolution = true;
+ break;
+ }
+ }
return new StreamConfigurationMap(
configurations, minFrameDurations, stallDurations,
depthConfigurations, depthMinFrameDurations, depthStallDurations,
- highSpeedVideoConfigurations, inputOutputFormatsMap);
+ highSpeedVideoConfigurations, inputOutputFormatsMap,
+ listHighResolution);
}
private <T> Integer getMaxRegions(Key<T> key) {
diff --git a/core/java/android/hardware/camera2/legacy/LegacyCameraDevice.java b/core/java/android/hardware/camera2/legacy/LegacyCameraDevice.java
index 2fb3203973bc..e786707c383d 100644
--- a/core/java/android/hardware/camera2/legacy/LegacyCameraDevice.java
+++ b/core/java/android/hardware/camera2/legacy/LegacyCameraDevice.java
@@ -605,6 +605,14 @@ public class LegacyCameraDevice implements AutoCloseable {
return LegacyExceptionUtils.throwOnError(nativeDetectSurfaceType(surface));
}
+ /**
+ * Query the surface for its currently configured dataspace
+ */
+ public static int detectSurfaceDataspace(Surface surface) throws BufferQueueAbandonedException {
+ checkNotNull(surface);
+ return LegacyExceptionUtils.throwOnError(nativeDetectSurfaceDataspace(surface));
+ }
+
static void configureSurface(Surface surface, int width, int height,
int pixelFormat) throws BufferQueueAbandonedException {
checkNotNull(surface);
@@ -702,6 +710,8 @@ public class LegacyCameraDevice implements AutoCloseable {
private static native int nativeDetectSurfaceType(Surface surface);
+ private static native int nativeDetectSurfaceDataspace(Surface surface);
+
private static native int nativeDetectSurfaceDimens(Surface surface,
/*out*/int[/*2*/] dimens);
diff --git a/core/java/android/hardware/camera2/params/StreamConfigurationMap.java b/core/java/android/hardware/camera2/params/StreamConfigurationMap.java
index c6ea4883f188..0935564913c8 100644
--- a/core/java/android/hardware/camera2/params/StreamConfigurationMap.java
+++ b/core/java/android/hardware/camera2/params/StreamConfigurationMap.java
@@ -22,12 +22,13 @@ import android.hardware.camera2.CameraCharacteristics;
import android.hardware.camera2.CameraDevice;
import android.hardware.camera2.CaptureRequest;
import android.hardware.camera2.utils.HashCodeHelpers;
+import android.hardware.camera2.utils.SurfaceUtils;
import android.hardware.camera2.legacy.LegacyCameraDevice;
import android.hardware.camera2.legacy.LegacyMetadataMapper;
-import android.hardware.camera2.legacy.LegacyExceptionUtils.BufferQueueAbandonedException;
import android.view.Surface;
import android.util.Range;
import android.util.Size;
+import android.util.SparseIntArray;
import java.util.Arrays;
import java.util.HashMap;
@@ -79,7 +80,8 @@ public final class StreamConfigurationMap {
* @param stallDurations a non-{@code null} array of {@link StreamConfigurationDuration}
* @param highSpeedVideoConfigurations an array of {@link HighSpeedVideoConfiguration}, null if
* camera device does not support high speed video recording
- *
+ * @param listHighResolution a flag indicating whether the device supports BURST_CAPTURE
+ * and thus needs a separate list of slow high-resolution output sizes
* @throws NullPointerException if any of the arguments except highSpeedVideoConfigurations
* were {@code null} or any subelements were {@code null}
*
@@ -93,10 +95,12 @@ public final class StreamConfigurationMap {
StreamConfigurationDuration[] depthMinFrameDurations,
StreamConfigurationDuration[] depthStallDurations,
HighSpeedVideoConfiguration[] highSpeedVideoConfigurations,
- ReprocessFormatsMap inputOutputFormatsMap) {
+ ReprocessFormatsMap inputOutputFormatsMap,
+ boolean listHighResolution) {
mConfigurations = checkArrayElementsNotNull(configurations, "configurations");
mMinFrameDurations = checkArrayElementsNotNull(minFrameDurations, "minFrameDurations");
mStallDurations = checkArrayElementsNotNull(stallDurations, "stallDurations");
+ mListHighResolution = listHighResolution;
if (depthConfigurations == null) {
mDepthConfigurations = new StreamConfiguration[0];
@@ -120,15 +124,27 @@ public final class StreamConfigurationMap {
// For each format, track how many sizes there are available to configure
for (StreamConfiguration config : configurations) {
- HashMap<Integer, Integer> map = config.isOutput() ? mOutputFormats : mInputFormats;
-
- Integer count = map.get(config.getFormat());
-
- if (count == null) {
- count = 0;
+ int fmt = config.getFormat();
+ SparseIntArray map = null;
+ if (config.isOutput()) {
+ mAllOutputFormats.put(fmt, mAllOutputFormats.get(fmt) + 1);
+ long duration = 0;
+ if (mListHighResolution) {
+ for (StreamConfigurationDuration configurationDuration : mMinFrameDurations) {
+ if (configurationDuration.getFormat() == fmt &&
+ configurationDuration.getWidth() == config.getSize().getWidth() &&
+ configurationDuration.getHeight() == config.getSize().getHeight()) {
+ duration = configurationDuration.getDuration();
+ break;
+ }
+ }
+ }
+ map = duration <= DURATION_20FPS_NS ?
+ mOutputFormats : mHighResOutputFormats;
+ } else {
+ map = mInputFormats;
}
-
- map.put(config.getFormat(), count + 1);
+ map.put(fmt, map.get(fmt) + 1);
}
// For each depth format, track how many sizes there are available to configure
@@ -138,16 +154,11 @@ public final class StreamConfigurationMap {
continue;
}
- Integer count = mDepthOutputFormats.get(config.getFormat());
-
- if (count == null) {
- count = 0;
- }
-
- mDepthOutputFormats.put(config.getFormat(), count + 1);
+ mDepthOutputFormats.put(config.getFormat(),
+ mDepthOutputFormats.get(config.getFormat()) + 1);
}
- if (!mOutputFormats.containsKey(HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED)) {
+ if (mOutputFormats.indexOfKey(HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED) < 0) {
throw new AssertionError(
"At least one stream configuration for IMPLEMENTATION_DEFINED must exist");
}
@@ -241,7 +252,7 @@ public final class StreamConfigurationMap {
* @return a non-empty array of sizes, or {@code null} if the format was not available.
*/
public Size[] getInputSizes(final int format) {
- return getPublicFormatSizes(format, /*output*/false);
+ return getPublicFormatSizes(format, /*output*/false, /*highRes*/false);
}
/**
@@ -274,9 +285,9 @@ public final class StreamConfigurationMap {
int internalFormat = imageFormatToInternal(format);
int dataspace = imageFormatToDataspace(format);
if (dataspace == HAL_DATASPACE_DEPTH) {
- return mDepthOutputFormats.containsKey(internalFormat);
+ return mDepthOutputFormats.indexOfKey(internalFormat) >= 0;
} else {
- return getFormatsMap(/*output*/true).containsKey(internalFormat);
+ return getFormatsMap(/*output*/true).indexOfKey(internalFormat) >= 0;
}
}
@@ -378,27 +389,24 @@ public final class StreamConfigurationMap {
public boolean isOutputSupportedFor(Surface surface) {
checkNotNull(surface, "surface must not be null");
- Size surfaceSize;
- int surfaceFormat = -1;
- try {
- surfaceSize = LegacyCameraDevice.getSurfaceSize(surface);
- surfaceFormat = LegacyCameraDevice.detectSurfaceType(surface);
- } catch(BufferQueueAbandonedException e) {
- throw new IllegalArgumentException("Abandoned surface", e);
- }
+ Size surfaceSize = SurfaceUtils.getSurfaceSize(surface);
+ int surfaceFormat = SurfaceUtils.getSurfaceFormat(surface);
+ int surfaceDataspace = SurfaceUtils.getSurfaceDataspace(surface);
// See if consumer is flexible.
- boolean isFlexible = LegacyCameraDevice.isFlexibleConsumer(surface);
+ boolean isFlexible = SurfaceUtils.isFlexibleConsumer(surface);
// Override RGB formats to IMPLEMENTATION_DEFINED, b/9487482
if ((surfaceFormat >= LegacyMetadataMapper.HAL_PIXEL_FORMAT_RGBA_8888 &&
surfaceFormat <= LegacyMetadataMapper.HAL_PIXEL_FORMAT_BGRA_8888)) {
- surfaceFormat = LegacyMetadataMapper.HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED;
+ surfaceFormat = HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED;
}
- for (StreamConfiguration config : mConfigurations) {
+ StreamConfiguration[] configs =
+ surfaceDataspace != HAL_DATASPACE_DEPTH ? mConfigurations : mDepthConfigurations;
+ for (StreamConfiguration config : configs) {
if (config.getFormat() == surfaceFormat && config.isOutput()) {
- // Mathing format, either need exact size match, or a flexible consumer
+ // Matching format, either need exact size match, or a flexible consumer
// and a size no bigger than MAX_DIMEN_FOR_ROUNDING
if (config.getSize().equals(surfaceSize)) {
return true;
@@ -414,12 +422,12 @@ public final class StreamConfigurationMap {
/**
* Get a list of sizes compatible with {@code klass} to use as an output.
*
- * <p>Since some of the supported classes may support additional formats beyond
+ * <p>Some of the supported classes may support additional formats beyond
* {@link ImageFormat#PRIVATE}; this function only returns
* sizes for {@link ImageFormat#PRIVATE}. For example, {@link android.media.ImageReader}
* supports {@link ImageFormat#YUV_420_888} and {@link ImageFormat#PRIVATE}, this method will
* only return the sizes for {@link ImageFormat#PRIVATE} for {@link android.media.ImageReader}
- * class .</p>
+ * class.</p>
*
* <p>If a well-defined format such as {@code NV21} is required, use
* {@link #getOutputSizes(int)} instead.</p>
@@ -444,7 +452,7 @@ public final class StreamConfigurationMap {
}
return getInternalFormatSizes(HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED,
- HAL_DATASPACE_UNKNOWN,/*output*/true);
+ HAL_DATASPACE_UNKNOWN,/*output*/true, /*highRes*/false);
}
/**
@@ -453,6 +461,14 @@ public final class StreamConfigurationMap {
* <p>The {@code format} should be a supported format (one of the formats returned by
* {@link #getOutputFormats}).</p>
*
+ * As of API level 23, the {@link #getHighResolutionOutputSizes} method can be used on devices
+ * that support the
+ * {@link android.hardware.camera2.CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES_BURST_CAPTURE BURST_CAPTURE}
+ * capability to get a list of high-resolution output sizes that cannot operate at the preferred
+ * 20fps rate. This means that for some supported formats, this method will return an empty
+ * list, if all the supported resolutions operate at below 20fps. For devices that do not
+ * support the BURST_CAPTURE capability, all output resolutions are listed through this method.
+ *
* @param format an image format from {@link ImageFormat} or {@link PixelFormat}
* @return
* an array of supported sizes,
@@ -463,7 +479,7 @@ public final class StreamConfigurationMap {
* @see #getOutputFormats
*/
public Size[] getOutputSizes(int format) {
- return getPublicFormatSizes(format, /*output*/true);
+ return getPublicFormatSizes(format, /*output*/true, /*highRes*/ false);
}
/**
@@ -616,6 +632,32 @@ public final class StreamConfigurationMap {
}
/**
+ * Get a list of supported high resolution sizes, which cannot operate at full BURST_CAPTURE
+ * rate.
+ *
+ * <p>This includes all output sizes that cannot meet the 20 fps frame rate requirements for the
+ * {@link android.hardware.camera2.CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES_BURST_CAPTURE BURST_CAPTURE}
+ * capability. This does not include the stall duration, so for example, a JPEG or RAW16 output
+ * resolution with a large stall duration but a minimum frame duration that's above 20 fps will
+ * still be listed in the regular {@link #getOutputSizes} list. All the sizes on this list are
+ * still guaranteed to operate at a rate of at least 10 fps, not including stall duration.</p>
+ *
+ * <p>For a device that does not support the BURST_CAPTURE capability, this list will be
+ * {@code null}, since resolutions in the {@link #getOutputSizes} list are already not
+ * guaranteed to meet &gt;= 20 fps rate requirements. For a device that does support the
+ * BURST_CAPTURE capability, this list may be empty, if all supported resolutions meet the 20
+ * fps requirement.</p>
+ *
+ * @return an array of supported slower high-resolution sizes, or {@code null} if the
+ * BURST_CAPTURE capability is not supported
+ */
+ public Size[] getHighResolutionOutputSizes(int format) {
+ if (!mListHighResolution) return null;
+
+ return getPublicFormatSizes(format, /*output*/true, /*highRes*/ true);
+ }
+
+ /**
* Get the minimum {@link CaptureRequest#SENSOR_FRAME_DURATION frame duration}
* for the format/size combination (in nanoseconds).
*
@@ -867,6 +909,7 @@ public final class StreamConfigurationMap {
return Arrays.equals(mConfigurations, other.mConfigurations) &&
Arrays.equals(mMinFrameDurations, other.mMinFrameDurations) &&
Arrays.equals(mStallDurations, other.mStallDurations) &&
+ Arrays.equals(mDepthConfigurations, other.mDepthConfigurations) &&
Arrays.equals(mHighSpeedVideoConfigurations,
other.mHighSpeedVideoConfigurations);
}
@@ -879,18 +922,31 @@ public final class StreamConfigurationMap {
@Override
public int hashCode() {
// XX: do we care about order?
- return HashCodeHelpers.hashCode(
+ return HashCodeHelpers.hashCodeGeneric(
mConfigurations, mMinFrameDurations,
- mStallDurations, mHighSpeedVideoConfigurations);
+ mStallDurations,
+ mDepthConfigurations, mHighSpeedVideoConfigurations);
}
// Check that the argument is supported by #getOutputFormats or #getInputFormats
private int checkArgumentFormatSupported(int format, boolean output) {
checkArgumentFormat(format);
- int[] formats = output ? getOutputFormats() : getInputFormats();
- for (int i = 0; i < formats.length; ++i) {
- if (format == formats[i]) {
+ int internalFormat = imageFormatToInternal(format);
+ int internalDataspace = imageFormatToDataspace(format);
+
+ if (output) {
+ if (internalDataspace == HAL_DATASPACE_DEPTH) {
+ if (mDepthOutputFormats.indexOfKey(internalFormat) >= 0) {
+ return format;
+ }
+ } else {
+ if (mAllOutputFormats.indexOfKey(internalFormat) >= 0) {
+ return format;
+ }
+ }
+ } else {
+ if (mInputFormats.indexOfKey(internalFormat) >= 0) {
return format;
}
}
@@ -1175,7 +1231,7 @@ public final class StreamConfigurationMap {
return formats;
}
- private Size[] getPublicFormatSizes(int format, boolean output) {
+ private Size[] getPublicFormatSizes(int format, boolean output, boolean highRes) {
try {
checkArgumentFormatSupported(format, output);
} catch (IllegalArgumentException e) {
@@ -1185,36 +1241,57 @@ public final class StreamConfigurationMap {
int internalFormat = imageFormatToInternal(format);
int dataspace = imageFormatToDataspace(format);
- return getInternalFormatSizes(internalFormat, dataspace, output);
+ return getInternalFormatSizes(internalFormat, dataspace, output, highRes);
}
- private Size[] getInternalFormatSizes(int format, int dataspace, boolean output) {
-
- HashMap<Integer, Integer> formatsMap =
- (dataspace == HAL_DATASPACE_DEPTH) ? mDepthOutputFormats : getFormatsMap(output);
-
- Integer sizesCount = formatsMap.get(format);
- if (sizesCount == null) {
+ private Size[] getInternalFormatSizes(int format, int dataspace,
+ boolean output, boolean highRes) {
+ SparseIntArray formatsMap =
+ !output ? mInputFormats :
+ dataspace == HAL_DATASPACE_DEPTH ? mDepthOutputFormats :
+ highRes ? mHighResOutputFormats :
+ mOutputFormats;
+
+ int sizesCount = formatsMap.get(format);
+ if ( ((!output || dataspace == HAL_DATASPACE_DEPTH) && sizesCount == 0) ||
+ (output && dataspace != HAL_DATASPACE_DEPTH && mAllOutputFormats.get(format) == 0)) {
+ // Only throw if this is really not supported at all
throw new IllegalArgumentException("format not available");
}
- int len = sizesCount;
- Size[] sizes = new Size[len];
+ Size[] sizes = new Size[sizesCount];
int sizeIndex = 0;
StreamConfiguration[] configurations =
(dataspace == HAL_DATASPACE_DEPTH) ? mDepthConfigurations : mConfigurations;
-
for (StreamConfiguration config : configurations) {
- if (config.getFormat() == format && config.isOutput() == output) {
+ int fmt = config.getFormat();
+ if (fmt == format && config.isOutput() == output) {
+ if (output) {
+ // Filter slow high-res output formats; include for
+ // highRes, remove for !highRes
+ long duration = 0;
+ for (int i = 0; i < mMinFrameDurations.length; i++) {
+ StreamConfigurationDuration d = mMinFrameDurations[i];
+ if (d.getFormat() == fmt &&
+ d.getWidth() == config.getSize().getWidth() &&
+ d.getHeight() == config.getSize().getHeight()) {
+ duration = d.getDuration();
+ break;
+ }
+ }
+ if (highRes != (duration > DURATION_20FPS_NS)) {
+ continue;
+ }
+ }
sizes[sizeIndex++] = config.getSize();
}
}
- if (sizeIndex != len) {
+ if (sizeIndex != sizesCount) {
throw new AssertionError(
- "Too few sizes (expected " + len + ", actual " + sizeIndex + ")");
+ "Too few sizes (expected " + sizesCount + ", actual " + sizeIndex + ")");
}
return sizes;
@@ -1226,14 +1303,16 @@ public final class StreamConfigurationMap {
int i = 0;
- for (int format : getFormatsMap(output).keySet()) {
+ SparseIntArray map = getFormatsMap(output);
+ for (int j = 0; j < map.size(); j++) {
+ int format = map.keyAt(j);
if (format != HAL_PIXEL_FORMAT_RAW_OPAQUE) {
formats[i++] = imageFormatToPublic(format);
}
}
if (output) {
- for (int format : mDepthOutputFormats.keySet()) {
- formats[i++] = depthFormatToPublic(format);
+ for (int j = 0; j < mDepthOutputFormats.size(); j++) {
+ formats[i++] = depthFormatToPublic(mDepthOutputFormats.keyAt(j));
}
}
if (formats.length != i) {
@@ -1244,14 +1323,14 @@ public final class StreamConfigurationMap {
}
/** Get the format -> size count map for either output or input formats */
- private HashMap<Integer, Integer> getFormatsMap(boolean output) {
- return output ? mOutputFormats : mInputFormats;
+ private SparseIntArray getFormatsMap(boolean output) {
+ return output ? mAllOutputFormats : mInputFormats;
}
private long getInternalFormatDuration(int format, int dataspace, Size size, int duration) {
// assume format is already checked, since its internal
- if (!arrayContains(getInternalFormatSizes(format, dataspace, /*output*/true), size)) {
+ if (!isSupportedInternalConfiguration(format, dataspace, size)) {
throw new IllegalArgumentException("size was not supported");
}
@@ -1289,10 +1368,9 @@ public final class StreamConfigurationMap {
/** Count the number of publicly-visible output formats */
private int getPublicFormatCount(boolean output) {
- HashMap<Integer, Integer> formatsMap = getFormatsMap(output);
-
+ SparseIntArray formatsMap = getFormatsMap(output);
int size = formatsMap.size();
- if (formatsMap.containsKey(HAL_PIXEL_FORMAT_RAW_OPAQUE)) {
+ if (formatsMap.indexOfKey(HAL_PIXEL_FORMAT_RAW_OPAQUE) >= 0) {
size -= 1;
}
if (output) {
@@ -1316,6 +1394,21 @@ public final class StreamConfigurationMap {
return false;
}
+ private boolean isSupportedInternalConfiguration(int format, int dataspace,
+ Size size) {
+ StreamConfiguration[] configurations =
+ (dataspace == HAL_DATASPACE_DEPTH) ? mDepthConfigurations : mConfigurations;
+
+ for (int i = 0; i < configurations.length; i++) {
+ if (configurations[i].getFormat() == format &&
+ configurations[i].getSize().equals(size)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
/**
* Return this {@link StreamConfigurationMap} as a string representation.
*
@@ -1351,6 +1444,8 @@ public final class StreamConfigurationMap {
StringBuilder sb = new StringBuilder("StreamConfiguration(");
appendOutputsString(sb);
sb.append(", ");
+ appendHighResOutputsString(sb);
+ sb.append(", ");
appendInputsString(sb);
sb.append(", ");
appendValidOutputFormatsForInputString(sb);
@@ -1381,6 +1476,27 @@ public final class StreamConfigurationMap {
sb.append(")");
}
+ private void appendHighResOutputsString(StringBuilder sb) {
+ sb.append("HighResolutionOutputs(");
+ int[] formats = getOutputFormats();
+ for (int format : formats) {
+ Size[] sizes = getHighResolutionOutputSizes(format);
+ if (sizes == null) continue;
+ for (Size size : sizes) {
+ long minFrameDuration = getOutputMinFrameDuration(format, size);
+ long stallDuration = getOutputStallDuration(format, size);
+ sb.append(String.format("[w:%d, h:%d, format:%s(%d), min_duration:%d, " +
+ "stall:%d], ", size.getWidth(), size.getHeight(), formatToString(format),
+ format, minFrameDuration, stallDuration));
+ }
+ }
+ // Remove the pending ", "
+ if (sb.charAt(sb.length() - 1) == ' ') {
+ sb.delete(sb.length() - 2, sb.length());
+ }
+ sb.append(")");
+ }
+
private void appendInputsString(StringBuilder sb) {
sb.append("Inputs(");
int[] formats = getInputFormats();
@@ -1479,15 +1595,21 @@ public final class StreamConfigurationMap {
}
// from system/core/include/system/graphics.h
+ private static final int HAL_PIXEL_FORMAT_RAW16 = 0x20;
private static final int HAL_PIXEL_FORMAT_BLOB = 0x21;
private static final int HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED = 0x22;
+ private static final int HAL_PIXEL_FORMAT_YCbCr_420_888 = 0x23;
private static final int HAL_PIXEL_FORMAT_RAW_OPAQUE = 0x24;
+ private static final int HAL_PIXEL_FORMAT_RAW10 = 0x25;
+ private static final int HAL_PIXEL_FORMAT_RAW12 = 0x26;
private static final int HAL_PIXEL_FORMAT_Y16 = 0x20363159;
+
private static final int HAL_DATASPACE_UNKNOWN = 0x0;
private static final int HAL_DATASPACE_JFIF = 0x101;
private static final int HAL_DATASPACE_DEPTH = 0x1000;
+ private static final long DURATION_20FPS_NS = 50000000L;
/**
* @see #getDurations(int, int)
*/
@@ -1505,15 +1627,20 @@ public final class StreamConfigurationMap {
private final HighSpeedVideoConfiguration[] mHighSpeedVideoConfigurations;
private final ReprocessFormatsMap mInputOutputFormatsMap;
- /** ImageFormat -> num output sizes mapping */
- private final HashMap</*ImageFormat*/Integer, /*Count*/Integer> mOutputFormats =
- new HashMap<Integer, Integer>();
- /** ImageFormat -> num input sizes mapping */
- private final HashMap</*ImageFormat*/Integer, /*Count*/Integer> mInputFormats =
- new HashMap<Integer, Integer>();
- /** ImageFormat -> num depth output sizes mapping */
- private final HashMap</*ImageFormat*/Integer, /*Count*/Integer> mDepthOutputFormats =
- new HashMap<Integer, Integer>();
+ private final boolean mListHighResolution;
+
+ /** internal format -> num output sizes mapping, not including slow high-res sizes, for
+ * non-depth dataspaces */
+ private final SparseIntArray mOutputFormats = new SparseIntArray();
+ /** internal format -> num output sizes mapping for slow high-res sizes, for non-depth
+ * dataspaces */
+ private final SparseIntArray mHighResOutputFormats = new SparseIntArray();
+ /** internal format -> num output sizes mapping for all non-depth dataspaces */
+ private final SparseIntArray mAllOutputFormats = new SparseIntArray();
+ /** internal format -> num input sizes mapping, for input reprocessing formats */
+ private final SparseIntArray mInputFormats = new SparseIntArray();
+ /** internal format -> num depth output sizes mapping, for HAL_DATASPACE_DEPTH */
+ private final SparseIntArray mDepthOutputFormats = new SparseIntArray();
/** High speed video Size -> FPS range count mapping*/
private final HashMap</*HighSpeedVideoSize*/Size, /*Count*/Integer> mHighSpeedVideoSizeMap =
new HashMap<Size, Integer>();
@@ -1522,4 +1649,3 @@ public final class StreamConfigurationMap {
mHighSpeedVideoFpsRangeMap = new HashMap<Range<Integer>, Integer>();
}
-
diff --git a/core/java/android/hardware/camera2/params/TonemapCurve.java b/core/java/android/hardware/camera2/params/TonemapCurve.java
index 398a7e91a53d..2d7bbaa21c54 100644
--- a/core/java/android/hardware/camera2/params/TonemapCurve.java
+++ b/core/java/android/hardware/camera2/params/TonemapCurve.java
@@ -277,7 +277,7 @@ public final class TonemapCurve {
return mHashCode;
}
- mHashCode = HashCodeHelpers.hashCode(mRed, mGreen, mBlue);
+ mHashCode = HashCodeHelpers.hashCodeGeneric(mRed, mGreen, mBlue);
mHashCalculated = true;
return mHashCode;
diff --git a/core/java/android/hardware/camera2/utils/HashCodeHelpers.java b/core/java/android/hardware/camera2/utils/HashCodeHelpers.java
index 7b4aa09f86ff..731da8b6a721 100644
--- a/core/java/android/hardware/camera2/utils/HashCodeHelpers.java
+++ b/core/java/android/hardware/camera2/utils/HashCodeHelpers.java
@@ -30,7 +30,7 @@ public final class HashCodeHelpers {
*
* @return the numeric hash code
*/
- public static int hashCode(int[] array) {
+ public static int hashCode(int... array) {
if (array == null) {
return 0;
}
@@ -60,7 +60,7 @@ public final class HashCodeHelpers {
*
* @return the numeric hash code
*/
- public static int hashCode(float[] array) {
+ public static int hashCode(float... array) {
if (array == null) {
return 0;
}
@@ -83,7 +83,7 @@ public final class HashCodeHelpers {
*
* @return the numeric hash code
*/
- public static <T> int hashCode(T[] array) {
+ public static <T> int hashCodeGeneric(T... array) {
if (array == null) {
return 0;
}
@@ -97,56 +97,4 @@ public final class HashCodeHelpers {
return h;
}
- public static <T> int hashCode(T a) {
- return (a == null) ? 0 : a.hashCode();
- }
-
- public static <T> int hashCode(T a, T b) {
- int h = hashCode(a);
-
- int x = (b == null) ? 0 : b.hashCode();
- h = ((h << 5) - h) ^ x; // (h * 31) XOR x
-
- return h;
- }
-
- public static <T> int hashCode(T a, T b, T c) {
- int h = hashCode(a, b);
-
- int x = (c == null) ? 0 : c.hashCode();
- h = ((h << 5) - h) ^ x; // (h * 31) XOR x
-
- return h;
- }
-
- public static <T> int hashCode(T a, T b, T c, T d) {
- int h = hashCode(a, b, c);
-
- int x = (d == null) ? 0 : d.hashCode();
- h = ((h << 5) - h) ^ x; // (h * 31) XOR x
-
- return h;
- }
-
- public static int hashCode(int x) {
- return hashCode(new int[] { x } );
- }
-
- public static int hashCode(int x, int y) {
- return hashCode(new int[] { x, y } );
- }
-
- public static int hashCode(int x, int y, int z) {
- return hashCode(new int[] { x, y, z } );
- }
-
- public static int hashCode(int x, int y, int z, int w) {
- return hashCode(new int[] { x, y, z, w } );
- }
-
- public static int hashCode(int x, int y, int z, int w, int t) {
- return hashCode(new int[] { x, y, z, w, t } );
- }
-
-
}
diff --git a/core/java/android/hardware/camera2/utils/SurfaceUtils.java b/core/java/android/hardware/camera2/utils/SurfaceUtils.java
index 40005a5be0f3..064b21a4254c 100644
--- a/core/java/android/hardware/camera2/utils/SurfaceUtils.java
+++ b/core/java/android/hardware/camera2/utils/SurfaceUtils.java
@@ -79,4 +79,30 @@ public class SurfaceUtils {
throw new IllegalArgumentException("Surface was abandoned", e);
}
}
+
+ /**
+ * Get the Surface dataspace.
+ *
+ * @param surface The surface to be queried for dataspace.
+ * @return dataspace of the surface.
+ *
+ * @throws IllegalArgumentException if the surface is already abandoned.
+ */
+ public static int getSurfaceDataspace(Surface surface) {
+ try {
+ return LegacyCameraDevice.detectSurfaceDataspace(surface);
+ } catch (BufferQueueAbandonedException e) {
+ throw new IllegalArgumentException("Surface was abandoned", e);
+ }
+ }
+
+ /**
+ * Return true is the consumer is one of the consumers that can accept
+ * producer overrides of the default dimensions and format.
+ *
+ */
+ public static boolean isFlexibleConsumer(Surface output) {
+ return LegacyCameraDevice.isFlexibleConsumer(output);
+ }
+
}
diff --git a/core/java/android/net/ConnectivityManager.java b/core/java/android/net/ConnectivityManager.java
index b9f7365d8ce5..04a29aafe7d2 100644
--- a/core/java/android/net/ConnectivityManager.java
+++ b/core/java/android/net/ConnectivityManager.java
@@ -2110,6 +2110,8 @@ public class ConnectivityManager {
* can automatically log in to a captive portal without user intervention.
*
* @param network The {@link Network} of the network that is being evaluated.
+ *
+ * @hide
*/
public void onPreCheck(Network network) {}
diff --git a/core/java/android/net/NetworkCapabilities.java b/core/java/android/net/NetworkCapabilities.java
index cf747cf0379f..bf94b25924f1 100644
--- a/core/java/android/net/NetworkCapabilities.java
+++ b/core/java/android/net/NetworkCapabilities.java
@@ -173,7 +173,6 @@ public final class NetworkCapabilities implements Parcelable {
* Indicates that connectivity on this network was successfully validated. For example, for a
* network with NET_CAPABILITY_INTERNET, it means that Internet connectivity was successfully
* detected.
- * @hide
*/
public static final int NET_CAPABILITY_VALIDATED = 16;
diff --git a/core/java/android/os/StrictMode.java b/core/java/android/os/StrictMode.java
index 1cc2d334c477..f10b982af750 100644
--- a/core/java/android/os/StrictMode.java
+++ b/core/java/android/os/StrictMode.java
@@ -1919,9 +1919,9 @@ public final class StrictMode {
for (int i = 0; i < numViolations; ++i) {
if (LOG_V) Log.d(TAG, "strict mode violation stacks read from binder call. i=" + i);
ViolationInfo info = new ViolationInfo(p, !currentlyGathering);
- if (info.crashInfo.stackTrace != null && info.crashInfo.stackTrace.length() > 10000) {
+ if (info.crashInfo.stackTrace != null && info.crashInfo.stackTrace.length() > 30000) {
String front = info.crashInfo.stackTrace.substring(256);
- // 10000 characters is way too large for this to be any sane kind of
+ // 30000 characters is way too large for this to be any sane kind of
// strict mode collection of stacks. We've had a problem where we leave
// strict mode violations associated with the thread, and it keeps tacking
// more and more stacks on to the violations. Looks like we're in this casse,
diff --git a/core/java/android/os/UserManager.java b/core/java/android/os/UserManager.java
index 00350ec92a36..9770941babc4 100644
--- a/core/java/android/os/UserManager.java
+++ b/core/java/android/os/UserManager.java
@@ -449,6 +449,22 @@ public class UserManager {
public static final String DISALLOW_RECORD_AUDIO = "no_record_audio";
/**
+ * This user restriction has an effect only in a managed profile.
+ * If set:
+ * Intent filters of activities in the parent profile with action
+ * {@link android.content.Intent#ACTION_VIEW},
+ * category {@link android.content.Intent#CATEGORY_BROWSABLE}, scheme http or https, and which
+ * define a host can handle intents from the managed profile.
+ * The default value is <code>false</code>.
+ *
+ * <p/>Key for user restrictions.
+ * <p/>Type: Boolean
+ * @see #setUserRestrictions(Bundle)
+ * @see #getUserRestrictions()
+ */
+ public static final String ALLOW_PARENT_APP_LINKING = "allow_parent_app_linking";
+
+ /**
* Application restriction key that is used to indicate the pending arrival
* of real restrictions for the app.
*
diff --git a/core/java/android/os/storage/VolumeInfo.java b/core/java/android/os/storage/VolumeInfo.java
index 8d115279291b..e33baa9ebdda 100644
--- a/core/java/android/os/storage/VolumeInfo.java
+++ b/core/java/android/os/storage/VolumeInfo.java
@@ -137,6 +137,7 @@ public class VolumeInfo implements Parcelable {
public final String id;
public final int type;
public final DiskInfo disk;
+ public final String partGuid;
public int mountFlags = 0;
public int mountUserId = -1;
public int state = STATE_UNMOUNTED;
@@ -149,10 +150,11 @@ public class VolumeInfo implements Parcelable {
/** Framework state */
public final int mtpIndex;
- public VolumeInfo(String id, int type, DiskInfo disk, int mtpIndex) {
+ public VolumeInfo(String id, int type, DiskInfo disk, String partGuid, int mtpIndex) {
this.id = Preconditions.checkNotNull(id);
this.type = type;
this.disk = disk;
+ this.partGuid = partGuid;
this.mtpIndex = mtpIndex;
}
@@ -164,6 +166,7 @@ public class VolumeInfo implements Parcelable {
} else {
disk = null;
}
+ partGuid = parcel.readString();
mountFlags = parcel.readInt();
mountUserId = parcel.readInt();
state = parcel.readInt();
@@ -385,6 +388,7 @@ public class VolumeInfo implements Parcelable {
pw.increaseIndent();
pw.printPair("type", DebugUtils.valueToString(getClass(), "TYPE_", type));
pw.printPair("diskId", getDiskId());
+ pw.printPair("partGuid", partGuid);
pw.printPair("mountFlags", DebugUtils.flagsToString(getClass(), "MOUNT_FLAG_", mountFlags));
pw.printPair("mountUserId", mountUserId);
pw.printPair("state", DebugUtils.valueToString(getClass(), "STATE_", state));
@@ -453,6 +457,7 @@ public class VolumeInfo implements Parcelable {
} else {
parcel.writeInt(0);
}
+ parcel.writeString(partGuid);
parcel.writeInt(mountFlags);
parcel.writeInt(mountUserId);
parcel.writeInt(state);
diff --git a/core/java/android/os/storage/VolumeRecord.java b/core/java/android/os/storage/VolumeRecord.java
index 096e2dd30cea..cb1630516a27 100644
--- a/core/java/android/os/storage/VolumeRecord.java
+++ b/core/java/android/os/storage/VolumeRecord.java
@@ -39,6 +39,7 @@ public class VolumeRecord implements Parcelable {
public final int type;
public final String fsUuid;
+ public String partGuid;
public String nickname;
public int userFlags;
@@ -50,6 +51,7 @@ public class VolumeRecord implements Parcelable {
public VolumeRecord(Parcel parcel) {
type = parcel.readInt();
fsUuid = parcel.readString();
+ partGuid = parcel.readString();
nickname = parcel.readString();
userFlags = parcel.readInt();
}
@@ -79,6 +81,8 @@ public class VolumeRecord implements Parcelable {
pw.increaseIndent();
pw.printPair("type", DebugUtils.valueToString(VolumeInfo.class, "TYPE_", type));
pw.printPair("fsUuid", fsUuid);
+ pw.printPair("partGuid", partGuid);
+ pw.println();
pw.printPair("nickname", nickname);
pw.printPair("userFlags",
DebugUtils.flagsToString(VolumeRecord.class, "USER_FLAG_", userFlags));
@@ -133,6 +137,7 @@ public class VolumeRecord implements Parcelable {
public void writeToParcel(Parcel parcel, int flags) {
parcel.writeInt(type);
parcel.writeString(fsUuid);
+ parcel.writeString(partGuid);
parcel.writeString(nickname);
parcel.writeInt(userFlags);
}
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 56cd1a741f10..9b5fbfaf562a 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -6685,6 +6685,17 @@ public final class Settings {
"wifi_mobile_data_transition_wakelock_timeout_ms";
/**
+ * This setting controls whether WiFi configurations created by a Device Owner app
+ * should be locked down (that is, be editable or removable only by the Device Owner App,
+ * not even by Settings app).
+ * This setting takes integer values. Non-zero values mean DO created configurations
+ * are locked down. Value of zero means they are not. Default value in the absence of
+ * actual value to this setting is 0.
+ */
+ public static final String WIFI_DEVICE_OWNER_CONFIGS_LOCKDOWN =
+ "wifi_device_owner_configs_lockdown";
+
+ /**
* The operational wifi frequency band
* Set to one of {@link WifiManager#WIFI_FREQUENCY_BAND_AUTO},
* {@link WifiManager#WIFI_FREQUENCY_BAND_5GHZ} or
diff --git a/core/java/android/text/TextUtils.java b/core/java/android/text/TextUtils.java
index d51aa7939c3d..d8f7158cb69d 100644
--- a/core/java/android/text/TextUtils.java
+++ b/core/java/android/text/TextUtils.java
@@ -465,6 +465,11 @@ public class TextUtils {
return false;
}
+ /** {@hide} */
+ public static String nullIfEmpty(@Nullable String str) {
+ return isEmpty(str) ? null : str;
+ }
+
/**
* Returns the length that the specified CharSequence would have if
* spaces and control characters were trimmed from the start and end,
diff --git a/core/java/android/text/format/Formatter.java b/core/java/android/text/format/Formatter.java
index 13a959e6fcdd..47d5c7982d0a 100644
--- a/core/java/android/text/format/Formatter.java
+++ b/core/java/android/text/format/Formatter.java
@@ -16,6 +16,7 @@
package android.text.format;
+import android.annotation.Nullable;
import android.content.Context;
import android.content.res.Resources;
import android.net.NetworkUtils;
@@ -52,7 +53,10 @@ public final class Formatter {
* @param sizeBytes size value to be formatted, in bytes
* @return formatted string with the number
*/
- public static String formatFileSize(Context context, long sizeBytes) {
+ public static String formatFileSize(@Nullable Context context, long sizeBytes) {
+ if (context == null) {
+ return "";
+ }
final BytesResult res = formatBytes(context.getResources(), sizeBytes, 0);
return context.getString(com.android.internal.R.string.fileSizeSuffix,
res.value, res.units);
@@ -62,7 +66,10 @@ public final class Formatter {
* Like {@link #formatFileSize}, but trying to generate shorter numbers
* (showing fewer digits of precision).
*/
- public static String formatShortFileSize(Context context, long sizeBytes) {
+ public static String formatShortFileSize(@Nullable Context context, long sizeBytes) {
+ if (context == null) {
+ return "";
+ }
final BytesResult res = formatBytes(context.getResources(), sizeBytes, FLAG_SHORTER);
return context.getString(com.android.internal.R.string.fileSizeSuffix,
res.value, res.units);
diff --git a/core/java/android/util/Range.java b/core/java/android/util/Range.java
index 211d01a9e2ef..55245065c082 100644
--- a/core/java/android/util/Range.java
+++ b/core/java/android/util/Range.java
@@ -350,7 +350,7 @@ public final class Range<T extends Comparable<? super T>> {
*/
@Override
public int hashCode() {
- return HashCodeHelpers.hashCode(mLower, mUpper);
+ return HashCodeHelpers.hashCodeGeneric(mLower, mUpper);
}
private final T mLower;
diff --git a/core/java/android/view/MotionEvent.java b/core/java/android/view/MotionEvent.java
index 4394cd8dea30..6026d04a1f21 100644
--- a/core/java/android/view/MotionEvent.java
+++ b/core/java/android/view/MotionEvent.java
@@ -1399,6 +1399,7 @@ public final class MotionEvent extends InputEvent implements Parcelable {
private static native int nativeGetButtonState(long nativePtr);
private static native void nativeSetButtonState(long nativePtr, int buttonState);
private static native int nativeGetActionButton(long nativePtr);
+ private static native void nativeSetActionButton(long nativePtr, int actionButton);
private static native void nativeOffsetLocation(long nativePtr, float deltaX, float deltaY);
private static native float nativeGetXOffset(long nativePtr);
private static native float nativeGetYOffset(long nativePtr);
@@ -2284,6 +2285,16 @@ public final class MotionEvent extends InputEvent implements Parcelable {
}
/**
+ * Sets the action button for the event.
+ *
+ * @see #getActionButton()
+ * @hide
+ */
+ public final void setActionButton(int button) {
+ nativeSetActionButton(mNativePtr, button);
+ }
+
+ /**
* Returns the original raw X coordinate of this event. For touch
* events on the screen, this is the original location of the event
* on the screen, before it had been adjusted for the containing window
diff --git a/core/java/android/view/SurfaceControl.java b/core/java/android/view/SurfaceControl.java
index 40745292542e..5970c3f738a0 100644
--- a/core/java/android/view/SurfaceControl.java
+++ b/core/java/android/view/SurfaceControl.java
@@ -453,6 +453,19 @@ public class SurfaceControl {
}
}
+ /**
+ * Sets the security of the surface. Setting the flag is equivalent to creating the
+ * Surface with the {@link #SECURE} flag.
+ */
+ public void setSecure(boolean isSecure) {
+ checkNotReleased();
+ if (isSecure) {
+ nativeSetFlags(mNativeObject, SECURE, SECURE);
+ } else {
+ nativeSetFlags(mNativeObject, 0, SECURE);
+ }
+ }
+
/*
* set display parameters.
* needs to be inside open/closeTransaction block
diff --git a/core/java/android/view/accessibility/CaptioningManager.java b/core/java/android/view/accessibility/CaptioningManager.java
index 410d39cb18c4..14f0b0a06218 100644
--- a/core/java/android/view/accessibility/CaptioningManager.java
+++ b/core/java/android/view/accessibility/CaptioningManager.java
@@ -266,11 +266,19 @@ public class CaptioningManager {
* background colors, edge properties, and typeface.
*/
public static final class CaptionStyle {
- /** Packed value for a color of 'none' and a cached opacity of 100%. */
+ /**
+ * Packed value for a color of 'none' and a cached opacity of 100%.
+ *
+ * @hide
+ */
private static final int COLOR_NONE_OPAQUE = 0x000000FF;
- /** Packed value for an unspecified color and opacity. */
- private static final int COLOR_UNSPECIFIED = 0x000001FF;
+ /**
+ * Packed value for a color of 'default' and opacity of 100%.
+ *
+ * @hide
+ */
+ public static final int COLOR_UNSPECIFIED = 0x00FFFFFF;
private static final CaptionStyle WHITE_ON_BLACK;
private static final CaptionStyle BLACK_ON_WHITE;
@@ -350,11 +358,11 @@ public class CaptioningManager {
private CaptionStyle(int foregroundColor, int backgroundColor, int edgeType, int edgeColor,
int windowColor, String rawTypeface) {
- mHasForegroundColor = foregroundColor != COLOR_UNSPECIFIED;
- mHasBackgroundColor = backgroundColor != COLOR_UNSPECIFIED;
+ mHasForegroundColor = hasColor(foregroundColor);
+ mHasBackgroundColor = hasColor(backgroundColor);
mHasEdgeType = edgeType != EDGE_TYPE_UNSPECIFIED;
- mHasEdgeColor = edgeColor != COLOR_UNSPECIFIED;
- mHasWindowColor = windowColor != COLOR_UNSPECIFIED;
+ mHasEdgeColor = hasColor(edgeColor);
+ mHasWindowColor = hasColor(windowColor);
// Always use valid colors, even when no override is specified, to
// ensure backwards compatibility with apps targeting KitKat MR2.
@@ -368,6 +376,20 @@ public class CaptioningManager {
}
/**
+ * Returns whether a packed color indicates a non-default value.
+ *
+ * @param packedColor the packed color value
+ * @return {@code true} if a non-default value is specified
+ * @hide
+ */
+ public static boolean hasColor(int packedColor) {
+ // Matches the color packing code from Settings. "Default" packed
+ // colors are indicated by zero alpha and non-zero red/blue. The
+ // cached alpha value used by Settings is stored in green.
+ return (packedColor >>> 24) != 0 || (packedColor & 0xFFFF00) == 0;
+ }
+
+ /**
* Applies a caption style, overriding any properties that are specified
* in the overlay caption.
*
diff --git a/core/java/android/widget/RelativeLayout.java b/core/java/android/widget/RelativeLayout.java
index affc5daa35f7..339038eddf3f 100644
--- a/core/java/android/widget/RelativeLayout.java
+++ b/core/java/android/widget/RelativeLayout.java
@@ -522,7 +522,7 @@ public class RelativeLayout extends ViewGroup {
View baselineView = null;
LayoutParams baselineParams = null;
for (int i = 0; i < count; i++) {
- final View child = getChildAt(i);
+ final View child = views[i];
if (child.getVisibility() != GONE) {
final LayoutParams childParams = (LayoutParams) child.getLayoutParams();
if (baselineView == null || baselineParams == null
@@ -548,9 +548,9 @@ public class RelativeLayout extends ViewGroup {
if (offsetHorizontalAxis) {
for (int i = 0; i < count; i++) {
- View child = getChildAt(i);
+ final View child = views[i];
if (child.getVisibility() != GONE) {
- LayoutParams params = (LayoutParams) child.getLayoutParams();
+ final LayoutParams params = (LayoutParams) child.getLayoutParams();
final int[] rules = params.getRules(layoutDirection);
if (rules[CENTER_IN_PARENT] != 0 || rules[CENTER_HORIZONTAL] != 0) {
centerHorizontal(child, params, width);
@@ -578,9 +578,9 @@ public class RelativeLayout extends ViewGroup {
if (offsetVerticalAxis) {
for (int i = 0; i < count; i++) {
- View child = getChildAt(i);
+ final View child = views[i];
if (child.getVisibility() != GONE) {
- LayoutParams params = (LayoutParams) child.getLayoutParams();
+ final LayoutParams params = (LayoutParams) child.getLayoutParams();
final int[] rules = params.getRules(layoutDirection);
if (rules[CENTER_IN_PARENT] != 0 || rules[CENTER_VERTICAL] != 0) {
centerVertical(child, params, height);
@@ -607,9 +607,9 @@ public class RelativeLayout extends ViewGroup {
final int verticalOffset = contentBounds.top - top;
if (horizontalOffset != 0 || verticalOffset != 0) {
for (int i = 0; i < count; i++) {
- View child = getChildAt(i);
+ final View child = views[i];
if (child.getVisibility() != GONE && child != ignore) {
- LayoutParams params = (LayoutParams) child.getLayoutParams();
+ final LayoutParams params = (LayoutParams) child.getLayoutParams();
if (horizontalGravity) {
params.mLeft += horizontalOffset;
params.mRight += horizontalOffset;
@@ -626,9 +626,9 @@ public class RelativeLayout extends ViewGroup {
if (isLayoutRtl()) {
final int offsetWidth = myWidth - width;
for (int i = 0; i < count; i++) {
- View child = getChildAt(i);
+ final View child = views[i];
if (child.getVisibility() != GONE) {
- LayoutParams params = (LayoutParams) child.getLayoutParams();
+ final LayoutParams params = (LayoutParams) child.getLayoutParams();
params.mLeft -= offsetWidth;
params.mRight -= offsetWidth;
}
diff --git a/core/java/android/widget/Spinner.java b/core/java/android/widget/Spinner.java
index fdabe913e80a..6abd1293edd5 100644
--- a/core/java/android/widget/Spinner.java
+++ b/core/java/android/widget/Spinner.java
@@ -711,9 +711,7 @@ public class Spinner extends AbsSpinner implements OnClickListener {
lp = generateDefaultLayoutParams();
}
- if (addChild) {
- addViewInLayout(child, 0, lp);
- }
+ addViewInLayout(child, 0, lp);
child.setSelected(hasFocus());
if (mDisableChildrenWhenDisabled) {
@@ -743,6 +741,10 @@ public class Spinner extends AbsSpinner implements OnClickListener {
childRight = childLeft + width;
child.layout(childLeft, childTop, childRight, childBottom);
+
+ if (!addChild) {
+ removeViewInLayout(child);
+ }
}
@Override
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index f733eab42534..2d9a6279ca70 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -9443,10 +9443,12 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
public void onRtlPropertiesChanged(int layoutDirection) {
super.onRtlPropertiesChanged(layoutDirection);
- mTextDir = getTextDirectionHeuristic();
-
- if (mLayout != null) {
- checkForRelayout();
+ final TextDirectionHeuristic newTextDir = getTextDirectionHeuristic();
+ if (mTextDir != newTextDir) {
+ mTextDir = newTextDir;
+ if (mLayout != null) {
+ checkForRelayout();
+ }
}
}
diff --git a/core/java/com/android/internal/app/ChooserActivity.java b/core/java/com/android/internal/app/ChooserActivity.java
index 678e92b35db8..1b55557e8dd7 100644
--- a/core/java/com/android/internal/app/ChooserActivity.java
+++ b/core/java/com/android/internal/app/ChooserActivity.java
@@ -100,6 +100,10 @@ public class ChooserActivity extends ResolverActivity {
mChooserListAdapter.addServiceResults(sri.originalTarget, sri.resultTargets);
unbindService(sri.connection);
mServiceConnections.remove(sri.connection);
+ if (mServiceConnections.isEmpty()) {
+ mChooserHandler.removeMessages(CHOOSER_TARGET_SERVICE_WATCHDOG_TIMEOUT);
+ sendVoiceChoicesIfNeeded();
+ }
break;
case CHOOSER_TARGET_SERVICE_WATCHDOG_TIMEOUT:
@@ -107,6 +111,7 @@ public class ChooserActivity extends ResolverActivity {
Log.d(TAG, "CHOOSER_TARGET_SERVICE_WATCHDOG_TIMEOUT; unbinding services");
}
unbindRemainingServices();
+ sendVoiceChoicesIfNeeded();
break;
default:
@@ -384,6 +389,8 @@ public class ChooserActivity extends ResolverActivity {
+ WATCHDOG_TIMEOUT_MILLIS + "ms");
mChooserHandler.sendEmptyMessageDelayed(CHOOSER_TARGET_SERVICE_WATCHDOG_TIMEOUT,
WATCHDOG_TIMEOUT_MILLIS);
+ } else {
+ sendVoiceChoicesIfNeeded();
}
}
@@ -418,6 +425,10 @@ public class ChooserActivity extends ResolverActivity {
mChooserHandler.removeMessages(CHOOSER_TARGET_SERVICE_WATCHDOG_TIMEOUT);
}
+ void onSetupVoiceInteraction() {
+ // Do nothing. We'll send the voice stuff ourselves.
+ }
+
void onRefinementResult(TargetInfo selectedTarget, Intent matchingIntent) {
if (mRefinementResultReceiver != null) {
mRefinementResultReceiver.destroy();
@@ -956,6 +967,10 @@ public class ChooserActivity extends ResolverActivity {
if (DEBUG) Log.d(TAG, "onServiceDisconnected: " + name);
unbindService(this);
mServiceConnections.remove(this);
+ if (mServiceConnections.isEmpty()) {
+ mChooserHandler.removeMessages(CHOOSER_TARGET_SERVICE_WATCHDOG_TIMEOUT);
+ sendVoiceChoicesIfNeeded();
+ }
}
@Override
diff --git a/core/java/com/android/internal/app/ResolverActivity.java b/core/java/com/android/internal/app/ResolverActivity.java
index e14f0584a0b8..fe3ab9e49743 100644
--- a/core/java/com/android/internal/app/ResolverActivity.java
+++ b/core/java/com/android/internal/app/ResolverActivity.java
@@ -16,10 +16,17 @@
package com.android.internal.app;
+import android.annotation.Nullable;
import android.app.Activity;
import android.app.ActivityThread;
+import android.app.VoiceInteractor;
+import android.app.VoiceInteractor.PickOptionRequest;
+import android.app.VoiceInteractor.PickOptionRequest.Option;
+import android.app.VoiceInteractor.Prompt;
+import android.app.VoiceInteractor.Request;
import android.os.AsyncTask;
import android.provider.Settings;
+import android.service.chooser.ChooserTarget;
import android.text.TextUtils;
import android.util.Slog;
import android.widget.AbsListView;
@@ -96,6 +103,7 @@ public class ResolverActivity extends Activity {
private int mProfileSwitchMessageId = -1;
private final ArrayList<Intent> mIntents = new ArrayList<>();
private ResolverComparator mResolverComparator;
+ private PickTargetOptionRequest mPickOptionRequest;
private boolean mRegistered;
private final PackageMonitor mPackageMonitor = new PackageMonitor() {
@@ -242,6 +250,9 @@ public class ResolverActivity extends Activity {
finish();
}
});
+ if (isVoiceInteraction()) {
+ rdl.setCollapsed(false);
+ }
}
if (title == null) {
@@ -313,6 +324,39 @@ public class ResolverActivity extends Activity {
});
bindProfileView();
}
+
+ if (isVoiceInteraction()) {
+ onSetupVoiceInteraction();
+ }
+ }
+
+ /**
+ * Perform any initialization needed for voice interaction.
+ */
+ void onSetupVoiceInteraction() {
+ // Do it right now. Subclasses may delay this and send it later.
+ sendVoiceChoicesIfNeeded();
+ }
+
+ void sendVoiceChoicesIfNeeded() {
+ if (!isVoiceInteraction()) {
+ // Clearly not needed.
+ return;
+ }
+
+
+ final Option[] options = new Option[mAdapter.getCount()];
+ for (int i = 0, N = options.length; i < N; i++) {
+ options[i] = optionForChooserTarget(mAdapter.getItem(i), i);
+ }
+
+ mPickOptionRequest = new PickTargetOptionRequest(
+ new Prompt(getTitle()), options, null);
+ getVoiceInteractor().submitRequest(mPickOptionRequest);
+ }
+
+ Option optionForChooserTarget(TargetInfo target, int index) {
+ return new Option(target.getDisplayLabel(), index);
}
protected final void setAdditionalTargets(Intent[] intents) {
@@ -473,6 +517,14 @@ public class ResolverActivity extends Activity {
}
@Override
+ protected void onDestroy() {
+ super.onDestroy();
+ if (!isChangingConfigurations() && mPickOptionRequest != null) {
+ mPickOptionRequest.cancel();
+ }
+ }
+
+ @Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
if (mAlwaysUseOption) {
@@ -510,16 +562,12 @@ public class ResolverActivity extends Activity {
try {
ApplicationInfo appInfo = getPackageManager().getApplicationInfo(
resolveInfo.activityInfo.packageName, 0 /* default flags */);
- return versionNumberAtLeastL(appInfo.targetSdkVersion);
+ return appInfo.targetSdkVersion >= Build.VERSION_CODES.LOLLIPOP;
} catch (NameNotFoundException e) {
return false;
}
}
- private boolean versionNumberAtLeastL(int versionNumber) {
- return versionNumber >= Build.VERSION_CODES.LOLLIPOP;
- }
-
private void setAlwaysButtonEnabled(boolean hasValidSelection, int checkedPos,
boolean filtered) {
boolean enabled = false;
@@ -1644,4 +1692,39 @@ public class ResolverActivity extends Activity {
&& match <= IntentFilter.MATCH_CATEGORY_PATH;
}
+ static class PickTargetOptionRequest extends PickOptionRequest {
+ public PickTargetOptionRequest(@Nullable Prompt prompt, Option[] options,
+ @Nullable Bundle extras) {
+ super(prompt, options, extras);
+ }
+
+ @Override
+ public void onCancel() {
+ super.onCancel();
+ final ResolverActivity ra = (ResolverActivity) getActivity();
+ if (ra != null) {
+ ra.mPickOptionRequest = null;
+ ra.finish();
+ }
+ }
+
+ @Override
+ public void onPickOptionResult(boolean finished, Option[] selections, Bundle result) {
+ super.onPickOptionResult(finished, selections, result);
+ if (selections.length != 1) {
+ // TODO In a better world we would filter the UI presented here and let the
+ // user refine. Maybe later.
+ return;
+ }
+
+ final ResolverActivity ra = (ResolverActivity) getActivity();
+ if (ra != null) {
+ final TargetInfo ti = ra.mAdapter.getItem(selections[0].getIndex());
+ if (ra.onTargetSelected(ti, false)) {
+ ra.mPickOptionRequest = null;
+ ra.finish();
+ }
+ }
+ }
+ }
}
diff --git a/core/java/com/android/internal/statusbar/IStatusBarService.aidl b/core/java/com/android/internal/statusbar/IStatusBarService.aidl
index 663c838f4b11..aea1585ae517 100644
--- a/core/java/com/android/internal/statusbar/IStatusBarService.aidl
+++ b/core/java/com/android/internal/statusbar/IStatusBarService.aidl
@@ -19,6 +19,7 @@ package com.android.internal.statusbar;
import com.android.internal.statusbar.IStatusBar;
import com.android.internal.statusbar.StatusBarIcon;
import com.android.internal.statusbar.StatusBarIconList;
+import com.android.internal.statusbar.NotificationVisibility;
import android.service.notification.StatusBarNotification;
/** @hide */
@@ -53,8 +54,8 @@ interface IStatusBarService
int uid, int initialPid, String message, int userId);
void onClearAllNotifications(int userId);
void onNotificationClear(String pkg, String tag, int id, int userId);
- void onNotificationVisibilityChanged(
- in String[] newlyVisibleKeys, in String[] noLongerVisibleKeys);
+ void onNotificationVisibilityChanged( in NotificationVisibility[] newlyVisibleKeys,
+ in NotificationVisibility[] noLongerVisibleKeys);
void onNotificationExpansionChanged(in String key, in boolean userAction, in boolean expanded);
void setSystemUiVisibility(int vis, int mask, String cause);
void setWindowState(int window, int state);
diff --git a/core/java/com/android/internal/statusbar/NotificationVisibility.aidl b/core/java/com/android/internal/statusbar/NotificationVisibility.aidl
new file mode 100644
index 000000000000..c0675511b814
--- /dev/null
+++ b/core/java/com/android/internal/statusbar/NotificationVisibility.aidl
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2015, 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.statusbar;
+
+parcelable NotificationVisibility;
+
diff --git a/core/java/com/android/internal/statusbar/NotificationVisibility.java b/core/java/com/android/internal/statusbar/NotificationVisibility.java
new file mode 100644
index 000000000000..2139ad02e4f3
--- /dev/null
+++ b/core/java/com/android/internal/statusbar/NotificationVisibility.java
@@ -0,0 +1,161 @@
+/*
+ * Copyright (C) 2015 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.statusbar;
+
+import android.os.Message;
+import android.os.Parcel;
+import android.os.Parcelable;
+import android.util.Log;
+
+import java.util.ArrayDeque;
+import java.util.Collection;
+
+public class NotificationVisibility implements Parcelable {
+ private static final String TAG = "NoViz";
+ private static final int MAX_POOL_SIZE = 25;
+ private static ArrayDeque<NotificationVisibility> sPool = new ArrayDeque<>(MAX_POOL_SIZE);
+ private static int sNexrId = 0;
+
+ public String key;
+ public int rank;
+ public boolean visible = true;
+ /*package*/ int id;
+
+ private NotificationVisibility() {
+ id = sNexrId++;
+ }
+
+ private NotificationVisibility(String key, int rank, boolean visibile) {
+ this();
+ this.key = key;
+ this.rank = rank;
+ this.visible = visibile;
+ }
+
+ @Override
+ public String toString() {
+ return "NotificationVisibility(id=" + id
+ + "key=" + key
+ + " rank=" + rank
+ + (visible?" visible":"")
+ + " )";
+ }
+
+ @Override
+ public NotificationVisibility clone() {
+ return obtain(this.key, this.rank, this.visible);
+ }
+
+ @Override
+ public int hashCode() {
+ // allow lookups by key, which _should_ never be null.
+ return key == null ? 0 : key.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ // allow lookups by key, which _should_ never be null.
+ if (that instanceof NotificationVisibility) {
+ NotificationVisibility thatViz = (NotificationVisibility) that;
+ return (key == null && thatViz.key == null) || key.equals(thatViz.key);
+ }
+ return false;
+ }
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public void writeToParcel(Parcel out, int flags) {
+ out.writeString(this.key);
+ out.writeInt(this.rank);
+ out.writeInt(this.visible ? 1 : 0);
+ }
+
+ private void readFromParcel(Parcel in) {
+ this.key = in.readString();
+ this.rank = in.readInt();
+ this.visible = in.readInt() != 0;
+ }
+
+ /**
+ * Return a new NotificationVisibility instance from the global pool. Allows us to
+ * avoid allocating new objects in many cases.
+ */
+ public static NotificationVisibility obtain(String key, int rank, boolean visible) {
+ NotificationVisibility vo = obtain();
+ vo.key = key;
+ vo.rank = rank;
+ vo.visible = visible;
+ return vo;
+ }
+
+ private static NotificationVisibility obtain(Parcel in) {
+ NotificationVisibility vo = obtain();
+ vo.readFromParcel(in);
+ return vo;
+ }
+
+ private static NotificationVisibility obtain() {
+ synchronized (sPool) {
+ if (!sPool.isEmpty()) {
+ return sPool.poll();
+ }
+ }
+ return new NotificationVisibility();
+ }
+
+ /**
+ * Return a NotificationVisibility instance to the global pool.
+ * <p>
+ * You MUST NOT touch the NotificationVisibility after calling this function because it has
+ * effectively been freed.
+ * </p>
+ */
+ public void recycle() {
+ if (key == null) {
+ // do nothing on multiple recycles
+ return;
+ }
+ key = null;
+ if (sPool.size() < MAX_POOL_SIZE) {
+ synchronized (sPool) {
+ sPool.offer(this);
+ }
+ }
+ }
+
+ /**
+ * Parcelable.Creator that instantiates NotificationVisibility objects
+ */
+ public static final Parcelable.Creator<NotificationVisibility> CREATOR
+ = new Parcelable.Creator<NotificationVisibility>()
+ {
+ public NotificationVisibility createFromParcel(Parcel parcel)
+ {
+ return obtain(parcel);
+ }
+
+ public NotificationVisibility[] newArray(int size)
+ {
+ return new NotificationVisibility[size];
+ }
+ };
+}
+
diff --git a/core/java/com/android/internal/widget/ResolverDrawerLayout.java b/core/java/com/android/internal/widget/ResolverDrawerLayout.java
index 585cbc943788..1071e12cb6e3 100644
--- a/core/java/com/android/internal/widget/ResolverDrawerLayout.java
+++ b/core/java/com/android/internal/widget/ResolverDrawerLayout.java
@@ -144,6 +144,14 @@ public class ResolverDrawerLayout extends ViewGroup {
return mCollapseOffset > 0;
}
+ public void setCollapsed(boolean collapsed) {
+ if (!isLaidOut()) {
+ mOpenOnLayout = collapsed;
+ } else {
+ smoothScrollTo(collapsed ? mCollapsibleHeight : 0, 0);
+ }
+ }
+
private boolean isMoving() {
return mIsDragging || !mScroller.isFinished();
}
@@ -575,7 +583,13 @@ public class ResolverDrawerLayout extends ViewGroup {
@Override
public boolean onNestedFling(View target, float velocityX, float velocityY, boolean consumed) {
if (!consumed && Math.abs(velocityY) > mMinFlingVelocity) {
- smoothScrollTo(velocityY > 0 ? 0 : mCollapsibleHeight, velocityY);
+ if (mOnDismissedListener != null
+ && velocityY < 0 && mCollapseOffset > mCollapsibleHeight) {
+ smoothScrollTo(mCollapsibleHeight + mUncollapsibleHeight, velocityY);
+ mDismissOnScrollerFinished = true;
+ } else {
+ smoothScrollTo(velocityY > 0 ? 0 : mCollapsibleHeight, velocityY);
+ }
return true;
}
return false;
diff --git a/core/java/com/android/server/backup/PreferredActivityBackupHelper.java b/core/java/com/android/server/backup/PreferredActivityBackupHelper.java
index 26f5bf4143e6..458a2ca19d18 100644
--- a/core/java/com/android/server/backup/PreferredActivityBackupHelper.java
+++ b/core/java/com/android/server/backup/PreferredActivityBackupHelper.java
@@ -27,48 +27,69 @@ public class PreferredActivityBackupHelper extends BlobBackupHelper {
private static final boolean DEBUG = false;
// current schema of the backup state blob
- private static final int STATE_VERSION = 2;
+ private static final int STATE_VERSION = 3;
// key under which the preferred-activity state blob is committed to backup
private static final String KEY_PREFERRED = "preferred-activity";
+ // key for default-browser [etc] state
+ private static final String KEY_DEFAULT_APPS = "default-apps";
+
+ // intent-filter verification state
+ private static final String KEY_INTENT_VERIFICATION = "intent-verification";
+
public PreferredActivityBackupHelper() {
- super(STATE_VERSION, KEY_PREFERRED);
+ super(STATE_VERSION,
+ KEY_PREFERRED,
+ KEY_DEFAULT_APPS,
+ KEY_INTENT_VERIFICATION);
}
@Override
protected byte[] getBackupPayload(String key) {
- if (KEY_PREFERRED.equals(key)) {
- if (DEBUG) {
- Slog.v(TAG, "Checking whether to back up");
- }
- IPackageManager pm = AppGlobals.getPackageManager();
- try {
- return pm.getPreferredActivityBackup(UserHandle.USER_OWNER);
- } catch (Exception e) {
- Slog.e(TAG, "Unable to store backup payload", e);
- // fall through to report null state
+ IPackageManager pm = AppGlobals.getPackageManager();
+ if (DEBUG) {
+ Slog.d(TAG, "Handling backup of " + key);
+ }
+ try {
+ switch (key) {
+ case KEY_PREFERRED:
+ return pm.getPreferredActivityBackup(UserHandle.USER_OWNER);
+ case KEY_DEFAULT_APPS:
+ return pm.getDefaultAppsBackup(UserHandle.USER_OWNER);
+ case KEY_INTENT_VERIFICATION:
+ return pm.getIntentFilterVerificationBackup(UserHandle.USER_OWNER);
+ default:
+ Slog.w(TAG, "Unexpected backup key " + key);
}
- } else {
- Slog.w(TAG, "Unexpected backup key " + key);
+ } catch (Exception e) {
+ Slog.e(TAG, "Unable to store payload " + key);
}
return null;
}
@Override
protected void applyRestoredPayload(String key, byte[] payload) {
- if (KEY_PREFERRED.equals(key)) {
- if (DEBUG) {
- Slog.v(TAG, "Restoring");
- }
- IPackageManager pm = AppGlobals.getPackageManager();
- try {
- pm.restorePreferredActivities(payload, UserHandle.USER_OWNER);
- } catch (Exception e) {
- Slog.e(TAG, "Unable to restore", e);
+ IPackageManager pm = AppGlobals.getPackageManager();
+ if (DEBUG) {
+ Slog.d(TAG, "Handling restore of " + key);
+ }
+ try {
+ switch (key) {
+ case KEY_PREFERRED:
+ pm.restorePreferredActivities(payload, UserHandle.USER_OWNER);
+ break;
+ case KEY_DEFAULT_APPS:
+ pm.restoreDefaultApps(payload, UserHandle.USER_OWNER);
+ break;
+ case KEY_INTENT_VERIFICATION:
+ pm.restoreIntentFilterVerification(payload, UserHandle.USER_OWNER);
+ break;
+ default:
+ Slog.w(TAG, "Unexpected restore key " + key);
}
- } else {
- Slog.w(TAG, "Unexpected restore key " + key);
+ } catch (Exception e) {
+ Slog.w(TAG, "Unable to restore key " + key);
}
}
}
diff --git a/core/jni/android_hardware_SensorManager.cpp b/core/jni/android_hardware_SensorManager.cpp
index f5f8b1f6324d..c9d609c31537 100644
--- a/core/jni/android_hardware_SensorManager.cpp
+++ b/core/jni/android_hardware_SensorManager.cpp
@@ -257,6 +257,8 @@ private:
case SENSOR_TYPE_MAGNETIC_FIELD:
case SENSOR_TYPE_ACCELEROMETER:
case SENSOR_TYPE_GYROSCOPE:
+ case SENSOR_TYPE_GRAVITY:
+ case SENSOR_TYPE_LINEAR_ACCELERATION:
status = buffer[i].vector.status;
break;
case SENSOR_TYPE_HEART_RATE:
diff --git a/core/jni/android_hardware_camera2_legacy_LegacyCameraDevice.cpp b/core/jni/android_hardware_camera2_legacy_LegacyCameraDevice.cpp
index 5bef65370aac..63915ed1c134 100644
--- a/core/jni/android_hardware_camera2_legacy_LegacyCameraDevice.cpp
+++ b/core/jni/android_hardware_camera2_legacy_LegacyCameraDevice.cpp
@@ -436,6 +436,23 @@ static jint LegacyCameraDevice_nativeDetectSurfaceType(JNIEnv* env, jobject thiz
return fmt;
}
+static jint LegacyCameraDevice_nativeDetectSurfaceDataspace(JNIEnv* env, jobject thiz, jobject surface) {
+ ALOGV("nativeDetectSurfaceDataspace");
+ sp<ANativeWindow> anw;
+ if ((anw = getNativeWindow(env, surface)) == NULL) {
+ ALOGE("%s: Could not retrieve native window from surface.", __FUNCTION__);
+ return BAD_VALUE;
+ }
+ int32_t fmt = 0;
+ status_t err = anw->query(anw.get(), NATIVE_WINDOW_DEFAULT_DATASPACE, &fmt);
+ if(err != NO_ERROR) {
+ ALOGE("%s: Error while querying surface dataspace %s (%d).", __FUNCTION__, strerror(-err),
+ err);
+ return err;
+ }
+ return fmt;
+}
+
static jint LegacyCameraDevice_nativeDetectSurfaceDimens(JNIEnv* env, jobject thiz,
jobject surface, jintArray dimens) {
ALOGV("nativeGetSurfaceDimens");
@@ -717,6 +734,9 @@ static JNINativeMethod gCameraDeviceMethods[] = {
{ "nativeDetectSurfaceType",
"(Landroid/view/Surface;)I",
(void *)LegacyCameraDevice_nativeDetectSurfaceType },
+ { "nativeDetectSurfaceDataspace",
+ "(Landroid/view/Surface;)I",
+ (void *)LegacyCameraDevice_nativeDetectSurfaceDataspace },
{ "nativeDetectSurfaceDimens",
"(Landroid/view/Surface;[I)I",
(void *)LegacyCameraDevice_nativeDetectSurfaceDimens },
diff --git a/core/jni/android_view_DisplayEventReceiver.cpp b/core/jni/android_view_DisplayEventReceiver.cpp
index 91a3c7e6891f..0e2ec6b85209 100644
--- a/core/jni/android_view_DisplayEventReceiver.cpp
+++ b/core/jni/android_view_DisplayEventReceiver.cpp
@@ -77,7 +77,7 @@ NativeDisplayEventReceiver::NativeDisplayEventReceiver(JNIEnv* env,
jobject receiverWeak, const sp<MessageQueue>& messageQueue) :
mReceiverWeakGlobal(env->NewGlobalRef(receiverWeak)),
mMessageQueue(messageQueue), mWaitingForVsync(false) {
- ALOGV("receiver %p ~ Initializing input event receiver.", this);
+ ALOGV("receiver %p ~ Initializing display event receiver.", this);
}
NativeDisplayEventReceiver::~NativeDisplayEventReceiver() {
diff --git a/core/jni/android_view_MotionEvent.cpp b/core/jni/android_view_MotionEvent.cpp
index eb28c4de12cf..98c17c03b1a7 100644
--- a/core/jni/android_view_MotionEvent.cpp
+++ b/core/jni/android_view_MotionEvent.cpp
@@ -462,6 +462,12 @@ static int android_view_MotionEvent_nativeGetActionButton(JNIEnv* env, jclass cl
return event->getActionButton();
}
+static void android_view_MotionEvent_nativeSetActionButton(JNIEnv* env, jclass clazz,
+ jlong nativePtr, jint button) {
+ MotionEvent* event = reinterpret_cast<MotionEvent*>(nativePtr);
+ event->setActionButton(button);
+}
+
static jboolean android_view_MotionEvent_nativeIsTouchEvent(JNIEnv* env, jclass clazz,
jlong nativePtr) {
MotionEvent* event = reinterpret_cast<MotionEvent*>(nativePtr);
@@ -779,6 +785,9 @@ static JNINativeMethod gMotionEventMethods[] = {
{ "nativeGetActionButton",
"(J)I",
(void*)android_view_MotionEvent_nativeGetActionButton},
+ { "nativeSetActionButton",
+ "(JI)V",
+ (void*)android_view_MotionEvent_nativeSetActionButton},
{ "nativeIsTouchEvent",
"(J)Z",
(void*)android_view_MotionEvent_nativeIsTouchEvent },
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index b1b772ae7e7e..f9b41a9324d4 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -2457,6 +2457,7 @@
<intent-filter>
<action android:name="android.intent.action.CHOOSER" />
<category android:name="android.intent.category.DEFAULT" />
+ <category android:name="android.intent.category.VOICE" />
</intent-filter>
</activity>
<activity android:name="com.android.internal.app.IntentForwarderActivity"
diff --git a/core/res/res/layout-land/time_picker_material.xml b/core/res/res/layout-land/time_picker_material.xml
index 4b544d2244c1..2fa2054d5cad 100644
--- a/core/res/res/layout-land/time_picker_material.xml
+++ b/core/res/res/layout-land/time_picker_material.xml
@@ -17,21 +17,24 @@
<GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
- android:layout_height="match_parent">
+ android:layout_height="match_parent"
+ android:layoutDirection="ltr">
+ <!-- Provides a background for the time layout that extends into the button bar area. -->
<View
android:id="@+id/time_header"
android:layout_width="0dp"
android:layout_height="wrap_content"
- android:layout_column="0"
+ android:layout_column="@dimen/time_picker_column_start_material"
android:layout_row="0"
android:layout_rowSpan="3"
- android:layout_gravity="center|fill" />
+ android:layout_gravity="center|fill"
+ android:layoutDirection="locale" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_column="0"
+ android:layout_column="@dimen/time_picker_column_start_material"
android:layout_row="1"
android:layout_gravity="center|fill"
android:paddingStart="?attr/dialogPreferredPadding"
@@ -83,7 +86,8 @@
android:layout_height="wrap_content"
android:layout_below="@+id/time_layout"
android:layout_centerHorizontal="true"
- android:orientation="vertical">
+ android:orientation="vertical"
+ android:layoutDirection="locale">
<CheckedTextView
android:id="@+id/am_label"
@@ -116,28 +120,31 @@
android:layout="@layout/alert_dialog_title_material"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_column="1"
+ android:layout_column="@dimen/time_picker_column_end_material"
android:layout_row="0"
- android:layout_gravity="top|fill_horizontal" />
+ android:layout_gravity="top|fill_horizontal"
+ android:layoutDirection="locale" />
<android.widget.RadialTimePickerView
android:id="@+id/radial_picker"
android:layout_width="@dimen/timepicker_radial_picker_dimen"
android:layout_height="@dimen/timepicker_radial_picker_dimen"
- android:layout_column="1"
+ android:layout_column="@dimen/time_picker_column_end_material"
android:layout_row="1"
android:layout_rowWeight="1"
android:layout_gravity="center|fill"
android:layout_marginTop="@dimen/timepicker_radial_picker_top_margin"
android:layout_marginStart="@dimen/timepicker_radial_picker_horizontal_margin"
- android:layout_marginEnd="@dimen/timepicker_radial_picker_horizontal_margin" />
+ android:layout_marginEnd="@dimen/timepicker_radial_picker_horizontal_margin"
+ android:layoutDirection="locale" />
<ViewStub
android:id="@id/buttonPanel"
android:layout="@layout/alert_dialog_button_bar_material"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_column="1"
+ android:layout_column="@dimen/time_picker_column_end_material"
android:layout_row="2"
- android:layout_gravity="bottom|fill_horizontal" />
+ android:layout_gravity="bottom|fill_horizontal"
+ android:layoutDirection="locale" />
</GridLayout>
diff --git a/core/res/res/values-ldrtl/dimens.xml b/core/res/res/values-ldrtl/dimens.xml
new file mode 100644
index 000000000000..807c0424235d
--- /dev/null
+++ b/core/res/res/values-ldrtl/dimens.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2015 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.
+-->
+
+<resources>
+ <item type="dimen" format="integer" name="time_picker_column_start_material">1</item>
+ <item type="dimen" format="integer" name="time_picker_column_end_material">0</item>
+</resources>
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index edbe1304d910..f5c89c582fb9 100755
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -368,6 +368,9 @@
<!-- Boolean indicating whether the wifi chipset has dual frequency band support -->
<bool translatable="false" name="config_wifi_dual_band_support">false</bool>
+ <!-- Boolean indicating whether Hotspot 2.0/Passpoint and ANQP queries is enabled -->
+ <bool translatable="false" name="config_wifi_hotspot2_enabled">true</bool>
+
<!-- Device type information conforming to Annex B format in WiFi Direct specification.
The default represents a dual-mode smartphone -->
<string translatable="false" name="config_wifi_p2p_device_type">10-0050F204-5</string>
@@ -1840,6 +1843,17 @@
<item>com.android.inputmethod.latin</item>
</string-array>
+ <!-- The list of carrier applications which should be disabled until used.
+ This function suppresses update notifications for these pre-installed apps.
+ In SubscriptionInfoUpdater, the listed applications are disabled until used when all of the
+ following conditions are met.
+ 1. Not currently carrier-privileged according to the inserted SIM
+ 2. Pre-installed
+ 3. In the default state (enabled but not explicitly)
+ And SubscriptionInfoUpdater undoes this and marks the app enabled when a SIM is inserted
+ that marks the app as carrier privileged. -->
+ <string-array name="config_disabledUntilUsedPreinstalledCarrierApps" translatable="false" />
+
<!-- The list of classes that should be added to the notification ranking pipline.
See {@link com.android.server.notification.NotificationSignalExtractor} -->
<string-array name="config_notificationSignalExtractors">
diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml
index 7e74680255d2..09c1e6fa49b9 100644
--- a/core/res/res/values/dimens.xml
+++ b/core/res/res/values/dimens.xml
@@ -385,21 +385,24 @@
<item type="dimen" format="float" name="ambient_shadow_alpha">0.039</item>
<item type="dimen" format="float" name="spot_shadow_alpha">0.19</item>
- <!-- Floating toolbar dimensions -->
- <dimen name="floating_toolbar_height">48dp</dimen>
- <dimen name="floating_toolbar_menu_image_button_width">56dp</dimen>
- <dimen name="floating_toolbar_menu_image_button_vertical_padding">12dp</dimen>
- <dimen name="floating_toolbar_menu_button_side_padding">16dp</dimen>
- <dimen name="floating_toolbar_overflow_image_button_width">60dp</dimen>
- <dimen name="floating_toolbar_overflow_side_padding">18dp</dimen>
- <dimen name="floating_toolbar_text_size">14sp</dimen>
- <dimen name="floating_toolbar_menu_button_minimum_width">48dp</dimen>
- <dimen name="floating_toolbar_preferred_width">328dp</dimen>
- <dimen name="floating_toolbar_minimum_overflow_height">96dp</dimen>
- <dimen name="floating_toolbar_maximum_overflow_height">192dp</dimen>
- <dimen name="floating_toolbar_horizontal_margin">16dp</dimen>
- <dimen name="floating_toolbar_vertical_margin">8dp</dimen>
- <dimen name="content_rect_bottom_clip_allowance">20dp</dimen>
-
- <dimen name="chooser_grid_padding">0dp</dimen>
+ <!-- Floating toolbar dimensions -->
+ <dimen name="floating_toolbar_height">48dp</dimen>
+ <dimen name="floating_toolbar_menu_image_button_width">56dp</dimen>
+ <dimen name="floating_toolbar_menu_image_button_vertical_padding">12dp</dimen>
+ <dimen name="floating_toolbar_menu_button_side_padding">16dp</dimen>
+ <dimen name="floating_toolbar_overflow_image_button_width">60dp</dimen>
+ <dimen name="floating_toolbar_overflow_side_padding">18dp</dimen>
+ <dimen name="floating_toolbar_text_size">14sp</dimen>
+ <dimen name="floating_toolbar_menu_button_minimum_width">48dp</dimen>
+ <dimen name="floating_toolbar_preferred_width">328dp</dimen>
+ <dimen name="floating_toolbar_minimum_overflow_height">96dp</dimen>
+ <dimen name="floating_toolbar_maximum_overflow_height">192dp</dimen>
+ <dimen name="floating_toolbar_horizontal_margin">16dp</dimen>
+ <dimen name="floating_toolbar_vertical_margin">8dp</dimen>
+ <dimen name="content_rect_bottom_clip_allowance">20dp</dimen>
+
+ <dimen name="chooser_grid_padding">0dp</dimen>
+
+ <item type="dimen" format="integer" name="time_picker_column_start_material">0</item>
+ <item type="dimen" format="integer" name="time_picker_column_end_material">1</item>
</resources>
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 483f83018f66..3a1a1568074d 100755
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -1128,6 +1128,7 @@
<java-symbol type="array" name="special_locale_names" />
<java-symbol type="array" name="config_cdma_dun_supported_types" />
<java-symbol type="array" name="config_disabledUntilUsedPreinstalledImes" />
+ <java-symbol type="array" name="config_disabledUntilUsedPreinstalledCarrierApps" />
<java-symbol type="array" name="config_operatorConsideredNonRoaming" />
<java-symbol type="array" name="config_sameNamedOperatorConsideredRoaming" />
<java-symbol type="array" name="config_callBarringMMI" />
@@ -1648,6 +1649,7 @@
<java-symbol type="bool" name="config_supportLongPressPowerWhenNonInteractive" />
<java-symbol type="bool" name="config_wifi_background_scan_support" />
<java-symbol type="bool" name="config_wifi_dual_band_support" />
+ <java-symbol type="bool" name="config_wifi_hotspot2_enabled" />
<java-symbol type="bool" name="config_wimaxEnabled" />
<java-symbol type="bool" name="show_ongoing_ime_switcher" />
<java-symbol type="color" name="config_defaultNotificationColor" />
diff --git a/core/res/res/xml/sms_short_codes.xml b/core/res/res/xml/sms_short_codes.xml
index 18c83b4e499e..9548e51b0c74 100644
--- a/core/res/res/xml/sms_short_codes.xml
+++ b/core/res/res/xml/sms_short_codes.xml
@@ -93,11 +93,11 @@
<!-- France: 5 digits, free: 3xxxx, premium [4-8]xxxx, plus EU:
http://clients.txtnation.com/entries/161972-france-premium-sms-short-code-requirements -->
- <shortcode country="fr" premium="[4-8]\\d{4}" free="3\\d{4}|116\\d{3}" />
+ <shortcode country="fr" premium="[4-8]\\d{4}" free="3\\d{4}|116\\d{3}|21101" />
<!-- United Kingdom (Great Britain): 4-6 digits, common codes [5-8]xxxx, plus EU:
http://www.short-codes.com/media/Co-regulatoryCodeofPracticeforcommonshortcodes170206.pdf -->
- <shortcode country="gb" pattern="\\d{4,6}" premium="[5-8]\\d{4}" free="116\\d{3}" />
+ <shortcode country="gb" pattern="\\d{4,6}" premium="[5-8]\\d{4}" free="116\\d{3}|887" />
<!-- Georgia: 4 digits, known premium codes listed -->
<shortcode country="ge" pattern="\\d{4}" premium="801[234]|888[239]" />
@@ -184,6 +184,6 @@
<shortcode country="ua" pattern="\\d{4}" premium="444[3-9]|70[579]4|7540" />
<!-- USA: 5-6 digits (premium codes from https://www.premiumsmsrefunds.com/ShortCodes.htm) -->
- <shortcode country="us" pattern="\\d{5,6}" premium="20433|21(?:344|472)|22715|23(?:333|847)|24(?:15|28)0|25209|27(?:449|606|663)|28498|305(?:00|83)|32(?:340|941)|33(?:166|786|849)|34746|35(?:182|564)|37975|38(?:135|146|254)|41(?:366|463)|42335|43(?:355|500)|44(?:578|711|811)|45814|46(?:157|173|327)|46666|47553|48(?:221|277|669)|50(?:844|920)|51(?:062|368)|52944|54(?:723|892)|55928|56483|57370|59(?:182|187|252|342)|60339|61(?:266|982)|62478|64(?:219|898)|65(?:108|500)|69(?:208|388)|70877|71851|72(?:078|087|465)|73(?:288|588|882|909|997)|74(?:034|332|815)|76426|79213|81946|83177|84(?:103|685)|85797|86(?:234|236|666)|89616|90(?:715|842|938)|91(?:362|958)|94719|95297|96(?:040|666|835|969)|97(?:142|294|688)|99(?:689|796|807)" free="87902" />
+ <shortcode country="us" pattern="\\d{5,6}" premium="20433|21(?:344|472)|22715|23(?:333|847)|24(?:15|28)0|25209|27(?:449|606|663)|28498|305(?:00|83)|32(?:340|941)|33(?:166|786|849)|34746|35(?:182|564)|37975|38(?:135|146|254)|41(?:366|463)|42335|43(?:355|500)|44(?:578|711|811)|45814|46(?:157|173|327)|46666|47553|48(?:221|277|669)|50(?:844|920)|51(?:062|368)|52944|54(?:723|892)|55928|56483|57370|59(?:182|187|252|342)|60339|61(?:266|982)|62478|64(?:219|898)|65(?:108|500)|69(?:208|388)|70877|71851|72(?:078|087|465)|73(?:288|588|882|909|997)|74(?:034|332|815)|76426|79213|81946|83177|84(?:103|685)|85797|86(?:234|236|666)|89616|90(?:715|842|938)|91(?:362|958)|94719|95297|96(?:040|666|835|969)|97(?:142|294|688)|99(?:689|796|807)" free="122|87902" />
</shortcodes>
diff --git a/docs/html/distribute/googleplay/about.jd b/docs/html/distribute/googleplay/about.jd
index 26520462824e..543d7d3f79af 100644
--- a/docs/html/distribute/googleplay/about.jd
+++ b/docs/html/distribute/googleplay/about.jd
@@ -1,7 +1,7 @@
page.title=The Google Play Opportunity
meta.tags="visibility, growth, distributing"
page.tags="play, apps, distributing, publishing"
-page.metaDescription=Billons of downloads a month and growing. Get your apps in front of users at Google's scale.
+page.metaDescription=Billions of downloads a month and growing. Get your apps in front of users at Google's scale.
page.image=images/cards/google-play_2x.png
@jd:body
diff --git a/docs/html/distribute/googleplay/families/about.jd b/docs/html/distribute/googleplay/families/about.jd
index bec9b6a9ff6e..9b85c9a48b12 100644
--- a/docs/html/distribute/googleplay/families/about.jd
+++ b/docs/html/distribute/googleplay/families/about.jd
@@ -50,7 +50,7 @@ frameborder="0" allowfullscreen></iframe>
Designed for Families expands the visibility of your family content on Google
Play, helping parents easily find your family-friendly apps and games
throughout the store. And new features create a trusted environment that
- empowers parents to make informed desicions and engage with your content.
+ empowers parents to make informed decisions and engage with your content.
</p>
<h3>
Search
diff --git a/docs/html/guide/topics/manifest/uses-permission-element.jd b/docs/html/guide/topics/manifest/uses-permission-element.jd
index 939411406e36..bb93a702b34f 100644
--- a/docs/html/guide/topics/manifest/uses-permission-element.jd
+++ b/docs/html/guide/topics/manifest/uses-permission-element.jd
@@ -81,6 +81,7 @@ permission is needed only up to API level 18 with a declaration such as this:
</pre>
<p>This way, beginning with API level 19, the system will no longer grant your app the
{@link android.Manifest.permission#WRITE_EXTERNAL_STORAGE} permission.</p>
+<p>This attribute was added in API level 19.</p>
</dd>
</dl></dd>
diff --git a/docs/html/images/distribute/hero-IO15-google-play.jpg b/docs/html/images/distribute/hero-IO15-google-play.jpg
new file mode 100644
index 000000000000..3bfff961824c
--- /dev/null
+++ b/docs/html/images/distribute/hero-IO15-google-play.jpg
Binary files differ
diff --git a/docs/html/images/distribute/hero-IO15-growing-games.jpg b/docs/html/images/distribute/hero-IO15-growing-games.jpg
new file mode 100644
index 000000000000..c08bd71ce31d
--- /dev/null
+++ b/docs/html/images/distribute/hero-IO15-growing-games.jpg
Binary files differ
diff --git a/docs/html/images/distribute/hero-family-discovery.jpg b/docs/html/images/distribute/hero-family-discovery.jpg
new file mode 100644
index 000000000000..7ee26b59acf8
--- /dev/null
+++ b/docs/html/images/distribute/hero-family-discovery.jpg
Binary files differ
diff --git a/docs/html/images/distribute/hero-family.jpg b/docs/html/images/distribute/hero-family.jpg
deleted file mode 100644
index 6e467a5521ae..000000000000
--- a/docs/html/images/distribute/hero-family.jpg
+++ /dev/null
Binary files differ
diff --git a/docs/html/images/distribute/hero-shifty-jelly.jpg b/docs/html/images/distribute/hero-shifty-jelly.jpg
new file mode 100644
index 000000000000..4a2e98675bbf
--- /dev/null
+++ b/docs/html/images/distribute/hero-shifty-jelly.jpg
Binary files differ
diff --git a/docs/html/images/distribute/hero-store-listing-experience.jpg b/docs/html/images/distribute/hero-store-listing-experience.jpg
new file mode 100644
index 000000000000..5b00b510b3ec
--- /dev/null
+++ b/docs/html/images/distribute/hero-store-listing-experience.jpg
Binary files differ
diff --git a/docs/html/images/distribute/hero-the-hunt.jpg b/docs/html/images/distribute/hero-the-hunt.jpg
new file mode 100644
index 000000000000..ad6fd0657b8d
--- /dev/null
+++ b/docs/html/images/distribute/hero-the-hunt.jpg
Binary files differ
diff --git a/docs/html/images/distribute/hero-trello.jpg b/docs/html/images/distribute/hero-trello.jpg
new file mode 100644
index 000000000000..c89b32a5c7d5
--- /dev/null
+++ b/docs/html/images/distribute/hero-trello.jpg
Binary files differ
diff --git a/docs/html/images/distribute/hero-wooga.jpg b/docs/html/images/distribute/hero-wooga.jpg
new file mode 100644
index 000000000000..ca796a8d5327
--- /dev/null
+++ b/docs/html/images/distribute/hero-wooga.jpg
Binary files differ
diff --git a/docs/html/index.jd b/docs/html/index.jd
index cd129d4979af..794494e279c2 100644
--- a/docs/html/index.jd
+++ b/docs/html/index.jd
@@ -71,7 +71,7 @@ page.customHeadTag=<meta name="google-site-verification" content="sa-bIAI6GKvct3
data-maxResults="3"></div>
</div></section>
-<div class="dac-hero-carousel" data-carousel-query="collection:distribute/landing/carousel">
+<div class="dac-hero-carousel" data-carousel-query="collection:index/secondary/carousel">
</div>
<section class="dac-section dac-gray"><div class="wrap">
diff --git a/docs/html/jd_collections.js b/docs/html/jd_collections.js
index 86089e65ac44..e677f642882e 100644
--- a/docs/html/jd_collections.js
+++ b/docs/html/jd_collections.js
@@ -13,6 +13,15 @@ var RESOURCE_COLLECTIONS = {
"sdk/index.html"
]
},
+ "index/secondary/carousel": {
+ "title": "",
+ "resources": [
+ "http://www.youtube.com/watch?v=0r36OJaeMo4",
+ "http://www.youtube.com/watch?v=1Iw7Tg_afKk",
+ "http://www.youtube.com/watch?v=TieksFvD-7o",
+ "http://www.youtube.com/watch?v=MCoh4Pxs_ok"
+ ]
+ },
"index/multiscreen": {
"title": "",
"resources": [
@@ -175,10 +184,10 @@ var RESOURCE_COLLECTIONS = {
"distribute/landing/carousel": {
"title": "",
"resources": [
- "http://www.youtube.com/watch?v=Pd49vTkvu0U",
- "http://www.youtube.com/watch?v=ekxABqJeRBc",
- "http://www.youtube.com/watch?v=MPnH7h12h0U",
- "http://www.youtube.com/watch?v=700gYRkhkLM"
+ "https://www.youtube.com/watch?v=QDM52bblwlg",
+ "https://www.youtube.com/watch?v=wcjqBSei3a0&list=PLOU2XLYxmsIKLNUPiFCWVtcO7mZRZ9MmS",
+ "https://www.youtube.com/watch?v=B6ydLpkhq04&list=PLOU2XLYxmsIKLNUPiFCWVtcO7mZRZ9MmS",
+ "https://www.youtube.com/watch?v=jyO3-rF4Mu0&list=PLOU2XLYxmsIKLNUPiFCWVtcO7mZRZ9MmS",
]
},
"distribute/landing/googleplay": {
diff --git a/docs/html/jd_extras.js b/docs/html/jd_extras.js
index 5b2468d749fa..5dbca75037b3 100644
--- a/docs/html/jd_extras.js
+++ b/docs/html/jd_extras.js
@@ -2914,7 +2914,7 @@ DISTRIBUTE_RESOURCES = DISTRIBUTE_RESOURCES.concat([
"tags": [],
"image":"http://i1.ytimg.com/vi/jQWB_-o1kz4/maxresdefault.jpg",
"lang":"en",
- "type":"about"
+ "type":"youtube"
},
{
"title":"App Configurations, Testing and Launchers",
@@ -2926,7 +2926,7 @@ DISTRIBUTE_RESOURCES = DISTRIBUTE_RESOURCES.concat([
"tags": [],
"image":"http://i1.ytimg.com/vi/39NkpWkaH8M/maxresdefault.jpg",
"lang":"en",
- "type":"about"
+ "type":"youtube"
},
{
"title":"Building an enterprise ready app",
@@ -2938,7 +2938,7 @@ DISTRIBUTE_RESOURCES = DISTRIBUTE_RESOURCES.concat([
"tags": [],
"image":"http://i1.ytimg.com/vi/dH41OutAMNM/maxresdefault.jpg",
"lang":"en",
- "type":"develop"
+ "type":"youtube"
},
{
"title":"Android for Work: Single Use Devices",
@@ -2950,7 +2950,7 @@ DISTRIBUTE_RESOURCES = DISTRIBUTE_RESOURCES.concat([
"tags": [],
"image":"http://i1.ytimg.com/vi/j3QC6hcpy90/maxresdefault.jpg",
"lang":"en",
- "type":"about"
+ "type":"youtube"
},
{
"title":"Discover YouTube cards",
@@ -3301,6 +3301,41 @@ DISTRIBUTE_RESOURCES = DISTRIBUTE_RESOURCES.concat([
"tags": [],
"image": "distribute/images/advertising.jpg",
"type": "distribute"
+ },
+ {
+ "url":"https://www.youtube.com/watch?v=QDM52bblwlg",
+ "image": "images/distribute/hero-family-discovery.jpg",
+ "title": "Introducing the new family discovery experience on Google Play",
+ "summary": "Help families create little moments on Google Play. Opt-in your apps now.",
+ "tags":["families","googleplay"],
+ "type":"youtube"
+ },
+ {
+ "url":"https://www.youtube.com/watch?v=wcjqBSei3a0&list=PLOU2XLYxmsIKLNUPiFCWVtcO7mZRZ9MmS",
+ "image": "http://i1.ytimg.com/vi/wcjqBSei3a0/maxresdefault.jpg",
+ "title": "Developers connecting the world through Google Play",
+ "summary": "The mobile ecosystem is empowering developers to make good on the dream of connecting the world through technology to improve people's lives.",
+ "tags":["io15","googleplay"],
+ "keywords":["Google I/O 2015","io"],
+ "type":"youtube"
+ },
+ {
+ "url":"https://www.youtube.com/watch?v=B6ydLpkhq04&list=PLOU2XLYxmsIKLNUPiFCWVtcO7mZRZ9MmS",
+ "image": "http://i1.ytimg.com/vi/B6ydLpkhq04/maxresdefault.jpg",
+ "title": "Store Listing Experiments for Google Play",
+ "summary": "Learn how to use Google Play’s new store listing optimization feature to get more installs of your app, and how to test different graphics and text to find out which options perform the best. ",
+ "tags":["io15","googleplay","store listing"],
+ "tags":["google i/o","google play","store listing"],
+ "type":"youtube"
+ },
+ {
+ "url":"https://www.youtube.com/watch?v=jyO3-rF4Mu0&list=PLOU2XLYxmsIKLNUPiFCWVtcO7mZRZ9MmS",
+ "image": "http://i1.ytimg.com/vi/jyO3-rF4Mu0/maxresdefault.jpg",
+ "title": "Growing games with Google",
+ "summary": "The games industry has never been more promising and full of opportunities. This talk covers how Google is helping developers across a broad range of existing and emerging platforms.",
+ "tags":["io15","android", "googleplay","games"],
+ "keywords":["Google I/O","google play","games"],
+ "type":"youtube"
}
]);
@@ -3310,41 +3345,85 @@ var CAROUSEL_OVERRIDE = {
"heroColor": "#263238",
"heroInvert": true,
"title": "Android 5.0 Lollipop",
- "summary": "The Android 5.0 update adds a variety of new features for your apps, such as notifications on the lock screen, an all-new camera API, OpenGL ES 3.1, the new Material design interface, and much more."
- },
- "distribute/googleplay/families/about.html": {
- "image": "images/distribute/hero-family.jpg",
- "title": "Designed for Families",
- "summary": "Introducing a new Google Play section to promote family friendly apps. Your apps in the program can benefit from enhanced discoverability in addition to maintaining their existing categories, rankings, and reviews elsewhere on the Google Play store."
+ "summary": "The Android 5.0 update adds a variety of new features for your apps, such as notifications on the lock screen, an all-new camera API, OpenGL ES 3.1, the new naterial design interface, and much more.",
},
"http://www.youtube.com/watch?v=Pd49vTkvu0U": {
"url":"http://www.youtube.com/watch?v=Pd49vTkvu0U&list=PLWz5rJ2EKKc9ofd2f-_-xmUi07wIGZa1c",
"image": "images/distribute/hero-jelly-button.jpg",
"title": "How Jelly Button Games are growing globally through data",
- "summary": "To really understand their users, Jelly Button Games analyzes over 3 billion events each month using Google Analytics and Google BigQuery."
+ "summary": "To really understand their users, Jelly Button Games analyzes over 3 billion events each month using Google Analytics and Google BigQuery.",
},
"http://www.youtube.com/watch?v=700gYRkhkLM": {
"url":"http://www.youtube.com/watch?v=700gYRkhkLM&list=PLWz5rJ2EKKc9ofd2f-_-xmUi07wIGZa1c",
"image": "images/distribute/hero-outfit7.jpg",
"title": "Outfit7 — Building an entertainment company with Google",
- "summary": "Outfit7, creators of My Talking Tom and My Talking Angela, offer a complete entertainment experience to users spanning mobile apps, user generated and original YouTube content, and a range of toys, clothing, and accessories...."
+ "summary": "Outfit7, creators of My Talking Tom and My Talking Angela, offer a complete entertainment experience to users spanning mobile apps, user generated and original YouTube content, and a range of toys, clothing, and accessories....",
},
"http://www.youtube.com/watch?v=MPnH7h12h0U": {
"url":"http://www.youtube.com/watch?v=MPnH7h12h0U&list=PLWz5rJ2EKKc9ofd2f-_-xmUi07wIGZa1c",
"image": "images/distribute/hero-haystack.jpg",
- "summary": "Haystack TV built a scalable business with six employees and Android TV. Two weeks was all it took for them to bring their mobile app to the big screen."
+ "summary": "Haystack TV built a scalable business with six employees and Android TV. Two weeks was all it took for them to bring their mobile app to the big screen.",
},
"http://www.youtube.com/watch?v=ekxABqJeRBc": {
"url":"http://www.youtube.com/watch?v=ekxABqJeRBc&list=PLWz5rJ2EKKc9ofd2f-_-xmUi07wIGZa1c",
"image": "images/distribute/hero-ginlemon.jpg",
"title": "How GinLemon is breaking through with Google Play",
- "summary": "Meet Vincenzo Colucci, developer and founder of GinLemon, which started as a summer holiday joke and has now become a successful global app business on Google Play based in Manfredonia, southern Italy."
+ "summary": "Meet Vincenzo Colucci, developer and founder of GinLemon, which started as a summer holiday joke and has now become a successful global app business on Google Play based in Manfredonia, southern Italy.",
},
"distribute/googleplay/guide.html": {
"heroColor": "#fcb94e",
"image": "images/distribute/hero-g-play-guidebooks_2x.png",
- "title": "Finding Success on Google Play",
+ "title": "Finding success on Google Play",
"summary": "We’ve created a downloadable guide to help you find success with your app or game business on Google Play. In it, you’ll find features, tips, and best practices to help you build an effective strategy.",
- "tags": []
+ },
+ "http://www.youtube.com/watch?v=0r36OJaeMo4": {
+ "url":"http://www.youtube.com/watch?v=0r36OJaeMo4&list=PLWz5rJ2EKKc9ofd2f-_-xmUi07wIGZa1c",
+ "image": "images/distribute/hero-shifty-jelly.jpg",
+ "title": "Shifty Jelly — building a number 1 podcast app",
+ "summary": "Shifty Jelly is an Adelaide based mobile development company that has seen great success building Pocket Casts, a premium podcast manager app.",
+ },
+ "http://www.youtube.com/watch?v=1Iw7Tg_afKk": {
+ "image": "images/distribute/hero-wooga.jpg",
+ "url":"http://www.youtube.com/watch?v=1Iw7Tg_afKk&list=PLWz5rJ2EKKc9ofd2f-_-xmUi07wIGZa1c",
+ "title": "Wooga’s fast iterations on Google Play",
+ "summary": "The speed at which Wooga is able to iterate its live and under development games with the Android and Google Play tools has been key to delivering hits such as Diamond Dash, Jelly Splash, and Agent Alice.",
+ },
+ "http://www.youtube.com/watch?v=TieksFvD-7o": {
+ "url":"http://www.youtube.com/watch?v=TieksFvD-7o&list=PLWz5rJ2EKKc9ofd2f-_-xmUi07wIGZa1c",
+ "image": "images/distribute/hero-trello.jpg",
+ "title": "Trello lifts engagement by double digits with material design",
+ "summary": "Trello recently redesigned their collaborative planning app using the material design guidelines, and their efforts paid off.",
+ },
+ "http://www.youtube.com/watch?v=MCoh4Pxs_ok": {
+ "url":"http://www.youtube.com/watch?v=MCoh4Pxs_ok&list=PLWz5rJ2EKKc9ofd2f-_-xmUi07wIGZa1c",
+ "image": "images/distribute/hero-the-hunt.jpg",
+ "title": "The Hunt — growing engagement with material design and Google Play",
+ "summary": "Material design has helped The Hunt to enhance engagement in their style advice and product discovery app. ",
+ },
+ "https://www.youtube.com/watch?v=QDM52bblwlg": {
+ "url":"distribute/googleplay/families/about.html",
+ "image": "images/distribute/hero-family-discovery.jpg",
+ "title": "Designed for families",
+ "summary": "Introducing the new family discovery experience in Google Play. Your apps can benefit from enhanced discoverability and maintain their existing categories, rankings, and reviews elsewhere in the store. Opt-in your apps today.",
+ "type":"distribute",
+ },
+ "https://www.youtube.com/watch?v=wcjqBSei3a0&list=PLOU2XLYxmsIKLNUPiFCWVtcO7mZRZ9MmS": {
+ "url":"https://www.youtube.com/watch?v=wcjqBSei3a0&list=PLOU2XLYxmsIKLNUPiFCWVtcO7mZRZ9MmS",
+ "image": "images/distribute/hero-IO15-google-play.jpg",
+ "title": "Connecting the world through Google Play",
+ "tags":["io15"],
+ "summary": "In this this Google I/O talk, hear how the mobile ecosystem is empowering developers to connect the world through technology and improve people's lives.",
+ },
+ "https://www.youtube.com/watch?v=B6ydLpkhq04&list=PLOU2XLYxmsIKLNUPiFCWVtcO7mZRZ9MmS": {
+ "image": "images/distribute/hero-store-listing-experience.jpg",
+ "title": "Using Google Play store listing experiments",
+ "tags":["io15"],
+ "summary": "Learn how to use Google Play store listing experiments to get more installs in this Google I/O talk. Test different graphics and text to find out which options perform the best. ",
+ },
+ "https://www.youtube.com/watch?v=jyO3-rF4Mu0&list=PLOU2XLYxmsIKLNUPiFCWVtcO7mZRZ9MmS": {
+ "image": "images/distribute/hero-IO15-growing-games.jpg",
+ "title": "Growing games with Google",
+ "tags":["io15"],
+ "summary": "The games industry has never been more promising and full of opportunities. This talk from Google I/O 2015 covers how Google is helping developers across a broad range of existing and emerging platforms.",
}
-};
+}; \ No newline at end of file
diff --git a/graphics/java/android/graphics/drawable/Drawable.java b/graphics/java/android/graphics/drawable/Drawable.java
index 5e62aeac6054..7af78a78798c 100644
--- a/graphics/java/android/graphics/drawable/Drawable.java
+++ b/graphics/java/android/graphics/drawable/Drawable.java
@@ -270,8 +270,13 @@ public abstract class Drawable {
/**
* Set to true to have the drawable dither its colors when drawn to a device
- * with fewer than 8-bits per color component. This can improve the look on
- * those devices, but can also slow down the drawing a little.
+ * with fewer than 8-bits per color component.
+ *
+ * <p>This can improve the look on those devices, but can also slow down
+ * the drawing a little.</p>
+ *
+ * @see #isDither()
+ * @see android.graphics.Paint#setDither(boolean);
*/
public void setDither(boolean dither) {}
@@ -284,15 +289,19 @@ public abstract class Drawable {
}
/**
- * Set to true to have the drawable filter its bitmap when scaled or rotated
- * (for drawables that use bitmaps). If the drawable does not use bitmaps,
- * this call is ignored. This can improve the look when scaled or rotated,
- * but also slows down the drawing.
+ * Set to true to have the drawable filter its bitmaps with bilinear
+ * sampling when they are scaled or rotated.
+ *
+ * <p>This can improve appearance when bitmaps are rotated. If the drawable
+ * does not use bitmaps, this call is ignored.</p>
+ *
+ * @see #isFilterBitmap()
+ * @see android.graphics.Paint#setFilterBitmap(boolean);
*/
public void setFilterBitmap(boolean filter) {}
/**
- * @return whether this drawable filters its bitmap
+ * @return whether this drawable filters its bitmaps
* @see #setFilterBitmap(boolean)
*/
public boolean isFilterBitmap() {
diff --git a/keystore/java/android/security/keystore/AndroidKeyStoreKeyFactorySpi.java b/keystore/java/android/security/keystore/AndroidKeyStoreKeyFactorySpi.java
index 250bad797406..515be1d33ba2 100644
--- a/keystore/java/android/security/keystore/AndroidKeyStoreKeyFactorySpi.java
+++ b/keystore/java/android/security/keystore/AndroidKeyStoreKeyFactorySpi.java
@@ -113,7 +113,7 @@ public class AndroidKeyStoreKeyFactorySpi extends KeyFactorySpi {
return result;
} else {
throw new InvalidKeySpecException(
- "Obtaining RSAPublicKeySpec not supported for " + key.getAlgorithm() + " "
+ "Obtaining ECPublicKeySpec not supported for " + key.getAlgorithm() + " "
+ ((key instanceof AndroidKeyStorePrivateKey) ? "private" : "public")
+ " key");
}
diff --git a/keystore/java/android/security/keystore/AndroidKeyStoreKeyPairGeneratorSpi.java b/keystore/java/android/security/keystore/AndroidKeyStoreKeyPairGeneratorSpi.java
index 2055cdb144e5..f7ff07f38b21 100644
--- a/keystore/java/android/security/keystore/AndroidKeyStoreKeyPairGeneratorSpi.java
+++ b/keystore/java/android/security/keystore/AndroidKeyStoreKeyPairGeneratorSpi.java
@@ -624,9 +624,8 @@ public abstract class AndroidKeyStoreKeyPairGeneratorSpi extends KeyPairGenerato
// Constraints:
// 1. Key must be authorized for signing without user authentication.
// 2. Signature digest must be one of key's authorized digests.
- // 3. For RSA keys, the digest output size must not exceed modulus size minus space needed
- // for RSA PKCS#1 signature padding (about 29 bytes: minimum 10 bytes of padding + 15--19
- // bytes overhead for encoding digest OID and digest value in DER).
+ // 3. For RSA keys, the digest output size must not exceed modulus size minus space overhead
+ // of RSA PKCS#1 signature padding scheme (about 30 bytes).
// 4. For EC keys, the there is no point in using a digest whose output size is longer than
// key/field size because the digest will be truncated to that size.
@@ -727,10 +726,12 @@ public abstract class AndroidKeyStoreKeyPairGeneratorSpi extends KeyPairGenerato
spec.getDigests(),
AndroidKeyStoreBCWorkaroundProvider.getSupportedEcdsaSignatureDigests());
- // The amount of space available for the digest is less than modulus size because
- // padding must be at least 10 bytes long, and then there's also the 15--19
- // bytes overhead for encoding digest OID and digest value in DER.
- int maxDigestOutputSizeBits = keySizeBits - 29 * 8;
+ // The amount of space available for the digest is less than modulus size by about
+ // 30 bytes because padding must be at least 11 bytes long (00 || 01 || PS || 00,
+ // where PS must be at least 8 bytes long), and then there's also the 15--19 bytes
+ // overhead (depending the on chosen digest) for encoding digest OID and digest
+ // value in DER.
+ int maxDigestOutputSizeBits = keySizeBits - 30 * 8;
int bestKeymasterDigest = -1;
int bestDigestOutputSizeBits = -1;
for (int keymasterDigest : availableKeymasterDigests) {
diff --git a/keystore/java/android/security/keystore/KeyGenParameterSpec.java b/keystore/java/android/security/keystore/KeyGenParameterSpec.java
index 1732db9ae335..3d23399a265c 100644
--- a/keystore/java/android/security/keystore/KeyGenParameterSpec.java
+++ b/keystore/java/android/security/keystore/KeyGenParameterSpec.java
@@ -634,11 +634,12 @@ public final class KeyGenParameterSpec implements AlgorithmParameterSpec {
/**
* Sets the set of digests algorithms (e.g., {@code SHA-256}, {@code SHA-384}) with which
- * the key can be used when signing/verifying. Attempts to use the key with any other digest
- * algorithm will be rejected.
+ * the key can be used. Attempts to use the key with any other digest algorithm will be
+ * rejected.
*
- * <p>This must be specified for keys which are used for signing/verification. For HMAC
- * keys, the set of digests defaults to the digest associated with the key algorithm (e.g.,
+ * <p>This must be specified for signing/verification keys and RSA encryption/decryption
+ * keys used with RSA OAEP padding scheme because these operations involve a digest. For
+ * HMAC keys, the default is the digest associated with the key algorithm (e.g.,
* {@code SHA-256} for key algorithm {@code HmacSHA256}).
*
* <p>For private keys used for TLS/SSL client or server authentication it is usually
diff --git a/keystore/java/android/security/keystore/KeyProtection.java b/keystore/java/android/security/keystore/KeyProtection.java
index b7a2a0b25032..5b4b3e73cb01 100644
--- a/keystore/java/android/security/keystore/KeyProtection.java
+++ b/keystore/java/android/security/keystore/KeyProtection.java
@@ -417,12 +417,13 @@ public final class KeyProtection implements ProtectionParameter {
/**
* Sets the set of digest algorithms (e.g., {@code SHA-256}, {@code SHA-384}) with which the
- * key can be used when signing/verifying or generating MACs. Attempts to use the key with
- * any other digest algorithm will be rejected.
+ * key can be used. Attempts to use the key with any other digest algorithm will be
+ * rejected.
*
- * <p>For HMAC keys, the default is the digest algorithm specified in
- * {@link Key#getAlgorithm()}. For asymmetric signing keys the set of digest algorithms
- * must be specified.
+ * <p>This must be specified for signing/verification keys and RSA encryption/decryption
+ * keys used with RSA OAEP padding scheme because these operations involve a digest. For
+ * HMAC keys, the default is the digest specified in {@link Key#getAlgorithm()} (e.g.,
+ * {@code SHA-256} for key algorithm {@code HmacSHA256}).
*
* <p>For private keys used for TLS/SSL client or server authentication it is usually
* necessary to authorize the use of no digest ({@link KeyProperties#DIGEST_NONE}). This is
diff --git a/libs/hwui/DisplayListCanvas.cpp b/libs/hwui/DisplayListCanvas.cpp
index 843c412c156c..02a4877b0828 100644
--- a/libs/hwui/DisplayListCanvas.cpp
+++ b/libs/hwui/DisplayListCanvas.cpp
@@ -135,6 +135,8 @@ int DisplayListCanvas::saveLayer(float left, float top, float right, float botto
}
void DisplayListCanvas::translate(float dx, float dy) {
+ if (dx == 0.0f && dy == 0.0f) return;
+
mHasDeferredTranslate = true;
mTranslateX += dx;
mTranslateY += dy;
@@ -143,11 +145,15 @@ void DisplayListCanvas::translate(float dx, float dy) {
}
void DisplayListCanvas::rotate(float degrees) {
+ if (degrees == 0.0f) return;
+
addStateOp(new (alloc()) RotateOp(degrees));
mState.rotate(degrees);
}
void DisplayListCanvas::scale(float sx, float sy) {
+ if (sx == 1.0f && sy == 1.0f) return;
+
addStateOp(new (alloc()) ScaleOp(sx, sy));
mState.scale(sx, sy);
}
diff --git a/location/java/android/location/LocationManager.java b/location/java/android/location/LocationManager.java
index b09f2169e8ad..2c1932439584 100644
--- a/location/java/android/location/LocationManager.java
+++ b/location/java/android/location/LocationManager.java
@@ -892,7 +892,6 @@ public class LocationManager {
* @param listener listener object that no longer needs location updates
* @throws IllegalArgumentException if listener is null
*/
- @RequiresPermission(anyOf = {ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION})
public void removeUpdates(LocationListener listener) {
checkListener(listener);
String packageName = mContext.getPackageName();
@@ -1055,7 +1054,6 @@ public class LocationManager {
* @throws SecurityException if {@link android.Manifest.permission#ACCESS_FINE_LOCATION}
* permission is not present
*/
- @RequiresPermission(anyOf = {ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION})
public void removeProximityAlert(PendingIntent intent) {
checkPendingIntent(intent);
String packageName = mContext.getPackageName();
@@ -1083,7 +1081,6 @@ public class LocationManager {
*
* @hide
*/
- @RequiresPermission(anyOf = {ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION})
public void removeGeofence(Geofence fence, PendingIntent intent) {
checkPendingIntent(intent);
checkGeofence(fence);
@@ -1107,7 +1104,6 @@ public class LocationManager {
*
* @hide
*/
- @RequiresPermission(anyOf = {ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION})
public void removeAllGeofences(PendingIntent intent) {
checkPendingIntent(intent);
String packageName = mContext.getPackageName();
diff --git a/media/java/android/media/CamcorderProfile.java b/media/java/android/media/CamcorderProfile.java
index 9609c3551106..d303a2e39882 100644
--- a/media/java/android/media/CamcorderProfile.java
+++ b/media/java/android/media/CamcorderProfile.java
@@ -150,6 +150,25 @@ public class CamcorderProfile
/**
* High speed ( >= 100fps) quality level corresponding to the lowest available resolution.
+ * <p>
+ * For all the high speed profiles defined below ((from {@link #QUALITY_HIGH_SPEED_LOW} to
+ * {@link #QUALITY_HIGH_SPEED_2160P}), they are similar as normal recording profiles, with just
+ * higher output frame rate and bit rate. Therefore, setting these profiles with
+ * {@link MediaRecorder#setProfile} without specifying any other encoding parameters will
+ * produce high speed videos rather than slow motion videos that have different capture and
+ * output (playback) frame rates. To record slow motion videos, the application must set video
+ * output (playback) frame rate and bit rate appropriately via
+ * {@link MediaRecorder#setVideoFrameRate} and {@link MediaRecorder#setVideoEncodingBitRate}
+ * based on the slow motion factor. If the application intends to do the video recording with
+ * {@link MediaCodec} encoder, it must set each individual field of {@link MediaFormat}
+ * similarly according to this CamcorderProfile.
+ * </p>
+ *
+ * @see #videoBitRate
+ * @see #videoFrameRate
+ * @see MediaRecorder
+ * @see MediaCodec
+ * @see MediaFormat
*/
public static final int QUALITY_HIGH_SPEED_LOW = 2000;
@@ -212,11 +231,56 @@ public class CamcorderProfile
/**
* The target video output bit rate in bits per second
+ * <p>
+ * This is the target recorded video output bit rate if the application configures the video
+ * recording via {@link MediaRecorder#setProfile} without specifying any other
+ * {@link MediaRecorder} encoding parameters. For example, for high speed quality profiles (from
+ * {@link #QUALITY_HIGH_SPEED_LOW} to {@link #QUALITY_HIGH_SPEED_2160P}), this is the bit rate
+ * where the video is recorded with. If the application intends to record slow motion videos
+ * with the high speed quality profiles, it must set a different video bit rate that is
+ * corresponding to the desired recording output bit rate (i.e., the encoded video bit rate
+ * during normal playback) via {@link MediaRecorder#setVideoEncodingBitRate}. For example, if
+ * {@link #QUALITY_HIGH_SPEED_720P} advertises 240fps {@link #videoFrameRate} and 64Mbps
+ * {@link #videoBitRate} in the high speed CamcorderProfile, and the application intends to
+ * record 1/8 factor slow motion recording videos, the application must set 30fps via
+ * {@link MediaRecorder#setVideoFrameRate} and 8Mbps ( {@link #videoBitRate} * slow motion
+ * factor) via {@link MediaRecorder#setVideoEncodingBitRate}. Failing to do so will result in
+ * videos with unexpected frame rate and bit rate, or {@link MediaRecorder} error if the output
+ * bit rate exceeds the encoder limit. If the application intends to do the video recording with
+ * {@link MediaCodec} encoder, it must set each individual field of {@link MediaFormat}
+ * similarly according to this CamcorderProfile.
+ * </p>
+ *
+ * @see #videoFrameRate
+ * @see MediaRecorder
+ * @see MediaCodec
+ * @see MediaFormat
*/
public int videoBitRate;
/**
- * The target video frame rate in frames per second
+ * The target video frame rate in frames per second.
+ * <p>
+ * This is the target recorded video output frame rate per second if the application configures
+ * the video recording via {@link MediaRecorder#setProfile} without specifying any other
+ * {@link MediaRecorder} encoding parameters. For example, for high speed quality profiles (from
+ * {@link #QUALITY_HIGH_SPEED_LOW} to {@link #QUALITY_HIGH_SPEED_2160P}), this is the frame rate
+ * where the video is recorded and played back with. If the application intends to create slow
+ * motion use case with the high speed quality profiles, it must set a different video frame
+ * rate that is corresponding to the desired output (playback) frame rate via
+ * {@link MediaRecorder#setVideoFrameRate}. For example, if {@link #QUALITY_HIGH_SPEED_720P}
+ * advertises 240fps {@link #videoFrameRate} in the CamcorderProfile, and the application
+ * intends to create 1/8 factor slow motion recording videos, the application must set 30fps via
+ * {@link MediaRecorder#setVideoFrameRate}. Failing to do so will result in high speed videos
+ * with normal speed playback frame rate (240fps for above example). If the application intends
+ * to do the video recording with {@link MediaCodec} encoder, it must set each individual field
+ * of {@link MediaFormat} similarly according to this CamcorderProfile.
+ * </p>
+ *
+ * @see #videoBitRate
+ * @see MediaRecorder
+ * @see MediaCodec
+ * @see MediaFormat
*/
public int videoFrameRate;
diff --git a/packages/SettingsLib/src/com/android/settingslib/wifi/WifiTracker.java b/packages/SettingsLib/src/com/android/settingslib/wifi/WifiTracker.java
index f4e4ea16c7ff..ef08e1900ee7 100644
--- a/packages/SettingsLib/src/com/android/settingslib/wifi/WifiTracker.java
+++ b/packages/SettingsLib/src/com/android/settingslib/wifi/WifiTracker.java
@@ -346,7 +346,7 @@ public class WifiTracker {
accessPoint.update(mLastInfo, mLastNetworkInfo);
}
- if (result.passpointNetwork) {
+ if (result.isPasspointNetwork()) {
WifiConfiguration config = mWifiManager.getMatchingWifiConfig(result);
if (config != null) {
accessPoint.update(config);
diff --git a/packages/Shell/src/com/android/shell/BugreportReceiver.java b/packages/Shell/src/com/android/shell/BugreportReceiver.java
index 0c84fa148e7f..6278650775f5 100644
--- a/packages/Shell/src/com/android/shell/BugreportReceiver.java
+++ b/packages/Shell/src/com/android/shell/BugreportReceiver.java
@@ -214,7 +214,7 @@ public class BugreportReceiver extends BroadcastReceiver {
try (InputStream is = new FileInputStream(bugreportFile);
ZipOutputStream zos = new ZipOutputStream(
new BufferedOutputStream(new FileOutputStream(bugreportZippedFile)))) {
- ZipEntry entry = new ZipEntry("bugreport.txt");
+ ZipEntry entry = new ZipEntry(bugreportFile.getName());
zos.putNextEntry(entry);
int totalBytes = Streams.copy(is, zos);
Log.v(TAG, "size of original bugreport: " + totalBytes + " bytes");
diff --git a/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java b/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java
index 674356b0f866..7838119cc6de 100644
--- a/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java
+++ b/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java
@@ -311,4 +311,12 @@ public class AssistManager {
public void showDisclosure() {
mAssistDisclosure.postShow();
}
+
+ public void onUserSwitched(int newUserId) {
+ updateAssistInfo();
+ }
+
+ public void prepareBeforeInvocation() {
+ updateAssistInfo();
+ }
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
index ade40e507173..9e6dd7e86537 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -96,6 +96,7 @@ import android.widget.ImageView;
import android.widget.TextView;
import com.android.internal.logging.MetricsLogger;
+import com.android.internal.statusbar.NotificationVisibility;
import com.android.internal.statusbar.StatusBarIcon;
import com.android.keyguard.KeyguardHostView.OnDismissAction;
import com.android.keyguard.ViewMediatorCallback;
@@ -457,7 +458,8 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
private int mDisabledUnmodified2;
/** Keys of notifications currently visible to the user. */
- private final ArraySet<String> mCurrentlyVisibleNotifications = new ArraySet<String>();
+ private final ArraySet<NotificationVisibility> mCurrentlyVisibleNotifications =
+ new ArraySet<>();
private long mLastVisibilityReportUptimeMs;
private final ShadeUpdates mShadeUpdates = new ShadeUpdates();
@@ -471,9 +473,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
private int mLastLoggedStateFingerprint;
private static final int VISIBLE_LOCATIONS = StackViewState.LOCATION_FIRST_CARD
- | StackViewState.LOCATION_TOP_STACK_PEEKING
- | StackViewState.LOCATION_MAIN_AREA
- | StackViewState.LOCATION_BOTTOM_STACK_PEEKING;
+ | StackViewState.LOCATION_MAIN_AREA;
private final OnChildLocationsChangedListener mNotificationLocationsChangedListener =
new OnChildLocationsChangedListener() {
@@ -498,12 +498,17 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
// Tracks notifications currently visible in mNotificationStackScroller and
// emits visibility events via NoMan on changes.
private final Runnable mVisibilityReporter = new Runnable() {
- private final ArrayList<String> mTmpNewlyVisibleNotifications = new ArrayList<String>();
- private final ArrayList<String> mTmpCurrentlyVisibleNotifications = new ArrayList<String>();
+ private final ArraySet<NotificationVisibility> mTmpNewlyVisibleNotifications =
+ new ArraySet<>();
+ private final ArraySet<NotificationVisibility> mTmpCurrentlyVisibleNotifications =
+ new ArraySet<>();
+ private final ArraySet<NotificationVisibility> mTmpNoLongerVisibleNotifications =
+ new ArraySet<>();
@Override
public void run() {
mLastVisibilityReportUptimeMs = SystemClock.uptimeMillis();
+ final String mediaKey = getCurrentMediaNotificationKey();
// 1. Loop over mNotificationData entries:
// A. Keep list of visible notifications.
@@ -518,31 +523,45 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
for (int i = 0; i < N; i++) {
Entry entry = activeNotifications.get(i);
String key = entry.notification.getKey();
- boolean previouslyVisible = mCurrentlyVisibleNotifications.contains(key);
- boolean currentlyVisible =
+ boolean isVisible =
(mStackScroller.getChildLocation(entry.row) & VISIBLE_LOCATIONS) != 0;
- if (currentlyVisible) {
+ NotificationVisibility visObj = NotificationVisibility.obtain(key, i, isVisible);
+ boolean previouslyVisible = mCurrentlyVisibleNotifications.contains(visObj);
+ if (isVisible) {
// Build new set of visible notifications.
- mTmpCurrentlyVisibleNotifications.add(key);
- }
- if (!previouslyVisible && currentlyVisible) {
- mTmpNewlyVisibleNotifications.add(key);
+ mTmpCurrentlyVisibleNotifications.add(visObj);
+ if (!previouslyVisible) {
+ mTmpNewlyVisibleNotifications.add(visObj);
+ }
+ } else {
+ // release object
+ visObj.recycle();
}
}
- ArraySet<String> noLongerVisibleNotifications = mCurrentlyVisibleNotifications;
- noLongerVisibleNotifications.removeAll(mTmpCurrentlyVisibleNotifications);
+ mTmpNoLongerVisibleNotifications.addAll(mCurrentlyVisibleNotifications);
+ mTmpNoLongerVisibleNotifications.removeAll(mTmpCurrentlyVisibleNotifications);
logNotificationVisibilityChanges(
- mTmpNewlyVisibleNotifications, noLongerVisibleNotifications);
+ mTmpNewlyVisibleNotifications, mTmpNoLongerVisibleNotifications);
- mCurrentlyVisibleNotifications.clear();
+ recycleAllVisibilityObjects(mCurrentlyVisibleNotifications);
mCurrentlyVisibleNotifications.addAll(mTmpCurrentlyVisibleNotifications);
- mTmpNewlyVisibleNotifications.clear();
+ recycleAllVisibilityObjects(mTmpNoLongerVisibleNotifications);
mTmpCurrentlyVisibleNotifications.clear();
+ mTmpNewlyVisibleNotifications.clear();
+ mTmpNoLongerVisibleNotifications.clear();
}
};
+ private void recycleAllVisibilityObjects(ArraySet<NotificationVisibility> array) {
+ final int N = array.size();
+ for (int i = 0 ; i < N; i++) {
+ array.valueAt(i).recycle();
+ }
+ array.clear();
+ }
+
private final View.OnClickListener mOverflowClickListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
@@ -1028,6 +1047,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
private int mShowSearchHoldoff = 0;
private Runnable mInvokeAssist = new Runnable() {
public void run() {
+ mAssistManager.prepareBeforeInvocation();
invokeAssistGesture(true /* vibrate */);
awakenDreams();
if (mNavigationBarView != null) {
@@ -2917,6 +2937,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
updateNotifications();
resetUserSetupObserver();
setControllerUsers();
+ mAssistManager.onUserSwitched(newUserId);
}
private void setControllerUsers() {
@@ -2987,9 +3008,9 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
// Report all notifications as invisible and turn down the
// reporter.
if (!mCurrentlyVisibleNotifications.isEmpty()) {
- logNotificationVisibilityChanges(
- Collections.<String>emptyList(), mCurrentlyVisibleNotifications);
- mCurrentlyVisibleNotifications.clear();
+ logNotificationVisibilityChanges(Collections.<NotificationVisibility>emptyList(),
+ mCurrentlyVisibleNotifications);
+ recycleAllVisibilityObjects(mCurrentlyVisibleNotifications);
}
mHandler.removeCallbacks(mVisibilityReporter);
mStackScroller.setChildLocationsChangedListener(null);
@@ -3007,18 +3028,27 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
}
private void logNotificationVisibilityChanges(
- Collection<String> newlyVisible, Collection<String> noLongerVisible) {
+ Collection<NotificationVisibility> newlyVisible,
+ Collection<NotificationVisibility> noLongerVisible) {
if (newlyVisible.isEmpty() && noLongerVisible.isEmpty()) {
return;
}
- String[] newlyVisibleAr = newlyVisible.toArray(new String[newlyVisible.size()]);
- String[] noLongerVisibleAr = noLongerVisible.toArray(new String[noLongerVisible.size()]);
+ NotificationVisibility[] newlyVisibleAr =
+ newlyVisible.toArray(new NotificationVisibility[newlyVisible.size()]);
+ NotificationVisibility[] noLongerVisibleAr =
+ noLongerVisible.toArray(new NotificationVisibility[noLongerVisible.size()]);
try {
mBarService.onNotificationVisibilityChanged(newlyVisibleAr, noLongerVisibleAr);
} catch (RemoteException e) {
// Ignore.
}
- setNotificationsShown(newlyVisibleAr);
+
+ final int N = newlyVisible.size();
+ String[] newlyVisibleKeyAr = new String[N];
+ for (int i = 0; i < N; i++) {
+ newlyVisibleKeyAr[i] = newlyVisibleAr[i].key;
+ }
+ setNotificationsShown(newlyVisibleKeyAr);
}
// State logging
@@ -3886,6 +3916,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
mScreenOnComingFromTouch = true;
mScreenOnTouchLocation = new PointF(event.getX(), event.getY());
mNotificationPanel.setTouchDisabled(false);
+ mStatusBarKeyguardViewManager.notifyScreenWakeUpRequested();
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
index fcf3a9c2e477..a7e8406f1cf3 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
@@ -73,6 +73,7 @@ public class StatusBarKeyguardViewManager {
private boolean mLastBouncerShowing;
private boolean mLastBouncerDismissible;
private OnDismissAction mAfterKeyguardGoneAction;
+ private boolean mScreenWillWakeUp;
public StatusBarKeyguardViewManager(Context context, ViewMediatorCallback callback,
LockPatternUtils lockPatternUtils) {
@@ -163,6 +164,7 @@ public class StatusBarKeyguardViewManager {
public void onScreenTurnedOn(final IKeyguardShowCallback callback) {
mScreenOn = true;
+ mScreenWillWakeUp = false;
mPhoneStatusBar.onScreenTurnedOn();
if (callback != null) {
callbackAfterDraw(callback);
@@ -182,6 +184,10 @@ public class StatusBarKeyguardViewManager {
});
}
+ public void notifyScreenWakeUpRequested() {
+ mScreenWillWakeUp = !mScreenOn;
+ }
+
public void verifyUnlock() {
dismiss();
}
@@ -297,7 +303,7 @@ public class StatusBarKeyguardViewManager {
* Dismisses the keyguard by going to the next screen or making it gone.
*/
public void dismiss() {
- if (mScreenOn) {
+ if (mScreenOn || mScreenWillWakeUp) {
showBouncer();
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/tuner/QsTuner.java b/packages/SystemUI/src/com/android/systemui/tuner/QsTuner.java
index 2b76c31ca90b..a5b244e21c91 100644
--- a/packages/SystemUI/src/com/android/systemui/tuner/QsTuner.java
+++ b/packages/SystemUI/src/com/android/systemui/tuner/QsTuner.java
@@ -150,13 +150,23 @@ public class QsTuner extends Fragment implements Callback {
}
public void onStartDrag() {
- mDropTarget.setVisibility(View.VISIBLE);
- mAddTarget.setVisibility(View.GONE);
+ mDropTarget.post(new Runnable() {
+ @Override
+ public void run() {
+ mDropTarget.setVisibility(View.VISIBLE);
+ mAddTarget.setVisibility(View.GONE);
+ }
+ });
}
public void stopDrag() {
- mDropTarget.setVisibility(View.GONE);
- mAddTarget.setVisibility(View.VISIBLE);
+ mDropTarget.post(new Runnable() {
+ @Override
+ public void run() {
+ mDropTarget.setVisibility(View.GONE);
+ mAddTarget.setVisibility(View.VISIBLE);
+ }
+ });
}
@Override
@@ -230,9 +240,16 @@ public class QsTuner extends Fragment implements Callback {
public void showAddDialog() {
List<String> tiles = mTileSpecs;
+ int numBroadcast = 0;
+ for (int i = 0; i < tiles.size(); i++) {
+ if (tiles.get(i).startsWith(IntentTile.PREFIX)) {
+ numBroadcast++;
+ }
+ }
String[] defaults =
getContext().getString(R.string.quick_settings_tiles_default).split(",");
- final String[] available = new String[defaults.length + 1 - tiles.size()];
+ final String[] available = new String[defaults.length + 1
+ - (tiles.size() - numBroadcast)];
final String[] availableTiles = new String[available.length];
int index = 0;
for (int i = 0; i < defaults.length; i++) {
diff --git a/services/core/java/com/android/server/EventLogTags.logtags b/services/core/java/com/android/server/EventLogTags.logtags
index 49d4c221397d..43b640b434ce 100644
--- a/services/core/java/com/android/server/EventLogTags.logtags
+++ b/services/core/java/com/android/server/EventLogTags.logtags
@@ -74,7 +74,7 @@ option java_package com.android.server
# when a notification has been canceled
27530 notification_canceled (key|3),(reason|1),(lifespan|1),(freshness|1),(exposure|1)
# replaces 27510 with a row per notification
-27531 notification_visibility (key|3),(visibile|1),(lifespan|1),(freshness|1)
+27531 notification_visibility (key|3),(visibile|1),(lifespan|1),(freshness|1),(exposure|1),(rank|1)
# a notification emited noise, vibration, or light
27532 notification_alert (key|3),(buzz|1),(beep|1),(blink|1)
diff --git a/services/core/java/com/android/server/LocationManagerService.java b/services/core/java/com/android/server/LocationManagerService.java
index 61bedf5d6bd7..cae060a8493e 100644
--- a/services/core/java/com/android/server/LocationManagerService.java
+++ b/services/core/java/com/android/server/LocationManagerService.java
@@ -270,6 +270,17 @@ public class LocationManagerService extends ILocationManager.Stub {
};
mAppOps.startWatchingMode(AppOpsManager.OP_COARSE_LOCATION, null, callback);
+ PackageManager.OnPermissionsChangedListener permissionListener
+ = new PackageManager.OnPermissionsChangedListener() {
+ @Override
+ public void onPermissionsChanged(final int uid) {
+ synchronized (mLock) {
+ applyAllProviderRequirementsLocked();
+ }
+ }
+ };
+ mPackageManager.addOnPermissionsChangeListener(permissionListener);
+
mUserManager = (UserManager) mContext.getSystemService(Context.USER_SERVICE);
updateUserProfiles(mCurrentUserId);
@@ -1133,23 +1144,34 @@ public class LocationManagerService extends ILocationManager.Stub {
return -1;
}
- boolean reportLocationAccessNoThrow(int uid, String packageName, int allowedResolutionLevel) {
+ boolean reportLocationAccessNoThrow(
+ int pid, int uid, String packageName, int allowedResolutionLevel) {
int op = resolutionLevelToOp(allowedResolutionLevel);
if (op >= 0) {
if (mAppOps.noteOpNoThrow(op, uid, packageName) != AppOpsManager.MODE_ALLOWED) {
return false;
}
}
+
+ if (getAllowedResolutionLevel(pid, uid) < allowedResolutionLevel) {
+ return false;
+ }
+
return true;
}
- boolean checkLocationAccess(int uid, String packageName, int allowedResolutionLevel) {
+ boolean checkLocationAccess(int pid, int uid, String packageName, int allowedResolutionLevel) {
int op = resolutionLevelToOp(allowedResolutionLevel);
if (op >= 0) {
if (mAppOps.checkOp(op, uid, packageName) != AppOpsManager.MODE_ALLOWED) {
return false;
}
}
+
+ if (getAllowedResolutionLevel(pid, uid) < allowedResolutionLevel) {
+ return false;
+ }
+
return true;
}
@@ -1347,7 +1369,10 @@ public class LocationManagerService extends ILocationManager.Stub {
if (records != null) {
for (UpdateRecord record : records) {
if (isCurrentProfile(UserHandle.getUserId(record.mReceiver.mUid))) {
- if (checkLocationAccess(record.mReceiver.mUid, record.mReceiver.mPackageName,
+ if (checkLocationAccess(
+ record.mReceiver.mPid,
+ record.mReceiver.mUid,
+ record.mReceiver.mPackageName,
record.mReceiver.mAllowedResolutionLevel)) {
LocationRequest locationRequest = record.mRequest;
providerRequest.locationRequests.add(locationRequest);
@@ -1583,7 +1608,7 @@ public class LocationManagerService extends ILocationManager.Stub {
try {
// We don't check for MODE_IGNORED here; we will do that when we go to deliver
// a location.
- checkLocationAccess(uid, packageName, allowedResolutionLevel);
+ checkLocationAccess(pid, uid, packageName, allowedResolutionLevel);
synchronized (mLock) {
Receiver recevier = checkListenerOrIntentLocked(listener, intent, pid, uid,
@@ -1711,6 +1736,7 @@ public class LocationManagerService extends ILocationManager.Stub {
request.getProvider());
// no need to sanitize this request, as only the provider name is used
+ final int pid = Binder.getCallingPid();
final int uid = Binder.getCallingUid();
final long identity = Binder.clearCallingIdentity();
try {
@@ -1720,7 +1746,7 @@ public class LocationManagerService extends ILocationManager.Stub {
return null;
}
- if (!reportLocationAccessNoThrow(uid, packageName, allowedResolutionLevel)) {
+ if (!reportLocationAccessNoThrow(pid, uid, packageName, allowedResolutionLevel)) {
if (D) Log.d(TAG, "not returning last loc for no op app: " +
packageName);
return null;
@@ -1794,7 +1820,6 @@ public class LocationManagerService extends ILocationManager.Stub {
@Override
public void removeGeofence(Geofence geofence, PendingIntent intent, String packageName) {
- checkResolutionLevelIsSufficientForGeofenceUse(getCallerAllowedResolutionLevel());
checkPendingIntent(intent);
checkPackageName(packageName);
@@ -1816,10 +1841,11 @@ public class LocationManagerService extends ILocationManager.Stub {
checkResolutionLevelIsSufficientForProviderUse(allowedResolutionLevel,
LocationManager.GPS_PROVIDER);
+ final int pid = Binder.getCallingPid();
final int uid = Binder.getCallingUid();
final long ident = Binder.clearCallingIdentity();
try {
- if (!checkLocationAccess(uid, packageName, allowedResolutionLevel)) {
+ if (!checkLocationAccess(pid, uid, packageName, allowedResolutionLevel)) {
return false;
}
} finally {
@@ -1859,11 +1885,12 @@ public class LocationManagerService extends ILocationManager.Stub {
allowedResolutionLevel,
LocationManager.GPS_PROVIDER);
+ int pid = Binder.getCallingPid();
int uid = Binder.getCallingUid();
long identity = Binder.clearCallingIdentity();
boolean hasLocationAccess;
try {
- hasLocationAccess = checkLocationAccess(uid, packageName, allowedResolutionLevel);
+ hasLocationAccess = checkLocationAccess(pid, uid, packageName, allowedResolutionLevel);
} finally {
Binder.restoreCallingIdentity(identity);
}
@@ -1890,11 +1917,12 @@ public class LocationManagerService extends ILocationManager.Stub {
allowedResolutionLevel,
LocationManager.GPS_PROVIDER);
+ int pid = Binder.getCallingPid();
int uid = Binder.getCallingUid();
long identity = Binder.clearCallingIdentity();
boolean hasLocationAccess;
try {
- hasLocationAccess = checkLocationAccess(uid, packageName, allowedResolutionLevel);
+ hasLocationAccess = checkLocationAccess(pid, uid, packageName, allowedResolutionLevel);
} finally {
Binder.restoreCallingIdentity(identity);
}
@@ -2209,7 +2237,7 @@ public class LocationManagerService extends ILocationManager.Stub {
continue;
}
- if (!reportLocationAccessNoThrow(receiver.mUid, receiver.mPackageName,
+ if (!reportLocationAccessNoThrow(receiver.mPid, receiver.mUid, receiver.mPackageName,
receiver.mAllowedResolutionLevel)) {
if (D) Log.d(TAG, "skipping loc update for no op app: " +
receiver.mPackageName);
diff --git a/services/core/java/com/android/server/MountService.java b/services/core/java/com/android/server/MountService.java
index 34dceedb0a8f..458150c60294 100644
--- a/services/core/java/com/android/server/MountService.java
+++ b/services/core/java/com/android/server/MountService.java
@@ -259,6 +259,7 @@ class MountService extends IMountService.Stub
private static final String TAG_VOLUME = "volume";
private static final String ATTR_TYPE = "type";
private static final String ATTR_FS_UUID = "fsUuid";
+ private static final String ATTR_PART_GUID = "partGuid";
private static final String ATTR_NICKNAME = "nickname";
private static final String ATTR_USER_FLAGS = "userFlags";
@@ -689,7 +690,7 @@ class MountService extends IMountService.Stub
// Create a stub volume that represents internal storage
final VolumeInfo internal = new VolumeInfo(VolumeInfo.ID_PRIVATE_INTERNAL,
- VolumeInfo.TYPE_PRIVATE, null, 0);
+ VolumeInfo.TYPE_PRIVATE, null, null, 0);
internal.state = VolumeInfo.STATE_MOUNTED;
internal.path = Environment.getDataDirectory().getAbsolutePath();
mVolumes.put(internal.id, internal);
@@ -900,10 +901,12 @@ class MountService extends IMountService.Stub
case VoldResponseCode.VOLUME_CREATED: {
final String id = cooked[1];
final int type = Integer.parseInt(cooked[2]);
- final String diskId = (cooked.length == 4) ? cooked[3] : null;
+ final String diskId = TextUtils.nullIfEmpty(cooked[3]);
+ final String partGuid = TextUtils.nullIfEmpty(cooked[4]);
+
final DiskInfo disk = mDisks.get(diskId);
final int mtpIndex = allocateMtpIndex(id);
- final VolumeInfo vol = new VolumeInfo(id, type, disk, mtpIndex);
+ final VolumeInfo vol = new VolumeInfo(id, type, disk, partGuid, mtpIndex);
mVolumes.put(id, vol);
onVolumeCreatedLocked(vol);
break;
@@ -1091,13 +1094,21 @@ class MountService extends IMountService.Stub
// Remember that we saw this volume so we're ready to accept user
// metadata, or so we can annoy them when a private volume is ejected
if (vol.isMountedReadable() && !TextUtils.isEmpty(vol.fsUuid)) {
- if (!mRecords.containsKey(vol.fsUuid)) {
- final VolumeRecord rec = new VolumeRecord(vol.type, vol.fsUuid);
+ VolumeRecord rec = mRecords.get(vol.fsUuid);
+ if (rec == null) {
+ rec = new VolumeRecord(vol.type, vol.fsUuid);
+ rec.partGuid = vol.partGuid;
if (vol.type == VolumeInfo.TYPE_PRIVATE) {
rec.nickname = vol.disk.getDescription();
}
mRecords.put(rec.fsUuid, rec);
writeSettingsLocked();
+ } else {
+ // Handle upgrade case where we didn't store partition GUID
+ if (TextUtils.isEmpty(rec.partGuid)) {
+ rec.partGuid = vol.partGuid;
+ writeSettingsLocked();
+ }
}
}
@@ -1347,6 +1358,7 @@ class MountService extends IMountService.Stub
final int type = readIntAttribute(in, ATTR_TYPE);
final String fsUuid = readStringAttribute(in, ATTR_FS_UUID);
final VolumeRecord meta = new VolumeRecord(type, fsUuid);
+ meta.partGuid = readStringAttribute(in, ATTR_PART_GUID);
meta.nickname = readStringAttribute(in, ATTR_NICKNAME);
meta.userFlags = readIntAttribute(in, ATTR_USER_FLAGS);
return meta;
@@ -1356,6 +1368,7 @@ class MountService extends IMountService.Stub
out.startTag(null, TAG_VOLUME);
writeIntAttribute(out, ATTR_TYPE, rec.type);
writeStringAttribute(out, ATTR_FS_UUID, rec.fsUuid);
+ writeStringAttribute(out, ATTR_PART_GUID, rec.partGuid);
writeStringAttribute(out, ATTR_NICKNAME, rec.nickname);
writeIntAttribute(out, ATTR_USER_FLAGS, rec.userFlags);
out.endTag(null, TAG_VOLUME);
@@ -1573,9 +1586,11 @@ class MountService extends IMountService.Stub
Preconditions.checkNotNull(fsUuid);
synchronized (mLock) {
- mRecords.remove(fsUuid);
-
- // TODO: tell vold to forget keys
+ final VolumeRecord rec = mRecords.remove(fsUuid);
+ if (rec != null && !TextUtils.isEmpty(rec.partGuid)) {
+ forgetPartition(rec.partGuid);
+ }
+ mCallbacks.notifyVolumeForgotten(fsUuid);
// If this had been primary storage, revert back to internal and
// reset vold so we bind into new volume into place.
@@ -1584,7 +1599,6 @@ class MountService extends IMountService.Stub
resetIfReadyAndConnected();
}
- mCallbacks.notifyVolumeForgotten(fsUuid);
writeSettingsLocked();
}
}
@@ -1597,6 +1611,10 @@ class MountService extends IMountService.Stub
synchronized (mLock) {
for (int i = 0; i < mRecords.size(); i++) {
final String fsUuid = mRecords.keyAt(i);
+ final VolumeRecord rec = mRecords.valueAt(i);
+ if (!TextUtils.isEmpty(rec.partGuid)) {
+ forgetPartition(rec.partGuid);
+ }
mCallbacks.notifyVolumeForgotten(fsUuid);
}
mRecords.clear();
@@ -1610,6 +1628,14 @@ class MountService extends IMountService.Stub
}
}
+ private void forgetPartition(String partGuid) {
+ try {
+ mConnector.execute("volume", "forget_partition", partGuid);
+ } catch (NativeDaemonConnectorException e) {
+ Slog.w(TAG, "Failed to forget key for " + partGuid + ": " + e);
+ }
+ }
+
@Override
public void setDebugFlags(int flags, int mask) {
enforcePermission(android.Manifest.permission.MOUNT_UNMOUNT_FILESYSTEMS);
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index 030163829059..1ef1375b1cac 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -10779,15 +10779,21 @@ public final class ActivityManagerService extends ActivityManagerNative
return;
}
}
- pae.intent.replaceExtras(pae.extras);
- pae.intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
- | Intent.FLAG_ACTIVITY_SINGLE_TOP
- | Intent.FLAG_ACTIVITY_CLEAR_TOP);
- closeSystemDialogs("assist");
+
+ long ident = Binder.clearCallingIdentity();
try {
- mContext.startActivityAsUser(pae.intent, new UserHandle(pae.userHandle));
- } catch (ActivityNotFoundException e) {
- Slog.w(TAG, "No activity to handle assist action.", e);
+ pae.intent.replaceExtras(pae.extras);
+ pae.intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
+ | Intent.FLAG_ACTIVITY_SINGLE_TOP
+ | Intent.FLAG_ACTIVITY_CLEAR_TOP);
+ closeSystemDialogs("assist");
+ try {
+ mContext.startActivityAsUser(pae.intent, new UserHandle(pae.userHandle));
+ } catch (ActivityNotFoundException e) {
+ Slog.w(TAG, "No activity to handle assist action.", e);
+ }
+ } finally {
+ Binder.restoreCallingIdentity(ident);
}
}
diff --git a/services/core/java/com/android/server/content/SyncManager.java b/services/core/java/com/android/server/content/SyncManager.java
index cd9c7fe0b9bb..7415b0ee624c 100644
--- a/services/core/java/com/android/server/content/SyncManager.java
+++ b/services/core/java/com/android/server/content/SyncManager.java
@@ -55,6 +55,7 @@ import android.content.pm.UserInfo;
import android.database.ContentObserver;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
+import android.net.TrafficStats;
import android.os.BatteryStats;
import android.os.Bundle;
import android.os.Handler;
@@ -100,7 +101,6 @@ import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
-import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Random;
@@ -162,6 +162,19 @@ public class SyncManager {
private static final long ACTIVE_SYNC_TIMEOUT_MILLIS = 30L * 60 * 1000; // 30 mins
/**
+ * How often to periodically poll network traffic for an adapter performing a sync to determine
+ * whether progress is being made.
+ */
+ private static final long SYNC_MONITOR_WINDOW_LENGTH_MILLIS = 60 * 1000; // 60 seconds
+
+ /**
+ * How many bytes must be transferred (Tx + Rx) over the period of time defined by
+ * {@link #SYNC_MONITOR_WINDOW_LENGTH_MILLIS} for the sync to be considered to be making
+ * progress.
+ */
+ private static final int SYNC_MONITOR_PROGRESS_THRESHOLD_BYTES = 10; // 10 bytes
+
+ /**
* How long to delay each queued {@link SyncHandler} message that may have occurred before boot
* or befor the device became provisioned.
*/
@@ -957,20 +970,42 @@ public class SyncManager {
}
/**
- * Remove any time-outs previously posted for the provided active sync.
+ * Post a delayed message that will monitor the given sync context by periodically checking how
+ * much network has been used by the uid.
*/
- private void removeSyncExpiryMessage(ActiveSyncContext activeSyncContext) {
+ private void postMonitorSyncProgressMessage(ActiveSyncContext activeSyncContext) {
if (Log.isLoggable(TAG, Log.VERBOSE)) {
- Log.v(TAG, "removing all MESSAGE_SYNC_EXPIRED for " + activeSyncContext.toString());
- }
- mSyncHandler.removeMessages(SyncHandler.MESSAGE_SYNC_EXPIRED, activeSyncContext);
+ Log.v(TAG, "posting MESSAGE_SYNC_MONITOR in " +
+ (SYNC_MONITOR_WINDOW_LENGTH_MILLIS/1000) + "s");
+ }
+
+ activeSyncContext.mBytesTransferredAtLastPoll =
+ getTotalBytesTransferredByUid(activeSyncContext.mSyncAdapterUid);
+ activeSyncContext.mLastPolledTimeElapsed = SystemClock.elapsedRealtime();
+ Message monitorMessage =
+ mSyncHandler.obtainMessage(
+ SyncHandler.MESSAGE_MONITOR_SYNC,
+ activeSyncContext);
+ mSyncHandler.sendMessageDelayed(monitorMessage, SYNC_MONITOR_WINDOW_LENGTH_MILLIS);
}
+ /**
+ * Monitor sync progress by calculating how many bytes it is managing to send to and fro.
+ */
+ private long getTotalBytesTransferredByUid(int uid) {
+ return (TrafficStats.getUidRxBytes(uid) + TrafficStats.getUidTxBytes(uid));
+ }
+
+ /**
+ * Convenience class for passing parameters for a finished or cancelled sync to the handler
+ * to be processed.
+ */
class SyncHandlerMessagePayload {
public final ActiveSyncContext activeSyncContext;
public final SyncResult syncResult;
- SyncHandlerMessagePayload(ActiveSyncContext syncContext, SyncResult syncResult) {
+ SyncHandlerMessagePayload(ActiveSyncContext syncContext,
+ SyncResult syncResult) {
this.activeSyncContext = syncContext;
this.syncResult = syncResult;
}
@@ -1277,6 +1312,14 @@ public class SyncManager {
boolean mIsLinkedToDeath = false;
String mEventName;
+ /** Total bytes transferred, counted at {@link #mLastPolledTimeElapsed} */
+ long mBytesTransferredAtLastPoll;
+ /**
+ * Last point in {@link SystemClock#elapsedRealtime()} at which we checked the # of bytes
+ * transferred to/fro by this adapter.
+ */
+ long mLastPolledTimeElapsed;
+
/**
* Create an ActiveSyncContext for an impending sync and grab the wakelock for that
* sync adapter. Since this grabs the wakelock you need to be sure to call
@@ -2048,8 +2091,16 @@ public class SyncManager {
private static final int MESSAGE_SERVICE_CONNECTED = 4;
private static final int MESSAGE_SERVICE_DISCONNECTED = 5;
private static final int MESSAGE_CANCEL = 6;
- /** Posted delayed in order to expire syncs that are long-running. */
+ /**
+ * Posted delayed in order to expire syncs that are long-running.
+ * obj: {@link com.android.server.content.SyncManager.ActiveSyncContext}
+ */
private static final int MESSAGE_SYNC_EXPIRED = 7;
+ /**
+ * Posted periodically to monitor network process for long-running syncs.
+ * obj: {@link com.android.server.content.SyncManager.ActiveSyncContext}
+ */
+ private static final int MESSAGE_MONITOR_SYNC = 8;
public final SyncNotificationInfo mSyncNotificationInfo = new SyncNotificationInfo();
private Long mAlarmScheduleTime = null;
@@ -2167,28 +2218,16 @@ public class SyncManager {
// to also take into account the periodic syncs.
earliestFuturePollTime = scheduleReadyPeriodicSyncs();
switch (msg.what) {
- case SyncHandler.MESSAGE_SYNC_EXPIRED:
- ActiveSyncContext expiredContext = (ActiveSyncContext) msg.obj;
- if (Log.isLoggable(TAG, Log.DEBUG)) {
- Log.d(TAG, "handleSyncHandlerMessage: MESSAGE_SYNC_EXPIRED: expiring "
- + expiredContext);
- }
- cancelActiveSync(expiredContext.mSyncOperation.target,
- expiredContext.mSyncOperation.extras);
- nextPendingSyncTime = maybeStartNextSyncH();
- break;
-
- case SyncHandler.MESSAGE_CANCEL: {
- SyncStorageEngine.EndPoint payload = (SyncStorageEngine.EndPoint) msg.obj;
+ case SyncHandler.MESSAGE_CANCEL:
+ SyncStorageEngine.EndPoint endpoint = (SyncStorageEngine.EndPoint) msg.obj;
Bundle extras = msg.peekData();
if (Log.isLoggable(TAG, Log.DEBUG)) {
- Log.d(TAG, "handleSyncHandlerMessage: MESSAGE_SERVICE_CANCEL: "
- + payload + " bundle: " + extras);
+ Log.d(TAG, "handleSyncHandlerMessage: MESSAGE_CANCEL: "
+ + endpoint + " bundle: " + extras);
}
- cancelActiveSyncLocked(payload, extras);
+ cancelActiveSyncH(endpoint, extras);
nextPendingSyncTime = maybeStartNextSyncH();
break;
- }
case SyncHandler.MESSAGE_SYNC_FINISHED:
if (Log.isLoggable(TAG, Log.VERBOSE)) {
@@ -2254,7 +2293,6 @@ public class SyncManager {
// since a sync just finished check if it is time to start a new sync
nextPendingSyncTime = maybeStartNextSyncH();
}
-
break;
}
@@ -2278,6 +2316,36 @@ public class SyncManager {
}
nextPendingSyncTime = maybeStartNextSyncH();
break;
+ case SyncHandler.MESSAGE_SYNC_EXPIRED:
+ ActiveSyncContext expiredContext = (ActiveSyncContext) msg.obj;
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "handleSyncHandlerMessage: MESSAGE_SYNC_EXPIRED:" +
+ " cancelling " + expiredContext);
+ }
+ runSyncFinishedOrCanceledH(
+ null /* cancel => no result */,
+ expiredContext);
+ nextPendingSyncTime = maybeStartNextSyncH();
+ break;
+ case SyncHandler.MESSAGE_MONITOR_SYNC:
+ ActiveSyncContext monitoredSyncContext = (ActiveSyncContext) msg.obj;
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "handleSyncHandlerMessage: MESSAGE_MONITOR_SYNC: " +
+ monitoredSyncContext.mSyncOperation.target);
+ }
+
+ if (isSyncNotUsingNetworkH(monitoredSyncContext)) {
+ Log.w(TAG, String.format(
+ "Detected sync making no progress for %s. cancelling.",
+ monitoredSyncContext));
+ runSyncFinishedOrCanceledH(
+ null /* cancel => no result */, monitoredSyncContext);
+ } else {
+ // Repost message to check again.
+ postMonitorSyncProgressMessage(monitoredSyncContext);
+ }
+ break;
+
}
} finally {
manageSyncNotificationLocked();
@@ -2699,6 +2767,30 @@ public class SyncManager {
return nextReadyToRunTime;
}
+ private boolean isSyncNotUsingNetworkH(ActiveSyncContext activeSyncContext) {
+ final long bytesTransferredCurrent =
+ getTotalBytesTransferredByUid(activeSyncContext.mSyncAdapterUid);
+ final long deltaBytesTransferred =
+ bytesTransferredCurrent - activeSyncContext.mBytesTransferredAtLastPoll;
+
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ // Bytes transferred
+ long remainder = deltaBytesTransferred;
+ long mb = remainder / (1024 * 1024);
+ remainder %= 1024 * 1024;
+ long kb = remainder / 1024;
+ remainder %= 1024;
+ long b = remainder;
+ Log.d(TAG, String.format(
+ "Time since last update: %ds. Delta transferred: %dMBs,%dKBs,%dBs",
+ (SystemClock.elapsedRealtime()
+ - activeSyncContext.mLastPolledTimeElapsed)/1000,
+ mb, kb, b)
+ );
+ }
+ return (deltaBytesTransferred <= SYNC_MONITOR_PROGRESS_THRESHOLD_BYTES);
+ }
+
/**
* Determine if a sync is no longer valid and should be dropped from the sync queue and its
* pending op deleted.
@@ -2849,18 +2941,22 @@ public class SyncManager {
}
ActiveSyncContext activeSyncContext =
new ActiveSyncContext(op, insertStartSyncEvent(op), targetUid);
+ if (Log.isLoggable(TAG, Log.VERBOSE)) {
+ Log.v(TAG, "dispatchSyncOperation: starting " + activeSyncContext);
+ }
+
activeSyncContext.mSyncInfo = mSyncStorageEngine.addActiveSync(activeSyncContext);
mActiveSyncContexts.add(activeSyncContext);
- if (!activeSyncContext.mSyncOperation.isInitialization() &&
- !activeSyncContext.mSyncOperation.isExpedited() &&
+ // Post message to cancel this sync if it runs for too long.
+ if (!activeSyncContext.mSyncOperation.isExpedited() &&
!activeSyncContext.mSyncOperation.isManual() &&
!activeSyncContext.mSyncOperation.isIgnoreSettings()) {
- // Post message to expire this sync if it runs for too long.
postSyncExpiryMessage(activeSyncContext);
}
- if (Log.isLoggable(TAG, Log.VERBOSE)) {
- Log.v(TAG, "dispatchSyncOperation: starting " + activeSyncContext);
- }
+
+ // Post message to begin monitoring this sync's progress.
+ postMonitorSyncProgressMessage(activeSyncContext);
+
if (!activeSyncContext.bindToSyncAdapter(targetComponent, info.userId)) {
Log.e(TAG, "Bind attempt failed - target: " + targetComponent);
closeActiveSyncContext(activeSyncContext);
@@ -2902,9 +2998,10 @@ public class SyncManager {
/**
* Cancel the sync for the provided target that matches the given bundle.
- * @param info can have null fields to indicate all the active syncs for that field.
+ * @param info Can have null fields to indicate all the active syncs for that field.
+ * @param extras Can be null to indicate <strong>all</strong> syncs for the given endpoint.
*/
- private void cancelActiveSyncLocked(SyncStorageEngine.EndPoint info, Bundle extras) {
+ private void cancelActiveSyncH(SyncStorageEngine.EndPoint info, Bundle extras) {
ArrayList<ActiveSyncContext> activeSyncs =
new ArrayList<ActiveSyncContext>(mActiveSyncContexts);
for (ActiveSyncContext activeSyncContext : activeSyncs) {
@@ -2920,8 +3017,7 @@ public class SyncManager {
false /* no config settings */)) {
continue;
}
- runSyncFinishedOrCanceledH(null /* no result since this is a cancel */,
- activeSyncContext);
+ runSyncFinishedOrCanceledH(null /* cancel => no result */, activeSyncContext);
}
}
}
@@ -3034,7 +3130,13 @@ public class SyncManager {
mActiveSyncContexts.remove(activeSyncContext);
mSyncStorageEngine.removeActiveSync(activeSyncContext.mSyncInfo,
activeSyncContext.mSyncOperation.target.userId);
- removeSyncExpiryMessage(activeSyncContext);
+
+ if (Log.isLoggable(TAG, Log.VERBOSE)) {
+ Log.v(TAG, "removing all MESSAGE_MONITOR_SYNC & MESSAGE_SYNC_EXPIRED for "
+ + activeSyncContext.toString());
+ }
+ mSyncHandler.removeMessages(SyncHandler.MESSAGE_SYNC_EXPIRED, activeSyncContext);
+ mSyncHandler.removeMessages(SyncHandler.MESSAGE_MONITOR_SYNC, activeSyncContext);
}
/**
diff --git a/services/core/java/com/android/server/display/DisplayPowerController.java b/services/core/java/com/android/server/display/DisplayPowerController.java
index 35fbef6d289f..8d2687ba9db9 100644
--- a/services/core/java/com/android/server/display/DisplayPowerController.java
+++ b/services/core/java/com/android/server/display/DisplayPowerController.java
@@ -231,6 +231,9 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
// The elapsed real time when the screen on was blocked.
private long mScreenOnBlockStartRealTime;
+ // True if we told the window manager policy that the screen was off.
+ private boolean mReportedScreenOffToPolicy;
+
// Remembers whether certain kinds of brightness adjustments
// were recently applied so that we can decide how to transition.
private boolean mAppliedAutoBrightness;
@@ -764,24 +767,30 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
} catch (RemoteException ex) {
// same process
}
+ }
- // Tell the window manager what's happening.
- // Temporarily block turning the screen on until the window manager is ready
- // by leaving a black surface covering the screen. This surface is essentially
- // the final state of the color fade animation.
- boolean isOn = (state != Display.STATE_OFF);
- if (wasOn && !isOn) {
+ // Tell the window manager policy when the screen is turned off or on unless it's due
+ // to the proximity sensor. We temporarily block turning the screen on until the
+ // window manager is ready by leaving a black surface covering the screen.
+ // This surface is essentially the final state of the color fade animation and
+ // it is only removed once the window manager tells us that the activity has
+ // finished drawing underneath.
+ final boolean isOff = (state == Display.STATE_OFF);
+ if (isOff && !mReportedScreenOffToPolicy && !mScreenOffBecauseOfProximity) {
+ mReportedScreenOffToPolicy = true;
+ unblockScreenOn();
+ mWindowManagerPolicy.screenTurnedOff();
+ } else if (!isOff && mReportedScreenOffToPolicy) {
+ mReportedScreenOffToPolicy = false;
+ if (mPowerState.getColorFadeLevel() == 0.0f) {
+ blockScreenOn();
+ } else {
unblockScreenOn();
- mWindowManagerPolicy.screenTurnedOff();
- } else if (!wasOn && isOn) {
- if (mPowerState.getColorFadeLevel() == 0.0f) {
- blockScreenOn();
- } else {
- unblockScreenOn();
- }
- mWindowManagerPolicy.screenTurningOn(mPendingScreenOnUnblocker);
}
+ mWindowManagerPolicy.screenTurningOn(mPendingScreenOnUnblocker);
}
+
+ // Return true if the screen isn't blocked.
return mPendingScreenOnUnblocker == null;
}
@@ -1086,6 +1095,7 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
pw.println(" mAppliedLowPower=" + mAppliedLowPower);
pw.println(" mPendingScreenOnUnblocker=" + mPendingScreenOnUnblocker);
pw.println(" mPendingScreenOff=" + mPendingScreenOff);
+ pw.println(" mReportedScreenOffToPolicy=" + mReportedScreenOffToPolicy);
pw.println(" mScreenBrightnessRampAnimator.isAnimating()=" +
mScreenBrightnessRampAnimator.isAnimating());
diff --git a/services/core/java/com/android/server/notification/NotificationDelegate.java b/services/core/java/com/android/server/notification/NotificationDelegate.java
index fdb443e1753d..87b4f8cddc15 100644
--- a/services/core/java/com/android/server/notification/NotificationDelegate.java
+++ b/services/core/java/com/android/server/notification/NotificationDelegate.java
@@ -16,6 +16,8 @@
package com.android.server.notification;
+import com.android.internal.statusbar.NotificationVisibility;
+
public interface NotificationDelegate {
void onSetDisabled(int status);
void onClearAll(int callingUid, int callingPid, int userId);
@@ -30,6 +32,7 @@ public interface NotificationDelegate {
void onPanelHidden();
void clearEffects();
void onNotificationVisibilityChanged(
- String[] newlyVisibleKeys, String[] noLongerVisibleKeys);
+ NotificationVisibility[] newlyVisibleKeys,
+ NotificationVisibility[] noLongerVisibleKeys);
void onNotificationExpansionChanged(String key, boolean userAction, boolean expanded);
}
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java
index 0dcad8219ef1..4524ff895428 100644
--- a/services/core/java/com/android/server/notification/NotificationManagerService.java
+++ b/services/core/java/com/android/server/notification/NotificationManagerService.java
@@ -97,6 +97,7 @@ import android.view.accessibility.AccessibilityManager;
import android.widget.Toast;
import com.android.internal.R;
+import com.android.internal.statusbar.NotificationVisibility;
import com.android.internal.util.FastXmlSerializer;
import com.android.server.EventLogTags;
import com.android.server.LocalServices;
@@ -622,22 +623,24 @@ public class NotificationManagerService extends SystemService {
}
@Override
- public void onNotificationVisibilityChanged(
- String[] newlyVisibleKeys, String[] noLongerVisibleKeys) {
+ public void onNotificationVisibilityChanged(NotificationVisibility[] newlyVisibleKeys,
+ NotificationVisibility[] noLongerVisibleKeys) {
synchronized (mNotificationList) {
- for (String key : newlyVisibleKeys) {
- NotificationRecord r = mNotificationsByKey.get(key);
+ for (NotificationVisibility nv : newlyVisibleKeys) {
+ NotificationRecord r = mNotificationsByKey.get(nv.key);
if (r == null) continue;
- r.setVisibility(true);
+ r.setVisibility(true, nv.rank);
+ nv.recycle();
}
// Note that we might receive this event after notifications
// have already left the system, e.g. after dismissing from the
// shade. Hence not finding notifications in
// mNotificationsByKey is not an exceptional condition.
- for (String key : noLongerVisibleKeys) {
- NotificationRecord r = mNotificationsByKey.get(key);
+ for (NotificationVisibility nv : noLongerVisibleKeys) {
+ NotificationRecord r = mNotificationsByKey.get(nv.key);
if (r == null) continue;
- r.setVisibility(false);
+ r.setVisibility(false, nv.rank);
+ nv.recycle();
}
}
}
diff --git a/services/core/java/com/android/server/notification/NotificationRecord.java b/services/core/java/com/android/server/notification/NotificationRecord.java
index c4773cacf1ca..b7aea9da1d8b 100644
--- a/services/core/java/com/android/server/notification/NotificationRecord.java
+++ b/services/core/java/com/android/server/notification/NotificationRecord.java
@@ -314,13 +314,15 @@ public final class NotificationRecord {
/**
* Set the visibility of the notification.
*/
- public void setVisibility(boolean visible) {
+ public void setVisibility(boolean visible, int rank) {
final long now = System.currentTimeMillis();
mVisibleSinceMs = visible ? now : mVisibleSinceMs;
stats.onVisibilityChanged(visible);
EventLogTags.writeNotificationVisibility(getKey(), visible ? 1 : 0,
(int) (now - mCreationTimeMs),
- (int) (now - mUpdateTimeMs));
+ (int) (now - mUpdateTimeMs),
+ 0, // exposure time
+ rank);
}
/**
diff --git a/services/core/java/com/android/server/pm/DefaultPermissionGrantPolicy.java b/services/core/java/com/android/server/pm/DefaultPermissionGrantPolicy.java
index fe3103bcdc69..62c686c9bf77 100644
--- a/services/core/java/com/android/server/pm/DefaultPermissionGrantPolicy.java
+++ b/services/core/java/com/android/server/pm/DefaultPermissionGrantPolicy.java
@@ -106,7 +106,7 @@ final class DefaultPermissionGrantPolicy {
private static final Set<String> STORAGE_PERMISSIONS = new ArraySet<>();
static {
-// STORAGE_PERMISSIONS.add(Manifest.permission.READ_EXTERNAL_STORAGE);
+ STORAGE_PERMISSIONS.add(Manifest.permission.READ_EXTERNAL_STORAGE);
STORAGE_PERMISSIONS.add(Manifest.permission.WRITE_EXTERNAL_STORAGE);
}
diff --git a/services/core/java/com/android/server/pm/IntentFilterVerificationState.java b/services/core/java/com/android/server/pm/IntentFilterVerificationState.java
index c09d6ae7ff8b..c6e7911ea2a7 100644
--- a/services/core/java/com/android/server/pm/IntentFilterVerificationState.java
+++ b/services/core/java/com/android/server/pm/IntentFilterVerificationState.java
@@ -19,7 +19,7 @@ package com.android.server.pm;
import android.content.pm.PackageManager;
import android.content.pm.PackageParser;
import android.util.ArraySet;
-import android.util.Log;
+import android.util.Slog;
import java.util.ArrayList;
@@ -113,7 +113,7 @@ public class IntentFilterVerificationState {
setState(state);
return true;
}
- Log.d(TAG, "Cannot set verifier response with callerUid:" + callerUid + " and code:" +
+ Slog.d(TAG, "Cannot set verifier response with callerUid:" + callerUid + " and code:" +
code + " as required verifierUid is:" + mRequiredVerifierUid);
return false;
}
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index b593906a214d..41d3ffd3087c 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -212,6 +212,7 @@ import com.android.server.pm.PermissionsState.PermissionState;
import com.android.server.storage.DeviceStorageMonitorInternal;
import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlSerializer;
import java.io.BufferedInputStream;
@@ -556,6 +557,22 @@ public class PackageManagerService extends IPackageManager.Stub {
final DefaultPermissionGrantPolicy mDefaultPermissionPolicy =
new DefaultPermissionGrantPolicy(this);
+ private static class IFVerificationParams {
+ PackageParser.Package pkg;
+ boolean replacing;
+ int userId;
+ int verifierUid;
+
+ public IFVerificationParams(PackageParser.Package _pkg, boolean _replacing,
+ int _userId, int _verifierUid) {
+ pkg = _pkg;
+ replacing = _replacing;
+ userId = _userId;
+ replacing = _replacing;
+ verifierUid = _verifierUid;
+ }
+ }
+
private interface IntentFilterVerifier<T extends IntentFilter> {
boolean addOneIntentFilterVerification(int verifierId, int userId, int verificationId,
T filter, String packageName);
@@ -629,7 +646,7 @@ public class PackageManagerService extends IPackageManager.Stub {
UserHandle user = new UserHandle(userId);
mContext.sendBroadcastAsUser(verificationIntent, user);
if (DEBUG_DOMAIN_VERIFICATION) Slog.d(TAG,
- "Sending IntenFilter verification broadcast");
+ "Sending IntentFilter verification broadcast");
}
public void receiveVerificationResponse(int verificationId) {
@@ -639,6 +656,10 @@ public class PackageManagerService extends IPackageManager.Stub {
ArrayList<PackageParser.ActivityIntentInfo> filters = ivs.getFilters();
final int count = filters.size();
+ if (DEBUG_DOMAIN_VERIFICATION) {
+ Slog.i(TAG, "Received verification response " + verificationId
+ + " for " + count + " filters, verified=" + verified);
+ }
for (int n=0; n<count; n++) {
PackageParser.ActivityIntentInfo filter = filters.get(n);
filter.setVerified(verified);
@@ -713,30 +734,27 @@ public class PackageManagerService extends IPackageManager.Stub {
}
@Override
- public boolean addOneIntentFilterVerification(int verifierId, int userId, int verificationId,
+ public boolean addOneIntentFilterVerification(int verifierUid, int userId, int verificationId,
ActivityIntentInfo filter, String packageName) {
- if (!(filter.hasDataScheme(IntentFilter.SCHEME_HTTP) ||
- filter.hasDataScheme(IntentFilter.SCHEME_HTTPS))) {
- if (DEBUG_DOMAIN_VERIFICATION) Slog.d(TAG,
- "IntentFilter does not contain HTTP nor HTTPS data scheme");
+ if (!hasValidDomains(filter)) {
return false;
}
IntentFilterVerificationState ivs = mIntentFilterVerificationStates.get(verificationId);
if (ivs == null) {
- ivs = createDomainVerificationState(verifierId, userId, verificationId,
+ ivs = createDomainVerificationState(verifierUid, userId, verificationId,
packageName);
}
- if (!hasValidDomains(filter)) {
- return false;
+ if (DEBUG_DOMAIN_VERIFICATION) {
+ Slog.d(TAG, "Adding verification filter for " + packageName + " : " + filter);
}
ivs.addFilter(filter);
return true;
}
- private IntentFilterVerificationState createDomainVerificationState(int verifierId,
+ private IntentFilterVerificationState createDomainVerificationState(int verifierUid,
int userId, int verificationId, String packageName) {
IntentFilterVerificationState ivs = new IntentFilterVerificationState(
- verifierId, userId, packageName);
+ verifierUid, userId, packageName);
ivs.setPendingState();
synchronized (mPackages) {
mIntentFilterVerificationStates.append(verificationId, ivs);
@@ -888,8 +906,10 @@ public class PackageManagerService extends IPackageManager.Stub {
final SparseArray<PostInstallData> mRunningInstalls = new SparseArray<PostInstallData>();
int mNextInstallToken = 1; // nonzero; will be wrapped back to 1 when ++ overflows
- // backup/restore of preferred activity state
+ // XML tags for backup/restore of various bits of state
private static final String TAG_PREFERRED_BACKUP = "pa";
+ private static final String TAG_DEFAULT_APPS = "da";
+ private static final String TAG_INTENT_FILTER_VERIFICATION = "iv";
private final String mRequiredVerifierPackage;
@@ -1507,11 +1527,9 @@ public class PackageManagerService extends IPackageManager.Stub {
break;
}
case START_INTENT_FILTER_VERIFICATIONS: {
- int userId = msg.arg1;
- int verifierUid = msg.arg2;
- PackageParser.Package pkg = (PackageParser.Package)msg.obj;
-
- verifyIntentFiltersIfNeeded(userId, verifierUid, pkg);
+ IFVerificationParams params = (IFVerificationParams) msg.obj;
+ verifyIntentFiltersIfNeeded(params.userId, params.verifierUid,
+ params.replacing, params.pkg);
break;
}
case INTENT_FILTER_VERIFIED: {
@@ -2357,8 +2375,7 @@ public class PackageManagerService extends IPackageManager.Stub {
final String packageName = getDefaultBrowserPackageName(myUserId);
PackageInfo info = getPackageInfo(packageName, 0, myUserId);
if (info == null) {
- Slog.w(TAG, "Clearing default Browser as its package is no more installed: " +
- packageName);
+ Slog.w(TAG, "Default browser no longer installed: " + packageName);
setDefaultBrowserPackageName(null, myUserId);
}
}
@@ -4118,9 +4135,26 @@ public class PackageManagerService extends IPackageManager.Stub {
if (matches.get(i).getTargetUserId() == targetUserId) return true;
}
}
+ if (hasWebURI(intent)) {
+ // cross-profile app linking works only towards the parent.
+ final UserInfo parent = getProfileParent(sourceUserId);
+ synchronized(mPackages) {
+ return getCrossProfileDomainPreferredLpr(intent, resolvedType, 0, sourceUserId,
+ parent.id) != null;
+ }
+ }
return false;
}
+ private UserInfo getProfileParent(int userId) {
+ final long identity = Binder.clearCallingIdentity();
+ try {
+ return sUserManager.getProfileParent(userId);
+ } finally {
+ Binder.restoreCallingIdentity(identity);
+ }
+ }
+
private List<CrossProfileIntentFilter> getMatchingCrossProfileIntentFilters(Intent intent,
String resolvedType, int userId) {
CrossProfileIntentResolver resolver = mSettings.mCrossProfileIntentResolvers.get(userId);
@@ -4161,11 +4195,11 @@ public class PackageManagerService extends IPackageManager.Stub {
List<CrossProfileIntentFilter> matchingFilters =
getMatchingCrossProfileIntentFilters(intent, resolvedType, userId);
// Check for results that need to skip the current profile.
- ResolveInfo resolveInfo = querySkipCurrentProfileIntents(matchingFilters, intent,
+ ResolveInfo xpResolveInfo = querySkipCurrentProfileIntents(matchingFilters, intent,
resolvedType, flags, userId);
- if (resolveInfo != null && isUserEnabled(resolveInfo.targetUserId)) {
+ if (xpResolveInfo != null && isUserEnabled(xpResolveInfo.targetUserId)) {
List<ResolveInfo> result = new ArrayList<ResolveInfo>(1);
- result.add(resolveInfo);
+ result.add(xpResolveInfo);
return filterIfNotPrimaryUser(result, userId);
}
@@ -4174,15 +4208,36 @@ public class PackageManagerService extends IPackageManager.Stub {
intent, resolvedType, flags, userId);
// Check for cross profile results.
- resolveInfo = queryCrossProfileIntents(
+ xpResolveInfo = queryCrossProfileIntents(
matchingFilters, intent, resolvedType, flags, userId);
- if (resolveInfo != null && isUserEnabled(resolveInfo.targetUserId)) {
- result.add(resolveInfo);
+ if (xpResolveInfo != null && isUserEnabled(xpResolveInfo.targetUserId)) {
+ result.add(xpResolveInfo);
Collections.sort(result, mResolvePrioritySorter);
}
result = filterIfNotPrimaryUser(result, userId);
- if (result.size() > 1 && hasWebURI(intent)) {
- return filterCandidatesWithDomainPreferedActivitiesLPr(flags, result);
+ if (hasWebURI(intent)) {
+ CrossProfileDomainInfo xpDomainInfo = null;
+ final UserInfo parent = getProfileParent(userId);
+ if (parent != null) {
+ xpDomainInfo = getCrossProfileDomainPreferredLpr(intent, resolvedType,
+ flags, userId, parent.id);
+ }
+ if (xpDomainInfo != null) {
+ if (xpResolveInfo != null) {
+ // If we didn't remove it, the cross-profile ResolveInfo would be twice
+ // in the result.
+ result.remove(xpResolveInfo);
+ }
+ if (result.size() == 0) {
+ result.add(xpDomainInfo.resolveInfo);
+ return result;
+ }
+ } else if (result.size() <= 1) {
+ return result;
+ }
+ result = filterCandidatesWithDomainPreferredActivitiesLPr(flags, result,
+ xpDomainInfo);
+ Collections.sort(result, mResolvePrioritySorter);
}
return result;
}
@@ -4197,6 +4252,67 @@ public class PackageManagerService extends IPackageManager.Stub {
}
}
+ private static class CrossProfileDomainInfo {
+ /* ResolveInfo for IntentForwarderActivity to send the intent to the other profile */
+ ResolveInfo resolveInfo;
+ /* Best domain verification status of the activities found in the other profile */
+ int bestDomainVerificationStatus;
+ }
+
+ private CrossProfileDomainInfo getCrossProfileDomainPreferredLpr(Intent intent,
+ String resolvedType, int flags, int sourceUserId, int parentUserId) {
+ if (!sUserManager.hasUserRestriction(UserManager.ALLOW_PARENT_APP_LINKING,
+ sourceUserId)) {
+ return null;
+ }
+ List<ResolveInfo> resultTargetUser = mActivities.queryIntent(intent,
+ resolvedType, flags, parentUserId);
+
+ if (resultTargetUser == null || resultTargetUser.isEmpty()) {
+ return null;
+ }
+ CrossProfileDomainInfo result = null;
+ int size = resultTargetUser.size();
+ for (int i = 0; i < size; i++) {
+ ResolveInfo riTargetUser = resultTargetUser.get(i);
+ // Intent filter verification is only for filters that specify a host. So don't return
+ // those that handle all web uris.
+ if (riTargetUser.handleAllWebDataURI) {
+ continue;
+ }
+ String packageName = riTargetUser.activityInfo.packageName;
+ PackageSetting ps = mSettings.mPackages.get(packageName);
+ if (ps == null) {
+ continue;
+ }
+ int status = getDomainVerificationStatusLPr(ps, parentUserId);
+ if (result == null) {
+ result = new CrossProfileDomainInfo();
+ result.resolveInfo =
+ createForwardingResolveInfo(null, sourceUserId, parentUserId);
+ result.bestDomainVerificationStatus = status;
+ } else {
+ result.bestDomainVerificationStatus = bestDomainVerificationStatus(status,
+ result.bestDomainVerificationStatus);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Verification statuses are ordered from the worse to the best, except for
+ * INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER, which is the worse.
+ */
+ private int bestDomainVerificationStatus(int status1, int status2) {
+ if (status1 == INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER) {
+ return status2;
+ }
+ if (status2 == INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER) {
+ return status1;
+ }
+ return (int) MathUtils.max(status1, status2);
+ }
+
private boolean isUserEnabled(int userId) {
long callingId = Binder.clearCallingIdentity();
try {
@@ -4236,8 +4352,8 @@ public class PackageManagerService extends IPackageManager.Stub {
return scheme.equals(IntentFilter.SCHEME_HTTP) || scheme.equals(IntentFilter.SCHEME_HTTPS);
}
- private List<ResolveInfo> filterCandidatesWithDomainPreferedActivitiesLPr(
- int flags, List<ResolveInfo> candidates) {
+ private List<ResolveInfo> filterCandidatesWithDomainPreferredActivitiesLPr(
+ int flags, List<ResolveInfo> candidates, CrossProfileDomainInfo xpDomainInfo) {
if (DEBUG_PREFERRED) {
Slog.v("TAG", "Filtering results with prefered activities. Candidates count: " +
candidates.size());
@@ -4277,12 +4393,23 @@ public class PackageManagerService extends IPackageManager.Stub {
}
}
}
- // First try to add the "always" if there is any
+ // First try to add the "always" resolution for the current user if there is any
if (alwaysList.size() > 0) {
result.addAll(alwaysList);
+ // if there is an "always" for the parent user, add it.
+ } else if (xpDomainInfo != null && xpDomainInfo.bestDomainVerificationStatus
+ == INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS) {
+ result.add(xpDomainInfo.resolveInfo);
} else {
// Add all undefined Apps as we want them to appear in the Disambiguation dialog.
result.addAll(undefinedList);
+ if (xpDomainInfo != null && (
+ xpDomainInfo.bestDomainVerificationStatus
+ == INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_UNDEFINED
+ || xpDomainInfo.bestDomainVerificationStatus
+ == INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ASK)) {
+ result.add(xpDomainInfo.resolveInfo);
+ }
// Also add Browsers (all of them or only the default one)
if ((flags & MATCH_ALL) != 0) {
result.addAll(matchAllList);
@@ -11753,7 +11880,7 @@ public class PackageManagerService extends IPackageManager.Stub {
return;
}
- startIntentFilterVerifications(args.user.getIdentifier(), pkg);
+ startIntentFilterVerifications(args.user.getIdentifier(), replace, pkg);
if (replace) {
replacePackageLI(pkg, parseFlags, scanFlags, args.user,
@@ -11770,7 +11897,8 @@ public class PackageManagerService extends IPackageManager.Stub {
}
}
- private void startIntentFilterVerifications(int userId, PackageParser.Package pkg) {
+ private void startIntentFilterVerifications(int userId, boolean replacing,
+ PackageParser.Package pkg) {
if (mIntentFilterVerifierComponent == null) {
Slog.w(TAG, "No IntentFilter verification will not be done as "
+ "there is no IntentFilterVerifier available!");
@@ -11783,14 +11911,11 @@ public class PackageManagerService extends IPackageManager.Stub {
mHandler.removeMessages(START_INTENT_FILTER_VERIFICATIONS);
final Message msg = mHandler.obtainMessage(START_INTENT_FILTER_VERIFICATIONS);
- msg.obj = pkg;
- msg.arg1 = userId;
- msg.arg2 = verifierUid;
-
+ msg.obj = new IFVerificationParams(pkg, replacing, userId, verifierUid);
mHandler.sendMessage(msg);
}
- private void verifyIntentFiltersIfNeeded(int userId, int verifierUid,
+ private void verifyIntentFiltersIfNeeded(int userId, int verifierUid, boolean replacing,
PackageParser.Package pkg) {
int size = pkg.activities.size();
if (size == 0) {
@@ -11810,13 +11935,26 @@ public class PackageManagerService extends IPackageManager.Stub {
+ " if any IntentFilter from the " + size
+ " Activities needs verification ...");
- final int verificationId = mIntentFilterVerificationToken++;
int count = 0;
final String packageName = pkg.packageName;
- boolean needToVerify = false;
synchronized (mPackages) {
+ // If this is a new install and we see that we've already run verification for this
+ // package, we have nothing to do: it means the state was restored from backup.
+ if (!replacing) {
+ IntentFilterVerificationInfo ivi =
+ mSettings.getIntentFilterVerificationLPr(packageName);
+ if (ivi != null) {
+ if (DEBUG_DOMAIN_VERIFICATION) {
+ Slog.i(TAG, "Package " + packageName+ " already verified: status="
+ + ivi.getStatusString());
+ }
+ return;
+ }
+ }
+
// If any filters need to be verified, then all need to be.
+ boolean needToVerify = false;
for (PackageParser.Activity a : pkg.activities) {
for (ActivityIntentInfo filter : a.intents) {
if (filter.needsVerification() && needsNetworkVerificationLPr(filter)) {
@@ -11828,7 +11966,9 @@ public class PackageManagerService extends IPackageManager.Stub {
}
}
}
+
if (needToVerify) {
+ final int verificationId = mIntentFilterVerificationToken++;
for (PackageParser.Activity a : pkg.activities) {
for (ActivityIntentInfo filter : a.intents) {
boolean needsFilterVerification = filter.hasWebDataURI();
@@ -13268,9 +13408,45 @@ public class PackageManagerService extends IPackageManager.Stub {
}
/**
+ * Common machinery for picking apart a restored XML blob and passing
+ * it to a caller-supplied functor to be applied to the running system.
+ */
+ private void restoreFromXml(XmlPullParser parser, int userId,
+ String expectedStartTag, BlobXmlRestorer functor)
+ throws IOException, XmlPullParserException {
+ int type;
+ while ((type = parser.next()) != XmlPullParser.START_TAG
+ && type != XmlPullParser.END_DOCUMENT) {
+ }
+ if (type != XmlPullParser.START_TAG) {
+ // oops didn't find a start tag?!
+ if (DEBUG_BACKUP) {
+ Slog.e(TAG, "Didn't find start tag during restore");
+ }
+ return;
+ }
+
+ // this is supposed to be TAG_PREFERRED_BACKUP
+ if (!expectedStartTag.equals(parser.getName())) {
+ if (DEBUG_BACKUP) {
+ Slog.e(TAG, "Found unexpected tag " + parser.getName());
+ }
+ return;
+ }
+
+ // skip interfering stuff, then we're aligned with the backing implementation
+ while ((type = parser.next()) == XmlPullParser.TEXT) { }
+ functor.apply(parser, userId);
+ }
+
+ private interface BlobXmlRestorer {
+ public void apply(XmlPullParser parser, int userId) throws IOException, XmlPullParserException;
+ }
+
+ /**
* Non-Binder method, support for the backup/restore mechanism: write the
- * full set of preferred activities in its canonical XML format. Returns true
- * on success; false otherwise.
+ * full set of preferred activities in its canonical XML format. Returns the
+ * XML output as a byte array, or null if there is none.
*/
@Override
public byte[] getPreferredActivityBackup(int userId) {
@@ -13311,32 +13487,134 @@ public class PackageManagerService extends IPackageManager.Stub {
try {
final XmlPullParser parser = Xml.newPullParser();
parser.setInput(new ByteArrayInputStream(backup), StandardCharsets.UTF_8.name());
+ restoreFromXml(parser, userId, TAG_PREFERRED_BACKUP,
+ new BlobXmlRestorer() {
+ @Override
+ public void apply(XmlPullParser parser, int userId)
+ throws XmlPullParserException, IOException {
+ synchronized (mPackages) {
+ mSettings.readPreferredActivitiesLPw(parser, userId);
+ }
+ }
+ } );
+ } catch (Exception e) {
+ if (DEBUG_BACKUP) {
+ Slog.e(TAG, "Exception restoring preferred activities: " + e.getMessage());
+ }
+ }
+ }
- int type;
- while ((type = parser.next()) != XmlPullParser.START_TAG
- && type != XmlPullParser.END_DOCUMENT) {
+ /**
+ * Non-Binder method, support for the backup/restore mechanism: write the
+ * default browser (etc) settings in its canonical XML format. Returns the default
+ * browser XML representation as a byte array, or null if there is none.
+ */
+ @Override
+ public byte[] getDefaultAppsBackup(int userId) {
+ if (Binder.getCallingUid() != Process.SYSTEM_UID) {
+ throw new SecurityException("Only the system may call getDefaultAppsBackup()");
+ }
+
+ ByteArrayOutputStream dataStream = new ByteArrayOutputStream();
+ try {
+ final XmlSerializer serializer = new FastXmlSerializer();
+ serializer.setOutput(dataStream, StandardCharsets.UTF_8.name());
+ serializer.startDocument(null, true);
+ serializer.startTag(null, TAG_DEFAULT_APPS);
+
+ synchronized (mPackages) {
+ mSettings.writeDefaultAppsLPr(serializer, userId);
}
- if (type != XmlPullParser.START_TAG) {
- // oops didn't find a start tag?!
- if (DEBUG_BACKUP) {
- Slog.e(TAG, "Didn't find start tag during restore");
- }
- return;
+
+ serializer.endTag(null, TAG_DEFAULT_APPS);
+ serializer.endDocument();
+ serializer.flush();
+ } catch (Exception e) {
+ if (DEBUG_BACKUP) {
+ Slog.e(TAG, "Unable to write default apps for backup", e);
}
+ return null;
+ }
- // this is supposed to be TAG_PREFERRED_BACKUP
- if (!TAG_PREFERRED_BACKUP.equals(parser.getName())) {
- if (DEBUG_BACKUP) {
- Slog.e(TAG, "Found unexpected tag " + parser.getName());
- }
- return;
+ return dataStream.toByteArray();
+ }
+
+ @Override
+ public void restoreDefaultApps(byte[] backup, int userId) {
+ if (Binder.getCallingUid() != Process.SYSTEM_UID) {
+ throw new SecurityException("Only the system may call restoreDefaultApps()");
+ }
+
+ try {
+ final XmlPullParser parser = Xml.newPullParser();
+ parser.setInput(new ByteArrayInputStream(backup), StandardCharsets.UTF_8.name());
+ restoreFromXml(parser, userId, TAG_DEFAULT_APPS,
+ new BlobXmlRestorer() {
+ @Override
+ public void apply(XmlPullParser parser, int userId)
+ throws XmlPullParserException, IOException {
+ synchronized (mPackages) {
+ mSettings.readDefaultAppsLPw(parser, userId);
+ }
+ }
+ } );
+ } catch (Exception e) {
+ if (DEBUG_BACKUP) {
+ Slog.e(TAG, "Exception restoring default apps: " + e.getMessage());
}
+ }
+ }
+
+ @Override
+ public byte[] getIntentFilterVerificationBackup(int userId) {
+ if (Binder.getCallingUid() != Process.SYSTEM_UID) {
+ throw new SecurityException("Only the system may call getIntentFilterVerificationBackup()");
+ }
+
+ ByteArrayOutputStream dataStream = new ByteArrayOutputStream();
+ try {
+ final XmlSerializer serializer = new FastXmlSerializer();
+ serializer.setOutput(dataStream, StandardCharsets.UTF_8.name());
+ serializer.startDocument(null, true);
+ serializer.startTag(null, TAG_INTENT_FILTER_VERIFICATION);
- // skip interfering stuff, then we're aligned with the backing implementation
- while ((type = parser.next()) == XmlPullParser.TEXT) { }
synchronized (mPackages) {
- mSettings.readPreferredActivitiesLPw(parser, userId);
+ mSettings.writeAllDomainVerificationsLPr(serializer, userId);
+ }
+
+ serializer.endTag(null, TAG_INTENT_FILTER_VERIFICATION);
+ serializer.endDocument();
+ serializer.flush();
+ } catch (Exception e) {
+ if (DEBUG_BACKUP) {
+ Slog.e(TAG, "Unable to write default apps for backup", e);
}
+ return null;
+ }
+
+ return dataStream.toByteArray();
+ }
+
+ @Override
+ public void restoreIntentFilterVerification(byte[] backup, int userId) {
+ if (Binder.getCallingUid() != Process.SYSTEM_UID) {
+ throw new SecurityException("Only the system may call restorePreferredActivities()");
+ }
+
+ try {
+ final XmlPullParser parser = Xml.newPullParser();
+ parser.setInput(new ByteArrayInputStream(backup), StandardCharsets.UTF_8.name());
+ restoreFromXml(parser, userId, TAG_INTENT_FILTER_VERIFICATION,
+ new BlobXmlRestorer() {
+ @Override
+ public void apply(XmlPullParser parser, int userId)
+ throws XmlPullParserException, IOException {
+ synchronized (mPackages) {
+ mSettings.readAllDomainVerificationsLPr(parser, userId);
+ mSettings.writeLPr();
+ }
+ }
+ } );
} catch (Exception e) {
if (DEBUG_BACKUP) {
Slog.e(TAG, "Exception restoring preferred activities: " + e.getMessage());
diff --git a/services/core/java/com/android/server/pm/Settings.java b/services/core/java/com/android/server/pm/Settings.java
index 6415343916d2..169f6de9b27a 100644
--- a/services/core/java/com/android/server/pm/Settings.java
+++ b/services/core/java/com/android/server/pm/Settings.java
@@ -174,6 +174,8 @@ final class Settings {
"crossProfile-intent-filters";
public static final String TAG_DOMAIN_VERIFICATION = "domain-verification";
public static final String TAG_DEFAULT_APPS= "default-apps";
+ public static final String TAG_ALL_INTENT_FILTER_VERIFICATION =
+ "all-intent-filter-verifications";
public static final String TAG_DEFAULT_BROWSER= "default-browser";
private static final String ATTR_NAME = "name";
@@ -206,10 +208,15 @@ final class Settings {
final ArrayMap<String, PackageSetting> mPackages =
new ArrayMap<String, PackageSetting>();
+
// List of replaced system applications
private final ArrayMap<String, PackageSetting> mDisabledSysPackages =
new ArrayMap<String, PackageSetting>();
+ // Set of restored intent-filter verification states
+ private final ArrayMap<String, IntentFilterVerificationInfo> mRestoredIntentFilterVerifications =
+ new ArrayMap<String, IntentFilterVerificationInfo>();
+
private static int mFirstAvailableUid = 0;
// TODO: store SDK versions and fingerprint for each volume UUID
@@ -753,7 +760,8 @@ final class Settings {
}
// Utility method that adds a PackageSetting to mPackages and
- // completes updating the shared user attributes
+ // completes updating the shared user attributes and any restored
+ // app link verification state
private void addPackageSettingLPw(PackageSetting p, String name,
SharedUserSetting sharedUser) {
mPackages.put(name, p);
@@ -776,6 +784,14 @@ final class Settings {
p.sharedUser = sharedUser;
p.appId = sharedUser.userId;
}
+ IntentFilterVerificationInfo ivi = mRestoredIntentFilterVerifications.get(name);
+ if (ivi != null) {
+ if (DEBUG_DOMAIN_VERIFICATION) {
+ Slog.i(TAG, "Applying restored IVI for " + name + " : " + ivi.getStatusString());
+ }
+ mRestoredIntentFilterVerifications.remove(name);
+ p.setIntentFilterVerificationInfo(ivi);
+ }
}
/*
@@ -1259,13 +1275,13 @@ final class Settings {
if (type == XmlPullParser.END_TAG || type == XmlPullParser.TEXT) {
continue;
}
- String tagName = parser.getName();
+ final String tagName = parser.getName();
if (tagName.equals(TAG_ITEM)) {
CrossProfileIntentFilter cpif = new CrossProfileIntentFilter(parser);
editCrossProfileIntentResolverLPw(userId).addFilter(cpif);
} else {
String msg = "Unknown element under " + TAG_CROSS_PROFILE_INTENT_FILTERS + ": " +
- parser.getName();
+ tagName;
PackageManagerService.reportSettingsProblem(Log.WARN, msg);
XmlUtils.skipCurrentTag(parser);
}
@@ -1279,7 +1295,31 @@ final class Settings {
Log.d(TAG, "Read domain verification for package:" + ivi.getPackageName());
}
- private void readDefaultAppsLPw(XmlPullParser parser, int userId)
+ private void readRestoredIntentFilterVerifications(XmlPullParser parser)
+ throws XmlPullParserException, IOException {
+ int outerDepth = parser.getDepth();
+ int type;
+ while ((type = parser.next()) != XmlPullParser.END_DOCUMENT
+ && (type != XmlPullParser.END_TAG || parser.getDepth() > outerDepth)) {
+ if (type == XmlPullParser.END_TAG || type == XmlPullParser.TEXT) {
+ continue;
+ }
+ final String tagName = parser.getName();
+ if (tagName.equals(TAG_DOMAIN_VERIFICATION)) {
+ IntentFilterVerificationInfo ivi = new IntentFilterVerificationInfo(parser);
+ if (DEBUG_DOMAIN_VERIFICATION) {
+ Slog.i(TAG, "Restored IVI for " + ivi.getPackageName()
+ + " status=" + ivi.getStatusString());
+ }
+ mRestoredIntentFilterVerifications.put(ivi.getPackageName(), ivi);
+ } else {
+ Slog.w(TAG, "Unknown element: " + tagName);
+ XmlUtils.skipCurrentTag(parser);
+ }
+ }
+ }
+
+ void readDefaultAppsLPw(XmlPullParser parser, int userId)
throws XmlPullParserException, IOException {
int outerDepth = parser.getDepth();
int type;
@@ -1563,6 +1603,62 @@ final class Settings {
}
}
+ // Specifically for backup/restore
+ void writeAllDomainVerificationsLPr(XmlSerializer serializer, int userId)
+ throws IllegalArgumentException, IllegalStateException, IOException {
+ serializer.startTag(null, TAG_ALL_INTENT_FILTER_VERIFICATION);
+ final int N = mPackages.size();
+ for (int i = 0; i < N; i++) {
+ PackageSetting ps = mPackages.valueAt(i);
+ IntentFilterVerificationInfo ivi = ps.getIntentFilterVerificationInfo();
+ if (ivi != null) {
+ writeDomainVerificationsLPr(serializer, ivi);
+ }
+ }
+ serializer.endTag(null, TAG_ALL_INTENT_FILTER_VERIFICATION);
+ }
+
+ // Specifically for backup/restore
+ void readAllDomainVerificationsLPr(XmlPullParser parser, int userId)
+ throws XmlPullParserException, IOException {
+ mRestoredIntentFilterVerifications.clear();
+
+ int outerDepth = parser.getDepth();
+ int type;
+ while ((type = parser.next()) != XmlPullParser.END_DOCUMENT
+ && (type != XmlPullParser.END_TAG || parser.getDepth() > outerDepth)) {
+ if (type == XmlPullParser.END_TAG || type == XmlPullParser.TEXT) {
+ continue;
+ }
+
+ String tagName = parser.getName();
+ if (tagName.equals(TAG_DOMAIN_VERIFICATION)) {
+ IntentFilterVerificationInfo ivi = new IntentFilterVerificationInfo(parser);
+ final String pkgName = ivi.getPackageName();
+ final PackageSetting ps = mPackages.get(pkgName);
+ if (ps != null) {
+ // known/existing package; update in place
+ ps.setIntentFilterVerificationInfo(ivi);
+ if (DEBUG_DOMAIN_VERIFICATION) {
+ Slog.d(TAG, "Restored IVI for existing app " + pkgName
+ + " status=" + ivi.getStatusString());
+ }
+ } else {
+ mRestoredIntentFilterVerifications.put(pkgName, ivi);
+ if (DEBUG_DOMAIN_VERIFICATION) {
+ Slog.d(TAG, "Restored IVI for pending app " + pkgName
+ + " status=" + ivi.getStatusString());
+ }
+ }
+ } else {
+ PackageManagerService.reportSettingsProblem(Log.WARN,
+ "Unknown element under <all-intent-filter-verification>: "
+ + parser.getName());
+ XmlUtils.skipCurrentTag(parser);
+ }
+ }
+ }
+
void writeDefaultAppsLPr(XmlSerializer serializer, int userId)
throws IllegalArgumentException, IllegalStateException, IOException {
serializer.startTag(null, TAG_DEFAULT_APPS);
@@ -2012,6 +2108,23 @@ final class Settings {
}
}
+ final int numIVIs = mRestoredIntentFilterVerifications.size();
+ if (numIVIs > 0) {
+ if (DEBUG_DOMAIN_VERIFICATION) {
+ Slog.i(TAG, "Writing restored-ivi entries to packages.xml");
+ }
+ serializer.startTag(null, "restored-ivi");
+ for (int i = 0; i < numIVIs; i++) {
+ IntentFilterVerificationInfo ivi = mRestoredIntentFilterVerifications.valueAt(i);
+ writeDomainVerificationsLPr(serializer, ivi);
+ }
+ serializer.endTag(null, "restored-ivi");
+ } else {
+ if (DEBUG_DOMAIN_VERIFICATION) {
+ Slog.i(TAG, " no restored IVI entries to write");
+ }
+ }
+
mKeySetManagerService.writeKeySetManagerServiceLPr(serializer);
serializer.endTag(null, "packages");
@@ -2441,6 +2554,8 @@ final class Settings {
if (nname != null && oname != null) {
mRenamedPackages.put(nname, oname);
}
+ } else if (tagName.equals("restored-ivi")) {
+ readRestoredIntentFilterVerifications(parser);
} else if (tagName.equals("last-platform-version")) {
mInternalSdkPlatform = mExternalSdkPlatform = 0;
try {
diff --git a/services/core/java/com/android/server/pm/UserManagerService.java b/services/core/java/com/android/server/pm/UserManagerService.java
index 4082ff3a957a..8a8d2a6b104f 100644
--- a/services/core/java/com/android/server/pm/UserManagerService.java
+++ b/services/core/java/com/android/server/pm/UserManagerService.java
@@ -972,6 +972,7 @@ public class UserManagerService extends IUserManager.Stub {
writeBoolean(serializer, restrictions, UserManager.DISALLOW_OUTGOING_BEAM);
writeBoolean(serializer, restrictions, UserManager.DISALLOW_WALLPAPER);
writeBoolean(serializer, restrictions, UserManager.DISALLOW_SAFE_BOOT);
+ writeBoolean(serializer, restrictions, UserManager.ALLOW_PARENT_APP_LINKING);
serializer.endTag(null, TAG_RESTRICTIONS);
}
@@ -1103,6 +1104,7 @@ public class UserManagerService extends IUserManager.Stub {
readBoolean(parser, restrictions, UserManager.DISALLOW_OUTGOING_BEAM);
readBoolean(parser, restrictions, UserManager.DISALLOW_WALLPAPER);
readBoolean(parser, restrictions, UserManager.DISALLOW_SAFE_BOOT);
+ readBoolean(parser, restrictions, UserManager.ALLOW_PARENT_APP_LINKING);
}
private void readBoolean(XmlPullParser parser, Bundle restrictions,
diff --git a/services/core/java/com/android/server/statusbar/StatusBarManagerService.java b/services/core/java/com/android/server/statusbar/StatusBarManagerService.java
index a7543790cc10..7640837f4e73 100644
--- a/services/core/java/com/android/server/statusbar/StatusBarManagerService.java
+++ b/services/core/java/com/android/server/statusbar/StatusBarManagerService.java
@@ -29,6 +29,7 @@ import android.util.Slog;
import com.android.internal.statusbar.IStatusBar;
import com.android.internal.statusbar.IStatusBarService;
+import com.android.internal.statusbar.NotificationVisibility;
import com.android.internal.statusbar.StatusBarIcon;
import com.android.internal.statusbar.StatusBarIconList;
import com.android.server.LocalServices;
@@ -660,7 +661,8 @@ public class StatusBarManagerService extends IStatusBarService.Stub {
@Override
public void onNotificationVisibilityChanged(
- String[] newlyVisibleKeys, String[] noLongerVisibleKeys) throws RemoteException {
+ NotificationVisibility[] newlyVisibleKeys, NotificationVisibility[] noLongerVisibleKeys)
+ throws RemoteException {
enforceStatusBarService();
long identity = Binder.clearCallingIdentity();
try {
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index ace59970d0bf..b285b663bd14 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -2671,6 +2671,16 @@ public class WindowManagerService extends IWindowManager.Stub
synchronized(mWindowMap) {
mScreenCaptureDisabled.put(userId, disabled);
+ // Update secure surface for all windows belonging to this user.
+ for (int displayNdx = mDisplayContents.size() - 1; displayNdx >= 0; --displayNdx) {
+ WindowList windows = mDisplayContents.valueAt(displayNdx).getWindowList();
+ for (int winNdx = windows.size() - 1; winNdx >= 0; --winNdx) {
+ final WindowState win = windows.get(winNdx);
+ if (win.mHasSurface && userId == UserHandle.getUserId(win.mOwnerUid)) {
+ win.mWinAnimator.setSecureLocked(disabled);
+ }
+ }
+ }
}
}
diff --git a/services/core/java/com/android/server/wm/WindowStateAnimator.java b/services/core/java/com/android/server/wm/WindowStateAnimator.java
index f1331e94bd42..d818519d5dfa 100644
--- a/services/core/java/com/android/server/wm/WindowStateAnimator.java
+++ b/services/core/java/com/android/server/wm/WindowStateAnimator.java
@@ -658,6 +658,11 @@ class WindowStateAnimator {
}
@Override
+ public void setSecure(boolean isSecure) {
+ super.setSecure(isSecure);
+ }
+
+ @Override
public void setMatrix(float dsdx, float dtdx, float dsdy, float dtdy) {
if (dsdx != mDsdx || dtdx != mDtdx || dsdy != mDsdy || dtdy != mDtdy) {
if (logSurfaceTrace) Slog.v(SURFACE_TAG, "setMatrix(" + dsdx + "," + dtdx + ","
@@ -1663,6 +1668,22 @@ class WindowStateAnimator {
}
}
+ void setSecureLocked(boolean isSecure) {
+ if (mSurfaceControl == null) {
+ return;
+ }
+ if (SHOW_LIGHT_TRANSACTIONS) Slog.i(TAG, ">>> OPEN TRANSACTION setSecureLocked");
+ SurfaceControl.openTransaction();
+ try {
+ if (SHOW_TRANSACTIONS) WindowManagerService.logSurface(mWin, "isSecure=" + isSecure,
+ null);
+ mSurfaceControl.setSecure(isSecure);
+ } finally {
+ SurfaceControl.closeTransaction();
+ if (SHOW_LIGHT_TRANSACTIONS) Slog.i(TAG, "<<< CLOSE TRANSACTION setSecureLocked");
+ }
+ }
+
// This must be called while inside a transaction.
boolean performShowLocked() {
if (mWin.isHiddenFromUserLocked()) {
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
index 3b62b61a1f3c..74adc6b30747 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
@@ -246,6 +246,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
GLOBAL_SETTINGS_WHITELIST.add(Settings.Global.USB_MASS_STORAGE_ENABLED);
GLOBAL_SETTINGS_WHITELIST.add(Settings.Global.WIFI_SLEEP_POLICY);
GLOBAL_SETTINGS_WHITELIST.add(Settings.Global.STAY_ON_WHILE_PLUGGED_IN);
+ GLOBAL_SETTINGS_WHITELIST.add(Settings.Global.WIFI_DEVICE_OWNER_CONFIGS_LOCKDOWN);
}
// Keyguard features that when set of a profile will affect the profiles
@@ -3231,15 +3232,21 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
}
final UserHandle caller = Binder.getCallingUserHandle();
- final ComponentName profileOwner = getProfileOwner(caller.getIdentifier());
-
- if (profileOwner == null) {
+ // If there is a profile owner, redirect to that; otherwise query the device owner.
+ ComponentName aliasChooser = getProfileOwner(caller.getIdentifier());
+ if (aliasChooser == null && caller.isOwner()) {
+ ActiveAdmin deviceOwnerAdmin = getDeviceOwnerAdmin();
+ if (deviceOwnerAdmin != null) {
+ aliasChooser = deviceOwnerAdmin.info.getComponent();
+ }
+ }
+ if (aliasChooser == null) {
sendPrivateKeyAliasResponse(null, response);
return;
}
Intent intent = new Intent(DeviceAdminReceiver.ACTION_CHOOSE_PRIVATE_KEY_ALIAS);
- intent.setComponent(profileOwner);
+ intent.setComponent(aliasChooser);
intent.putExtra(DeviceAdminReceiver.EXTRA_CHOOSE_PRIVATE_KEY_SENDER_UID, uid);
intent.putExtra(DeviceAdminReceiver.EXTRA_CHOOSE_PRIVATE_KEY_URI, uri);
intent.putExtra(DeviceAdminReceiver.EXTRA_CHOOSE_PRIVATE_KEY_ALIAS, alias);
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index b7ca7499b64c..cec11cfd17d1 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -944,10 +944,17 @@ public class TelephonyManager {
/** {@hide} */
@SystemApi
public int getCurrentPhoneType(int subId) {
- int phoneId = SubscriptionManager.getPhoneId(subId);
+ int phoneId;
+ if (subId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
+ // if we don't have any sims, we don't have subscriptions, but we
+ // still may want to know what type of phone we've got.
+ phoneId = 0;
+ } else {
+ phoneId = SubscriptionManager.getPhoneId(subId);
+ }
try{
ITelephony telephony = getITelephony();
- if (telephony != null) {
+ if (telephony != null && subId != SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
return telephony.getActivePhoneTypeForSubscriber(subId);
} else {
// This can happen when the ITelephony interface is not up yet.
diff --git a/wifi/java/android/net/wifi/ScanResult.java b/wifi/java/android/net/wifi/ScanResult.java
index 5dc70bd49baf..fc6a3de753fe 100644
--- a/wifi/java/android/net/wifi/ScanResult.java
+++ b/wifi/java/android/net/wifi/ScanResult.java
@@ -18,6 +18,7 @@ package android.net.wifi;
import android.os.Parcel;
import android.os.Parcelable;
+import android.util.Log;
/**
* Describes information about a detected access point. In addition
@@ -80,27 +81,30 @@ public class ScanResult implements Parcelable {
public static final int CHANNEL_WIDTH_80MHZ_PLUS_MHZ = 4;
/**
- * AP Channel bandwidth
+ * AP Channel bandwidth; one of {@link #CHANNEL_WIDTH_20MHZ}, {@link #CHANNEL_WIDTH_40MHZ},
+ * {@link #CHANNEL_WIDTH_80MHZ}, {@link #CHANNEL_WIDTH_160MHZ}
+ * or {@link #CHANNEL_WIDTH_80MHZ_PLUS_MHZ}.
*/
public int channelWidth;
/**
* Not used if the AP bandwidth is 20 MHz
- * If the AP use 40, 80 or 160 MHz, this is the center frequency
- * if the AP use 80 + 80 MHz, this is the center frequency of the first segment
+ * If the AP use 40, 80 or 160 MHz, this is the center frequency (in MHz)
+ * if the AP use 80 + 80 MHz, this is the center frequency of the first segment (in MHz)
*/
public int centerFreq0;
/**
* Only used if the AP bandwidth is 80 + 80 MHz
- * if the AP use 80 + 80 MHz, this is the center frequency of the second segment
+ * if the AP use 80 + 80 MHz, this is the center frequency of the second segment (in MHz)
*/
public int centerFreq1;
/**
- * Whether the AP support 802.11mc Responder
+ * @deprecated use is80211mcResponder() instead
+ * @hide
*/
- public boolean is80211McRTTResponder;
+ public boolean is80211McRTTResponder;
/**
* timestamp in microseconds (since boot) when
@@ -123,7 +127,7 @@ public class ScanResult implements Parcelable {
/**
* @hide
* Update RSSI of the scan result
- * @param previousRSSI
+ * @param previousRssi
* @param previousSeen
* @param maxAge
*/
@@ -206,26 +210,56 @@ public class ScanResult implements Parcelable {
public int distanceCm;
/**
- * The standard deviation of the distance to the AP, if available.
+ * The standard deviation of the distance to the access point, if available.
* Else {@link UNSPECIFIED}.
* {@hide}
*/
public int distanceSdCm;
+ public static final long FLAG_PASSPOINT_NETWORK = 0x0000000000000001;
+ public static final long FLAG_80211mc_RESPONDER = 0x0000000000000002;
+
/**
- * Indicates if the scan result represents a passpoint AP
+ * Defines flags; such as {@link #FLAG_PASSPOINT_NETWORK}.
*/
- public boolean passpointNetwork;
+ public long flags;
/**
- * Indicates if venue name
+ * sets a flag in {@link #flags} field
+ * @param flag flag to set
+ * @hide
*/
- public String venueName;
+ public void setFlag(long flag) {
+ flags |= flag;
+ }
/**
- * Indicates operator name
+ * clears a flag in {@link #flags} field
+ * @param flag flag to set
+ * @hide
*/
- public String operatorFriendlyName;
+ public void clearFlag(long flag) {
+ flags &= ~flag;
+ }
+
+ public boolean is80211mcResponder() {
+ return (flags & FLAG_80211mc_RESPONDER) != 0;
+ }
+
+ public boolean isPasspointNetwork() {
+ return (flags & FLAG_PASSPOINT_NETWORK) != 0;
+ }
+
+ /**
+ * Indicates venue name (such as 'San Francisco Airport') published by access point; only
+ * available on passpoint network and if published by access point.
+ */
+ public CharSequence venueName;
+
+ /**
+ * Indicates passpoint operator name published by access point.
+ */
+ public CharSequence operatorFriendlyName;
/**
* {@hide}
@@ -267,7 +301,7 @@ public class ScanResult implements Parcelable {
**/
public byte[] bytes;
- /** information element from beacon
+ /** information elements from beacon
* @hide
*/
public static class InformationElement {
@@ -303,8 +337,7 @@ public class ScanResult implements Parcelable {
this.channelWidth = UNSPECIFIED;
this.centerFreq0 = UNSPECIFIED;
this.centerFreq1 = UNSPECIFIED;
- this.is80211McRTTResponder = false;
- this.passpointNetwork = false;
+ this.flags = 0;
}
/** {@hide} */
@@ -322,8 +355,7 @@ public class ScanResult implements Parcelable {
this.channelWidth = UNSPECIFIED;
this.centerFreq0 = UNSPECIFIED;
this.centerFreq1 = UNSPECIFIED;
- this.is80211McRTTResponder = false;
- this.passpointNetwork = false;
+ this.flags = 0;
}
/** {@hide} */
@@ -342,8 +374,11 @@ public class ScanResult implements Parcelable {
this.channelWidth = channelWidth;
this.centerFreq0 = centerFreq0;
this.centerFreq1 = centerFreq1;
- this.is80211McRTTResponder = is80211McRTTResponder;
- this.passpointNetwork = false;
+ if (is80211McRTTResponder) {
+ this.flags = FLAG_80211mc_RESPONDER;
+ } else {
+ this.flags = 0;
+ }
}
/** copy constructor {@hide} */
@@ -358,7 +393,6 @@ public class ScanResult implements Parcelable {
channelWidth = source.channelWidth;
centerFreq0 = source.centerFreq0;
centerFreq1 = source.centerFreq1;
- is80211McRTTResponder = source.is80211McRTTResponder;
timestamp = source.timestamp;
distanceCm = source.distanceCm;
distanceSdCm = source.distanceSdCm;
@@ -369,9 +403,9 @@ public class ScanResult implements Parcelable {
numUsage = source.numUsage;
numIpConfigFailures = source.numIpConfigFailures;
isAutoJoinCandidate = source.isAutoJoinCandidate;
- passpointNetwork = source.passpointNetwork;
venueName = source.venueName;
operatorFriendlyName = source.operatorFriendlyName;
+ flags = source.flags;
}
}
@@ -405,15 +439,16 @@ public class ScanResult implements Parcelable {
sb.append(", distanceSd: ").append((distanceSdCm != UNSPECIFIED ? distanceSdCm : "?")).
append("(cm)");
- sb.append(", passpoint: ").append(passpointNetwork ? "yes" : "no");
+ sb.append(", passpoint: ");
+ sb.append(((flags & FLAG_PASSPOINT_NETWORK) != 0) ? "yes" : "no");
if (autoJoinStatus != 0) {
sb.append(", status: ").append(autoJoinStatus);
}
sb.append(", ChannelBandwidth: ").append(channelWidth);
sb.append(", centerFreq0: ").append(centerFreq0);
sb.append(", centerFreq1: ").append(centerFreq1);
- sb.append(", 80211mcResponder: ").append(is80211McRTTResponder?
- "is supported":"is not supported");
+ sb.append(", 80211mcResponder: ");
+ sb.append(((flags & FLAG_80211mc_RESPONDER) != 0) ? "is supported" : "is not supported");
return sb.toString();
}
@@ -440,7 +475,6 @@ public class ScanResult implements Parcelable {
dest.writeInt(channelWidth);
dest.writeInt(centerFreq0);
dest.writeInt(centerFreq1);
- dest.writeInt(is80211McRTTResponder ? 1 : 0);
dest.writeLong(seen);
dest.writeInt(autoJoinStatus);
dest.writeInt(untrusted ? 1 : 0);
@@ -448,9 +482,9 @@ public class ScanResult implements Parcelable {
dest.writeInt(numUsage);
dest.writeInt(numIpConfigFailures);
dest.writeInt(isAutoJoinCandidate);
- dest.writeInt(passpointNetwork ? 1 : 0);
- dest.writeString(venueName);
- dest.writeString(operatorFriendlyName);
+ dest.writeString((venueName != null) ? venueName.toString() : "");
+ dest.writeString((operatorFriendlyName != null) ? operatorFriendlyName.toString() : "");
+ dest.writeLong(this.flags);
if (informationElements != null) {
dest.writeInt(informationElements.length);
@@ -474,18 +508,19 @@ public class ScanResult implements Parcelable {
}
ScanResult sr = new ScanResult(
wifiSsid,
- in.readString(),
- in.readString(),
- in.readInt(),
- in.readInt(),
- in.readLong(),
- in.readInt(),
- in.readInt(),
- in.readInt(),
- in.readInt(),
- in.readInt(),
- in.readInt() == 1
+ in.readString(), /* BSSID */
+ in.readString(), /* capabilities */
+ in.readInt(), /* level */
+ in.readInt(), /* frequency */
+ in.readLong(), /* timestamp */
+ in.readInt(), /* distanceCm */
+ in.readInt(), /* distanceSdCm */
+ in.readInt(), /* channelWidth */
+ in.readInt(), /* centerFreq0 */
+ in.readInt(), /* centerFreq1 */
+ false /* rtt responder, fixed with flags below */
);
+
sr.seen = in.readLong();
sr.autoJoinStatus = in.readInt();
sr.untrusted = in.readInt() != 0;
@@ -493,9 +528,9 @@ public class ScanResult implements Parcelable {
sr.numUsage = in.readInt();
sr.numIpConfigFailures = in.readInt();
sr.isAutoJoinCandidate = in.readInt();
- sr.passpointNetwork = in.readInt() == 1;
sr.venueName = in.readString();
sr.operatorFriendlyName = in.readString();
+ sr.flags = in.readLong();
int n = in.readInt();
if (n != 0) {
sr.informationElements = new InformationElement[n];
diff --git a/wifi/java/android/net/wifi/WifiConfiguration.java b/wifi/java/android/net/wifi/WifiConfiguration.java
index 5d55ec611be0..5d834f6bc568 100644
--- a/wifi/java/android/net/wifi/WifiConfiguration.java
+++ b/wifi/java/android/net/wifi/WifiConfiguration.java
@@ -344,14 +344,15 @@ public class WifiConfiguration implements Parcelable {
public String FQDN;
/**
- * Service provider name, for Passpoint credential.
+ * Name of passpoint credential provider
*/
public String providerFriendlyName;
/**
- * Roaming Consortium Id, for Passpoint credential.
+ * Roaming Consortium Id list for passpoint credential; identifies a set of networks where
+ * passpoint credential will be considered valid
*/
- public HashSet<Long> roamingConsortiumIds;
+ public Long[] roamingConsortiumIds;
/**
* @hide
@@ -906,7 +907,7 @@ public class WifiConfiguration implements Parcelable {
SSID = null;
BSSID = null;
FQDN = null;
- roamingConsortiumIds = new HashSet<Long>();
+ roamingConsortiumIds = new Long[0];
priority = 0;
hiddenSSID = false;
disableReason = DISABLED_UNKNOWN_REASON;
@@ -1437,11 +1438,7 @@ public class WifiConfiguration implements Parcelable {
SSID = source.SSID;
BSSID = source.BSSID;
FQDN = source.FQDN;
- roamingConsortiumIds = new HashSet<Long>();
- for (Long roamingConsortiumId : source.roamingConsortiumIds) {
- roamingConsortiumIds.add(roamingConsortiumId);
- }
-
+ roamingConsortiumIds = source.roamingConsortiumIds.clone();
providerFriendlyName = source.providerFriendlyName;
preSharedKey = source.preSharedKey;
@@ -1546,7 +1543,7 @@ public class WifiConfiguration implements Parcelable {
dest.writeString(autoJoinBSSID);
dest.writeString(FQDN);
dest.writeString(providerFriendlyName);
- dest.writeInt(roamingConsortiumIds.size());
+ dest.writeInt(roamingConsortiumIds.length);
for (Long roamingConsortiumId : roamingConsortiumIds) {
dest.writeLong(roamingConsortiumId);
}
@@ -1622,8 +1619,9 @@ public class WifiConfiguration implements Parcelable {
config.FQDN = in.readString();
config.providerFriendlyName = in.readString();
int numRoamingConsortiumIds = in.readInt();
+ config.roamingConsortiumIds = new Long[numRoamingConsortiumIds];
for (int i = 0; i < numRoamingConsortiumIds; i++) {
- config.roamingConsortiumIds.add(in.readLong());
+ config.roamingConsortiumIds[i] = in.readLong();
}
config.preSharedKey = in.readString();
for (int i = 0; i < config.wepKeys.length; i++) {
diff --git a/wifi/java/android/net/wifi/WifiEnterpriseConfig.java b/wifi/java/android/net/wifi/WifiEnterpriseConfig.java
index 3525ec26f53a..e611ea448497 100644
--- a/wifi/java/android/net/wifi/WifiEnterpriseConfig.java
+++ b/wifi/java/android/net/wifi/WifiEnterpriseConfig.java
@@ -604,12 +604,13 @@ public class WifiEnterpriseConfig implements Parcelable {
* Get the domain_suffix_match value. See setDomSuffixMatch.
* @return The domain value.
*/
- public String getDomainSubjectMatch() {
+ public String getDomainSuffixMatch() {
return getFieldValue(DOM_SUFFIX_MATCH_KEY, "");
}
/**
- * Set realm for passpoint credential
+ * Set realm for passpoint credential; realm identifies a set of networks where your
+ * passpoint credential can be used
* @param realm the realm
*/
public void setRealm(String realm) {
@@ -617,7 +618,7 @@ public class WifiEnterpriseConfig implements Parcelable {
}
/**
- * Get realm for passpoint credential
+ * Get realm for passpoint credential; see {@link #setRealm(String)} for more information
* @return the realm
*/
public String getRealm() {
@@ -625,15 +626,16 @@ public class WifiEnterpriseConfig implements Parcelable {
}
/**
- * Set plmn for passpoint credential
- * @param plmn the plmn value derived from mcc & mnc
+ * Set plmn (Public Land Mobile Network) of the provider of passpoint credential
+ * @param plmn the plmn value derived from mcc (mobile country code) & mnc (mobile network code)
*/
public void setPlmn(String plmn) {
setFieldValue(PLMN_KEY, plmn, "");
}
/**
- * Get plmn for passpoint credential
+ * Get plmn (Public Land Mobile Network) for passpoint credential; see {@link #setPlmn
+ * (String)} for more information
* @return the plmn
*/
public String getPlmn() {
diff --git a/wifi/java/android/net/wifi/WifiInfo.java b/wifi/java/android/net/wifi/WifiInfo.java
index dbfd4ef41ead..2ba38e18fd1c 100644
--- a/wifi/java/android/net/wifi/WifiInfo.java
+++ b/wifi/java/android/net/wifi/WifiInfo.java
@@ -167,15 +167,24 @@ public class WifiInfo implements Parcelable {
long txbad = stats.lostmpdu_be + stats.lostmpdu_bk
+ stats.lostmpdu_vi + stats.lostmpdu_vo;
- txBadRate = (txBadRate * 0.5)
- + ((double) (txbad - txBad) * 0.5);
- txSuccessRate = (txSuccessRate * 0.5)
- + ((double) (txgood - txSuccess) * 0.5);
- rxSuccessRate = (rxSuccessRate * 0.5)
- + ((double) (rxgood - rxSuccess) * 0.5);
- txRetriesRate = (txRetriesRate * 0.5)
- + ((double) (txretries - txRetries) * 0.5);
-
+ if (txBad <= txbad
+ && txSuccess <= txgood
+ && rxSuccess <= rxgood
+ && txRetries <= txretries) {
+ txBadRate = (txBadRate * 0.5)
+ + ((double) (txbad - txBad) * 0.5);
+ txSuccessRate = (txSuccessRate * 0.5)
+ + ((double) (txgood - txSuccess) * 0.5);
+ rxSuccessRate = (rxSuccessRate * 0.5)
+ + ((double) (rxgood - rxSuccess) * 0.5);
+ txRetriesRate = (txRetriesRate * 0.5)
+ + ((double) (txretries - txRetries) * 0.5);
+ } else {
+ txBadRate = 0;
+ txSuccessRate = 0;
+ rxSuccessRate = 0;
+ txRetriesRate = 0;
+ }
txBad = txbad;
txSuccess = txgood;
rxSuccess = rxgood;
@@ -204,11 +213,15 @@ public class WifiInfo implements Parcelable {
txRetries = 0;
txBadRate = 0;
txRetriesRate = 0;
-
- txSuccessRate = (txSuccessRate * 0.5)
- + ((double) (txPackets - txSuccess) * 0.5);
- rxSuccessRate = (rxSuccessRate * 0.5)
- + ((double) (rxPackets - rxSuccess) * 0.5);
+ if (txSuccess <= txPackets && rxSuccess <= rxPackets) {
+ txSuccessRate = (txSuccessRate * 0.5)
+ + ((double) (txPackets - txSuccess) * 0.5);
+ rxSuccessRate = (rxSuccessRate * 0.5)
+ + ((double) (rxPackets - rxSuccess) * 0.5);
+ } else {
+ txBadRate = 0;
+ txRetriesRate = 0;
+ }
txSuccess = txPackets;
rxSuccess = rxPackets;
}
diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java
index 64fa0e5226e6..d00c65414229 100644
--- a/wifi/java/android/net/wifi/WifiManager.java
+++ b/wifi/java/android/net/wifi/WifiManager.java
@@ -399,14 +399,16 @@ public class WifiManager {
public static final int CHANGE_REASON_CONFIG_CHANGE = 2;
/**
* An access point scan has completed, and results are available from the supplicant.
- * Call {@link #getScanResults()} to obtain the results.
+ * Call {@link #getScanResults()} to obtain the results. {@link #EXTRA_RESULTS_UPDATED}
+ * indicates if the scan was completed successfully.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String SCAN_RESULTS_AVAILABLE_ACTION = "android.net.wifi.SCAN_RESULTS";
/**
- * The result of previous scan, reported with {@link #SCAN_RESULTS_AVAILABLE_ACTION}.
- * @return true scan was successful, results updated
+ * Lookup key for a {@code boolean} representing the result of previous {@link #startScan}
+ * operation, reported with {@link #SCAN_RESULTS_AVAILABLE_ACTION}.
+ * @return true scan was successful, results are updated
* @return false scan was not successful, results haven't been updated since previous scan
*/
public static final String EXTRA_RESULTS_UPDATED = "resultsUpdated";