Merge "Add the systemserver_fragment to media SDK."
diff --git a/api/Android.bp b/api/Android.bp
index 2d7b8bd..ed2247b 100644
--- a/api/Android.bp
+++ b/api/Android.bp
@@ -430,7 +430,7 @@
}
genrule {
- name: "services-system-server-current.txt",
+ name: "frameworks-base-api-system-server-current.txt",
srcs: [
":service-media-s{.system-server.api.txt}",
":service-permission{.system-server.api.txt}",
@@ -457,7 +457,7 @@
}
genrule {
- name: "services-system-server-removed.txt",
+ name: "frameworks-base-api-system-server-removed.txt",
srcs: [
":service-media-s{.system-server.removed-api.txt}",
":service-permission{.system-server.removed-api.txt}",
diff --git a/core/java/android/bluetooth/BluetoothLeAudio.java b/core/java/android/bluetooth/BluetoothLeAudio.java
index 3ea865b..c30c933 100644
--- a/core/java/android/bluetooth/BluetoothLeAudio.java
+++ b/core/java/android/bluetooth/BluetoothLeAudio.java
@@ -199,11 +199,8 @@
*
* <p>
* <ul>
- * <li> {@link #GROUP_STATUS_IDLE} </li>
- * <li> {@link #GROUP_STATUS_STREAMING} </li>
- * <li> {@link #GROUP_STATUS_SUSPENDED} </li>
- * <li> {@link #GROUP_STATUS_RECONFIGURED} </li>
- * <li> {@link #GROUP_STATUS_DESTROYED} </li>
+ * <li> {@link #GROUP_STATUS_ACTIVE} </li>
+ * <li> {@link #GROUP_STATUS_INACTIVE} </li>
* </ul>
* <p>
* @hide
@@ -241,6 +238,19 @@
private final BluetoothAdapter mAdapter;
private final AttributionSource mAttributionSource;
+ /**
+ * Indicating that group is Active ( Audio device is available )
+ * @hide
+ */
+ public static final int GROUP_STATUS_ACTIVE = IBluetoothLeAudio.GROUP_STATUS_ACTIVE;
+
+ /**
+ * Indicating that group is Inactive ( Audio device is not available )
+ * @hide
+ */
+ public static final int GROUP_STATUS_INACTIVE = IBluetoothLeAudio.GROUP_STATUS_INACTIVE;
+
+
private final BluetoothProfileConnector<IBluetoothLeAudio> mProfileConnector =
new BluetoothProfileConnector(this, BluetoothProfile.LE_AUDIO, "BluetoothLeAudio",
IBluetoothLeAudio.class.getName()) {
@@ -433,7 +443,7 @@
* <p> This API returns false in scenarios like the profile on the
* device is not connected or Bluetooth is not turned on.
* When this API returns true, it is guaranteed that the
- * {@link #ACTION_LEAUDIO_ACTIVE_DEVICE_CHANGED} intent will be broadcasted
+ * {@link #ACTION_LE_AUDIO_ACTIVE_DEVICE_CHANGED} intent will be broadcasted
* with the active device.
*
*
@@ -512,6 +522,30 @@
}
/**
+ * Set volume for the streaming devices
+ *
+ * @param volume volume to set
+ * @hide
+ */
+ @RequiresBluetoothConnectPermission
+ @RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT, android.Manifest.permission.BLUETOOTH_PRIVILEGED})
+ public void setVolume(int volume) {
+ if (VDBG) log("setVolume(vol: " + volume + " )");
+ try {
+ final IBluetoothLeAudio service = getService();
+ if (service != null && mAdapter.isEnabled()) {
+ service.setVolume(volume, mAttributionSource);
+ return;
+ }
+ if (service == null) Log.w(TAG, "Proxy not attached to service");
+ return;
+ } catch (RemoteException e) {
+ Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable()));
+ return;
+ }
+ }
+
+ /**
* Set connection policy of the profile
*
* <p> The device should already be paired.
diff --git a/core/java/android/bluetooth/BluetoothUuid.java b/core/java/android/bluetooth/BluetoothUuid.java
index 67b7252..325a771 100644
--- a/core/java/android/bluetooth/BluetoothUuid.java
+++ b/core/java/android/bluetooth/BluetoothUuid.java
@@ -155,12 +155,11 @@
@SystemApi
public static final ParcelUuid HEARING_AID =
ParcelUuid.fromString("0000FDF0-0000-1000-8000-00805f9b34fb");
- /** Placeholder until specification is released
- * @hide */
+ /** @hide */
@NonNull
@SystemApi
public static final ParcelUuid LE_AUDIO =
- ParcelUuid.fromString("EEEEEEEE-EEEE-EEEE-EEEE-EEEEEEEEEEEE");
+ ParcelUuid.fromString("0000184E-0000-1000-8000-00805F9B34FB");
/** @hide */
@NonNull
@SystemApi
diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java
index 7ce9b51..2431941 100644
--- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java
+++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java
@@ -69,6 +69,7 @@
// Some Hearing Aids (especially the 2nd device) needs more time to do service discovery
private static final long MAX_HEARING_AIDS_DELAY_FOR_AUTO_CONNECT = 15000;
private static final long MAX_HOGP_DELAY_FOR_AUTO_CONNECT = 30000;
+ private static final long MAX_LEAUDIO_DELAY_FOR_AUTO_CONNECT = 30000;
private static final long MAX_MEDIA_PROFILE_CONNECT_DELAY = 60000;
private final Context mContext;
@@ -757,6 +758,8 @@
timeout = MAX_HOGP_DELAY_FOR_AUTO_CONNECT;
} else if (ArrayUtils.contains(uuids, BluetoothUuid.HEARING_AID)) {
timeout = MAX_HEARING_AIDS_DELAY_FOR_AUTO_CONNECT;
+ } else if (ArrayUtils.contains(uuids, BluetoothUuid.LE_AUDIO)) {
+ timeout = MAX_LEAUDIO_DELAY_FOR_AUTO_CONNECT;
}
if (BluetoothUtils.D) {
diff --git a/proto/src/criticalevents/OWNERS b/proto/src/criticalevents/OWNERS
new file mode 100644
index 0000000..07c0e70
--- /dev/null
+++ b/proto/src/criticalevents/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/criticalevents/OWNERS
diff --git a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
index f3ba56a..08f3b1a 100644
--- a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
+++ b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
@@ -3387,9 +3387,15 @@
final List<RemoteAction> actions = r.pictureInPictureArgs.getActions();
mRootWindowContainer.moveActivityToPinnedRootTask(
r, "enterPictureInPictureMode");
- final Task rootTask = r.getRootTask();
- rootTask.setPictureInPictureAspectRatio(aspectRatio);
- rootTask.setPictureInPictureActions(actions);
+ final Task task = r.getTask();
+ task.setPictureInPictureAspectRatio(aspectRatio);
+ task.setPictureInPictureActions(actions);
+
+ // Continue the pausing process after entering pip.
+ if (task.getPausingActivity() == r) {
+ task.schedulePauseActivity(r, false /* userLeaving */,
+ false /* pauseImmediately */, "auto-pip");
+ }
}
};
diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java
index ced5af1..516be55 100644
--- a/services/core/java/com/android/server/wm/Task.java
+++ b/services/core/java/com/android/server/wm/Task.java
@@ -5771,23 +5771,8 @@
+ "directly: %s", prev);
didAutoPip = mAtmService.enterPictureInPictureMode(prev, prev.pictureInPictureArgs);
- mPausingActivity = null;
} else {
- ProtoLog.v(WM_DEBUG_STATES, "Enqueueing pending pause: %s", prev);
- try {
- EventLogTags.writeWmPauseActivity(prev.mUserId, System.identityHashCode(prev),
- prev.shortComponentName, "userLeaving=" + userLeaving, reason);
-
- mAtmService.getLifecycleManager().scheduleTransaction(prev.app.getThread(),
- prev.appToken, PauseActivityItem.obtain(prev.finishing, userLeaving,
- prev.configChangeFlags, pauseImmediately));
- } catch (Exception e) {
- // Ignore exception, if process died other code will cleanup.
- Slog.w(TAG, "Exception thrown during pause", e);
- mPausingActivity = null;
- mLastPausedActivity = null;
- mTaskSupervisor.mNoHistoryActivities.remove(prev);
- }
+ schedulePauseActivity(prev, userLeaving, pauseImmediately, reason);
}
} else {
mPausingActivity = null;
@@ -5802,7 +5787,7 @@
}
// If already entered PIP mode, no need to keep pausing.
- if (mPausingActivity != null && !didAutoPip) {
+ if (mPausingActivity != null) {
// Have the window manager pause its key dispatching until the new
// activity has started. If we're pausing the activity just because
// the screen is being turned off and the UI is sleeping, don't interrupt
@@ -5835,6 +5820,25 @@
}
}
+ void schedulePauseActivity(ActivityRecord prev, boolean userLeaving,
+ boolean pauseImmediately, String reason) {
+ ProtoLog.v(WM_DEBUG_STATES, "Enqueueing pending pause: %s", prev);
+ try {
+ EventLogTags.writeWmPauseActivity(prev.mUserId, System.identityHashCode(prev),
+ prev.shortComponentName, "userLeaving=" + userLeaving, reason);
+
+ mAtmService.getLifecycleManager().scheduleTransaction(prev.app.getThread(),
+ prev.appToken, PauseActivityItem.obtain(prev.finishing, userLeaving,
+ prev.configChangeFlags, pauseImmediately));
+ } catch (Exception e) {
+ // Ignore exception, if process died other code will cleanup.
+ Slog.w(TAG, "Exception thrown during pause", e);
+ mPausingActivity = null;
+ mLastPausedActivity = null;
+ mTaskSupervisor.mNoHistoryActivities.remove(prev);
+ }
+ }
+
@VisibleForTesting
void completePauseLocked(boolean resumeNext, ActivityRecord resuming) {
// Complete the pausing process of a pausing activity, so it doesn't make sense to