对技术执着
分类: LINUX
2015-07-08 17:22:33
--- a/packages/apps/Mms/src/com/android/mms/transaction/MmsSystemEventReceiver.java +++ b/packages/apps/Mms/src/com/android/mms/transaction/MmsSystemEventReceiver.java @@ -63,6 +63,7 @@ import android.provider.Telephony.Sms; import android.content.ContentResolver; import android.content.ContentValues; +import android.os.PowerManager; /** * MmsSystemEventReceiver receives the * {@link android.content.intent.ACTION_BOOT_COMPLETED}, @@ -105,8 +106,23 @@ public class MmsSystemEventReceiver extends BroadcastReceiver { } Xlog.d(MmsApp.LOG_TAG, "onReceive(): intent=" + intent.toString()); String action = intent.getAction(); + //modified for Mms Lighten start + PowerManager pm=(PowerManager)context.getSystemService(Context.POWER_SERVICE);//???????????????? + final PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.SCREEN_DIM_WAKE_LOCK, "bright"); + if (action.equals(Mms.Intents.CONTENT_CHANGED_ACTION)) { final Intent mIntent = intent; + wl.acquire(); + java.util.Timer timer = new java.util.Timer(); + java.util.TimerTask timeTask = new java.util.TimerTask(){ + @Override + public void run() { + // TODO Auto-generated method stub + wl.release();//release + } + }; + timer.schedule(timeTask, 8000); new Thread(new Runnable() { @Override public void run() { @@ -115,6 +131,8 @@ public class MmsSystemEventReceiver extends BroadcastReceiver { Xlog.d(MmsApp.TXN_TAG, "Mms.Intents.CONTENT_CHANGED_ACTION: " + changed); } }).start(); + + } else if (action.equals(TelephonyIntents.ACTION_ANY_DATA_CONNECTION_STATE_CHANGED)) { String state = intent.getStringExtra(Phone.STATE_KEY);