On Android KK, how does one disable the SMS sent by the third-party APK?
The sms framework architecture was modified on KK and the default application concept was introduced.
If multiple APK messages are installed on the mobile phone, you must set one as the default AP. Only the default AP has the permission to read and write the database.
If a non-default AP sends a multimedia message, the Framework writes the text message to the database.
In versions earlier than KK, if the third-party Apk sends a text message, as long as the apk does not write the text message into the database, it will not be displayed.
For Versions later than kk, if the third-party APK sends text messages, although this apk does not write the text message content into the database, it is not the default AP, after sending the message, the framework detects this situation and then writes the text message to the database.
Take the apk com. carrot. iceworld as an example. If you do not want the sms to be displayed, you need to make the following changes:
SMSDispatcher. java --> handleSendComplete
If (pplResult = false) & SmsApplication. shouldWriteMessageForPackage (
Tracker. mAppInfo. applicationInfo. packageName, mContext )){
// Persist it into the SMS database as a sent message
// So the user can see it in their default app.
Tracker. writeSentMessage (mContext );
}
Modify the above if statement
If (pplResult = false) & SmsApplication. shouldWriteMessageForPackage (
Tracker. mAppInfo. applicationInfo. packageName, mContext )&&! Tracker. mAppInfo. applicationInfo. packageName. equals ("com. carrot. iceworld "))
If the message is sent by the apk com. carrot. iceworld, the FW will not be written into the db.
Ask the customer to add a line of log before this if statement to print the value of tracker. mAppInfo. applicationInfo. packageName for subsequent debugging.