Permalink
Browse files

Frameworks: follow charging notification settings also for wireless c…

…harging

Originally, system would play a fixed notification sound when wireless
charging starts from com.android.server.power.Notifier.java regardless
of the Charging sounds settings. This removes the notification from
Notifier.java which means the system will notify about wireless charging
in the same (configurable) way as for normal wired charging.

Change-Id: I034fc95f8ac3554ef1d463ac94bebd5a448e1a3f
  • Loading branch information...
piit79 authored and xlxfoxxlx committed Feb 6, 2015
1 parent 7d2f356 commit 7476a40bc7e6050c86eb8876c6c8c59d7ad769d5
Showing with 1 addition and 34 deletions.
  1. +1 −34 services/core/java/com/android/server/power/Notifier.java
@@ -30,10 +30,6 @@
import android.content.Context;
import android.content.Intent;
import android.hardware.input.InputManagerInternal;
import android.media.AudioManager;
import android.media.Ringtone;
import android.media.RingtoneManager;
import android.net.Uri;
import android.os.BatteryStats;
import android.os.Handler;
import android.os.Looper;
@@ -79,8 +75,7 @@
private static final int MSG_USER_ACTIVITY = 1;
private static final int MSG_BROADCAST = 2;
private static final int MSG_WIRELESS_CHARGING_STARTED = 3;
private static final int MSG_SCREEN_BRIGHTNESS_BOOST_CHANGED = 4;
private static final int MSG_SCREEN_BRIGHTNESS_BOOST_CHANGED = 3;
private final Object mLock = new Object();
@@ -547,11 +542,6 @@ public void onWirelessChargingStarted() {
if (DEBUG) {
Slog.d(TAG, "onWirelessChargingStarted");
}
mSuspendBlocker.acquire();
Message msg = mHandler.obtainMessage(MSG_WIRELESS_CHARGING_STARTED);
msg.setAsynchronous(true);
mHandler.sendMessage(msg);
}
private void updatePendingBroadcastLocked() {
@@ -689,25 +679,6 @@ public void onReceive(Context context, Intent intent) {
}
};
private void playWirelessChargingStartedSound() {
final boolean enabled = Settings.Global.getInt(mContext.getContentResolver(),
Settings.Global.CHARGING_SOUNDS_ENABLED, 1) != 0;
final String soundPath = Settings.Global.getString(mContext.getContentResolver(),
Settings.Global.WIRELESS_CHARGING_STARTED_SOUND);
if (enabled && soundPath != null) {
final Uri soundUri = Uri.parse("file://" + soundPath);
if (soundUri != null) {
final Ringtone sfx = RingtoneManager.getRingtone(mContext, soundUri);
if (sfx != null) {
sfx.setStreamType(AudioManager.STREAM_SYSTEM);
sfx.play();
}
}
}
mSuspendBlocker.release();
}
private final class NotifierHandler extends Handler {
public NotifierHandler(Looper looper) {
super(looper, null, true /*async*/);
@@ -723,10 +694,6 @@ public void handleMessage(Message msg) {
case MSG_BROADCAST:
sendNextBroadcast();
break;
case MSG_WIRELESS_CHARGING_STARTED:
playWirelessChargingStartedSound();
break;
case MSG_SCREEN_BRIGHTNESS_BOOST_CHANGED:
sendBrightnessBoostChangedBroadcast();
break;

0 comments on commit 7476a40

Please sign in to comment.