diff options
author | Danny Baumann <dannybaumann@web.de> | 2015-01-15 04:36:29 +0000 |
---|---|---|
committer | Altaf-Mahdi <altaf.mahdi@gmail.com> | 2016-10-21 16:12:20 +0100 |
commit | 5566789a845a5ab0b4906d1c90d88c870787d473 (patch) | |
tree | 9d486d302985b4ae52389bc470311ecb50f28e79 | |
parent | 14ebde118fa694b4e2af9eb7b18dbcc00e951f3f (diff) | |
download | android_packages_services_Telecomm-cm-14.0.tar.gz android_packages_services_Telecomm-cm-14.0.tar.bz2 android_packages_services_Telecomm-cm-14.0.zip |
Add back phone notification LED settings backend (1/2)cm-14.0
Also squashed
Telecomm : Move light pulse settings to CmSettings
Change-Id: I169c5ae810b47e8f1101fe993d159f50b9eaa6bd
Change-Id: I1f6834872ac8320e43a0c5d77b1dc8d3654fa99b
-rw-r--r-- | Android.mk | 4 | ||||
-rw-r--r-- | src/com/android/server/telecom/ui/MissedCallNotifierImpl.java | 38 |
2 files changed, 37 insertions, 5 deletions
@@ -4,7 +4,9 @@ LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) LOCAL_JAVA_LIBRARIES := telephony-common telephony-ext ims-common -LOCAL_STATIC_JAVA_LIBRARIES := ims-ext-common +LOCAL_STATIC_JAVA_LIBRARIES := \ + ims-ext-common \ + org.cyanogenmod.platform.sdk LOCAL_SRC_FILES := $(call all-java-files-under, src) LOCAL_SRC_FILES += \ diff --git a/src/com/android/server/telecom/ui/MissedCallNotifierImpl.java b/src/com/android/server/telecom/ui/MissedCallNotifierImpl.java index 0bed9818..7600a696 100644 --- a/src/com/android/server/telecom/ui/MissedCallNotifierImpl.java +++ b/src/com/android/server/telecom/ui/MissedCallNotifierImpl.java @@ -46,6 +46,7 @@ import android.app.NotificationManager; import android.app.PendingIntent; import android.app.TaskStackBuilder; import android.content.AsyncQueryHandler; +import android.content.ContentResolver; import android.content.ContentValues; import android.content.Context; import android.content.Intent; @@ -55,6 +56,7 @@ import android.graphics.Bitmap; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.net.Uri; +import android.provider.Settings; import android.os.AsyncTask; import android.os.Binder; import android.os.UserHandle; @@ -78,6 +80,8 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.atomic.AtomicInteger; +import cyanogenmod.providers.CMSettings; + // TODO: Needed for move to system service: import com.android.internal.R; /** @@ -128,6 +132,10 @@ public class MissedCallNotifierImpl extends CallsManagerListenerBase implements private static final int MISSED_CALL_NOTIFICATION_ID = 1; + // notification light default constants + public static final int DEFAULT_COLOR = 0xFFFFFF; //White + public static final int DEFAULT_TIME = 1000; // 1 second + private final Context mContext; private final PhoneAccountRegistrar mPhoneAccountRegistrar; private final NotificationManager mNotificationManager; @@ -395,7 +403,7 @@ public class MissedCallNotifierImpl extends CallsManagerListenerBase implements } Notification notification = builder.build(); - configureLedOnNotification(notification); + configureLedNotification(mContext, notification); Log.i(this, "Adding missed call notification for %s.", call); long token = Binder.clearCallingIdentity(); @@ -546,11 +554,33 @@ public class MissedCallNotifierImpl extends CallsManagerListenerBase implements } /** - * Configures a notification to emit the blinky notification light. + * Configures a Notification to emit the blinky message-waiting/ + * missed-call signal. */ - private void configureLedOnNotification(Notification notification) { + private static void configureLedNotification(Context context, Notification notification) { + ContentResolver resolver = context.getContentResolver(); + + boolean lightEnabled = Settings.System.getInt(resolver, + Settings.System.NOTIFICATION_LIGHT_PULSE, 0) == 1; + if (!lightEnabled) { + return; + } notification.flags |= Notification.FLAG_SHOW_LIGHTS; - notification.defaults |= Notification.DEFAULT_LIGHTS; + + // Get Missed call and Voice mail values if they are to be used + boolean customEnabled = CMSettings.System.getInt(resolver, + CMSettings.System.NOTIFICATION_LIGHT_PULSE_CUSTOM_ENABLE, 0) == 1; + if (!customEnabled) { + notification.defaults |= Notification.DEFAULT_LIGHTS; + return; + } + + notification.ledARGB = CMSettings.System.getInt(resolver, + CMSettings.System.NOTIFICATION_LIGHT_PULSE_CALL_COLOR, DEFAULT_COLOR); + notification.ledOnMS = CMSettings.System.getInt(resolver, + CMSettings.System.NOTIFICATION_LIGHT_PULSE_CALL_LED_ON, DEFAULT_TIME); + notification.ledOffMS = CMSettings.System.getInt(resolver, + CMSettings.System.NOTIFICATION_LIGHT_PULSE_CALL_LED_OFF, DEFAULT_TIME); } private boolean canRespondViaSms(Call call) { |