There's a .jar file, I need to change a private method implement in a .class file. That method below
private void vibrate() {
Vibrator vibrator = (Vibrator)RongContext.getInstance().getSystemService("vibrator");
vibrator.vibrate(new long[]{0L, 200L, 250L, 200L}, -1);
}
this private method is invoked by another another private method below
private void notify(Context context, Message message, int left) {
boolean isInBackground = SystemUtils.isInBackground(context);
if(message.getConversationType() != ConversationType.CHATROOM) {
if(isInBackground) {
RongNotificationManager.getInstance().onReceiveMessageFromApp(message);
} else if(!this.isInConversationPager(message.getTargetId(), message.getConversationType()) && left == 0 && System.currentTimeMillis() - this.lastSoundTime > 3000L) {
this.lastSoundTime = System.currentTimeMillis();
int ringerMode = NotificationUtil.getRingerMode(context);
if(ringerMode != 0) {
if(ringerMode != 1) {
this.sound();
}
this.vibrate();
}
}
}
}
I need to surround it with a if-block like this
private void vibrate() {
if(xxx){
Vibrator vibrator = (Vibrator)RongContext.getInstance().getSystemService("vibrator");
vibrator.vibrate(new long[]{0L, 200L, 250L, 200L}, -1);
}
}
so I just wonderred if there is anyway to change the private method implement, like change the method Id use ClassLoader, or something else.
Aucun commentaire:
Enregistrer un commentaire