summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apex/media/framework/java/android/media/MediaParser.java17
-rw-r--r--api/current.txt8
-rwxr-xr-xapi/system-current.txt37
-rw-r--r--api/test-current.txt3
-rw-r--r--api/test-lint-baseline.txt2
-rw-r--r--cmds/statsd/src/atoms.proto11
-rw-r--r--core/java/android/content/pm/PackageManager.java9
-rw-r--r--core/java/android/hardware/camera2/CameraCharacteristics.java23
-rw-r--r--core/java/android/hardware/camera2/CameraDevice.java19
-rw-r--r--core/java/android/hardware/camera2/CameraManager.java196
-rw-r--r--core/java/android/hardware/camera2/impl/CameraMetadataNative.java46
-rw-r--r--core/java/android/hardware/camera2/params/MandatoryStreamCombination.java105
-rw-r--r--core/java/android/hardware/camera2/utils/CameraIdAndSessionConfiguration.java85
-rw-r--r--core/java/android/hardware/camera2/utils/ConcurrentCameraIdCombination.java91
-rw-r--r--core/java/android/os/HwParcel.java1
-rw-r--r--core/java/android/os/connectivity/WifiActivityEnergyInfo.java132
-rwxr-xr-xcore/jni/android/graphics/Bitmap.cpp27
-rw-r--r--core/tests/hosttests/test-apps/DownloadManagerTestApp/src/com/android/frameworks/downloadmanagertests/DownloadManagerTestRunner.java2
-rw-r--r--graphics/java/android/graphics/Bitmap.java3
-rw-r--r--packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java2
-rw-r--r--packages/SettingsLib/src/com/android/settingslib/wifi/WifiTracker.java2
-rw-r--r--packages/SettingsLib/src/com/android/settingslib/wifi/WifiUtils.java8
-rw-r--r--packages/SettingsLib/tests/integ/src/com/android/settingslib/wifi/AccessPointTest.java2
-rw-r--r--services/core/java/com/android/server/am/BatteryExternalStatsWorker.java64
-rw-r--r--telecomm/java/android/telecom/Call.java33
-rw-r--r--telecomm/java/android/telecom/Connection.java11
-rw-r--r--telecomm/java/android/telecom/ConnectionService.java32
-rw-r--r--telecomm/java/android/telecom/InCallAdapter.java13
-rw-r--r--telecomm/java/com/android/internal/telecom/IConnectionService.aidl2
-rw-r--r--telecomm/java/com/android/internal/telecom/IInCallAdapter.aidl2
-rw-r--r--telephony/java/android/telephony/ims/stub/ImsCallSessionImplBase.java7
-rw-r--r--wifi/java/android/net/wifi/WifiInfo.java92
-rw-r--r--wifi/java/android/net/wifi/WifiManager.java26
-rw-r--r--wifi/tests/README.md21
-rwxr-xr-xwifi/tests/runtests.sh25
-rw-r--r--wifi/tests/src/android/net/wifi/WifiInfoTest.java4
36 files changed, 892 insertions, 271 deletions
diff --git a/apex/media/framework/java/android/media/MediaParser.java b/apex/media/framework/java/android/media/MediaParser.java
index ac66d1b7f4ad..d59270c6a51b 100644
--- a/apex/media/framework/java/android/media/MediaParser.java
+++ b/apex/media/framework/java/android/media/MediaParser.java
@@ -223,7 +223,7 @@ public final class MediaParser {
public static final class SeekPoint {
/** A {@link SeekPoint} whose time and byte offset are both set to 0. */
- public static final @NonNull SeekPoint START = new SeekPoint(0, 0);
+ @NonNull public static final SeekPoint START = new SeekPoint(0, 0);
/** The time of the seek point, in microseconds. */
public final long timeUs;
@@ -241,7 +241,8 @@ public final class MediaParser {
}
@Override
- public @NonNull String toString() {
+ @NonNull
+ public String toString() {
return "[timeUs=" + timeUs + ", position=" + position + "]";
}
@@ -414,7 +415,8 @@ public final class MediaParser {
* @return A new instance.
* @throws IllegalArgumentException If an invalid name is provided.
*/
- public static @NonNull MediaParser createByName(
+ @NonNull
+ public static MediaParser createByName(
@NonNull String name, @NonNull OutputConsumer outputConsumer) {
String[] nameAsArray = new String[] {name};
assertValidNames(nameAsArray);
@@ -431,7 +433,8 @@ public final class MediaParser {
* default array of names is used.
* @return A new instance.
*/
- public static @NonNull MediaParser create(
+ @NonNull
+ public static MediaParser create(
@NonNull OutputConsumer outputConsumer, @NonNull String... extractorNames) {
assertValidNames(extractorNames);
if (extractorNames.length == 0) {
@@ -448,7 +451,8 @@ public final class MediaParser {
*
* <p>TODO: List which properties are taken into account. E.g. MimeType.
*/
- public static @NonNull List<String> getExtractorNames(@NonNull MediaFormat mediaFormat) {
+ @NonNull
+ public static List<String> getExtractorNames(@NonNull MediaFormat mediaFormat) {
throw new UnsupportedOperationException();
}
@@ -479,7 +483,8 @@ public final class MediaParser {
* @return The name of the backing extractor implementation, or null if the backing extractor
* implementation has not yet been selected.
*/
- public @Nullable String getExtractorName() {
+ @Nullable
+ public String getExtractorName() {
return mExtractorName;
}
diff --git a/api/current.txt b/api/current.txt
index b3d136df9c7b..e614f17cce92 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -12017,6 +12017,7 @@ package android.content.pm {
field public static final String FEATURE_CAMERA_CAPABILITY_MANUAL_POST_PROCESSING = "android.hardware.camera.capability.manual_post_processing";
field public static final String FEATURE_CAMERA_CAPABILITY_MANUAL_SENSOR = "android.hardware.camera.capability.manual_sensor";
field public static final String FEATURE_CAMERA_CAPABILITY_RAW = "android.hardware.camera.capability.raw";
+ field public static final String FEATURE_CAMERA_CONCURRENT = "android.hardware.camera.concurrent";
field public static final String FEATURE_CAMERA_EXTERNAL = "android.hardware.camera.external";
field public static final String FEATURE_CAMERA_FLASH = "android.hardware.camera.flash";
field public static final String FEATURE_CAMERA_FRONT = "android.hardware.camera.front";
@@ -17174,6 +17175,7 @@ package android.hardware.camera2 {
field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Float> SCALER_AVAILABLE_MAX_DIGITAL_ZOOM;
field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> SCALER_AVAILABLE_ROTATE_AND_CROP_MODES;
field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> SCALER_CROPPING_TYPE;
+ field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.hardware.camera2.params.MandatoryStreamCombination[]> SCALER_MANDATORY_CONCURRENT_STREAM_COMBINATIONS;
field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.hardware.camera2.params.MandatoryStreamCombination[]> SCALER_MANDATORY_STREAM_COMBINATIONS;
field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.hardware.camera2.params.StreamConfigurationMap> SCALER_STREAM_CONFIGURATION_MAP;
field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> SENSOR_AVAILABLE_TEST_PATTERN_MODES;
@@ -17263,6 +17265,8 @@ package android.hardware.camera2 {
public final class CameraManager {
method @NonNull public android.hardware.camera2.CameraCharacteristics getCameraCharacteristics(@NonNull String) throws android.hardware.camera2.CameraAccessException;
method @NonNull public String[] getCameraIdList() throws android.hardware.camera2.CameraAccessException;
+ method @NonNull public java.util.Set<java.util.Set<java.lang.String>> getConcurrentStreamingCameraIds() throws android.hardware.camera2.CameraAccessException;
+ method @RequiresPermission(android.Manifest.permission.CAMERA) public boolean isConcurrentSessionConfigurationSupported(@NonNull java.util.Map<java.lang.String,android.hardware.camera2.params.SessionConfiguration>) throws android.hardware.camera2.CameraAccessException;
method @RequiresPermission(android.Manifest.permission.CAMERA) public void openCamera(@NonNull String, @NonNull android.hardware.camera2.CameraDevice.StateCallback, @Nullable android.os.Handler) throws android.hardware.camera2.CameraAccessException;
method @RequiresPermission(android.Manifest.permission.CAMERA) public void openCamera(@NonNull String, @NonNull java.util.concurrent.Executor, @NonNull android.hardware.camera2.CameraDevice.StateCallback) throws android.hardware.camera2.CameraAccessException;
method public void registerAvailabilityCallback(@NonNull android.hardware.camera2.CameraManager.AvailabilityCallback, @Nullable android.os.Handler);
@@ -45213,6 +45217,7 @@ package android.telecom {
method public void registerCallback(android.telecom.Call.Callback);
method public void registerCallback(android.telecom.Call.Callback, android.os.Handler);
method public void reject(boolean, String);
+ method public void reject(int);
method public void removeExtras(java.util.List<java.lang.String>);
method public void removeExtras(java.lang.String...);
method public void respondToRttRequest(int, boolean);
@@ -45228,6 +45233,8 @@ package android.telecom {
field public static final String EXTRA_LAST_EMERGENCY_CALLBACK_TIME_MILLIS = "android.telecom.extra.LAST_EMERGENCY_CALLBACK_TIME_MILLIS";
field public static final String EXTRA_SILENT_RINGING_REQUESTED = "android.telecom.extra.SILENT_RINGING_REQUESTED";
field public static final String EXTRA_SUGGESTED_PHONE_ACCOUNTS = "android.telecom.extra.SUGGESTED_PHONE_ACCOUNTS";
+ field public static final int REJECT_REASON_DECLINED = 1; // 0x1
+ field public static final int REJECT_REASON_UNWANTED = 2; // 0x2
field public static final int STATE_ACTIVE = 4; // 0x4
field public static final int STATE_AUDIO_PROCESSING = 12; // 0xc
field public static final int STATE_CONNECTING = 9; // 0x9
@@ -45495,6 +45502,7 @@ package android.telecom {
method public void onPostDialContinue(boolean);
method public void onPullExternalCall();
method public void onReject();
+ method public void onReject(int);
method public void onReject(String);
method public void onSeparate();
method public void onShowIncomingCallUi();
diff --git a/api/system-current.txt b/api/system-current.txt
index 9da82ef10e0c..cc4b1221c756 100755
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -7571,12 +7571,12 @@ package android.net.wifi {
}
public class WifiInfo implements android.os.Parcelable {
- method @Nullable public String getAppPackageName();
- method public double getRxSuccessRate();
+ method public double getLostTxPacketsPerSecond();
+ method @Nullable public String getRequestingPackageName();
+ method public double getRetriedTxPacketsPerSecond();
method public int getScore();
- method public double getTxBadRate();
- method public double getTxRetriesRate();
- method public double getTxSuccessRate();
+ method public double getSuccessfulRxPacketsPerSecond();
+ method public double getSuccessfulTxPacketsPerSecond();
method public boolean isEphemeral();
method public boolean isOsuAp();
method public boolean isPasspointAp();
@@ -7604,7 +7604,6 @@ package android.net.wifi {
method @RequiresPermission(anyOf={android.Manifest.permission.NETWORK_SETTINGS, android.Manifest.permission.NETWORK_SETUP_WIZARD, android.Manifest.permission.NETWORK_STACK}) public void connect(int, @Nullable android.net.wifi.WifiManager.ActionListener);
method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.NETWORK_SETTINGS, android.Manifest.permission.NETWORK_SETUP_WIZARD, android.Manifest.permission.NETWORK_STACK}) public void disable(int, @Nullable android.net.wifi.WifiManager.ActionListener);
method @RequiresPermission(anyOf={android.Manifest.permission.NETWORK_SETTINGS, android.Manifest.permission.NETWORK_STACK}) public void disableEphemeralNetwork(@NonNull String);
- method @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public void enableVerboseLogging(int);
method @RequiresPermission(android.Manifest.permission.CONNECTIVITY_INTERNAL) public void factoryReset();
method @RequiresPermission(anyOf={android.Manifest.permission.NETWORK_SETTINGS, android.Manifest.permission.NETWORK_SETUP_WIZARD, android.Manifest.permission.NETWORK_STACK}) public void forget(int, @Nullable android.net.wifi.WifiManager.ActionListener);
method @NonNull @RequiresPermission(anyOf={android.Manifest.permission.NETWORK_SETTINGS, android.Manifest.permission.NETWORK_SETUP_WIZARD}) public java.util.List<android.util.Pair<android.net.wifi.WifiConfiguration,java.util.Map<java.lang.Integer,java.util.List<android.net.wifi.ScanResult>>>> getAllMatchingWifiConfigs(@NonNull java.util.List<android.net.wifi.ScanResult>);
@@ -7616,7 +7615,6 @@ package android.net.wifi {
method @NonNull @RequiresPermission(allOf={android.Manifest.permission.ACCESS_FINE_LOCATION, android.Manifest.permission.ACCESS_WIFI_STATE}) public java.util.Map<android.net.wifi.WifiNetworkSuggestion,java.util.List<android.net.wifi.ScanResult>> getMatchingScanResults(@NonNull java.util.List<android.net.wifi.WifiNetworkSuggestion>, @Nullable java.util.List<android.net.wifi.ScanResult>);
method @RequiresPermission(allOf={android.Manifest.permission.ACCESS_FINE_LOCATION, android.Manifest.permission.ACCESS_WIFI_STATE, android.Manifest.permission.READ_WIFI_CREDENTIAL}) public java.util.List<android.net.wifi.WifiConfiguration> getPrivilegedConfiguredNetworks();
method @NonNull @RequiresPermission(android.Manifest.permission.ACCESS_WIFI_STATE) public android.net.wifi.SoftApConfiguration getSoftApConfiguration();
- method public int getVerboseLoggingLevel();
method @RequiresPermission(android.Manifest.permission.ACCESS_WIFI_STATE) public void getWifiActivityEnergyInfoAsync(@NonNull java.util.concurrent.Executor, @NonNull android.net.wifi.WifiManager.OnWifiActivityEnergyInfoListener);
method @Deprecated @Nullable @RequiresPermission(android.Manifest.permission.ACCESS_WIFI_STATE) public android.net.wifi.WifiConfiguration getWifiApConfiguration();
method @RequiresPermission(android.Manifest.permission.ACCESS_WIFI_STATE) public int getWifiApState();
@@ -7626,6 +7624,7 @@ package android.net.wifi {
method @Deprecated public boolean isDeviceToDeviceRttSupported();
method @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public boolean isDualModeSupported();
method public boolean isPortableHotspotSupported();
+ method public boolean isVerboseLoggingEnabled();
method @RequiresPermission(android.Manifest.permission.ACCESS_WIFI_STATE) public boolean isWifiApEnabled();
method public boolean isWifiScannerSupported();
method @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public void registerNetworkRequestMatchCallback(@NonNull java.util.concurrent.Executor, @NonNull android.net.wifi.WifiManager.NetworkRequestMatchCallback);
@@ -7642,6 +7641,7 @@ package android.net.wifi {
method @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public void setMacRandomizationSettingPasspointEnabled(@NonNull String, boolean);
method @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public void setMeteredOverridePasspoint(@NonNull String, int);
method @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public boolean setSoftApConfiguration(@NonNull android.net.wifi.SoftApConfiguration);
+ method @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public void setVerboseLoggingEnabled(boolean);
method @Deprecated @RequiresPermission(android.Manifest.permission.CHANGE_WIFI_STATE) public boolean setWifiApConfiguration(android.net.wifi.WifiConfiguration);
method @RequiresPermission(android.Manifest.permission.WIFI_UPDATE_USABILITY_STATS_SCORE) public boolean setWifiConnectedNetworkScorer(@NonNull java.util.concurrent.Executor, @NonNull android.net.wifi.WifiManager.WifiConnectedNetworkScorer);
method @RequiresPermission(anyOf={android.Manifest.permission.NETWORK_SETTINGS, android.Manifest.permission.NETWORK_SETUP_WIZARD}) public void startEasyConnectAsConfiguratorInitiator(@NonNull String, int, int, @NonNull java.util.concurrent.Executor, @NonNull android.net.wifi.EasyConnectStatusCallback);
@@ -8606,9 +8606,6 @@ package android.os {
field public static final int STATUS_SUCCESS = 0; // 0x0
}
- @IntDef(prefix={"STATUS_"}, value={android.os.HwParcel.STATUS_SUCCESS}) @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) public static @interface HwParcel.Status {
- }
-
public interface IHwBinder {
method public boolean linkToDeath(android.os.IHwBinder.DeathRecipient, long);
method public android.os.IHwInterface queryLocalInterface(String);
@@ -9045,23 +9042,15 @@ package android.os.connectivity {
}
public final class WifiActivityEnergyInfo implements android.os.Parcelable {
- ctor public WifiActivityEnergyInfo(long, int, long, long, long, long);
+ ctor public WifiActivityEnergyInfo(long, int, @IntRange(from=0) long, @IntRange(from=0) long, @IntRange(from=0) long, @IntRange(from=0) long);
method public int describeContents();
- method public long getControllerEnergyUsedMicroJoules();
- method public long getControllerIdleDurationMillis();
- method public long getControllerRxDurationMillis();
- method public long getControllerScanDurationMillis();
- method public long getControllerTxDurationMillis();
+ method @IntRange(from=0) public long getControllerEnergyUsedMicroJoules();
+ method @IntRange(from=0) public long getControllerIdleDurationMillis();
+ method @IntRange(from=0) public long getControllerRxDurationMillis();
+ method @IntRange(from=0) public long getControllerScanDurationMillis();
+ method @IntRange(from=0) public long getControllerTxDurationMillis();
method public int getStackState();
method public long getTimeSinceBootMillis();
- method public boolean isValid();
- method public void setControllerEnergyUsedMicroJoules(long);
- method public void setControllerIdleDurationMillis(long);
- method public void setControllerRxDurationMillis(long);
- method public void setControllerScanDurationMillis(long);
- method public void setControllerTxDurationMillis(long);
- method public void setStackState(int);
- method public void setTimeSinceBootMillis(long);
method public void writeToParcel(@NonNull android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.os.connectivity.WifiActivityEnergyInfo> CREATOR;
field public static final int STACK_STATE_INVALID = 0; // 0x0
diff --git a/api/test-current.txt b/api/test-current.txt
index 837706b36442..b35bca8ea2ea 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -2218,9 +2218,6 @@ package android.os {
field public static final int STATUS_SUCCESS = 0; // 0x0
}
- @IntDef(prefix={"STATUS_"}, value={android.os.HwParcel.STATUS_SUCCESS}) @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) public static @interface HwParcel.Status {
- }
-
public interface IHwBinder {
method public boolean linkToDeath(android.os.IHwBinder.DeathRecipient, long);
method public android.os.IHwInterface queryLocalInterface(String);
diff --git a/api/test-lint-baseline.txt b/api/test-lint-baseline.txt
index a9c18363d8b0..f53548b68a45 100644
--- a/api/test-lint-baseline.txt
+++ b/api/test-lint-baseline.txt
@@ -2451,8 +2451,6 @@ ProtectedMember: android.view.ViewGroup#resetResolvedDrawables():
-PublicTypedef: android.os.HwParcel.Status:
-
PublicTypedef: android.telephony.ims.feature.MmTelFeature.MmTelCapabilities.MmTelCapability:
PublicTypedef: android.telephony.ims.feature.MmTelFeature.ProcessCallResult:
diff --git a/cmds/statsd/src/atoms.proto b/cmds/statsd/src/atoms.proto
index 177b699f5e7c..7011724ef7d4 100644
--- a/cmds/statsd/src/atoms.proto
+++ b/cmds/statsd/src/atoms.proto
@@ -137,7 +137,7 @@ message Atom {
DaveyOccurred davey_occurred = 58 [(allow_from_any_uid) = true];
OverlayStateChanged overlay_state_changed = 59;
ForegroundServiceStateChanged foreground_service_state_changed = 60;
- CallStateChanged call_state_changed = 61;
+ CallStateChanged call_state_changed = 61 [(module) = "telecom"];
KeyguardStateChanged keyguard_state_changed = 62 [(module) = "sysui"];
KeyguardBouncerStateChanged keyguard_bouncer_state_changed = 63 [(module) = "sysui"];
KeyguardBouncerPasswordEntered keyguard_bouncer_password_entered = 64 [(module) = "sysui"];
@@ -288,8 +288,8 @@ message Atom {
MediametricsNuPlayerReported mediametrics_nuplayer_reported = 199;
MediametricsRecorderReported mediametrics_recorder_reported = 200;
MediametricsDrmManagerReported mediametrics_drmmanager_reported = 201;
- CarPowerStateChanged car_power_state_changed = 203;
- GarageModeInfo garage_mode_info = 204;
+ CarPowerStateChanged car_power_state_changed = 203 [(module) = "car"];
+ GarageModeInfo garage_mode_info = 204 [(module) = "car"];
TestAtomReported test_atom_reported = 205 [(module) = "cts"];
ContentCaptureCallerMismatchReported content_capture_caller_mismatch_reported = 206;
ContentCaptureServiceEvents content_capture_service_events = 207;
@@ -324,7 +324,8 @@ message Atom {
AppCompatibilityChangeReported app_compatibility_change_reported =
228 [(allow_from_any_uid) = true];
PerfettoUploaded perfetto_uploaded = 229 [(module) = "perfetto"];
- VmsClientConnectionStateChanged vms_client_connection_state_changed = 230;
+ VmsClientConnectionStateChanged vms_client_connection_state_changed =
+ 230 [(module) = "car"];
MediaProviderScanEvent media_provider_scan_event = 233 [(module) = "mediaprovider"];
MediaProviderDeletionEvent media_provider_deletion_event = 234 [(module) = "mediaprovider"];
MediaProviderPermissionEvent media_provider_permission_event =
@@ -416,7 +417,7 @@ message Atom {
SurfaceflingerStatsGlobalInfo surfaceflinger_stats_global_info = 10062;
SurfaceflingerStatsLayerInfo surfaceflinger_stats_layer_info = 10063;
ProcessMemorySnapshot process_memory_snapshot = 10064;
- VmsClientStats vms_client_stats = 10065;
+ VmsClientStats vms_client_stats = 10065 [(module) = "car"];
NotificationRemoteViews notification_remote_views = 10066;
DangerousPermissionStateSampled dangerous_permission_state_sampled = 10067;
GraphicsStats graphics_stats = 10068;
diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java
index 38ffb516b138..b64c001ea6e2 100644
--- a/core/java/android/content/pm/PackageManager.java
+++ b/core/java/android/content/pm/PackageManager.java
@@ -1960,6 +1960,15 @@ public abstract class PackageManager {
/**
* Feature for {@link #getSystemAvailableFeatures} and
+ * {@link #hasSystemFeature}: The device's main front and back cameras can stream
+ * concurrently as described in {@link
+ * android.hardware.camera2.CameraManager#getConcurrentStreamingCameraIds()}
+ */
+ @SdkConstant(SdkConstantType.FEATURE)
+ public static final String FEATURE_CAMERA_CONCURRENT = "android.hardware.camera.concurrent";
+
+ /**
+ * Feature for {@link #getSystemAvailableFeatures} and
* {@link #hasSystemFeature}: The device is capable of communicating with
* consumer IR devices.
*/
diff --git a/core/java/android/hardware/camera2/CameraCharacteristics.java b/core/java/android/hardware/camera2/CameraCharacteristics.java
index dfc4f0f6586c..b3a1ee2f9b69 100644
--- a/core/java/android/hardware/camera2/CameraCharacteristics.java
+++ b/core/java/android/hardware/camera2/CameraCharacteristics.java
@@ -2875,7 +2875,28 @@ public final class CameraCharacteristics extends CameraMetadata<CameraCharacteri
@NonNull
public static final Key<int[]> SCALER_AVAILABLE_ROTATE_AND_CROP_MODES =
new Key<int[]>("android.scaler.availableRotateAndCropModes", int[].class);
-
+ /**
+ * <p>An array of mandatory concurrent stream combinations.
+ * This is an app-readable conversion of the concurrent mandatory stream combination
+ * {@link android.hardware.camera2.CameraDevice#createCaptureSession tables}.</p>
+ * <p>The array of
+ * {@link android.hardware.camera2.params.MandatoryStreamCombination combinations} is
+ * generated according to the documented
+ * {@link android.hardware.camera2.CameraDevice#createCaptureSession guideline} for each device
+ * which has its Id present in the set returned by
+ * {@link android.hardware.camera2.CameraManager#getConcurrentStreamingCameraIds}.
+ * Clients can use the array as a quick reference to find an appropriate camera stream
+ * combination.
+ * The mandatory stream combination array will be {@code null} in case the device is not a part
+ * of at least one set of combinations returned by
+ * {@link android.hardware.camera2.CameraManager#getConcurrentStreamingCameraIds}.</p>
+ * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
+ */
+ @PublicKey
+ @NonNull
+ @SyntheticKey
+ public static final Key<android.hardware.camera2.params.MandatoryStreamCombination[]> SCALER_MANDATORY_CONCURRENT_STREAM_COMBINATIONS =
+ new Key<android.hardware.camera2.params.MandatoryStreamCombination[]>("android.scaler.mandatoryConcurrentStreamCombinations", android.hardware.camera2.params.MandatoryStreamCombination[].class);
/**
* <p>The area of the image sensor which corresponds to active pixels after any geometric
* distortion correction has been applied.</p>
diff --git a/core/java/android/hardware/camera2/CameraDevice.java b/core/java/android/hardware/camera2/CameraDevice.java
index cc066812ba1f..24d931154533 100644
--- a/core/java/android/hardware/camera2/CameraDevice.java
+++ b/core/java/android/hardware/camera2/CameraDevice.java
@@ -680,6 +680,25 @@ public abstract class CameraDevice implements AutoCloseable {
* </table><br>
* </p>
*
+ *<p>Devices capable of streaming concurrently with other devices as described by
+ * {@link android.hardware.camera2.CameraManager#getConcurrentStreamingCameraIds} have the
+ * following guaranteed streams (when streaming concurrently with other devices)</p>
+ *
+ * <table>
+ * <tr><th colspan="5">Concurrent stream guaranteed configurations</th></tr>
+ * <tr><th colspan="2" id="rb">Target 1</th><th colspan="2" id="rb">Target 2</th><th rowspan="2">Sample use case(s)</th> </tr>
+ * <tr><th>Type</th><th id="rb">Max size</th><th>Type</th><th id="rb">Max size</th> </tr>
+ * <tr> <td>{@code YUV}</td><td id="rb">{@code MAXIMUM}</td> <td colspan="2" id="rb"></td> <td>In-app video / image processing.</td> </tr>
+ * <tr> <td>{@code PRIV}</td><td id="rb">{@code MAXIMUM}</td> <td colspan="2" id="rb"></td> <td>In-app viewfinder analysis.</td> </tr>
+ * <tr> <td>{@code YUV}</td><td id="rb">{@code MAXIMUM}</td> <td>{@code YUV }</td><td id="rb">{@code MAXIMUM}</td> <td>In-app video / processing with preview.</td> </tr>
+ * <tr> <td>{@code YUV}</td><td id="rb">{@code MAXIMUM}</td> <td>{@code PRIV }</td><td id="rb">{@code MAXIMUM}</td> <td>In-app video / processing with preview.</td> </tr>
+ * <tr> <td>{@code PRIV}</td><td id="rb">{@code MAXIMUM}</td> <td>{@code PRIV }</td><td id="rb">{@code MAXIMUM}</td> <td>Standard Recording.</td> </tr>
+ * </table><br>
+ * </p>
+ *
+ * <p> For guaranteed concurrent stream configurations, MAXIMUM refers to the camera device's
+ * resolution for that format from {@link StreamConfigurationMap#getOutputSizes} or
+ * 720p(1280X720) whichever is lower. </p>
* <p>MONOCHROME-capability ({@link CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES}
* includes {@link CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_MONOCHROME MONOCHROME}) devices
* supporting {@link android.graphics.ImageFormat#Y8 Y8} support substituting {@code YUV}
diff --git a/core/java/android/hardware/camera2/CameraManager.java b/core/java/android/hardware/camera2/CameraManager.java
index 55025f0411f9..9ee56a928d81 100644
--- a/core/java/android/hardware/camera2/CameraManager.java
+++ b/core/java/android/hardware/camera2/CameraManager.java
@@ -31,6 +31,9 @@ import android.hardware.camera2.impl.CameraDeviceImpl;
import android.hardware.camera2.impl.CameraMetadataNative;
import android.hardware.camera2.legacy.CameraDeviceUserShim;
import android.hardware.camera2.legacy.LegacyMetadataMapper;
+import android.hardware.camera2.params.SessionConfiguration;
+import android.hardware.camera2.utils.CameraIdAndSessionConfiguration;
+import android.hardware.camera2.utils.ConcurrentCameraIdCombination;
import android.os.Binder;
import android.os.DeadObjectException;
import android.os.Handler;
@@ -40,6 +43,7 @@ import android.os.ServiceManager;
import android.os.ServiceSpecificException;
import android.os.SystemProperties;
import android.util.ArrayMap;
+import android.util.ArraySet;
import android.util.Log;
import android.util.Size;
import android.view.Display;
@@ -48,6 +52,7 @@ import android.view.WindowManager;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
+import java.util.Map;
import java.util.Set;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
@@ -126,6 +131,66 @@ public final class CameraManager {
}
/**
+ * Return the list of combinations of currently connected camera devices identifiers, which
+ * support configuring camera device sessions concurrently.
+ *
+ * <p>The set of combinations may include camera devices that may be in use by other camera API
+ * clients.</p>
+ *
+ * <p>The set of combinations doesn't contain physical cameras that can only be used as
+ * part of a logical multi-camera device.</p>
+ *
+ * @return The set of combinations of currently connected camera devices, that may have
+ * sessions configured concurrently. The set of combinations will be empty if no such
+ * combinations are supported by the camera subsystem.
+ *
+ * @throws CameraAccessException if the camera device has been disconnected.
+ */
+ @NonNull
+ public Set<Set<String>> getConcurrentStreamingCameraIds() throws CameraAccessException {
+ return CameraManagerGlobal.get().getConcurrentStreamingCameraIds();
+ }
+
+ /**
+ * Checks whether the provided set of camera devices and their corresponding
+ * {@link SessionConfiguration} can be configured concurrently.
+ *
+ * <p>This method performs a runtime check of the given {@link SessionConfiguration} and camera
+ * id combinations. The result confirms whether or not the passed session configurations can be
+ * successfully used to create camera capture sessions concurrently, on the given camera
+ * devices using {@link CameraDevice#createCaptureSession(SessionConfiguration)}.
+ * </p>
+ *
+ * <p>The method can be called at any point before, during and after active capture sessions.
+ * It will not impact normal camera behavior in any way and must complete significantly
+ * faster than creating a regular or constrained capture session.</p>
+ *
+ * <p>Although this method is faster than creating a new capture session, it is not intended
+ * to be used for exploring the entire space of supported concurrent stream combinations. The
+ * available mandatory concurrent stream combinations may be obtained by querying
+ * {@link #getCameraCharacteristics} for the key
+ * SCALER_MANDATORY_CONCURRENT_STREAM_COMBINATIONS. </p>
+ *
+ * <p>Note that session parameters will be ignored and calls to
+ * {@link SessionConfiguration#setSessionParameters} are not required.</p>
+ *
+ * @return {@code true} if the given combination of session configurations and corresponding
+ * camera ids are concurrently supported by the camera sub-system,
+ * {@code false} otherwise.
+ *
+ * @throws IllegalArgumentException if the set of camera devices provided is not a subset of
+ * those returned by getConcurrentStreamingCameraIds()
+ * @throws CameraAccessException if one of the camera devices queried is no longer connected.
+ */
+ @RequiresPermission(android.Manifest.permission.CAMERA)
+ public boolean isConcurrentSessionConfigurationSupported(
+ @NonNull Map<String, SessionConfiguration> cameraIdAndSessionConfig)
+ throws CameraAccessException {
+ return CameraManagerGlobal.get().isConcurrentSessionConfigurationSupported(
+ cameraIdAndSessionConfig);
+ }
+
+ /**
* Register a callback to be notified about camera device availability.
*
* <p>Registering the same callback again will replace the handler with the
@@ -336,8 +401,10 @@ public final class CameraManager {
} catch (NumberFormatException e) {
Log.e(TAG, "Failed to parse camera Id " + cameraId + " to integer");
}
+ boolean hasConcurrentStreams =
+ CameraManagerGlobal.get().cameraIdHasConcurrentStreamsLocked(cameraId);
+ info.setHasMandatoryConcurrentStreams(hasConcurrentStreams);
info.setDisplaySize(displaySize);
-
characteristics = new CameraCharacteristics(info);
}
} catch (ServiceSpecificException e) {
@@ -964,6 +1031,9 @@ public final class CameraManager {
private final ArrayMap<String, ArrayList<String>> mUnavailablePhysicalDevices =
new ArrayMap<String, ArrayList<String>>();
+ private final Set<Set<String>> mConcurrentCameraIdCombinations =
+ new ArraySet<Set<String>>();
+
// Registered availablility callbacks and their executors
private final ArrayMap<AvailabilityCallback, Executor> mCallbackMap =
new ArrayMap<AvailabilityCallback, Executor>();
@@ -1068,7 +1138,22 @@ public final class CameraManager {
} catch (RemoteException e) {
// Camera service is now down, leave mCameraService as null
}
+
+ try {
+ ConcurrentCameraIdCombination[] cameraIdCombinations =
+ cameraService.getConcurrentStreamingCameraIds();
+ for (ConcurrentCameraIdCombination comb : cameraIdCombinations) {
+ mConcurrentCameraIdCombinations.add(comb.getConcurrentCameraIdCombination());
+ }
+ } catch (ServiceSpecificException e) {
+ // Unexpected failure
+ throw new IllegalStateException("Failed to get concurrent camera id combinations",
+ e);
+ } catch (RemoteException e) {
+ // Camera service died in all probability
+ }
}
+
private String[] extractCameraIdListLocked() {
String[] cameraIds = null;
int idCount = 0;
@@ -1089,6 +1174,31 @@ public final class CameraManager {
}
return cameraIds;
}
+
+ private Set<Set<String>> extractConcurrentCameraIdListLocked() {
+ Set<Set<String>> concurrentCameraIds = new ArraySet<Set<String>>();
+ for (Set<String> cameraIds : mConcurrentCameraIdCombinations) {
+ Set<String> extractedCameraIds = new ArraySet<String>();
+ for (String cameraId : cameraIds) {
+ // if the camera id status is NOT_PRESENT or ENUMERATING; skip the device.
+ // TODO: Would a device status NOT_PRESENT ever be in the map ? it gets removed
+ // in the callback anyway.
+ Integer status = mDeviceStatus.get(cameraId);
+ if (status == null) {
+ // camera id not present
+ continue;
+ }
+ if (status == ICameraServiceListener.STATUS_ENUMERATING
+ || status == ICameraServiceListener.STATUS_NOT_PRESENT) {
+ continue;
+ }
+ extractedCameraIds.add(cameraId);
+ }
+ concurrentCameraIds.add(extractedCameraIds);
+ }
+ return concurrentCameraIds;
+ }
+
private static void sortCameraIds(String[] cameraIds) {
// The sort logic must match the logic in
// libcameraservice/common/CameraProviderManager.cpp::getAPI1CompatibleCameraDeviceIds
@@ -1214,6 +1324,88 @@ public final class CameraManager {
return cameraIds;
}
+ public @NonNull Set<Set<String>> getConcurrentStreamingCameraIds() {
+ Set<Set<String>> concurrentStreamingCameraIds = null;
+ synchronized (mLock) {
+ // Try to make sure we have an up-to-date list of concurrent camera devices.
+ connectCameraServiceLocked();
+ concurrentStreamingCameraIds = extractConcurrentCameraIdListLocked();
+ }
+ // TODO: Some sort of sorting ?
+ return concurrentStreamingCameraIds;
+ }
+
+ public boolean isConcurrentSessionConfigurationSupported(
+ @NonNull Map<String, SessionConfiguration> cameraIdsAndSessionConfigurations)
+ throws CameraAccessException {
+
+ if (cameraIdsAndSessionConfigurations == null) {
+ throw new IllegalArgumentException("cameraIdsAndSessionConfigurations was null");
+ }
+
+ int size = cameraIdsAndSessionConfigurations.size();
+ if (size == 0) {
+ throw new IllegalArgumentException("camera id and session combination is empty");
+ }
+
+ synchronized (mLock) {
+ // Go through all the elements and check if the camera ids are valid at least /
+ // belong to one of the combinations returned by getConcurrentStreamingCameraIds()
+ boolean subsetFound = false;
+ for (Set<String> combination : mConcurrentCameraIdCombinations) {
+ if (combination.containsAll(cameraIdsAndSessionConfigurations.keySet())) {
+ subsetFound = true;
+ }
+ }
+ if (!subsetFound) {
+ throw new IllegalArgumentException(
+ "The set of camera ids provided is not a subset of"
+ + "getConcurrentStreamingCameraIds");
+ }
+ CameraIdAndSessionConfiguration [] cameraIdsAndConfigs =
+ new CameraIdAndSessionConfiguration[size];
+ int i = 0;
+ for (Map.Entry<String, SessionConfiguration> pair :
+ cameraIdsAndSessionConfigurations.entrySet()) {
+ cameraIdsAndConfigs[i] =
+ new CameraIdAndSessionConfiguration(pair.getKey(), pair.getValue());
+ i++;
+ }
+ try {
+ return mCameraService.isConcurrentSessionConfigurationSupported(
+ cameraIdsAndConfigs);
+ } catch (ServiceSpecificException e) {
+ throwAsPublicException(e);
+ } catch (RemoteException e) {
+ // Camera service died - act as if the camera was disconnected
+ throw new CameraAccessException(CameraAccessException.CAMERA_DISCONNECTED,
+ "Camera service is currently unavailable", e);
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Helper function to find out if a camera id is in the set of combinations returned by
+ * getConcurrentStreamingCameraIds()
+ * @param cameraId the unique identifier of the camera device to query
+ * @return Whether the camera device was found in the set of combinations returned by
+ * getConcurrentStreamingCameraIds
+ */
+ public boolean cameraIdHasConcurrentStreamsLocked(String cameraId) {
+ if (!mDeviceStatus.containsKey(cameraId)) {
+ Log.e(TAG, "cameraIdHasConcurrentStreamsLocked called on non existing camera id");
+ return false;
+ }
+ for (Set<String> comb : mConcurrentCameraIdCombinations) {
+ if (comb.contains(cameraId)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
public void setTorchMode(String cameraId, boolean enabled) throws CameraAccessException {
synchronized(mLock) {
@@ -1698,6 +1890,8 @@ public final class CameraManager {
cameraId);
}
+ mConcurrentCameraIdCombinations.clear();
+
scheduleCameraServiceReconnectionLocked();
}
}
diff --git a/core/java/android/hardware/camera2/impl/CameraMetadataNative.java b/core/java/android/hardware/camera2/impl/CameraMetadataNative.java
index 3ae3d786af2a..aefe66fe5dec 100644
--- a/core/java/android/hardware/camera2/impl/CameraMetadataNative.java
+++ b/core/java/android/hardware/camera2/impl/CameraMetadataNative.java
@@ -621,6 +621,16 @@ public class CameraMetadataNative implements Parcelable {
}
});
sGetCommandMap.put(
+ CameraCharacteristics.SCALER_MANDATORY_CONCURRENT_STREAM_COMBINATIONS.getNativeKey(),
+ new GetCommand() {
+ @Override
+ @SuppressWarnings("unchecked")
+ public <T> T getValue(CameraMetadataNative metadata, Key<T> key) {
+ return (T) metadata.getMandatoryConcurrentStreamCombinations();
+ }
+ });
+
+ sGetCommandMap.put(
CameraCharacteristics.CONTROL_MAX_REGIONS_AE.getNativeKey(), new GetCommand() {
@Override
@SuppressWarnings("unchecked")
@@ -1247,7 +1257,8 @@ public class CameraMetadataNative implements Parcelable {
return ret;
}
- private MandatoryStreamCombination[] getMandatoryStreamCombinations() {
+ private MandatoryStreamCombination[] getMandatoryStreamCombinationsHelper(
+ boolean getConcurrent) {
int[] capabilities = getBase(CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES);
ArrayList<Integer> caps = new ArrayList<Integer>();
caps.ensureCapacity(capabilities.length);
@@ -1257,7 +1268,13 @@ public class CameraMetadataNative implements Parcelable {
int hwLevel = getBase(CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL);
MandatoryStreamCombination.Builder build = new MandatoryStreamCombination.Builder(
mCameraId, hwLevel, mDisplaySize, caps, getStreamConfigurationMap());
- List<MandatoryStreamCombination> combs = build.getAvailableMandatoryStreamCombinations();
+
+ List<MandatoryStreamCombination> combs = null;
+ if (getConcurrent) {
+ combs = build.getAvailableMandatoryConcurrentStreamCombinations();
+ } else {
+ combs = build.getAvailableMandatoryStreamCombinations();
+ }
if ((combs != null) && (!combs.isEmpty())) {
MandatoryStreamCombination[] combArray = new MandatoryStreamCombination[combs.size()];
combArray = combs.toArray(combArray);
@@ -1267,6 +1284,17 @@ public class CameraMetadataNative implements Parcelable {
return null;
}
+ private MandatoryStreamCombination[] getMandatoryConcurrentStreamCombinations() {
+ if (!mHasMandatoryConcurrentStreams) {
+ return null;
+ }
+ return getMandatoryStreamCombinationsHelper(true);
+ }
+
+ private MandatoryStreamCombination[] getMandatoryStreamCombinations() {
+ return getMandatoryStreamCombinationsHelper(false);
+ }
+
private StreamConfigurationMap getStreamConfigurationMap() {
StreamConfiguration[] configurations = getBase(
CameraCharacteristics.SCALER_AVAILABLE_STREAM_CONFIGURATIONS);
@@ -1614,6 +1642,7 @@ public class CameraMetadataNative implements Parcelable {
}
private int mCameraId = -1;
+ private boolean mHasMandatoryConcurrentStreams = false;
private Size mDisplaySize = new Size(0, 0);
/**
@@ -1628,6 +1657,18 @@ public class CameraMetadataNative implements Parcelable {
}
/**
+ * Set the current camera Id.
+ *
+ * @param hasMandatoryConcurrentStreams whether the metadata advertises mandatory concurrent
+ * streams.
+ *
+ * @hide
+ */
+ public void setHasMandatoryConcurrentStreams(boolean hasMandatoryConcurrentStreams) {
+ mHasMandatoryConcurrentStreams = hasMandatoryConcurrentStreams;
+ }
+
+ /**
* Set the current display size.
*
* @param displaySize The current display size.
@@ -1682,6 +1723,7 @@ public class CameraMetadataNative implements Parcelable {
public void swap(CameraMetadataNative other) {
nativeSwap(other);
mCameraId = other.mCameraId;
+ mHasMandatoryConcurrentStreams = other.mHasMandatoryConcurrentStreams;
mDisplaySize = other.mDisplaySize;
}
diff --git a/core/java/android/hardware/camera2/params/MandatoryStreamCombination.java b/core/java/android/hardware/camera2/params/MandatoryStreamCombination.java
index 23f18a80caf8..41e1443d6866 100644
--- a/core/java/android/hardware/camera2/params/MandatoryStreamCombination.java
+++ b/core/java/android/hardware/camera2/params/MandatoryStreamCombination.java
@@ -16,30 +16,27 @@
package android.hardware.camera2.params;
-import static com.android.internal.util.Preconditions.*;
import static android.hardware.camera2.params.StreamConfigurationMap.checkArgumentFormat;
-import android.annotation.IntRange;
+import static com.android.internal.util.Preconditions.*;
+
import android.annotation.NonNull;
import android.annotation.Nullable;
-import android.content.Context;
import android.graphics.ImageFormat;
import android.graphics.ImageFormat.Format;
import android.hardware.camera2.CameraCharacteristics;
-import android.hardware.camera2.CameraCharacteristics.Key;
import android.hardware.camera2.CameraDevice;
import android.hardware.camera2.CameraManager;
import android.hardware.camera2.CameraMetadata;
import android.hardware.camera2.params.StreamConfigurationMap;
import android.hardware.camera2.utils.HashCodeHelpers;
-import android.graphics.PixelFormat;
import android.media.CamcorderProfile;
-import android.util.Size;
import android.util.Log;
import android.util.Pair;
+import android.util.Size;
-import java.util.Arrays;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
@@ -200,7 +197,6 @@ public final class MandatoryStreamCombination {
mDescription = description;
mIsReprocessable = isReprocessable;
}
-
/**
* Get the mandatory stream combination description.
*
@@ -271,7 +267,7 @@ public final class MandatoryStreamCombination {
mStreamsInformation.hashCode());
}
- private static enum SizeThreshold { VGA, PREVIEW, RECORD, MAXIMUM }
+ private static enum SizeThreshold { VGA, PREVIEW, RECORD, MAXIMUM, s720p }
private static enum ReprocessType { NONE, PRIVATE, YUV }
private static final class StreamTemplate {
public int mFormat;
@@ -653,6 +649,27 @@ public final class MandatoryStreamCombination {
/*reprocessType*/ ReprocessType.YUV),
};
+ private static StreamCombinationTemplate sConcurrentStreamCombinations[] = {
+ new StreamCombinationTemplate(new StreamTemplate [] {
+ new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.s720p) },
+ "In-app video / image processing"),
+ new StreamCombinationTemplate(new StreamTemplate [] {
+ new StreamTemplate(ImageFormat.PRIVATE, SizeThreshold.s720p) },
+ "preview / preview to GPU"),
+ new StreamCombinationTemplate(new StreamTemplate [] {
+ new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.s720p),
+ new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.s720p)},
+ "In-app video / image processing with preview"),
+ new StreamCombinationTemplate(new StreamTemplate [] {
+ new StreamTemplate(ImageFormat.PRIVATE, SizeThreshold.s720p),
+ new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.s720p)},
+ "In-app video / image processing with preview"),
+ new StreamCombinationTemplate(new StreamTemplate [] {
+ new StreamTemplate(ImageFormat.PRIVATE, SizeThreshold.s720p),
+ new StreamTemplate(ImageFormat.PRIVATE, SizeThreshold.s720p)},
+ "Standard Recording"),
+ };
+
/**
* Helper builder class to generate a list of available mandatory stream combinations.
* @hide
@@ -687,6 +704,64 @@ public final class MandatoryStreamCombination {
}
/**
+ * Retrieve a list of all available mandatory concurrent stream combinations.
+ * This method should only be called for devices which are listed in combinations returned
+ * by CameraManager.getConcurrentStreamingCameraIds.
+ *
+ * @return a non-modifiable list of supported mandatory concurrent stream combinations.
+ */
+ public @NonNull List<MandatoryStreamCombination>
+ getAvailableMandatoryConcurrentStreamCombinations() {
+ // Since concurrent streaming support is optional, we mandate these stream
+ // combinations regardless of camera device capabilities.
+ if (!isColorOutputSupported()) {
+ Log.v(TAG, "Device is not backward compatible!");
+ throw new IllegalArgumentException("Camera device which is not BACKWARD_COMPATIBLE"
+ + " cannot have mandatory concurrent streams");
+ }
+ Size size720p = new Size(1280, 720);
+
+ ArrayList<MandatoryStreamCombination> availableConcurrentStreamCombinations =
+ new ArrayList<MandatoryStreamCombination>();
+ availableConcurrentStreamCombinations.ensureCapacity(
+ sConcurrentStreamCombinations.length);
+ for (StreamCombinationTemplate combTemplate : sConcurrentStreamCombinations) {
+ ArrayList<MandatoryStreamInformation> streamsInfo =
+ new ArrayList<MandatoryStreamInformation>();
+ streamsInfo.ensureCapacity(combTemplate.mStreamTemplates.length);
+ for (StreamTemplate template : combTemplate.mStreamTemplates) {
+ MandatoryStreamInformation streamInfo;
+ List<Size> sizes = new ArrayList<Size>();
+ Size sizeChosen =
+ getMinSize(size720p,
+ getMaxSize(mStreamConfigMap.getOutputSizes(template.mFormat)));
+ sizes.add(sizeChosen);
+ try {
+ streamInfo = new MandatoryStreamInformation(sizes, template.mFormat);
+ } catch (IllegalArgumentException e) {
+ String cause = "No available sizes found for format: " + template.mFormat
+ + " size threshold: " + template.mSizeThreshold + " combination: "
+ + combTemplate.mDescription;
+ throw new RuntimeException(cause, e);
+ }
+ streamsInfo.add(streamInfo);
+ }
+
+ MandatoryStreamCombination streamCombination;
+ try {
+ streamCombination = new MandatoryStreamCombination(streamsInfo,
+ combTemplate.mDescription, /*isReprocess*/false);
+ } catch (IllegalArgumentException e) {
+ String cause = "No stream information for mandatory combination: "
+ + combTemplate.mDescription;
+ throw new RuntimeException(cause, e);
+ }
+ availableConcurrentStreamCombinations.add(streamCombination);
+ }
+ return Collections.unmodifiableList(availableConcurrentStreamCombinations);
+ }
+
+ /**
* Retrieve a list of all available mandatory stream combinations.
*
* @return a non-modifiable list of supported mandatory stream combinations or
@@ -965,6 +1040,18 @@ public final class MandatoryStreamCombination {
}
/**
+ * Return the lower size
+ */
+ public static @Nullable Size getMinSize(Size a, Size b) {
+ if (a == null || b == null) {
+ throw new IllegalArgumentException("sizes was empty");
+ }
+ if (a.getWidth() * a.getHeight() < b.getHeight() * b.getWidth()) {
+ return a;
+ }
+ return b;
+ }
+ /**
* Get the largest size by area.
*
* @param sizes an array of sizes, must have at least 1 element
diff --git a/core/java/android/hardware/camera2/utils/CameraIdAndSessionConfiguration.java b/core/java/android/hardware/camera2/utils/CameraIdAndSessionConfiguration.java
new file mode 100644
index 000000000000..cdc037cbd020
--- /dev/null
+++ b/core/java/android/hardware/camera2/utils/CameraIdAndSessionConfiguration.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package android.hardware.camera2.utils;
+
+import android.annotation.NonNull;
+import android.hardware.camera2.params.SessionConfiguration;
+import android.os.Parcel;
+import android.os.Parcelable;
+
+/**
+ * CameraIdAndSessionConfiguration
+ *
+ * Includes the pair of a cameraId and its corresponding SessionConfiguration, to be used with
+ * ICameraService.isConcurrentSessionConfigurationSupported.
+ * @hide
+ */
+public class CameraIdAndSessionConfiguration implements Parcelable {
+
+ private String mCameraId;
+ private SessionConfiguration mSessionConfiguration;
+
+ public CameraIdAndSessionConfiguration(@NonNull String cameraId,
+ @NonNull SessionConfiguration sessionConfiguration) {
+ mCameraId = cameraId;
+ mSessionConfiguration = sessionConfiguration;
+ }
+
+ public static final @NonNull
+ Parcelable.Creator<CameraIdAndSessionConfiguration> CREATOR =
+ new Parcelable.Creator<CameraIdAndSessionConfiguration>() {
+ @Override
+ public CameraIdAndSessionConfiguration createFromParcel(Parcel in) {
+ return new CameraIdAndSessionConfiguration(in);
+ }
+
+ @Override
+ public CameraIdAndSessionConfiguration[] newArray(int size) {
+ return new CameraIdAndSessionConfiguration[size];
+ }
+ };
+
+ private CameraIdAndSessionConfiguration(Parcel in) {
+ readFromParcel(in);
+ }
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeString(mCameraId);
+ mSessionConfiguration.writeToParcel(dest, flags);
+ }
+
+ /**
+ * helper for CREATOR
+ */
+ public void readFromParcel(Parcel in) {
+ mCameraId = in.readString();
+ mSessionConfiguration = SessionConfiguration.CREATOR.createFromParcel(in);
+ }
+
+ public @NonNull String getCameraId() {
+ return mCameraId;
+ }
+
+ public @NonNull SessionConfiguration getSessionConfiguration() {
+ return mSessionConfiguration;
+ }
+}
diff --git a/core/java/android/hardware/camera2/utils/ConcurrentCameraIdCombination.java b/core/java/android/hardware/camera2/utils/ConcurrentCameraIdCombination.java
new file mode 100644
index 000000000000..8f4d6365f05e
--- /dev/null
+++ b/core/java/android/hardware/camera2/utils/ConcurrentCameraIdCombination.java
@@ -0,0 +1,91 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package android.hardware.camera2.utils;
+
+import android.annotation.NonNull;
+import android.os.Parcel;
+import android.os.Parcelable;
+
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * ConcurrentCameraIdCombination
+ *
+ * Includes a list of camera ids that may have sessions configured concurrently.
+ * @hide
+ */
+public class ConcurrentCameraIdCombination implements Parcelable {
+
+ private Set<String> mConcurrentCameraIds = new HashSet<>();
+
+ public static final @NonNull
+ Parcelable.Creator<ConcurrentCameraIdCombination> CREATOR =
+ new Parcelable.Creator<ConcurrentCameraIdCombination>() {
+ @Override
+ public ConcurrentCameraIdCombination createFromParcel(Parcel in) {
+ return new ConcurrentCameraIdCombination(in);
+ }
+
+ @Override
+ public ConcurrentCameraIdCombination[] newArray(int size) {
+ return new ConcurrentCameraIdCombination[size];
+ }
+ };
+
+ private ConcurrentCameraIdCombination(Parcel in) {
+ readFromParcel(in);
+ }
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeInt(mConcurrentCameraIds.size());
+ for (String cameraId : mConcurrentCameraIds) {
+ dest.writeString(cameraId);
+ }
+ }
+
+ /**
+ * helper for CREATOR
+ */
+ public void readFromParcel(Parcel in) {
+ mConcurrentCameraIds.clear();
+ int cameraCombinationSize = in.readInt();
+ if (cameraCombinationSize < 0) {
+ throw new RuntimeException("cameraCombinationSize " + cameraCombinationSize
+ + " should not be negative");
+ }
+ for (int i = 0; i < cameraCombinationSize; i++) {
+ String cameraId = in.readString();
+ if (cameraId == null) {
+ throw new RuntimeException("Failed to read camera id from Parcel");
+ }
+ mConcurrentCameraIds.add(cameraId);
+ }
+ }
+
+ /**
+ * Get this concurrent camera id combination.
+ */
+ public Set<String> getConcurrentCameraIdCombination() {
+ return mConcurrentCameraIds;
+ }
+}
diff --git a/core/java/android/os/HwParcel.java b/core/java/android/os/HwParcel.java
index fb36e6f6978f..228548ad7802 100644
--- a/core/java/android/os/HwParcel.java
+++ b/core/java/android/os/HwParcel.java
@@ -38,6 +38,7 @@ import java.util.Arrays;
public class HwParcel {
private static final String TAG = "HwParcel";
+ /** @hide */
@IntDef(prefix = { "STATUS_" }, value = {
STATUS_SUCCESS,
})
diff --git a/core/java/android/os/connectivity/WifiActivityEnergyInfo.java b/core/java/android/os/connectivity/WifiActivityEnergyInfo.java
index 664b6c87d339..016cc2f3cdad 100644
--- a/core/java/android/os/connectivity/WifiActivityEnergyInfo.java
+++ b/core/java/android/os/connectivity/WifiActivityEnergyInfo.java
@@ -16,7 +16,9 @@
package android.os.connectivity;
+import android.annotation.ElapsedRealtimeLong;
import android.annotation.IntDef;
+import android.annotation.IntRange;
import android.annotation.NonNull;
import android.annotation.SystemApi;
import android.app.ActivityThread;
@@ -37,14 +39,20 @@ import java.lang.annotation.RetentionPolicy;
*/
@SystemApi
public final class WifiActivityEnergyInfo implements Parcelable {
- private long mTimeSinceBootMillis;
+ @ElapsedRealtimeLong
+ private final long mTimeSinceBootMillis;
@StackState
- private int mStackState;
- private long mControllerTxDurationMillis;
- private long mControllerRxDurationMillis;
- private long mControllerScanDurationMillis;
- private long mControllerIdleDurationMillis;
- private long mControllerEnergyUsedMicroJoules;
+ private final int mStackState;
+ @IntRange(from = 0)
+ private final long mControllerTxDurationMillis;
+ @IntRange(from = 0)
+ private final long mControllerRxDurationMillis;
+ @IntRange(from = 0)
+ private final long mControllerScanDurationMillis;
+ @IntRange(from = 0)
+ private final long mControllerIdleDurationMillis;
+ @IntRange(from = 0)
+ private final long mControllerEnergyUsedMicroJoules;
/** @hide */
@Retention(RetentionPolicy.SOURCE)
@@ -67,7 +75,7 @@ public final class WifiActivityEnergyInfo implements Parcelable {
/**
* Constructor.
*
- * @param timeSinceBootMillis the time since boot, in milliseconds.
+ * @param timeSinceBootMillis the elapsed real time since boot, in milliseconds.
* @param stackState The current state of the Wifi Stack. One of {@link #STACK_STATE_INVALID},
* {@link #STACK_STATE_STATE_ACTIVE}, {@link #STACK_STATE_STATE_SCANNING},
* or {@link #STACK_STATE_STATE_IDLE}.
@@ -78,23 +86,27 @@ public final class WifiActivityEnergyInfo implements Parcelable {
* receiving.
*/
public WifiActivityEnergyInfo(
- long timeSinceBootMillis,
+ @ElapsedRealtimeLong long timeSinceBootMillis,
@StackState int stackState,
- long txDurationMillis,
- long rxDurationMillis,
- long scanDurationMillis,
- long idleDurationMillis) {
- mTimeSinceBootMillis = timeSinceBootMillis;
- mStackState = stackState;
- mControllerTxDurationMillis = txDurationMillis;
- mControllerRxDurationMillis = rxDurationMillis;
- mControllerScanDurationMillis = scanDurationMillis;
- mControllerIdleDurationMillis = idleDurationMillis;
-
+ @IntRange(from = 0) long txDurationMillis,
+ @IntRange(from = 0) long rxDurationMillis,
+ @IntRange(from = 0) long scanDurationMillis,
+ @IntRange(from = 0) long idleDurationMillis) {
+
+ this(timeSinceBootMillis,
+ stackState,
+ txDurationMillis,
+ rxDurationMillis,
+ scanDurationMillis,
+ idleDurationMillis,
+ calculateEnergyMicroJoules(txDurationMillis, rxDurationMillis, idleDurationMillis));
+ }
+
+ private static long calculateEnergyMicroJoules(
+ long txDurationMillis, long rxDurationMillis, long idleDurationMillis) {
final Context context = ActivityThread.currentActivityThread().getSystemContext();
if (context == null) {
- mControllerEnergyUsedMicroJoules = 0L;
- return;
+ return 0L;
}
// Calculate energy used using PowerProfile.
PowerProfile powerProfile = new PowerProfile(context);
@@ -106,10 +118,28 @@ public final class WifiActivityEnergyInfo implements Parcelable {
PowerProfile.POWER_WIFI_CONTROLLER_TX);
final double voltage = powerProfile.getAveragePower(
PowerProfile.POWER_WIFI_CONTROLLER_OPERATING_VOLTAGE) / 1000.0;
- final long energyUsedMicroJoules = (long) ((mControllerTxDurationMillis * txCurrent
- + mControllerRxDurationMillis * rxCurrent
- + mControllerIdleDurationMillis * rxIdleCurrent)
+
+ return (long) ((txDurationMillis * txCurrent
+ + rxDurationMillis * rxCurrent
+ + idleDurationMillis * rxIdleCurrent)
* voltage);
+ }
+
+ /** @hide */
+ public WifiActivityEnergyInfo(
+ @ElapsedRealtimeLong long timeSinceBootMillis,
+ @StackState int stackState,
+ @IntRange(from = 0) long txDurationMillis,
+ @IntRange(from = 0) long rxDurationMillis,
+ @IntRange(from = 0) long scanDurationMillis,
+ @IntRange(from = 0) long idleDurationMillis,
+ @IntRange(from = 0) long energyUsedMicroJoules) {
+ mTimeSinceBootMillis = timeSinceBootMillis;
+ mStackState = stackState;
+ mControllerTxDurationMillis = txDurationMillis;
+ mControllerRxDurationMillis = rxDurationMillis;
+ mControllerScanDurationMillis = scanDurationMillis;
+ mControllerIdleDurationMillis = idleDurationMillis;
mControllerEnergyUsedMicroJoules = energyUsedMicroJoules;
}
@@ -158,16 +188,12 @@ public final class WifiActivityEnergyInfo implements Parcelable {
return 0;
}
- /** Get the timestamp (milliseconds since boot) of record creation. */
+ /** Get the timestamp (elapsed real time milliseconds since boot) of record creation. */
+ @ElapsedRealtimeLong
public long getTimeSinceBootMillis() {
return mTimeSinceBootMillis;
}
- /** Set the timestamp (milliseconds since boot) of record creation. */
- public void setTimeSinceBootMillis(long timeSinceBootMillis) {
- mTimeSinceBootMillis = timeSinceBootMillis;
- }
-
/**
* Get the Wifi stack reported state. One of {@link #STACK_STATE_INVALID},
* {@link #STACK_STATE_STATE_ACTIVE}, {@link #STACK_STATE_STATE_SCANNING},
@@ -178,66 +204,40 @@ public final class WifiActivityEnergyInfo implements Parcelable {
return mStackState;
}
- /**
- * Set the Wifi stack reported state. One of {@link #STACK_STATE_INVALID},
- * {@link #STACK_STATE_STATE_ACTIVE}, {@link #STACK_STATE_STATE_SCANNING},
- * {@link #STACK_STATE_STATE_IDLE}.
- */
- public void setStackState(@StackState int stackState) {
- mStackState = stackState;
- }
-
/** Get the Wifi transmission duration, in milliseconds. */
+ @IntRange(from = 0)
public long getControllerTxDurationMillis() {
return mControllerTxDurationMillis;
}
- /** Set the Wifi transmission duration, in milliseconds. */
- public void setControllerTxDurationMillis(long controllerTxDurationMillis) {
- mControllerTxDurationMillis = controllerTxDurationMillis;
- }
-
/** Get the Wifi receive duration, in milliseconds. */
+ @IntRange(from = 0)
public long getControllerRxDurationMillis() {
return mControllerRxDurationMillis;
}
- /** Set the Wifi receive duration, in milliseconds. */
- public void setControllerRxDurationMillis(long controllerRxDurationMillis) {
- mControllerRxDurationMillis = controllerRxDurationMillis;
- }
-
/** Get the Wifi scan duration, in milliseconds. */
+ @IntRange(from = 0)
public long getControllerScanDurationMillis() {
return mControllerScanDurationMillis;
}
- /** Set the Wifi scan duration, in milliseconds. */
- public void setControllerScanDurationMillis(long controllerScanDurationMillis) {
- mControllerScanDurationMillis = controllerScanDurationMillis;
- }
-
/** Get the Wifi idle duration, in milliseconds. */
+ @IntRange(from = 0)
public long getControllerIdleDurationMillis() {
return mControllerIdleDurationMillis;
}
- /** Set the Wifi idle duration, in milliseconds. */
- public void setControllerIdleDurationMillis(long controllerIdleDurationMillis) {
- mControllerIdleDurationMillis = controllerIdleDurationMillis;
- }
-
/** Get the energy consumed by Wifi, in microjoules. */
+ @IntRange(from = 0)
public long getControllerEnergyUsedMicroJoules() {
return mControllerEnergyUsedMicroJoules;
}
- /** Set the energy consumed by Wifi, in microjoules. */
- public void setControllerEnergyUsedMicroJoules(long controllerEnergyUsedMicroJoules) {
- mControllerEnergyUsedMicroJoules = controllerEnergyUsedMicroJoules;
- }
-
- /** Returns true if the record is valid, false otherwise. */
+ /**
+ * Returns true if the record is valid, false otherwise.
+ * @hide
+ */
public boolean isValid() {
return mControllerTxDurationMillis >= 0
&& mControllerRxDurationMillis >= 0
diff --git a/core/jni/android/graphics/Bitmap.cpp b/core/jni/android/graphics/Bitmap.cpp
index eb7d432b559b..30e914de45c2 100755
--- a/core/jni/android/graphics/Bitmap.cpp
+++ b/core/jni/android/graphics/Bitmap.cpp
@@ -34,7 +34,6 @@
#include <string>
#define DEBUG_PARCEL 0
-#define ASHMEM_BITMAP_MIN_SIZE (128 * (1 << 10))
static jclass gBitmap_class;
static jfieldID gBitmap_nativePtr;
@@ -587,7 +586,6 @@ static jobject Bitmap_createFromParcel(JNIEnv* env, jobject, jobject parcel) {
android::Parcel* p = android::parcelForJavaObject(env, parcel);
- const bool isMutable = p->readInt32() != 0;
const SkColorType colorType = (SkColorType)p->readInt32();
const SkAlphaType alphaType = (SkAlphaType)p->readInt32();
const uint32_t colorSpaceSize = p->readUint32();
@@ -636,11 +634,10 @@ static jobject Bitmap_createFromParcel(JNIEnv* env, jobject, jobject parcel) {
// Map the bitmap in place from the ashmem region if possible otherwise copy.
sk_sp<Bitmap> nativeBitmap;
- if (blob.fd() >= 0 && (blob.isMutable() || !isMutable) && (size >= ASHMEM_BITMAP_MIN_SIZE)) {
+ if (blob.fd() >= 0 && !blob.isMutable()) {
#if DEBUG_PARCEL
- ALOGD("Bitmap.createFromParcel: mapped contents of %s bitmap from %s blob "
+ ALOGD("Bitmap.createFromParcel: mapped contents of bitmap from %s blob "
"(fds %s)",
- isMutable ? "mutable" : "immutable",
blob.isMutable() ? "mutable" : "immutable",
p->allowFds() ? "allowed" : "forbidden");
#endif
@@ -657,7 +654,7 @@ static jobject Bitmap_createFromParcel(JNIEnv* env, jobject, jobject parcel) {
// Map the pixels in place and take ownership of the ashmem region. We must also respect the
// rowBytes value already set on the bitmap instead of attempting to compute our own.
nativeBitmap = Bitmap::createFrom(bitmap->info(), bitmap->rowBytes(), dupFd,
- const_cast<void*>(blob.data()), size, !isMutable);
+ const_cast<void*>(blob.data()), size, true);
if (!nativeBitmap) {
close(dupFd);
blob.release();
@@ -695,7 +692,7 @@ static jobject Bitmap_createFromParcel(JNIEnv* env, jobject, jobject parcel) {
}
return createBitmap(env, nativeBitmap.release(),
- getPremulBitmapCreateFlags(isMutable), NULL, NULL, density);
+ getPremulBitmapCreateFlags(false), NULL, NULL, density);
#else
doThrowRE(env, "Cannot use parcels outside of Android");
return NULL;
@@ -703,9 +700,7 @@ static jobject Bitmap_createFromParcel(JNIEnv* env, jobject, jobject parcel) {
}
static jboolean Bitmap_writeToParcel(JNIEnv* env, jobject,
- jlong bitmapHandle,
- jboolean isMutable, jint density,
- jobject parcel) {
+ jlong bitmapHandle, jint density, jobject parcel) {
#ifdef __ANDROID__ // Layoutlib does not support parcel
if (parcel == NULL) {
SkDebugf("------- writeToParcel null parcel\n");
@@ -718,7 +713,6 @@ static jboolean Bitmap_writeToParcel(JNIEnv* env, jobject,
auto bitmapWrapper = reinterpret_cast<BitmapWrapper*>(bitmapHandle);
bitmapWrapper->getSkBitmap(&bitmap);
- p->writeInt32(isMutable);
p->writeInt32(bitmap.colorType());
p->writeInt32(bitmap.alphaType());
SkColorSpace* colorSpace = bitmap.colorSpace();
@@ -745,7 +739,7 @@ static jboolean Bitmap_writeToParcel(JNIEnv* env, jobject,
// Transfer the underlying ashmem region if we have one and it's immutable.
android::status_t status;
int fd = bitmapWrapper->bitmap().getAshmemFd();
- if (fd >= 0 && !isMutable && p->allowFds()) {
+ if (fd >= 0 && p->allowFds()) {
#if DEBUG_PARCEL
ALOGD("Bitmap.writeToParcel: transferring immutable bitmap's ashmem fd as "
"immutable blob (fds %s)",
@@ -761,17 +755,14 @@ static jboolean Bitmap_writeToParcel(JNIEnv* env, jobject,
}
// Copy the bitmap to a new blob.
- bool mutableCopy = isMutable;
#if DEBUG_PARCEL
- ALOGD("Bitmap.writeToParcel: copying %s bitmap into new %s blob (fds %s)",
- isMutable ? "mutable" : "immutable",
- mutableCopy ? "mutable" : "immutable",
+ ALOGD("Bitmap.writeToParcel: copying bitmap into new blob (fds %s)",
p->allowFds() ? "allowed" : "forbidden");
#endif
size_t size = bitmap.computeByteSize();
android::Parcel::WritableBlob blob;
- status = p->writeBlob(size, mutableCopy, &blob);
+ status = p->writeBlob(size, false, &blob);
if (status) {
doThrowRE(env, "Could not copy bitmap to parcel blob.");
return JNI_FALSE;
@@ -1109,7 +1100,7 @@ static const JNINativeMethod gBitmapMethods[] = {
{ "nativeCreateFromParcel",
"(Landroid/os/Parcel;)Landroid/graphics/Bitmap;",
(void*)Bitmap_createFromParcel },
- { "nativeWriteToParcel", "(JZILandroid/os/Parcel;)Z",
+ { "nativeWriteToParcel", "(JILandroid/os/Parcel;)Z",
(void*)Bitmap_writeToParcel },
{ "nativeExtractAlpha", "(JJ[I)Landroid/graphics/Bitmap;",
(void*)Bitmap_extractAlpha },
diff --git a/core/tests/hosttests/test-apps/DownloadManagerTestApp/src/com/android/frameworks/downloadmanagertests/DownloadManagerTestRunner.java b/core/tests/hosttests/test-apps/DownloadManagerTestApp/src/com/android/frameworks/downloadmanagertests/DownloadManagerTestRunner.java
index 70c266a765e4..ac6385333b35 100644
--- a/core/tests/hosttests/test-apps/DownloadManagerTestApp/src/com/android/frameworks/downloadmanagertests/DownloadManagerTestRunner.java
+++ b/core/tests/hosttests/test-apps/DownloadManagerTestApp/src/com/android/frameworks/downloadmanagertests/DownloadManagerTestRunner.java
@@ -58,7 +58,7 @@ public class DownloadManagerTestRunner extends InstrumentationTestRunner {
}
// enable verbose wifi logging
((WifiManager)getContext().getSystemService(Context.WIFI_SERVICE))
- .enableVerboseLogging(1);
+ .setVerboseLoggingEnabled(true);
super.onCreate(icicle);
}
diff --git a/graphics/java/android/graphics/Bitmap.java b/graphics/java/android/graphics/Bitmap.java
index ac094ba5d5d2..9c2e95fab455 100644
--- a/graphics/java/android/graphics/Bitmap.java
+++ b/graphics/java/android/graphics/Bitmap.java
@@ -2132,7 +2132,7 @@ public final class Bitmap implements Parcelable {
public void writeToParcel(Parcel p, int flags) {
checkRecycled("Can't parcel a recycled bitmap");
noteHardwareBitmapSlowCall();
- if (!nativeWriteToParcel(mNativePtr, isMutable(), mDensity, p)) {
+ if (!nativeWriteToParcel(mNativePtr, mDensity, p)) {
throw new RuntimeException("native writeToParcel failed");
}
}
@@ -2285,7 +2285,6 @@ public final class Bitmap implements Parcelable {
private static native Bitmap nativeCreateFromParcel(Parcel p);
// returns true on success
private static native boolean nativeWriteToParcel(long nativeBitmap,
- boolean isMutable,
int density,
Parcel p);
// returns a new bitmap built from the native bitmap's alpha, and the paint
diff --git a/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java b/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java
index 9d4c24e8faa4..84dde05afb2e 100644
--- a/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java
+++ b/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java
@@ -1141,7 +1141,7 @@ public class AccessPoint implements Comparable<AccessPoint> {
} else if (isActive()) {
summary.append(getSummary(mContext, /* ssid */ null, getDetailedState(),
mInfo != null && mInfo.isEphemeral(),
- mInfo != null ? mInfo.getAppPackageName() : null));
+ mInfo != null ? mInfo.getRequestingPackageName() : null));
} else { // not active
if (mConfig != null && mConfig.hasNoInternetAccess()) {
int messageID = mConfig.getNetworkSelectionStatus().isNetworkPermanentlyDisabled()
diff --git a/packages/SettingsLib/src/com/android/settingslib/wifi/WifiTracker.java b/packages/SettingsLib/src/com/android/settingslib/wifi/WifiTracker.java
index ed4ff085aeac..26abf715369c 100644
--- a/packages/SettingsLib/src/com/android/settingslib/wifi/WifiTracker.java
+++ b/packages/SettingsLib/src/com/android/settingslib/wifi/WifiTracker.java
@@ -226,7 +226,7 @@ public class WifiTracker implements LifecycleObserver, OnStart, OnStop, OnDestro
mConnectivityManager = connectivityManager;
// check if verbose logging developer option has been turned on or off
- sVerboseLogging = mWifiManager != null && (mWifiManager.getVerboseLoggingLevel() > 0);
+ sVerboseLogging = mWifiManager != null && mWifiManager.isVerboseLoggingEnabled();
mFilter = filter;
diff --git a/packages/SettingsLib/src/com/android/settingslib/wifi/WifiUtils.java b/packages/SettingsLib/src/com/android/settingslib/wifi/WifiUtils.java
index b93b0001f5de..78ccba02fb04 100644
--- a/packages/SettingsLib/src/com/android/settingslib/wifi/WifiUtils.java
+++ b/packages/SettingsLib/src/com/android/settingslib/wifi/WifiUtils.java
@@ -102,10 +102,10 @@ public class WifiUtils {
if (accessPoint.getSpeed() != AccessPoint.Speed.NONE) {
visibility.append(" speed=").append(accessPoint.getSpeedLabel());
}
- visibility.append(String.format(" tx=%.1f,", info.getTxSuccessRate()));
- visibility.append(String.format("%.1f,", info.getTxRetriesRate()));
- visibility.append(String.format("%.1f ", info.getTxBadRate()));
- visibility.append(String.format("rx=%.1f", info.getRxSuccessRate()));
+ visibility.append(String.format(" tx=%.1f,", info.getSuccessfulTxPacketsPerSecond()));
+ visibility.append(String.format("%.1f,", info.getRetriedTxPacketsPerSecond()));
+ visibility.append(String.format("%.1f ", info.getLostTxPacketsPerSecond()));
+ visibility.append(String.format("rx=%.1f", info.getSuccessfulRxPacketsPerSecond()));
}
int maxRssi5 = INVALID_RSSI;
diff --git a/packages/SettingsLib/tests/integ/src/com/android/settingslib/wifi/AccessPointTest.java b/packages/SettingsLib/tests/integ/src/com/android/settingslib/wifi/AccessPointTest.java
index 03201ae6d5ba..42f3cbb04cf8 100644
--- a/packages/SettingsLib/tests/integ/src/com/android/settingslib/wifi/AccessPointTest.java
+++ b/packages/SettingsLib/tests/integ/src/com/android/settingslib/wifi/AccessPointTest.java
@@ -507,7 +507,7 @@ public class AccessPointTest {
WifiInfo wifiInfo = new WifiInfo();
wifiInfo.setSSID(WifiSsid.createFromAsciiEncoded(TEST_SSID));
wifiInfo.setEphemeral(true);
- wifiInfo.setAppPackageName(appPackageName);
+ wifiInfo.setRequestingPackageName(appPackageName);
wifiInfo.setRssi(rssi);
Context context = mock(Context.class);
diff --git a/services/core/java/com/android/server/am/BatteryExternalStatsWorker.java b/services/core/java/com/android/server/am/BatteryExternalStatsWorker.java
index cf996a50d5c7..fa916202d553 100644
--- a/services/core/java/com/android/server/am/BatteryExternalStatsWorker.java
+++ b/services/core/java/com/android/server/am/BatteryExternalStatsWorker.java
@@ -567,39 +567,41 @@ class BatteryExternalStatsWorker implements BatteryStatsImpl.ExternalStatsSync {
final long lastRxMs = mLastInfo.getControllerRxDurationMillis();
final long lastEnergy = mLastInfo.getControllerEnergyUsedMicroJoules();
- // We will modify the last info object to be the delta, and store the new
- // WifiActivityEnergyInfo object as our last one.
- final WifiActivityEnergyInfo delta = mLastInfo;
- delta.setTimeSinceBootMillis(latest.getTimeSinceBootMillis());
- delta.setStackState(latest.getStackState());
+ final long deltaTimeSinceBootMillis = latest.getTimeSinceBootMillis();
+ final int deltaStackState = latest.getStackState();
+ final long deltaControllerTxDurationMillis;
+ final long deltaControllerRxDurationMillis;
+ final long deltaControllerScanDurationMillis;
+ final long deltaControllerIdleDurationMillis;
+ final long deltaControllerEnergyUsedMicroJoules;
final long txTimeMs = latest.getControllerTxDurationMillis() - lastTxMs;
final long rxTimeMs = latest.getControllerRxDurationMillis() - lastRxMs;
final long idleTimeMs = latest.getControllerIdleDurationMillis() - lastIdleMs;
final long scanTimeMs = latest.getControllerScanDurationMillis() - lastScanMs;
+ final boolean wasReset;
if (txTimeMs < 0 || rxTimeMs < 0 || scanTimeMs < 0 || idleTimeMs < 0) {
// The stats were reset by the WiFi system (which is why our delta is negative).
// Returns the unaltered stats. The total on time should not exceed the time
- // duartion between reports.
+ // duration between reports.
final long totalOnTimeMs = latest.getControllerTxDurationMillis()
+ latest.getControllerRxDurationMillis()
+ latest.getControllerIdleDurationMillis();
if (totalOnTimeMs <= timePeriodMs + MAX_WIFI_STATS_SAMPLE_ERROR_MILLIS) {
- delta.setControllerEnergyUsedMicroJoules(
- latest.getControllerEnergyUsedMicroJoules());
- delta.setControllerRxDurationMillis(latest.getControllerRxDurationMillis());
- delta.setControllerTxDurationMillis(latest.getControllerTxDurationMillis());
- delta.setControllerIdleDurationMillis(latest.getControllerIdleDurationMillis());
- delta.setControllerScanDurationMillis(latest.getControllerScanDurationMillis());
+ deltaControllerEnergyUsedMicroJoules = latest.getControllerEnergyUsedMicroJoules();
+ deltaControllerRxDurationMillis = latest.getControllerRxDurationMillis();
+ deltaControllerTxDurationMillis = latest.getControllerTxDurationMillis();
+ deltaControllerIdleDurationMillis = latest.getControllerIdleDurationMillis();
+ deltaControllerScanDurationMillis = latest.getControllerScanDurationMillis();
} else {
- delta.setControllerEnergyUsedMicroJoules(0);
- delta.setControllerRxDurationMillis(0);
- delta.setControllerTxDurationMillis(0);
- delta.setControllerIdleDurationMillis(0);
- delta.setControllerScanDurationMillis(0);
+ deltaControllerEnergyUsedMicroJoules = 0;
+ deltaControllerRxDurationMillis = 0;
+ deltaControllerTxDurationMillis = 0;
+ deltaControllerIdleDurationMillis = 0;
+ deltaControllerScanDurationMillis = 0;
}
- Slog.v(TAG, "WiFi energy data was reset, new WiFi energy data is " + delta);
+ wasReset = true;
} else {
final long totalActiveTimeMs = txTimeMs + rxTimeMs;
long maxExpectedIdleTimeMs;
@@ -634,21 +636,33 @@ class BatteryExternalStatsWorker implements BatteryStatsImpl.ExternalStatsSync {
maxExpectedIdleTimeMs = timePeriodMs - totalActiveTimeMs;
}
// These times seem to be the most reliable.
- delta.setControllerTxDurationMillis(txTimeMs);
- delta.setControllerRxDurationMillis(rxTimeMs);
- delta.setControllerScanDurationMillis(scanTimeMs);
+ deltaControllerTxDurationMillis = txTimeMs;
+ deltaControllerRxDurationMillis = rxTimeMs;
+ deltaControllerScanDurationMillis = scanTimeMs;
// WiFi calculates the idle time as a difference from the on time and the various
// Rx + Tx times. There seems to be some missing time there because this sometimes
// becomes negative. Just cap it at 0 and ensure that it is less than the expected idle
// time from the difference in timestamps.
// b/21613534
- delta.setControllerIdleDurationMillis(
- Math.min(maxExpectedIdleTimeMs, Math.max(0, idleTimeMs)));
- delta.setControllerEnergyUsedMicroJoules(
- Math.max(0, latest.getControllerEnergyUsedMicroJoules() - lastEnergy));
+ deltaControllerIdleDurationMillis =
+ Math.min(maxExpectedIdleTimeMs, Math.max(0, idleTimeMs));
+ deltaControllerEnergyUsedMicroJoules =
+ Math.max(0, latest.getControllerEnergyUsedMicroJoules() - lastEnergy);
+ wasReset = false;
}
mLastInfo = latest;
+ WifiActivityEnergyInfo delta = new WifiActivityEnergyInfo(
+ deltaTimeSinceBootMillis,
+ deltaStackState,
+ deltaControllerTxDurationMillis,
+ deltaControllerRxDurationMillis,
+ deltaControllerScanDurationMillis,
+ deltaControllerIdleDurationMillis,
+ deltaControllerEnergyUsedMicroJoules);
+ if (wasReset) {
+ Slog.v(TAG, "WiFi energy data was reset, new WiFi energy data is " + delta);
+ }
return delta;
}
}
diff --git a/telecomm/java/android/telecom/Call.java b/telecomm/java/android/telecom/Call.java
index acf51f3856d3..f54f8d1f5832 100644
--- a/telecomm/java/android/telecom/Call.java
+++ b/telecomm/java/android/telecom/Call.java
@@ -265,6 +265,29 @@ public final class Call {
public static final String EVENT_HANDOVER_FAILED =
"android.telecom.event.HANDOVER_FAILED";
+
+ /**
+ * Reject reason used with {@link #reject(int)} to indicate that the user is rejecting this
+ * call because they have declined to answer it. This typically means that they are unable
+ * to answer the call at this time and would prefer it be sent to voicemail.
+ */
+ public static final int REJECT_REASON_DECLINED = 1;
+
+ /**
+ * Reject reason used with {@link #reject(int)} to indicate that the user is rejecting this
+ * call because it is an unwanted call. This allows the user to indicate that they are
+ * rejecting a call because it is likely a nuisance call.
+ */
+ public static final int REJECT_REASON_UNWANTED = 2;
+
+ /**
+ * @hide
+ */
+ @IntDef(prefix = { "REJECT_REASON_" },
+ value = {REJECT_REASON_DECLINED, REJECT_REASON_UNWANTED})
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface RejectReason {};
+
public static class Details {
/** @hide */
@Retention(RetentionPolicy.SOURCE)
@@ -1520,6 +1543,16 @@ public final class Call {
}
/**
+ * Instructs the {@link ConnectionService} providing this {@link #STATE_RINGING} call that the
+ * user has chosen to reject the call and has indicated a reason why the call is being rejected.
+ *
+ * @param rejectReason the reason the call is being rejected.
+ */
+ public void reject(@RejectReason int rejectReason) {
+ mInCallAdapter.rejectCall(mTelecomCallId, rejectReason);
+ }
+
+ /**
* Instructs this {@code Call} to disconnect.
*/
public void disconnect() {
diff --git a/telecomm/java/android/telecom/Connection.java b/telecomm/java/android/telecom/Connection.java
index c934625f588b..72c66d20548a 100644
--- a/telecomm/java/android/telecom/Connection.java
+++ b/telecomm/java/android/telecom/Connection.java
@@ -3037,6 +3037,17 @@ public abstract class Connection extends Conferenceable {
public void onReject() {}
/**
+ * Notifies this Connection, which is in {@link #STATE_RINGING}, of a request to reject.
+ * <p>
+ * For managed {@link ConnectionService}s, this will be called when the user rejects a call via
+ * the default dialer's {@link InCallService} using {@link Call#reject(int)}.
+ * @param rejectReason the reason the user provided for rejecting the call.
+ */
+ public void onReject(@android.telecom.Call.RejectReason int rejectReason) {
+ // to be implemented by ConnectionService.
+ }
+
+ /**
* Notifies this Connection, which is in {@link #STATE_RINGING}, of
* a request to reject with a message.
*/
diff --git a/telecomm/java/android/telecom/ConnectionService.java b/telecomm/java/android/telecom/ConnectionService.java
index 440f044fdcf7..00c2918837ac 100644
--- a/telecomm/java/android/telecom/ConnectionService.java
+++ b/telecomm/java/android/telecom/ConnectionService.java
@@ -194,6 +194,7 @@ public abstract class ConnectionService extends Service {
private static final int MSG_CREATE_CONFERENCE = 35;
private static final int MSG_CREATE_CONFERENCE_COMPLETE = 36;
private static final int MSG_CREATE_CONFERENCE_FAILED = 37;
+ private static final int MSG_REJECT_WITH_REASON = 38;
private static Connection sNullConnection;
@@ -450,6 +451,21 @@ public abstract class ConnectionService extends Service {
}
@Override
+ public void rejectWithReason(String callId,
+ @android.telecom.Call.RejectReason int rejectReason, Session.Info sessionInfo) {
+ Log.startSession(sessionInfo, SESSION_REJECT);
+ try {
+ SomeArgs args = SomeArgs.obtain();
+ args.arg1 = callId;
+ args.argi1 = rejectReason;
+ args.arg2 = Log.createSubsession();
+ mHandler.obtainMessage(MSG_REJECT_WITH_REASON, args).sendToTarget();
+ } finally {
+ Log.endSession();
+ }
+ }
+
+ @Override
public void rejectWithMessage(String callId, String message, Session.Info sessionInfo) {
Log.startSession(sessionInfo, SESSION_REJECT_MESSAGE);
try {
@@ -1053,6 +1069,17 @@ public abstract class ConnectionService extends Service {
}
break;
}
+ case MSG_REJECT_WITH_REASON: {
+ SomeArgs args = (SomeArgs) msg.obj;
+ Log.continueSession((Session) args.arg2, SESSION_HANDLER + SESSION_REJECT);
+ try {
+ reject((String) args.arg1, args.argi1);
+ } finally {
+ args.recycle();
+ Log.endSession();
+ }
+ break;
+ }
case MSG_REJECT_WITH_MESSAGE: {
SomeArgs args = (SomeArgs) msg.obj;
Log.continueSession((Session) args.arg3,
@@ -1981,6 +2008,11 @@ public abstract class ConnectionService extends Service {
findConnectionForAction(callId, "reject").onReject(rejectWithMessage);
}
+ private void reject(String callId, @android.telecom.Call.RejectReason int rejectReason) {
+ Log.d(this, "reject %s with reason %d", callId, rejectReason);
+ findConnectionForAction(callId, "reject").onReject(rejectReason);
+ }
+
private void silence(String callId) {
Log.d(this, "silence %s", callId);
findConnectionForAction(callId, "silence").onSilence();
diff --git a/telecomm/java/android/telecom/InCallAdapter.java b/telecomm/java/android/telecom/InCallAdapter.java
index 261246818f1d..594c1eb392b3 100644
--- a/telecomm/java/android/telecom/InCallAdapter.java
+++ b/telecomm/java/android/telecom/InCallAdapter.java
@@ -89,6 +89,19 @@ public final class InCallAdapter {
}
/**
+ * Instructs Telecom to reject the specified call.
+ *
+ * @param callId The identifier of the call to reject.
+ * @param rejectReason The reason the call was rejected.
+ */
+ public void rejectCall(String callId, @Call.RejectReason int rejectReason) {
+ try {
+ mAdapter.rejectCallWithReason(callId, rejectReason);
+ } catch (RemoteException e) {
+ }
+ }
+
+ /**
* Instructs Telecom to disconnect the specified call.
*
* @param callId The identifier of the call to disconnect.
diff --git a/telecomm/java/com/android/internal/telecom/IConnectionService.aidl b/telecomm/java/com/android/internal/telecom/IConnectionService.aidl
index 96f2483f32f9..4249dff151c7 100644
--- a/telecomm/java/com/android/internal/telecom/IConnectionService.aidl
+++ b/telecomm/java/com/android/internal/telecom/IConnectionService.aidl
@@ -77,6 +77,8 @@ oneway interface IConnectionService {
void reject(String callId, in Session.Info sessionInfo);
+ void rejectWithReason(String callId, int rejectReason, in Session.Info sessionInfo);
+
void rejectWithMessage(String callId, String message, in Session.Info sessionInfo);
void disconnect(String callId, in Session.Info sessionInfo);
diff --git a/telecomm/java/com/android/internal/telecom/IInCallAdapter.aidl b/telecomm/java/com/android/internal/telecom/IInCallAdapter.aidl
index 60745e40aa77..eb2d714fe3f4 100644
--- a/telecomm/java/com/android/internal/telecom/IInCallAdapter.aidl
+++ b/telecomm/java/com/android/internal/telecom/IInCallAdapter.aidl
@@ -34,6 +34,8 @@ oneway interface IInCallAdapter {
void rejectCall(String callId, boolean rejectWithMessage, String textMessage);
+ void rejectCallWithReason(String callId, int rejectReason);
+
void disconnectCall(String callId);
void holdCall(String callId);
diff --git a/telephony/java/android/telephony/ims/stub/ImsCallSessionImplBase.java b/telephony/java/android/telephony/ims/stub/ImsCallSessionImplBase.java
index f4367da4a4dc..e8f69ea64a22 100644
--- a/telephony/java/android/telephony/ims/stub/ImsCallSessionImplBase.java
+++ b/telephony/java/android/telephony/ims/stub/ImsCallSessionImplBase.java
@@ -410,6 +410,13 @@ public class ImsCallSessionImplBase implements AutoCloseable {
* Rejects an incoming call or session update.
*
* @param reason reason code to reject an incoming call, defined in {@link ImsReasonInfo}.
+ * The {@link android.telecom.InCallService} (dialer app) can use the
+ * {@link android.telecom.Call#reject(int)} API to reject a call while specifying
+ * a user-indicated reason for rejecting the call.
+ * Normal call declines ({@link android.telecom.Call#REJECT_REASON_DECLINED}) will
+ * map to {@link ImsReasonInfo#CODE_USER_DECLINE}.
+ * Unwanted calls ({@link android.telecom.Call#REJECT_REASON_UNWANTED}) will map
+ * to {@link ImsReasonInfo#CODE_SIP_USER_MARKED_UNWANTED}.
* {@link ImsCallSession.Listener#callSessionStartFailed}
*/
public void reject(int reason) {
diff --git a/wifi/java/android/net/wifi/WifiInfo.java b/wifi/java/android/net/wifi/WifiInfo.java
index 419bcb107013..f8d48c5403f7 100644
--- a/wifi/java/android/net/wifi/WifiInfo.java
+++ b/wifi/java/android/net/wifi/WifiInfo.java
@@ -178,7 +178,7 @@ public class WifiInfo implements Parcelable {
* If connected to a network suggestion or specifier, store the package name of the app,
* else null.
*/
- private String mAppPackageName;
+ private String mRequestingPackageName;
/**
* Running total count of lost (not ACKed) transmitted unicast data packets.
@@ -201,68 +201,68 @@ public class WifiInfo implements Parcelable {
*/
public long rxSuccess;
- private double mTxBadRate;
+ private double mLostTxPacketsPerSecond;
/**
* Average rate of lost transmitted packets, in units of packets per second.
* @hide
*/
@SystemApi
- public double getTxBadRate() {
- return mTxBadRate;
+ public double getLostTxPacketsPerSecond() {
+ return mLostTxPacketsPerSecond;
}
/** @hide */
- public void setTxBadRate(double txBadRate) {
- mTxBadRate = txBadRate;
+ public void setLostTxPacketsPerSecond(double lostTxPacketsPerSecond) {
+ mLostTxPacketsPerSecond = lostTxPacketsPerSecond;
}
- private double mTxRetriesRate;
+ private double mTxRetriedTxPacketsPerSecond;
/**
* Average rate of transmitted retry packets, in units of packets per second.
* @hide
*/
@SystemApi
- public double getTxRetriesRate() {
- return mTxRetriesRate;
+ public double getRetriedTxPacketsPerSecond() {
+ return mTxRetriedTxPacketsPerSecond;
}
/** @hide */
- public void setTxRetriesRate(double txRetriesRate) {
- mTxRetriesRate = txRetriesRate;
+ public void setRetriedTxPacketsRate(double txRetriedTxPacketsPerSecond) {
+ mTxRetriedTxPacketsPerSecond = txRetriedTxPacketsPerSecond;
}
- private double mTxSuccessRate;
+ private double mSuccessfulTxPacketsPerSecond;
/**
* Average rate of successfully transmitted unicast packets, in units of packets per second.
* @hide
*/
@SystemApi
- public double getTxSuccessRate() {
- return mTxSuccessRate;
+ public double getSuccessfulTxPacketsPerSecond() {
+ return mSuccessfulTxPacketsPerSecond;
}
/** @hide */
- public void setTxSuccessRate(double txSuccessRate) {
- mTxSuccessRate = txSuccessRate;
+ public void setSuccessfulTxPacketsPerSecond(double successfulTxPacketsPerSecond) {
+ mSuccessfulTxPacketsPerSecond = successfulTxPacketsPerSecond;
}
- private double mRxSuccessRate;
+ private double mSuccessfulRxPacketsPerSecond;
/**
* Average rate of received unicast data packets, in units of packets per second.
* @hide
*/
@SystemApi
- public double getRxSuccessRate() {
- return mRxSuccessRate;
+ public double getSuccessfulRxPacketsPerSecond() {
+ return mSuccessfulRxPacketsPerSecond;
}
/** @hide */
- public void setRxSuccessRate(double rxSuccessRate) {
- mRxSuccessRate = rxSuccessRate;
+ public void setSuccessfulRxPacketsPerSecond(double successfulRxPacketsPerSecond) {
+ mSuccessfulRxPacketsPerSecond = successfulRxPacketsPerSecond;
}
/** @hide */
@@ -319,17 +319,17 @@ public class WifiInfo implements Parcelable {
setMeteredHint(false);
setEphemeral(false);
setOsuAp(false);
- setAppPackageName(null);
+ setRequestingPackageName(null);
setFQDN(null);
setProviderFriendlyName(null);
txBad = 0;
txSuccess = 0;
rxSuccess = 0;
txRetries = 0;
- mTxBadRate = 0;
- mTxSuccessRate = 0;
- mRxSuccessRate = 0;
- mTxRetriesRate = 0;
+ mLostTxPacketsPerSecond = 0;
+ mSuccessfulTxPacketsPerSecond = 0;
+ mSuccessfulRxPacketsPerSecond = 0;
+ mTxRetriedTxPacketsPerSecond = 0;
score = 0;
}
@@ -353,8 +353,8 @@ public class WifiInfo implements Parcelable {
mMeteredHint = source.mMeteredHint;
mEphemeral = source.mEphemeral;
mTrusted = source.mTrusted;
- mAppPackageName =
- source.mAppPackageName;
+ mRequestingPackageName =
+ source.mRequestingPackageName;
mOsuAp = source.mOsuAp;
mFqdn = source.mFqdn;
mProviderFriendlyName = source.mProviderFriendlyName;
@@ -362,10 +362,10 @@ public class WifiInfo implements Parcelable {
txRetries = source.txRetries;
txSuccess = source.txSuccess;
rxSuccess = source.rxSuccess;
- mTxBadRate = source.mTxBadRate;
- mTxRetriesRate = source.mTxRetriesRate;
- mTxSuccessRate = source.mTxSuccessRate;
- mRxSuccessRate = source.mRxSuccessRate;
+ mLostTxPacketsPerSecond = source.mLostTxPacketsPerSecond;
+ mTxRetriedTxPacketsPerSecond = source.mTxRetriedTxPacketsPerSecond;
+ mSuccessfulTxPacketsPerSecond = source.mSuccessfulTxPacketsPerSecond;
+ mSuccessfulRxPacketsPerSecond = source.mSuccessfulRxPacketsPerSecond;
score = source.score;
mWifiStandard = source.mWifiStandard;
mMaxSupportedTxLinkSpeed = source.mMaxSupportedTxLinkSpeed;
@@ -777,8 +777,8 @@ public class WifiInfo implements Parcelable {
}
/** {@hide} */
- public void setAppPackageName(@Nullable String packageName) {
- mAppPackageName = packageName;
+ public void setRequestingPackageName(@Nullable String packageName) {
+ mRequestingPackageName = packageName;
}
/**
@@ -788,8 +788,8 @@ public class WifiInfo implements Parcelable {
* @hide
*/
@SystemApi
- public @Nullable String getAppPackageName() {
- return mAppPackageName;
+ public @Nullable String getRequestingPackageName() {
+ return mRequestingPackageName;
}
@@ -956,16 +956,16 @@ public class WifiInfo implements Parcelable {
dest.writeInt(mTrusted ? 1 : 0);
dest.writeInt(score);
dest.writeLong(txSuccess);
- dest.writeDouble(mTxSuccessRate);
+ dest.writeDouble(mSuccessfulTxPacketsPerSecond);
dest.writeLong(txRetries);
- dest.writeDouble(mTxRetriesRate);
+ dest.writeDouble(mTxRetriedTxPacketsPerSecond);
dest.writeLong(txBad);
- dest.writeDouble(mTxBadRate);
+ dest.writeDouble(mLostTxPacketsPerSecond);
dest.writeLong(rxSuccess);
- dest.writeDouble(mRxSuccessRate);
+ dest.writeDouble(mSuccessfulRxPacketsPerSecond);
mSupplicantState.writeToParcel(dest, flags);
dest.writeInt(mOsuAp ? 1 : 0);
- dest.writeString(mAppPackageName);
+ dest.writeString(mRequestingPackageName);
dest.writeString(mFqdn);
dest.writeString(mProviderFriendlyName);
dest.writeInt(mWifiStandard);
@@ -1000,16 +1000,16 @@ public class WifiInfo implements Parcelable {
info.mTrusted = in.readInt() != 0;
info.score = in.readInt();
info.txSuccess = in.readLong();
- info.mTxSuccessRate = in.readDouble();
+ info.mSuccessfulTxPacketsPerSecond = in.readDouble();
info.txRetries = in.readLong();
- info.mTxRetriesRate = in.readDouble();
+ info.mTxRetriedTxPacketsPerSecond = in.readDouble();
info.txBad = in.readLong();
- info.mTxBadRate = in.readDouble();
+ info.mLostTxPacketsPerSecond = in.readDouble();
info.rxSuccess = in.readLong();
- info.mRxSuccessRate = in.readDouble();
+ info.mSuccessfulRxPacketsPerSecond = in.readDouble();
info.mSupplicantState = SupplicantState.CREATOR.createFromParcel(in);
info.mOsuAp = in.readInt() != 0;
- info.mAppPackageName = in.readString();
+ info.mRequestingPackageName = in.readString();
info.mFqdn = in.readString();
info.mProviderFriendlyName = in.readString();
info.mWifiStandard = in.readInt();
diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java
index fb3e794d92d1..c7475ee92dc7 100644
--- a/wifi/java/android/net/wifi/WifiManager.java
+++ b/wifi/java/android/net/wifi/WifiManager.java
@@ -4854,13 +4854,19 @@ public class WifiManager {
/**
* Set Wi-Fi verbose logging level from developer settings.
*
- * @param verbose the verbose logging level to set. 0 will disable verbose logging, a positive
- * integer will enable verbose logging.
+ * @param enable true to enable verbose logging, false to disable.
*
* @hide
*/
@SystemApi
@RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS)
+ public void setVerboseLoggingEnabled(boolean enable) {
+ enableVerboseLogging(enable ? 1 : 0);
+ }
+
+ /** @hide */
+ @UnsupportedAppUsage
+ @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS)
public void enableVerboseLogging (int verbose) {
try {
mService.enableVerboseLogging(verbose);
@@ -4871,15 +4877,23 @@ public class WifiManager {
}
/**
- * Get the persisted WiFi verbose logging level, set by {@link #enableVerboseLogging(int)}.
+ * Get the persisted Wi-Fi verbose logging level, set by
+ * {@link #setVerboseLoggingEnabled(boolean)}.
* No permissions are required to call this method.
*
- * @return 0 to indicate that verbose logging is disabled, a positive integer to indicate that
- * verbose logging is enabled.
+ * @return true to indicate that verbose logging is enabled, false to indicate that verbose
+ * logging is disabled.
*
* @hide
*/
@SystemApi
+ public boolean isVerboseLoggingEnabled() {
+ return getVerboseLoggingLevel() > 0;
+ }
+
+ /** @hide */
+ // TODO(b/145484145): remove once SUW stops calling this via reflection
+ @UnsupportedAppUsage
public int getVerboseLoggingLevel() {
try {
return mService.getVerboseLoggingLevel();
@@ -5204,7 +5218,7 @@ public class WifiManager {
* level from wifi service.
*/
private void updateVerboseLoggingEnabledFromService() {
- mVerboseLoggingEnabled = getVerboseLoggingLevel() > 0;
+ mVerboseLoggingEnabled = isVerboseLoggingEnabled();
}
/**
diff --git a/wifi/tests/README.md b/wifi/tests/README.md
index b0594f2d29b1..f90940470432 100644
--- a/wifi/tests/README.md
+++ b/wifi/tests/README.md
@@ -8,12 +8,9 @@ libraries.
The easiest way to run tests is simply run
```
-frameworks/base/wifi/tests/runtests.sh
+atest android.net.wifi
```
-`runtests.sh` will build the test project and all of its dependencies and push the APK to the
-connected device. It will then run the tests on the device.
-
To pick up changes in framework/base, you will need to:
1. rebuild the framework library 'make -j32'
2. sync over the updated library to the device 'adb sync'
@@ -24,22 +21,6 @@ To enable syncing data to the device for first time after clean reflash:
2. adb reboot
3. adb remount
-See below for a few example of options to limit which tests are run.
-See the
-[AndroidJUnitRunner Documentation](https://developer.android.com/reference/android/support/test/runner/AndroidJUnitRunner.html)
-for more details on the supported options.
-
-```
-runtests.sh -e package android.net.wifi
-runtests.sh -e class android.net.wifi.WifiScannerTest
-```
-
-If you manually build and push the test APK to the device you can run tests using
-
-```
-adb shell am instrument -w 'android.net.wifi.test/androidx.test.runner.AndroidJUnitRunner'
-```
-
## Adding Tests
Tests can be added by adding classes to the src directory. JUnit4 style test cases can
be written by simply annotating test methods with `org.junit.Test`.
diff --git a/wifi/tests/runtests.sh b/wifi/tests/runtests.sh
deleted file mode 100755
index 4024371dd97d..000000000000
--- a/wifi/tests/runtests.sh
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/usr/bin/env bash
-
-if [ -z $ANDROID_BUILD_TOP ]; then
- echo "You need to source and lunch before you can use this script"
- exit 1
-fi
-
-echo "Running tests"
-
-set -e # fail early
-
-echo "+ mmma -j32 $ANDROID_BUILD_TOP/frameworks/base/wifi/tests"
-# NOTE Don't actually run the command above since this shell doesn't inherit functions from the
-# caller.
-$ANDROID_BUILD_TOP/build/soong/soong_ui.bash --make-mode MODULES-IN-frameworks-base-wifi-tests
-
-set -x # print commands
-
-adb wait-for-device
-
-TARGET_ARCH=$($ANDROID_BUILD_TOP/build/soong/soong_ui.bash --dumpvar-mode TARGET_ARCH)
-adb install -r -g "$OUT/testcases/FrameworksWifiApiTests/$TARGET_ARCH/FrameworksWifiApiTests.apk"
-
-adb shell am instrument --no-hidden-api-checks -w "$@" \
- 'android.net.wifi.test/androidx.test.runner.AndroidJUnitRunner'
diff --git a/wifi/tests/src/android/net/wifi/WifiInfoTest.java b/wifi/tests/src/android/net/wifi/WifiInfoTest.java
index 04759ac21bba..311bbc41b8fe 100644
--- a/wifi/tests/src/android/net/wifi/WifiInfoTest.java
+++ b/wifi/tests/src/android/net/wifi/WifiInfoTest.java
@@ -64,7 +64,7 @@ public class WifiInfoTest {
writeWifiInfo.setOsuAp(true);
writeWifiInfo.setFQDN(TEST_FQDN);
writeWifiInfo.setProviderFriendlyName(TEST_PROVIDER_NAME);
- writeWifiInfo.setAppPackageName(TEST_PACKAGE_NAME);
+ writeWifiInfo.setRequestingPackageName(TEST_PACKAGE_NAME);
writeWifiInfo.setWifiStandard(TEST_WIFI_STANDARD);
writeWifiInfo.setMaxSupportedTxLinkSpeedMbps(TEST_MAX_SUPPORTED_TX_LINK_SPEED_MBPS);
writeWifiInfo.setMaxSupportedRxLinkSpeedMbps(TEST_MAX_SUPPORTED_RX_LINK_SPEED_MBPS);
@@ -83,7 +83,7 @@ public class WifiInfoTest {
assertTrue(readWifiInfo.isTrusted());
assertTrue(readWifiInfo.isOsuAp());
assertTrue(readWifiInfo.isPasspointAp());
- assertEquals(TEST_PACKAGE_NAME, readWifiInfo.getAppPackageName());
+ assertEquals(TEST_PACKAGE_NAME, readWifiInfo.getRequestingPackageName());
assertEquals(TEST_FQDN, readWifiInfo.getPasspointFqdn());
assertEquals(TEST_PROVIDER_NAME, readWifiInfo.getPasspointProviderFriendlyName());
assertEquals(TEST_WIFI_STANDARD, readWifiInfo.getWifiStandard());