Permalink
Browse files

HeadsUp: add timeout option (1/2)

Forward ported to marshmallow/nougat By: @beanstown106
this was basically a rewrite as everything about it changed

Change-Id: If542480dc1efd4d92ba1d536fa23d0342569b8e1
  • Loading branch information...
kufikugel authored and xlxfoxxlx committed Mar 27, 2016
1 parent c71d02b commit 9ada62dfaf90ea7a89b9d94564affc85c39c959a
@@ -4396,6 +4396,12 @@ public boolean validate(String value) {
*/
public static final String QS_FOOTER_WARNINGS = "qs_footer_warnings";
/**
* Heads up timeout configuration
* @hide
*/
public static final String HEADS_UP_TIMEOUT = "heads_up_timeout";
/**
* Settings to backup. This is here so that it's in the same place as the settings
* keys and easy to update.
@@ -20,6 +20,7 @@
import android.content.res.Resources;
import android.database.ContentObserver;
import android.os.Handler;
import android.os.UserHandle;
import android.os.SystemClock;
import android.provider.Settings;
import android.util.ArrayMap;
@@ -58,7 +59,7 @@
private static final String SETTING_HEADS_UP_SNOOZE_LENGTH_MS = "heads_up_snooze_length_ms";
private static final int TAG_CLICKED_NOTIFICATION = R.id.is_clicked_heads_up_tag;
private final int mHeadsUpNotificationDecay;
private int mHeadsUpNotificationDecay;
private final int mMinimumDisplayTime;
private final int mTouchAcceptanceDelay;
@@ -121,7 +122,10 @@ public HeadsUpManager(final Context context, View statusBarWindowView,
mDefaultSnoozeLengthMs = resources.getInteger(R.integer.heads_up_default_snooze_length_ms);
mSnoozeLengthMs = mDefaultSnoozeLengthMs;
mMinimumDisplayTime = resources.getInteger(R.integer.heads_up_notification_minimum_time);
mHeadsUpNotificationDecay = resources.getInteger(R.integer.heads_up_notification_decay);
mHeadsUpNotificationDecay = Settings.System.getIntForUser(context.getContentResolver(),
Settings.System.HEADS_UP_TIMEOUT,
context.getResources().getInteger(R.integer.heads_up_notification_decay),
UserHandle.USER_CURRENT);
mClock = new Clock();
mSnoozeLengthMs = Settings.Global.getInt(context.getContentResolver(),
@@ -668,6 +672,10 @@ public void updateEntry() {
}
public void updateEntry(boolean updatePostTime) {
mHeadsUpNotificationDecay = Settings.System.getIntForUser(mContext.getContentResolver(),
Settings.System.HEADS_UP_TIMEOUT,
mContext.getResources().getInteger(R.integer.heads_up_notification_decay),
UserHandle.USER_CURRENT);
long currentTime = mClock.currentTimeMillis();
earliestRemovaltime = currentTime + mMinimumDisplayTime;
if (updatePostTime) {

0 comments on commit 9ada62d

Please sign in to comment.