Update zen onboarding flow
am: 76bfa60039
Change-Id: I94b3087d02ca8e0d54711376892206d27d24d749
diff --git a/core/res/res/drawable/ic_dnd_block_notifications.xml b/core/res/res/drawable/ic_dnd_block_notifications.xml
new file mode 100644
index 0000000..4983614
--- /dev/null
+++ b/core/res/res/drawable/ic_dnd_block_notifications.xml
@@ -0,0 +1,30 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="40dp"
+ android:height="40dp"
+ android:viewportWidth="40.0"
+ android:viewportHeight="40.0">
+ <path
+ android:pathData="M34,20H2c-1.1,0 -2,-0.9 -2,-2V6c0,-1.1 0.9,-2 2,-2h32c1.1,0 2,0.9 2,2v12C36,19.1 35.1,20 34,20z"
+ android:fillColor="#FBBC04"/>
+ <path
+ android:pathData="M4.63,10L4.63,10c-0.83,0 -1.5,-0.67 -1.5,-1.5v0C3.12,7.67 3.8,7 4.62,7h0c0.82,0 1.5,0.67 1.5,1.5v0C6.12,9.33 5.45,10 4.63,10z"
+ android:fillColor="#FFFFFF"/>
+ <path
+ android:pathData="M8.62,7.5h9.5v2h-9.5z"
+ android:fillColor="#FFFFFF"/>
+ <path
+ android:pathData="M3.12,15h24v2h-24z"
+ android:fillColor="#FFFFFF"/>
+ <path
+ android:pathData="M3.12,12h17.5v2h-17.5z"
+ android:fillColor="#FFFFFF"/>
+ <path
+ android:pathData="M33.59,6.41m-5.78,0a5.78,5.78 0,1 1,11.56 0a5.78,5.78 0,1 1,-11.56 0"
+ android:fillColor="#FFFFFF"/>
+ <path
+ android:pathData="M33.5,0C29.91,0 27,2.91 27,6.5s2.91,6.5 6.5,6.5S40,10.09 40,6.5S37.09,0 33.5,0zM33.5,11.7c-2.87,0 -5.2,-2.33 -5.2,-5.2s2.33,-5.2 5.2,-5.2s5.2,2.33 5.2,5.2S36.37,11.7 33.5,11.7z"
+ android:fillColor="#4285F4"/>
+ <path
+ android:pathData="M30.25,5.85h6.5v1.3h-6.5z"
+ android:fillColor="#4285F4"/>
+</vector>
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 5298e5b..c3ab1a6 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -2555,6 +2555,7 @@
<java-symbol type="drawable" name="ic_storage_48dp" />
<java-symbol type="drawable" name="ic_usb_48dp" />
<java-symbol type="drawable" name="ic_zen_24dp" />
+ <java-symbol type="drawable" name="ic_dnd_block_notifications" />
<!-- Floating toolbar -->
<java-symbol type="id" name="floating_toolbar_menu_item_image" />
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
index 1d3e521..32aafea 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
@@ -2935,7 +2935,7 @@
}
private final class UpgradeController {
- private static final int SETTINGS_VERSION = 164;
+ private static final int SETTINGS_VERSION = 165;
private final int mUserId;
@@ -3710,17 +3710,7 @@
}
if (currentVersion == 162) {
- // Version 162: Add a gesture for silencing phones
- final SettingsState settings = getGlobalSettingsLocked();
- final Setting currentSetting = settings.getSettingLocked(
- Global.SHOW_ZEN_UPGRADE_NOTIFICATION);
- if (!currentSetting.isNull()
- && TextUtils.equals("0", currentSetting.getValue())) {
- settings.insertSettingLocked(
- Global.SHOW_ZEN_UPGRADE_NOTIFICATION, "1",
- null, true, SettingsState.SYSTEM_PACKAGE_NAME);
- }
-
+ // Version 162: REMOVED: Add a gesture for silencing phones
currentVersion = 163;
}
@@ -3742,6 +3732,21 @@
currentVersion = 164;
}
+ if (currentVersion == 164) {
+ // Version 164: Add a gesture for silencing phones
+ final SettingsState settings = getGlobalSettingsLocked();
+ final Setting currentSetting = settings.getSettingLocked(
+ Global.SHOW_ZEN_UPGRADE_NOTIFICATION);
+ if (!currentSetting.isNull()
+ && TextUtils.equals("0", currentSetting.getValue())) {
+ settings.insertSettingLocked(
+ Global.SHOW_ZEN_UPGRADE_NOTIFICATION, "1",
+ null, true, SettingsState.SYSTEM_PACKAGE_NAME);
+ }
+
+ currentVersion = 165;
+ }
+
// vXXX: Add new settings above this point.
if (currentVersion != newVersion) {
diff --git a/services/core/java/com/android/server/notification/ZenModeHelper.java b/services/core/java/com/android/server/notification/ZenModeHelper.java
index a84be57..658c7f1 100644
--- a/services/core/java/com/android/server/notification/ZenModeHelper.java
+++ b/services/core/java/com/android/server/notification/ZenModeHelper.java
@@ -1171,7 +1171,7 @@
private void showZenUpgradeNotification(int zen) {
final boolean showNotification = mIsBootComplete
- && zen == Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS
+ && zen != Global.ZEN_MODE_OFF
&& Settings.Global.getInt(mContext.getContentResolver(),
Settings.Global.SHOW_ZEN_UPGRADE_NOTIFICATION, 0) != 0;
@@ -1190,17 +1190,20 @@
mContext.getResources().getString(R.string.global_action_settings));
int title = R.string.zen_upgrade_notification_title;
int content = R.string.zen_upgrade_notification_content;
+ int drawable = R.drawable.ic_zen_24dp;
if (NotificationManager.Policy.areAllVisualEffectsSuppressed(
getNotificationPolicy().suppressedVisualEffects)) {
title = R.string.zen_upgrade_notification_visd_title;
content = R.string.zen_upgrade_notification_visd_content;
+ drawable = R.drawable.ic_dnd_block_notifications;
}
+
Intent onboardingIntent = new Intent(Settings.ZEN_MODE_ONBOARDING);
onboardingIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
return new Notification.Builder(mContext, SystemNotificationChannels.DO_NOT_DISTURB)
.setAutoCancel(true)
.setSmallIcon(R.drawable.ic_settings_24dp)
- .setLargeIcon(Icon.createWithResource(mContext, R.drawable.ic_zen_24dp))
+ .setLargeIcon(Icon.createWithResource(mContext, drawable))
.setContentTitle(mContext.getResources().getString(title))
.setContentText(mContext.getResources().getString(content))
.setContentIntent(PendingIntent.getActivity(mContext, 0, onboardingIntent,