Merge "Implement an API to block non-enterprise networks"
diff --git a/boot/Android.bp b/boot/Android.bp
index 24ad9de..851294c 100644
--- a/boot/Android.bp
+++ b/boot/Android.bp
@@ -23,6 +23,18 @@
     default_applicable_licenses: ["frameworks_base_license"],
 }
 
+soong_config_module_type {
+    name: "custom_platform_bootclasspath",
+    module_type: "platform_bootclasspath",
+    config_namespace: "AUTO",
+    bool_variables: [
+        "car_bootclasspath_fragment",
+    ],
+    properties: [
+        "fragments",
+    ],
+}
+
 // This module provides access to information Soong has related to the
 // whole platform bootclasspath. Currently, that information is provided solely
 // through configuration but additional information will be added here.
@@ -41,7 +53,7 @@
 //
 // This module needs to be present in the build for the above processing to be
 // done correctly.
-platform_bootclasspath {
+custom_platform_bootclasspath {
     name: "platform-bootclasspath",
 
     // The bootclasspath_fragments that contribute to the platform
@@ -115,17 +127,24 @@
             apex: "com.android.wifi",
             module: "com.android.wifi-bootclasspath-fragment",
         },
-        // only used for auto
-        {
-            apex: "com.android.car.framework",
-            module: "com.android.car.framework-bootclasspath-fragment",
-        },
         {
             apex: "com.android.virt",
             module: "com.android.virt-bootclasspath-fragment",
         },
     ],
 
+    soong_config_variables: {
+        car_bootclasspath_fragment: {
+            fragments: [
+                // only used for auto
+                {
+                    apex: "com.android.car.framework",
+                    module: "com.android.car.framework-bootclasspath-fragment",
+                },
+            ],
+        },
+    },
+
     // Additional information needed by hidden api processing.
     hidden_api: {
         unsupported: [
diff --git a/core/api/current.txt b/core/api/current.txt
index 6ca5c4f..af94963 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -6024,7 +6024,7 @@
   }
 
   public static class Notification.Action implements android.os.Parcelable {
-    ctor @Deprecated public Notification.Action(int, CharSequence, android.app.PendingIntent);
+    ctor @Deprecated public Notification.Action(int, CharSequence, @Nullable android.app.PendingIntent);
     method public android.app.Notification.Action clone();
     method public int describeContents();
     method public boolean getAllowGeneratedReplies();
@@ -6054,8 +6054,8 @@
   }
 
   public static final class Notification.Action.Builder {
-    ctor @Deprecated public Notification.Action.Builder(int, CharSequence, android.app.PendingIntent);
-    ctor public Notification.Action.Builder(android.graphics.drawable.Icon, CharSequence, android.app.PendingIntent);
+    ctor @Deprecated public Notification.Action.Builder(int, CharSequence, @Nullable android.app.PendingIntent);
+    ctor public Notification.Action.Builder(android.graphics.drawable.Icon, CharSequence, @Nullable android.app.PendingIntent);
     ctor public Notification.Action.Builder(android.app.Notification.Action);
     method @NonNull public android.app.Notification.Action.Builder addExtras(android.os.Bundle);
     method @NonNull public android.app.Notification.Action.Builder addRemoteInput(android.app.RemoteInput);
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index f320b74..b316b19 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -1783,7 +1783,7 @@
          * @deprecated Use {@link android.app.Notification.Action.Builder}.
          */
         @Deprecated
-        public Action(int icon, CharSequence title, PendingIntent intent) {
+        public Action(int icon, CharSequence title, @Nullable PendingIntent intent) {
             this(Icon.createWithResource("", icon), title, intent, new Bundle(), null, true,
                     SEMANTIC_ACTION_NONE, false /* isContextual */, false /* requireAuth */);
         }
@@ -1908,10 +1908,12 @@
              * which may display them in other contexts, for example on a wearable device.
              * @param icon icon to show for this action
              * @param title the title of the action
-             * @param intent the {@link PendingIntent} to fire when users trigger this action
+             * @param intent the {@link PendingIntent} to fire when users trigger this action. May
+             * be null, in which case the action may be rendered in a disabled presentation by the
+             * system UI.
              */
             @Deprecated
-            public Builder(int icon, CharSequence title, PendingIntent intent) {
+            public Builder(int icon, CharSequence title, @Nullable PendingIntent intent) {
                 this(Icon.createWithResource("", icon), title, intent);
             }
 
@@ -1940,9 +1942,11 @@
              *
              * @param icon icon to show for this action
              * @param title the title of the action
-             * @param intent the {@link PendingIntent} to fire when users trigger this action
+             * @param intent the {@link PendingIntent} to fire when users trigger this action. May
+             * be null, in which case the action may be rendered in a disabled presentation by the
+             * system UI.
              */
-            public Builder(Icon icon, CharSequence title, PendingIntent intent) {
+            public Builder(Icon icon, CharSequence title, @Nullable PendingIntent intent) {
                 this(icon, title, intent, new Bundle(), null, true, SEMANTIC_ACTION_NONE, false);
             }
 
diff --git a/core/java/android/app/admin/Provisioning_OWNERS b/core/java/android/app/admin/Provisioning_OWNERS
index c59a9dc..2e5c2df 100644
--- a/core/java/android/app/admin/Provisioning_OWNERS
+++ b/core/java/android/app/admin/Provisioning_OWNERS
@@ -1,5 +1,5 @@
 # Assign bugs to android-enterprise-triage@google.com
-petuska@google.com
-nupursn@google.com
-shreyacsingh@google.com
-alexkershaw@google.com #{LAST_RESORT_SUGGESTION}
\ No newline at end of file
+mdb.ae-provisioning-reviews@google.com
+petuska@google.com #{LAST_RESORT_SUGGESTION}
+nupursn@google.com #{LAST_RESORT_SUGGESTION}
+shreyacsingh@google.com #{LAST_RESORT_SUGGESTION}
diff --git a/core/java/com/android/server/backup/OWNERS b/core/java/com/android/server/backup/OWNERS
new file mode 100644
index 0000000..d99779e
--- /dev/null
+++ b/core/java/com/android/server/backup/OWNERS
@@ -0,0 +1 @@
+include /services/backup/OWNERS
diff --git a/core/res/OWNERS b/core/res/OWNERS
index b878189..bce500c 100644
--- a/core/res/OWNERS
+++ b/core/res/OWNERS
@@ -23,8 +23,8 @@
 
 # WindowManager team
 # TODO(262451702): Move WindowManager configs out of config.xml in a separate file
-per-file core/res/res/values/config.xml = file:/services/core/java/com/android/server/wm/OWNERS
-per-file core/res/res/values/symbols.xml = file:/services/core/java/com/android/server/wm/OWNERS
+per-file res/values/config.xml = file:/services/core/java/com/android/server/wm/OWNERS
+per-file res/values/symbols.xml = file:/services/core/java/com/android/server/wm/OWNERS
 
 # Resources finalization
 per-file res/xml/public-staging.xml = file:/tools/aapt2/OWNERS
diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/BluetoothBroadcastUtils.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/BluetoothBroadcastUtils.java
index 1f72609..a80061e 100644
--- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/BluetoothBroadcastUtils.java
+++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/BluetoothBroadcastUtils.java
@@ -53,8 +53,8 @@
     static final String PREFIX_BT_SYNC_INTERVAL = "SI:";
     static final String PREFIX_BT_IS_ENCRYPTED = "E:";
     static final String PREFIX_BT_BROADCAST_CODE = "C:";
-    static final String PREFIX_BT_PRESENTATION_DELAY = "D:";
-    static final String PREFIX_BT_SUBGROUPS = "G:";
+    static final String PREFIX_BT_PRESENTATION_DELAY = "PD:";
+    static final String PREFIX_BT_SUBGROUPS = "SG:";
     static final String PREFIX_BT_ANDROID_VERSION = "V:";
 
     // BluetoothLeBroadcastSubgroup
diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothLeBroadcastMetadata.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothLeBroadcastMetadata.java
index aff9a6e..c61ebc0 100644
--- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothLeBroadcastMetadata.java
+++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothLeBroadcastMetadata.java
@@ -28,7 +28,9 @@
 import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -38,6 +40,43 @@
     private static final String METADATA_START = "<";
     private static final String METADATA_END = ">";
     private static final String PATTERN_REGEX = "<(.*?)>";
+    private static final String PATTERN_BT_BROADCAST_METADATA =
+            "T:<(.*?)>;+D:<(.*?)>;+AS:<(.*?)>;+B:<(.*?)>;+SI:<(.*?)>;+E:<(.*?)>;+C:<(.*?)>;"
+                + "+PD:<(.*?)>;+SG:(.*)";
+    private static final String PATTERN_BT_SUBGROUP =
+            "CID:<(.*?)>;+CC:<(.*?);>;+AC:<(.*?);>;+CP:<(.*?)>;+BC:<(.*)>;>;";
+    private static final String PATTERN_BT_CHANNEL = "CI:<(.*?)>;+BCCM:<(.*?);>;";
+
+    /* Index for BluetoothLeBroadcastMetadata */
+    private static int MATCH_INDEX_ADDRESS_TYPE = 1;
+    private static int MATCH_INDEX_DEVICE = 2;
+    private static int MATCH_INDEX_ADVERTISING_SID = 3;
+    private static int MATCH_INDEX_BROADCAST_ID = 4;
+    private static int MATCH_INDEX_SYNC_INTERVAL = 5;
+    private static int MATCH_INDEX_IS_ENCRYPTED = 6;
+    private static int MATCH_INDEX_BROADCAST_CODE = 7;
+    private static int MATCH_INDEX_PRESENTATION_DELAY = 8;
+    private static int MATCH_INDEX_SUBGROUPS = 9;
+
+    /* Index for BluetoothLeBroadcastSubgroup */
+    private static int MATCH_INDEX_CODEC_ID = 1;
+    private static int MATCH_INDEX_CODEC_CONFIG = 2;
+    private static int MATCH_INDEX_AUDIO_CONTENT = 3;
+    private static int MATCH_INDEX_CHANNEL_PREF = 4;
+    private static int MATCH_INDEX_BROADCAST_CHANNEL = 5;
+
+    /* Index for BluetoothLeAudioCodecConfigMetadata */
+    private static int LIST_INDEX_AUDIO_LOCATION = 0;
+    private static int LIST_INDEX_CODEC_CONFIG_RAW_METADATA = 1;
+
+    /* Index for BluetoothLeAudioContentMetadata */
+    private static int LIST_INDEX_PROGRAM_INFO = 0;
+    private static int LIST_INDEX_LANGUAGE = 1;
+    private static int LIST_INDEX_AUDIO_CONTENT_RAW_METADATA = 2;
+
+    /* Index for BluetoothLeBroadcastChannel */
+    private static int MATCH_INDEX_CHANNEL_INDEX = 1;
+    private static int MATCH_INDEX_CHANNEL_CODEC_CONFIG = 2;
 
     private BluetoothLeBroadcastSubgroup mSubgroup;
     private List<BluetoothLeBroadcastSubgroup> mSubgroupList;
@@ -55,17 +94,20 @@
     private byte[] mBroadcastCode;
 
     // BluetoothLeBroadcastSubgroup
-    private long mCodecId;
+    private int mCodecId;
     private BluetoothLeAudioContentMetadata mContentMetadata;
     private BluetoothLeAudioCodecConfigMetadata mConfigMetadata;
-    private BluetoothLeBroadcastChannel mChannel;
+    private Boolean mNoChannelPreference;
+    private List<BluetoothLeBroadcastChannel> mChannel;
 
     // BluetoothLeAudioCodecConfigMetadata
     private long mAudioLocation;
+    private byte[] mCodecConfigMetadata;
 
     // BluetoothLeAudioContentMetadata
     private String mLanguage;
     private String mProgramInfo;
+    private byte[] mAudioContentMetadata;
 
     // BluetoothLeBroadcastChannel
     private boolean mIsSelected;
@@ -135,6 +177,7 @@
         for (BluetoothLeBroadcastSubgroup subgroup: subgroupList) {
             String audioCodec = convertAudioCodecConfigToString(subgroup.getCodecSpecificConfig());
             String audioContent = convertAudioContentToString(subgroup.getContentMetadata());
+            boolean hasChannelPreference = subgroup.hasChannelPreference();
             String channels = convertChannelToString(subgroup.getChannels());
             subgroupString = new StringBuilder()
                     .append(BluetoothBroadcastUtils.PREFIX_BTSG_CODEC_ID)
@@ -146,6 +189,9 @@
                     .append(BluetoothBroadcastUtils.PREFIX_BTSG_AUDIO_CONTENT)
                     .append(METADATA_START).append(audioContent).append(METADATA_END)
                     .append(BluetoothBroadcastUtils.DELIMITER_QR_CODE)
+                    .append(BluetoothBroadcastUtils.PREFIX_BTSG_CHANNEL_PREF)
+                    .append(METADATA_START).append(hasChannelPreference).append(METADATA_END)
+                    .append(BluetoothBroadcastUtils.DELIMITER_QR_CODE)
                     .append(BluetoothBroadcastUtils.PREFIX_BTSG_BROADCAST_CHANNEL)
                     .append(METADATA_START).append(channels).append(METADATA_END)
                     .append(BluetoothBroadcastUtils.DELIMITER_QR_CODE)
@@ -211,26 +257,35 @@
         if (DEBUG) {
             Log.d(TAG, "Convert " + qrCodeString + "to BluetoothLeBroadcastMetadata");
         }
-        Pattern pattern = Pattern.compile(PATTERN_REGEX);
+
+        Pattern pattern = Pattern.compile(PATTERN_BT_BROADCAST_METADATA);
         Matcher match = pattern.matcher(qrCodeString);
         if (match.find()) {
-            ArrayList<String> resultList = new ArrayList<>();
-            resultList.add(match.group(1));
-            mSourceAddressType = Integer.parseInt(resultList.get(0));
+            mSourceAddressType = Integer.parseInt(match.group(MATCH_INDEX_ADDRESS_TYPE));
             mSourceDevice = BluetoothAdapter.getDefaultAdapter().getRemoteDevice(
-                    resultList.get(1));
-            mSourceAdvertisingSid = Integer.parseInt(resultList.get(2));
-            mBroadcastId = Integer.parseInt(resultList.get(3));
-            mPaSyncInterval = Integer.parseInt(resultList.get(4));
-            mIsEncrypted = Boolean.valueOf(resultList.get(5));
-            mBroadcastCode = resultList.get(6).getBytes();
-            mPresentationDelayMicros = Integer.parseInt(resultList.get(7));
-            mSubgroup = convertToSubgroup(resultList.get(8));
+                    match.group(MATCH_INDEX_DEVICE));
+            mSourceAdvertisingSid = Integer.parseInt(match.group(MATCH_INDEX_ADVERTISING_SID));
+            mBroadcastId = Integer.parseInt(match.group(MATCH_INDEX_BROADCAST_ID));
+            mPaSyncInterval = Integer.parseInt(match.group(MATCH_INDEX_SYNC_INTERVAL));
+            mIsEncrypted = Boolean.valueOf(match.group(MATCH_INDEX_IS_ENCRYPTED));
+            mBroadcastCode = match.group(MATCH_INDEX_BROADCAST_CODE).getBytes();
+            mPresentationDelayMicros =
+                  Integer.parseInt(match.group(MATCH_INDEX_PRESENTATION_DELAY));
 
             if (DEBUG) {
-                Log.d(TAG, "Converted qrCodeString result: " + match.group());
+                Log.d(TAG, "Converted qrCodeString result: "
+                        + " ,Type = " + mSourceAddressType
+                        + " ,Device = " + mSourceDevice
+                        + " ,AdSid = " + mSourceAdvertisingSid
+                        + " ,BroadcastId = " + mBroadcastId
+                        + " ,paSync = " + mPaSyncInterval
+                        + " ,encrypted = " + mIsEncrypted
+                        + " ,BroadcastCode = " + Arrays.toString(mBroadcastCode)
+                        + " ,delay = " + mPresentationDelayMicros);
             }
 
+            mSubgroup = convertToSubgroup(match.group(MATCH_INDEX_SUBGROUPS));
+
             return new BluetoothLeBroadcastMetadata.Builder()
                     .setSourceDevice(mSourceDevice, mSourceAddressType)
                     .setSourceAdvertisingSid(mSourceAdvertisingSid)
@@ -254,26 +309,26 @@
         if (DEBUG) {
             Log.d(TAG, "Convert " + subgroupString + "to BluetoothLeBroadcastSubgroup");
         }
-        Pattern pattern = Pattern.compile(PATTERN_REGEX);
+        Pattern pattern = Pattern.compile(PATTERN_BT_SUBGROUP);
         Matcher match = pattern.matcher(subgroupString);
         if (match.find()) {
-            ArrayList<String> resultList = new ArrayList<>();
-            resultList.add(match.group(1));
-            mCodecId = Long.getLong(resultList.get(0));
-            mConfigMetadata = convertToConfigMetadata(resultList.get(1));
-            mContentMetadata = convertToContentMetadata(resultList.get(2));
-            mChannel = convertToChannel(resultList.get(3), mConfigMetadata);
+            mCodecId = Integer.parseInt(match.group(MATCH_INDEX_CODEC_ID));
+            mConfigMetadata = convertToConfigMetadata(match.group(MATCH_INDEX_CODEC_CONFIG));
+            mContentMetadata = convertToContentMetadata(match.group(MATCH_INDEX_AUDIO_CONTENT));
+            mNoChannelPreference = Boolean.valueOf(match.group(MATCH_INDEX_CHANNEL_PREF));
+            mChannel =
+                  convertToChannel(match.group(MATCH_INDEX_BROADCAST_CHANNEL), mConfigMetadata);
 
-            if (DEBUG) {
-                Log.d(TAG, "Converted subgroupString result: " + match.group());
+            BluetoothLeBroadcastSubgroup.Builder subgroupBuilder =
+                    new BluetoothLeBroadcastSubgroup.Builder();
+            subgroupBuilder.setCodecId(mCodecId);
+            subgroupBuilder.setCodecSpecificConfig(mConfigMetadata);
+            subgroupBuilder.setContentMetadata(mContentMetadata);
+
+            for (BluetoothLeBroadcastChannel channel : mChannel) {
+                subgroupBuilder.addChannel(channel);
             }
-
-            return new BluetoothLeBroadcastSubgroup.Builder()
-                    .setCodecId(mCodecId)
-                    .setCodecSpecificConfig(mConfigMetadata)
-                    .setContentMetadata(mContentMetadata)
-                    .addChannel(mChannel)
-                    .build();
+            return subgroupBuilder.build();
         } else {
             if (DEBUG) {
                 Log.d(TAG,
@@ -291,15 +346,17 @@
         }
         Pattern pattern = Pattern.compile(PATTERN_REGEX);
         Matcher match = pattern.matcher(configMetadataString);
-        if (match.find()) {
-            ArrayList<String> resultList = new ArrayList<>();
+        ArrayList<String> resultList = new ArrayList<>();
+        while (match.find()) {
             resultList.add(match.group(1));
-            mAudioLocation = Long.getLong(resultList.get(0));
-
-            if (DEBUG) {
-                Log.d(TAG, "Converted configMetadataString result: " + match.group());
-            }
-
+            Log.d(TAG, "Codec Config match : " + match.group(1));
+        }
+        if (DEBUG) {
+            Log.d(TAG, "Converted configMetadataString result: " + resultList.size());
+        }
+        if (resultList.size() > 0) {
+            mAudioLocation = Long.parseLong(resultList.get(LIST_INDEX_AUDIO_LOCATION));
+            mCodecConfigMetadata = resultList.get(LIST_INDEX_CODEC_CONFIG_RAW_METADATA).getBytes();
             return new BluetoothLeAudioCodecConfigMetadata.Builder()
                     .setAudioLocation(mAudioLocation)
                     .build();
@@ -319,14 +376,25 @@
         }
         Pattern pattern = Pattern.compile(PATTERN_REGEX);
         Matcher match = pattern.matcher(contentMetadataString);
-        if (match.find()) {
-            ArrayList<String> resultList = new ArrayList<>();
+        ArrayList<String> resultList = new ArrayList<>();
+        while (match.find()) {
+            Log.d(TAG, "Audio Content match : " + match.group(1));
             resultList.add(match.group(1));
-            mProgramInfo = resultList.get(0);
-            mLanguage = resultList.get(1);
+        }
+        if (DEBUG) {
+            Log.d(TAG, "Converted contentMetadataString result: " + resultList.size());
+        }
+        if (resultList.size() > 0) {
+            mProgramInfo = resultList.get(LIST_INDEX_PROGRAM_INFO);
+            mLanguage = resultList.get(LIST_INDEX_LANGUAGE);
+            mAudioContentMetadata =
+                  resultList.get(LIST_INDEX_AUDIO_CONTENT_RAW_METADATA).getBytes();
 
-            if (DEBUG) {
-                Log.d(TAG, "Converted contentMetadataString result: " + match.group());
+            /* TODO(b/265253566) : Need to set the default value for language when the user starts
+            *  the broadcast.
+            */
+            if (mLanguage.equals("null")) {
+                mLanguage = "eng";
             }
 
             return new BluetoothLeAudioContentMetadata.Builder()
@@ -342,28 +410,34 @@
         }
     }
 
-    private BluetoothLeBroadcastChannel convertToChannel(String channelString,
+    private List<BluetoothLeBroadcastChannel> convertToChannel(String channelString,
             BluetoothLeAudioCodecConfigMetadata configMetadata) {
         if (DEBUG) {
             Log.d(TAG, "Convert " + channelString + "to BluetoothLeBroadcastChannel");
         }
-        Pattern pattern = Pattern.compile(PATTERN_REGEX);
+        Pattern pattern = Pattern.compile(PATTERN_BT_CHANNEL);
         Matcher match = pattern.matcher(channelString);
-        if (match.find()) {
-            ArrayList<String> resultList = new ArrayList<>();
-            resultList.add(match.group(1));
-            mIsSelected = Boolean.valueOf(resultList.get(0));
-            mChannelIndex = Integer.parseInt(resultList.get(1));
+        Map<Integer, BluetoothLeAudioCodecConfigMetadata> channel =
+                new HashMap<Integer, BluetoothLeAudioCodecConfigMetadata>();
+        while (match.find()) {
+            channel.put(Integer.parseInt(match.group(MATCH_INDEX_CHANNEL_INDEX)),
+                    convertToConfigMetadata(match.group(MATCH_INDEX_CHANNEL_CODEC_CONFIG)));
+        }
 
-            if (DEBUG) {
-                Log.d(TAG, "Converted channelString result: " + match.group());
+        if (channel.size() > 0) {
+            mIsSelected = false;
+            ArrayList<BluetoothLeBroadcastChannel> broadcastChannelList = new ArrayList<>();
+            for (Map.Entry<Integer, BluetoothLeAudioCodecConfigMetadata> entry :
+                    channel.entrySet()) {
+
+                broadcastChannelList.add(
+                        new BluetoothLeBroadcastChannel.Builder()
+                            .setSelected(mIsSelected)
+                            .setChannelIndex(entry.getKey())
+                            .setCodecMetadata(entry.getValue())
+                            .build());
             }
-
-            return new BluetoothLeBroadcastChannel.Builder()
-                    .setSelected(mIsSelected)
-                    .setChannelIndex(mChannelIndex)
-                    .setCodecMetadata(configMetadata)
-                    .build();
+            return broadcastChannelList;
         } else {
             if (DEBUG) {
                 Log.d(TAG,
diff --git a/services/core/java/com/android/server/wm/TaskFragment.java b/services/core/java/com/android/server/wm/TaskFragment.java
index ec67414..1a3e7d1 100644
--- a/services/core/java/com/android/server/wm/TaskFragment.java
+++ b/services/core/java/com/android/server/wm/TaskFragment.java
@@ -1904,7 +1904,8 @@
     }
 
     boolean shouldSleepActivities() {
-        return false;
+        final Task task = getRootTask();
+        return task != null && task.shouldSleepActivities();
     }
 
     @Override