diff options
21 files changed, 60 insertions, 46 deletions
diff --git a/cmds/app_process/Android.bp b/cmds/app_process/Android.bp index d541169ae97a..f92502370566 100644 --- a/cmds/app_process/Android.bp +++ b/cmds/app_process/Android.bp @@ -21,6 +21,7 @@ cc_binary { "libbinder", "libcutils", "libdl", + "libhidlbase", "libhwbinder", "liblog", "libnativeloader", diff --git a/core/java/android/bluetooth/BluetoothAdapter.java b/core/java/android/bluetooth/BluetoothAdapter.java index 31bbd16497cb..39d63de87da3 100644 --- a/core/java/android/bluetooth/BluetoothAdapter.java +++ b/core/java/android/bluetooth/BluetoothAdapter.java @@ -1028,7 +1028,8 @@ public final class BluetoothAdapter { */ @RequiresPermission(Manifest.permission.BLUETOOTH) @AdapterState - @UnsupportedAppUsage + @UnsupportedAppUsage(publicAlternatives = "Use {@link #getState()} instead to determine " + + "whether you can use BLE & BT classic.") public int getLeState() { int state = BluetoothAdapter.STATE_OFF; @@ -1484,7 +1485,8 @@ public final class BluetoothAdapter { * @return true if the scan mode was set, false otherwise * @hide */ - @UnsupportedAppUsage + @UnsupportedAppUsage(publicAlternatives = "Use {@link #ACTION_REQUEST_DISCOVERABLE}, which " + + "shows UI that confirms the user wants to go into discoverable mode.") public boolean setScanMode(@ScanMode int mode, int duration) { if (getState() != STATE_ON) { return false; diff --git a/core/java/android/bluetooth/BluetoothDevice.java b/core/java/android/bluetooth/BluetoothDevice.java index 34c7372202ee..ee33103ebb2f 100644 --- a/core/java/android/bluetooth/BluetoothDevice.java +++ b/core/java/android/bluetooth/BluetoothDevice.java @@ -1051,7 +1051,7 @@ public final class BluetoothDevice implements Parcelable { * @return the Bluetooth alias, or null if no alias or there was a problem * @hide */ - @UnsupportedAppUsage + @UnsupportedAppUsage(publicAlternatives = "Use {@link #getName()} instead.") public String getAlias() { final IBluetooth service = sService; if (service == null) { @@ -1100,7 +1100,7 @@ public final class BluetoothDevice implements Parcelable { * @see #getAlias() * @see #getName() */ - @UnsupportedAppUsage + @UnsupportedAppUsage(publicAlternatives = "Use {@link #getName()} instead.") public String getAliasName() { String name = getAlias(); if (name == null) { @@ -1975,7 +1975,8 @@ public final class BluetoothDevice implements Parcelable { * permissions. * @hide */ - @UnsupportedAppUsage + @UnsupportedAppUsage(publicAlternatives = "Use " + + "{@link #createInsecureRfcommSocketToServiceRecord} instead.") public BluetoothSocket createInsecureRfcommSocket(int port) throws IOException { if (!isBluetoothEnabled()) { Log.e(TAG, "Bluetooth is not enabled"); diff --git a/core/java/android/bluetooth/BluetoothServerSocket.java b/core/java/android/bluetooth/BluetoothServerSocket.java index c06b837a9ee3..3a23808f3617 100644 --- a/core/java/android/bluetooth/BluetoothServerSocket.java +++ b/core/java/android/bluetooth/BluetoothServerSocket.java @@ -77,7 +77,8 @@ public final class BluetoothServerSocket implements Closeable { private static final String TAG = "BluetoothServerSocket"; private static final boolean DBG = false; - @UnsupportedAppUsage + @UnsupportedAppUsage(publicAlternatives = "Use public {@link BluetoothServerSocket} API " + + "instead.") /*package*/ final BluetoothSocket mSocket; private Handler mHandler; private int mMessage; diff --git a/core/java/android/bluetooth/BluetoothSocket.java b/core/java/android/bluetooth/BluetoothSocket.java index 3a1e2f58c99d..a6e3153d6af7 100644 --- a/core/java/android/bluetooth/BluetoothSocket.java +++ b/core/java/android/bluetooth/BluetoothSocket.java @@ -131,7 +131,7 @@ public final class BluetoothSocket implements Closeable { private boolean mExcludeSdp = false; /* when true no SPP SDP record will be created */ private boolean mAuthMitm = false; /* when true Man-in-the-middle protection will be enabled*/ private boolean mMin16DigitPin = false; /* Minimum 16 digit pin for sec mode 2 connections */ - @UnsupportedAppUsage + @UnsupportedAppUsage(publicAlternatives = "Use {@link BluetoothSocket} public API instead.") private ParcelFileDescriptor mPfd; @UnsupportedAppUsage private LocalSocket mSocket; diff --git a/core/java/android/net/SocketKeepalive.java b/core/java/android/net/SocketKeepalive.java index 46eddde968a0..ec73866a647d 100644 --- a/core/java/android/net/SocketKeepalive.java +++ b/core/java/android/net/SocketKeepalive.java @@ -44,9 +44,11 @@ import java.util.concurrent.Executor; * {@link SocketKeepalive.Callback#onStopped} if the operation was successful or * {@link SocketKeepalive.Callback#onError} if an error occurred. * - * The device SHOULD support keepalive offload. If it does not, it MUST reply with + * For cellular, the device MUST support at least 1 keepalive slot. + * + * For WiFi, the device SHOULD support keepalive offload. If it does not, it MUST reply with * {@link SocketKeepalive.Callback#onError} with {@code ERROR_UNSUPPORTED} to any keepalive offload - * request. If it does, it MUST support at least 3 concurrent keepalive slots per transport. + * request. If it does, it MUST support at least 3 concurrent keepalive slots. */ public abstract class SocketKeepalive implements AutoCloseable { static final String TAG = "SocketKeepalive"; diff --git a/core/java/android/net/util/KeepaliveUtils.java b/core/java/android/net/util/KeepaliveUtils.java index 569fed1fc994..bfc4563fbf8f 100644 --- a/core/java/android/net/util/KeepaliveUtils.java +++ b/core/java/android/net/util/KeepaliveUtils.java @@ -34,9 +34,6 @@ public final class KeepaliveUtils { public static final String TAG = "KeepaliveUtils"; - // Minimum supported keepalive count per transport if the network supports keepalive. - public static final int MIN_SUPPORTED_KEEPALIVE_COUNT = 3; - public static class KeepaliveDeviceConfigurationException extends AndroidRuntimeException { public KeepaliveDeviceConfigurationException(final String msg) { super(msg); @@ -84,10 +81,7 @@ public final class KeepaliveUtils { throw new KeepaliveDeviceConfigurationException("Invalid transport " + transport); } - // Customized values should be either 0 to indicate the network doesn't support - // keepalive offload, or a positive value that is at least - // MIN_SUPPORTED_KEEPALIVE_COUNT if supported. - if (supported != 0 && supported < MIN_SUPPORTED_KEEPALIVE_COUNT) { + if (supported < 0) { throw new KeepaliveDeviceConfigurationException( "Invalid supported count " + supported + " for " + NetworkCapabilities.transportNameOf(transport)); diff --git a/core/proto/android/server/connectivity/Android.bp b/core/proto/android/server/connectivity/Android.bp index c0ac2cb8f800..413623963851 100644 --- a/core/proto/android/server/connectivity/Android.bp +++ b/core/proto/android/server/connectivity/Android.bp @@ -21,5 +21,4 @@ java_library_static { "data_stall_event.proto", ], sdk_version: "system_current", - no_framework_libs: true, -}
\ No newline at end of file +} diff --git a/core/proto/android/stats/connectivity/Android.bp b/core/proto/android/stats/connectivity/Android.bp index 5aa4ddbdf7f9..5d642d3845fe 100644 --- a/core/proto/android/stats/connectivity/Android.bp +++ b/core/proto/android/stats/connectivity/Android.bp @@ -21,5 +21,4 @@ java_library_static { "network_stack.proto", ], sdk_version: "system_current", - no_framework_libs: true, -}
\ No newline at end of file +} diff --git a/core/proto/android/stats/dnsresolver/Android.bp b/core/proto/android/stats/dnsresolver/Android.bp index 0b5aa8677a6e..1e8c76314448 100644 --- a/core/proto/android/stats/dnsresolver/Android.bp +++ b/core/proto/android/stats/dnsresolver/Android.bp @@ -21,5 +21,4 @@ java_library_static { "dns_resolver.proto", ], sdk_version: "system_current", - no_framework_libs: true, } diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index f94a5bdcb09f..1fce5be4def0 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -353,7 +353,7 @@ overridden by the device to present the capability of creating socket keepalives. --> <!-- An Array of "[NetworkCapabilities.TRANSPORT_*],[supported keepalives] --> <string-array translatable="false" name="config_networkSupportedKeepaliveCount"> - <item>0,3</item> + <item>0,1</item> <item>1,3</item> </string-array> diff --git a/graphics/proto/Android.bp b/graphics/proto/Android.bp index 1d06348fb02f..ddced597759f 100644 --- a/graphics/proto/Android.bp +++ b/graphics/proto/Android.bp @@ -5,7 +5,6 @@ java_library_static { type: "lite", }, srcs: ["game_driver.proto"], - no_framework_libs: true, jarjar_rules: "jarjar-rules.txt", sdk_version: "28", } diff --git a/libs/androidfw/ApkAssets.cpp b/libs/androidfw/ApkAssets.cpp index 7ba7828d71c4..5a8579a275df 100644 --- a/libs/androidfw/ApkAssets.cpp +++ b/libs/androidfw/ApkAssets.cpp @@ -211,7 +211,7 @@ bool ApkAssets::ForEachFile(const std::string& root_path, return false; } - ::ZipString name; + std::string name; ::ZipEntry entry; // We need to hold back directories because many paths will contain them and we want to only @@ -220,7 +220,7 @@ bool ApkAssets::ForEachFile(const std::string& root_path, int32_t result; while ((result = ::Next(cookie, &entry, &name)) == 0) { - StringPiece full_file_path(reinterpret_cast<const char*>(name.name), name.name_length); + StringPiece full_file_path(name); StringPiece leaf_file_path = full_file_path.substr(root_path_full.size()); if (!leaf_file_path.empty()) { diff --git a/libs/androidfw/ZipFileRO.cpp b/libs/androidfw/ZipFileRO.cpp index ee5f7783635d..e77ac3df474c 100644 --- a/libs/androidfw/ZipFileRO.cpp +++ b/libs/androidfw/ZipFileRO.cpp @@ -39,7 +39,7 @@ using namespace android; class _ZipEntryRO { public: ZipEntry entry; - ZipString name; + std::string_view name; void *cookie; _ZipEntryRO() : cookie(NULL) {} @@ -96,7 +96,7 @@ ZipEntryRO ZipFileRO::findEntryByName(const char* entryName) const { _ZipEntryRO* data = new _ZipEntryRO; - data->name = ZipString(entryName); + data->name = entryName; const int32_t error = FindEntry(mHandle, entryName, &(data->entry)); if (error) { @@ -194,14 +194,14 @@ int ZipFileRO::getEntryFileName(ZipEntryRO entry, char* buffer, size_t bufLen) const { const _ZipEntryRO* zipEntry = reinterpret_cast<_ZipEntryRO*>(entry); - const uint16_t requiredSize = zipEntry->name.name_length + 1; + const uint16_t requiredSize = zipEntry->name.length() + 1; if (bufLen < requiredSize) { ALOGW("Buffer too short, requires %d bytes for entry name", requiredSize); return requiredSize; } - memcpy(buffer, zipEntry->name.name, requiredSize - 1); + memcpy(buffer, zipEntry->name.data(), requiredSize - 1); buffer[requiredSize - 1] = '\0'; return 0; diff --git a/proto/Android.bp b/proto/Android.bp index e924a4dcd201..5523c53b4d20 100644 --- a/proto/Android.bp +++ b/proto/Android.bp @@ -25,6 +25,5 @@ java_library_static { type: "nano", }, srcs: ["src/metrics_constants.proto"], - no_framework_libs: true, sdk_version: "system_current", } diff --git a/services/core/java/com/android/server/connectivity/KeepaliveTracker.java b/services/core/java/com/android/server/connectivity/KeepaliveTracker.java index 626d724404c7..9bae902eb7b1 100644 --- a/services/core/java/com/android/server/connectivity/KeepaliveTracker.java +++ b/services/core/java/com/android/server/connectivity/KeepaliveTracker.java @@ -562,7 +562,7 @@ public class KeepaliveTracker { if (KeepaliveInfo.STARTING == ki.mStartedState) { if (SUCCESS == reason) { // Keepalive successfully started. - if (DBG) Log.d(TAG, "Started keepalive " + slot + " on " + nai.name()); + Log.d(TAG, "Started keepalive " + slot + " on " + nai.name()); ki.mStartedState = KeepaliveInfo.STARTED; try { ki.mCallback.onStarted(slot); diff --git a/services/net/java/android/net/NetworkStackClient.java b/services/net/java/android/net/NetworkStackClient.java index cf52574e83e3..787fda33717a 100644 --- a/services/net/java/android/net/NetworkStackClient.java +++ b/services/net/java/android/net/NetworkStackClient.java @@ -488,7 +488,9 @@ public class NetworkStackClient { private void requestConnector(@NonNull NetworkStackCallback request) { // TODO: PID check. final int caller = Binder.getCallingUid(); - if (caller != Process.SYSTEM_UID && !UserHandle.isSameApp(caller, Process.BLUETOOTH_UID) + if (caller != Process.SYSTEM_UID + && caller != Process.NETWORK_STACK_UID + && !UserHandle.isSameApp(caller, Process.BLUETOOTH_UID) && !UserHandle.isSameApp(caller, Process.PHONE_UID)) { // Don't even attempt to obtain the connector and give a nice error message throw new SecurityException( diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 3ae9b33cb145..c955efbe6632 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -4733,7 +4733,8 @@ public class TelephonyManager { ITelephony telephony = getITelephony(); if (telephony == null) return DATA_ACTIVITY_NONE; - return telephony.getDataActivity(); + return telephony.getDataActivity( + getSubId(SubscriptionManager.getActiveDataSubscriptionId())); } catch (RemoteException ex) { // the phone process is restarting. return DATA_ACTIVITY_NONE; @@ -4781,7 +4782,8 @@ public class TelephonyManager { ITelephony telephony = getITelephony(); if (telephony == null) return DATA_DISCONNECTED; - return telephony.getDataState(); + return telephony.getDataState( + getSubId(SubscriptionManager.getActiveDataSubscriptionId())); } catch (RemoteException ex) { // the phone process is restarting. return DATA_DISCONNECTED; diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index 1aba95bf5e5a..4de19173965b 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -308,18 +308,36 @@ interface ITelephony { */ List<NeighboringCellInfo> getNeighboringCellInfo(String callingPkg); - @UnsupportedAppUsage - int getCallState(); + @UnsupportedAppUsage + int getCallState(); /** * Returns the call state for a slot. */ int getCallStateForSlot(int slotIndex); - @UnsupportedAppUsage - int getDataActivity(); - @UnsupportedAppUsage - int getDataState(); + /** + * Returns a constant indicating the type of activity on a data connection + * (cellular). + * + * @see #DATA_ACTIVITY_NONE + * @see #DATA_ACTIVITY_IN + * @see #DATA_ACTIVITY_OUT + * @see #DATA_ACTIVITY_INOUT + * @see #DATA_ACTIVITY_DORMANT + */ + int getDataActivity(int subId); + + /** + * Returns a constant indicating the current data connection state + * (cellular). + * + * @see #DATA_DISCONNECTED + * @see #DATA_CONNECTING + * @see #DATA_CONNECTED + * @see #DATA_SUSPENDED + */ + int getDataState(int subId); /** * Returns the current active phone type as integer. diff --git a/tests/net/java/android/net/util/KeepaliveUtilsTest.kt b/tests/net/java/android/net/util/KeepaliveUtilsTest.kt index 814e06e311b3..8ea226db938e 100644 --- a/tests/net/java/android/net/util/KeepaliveUtilsTest.kt +++ b/tests/net/java/android/net/util/KeepaliveUtilsTest.kt @@ -78,7 +78,6 @@ class KeepaliveUtilsTest { assertRunWithException(arrayOf("5")) // Check resource with invalid slots value. - assertRunWithException(arrayOf("2,2")) assertRunWithException(arrayOf("3,-1")) // Check resource with invalid transport type. diff --git a/tools/aapt2/io/ZipArchive.cpp b/tools/aapt2/io/ZipArchive.cpp index 550edd344aa3..77ecf6210a56 100644 --- a/tools/aapt2/io/ZipArchive.cpp +++ b/tools/aapt2/io/ZipArchive.cpp @@ -115,12 +115,9 @@ std::unique_ptr<ZipFileCollection> ZipFileCollection::Create( using IterationEnder = std::unique_ptr<void, decltype(EndIteration)*>; IterationEnder iteration_ender(cookie, EndIteration); - ZipString zip_entry_name; + std::string zip_entry_path; ZipEntry zip_data; - while ((result = Next(cookie, &zip_data, &zip_entry_name)) == 0) { - std::string zip_entry_path = - std::string(reinterpret_cast<const char*>(zip_entry_name.name), - zip_entry_name.name_length); + while ((result = Next(cookie, &zip_data, &zip_entry_path)) == 0) { std::string nested_path = path.to_string() + "@" + zip_entry_path; std::unique_ptr<IFile> file = util::make_unique<ZipFile>(collection->handle_, zip_data, Source(nested_path)); |