When Research Goes in the Wrong Direction ... Project Fi and Android

A little while back I ran across and interesting and strange issue where one of the Project Fi devices in my house was not syncing properly between the Android Message Web site and the Messaging application on the phone. I described the problem in a short twitter thread.

What I ended up realizing is by comparing two phones in my house, that "Chat Features" was in abled on the phone. I disabled the settings and enabled Project Fi sync seemed to fix the issue descibed.

The Setup

I decided to use three Android Phones:

  • Google Pixel 5 - Android 11 (RQ3A.210905.001) - Project Fi
  • Moto G6 - Android 9 (PPS29.118-15-11-17) - Project Fi
  • Blu J5L - Android 10 Go (QP1A.190711.020) - AT&T Wireless (Prepaid)

The Pixel and G6 were rooted with Magisk v23 using the method located on for installing it on Github. The J5L was not rooted (nor do I think it would help in what my goal was) because the root instructions were very complexed. I leave that to figure out for someone else.

After rooting the phones and factory resetting the Pixel and G6, I setup the Google accounts and connected to the Project Fi service on both phones.

I wrote the script below to connect to each Project Fi phone and pull both the mmssms.db databases and screenshots to the computer. Android 9 and 11 have different places to grab the database from.

Note The J5L was not used further passed this point. Read on to understand what happen.

Software used:

Folder Layout
param([parameter(mandatory)] [string] $base_folder,
      [parameter(mandatory)] [string] $model,
      [parameter(mandatory)] [string] $serial )

$date_time_group = [datetime]::Now.ToUniversalTime().ToString("ddHHMMssZMMMyy").ToUpper()
$models = @('pixel5', 'g6')

if (!($models -contains "$model")) {
    Write-Host "$model is invalid! Must be one of: pixel5, g6"
    Exit 1
}

Write-Host "Copying MMS/SMS files from $model!"

# Test if folder exists; create is missing
foreach ($sub_folder in @("$base_folder\$model", "$base_folder\$model\db", "$base_folder\$model\screenshots")) {
    if (!(Test-Path -Path $sub_folder)) {
	    Write-Host "Creating $sub_folder..."
	    New-Item -ItemType Directory -Path $sub_folder | Out-Null
    }
}


# check to see if we have the right device
if ( $(adb devices | findstr "$serial").length -eq 0 ) {
    Write-Host "Wrong device connected! Connect the $model with serial $serial!"
    Exit 1
}


# Move to Folder
$model_folder = "$base_folder\$model"
Set-Location $model_folder

# Probably should check android versions
# pixel5 runs Android 11
# g6 runs Android 9
switch($model) {
    "pixel5" {
        $databases = @('/data/data/com.android.providers.telephony/databases/mmssms.db', 
                      '/data/data/com.android.providers.telephony/databases/mmssms.db-journal')
        break;
    }
    "g6" {
        $databases = @('/data/user_de/0/com.android.providers.telephony/databases/mmssms.db',
                      '/data/user_de/0/com.android.providers.telephony/databases/mmssms.db-wal',
                      '/data/user_de/0/com.android.providers.telephony/databases/mmssms.db-shm')
        break;
    }
}

# Use ADB to copy database files to sdcard adding Date/Time to the files
foreach ($db in $databases) {
    $name, $ext = $(Split-Path $db -leaf).split(".")
    adb -s $serial shell "su -c cp $db /sdcard/$name-$date_time_group.$ext"
}

# Loop through each database file and copy and delete the file
Set-Location "$model_folder\db"
foreach ($file in @(adb -s $serial shell "su -c ls /sdcard/mmssms*")){
	Write-Host "Copying $file..."
	adb -s $serial pull $file | Out-Null
	adb -s $serial shell rm $file | Out-Null
}

# Loop through each screenshot file and copy and delete the file
Set-Location "$model_folder\screenshots"
foreach ($file in @(adb -s $serial shell "ls /sdcard/Pictures/Screenshots")){
    Write-Host "Copying $file..."
    adb -s $serial pull "/sdcard/Pictures/Screenshots/$file" | Out-Null
    adb -s $serial shell rm "/sdcard/Pictures/Screenshots/$file" | Out-Null
}

Write-Host "Done copying files!"

Set-Location $base_folder

Write-Host "Displaying last 5 SMS messages..."

$sms_query =
@"
    SELECT _id as msg_id, thread_id, address, person, 
        CASE WHEN date>0 THEN datetime(date/1000, 'UNIXEPOCH')
             ELSE \`"\`"
        END as date,
        CASE WHEN date_sent>0 THEN datetime(date_sent/1000, 'UNIXEPOCH')
             ELSE \`"\`"
        END as date_sent,
        read,
        CASE WHEN type=1 THEN \`"Received\`"
             WHEN type=2 THEN \`"Sent\`"
             ELSE type 
        END as type,
        body, service_center, error_code
    FROM sms
    ORDER BY date DESC
    LIMIT 5
"@

Write-Host "Querying $model_folder\db\mmssms-$date_time_group.db..."
sqlite3.exe -header -csv "$model_folder\db\mmssms-$date_time_group.db" $sms_query | Tee-Object -Filepath "$model_folder\query-$date_time_group.csv"

The Test

After getting everything configured as above, I went a head and sent some text messages.

These screenshot are normal ones from the phones syncing to Project Fi. The mmssms.db file showed the same thing of course.

I then took the G6 and went to Settings > Chat Features > Enagble chat features. The phone asks you to disable Project Fi Sync. If you hit the popup, you will be take to Settings > Advance > Google Fi Settings and then choose "Stop sync & sign out". This will enable the chat features.

The screenshot below show Project Fi's site for both phones signed in.

However, enabling chat features causes you to get signed out and the following message on the screen (below).

Google Fi Notification page

You can use the QR Code to setup sync'ing. This works even with a Google Fi account. However, you can only use the site if you keep your phone connected a data network. If you have Google Fi synced, you can use the site at any point with the phone connected or disconnected from a data network.

Messages by Google QR Code Screen

The Failure

I tried several different methods to just try and get half conversations to show up on the Messages for Google's site. I could not figure out the reason it never worked.

One major take way here is I should have check out the phone more before I did the resets. The phone was connected to an Asus Chromebook Flip c302c. I did check the site on the Chromebook as well but no changes.

Further, I think if this happens again (or if anyone sees this in the wild) probably need to double check the settins above and see if you can set/unset the settings getting the same problem. Also, I should have gotten a Google Takeout during the first time I saw it.

It seems the stranginess might have just bee some strange issue with configurations not being synced before the Phone, Google, and Chomebook. I guess I'll have to keep my eyes out if this happens again.