diff options
| author | Danny Baumann <dannybaumann@web.de> | 2013-11-07 16:51:36 +0100 |
|---|---|---|
| committer | Altaf-Mahdi <altaf.mahdi@gmail.com> | 2016-10-21 16:15:16 +0100 |
| commit | 423fe45305f1d2d6c785ae341f15ebfc031be3f3 (patch) | |
| tree | 67a0503828fbacfbb328074855b022d0f522251e | |
| parent | c2ae96072767dcfedfffa8d7c41df7afebfbb71b (diff) | |
| download | android_packages_services_Telephony-cm-14.0.tar.gz android_packages_services_Telephony-cm-14.0.tar.bz2 android_packages_services_Telephony-cm-14.0.zip | |
Add back phone notification LED settings backend (2/2)cm-14.0
Also squashed
Telephony : Move light pulse settings to CmSettings
Change-Id: I023890f07968e80515bbef41f1daf05ba85dc651
Change-Id: I1f6834872ac8320e43a0c5d77b1dc8d3654fa99b
| -rw-r--r-- | Android.mk | 3 | ||||
| -rw-r--r-- | src/com/android/phone/NotificationMgr.java | 40 |
2 files changed, 42 insertions, 1 deletions
diff --git a/Android.mk b/Android.mk index 1af633734..92e396ebe 100644 --- a/Android.mk +++ b/Android.mk @@ -12,7 +12,8 @@ res_dirs := res $(phone_common_dir)/res sip/res LOCAL_JAVA_LIBRARIES := telephony-common voip-common ims-common telephony-ext LOCAL_STATIC_JAVA_LIBRARIES := \ guava \ - ims-ext-common + ims-ext-common \ + org.cyanogenmod.platform.sdk LOCAL_SRC_FILES := $(call all-java-files-under, $(src_dirs)) LOCAL_SRC_FILES += \ diff --git a/src/com/android/phone/NotificationMgr.java b/src/com/android/phone/NotificationMgr.java index e4690833f..bd6cce543 100644 --- a/src/com/android/phone/NotificationMgr.java +++ b/src/com/android/phone/NotificationMgr.java @@ -21,6 +21,7 @@ import android.app.NotificationManager; import android.app.PendingIntent; import android.app.StatusBarManager; import android.content.ComponentName; +import android.content.ContentResolver; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; @@ -33,6 +34,7 @@ import android.os.ServiceManager; import android.os.SystemProperties; import android.os.UserHandle; import android.os.UserManager; +import android.provider.Settings; import android.preference.PreferenceManager; import android.provider.ContactsContract.PhoneLookup; import android.telecom.PhoneAccount; @@ -61,6 +63,8 @@ import java.util.Set; import org.codeaurora.internal.IExtTelephony; +import cyanogenmod.providers.CMSettings; + /** * NotificationManager-related utility code for the Phone app. * @@ -87,6 +91,10 @@ public class NotificationMgr { static final int NOTIFICATION_ID_OFFSET = 50; + // notification light default constants + public static final int DEFAULT_COLOR = 0xFFFFFF; //White + public static final int DEFAULT_TIME = 1000; // 1 second + /** The singleton NotificationMgr instance. */ private static NotificationMgr sInstance; @@ -155,6 +163,37 @@ public class NotificationMgr { } } + /** + * Configures a Notification to emit the blinky Voice mail + * signal. + */ + 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; + + // Get 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_VMAIL_COLOR, DEFAULT_COLOR); + notification.ledOnMS = CMSettings.System.getInt(resolver, + CMSettings.System.NOTIFICATION_LIGHT_PULSE_VMAIL_LED_ON, DEFAULT_TIME); + notification.ledOffMS = CMSettings.System.getInt(resolver, + CMSettings.System.NOTIFICATION_LIGHT_PULSE_VMAIL_LED_OFF, DEFAULT_TIME); + } + /** The projection to use when querying the phones table */ static final String[] PHONES_PROJECTION = new String[] { PhoneLookup.NUMBER, @@ -352,6 +391,7 @@ public class NotificationMgr { if (!mUserManager.hasUserRestriction( UserManager.DISALLOW_OUTGOING_CALLS, userHandle) && !user.isManagedProfile()) { + configureLedNotification(mContext, notification); if (!sendNotificationCustomComponent(vmCount, vmNumber, pendingIntent, isSettingsIntent)) { mNotificationManager.notifyAsUser( |
