[Verizon Samsung Galaxy S 4] proximous:
Facebook contact photos (from the official Facebook app) are stored with a restricted flag. This seems to prevent some 3rd party apps like Textra and Handcent from displaying them. Some solutions involve installing free or pay apps that sync your Facebook contacts (instead of syncing with the Official Facebook app). Other solutions I've seen involve installing mystery apps from places other then the trusted Play Store. I don't want to install other apps, and I especially don't want to run any mystery applications. I also am rooted so that's not a concern.

The best solution I found meeting my requirements was here:

http://xdaforums.com/showthread.php?t=1639275

with variations at these places:

http://xdaforums.com/showthread.php?t=1570856

http://xdaforums.com/showpost.php?p=24182181&postcount=1259

http://xdaforums.com/showthread.php?t=1061521

Unfortunately, none of these worked for my SCH-i545 running stock 4.2.2. However with a little tinkering I came up with the following. I hope others find it helpful.

1) You need sqlite3. And you need an sqlite3 that was built for 4.2.2 or compatible version. I got mine from here thanks to a post from here.

2) I installed sqlite3 in /system/xbin. You need root for this. I used ES File Explorer. Make sure you enable read/write of /system or your copy/move will fail. Also, change the permissions to rwxrwxrwx (777). Make sure the file name is sqlite3 (not sqlite3-4.1).

3) Paste the code below into a terminal window or use an app like Script Manager. (I don't like to add apps, so I just opened the Terminal Emulator app I installed when rooting, and pasted the code at the prompt.)

/system/xbin/sqlite3 /data/data/com.android.providers.contacts/databases/contacts2.db "CREATE TRIGGER unrestrict_new_data AFTER INSERT ON raw_contacts BEGIN UPDATE raw_contacts SET is_restricted=0 WHERE _id=NEW._id and NEW.is_restricted!=0 and NEW.account_id = (SELECT _id FROM accounts WHERE account_type=('com.facebook.auth.login')); END;CREATE TRIGGER unrestrict_updated_data AFTER UPDATE OF is_restricted ON raw_contacts BEGIN UPDATE raw_contacts SET is_restricted=0 WHERE _id=NEW._id and NEW.is_restricted!=0 and NEW.account_id = (SELECT _id FROM accounts WHERE account_type=('com.facebook.auth.login')); END;UPDATE raw_contacts SET is_restricted=0 WHERE is_restricted!=0 AND account_id = (SELECT _id FROM accounts WHERE account_type=('com.facebook.auth.login'));"

The above code is a modification from the prior links. It seems the database structure has changed a bit, so I had to update the SQL command. I'm only a hack at SQL, so there may be better syntax. The code is my only real contribution since like I said the heavy lifting was done both others in the links above.

As a side note, I did not install libncurses.so like the first reference said...it's not needed for the S4. And if you need to mount /system from a script or command line, use "mount -o remount,rw /system". "sysmount -rw" didn't work for me.

If you want to understand the script (which I did before running), here's a short descriptions.

CREATE TRIGGER unrestrict_new_data AFTER INSERT ON raw_contacts BEGIN UPDATE raw_contacts SET is_restricted=0 WHERE _id=NEW._id and NEW.is_restricted!=0 and NEW.account_id = (SELECT _id FROM accounts WHERE account_type=('com.facebook.auth.login')); END;

This creates a trigger in the database that whenever a new contact is added, if it is from Facebook and restricted, unrestrict it. (You probably could just unrestrict everything, but this seemed safer since it limits the scope of changes.

CREATE TRIGGER unrestrict_updated_data AFTER UPDATE OF is_restricted ON raw_contacts BEGIN UPDATE raw_contacts SET is_restricted=0 WHERE _id=NEW._id and NEW.is_restricted!=0 and NEW.account_id = (SELECT _id FROM accounts WHERE account_type=('com.facebook.auth.login')); END

Same as before, working on database UPDATES as opposed to INSERTS.

UPDATE raw_contacts SET is_restricted=0 WHERE is_restricted!=0 AND account_id = (SELECT _id FROM accounts WHERE account_type=('com.facebook.auth.login'));

This updates contacts already in the database.