Update zen onboarding flow

- Reset notification/onboarding
- Update notification icon

Test: runtest systemui-notification
Bug: 78448988
Change-Id: I1114000ad534f74ae67fc19fd8bbb712f757dfd9
This commit is contained in:
Julia Reynolds
2018-04-23 09:38:47 -04:00
parent 1f58057118
commit 76bfa60039
4 changed files with 53 additions and 14 deletions

View File

@@ -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>

View File

@@ -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" />

View File

@@ -2935,7 +2935,7 @@ public class SettingsProvider extends ContentProvider {
}
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 @@ public class SettingsProvider extends ContentProvider {
}
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 @@ public class SettingsProvider extends ContentProvider {
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) {

View File

@@ -1171,7 +1171,7 @@ public class ZenModeHelper {
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 @@ public class ZenModeHelper {
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,