I managed to make it work with the following Google Script.
It's almos the same as @AlEverett's answer, but it never marks as read messages that skipped the inbox entirely (from a filter or something).
Unfortunately, it won't work for you if you tend archive messages very quickly (less then 30 seconds on average).
/** Mark as read archived threads which were previously in the inbox (determined by the label "i"). **/
function cleanAndroidArchived(){
markArchivedAsRead();
labelInboxAsI();
}
function markArchivedAsRead() {
var threads = GmailApp.search('in:unread label:i -label:inbox');
var label = GmailApp.createLabel("i");
label.removeFromThreads(threads);
GmailApp.markThreadsRead(threads);
};
function labelInboxAsI() {
var threads = GmailApp.search('in:unread label:inbox');
var label = GmailApp.createLabel("i");
label.addToThreads(threads);
};