Merge "Add link to onboarding screen" into pi-dev
am: e5d97dd6f9
Change-Id: I6ca7fbf3b1e9a14a12a1b3ecefd07549df11ff4d
This commit is contained in:
@@ -1338,6 +1338,32 @@ public class NotificationManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
public static int toggleScreenOffEffectsSuppressed(int currentEffects, boolean suppress) {
|
||||
return toggleEffects(currentEffects, SCREEN_OFF_SUPPRESSED_EFFECTS, suppress);
|
||||
}
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
public static int toggleScreenOnEffectsSuppressed(int currentEffects, boolean suppress) {
|
||||
return toggleEffects(currentEffects, SCREEN_ON_SUPPRESSED_EFFECTS, suppress);
|
||||
}
|
||||
|
||||
private static int toggleEffects(int currentEffects, int[] effects, boolean suppress) {
|
||||
for (int i = 0; i < effects.length; i++) {
|
||||
final int effect = effects[i];
|
||||
if (suppress) {
|
||||
currentEffects |= effect;
|
||||
} else {
|
||||
currentEffects &= ~effect;
|
||||
}
|
||||
}
|
||||
return currentEffects;
|
||||
}
|
||||
|
||||
public static String suppressedEffectsToString(int effects) {
|
||||
if (effects <= 0) return "";
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
|
||||
@@ -1178,6 +1178,23 @@ public final class Settings {
|
||||
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
|
||||
public static final String ACTION_ZEN_MODE_SETTINGS = "android.settings.ZEN_MODE_SETTINGS";
|
||||
|
||||
/**
|
||||
* Activity Action: Show Zen Mode visual effects configuration settings.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
|
||||
public static final String ZEN_MODE_BLOCKED_EFFECTS_SETTINGS =
|
||||
"android.settings.ZEN_MODE_BLOCKED_EFFECTS_SETTINGS";
|
||||
|
||||
/**
|
||||
* Activity Action: Show Zen Mode onboarding activity.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
|
||||
public static final String ZEN_MODE_ONBOARDING = "android.settings.ZEN_MODE_ONBOARDING";
|
||||
|
||||
/**
|
||||
* Activity Action: Show Zen Mode (aka Do Not Disturb) priority configuration settings.
|
||||
*/
|
||||
|
||||
26
core/res/res/drawable/ic_zen_24dp.xml
Normal file
26
core/res/res/drawable/ic_zen_24dp.xml
Normal file
@@ -0,0 +1,26 @@
|
||||
<!--
|
||||
Copyright (C) 2018 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.
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:viewportHeight="24.0"
|
||||
android:viewportWidth="24.0"
|
||||
android:height="24dp"
|
||||
android:width="24dp" >
|
||||
|
||||
<path
|
||||
android:fillColor="?android:attr/colorControlActivated"
|
||||
android:pathData="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm4 11H8c-.55 0-1-.45-1-1s.45-1 1-1h8c.55 0 1 .45 1 1s-.45 1-1 1z" />
|
||||
|
||||
</vector>
|
||||
@@ -4943,9 +4943,9 @@
|
||||
<!-- Title for the notification channel notifying user of do not disturb system changes (i.e. Do Not Disturb has changed). [CHAR LIMIT=NONE] -->
|
||||
<string name="notification_channel_do_not_disturb">Do Not Disturb</string>
|
||||
<!-- Title of notification indicating do not disturb visual interruption settings have changed when upgrading to P -->
|
||||
<string name="zen_upgrade_notification_visd_title">Do Not Disturb is hiding notifications to help you focus</string>
|
||||
<string name="zen_upgrade_notification_visd_title">New: Do Not Disturb is hiding notifications</string>
|
||||
<!-- Content of notification indicating users can tap on the notification to go to dnd behavior settings -->
|
||||
<string name="zen_upgrade_notification_visd_content">This is new behavior. Tap to change.</string>
|
||||
<string name="zen_upgrade_notification_visd_content">Tap to learn more and change.</string>
|
||||
<!-- Title of notification indicating do not disturb settings have changed when upgrading to P -->
|
||||
<string name="zen_upgrade_notification_title">Do Not Disturb has changed</string>
|
||||
<!-- Content of notification indicating users can tap on the notification to go to dnd behavior settings -->
|
||||
|
||||
@@ -2549,6 +2549,7 @@
|
||||
<java-symbol type="drawable" name="ic_settings_24dp" />
|
||||
<java-symbol type="drawable" name="ic_storage_48dp" />
|
||||
<java-symbol type="drawable" name="ic_usb_48dp" />
|
||||
<java-symbol type="drawable" name="ic_zen_24dp" />
|
||||
|
||||
<!-- Floating toolbar -->
|
||||
<java-symbol type="id" name="floating_toolbar_menu_item_image" />
|
||||
|
||||
@@ -32,6 +32,7 @@ import android.content.pm.ServiceInfo;
|
||||
import android.content.res.Resources;
|
||||
import android.content.res.XmlResourceParser;
|
||||
import android.database.ContentObserver;
|
||||
import android.graphics.drawable.Icon;
|
||||
import android.media.AudioAttributes;
|
||||
import android.media.AudioManager;
|
||||
import android.media.AudioManagerInternal;
|
||||
@@ -1198,8 +1199,6 @@ public class ZenModeHelper {
|
||||
|
||||
@VisibleForTesting
|
||||
protected Notification createZenUpgradeNotification() {
|
||||
Intent intent = new Intent(Settings.ACTION_ZEN_MODE_SETTINGS)
|
||||
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
final Bundle extras = new Bundle();
|
||||
extras.putString(Notification.EXTRA_SUBSTITUTE_APP_NAME,
|
||||
mContext.getResources().getString(R.string.global_action_settings));
|
||||
@@ -1210,15 +1209,20 @@ public class ZenModeHelper {
|
||||
title = R.string.zen_upgrade_notification_visd_title;
|
||||
content = R.string.zen_upgrade_notification_visd_content;
|
||||
}
|
||||
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))
|
||||
.setContentTitle(mContext.getResources().getString(title))
|
||||
.setContentText(mContext.getResources().getString(content))
|
||||
.setContentIntent(PendingIntent.getActivity(mContext, 0, onboardingIntent,
|
||||
PendingIntent.FLAG_UPDATE_CURRENT))
|
||||
.setAutoCancel(true)
|
||||
.setLocalOnly(true)
|
||||
.addExtras(extras)
|
||||
.setStyle(new Notification.BigTextStyle())
|
||||
.setContentIntent(PendingIntent.getActivity(mContext, 0, intent, 0, null))
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user