Loading packages/SystemUI/src/com/android/systemui/power/PowerUI.java +11 −16 Original line number Diff line number Diff line Loading @@ -24,12 +24,15 @@ import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.database.ContentObserver; import android.media.Ringtone; import android.media.RingtoneManager; import android.net.Uri; import android.os.BatteryManager; import android.os.Handler; import android.os.PowerManager; import android.os.SystemClock; import android.os.UserHandle; import android.os.Vibrator; import android.provider.Settings; import android.util.Log; import android.util.Slog; Loading Loading @@ -249,27 +252,19 @@ public class PowerUI extends SystemUI { final String soundPath = Settings.Global.getString(cr, Settings.Global.POWER_NOTIFICATIONS_RINGTONE); NotificationManager notificationManager = (NotificationManager)mContext.getSystemService(Context.NOTIFICATION_SERVICE); if (notificationManager == null) { return; } Notification powerNotify=new Notification(); powerNotify.defaults = Notification.DEFAULT_ALL; if (soundPath != null) { powerNotify.sound = Uri.parse(soundPath); if (powerNotify.sound != null) { // DEFAULT_SOUND overrides so flip off powerNotify.defaults &= ~Notification.DEFAULT_SOUND; Ringtone powerRingtone = RingtoneManager.getRingtone(mContext, Uri.parse(soundPath)); if (powerRingtone != null) { powerRingtone.play(); } } if (Settings.Global.getInt(cr, Settings.Global.POWER_NOTIFICATIONS_VIBRATE, 0) == 0) { powerNotify.defaults &= ~Notification.DEFAULT_VIBRATE; Settings.Global.POWER_NOTIFICATIONS_VIBRATE, 0) == 1) { Vibrator vibrator = (Vibrator) mContext.getSystemService(Context.VIBRATOR_SERVICE); if (vibrator != null) { vibrator.vibrate(250); } } notificationManager.notify(0, powerNotify); } public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { Loading Loading
packages/SystemUI/src/com/android/systemui/power/PowerUI.java +11 −16 Original line number Diff line number Diff line Loading @@ -24,12 +24,15 @@ import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.database.ContentObserver; import android.media.Ringtone; import android.media.RingtoneManager; import android.net.Uri; import android.os.BatteryManager; import android.os.Handler; import android.os.PowerManager; import android.os.SystemClock; import android.os.UserHandle; import android.os.Vibrator; import android.provider.Settings; import android.util.Log; import android.util.Slog; Loading Loading @@ -249,27 +252,19 @@ public class PowerUI extends SystemUI { final String soundPath = Settings.Global.getString(cr, Settings.Global.POWER_NOTIFICATIONS_RINGTONE); NotificationManager notificationManager = (NotificationManager)mContext.getSystemService(Context.NOTIFICATION_SERVICE); if (notificationManager == null) { return; } Notification powerNotify=new Notification(); powerNotify.defaults = Notification.DEFAULT_ALL; if (soundPath != null) { powerNotify.sound = Uri.parse(soundPath); if (powerNotify.sound != null) { // DEFAULT_SOUND overrides so flip off powerNotify.defaults &= ~Notification.DEFAULT_SOUND; Ringtone powerRingtone = RingtoneManager.getRingtone(mContext, Uri.parse(soundPath)); if (powerRingtone != null) { powerRingtone.play(); } } if (Settings.Global.getInt(cr, Settings.Global.POWER_NOTIFICATIONS_VIBRATE, 0) == 0) { powerNotify.defaults &= ~Notification.DEFAULT_VIBRATE; Settings.Global.POWER_NOTIFICATIONS_VIBRATE, 0) == 1) { Vibrator vibrator = (Vibrator) mContext.getSystemService(Context.VIBRATOR_SERVICE); if (vibrator != null) { vibrator.vibrate(250); } } notificationManager.notify(0, powerNotify); } public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { Loading