diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-10-16 20:21:18 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-10-16 20:21:18 +0000 |
commit | 48dc8f39f34451aa25193544b3e4d44a9e4e1640 (patch) | |
tree | d94483e410a3a9bc6b27d8bdd1a65161c1bf8efd | |
parent | 677c9e9eafe870520903726500c2f8d00b5b4311 (diff) | |
parent | 452a9e8d1a6af8cfe122a6a76038435efecebbe2 (diff) | |
download | sl4a-48dc8f39f34451aa25193544b3e4d44a9e4e1640.tar.gz |
Snap for 10957012 from 452a9e8d1a6af8cfe122a6a76038435efecebbe2 to simpleperf-release
Change-Id: I93d9a73a16bbb28e4fd5564e134d41d29c05d78b
13 files changed, 132 insertions, 28 deletions
diff --git a/Common/Android.bp b/Common/Android.bp index 499ac585..41154b29 100644 --- a/Common/Android.bp +++ b/Common/Android.bp @@ -34,6 +34,7 @@ java_library { "junit", "modules-utils-build", "aosp_test_rcs_client_base", + "com.uwb.support.ccc", "com.uwb.support.fira", ], diff --git a/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothA2dpFacade.java b/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothA2dpFacade.java index 0a40f9e7..2c200d3e 100644 --- a/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothA2dpFacade.java +++ b/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothA2dpFacade.java @@ -129,8 +129,8 @@ public class BluetoothA2dpFacade extends RpcReceiver { */ public Boolean a2dpDisconnect(BluetoothDevice device) { if (sA2dpProfile == null) return false; - if (sA2dpProfile.getPriority(device) > BluetoothProfile.PRIORITY_ON) { - sA2dpProfile.setPriority(device, BluetoothProfile.PRIORITY_ON); + if (sA2dpProfile.getConnectionPolicy(device) > BluetoothProfile.CONNECTION_POLICY_ALLOWED) { + sA2dpProfile.setConnectionPolicy(device, BluetoothProfile.CONNECTION_POLICY_ALLOWED); } return sA2dpProfile.disconnect(device); } @@ -162,7 +162,7 @@ public class BluetoothA2dpFacade extends RpcReceiver { BluetoothDevice device = BluetoothFacade.getDevice(mBluetoothAdapter.getBondedDevices(), deviceStr); Log.d("Changing priority of device " + device.getAlias() + " p: " + priority); - sA2dpProfile.setPriority(device, priority); + sA2dpProfile.setConnectionPolicy(device, priority); } diff --git a/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothA2dpSinkFacade.java b/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothA2dpSinkFacade.java index 26124bfe..c725464b 100644 --- a/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothA2dpSinkFacade.java +++ b/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothA2dpSinkFacade.java @@ -101,7 +101,7 @@ public class BluetoothA2dpSinkFacade extends RpcReceiver { mBluetoothAdapter.getBondedDevices(), deviceStr); Log.d("Changing priority of device " + device.getAlias() + " p: " + priority); - sA2dpSinkProfile.setPriority(device, priority); + sA2dpSinkProfile.setConnectionPolicy(device, priority); } /** @@ -114,11 +114,11 @@ public class BluetoothA2dpSinkFacade extends RpcReceiver { @RpcParameter(name = "device", description = "Mac address of a BT device.") String deviceStr) throws Exception { - if (sA2dpSinkProfile == null) return BluetoothProfile.PRIORITY_UNDEFINED; + if (sA2dpSinkProfile == null) return BluetoothProfile.CONNECTION_POLICY_UNKNOWN; BluetoothDevice device = BluetoothFacade.getDevice( mBluetoothAdapter.getBondedDevices(), deviceStr); - return sA2dpSinkProfile.getPriority(device); + return sA2dpSinkProfile.getConnectionPolicy(device); } /** diff --git a/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothHfpClientFacade.java b/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothHfpClientFacade.java index 8c6f93f8..0eb0e2fe 100644 --- a/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothHfpClientFacade.java +++ b/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothHfpClientFacade.java @@ -114,7 +114,7 @@ public class BluetoothHfpClientFacade extends RpcReceiver { deviceStr); Log.d("Changing priority of device " + device.getAlias() + " p: " + priority); - sHfpClientProfile.setPriority(device, priority); + sHfpClientProfile.setConnectionPolicy(device, priority); } /** @@ -127,10 +127,10 @@ public class BluetoothHfpClientFacade extends RpcReceiver { @RpcParameter(name = "device", description = "Mac address of a BT device.") String deviceStr) throws Exception { - if (sHfpClientProfile == null) return BluetoothProfile.PRIORITY_UNDEFINED; + if (sHfpClientProfile == null) return BluetoothProfile.CONNECTION_POLICY_UNKNOWN; BluetoothDevice device = BluetoothFacade.getDevice( mBluetoothAdapter.getBondedDevices(), deviceStr); - return sHfpClientProfile.getPriority(device); + return sHfpClientProfile.getConnectionPolicy(device); } /** @@ -392,4 +392,4 @@ public class BluetoothHfpClientFacade extends RpcReceiver { @Override public void shutdown() { } -}
\ No newline at end of file +} diff --git a/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothHidFacade.java b/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothHidFacade.java index 6829c90c..968e471c 100644 --- a/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothHidFacade.java +++ b/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothHidFacade.java @@ -347,7 +347,7 @@ public class BluetoothHidFacade extends RpcReceiver { Integer priority) throws Exception { BluetoothDevice device = BluetoothFacade.getDevice(sHidProfile.getConnectedDevices(), deviceID); - return sHidProfile.setPriority(device, priority); + return sHidProfile.setConnectionPolicy(device, priority); } /** @@ -363,7 +363,7 @@ public class BluetoothHidFacade extends RpcReceiver { String deviceID) throws Exception { BluetoothDevice device = BluetoothFacade.getDevice(sHidProfile.getConnectedDevices(), deviceID); - return sHidProfile.getPriority(device); + return sHidProfile.getConnectionPolicy(device); } /** diff --git a/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothMapClientFacade.java b/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothMapClientFacade.java index aaeac4c7..e0e80e04 100644 --- a/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothMapClientFacade.java +++ b/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothMapClientFacade.java @@ -157,8 +157,8 @@ public class BluetoothMapClientFacade extends RpcReceiver { } public Boolean mapDisconnect(BluetoothDevice device) { - if (sMapProfile.getPriority(device) > BluetoothProfile.PRIORITY_ON) { - sMapProfile.setPriority(device, BluetoothProfile.PRIORITY_ON); + if (sMapProfile.getConnectionPolicy(device) > BluetoothProfile.CONNECTION_POLICY_ALLOWED) { + sMapProfile.setConnectionPolicy(device, BluetoothProfile.CONNECTION_POLICY_ALLOWED); } return sMapProfile.disconnect(device); } @@ -182,8 +182,10 @@ public class BluetoothMapClientFacade extends RpcReceiver { connectedMapDevices, deviceID); if (!connectedMapDevices.isEmpty() && connectedMapDevices.get(0).equals(mDevice)) { - if (sMapProfile.getPriority(mDevice) > BluetoothProfile.PRIORITY_ON) { - sMapProfile.setPriority(mDevice, BluetoothProfile.PRIORITY_ON); + if (sMapProfile.getConnectionPolicy(mDevice) + > BluetoothProfile.CONNECTION_POLICY_ALLOWED) { + sMapProfile.setConnectionPolicy( + mDevice, BluetoothProfile.CONNECTION_POLICY_ALLOWED); } return sMapProfile.disconnect(mDevice); } else { diff --git a/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothMapFacade.java b/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothMapFacade.java index e3fe007b..2e7c534a 100644 --- a/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothMapFacade.java +++ b/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothMapFacade.java @@ -71,8 +71,8 @@ public class BluetoothMapFacade extends RpcReceiver { * @return if the disconnection was successfull or not. */ public Boolean mapDisconnect(BluetoothDevice device) { - if (sMapProfile.getPriority(device) > BluetoothProfile.PRIORITY_ON) { - sMapProfile.setPriority(device, BluetoothProfile.PRIORITY_ON); + if (sMapProfile.getConnectionPolicy(device) > BluetoothProfile.CONNECTION_POLICY_ALLOWED) { + sMapProfile.setConnectionPolicy(device, BluetoothProfile.CONNECTION_POLICY_ALLOWED); } return sMapProfile.disconnect(device); } @@ -103,9 +103,10 @@ public class BluetoothMapFacade extends RpcReceiver { BluetoothDevice mDevice = BluetoothFacade.getDevice(connectedMapDevices, deviceID); if (!connectedMapDevices.isEmpty() && connectedMapDevices.get(0).equals(mDevice)) { - if (sMapProfile.getPriority(mDevice) - > BluetoothProfile.PRIORITY_ON) { - sMapProfile.setPriority(mDevice, BluetoothProfile.PRIORITY_ON); + if (sMapProfile.getConnectionPolicy(mDevice) + > BluetoothProfile.CONNECTION_POLICY_ALLOWED) { + sMapProfile.setConnectionPolicy( + mDevice, BluetoothProfile.CONNECTION_POLICY_ALLOWED); } return sMapProfile.disconnect(mDevice); } else { diff --git a/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothPbapClientFacade.java b/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothPbapClientFacade.java index 979a1384..717926e9 100644 --- a/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothPbapClientFacade.java +++ b/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothPbapClientFacade.java @@ -115,7 +115,7 @@ public class BluetoothPbapClientFacade extends RpcReceiver { deviceStr); Log.d("Changing priority of device " + device.getAlias() + " p: " + priority); - sPbapClientProfile.setPriority(device, priority); + sPbapClientProfile.setConnectionPolicy(device, priority); } /** @@ -128,12 +128,12 @@ public class BluetoothPbapClientFacade extends RpcReceiver { description = "Mac address of a BT device.") String deviceStr) throws Exception { if (sPbapClientProfile == null) { - return BluetoothProfile.PRIORITY_UNDEFINED; + return BluetoothProfile.CONNECTION_POLICY_UNKNOWN; } BluetoothDevice device = BluetoothFacade.getDevice(mBluetoothAdapter.getBondedDevices(), deviceStr); - return sPbapClientProfile.getPriority(device); + return sPbapClientProfile.getConnectionPolicy(device); } /** diff --git a/Common/src/com/googlecode/android_scripting/facade/telephony/SmsFacade.java b/Common/src/com/googlecode/android_scripting/facade/telephony/SmsFacade.java index 1de17161..1c8724f2 100644 --- a/Common/src/com/googlecode/android_scripting/facade/telephony/SmsFacade.java +++ b/Common/src/com/googlecode/android_scripting/facade/telephony/SmsFacade.java @@ -740,7 +740,7 @@ public class SmsFacade extends RpcReceiver { } private PendingIntent createBroadcastPendingIntent(String intentAction, Uri messageUri) { - Intent intent = new Intent(intentAction, messageUri); + Intent intent = new Intent(intentAction, messageUri).setPackage(mService.getPackageName()); return PendingIntent.getBroadcast(mService, 0, intent, PendingIntent.FLAG_MUTABLE); } diff --git a/Common/src/com/googlecode/android_scripting/facade/telephony/TelephonyManagerFacade.java b/Common/src/com/googlecode/android_scripting/facade/telephony/TelephonyManagerFacade.java index ac6f9e74..f68647ab 100644 --- a/Common/src/com/googlecode/android_scripting/facade/telephony/TelephonyManagerFacade.java +++ b/Common/src/com/googlecode/android_scripting/facade/telephony/TelephonyManagerFacade.java @@ -1289,7 +1289,7 @@ public class TelephonyManagerFacade extends RpcReceiver { public void telephonySetCellInfoListRate( @RpcParameter(name = "rate") Integer rate ) { - mTelephonyManager.setCellInfoListRate(rate); + mTelephonyManager.setCellInfoListRate(rate, SubscriptionManager.getDefaultSubscriptionId()); } /** diff --git a/Common/src/com/googlecode/android_scripting/facade/uwb/UwbManagerFacade.java b/Common/src/com/googlecode/android_scripting/facade/uwb/UwbManagerFacade.java index 58cf9a07..03a9a29c 100644 --- a/Common/src/com/googlecode/android_scripting/facade/uwb/UwbManagerFacade.java +++ b/Common/src/com/googlecode/android_scripting/facade/uwb/UwbManagerFacade.java @@ -26,6 +26,10 @@ import android.uwb.RangingSession; import android.uwb.UwbAddress; import android.uwb.UwbManager; +import com.google.uwb.support.ccc.CccOpenRangingParams; +import com.google.uwb.support.ccc.CccParams; +import com.google.uwb.support.ccc.CccPulseShapeCombo; +import com.google.uwb.support.ccc.CccRangingStartedParams; import com.google.uwb.support.fira.FiraOpenSessionParams; import com.google.uwb.support.fira.FiraParams; import com.google.uwb.support.fira.FiraRangingReconfigureParams; @@ -318,6 +322,77 @@ public class UwbManagerFacade extends RpcReceiver { return builder.build(); } + private CccRangingStartedParams generateCccRangingStartedParams(JSONObject j) + throws JSONException { + if (j == null) { + return null; + } + CccRangingStartedParams.Builder builder = new CccRangingStartedParams.Builder(); + if (j.has("stsIndex")) { + builder.setStartingStsIndex(j.getInt("stsIndex")); + } + if (j.has("uwbTime")) { + builder.setUwbTime0(j.getInt("uwbTime")); + } + if (j.has("hopModeKey")) { + builder.setHopModeKey(j.getInt("hopModeKey")); + } + if (j.has("syncCodeIndex")) { + builder.setSyncCodeIndex(j.getInt("syncCodeIndex")); + } + if (j.has("ranMultiplier")) { + builder.setRanMultiplier(j.getInt("ranMultiplier")); + } + + return builder.build(); + } + + private CccOpenRangingParams generateCccOpenRangingParams(JSONObject j) throws JSONException { + if (j == null) { + return null; + } + CccOpenRangingParams.Builder builder = new CccOpenRangingParams.Builder(); + builder.setProtocolVersion(CccParams.PROTOCOL_VERSION_1_0); + if (j.has("sessionId")) { + builder.setSessionId(j.getInt("sessionId")); + } + if (j.has("uwbConfig")) { + builder.setUwbConfig(j.getInt("uwbConfig")); + } + if (j.has("ranMultiplier")) { + builder.setRanMultiplier(j.getInt("ranMultiplier")); + } + if (j.has("channel")) { + builder.setChannel(j.getInt("channel")); + } + if (j.has("chapsPerSlot")) { + builder.setNumChapsPerSlot(j.getInt("chapsPerSlot")); + } + if (j.has("responderNodes")) { + builder.setNumResponderNodes(j.getInt("responderNodes")); + } + if (j.has("slotsPerRound")) { + builder.setNumSlotsPerRound(j.getInt("slotsPerRound")); + } + if (j.has("hoppingMode")) { + builder.setHoppingConfigMode(j.getInt("hoppingMode")); + } + if (j.has("hoppingSequence")) { + builder.setHoppingSequence(j.getInt("hoppingSequence")); + } + if (j.has("syncCodeIndex")) { + builder.setSyncCodeIndex(j.getInt("syncCodeIndex")); + } + if (j.has("pulseShapeCombo")) { + JSONObject pulseShapeCombo = j.getJSONObject("pulseShapeCombo"); + builder.setPulseShapeCombo(new CccPulseShapeCombo( + pulseShapeCombo.getInt("pulseShapeComboTx"), + pulseShapeCombo.getInt("pulseShapeComboRx"))); + } + + return builder.build(); + } + private FiraOpenSessionParams generateFiraOpenSessionParams(JSONObject j) throws JSONException { if (j == null) { return null; @@ -424,6 +499,22 @@ public class UwbManagerFacade extends RpcReceiver { } /** + * Open CCC UWB ranging session. + */ + @Rpc(description = "Open CCC UWB ranging session") + public String openCccRangingSession(@RpcParameter(name = "config") JSONObject config) + throws JSONException { + RangingSessionCallback rangingSessionCallback = new RangingSessionCallback( + Event.EventAll.getType()); + CccOpenRangingParams params = generateCccOpenRangingParams(config); + CancellationSignal cancellationSignal = mUwbManager.openRangingSession( + params.toBundle(), mExecutor, rangingSessionCallback); + String key = rangingSessionCallback.mId; + sRangingSessionCallbackMap.put(key, rangingSessionCallback); + return key; + } + + /** * Start UWB ranging. */ @Rpc(description = "Start UWB ranging") @@ -433,6 +524,16 @@ public class UwbManagerFacade extends RpcReceiver { } /** + * Start CCC UWB ranging. + */ + @Rpc(description = "Start CCC UWB ranging") + public void startCccRangingSession(String key, JSONObject config) throws JSONException { + RangingSessionCallback rangingSessionCallback = sRangingSessionCallbackMap.get(key); + CccRangingStartedParams params = generateCccRangingStartedParams(config); + rangingSessionCallback.rangingSession.start(params.toBundle()); + } + + /** * Reconfigures UWB ranging session. */ @Rpc(description = "Reconfigure UWB ranging session") diff --git a/Common/src/com/googlecode/android_scripting/facade/wifi/WifiAwareManagerFacade.java b/Common/src/com/googlecode/android_scripting/facade/wifi/WifiAwareManagerFacade.java index 7586039a..85a72a76 100644 --- a/Common/src/com/googlecode/android_scripting/facade/wifi/WifiAwareManagerFacade.java +++ b/Common/src/com/googlecode/android_scripting/facade/wifi/WifiAwareManagerFacade.java @@ -413,7 +413,7 @@ public class WifiAwareManagerFacade extends RpcReceiver { new AwareAttachCallbackPostsEvents(sessionId, useIdInCallbackEventName), (identityCb != null && identityCb.booleanValue()) ? new AwareIdentityChangeListenerPostsEvents(sessionId, - useIdInCallbackEventName) : null); + useIdInCallbackEventName) : null, false, null); return sessionId; } } @@ -7,7 +7,6 @@ gmoturu@google.com jaineelm@google.com jpawlowski@google.com krisr@google.com -rahulsabnis@google.com siyuanh@google.com tturney@google.com xianyuanjia@google.com |