Increase the charging prompt tone and modify the default ringtone

在frameworks\base\services\core\java\com\android\server\power\PowerManagerService.java


First add and listen to the radio

     filter.addAction(Intent.ACTION_BATTERY_CHANGED);
+ filter.addAction("android.hardware.usb.action.USB_STATE");

+ filter.addAction(Intent.ACTION_POWER_CONNECTED);

    filter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY);



Then add in private final class BatteryReceiver extends BroadcastReceiver {Listen to the broadcast method

public void onReceive(Context context, Intent intent) {
           + String action = intent.getAction();
            +android.util.Log.d("lijunwei","BatteryReceiver-----action==="+action);
            synchronized (mLock) {
               + if(action.equals(Intent.ACTION_POWER_CONNECTED)){
                  +  if(null!=mNotifier){
                  +  mNotifier.onWirelessChargingStarted();
                +    }
          +  }    
                handleBatteryStateChangedLocked();
            }
        }

    }

In this way, you can hear the default charging ringtone when you plug in the data cable.


Modify the default ringtone

frameworks\base\data\sounds\Ring_Synth_04.ogg

Replace or add new audio files


Modify the default charging ringtone

frameworks\base\data\sounds\effects\material\ogg\WirelessChargingStarted.ogg

frameworks\base\data\sounds\effects\ogg\WirelessChargingStarted.ogg

Replace or add new audio files


        

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324533400&siteId=291194637