Merge "Hide volume slider in Output Switcher when volume adjustment is restricted" into rvc-dev
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index d31fb30..212290d 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -1200,7 +1200,8 @@
<activity
android:name=".notification.history.NotificationHistoryActivity"
- android:label="@string/notification_history_title">
+ android:label="@string/notification_history_title"
+ android:taskAffinity="com.android.settings.notification">
<intent-filter android:priority="1">
<action android:name="android.settings.NOTIFICATION_HISTORY" />
<category android:name="android.intent.category.DEFAULT" />
@@ -2530,6 +2531,7 @@
<activity
android:name="Settings$ConfigureNotificationSettingsActivity"
android:label="@string/configure_notification_settings"
+ android:taskAffinity="com.android.settings.notification"
android:exported="true">
<intent-filter android:priority="1">
<action android:name="android.settings.NOTIFICATION_SETTINGS" />
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 341ac90..e7bc9c4 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -8137,8 +8137,12 @@
<string name="bubbles_feature_education">Some notifications and other content can appear as bubbles on the screen. To open a bubble, tap it. To dismiss it, drag it down the screen.</string>
<!-- Title for the toggle shown on the app-level bubbles page [CHAR LIMIT=60] -->
<string name="bubbles_app_toggle_title">Bubbles</string>
+ <!-- Title on the conversation level screen; links back to the app level setting -->
+ <string name="bubbles_conversation_app_link">All Bubble settings</string>
+ <!-- Title for bubbles option on the conversation level screen -->
+ <string name="bubbles_conversation_toggle_title">Bubble this conversation</string>
<!-- Summary for bubbles option on the conversation level screen -->
- <string name="bubbles_conversation_toggle_summary">New messages will appear on screen</string>
+ <string name="bubbles_conversation_toggle_summary">Show floating icon on top of apps</string>
<!-- Description for the toggle shown on the app-level bubbles page [CHAR LIMIT=NONE] -->
<string name="bubbles_app_toggle_summary">Allow <xliff:g id="app_name" example="YouTube">%1$s</xliff:g> to show some notifications as bubbles</string>
<!-- Title of the dialog shown when the user has disabled bubbles at the feature level but tries to enable it for an app. [CHAR LIMIT=NONE] -->
diff --git a/res/xml/conversation_notification_settings.xml b/res/xml/conversation_notification_settings.xml
index be1c980..c034eb5 100644
--- a/res/xml/conversation_notification_settings.xml
+++ b/res/xml/conversation_notification_settings.xml
@@ -32,13 +32,23 @@
settings:allowDividerAbove="true"
settings:allowDividerBelow="true"/>
- <!-- bubbles -->
- <com.android.settingslib.RestrictedSwitchPreference
- android:key="bubble_pref"
- android:title="@string/notification_bubbles_title"
- android:summary="@string/bubbles_conversation_toggle_summary"
- android:icon="@drawable/ic_create_bubble"
- settings:restrictedSwitchSummary="@string/enabled_by_admin" />
+ <PreferenceCategory
+ android:key="bubbles"
+ android:title="@string/notification_bubbles_title">
+
+ <!-- bubbles -->
+ <com.android.settingslib.RestrictedSwitchPreference
+ android:key="bubble_pref"
+ android:title="@string/bubbles_conversation_toggle_title"
+ android:summary="@string/bubbles_conversation_toggle_summary"
+ android:icon="@drawable/ic_create_bubble"
+ settings:restrictedSwitchSummary="@string/enabled_by_admin" />
+
+ <Preference
+ android:key="notification_bubbles"
+ android:title="@string/bubbles_conversation_app_link"
+ />
+ </PreferenceCategory>
<!-- demote -->
<Preference
diff --git a/src/com/android/settings/accessibility/AccessibilitySettings.java b/src/com/android/settings/accessibility/AccessibilitySettings.java
index 3b3c2c5..17750df 100644
--- a/src/com/android/settings/accessibility/AccessibilitySettings.java
+++ b/src/com/android/settings/accessibility/AccessibilitySettings.java
@@ -105,7 +105,6 @@
static final String EXTRA_TITLE_RES = "title_res";
static final String EXTRA_RESOLVE_INFO = "resolve_info";
static final String EXTRA_SUMMARY = "summary";
- static final String EXTRA_SUMMARY_RES = "summary_res";
static final String EXTRA_SETTINGS_TITLE = "settings_title";
static final String EXTRA_COMPONENT_NAME = "component_name";
static final String EXTRA_SETTINGS_COMPONENT_NAME = "settings_component_name";
diff --git a/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragment.java b/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragment.java
index 0c83ef3..20ef7bc 100644
--- a/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragment.java
+++ b/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragment.java
@@ -363,10 +363,7 @@
}
// Summary.
- if (arguments.containsKey(AccessibilitySettings.EXTRA_SUMMARY_RES)) {
- final int summary = arguments.getInt(AccessibilitySettings.EXTRA_SUMMARY_RES);
- createFooterPreference(getText(summary));
- } else if (arguments.containsKey(AccessibilitySettings.EXTRA_SUMMARY)) {
+ if (arguments.containsKey(AccessibilitySettings.EXTRA_SUMMARY)) {
final CharSequence summary = arguments.getCharSequence(
AccessibilitySettings.EXTRA_SUMMARY);
createFooterPreference(summary);
diff --git a/src/com/android/settings/network/telephony/NrDisabledInDsdsFooterPreferenceController.java b/src/com/android/settings/network/telephony/NrDisabledInDsdsFooterPreferenceController.java
index e024788..ca944da 100644
--- a/src/com/android/settings/network/telephony/NrDisabledInDsdsFooterPreferenceController.java
+++ b/src/com/android/settings/network/telephony/NrDisabledInDsdsFooterPreferenceController.java
@@ -52,13 +52,18 @@
final TelephonyManager teleManager = ((TelephonyManager)
mContext.getSystemService(Context.TELEPHONY_SERVICE))
.createForSubscriptionId(mSubId);
+ final SubscriptionManager subManager = ((SubscriptionManager)
+ mContext.getSystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE));
+ final int[] activeSubIdList = subManager.getActiveSubscriptionIdList();
+ final int activeSubCount = activeSubIdList == null ? 0 : activeSubIdList.length;
// Show the footer only when DSDS is enabled, and mobile data is enabled on this SIM, and
// 5G is supported on this device.
- if (!teleManager.isDataEnabled() || teleManager.getActiveModemCount() < 2
- || !is5GSupportedByRadio(teleManager)) {
+ if (teleManager.isDataEnabled() && activeSubCount >= 2 && is5GSupportedByRadio(teleManager)
+ && !teleManager.canConnectTo5GInDsdsMode()) {
+ return AVAILABLE;
+ } else {
return CONDITIONALLY_UNAVAILABLE;
}
- return AVAILABLE;
}
private boolean is5GSupportedByRadio(TelephonyManager tm) {
diff --git a/src/com/android/settings/notification/app/BubbleCategoryPreferenceController.java b/src/com/android/settings/notification/app/BubbleCategoryPreferenceController.java
new file mode 100644
index 0000000..f8983ff
--- /dev/null
+++ b/src/com/android/settings/notification/app/BubbleCategoryPreferenceController.java
@@ -0,0 +1,68 @@
+/*
+ * 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.settings.notification.app;
+
+import static android.provider.Settings.Global.NOTIFICATION_BUBBLES;
+
+import android.content.Context;
+import android.content.Intent;
+import android.provider.Settings;
+
+import androidx.annotation.VisibleForTesting;
+import androidx.preference.Preference;
+
+public class BubbleCategoryPreferenceController extends NotificationPreferenceController {
+
+ private static final String KEY = "bubbles";
+ @VisibleForTesting
+ static final int ON = 1;
+
+ public BubbleCategoryPreferenceController(Context context) {
+ super(context, null);
+ }
+
+ @Override
+ public boolean isAvailable() {
+ if (!super.isAvailable()) {
+ return false;
+ }
+ return areBubblesEnabled();
+ }
+
+ @Override
+ public String getPreferenceKey() {
+ return KEY;
+ }
+
+ @Override
+ public void updateState(Preference preference) {
+ super.updateState(preference);
+
+ if (mAppRow != null) {
+ final Intent intent = new Intent(Settings.ACTION_APP_NOTIFICATION_BUBBLE_SETTINGS);
+ intent.putExtra(Settings.EXTRA_APP_PACKAGE, mAppRow.pkg);
+ intent.putExtra(Settings.EXTRA_APP_UID, mAppRow.uid);
+ preference.setIntent(intent);
+ }
+ }
+
+
+ private boolean areBubblesEnabled() {
+ return Settings.Global.getInt(mContext.getContentResolver(),
+ NOTIFICATION_BUBBLES, ON) == ON;
+ }
+}
diff --git a/src/com/android/settings/notification/app/BubbleLinkPreferenceController.java b/src/com/android/settings/notification/app/BubbleLinkPreferenceController.java
new file mode 100644
index 0000000..ff27043
--- /dev/null
+++ b/src/com/android/settings/notification/app/BubbleLinkPreferenceController.java
@@ -0,0 +1,68 @@
+/*
+ * 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.settings.notification.app;
+
+import static android.provider.Settings.Global.NOTIFICATION_BUBBLES;
+
+import android.content.Context;
+import android.content.Intent;
+import android.provider.Settings;
+
+import androidx.annotation.VisibleForTesting;
+import androidx.preference.Preference;
+
+public class BubbleLinkPreferenceController extends NotificationPreferenceController {
+
+ private static final String KEY = "notification_bubbles";
+ @VisibleForTesting
+ static final int ON = 1;
+
+ public BubbleLinkPreferenceController(Context context) {
+ super(context, null);
+ }
+
+ @Override
+ public boolean isAvailable() {
+ if (!super.isAvailable()) {
+ return false;
+ }
+ return areBubblesEnabled();
+ }
+
+ @Override
+ public String getPreferenceKey() {
+ return KEY;
+ }
+
+ @Override
+ public void updateState(Preference preference) {
+ super.updateState(preference);
+
+ if (mAppRow != null) {
+ final Intent intent = new Intent(Settings.ACTION_APP_NOTIFICATION_BUBBLE_SETTINGS);
+ intent.putExtra(Settings.EXTRA_APP_PACKAGE, mAppRow.pkg);
+ intent.putExtra(Settings.EXTRA_APP_UID, mAppRow.uid);
+ preference.setIntent(intent);
+ }
+ }
+
+
+ private boolean areBubblesEnabled() {
+ return Settings.Global.getInt(mContext.getContentResolver(),
+ NOTIFICATION_BUBBLES, ON) == ON;
+ }
+}
diff --git a/src/com/android/settings/notification/app/ConversationNotificationSettings.java b/src/com/android/settings/notification/app/ConversationNotificationSettings.java
index 210af20..9ee4a2c 100644
--- a/src/com/android/settings/notification/app/ConversationNotificationSettings.java
+++ b/src/com/android/settings/notification/app/ConversationNotificationSettings.java
@@ -94,6 +94,8 @@
mControllers.add(new BubblePreferenceController(context, getChildFragmentManager(),
mBackend, false /* isAppPage */));
mControllers.add(new ConversationDemotePreferenceController(context, this, mBackend));
+ mControllers.add(new BubbleCategoryPreferenceController(context));
+ mControllers.add(new BubbleLinkPreferenceController(context));
return new ArrayList<>(mControllers);
}
}
diff --git a/src/com/android/settings/notification/history/NotificationHistoryActivity.java b/src/com/android/settings/notification/history/NotificationHistoryActivity.java
index 144d102..a5993e4 100644
--- a/src/com/android/settings/notification/history/NotificationHistoryActivity.java
+++ b/src/com/android/settings/notification/history/NotificationHistoryActivity.java
@@ -23,6 +23,7 @@
import android.app.INotificationManager;
import android.content.ComponentName;
import android.content.Context;
+import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.os.RemoteException;
@@ -191,6 +192,20 @@
super.onDestroy();
}
+ @Override
+ public void onBackPressed() {
+ handleBackPressed();
+ }
+
+ private void handleBackPressed() {
+ if (getFragmentManager().getBackStackEntryCount() > 1) {
+ super.onBackPressed();
+ } else {
+ startActivity(new Intent(Settings.ACTION_NOTIFICATION_SETTINGS));
+ finish();
+ }
+ }
+
private void bindSwitch() {
if (mSwitchBar != null) {
mSwitchBar.setSwitchBarText(R.string.notification_history_toggle,