From e63f916724dd0c4e49a76287b78a47635b0057af Mon Sep 17 00:00:00 2001 From: Svet Ganov Date: Thu, 30 Apr 2020 19:29:23 -0700 Subject: Update current API file rules Test: build + boot bug:150281259 Change-Id: Ice6ab935723a072dbb68c4fe32199f86ec4d983a --- Android.bp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/Android.bp b/Android.bp index 9bc6cab..b312c68 100644 --- a/Android.bp +++ b/Android.bp @@ -26,3 +26,28 @@ java_sdk_library { } } +// Implicitly references by com.android.libraries.tv.tvsystem +filegroup { + name: "com.android.libraries.tv.tvsystem-removed.api.public.latest", + srcs: [ + "api/removed.txt" + ] +} + +// Implicitly references by com.android.libraries.tv.tvsystem +filegroup { + name: "com.android.libraries.tv.tvsystem-removed.api.system.latest", + srcs: [ + "api/system-removed.txt" + ] +} + +// Implicitly references by com.android.libraries.tv.tvsystem +filegroup { + name: "com.android.libraries.tv.tvsystem-removed.api.test.latest", + srcs: [ + "api/test-removed.txt" + ] +} + + -- cgit v1.2.3 From 3f336b7a2b7fa570a35d5cd3bce632c3b3b078cf Mon Sep 17 00:00:00 2001 From: Robin Lee Date: Fri, 31 Jul 2020 09:46:45 +0200 Subject: Add OWNERS for tvsystem Change-Id: Ie0dd5a057a2f3aad98548c33cee5c6a4d5cff78d --- OWNERS | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 OWNERS diff --git a/OWNERS b/OWNERS new file mode 100644 index 0000000..7b9d1be --- /dev/null +++ b/OWNERS @@ -0,0 +1,9 @@ +# Primary maintainer +robhor@google.com + +# Additional maintainers +galinap@google.com +philipjunker@google.com +rgl@google.com +sergeynv@google.com +valiiftime@google.com -- cgit v1.2.3 From 7a09a3a11657034d47ca7708143a696ac97692af Mon Sep 17 00:00:00 2001 From: Marvin Ramin Date: Wed, 29 Jul 2020 18:34:14 +0200 Subject: Add AudioManager volume behavior APIs to TvSystem Add the following APIs to TvSystem: - AudioManager#getDeviceVolumeBehavior - AudioManager#setDeviceVolumeBehavior - AudioDeviceAttributes (as argument to above methods) Bug: 162729744 Test: m Change-Id: I90ddbf62e770943d426fe14633524a4e72a28455 --- Android.bp | 1 + api/system-current.txt | 20 +++ .../tv/tvsystem/media/AudioDeviceAttributes.java | 179 +++++++++++++++++++++ .../tv/tvsystem/media/TvAudioManager.java | 76 +++++++++ 4 files changed, 276 insertions(+) create mode 100644 java/com/android/libraries/tv/tvsystem/media/AudioDeviceAttributes.java create mode 100644 java/com/android/libraries/tv/tvsystem/media/TvAudioManager.java diff --git a/Android.bp b/Android.bp index aaef313..4e2890e 100644 --- a/Android.bp +++ b/Android.bp @@ -18,6 +18,7 @@ java_sdk_library { api_packages: [ "com.android.libraries.tv.tvsystem", "com.android.libraries.tv.tvsystem.display", + "com.android.libraries.tv.tvsystem.media", "com.android.libraries.tv.tvsystem.pm", "com.android.libraries.tv.tvsystem.user", "com.android.libraries.tv.tvsystem.wifi" diff --git a/api/system-current.txt b/api/system-current.txt index aa0d1db..dbd0cc2 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -1,4 +1,24 @@ // Signature format: 2.0 +package com.android.libraries.tv.tvsystem.media { + + public final class AudioDeviceAttributes { + ctor public AudioDeviceAttributes(@NonNull android.media.AudioDeviceInfo); + ctor public AudioDeviceAttributes(int, int, @NonNull String); + method @NonNull public String getAddress(); + method public int getRole(); + method public int getType(); + field public static final int ROLE_INPUT = 1; // 0x1 + field public static final int ROLE_OUTPUT = 2; // 0x2 + } + + public final class TvAudioManager { + ctor public TvAudioManager(@NonNull android.content.Context); + method @RequiresPermission(android.Manifest.permission.MODIFY_AUDIO_ROUTING) public int getDeviceVolumeBehavior(@NonNull com.android.libraries.tv.tvsystem.media.AudioDeviceAttributes); + method @RequiresPermission(android.Manifest.permission.MODIFY_AUDIO_ROUTING) public void setDeviceVolumeBehavior(@NonNull com.android.libraries.tv.tvsystem.media.AudioDeviceAttributes, int); + } + +} + package com.android.libraries.tv.tvsystem.wifi { public final class SoftApConfiguration implements android.os.Parcelable { diff --git a/java/com/android/libraries/tv/tvsystem/media/AudioDeviceAttributes.java b/java/com/android/libraries/tv/tvsystem/media/AudioDeviceAttributes.java new file mode 100644 index 0000000..581d189 --- /dev/null +++ b/java/com/android/libraries/tv/tvsystem/media/AudioDeviceAttributes.java @@ -0,0 +1,179 @@ +/* + * 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 com.android.libraries.tv.tvsystem.media; + +import android.annotation.IntDef; +import android.annotation.NonNull; +import android.annotation.SystemApi; +import android.media.AudioDeviceInfo; +import android.media.AudioPort; +import android.media.AudioSystem; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.util.Objects; + +/** + * @hide + * Class to represent the attributes of an audio device: its type (speaker, headset...), address + * (if known) and role (input, output). + *

Unlike {@link AudioDeviceInfo}, the device + * doesn't need to be connected to be uniquely identified, it can + * for instance represent a specific A2DP headset even after a + * disconnection, whereas the corresponding AudioDeviceInfo + * would then be invalid. + *

While creating / obtaining an instance is not protected by a + * permission, APIs using one rely on MODIFY_AUDIO_ROUTING. + */ +@SystemApi +public final class AudioDeviceAttributes { + + /** + * A role identifying input devices, such as microphones. + */ + public static final int ROLE_INPUT = AudioPort.ROLE_SOURCE; + /** + * A role identifying output devices, such as speakers or headphones. + */ + public static final int ROLE_OUTPUT = AudioPort.ROLE_SINK; + + /** @hide */ + @IntDef(flag = false, prefix = "ROLE_", value = { + ROLE_INPUT, ROLE_OUTPUT } + ) + @Retention(RetentionPolicy.SOURCE) + public @interface Role {} + + /** + * The audio device type, as defined in {@link AudioDeviceInfo} + */ + private final @AudioDeviceInfo.AudioDeviceType int mType; + /** + * The unique address of the device. Some devices don't have addresses, only an empty string. + */ + private final @NonNull String mAddress; + + /** + * Is input or output device + */ + private final @AudioDeviceAttributes.Role + int mRole; + + /** + * @hide + * Constructor from a valid {@link AudioDeviceInfo} + * @param deviceInfo the connected audio device from which to obtain the device-identifying + * type and address. + */ + @SystemApi + public AudioDeviceAttributes(@NonNull AudioDeviceInfo deviceInfo) { + Objects.requireNonNull(deviceInfo); + mRole = deviceInfo.isSink() ? ROLE_OUTPUT : ROLE_INPUT; + mType = deviceInfo.getType(); + mAddress = deviceInfo.getAddress(); + } + + /** + * @hide + * Constructor from role, device type and address + * @param role indicates input or output role + * @param type the device type, as defined in {@link AudioDeviceInfo} + * @param address the address of the device, or an empty string for devices without one + */ + @SystemApi + public AudioDeviceAttributes(@AudioDeviceAttributes.Role int role, + @AudioDeviceInfo.AudioDeviceType int type, + @NonNull String address) { + Objects.requireNonNull(address); + if (role != ROLE_OUTPUT && role != ROLE_INPUT) { + throw new IllegalArgumentException("Invalid role " + role); + } + + mRole = role; + mType = type; + mAddress = address; + } + + /*package*/ AudioDeviceAttributes(int nativeType, @NonNull String address) { + mRole = (nativeType & AudioSystem.DEVICE_BIT_IN) != 0 ? ROLE_INPUT : ROLE_OUTPUT; + mType = AudioDeviceInfo.convertInternalDeviceToDeviceType(nativeType); + mAddress = address; + } + + /** + * @hide + * Returns the role of a device + * @return the role + */ + @SystemApi + public @AudioDeviceAttributes.Role + int getRole() { + return mRole; + } + + /** + * @hide + * Returns the audio device type of a device + * @return the type, as defined in {@link AudioDeviceInfo} + */ + @SystemApi + public @AudioDeviceInfo.AudioDeviceType int getType() { + return mType; + } + + /** + * @hide + * Returns the address of the audio device, or an empty string for devices without one + * @return the device address + */ + @SystemApi + public @NonNull String getAddress() { + return mAddress; + } + + @Override + public int hashCode() { + return Objects.hash(mRole, mType, mAddress); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + AudioDeviceAttributes that = (AudioDeviceAttributes) o; + return ((mRole == that.mRole) + && (mType == that.mType) + && mAddress.equals(that.mAddress)); + } + + /** @hide */ + public static String roleToString(@AudioDeviceAttributes.Role int role) { + return (role == ROLE_OUTPUT ? "output" : "input"); + } + + @Override + public String toString() { + return new String("AudioDeviceAttributes:" + + " role:" + roleToString(mRole) + + " type:" + (mRole == ROLE_OUTPUT ? AudioSystem.getOutputDeviceName( + AudioDeviceInfo.convertDeviceTypeToInternalDevice(mType)) + : AudioSystem.getInputDeviceName( + AudioDeviceInfo.convertDeviceTypeToInternalDevice(mType))) + + " addr:" + mAddress); + } +} diff --git a/java/com/android/libraries/tv/tvsystem/media/TvAudioManager.java b/java/com/android/libraries/tv/tvsystem/media/TvAudioManager.java new file mode 100644 index 0000000..7b18200 --- /dev/null +++ b/java/com/android/libraries/tv/tvsystem/media/TvAudioManager.java @@ -0,0 +1,76 @@ +/* + * 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 com.android.libraries.tv.tvsystem.media; + + +import android.annotation.NonNull; +import android.annotation.RequiresPermission; +import android.annotation.SystemApi; +import android.content.Context; +import android.media.AudioManager; + +/** + * Provides access to APIs in {@link AudioManager} that are otherwise @hidden. + * + * @hide + */ +@SystemApi +public final class TvAudioManager { + + private final AudioManager mAudioManager; + + public TvAudioManager(@NonNull Context context) { + mAudioManager = context.getSystemService(AudioManager.class); + } + + /** + * @hide + * Sets the volume behavior for an audio output device. + * @see AudioManager#DEVICE_VOLUME_BEHAVIOR_VARIABLE + * @see AudioManager#DEVICE_VOLUME_BEHAVIOR_FULL + * @see AudioManager#DEVICE_VOLUME_BEHAVIOR_FIXED + * @see AudioManager#DEVICE_VOLUME_BEHAVIOR_ABSOLUTE + * @see AudioManager#DEVICE_VOLUME_BEHAVIOR_ABSOLUTE_MULTI_MODE + * @param device the device to be affected + * @param deviceVolumeBehavior one of the device behaviors + */ + @SystemApi + @RequiresPermission(android.Manifest.permission.MODIFY_AUDIO_ROUTING) + public void setDeviceVolumeBehavior(@NonNull AudioDeviceAttributes device, + @AudioManager.DeviceVolumeBehavior int deviceVolumeBehavior) { + android.media.AudioDeviceAttributes audioDeviceAttributes = + new android.media.AudioDeviceAttributes(device.getRole(), device.getType(), + device.getAddress()); + mAudioManager.setDeviceVolumeBehavior(audioDeviceAttributes, deviceVolumeBehavior); + } + + /** + * @hide + * Returns the volume device behavior for the given audio device + * @param device the audio device + * @return the volume behavior for the device + */ + @SystemApi + @RequiresPermission(android.Manifest.permission.MODIFY_AUDIO_ROUTING) + public @AudioManager.DeviceVolumeBehavior + int getDeviceVolumeBehavior(@NonNull AudioDeviceAttributes device) { + android.media.AudioDeviceAttributes audioDeviceAttributes = + new android.media.AudioDeviceAttributes(device.getRole(), device.getType(), + device.getAddress()); + return mAudioManager.getDeviceVolumeBehavior(audioDeviceAttributes); + } +} -- cgit v1.2.3 From 89d32fb708129bf400335a41a7d50faad99a677b Mon Sep 17 00:00:00 2001 From: Robert Horvath Date: Mon, 26 Oct 2020 11:54:55 +0100 Subject: Move TvSystem to system_ext Test: Flash, verify TvSystem jar is located in /system_ext, use TvSystem from an app Bug: 171684954 Change-Id: I9fff12f04e600085c577dadd7e0c5ceadf31f39a --- Android.bp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Android.bp b/Android.bp index 4e2890e..dede902 100644 --- a/Android.bp +++ b/Android.bp @@ -25,6 +25,7 @@ java_sdk_library { ], dex_preopt: { enabled: false, - } + }, + system_ext_specific: true } -- cgit v1.2.3 From 8dea9bc6d3d5cc20c8a4e09634031ef9da44979a Mon Sep 17 00:00:00 2001 From: Robin Lee Date: Tue, 17 Nov 2020 21:09:22 +0000 Subject: Revert "Move TvSystem to system_ext" This reverts commit 89d32fb708129bf400335a41a7d50faad99a677b. Reason for revert: b/173530901 Bug: 173530901 Bug: 171684954 Change-Id: Icff994bb0e65e9679d342c19a1e27fd5a81f4e2f --- Android.bp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Android.bp b/Android.bp index dede902..4e2890e 100644 --- a/Android.bp +++ b/Android.bp @@ -25,7 +25,6 @@ java_sdk_library { ], dex_preopt: { enabled: false, - }, - system_ext_specific: true + } } -- cgit v1.2.3 From de9f928103d9ad08b21d3900fd0ca02e5dd97080 Mon Sep 17 00:00:00 2001 From: Robert Horvath Date: Thu, 19 Nov 2020 10:38:51 +0000 Subject: Revert^2 "Move TvSystem to system_ext" 8dea9bc6d3d5cc20c8a4e09634031ef9da44979a Change-Id: Ic70d8e0b6141dbe51d4d6c42e2105179d85a9496 --- Android.bp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Android.bp b/Android.bp index 4e2890e..dede902 100644 --- a/Android.bp +++ b/Android.bp @@ -25,6 +25,7 @@ java_sdk_library { ], dex_preopt: { enabled: false, - } + }, + system_ext_specific: true } -- cgit v1.2.3 From 2f39bde1b8941ebbfa19b9c7836f72ac9561de8c Mon Sep 17 00:00:00 2001 From: Robert Horvath Date: Tue, 24 Nov 2020 18:36:41 +0100 Subject: Add no_dist to TvSystem TvSystem should not be included in the sdk dist. Bug: 174148106 Test: Build sdk dist, verify tvsystem absent Change-Id: Ifb84976af6f818bda4f4dd5b73d3e1e1cc081d8a --- Android.bp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Android.bp b/Android.bp index dede902..3b41421 100644 --- a/Android.bp +++ b/Android.bp @@ -26,6 +26,7 @@ java_sdk_library { dex_preopt: { enabled: false, }, - system_ext_specific: true + system_ext_specific: true, + no_dist: true } -- cgit v1.2.3 From 075a5630c593ae5e79b50fd8973f09551bd6f9b6 Mon Sep 17 00:00:00 2001 From: Kriti Dang Date: Thu, 11 Feb 2021 15:27:28 +0100 Subject: Changes in tvsystem/ DeviceProductInfo to mirror changes in frameworks/base/ DeviceProductInfo Bug: 179775994 Test: N/A Change-Id: I6c726e12cacf167aeabee7fa886a706cbcd62086 --- api/current.txt | 10 ++- .../tv/tvsystem/display/DeviceProductInfo.java | 72 +++++++++++++++++++--- .../tv/tvsystem/display/DisplayCompatUtil.java | 2 +- 3 files changed, 73 insertions(+), 11 deletions(-) diff --git a/api/current.txt b/api/current.txt index 09cb6e8..fd59a47 100644 --- a/api/current.txt +++ b/api/current.txt @@ -2,13 +2,19 @@ package com.android.libraries.tv.tvsystem.display { public final class DeviceProductInfo { - ctor public DeviceProductInfo(String, String, String, Integer, com.android.libraries.tv.tvsystem.display.DeviceProductInfo.ManufactureDate, int[]); + ctor @Deprecated public DeviceProductInfo(String, String, String, Integer, com.android.libraries.tv.tvsystem.display.DeviceProductInfo.ManufactureDate, int[]); + ctor public DeviceProductInfo(String, String, String, Integer, com.android.libraries.tv.tvsystem.display.DeviceProductInfo.ManufactureDate, int); + method public int getConnectionToSinkType(); method public com.android.libraries.tv.tvsystem.display.DeviceProductInfo.ManufactureDate getManufactureDate(); method public String getManufacturerPnpId(); method public Integer getModelYear(); method public String getName(); method public String getProductId(); - method public int[] getRelativeAddress(); + method @Deprecated public int[] getRelativeAddress(); + field public static final int CONNECTION_TO_SINK_BUILT_IN = 1; // 0x1 + field public static final int CONNECTION_TO_SINK_DIRECT = 2; // 0x2 + field public static final int CONNECTION_TO_SINK_TRANSITIVE = 3; // 0x3 + field public static final int CONNECTION_TO_SINK_UNKNOWN = 0; // 0x0 } public static class DeviceProductInfo.ManufactureDate { diff --git a/java/com/android/libraries/tv/tvsystem/display/DeviceProductInfo.java b/java/com/android/libraries/tv/tvsystem/display/DeviceProductInfo.java index 6e78253..5620f45 100644 --- a/java/com/android/libraries/tv/tvsystem/display/DeviceProductInfo.java +++ b/java/com/android/libraries/tv/tvsystem/display/DeviceProductInfo.java @@ -16,7 +16,10 @@ package com.android.libraries.tv.tvsystem.display; -import java.util.Arrays; +import android.annotation.IntDef; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; import java.util.Objects; /** @@ -25,13 +28,39 @@ import java.util.Objects; * product information about the intermediate device. */ public final class DeviceProductInfo { + /** @hide */ + @IntDef(prefix = {"CONNECTION_TO_SINK_"}, value = { + CONNECTION_TO_SINK_UNKNOWN, + CONNECTION_TO_SINK_BUILT_IN, + CONNECTION_TO_SINK_DIRECT, + CONNECTION_TO_SINK_TRANSITIVE + }) + @Retention(RetentionPolicy.SOURCE) + public @interface ConnectionToSinkType { } + + /** The device connection to the display sink is unknown. */ + public static final int CONNECTION_TO_SINK_UNKNOWN = 0; + + /** The display sink is built-in to the device */ + public static final int CONNECTION_TO_SINK_BUILT_IN = 1; + + /** The device is directly connected to the display sink. */ + public static final int CONNECTION_TO_SINK_DIRECT = 2; + + /** The device is transitively connected to the display sink. */ + public static final int CONNECTION_TO_SINK_TRANSITIVE = 3; + private final String mName; private final String mManufacturerPnpId; private final String mProductId; private final Integer mModelYear; private final ManufactureDate mManufactureDate; - private final int[] mRelativeAddress; + private final @ConnectionToSinkType int mConnectionToSinkType; + /** @deprecated use + * {@link #DeviceProductInfo(String, String, String, Integer, ManufactureDate, int)} ()} + * instead.*/ + @Deprecated public DeviceProductInfo( String name, String manufacturerPnpId, @@ -44,7 +73,22 @@ public final class DeviceProductInfo { this.mProductId = productId; this.mModelYear = modelYear; this.mManufactureDate = manufactureDate; - this.mRelativeAddress = relativeAddress; + this.mConnectionToSinkType = CONNECTION_TO_SINK_UNKNOWN; + } + + public DeviceProductInfo( + String name, + String manufacturerPnpId, + String productId, + Integer modelYear, + ManufactureDate manufactureDate, + int connectionToSinkType) { + this.mName = name; + this.mManufacturerPnpId = manufacturerPnpId; + this.mProductId = productId; + this.mModelYear = modelYear; + this.mManufactureDate = manufactureDate; + this.mConnectionToSinkType = connectionToSinkType; } /** @@ -87,9 +131,21 @@ public final class DeviceProductInfo { /** * @return Relative address in the display network. For example, for HDMI connected devices this * can be its physical address. Each component of the address is in the range [0, 255]. + * + * @deprecated use {@link #getConnectionToSinkType()} instead. */ + @Deprecated public int[] getRelativeAddress() { - return mRelativeAddress; + return null; + } + + /** + * @return How the current device is connected to the display sink. For example, the display + * can be connected immediately to the device or there can be a receiver in between. + */ + @ConnectionToSinkType + public int getConnectionToSinkType() { + return mConnectionToSinkType; } @Override @@ -105,8 +161,8 @@ public final class DeviceProductInfo { + mModelYear + ", manufactureDate=" + mManufactureDate - + ", relativeAddress=" - + Arrays.toString(mRelativeAddress) + + ", connectionToSinkType=" + + mConnectionToSinkType + '}'; } @@ -120,13 +176,13 @@ public final class DeviceProductInfo { && Objects.equals(mProductId, that.mProductId) && Objects.equals(mModelYear, that.mModelYear) && Objects.equals(mManufactureDate, that.mManufactureDate) - && Arrays.equals(mRelativeAddress, that.mRelativeAddress); + && mConnectionToSinkType == that.mConnectionToSinkType; } @Override public int hashCode() { return Objects.hash(mName, mManufacturerPnpId, mProductId, mModelYear, mManufactureDate, - mRelativeAddress); + mConnectionToSinkType); } /** diff --git a/java/com/android/libraries/tv/tvsystem/display/DisplayCompatUtil.java b/java/com/android/libraries/tv/tvsystem/display/DisplayCompatUtil.java index fb19f98..746f90b 100644 --- a/java/com/android/libraries/tv/tvsystem/display/DisplayCompatUtil.java +++ b/java/com/android/libraries/tv/tvsystem/display/DisplayCompatUtil.java @@ -64,7 +64,7 @@ public final class DisplayCompatUtil { } return new DeviceProductInfo(info.getName(), info.getManufacturerPnpId(), info.getProductId(), info.getModelYear(), manufactureDate, - info.getRelativeAddress()); + info.getConnectionToSinkType()); } private DisplayCompatUtil() {} -- cgit v1.2.3 From d2155d82f96bb21fe9848ea2e5c68839a323d9d5 Mon Sep 17 00:00:00 2001 From: Ulyana Trafimovich Date: Tue, 23 Feb 2021 17:14:58 +0000 Subject: Revert "Changes in tvsystem/ DeviceProductInfo to mirror changes..." Revert "Adding new CTS test for the API display#getDeviceProductInfo" Revert submission 13552775-expose DisplayInfo.deviceProductInfo Reason for revert: broken test android.compat.sjp.cts.StrictJavaPackagesTest#testBootClassPathAndSystemServerClasspath_nonDuplicateClasses on git_sc-dev on cf_x86_64_phone-userdebug at 7162420 Bug: 181021245 Reverted Changes: Id6767127f:Adding aidl file to share deviceProductInfo consta... I6959d2829:Adding public API to expose DisplayInfo.deviceProd... I720dbfe84:Adding new CTS test for the API display#getDeviceP... I6c726e12c:Changes in tvsystem/ DeviceProductInfo to mirror c... Change-Id: I2c80ad16c444f8368a3765e4370f679f3f38abd9 --- api/current.txt | 10 +-- .../tv/tvsystem/display/DeviceProductInfo.java | 72 +++------------------- .../tv/tvsystem/display/DisplayCompatUtil.java | 2 +- 3 files changed, 11 insertions(+), 73 deletions(-) diff --git a/api/current.txt b/api/current.txt index fd59a47..09cb6e8 100644 --- a/api/current.txt +++ b/api/current.txt @@ -2,19 +2,13 @@ package com.android.libraries.tv.tvsystem.display { public final class DeviceProductInfo { - ctor @Deprecated public DeviceProductInfo(String, String, String, Integer, com.android.libraries.tv.tvsystem.display.DeviceProductInfo.ManufactureDate, int[]); - ctor public DeviceProductInfo(String, String, String, Integer, com.android.libraries.tv.tvsystem.display.DeviceProductInfo.ManufactureDate, int); - method public int getConnectionToSinkType(); + ctor public DeviceProductInfo(String, String, String, Integer, com.android.libraries.tv.tvsystem.display.DeviceProductInfo.ManufactureDate, int[]); method public com.android.libraries.tv.tvsystem.display.DeviceProductInfo.ManufactureDate getManufactureDate(); method public String getManufacturerPnpId(); method public Integer getModelYear(); method public String getName(); method public String getProductId(); - method @Deprecated public int[] getRelativeAddress(); - field public static final int CONNECTION_TO_SINK_BUILT_IN = 1; // 0x1 - field public static final int CONNECTION_TO_SINK_DIRECT = 2; // 0x2 - field public static final int CONNECTION_TO_SINK_TRANSITIVE = 3; // 0x3 - field public static final int CONNECTION_TO_SINK_UNKNOWN = 0; // 0x0 + method public int[] getRelativeAddress(); } public static class DeviceProductInfo.ManufactureDate { diff --git a/java/com/android/libraries/tv/tvsystem/display/DeviceProductInfo.java b/java/com/android/libraries/tv/tvsystem/display/DeviceProductInfo.java index 5620f45..6e78253 100644 --- a/java/com/android/libraries/tv/tvsystem/display/DeviceProductInfo.java +++ b/java/com/android/libraries/tv/tvsystem/display/DeviceProductInfo.java @@ -16,10 +16,7 @@ package com.android.libraries.tv.tvsystem.display; -import android.annotation.IntDef; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; +import java.util.Arrays; import java.util.Objects; /** @@ -28,39 +25,13 @@ import java.util.Objects; * product information about the intermediate device. */ public final class DeviceProductInfo { - /** @hide */ - @IntDef(prefix = {"CONNECTION_TO_SINK_"}, value = { - CONNECTION_TO_SINK_UNKNOWN, - CONNECTION_TO_SINK_BUILT_IN, - CONNECTION_TO_SINK_DIRECT, - CONNECTION_TO_SINK_TRANSITIVE - }) - @Retention(RetentionPolicy.SOURCE) - public @interface ConnectionToSinkType { } - - /** The device connection to the display sink is unknown. */ - public static final int CONNECTION_TO_SINK_UNKNOWN = 0; - - /** The display sink is built-in to the device */ - public static final int CONNECTION_TO_SINK_BUILT_IN = 1; - - /** The device is directly connected to the display sink. */ - public static final int CONNECTION_TO_SINK_DIRECT = 2; - - /** The device is transitively connected to the display sink. */ - public static final int CONNECTION_TO_SINK_TRANSITIVE = 3; - private final String mName; private final String mManufacturerPnpId; private final String mProductId; private final Integer mModelYear; private final ManufactureDate mManufactureDate; - private final @ConnectionToSinkType int mConnectionToSinkType; + private final int[] mRelativeAddress; - /** @deprecated use - * {@link #DeviceProductInfo(String, String, String, Integer, ManufactureDate, int)} ()} - * instead.*/ - @Deprecated public DeviceProductInfo( String name, String manufacturerPnpId, @@ -73,22 +44,7 @@ public final class DeviceProductInfo { this.mProductId = productId; this.mModelYear = modelYear; this.mManufactureDate = manufactureDate; - this.mConnectionToSinkType = CONNECTION_TO_SINK_UNKNOWN; - } - - public DeviceProductInfo( - String name, - String manufacturerPnpId, - String productId, - Integer modelYear, - ManufactureDate manufactureDate, - int connectionToSinkType) { - this.mName = name; - this.mManufacturerPnpId = manufacturerPnpId; - this.mProductId = productId; - this.mModelYear = modelYear; - this.mManufactureDate = manufactureDate; - this.mConnectionToSinkType = connectionToSinkType; + this.mRelativeAddress = relativeAddress; } /** @@ -131,21 +87,9 @@ public final class DeviceProductInfo { /** * @return Relative address in the display network. For example, for HDMI connected devices this * can be its physical address. Each component of the address is in the range [0, 255]. - * - * @deprecated use {@link #getConnectionToSinkType()} instead. */ - @Deprecated public int[] getRelativeAddress() { - return null; - } - - /** - * @return How the current device is connected to the display sink. For example, the display - * can be connected immediately to the device or there can be a receiver in between. - */ - @ConnectionToSinkType - public int getConnectionToSinkType() { - return mConnectionToSinkType; + return mRelativeAddress; } @Override @@ -161,8 +105,8 @@ public final class DeviceProductInfo { + mModelYear + ", manufactureDate=" + mManufactureDate - + ", connectionToSinkType=" - + mConnectionToSinkType + + ", relativeAddress=" + + Arrays.toString(mRelativeAddress) + '}'; } @@ -176,13 +120,13 @@ public final class DeviceProductInfo { && Objects.equals(mProductId, that.mProductId) && Objects.equals(mModelYear, that.mModelYear) && Objects.equals(mManufactureDate, that.mManufactureDate) - && mConnectionToSinkType == that.mConnectionToSinkType; + && Arrays.equals(mRelativeAddress, that.mRelativeAddress); } @Override public int hashCode() { return Objects.hash(mName, mManufacturerPnpId, mProductId, mModelYear, mManufactureDate, - mConnectionToSinkType); + mRelativeAddress); } /** diff --git a/java/com/android/libraries/tv/tvsystem/display/DisplayCompatUtil.java b/java/com/android/libraries/tv/tvsystem/display/DisplayCompatUtil.java index 746f90b..fb19f98 100644 --- a/java/com/android/libraries/tv/tvsystem/display/DisplayCompatUtil.java +++ b/java/com/android/libraries/tv/tvsystem/display/DisplayCompatUtil.java @@ -64,7 +64,7 @@ public final class DisplayCompatUtil { } return new DeviceProductInfo(info.getName(), info.getManufacturerPnpId(), info.getProductId(), info.getModelYear(), manufactureDate, - info.getConnectionToSinkType()); + info.getRelativeAddress()); } private DisplayCompatUtil() {} -- cgit v1.2.3 From b309e350d46756543e1b52a73e00a1327eea0bfe Mon Sep 17 00:00:00 2001 From: Kriti Dang Date: Thu, 25 Feb 2021 18:11:34 +0100 Subject: Changes in tvsystem/ DeviceProductInfo to mirror changes in frameworks/base/ DeviceProductInfo Bug: 179775994 Test: N/A Change-Id: I6b92cb3ef59f68f6eb9b73be03c51bf2c21dc2a3 --- api/current.txt | 9 ++- .../tv/tvsystem/display/DeviceProductInfo.java | 73 +++++++++++++++++++--- .../tv/tvsystem/display/DisplayCompatUtil.java | 2 +- 3 files changed, 73 insertions(+), 11 deletions(-) diff --git a/api/current.txt b/api/current.txt index 09cb6e8..fde8b7f 100644 --- a/api/current.txt +++ b/api/current.txt @@ -2,13 +2,18 @@ package com.android.libraries.tv.tvsystem.display { public final class DeviceProductInfo { - ctor public DeviceProductInfo(String, String, String, Integer, com.android.libraries.tv.tvsystem.display.DeviceProductInfo.ManufactureDate, int[]); + ctor @Deprecated public DeviceProductInfo(String, String, String, Integer, com.android.libraries.tv.tvsystem.display.DeviceProductInfo.ManufactureDate, int[]); + method public int getConnectionToSinkType(); method public com.android.libraries.tv.tvsystem.display.DeviceProductInfo.ManufactureDate getManufactureDate(); method public String getManufacturerPnpId(); method public Integer getModelYear(); method public String getName(); method public String getProductId(); - method public int[] getRelativeAddress(); + method @Deprecated public int[] getRelativeAddress(); + field public static final int CONNECTION_TO_SINK_BUILT_IN = 1; // 0x1 + field public static final int CONNECTION_TO_SINK_DIRECT = 2; // 0x2 + field public static final int CONNECTION_TO_SINK_TRANSITIVE = 3; // 0x3 + field public static final int CONNECTION_TO_SINK_UNKNOWN = 0; // 0x0 } public static class DeviceProductInfo.ManufactureDate { diff --git a/java/com/android/libraries/tv/tvsystem/display/DeviceProductInfo.java b/java/com/android/libraries/tv/tvsystem/display/DeviceProductInfo.java index 6e78253..fb0bf71 100644 --- a/java/com/android/libraries/tv/tvsystem/display/DeviceProductInfo.java +++ b/java/com/android/libraries/tv/tvsystem/display/DeviceProductInfo.java @@ -16,7 +16,10 @@ package com.android.libraries.tv.tvsystem.display; -import java.util.Arrays; +import android.annotation.IntDef; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; import java.util.Objects; /** @@ -25,13 +28,39 @@ import java.util.Objects; * product information about the intermediate device. */ public final class DeviceProductInfo { + /** @hide */ + @IntDef(prefix = {"CONNECTION_TO_SINK_"}, value = { + CONNECTION_TO_SINK_UNKNOWN, + CONNECTION_TO_SINK_BUILT_IN, + CONNECTION_TO_SINK_DIRECT, + CONNECTION_TO_SINK_TRANSITIVE + }) + @Retention(RetentionPolicy.SOURCE) + public @interface ConnectionToSinkType { } + + /** The device connection to the display sink is unknown. */ + public static final int CONNECTION_TO_SINK_UNKNOWN = 0; + + /** The display sink is built-in to the device */ + public static final int CONNECTION_TO_SINK_BUILT_IN = 1; + + /** The device is directly connected to the display sink. */ + public static final int CONNECTION_TO_SINK_DIRECT = 2; + + /** The device is transitively connected to the display sink. */ + public static final int CONNECTION_TO_SINK_TRANSITIVE = 3; + private final String mName; private final String mManufacturerPnpId; private final String mProductId; private final Integer mModelYear; private final ManufactureDate mManufactureDate; - private final int[] mRelativeAddress; + private final @ConnectionToSinkType int mConnectionToSinkType; + /** @deprecated use + * {@link #DeviceProductInfo(String, String, String, Integer, ManufactureDate, int)} ()} + * instead.*/ + @Deprecated public DeviceProductInfo( String name, String manufacturerPnpId, @@ -44,7 +73,23 @@ public final class DeviceProductInfo { this.mProductId = productId; this.mModelYear = modelYear; this.mManufactureDate = manufactureDate; - this.mRelativeAddress = relativeAddress; + this.mConnectionToSinkType = CONNECTION_TO_SINK_UNKNOWN; + } + + /** @hide */ + public DeviceProductInfo( + String name, + String manufacturerPnpId, + String productId, + Integer modelYear, + ManufactureDate manufactureDate, + int connectionToSinkType) { + this.mName = name; + this.mManufacturerPnpId = manufacturerPnpId; + this.mProductId = productId; + this.mModelYear = modelYear; + this.mManufactureDate = manufactureDate; + this.mConnectionToSinkType = connectionToSinkType; } /** @@ -87,9 +132,21 @@ public final class DeviceProductInfo { /** * @return Relative address in the display network. For example, for HDMI connected devices this * can be its physical address. Each component of the address is in the range [0, 255]. + * + * @deprecated use {@link #getConnectionToSinkType()} instead. */ + @Deprecated public int[] getRelativeAddress() { - return mRelativeAddress; + return null; + } + + /** + * @return How the current device is connected to the display sink. For example, the display + * can be connected immediately to the device or there can be a receiver in between. + */ + @ConnectionToSinkType + public int getConnectionToSinkType() { + return mConnectionToSinkType; } @Override @@ -105,8 +162,8 @@ public final class DeviceProductInfo { + mModelYear + ", manufactureDate=" + mManufactureDate - + ", relativeAddress=" - + Arrays.toString(mRelativeAddress) + + ", connectionToSinkType=" + + mConnectionToSinkType + '}'; } @@ -120,13 +177,13 @@ public final class DeviceProductInfo { && Objects.equals(mProductId, that.mProductId) && Objects.equals(mModelYear, that.mModelYear) && Objects.equals(mManufactureDate, that.mManufactureDate) - && Arrays.equals(mRelativeAddress, that.mRelativeAddress); + && mConnectionToSinkType == that.mConnectionToSinkType; } @Override public int hashCode() { return Objects.hash(mName, mManufacturerPnpId, mProductId, mModelYear, mManufactureDate, - mRelativeAddress); + mConnectionToSinkType); } /** diff --git a/java/com/android/libraries/tv/tvsystem/display/DisplayCompatUtil.java b/java/com/android/libraries/tv/tvsystem/display/DisplayCompatUtil.java index fb19f98..746f90b 100644 --- a/java/com/android/libraries/tv/tvsystem/display/DisplayCompatUtil.java +++ b/java/com/android/libraries/tv/tvsystem/display/DisplayCompatUtil.java @@ -64,7 +64,7 @@ public final class DisplayCompatUtil { } return new DeviceProductInfo(info.getName(), info.getManufacturerPnpId(), info.getProductId(), info.getModelYear(), manufactureDate, - info.getRelativeAddress()); + info.getConnectionToSinkType()); } private DisplayCompatUtil() {} -- cgit v1.2.3 From 59fe042252c98bb8a0a1b14bab51ddd5577b759b Mon Sep 17 00:00:00 2001 From: Robert Horvath Date: Tue, 23 Mar 2021 15:36:53 +0100 Subject: Add unsafe_ignore_missing_latest_api Required to remove TvSystem from prebuilts/sdk. Bug: 174218249 Test: m Change-Id: I5f1e862398a66be5fb31b053aeef7b3671a4633f --- Android.bp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Android.bp b/Android.bp index 61233f8..01a9950 100644 --- a/Android.bp +++ b/Android.bp @@ -31,5 +31,6 @@ java_sdk_library { enabled: false, }, system_ext_specific: true, - no_dist: true + no_dist: true, + unsafe_ignore_missing_latest_api: true } -- cgit v1.2.3 From 8212a763fe51bbaa98cf57a3990256e686833c29 Mon Sep 17 00:00:00 2001 From: lucaslin Date: Wed, 7 Apr 2021 17:55:15 +0800 Subject: Replace hidden API - ALL_ZEROS_ADDRESS with public API MacAddress is inside mainline module, so the external callers cannot call its hidden API. Replace hidden API - ALL_ZEROS_ADDRESS with MacAddress#fromString. Bug: 182859030 Test: 1. Remove "framework-connectivity.impl" 2. cd frameworks/opt/tv/tvsystem; mm Change-Id: Ica21b6e15d40456f001421f6b00bc08835a5d7d4 --- java/com/android/libraries/tv/tvsystem/wifi/SoftApConfiguration.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/java/com/android/libraries/tv/tvsystem/wifi/SoftApConfiguration.java b/java/com/android/libraries/tv/tvsystem/wifi/SoftApConfiguration.java index a467965..2bc81af 100644 --- a/java/com/android/libraries/tv/tvsystem/wifi/SoftApConfiguration.java +++ b/java/com/android/libraries/tv/tvsystem/wifi/SoftApConfiguration.java @@ -208,7 +208,8 @@ public final class SoftApConfiguration implements Parcelable { @NonNull public Builder setBssid(@Nullable MacAddress bssid) { if (bssid != null) { - Preconditions.checkArgument(!bssid.equals(MacAddress.ALL_ZEROS_ADDRESS)); + Preconditions.checkArgument(!bssid.equals( + MacAddress.fromString("00:00:00:00:00:00"))); Preconditions.checkArgument(!bssid.equals(MacAddress.BROADCAST_ADDRESS)); } mBssid = bssid; -- cgit v1.2.3