c.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // 043001RC00
  2. class Log {
  3. static TAG = '[SMS]'
  4. static Debug = true
  5. static format(...msg) {
  6. let m = []
  7. for (let i = 0; i < msg.length; i++) {
  8. if (typeof msg[i] === 'object') {
  9. m.push(JSON.stringify(msg[i]))
  10. } else {
  11. m.push(msg[i])
  12. }
  13. }
  14. m = m.join(' ')
  15. return m
  16. }
  17. static i(...msg) {
  18. if (!this.Debug) return
  19. console.log(`\x1b[30m${this.TAG} ${this.format(...msg)}\x1b[0m`)
  20. }
  21. static w(...msg) {
  22. console.log(`\x1b[33m${this.TAG} ${this.format(...msg)}\x1b[0m`)
  23. }
  24. static e(...msg) {
  25. console.log(`\x1b[31m${this.TAG} ${this.format(...msg)}\x1b[0m`)
  26. }
  27. static s(...msg) {
  28. console.log(`\x1b[32m${this.TAG} ${this.format(...msg)}\x1b[0m`)
  29. }
  30. }
  31. function trace(tag) {
  32. Log.e((tag || '') + Java.use('android.util.Log').getStackTraceString(Java.use('java.lang.Throwable').$new()))
  33. }
  34. setImmediate(() => {
  35. Java.perform(function () {
  36. const contentResolver = Java.use('android.content.ContentResolver')
  37. contentResolver.update.overload(
  38. 'android.net.Uri',
  39. 'android.content.ContentValues',
  40. 'java.lang.String',
  41. '[Ljava.lang.String;'
  42. ).implementation = function (uri, values, selection, selectionArgs) {
  43. Log.s(
  44. `contentResolver.update(uri=${uri}, values=${values}, selection=${selection}, selectionArgs=${selectionArgs})`
  45. )
  46. const res = this.update(uri, values, selection, selectionArgs)
  47. Log.s(res)
  48. return res
  49. }
  50. })
  51. }, 0)